Module: Mesa
Branch: master
Commit: 5aea0d691988af945e09e1d7cca28ca0759cc309
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=5aea0d691988af945e09e1d7cca28ca0759cc309

Author: Christian König <christian.koe...@amd.com>
Date:   Thu Jan 14 15:01:39 2016 +0100

radeon/winsys: add layer support for BO export

Add layer support to export individual array layers.

Signed-off-by: Christian König <christian.koe...@amd.com>
Reviewed-by: Marek Olšák <marek.ol...@amd.com>

---

 src/gallium/drivers/radeon/r600_texture.c     | 1 +
 src/gallium/drivers/radeon/radeon_winsys.h    | 1 +
 src/gallium/winsys/amdgpu/drm/amdgpu_bo.c     | 2 ++
 src/gallium/winsys/radeon/drm/radeon_drm_bo.c | 3 +++
 4 files changed, 7 insertions(+)

diff --git a/src/gallium/drivers/radeon/r600_texture.c 
b/src/gallium/drivers/radeon/r600_texture.c
index 15818aa..1ad7076 100644
--- a/src/gallium/drivers/radeon/r600_texture.c
+++ b/src/gallium/drivers/radeon/r600_texture.c
@@ -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);
 }
 
diff --git a/src/gallium/drivers/radeon/radeon_winsys.h 
b/src/gallium/drivers/radeon/radeon_winsys.h
index fb3f051..daa15db 100644
--- a/src/gallium/drivers/radeon/radeon_winsys.h
+++ b/src/gallium/drivers/radeon/radeon_winsys.h
@@ -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);
 
     /**
diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c 
b/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c
index 3f74dd7..c79bed4 100644
--- a/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c
+++ b/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c
@@ -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;
 }
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c 
b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
index 3f39827..08856df 100644
--- a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
+++ b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
@@ -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;
 }
 

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to