OSDN Git Service

drm_hwcomposer: Assume premultiplied alpha for CLIENT layer
authorRoman Stratiienko <roman.o.stratiienko@globallogic.com>
Mon, 6 Dec 2021 12:56:14 +0000 (14:56 +0200)
committerJohn Stultz <john.stultz@linaro.org>
Mon, 13 Dec 2021 23:11:22 +0000 (23:11 +0000)
On db845c, we have seen an odd behavior with modal dialogs in
AOSP, where the background which is normally darkened, was
rendering as black, though it would occasionally flicker to the
right thing. This cropped up after alpha support on planes
landed in 5.15, so we assumed it was an edge case issue with the
dpu1 driver.

But while working on a separate issue seen on x86 hardware:
  https://gitlab.freedesktop.org/drm-hwcomposer/drm-hwcomposer/-/issues/46

Roman noticed drm_hwcomposer always sets the blending type to
NONE for the client layer. Which had gone un-noticed becase he
didn't have any devices that exposed the NONE type.

Thus Roman implemented this patch, which sets up the client
blend type to PREMULTIPLIED.

While it did not resolve the x86 issue above, it does resolve
the incorrect rendering seen on db845c with alpha support
enabled.

Tested-by: Martin Juecker martin.juecker@gmail.com #Exynos 4412
Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Change-Id: I95601c680ca1af0dc9d3b3f102f79f77af081b75

DrmHwcTwo.cpp

index 6faec1c..9bf1327 100644 (file)
@@ -341,6 +341,8 @@ HWC2::Error DrmHwcTwo::HwcDisplay::Init(std::vector<DrmPlane *> *planes) {
     return HWC2::Error::BadDisplay;
   }
 
+  client_layer_.SetLayerBlendMode(HWC2_BLEND_MODE_PREMULTIPLIED);
+
   return ChosePreferredConfig();
 }