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

Commit 15c951b6 authored by Su Hong Koo's avatar Su Hong Koo
Browse files

SF: Replace the active display terminology with front internal display

Active display is ultimately in service of foldable displays. As we
move to remove and replace the active display concept, we should make
the relationship clear.

Rename the following members of SurfaceFlinger:
* onActiveDisplayChangedLocked()
* getActiveDisplayDevice*()
* sActiveDisplayRotationFlags
* mActiveDisplayTransformHint

Flag: EXEMPT renaming
Bug: 255635821
Test: presubmit
Change-Id: Ifada4a46974b0e24be6b9e8cf6ae675ceb48dbc5
parent 76b2fc03
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1173,7 +1173,7 @@ Rect Layer::getBufferSize(const State& /*s*/) const {
    }

    if (getTransformToDisplayInverse()) {
        uint32_t invTransform = SurfaceFlinger::getActiveDisplayRotationFlags();
        uint32_t invTransform = SurfaceFlinger::getFrontInternalDisplayRotationFlags();
        if (invTransform & ui::Transform::ROT_90) {
            std::swap(bufWidth, bufHeight);
        }
+1 −1
Original line number Diff line number Diff line
@@ -291,7 +291,7 @@ void LayerFE::prepareBufferStateClientComposition(
         * the code below applies the primary display's inverse transform to
         * the texture transform
         */
        uint32_t transform = SurfaceFlinger::getActiveDisplayRotationFlags();
        uint32_t transform = SurfaceFlinger::getFrontInternalDisplayRotationFlags();
        mat4 tr = inverseOrientation(transform);

        /**
+1 −1
Original line number Diff line number Diff line
@@ -279,7 +279,7 @@ void RegionSamplingThread::captureSample() {

    {
        // TODO(b/159112860): Don't keep sp<DisplayDevice> outside of SF main thread
        const sp<const DisplayDevice> display = mFlinger.getActiveDisplay();
        const sp<const DisplayDevice> display = mFlinger.getFrontInternalDisplay();
        displayWeak = display;
        layerStack = display->getLayerStack();
        orientation = ui::Transform::toRotationFlags(display->getOrientation());
+70 −74

File changed.

Preview size limit exceeded, changes collapsed.

+16 −17
Original line number Diff line number Diff line
@@ -342,8 +342,8 @@ public:
    // TODO (b/281857977): This should be annotated with REQUIRES(kMainThreadContext), but this
    // would require thread safety annotations throughout the frontend (in particular Layer and
    // LayerFE).
    static ui::Transform::RotationFlags getActiveDisplayRotationFlags() {
        return sActiveDisplayRotationFlags;
    static ui::Transform::RotationFlags getFrontInternalDisplayRotationFlags() {
        return sFrontInternalDisplayRotationFlags;
    }

protected:
@@ -1005,7 +1005,7 @@ private:

    sp<DisplayDevice> getPacesetterDisplayLocked() REQUIRES(mStateLock) {
        if (!FlagManager::getInstance().pacesetter_selection()) {
            return getActiveDisplayLocked();
            return getFrontInternalDisplayLocked();
        }
        return getDisplayDeviceLocked(mScheduler->getPacesetterDisplayId());
    }
@@ -1015,17 +1015,17 @@ private:
        return getPacesetterDisplayLocked();
    }

    sp<const DisplayDevice> getActiveDisplayLocked() const REQUIRES(mStateLock) {
        return const_cast<SurfaceFlinger*>(this)->getActiveDisplayLocked();
    sp<const DisplayDevice> getFrontInternalDisplayLocked() const REQUIRES(mStateLock) {
        return const_cast<SurfaceFlinger*>(this)->getFrontInternalDisplayLocked();
    }

    sp<DisplayDevice> getActiveDisplayLocked() REQUIRES(mStateLock) {
        return getDisplayDeviceLocked(mActiveDisplayId);
    sp<DisplayDevice> getFrontInternalDisplayLocked() REQUIRES(mStateLock) {
        return getDisplayDeviceLocked(mFrontInternalDisplayId);
    }

    sp<const DisplayDevice> getActiveDisplay() const EXCLUDES(mStateLock) {
    sp<const DisplayDevice> getFrontInternalDisplay() const EXCLUDES(mStateLock) {
        Mutex::Autolock lock(mStateLock);
        return getActiveDisplayLocked();
        return getFrontInternalDisplayLocked();
    }

    using DisplayDeviceAndSnapshot = std::pair<sp<DisplayDevice>, display::DisplaySnapshotRef>;
@@ -1171,14 +1171,13 @@ private:
    void releaseVirtualDisplay(VirtualDisplayIdVariant displayId);
    void releaseVirtualDisplaySnapshot(VirtualDisplayId displayId);

    // Returns a display other than `mActiveDisplayId` that can be activated, if any.
    sp<DisplayDevice> getActivatableDisplay() const REQUIRES(mStateLock, kMainThreadContext);
    sp<DisplayDevice> findFrontInternalDisplay() const REQUIRES(mStateLock, kMainThreadContext);

    void onActiveDisplayChangedLocked(const DisplayDevice* inactiveDisplayPtr,
                                      const DisplayDevice& activeDisplay)
    void onNewFrontInternalDisplay(const DisplayDevice* oldFrontInternalDisplayPtr,
                                   const DisplayDevice& newFrontInternalDisplay)
            REQUIRES(mStateLock, kMainThreadContext);

    void onActiveDisplaySizeChanged(const DisplayDevice&);
    void onFrontInternalDisplaySizeChanged(const DisplayDevice&);

    /*
     * Debugging & dumpsys
@@ -1373,7 +1372,7 @@ private:
            GUARDED_BY(mVirtualDisplaysMutex);

    // The inner or outer display for foldables, while unfolded or folded, respectively.
    std::atomic<PhysicalDisplayId> mActiveDisplayId;
    std::atomic<PhysicalDisplayId> mFrontInternalDisplayId;

    display::DisplayModeController mDisplayModeController;

@@ -1483,11 +1482,11 @@ private:
    ActivePictureTracker::Listeners mActivePictureListenersToAdd GUARDED_BY(mStateLock);
    ActivePictureTracker::Listeners mActivePictureListenersToRemove GUARDED_BY(mStateLock);

    std::atomic<ui::Transform::RotationFlags> mActiveDisplayTransformHint;
    std::atomic<ui::Transform::RotationFlags> mFrontInternalDisplayTransformHint;

    // Must only be accessed on the main thread.
    // TODO (b/259407931): Remove.
    static ui::Transform::RotationFlags sActiveDisplayRotationFlags;
    static ui::Transform::RotationFlags sFrontInternalDisplayRotationFlags;

    bool isRefreshRateOverlayEnabled() const REQUIRES(mStateLock) {
        return hasDisplay(
Loading