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

Commit 799bcb84 authored by Su Hong Koo's avatar Su Hong Koo Committed by Android (Google) Code Review
Browse files

Merge "SF: Replace the active display terminology with front internal display" into main

parents 01334063 15c951b6
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
@@ -286,7 +286,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:
@@ -1034,7 +1034,7 @@ private:

    sp<DisplayDevice> getPacesetterDisplayLocked() REQUIRES(mStateLock) {
        if (!FlagManager::getInstance().pacesetter_selection()) {
            return getActiveDisplayLocked();
            return getFrontInternalDisplayLocked();
        }
        return getDisplayDeviceLocked(mScheduler->getPacesetterDisplayId());
    }
@@ -1044,17 +1044,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>;
@@ -1200,14 +1200,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
@@ -1403,7 +1402,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;

@@ -1513,11 +1512,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