From 5089ffe0de69bc23aeac3601ff5ff1c83ef59254 Mon Sep 17 00:00:00 2001 From: Andrii Chepurnyi Date: Thu, 25 Aug 2022 20:22:39 +0300 Subject: drm_hwcomposer: fix BufferInfoImagination build Commit e9fbd8d626a2 ("drm_hwcomposer: Set return type to std::optional for BufferInfoGetters") changed the BufferInfo variable name, but missed the case defined under HAL_PIXEL_FORMAT_BGRX_8888. This results in build failures. This patch fixes the build issue by completing the variable renaming. Fixes: e9fbd8d626a2 ("drm_hwcomposer: Set return type to std::optional for BufferInfoGetters") Signed-off-by: Andrii Chepurnyi --- bufferinfo/legacy/BufferInfoImagination.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bufferinfo/legacy/BufferInfoImagination.cpp b/bufferinfo/legacy/BufferInfoImagination.cpp index 1858ddb..6d917c2 100644 --- a/bufferinfo/legacy/BufferInfoImagination.cpp +++ b/bufferinfo/legacy/BufferInfoImagination.cpp @@ -51,7 +51,7 @@ auto BufferInfoImagination::GetBoInfo(buffer_handle_t handle) switch (hnd->iFormat) { #ifdef HAL_PIXEL_FORMAT_BGRX_8888 case HAL_PIXEL_FORMAT_BGRX_8888: - bo->format = DRM_FORMAT_XRGB8888; + bi.format = DRM_FORMAT_XRGB8888; break; #endif default: -- cgit v1.2.3 From 7ee6a9ea6b6873742b7716517f1be18ce39a7524 Mon Sep 17 00:00:00 2001 From: Yongqin Liu Date: Sat, 11 Dec 2021 20:39:05 +0800 Subject: drm_hwcomposer: check if the primary plane is being used by any crtc Some DRM driver such as omap_drm allow sharing primary plane between CRTCs. drm_hwcomposer isn't ready for such a scenarios and fails with an error: Found more than 1 primary plane for CRTC Don't report multiple primary planes for single CRTC to satisfy the drm_hwc. Signed-off-by: Yongqin Liu --- drm/DrmPlane.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drm/DrmPlane.cpp b/drm/DrmPlane.cpp index 329ef1c..5051d35 100644 --- a/drm/DrmPlane.cpp +++ b/drm/DrmPlane.cpp @@ -148,6 +148,23 @@ int DrmPlane::Init() { } bool DrmPlane::IsCrtcSupported(const DrmCrtc &crtc) const { + unsigned int crtc_property_value = 0; + std::tie(std::ignore, crtc_property_value) = crtc_property_.value(); + if (crtc_property_value != 0 && crtc_property_value != crtc.GetId() && + GetType() == DRM_PLANE_TYPE_PRIMARY) { + // Some DRM driver such as omap_drm allows sharing primary plane between + // CRTCs, but the primay plane could not be shared if it has been used by + // any CRTC already, which is protected by the plane_switching_crtc function + // in the kernel drivers/gpu/drm/drm_atomic.c file. + // The current drm_hwc design is not ready to support such scenario yet, + // so adding the CRTC status check here to workaorund for now. + ALOGW( + "%s: This Plane(id=%d) is activated for Crtc(id=%d), could not be used " + "for Crtc (id=%d)", + __FUNCTION__, GetId(), crtc_property_value, crtc.GetId()); + return false; + } + return ((1 << crtc.GetIndexInResArray()) & plane_->possible_crtcs) != 0; } -- cgit v1.2.3 From ce2ce75a366db0dc60e0a521aaa66daa06701417 Mon Sep 17 00:00:00 2001 From: Roman Stratiienko Date: Thu, 29 Sep 2022 19:55:01 +0300 Subject: drm_hwcomposer: Basic support for shared primary planes For now just bind the first suitable primary plane to the pipeline on creation. Closes: https://gitlab.freedesktop.org/drm-hwcomposer/drm-hwcomposer/-/issues/68 Change-Id: Idc4a7a5ac9d768d2614e1cd8a460d742f406a1cc Signed-off-by: Roman Stratiienko --- drm/DrmDisplayPipeline.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drm/DrmDisplayPipeline.cpp b/drm/DrmDisplayPipeline.cpp index f993d28..e81544d 100644 --- a/drm/DrmDisplayPipeline.cpp +++ b/drm/DrmDisplayPipeline.cpp @@ -86,15 +86,15 @@ static auto TryCreatePipeline(DrmDevice &dev, DrmConnector &connector, return {}; } - if (primary_planes.size() > 1) { - ALOGE("Found more than 1 primary plane for CRTC %d", crtc.GetId()); - return {}; + for (const auto &plane : primary_planes) { + pipe->primary_plane = plane->BindPipeline(pipe.get()); + if (pipe->primary_plane) { + break; + } } - pipe->primary_plane = primary_planes[0]->BindPipeline(pipe.get()); if (!pipe->primary_plane) { - ALOGE("Primary plane %d is already owned. Internal error.", - primary_planes[0]->GetId()); + ALOGE("Failed to bind primary plane"); return {}; } -- cgit v1.2.3