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

Commit 12bfe6b7 authored by ramindani's avatar ramindani
Browse files

[SF] Adds Refresh Rate Indicator HWC callback handlers

Adds onRefreshRateChangedDebug handling
Implementation details will follow in the upcoming CLS.
Test: Device boots
BUG: 202734676

Change-Id: I7e4c1f43712661627de02199ba900d520fa24dc3
parent b7f27919
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -208,6 +208,12 @@ public:
        return ::ndk::ScopedAStatus::ok();
    }

    ::ndk::ScopedAStatus onRefreshRateChangedDebug(
            const RefreshRateChangedDebugData& refreshRateChangedDebugData) override {
        mCallback.onRefreshRateChangedDebug(refreshRateChangedDebugData);
        return ::ndk::ScopedAStatus::ok();
    }

private:
    HWC2::ComposerCallback& mCallback;
};
+4 −0
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@
#include <aidl/android/hardware/graphics/composer3/Composition.h>
#include <aidl/android/hardware/graphics/composer3/DisplayCapability.h>
#include <aidl/android/hardware/graphics/composer3/OverlayProperties.h>
#include <aidl/android/hardware/graphics/composer3/RefreshRateChangedDebugData.h>

namespace android {

@@ -63,6 +64,8 @@ class Layer;

namespace hal = android::hardware::graphics::composer::hal;

using aidl::android::hardware::graphics::composer3::RefreshRateChangedDebugData;

// Implement this interface to receive hardware composer events.
//
// These callback functions will generally be called on a hwbinder thread, but
@@ -77,6 +80,7 @@ struct ComposerCallback {
                                                       const hal::VsyncPeriodChangeTimeline&) = 0;
    virtual void onComposerHalSeamlessPossible(hal::HWDisplayId) = 0;
    virtual void onComposerHalVsyncIdle(hal::HWDisplayId) = 0;
    virtual void onRefreshRateChangedDebug(const RefreshRateChangedDebugData&) = 0;

protected:
    ~ComposerCallback() = default;
+4 −0
Original line number Diff line number Diff line
@@ -2085,6 +2085,10 @@ void SurfaceFlinger::onComposerHalVsyncIdle(hal::HWDisplayId) {
    mScheduler->forceNextResync();
}

void SurfaceFlinger::onRefreshRateChangedDebug(const RefreshRateChangedDebugData&) {
    // TODO(b/202734676) update refresh rate value on the RefreshRateOverlay
}

void SurfaceFlinger::setVsyncEnabled(bool enabled) {
    ATRACE_CALL();

+3 −0
Original line number Diff line number Diff line
@@ -104,6 +104,7 @@
#include <vector>

#include <aidl/android/hardware/graphics/common/DisplayDecorationSupport.h>
#include <aidl/android/hardware/graphics/composer3/RefreshRateChangedDebugData.h>
#include "Client.h"

using namespace android::surfaceflinger;
@@ -127,6 +128,7 @@ class FrameTracer;
class ScreenCapturer;
class WindowInfosListenerInvoker;

using ::aidl::android::hardware::graphics::composer3::RefreshRateChangedDebugData;
using frontend::TransactionHandler;
using gui::CaptureArgs;
using gui::DisplayCaptureArgs;
@@ -630,6 +632,7 @@ private:
                                               const hal::VsyncPeriodChangeTimeline&) override;
    void onComposerHalSeamlessPossible(hal::HWDisplayId) override;
    void onComposerHalVsyncIdle(hal::HWDisplayId) override;
    void onRefreshRateChangedDebug(const RefreshRateChangedDebugData&) override;

    // ICompositor overrides:
    void configure() override;
+2 −0
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ class SurfaceComposerClient;

namespace android::hardware::graphics::composer::hal {

using aidl::android::hardware::graphics::composer3::RefreshRateChangedDebugData;
using ::android::hardware::Return;
using ::android::hardware::Void;
using ::android::HWC2::ComposerCallback;
@@ -99,6 +100,7 @@ struct TestHWC2ComposerCallback : public HWC2::ComposerCallback {
    void onComposerHalVsyncPeriodTimingChanged(HWDisplayId, const VsyncPeriodChangeTimeline&) {}
    void onComposerHalSeamlessPossible(HWDisplayId) {}
    void onComposerHalVsyncIdle(HWDisplayId) {}
    void onRefreshRateChangedDebug(const RefreshRateChangedDebugData&) {}
};

} // namespace android::hardware::graphics::composer::hal
Loading