Module: Mesa
Branch: main
Commit: 6875f97618bc82fcf7315ae22d8ab91e082d3924
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6875f97618bc82fcf7315ae22d8ab91e082d3924

Author: José Roberto de Souza <[email protected]>
Date:   Tue May  9 10:28:07 2023 -0700

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 <[email protected]>
Reviewed-by: Lionel Landwerlin <[email protected]>
Ack-by: Rohan Garg <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22969>

---

 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))

Reply via email to