Loading services/surfaceflinger/SurfaceFlinger.cpp +4 −1 Original line number Diff line number Diff line Loading @@ -324,6 +324,7 @@ int64_t SurfaceFlinger::dispSyncPresentTimeOffset; bool SurfaceFlinger::useHwcForRgbToYuv; bool SurfaceFlinger::hasSyncFramework; int64_t SurfaceFlinger::maxFrameBufferAcquiredBuffers; int64_t SurfaceFlinger::minAcquiredBuffers = 1; uint32_t SurfaceFlinger::maxGraphicsWidth; uint32_t SurfaceFlinger::maxGraphicsHeight; bool SurfaceFlinger::useContextPriority; Loading Loading @@ -385,6 +386,8 @@ SurfaceFlinger::SurfaceFlinger(Factory& factory) : SurfaceFlinger(factory, SkipI useHwcForRgbToYuv = force_hwc_copy_for_virtual_displays(false); maxFrameBufferAcquiredBuffers = max_frame_buffer_acquired_buffers(2); minAcquiredBuffers = SurfaceFlingerProperties::min_acquired_buffers().value_or(minAcquiredBuffers); maxGraphicsWidth = std::max(max_graphics_width(0), 0); maxGraphicsHeight = std::max(max_graphics_height(0), 0); Loading Loading @@ -7849,7 +7852,7 @@ int SurfaceFlinger::calculateMaxAcquiredBufferCount(Fps refreshRate, if (presentLatency.count() % refreshRate.getPeriodNsecs()) { pipelineDepth++; } return std::max(1ll, pipelineDepth - 1); return std::max(minAcquiredBuffers, static_cast<int64_t>(pipelineDepth - 1)); } status_t SurfaceFlinger::getMaxAcquiredBufferCount(int* buffers) const { Loading services/surfaceflinger/SurfaceFlinger.h +4 −0 Original line number Diff line number Diff line Loading @@ -226,6 +226,10 @@ public: // FramebufferSurface static int64_t maxFrameBufferAcquiredBuffers; // Controls the minimum acquired buffers SurfaceFlinger will suggest via // ISurfaceComposer.getMaxAcquiredBufferCount(). static int64_t minAcquiredBuffers; // Controls the maximum width and height in pixels that the graphics pipeline can support for // GPU fallback composition. For example, 8k devices with 4k GPUs, or 4k devices with 2k GPUs. static uint32_t maxGraphicsWidth; Loading services/surfaceflinger/sysprop/SurfaceFlingerProperties.sysprop +11 −1 Original line number Diff line number Diff line Loading @@ -471,3 +471,13 @@ prop { access: Readonly prop_name: "ro.surface_flinger.ignore_hdr_camera_layers" } # Controls the minimum acquired buffers SurfaceFlinger will suggest via # ISurfaceComposer.getMaxAcquiredBufferCount(). prop { api_name: "min_acquired_buffers" type: Long scope: Public access: Readonly prop_name: "ro.surface_flinger.min_acquired_buffers" } services/surfaceflinger/sysprop/api/SurfaceFlingerProperties-current.txt +5 −0 Original line number Diff line number Diff line Loading @@ -92,6 +92,11 @@ props { type: Long prop_name: "ro.surface_flinger.max_virtual_display_dimension" } prop { api_name: "min_acquired_buffers" type: Long prop_name: "ro.surface_flinger.min_acquired_buffers" } prop { api_name: "present_time_offset_from_vsync_ns" type: Long Loading services/surfaceflinger/tests/unittests/SchedulerTest.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -249,6 +249,11 @@ TEST_F(SchedulerTest, calculateMaxAcquiredBufferCount) { EXPECT_EQ(2, mFlinger.calculateMaxAcquiredBufferCount(60_Hz, 40ms)); EXPECT_EQ(1, mFlinger.calculateMaxAcquiredBufferCount(60_Hz, 10ms)); const auto savedMinAcquiredBuffers = mFlinger.mutableMinAcquiredBuffers(); mFlinger.mutableMinAcquiredBuffers() = 2; EXPECT_EQ(2, mFlinger.calculateMaxAcquiredBufferCount(60_Hz, 10ms)); mFlinger.mutableMinAcquiredBuffers() = savedMinAcquiredBuffers; } MATCHER(Is120Hz, "") { Loading Loading
services/surfaceflinger/SurfaceFlinger.cpp +4 −1 Original line number Diff line number Diff line Loading @@ -324,6 +324,7 @@ int64_t SurfaceFlinger::dispSyncPresentTimeOffset; bool SurfaceFlinger::useHwcForRgbToYuv; bool SurfaceFlinger::hasSyncFramework; int64_t SurfaceFlinger::maxFrameBufferAcquiredBuffers; int64_t SurfaceFlinger::minAcquiredBuffers = 1; uint32_t SurfaceFlinger::maxGraphicsWidth; uint32_t SurfaceFlinger::maxGraphicsHeight; bool SurfaceFlinger::useContextPriority; Loading Loading @@ -385,6 +386,8 @@ SurfaceFlinger::SurfaceFlinger(Factory& factory) : SurfaceFlinger(factory, SkipI useHwcForRgbToYuv = force_hwc_copy_for_virtual_displays(false); maxFrameBufferAcquiredBuffers = max_frame_buffer_acquired_buffers(2); minAcquiredBuffers = SurfaceFlingerProperties::min_acquired_buffers().value_or(minAcquiredBuffers); maxGraphicsWidth = std::max(max_graphics_width(0), 0); maxGraphicsHeight = std::max(max_graphics_height(0), 0); Loading Loading @@ -7849,7 +7852,7 @@ int SurfaceFlinger::calculateMaxAcquiredBufferCount(Fps refreshRate, if (presentLatency.count() % refreshRate.getPeriodNsecs()) { pipelineDepth++; } return std::max(1ll, pipelineDepth - 1); return std::max(minAcquiredBuffers, static_cast<int64_t>(pipelineDepth - 1)); } status_t SurfaceFlinger::getMaxAcquiredBufferCount(int* buffers) const { Loading
services/surfaceflinger/SurfaceFlinger.h +4 −0 Original line number Diff line number Diff line Loading @@ -226,6 +226,10 @@ public: // FramebufferSurface static int64_t maxFrameBufferAcquiredBuffers; // Controls the minimum acquired buffers SurfaceFlinger will suggest via // ISurfaceComposer.getMaxAcquiredBufferCount(). static int64_t minAcquiredBuffers; // Controls the maximum width and height in pixels that the graphics pipeline can support for // GPU fallback composition. For example, 8k devices with 4k GPUs, or 4k devices with 2k GPUs. static uint32_t maxGraphicsWidth; Loading
services/surfaceflinger/sysprop/SurfaceFlingerProperties.sysprop +11 −1 Original line number Diff line number Diff line Loading @@ -471,3 +471,13 @@ prop { access: Readonly prop_name: "ro.surface_flinger.ignore_hdr_camera_layers" } # Controls the minimum acquired buffers SurfaceFlinger will suggest via # ISurfaceComposer.getMaxAcquiredBufferCount(). prop { api_name: "min_acquired_buffers" type: Long scope: Public access: Readonly prop_name: "ro.surface_flinger.min_acquired_buffers" }
services/surfaceflinger/sysprop/api/SurfaceFlingerProperties-current.txt +5 −0 Original line number Diff line number Diff line Loading @@ -92,6 +92,11 @@ props { type: Long prop_name: "ro.surface_flinger.max_virtual_display_dimension" } prop { api_name: "min_acquired_buffers" type: Long prop_name: "ro.surface_flinger.min_acquired_buffers" } prop { api_name: "present_time_offset_from_vsync_ns" type: Long Loading
services/surfaceflinger/tests/unittests/SchedulerTest.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -249,6 +249,11 @@ TEST_F(SchedulerTest, calculateMaxAcquiredBufferCount) { EXPECT_EQ(2, mFlinger.calculateMaxAcquiredBufferCount(60_Hz, 40ms)); EXPECT_EQ(1, mFlinger.calculateMaxAcquiredBufferCount(60_Hz, 10ms)); const auto savedMinAcquiredBuffers = mFlinger.mutableMinAcquiredBuffers(); mFlinger.mutableMinAcquiredBuffers() = 2; EXPECT_EQ(2, mFlinger.calculateMaxAcquiredBufferCount(60_Hz, 10ms)); mFlinger.mutableMinAcquiredBuffers() = savedMinAcquiredBuffers; } MATCHER(Is120Hz, "") { Loading