lima: fail in get_handle(TYPE_KMS) without a scanout resource
authorSimon Ser <contact@emersion.fr>
Tue, 27 Jul 2021 07:04:14 +0000 (09:04 +0200)
committerSimon Ser <contact@emersion.fr>
Thu, 29 Jul 2021 19:01:10 +0000 (21:01 +0200)
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@emersion.fr>
Reviewed-by: Vasily Khoruzhick <anarsoul@gmail.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12074>

src/gallium/drivers/lima/lima_resource.c

index a783595..7b94dd4 100644 (file)
@@ -416,9 +416,8 @@ lima_resource_get_handle(struct pipe_screen *pscreen,
 
    res->modifier_constant = true;
 
-   if (handle->type == WINSYS_HANDLE_TYPE_KMS && screen->ro &&
-       renderonly_get_handle(res->scanout, handle))
-      return true;
+   if (handle->type == WINSYS_HANDLE_TYPE_KMS && screen->ro)
+      return renderonly_get_handle(res->scanout, handle);
 
    if (!lima_bo_export(res->bo, handle))
       return false;