gallium: add PIPE_CAP_MAX_TEXTURE_MB

Allows driver to override the default value (1024) from mesa.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6754>
This commit is contained in:
Pierre-Eric Pelloux-Prayer
2020-09-14 10:49:29 +02:00
parent 2228835fb5
commit fc6df020e3
5 changed files with 7 additions and 2 deletions

View File

@@ -591,6 +591,7 @@ The integer capabilities:
* ``PIPE_CAP_BLEND_EQUATION_ADVANCED``: Driver supports blend equation advanced without necessarily supporting FBFETCH.
* ``PIPE_CAP_NIR_ATOMICS_AS_DEREF``: Whether NIR atomics instructions should reference atomics as NIR derefs instead of by indices.
* ``PIPE_CAP_NO_CLIP_ON_COPY_TEX``: Driver doesn't want x/y/width/height clipped based on src size when doing a copy texture operation (eg: may want out-of-bounds reads that produce 0 instead of leaving the texture content undefined)
* ``PIPE_CAP_MAX_TEXTURE_MB``: Maximum texture size in MB (default is 1024)
.. _pipe_capf:

View File

@@ -436,9 +436,8 @@ u_pipe_screen_get_param_defaults(struct pipe_screen *pscreen,
case PIPE_CAP_SYSTEM_SVM:
case PIPE_CAP_ALPHA_TO_COVERAGE_DITHER_CONTROL:
return 0;
case PIPE_CAP_NO_CLIP_ON_COPY_TEX:
case PIPE_CAP_MAX_TEXTURE_MB:
return 0;
default:

View File

@@ -216,6 +216,8 @@ static int si_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
case PIPE_CAP_MAX_SHADER_BUFFER_SIZE:
/* Align it down to 256 bytes. I've chosen the number randomly. */
return ROUND_DOWN_TO(MIN2(sscreen->info.max_alloc_size, INT_MAX), 256);
case PIPE_CAP_MAX_TEXTURE_MB:
return sscreen->info.max_alloc_size / (1024 * 1024);
case PIPE_CAP_VERTEX_BUFFER_OFFSET_4BYTE_ALIGNED_ONLY:
case PIPE_CAP_VERTEX_BUFFER_STRIDE_4BYTE_ALIGNED_ONLY:

View File

@@ -967,6 +967,7 @@ enum pipe_cap
PIPE_CAP_BLEND_EQUATION_ADVANCED,
PIPE_CAP_NIR_ATOMICS_AS_DEREF,
PIPE_CAP_NO_CLIP_ON_COPY_TEX,
PIPE_CAP_MAX_TEXTURE_MB,
};
/**

View File

@@ -87,6 +87,8 @@ void st_init_limits(struct pipe_screen *screen,
c->MaxTextureSize = screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_2D_SIZE);
c->MaxTextureSize = MIN2(c->MaxTextureSize, 1 << (MAX_TEXTURE_LEVELS - 1));
c->MaxTextureMbytes = MAX2(c->MaxTextureMbytes,
screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_MB));
c->Max3DTextureLevels
= _min(screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_3D_LEVELS),