Mesa (staging/18.3): vc4: Make sure we make ro scanout resources for create_with_modifiers.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Nov 16 12:05:12 UTC 2018


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

Author: Eric Anholt <eric at anholt.net>
Date:   Thu Oct 25 09:12:50 2018 -0700

vc4: Make sure we make ro scanout resources for create_with_modifiers.

The DRI3 create_with_modifiers paths don't set tmpl.bind to SCANOUT or
SHARED, with the theory that given that you've got modifiers, that's all
you need.  However, we were looking at the tmpl.bind for setting up the
KMS handle in the renderonly case, so we'd end up trying to use vc4's
handle on the hx8357d fd.

Fixes: 84ed8b67c56b ("vc4: Set shareable BOs as T tiled if possible")
(cherry picked from commit cc0bc76a382f908b4412ee8ab7a8409766ecf16a)

---

 src/gallium/drivers/vc4/vc4_resource.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/vc4/vc4_resource.c b/src/gallium/drivers/vc4/vc4_resource.c
index 94784bbdc0..41e6ec5c1c 100644
--- a/src/gallium/drivers/vc4/vc4_resource.c
+++ b/src/gallium/drivers/vc4/vc4_resource.c
@@ -572,7 +572,15 @@ vc4_resource_create_with_modifiers(struct pipe_screen *pscreen,
                         goto fail;
         }
 
-        if (screen->ro && tmpl->bind & PIPE_BIND_SCANOUT) {
+        /* Set up the "scanout resource" (the dmabuf export of our buffer to
+         * the KMS handle) if the buffer might ever have
+         * resource_get_handle(WINSYS_HANDLE_TYPE_KMS) called on it.
+         * create_with_modifiers() doesn't give us usage flags, so we have to
+         * assume that all calls with modifiers are scanout-possible.
+         */
+        if (screen->ro &&
+            ((tmpl->bind & PIPE_BIND_SCANOUT) ||
+             !(count == 1 && modifiers[0] == DRM_FORMAT_MOD_INVALID))) {
                 rsc->scanout =
                         renderonly_scanout_for_resource(prsc, screen->ro, NULL);
                 if (!rsc->scanout)




More information about the mesa-commit mailing list