Mesa (main): freedreno: 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: 465eb7864bf0328aa2d497f0c2a2de72fafeced6
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=465eb7864bf0328aa2d497f0c2a2de72fafeced6
Author: Simon Ser <contact at emersion.fr>
Date: Tue Jul 27 08:59:09 2021 +0200
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 <contact at emersion.fr>
Reviewed-by: Emma Anholt <emma at anholt.net>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12074>
---
src/gallium/drivers/freedreno/freedreno_screen.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c b/src/gallium/drivers/freedreno/freedreno_screen.c
index 2e589facea7..2e377f9e05f 100644
--- a/src/gallium/drivers/freedreno/freedreno_screen.c
+++ b/src/gallium/drivers/freedreno/freedreno_screen.c
@@ -803,15 +803,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;
More information about the mesa-commit
mailing list