Module: Mesa
Branch: staging/21.3
Commit: cd9c4eeefc9dc281b9809b504b5a957f40372b4b
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=cd9c4eeefc9dc281b9809b504b5a957f40372b4b

Author: Dave Airlie <[email protected]>
Date:   Wed Dec 29 17:32:12 2021 +1000

crocus: fail resource allocation properly.

Older gens have a limit of 2GB on surfaces, this results in
isl_surf_init_s failing if the surface exceeds that, in this
case this should fail all the way back up the stack.

This fixes some cases of max-texture-size on crocus

Fixes: f3630548f1da ("crocus: initial gallium driver for Intel gfx 4-7")

Reviewed-by: Emma Anholt <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14347>
(cherry picked from commit d8a38edc48e5567e5f0205b7347761e3d05a4bda)

---

 .pick_status.json                            | 2 +-
 src/gallium/drivers/crocus/crocus_resource.c | 5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 0ac9cd51760..4f2053672c6 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -733,7 +733,7 @@
         "description": "crocus: fail resource allocation properly.",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": "f3630548f1da904ec6c63b43ece7e68afdb8867e"
     },
diff --git a/src/gallium/drivers/crocus/crocus_resource.c 
b/src/gallium/drivers/crocus/crocus_resource.c
index 51dcc921cfd..69ebd919ef6 100644
--- a/src/gallium/drivers/crocus/crocus_resource.c
+++ b/src/gallium/drivers/crocus/crocus_resource.c
@@ -688,9 +688,10 @@ crocus_resource_create_with_modifiers(struct pipe_screen 
*pscreen,
        devinfo->ver < 6)
       return NULL;
 
-   UNUSED const bool isl_surf_created_successfully =
+   const bool isl_surf_created_successfully =
       crocus_resource_configure_main(screen, res, templ, modifier, 0);
-   assert(isl_surf_created_successfully);
+   if (!isl_surf_created_successfully)
+      return NULL;
 
    const char *name = "miptree";
 

Reply via email to