diff options
author | Sean Paul <seanpaul@chromium.org> | 2015-11-19 21:46:11 -0500 |
---|---|---|
committer | Sean Paul <seanpaul@chromium.org> | 2015-11-20 15:01:18 -0500 |
commit | 04b47ea435834b4373d57dae6485986b9f0918ae (patch) | |
tree | 9a54b4abdede013cfd74994c27e35e7e460b3544 /hwcomposer.cpp | |
parent | 35301f498c372f3ad2bbbc969acda39056131b26 (diff) | |
download | drm_hwcomposer-04b47ea435834b4373d57dae6485986b9f0918ae.tar.gz |
drm_hwcomposer: Allow for multiple transforms at once
Because sometimes one just ain't enough, allow more than
one transform at a time.
Bug: chrome-os-partner:46710
Test: Tested with the CTS Verifier "Camera Orientation" test
Change-Id: Ie5f9bbbc7c89964feafc78150e18512861c85b69
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Diffstat (limited to 'hwcomposer.cpp')
-rw-r--r-- | hwcomposer.cpp | 38 |
1 files changed, 16 insertions, 22 deletions
diff --git a/hwcomposer.cpp b/hwcomposer.cpp index e755273..c6f636b 100644 --- a/hwcomposer.cpp +++ b/hwcomposer.cpp @@ -252,28 +252,22 @@ int DrmHwcLayer::InitFromHwcLayer(hwc_layer_1_t *sf_layer, Importer *importer, sf_layer->displayFrame.left, sf_layer->displayFrame.top, sf_layer->displayFrame.right, sf_layer->displayFrame.bottom); - switch (sf_layer->transform) { - case 0: - transform = DrmHwcTransform::kIdentity; - break; - case HWC_TRANSFORM_FLIP_H: - transform = DrmHwcTransform::kFlipH; - break; - case HWC_TRANSFORM_FLIP_V: - transform = DrmHwcTransform::kFlipV; - break; - case HWC_TRANSFORM_ROT_90: - transform = DrmHwcTransform::kRotate90; - break; - case HWC_TRANSFORM_ROT_180: - transform = DrmHwcTransform::kRotate180; - break; - case HWC_TRANSFORM_ROT_270: - transform = DrmHwcTransform::kRotate270; - break; - default: - ALOGE("Invalid transform in hwc_layer_1_t %d", sf_layer->transform); - return -EINVAL; + transform = 0; + // 270* and 180* cannot be combined with flips. More specifically, they + // already contain both horizontal and vertical flips, so those fields are + // redundant in this case. 90* rotation can be combined with either horizontal + // flip or vertical flip, so treat it differently + if (sf_layer->transform == HWC_TRANSFORM_ROT_270) { + transform = DrmHwcTransform::kRotate270; + } else if (sf_layer->transform == HWC_TRANSFORM_ROT_180) { + transform = DrmHwcTransform::kRotate180; + } else { + if (sf_layer->transform & HWC_TRANSFORM_FLIP_H) + transform |= DrmHwcTransform::kFlipH; + if (sf_layer->transform & HWC_TRANSFORM_FLIP_V) + transform |= DrmHwcTransform::kFlipV; + if (sf_layer->transform & HWC_TRANSFORM_ROT_90) + transform |= DrmHwcTransform::kRotate90; } switch (sf_layer->blending) { |