diff options
author | Matvii Zorin <matvii.zorin@globallogic.com> | 2021-01-31 14:45:05 +0200 |
---|---|---|
committer | Matvii Zorin <matvii.zorin@globallogic.com> | 2021-04-06 12:46:22 +0300 |
commit | 67a89d33b82caf45997bcdd3ca7690b5bd3ebef5 (patch) | |
tree | a1e4be71aa72b954dd082de36c8026e6e9ae6c18 /compositor | |
parent | b865227a2528d8a9d5ada90d1409dda47094b602 (diff) | |
download | drm_hwcomposer-67a89d33b82caf45997bcdd3ca7690b5bd3ebef5.tar.gz |
drm_hwcomposer: Move ValidatePlane method into DrmPlane
It is more common to validate the layer for the proper object.
Signed-off-by: Matvii Zorin <matvii.zorin@globallogic.com>
Diffstat (limited to 'compositor')
-rw-r--r-- | compositor/Planner.cpp | 51 | ||||
-rw-r--r-- | compositor/Planner.h | 4 |
2 files changed, 1 insertions, 54 deletions
diff --git a/compositor/Planner.cpp b/compositor/Planner.cpp index d87e79f..42259d1 100644 --- a/compositor/Planner.cpp +++ b/compositor/Planner.cpp @@ -44,57 +44,6 @@ std::vector<DrmPlane *> Planner::GetUsablePlanes( return usable_planes; } -int Planner::PlanStage::ValidatePlane(DrmPlane *plane, DrmHwcLayer *layer) { - int ret = 0; - uint64_t blend = UINT64_MAX; - - if ((plane->rotation_property().id() == 0) && - layer->transform != DrmHwcTransform::kIdentity) { - ALOGE("Rotation is not supported on plane %d", plane->id()); - return -EINVAL; - } - - if (plane->alpha_property().id() == 0 && layer->alpha != 0xffff) { - ALOGE("Alpha is not supported on plane %d", plane->id()); - return -EINVAL; - } - - if (plane->blend_property().id() == 0) { - if ((layer->blending != DrmHwcBlending::kNone) && - (layer->blending != DrmHwcBlending::kPreMult)) { - ALOGE("Blending is not supported on plane %d", plane->id()); - return -EINVAL; - } - } else { - switch (layer->blending) { - case DrmHwcBlending::kPreMult: - std::tie(blend, ret) = plane->blend_property().GetEnumValueWithName( - "Pre-multiplied"); - break; - case DrmHwcBlending::kCoverage: - std::tie(blend, ret) = plane->blend_property().GetEnumValueWithName( - "Coverage"); - break; - case DrmHwcBlending::kNone: - default: - std::tie(blend, - ret) = plane->blend_property().GetEnumValueWithName("None"); - break; - } - if (ret) - ALOGE("Expected a valid blend mode on plane %d", plane->id()); - } - - uint32_t format = layer->buffer->format; - if (!plane->IsFormatSupported(format)) { - ALOGE("Plane %d does not supports %c%c%c%c format", plane->id(), format, - format >> 8, format >> 16, format >> 24); - return -EINVAL; - } - - return ret; -} - std::tuple<int, std::vector<DrmCompositionPlane>> Planner::ProvisionPlanes( std::map<size_t, DrmHwcLayer *> &layers, DrmCrtc *crtc, std::vector<DrmPlane *> *primary_planes, diff --git a/compositor/Planner.h b/compositor/Planner.h index 7c1fe80..3390acb 100644 --- a/compositor/Planner.h +++ b/compositor/Planner.h @@ -52,8 +52,6 @@ class Planner { return plane; } - static int ValidatePlane(DrmPlane *plane, DrmHwcLayer *layer); - // Inserts the given layer:plane in the composition at the back static int Emplace(std::vector<DrmCompositionPlane> *composition, std::vector<DrmPlane *> *planes, @@ -63,7 +61,7 @@ class Planner { std::vector<DrmPlane *> unused_planes; int ret = -ENOENT; while (plane) { - ret = ValidatePlane(plane, layer.second); + ret = plane->IsValidForLayer(layer.second) ? 0 : -EINVAL; if (!ret) break; if (!plane->zpos_property().is_immutable()) |