[Mesa-dev] [PATCH 2/2] gallium/radeon: use max_alloc_size
Marek Olšák
maraeo at gmail.com
Fri Jul 1 08:54:03 UTC 2016
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?
>
>> }
>> return sizeof(uint64_t);
>>
>> @@ -889,10 +889,7 @@ static int r600_get_compute_param(struct pipe_screen
>> *screen,
>> if (ret) {
>> uint64_t *max_mem_alloc_size = ret;
>>
>> - /* XXX: The limit in older kernels is 256 MB. We
>> - * should add a query here for newer kernels.
>> - */
>> - *max_mem_alloc_size = 256 * 1024 * 1024;
>> + *max_mem_alloc_size =
>> rscreen->info.max_alloc_size;
>> }
>> return sizeof(uint64_t);
>>
>> diff --git a/src/gallium/drivers/radeonsi/si_pipe.c
>> b/src/gallium/drivers/radeonsi/si_pipe.c
>> index ad2a86a..30e6253 100644
>> --- a/src/gallium/drivers/radeonsi/si_pipe.c
>> +++ b/src/gallium/drivers/radeonsi/si_pipe.c
>> @@ -419,7 +419,7 @@ static int si_get_param(struct pipe_screen* pscreen,
>> enum pipe_cap param)
>> HAVE_LLVM >= 0x0307 ? 410 : 330;
>>
>> case PIPE_CAP_MAX_TEXTURE_BUFFER_SIZE:
>> - return MIN2(sscreen->b.info.vram_size, 0xFFFFFFFF);
>> + return MIN2(sscreen->b.info.max_alloc_size, 0xFFFFFFFF);
>>
>> case PIPE_CAP_BUFFER_SAMPLER_VIEW_RGBA_ONLY:
>> return 0;
>>
>
> Had something similar in the works, Bas did as well, but this approach is
> cleaner.
>
> With these changes, in si_pipe.c and r600_pipe.c, you should not return
> max_const_buffer_size anymore, since it can exceed int limits, but instead
> something like
>
> MAX2(0x7ffffff, max_const_buffer_size)
Good point. I'll fix that.
Marek
More information about the mesa-dev
mailing list