hwc: fix colors on YCrCb surfaces
authorGreg Hackmann <ghackmann@google.com>
Tue, 14 Aug 2012 22:51:40 +0000 (15:51 -0700)
committerGreg Hackmann <ghackmann@google.com>
Wed, 15 Aug 2012 00:27:59 +0000 (17:27 -0700)
Change-Id: Iafabe17735811fe815ad80ae1c145e1e75b63ca4
Signed-off-by: Greg Hackmann <ghackmann@google.com>
libhwc/hwc.cpp

index 229031bf83e0f4dc221b10de21ef3e6490be9c88..7df743097e9669e55f061f9d00ac8ac45b2117c8 100644 (file)
@@ -234,6 +234,11 @@ static bool exynos5_format_is_supported_by_gscaler(int format)
     }
 }
 
+static bool exynos5_format_is_ycrcb(int format)
+{
+    return format == HAL_PIXEL_FORMAT_YV12;
+}
+
 static bool exynos5_format_requires_gscaler(int format)
 {
     return exynos5_format_is_supported_by_gscaler(format) &&
@@ -678,8 +683,13 @@ static int exynos5_config_gsc_m2m(hwc_layer_1_t &layer,
     src_cfg.h = HEIGHT(layer.sourceCrop);
     src_cfg.fh = src_handle->height;
     src_cfg.yaddr = src_handle->fd;
-    src_cfg.uaddr = src_handle->fd1;
-    src_cfg.vaddr = src_handle->fd2;
+    if (exynos5_format_is_ycrcb(src_handle->format)) {
+        src_cfg.uaddr = src_handle->fd2;
+        src_cfg.vaddr = src_handle->fd1;
+    } else {
+        src_cfg.uaddr = src_handle->fd1;
+        src_cfg.vaddr = src_handle->fd2;
+    }
     src_cfg.format = src_handle->format;
 
     dst_cfg.x = 0;