Merge "Add getOverlaySupport() AIDL interface."

This commit is contained in:
Sally Qi
2022-10-13 21:29:46 +00:00
committed by Android (Google) Code Review
10 changed files with 165 additions and 2 deletions

View File

@@ -47,13 +47,13 @@ cc_defaults {
cc_defaults {
name: "android.hardware.graphics.composer3-ndk_static",
static_libs: [
"android.hardware.graphics.composer3-V1-ndk",
"android.hardware.graphics.composer3-V2-ndk",
],
}
cc_defaults {
name: "android.hardware.graphics.composer3-ndk_shared",
shared_libs: [
"android.hardware.graphics.composer3-V1-ndk",
"android.hardware.graphics.composer3-V2-ndk",
],
}

View File

@@ -75,6 +75,7 @@ interface IComposerClient {
void setReadbackBuffer(long display, in android.hardware.common.NativeHandle buffer, in @nullable ParcelFileDescriptor releaseFence);
void setVsyncEnabled(long display, boolean enabled);
void setIdleTimerEnabled(long display, int timeoutMs);
android.hardware.graphics.composer3.OverlayProperties getOverlaySupport();
const int EX_BAD_CONFIG = 1;
const int EX_BAD_DISPLAY = 2;
const int EX_BAD_LAYER = 3;

View File

@@ -0,0 +1,38 @@
/**
* Copyright (C) 2022 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 OverlayProperties {
android.hardware.graphics.composer3.SupportedBufferCombinations[] combinations;
}

View File

@@ -0,0 +1,39 @@
/**
* Copyright (C) 2022 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 SupportedBufferCombinations {
android.hardware.graphics.common.PixelFormat[] pixelFormats;
android.hardware.graphics.common.Dataspace[] dataspaces;
}

View File

@@ -32,6 +32,7 @@ import android.hardware.graphics.composer3.DisplayIdentification;
import android.hardware.graphics.composer3.FormatColorComponent;
import android.hardware.graphics.composer3.HdrCapabilities;
import android.hardware.graphics.composer3.IComposerCallback;
import android.hardware.graphics.composer3.OverlayProperties;
import android.hardware.graphics.composer3.PerFrameMetadataKey;
import android.hardware.graphics.composer3.PowerMode;
import android.hardware.graphics.composer3.ReadbackBufferAttributes;
@@ -814,4 +815,14 @@ interface IComposerClient {
*
*/
void setIdleTimerEnabled(long display, int timeoutMs);
/**
* Hardware overlays is a technique to composite different buffers directly to the screen
* while bypassing GPU composition.
*
* This function returns what the device's overlays support.
*
* @return the overlay properties of the device.
*/
OverlayProperties getOverlaySupport();
}

View File

@@ -0,0 +1,29 @@
/**
* Copyright (C) 2022 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;
import android.hardware.graphics.composer3.SupportedBufferCombinations;
@VintfStability
parcelable OverlayProperties {
// Array of all valid pixelformat and dataspace combinations.
// If all supported formats work with all supported dataspaces,
// then this list may only have 1 entry.
// If some dataspaces, e.g. scRGB, only work with specific formats,
// then this list may contain more than 1 entry.
SupportedBufferCombinations[] combinations;
}

View File

@@ -0,0 +1,25 @@
/**
* Copyright (C) 2022 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 SupportedBufferCombinations {
// List of pixelformats and dataspaces that can be used together.
// All pixelformats and dataspaces stored inside are valid combinations.
android.hardware.graphics.common.PixelFormat[] pixelFormats;
android.hardware.graphics.common.Dataspace[] dataspaces;
}

View File

@@ -338,6 +338,11 @@ std::pair<ScopedAStatus, common::Transform> VtsComposerClient::getDisplayPhysica
outDisplayOrientation};
}
std::pair<ScopedAStatus, composer3::OverlayProperties> VtsComposerClient::getOverlaySupport() {
OverlayProperties properties;
return {mComposerClient->getOverlaySupport(&properties), properties};
}
ScopedAStatus VtsComposerClient::setIdleTimerEnabled(int64_t display, int32_t timeoutMs) {
return mComposerClient->setIdleTimerEnabled(display, timeoutMs);
}

View File

@@ -172,6 +172,8 @@ class VtsComposerClient {
std::pair<ScopedAStatus, std::vector<VtsDisplay>> getDisplays();
std::pair<ScopedAStatus, OverlayProperties> getOverlaySupport();
private:
ScopedAStatus updateDisplayProperties(VtsDisplay* vtsDisplay, int32_t config);

View File

@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <aidl/Gtest.h>
#include <aidl/Vintf.h>
#include <aidl/android/hardware/graphics/common/BlendMode.h>
@@ -808,6 +809,18 @@ TEST_P(GraphicsComposerAidlTest, GetDisplayName) {
EXPECT_TRUE(status.isOk());
}
// TODO(b/250036572): disable this due to no implementation and revup on cuttlefish
TEST_P(GraphicsComposerAidlTest, DISABLED_GetOverlaySupport) {
const auto& [status, _] = mComposerClient->getOverlaySupport();
if (!status.isOk() && status.getExceptionCode() == EX_SERVICE_SPECIFIC &&
status.getServiceSpecificError() == IComposerClient::EX_UNSUPPORTED) {
GTEST_SUCCEED() << "getOverlaySupport is not supported";
return;
}
ASSERT_TRUE(status.isOk());
}
TEST_P(GraphicsComposerAidlTest, GetDisplayPhysicalOrientation_BadDisplay) {
const auto& [status, _] = mComposerClient->getDisplayPhysicalOrientation(getInvalidDisplayId());