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

Commit 3774e13e authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 12651823 from e4002e31 to 25Q1-release

Change-Id: I36ec23de55b6b5afe6ac7427cafd3dfb3766beb3
parents 921762ca e4002e31
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -318,7 +318,7 @@ size_t AChoreographerFrameCallbackData_getPreferredFrameTimelineIndex(

/**
 * Gets the token used by the platform to identify the frame timeline at the given \c index.
 * q
 *
 * Available since API level 33.
 *
 * \param index index of a frame timeline, in \f( [0, FrameTimelinesLength) \f). See
+7 −0
Original line number Diff line number Diff line
### Buffer Stuffing and Recovery ###

Buffer stuffing happens on the client side when SurfaceFlinger misses a frame, but the client continues producing buffers at the same rate. This could occur anytime when SurfaceFlinger does not meet the expected timeline’s deadline to finish composing a frame. As a result, SurfaceFlinger cannot yet release the buffer for the frame that it missed and the client has one less buffer to render into. The client may then run out of buffers or have to wait for buffer release callbacks, increasing the chances of janking when clients render multiple windows.

Recovery is implemented by first detecting when buffer stuffing occurs and ensuring that the elevated buffer counts in the server are from a relevant SurfaceControl (is a ViewRootImpl). Other SurfaceControl buffer producers such as games, media, and camera have other reasons for expectedly increased buffer counts, which do not need buffer stuffing recovery.

The actual recovery adjusts the animation timeline in the Choreographer so that the client deadlines for subsequent frames are moved forward in time by one frame. This approach adjusts the client buffer production timeline such that SurfaceFlinger does not fall behind when it misses a frame because the client will simply match its frame production rate with SurfaceFlinger. Ordinarily, buffer stuffing is problematic because the client continues producing buffers when SurfaceFlinger is behind. However, if the client delays producing its buffers to match SurfaceFlinger’s rate, the animation has new frame deadlines that can be reasonably met. The animation is effectively paused for one frame longer than originally intended, and continues the remainder of the animation normally.
 No newline at end of file
+1 −1
Original line number Diff line number Diff line
@@ -119,7 +119,7 @@ public:
            HdcpLevelsChange hdcpLevelsChange;
        };
    };
    static_assert(sizeof(Event) == 216);
    static_assert(sizeof(Event) == 224);

public:
    /*
+1 −1
Original line number Diff line number Diff line
@@ -414,7 +414,7 @@ public:
        uint64_t nextFrameNumber{0};
        FrameEventHistoryDelta frameTimestamps;
        bool bufferReplaced{false};
        int maxBufferCount{0};
        int maxBufferCount{BufferQueueDefs::NUM_BUFFER_SLOTS};
        status_t result{NO_ERROR};
    };

+4 −0
Original line number Diff line number Diff line
@@ -171,6 +171,10 @@ struct layer_state_t {
        // Sets a property on this layer indicating that its visible region should be considered
        // when computing TrustedPresentation Thresholds.
        eCanOccludePresentation = 0x1000,
        // Indicates that the SurfaceControl should recover from buffer stuffing when
        // possible. This is the case when the SurfaceControl is the root SurfaceControl
        // owned by ViewRootImpl.
        eRecoverableFromBufferStuffing = 0x2000,
    };

    enum {
Loading