crocus: don't create staging resources > half aperture

The theory here is that a staging resource will need to be transferred
into or out of a non-staging resource. If the staging resource is too
big for 1/2 aperture threshold, then it the corresponding non-stage
resource will be similiarly sized. This means there's no hope of fitting
both of them in.

This will cause the st blit transfer path to fall back and allow
max-texture-size to pass.

Fixes piglit max-texture-size

Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14347>
This commit is contained in:
Dave Airlie
2021-12-30 11:52:32 +10:00
parent d8a38edc48
commit f1c1fcfdce
4 changed files with 12 additions and 4 deletions

View File

@@ -39,9 +39,6 @@ spec@!opengl 1.1@linestipple@Factor 3x,Fail
spec@!opengl 1.1@linestipple@Line loop,Fail
spec@!opengl 1.1@linestipple@Line strip,Fail
# max-texture-size: ../src/gallium/drivers/crocus/crocus_resource.c:693: crocus_resource_create_with_modifiers: Assertion `isl_surf_created_successfully' failed.
spec@!opengl 1.1@max-texture-size,Crash
spec@!opengl 3.0@clearbuffer-bug,Fail
# "../src/mesa/state_tracker/st_cb_texture.c:1164:st_get_blit_mask: Assertion `0' failed."

View File

@@ -254,6 +254,15 @@ crocus_resource_configure_main(const struct crocus_screen *screen,
if (!isl_surf_init_s(&screen->isl_dev, &res->surf, &init_info))
return false;
/*
* Don't create staging surfaces that will use > half the aperture
* since staging implies you are sending to another resource,
* which there is no way to fit both into aperture.
*/
if (templ->usage == PIPE_USAGE_STAGING)
if (res->surf.size_B > screen->aperture_threshold / 2)
return false;
res->internal_format = templ->format;
return true;

View File

@@ -351,7 +351,7 @@ crocus_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
* flushing, etc. That's the big cliff apps will care about.
*/
const unsigned gpu_mappable_megabytes =
(screen->aperture_bytes * 3 / 4) / (1024 * 1024);
(screen->aperture_threshold) / (1024 * 1024);
const long system_memory_pages = sysconf(_SC_PHYS_PAGES);
const long system_page_size = sysconf(_SC_PAGE_SIZE);
@@ -743,6 +743,7 @@ crocus_screen_create(int fd, const struct pipe_screen_config *config)
p_atomic_set(&screen->refcount, 1);
screen->aperture_bytes = get_aperture_size(fd);
screen->aperture_threshold = screen->aperture_bytes * 3 / 4;
driParseConfigFiles(config->options, config->options_info, 0, "crocus",
NULL, NULL, NULL, 0, NULL, 0);

View File

@@ -202,6 +202,7 @@ struct crocus_screen {
} driconf;
uint64_t aperture_bytes;
uint64_t aperture_threshold;
struct intel_device_info devinfo;
struct isl_device isl_dev;