From: Greg Hackmann <ghackmann@google.com>
Date: Tue, 14 Aug 2012 22:51:40 +0000 (-0700)
Subject: hwc: fix colors on YCrCb surfaces
X-Git-Tag: cm-10.1-M1~245
X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=296668ec39f8e30a0aa652f6a99ebfd522fda864;p=GitHub%2FLineageOS%2Fandroid_hardware_samsung_slsi_exynos5.git

hwc: fix colors on YCrCb surfaces

Change-Id: Iafabe17735811fe815ad80ae1c145e1e75b63ca4
Signed-off-by: Greg Hackmann <ghackmann@google.com>
---

diff --git a/libhwc/hwc.cpp b/libhwc/hwc.cpp
index 229031b..7df7430 100644
--- a/libhwc/hwc.cpp
+++ b/libhwc/hwc.cpp
@@ -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;