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
This commit is contained in:
Ram Indani
2023-02-13 23:00:03 +00:00
committed by Android (Google) Code Review
14 changed files with 145 additions and 0 deletions

View File

@@ -44,4 +44,5 @@ enum Capability {
SKIP_VALIDATE = 4,
BOOT_DISPLAY_CONFIG = 5,
HDR_OUTPUT_CONVERSION_CONFIG = 6,
REFRESH_RATE_CHANGED_CALLBACK_DEBUG = 7,
}

View File

@@ -41,4 +41,5 @@ enum Composition {
CURSOR = 4,
SIDEBAND = 5,
DISPLAY_DECORATION = 6,
REFRESH_RATE_INDICATOR = 7,
}

View File

@@ -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);
}

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -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,
}

View File

@@ -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,
}

View File

@@ -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);
}

View File

@@ -850,4 +850,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);
}

View File

@@ -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;
}

View File

@@ -124,6 +124,12 @@ GraphicsComposerCallback::takeLastVsyncPeriodChangeTimeline() {
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&

View File

@@ -55,6 +55,8 @@ class GraphicsComposerCallback : public BnComposerCallback {
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

View File

@@ -373,6 +373,12 @@ int64_t VtsComposerClient::getVsyncIdleTime() {
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

View File

@@ -196,6 +196,9 @@ class VtsComposerClient {
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.