summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoman Stratiienko <roman.stratiienko@globallogic.com>2019-11-08 17:16:11 +0200
committerRoman Stratiienko <roman.stratiienko@globallogic.com>2019-11-21 08:25:14 +0200
commitafb36897c9ecc76921f4d69c9de30e924b286893 (patch)
tree044c8ff04502bfbf3b94519f893baabc12c8771f
parentf264723195a7ef5ecb5bf29a6018d29b20fe5ed6 (diff)
drm_hwcomposer: Apply same logic for 'CURSOR' layers as for 'DEVICE'
Cursor usually is most top layer. Since it validates as CLIENT, it causes remain layers to be validated as CLIENT, resulting performance dropping. Signed-off-by: Roman Stratiienko <roman.stratiienko@globallogic.com>
-rw-r--r--drmhwctwo.cpp8
-rw-r--r--include/drmhwctwo.h1
2 files changed, 8 insertions, 1 deletions
diff --git a/drmhwctwo.cpp b/drmhwctwo.cpp
index c419758..ab81f61 100644
--- a/drmhwctwo.cpp
+++ b/drmhwctwo.cpp
@@ -560,6 +560,12 @@ void DrmHwcTwo::HwcDisplay::AddFenceToRetireFence(int fd) {
}
}
+bool DrmHwcTwo::HwcDisplay::HardwareSupportsLayerType(
+ HWC2::Composition comp_type) {
+ return comp_type == HWC2::Composition::Device ||
+ comp_type == HWC2::Composition::Cursor;
+}
+
HWC2::Error DrmHwcTwo::HwcDisplay::CreateComposition(bool test) {
std::vector<DrmCompositionDisplayLayersMap> layers_map;
layers_map.emplace_back();
@@ -803,7 +809,7 @@ HWC2::Error DrmHwcTwo::HwcDisplay::ValidateDisplay(uint32_t *num_types,
bool gpu_block = false;
for (std::pair<const uint32_t, DrmHwcTwo::HwcLayer *> &l : z_map) {
if (gpu_block || avail_planes == 0 ||
- l.second->sf_type() != HWC2::Composition::Device ||
+ !HardwareSupportsLayerType(l.second->sf_type()) ||
!importer_->CanImportBuffer(l.second->buffer())) {
gpu_block = true;
++*num_types;
diff --git a/include/drmhwctwo.h b/include/drmhwctwo.h
index 8c75fc0..f675429 100644
--- a/include/drmhwctwo.h
+++ b/include/drmhwctwo.h
@@ -193,6 +193,7 @@ class DrmHwcTwo : public hwc2_device_t {
private:
HWC2::Error CreateComposition(bool test);
void AddFenceToRetireFence(int fd);
+ bool HardwareSupportsLayerType(HWC2::Composition comp_type);
ResourceManager *resource_manager_;
DrmDevice *drm_;