[Mesa-dev] [PATCH 2/2] gallium/radeon: use max_alloc_size

Vedran Miletić vedran at miletic.net
Fri Jul 1 11:45:49 UTC 2016


On 07/01/2016 11:11 AM, Marek Olšák wrote:
> On Fri, Jul 1, 2016 at 10:54 AM, Marek Olšák <maraeo at gmail.com> wrote:
>> On Fri, Jul 1, 2016 at 2:52 AM, Vedran Miletić <vedran at miletic.net> wrote:
>>> On 07/01/2016 01:29 AM, Marek Olšák wrote:
>>>>
>>>> From: Marek Olšák <marek.olsak at amd.com>
>>>>
>>>> also fix max_global_size to take a maximum of {vram_size, gart_size}
>>>> ---
>>>>  src/gallium/drivers/r600/r600_pipe.c          | 2 +-
>>>>  src/gallium/drivers/radeon/r600_pipe_common.c | 9 +++------
>>>>  src/gallium/drivers/radeonsi/si_pipe.c        | 2 +-
>>>>  3 files changed, 5 insertions(+), 8 deletions(-)
>>>>
>>>> diff --git a/src/gallium/drivers/r600/r600_pipe.c
>>>> b/src/gallium/drivers/r600/r600_pipe.c
>>>> index 119c76b..55bbde1 100644
>>>> --- a/src/gallium/drivers/r600/r600_pipe.c
>>>> +++ b/src/gallium/drivers/r600/r600_pipe.c
>>>> @@ -301,7 +301,7 @@ static int r600_get_param(struct pipe_screen* pscreen,
>>>> enum pipe_cap param)
>>>>                 return 0;
>>>>
>>>>         case PIPE_CAP_MAX_TEXTURE_BUFFER_SIZE:
>>>> -               return MIN2(rscreen->b.info.vram_size, 0xFFFFFFFF);
>>>> +               return MIN2(rscreen->b.info.max_alloc_size, 0xFFFFFFFF);
>>>>
>>>>          case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT:
>>>>                  return R600_MAP_BUFFER_ALIGNMENT;
>>>> diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c
>>>> b/src/gallium/drivers/radeon/r600_pipe_common.c
>>>> index d7f1d41..f75fa6c 100644
>>>> --- a/src/gallium/drivers/radeon/r600_pipe_common.c
>>>> +++ b/src/gallium/drivers/radeon/r600_pipe_common.c
>>>> @@ -864,8 +864,8 @@ static int r600_get_compute_param(struct pipe_screen
>>>> *screen,
>>>>                          * 4 * MAX_MEM_ALLOC_SIZE.
>>>>                          */
>>>>                         *max_global_size = MIN2(4 * max_mem_alloc_size,
>>>> -                               rscreen->info.gart_size +
>>>> -                               rscreen->info.vram_size);
>>>> +
>>>> MAX2(rscreen->info.gart_size,
>>>> +
>>>> rscreen->info.vram_size));
>>>
>>>
>>> Can't you also use info.max_alloc_size here?
>>
>> I can do *max_global_size = max_alloc_size; Does that sound good?
>
> Even if max_alloc_size can be 256 MB?
>
> Marek
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>

How about

*max_global_size = MIN2(4 * max_mem_alloc_size,
                         rscreen->info.max_alloc_size);

Would that work? That avoids calculating the same value in two distinct 
places, since rscreen->info.max_alloc_size = 
MAX2(rscreen->info.gart_size, rscreen->info.vram_size) for both radeon 
and amdgpu.

Regards,
Vedran

-- 
Vedran Miletić
vedran.miletic.net


More information about the mesa-dev mailing list