radeon/winsys: add layer support for BO export
authorChristian König <christian.koenig@amd.com>
Thu, 14 Jan 2016 14:01:39 +0000 (15:01 +0100)
committerChristian König <christian.koenig@amd.com>
Thu, 17 Mar 2016 13:17:06 +0000 (14:17 +0100)
Add layer support to export individual array layers.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/gallium/drivers/radeon/r600_texture.c
src/gallium/drivers/radeon/radeon_winsys.h
src/gallium/winsys/amdgpu/drm/amdgpu_bo.c
src/gallium/winsys/radeon/drm/radeon_drm_bo.c

index 15818aaae6f519867cfdf9f64b63d24636b30334..1ad70765781412937a601e4b28e64f8e0c3d6683 100644 (file)
@@ -374,6 +374,7 @@ static boolean r600_texture_get_handle(struct pipe_screen* screen,
        return rscreen->ws->buffer_get_handle(res->buf,
                                              rtex->surface.level[0].pitch_bytes,
                                              rtex->surface.level[0].offset,
+                                             rtex->surface.level[0].slice_size,
                                              whandle);
 }
 
index fb3f051be2bdc914be19788733939db85ca43b89..daa15db2812cb0890302a35b447f19053c264b0c 100644 (file)
@@ -547,6 +547,7 @@ struct radeon_winsys {
      */
     boolean (*buffer_get_handle)(struct pb_buffer *buf,
                                  unsigned stride, unsigned offset,
+                                 unsigned slice_size,
                                  struct winsys_handle *whandle);
 
     /**
index 3f74dd7da5e5e97176a1b4ac72e84d320aee6e5e..c79bed45753be6b6bb118517624fe0904393aad5 100644 (file)
@@ -613,6 +613,7 @@ error:
 
 static boolean amdgpu_bo_get_handle(struct pb_buffer *buffer,
                                     unsigned stride, unsigned offset,
+                                    unsigned slice_size,
                                     struct winsys_handle *whandle)
 {
    struct amdgpu_winsys_bo *bo = amdgpu_winsys_bo(buffer);
@@ -641,6 +642,7 @@ static boolean amdgpu_bo_get_handle(struct pb_buffer *buffer,
 
    whandle->stride = stride;
    whandle->offset = offset;
+   whandle->offset += slice_size * whandle->layer;
    bo->is_shared = true;
    return TRUE;
 }
index 3f39827b307f55b2eba6770ba0a7e52cfa0a5696..08856dff430c8aba8d4600800e3b6aa87da26f3f 100644 (file)
@@ -995,6 +995,7 @@ fail:
 
 static boolean radeon_winsys_bo_get_handle(struct pb_buffer *buffer,
                                            unsigned stride, unsigned offset,
+                                           unsigned slice_size,
                                            struct winsys_handle *whandle)
 {
     struct drm_gem_flink flink;
@@ -1029,6 +1030,8 @@ static boolean radeon_winsys_bo_get_handle(struct pb_buffer *buffer,
 
     whandle->stride = stride;
     whandle->offset = offset;
+    whandle->offset += slice_size * whandle->layer;
+
     return TRUE;
 }