Module: Mesa
Branch: master
Commit: 3c0ba7b1802bf231ef3f0a7bdbeb474be99a2aed
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3c0ba7b1802bf231ef3f0a7bdbeb474be99a2aed

Author: Erik Faye-Lund <erik.faye-l...@collabora.com>
Date:   Mon Oct 19 11:17:30 2020 +0200

zink: reject resource-imports with modifiers

Zink doesn't support forwarding DRM modifiers yet, so whenever those are
used, we end up ignoring them. That's not going to do the right thing in
most cases, so let's reject them instead.

Since d686835171c, the dri2 code tries to create a 0x0 surface without
any format when trying to import. This makes this go from
rendering-issues to asserting in debug builds, making things even worse.

Fixes: d686835171c ("gallium/dri2: Support I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS 
import")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3654
Reviewed-by: Daniel Stone <dani...@collabora.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkra...@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7214>

---

 src/gallium/drivers/zink/zink_resource.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/gallium/drivers/zink/zink_resource.c 
b/src/gallium/drivers/zink/zink_resource.c
index e53e941ed33..88bc347ad6b 100644
--- a/src/gallium/drivers/zink/zink_resource.c
+++ b/src/gallium/drivers/zink/zink_resource.c
@@ -36,6 +36,8 @@
 
 #include "frontend/sw_winsys.h"
 
+#include "drm-uapi/drm_fourcc.h"
+
 static void
 zink_resource_destroy(struct pipe_screen *pscreen,
                       struct pipe_resource *pres)
@@ -339,6 +341,7 @@ zink_resource_get_handle(struct pipe_screen *pscreen,
       if (result != VK_SUCCESS)
          return false;
       whandle->handle = fd;
+      whandle->modifier = DRM_FORMAT_MOD_INVALID;
    }
    return true;
 }
@@ -349,6 +352,9 @@ zink_resource_from_handle(struct pipe_screen *pscreen,
                  struct winsys_handle *whandle,
                  unsigned usage)
 {
+   if (whandle->modifier != DRM_FORMAT_MOD_INVALID)
+      return NULL;
+
    return resource_create(pscreen, templ, whandle, usage);
 }
 

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to