Update setHdrConversionStrategy to return the preferredHdrOutput type

Bug: 268336382
Test: atest VtsHalGraphicsComposer3_TargetTest
Change-Id: I6ac912ac8a0329f4ea32acad657e44b473660c42
This commit is contained in:
Kriti Dang 2023-02-09 18:15:37 +01:00
parent 06fc4aa74c
commit 376227694f
7 changed files with 26 additions and 11 deletions

View file

@ -35,6 +35,7 @@ package android.hardware.graphics.common;
/* @hide */
@Backing(type="int") @VintfStability
enum Hdr {
INVALID = 0,
DOLBY_VISION = 1,
HDR10 = 2,
HLG = 3,

View file

@ -23,6 +23,10 @@ package android.hardware.graphics.common;
@VintfStability
@Backing(type="int")
enum Hdr {
/**
* Invalid HDR type
*/
INVALID = 0,
/**
* Device supports Dolby Vision HDR
*/

View file

@ -77,7 +77,7 @@ interface IComposerClient {
void setIdleTimerEnabled(long display, int timeoutMs);
android.hardware.graphics.composer3.OverlayProperties getOverlaySupport();
android.hardware.graphics.common.HdrConversionCapability[] getHdrConversionCapabilities();
void setHdrConversionStrategy(in android.hardware.graphics.common.HdrConversionStrategy conversionStrategy);
android.hardware.graphics.common.Hdr 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;

View file

@ -17,6 +17,7 @@
package android.hardware.graphics.composer3;
import android.hardware.graphics.common.DisplayDecorationSupport;
import android.hardware.graphics.common.Hdr;
import android.hardware.graphics.common.HdrConversionCapability;
import android.hardware.graphics.common.HdrConversionStrategy;
import android.hardware.graphics.common.Transform;
@ -844,12 +845,13 @@ interface IComposerClient {
/**
* Sets the of HDR conversion strategy.
*
*
* @return the chosen HDR type in case HdrConversionStrategy has autoAllowedHdrTypes set. In
* other cases, return HDR type INVALID.
* @exception EX_UNSUPPORTED when not supported by the underlying HAL
*
* @see getHdrConversionCapabilities
*/
void setHdrConversionStrategy(in HdrConversionStrategy conversionStrategy);
Hdr setHdrConversionStrategy(in HdrConversionStrategy conversionStrategy);
/*
* Sets either the callback for the refresh rate change is enabled or disabled

View file

@ -344,9 +344,11 @@ VtsComposerClient::getHdrConversionCapabilities() {
hdrConversionCapability};
}
ScopedAStatus VtsComposerClient::setHdrConversionStrategy(
std::pair<ScopedAStatus, common::Hdr> VtsComposerClient::setHdrConversionStrategy(
const common::HdrConversionStrategy& conversionStrategy) {
return mComposerClient->setHdrConversionStrategy(conversionStrategy);
common::Hdr preferredHdrOutputType;
return {mComposerClient->setHdrConversionStrategy(conversionStrategy, &preferredHdrOutputType),
preferredHdrOutputType};
}
std::pair<ScopedAStatus, common::Transform> VtsComposerClient::getDisplayPhysicalOrientation(

View file

@ -166,7 +166,8 @@ class VtsComposerClient {
std::pair<ScopedAStatus, std::vector<common::HdrConversionCapability>>
getHdrConversionCapabilities();
ScopedAStatus setHdrConversionStrategy(const common::HdrConversionStrategy& conversionStrategy);
std::pair<ScopedAStatus, common::Hdr> setHdrConversionStrategy(
const common::HdrConversionStrategy& conversionStrategy);
std::pair<ScopedAStatus, common::Transform> getDisplayPhysicalOrientation(int64_t display);

View file

@ -637,8 +637,10 @@ TEST_P(GraphicsComposerAidlTest, SetHdrConversionStrategy_Passthrough) {
}
common::HdrConversionStrategy hdrConversionStrategy;
hdrConversionStrategy.set<common::HdrConversionStrategy::Tag::passthrough>(true);
const auto& status = mComposerClient->setHdrConversionStrategy(hdrConversionStrategy);
const auto& [status, preferredHdrOutputType] =
mComposerClient->setHdrConversionStrategy(hdrConversionStrategy);
EXPECT_TRUE(status.isOk());
EXPECT_EQ(common::Hdr::INVALID, preferredHdrOutputType);
}
TEST_P(GraphicsComposerAidlTest, SetHdrConversionStrategy_Force) {
@ -652,9 +654,10 @@ TEST_P(GraphicsComposerAidlTest, SetHdrConversionStrategy_Force) {
common::HdrConversionStrategy hdrConversionStrategy;
hdrConversionStrategy.set<common::HdrConversionStrategy::Tag::forceHdrConversion>(
conversionCapability.outputType->hdr);
const auto& statusSet =
const auto& [statusSet, preferredHdrOutputType] =
mComposerClient->setHdrConversionStrategy(hdrConversionStrategy);
EXPECT_TRUE(status.isOk());
EXPECT_TRUE(statusSet.isOk());
EXPECT_EQ(common::Hdr::INVALID, preferredHdrOutputType);
}
}
}
@ -674,8 +677,10 @@ TEST_P(GraphicsComposerAidlTest, SetHdrConversionStrategy_Auto) {
common::HdrConversionStrategy hdrConversionStrategy;
hdrConversionStrategy.set<common::HdrConversionStrategy::Tag::autoAllowedHdrTypes>(
autoHdrTypes);
const auto& statusSet = mComposerClient->setHdrConversionStrategy(hdrConversionStrategy);
EXPECT_TRUE(status.isOk());
const auto& [statusSet, preferredHdrOutputType] =
mComposerClient->setHdrConversionStrategy(hdrConversionStrategy);
EXPECT_TRUE(statusSet.isOk());
EXPECT_NE(common::Hdr::INVALID, preferredHdrOutputType);
}
TEST_P(GraphicsComposerAidlTest, SetAutoLowLatencyMode_BadDisplay) {