summaryrefslogtreecommitdiff
path: root/libhwc
diff options
context:
space:
mode:
authorGreg Hackmann <ghackmann@google.com>2012-09-27 14:09:18 -0700
committerGreg Hackmann <ghackmann@google.com>2012-09-27 14:27:59 -0700
commit2a19eb169927b5669b2bc0adb96145b84ae49c6b (patch)
tree48382864f03b3649158e6095d5fdd160648250b5 /libhwc
parent46bbff719a64d7fef89e702b0d86164bcae0ee37 (diff)
downloadexynos5-2a19eb169927b5669b2bc0adb96145b84ae49c6b.tar.gz
hwc: enforce X-coordinate alignment constraints
The FIMD requires buffers' X coordinates to be aligned to word boundaries. Use a Gscaler to convert unaligned buffers to 32-bpp, which have no alignment constraints (1 word == 1 pixel). Bug: 7242154 Change-Id: I169f89d3eaff4d7694a1e7fc4696caaf4bbd512d Signed-off-by: Greg Hackmann <ghackmann@google.com>
Diffstat (limited to 'libhwc')
-rw-r--r--libhwc/hwc.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/libhwc/hwc.cpp b/libhwc/hwc.cpp
index 7ff722c..15db935 100644
--- a/libhwc/hwc.cpp
+++ b/libhwc/hwc.cpp
@@ -299,6 +299,18 @@ static uint8_t exynos5_format_to_bpp(int format)
}
}
+static bool is_x_aligned(const hwc_layer_1_t &layer, int format)
+{
+ if (!exynos5_format_is_supported(format))
+ return true;
+
+ uint8_t bpp = exynos5_format_to_bpp(format);
+ uint8_t pixel_alignment = 32 / bpp;
+
+ return (layer.displayFrame.left % pixel_alignment) == 0 &&
+ (layer.displayFrame.right % pixel_alignment) == 0;
+}
+
static bool exynos5_supports_gscaler(hwc_layer_1_t &layer, int format,
bool local_path)
{
@@ -341,7 +353,7 @@ static bool exynos5_supports_gscaler(hwc_layer_1_t &layer, int format,
static bool exynos5_requires_gscaler(hwc_layer_1_t &layer, int format)
{
return exynos5_format_requires_gscaler(format) || is_scaled(layer)
- || is_transformed(layer);
+ || is_transformed(layer) || !is_x_aligned(layer, format);
}
int hdmi_get_config(struct exynos5_hwc_composer_device_1_t *dev)