[Mesa-dev] [PATCH 1/2] etnaviv: Only use renderonly_get_handle for GEM handles.

Eric Anholt eric at anholt.net
Wed May 10 23:06:11 UTC 2017


Note that for requests for Prime FDs or flink names, we return handles to
the etanviv BO, not the scanout BO.  This is at least better than previous
behavior of returning GEM handles for a request for an FD or flink name.

And add an assert that renderonly_get_handle is only used for getting the
GEM handle.

Signed-off-by: Eric Anholt <eric at anholt.net>
---

Etnaviv devs, do you want to fix this properly a different way?  This
was my biggest stumbling block using renderonly on vc4 -- I
implemented the same get_handle() behavior and kept seeing X try to
import bad fds (actually handles).

 src/gallium/auxiliary/renderonly/renderonly.h  | 1 +
 src/gallium/drivers/etnaviv/etnaviv_resource.c | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/renderonly/renderonly.h b/src/gallium/auxiliary/renderonly/renderonly.h
index d54307329824..70641c45878a 100644
--- a/src/gallium/auxiliary/renderonly/renderonly.h
+++ b/src/gallium/auxiliary/renderonly/renderonly.h
@@ -87,6 +87,7 @@ renderonly_get_handle(struct renderonly_scanout *scanout,
    if (!scanout)
       return FALSE;
 
+   assert(handle->type == DRM_API_HANDLE_TYPE_KMS);
    handle->handle = scanout->handle;
    handle->stride = scanout->stride;
 
diff --git a/src/gallium/drivers/etnaviv/etnaviv_resource.c b/src/gallium/drivers/etnaviv/etnaviv_resource.c
index 0e37345c0c0a..6a51e37703f4 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_resource.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_resource.c
@@ -405,7 +405,8 @@ etna_resource_get_handle(struct pipe_screen *pscreen,
 {
    struct etna_resource *rsc = etna_resource(prsc);
 
-   if (renderonly_get_handle(rsc->scanout, handle))
+   if (handle->type == DRM_API_HANDLE_TYPE_KMS &&
+       renderonly_get_handle(rsc->scanout, handle))
       return TRUE;
 
    return etna_screen_bo_get_handle(pscreen, rsc->bo, rsc->levels[0].stride,
-- 
2.11.0



More information about the mesa-dev mailing list