drm_hwcomposer: Support default values for Rect structures
This commit introduces two improvements:
1. Introduces frontend-agnostic structures for rects.
2. Support default values in them so that the backend can handle
cases where rects are not specified by the client, like
the client layer display frame, etc.
This reduces the complexity of the Internal layer, making it
feasible to use a single Frontend<->Internal layer API for
regular layers, as well as for the Client and Output layers.
Change-Id: Iab5030ad523d36ea4c5af142f6f628952467d6ab
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
diff --git a/drm/DrmAtomicStateManager.cpp b/drm/DrmAtomicStateManager.cpp
index 9ce9a93..299d30c 100644
--- a/drm/DrmAtomicStateManager.cpp
+++ b/drm/DrmAtomicStateManager.cpp
@@ -120,6 +120,9 @@
return -EINVAL;
}
+ auto raw_mode = args.display_mode.value().GetRawMode();
+ whole_display_rect_.i_rect = {0, 0, raw_mode.hdisplay, raw_mode.vdisplay};
+
if (!crtc->GetModeProperty().AtomicSet(*pset, *new_frame_state.mode_blob)) {
return -EINVAL;
}
@@ -141,12 +144,14 @@
if (args.colorspace && connector->GetColorspaceProperty()) {
if (!connector->GetColorspaceProperty()
- .AtomicSet(*pset, connector->GetColorspacePropertyValue(*args.colorspace)))
+ .AtomicSet(*pset, connector->GetColorspacePropertyValue(
+ *args.colorspace)))
return -EINVAL;
}
if (args.content_type && connector->GetContentTypeProperty()) {
- if (!connector->GetContentTypeProperty().AtomicSet(*pset, *args.content_type))
+ if (!connector->GetContentTypeProperty().AtomicSet(*pset,
+ *args.content_type))
return -EINVAL;
}
@@ -181,8 +186,8 @@
auto &v = unused_planes;
v.erase(std::remove(v.begin(), v.end(), joining.plane), v.end());
- if (plane->AtomicSetState(*pset, layer, joining.z_pos, crtc->GetId()) !=
- 0) {
+ if (plane->AtomicSetState(*pset, layer, joining.z_pos, crtc->GetId(),
+ whole_display_rect_) != 0) {
return -EINVAL;
}
}