iris: Replace aperture_bytes by sram size in iris_resource_create_for_image() for PIPE_USAGE_STAGING

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 <jose.souza@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Ack-by: Rohan Garg <rohan.garg@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22969>
This commit is contained in:
José Roberto de Souza
2023-05-09 10:28:07 -07:00
committed by Marge Bot
parent 88ca89bea9
commit 6875f97618
+3 -3
View File
@@ -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))