From 47f000c170ccb824b308e02db8c2c955a8c00217 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Tue, 27 Jul 2021 09:04:14 +0200 Subject: [PATCH] lima: 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: Vasily Khoruzhick Cc: mesa-stable Part-of: --- src/gallium/drivers/lima/lima_resource.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/lima/lima_resource.c b/src/gallium/drivers/lima/lima_resource.c index a783595411a..7b94dd48320 100644 --- a/src/gallium/drivers/lima/lima_resource.c +++ b/src/gallium/drivers/lima/lima_resource.c @@ -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;