summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandru Gheorghe <alexandru-cosmin.gheorghe@arm.com>2018-06-13 16:46:36 +0100
committerAlexandru Gheorghe <alexandru-cosmin.gheorghe@arm.com>2018-06-14 10:32:37 +0100
commit1542d29a538683250b818922527aec33774c793b (patch)
tree44b683c6339fc14eafd949e8142440236120b86b
parent4f6c62e978a02c78c6ae4e9707f0cb0a174f5721 (diff)
drm_hwcomposer: Set client composition buffer at the bottom.
Currently, we allocate layers to device composition from bottom to top and save the last DrmPlane from the top to be used by the client target buffer. However, we don't know much about client layer, so information for layers which we decided to set as ClientComposition, will be lost. For example, in BlendMode case if we have the following scene, with 2 DrmPlanes available. z0: LAYER0 AR24 BlendNone. z1: LAYER1 AR24 BlendPremulti. z2: LAYER2 AR24 BlendPremulti. We decide: z0: LAYER0 DeviceComposition z1: LAYER1 ClientComposition z2: LAYER2 ClientComposition LAYER1+LAYER2 will be in client target buffer, but we don't know nothing about the blending for client_target_layer. Which Android actually expects to be still BlendPremulti. So, we are kind of stucked we the default value which is BlendNone. I think there are two ways to solve this issue: 1) This commit, allocate layers as DeviceComposition from top to bottom and save the bottom for ClientComposition. 2) A smarter logic for detecting what should be the actual properties of client_layer_target, but I still think it makes more sense to actually have the client_layer_target at the bottom. Signed-off-by: Alexandru Gheorghe <alexandru-cosmin.gheorghe@arm.com>
-rw-r--r--drmhwctwo.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/drmhwctwo.cpp b/drmhwctwo.cpp
index cbe6df7..21309ec 100644
--- a/drmhwctwo.cpp
+++ b/drmhwctwo.cpp
@@ -477,7 +477,7 @@ HWC2::Error DrmHwcTwo::HwcDisplay::CreateComposition(bool test) {
// order the layers by z-order
bool use_client_layer = false;
- uint32_t client_z_order = 0;
+ uint32_t client_z_order = UINT32_MAX;
std::map<uint32_t, DrmHwcTwo::HwcLayer *> z_map;
for (std::pair<const hwc2_layer_t, DrmHwcTwo::HwcLayer> &l : layers_) {
HWC2::Composition comp_type;
@@ -491,9 +491,9 @@ HWC2::Error DrmHwcTwo::HwcDisplay::CreateComposition(bool test) {
z_map.emplace(std::make_pair(l.second.z_order(), &l.second));
break;
case HWC2::Composition::Client:
- // Place it at the z_order of the highest client layer
+ // Place it at the z_order of the lowest client layer
use_client_layer = true;
- client_z_order = std::max(client_z_order, l.second.z_order());
+ client_z_order = std::min(client_z_order, l.second.z_order());
break;
default:
continue;
@@ -707,7 +707,7 @@ HWC2::Error DrmHwcTwo::HwcDisplay::ValidateDisplay(uint32_t *num_types,
// Assume the test failed due to overlay planes
avail_planes = 1;
- std::map<uint32_t, DrmHwcTwo::HwcLayer *> z_map;
+ std::map<uint32_t, DrmHwcTwo::HwcLayer *, std::greater<int>> z_map;
for (std::pair<const hwc2_layer_t, DrmHwcTwo::HwcLayer> &l : layers_) {
if (l.second.sf_type() == HWC2::Composition::Device)
z_map.emplace(std::make_pair(l.second.z_order(), &l.second));