summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTapani Pälli <tapani.palli@intel.com>2012-12-12 13:19:11 +0200
committerTapani Pälli <tapani.palli@intel.com>2012-12-14 10:58:35 +0200
commitcca14cfd68da631fb1b5d53f2951ffb1059fd7f7 (patch)
treebd9539eeaf50770b20b05dbbb7be6031815fecb2
parent45a9451495fade9c39239569f55c1de6aa0866ab (diff)
downloadexternal_drm_gralloc-cca14cfd68da631fb1b5d53f2951ffb1059fd7f7.zip
external_drm_gralloc-cca14cfd68da631fb1b5d53f2951ffb1059fd7f7.tar.gz
external_drm_gralloc-cca14cfd68da631fb1b5d53f2951ffb1059fd7f7.tar.bz2
gralloc: yuv offset calculation function for mesa
Patch adds add api for mesa to query component offsets for yuv buffer handles. Change-Id: Ib477627ad812f5b6352665d00fb2bb3b10fe5b8e Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
-rw-r--r--gralloc_drm_handle.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/gralloc_drm_handle.h b/gralloc_drm_handle.h
index 383719e..621f500 100644
--- a/gralloc_drm_handle.h
+++ b/gralloc_drm_handle.h
@@ -25,6 +25,7 @@
#define _GRALLOC_DRM_HANDLE_H_
#include <cutils/native_handle.h>
+#include "gralloc_drm_formats.h"
struct gralloc_drm_handle_t {
native_handle_t base;
@@ -60,4 +61,22 @@ static inline struct gralloc_drm_handle_t *gralloc_drm_handle(buffer_handle_t _h
return handle;
}
+static inline void gralloc_drm_yuv_offsets(buffer_handle_t _handle,
+ int *y, int *u, int *v)
+{
+ struct gralloc_drm_handle_t *handle = gralloc_drm_handle(_handle);
+ if (handle && *y && *u && *v) {
+ *y = 0;
+ switch (handle->format) {
+ case HAL_PIXEL_FORMAT_YV12:
+ *v = handle->stride * handle->height;
+ *u = *v + handle->height/2;
+ break;
+ case HAL_PIXEL_FORMAT_DRM_NV12:
+ *u = *v = handle->stride * handle->height;
+ break;
+ }
+ }
+}
+
#endif /* _GRALLOC_DRM_HANDLE_H_ */