From 5b19fdb6632eb5326700dbb71c0b7a75b9c49fb4 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Tue, 27 Jul 2021 08:59:09 +0200 Subject: [PATCH] freedreno: 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: Emma Anholt Cc: mesa-stable Part-of: (cherry picked from commit 465eb7864bf0328aa2d497f0c2a2de72fafeced6) --- .pick_status.json | 2 +- src/gallium/drivers/freedreno/freedreno_screen.c | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index dd76a476233..004af4ef974 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -1444,7 +1444,7 @@ "description": "freedreno: 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/freedreno/freedreno_screen.c b/src/gallium/drivers/freedreno/freedreno_screen.c index b1845766f46..bdd6a92cda9 100644 --- a/src/gallium/drivers/freedreno/freedreno_screen.c +++ b/src/gallium/drivers/freedreno/freedreno_screen.c @@ -808,15 +808,19 @@ fd_screen_bo_get_handle(struct pipe_screen *pscreen, struct fd_bo *bo, struct renderonly_scanout *scanout, unsigned stride, struct winsys_handle *whandle) { + struct fd_screen *screen = fd_screen(pscreen); + whandle->stride = stride; if (whandle->type == WINSYS_HANDLE_TYPE_SHARED) { return fd_bo_get_name(bo, &whandle->handle) == 0; } else if (whandle->type == WINSYS_HANDLE_TYPE_KMS) { - if (renderonly_get_handle(scanout, whandle)) + if (screen->ro) { + return renderonly_get_handle(scanout, whandle); + } else { + whandle->handle = fd_bo_handle(bo); return true; - whandle->handle = fd_bo_handle(bo); - return true; + } } else if (whandle->type == WINSYS_HANDLE_TYPE_FD) { whandle->handle = fd_bo_dmabuf(bo); return true;