sdm: Add split rectangle support for split rotation.
1. Add support to split rectangle vertically and horizontally.
2. Add debug property to enable/disable split rotation.
Change-Id: I4070e7e754c2a3a3a9ca4f4eab91037f7f9c88b7
diff --git a/sdm/include/utils/debug.h b/sdm/include/utils/debug.h
index 0bd0429..0d64bbf 100644
--- a/sdm/include/utils/debug.h
+++ b/sdm/include/utils/debug.h
@@ -69,6 +69,7 @@
static int GetMaxPipesPerMixer(DisplayType display_type);
static bool IsVideoModeEnabled();
static bool IsRotatorUbwcDisabled();
+ static bool IsRotatorSplitDisabled();
private:
Debug();
diff --git a/sdm/include/utils/rect.h b/sdm/include/utils/rect.h
index 1b75d40..248b11c 100644
--- a/sdm/include/utils/rect.h
+++ b/sdm/include/utils/rect.h
@@ -45,6 +45,10 @@
LayerRect Intersection(const LayerRect &rect1, const LayerRect &rect2);
LayerRect Subtract(const LayerRect &rect1, const LayerRect &rect2);
LayerRect Reposition(const LayerRect &rect1, const int &x_offset, const int &y_offset);
+ void SplitLeftRight(const LayerRect &in_rect, uint32_t split_count, uint32_t align_x,
+ LayerRect *out_rects);
+ void SplitTopBottom(const LayerRect &in_rect, uint32_t split_count, uint32_t align_y,
+ LayerRect *out_rects);
} // namespace sdm
#endif // __RECT_H__
diff --git a/sdm/libs/utils/debug.cpp b/sdm/libs/utils/debug.cpp
index ada17cd..f240082 100644
--- a/sdm/libs/utils/debug.cpp
+++ b/sdm/libs/utils/debug.cpp
@@ -113,5 +113,12 @@
return (value == 1);
}
+bool Debug::IsRotatorSplitDisabled() {
+ int value = 0;
+ debug_.debug_handler_->GetProperty("sdm.debug.disable_rotator_split", &value);
+
+ return (value == 1);
+}
+
} // namespace sdm
diff --git a/sdm/libs/utils/rect.cpp b/sdm/libs/utils/rect.cpp
index 9edc4f4..8350340 100644
--- a/sdm/libs/utils/rect.cpp
+++ b/sdm/libs/utils/rect.cpp
@@ -138,5 +138,43 @@
return res;
}
+void SplitLeftRight(const LayerRect &in_rect, uint32_t split_count, uint32_t align_x,
+ LayerRect *out_rects) {
+ LayerRect rect_temp = in_rect;
+
+ uint32_t split_width = UINT32(rect_temp.right - rect_temp.left) / split_count;
+
+ for (uint32_t count = 0; count < split_count; count++) {
+ float aligned_right = rect_temp.left + FLOAT(CeilToMultipleOf(split_width, align_x));
+ out_rects[count].left = rect_temp.left;
+ out_rects[count].right = MIN(rect_temp.right, aligned_right);
+ out_rects[count].top = rect_temp.top;
+ out_rects[count].bottom = rect_temp.bottom;
+
+ rect_temp.left = out_rects[count].right;
+
+ Log(kTagRotator, "SplitLeftRight", out_rects[count]);
+ }
+}
+
+void SplitTopBottom(const LayerRect &in_rect, uint32_t split_count, uint32_t align_y,
+ LayerRect *out_rects) {
+ LayerRect rect_temp = in_rect;
+
+ uint32_t split_height = UINT32(rect_temp.bottom - rect_temp.top) / split_count;
+
+ for (uint32_t count = 0; count < split_count; count++) {
+ float aligned_bottom = rect_temp.top + FLOAT(CeilToMultipleOf(split_height, align_y));
+ out_rects[count].top = rect_temp.top;
+ out_rects[count].bottom = MIN(rect_temp.bottom, aligned_bottom);
+ out_rects[count].left = rect_temp.left;
+ out_rects[count].right = rect_temp.right;
+
+ rect_temp.top = out_rects[count].bottom;
+
+ Log(kTagRotator, "SplitTopBottom", out_rects[count]);
+ }
+}
+
} // namespace sdm