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

Commit 045b7005 authored by Marin Shalamanov's avatar Marin Shalamanov
Browse files

SF: Don't cache display modes in HWComposer

The display modes should be stored only in DisplayDevice.
Having the state also in HWComposer is unnesesary and hard to
keep in sync with SF, e.g. during hotplug processing of
displays which can change their supported modes.

Any HWC calls which need to validate their parameters need
to go through display device. This additinally makes the
code more undestandable.

Bug: 159590486
Test: presubmit
Change-Id: I40b03c09a5fd6092fca0682d602deb70db022fa5
parent ca5d8908
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -377,7 +377,7 @@ bool BufferLayer::onPostComposition(const DisplayDevice* display,
               displayId && mFlinger->getHwComposer().isConnected(*displayId)) {
        // The HWC doesn't support present fences, so use the refresh
        // timestamp instead.
        const nsecs_t actualPresentTime = mFlinger->getHwComposer().getRefreshTimestamp(*displayId);
        const nsecs_t actualPresentTime = display->getRefreshTimestamp();
        mFlinger->mTimeStats->setPresentTime(layerId, mCurrentFrameNumber, actualPresentTime);
        mFlinger->mFrameTracer->traceTimestamp(layerId, getCurrentBufferId(), mCurrentFrameNumber,
                                               actualPresentTime,
+2 −1
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

#pragma once

#include <ui/Size.h>
#include <utils/Errors.h>
#include <utils/RefBase.h>
#include <utils/StrongPointer.h>
@@ -71,7 +72,7 @@ public:

    virtual void dumpAsString(String8& result) const = 0;

    virtual void resizeBuffers(const uint32_t w, const uint32_t h) = 0;
    virtual void resizeBuffers(const ui::Size&) = 0;

    virtual const sp<Fence>& getClientTargetAcquireFence() const = 0;
};
+2 −1
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@

#include <compositionengine/DisplaySurface.h>
#include <gmock/gmock.h>
#include <ui/Size.h>
#include <utils/String8.h>

namespace android::compositionengine::mock {
@@ -32,7 +33,7 @@ public:
    MOCK_METHOD0(advanceFrame, status_t());
    MOCK_METHOD0(onFrameCommitted, void());
    MOCK_CONST_METHOD1(dumpAsString, void(String8& result));
    MOCK_METHOD2(resizeBuffers, void(uint32_t, uint32_t));
    MOCK_METHOD1(resizeBuffers, void(const ui::Size&));
    MOCK_CONST_METHOD0(getClientTargetAcquireFence, const sp<Fence>&());
};

+1 −2
Original line number Diff line number Diff line
@@ -96,8 +96,7 @@ const sp<Fence>& RenderSurface::getClientTargetAcquireFence() const {
}

void RenderSurface::setDisplaySize(const ui::Size& size) {
    mDisplaySurface->resizeBuffers(static_cast<uint32_t>(size.width),
                                   static_cast<uint32_t>(size.height));
    mDisplaySurface->resizeBuffers(size);
    mSize = size;
}

+3 −4
Original line number Diff line number Diff line
@@ -85,16 +85,15 @@ public:
    MOCK_CONST_METHOD0(updatesDeviceProductInfoOnHotplugReconnect, bool());
    MOCK_METHOD2(onVsync, bool(hal::HWDisplayId, int64_t));
    MOCK_METHOD2(setVsyncEnabled, void(PhysicalDisplayId, hal::Vsync));
    MOCK_CONST_METHOD1(getRefreshTimestamp, nsecs_t(PhysicalDisplayId));
    MOCK_CONST_METHOD1(isConnected, bool(PhysicalDisplayId));
    MOCK_CONST_METHOD1(getModes, DisplayModes(PhysicalDisplayId));
    MOCK_CONST_METHOD1(getActiveMode, DisplayModePtr(PhysicalDisplayId));
    MOCK_CONST_METHOD1(getModes, std::vector<HWComposer::HWCDisplayMode>(PhysicalDisplayId));
    MOCK_CONST_METHOD1(getActiveMode, std::optional<hal::HWConfigId>(PhysicalDisplayId));
    MOCK_CONST_METHOD1(getColorModes, std::vector<ui::ColorMode>(PhysicalDisplayId));
    MOCK_METHOD3(setActiveColorMode, status_t(PhysicalDisplayId, ui::ColorMode, ui::RenderIntent));
    MOCK_CONST_METHOD0(isUsingVrComposer, bool());
    MOCK_CONST_METHOD1(getDisplayConnectionType, DisplayConnectionType(PhysicalDisplayId));
    MOCK_CONST_METHOD1(isVsyncPeriodSwitchSupported, bool(PhysicalDisplayId));
    MOCK_CONST_METHOD1(getDisplayVsyncPeriod, nsecs_t(PhysicalDisplayId));
    MOCK_CONST_METHOD2(getDisplayVsyncPeriod, status_t(PhysicalDisplayId, nsecs_t*));
    MOCK_METHOD4(setActiveModeWithConstraints,
                 status_t(PhysicalDisplayId, hal::HWConfigId,
                          const hal::VsyncPeriodChangeConstraints&,
Loading