summaryrefslogtreecommitdiffstats
path: root/gralloc_drm_kms.c
diff options
context:
space:
mode:
authorTapani Pälli <tapani.palli@intel.com>2013-01-18 15:01:43 +0200
committerTapani Pälli <tapani.palli@intel.com>2013-01-21 14:39:37 +0200
commita8f0334ef5706875f2c73a2690a2f1fc3e5fee27 (patch)
treed7d822a66b36a702ddf1943fd35549180f7c669f /gralloc_drm_kms.c
parent421d4ec03917d13cc4449832275ac3c25e00acf5 (diff)
downloadexternal_drm_gralloc-a8f0334ef5706875f2c73a2690a2f1fc3e5fee27.zip
external_drm_gralloc-a8f0334ef5706875f2c73a2690a2f1fc3e5fee27.tar.gz
external_drm_gralloc-a8f0334ef5706875f2c73a2690a2f1fc3e5fee27.tar.bz2
gralloc: implement yuv offset query as hw specific function
This patch reverts earlier cca14cfd... and introduces a new hw specific hook to query yuv components offsets which can vary between different hw, decoders, cameras etc. Change-Id: Ib60bc8ee28df7bc9425b6d7934294fe36fc55354 Depends-Change-Id: I1aa5368b21e588d5d711c1005fff2a5296e143a0 Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Diffstat (limited to 'gralloc_drm_kms.c')
-rw-r--r--gralloc_drm_kms.c43
1 files changed, 9 insertions, 34 deletions
diff --git a/gralloc_drm_kms.c b/gralloc_drm_kms.c
index 3310807..a921e6c 100644
--- a/gralloc_drm_kms.c
+++ b/gralloc_drm_kms.c
@@ -73,42 +73,17 @@ static unsigned int drm_format_from_hal(int hal_format)
static int resolve_drm_format(struct gralloc_drm_bo_t *bo,
uint32_t *pitches, uint32_t *offsets, uint32_t *handles)
{
- memset(pitches, 0, 4 * sizeof(uint32_t));
- memset(offsets, 0, 4 * sizeof(uint32_t));
- memset(handles, 0, 4 * sizeof(uint32_t));
+ struct gralloc_drm_t *drm = bo->drm;
pitches[0] = bo->handle->stride;
handles[0] = bo->fb_handle;
- int format = drm_format_from_hal(bo->handle->format);
-
- // handle 'special formats'
- switch(bo->handle->format) {
- case HAL_PIXEL_FORMAT_YV12:
-
- // U and V stride are half of Y plane
- pitches[2] = pitches[0]/2;
- pitches[1] = pitches[0]/2;
-
- // like I420 but U and V are in reverse order
- offsets[2] = offsets[0] +
- pitches[0] * bo->handle->height;
- offsets[1] = offsets[2] +
- pitches[2] * bo->handle->height/2;
+ /* driver takes care of HW specific padding, alignment etc. */
+ if (drm->drv->resolve_format)
+ drm->drv->resolve_format(drm->drv, bo,
+ pitches, offsets, handles);
- handles[1] = handles[2] = handles[0];
- break;
-
- case HAL_PIXEL_FORMAT_DRM_NV12:
-
- // U and V are interleaved in 2nd plane
- pitches[1] = pitches[0];
- offsets[1] = offsets[0] +
- pitches[0] * bo->handle->height;
- handles[1] = handles[0];
- break;
- }
- return format;
+ return drm_format_from_hal(bo->handle->format);
}
/*
@@ -116,9 +91,9 @@ static int resolve_drm_format(struct gralloc_drm_bo_t *bo,
*/
int gralloc_drm_bo_add_fb(struct gralloc_drm_bo_t *bo)
{
- uint32_t pitches[4];
- uint32_t offsets[4];
- uint32_t handles[4];
+ uint32_t pitches[4] = { 0, 0, 0, 0 };
+ uint32_t offsets[4] = { 0, 0, 0, 0 };
+ uint32_t handles[4] = { 0, 0, 0, 0 };
if (bo->fb_id)
return 0;