From 4bb8e29a28c9e2bf796da233183dd3a32a86c640 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Tue, 27 Jul 2021 08:59:52 +0200 Subject: [PATCH] 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 Reviewed-by: Daniel Stone Cc: mesa-stable Part-of: (cherry picked from commit 4c092947df308f20e288bb5baf50bff181e5d3fa) --- .pick_status.json | 2 +- src/gallium/drivers/panfrost/pan_resource.c | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index a361140789d..421259755dd 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -256,7 +256,7 @@ "description": "panfrost: fail in get_handle(TYPE_KMS) without a scanout resource", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null }, diff --git a/src/gallium/drivers/panfrost/pan_resource.c b/src/gallium/drivers/panfrost/pan_resource.c index 594c5b51962..b56e5c428b1 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 = {