Mesa (staging/21.2): etnaviv: fail in get_handle(TYPE_KMS) without a scanout resource

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jul 30 17:14:46 UTC 2021


Module: Mesa
Branch: staging/21.2
Commit: bda17c7388fcc27082d7607826a60ea14b4a105d
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=bda17c7388fcc27082d7607826a60ea14b4a105d

Author: Simon Ser <contact at emersion.fr>
Date:   Tue Jul 27 08:55:02 2021 +0200

etnaviv: 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: Christian Gmeiner <christian.gmeiner at gmail.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12074>
(cherry picked from commit 9da901d2b2e7ab5d5f21a0004fc294810f69f04a)

---

 .pick_status.json                              | 2 +-
 src/gallium/drivers/etnaviv/etnaviv_resource.c | 5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 44b2b1865fc..7c4f807a3f3 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -274,7 +274,7 @@
         "description": "etnaviv: 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/etnaviv/etnaviv_resource.c b/src/gallium/drivers/etnaviv/etnaviv_resource.c
index fa865f25093..3d1552e4c23 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_resource.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_resource.c
@@ -580,6 +580,7 @@ etna_resource_get_handle(struct pipe_screen *pscreen,
                          struct pipe_resource *prsc,
                          struct winsys_handle *handle, unsigned usage)
 {
+   struct etna_screen *screen = etna_screen(pscreen);
    struct etna_resource *rsc = etna_resource(prsc);
    struct renderonly_scanout *scanout;
 
@@ -607,8 +608,8 @@ etna_resource_get_handle(struct pipe_screen *pscreen,
    if (handle->type == WINSYS_HANDLE_TYPE_SHARED) {
       return etna_bo_get_name(rsc->bo, &handle->handle) == 0;
    } else if (handle->type == WINSYS_HANDLE_TYPE_KMS) {
-      if (renderonly_get_handle(scanout, handle)) {
-         return true;
+      if (screen->ro) {
+         return renderonly_get_handle(scanout, handle);
       } else {
          handle->handle = etna_bo_handle(rsc->bo);
          return true;



More information about the mesa-commit mailing list