From 6875f97618bc82fcf7315ae22d8ab91e082d3924 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Roberto=20de=20Souza?= Date: Tue, 9 May 2023 10:28:07 -0700 Subject: [PATCH] iris: Replace aperture_bytes by sram size in iris_resource_create_for_image() for PIPE_USAGE_STAGING MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit All platforms supported by Iris will have aperture_bytes set as 4Gb. Also this value is not the actual aperture in i915, it actualy is the GGTT size. So here replacing it by the sram size, something that will vary depending in the amount of RAM available. This fix some tests with Xe KMD, as it is not setting aperture_bytes. And will not do that as there is no UAPI to fetch this information and it is not planned to it to Xe UAPI. Signed-off-by: José Roberto de Souza Reviewed-by: Lionel Landwerlin Ack-by: Rohan Garg Part-of: --- src/gallium/drivers/iris/iris_resource.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/iris/iris_resource.c b/src/gallium/drivers/iris/iris_resource.c index bf2dff289a4..8be3695e404 100644 --- a/src/gallium/drivers/iris/iris_resource.c +++ b/src/gallium/drivers/iris/iris_resource.c @@ -1197,16 +1197,16 @@ iris_resource_create_for_image(struct pipe_screen *pscreen, if (!isl_surf_created_successfully) goto fail; - /* Don't create staging surfaces that will use over half the aperture, + /* Don't create staging surfaces that will use over half the sram, * since staging implies you are copying data to another resource that's - * at least as large, and then both wouldn't fit in the aperture. + * at least as large, and then both wouldn't fit in system memory. * * Skip this for discrete cards, as the destination buffer might be in * device local memory while the staging buffer would be in system memory, * so both would fit. */ if (templ->usage == PIPE_USAGE_STAGING && !devinfo->has_local_mem && - res->surf.size_B > devinfo->aperture_bytes / 2) + res->surf.size_B > (iris_bufmgr_sram_size(screen->bufmgr) / 2)) goto fail; if (!iris_resource_configure_aux(screen, res, false))