summaryrefslogtreecommitdiffstats
path: root/graphics
diff options
context:
space:
mode:
authorPeiyong Lin <lpy@google.com>2019-04-29 16:04:41 -0700
committerPeiyong Lin <lpy@google.com>2019-05-01 16:58:13 -0700
commit0686afa15a0c2f3666246977ebd1db37e640ebad (patch)
tree8cd24ce2128c7bb3e08b7549223cac9d194b6c37 /graphics
parentef85db2b657380bddd28ea16b4421bcf1cd77ed8 (diff)
downloadandroid_hardware_interfaces-0686afa15a0c2f3666246977ebd1db37e640ebad.tar.gz
android_hardware_interfaces-0686afa15a0c2f3666246977ebd1db37e640ebad.tar.bz2
android_hardware_interfaces-0686afa15a0c2f3666246977ebd1db37e640ebad.zip
Return display capability if getDisplayBrightnessSupport is not registered.
If getDisplayBrightnessSupport is not registered, there are two possibilities, one is it's not supported at all, the other is that the support is returned in getDisplayCapabilities. And thus we need to check getDisplayCapabilities, and we return UNSUPPORTED always in this case. This patch also allows getPerFrameMetadataKeys to return UNSUPPORTED on non-HDR capable devices. BUG: 131595097 Test: Build, boot. Change-Id: Ied302b1ac702dd94e039f1081d5420395c1bfbf4
Diffstat (limited to 'graphics')
-rw-r--r--graphics/composer/2.2/vts/functional/VtsHalGraphicsComposerV2_2TargetTest.cpp14
-rw-r--r--graphics/composer/2.3/utils/hal/include/composer-hal/2.3/ComposerClient.h2
-rw-r--r--graphics/composer/2.3/utils/hal/include/composer-hal/2.3/ComposerHal.h2
-rw-r--r--graphics/composer/2.3/utils/passthrough/include/composer-passthrough/2.3/HwcHal.h18
4 files changed, 31 insertions, 5 deletions
diff --git a/graphics/composer/2.2/vts/functional/VtsHalGraphicsComposerV2_2TargetTest.cpp b/graphics/composer/2.2/vts/functional/VtsHalGraphicsComposerV2_2TargetTest.cpp
index 7834b9460..9c80f4da5 100644
--- a/graphics/composer/2.2/vts/functional/VtsHalGraphicsComposerV2_2TargetTest.cpp
+++ b/graphics/composer/2.2/vts/functional/VtsHalGraphicsComposerV2_2TargetTest.cpp
@@ -246,7 +246,19 @@ TEST_F(GraphicsComposerHidlCommandTest, SET_LAYER_PER_FRAME_METADATA) {
* Test IComposerClient::getPerFrameMetadataKeys.
*/
TEST_F(GraphicsComposerHidlTest, GetPerFrameMetadataKeys) {
- mComposerClient->getPerFrameMetadataKeys(mPrimaryDisplay);
+ std::vector<IComposerClient::PerFrameMetadataKey> keys;
+ Error error = Error::NONE;
+ mComposerClient->getRaw()->getPerFrameMetadataKeys(
+ mPrimaryDisplay, [&](const auto& tmpError, const auto& tmpKeys) {
+ error = tmpError;
+ keys = tmpKeys;
+ });
+ if (error == Error::UNSUPPORTED) {
+ GTEST_SUCCEED() << "getPerFrameMetadataKeys is not supported";
+ return;
+ }
+ ASSERT_EQ(Error::NONE, error);
+ ASSERT_TRUE(keys.size() >= 0);
}
/**
diff --git a/graphics/composer/2.3/utils/hal/include/composer-hal/2.3/ComposerClient.h b/graphics/composer/2.3/utils/hal/include/composer-hal/2.3/ComposerClient.h
index 3792c2e4a..b289b6a0f 100644
--- a/graphics/composer/2.3/utils/hal/include/composer-hal/2.3/ComposerClient.h
+++ b/graphics/composer/2.3/utils/hal/include/composer-hal/2.3/ComposerClient.h
@@ -95,7 +95,7 @@ class ComposerClientImpl : public V2_2::hal::detail::ComposerClientImpl<Interfac
Return<void> getDisplayCapabilities(
Display display, IComposerClient::getDisplayCapabilities_cb hidl_cb) override {
- hidl_vec<IComposerClient::DisplayCapability> capabilities;
+ std::vector<IComposerClient::DisplayCapability> capabilities;
Error error = mHal->getDisplayCapabilities(display, &capabilities);
hidl_cb(error, capabilities);
return Void();
diff --git a/graphics/composer/2.3/utils/hal/include/composer-hal/2.3/ComposerHal.h b/graphics/composer/2.3/utils/hal/include/composer-hal/2.3/ComposerHal.h
index 186b00481..c3c488746 100644
--- a/graphics/composer/2.3/utils/hal/include/composer-hal/2.3/ComposerHal.h
+++ b/graphics/composer/2.3/utils/hal/include/composer-hal/2.3/ComposerHal.h
@@ -115,7 +115,7 @@ class ComposerHal : public V2_2::hal::ComposerHal {
hidl_vec<uint64_t>& sampleComponent2,
hidl_vec<uint64_t>& sampleComponent3) = 0;
virtual Error getDisplayCapabilities(
- Display display, hidl_vec<IComposerClient::DisplayCapability>* outCapabilities) = 0;
+ Display display, std::vector<IComposerClient::DisplayCapability>* outCapabilities) = 0;
virtual Error setLayerPerFrameMetadataBlobs(
Display display, Layer layer,
std::vector<IComposerClient::PerFrameMetadataBlob>& blobs) = 0;
diff --git a/graphics/composer/2.3/utils/passthrough/include/composer-passthrough/2.3/HwcHal.h b/graphics/composer/2.3/utils/passthrough/include/composer-passthrough/2.3/HwcHal.h
index 4829e24da..d3b29bb80 100644
--- a/graphics/composer/2.3/utils/passthrough/include/composer-passthrough/2.3/HwcHal.h
+++ b/graphics/composer/2.3/utils/passthrough/include/composer-passthrough/2.3/HwcHal.h
@@ -220,7 +220,8 @@ class HwcHalImpl : public V2_2::passthrough::detail::HwcHalImpl<Hal> {
}
Error getDisplayCapabilities(
- Display display, hidl_vec<IComposerClient::DisplayCapability>* outCapabilities) override {
+ Display display,
+ std::vector<IComposerClient::DisplayCapability>* outCapabilities) override {
uint32_t count = 0;
int32_t error = mDispatch.getDisplayCapabilities(mDevice, display, &count, nullptr);
if (error != HWC2_ERROR_NONE) {
@@ -232,7 +233,7 @@ class HwcHalImpl : public V2_2::passthrough::detail::HwcHalImpl<Hal> {
reinterpret_cast<std::underlying_type<IComposerClient::DisplayCapability>::type*>(
outCapabilities->data()));
if (error != HWC2_ERROR_NONE) {
- *outCapabilities = hidl_vec<IComposerClient::DisplayCapability>();
+ *outCapabilities = std::vector<IComposerClient::DisplayCapability>();
return static_cast<Error>(error);
}
return Error::NONE;
@@ -267,6 +268,19 @@ class HwcHalImpl : public V2_2::passthrough::detail::HwcHalImpl<Hal> {
Error getDisplayBrightnessSupport(Display display, bool* outSupport) {
if (!mDispatch.getDisplayBrightnessSupport) {
+ // Preemptively set to false.
+ *outSupport = false;
+ // Try to query from getDisplayCapabilities.
+ std::vector<IComposerClient::DisplayCapability> capabilities;
+ Error error = getDisplayCapabilities(display, &capabilities);
+ if (error != Error::NONE) {
+ // This function is not registered, always return UNSUPPORTED.
+ return Error::UNSUPPORTED;
+ }
+ *outSupport =
+ std::find(capabilities.begin(), capabilities.end(),
+ IComposerClient::DisplayCapability::BRIGHTNESS) != capabilities.end();
+ // This function is not registered, always return UNSUPPORTED.
return Error::UNSUPPORTED;
}
bool support = false;