From ff0da0bb242dfebffe74c69529f20ed2dc90a11c Mon Sep 17 00:00:00 2001 From: ramindani Date: Fri, 3 Feb 2023 12:50:36 -0800 Subject: [PATCH] [HWC3] AIDL implementation for Refresh Rate Overlay indicator Adds IComposerClient method to inform that the Refresh Rate callback is enabled. Adds IComposerCallback to get the display vsyncPeriod for the Overlay. Adds Composition type REFRESH_RATE_INDICATOR Test: Device boots BUG: 202734676 Change-Id: I48b0c05f49095b15cea444dc5c3ad8f78a043cb0 --- .../graphics/composer3/Capability.aidl | 1 + .../graphics/composer3/Composition.aidl | 1 + .../graphics/composer3/IComposerCallback.aidl | 1 + .../graphics/composer3/IComposerClient.aidl | 1 + .../RefreshRateChangedDebugData.aidl | 39 +++++++++++++++++++ .../graphics/composer3/Capability.aidl | 11 ++++++ .../graphics/composer3/Composition.aidl | 10 +++++ .../graphics/composer3/IComposerCallback.aidl | 22 +++++++++++ .../graphics/composer3/IComposerClient.aidl | 12 ++++++ .../RefreshRateChangedDebugData.aidl | 30 ++++++++++++++ 10 files changed, 128 insertions(+) create mode 100644 graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/RefreshRateChangedDebugData.aidl create mode 100644 graphics/composer/aidl/android/hardware/graphics/composer3/RefreshRateChangedDebugData.aidl 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 6e844ef1cd..f02f8aaa77 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 @@ enum Capability { 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 d2d8f0486a..34d6822148 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 @@ enum Composition { 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 21620e7f31..2c08cbeffd 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 @@ interface IComposerCallback { 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 10ce067aad..af82b83b76 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 @@ interface IComposerClient { 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 0000000000..2b9801a4aa --- /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 -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 509a8f433f..4638610955 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 @@ enum Capability { * @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 82b218be3f..37912b0069 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 @@ enum Composition { * 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 67954d4cc5..f4384b7a5a 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 @@ interface IComposerCallback { * @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 8091491ae2..f0f2432459 100644 --- a/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerClient.aidl +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerClient.aidl @@ -848,4 +848,16 @@ interface IComposerClient { * @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 0000000000..c1f78d6f5e --- /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; +}