trusty: tui: assume device params apply rotation to dimensions
This cleans up the abstraction provided by the device parameters and
layout context. Critically it avoids special handling in the confui
port test.
Bug: 289339705
Test: build.py
Change-Id: I743b4dc10f8995a8d01f79c895ead623e5ceb2a9
diff --git a/src/trusty_confirmation_ui.cpp b/src/trusty_confirmation_ui.cpp
index 997abd7..f2c35d3 100644
--- a/src/trusty_confirmation_ui.cpp
+++ b/src/trusty_confirmation_ui.cpp
@@ -146,23 +146,26 @@
return ResponseCode::UIError;
}
- /* Check the layout context and framebuffer agree on dimensions,
- * ignoring rotation for now.
- */
- if (*ctx->getParam<RightEdgeOfScreen>() != pxs(fb_info_[i].width) ||
- *ctx->getParam<BottomOfScreen>() != pxs(fb_info_[i].height)) {
+ /* Get rotated frame buffer dimensions */
+ uint32_t rwidth, rheight;
+
+ if (fb_info_[i].rotation == TTUI_DRAW_ROTATION_90 ||
+ fb_info_[i].rotation == TTUI_DRAW_ROTATION_270) {
+ rwidth = fb_info_[i].height;
+ rheight = fb_info_[i].width;
+ } else {
+ rwidth = fb_info_[i].width;
+ rheight = fb_info_[i].height;
+ }
+
+ /* Check the layout context and framebuffer agree on dimensions */
+ if (*ctx->getParam<RightEdgeOfScreen>() != pxs(rwidth) ||
+ *ctx->getParam<BottomOfScreen>() != pxs(rheight)) {
TLOGE("Framebuffer dimensions do not match panel configuration\n");
stop();
return ResponseCode::UIError;
}
- /* Swap dimensions if rotating */
- if (fb_info_[i].rotation == TTUI_DRAW_ROTATION_90 ||
- fb_info_[i].rotation == TTUI_DRAW_ROTATION_270) {
- ctx->setParam<RightEdgeOfScreen>(pxs(fb_info_[i].height));
- ctx->setParam<BottomOfScreen>(pxs(fb_info_[i].width));
- }
-
/* Set the colours */
updateColorScheme(&ctx.value(), inverted_);
diff --git a/test/main.cpp b/test/main.cpp
index 82968e2..094a8fc 100644
--- a/test/main.cpp
+++ b/test/main.cpp
@@ -133,7 +133,7 @@
"pixel coverage %" PRIu32 ".%" PRIu32 "%%",
coverage / 10, coverage % 10);
- trusty_unittest_printf("[ DATA ] %" PRIu32 "x%" PRIu32
+ trusty_unittest_printf("[ DATA ] %" PRIu32 " x %" PRIu32
", %" PRIu32
" plot calls = approx %" PRIu32
".%" PRIu32 "%% coverage\n",