aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmit Pundir <amit.pundir@linaro.org>2022-10-06 11:22:21 +0530
committerAmit Pundir <amit.pundir@linaro.org>2022-10-06 11:22:54 +0530
commita393df4bcfdf37fbe7b1714dc3610505a41618a9 (patch)
tree202bce01b6b7ce65c46f95b5730ea45833e3b656
parent5944fd14ed04728be3f6f87d15ddf71d801a221a (diff)
parentce2ce75a366db0dc60e0a521aaa66daa06701417 (diff)
downloaddrm_hwcomposer-a393df4bcfdf37fbe7b1714dc3610505a41618a9.tar.gz
drm_hwcomposer: Merge 'aosp/upstream-main' into HEAD
Sync with upstream * aosp/upstream-main: drm_hwcomposer: Basic support for shared primary planes drm_hwcomposer: check if the primary plane is being used by any crtc drm_hwcomposer: fix BufferInfoImagination build Change-Id: Id558c88c0f3b64e8c8bd33cb8d20f778ba610d85 Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
-rw-r--r--bufferinfo/legacy/BufferInfoImagination.cpp2
-rw-r--r--drm/DrmDisplayPipeline.cpp12
-rw-r--r--drm/DrmPlane.cpp17
3 files changed, 24 insertions, 7 deletions
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:
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 {};
}
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;
}