Merge changes from topic "hwc-rri"
* changes:
[HWC3] VTS client updates for onRefreshRateChangedDebug callback And for setRefreshRateChangedCallbackDebugEnabled
[HWC3] AIDL implementation for Refresh Rate Overlay indicator
diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/Capability.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/Capability.aidl
index 6e844ef..f02f8aa 100644
--- a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/Capability.aidl
+++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/Capability.aidl
@@ -44,4 +44,5 @@
SKIP_VALIDATE = 4,
BOOT_DISPLAY_CONFIG = 5,
HDR_OUTPUT_CONVERSION_CONFIG = 6,
+ REFRESH_RATE_CHANGED_CALLBACK_DEBUG = 7,
}
diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/Composition.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/Composition.aidl
index d2d8f04..34d6822 100644
--- a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/Composition.aidl
+++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/Composition.aidl
@@ -41,4 +41,5 @@
CURSOR = 4,
SIDEBAND = 5,
DISPLAY_DECORATION = 6,
+ REFRESH_RATE_INDICATOR = 7,
}
diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/IComposerCallback.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/IComposerCallback.aidl
index 21620e7..2c08cbe 100644
--- a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/IComposerCallback.aidl
+++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/IComposerCallback.aidl
@@ -40,4 +40,5 @@
oneway void onVsync(long display, long timestamp, int vsyncPeriodNanos);
oneway void onVsyncPeriodTimingChanged(long display, in android.hardware.graphics.composer3.VsyncPeriodChangeTimeline updatedTimeline);
oneway void onVsyncIdle(long display);
+ oneway void onRefreshRateChangedDebug(in android.hardware.graphics.composer3.RefreshRateChangedDebugData data);
}
diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/IComposerClient.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/IComposerClient.aidl
index 10ce067..af82b83 100644
--- a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/IComposerClient.aidl
+++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/IComposerClient.aidl
@@ -78,6 +78,7 @@
android.hardware.graphics.composer3.OverlayProperties getOverlaySupport();
android.hardware.graphics.common.HdrConversionCapability[] getHdrConversionCapabilities();
void setHdrConversionStrategy(in android.hardware.graphics.common.HdrConversionStrategy conversionStrategy);
+ void setRefreshRateChangedCallbackDebugEnabled(long display, boolean enabled);
const int EX_BAD_CONFIG = 1;
const int EX_BAD_DISPLAY = 2;
const int EX_BAD_LAYER = 3;
diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/RefreshRateChangedDebugData.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/RefreshRateChangedDebugData.aidl
new file mode 100644
index 0000000..2b9801a
--- /dev/null
+++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/RefreshRateChangedDebugData.aidl
@@ -0,0 +1,39 @@
+/**
+ * Copyright 2023, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.graphics.composer3;
+@VintfStability
+parcelable RefreshRateChangedDebugData {
+ long display;
+ int vsyncPeriodNanos;
+}
diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/Capability.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/Capability.aidl
index 509a8f4..4638610 100644
--- a/graphics/composer/aidl/android/hardware/graphics/composer3/Capability.aidl
+++ b/graphics/composer/aidl/android/hardware/graphics/composer3/Capability.aidl
@@ -75,4 +75,15 @@
* @see IComposerClient.setHdrConversionStrategy
*/
HDR_OUTPUT_CONVERSION_CONFIG = 6,
+
+ /**
+ * Specifies that the device supports the callback onRefreshRateChangedDebug
+ * to pass information about the refresh rate.
+ * The refresh rate from the callback is used to update the refresh rate
+ * overlay indicator.
+ *
+ * @see IComposerClient.setRefreshRateChangedCallbackDebugEnabled
+ * @see IComposerCallback.onRefreshRateChangedDebug
+ */
+ REFRESH_RATE_CHANGED_CALLBACK_DEBUG = 7,
}
diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/Composition.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/Composition.aidl
index 82b218b..37912b0 100644
--- a/graphics/composer/aidl/android/hardware/graphics/composer3/Composition.aidl
+++ b/graphics/composer/aidl/android/hardware/graphics/composer3/Composition.aidl
@@ -86,4 +86,14 @@
* to either DEVICE or CLIENT.
*/
DISPLAY_DECORATION = 6,
+
+ /**
+ * This composition type is similar to DEVICE, with a single difference,
+ * that indicates to HWC that this layer update is not considered an activity
+ * of any sort. For example, If HWC maintains a timer for activity to switch
+ * the display mode from a power save mode, it should not reset that timer.
+ *
+ * Upon validateDisplay, the device may request a change from this type to CLIENT.
+ */
+ REFRESH_RATE_INDICATOR = 7,
}
diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerCallback.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerCallback.aidl
index 67954d4..f4384b7 100644
--- a/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerCallback.aidl
+++ b/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerCallback.aidl
@@ -16,6 +16,7 @@
package android.hardware.graphics.composer3;
+import android.hardware.graphics.composer3.RefreshRateChangedDebugData;
import android.hardware.graphics.composer3.VsyncPeriodChangeTimeline;
@VintfStability
@@ -96,4 +97,25 @@
* @param display is the display whose vsync cadence changed due to panel idle mode.
*/
oneway void onVsyncIdle(long display);
+
+ /**
+ * Notifies the client the vsyncPeriod of the display changed.
+ * Whether or not to call this callback is managed by
+ * IComposerClient.setRefreshRateChangedCallbackDebugEnabled
+ *
+ * Immediate callback is required after the setRefreshRateChangedCallbackDebugEnabled
+ * called.
+ * When the panel refresh rate changes, as a result of a setActiveConfig or
+ * setActiveConfigWithConstraints, this callback should be called with the new panel
+ * refresh rate. In addition, when the panel refresh rate is changed by other means,
+ * such as idleness or DOZE power state, this callback should be called as well.
+ *
+ * This callback is used for debug purposes, and not for scheduling frames,
+ * therefore synchronization is not required.
+ *
+ * @see IComposerClient.setRefreshRateChangedCallbackDebugEnabled
+ *
+ * @param data is the data for the callback when refresh rate changed.
+ */
+ oneway void onRefreshRateChangedDebug(in RefreshRateChangedDebugData data);
}
diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerClient.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerClient.aidl
index 17924b9..fe6483e 100644
--- a/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerClient.aidl
+++ b/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerClient.aidl
@@ -850,4 +850,16 @@
* @see getHdrConversionCapabilities
*/
void setHdrConversionStrategy(in HdrConversionStrategy conversionStrategy);
+
+ /*
+ * Sets either the callback for the refresh rate change is enabled or disabled
+ * for the provided display.
+ *
+ * @see IComposerCallback.onRefreshRateChangedDebug
+ *
+ * @param display is the display on which the callback is enabled on.
+ * @param enabled true when refresh rate callback is enabled,
+ * false when refresh rate callback is disabled.
+ */
+ void setRefreshRateChangedCallbackDebugEnabled(long display, boolean enabled);
}
diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/RefreshRateChangedDebugData.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/RefreshRateChangedDebugData.aidl
new file mode 100644
index 0000000..c1f78d6
--- /dev/null
+++ b/graphics/composer/aidl/android/hardware/graphics/composer3/RefreshRateChangedDebugData.aidl
@@ -0,0 +1,30 @@
+/**
+ * Copyright 2023, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.graphics.composer3;
+
+@VintfStability
+parcelable RefreshRateChangedDebugData {
+ /**
+ * The display for which the debug data is for.
+ */
+ long display;
+
+ /**
+ * The display vsync period in nanoseconds.
+ */
+ int vsyncPeriodNanos;
+}
diff --git a/graphics/composer/aidl/vts/GraphicsComposerCallback.cpp b/graphics/composer/aidl/vts/GraphicsComposerCallback.cpp
index d534943..4fb5d01 100644
--- a/graphics/composer/aidl/vts/GraphicsComposerCallback.cpp
+++ b/graphics/composer/aidl/vts/GraphicsComposerCallback.cpp
@@ -124,6 +124,12 @@
return ::ndk::ScopedAStatus::ok();
}
+::ndk::ScopedAStatus GraphicsComposerCallback::onRefreshRateChangedDebug(
+ const RefreshRateChangedDebugData&) {
+ // TODO(b/202734676) Add implementation for Vts tests
+ return ::ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
+}
+
::ndk::ScopedAStatus GraphicsComposerCallback::onVsyncPeriodTimingChanged(
int64_t in_display,
const ::aidl::android::hardware::graphics::composer3::VsyncPeriodChangeTimeline&
diff --git a/graphics/composer/aidl/vts/GraphicsComposerCallback.h b/graphics/composer/aidl/vts/GraphicsComposerCallback.h
index e54da34..9c3bc70 100644
--- a/graphics/composer/aidl/vts/GraphicsComposerCallback.h
+++ b/graphics/composer/aidl/vts/GraphicsComposerCallback.h
@@ -55,6 +55,8 @@
const ::aidl::android::hardware::graphics::composer3::VsyncPeriodChangeTimeline&
in_updatedTimeline) override;
virtual ::ndk::ScopedAStatus onVsyncIdle(int64_t in_display) override;
+ virtual ::ndk::ScopedAStatus onRefreshRateChangedDebug(
+ const RefreshRateChangedDebugData&) override;
mutable std::mutex mMutex;
// the set of all currently connected displays
diff --git a/graphics/composer/aidl/vts/VtsComposerClient.cpp b/graphics/composer/aidl/vts/VtsComposerClient.cpp
index f95e747..2e2b193 100644
--- a/graphics/composer/aidl/vts/VtsComposerClient.cpp
+++ b/graphics/composer/aidl/vts/VtsComposerClient.cpp
@@ -373,6 +373,12 @@
return mComposerCallback->getVsyncIdleTime();
}
+ndk::ScopedAStatus VtsComposerClient::setRefreshRateChangedCallbackDebugEnabled(
+ int64_t /* display */, bool /* enabled */) {
+ // TODO(b/202734676) Add implementation for VTS tests
+ return ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
+}
+
int64_t VtsComposerClient::getInvalidDisplayId() {
// returns an invalid display id (one that has not been registered to a
// display. Currently assuming that a device will never have close to
diff --git a/graphics/composer/aidl/vts/VtsComposerClient.h b/graphics/composer/aidl/vts/VtsComposerClient.h
index 27788e7..aee46d2 100644
--- a/graphics/composer/aidl/vts/VtsComposerClient.h
+++ b/graphics/composer/aidl/vts/VtsComposerClient.h
@@ -196,6 +196,9 @@
bool verifyComposerCallbackParams();
+ ndk::ScopedAStatus setRefreshRateChangedCallbackDebugEnabled(int64_t /* display */,
+ bool /* enabled */);
+
// Keep track of displays and layers. When a test fails/ends,
// the VtsComposerClient::tearDown should be called from the
// test tearDown to clean up the resources for the test.