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/hwc3/ComposerClient.cpp b/hwc3/ComposerClient.cpp
index ff3d42e..4ffc75b 100644
--- a/hwc3/ComposerClient.cpp
+++ b/hwc3/ComposerClient.cpp
@@ -49,11 +49,13 @@
#include "hwc3/DrmHwcThree.h"
#include "hwc3/Utils.h"
+using ::android::DstRectInfo;
using ::android::HwcDisplay;
using ::android::HwcDisplayConfig;
using ::android::HwcDisplayConfigs;
using ::android::HwcLayer;
using ::android::LayerTransform;
+using ::android::SrcRectInfo;
#include "utils/log.h"
@@ -290,18 +292,29 @@
return aidl_configuration;
}
-std::optional<hwc_rect> AidlToRect(const std::optional<common::Rect>& rect) {
+std::optional<DstRectInfo> AidlToRect(const std::optional<common::Rect>& rect) {
if (!rect) {
return std::nullopt;
}
- return hwc_rect{rect->left, rect->top, rect->right, rect->bottom};
+ DstRectInfo dst_rec;
+ dst_rec.i_rect = {.left = rect->left,
+ .top = rect->top,
+ .right = rect->right,
+ .bottom = rect->bottom};
+ return dst_rec;
}
-std::optional<hwc_frect> AidlToFRect(const std::optional<common::FRect>& rect) {
+std::optional<SrcRectInfo> AidlToFRect(
+ const std::optional<common::FRect>& rect) {
if (!rect) {
return std::nullopt;
}
- return hwc_frect{rect->left, rect->top, rect->right, rect->bottom};
+ SrcRectInfo src_rect;
+ src_rect.f_rect = {.left = rect->left,
+ .top = rect->top,
+ .right = rect->right,
+ .bottom = rect->bottom};
+ return src_rect;
}
std::optional<float> AidlToAlpha(const std::optional<PlaneAlpha>& alpha) {