Mesa (main): panfrost: fail in get_handle(TYPE_KMS) without a scanout resource

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Jul 29 19:32:26 UTC 2021


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

Author: Simon Ser <contact at emersion.fr>
Date:   Tue Jul 27 08:59:52 2021 +0200

panfrost: fail in get_handle(TYPE_KMS) without a scanout resource

The previous logic was returning a handle valid for the render-only
device if rsc->scanout was NULL. However the caller doesn't expect
this: the caller will use the handle with the KMS device.

Instead of returning a handle for the wrong device, fail if we don't
have one.

Signed-off-by: Simon Ser <contact at emersion.fr>
Reviewed-by: Daniel Stone <daniels at collabora.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12074>

---

 src/gallium/drivers/panfrost/pan_resource.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/gallium/drivers/panfrost/pan_resource.c b/src/gallium/drivers/panfrost/pan_resource.c
index 678977ad474..59140578097 100644
--- a/src/gallium/drivers/panfrost/pan_resource.c
+++ b/src/gallium/drivers/panfrost/pan_resource.c
@@ -144,13 +144,14 @@ panfrost_resource_get_handle(struct pipe_screen *pscreen,
         if (handle->type == WINSYS_HANDLE_TYPE_SHARED) {
                 return false;
         } else if (handle->type == WINSYS_HANDLE_TYPE_KMS) {
-                if (renderonly_get_handle(scanout, handle))
+                if (dev->ro) {
+                        return renderonly_get_handle(scanout, handle);
+                } else {
+                        handle->handle = rsrc->image.data.bo->gem_handle;
+                        handle->stride = rsrc->image.layout.slices[0].line_stride;
+                        handle->offset = rsrc->image.layout.slices[0].offset;
                         return true;
-
-                handle->handle = rsrc->image.data.bo->gem_handle;
-                handle->stride = rsrc->image.layout.slices[0].line_stride;
-                handle->offset = rsrc->image.layout.slices[0].offset;
-                return TRUE;
+                }
         } else if (handle->type == WINSYS_HANDLE_TYPE_FD) {
                 if (scanout) {
                         struct drm_prime_handle args = {



More information about the mesa-commit mailing list