Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 50eda720 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "SF: Add ro.surface_flinger.min_acquired_buffers"

parents f17f8c1c a1456c16
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -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;
@@ -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);
@@ -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 {
+4 −0
Original line number Diff line number Diff line
@@ -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;
+11 −1
Original line number Diff line number Diff line
@@ -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"
}
+5 −0
Original line number Diff line number Diff line
@@ -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
+5 −0
Original line number Diff line number Diff line
@@ -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