summaryrefslogtreecommitdiffstats
path: root/src/gallium/winsys
diff options
context:
space:
mode:
authorChristian König <[email protected]>2016-01-12 15:59:11 +0100
committerChristian König <[email protected]>2016-03-17 14:17:03 +0100
commit04bc082f6a8bfc3b3774bb102d3200317609432e (patch)
tree9ef4d2a8ffe48087f97d4e00674c4aa17e9df33f /src/gallium/winsys
parentf1e78a48f2ec2645eb87d134c6961815dc89a307 (diff)
radeon/winsys: add offset support for BO import/export
Add offset support to handle NV12 offsets as well. Signed-off-by: Christian König <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/gallium/winsys')
-rw-r--r--src/gallium/winsys/amdgpu/drm/amdgpu_bo.c9
-rw-r--r--src/gallium/winsys/radeon/drm/radeon_drm_bo.c9
2 files changed, 12 insertions, 6 deletions
diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c b/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c
index 70993297ceb..3f74dd7da5e 100644
--- a/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c
+++ b/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c
@@ -519,7 +519,8 @@ amdgpu_bo_create(struct radeon_winsys *rws,
static struct pb_buffer *amdgpu_bo_from_handle(struct radeon_winsys *rws,
struct winsys_handle *whandle,
- unsigned *stride)
+ unsigned *stride,
+ unsigned *offset)
{
struct amdgpu_winsys *ws = amdgpu_winsys(rws);
struct amdgpu_winsys_bo *bo;
@@ -587,6 +588,8 @@ static struct pb_buffer *amdgpu_bo_from_handle(struct radeon_winsys *rws,
if (stride)
*stride = whandle->stride;
+ if (offset)
+ *offset = whandle->offset;
if (bo->initial_domain & RADEON_DOMAIN_VRAM)
ws->allocated_vram += align(bo->base.size, ws->gart_page_size);
@@ -609,7 +612,7 @@ error:
}
static boolean amdgpu_bo_get_handle(struct pb_buffer *buffer,
- unsigned stride,
+ unsigned stride, unsigned offset,
struct winsys_handle *whandle)
{
struct amdgpu_winsys_bo *bo = amdgpu_winsys_bo(buffer);
@@ -637,7 +640,7 @@ static boolean amdgpu_bo_get_handle(struct pb_buffer *buffer,
return FALSE;
whandle->stride = stride;
- whandle->offset = 0;
+ whandle->offset = offset;
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 9e5d7d2e7a0..3f39827b307 100644
--- a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
+++ b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
@@ -851,7 +851,8 @@ static struct pb_buffer *radeon_winsys_bo_from_ptr(struct radeon_winsys *rws,
static struct pb_buffer *radeon_winsys_bo_from_handle(struct radeon_winsys *rws,
struct winsys_handle *whandle,
- unsigned *stride)
+ unsigned *stride,
+ unsigned *offset)
{
struct radeon_drm_winsys *ws = radeon_drm_winsys(rws);
struct radeon_bo *bo;
@@ -941,6 +942,8 @@ done:
if (stride)
*stride = whandle->stride;
+ if (offset)
+ *offset = whandle->offset;
if (ws->info.has_virtual_memory && !bo->va) {
struct drm_radeon_gem_va va;
@@ -991,7 +994,7 @@ fail:
}
static boolean radeon_winsys_bo_get_handle(struct pb_buffer *buffer,
- unsigned stride,
+ unsigned stride, unsigned offset,
struct winsys_handle *whandle)
{
struct drm_gem_flink flink;
@@ -1025,7 +1028,7 @@ static boolean radeon_winsys_bo_get_handle(struct pb_buffer *buffer,
}
whandle->stride = stride;
- whandle->offset = 0;
+ whandle->offset = offset;
return TRUE;
}