summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/etnaviv/etnaviv_resource.c
diff options
context:
space:
mode:
authorLucas Stach <[email protected]>2017-06-22 13:43:36 +0200
committerLucas Stach <[email protected]>2017-07-19 16:26:50 +0200
commiteebf6ee6e9eacce014b855c0e067ce1f1b9ff4d6 (patch)
treeee2e2dd921ac41f3adf6708bd2d1cf41efcc2f28 /src/gallium/drivers/etnaviv/etnaviv_resource.c
parent8a44aa50435b905b6cdf4524711702b7645cbd2b (diff)
etnaviv: fold etna_screen_bo_get_handle into etna_resource_get_handle
There is no point in keeping this indirection. Makes the code easier to follow. Signed-off-by: Lucas Stach <[email protected]> Reviewed-by: Wladimir J. van der Laan <[email protected]> (v1) Reviewed-by: Christian Gmeiner <[email protected]> Reviewed-by: Daniel Stone <[email protected]>
Diffstat (limited to 'src/gallium/drivers/etnaviv/etnaviv_resource.c')
-rw-r--r--src/gallium/drivers/etnaviv/etnaviv_resource.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/gallium/drivers/etnaviv/etnaviv_resource.c b/src/gallium/drivers/etnaviv/etnaviv_resource.c
index b1a814d4a39..c7eef96a6e8 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_resource.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_resource.c
@@ -479,12 +479,23 @@ etna_resource_get_handle(struct pipe_screen *pscreen,
if (rsc->external)
rsc = etna_resource(rsc->external);
- if (handle->type == DRM_API_HANDLE_TYPE_KMS &&
- renderonly_get_handle(scanout, handle))
+ handle->stride = rsc->levels[0].stride;
+
+ if (handle->type == DRM_API_HANDLE_TYPE_SHARED) {
+ return etna_bo_get_name(rsc->bo, &handle->handle) == 0;
+ } else if (handle->type == DRM_API_HANDLE_TYPE_KMS) {
+ if (renderonly_get_handle(scanout, handle)) {
+ return TRUE;
+ } else {
+ handle->handle = etna_bo_handle(rsc->bo);
+ return TRUE;
+ }
+ } else if (handle->type == DRM_API_HANDLE_TYPE_FD) {
+ handle->handle = etna_bo_dmabuf(rsc->bo);
return TRUE;
-
- return etna_screen_bo_get_handle(pscreen, rsc->bo, rsc->levels[0].stride,
- handle);
+ } else {
+ return FALSE;
+ }
}
void