drm_hwcomposer: Store the HAL_PIXEL_FORMAT_* in the hwc_drm_bo
The new GraphicBufferMapper ImportBuffer takes a format
as an argument, but I believe it wants the HAL_PIXEL_FORMAT_*
and not the DRM_FORMAT value.
So stash the HAL_PIXEL_FORMAT_* into the hwc_drm_bo so we
can pass it along when needed.
Change-Id: Id5b8e0d8c624e26c2c6307f85489665c88a9e75d
Signed-off-by: John Stultz <john.stultz@linaro.org>
diff --git a/drmhwcgralloc.h b/drmhwcgralloc.h
index daa44dc..abfd2c1 100644
--- a/drmhwcgralloc.h
+++ b/drmhwcgralloc.h
@@ -23,7 +23,8 @@
typedef struct hwc_drm_bo {
uint32_t width;
uint32_t height;
- uint32_t format; /* DRM_FORMAT_* from drm_fourcc.h */
+ uint32_t format; /* DRM_FORMAT_* from drm_fourcc.h */
+ uint32_t hal_format; /* HAL_PIXEL_FORMAT_* */
uint32_t usage;
uint32_t pitches[HWC_DRM_BO_MAX_PLANES];
uint32_t offsets[HWC_DRM_BO_MAX_PLANES];
diff --git a/platformdrmgeneric.cpp b/platformdrmgeneric.cpp
index 85b2a7f..491b2e3 100644
--- a/platformdrmgeneric.cpp
+++ b/platformdrmgeneric.cpp
@@ -98,6 +98,7 @@
memset(bo, 0, sizeof(hwc_drm_bo_t));
bo->width = gr_handle->width;
bo->height = gr_handle->height;
+ bo->hal_format = gr_handle->format;
bo->format = ConvertHalFormatToDrm(gr_handle->format);
bo->usage = gr_handle->usage;
bo->pitches[0] = gr_handle->stride;
diff --git a/platformhisi.cpp b/platformhisi.cpp
index 99d222b..1723cb8 100644
--- a/platformhisi.cpp
+++ b/platformhisi.cpp
@@ -96,6 +96,7 @@
bo->width = hnd->width;
bo->height = hnd->height;
+ bo->hal_format = hnd->req_format;
bo->format = fmt;
bo->usage = hnd->usage;
diff --git a/platformminigbm.cpp b/platformminigbm.cpp
index eb0b93f..24112aa 100644
--- a/platformminigbm.cpp
+++ b/platformminigbm.cpp
@@ -82,6 +82,7 @@
memset(bo, 0, sizeof(hwc_drm_bo_t));
bo->width = gr_handle->width;
bo->height = gr_handle->height;
+ bo->hal_format = gr_handle->droid_format;
bo->format = gr_handle->format;
bo->usage = gr_handle->usage;
bo->pitches[0] = gr_handle->strides[0];