summaryrefslogtreecommitdiffstats
path: root/gralloc_drm_pipe.c
diff options
context:
space:
mode:
authorTapani Pälli <tapani.palli@intel.com>2013-02-22 12:13:28 +0200
committerTapani Pälli <tapani.palli@intel.com>2013-03-01 10:59:42 +0200
commitf3c326e3a15df2b1d8e0387ab634ec29dafd7707 (patch)
treef9587d8a165b37a0d7b1dc49e8f7938f25dc2a8d /gralloc_drm_pipe.c
parent25d22516a6eb0991e1b1ec25d25785daf7100eff (diff)
downloadexternal_drm_gralloc-f3c326e3a15df2b1d8e0387ab634ec29dafd7707.zip
external_drm_gralloc-f3c326e3a15df2b1d8e0387ab634ec29dafd7707.tar.gz
external_drm_gralloc-f3c326e3a15df2b1d8e0387ab634ec29dafd7707.tar.bz2
gralloc: change copy api and fix copy function for intel
Patch extends current copy api, renames it blit and introduces src+dst coordinates to be able to implement partial blits and blits with offsets. Implementation must take care of hw specific restrictions with blits. Patch also fixes issues with the current intel_blit function. Current implementation does not select ring buffer and ends up queuing blit commands to the render ring. Patch starts to use drm_intel_bo_mrb_exec to be able to select blit ring and fixes the checks inside copy function. Change-Id: I05905e0b9c48fc2a55230212b676bfb8813a2b55 Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Diffstat (limited to 'gralloc_drm_pipe.c')
-rw-r--r--gralloc_drm_pipe.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/gralloc_drm_pipe.c b/gralloc_drm_pipe.c
index ee5c4c0..9987d52 100644
--- a/gralloc_drm_pipe.c
+++ b/gralloc_drm_pipe.c
@@ -285,10 +285,13 @@ static void pipe_unmap(struct gralloc_drm_drv_t *drv,
pthread_mutex_unlock(&pm->mutex);
}
-static void pipe_copy(struct gralloc_drm_drv_t *drv,
+static void pipe_blit(struct gralloc_drm_drv_t *drv,
struct gralloc_drm_bo_t *dst_bo,
struct gralloc_drm_bo_t *src_bo,
- short x1, short y1, short x2, short y2)
+ uint16_t dst_x1, uint16_t dst_y1,
+ uint16_t dst_x2, uint16_t dst_y2,
+ uint16_t src_x1, uint16_t src_y1,
+ uint16_t src_x2, uint16_t src_y2)
{
struct pipe_manager *pm = (struct pipe_manager *) drv;
struct pipe_buffer *dst = (struct pipe_buffer *) dst_bo;
@@ -303,19 +306,15 @@ static void pipe_copy(struct gralloc_drm_drv_t *drv,
return;
}
- if (x1 < 0)
- x1 = 0;
- if (y1 < 0)
- y1 = 0;
- if (x2 > dst_bo->handle->width)
- x2 = dst_bo->handle->width;
- if (y2 > dst_bo->handle->height)
- y2 = dst_bo->handle->height;
+ if (dst_x2 > dst_bo->handle->width)
+ dst_x2 = dst_bo->handle->width;
+ if (dst_y2 > dst_bo->handle->height)
+ dst_y2 = dst_bo->handle->height;
- if (x2 <= x1 || y2 <= y1)
+ if (src_x2 <= src_x1 || src_y2 <= src_y1)
return;
- u_box_2d(x1, y1, x2 - x1, y2 - y1, &src_box);
+ u_box_2d(src_x1, src_y1, src_x2 - src_x1, src_y2 - src_y1, &src_box);
pthread_mutex_lock(&pm->mutex);
@@ -330,7 +329,7 @@ static void pipe_copy(struct gralloc_drm_drv_t *drv,
}
pm->context->resource_copy_region(pm->context,
- dst->resource, 0, x1, y1, 0,
+ dst->resource, 0, dst_x1, dst_y1, 0,
src->resource, 0, &src_box);
pm->context->flush(pm->context, NULL);
@@ -562,7 +561,7 @@ struct gralloc_drm_drv_t *gralloc_drm_drv_create_for_pipe(int fd, const char *na
pm->base.free = pipe_free;
pm->base.map = pipe_map;
pm->base.unmap = pipe_unmap;
- pm->base.copy = pipe_copy;
+ pm->base.blit = pipe_blit;
return &pm->base;
}