aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Salido <salidoa@google.com>2017-08-21 17:07:18 -0700
committerAdrian Salido <salidoa@google.com>2017-08-24 11:39:01 -0700
commit329e7682c63f7ddac92a90b244ed2c44610b882a (patch)
tree95094ee2586a2a4f25a21073a3cd6757dd6ed6f8
parentee24aca7b8fbceab1011a4bb36b0baff08d9cdbc (diff)
downloaddrm_hwcomposer-329e7682c63f7ddac92a90b244ed2c44610b882a.tar.gz
drm_hwcomposer: skip layers with non-premult blending
Tegra driver assumes that all layers with alpha component have premult alpha. This can cause issues if blending is different since the alpha component is supposed to be ignored in that case. Fixes: 62401826 Test: share location in hangouts and drag around map Change-Id: Iff870697f7efbf5d075a5925d63a8f0f672ee725 Signed-off-by: Adrian Salido <salidoa@google.com>
-rw-r--r--platformnv.cpp15
-rw-r--r--platformnv.h2
2 files changed, 14 insertions, 3 deletions
diff --git a/platformnv.cpp b/platformnv.cpp
index d3e5d70..e680981 100644
--- a/platformnv.cpp
+++ b/platformnv.cpp
@@ -286,7 +286,7 @@ int PlanStageProtectedRotated::ProvisionPlanes(
return 0;
}
-bool PlanStageNvLimits::CheckLayer(DrmHwcLayer *layer) {
+bool PlanStageNvLimits::CheckLayer(size_t zorder, DrmHwcLayer *layer) {
auto src_w = layer->source_crop.width();
auto src_h = layer->source_crop.height();
auto dst_w = layer->display_frame.width();
@@ -295,6 +295,17 @@ bool PlanStageNvLimits::CheckLayer(DrmHwcLayer *layer) {
int v_limit;
switch (layer->buffer->format) {
+ case DRM_FORMAT_ARGB8888:
+ case DRM_FORMAT_ABGR8888:
+ case DRM_FORMAT_XBGR8888:
+ // tegra driver assumes any layer with alpha channel has premult
+ // blending, avoid handling it this is not the case. This is not an
+ // issue for bottom-most layer since there's nothing to blend with
+ if (zorder > 0 && layer->blending != DrmHwcBlending::kPreMult)
+ return false;
+
+ v_limit = 2;
+ break;
case DRM_FORMAT_YVU420:
case DRM_FORMAT_BGR565:
v_limit = 4;
@@ -323,7 +334,7 @@ int PlanStageNvLimits::ProvisionPlanes(
for (auto i = layers.begin(); i != layers.end();) {
// Skip layer if supported
- if (CheckLayer(i->second)) {
+ if (CheckLayer(i->first, i->second)) {
i++;
continue;
}
diff --git a/platformnv.h b/platformnv.h
index 3c1f49e..7e2784f 100644
--- a/platformnv.h
+++ b/platformnv.h
@@ -83,7 +83,7 @@ class PlanStageNvLimits : public Planner::PlanStage {
std::map<size_t, DrmHwcLayer *> &layers, DrmCrtc *crtc,
std::vector<DrmPlane *> *planes);
protected:
- bool CheckLayer(DrmHwcLayer *layer);
+ bool CheckLayer(size_t zorder, DrmHwcLayer *layer);
};
}