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

Commit bf5430d3 authored by Tatenda Chipeperekwa's avatar Tatenda Chipeperekwa Committed by Linux Build Service Account
Browse files

sf: vds: Fixes and code cleanup for VirtualDisplaySurface

1. Remove unused variable declarations

   Remove static variable sForceHwcCopy that is not required since moving
   to an implementation that uses a local variable mForceHwcCopy.

2. Add a condition to reduce log spam from advanceFrame hook

   When mForceHwcCopy is true, we override the composition type to MIXED.
   Therefore, we need to check whether we are in this scenario and add
   checks to satisfy the state machine requirements and reduce log spam.
   In particular, by setting mForceHwcCopy we can now expect to get an
   advanceFrame when composition type is MIXED and our previous state was
   PREPARED or GLES_DONE.

Change-Id: I1f47d6d6f01deec17da9069dea32c382c8f39b02
parent e875af1a
Loading
Loading
Loading
Loading
+14 −7
Original line number Diff line number Diff line
@@ -25,12 +25,6 @@
namespace android {
// ---------------------------------------------------------------------------

#if defined(FORCE_HWC_COPY_FOR_VIRTUAL_DISPLAYS)
static const bool sForceHwcCopy = true;
#else
static const bool sForceHwcCopy = false;
#endif

#define VDS_LOGE(msg, ...) ALOGE("[%s] " msg, \
        mDisplayName.string(), ##__VA_ARGS__)
#define VDS_LOGW_IF(cond, msg, ...) ALOGW_IF(cond, "[%s] " msg, \
@@ -219,7 +213,20 @@ status_t VirtualDisplaySurface::advanceFrame() {
    if (mDisplayId < 0)
        return NO_ERROR;

    if (mCompositionType == COMPOSITION_HWC) {
    // When mForceHwcCopy is true, we override the composition type to MIXED.
    // Therefore, we need to check whether we are in this scenario and add
    // checks to satisfy the state machine requirements and reduce log spam.
    // In particular, by setting mForceHwcCopy we can now expect to get an
    // advanceFrame when composition type is MIXED and our previous state was
    // PREPARED or GLES_DONE.
    if (mForceHwcCopy && (mCompositionType == COMPOSITION_MIXED)) {
        bool isValidState = (mDbgState == DBG_STATE_PREPARED) ||
                (mDbgState == DBG_STATE_GLES_DONE);
        VDS_LOGW_IF(!isValidState,
                "Unexpected advanceFrame() in %s state on %s frame",
                dbgStateStr(),
                (mDbgState == DBG_STATE_PREPARED) ? "HWC" : "GLES/MIXED");
    } else if (mCompositionType == COMPOSITION_HWC) {
        VDS_LOGW_IF(mDbgState != DBG_STATE_PREPARED,
                "Unexpected advanceFrame() in %s state on HWC frame",
                dbgStateStr());