etnaviv: fold etna_screen_bo_get_handle into etna_resource_get_handle
authorLucas Stach <l.stach@pengutronix.de>
Thu, 22 Jun 2017 11:43:36 +0000 (13:43 +0200)
committerLucas Stach <l.stach@pengutronix.de>
Wed, 19 Jul 2017 14:26:50 +0000 (16:26 +0200)
There is no point in keeping this indirection. Makes the code easier to
follow.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Wladimir J. van der Laan <laanwj@gmail.com> (v1)
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
src/gallium/drivers/etnaviv/etnaviv_resource.c
src/gallium/drivers/etnaviv/etnaviv_screen.c
src/gallium/drivers/etnaviv/etnaviv_screen.h

index b1a814d4a398720c5a15898331c21379a3a988ce..c7eef96a6e83d909884051c5bde75227a6d21ce1 100644 (file)
@@ -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
index 3a8066c0ffb0f0c47743911e5f176979669dde54..aa24c856b712e2a933433e1ab7bcc056a7bddf21 100644 (file)
@@ -708,25 +708,6 @@ fail:
    return false;
 }
 
-boolean
-etna_screen_bo_get_handle(struct pipe_screen *pscreen, struct etna_bo *bo,
-                          unsigned stride, struct winsys_handle *whandle)
-{
-   whandle->stride = stride;
-
-   if (whandle->type == DRM_API_HANDLE_TYPE_SHARED) {
-      return etna_bo_get_name(bo, &whandle->handle) == 0;
-   } else if (whandle->type == DRM_API_HANDLE_TYPE_KMS) {
-      whandle->handle = etna_bo_handle(bo);
-      return TRUE;
-   } else if (whandle->type == DRM_API_HANDLE_TYPE_FD) {
-      whandle->handle = etna_bo_dmabuf(bo);
-      return TRUE;
-   } else {
-      return FALSE;
-   }
-}
-
 struct etna_bo *
 etna_screen_bo_from_handle(struct pipe_screen *pscreen,
                            struct winsys_handle *whandle, unsigned *out_stride)
index bec740b0a000a14bdb9d1c4aec97606e0a6b4865..dc57a38dbb80bc8220ba24915ccf06c7cd4f08c5 100644 (file)
@@ -84,10 +84,6 @@ etna_screen(struct pipe_screen *pscreen)
    return (struct etna_screen *)pscreen;
 }
 
-boolean
-etna_screen_bo_get_handle(struct pipe_screen *pscreen, struct etna_bo *bo,
-                          unsigned stride, struct winsys_handle *whandle);
-
 struct etna_bo *
 etna_screen_bo_from_handle(struct pipe_screen *pscreen,
                            struct winsys_handle *whandle, unsigned *out_stride);