OSDN Git Service

drm_hwcomposer: Apply same logic for 'CURSOR' layers as for 'DEVICE'
authorRoman Stratiienko <roman.stratiienko@globallogic.com>
Fri, 8 Nov 2019 15:16:11 +0000 (17:16 +0200)
committerRoman Stratiienko <roman.stratiienko@globallogic.com>
Thu, 21 Nov 2019 06:25:14 +0000 (08:25 +0200)
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>
drmhwctwo.cpp
include/drmhwctwo.h

index c419758..ab81f61 100644 (file)
@@ -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;
index 8c75fc0..f675429 100644 (file)
@@ -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_;