BufferQueue: handle consumer driven size for pre-rotation
This change adds an option for the producer to set auto pre-rotation on the
buffers to be allocated. When auto pre-rotation is enabled, if the current
buffer size is driven by the consumer and there's 90 or 270 degree rotation
specified in the transform hint currently used by the producer, then the
dimension of the buffers to be allocated will be additionally swapped upon
buffers pre-allocaton or dequeueBuffer.
Auto prerotaion will be cached at Surface producer side, and will be
reset to false upon Surface disconnection.
Bug: 129422697
Test: atest libgui_test:SurfaceTest#DequeueWithConsumerDrivenSize
Change-Id: I01ddf3e00d5951935e557d18932ea9869f36b5d6
diff --git a/libs/nativewindow/ANativeWindow.cpp b/libs/nativewindow/ANativeWindow.cpp
index 8435dac..1751443 100644
--- a/libs/nativewindow/ANativeWindow.cpp
+++ b/libs/nativewindow/ANativeWindow.cpp
@@ -262,3 +262,7 @@
int ANativeWindow_setAutoRefresh(ANativeWindow* window, bool autoRefresh) {
return native_window_set_auto_refresh(window, autoRefresh);
}
+
+int ANativeWindow_setAutoPrerotation(ANativeWindow* window, bool autoPrerotation) {
+ return native_window_set_auto_prerotation(window, autoPrerotation);
+}