diff --git a/graphics/Android.bp b/graphics/Android.bp index b48844d475..b17643e5b5 100644 --- a/graphics/Android.bp +++ b/graphics/Android.bp @@ -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", ], } 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 b49f239ed0..a7e65353e1 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 @@ -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; diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/OverlayProperties.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/OverlayProperties.aidl new file mode 100644 index 0000000000..4d8fcac63e --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/OverlayProperties.aidl @@ -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 -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; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/SupportedBufferCombinations.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/SupportedBufferCombinations.aidl new file mode 100644 index 0000000000..1828be1078 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/SupportedBufferCombinations.aidl @@ -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 -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; +} diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerClient.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerClient.aidl index a4ea64f815..88bb3a47ff 100644 --- a/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerClient.aidl +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerClient.aidl @@ -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(); } diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/OverlayProperties.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/OverlayProperties.aidl new file mode 100644 index 0000000000..d3bd7d3b41 --- /dev/null +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/OverlayProperties.aidl @@ -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; +} diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/SupportedBufferCombinations.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/SupportedBufferCombinations.aidl new file mode 100644 index 0000000000..41f88172b4 --- /dev/null +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/SupportedBufferCombinations.aidl @@ -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; +} diff --git a/graphics/composer/aidl/vts/VtsComposerClient.cpp b/graphics/composer/aidl/vts/VtsComposerClient.cpp index 5bc7296f21..34cc80241c 100644 --- a/graphics/composer/aidl/vts/VtsComposerClient.cpp +++ b/graphics/composer/aidl/vts/VtsComposerClient.cpp @@ -338,6 +338,11 @@ std::pair VtsComposerClient::getDisplayPhysica outDisplayOrientation}; } +std::pair VtsComposerClient::getOverlaySupport() { + OverlayProperties properties; + return {mComposerClient->getOverlaySupport(&properties), properties}; +} + ScopedAStatus VtsComposerClient::setIdleTimerEnabled(int64_t display, int32_t timeoutMs) { return mComposerClient->setIdleTimerEnabled(display, timeoutMs); } diff --git a/graphics/composer/aidl/vts/VtsComposerClient.h b/graphics/composer/aidl/vts/VtsComposerClient.h index 3625c8ccfe..6358b85e0c 100644 --- a/graphics/composer/aidl/vts/VtsComposerClient.h +++ b/graphics/composer/aidl/vts/VtsComposerClient.h @@ -172,6 +172,8 @@ class VtsComposerClient { std::pair> getDisplays(); + std::pair getOverlaySupport(); + private: ScopedAStatus updateDisplayProperties(VtsDisplay* vtsDisplay, int32_t config); diff --git a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp index 93b646f498..78dce63dc2 100644 --- a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp +++ b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + #include #include #include @@ -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());