Allow GPU composition to occur at a lower resolution
Add a vendor-specified system property to allow GPU fallback composition to occur at a lower resolution than the display mode resolution.
Bug: 144574809
Test: Tested with sysprop disabled, and tested backport in Android Q with sysprop enabled. Unable to test on Android R due to device issues.
Change-Id: I02948ce72f49d20416d0e4dd45a4cffe99e28820
diff --git a/services/surfaceflinger/DisplayHardware/FramebufferSurface.h b/services/surfaceflinger/DisplayHardware/FramebufferSurface.h
index 7f451a5..a1859f3 100644
--- a/services/surfaceflinger/DisplayHardware/FramebufferSurface.h
+++ b/services/surfaceflinger/DisplayHardware/FramebufferSurface.h
@@ -23,6 +23,7 @@
#include <compositionengine/DisplaySurface.h>
#include <compositionengine/impl/HwcBufferCache.h>
#include <gui/ConsumerBase.h>
+#include <ui/Size.h>
#include "DisplayIdentification.h"
@@ -39,7 +40,8 @@
class FramebufferSurface : public ConsumerBase, public compositionengine::DisplaySurface {
public:
FramebufferSurface(HWComposer& hwc, DisplayId displayId,
- const sp<IGraphicBufferConsumer>& consumer);
+ const sp<IGraphicBufferConsumer>& consumer, uint32_t maxWidth,
+ uint32_t maxHeight);
virtual status_t beginFrame(bool mustRecompose);
virtual status_t prepareFrame(CompositionType compositionType);
@@ -47,7 +49,7 @@
virtual void onFrameCommitted();
virtual void dumpAsString(String8& result) const;
- virtual void resizeBuffers(const uint32_t width, const uint32_t height);
+ virtual void resizeBuffers(uint32_t width, uint32_t height);
virtual const sp<Fence>& getClientTargetAcquireFence() const override;
@@ -58,6 +60,9 @@
virtual void dumpLocked(String8& result, const char* prefix) const;
+ // Limits the width and height by the maximum width specified in the constructor.
+ ui::Size limitFramebufferSize(uint32_t width, uint32_t height);
+
// nextBuffer waits for and then latches the next buffer from the
// BufferQueue and releases the previously latched buffer to the
// BufferQueue. The new buffer is returned in the 'buffer' argument.
@@ -66,6 +71,14 @@
const DisplayId mDisplayId;
+ // Framebuffer size has a dimension limitation in pixels based on the graphics capabilities of
+ // the device.
+ const uint32_t mMaxWidth;
+
+ // Framebuffer size has a dimension limitation in pixels based on the graphics capabilities of
+ // the device.
+ const uint32_t mMaxHeight;
+
// mCurrentBufferIndex is the slot index of the current buffer or
// INVALID_BUFFER_SLOT to indicate that either there is no current buffer
// or the buffer is not associated with a slot.