diff options
author | Roman Stratiienko <roman.o.stratiienko@globallogic.com> | 2022-02-02 09:53:50 +0200 |
---|---|---|
committer | Roman Stratiienko <roman.o.stratiienko@globallogic.com> | 2022-02-04 11:19:40 +0200 |
commit | 9362cef4c34b9d23018d75be0cbb6ef0486bf75b (patch) | |
tree | 26e2c98e3a18d93ad165398f6d60377265b9ec5d /drm/DrmDisplayPipeline.cpp | |
parent | d0c035b44a844af5017c0c3b2507af2f3907c36c (diff) | |
download | drm-hwcomposer-9362cef4c34b9d23018d75be0cbb6ef0486bf75b.tar.gz drm-hwcomposer-9362cef4c34b9d23018d75be0cbb6ef0486bf75b.tar.bz2 drm-hwcomposer-9362cef4c34b9d23018d75be0cbb6ef0486bf75b.zip |
drm_hwcomposer: Rework KMS composition planner + plane sharing support
Rewrite Layer-to-Plane planner. Get rid of ~200 redundant lines of code
+ added plane sharing functionality.
Closes: https://gitlab.freedesktop.org/drm-hwcomposer/drm-hwcomposer/-/issues/11
Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
Diffstat (limited to 'drm/DrmDisplayPipeline.cpp')
-rw-r--r-- | drm/DrmDisplayPipeline.cpp | 47 |
1 files changed, 31 insertions, 16 deletions
diff --git a/drm/DrmDisplayPipeline.cpp b/drm/DrmDisplayPipeline.cpp index 0ce1afc..31bc764 100644 --- a/drm/DrmDisplayPipeline.cpp +++ b/drm/DrmDisplayPipeline.cpp @@ -98,22 +98,6 @@ static auto TryCreatePipeline(DrmDevice &dev, DrmConnector &connector, return {}; } - char use_overlay_planes_prop[PROPERTY_VALUE_MAX]; - property_get("vendor.hwc.drm.use_overlay_planes", use_overlay_planes_prop, - "1"); - constexpr int kStrtolBase = 10; - bool use_overlay_planes = strtol(use_overlay_planes_prop, nullptr, - kStrtolBase) != 0; - - if (use_overlay_planes) { - for (auto *plane : overlay_planes) { - auto op = plane->BindPipeline(pipe.get()); - if (op) { - pipe->overlay_planes.emplace_back(op); - } - } - } - pipe->compositor = std::make_unique<DrmDisplayCompositor>(pipe.get()); return pipe; @@ -173,4 +157,35 @@ auto DrmDisplayPipeline::CreatePipeline(DrmConnector &connector) return {}; } +static bool ReadUseOverlayProperty() { + char use_overlay_planes_prop[PROPERTY_VALUE_MAX]; + property_get("vendor.hwc.drm.use_overlay_planes", use_overlay_planes_prop, + "1"); + constexpr int kStrtolBase = 10; + return strtol(use_overlay_planes_prop, nullptr, kStrtolBase) != 0; +} + +auto DrmDisplayPipeline::GetUsablePlanes() + -> std::vector<std::shared_ptr<BindingOwner<DrmPlane>>> { + std::vector<std::shared_ptr<BindingOwner<DrmPlane>>> planes; + planes.emplace_back(primary_plane); + + static bool use_overlay_planes = ReadUseOverlayProperty(); + + if (use_overlay_planes) { + for (const auto &plane : device->GetPlanes()) { + if (plane->IsCrtcSupported(*crtc->Get())) { + if (plane->GetType() == DRM_PLANE_TYPE_OVERLAY) { + auto op = plane->BindPipeline(this, true); + if (op) { + planes.emplace_back(op); + } + } + } + } + } + + return planes; +} + } // namespace android |