diff options
author | android-build-team Robot | 2018-04-03 02:22:49 -0500 |
---|---|---|
committer | android-build-team Robot | 2018-04-03 02:22:49 -0500 |
commit | 13470a1d66eb96f3f3067d0c2261af911b67a2d1 (patch) | |
tree | 66309abffea773b9fac6c7df23ff223c3e08208b | |
parent | 456a6dd9f0a928044b65b6a47709d28775859167 (diff) | |
parent | 584ee3b94ab8d774dbad8401ab589183f8154d4a (diff) | |
download | platform-hardware-interfaces-13470a1d66eb96f3f3067d0c2261af911b67a2d1.tar.gz platform-hardware-interfaces-13470a1d66eb96f3f3067d0c2261af911b67a2d1.tar.xz platform-hardware-interfaces-13470a1d66eb96f3f3067d0c2261af911b67a2d1.zip |
Snap for 4696032 from 584ee3b94ab8d774dbad8401ab589183f8154d4a to pi-release
Change-Id: I714278ca21e594c0270bb9bfb302a77715678d15
27 files changed, 933 insertions, 111 deletions
diff --git a/camera/device/3.4/default/CameraDeviceSession.cpp b/camera/device/3.4/default/CameraDeviceSession.cpp index ad7f6f51..550d65a8 100644 --- a/camera/device/3.4/default/CameraDeviceSession.cpp +++ b/camera/device/3.4/default/CameraDeviceSession.cpp | |||
@@ -51,6 +51,32 @@ CameraDeviceSession::CameraDeviceSession( | |||
51 | } | 51 | } |
52 | } | 52 | } |
53 | } | 53 | } |
54 | |||
55 | camera_metadata_entry_t capabilities = | ||
56 | mDeviceInfo.find(ANDROID_REQUEST_AVAILABLE_CAPABILITIES); | ||
57 | bool isLogicalMultiCamera = false; | ||
58 | for (size_t i = 0; i < capabilities.count; i++) { | ||
59 | if (capabilities.data.u8[i] == | ||
60 | ANDROID_REQUEST_AVAILABLE_CAPABILITIES_LOGICAL_MULTI_CAMERA) { | ||
61 | isLogicalMultiCamera = true; | ||
62 | break; | ||
63 | } | ||
64 | } | ||
65 | if (isLogicalMultiCamera) { | ||
66 | camera_metadata_entry entry = | ||
67 | mDeviceInfo.find(ANDROID_LOGICAL_MULTI_CAMERA_PHYSICAL_IDS); | ||
68 | const uint8_t* ids = entry.data.u8; | ||
69 | size_t start = 0; | ||
70 | for (size_t i = 0; i < entry.count; ++i) { | ||
71 | if (ids[i] == '\0') { | ||
72 | if (start != i) { | ||
73 | const char* physicalId = reinterpret_cast<const char*>(ids+start); | ||
74 | mPhysicalCameraIds.emplace(physicalId); | ||
75 | } | ||
76 | start = i + 1; | ||
77 | } | ||
78 | } | ||
79 | } | ||
54 | } | 80 | } |
55 | 81 | ||
56 | CameraDeviceSession::~CameraDeviceSession() { | 82 | CameraDeviceSession::~CameraDeviceSession() { |
@@ -456,9 +482,19 @@ void CameraDeviceSession::sProcessCaptureResult_3_4( | |||
456 | return; | 482 | return; |
457 | } | 483 | } |
458 | 484 | ||
485 | if (hal_result->num_physcam_metadata > d->mPhysicalCameraIds.size()) { | ||
486 | ALOGE("%s: Fatal: Invalid num_physcam_metadata %u", __FUNCTION__, | ||
487 | hal_result->num_physcam_metadata); | ||
488 | return; | ||
489 | } | ||
459 | result.physicalCameraMetadata.resize(hal_result->num_physcam_metadata); | 490 | result.physicalCameraMetadata.resize(hal_result->num_physcam_metadata); |
460 | for (uint32_t i = 0; i < hal_result->num_physcam_metadata; i++) { | 491 | for (uint32_t i = 0; i < hal_result->num_physcam_metadata; i++) { |
461 | std::string physicalId = hal_result->physcam_ids[i]; | 492 | std::string physicalId = hal_result->physcam_ids[i]; |
493 | if (d->mPhysicalCameraIds.find(physicalId) == d->mPhysicalCameraIds.end()) { | ||
494 | ALOGE("%s: Fatal: Invalid physcam_ids[%u]: %s", __FUNCTION__, | ||
495 | i, hal_result->physcam_ids[i]); | ||
496 | return; | ||
497 | } | ||
462 | V3_2::CameraMetadata physicalMetadata; | 498 | V3_2::CameraMetadata physicalMetadata; |
463 | V3_2::implementation::convertToHidl(hal_result->physcam_metadata[i], &physicalMetadata); | 499 | V3_2::implementation::convertToHidl(hal_result->physcam_metadata[i], &physicalMetadata); |
464 | PhysicalCameraMetadata physicalCameraMetadata = { | 500 | PhysicalCameraMetadata physicalCameraMetadata = { |
diff --git a/camera/device/3.4/default/include/device_v3_4_impl/CameraDeviceSession.h b/camera/device/3.4/default/include/device_v3_4_impl/CameraDeviceSession.h index 6e90ed49..5d6a112e 100644 --- a/camera/device/3.4/default/include/device_v3_4_impl/CameraDeviceSession.h +++ b/camera/device/3.4/default/include/device_v3_4_impl/CameraDeviceSession.h | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <hidl/Status.h> | 27 | #include <hidl/Status.h> |
28 | #include <deque> | 28 | #include <deque> |
29 | #include <map> | 29 | #include <map> |
30 | #include <unordered_set> | ||
30 | #include <unordered_map> | 31 | #include <unordered_map> |
31 | #include "CameraMetadata.h" | 32 | #include "CameraMetadata.h" |
32 | #include "HandleImporter.h" | 33 | #include "HandleImporter.h" |
@@ -110,6 +111,10 @@ protected: | |||
110 | 111 | ||
111 | // Whether this camera device session is created with version 3.4 callback. | 112 | // Whether this camera device session is created with version 3.4 callback. |
112 | bool mHasCallback_3_4; | 113 | bool mHasCallback_3_4; |
114 | |||
115 | // Physical camera ids for the logical multi-camera. Empty if this | ||
116 | // is not a logical multi-camera. | ||
117 | std::unordered_set<std::string> mPhysicalCameraIds; | ||
113 | private: | 118 | private: |
114 | 119 | ||
115 | struct TrampolineSessionInterface_3_4 : public ICameraDeviceSession { | 120 | struct TrampolineSessionInterface_3_4 : public ICameraDeviceSession { |
diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml index 467e11ee..6aa5fc51 100644 --- a/compatibility_matrices/compatibility_matrix.current.xml +++ b/compatibility_matrices/compatibility_matrix.current.xml | |||
@@ -24,6 +24,14 @@ | |||
24 | </interface> | 24 | </interface> |
25 | </hal> | 25 | </hal> |
26 | <hal format="hidl" optional="true"> | 26 | <hal format="hidl" optional="true"> |
27 | <name>android.hardware.automotive.audiocontrol</name> | ||
28 | <version>1.0</version> | ||
29 | <interface> | ||
30 | <name>IAudioControl</name> | ||
31 | <instance>default</instance> | ||
32 | </interface> | ||
33 | </hal> | ||
34 | <hal format="hidl" optional="true"> | ||
27 | <name>android.hardware.automotive.evs</name> | 35 | <name>android.hardware.automotive.evs</name> |
28 | <version>1.0</version> | 36 | <version>1.0</version> |
29 | <interface> | 37 | <interface> |
@@ -104,6 +112,14 @@ | |||
104 | </interface> | 112 | </interface> |
105 | </hal> | 113 | </hal> |
106 | <hal format="hidl" optional="true"> | 114 | <hal format="hidl" optional="true"> |
115 | <name>android.hardware.confirmationui</name> | ||
116 | <version>1.0</version> | ||
117 | <interface> | ||
118 | <name>IConfirmationUI</name> | ||
119 | <instance>default</instance> | ||
120 | </interface> | ||
121 | </hal> | ||
122 | <hal format="hidl" optional="true"> | ||
107 | <name>android.hardware.contexthub</name> | 123 | <name>android.hardware.contexthub</name> |
108 | <version>1.0</version> | 124 | <version>1.0</version> |
109 | <interface> | 125 | <interface> |
@@ -287,6 +303,14 @@ | |||
287 | </interface> | 303 | </interface> |
288 | </hal> | 304 | </hal> |
289 | <hal format="hidl" optional="true"> | 305 | <hal format="hidl" optional="true"> |
306 | <name>android.hardware.radio.config</name> | ||
307 | <version>1.0</version> | ||
308 | <interface> | ||
309 | <name>IRadioConfig</name> | ||
310 | <instance>default</instance> | ||
311 | </interface> | ||
312 | </hal> | ||
313 | <hal format="hidl" optional="true"> | ||
290 | <name>android.hardware.renderscript</name> | 314 | <name>android.hardware.renderscript</name> |
291 | <version>1.0</version> | 315 | <version>1.0</version> |
292 | <interface> | 316 | <interface> |
diff --git a/current.txt b/current.txt index 06c94d93..096b6557 100644 --- a/current.txt +++ b/current.txt | |||
@@ -318,14 +318,14 @@ a3ff916784dce87a56c757ab5c86433f0cdf562280999a5f978a6e8a0f3f19e7 android.hardwar | |||
318 | 7877ff8e4c1e48b825e6e5e66d050288e5656ed535c61cc7830a92ed4a9e1990 android.hardware.drm@1.1::IDrmFactory | 318 | 7877ff8e4c1e48b825e6e5e66d050288e5656ed535c61cc7830a92ed4a9e1990 android.hardware.drm@1.1::IDrmFactory |
319 | fef2f0ebde7704548fb203df46673ceb342272fc4fa9d0af25a980d2584a36e7 android.hardware.drm@1.1::IDrmPlugin | 319 | fef2f0ebde7704548fb203df46673ceb342272fc4fa9d0af25a980d2584a36e7 android.hardware.drm@1.1::IDrmPlugin |
320 | 5047a346ecce239404b9020959f60dd467318e9c17b290a6386bc3894df62c3c android.hardware.drm@1.1::types | 320 | 5047a346ecce239404b9020959f60dd467318e9c17b290a6386bc3894df62c3c android.hardware.drm@1.1::types |
321 | be794f5df97f134d6dcabb866b250d1305100e7ae07fb253b7841df890b931bb android.hardware.gnss@1.1::IGnss | 321 | a830336ac8627d6432cfafb1b884343ad9f885dee0a5323e380e6d3c519156b8 android.hardware.gnss@1.1::IGnss |
322 | 8ad55bc35bb3a83e65c018bdfde7ae5ebc749ff2bf6b79412ded0bc6c89b97d8 android.hardware.gnss@1.1::IGnssCallback | 322 | 8ad55bc35bb3a83e65c018bdfde7ae5ebc749ff2bf6b79412ded0bc6c89b97d8 android.hardware.gnss@1.1::IGnssCallback |
323 | 3c5183d7506010be57e0f748e3640fc2ded1ba955784b6256ba427f4c399591c android.hardware.gnss@1.1::IGnssConfiguration | 323 | 3c5183d7506010be57e0f748e3640fc2ded1ba955784b6256ba427f4c399591c android.hardware.gnss@1.1::IGnssConfiguration |
324 | b054af24fbb70d54cde1fb5cba126809e7c4e863e8f9115dc492321dfbcbc993 android.hardware.gnss@1.1::IGnssMeasurement | 324 | 1a07d1383e847c3deb696ec7a2c9e33b9683772945660448a010b18063da67a4 android.hardware.gnss@1.1::IGnssMeasurement |
325 | 83e7a10ff3702147bd7ffa04567b20d407a3b16bbb7705644af44d919afe9103 android.hardware.gnss@1.1::IGnssMeasurementCallback | 325 | 83e7a10ff3702147bd7ffa04567b20d407a3b16bbb7705644af44d919afe9103 android.hardware.gnss@1.1::IGnssMeasurementCallback |
326 | 82da7e7624f72ff1927f48738913e20bee3a513adfe5dc7c4f888176e20376e6 android.hardware.graphics.common@1.1::types | 326 | 0b96e0254e2168cfecb30c1ed5fb42681652cc00faa68c6e07568fafe64d1d50 android.hardware.graphics.common@1.1::types |
327 | d9b40a5b09962a5a0780b10fe33a4e607e69e2e088fc83de88a584115b7cb1c0 android.hardware.graphics.composer@2.2::IComposer | 327 | d9b40a5b09962a5a0780b10fe33a4e607e69e2e088fc83de88a584115b7cb1c0 android.hardware.graphics.composer@2.2::IComposer |
328 | d6ce042995239712bc1d0970fa9d512c15c0b1ac9bcb048bd8b69f617b45c25e android.hardware.graphics.composer@2.2::IComposerClient | 328 | c3cd2a3e245ffefae859c9a3d31382a9421be95cfa6bc1231571eb3533049b54 android.hardware.graphics.composer@2.2::IComposerClient |
329 | dd83be076b6b3f10ed62ab34d8c8b95f2415961fb785200eb842e7bfb2b0ee92 android.hardware.graphics.mapper@2.1::IMapper | 329 | dd83be076b6b3f10ed62ab34d8c8b95f2415961fb785200eb842e7bfb2b0ee92 android.hardware.graphics.mapper@2.1::IMapper |
330 | 675682dd3007805c985eaaec91612abc88f4c25b3431fb84070b7584a1a741fb android.hardware.health@2.0::IHealth | 330 | 675682dd3007805c985eaaec91612abc88f4c25b3431fb84070b7584a1a741fb android.hardware.health@2.0::IHealth |
331 | 434c4c32c00b0e54bb05e40c79503208b40f786a318029a2a4f66e34f10f2a76 android.hardware.health@2.0::IHealthInfoCallback | 331 | 434c4c32c00b0e54bb05e40c79503208b40f786a318029a2a4f66e34f10f2a76 android.hardware.health@2.0::IHealthInfoCallback |
diff --git a/gnss/1.1/IGnss.hal b/gnss/1.1/IGnss.hal index 096f251b..672f7423 100644 --- a/gnss/1.1/IGnss.hal +++ b/gnss/1.1/IGnss.hal | |||
@@ -46,15 +46,17 @@ interface IGnss extends @1.0::IGnss { | |||
46 | * @param minIntervalMs Represents the time between fixes in milliseconds. | 46 | * @param minIntervalMs Represents the time between fixes in milliseconds. |
47 | * @param preferredAccuracyMeters Represents the requested fix accuracy in meters. | 47 | * @param preferredAccuracyMeters Represents the requested fix accuracy in meters. |
48 | * @param preferredTimeMs Represents the requested time to first fix in milliseconds. | 48 | * @param preferredTimeMs Represents the requested time to first fix in milliseconds. |
49 | * @param lowPowerMode When true, HAL must make strong tradeoffs to substantially restrict power | 49 | * @param lowPowerMode When true, and IGnss.hal is the only client to the GNSS hardware, the |
50 | * use. Specifically, in the case of a several second long minIntervalMs, the GNSS chipset | 50 | * GNSS hardware must make strong tradeoffs to substantially restrict power use. |
51 | * must not, on average, run power hungry operations like RF and signal searches for more | 51 | * Specifically, in the case of a several second long minIntervalMs, the GNSS hardware must |
52 | * than one second per interval, and must make exactly one call to gnssSvStatusCb(), and | 52 | * not, on average, run power hungry operations like RF and signal searches for more than |
53 | * either zero or one call to GnssLocationCb() at each interval. When false, HAL must | 53 | * one second per interval, and must make exactly one call to gnssSvStatusCb(), and either |
54 | * operate in the nominal mode (similar to V1.0 where this flag wasn't present) and is | 54 | * zero or one call to GnssLocationCb() at each interval. When false, HAL must operate in |
55 | * expected to make power and performance tradoffs such as duty-cycling when signal | 55 | * the nominal mode (similar to V1.0 where this flag wasn't present) and is expected to make |
56 | * conditions are good and more active searches to reacquire GNSS signals when no signals | 56 | * power and performance tradoffs such as duty-cycling when signal conditions are good and |
57 | * are present. | 57 | * more active searches to reacquire GNSS signals when no signals are present. |
58 | * When there are additional clients using the GNSS hardware other than IGnss.hal, the GNSS | ||
59 | * hardware may operate in a higher power mode, on behalf of those clients. | ||
58 | * | 60 | * |
59 | * @return success Returns true if successful. | 61 | * @return success Returns true if successful. |
60 | */ | 62 | */ |
diff --git a/gnss/1.1/IGnssMeasurement.hal b/gnss/1.1/IGnssMeasurement.hal index cd83ae35..6ed8e53b 100644 --- a/gnss/1.1/IGnssMeasurement.hal +++ b/gnss/1.1/IGnssMeasurement.hal | |||
@@ -33,10 +33,11 @@ interface IGnssMeasurement extends @1.0::IGnssMeasurement { | |||
33 | * @param callback Handle to GnssMeasurement callback interface. | 33 | * @param callback Handle to GnssMeasurement callback interface. |
34 | * @param enableFullTracking If true, GNSS chipset must switch off duty cycling. In such mode | 34 | * @param enableFullTracking If true, GNSS chipset must switch off duty cycling. In such mode |
35 | * no clock discontinuities are expected and, when supported, carrier phase should be | 35 | * no clock discontinuities are expected and, when supported, carrier phase should be |
36 | * continuous in good signal conditions. All constellations and frequency bands that the | 36 | * continuous in good signal conditions. All non-blacklisted, healthy constellations, |
37 | * chipset supports must be reported in this mode. The GNSS chipset is allowed to consume | 37 | * satellites and frequency bands that the chipset supports must be reported in this mode. |
38 | * more power in this mode. If false, API must behave as in HAL V1_0, optimizing power via | 38 | * The GNSS chipset is allowed to consume more power in this mode. If false, API must behave |
39 | * duty cycling, constellations and frequency limits, etc. | 39 | * as in HAL V1_0, optimizing power via duty cycling, constellations and frequency limits, |
40 | * etc. | ||
40 | * | 41 | * |
41 | * @return initRet Returns SUCCESS if successful. Returns ERROR_ALREADY_INIT if a callback has | 42 | * @return initRet Returns SUCCESS if successful. Returns ERROR_ALREADY_INIT if a callback has |
42 | * already been registered without a corresponding call to 'close'. Returns ERROR_GENERIC | 43 | * already been registered without a corresponding call to 'close'. Returns ERROR_GENERIC |
diff --git a/graphics/common/1.1/Android.bp b/graphics/common/1.1/Android.bp index c319d800..8bc68f54 100644 --- a/graphics/common/1.1/Android.bp +++ b/graphics/common/1.1/Android.bp | |||
@@ -15,8 +15,10 @@ hidl_interface { | |||
15 | ], | 15 | ], |
16 | types: [ | 16 | types: [ |
17 | "BufferUsage", | 17 | "BufferUsage", |
18 | "ColorMode", | ||
18 | "Dataspace", | 19 | "Dataspace", |
19 | "PixelFormat", | 20 | "PixelFormat", |
21 | "RenderIntent", | ||
20 | ], | 22 | ], |
21 | gen_java: true, | 23 | gen_java: true, |
22 | gen_java_constants: true, | 24 | gen_java_constants: true, |
diff --git a/graphics/common/1.1/types.hal b/graphics/common/1.1/types.hal index b917d5e8..5dca4829 100644 --- a/graphics/common/1.1/types.hal +++ b/graphics/common/1.1/types.hal | |||
@@ -16,9 +16,10 @@ | |||
16 | 16 | ||
17 | package android.hardware.graphics.common@1.1; | 17 | package android.hardware.graphics.common@1.1; |
18 | 18 | ||
19 | import @1.0::PixelFormat; | ||
20 | import @1.0::BufferUsage; | 19 | import @1.0::BufferUsage; |
20 | import @1.0::ColorMode; | ||
21 | import @1.0::Dataspace; | 21 | import @1.0::Dataspace; |
22 | import @1.0::PixelFormat; | ||
22 | 23 | ||
23 | /** | 24 | /** |
24 | * Pixel formats for graphics buffers. | 25 | * Pixel formats for graphics buffers. |
@@ -129,15 +130,165 @@ enum BufferUsage : @1.0::BufferUsage { | |||
129 | @export(name="android_dataspace_v1_1_t", value_prefix="HAL_DATASPACE_", | 130 | @export(name="android_dataspace_v1_1_t", value_prefix="HAL_DATASPACE_", |
130 | export_parent="false") | 131 | export_parent="false") |
131 | enum Dataspace : @1.0::Dataspace { | 132 | enum Dataspace : @1.0::Dataspace { |
133 | /* | ||
134 | * @1.0::Dataspace defines six legacy dataspaces | ||
135 | * | ||
136 | * SRGB_LINEAR = 0x200, // deprecated, use V0_SRGB_LINEAR | ||
137 | * SRGB = 0x201, // deprecated, use V0_SRGB | ||
138 | * JFIF = 0x101, // deprecated, use V0_JFIF | ||
139 | * BT601_625 = 0x102, // deprecated, use V0_BT601_625 | ||
140 | * BT601_525 = 0x103, // deprecated, use V0_BT601_525 | ||
141 | * BT709 = 0x104, // deprecated, use V0_BT709 | ||
142 | * | ||
143 | * The difference between the legacy dataspaces and their modern | ||
144 | * counterparts is that, with legacy dataspaces, the pixel values may have | ||
145 | * been desaturated by the content creator in an unspecified way. | ||
146 | * | ||
147 | * When colorimetric mapping is required, the legacy dataspaces must be | ||
148 | * treated as their modern counterparts (e.g., SRGB must be treated as | ||
149 | * V0_SRGB) and no re-saturation is allowed. When non-colorimetric mapping | ||
150 | * is allowed, the pixel values can be interpreted freely by | ||
151 | * implementations for the purpose of re-saturation, and the re-saturated | ||
152 | * pixel values are in the respective modern dataspaces. | ||
153 | * | ||
154 | * This is also true when UNKNOWN is treated as a legacy dataspace. | ||
155 | */ | ||
156 | |||
132 | /** | 157 | /** |
133 | * ITU-R Recommendation 2020 (BT.2020) | 158 | * ITU-R Recommendation 2020 (BT.2020) |
134 | * | 159 | * |
135 | * Ultra High-definition television | 160 | * Ultra High-definition television |
136 | * | 161 | * |
137 | * Use limited range, SMPTE 2084 (PQ) transfer and BT2020 standard | 162 | * Use limited range, BT.709 transfer and BT2020 standard |
138 | * limited range is the preferred / normative definition for BT.2020 | ||
139 | */ | 163 | */ |
140 | BT2020_ITU = STANDARD_BT2020 | TRANSFER_SMPTE_170M | RANGE_LIMITED, | 164 | BT2020_ITU = STANDARD_BT2020 | TRANSFER_SMPTE_170M | RANGE_LIMITED, |
141 | 165 | ||
166 | /** | ||
167 | * ITU-R Recommendation 2100 (BT.2100) | ||
168 | * | ||
169 | * High dynamic range television | ||
170 | * | ||
171 | * Use limited/full range, PQ/HLG transfer, and BT2020 standard | ||
172 | * limited range is the preferred / normative definition for BT.2100 | ||
173 | */ | ||
142 | BT2020_ITU_PQ = STANDARD_BT2020 | TRANSFER_ST2084 | RANGE_LIMITED, | 174 | BT2020_ITU_PQ = STANDARD_BT2020 | TRANSFER_ST2084 | RANGE_LIMITED, |
175 | BT2020_ITU_HLG = STANDARD_BT2020 | TRANSFER_HLG | RANGE_LIMITED, | ||
176 | BT2020_HLG = STANDARD_BT2020 | TRANSFER_HLG | RANGE_FULL, | ||
177 | }; | ||
178 | |||
179 | @export(name="android_color_mode_v1_1_t", value_prefix="HAL_COLOR_MODE_", | ||
180 | export_parent="false") | ||
181 | enum ColorMode : @1.0::ColorMode { | ||
182 | /** | ||
183 | * BT2020 corresponds with display settings that implement the ITU-R | ||
184 | * Recommendation BT.2020 / Rec. 2020 for UHDTV. | ||
185 | * | ||
186 | * Primaries: | ||
187 | * x y | ||
188 | * green 0.170 0.797 | ||
189 | * blue 0.131 0.046 | ||
190 | * red 0.708 0.292 | ||
191 | * white (D65) 0.3127 0.3290 | ||
192 | * | ||
193 | * Inverse Gamma Correction (IGC): V represents normalized (with [0 to 1] | ||
194 | * range) value of R, G, or B. | ||
195 | * | ||
196 | * if Vnonlinear < b * 4.5 | ||
197 | * Vlinear = Vnonlinear / 4.5 | ||
198 | * else | ||
199 | * Vlinear = ((Vnonlinear + (a - 1)) / a) ^ (1/0.45) | ||
200 | * | ||
201 | * Gamma Correction (GC): | ||
202 | * | ||
203 | * if Vlinear < b | ||
204 | * Vnonlinear = 4.5 * Vlinear | ||
205 | * else | ||
206 | * Vnonlinear = a * Vlinear ^ 0.45 - (a - 1) | ||
207 | * | ||
208 | * where | ||
209 | * | ||
210 | * a = 1.09929682680944, b = 0.018053968510807 | ||
211 | * | ||
212 | * For practical purposes, these a/b values can be used instead | ||
213 | * | ||
214 | * a = 1.099, b = 0.018 for 10-bit display systems | ||
215 | * a = 1.0993, b = 0.0181 for 12-bit display systems | ||
216 | */ | ||
217 | BT2020 = 10, | ||
218 | |||
219 | /** | ||
220 | * BT2100_PQ and BT2100_HLG correspond with display settings that | ||
221 | * implement the ITU-R Recommendation BT.2100 / Rec. 2100 for HDR TV. | ||
222 | * | ||
223 | * Primaries: | ||
224 | * x y | ||
225 | * green 0.170 0.797 | ||
226 | * blue 0.131 0.046 | ||
227 | * red 0.708 0.292 | ||
228 | * white (D65) 0.3127 0.3290 | ||
229 | * | ||
230 | * For BT2100_PQ, the transfer function is Perceptual Quantizer (PQ). For | ||
231 | * BT2100_HLG, the transfer function is Hybrid Log-Gamma (HLG). | ||
232 | */ | ||
233 | BT2100_PQ = 11, | ||
234 | BT2100_HLG = 12, | ||
235 | }; | ||
236 | |||
237 | /** | ||
238 | * RenderIntent defines the mapping from color mode colors to display colors. | ||
239 | * | ||
240 | * A render intent must not change how it maps colors when the color mode | ||
241 | * changes. That is to say that when a render intent maps color C to color C', | ||
242 | * the fact that color C can have different pixel values in different color | ||
243 | * modes should not affect the mapping. | ||
244 | * | ||
245 | * RenderIntent overrides the render intents defined for individual color | ||
246 | * modes. It is ignored when the color mode is ColorMode::NATIVE, because | ||
247 | * ColorMode::NATIVE colors are already display colors. | ||
248 | */ | ||
249 | @export(name="android_render_intent_v1_1_t", value_prefix="HAL_RENDER_INTENT_", | ||
250 | export_parent="false") | ||
251 | enum RenderIntent : int32_t { | ||
252 | /** | ||
253 | * Colors in the display gamut are unchanged. Colors out of the display | ||
254 | * gamut are hard-clipped. | ||
255 | * | ||
256 | * This implies that the display must have been calibrated unless | ||
257 | * ColorMode::NATIVE is the only supported color mode. | ||
258 | */ | ||
259 | COLORIMETRIC = 0, | ||
260 | |||
261 | /** | ||
262 | * Enhance colors that are in the display gamut. Colors out of the display | ||
263 | * gamut are hard-clipped. | ||
264 | * | ||
265 | * The enhancement typically picks the biggest standard color space (e.g. | ||
266 | * DCI-P3) that is narrower than the display gamut and stretches it to the | ||
267 | * display gamut. The stretching is recommended to preserve skin tones. | ||
268 | */ | ||
269 | ENHANCE = 1, | ||
270 | |||
271 | /** | ||
272 | * Tone map high-dynamic-range colors to the display's dynamic range. The | ||
273 | * dynamic range of the colors are communicated separately. After tone | ||
274 | * mapping, the mapping to the display gamut is as defined in | ||
275 | * COLORIMETRIC. | ||
276 | */ | ||
277 | TONE_MAP_COLORIMETRIC = 2, | ||
278 | |||
279 | /** | ||
280 | * Tone map high-dynamic-range colors to the display's dynamic range. The | ||
281 | * dynamic range of the colors are communicated separately. After tone | ||
282 | * mapping, the mapping to the display gamut is as defined in ENHANCE. | ||
283 | * | ||
284 | * The tone mapping step and the enhancing step must match | ||
285 | * TONE_MAP_COLORIMETRIC and ENHANCE respectively when they are also | ||
286 | * supported. | ||
287 | */ | ||
288 | TONE_MAP_ENHANCE = 3, | ||
289 | |||
290 | /* | ||
291 | * Vendors are recommended to use 0x100 - 0x1FF for their own values, and | ||
292 | * that must be done with subtypes defined by vendor extensions. | ||
293 | */ | ||
143 | }; | 294 | }; |
diff --git a/graphics/composer/2.1/utils/command-buffer/include/composer-command-buffer/2.1/ComposerCommandBuffer.h b/graphics/composer/2.1/utils/command-buffer/include/composer-command-buffer/2.1/ComposerCommandBuffer.h index df529ec6..27422071 100644 --- a/graphics/composer/2.1/utils/command-buffer/include/composer-command-buffer/2.1/ComposerCommandBuffer.h +++ b/graphics/composer/2.1/utils/command-buffer/include/composer-command-buffer/2.1/ComposerCommandBuffer.h | |||
@@ -247,21 +247,8 @@ class CommandWriterBase { | |||
247 | 247 | ||
248 | void setClientTarget(uint32_t slot, const native_handle_t* target, int acquireFence, | 248 | void setClientTarget(uint32_t slot, const native_handle_t* target, int acquireFence, |
249 | Dataspace dataspace, const std::vector<IComposerClient::Rect>& damage) { | 249 | Dataspace dataspace, const std::vector<IComposerClient::Rect>& damage) { |
250 | bool doWrite = (damage.size() <= (kMaxLength - 4) / 4); | 250 | setClientTargetInternal(slot, target, acquireFence, static_cast<int32_t>(dataspace), |
251 | size_t length = 4 + ((doWrite) ? damage.size() * 4 : 0); | 251 | damage); |
252 | |||
253 | beginCommand(IComposerClient::Command::SET_CLIENT_TARGET, length); | ||
254 | write(slot); | ||
255 | writeHandle(target, true); | ||
256 | writeFence(acquireFence); | ||
257 | writeSigned(static_cast<int32_t>(dataspace)); | ||
258 | // When there are too many rectangles in the damage region and doWrite | ||
259 | // is false, we write no rectangle at all which means the entire | ||
260 | // client target is damaged. | ||
261 | if (doWrite) { | ||
262 | writeRegion(damage); | ||
263 | } | ||
264 | endCommand(); | ||
265 | } | 252 | } |
266 | 253 | ||
267 | static constexpr uint16_t kSetOutputBufferLength = 3; | 254 | static constexpr uint16_t kSetOutputBufferLength = 3; |
@@ -354,9 +341,7 @@ class CommandWriterBase { | |||
354 | 341 | ||
355 | static constexpr uint16_t kSetLayerDataspaceLength = 1; | 342 | static constexpr uint16_t kSetLayerDataspaceLength = 1; |
356 | void setLayerDataspace(Dataspace dataspace) { | 343 | void setLayerDataspace(Dataspace dataspace) { |
357 | beginCommand(IComposerClient::Command::SET_LAYER_DATASPACE, kSetLayerDataspaceLength); | 344 | setLayerDataspaceInternal(static_cast<int32_t>(dataspace)); |
358 | writeSigned(static_cast<int32_t>(dataspace)); | ||
359 | endCommand(); | ||
360 | } | 345 | } |
361 | 346 | ||
362 | static constexpr uint16_t kSetLayerDisplayFrameLength = 4; | 347 | static constexpr uint16_t kSetLayerDisplayFrameLength = 4; |
@@ -418,6 +403,32 @@ class CommandWriterBase { | |||
418 | } | 403 | } |
419 | 404 | ||
420 | protected: | 405 | protected: |
406 | void setClientTargetInternal(uint32_t slot, const native_handle_t* target, int acquireFence, | ||
407 | int32_t dataspace, | ||
408 | const std::vector<IComposerClient::Rect>& damage) { | ||
409 | bool doWrite = (damage.size() <= (kMaxLength - 4) / 4); | ||
410 | size_t length = 4 + ((doWrite) ? damage.size() * 4 : 0); | ||
411 | |||
412 | beginCommand(IComposerClient::Command::SET_CLIENT_TARGET, length); | ||
413 | write(slot); | ||
414 | writeHandle(target, true); | ||
415 | writeFence(acquireFence); | ||
416 | writeSigned(dataspace); | ||
417 | // When there are too many rectangles in the damage region and doWrite | ||
418 | // is false, we write no rectangle at all which means the entire | ||
419 | // client target is damaged. | ||
420 | if (doWrite) { | ||
421 | writeRegion(damage); | ||
422 | } | ||
423 | endCommand(); | ||
424 | } | ||
425 | |||
426 | void setLayerDataspaceInternal(int32_t dataspace) { | ||
427 | beginCommand(IComposerClient::Command::SET_LAYER_DATASPACE, kSetLayerDataspaceLength); | ||
428 | writeSigned(dataspace); | ||
429 | endCommand(); | ||
430 | } | ||
431 | |||
421 | void beginCommand(IComposerClient::Command command, uint16_t length) { | 432 | void beginCommand(IComposerClient::Command command, uint16_t length) { |
422 | if (mCommandEnd) { | 433 | if (mCommandEnd) { |
423 | LOG_FATAL("endCommand was not called before command 0x%x", command); | 434 | LOG_FATAL("endCommand was not called before command 0x%x", command); |
diff --git a/graphics/composer/2.1/utils/vts/include/composer-vts/2.1/ComposerVts.h b/graphics/composer/2.1/utils/vts/include/composer-vts/2.1/ComposerVts.h index 0d883e4f..8d5493e8 100644 --- a/graphics/composer/2.1/utils/vts/include/composer-vts/2.1/ComposerVts.h +++ b/graphics/composer/2.1/utils/vts/include/composer-vts/2.1/ComposerVts.h | |||
@@ -104,9 +104,7 @@ class ComposerClient { | |||
104 | 104 | ||
105 | void execute(TestCommandReader* reader, CommandWriterBase* writer); | 105 | void execute(TestCommandReader* reader, CommandWriterBase* writer); |
106 | 106 | ||
107 | private: | 107 | protected: |
108 | sp<IComposerClient> mClient; | ||
109 | |||
110 | // Keep track of all virtual displays and layers. When a test fails with | 108 | // Keep track of all virtual displays and layers. When a test fails with |
111 | // ASSERT_*, the destructor will clean up the resources for the test. | 109 | // ASSERT_*, the destructor will clean up the resources for the test. |
112 | struct DisplayResource { | 110 | struct DisplayResource { |
@@ -116,6 +114,9 @@ class ComposerClient { | |||
116 | std::unordered_set<Layer> layers; | 114 | std::unordered_set<Layer> layers; |
117 | }; | 115 | }; |
118 | std::unordered_map<Display, DisplayResource> mDisplayResources; | 116 | std::unordered_map<Display, DisplayResource> mDisplayResources; |
117 | |||
118 | private: | ||
119 | sp<IComposerClient> mClient; | ||
119 | }; | 120 | }; |
120 | 121 | ||
121 | } // namespace vts | 122 | } // namespace vts |
diff --git a/graphics/composer/2.2/Android.bp b/graphics/composer/2.2/Android.bp index 633a208c..fe71e9ec 100644 --- a/graphics/composer/2.2/Android.bp +++ b/graphics/composer/2.2/Android.bp | |||
@@ -12,6 +12,7 @@ hidl_interface { | |||
12 | ], | 12 | ], |
13 | interfaces: [ | 13 | interfaces: [ |
14 | "android.hardware.graphics.common@1.0", | 14 | "android.hardware.graphics.common@1.0", |
15 | "android.hardware.graphics.common@1.1", | ||
15 | "android.hardware.graphics.composer@2.1", | 16 | "android.hardware.graphics.composer@2.1", |
16 | "android.hidl.base@1.0", | 17 | "android.hidl.base@1.0", |
17 | ], | 18 | ], |
diff --git a/graphics/composer/2.2/IComposerClient.hal b/graphics/composer/2.2/IComposerClient.hal index dcd9c8d0..b7ba6a60 100644 --- a/graphics/composer/2.2/IComposerClient.hal +++ b/graphics/composer/2.2/IComposerClient.hal | |||
@@ -16,11 +16,14 @@ | |||
16 | 16 | ||
17 | package android.hardware.graphics.composer@2.2; | 17 | package android.hardware.graphics.composer@2.2; |
18 | 18 | ||
19 | import android.hardware.graphics.common@1.0::PixelFormat; | 19 | import android.hardware.graphics.common@1.1::ColorMode; |
20 | import android.hardware.graphics.common@1.0::Dataspace; | 20 | import android.hardware.graphics.common@1.1::Dataspace; |
21 | import android.hardware.graphics.common@1.1::PixelFormat; | ||
22 | import android.hardware.graphics.common@1.1::RenderIntent; | ||
21 | import @2.1::IComposerClient; | 23 | import @2.1::IComposerClient; |
22 | import @2.1::Display; | 24 | import @2.1::Display; |
23 | import @2.1::Error; | 25 | import @2.1::Error; |
26 | import @2.1::IComposerClient; | ||
24 | 27 | ||
25 | interface IComposerClient extends @2.1::IComposerClient { | 28 | interface IComposerClient extends @2.1::IComposerClient { |
26 | 29 | ||
@@ -90,16 +93,20 @@ interface IComposerClient extends @2.1::IComposerClient { | |||
90 | 93 | ||
91 | enum Command : @2.1::IComposerClient.Command { | 94 | enum Command : @2.1::IComposerClient.Command { |
92 | /** | 95 | /** |
93 | * setPerFrameMetadata(Display display, vec<PerFrameMetadata> data) | 96 | * SET_LAYER_PER_FRAME_METADATA has this pseudo prototype |
97 | * | ||
98 | * setLayerPerFrameMetadata(Display display, Layer layer, | ||
99 | * vec<PerFrameMetadata> data); | ||
100 | * | ||
94 | * Sets the PerFrameMetadata for the display. This metadata must be used | 101 | * Sets the PerFrameMetadata for the display. This metadata must be used |
95 | * by the implementation to better tone map content to that display. | 102 | * by the implementation to better tone map content to that display. |
96 | * | 103 | * |
97 | * This is a method that may be called every frame. Thus it's | 104 | * This is a method that may be called every frame. Thus it's |
98 | * implemented using buffered transport. | 105 | * implemented using buffered transport. |
99 | * SET_PER_FRAME_METADATA is the command used by the buffered transport | 106 | * SET_LAYER_PER_FRAME_METADATA is the command used by the buffered transport |
100 | * mechanism. | 107 | * mechanism. |
101 | */ | 108 | */ |
102 | SET_PER_FRAME_METADATA = 0x207 << @2.1::IComposerClient.Command:OPCODE_SHIFT, | 109 | SET_LAYER_PER_FRAME_METADATA = 0x303 << @2.1::IComposerClient.Command:OPCODE_SHIFT, |
103 | 110 | ||
104 | /** | 111 | /** |
105 | * SET_LAYER_COLOR has this pseudo prototype | 112 | * SET_LAYER_COLOR has this pseudo prototype |
@@ -242,6 +249,65 @@ interface IComposerClient extends @2.1::IComposerClient { | |||
242 | setReadbackBuffer(Display display, handle buffer, handle releaseFence) generates (Error error); | 249 | setReadbackBuffer(Display display, handle buffer, handle releaseFence) generates (Error error); |
243 | 250 | ||
244 | /** | 251 | /** |
252 | * createVirtualDisplay_2_2 | ||
253 | * Creates a new virtual display with the given width and height. The | ||
254 | * format passed into this function is the default format requested by the | ||
255 | * consumer of the virtual display output buffers. | ||
256 | * | ||
257 | * The display must be assumed to be on from the time the first frame is | ||
258 | * presented until the display is destroyed. | ||
259 | * | ||
260 | * @param width is the width in pixels. | ||
261 | * @param height is the height in pixels. | ||
262 | * @param formatHint is the default output buffer format selected by | ||
263 | * the consumer. | ||
264 | * @param outputBufferSlotCount is the number of output buffer slots to be | ||
265 | * reserved. | ||
266 | * @return error is NONE upon success. Otherwise, | ||
267 | * UNSUPPORTED when the width or height is too large for the | ||
268 | * device to be able to create a virtual display. | ||
269 | * NO_RESOURCES when the device is unable to create a new virtual | ||
270 | * display at this time. | ||
271 | * @return display is the newly-created virtual display. | ||
272 | * @return format is the format of the buffer the device will produce. | ||
273 | */ | ||
274 | @callflow(next="*") | ||
275 | createVirtualDisplay_2_2(uint32_t width, | ||
276 | uint32_t height, | ||
277 | PixelFormat formatHint, | ||
278 | uint32_t outputBufferSlotCount) | ||
279 | generates (Error error, | ||
280 | Display display, | ||
281 | PixelFormat format); | ||
282 | |||
283 | /** | ||
284 | * getClientTargetSupport_2_2 | ||
285 | * Returns whether a client target with the given properties can be | ||
286 | * handled by the device. | ||
287 | * | ||
288 | * This function must return true for a client target with width and | ||
289 | * height equal to the active display configuration dimensions, | ||
290 | * PixelFormat::RGBA_8888, and Dataspace::UNKNOWN. It is not required to | ||
291 | * return true for any other configuration. | ||
292 | * | ||
293 | * @param display is the display to query. | ||
294 | * @param width is the client target width in pixels. | ||
295 | * @param height is the client target height in pixels. | ||
296 | * @param format is the client target format. | ||
297 | * @param dataspace is the client target dataspace, as described in | ||
298 | * setLayerDataspace. | ||
299 | * @return error is NONE upon success. Otherwise, | ||
300 | * BAD_DISPLAY when an invalid display handle was passed in. | ||
301 | * UNSUPPORTED when the given configuration is not supported. | ||
302 | */ | ||
303 | @callflow(next="*") | ||
304 | getClientTargetSupport_2_2(Display display, | ||
305 | uint32_t width, | ||
306 | uint32_t height, | ||
307 | PixelFormat format, | ||
308 | Dataspace dataspace) | ||
309 | generates (Error error); | ||
310 | /** | ||
245 | * setPowerMode_2_2 | 311 | * setPowerMode_2_2 |
246 | * Sets the power mode of the given display. The transition must be | 312 | * Sets the power mode of the given display. The transition must be |
247 | * complete when this function returns. It is valid to call this function | 313 | * complete when this function returns. It is valid to call this function |
@@ -260,4 +326,118 @@ interface IComposerClient extends @2.1::IComposerClient { | |||
260 | */ | 326 | */ |
261 | setPowerMode_2_2(Display display, PowerMode mode) generates (Error error); | 327 | setPowerMode_2_2(Display display, PowerMode mode) generates (Error error); |
262 | 328 | ||
329 | /** | ||
330 | * Returns the color modes supported on this display. | ||
331 | * | ||
332 | * All devices must support at least ColorMode::NATIVE. | ||
333 | * | ||
334 | * @param display is the display to query. | ||
335 | * @return error is NONE upon success. Otherwise, | ||
336 | * BAD_DISPLAY when an invalid display handle was passed in. | ||
337 | * @return modes is an array of color modes. | ||
338 | */ | ||
339 | getColorModes_2_2(Display display) | ||
340 | generates (Error error, | ||
341 | vec<ColorMode> modes); | ||
342 | |||
343 | /** | ||
344 | * Returns the render intents supported by the specified display and color | ||
345 | * mode. | ||
346 | * | ||
347 | * RenderIntent::COLORIMETRIC is always supported. | ||
348 | * | ||
349 | * @param display is the display to query. | ||
350 | * @param mode is the color mode to query. | ||
351 | * @return error is NONE upon success. Otherwise, | ||
352 | * BAD_DISPLAY when an invalid display handle was passed in. | ||
353 | * BAD_PARAMETER when an invalid color mode was passed in. | ||
354 | * @return intents is an array of render intents. | ||
355 | */ | ||
356 | getRenderIntents(Display display, ColorMode mode) | ||
357 | generates (Error error, | ||
358 | vec<RenderIntent> intents); | ||
359 | |||
360 | /** | ||
361 | * Sets the color mode and render intent of the given display. | ||
362 | * | ||
363 | * The color mode and render intent change must take effect on next | ||
364 | * presentDisplay. | ||
365 | * | ||
366 | * All devices must support at least ColorMode::NATIVE and | ||
367 | * RenderIntent::COLORIMETRIC, and displays are assumed to be in this mode | ||
368 | * upon hotplug. | ||
369 | * | ||
370 | * @param display is the display to which the color mode is set. | ||
371 | * @param mode is the color mode to set to. | ||
372 | * @param intent is the render intent to set to. | ||
373 | * @return error is NONE upon success. Otherwise, | ||
374 | * BAD_DISPLAY when an invalid display handle was passed in. | ||
375 | * BAD_PARAMETER when mode or intent is invalid | ||
376 | * UNSUPPORTED when mode or intent is not supported on this | ||
377 | * display. | ||
378 | */ | ||
379 | setColorMode_2_2(Display display, ColorMode mode, RenderIntent intent) | ||
380 | generates (Error error); | ||
381 | |||
382 | /* | ||
383 | * By default, layer dataspaces are mapped to the current color mode | ||
384 | * colorimetrically with a few exceptions. | ||
385 | * | ||
386 | * When the layer dataspace is a legacy sRGB dataspace | ||
387 | * (Dataspace::SRGB_LINEAR, Dataspace::SRGB, or Dataspace::UNKNOWN when | ||
388 | * treated as such) and the display render intent is | ||
389 | * RenderIntent::ENHANCE, the pixel values can go through an | ||
390 | * implementation-defined saturation transform before being mapped to the | ||
391 | * current color mode colorimetrically. | ||
392 | * | ||
393 | * Colors that are out of the gamut of the current color mode are | ||
394 | * hard-clipped. | ||
395 | */ | ||
396 | |||
397 | /** | ||
398 | * Returns the saturation matrix of the specified legacy dataspace. | ||
399 | * | ||
400 | * The saturation matrix can be used to approximate the legacy dataspace | ||
401 | * saturation transform. It is to be applied on linear pixel values like | ||
402 | * this: | ||
403 | * | ||
404 | * (in GLSL) | ||
405 | * linearSrgb = clamp(saturationMatrix * linearSrgb, 0.0, 1.0); | ||
406 | * | ||
407 | * @param dataspace must be Dataspace::SRGB_LINEAR. | ||
408 | * @return error is NONE upon success. Otherwise, | ||
409 | * BAD_PARAMETER when an invalid dataspace was passed in. | ||
410 | * @return matrix is the 4x4 column-major matrix used to approximate the | ||
411 | * legacy dataspace saturation operation. The last row must be | ||
412 | * [0.0, 0.0, 0.0, 1.0]. | ||
413 | */ | ||
414 | getDataspaceSaturationMatrix(Dataspace dataspace) | ||
415 | generates (Error error, | ||
416 | float[4][4] matrix); | ||
417 | |||
418 | /** | ||
419 | * Executes commands from the input command message queue. Return values | ||
420 | * generated by the input commands are written to the output command | ||
421 | * message queue in the form of value commands. | ||
422 | * | ||
423 | * @param inLength is the length of input commands. | ||
424 | * @param inHandles is an array of handles referenced by the input | ||
425 | * commands. | ||
426 | * @return error is NONE upon success. Otherwise, | ||
427 | * BAD_PARAMETER when inLength is not equal to the length of | ||
428 | * commands in the input command message queue. | ||
429 | * NO_RESOURCES when the output command message queue was not | ||
430 | * properly drained. | ||
431 | * @param outQueueChanged indicates whether the output command message | ||
432 | * queue has changed. | ||
433 | * @param outLength is the length of output commands. | ||
434 | * @param outHandles is an array of handles referenced by the output | ||
435 | * commands. | ||
436 | */ | ||
437 | executeCommands_2_2(uint32_t inLength, | ||
438 | vec<handle> inHandles) | ||
439 | generates (Error error, | ||
440 | bool outQueueChanged, | ||
441 | uint32_t outLength, | ||
442 | vec<handle> outHandles); | ||
263 | }; | 443 | }; |
diff --git a/graphics/composer/2.2/default/Android.bp b/graphics/composer/2.2/default/Android.bp deleted file mode 100644 index 906479e6..00000000 --- a/graphics/composer/2.2/default/Android.bp +++ /dev/null | |||
@@ -1,31 +0,0 @@ | |||
1 | cc_binary { | ||
2 | name: "android.hardware.graphics.composer@2.2-service", | ||
3 | defaults: ["hidl_defaults"], | ||
4 | vendor: true, | ||
5 | relative_install_path: "hw", | ||
6 | srcs: ["service.cpp"], | ||
7 | init_rc: ["android.hardware.graphics.composer@2.2-service.rc"], | ||
8 | header_libs: [ | ||
9 | "android.hardware.graphics.composer@2.2-passthrough", | ||
10 | ], | ||
11 | shared_libs: [ | ||
12 | "android.hardware.graphics.composer@2.1", | ||
13 | "android.hardware.graphics.composer@2.2", | ||
14 | "android.hardware.graphics.mapper@2.0", | ||
15 | "libbase", | ||
16 | "libbinder", | ||
17 | "libcutils", | ||
18 | "libfmq", | ||
19 | "libhardware", | ||
20 | "libhidlbase", | ||
21 | "libhidltransport", | ||
22 | "libhwc2on1adapter", | ||
23 | "libhwc2onfbadapter", | ||
24 | "liblog", | ||
25 | "libsync", | ||
26 | "libutils", | ||
27 | ], | ||
28 | cflags: [ | ||
29 | "-DLOG_TAG=\"ComposerHal\"" | ||
30 | ], | ||
31 | } | ||
diff --git a/graphics/composer/2.2/default/Android.mk b/graphics/composer/2.2/default/Android.mk new file mode 100644 index 00000000..2f80f0c1 --- /dev/null +++ b/graphics/composer/2.2/default/Android.mk | |||
@@ -0,0 +1,32 @@ | |||
1 | LOCAL_PATH := $(call my-dir) | ||
2 | |||
3 | include $(CLEAR_VARS) | ||
4 | LOCAL_MODULE := android.hardware.graphics.composer@2.2-service | ||
5 | LOCAL_VENDOR_MODULE := true | ||
6 | LOCAL_MODULE_RELATIVE_PATH := hw | ||
7 | LOCAL_CFLAGS := -Wall -Werror -DLOG_TAG=\"ComposerHal\" | ||
8 | LOCAL_SRC_FILES := service.cpp | ||
9 | LOCAL_INIT_RC := android.hardware.graphics.composer@2.2-service.rc | ||
10 | LOCAL_HEADER_LIBRARIES := android.hardware.graphics.composer@2.2-passthrough | ||
11 | LOCAL_SHARED_LIBRARIES := \ | ||
12 | android.hardware.graphics.composer@2.1 \ | ||
13 | android.hardware.graphics.composer@2.2 \ | ||
14 | android.hardware.graphics.mapper@2.0 \ | ||
15 | libbase \ | ||
16 | libbinder \ | ||
17 | libcutils \ | ||
18 | libfmq \ | ||
19 | libhardware \ | ||
20 | libhidlbase \ | ||
21 | libhidltransport \ | ||
22 | libhwc2on1adapter \ | ||
23 | libhwc2onfbadapter \ | ||
24 | liblog \ | ||
25 | libsync \ | ||
26 | libutils | ||
27 | |||
28 | ifdef TARGET_USES_DISPLAY_RENDER_INTENTS | ||
29 | LOCAL_CFLAGS += -DUSES_DISPLAY_RENDER_INTENTS | ||
30 | endif | ||
31 | |||
32 | include $(BUILD_EXECUTABLE) | ||
diff --git a/graphics/composer/2.2/utils/command-buffer/include/composer-command-buffer/2.2/ComposerCommandBuffer.h b/graphics/composer/2.2/utils/command-buffer/include/composer-command-buffer/2.2/ComposerCommandBuffer.h index c803d3ca..138d7000 100644 --- a/graphics/composer/2.2/utils/command-buffer/include/composer-command-buffer/2.2/ComposerCommandBuffer.h +++ b/graphics/composer/2.2/utils/command-buffer/include/composer-command-buffer/2.2/ComposerCommandBuffer.h | |||
@@ -47,8 +47,8 @@ namespace V2_2 { | |||
47 | 47 | ||
48 | using android::hardware::MessageQueue; | 48 | using android::hardware::MessageQueue; |
49 | using android::hardware::graphics::common::V1_0::ColorTransform; | 49 | using android::hardware::graphics::common::V1_0::ColorTransform; |
50 | using android::hardware::graphics::common::V1_0::Dataspace; | ||
51 | using android::hardware::graphics::common::V1_0::Transform; | 50 | using android::hardware::graphics::common::V1_0::Transform; |
51 | using android::hardware::graphics::common::V1_1::Dataspace; | ||
52 | using android::hardware::graphics::composer::V2_1::Config; | 52 | using android::hardware::graphics::composer::V2_1::Config; |
53 | using android::hardware::graphics::composer::V2_1::Display; | 53 | using android::hardware::graphics::composer::V2_1::Display; |
54 | using android::hardware::graphics::composer::V2_1::Error; | 54 | using android::hardware::graphics::composer::V2_1::Error; |
@@ -64,6 +64,16 @@ class CommandWriterBase : public V2_1::CommandWriterBase { | |||
64 | public: | 64 | public: |
65 | CommandWriterBase(uint32_t initialMaxSize) : V2_1::CommandWriterBase(initialMaxSize) {} | 65 | CommandWriterBase(uint32_t initialMaxSize) : V2_1::CommandWriterBase(initialMaxSize) {} |
66 | 66 | ||
67 | void setClientTarget(uint32_t slot, const native_handle_t* target, int acquireFence, | ||
68 | Dataspace dataspace, const std::vector<IComposerClient::Rect>& damage) { | ||
69 | setClientTargetInternal(slot, target, acquireFence, static_cast<int32_t>(dataspace), | ||
70 | damage); | ||
71 | } | ||
72 | |||
73 | void setLayerDataspace(Dataspace dataspace) { | ||
74 | setLayerDataspaceInternal(static_cast<int32_t>(dataspace)); | ||
75 | } | ||
76 | |||
67 | static constexpr uint16_t kSetLayerFloatColorLength = 4; | 77 | static constexpr uint16_t kSetLayerFloatColorLength = 4; |
68 | void setLayerFloatColor(IComposerClient::FloatColor color) { | 78 | void setLayerFloatColor(IComposerClient::FloatColor color) { |
69 | beginCommand_2_2(IComposerClient::Command::SET_LAYER_FLOAT_COLOR, | 79 | beginCommand_2_2(IComposerClient::Command::SET_LAYER_FLOAT_COLOR, |
@@ -72,8 +82,9 @@ class CommandWriterBase : public V2_1::CommandWriterBase { | |||
72 | endCommand(); | 82 | endCommand(); |
73 | } | 83 | } |
74 | 84 | ||
75 | void setPerFrameMetadata(const hidl_vec<IComposerClient::PerFrameMetadata>& metadataVec) { | 85 | void setLayerPerFrameMetadata(const hidl_vec<IComposerClient::PerFrameMetadata>& metadataVec) { |
76 | beginCommand_2_2(IComposerClient::Command::SET_PER_FRAME_METADATA, metadataVec.size() * 2); | 86 | beginCommand_2_2(IComposerClient::Command::SET_LAYER_PER_FRAME_METADATA, |
87 | metadataVec.size() * 2); | ||
77 | for (const auto& metadata : metadataVec) { | 88 | for (const auto& metadata : metadataVec) { |
78 | writeSigned(static_cast<int32_t>(metadata.key)); | 89 | writeSigned(static_cast<int32_t>(metadata.key)); |
79 | writeFloat(metadata.value); | 90 | writeFloat(metadata.value); |
diff --git a/graphics/composer/2.2/utils/hal/include/composer-hal/2.2/ComposerClient.h b/graphics/composer/2.2/utils/hal/include/composer-hal/2.2/ComposerClient.h index d550f834..a6871fb4 100644 --- a/graphics/composer/2.2/utils/hal/include/composer-hal/2.2/ComposerClient.h +++ b/graphics/composer/2.2/utils/hal/include/composer-hal/2.2/ComposerClient.h | |||
@@ -99,10 +99,87 @@ class ComposerClientImpl : public V2_1::hal::detail::ComposerClientImpl<Interfac | |||
99 | return mHal->setReadbackBuffer(display, readbackBuffer, std::move(fenceFd)); | 99 | return mHal->setReadbackBuffer(display, readbackBuffer, std::move(fenceFd)); |
100 | } | 100 | } |
101 | 101 | ||
102 | Return<void> createVirtualDisplay_2_2( | ||
103 | uint32_t width, uint32_t height, PixelFormat formatHint, uint32_t outputBufferSlotCount, | ||
104 | IComposerClient::createVirtualDisplay_2_2_cb hidl_cb) override { | ||
105 | Display display = 0; | ||
106 | Error err = mHal->createVirtualDisplay_2_2(width, height, &formatHint, &display); | ||
107 | if (err == Error::NONE) { | ||
108 | mResources->addVirtualDisplay(display, outputBufferSlotCount); | ||
109 | } | ||
110 | |||
111 | hidl_cb(err, display, formatHint); | ||
112 | return Void(); | ||
113 | } | ||
114 | |||
115 | Return<Error> getClientTargetSupport_2_2(Display display, uint32_t width, uint32_t height, | ||
116 | PixelFormat format, Dataspace dataspace) override { | ||
117 | Error err = mHal->getClientTargetSupport_2_2(display, width, height, format, dataspace); | ||
118 | return err; | ||
119 | } | ||
120 | |||
102 | Return<Error> setPowerMode_2_2(Display display, IComposerClient::PowerMode mode) override { | 121 | Return<Error> setPowerMode_2_2(Display display, IComposerClient::PowerMode mode) override { |
103 | return mHal->setPowerMode_2_2(display, mode); | 122 | return mHal->setPowerMode_2_2(display, mode); |
104 | } | 123 | } |
105 | 124 | ||
125 | Return<void> getColorModes_2_2(Display display, | ||
126 | IComposerClient::getColorModes_2_2_cb hidl_cb) override { | ||
127 | hidl_vec<ColorMode> modes; | ||
128 | Error err = mHal->getColorModes_2_2(display, &modes); | ||
129 | hidl_cb(err, modes); | ||
130 | return Void(); | ||
131 | } | ||
132 | |||
133 | Return<void> getRenderIntents(Display display, ColorMode mode, | ||
134 | IComposerClient::getRenderIntents_cb hidl_cb) override { | ||
135 | #ifdef USES_DISPLAY_RENDER_INTENTS | ||
136 | std::vector<RenderIntent> intents; | ||
137 | Error err = mHal->getRenderIntents(display, mode, &intents); | ||
138 | hidl_cb(err, intents); | ||
139 | #else | ||
140 | (void)display; | ||
141 | (void)mode; | ||
142 | hidl_cb(Error::NONE, hidl_vec<RenderIntent>({RenderIntent::COLORIMETRIC})); | ||
143 | #endif | ||
144 | return Void(); | ||
145 | } | ||
146 | |||
147 | Return<Error> setColorMode_2_2(Display display, ColorMode mode, RenderIntent intent) override { | ||
148 | #ifndef USES_DISPLAY_RENDER_INTENTS | ||
149 | if (intent != RenderIntent::COLORIMETRIC) { | ||
150 | return Error::BAD_PARAMETER; | ||
151 | } | ||
152 | #endif | ||
153 | return mHal->setColorMode_2_2(display, mode, intent); | ||
154 | } | ||
155 | |||
156 | Return<void> getDataspaceSaturationMatrix( | ||
157 | Dataspace dataspace, IComposerClient::getDataspaceSaturationMatrix_cb hidl_cb) override { | ||
158 | if (dataspace != Dataspace::SRGB_LINEAR) { | ||
159 | hidl_cb(Error::BAD_PARAMETER, std::array<float, 16>{0.0f}.data()); | ||
160 | return Void(); | ||
161 | } | ||
162 | |||
163 | hidl_cb(Error::NONE, mHal->getDataspaceSaturationMatrix(dataspace).data()); | ||
164 | return Void(); | ||
165 | } | ||
166 | |||
167 | Return<void> executeCommands_2_2(uint32_t inLength, const hidl_vec<hidl_handle>& inHandles, | ||
168 | IComposerClient::executeCommands_2_2_cb hidl_cb) override { | ||
169 | std::lock_guard<std::mutex> lock(mCommandEngineMutex); | ||
170 | bool outChanged = false; | ||
171 | uint32_t outLength = 0; | ||
172 | hidl_vec<hidl_handle> outHandles; | ||
173 | Error error = | ||
174 | mCommandEngine->execute(inLength, inHandles, &outChanged, &outLength, &outHandles); | ||
175 | |||
176 | hidl_cb(error, outChanged, outLength, outHandles); | ||
177 | |||
178 | mCommandEngine->reset(); | ||
179 | |||
180 | return Void(); | ||
181 | } | ||
182 | |||
106 | protected: | 183 | protected: |
107 | std::unique_ptr<V2_1::hal::ComposerResources> createResources() override { | 184 | std::unique_ptr<V2_1::hal::ComposerResources> createResources() override { |
108 | return ComposerResources::create(); | 185 | return ComposerResources::create(); |
@@ -146,6 +223,8 @@ class ComposerClientImpl : public V2_1::hal::detail::ComposerClientImpl<Interfac | |||
146 | 223 | ||
147 | private: | 224 | private: |
148 | using BaseType2_1 = V2_1::hal::detail::ComposerClientImpl<Interface, Hal>; | 225 | using BaseType2_1 = V2_1::hal::detail::ComposerClientImpl<Interface, Hal>; |
226 | using BaseType2_1::mCommandEngine; | ||
227 | using BaseType2_1::mCommandEngineMutex; | ||
149 | using BaseType2_1::mHal; | 228 | using BaseType2_1::mHal; |
150 | using BaseType2_1::mResources; | 229 | using BaseType2_1::mResources; |
151 | }; | 230 | }; |
diff --git a/graphics/composer/2.2/utils/hal/include/composer-hal/2.2/ComposerCommandEngine.h b/graphics/composer/2.2/utils/hal/include/composer-hal/2.2/ComposerCommandEngine.h index adcac463..97e3a9ec 100644 --- a/graphics/composer/2.2/utils/hal/include/composer-hal/2.2/ComposerCommandEngine.h +++ b/graphics/composer/2.2/utils/hal/include/composer-hal/2.2/ComposerCommandEngine.h | |||
@@ -40,8 +40,8 @@ class ComposerCommandEngine : public V2_1::hal::ComposerCommandEngine { | |||
40 | protected: | 40 | protected: |
41 | bool executeCommand(V2_1::IComposerClient::Command command, uint16_t length) override { | 41 | bool executeCommand(V2_1::IComposerClient::Command command, uint16_t length) override { |
42 | switch (static_cast<IComposerClient::Command>(command)) { | 42 | switch (static_cast<IComposerClient::Command>(command)) { |
43 | case IComposerClient::Command::SET_PER_FRAME_METADATA: | 43 | case IComposerClient::Command::SET_LAYER_PER_FRAME_METADATA: |
44 | return executeSetPerFrameMetadata(length); | 44 | return executeSetLayerPerFrameMetadata(length); |
45 | case IComposerClient::Command::SET_LAYER_FLOAT_COLOR: | 45 | case IComposerClient::Command::SET_LAYER_FLOAT_COLOR: |
46 | return executeSetLayerFloatColor(length); | 46 | return executeSetLayerFloatColor(length); |
47 | default: | 47 | default: |
@@ -49,7 +49,7 @@ class ComposerCommandEngine : public V2_1::hal::ComposerCommandEngine { | |||
49 | } | 49 | } |
50 | } | 50 | } |
51 | 51 | ||
52 | bool executeSetPerFrameMetadata(uint16_t length) { | 52 | bool executeSetLayerPerFrameMetadata(uint16_t length) { |
53 | // (key, value) pairs | 53 | // (key, value) pairs |
54 | if (length % 2 != 0) { | 54 | if (length % 2 != 0) { |
55 | return false; | 55 | return false; |
@@ -63,7 +63,7 @@ class ComposerCommandEngine : public V2_1::hal::ComposerCommandEngine { | |||
63 | length -= 2; | 63 | length -= 2; |
64 | } | 64 | } |
65 | 65 | ||
66 | auto err = mHal->setPerFrameMetadata(mCurrentDisplay, metadata); | 66 | auto err = mHal->setLayerPerFrameMetadata(mCurrentDisplay, mCurrentLayer, metadata); |
67 | if (err != Error::NONE) { | 67 | if (err != Error::NONE) { |
68 | mWriter.setError(getCommandLoc(), err); | 68 | mWriter.setError(getCommandLoc(), err); |
69 | } | 69 | } |
diff --git a/graphics/composer/2.2/utils/hal/include/composer-hal/2.2/ComposerHal.h b/graphics/composer/2.2/utils/hal/include/composer-hal/2.2/ComposerHal.h index 30b36439..335dc240 100644 --- a/graphics/composer/2.2/utils/hal/include/composer-hal/2.2/ComposerHal.h +++ b/graphics/composer/2.2/utils/hal/include/composer-hal/2.2/ComposerHal.h | |||
@@ -28,34 +28,68 @@ namespace composer { | |||
28 | namespace V2_2 { | 28 | namespace V2_2 { |
29 | namespace hal { | 29 | namespace hal { |
30 | 30 | ||
31 | using common::V1_0::Dataspace; | 31 | using common::V1_1::ColorMode; |
32 | using common::V1_0::PixelFormat; | 32 | using common::V1_1::Dataspace; |
33 | using common::V1_1::PixelFormat; | ||
34 | using common::V1_1::RenderIntent; | ||
33 | using V2_1::Display; | 35 | using V2_1::Display; |
34 | using V2_1::Error; | 36 | using V2_1::Error; |
35 | using V2_1::Layer; | 37 | using V2_1::Layer; |
36 | 38 | ||
37 | class ComposerHal : public V2_1::hal::ComposerHal { | 39 | class ComposerHal : public V2_1::hal::ComposerHal { |
38 | public: | 40 | public: |
41 | Error createVirtualDisplay(uint32_t width, uint32_t height, common::V1_0::PixelFormat* format, | ||
42 | Display* outDisplay) override { | ||
43 | return createVirtualDisplay_2_2(width, height, reinterpret_cast<PixelFormat*>(format), | ||
44 | outDisplay); | ||
45 | } | ||
46 | Error getClientTargetSupport(Display display, uint32_t width, uint32_t height, | ||
47 | common::V1_0::PixelFormat format, | ||
48 | common::V1_0::Dataspace dataspace) override { | ||
49 | return getClientTargetSupport_2_2(display, width, height, static_cast<PixelFormat>(format), | ||
50 | static_cast<Dataspace>(dataspace)); | ||
51 | } | ||
39 | // superceded by setPowerMode_2_2 | 52 | // superceded by setPowerMode_2_2 |
40 | Error setPowerMode(Display display, V2_1::IComposerClient::PowerMode mode) override { | 53 | Error setPowerMode(Display display, V2_1::IComposerClient::PowerMode mode) override { |
41 | return setPowerMode_2_2(display, static_cast<IComposerClient::PowerMode>(mode)); | 54 | return setPowerMode_2_2(display, static_cast<IComposerClient::PowerMode>(mode)); |
42 | } | 55 | } |
43 | 56 | ||
57 | // superceded by getColorModes_2_2 | ||
58 | Error getColorModes(Display display, hidl_vec<common::V1_0::ColorMode>* outModes) override { | ||
59 | return getColorModes_2_2(display, reinterpret_cast<hidl_vec<ColorMode>*>(outModes)); | ||
60 | } | ||
61 | |||
62 | // superceded by setColorMode_2_2 | ||
63 | Error setColorMode(Display display, common::V1_0::ColorMode mode) override { | ||
64 | return setColorMode_2_2(display, static_cast<ColorMode>(mode), RenderIntent::COLORIMETRIC); | ||
65 | } | ||
66 | |||
44 | virtual Error getPerFrameMetadataKeys( | 67 | virtual Error getPerFrameMetadataKeys( |
45 | Display display, std::vector<IComposerClient::PerFrameMetadataKey>* outKeys) = 0; | 68 | Display display, std::vector<IComposerClient::PerFrameMetadataKey>* outKeys) = 0; |
46 | virtual Error setPerFrameMetadata( | 69 | virtual Error setLayerPerFrameMetadata( |
47 | Display display, const std::vector<IComposerClient::PerFrameMetadata>& metadata) = 0; | 70 | Display display, Layer layer, |
71 | const std::vector<IComposerClient::PerFrameMetadata>& metadata) = 0; | ||
48 | 72 | ||
49 | virtual Error getReadbackBufferAttributes(Display display, PixelFormat* outFormat, | 73 | virtual Error getReadbackBufferAttributes(Display display, PixelFormat* outFormat, |
50 | Dataspace* outDataspace) = 0; | 74 | Dataspace* outDataspace) = 0; |
51 | virtual Error setReadbackBuffer(Display display, const native_handle_t* bufferHandle, | 75 | virtual Error setReadbackBuffer(Display display, const native_handle_t* bufferHandle, |
52 | base::unique_fd fenceFd) = 0; | 76 | base::unique_fd fenceFd) = 0; |
53 | virtual Error getReadbackBufferFence(Display display, base::unique_fd* outFenceFd) = 0; | 77 | virtual Error getReadbackBufferFence(Display display, base::unique_fd* outFenceFd) = 0; |
54 | 78 | virtual Error createVirtualDisplay_2_2(uint32_t width, uint32_t height, PixelFormat* format, | |
79 | Display* outDisplay) = 0; | ||
80 | virtual Error getClientTargetSupport_2_2(Display display, uint32_t width, uint32_t height, | ||
81 | PixelFormat format, Dataspace dataspace) = 0; | ||
55 | virtual Error setPowerMode_2_2(Display display, IComposerClient::PowerMode mode) = 0; | 82 | virtual Error setPowerMode_2_2(Display display, IComposerClient::PowerMode mode) = 0; |
56 | 83 | ||
57 | virtual Error setLayerFloatColor(Display display, Layer layer, | 84 | virtual Error setLayerFloatColor(Display display, Layer layer, |
58 | IComposerClient::FloatColor color) = 0; | 85 | IComposerClient::FloatColor color) = 0; |
86 | |||
87 | virtual Error getColorModes_2_2(Display display, hidl_vec<ColorMode>* outModes) = 0; | ||
88 | virtual Error getRenderIntents(Display display, ColorMode mode, | ||
89 | std::vector<RenderIntent>* outIntents) = 0; | ||
90 | virtual Error setColorMode_2_2(Display display, ColorMode mode, RenderIntent intent) = 0; | ||
91 | |||
92 | virtual std::array<float, 16> getDataspaceSaturationMatrix(Dataspace dataspace) = 0; | ||
59 | }; | 93 | }; |
60 | 94 | ||
61 | } // namespace hal | 95 | } // namespace hal |
diff --git a/graphics/composer/2.2/utils/passthrough/include/composer-passthrough/2.2/HwcHal.h b/graphics/composer/2.2/utils/passthrough/include/composer-passthrough/2.2/HwcHal.h index b251351f..93da0a5d 100644 --- a/graphics/composer/2.2/utils/passthrough/include/composer-passthrough/2.2/HwcHal.h +++ b/graphics/composer/2.2/utils/passthrough/include/composer-passthrough/2.2/HwcHal.h | |||
@@ -34,8 +34,10 @@ namespace passthrough { | |||
34 | 34 | ||
35 | namespace detail { | 35 | namespace detail { |
36 | 36 | ||
37 | using common::V1_0::Dataspace; | 37 | using common::V1_1::ColorMode; |
38 | using common::V1_0::PixelFormat; | 38 | using common::V1_1::Dataspace; |
39 | using common::V1_1::PixelFormat; | ||
40 | using common::V1_1::RenderIntent; | ||
39 | using V2_1::Display; | 41 | using V2_1::Display; |
40 | using V2_1::Error; | 42 | using V2_1::Error; |
41 | using V2_1::Layer; | 43 | using V2_1::Layer; |
@@ -72,9 +74,10 @@ class HwcHalImpl : public V2_1::passthrough::detail::HwcHalImpl<Hal> { | |||
72 | return Error::NONE; | 74 | return Error::NONE; |
73 | } | 75 | } |
74 | 76 | ||
75 | Error setPerFrameMetadata( | 77 | Error setLayerPerFrameMetadata( |
76 | Display display, const std::vector<IComposerClient::PerFrameMetadata>& metadata) override { | 78 | Display display, Layer layer, |
77 | if (!mDispatch.setPerFrameMetadata) { | 79 | const std::vector<IComposerClient::PerFrameMetadata>& metadata) override { |
80 | if (!mDispatch.setLayerPerFrameMetadata) { | ||
78 | return Error::UNSUPPORTED; | 81 | return Error::UNSUPPORTED; |
79 | } | 82 | } |
80 | 83 | ||
@@ -87,8 +90,8 @@ class HwcHalImpl : public V2_1::passthrough::detail::HwcHalImpl<Hal> { | |||
87 | values.push_back(m.value); | 90 | values.push_back(m.value); |
88 | } | 91 | } |
89 | 92 | ||
90 | int32_t error = mDispatch.setPerFrameMetadata(mDevice, display, metadata.size(), | 93 | int32_t error = mDispatch.setLayerPerFrameMetadata(mDevice, display, layer, metadata.size(), |
91 | keys.data(), values.data()); | 94 | keys.data(), values.data()); |
92 | return static_cast<Error>(error); | 95 | return static_cast<Error>(error); |
93 | } | 96 | } |
94 | 97 | ||
@@ -131,6 +134,19 @@ class HwcHalImpl : public V2_1::passthrough::detail::HwcHalImpl<Hal> { | |||
131 | return static_cast<Error>(error); | 134 | return static_cast<Error>(error); |
132 | } | 135 | } |
133 | 136 | ||
137 | Error createVirtualDisplay_2_2(uint32_t width, uint32_t height, PixelFormat* format, | ||
138 | Display* outDisplay) override { | ||
139 | return createVirtualDisplay( | ||
140 | width, height, reinterpret_cast<common::V1_0::PixelFormat*>(format), outDisplay); | ||
141 | } | ||
142 | |||
143 | Error getClientTargetSupport_2_2(Display display, uint32_t width, uint32_t height, | ||
144 | PixelFormat format, Dataspace dataspace) override { | ||
145 | return getClientTargetSupport(display, width, height, | ||
146 | static_cast<common::V1_0::PixelFormat>(format), | ||
147 | static_cast<common::V1_0::Dataspace>(dataspace)); | ||
148 | } | ||
149 | |||
134 | Error setPowerMode_2_2(Display display, IComposerClient::PowerMode mode) override { | 150 | Error setPowerMode_2_2(Display display, IComposerClient::PowerMode mode) override { |
135 | if (mode == IComposerClient::PowerMode::ON_SUSPEND) { | 151 | if (mode == IComposerClient::PowerMode::ON_SUSPEND) { |
136 | return Error::UNSUPPORTED; | 152 | return Error::UNSUPPORTED; |
@@ -149,6 +165,69 @@ class HwcHalImpl : public V2_1::passthrough::detail::HwcHalImpl<Hal> { | |||
149 | return static_cast<Error>(error); | 165 | return static_cast<Error>(error); |
150 | } | 166 | } |
151 | 167 | ||
168 | Error getColorModes_2_2(Display display, hidl_vec<ColorMode>* outModes) override { | ||
169 | return getColorModes(display, | ||
170 | reinterpret_cast<hidl_vec<common::V1_0::ColorMode>*>(outModes)); | ||
171 | } | ||
172 | |||
173 | Error getRenderIntents(Display display, ColorMode mode, | ||
174 | std::vector<RenderIntent>* outIntents) override { | ||
175 | if (!mDispatch.getRenderIntents) { | ||
176 | *outIntents = std::vector<RenderIntent>({RenderIntent::COLORIMETRIC}); | ||
177 | return Error::NONE; | ||
178 | } | ||
179 | |||
180 | uint32_t count = 0; | ||
181 | int32_t error = | ||
182 | mDispatch.getRenderIntents(mDevice, display, int32_t(mode), &count, nullptr); | ||
183 | if (error != HWC2_ERROR_NONE) { | ||
184 | return static_cast<Error>(error); | ||
185 | } | ||
186 | |||
187 | std::vector<RenderIntent> intents(count); | ||
188 | error = mDispatch.getRenderIntents( | ||
189 | mDevice, display, int32_t(mode), &count, | ||
190 | reinterpret_cast<std::underlying_type<RenderIntent>::type*>(intents.data())); | ||
191 | if (error != HWC2_ERROR_NONE) { | ||
192 | return static_cast<Error>(error); | ||
193 | } | ||
194 | intents.resize(count); | ||
195 | |||
196 | *outIntents = std::move(intents); | ||
197 | return Error::NONE; | ||
198 | } | ||
199 | |||
200 | Error setColorMode_2_2(Display display, ColorMode mode, RenderIntent intent) override { | ||
201 | if (!mDispatch.setColorModeWithRenderIntent) { | ||
202 | if (intent != RenderIntent::COLORIMETRIC) { | ||
203 | return Error::UNSUPPORTED; | ||
204 | } | ||
205 | return setColorMode(display, static_cast<common::V1_0::ColorMode>(mode)); | ||
206 | } | ||
207 | |||
208 | int32_t err = mDispatch.setColorModeWithRenderIntent( | ||
209 | mDevice, display, static_cast<int32_t>(mode), static_cast<int32_t>(intent)); | ||
210 | return static_cast<Error>(err); | ||
211 | } | ||
212 | |||
213 | std::array<float, 16> getDataspaceSaturationMatrix(Dataspace dataspace) override { | ||
214 | std::array<float, 16> matrix; | ||
215 | |||
216 | int32_t error = HWC2_ERROR_UNSUPPORTED; | ||
217 | if (mDispatch.getDataspaceSaturationMatrix) { | ||
218 | error = mDispatch.getDataspaceSaturationMatrix(mDevice, static_cast<int32_t>(dataspace), | ||
219 | matrix.data()); | ||
220 | } | ||
221 | if (error != HWC2_ERROR_NONE) { | ||
222 | return std::array<float, 16>{ | ||
223 | 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, | ||
224 | 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, | ||
225 | }; | ||
226 | } | ||
227 | |||
228 | return matrix; | ||
229 | } | ||
230 | |||
152 | protected: | 231 | protected: |
153 | template <typename T> | 232 | template <typename T> |
154 | bool initOptionalDispatch(hwc2_function_descriptor_t desc, T* outPfn) { | 233 | bool initOptionalDispatch(hwc2_function_descriptor_t desc, T* outPfn) { |
@@ -168,7 +247,8 @@ class HwcHalImpl : public V2_1::passthrough::detail::HwcHalImpl<Hal> { | |||
168 | 247 | ||
169 | initOptionalDispatch(HWC2_FUNCTION_SET_LAYER_FLOAT_COLOR, &mDispatch.setLayerFloatColor); | 248 | initOptionalDispatch(HWC2_FUNCTION_SET_LAYER_FLOAT_COLOR, &mDispatch.setLayerFloatColor); |
170 | 249 | ||
171 | initOptionalDispatch(HWC2_FUNCTION_SET_PER_FRAME_METADATA, &mDispatch.setPerFrameMetadata); | 250 | initOptionalDispatch(HWC2_FUNCTION_SET_LAYER_PER_FRAME_METADATA, |
251 | &mDispatch.setLayerPerFrameMetadata); | ||
172 | initOptionalDispatch(HWC2_FUNCTION_GET_PER_FRAME_METADATA_KEYS, | 252 | initOptionalDispatch(HWC2_FUNCTION_GET_PER_FRAME_METADATA_KEYS, |
173 | &mDispatch.getPerFrameMetadataKeys); | 253 | &mDispatch.getPerFrameMetadataKeys); |
174 | 254 | ||
@@ -178,21 +258,34 @@ class HwcHalImpl : public V2_1::passthrough::detail::HwcHalImpl<Hal> { | |||
178 | initOptionalDispatch(HWC2_FUNCTION_GET_READBACK_BUFFER_FENCE, | 258 | initOptionalDispatch(HWC2_FUNCTION_GET_READBACK_BUFFER_FENCE, |
179 | &mDispatch.getReadbackBufferFence); | 259 | &mDispatch.getReadbackBufferFence); |
180 | 260 | ||
261 | initOptionalDispatch(HWC2_FUNCTION_GET_RENDER_INTENTS, &mDispatch.getRenderIntents); | ||
262 | initOptionalDispatch(HWC2_FUNCTION_SET_COLOR_MODE_WITH_RENDER_INTENT, | ||
263 | &mDispatch.setColorModeWithRenderIntent); | ||
264 | initOptionalDispatch(HWC2_FUNCTION_GET_DATASPACE_SATURATION_MATRIX, | ||
265 | &mDispatch.getDataspaceSaturationMatrix); | ||
266 | |||
181 | return true; | 267 | return true; |
182 | } | 268 | } |
183 | 269 | ||
184 | struct { | 270 | struct { |
185 | HWC2_PFN_SET_LAYER_FLOAT_COLOR setLayerFloatColor; | 271 | HWC2_PFN_SET_LAYER_FLOAT_COLOR setLayerFloatColor; |
186 | HWC2_PFN_SET_PER_FRAME_METADATA setPerFrameMetadata; | 272 | HWC2_PFN_SET_LAYER_PER_FRAME_METADATA setLayerPerFrameMetadata; |
187 | HWC2_PFN_GET_PER_FRAME_METADATA_KEYS getPerFrameMetadataKeys; | 273 | HWC2_PFN_GET_PER_FRAME_METADATA_KEYS getPerFrameMetadataKeys; |
188 | HWC2_PFN_SET_READBACK_BUFFER setReadbackBuffer; | 274 | HWC2_PFN_SET_READBACK_BUFFER setReadbackBuffer; |
189 | HWC2_PFN_GET_READBACK_BUFFER_ATTRIBUTES getReadbackBufferAttributes; | 275 | HWC2_PFN_GET_READBACK_BUFFER_ATTRIBUTES getReadbackBufferAttributes; |
190 | HWC2_PFN_GET_READBACK_BUFFER_FENCE getReadbackBufferFence; | 276 | HWC2_PFN_GET_READBACK_BUFFER_FENCE getReadbackBufferFence; |
277 | HWC2_PFN_GET_RENDER_INTENTS getRenderIntents; | ||
278 | HWC2_PFN_SET_COLOR_MODE_WITH_RENDER_INTENT setColorModeWithRenderIntent; | ||
279 | HWC2_PFN_GET_DATASPACE_SATURATION_MATRIX getDataspaceSaturationMatrix; | ||
191 | } mDispatch = {}; | 280 | } mDispatch = {}; |
192 | 281 | ||
193 | private: | 282 | private: |
194 | using BaseType2_1 = V2_1::passthrough::detail::HwcHalImpl<Hal>; | 283 | using BaseType2_1 = V2_1::passthrough::detail::HwcHalImpl<Hal>; |
284 | using BaseType2_1::getColorModes; | ||
195 | using BaseType2_1::mDevice; | 285 | using BaseType2_1::mDevice; |
286 | using BaseType2_1::setColorMode; | ||
287 | using BaseType2_1::createVirtualDisplay; | ||
288 | using BaseType2_1::getClientTargetSupport; | ||
196 | using BaseType2_1::setPowerMode; | 289 | using BaseType2_1::setPowerMode; |
197 | }; | 290 | }; |
198 | 291 | ||
diff --git a/graphics/composer/2.2/utils/vts/Android.bp b/graphics/composer/2.2/utils/vts/Android.bp index 641fdcb7..c6b524d2 100644 --- a/graphics/composer/2.2/utils/vts/Android.bp +++ b/graphics/composer/2.2/utils/vts/Android.bp | |||
@@ -26,10 +26,17 @@ cc_library_static { | |||
26 | "android.hardware.graphics.composer@2.1-vts", | 26 | "android.hardware.graphics.composer@2.1-vts", |
27 | "android.hardware.graphics.composer@2.2", | 27 | "android.hardware.graphics.composer@2.2", |
28 | ], | 28 | ], |
29 | export_static_lib_headers: [ | ||
30 | "android.hardware.graphics.composer@2.1-vts", | ||
31 | ], | ||
29 | header_libs: [ | 32 | header_libs: [ |
30 | "android.hardware.graphics.composer@2.1-command-buffer", | 33 | "android.hardware.graphics.composer@2.1-command-buffer", |
31 | "android.hardware.graphics.composer@2.2-command-buffer", | 34 | "android.hardware.graphics.composer@2.2-command-buffer", |
32 | ], | 35 | ], |
36 | export_header_lib_headers: [ | ||
37 | "android.hardware.graphics.composer@2.1-command-buffer", | ||
38 | "android.hardware.graphics.composer@2.2-command-buffer", | ||
39 | ], | ||
33 | cflags: [ | 40 | cflags: [ |
34 | "-O0", | 41 | "-O0", |
35 | "-g", | 42 | "-g", |
diff --git a/graphics/composer/2.2/utils/vts/ComposerVts.cpp b/graphics/composer/2.2/utils/vts/ComposerVts.cpp index b536f671..357c7725 100644 --- a/graphics/composer/2.2/utils/vts/ComposerVts.cpp +++ b/graphics/composer/2.2/utils/vts/ComposerVts.cpp | |||
@@ -87,6 +87,33 @@ void ComposerClient_v2_2::execute_v2_2(V2_1::vts::TestCommandReader* reader, | |||
87 | }); | 87 | }); |
88 | } | 88 | } |
89 | 89 | ||
90 | Display ComposerClient_v2_2::createVirtualDisplay_2_2(uint32_t width, uint32_t height, | ||
91 | PixelFormat formatHint, | ||
92 | uint32_t outputBufferSlotCount, | ||
93 | PixelFormat* outFormat) { | ||
94 | Display display = 0; | ||
95 | mClient_v2_2->createVirtualDisplay_2_2( | ||
96 | width, height, formatHint, outputBufferSlotCount, | ||
97 | [&](const auto& tmpError, const auto& tmpDisplay, const auto& tmpFormat) { | ||
98 | ASSERT_EQ(Error::NONE, tmpError) << "failed to create virtual display"; | ||
99 | display = tmpDisplay; | ||
100 | *outFormat = tmpFormat; | ||
101 | |||
102 | ASSERT_TRUE(mDisplayResources.insert({display, DisplayResource(true)}).second) | ||
103 | << "duplicated virtual display id " << display; | ||
104 | }); | ||
105 | |||
106 | return display; | ||
107 | } | ||
108 | |||
109 | bool ComposerClient_v2_2::getClientTargetSupport_2_2(Display display, uint32_t width, | ||
110 | uint32_t height, PixelFormat format, | ||
111 | Dataspace dataspace) { | ||
112 | Error error = | ||
113 | mClient_v2_2->getClientTargetSupport_2_2(display, width, height, format, dataspace); | ||
114 | return error == Error::NONE; | ||
115 | } | ||
116 | |||
90 | void ComposerClient_v2_2::setPowerMode_2_2(Display display, V2_2::IComposerClient::PowerMode mode) { | 117 | void ComposerClient_v2_2::setPowerMode_2_2(Display display, V2_2::IComposerClient::PowerMode mode) { |
91 | Error error = mClient_v2_2->setPowerMode_2_2(display, mode); | 118 | Error error = mClient_v2_2->setPowerMode_2_2(display, mode); |
92 | ASSERT_TRUE(error == Error::NONE || error == Error::UNSUPPORTED) << "failed to set power mode"; | 119 | ASSERT_TRUE(error == Error::NONE || error == Error::UNSUPPORTED) << "failed to set power mode"; |
@@ -119,6 +146,41 @@ void ComposerClient_v2_2::getReadbackBufferFence(Display display, int32_t* outFe | |||
119 | *outFence = 0; | 146 | *outFence = 0; |
120 | } | 147 | } |
121 | 148 | ||
149 | std::vector<ColorMode> ComposerClient_v2_2::getColorModes(Display display) { | ||
150 | std::vector<ColorMode> modes; | ||
151 | mClient_v2_2->getColorModes_2_2(display, [&](const auto& tmpError, const auto& tmpModes) { | ||
152 | ASSERT_EQ(Error::NONE, tmpError) << "failed to get color modes"; | ||
153 | modes = tmpModes; | ||
154 | }); | ||
155 | return modes; | ||
156 | } | ||
157 | |||
158 | std::vector<RenderIntent> ComposerClient_v2_2::getRenderIntents(Display display, ColorMode mode) { | ||
159 | std::vector<RenderIntent> intents; | ||
160 | mClient_v2_2->getRenderIntents( | ||
161 | display, mode, [&](const auto& tmpError, const auto& tmpIntents) { | ||
162 | ASSERT_EQ(Error::NONE, tmpError) << "failed to get render intents"; | ||
163 | intents = tmpIntents; | ||
164 | }); | ||
165 | return intents; | ||
166 | } | ||
167 | |||
168 | void ComposerClient_v2_2::setColorMode(Display display, ColorMode mode, RenderIntent intent) { | ||
169 | Error error = mClient_v2_2->setColorMode_2_2(display, mode, intent); | ||
170 | ASSERT_TRUE(error == Error::NONE || error == Error::UNSUPPORTED) << "failed to set color mode"; | ||
171 | } | ||
172 | |||
173 | std::array<float, 16> ComposerClient_v2_2::getDataspaceSaturationMatrix(Dataspace dataspace) { | ||
174 | std::array<float, 16> matrix; | ||
175 | mClient_v2_2->getDataspaceSaturationMatrix( | ||
176 | dataspace, [&](const auto& tmpError, const auto& tmpMatrix) { | ||
177 | ASSERT_EQ(Error::NONE, tmpError) << "failed to get datasapce saturation matrix"; | ||
178 | std::copy_n(tmpMatrix.data(), matrix.size(), matrix.begin()); | ||
179 | }); | ||
180 | |||
181 | return matrix; | ||
182 | } | ||
183 | |||
122 | } // namespace vts | 184 | } // namespace vts |
123 | } // namespace V2_2 | 185 | } // namespace V2_2 |
124 | } // namespace composer | 186 | } // namespace composer |
diff --git a/graphics/composer/2.2/utils/vts/include/composer-vts/2.2/ComposerVts.h b/graphics/composer/2.2/utils/vts/include/composer-vts/2.2/ComposerVts.h index eced69f2..62ab83f3 100644 --- a/graphics/composer/2.2/utils/vts/include/composer-vts/2.2/ComposerVts.h +++ b/graphics/composer/2.2/utils/vts/include/composer-vts/2.2/ComposerVts.h | |||
@@ -36,10 +36,11 @@ namespace composer { | |||
36 | namespace V2_2 { | 36 | namespace V2_2 { |
37 | namespace vts { | 37 | namespace vts { |
38 | 38 | ||
39 | using android::hardware::graphics::common::V1_0::ColorMode; | ||
40 | using android::hardware::graphics::common::V1_0::Dataspace; | ||
41 | using android::hardware::graphics::common::V1_0::Hdr; | 39 | using android::hardware::graphics::common::V1_0::Hdr; |
42 | using android::hardware::graphics::common::V1_0::PixelFormat; | 40 | using android::hardware::graphics::common::V1_1::ColorMode; |
41 | using android::hardware::graphics::common::V1_1::Dataspace; | ||
42 | using android::hardware::graphics::common::V1_1::PixelFormat; | ||
43 | using android::hardware::graphics::common::V1_1::RenderIntent; | ||
43 | using android::hardware::graphics::composer::V2_2::IComposer; | 44 | using android::hardware::graphics::composer::V2_2::IComposer; |
44 | using android::hardware::graphics::composer::V2_2::IComposerClient; | 45 | using android::hardware::graphics::composer::V2_2::IComposerClient; |
45 | 46 | ||
@@ -66,12 +67,22 @@ class ComposerClient_v2_2 | |||
66 | 67 | ||
67 | std::vector<IComposerClient::PerFrameMetadataKey> getPerFrameMetadataKeys(Display display); | 68 | std::vector<IComposerClient::PerFrameMetadataKey> getPerFrameMetadataKeys(Display display); |
68 | 69 | ||
70 | Display createVirtualDisplay_2_2(uint32_t width, uint32_t height, PixelFormat formatHint, | ||
71 | uint32_t outputBufferSlotCount, PixelFormat* outFormat); | ||
72 | bool getClientTargetSupport_2_2(Display display, uint32_t width, uint32_t height, | ||
73 | PixelFormat format, Dataspace dataspace); | ||
69 | void setPowerMode_2_2(Display display, V2_2::IComposerClient::PowerMode mode); | 74 | void setPowerMode_2_2(Display display, V2_2::IComposerClient::PowerMode mode); |
70 | void setReadbackBuffer(Display display, const native_handle_t* buffer, int32_t releaseFence); | 75 | void setReadbackBuffer(Display display, const native_handle_t* buffer, int32_t releaseFence); |
71 | void getReadbackBufferAttributes(Display display, PixelFormat* outPixelFormat, | 76 | void getReadbackBufferAttributes(Display display, PixelFormat* outPixelFormat, |
72 | Dataspace* outDataspace); | 77 | Dataspace* outDataspace); |
73 | void getReadbackBufferFence(Display display, int32_t* outFence); | 78 | void getReadbackBufferFence(Display display, int32_t* outFence); |
74 | 79 | ||
80 | std::vector<ColorMode> getColorModes(Display display); | ||
81 | std::vector<RenderIntent> getRenderIntents(Display display, ColorMode mode); | ||
82 | void setColorMode(Display display, ColorMode mode, RenderIntent intent); | ||
83 | |||
84 | std::array<float, 16> getDataspaceSaturationMatrix(Dataspace dataspace); | ||
85 | |||
75 | private: | 86 | private: |
76 | sp<V2_2::IComposerClient> mClient_v2_2; | 87 | sp<V2_2::IComposerClient> mClient_v2_2; |
77 | }; | 88 | }; |
diff --git a/graphics/composer/2.2/vts/functional/Android.bp b/graphics/composer/2.2/vts/functional/Android.bp index 77479009..669fbaea 100644 --- a/graphics/composer/2.2/vts/functional/Android.bp +++ b/graphics/composer/2.2/vts/functional/Android.bp | |||
@@ -27,6 +27,7 @@ cc_test { | |||
27 | ], | 27 | ], |
28 | static_libs: [ | 28 | static_libs: [ |
29 | "android.hardware.graphics.allocator@2.0", | 29 | "android.hardware.graphics.allocator@2.0", |
30 | "android.hardware.graphics.common@1.1", | ||
30 | "android.hardware.graphics.composer@2.1", | 31 | "android.hardware.graphics.composer@2.1", |
31 | "android.hardware.graphics.composer@2.1-vts", | 32 | "android.hardware.graphics.composer@2.1-vts", |
32 | "android.hardware.graphics.composer@2.2", | 33 | "android.hardware.graphics.composer@2.2", |
@@ -34,6 +35,7 @@ cc_test { | |||
34 | "android.hardware.graphics.mapper@2.0", | 35 | "android.hardware.graphics.mapper@2.0", |
35 | "android.hardware.graphics.mapper@2.0-vts", | 36 | "android.hardware.graphics.mapper@2.0-vts", |
36 | "android.hardware.graphics.mapper@2.1", | 37 | "android.hardware.graphics.mapper@2.1", |
38 | "android.hardware.graphics.mapper@2.1-vts", | ||
37 | ], | 39 | ], |
38 | header_libs: [ | 40 | header_libs: [ |
39 | "android.hardware.graphics.composer@2.1-command-buffer", | 41 | "android.hardware.graphics.composer@2.1-command-buffer", |
diff --git a/graphics/composer/2.2/vts/functional/VtsHalGraphicsComposerV2_2TargetTest.cpp b/graphics/composer/2.2/vts/functional/VtsHalGraphicsComposerV2_2TargetTest.cpp index c4943296..4e41333e 100644 --- a/graphics/composer/2.2/vts/functional/VtsHalGraphicsComposerV2_2TargetTest.cpp +++ b/graphics/composer/2.2/vts/functional/VtsHalGraphicsComposerV2_2TargetTest.cpp | |||
@@ -22,7 +22,7 @@ | |||
22 | #include <composer-vts/2.1/GraphicsComposerCallback.h> | 22 | #include <composer-vts/2.1/GraphicsComposerCallback.h> |
23 | #include <composer-vts/2.1/TestCommandReader.h> | 23 | #include <composer-vts/2.1/TestCommandReader.h> |
24 | #include <composer-vts/2.2/ComposerVts.h> | 24 | #include <composer-vts/2.2/ComposerVts.h> |
25 | #include <mapper-vts/2.0/MapperVts.h> | 25 | #include <mapper-vts/2.1/MapperVts.h> |
26 | 26 | ||
27 | namespace android { | 27 | namespace android { |
28 | namespace hardware { | 28 | namespace hardware { |
@@ -33,14 +33,15 @@ namespace vts { | |||
33 | namespace { | 33 | namespace { |
34 | 34 | ||
35 | using android::hardware::graphics::common::V1_0::BufferUsage; | 35 | using android::hardware::graphics::common::V1_0::BufferUsage; |
36 | using android::hardware::graphics::common::V1_0::ColorMode; | ||
37 | using android::hardware::graphics::common::V1_0::ColorTransform; | 36 | using android::hardware::graphics::common::V1_0::ColorTransform; |
38 | using android::hardware::graphics::common::V1_0::Dataspace; | ||
39 | using android::hardware::graphics::common::V1_0::PixelFormat; | ||
40 | using android::hardware::graphics::common::V1_0::Transform; | 37 | using android::hardware::graphics::common::V1_0::Transform; |
38 | using android::hardware::graphics::common::V1_1::ColorMode; | ||
39 | using android::hardware::graphics::common::V1_1::Dataspace; | ||
40 | using android::hardware::graphics::common::V1_1::PixelFormat; | ||
41 | using android::hardware::graphics::common::V1_1::RenderIntent; | ||
41 | using android::hardware::graphics::composer::V2_2::IComposerClient; | 42 | using android::hardware::graphics::composer::V2_2::IComposerClient; |
42 | using android::hardware::graphics::mapper::V2_0::IMapper; | 43 | using android::hardware::graphics::mapper::V2_1::IMapper; |
43 | using android::hardware::graphics::mapper::V2_0::vts::Gralloc; | 44 | using android::hardware::graphics::mapper::V2_1::vts::Gralloc; |
44 | using GrallocError = android::hardware::graphics::mapper::V2_0::Error; | 45 | using GrallocError = android::hardware::graphics::mapper::V2_0::Error; |
45 | 46 | ||
46 | // Test environment for graphics.composer | 47 | // Test environment for graphics.composer |
@@ -146,9 +147,9 @@ class GraphicsComposerHidlCommandTest : public GraphicsComposerHidlTest { | |||
146 | }; | 147 | }; |
147 | 148 | ||
148 | /** | 149 | /** |
149 | * Test IComposerClient::Command::SET_PER_FRAME_METADATA. | 150 | * Test IComposerClient::Command::SET_LAYER_PER_FRAME_METADATA. |
150 | */ | 151 | */ |
151 | TEST_F(GraphicsComposerHidlCommandTest, SET_PER_FRAME_METADATA) { | 152 | TEST_F(GraphicsComposerHidlCommandTest, SET_LAYER_PER_FRAME_METADATA) { |
152 | Layer layer; | 153 | Layer layer; |
153 | ASSERT_NO_FATAL_FAILURE(layer = | 154 | ASSERT_NO_FATAL_FAILURE(layer = |
154 | mComposerClient->createLayer(mPrimaryDisplay, kBufferSlotCount)); | 155 | mComposerClient->createLayer(mPrimaryDisplay, kBufferSlotCount)); |
@@ -182,7 +183,7 @@ TEST_F(GraphicsComposerHidlCommandTest, SET_PER_FRAME_METADATA) { | |||
182 | hidlMetadata.push_back({IComposerClient::PerFrameMetadataKey::MAX_CONTENT_LIGHT_LEVEL, 78.0}); | 183 | hidlMetadata.push_back({IComposerClient::PerFrameMetadataKey::MAX_CONTENT_LIGHT_LEVEL, 78.0}); |
183 | hidlMetadata.push_back( | 184 | hidlMetadata.push_back( |
184 | {IComposerClient::PerFrameMetadataKey::MAX_FRAME_AVERAGE_LIGHT_LEVEL, 62.0}); | 185 | {IComposerClient::PerFrameMetadataKey::MAX_FRAME_AVERAGE_LIGHT_LEVEL, 62.0}); |
185 | mWriter->setPerFrameMetadata(hidlMetadata); | 186 | mWriter->setLayerPerFrameMetadata(hidlMetadata); |
186 | execute(); | 187 | execute(); |
187 | } | 188 | } |
188 | 189 | ||
@@ -192,6 +193,55 @@ TEST_F(GraphicsComposerHidlCommandTest, SET_PER_FRAME_METADATA) { | |||
192 | TEST_F(GraphicsComposerHidlTest, GetPerFrameMetadataKeys) { | 193 | TEST_F(GraphicsComposerHidlTest, GetPerFrameMetadataKeys) { |
193 | mComposerClient->getPerFrameMetadataKeys(mPrimaryDisplay); | 194 | mComposerClient->getPerFrameMetadataKeys(mPrimaryDisplay); |
194 | } | 195 | } |
196 | |||
197 | /** | ||
198 | * Test IComposerClient::createVirtualDisplay_2_2 and | ||
199 | * IComposerClient::destroyVirtualDisplay. | ||
200 | * | ||
201 | * Test that virtual displays can be created and has the correct display type. | ||
202 | */ | ||
203 | TEST_F(GraphicsComposerHidlTest, CreateVirtualDisplay_2_2) { | ||
204 | if (mComposerClient->getMaxVirtualDisplayCount() == 0) { | ||
205 | GTEST_SUCCEED() << "no virtual display support"; | ||
206 | return; | ||
207 | } | ||
208 | |||
209 | Display display; | ||
210 | PixelFormat format; | ||
211 | ASSERT_NO_FATAL_FAILURE( | ||
212 | display = mComposerClient->createVirtualDisplay_2_2( | ||
213 | 64, 64, PixelFormat::IMPLEMENTATION_DEFINED, kBufferSlotCount, &format)); | ||
214 | |||
215 | // test display type | ||
216 | IComposerClient::DisplayType type = mComposerClient->getDisplayType(display); | ||
217 | EXPECT_EQ(IComposerClient::DisplayType::VIRTUAL, type); | ||
218 | |||
219 | mComposerClient->destroyVirtualDisplay(display); | ||
220 | } | ||
221 | |||
222 | /** | ||
223 | * Test IComposerClient::getClientTargetSupport_2_2. | ||
224 | * | ||
225 | * Test that IComposerClient::getClientTargetSupport returns true for the | ||
226 | * required client targets. | ||
227 | */ | ||
228 | TEST_F(GraphicsComposerHidlTest, GetClientTargetSupport_2_2) { | ||
229 | std::vector<Config> configs = mComposerClient->getDisplayConfigs(mPrimaryDisplay); | ||
230 | for (auto config : configs) { | ||
231 | int32_t width = mComposerClient->getDisplayAttribute(mPrimaryDisplay, config, | ||
232 | IComposerClient::Attribute::WIDTH); | ||
233 | int32_t height = mComposerClient->getDisplayAttribute(mPrimaryDisplay, config, | ||
234 | IComposerClient::Attribute::HEIGHT); | ||
235 | ASSERT_LT(0, width); | ||
236 | ASSERT_LT(0, height); | ||
237 | |||
238 | mComposerClient->setActiveConfig(mPrimaryDisplay, config); | ||
239 | |||
240 | ASSERT_TRUE(mComposerClient->getClientTargetSupport_2_2( | ||
241 | mPrimaryDisplay, width, height, PixelFormat::RGBA_8888, Dataspace::UNKNOWN)); | ||
242 | } | ||
243 | } | ||
244 | |||
195 | /** | 245 | /** |
196 | * Test IComposerClient::setPowerMode_2_2. | 246 | * Test IComposerClient::setPowerMode_2_2. |
197 | */ | 247 | */ |
@@ -235,6 +285,56 @@ TEST_F(GraphicsComposerHidlCommandTest, SET_LAYER_FLOAT_COLOR) { | |||
235 | mWriter->setLayerFloatColor(IComposerClient::FloatColor{0.0, 0.0, 0.0, 0.0}); | 285 | mWriter->setLayerFloatColor(IComposerClient::FloatColor{0.0, 0.0, 0.0, 0.0}); |
236 | } | 286 | } |
237 | 287 | ||
288 | /** | ||
289 | * Test IComposerClient::getDataspaceSaturationMatrix. | ||
290 | */ | ||
291 | TEST_F(GraphicsComposerHidlTest, getDataspaceSaturationMatrix) { | ||
292 | auto matrix = mComposerClient->getDataspaceSaturationMatrix(Dataspace::SRGB_LINEAR); | ||
293 | // the last row is known | ||
294 | ASSERT_EQ(0.0f, matrix[12]); | ||
295 | ASSERT_EQ(0.0f, matrix[13]); | ||
296 | ASSERT_EQ(0.0f, matrix[14]); | ||
297 | ASSERT_EQ(1.0f, matrix[15]); | ||
298 | } | ||
299 | |||
300 | /** | ||
301 | * Test IComposerClient::getColorMode_2_2. | ||
302 | */ | ||
303 | TEST_F(GraphicsComposerHidlTest, GetColorMode_2_2) { | ||
304 | std::vector<ColorMode> modes = mComposerClient->getColorModes(mPrimaryDisplay); | ||
305 | |||
306 | auto nativeMode = std::find(modes.cbegin(), modes.cend(), ColorMode::NATIVE); | ||
307 | EXPECT_NE(modes.cend(), nativeMode); | ||
308 | } | ||
309 | |||
310 | /** | ||
311 | * Test IComposerClient::getRenderIntent. | ||
312 | */ | ||
313 | TEST_F(GraphicsComposerHidlTest, GetRenderIntent) { | ||
314 | std::vector<ColorMode> modes = mComposerClient->getColorModes(mPrimaryDisplay); | ||
315 | for (auto mode : modes) { | ||
316 | std::vector<RenderIntent> intents = | ||
317 | mComposerClient->getRenderIntents(mPrimaryDisplay, mode); | ||
318 | auto colorimetricIntent = | ||
319 | std::find(intents.cbegin(), intents.cend(), RenderIntent::COLORIMETRIC); | ||
320 | EXPECT_NE(intents.cend(), colorimetricIntent); | ||
321 | } | ||
322 | } | ||
323 | |||
324 | /** | ||
325 | * Test IComposerClient::setColorMode_2_2. | ||
326 | */ | ||
327 | TEST_F(GraphicsComposerHidlTest, SetColorMode_2_2) { | ||
328 | std::vector<ColorMode> modes = mComposerClient->getColorModes(mPrimaryDisplay); | ||
329 | for (auto mode : modes) { | ||
330 | std::vector<RenderIntent> intents = | ||
331 | mComposerClient->getRenderIntents(mPrimaryDisplay, mode); | ||
332 | for (auto intent : intents) { | ||
333 | mComposerClient->setColorMode(mPrimaryDisplay, mode, intent); | ||
334 | } | ||
335 | } | ||
336 | } | ||
337 | |||
238 | } // namespace | 338 | } // namespace |
239 | } // namespace vts | 339 | } // namespace vts |
240 | } // namespace V2_2 | 340 | } // namespace V2_2 |
diff --git a/graphics/mapper/2.1/utils/vts/MapperVts.cpp b/graphics/mapper/2.1/utils/vts/MapperVts.cpp index 0aaa9260..078068e3 100644 --- a/graphics/mapper/2.1/utils/vts/MapperVts.cpp +++ b/graphics/mapper/2.1/utils/vts/MapperVts.cpp | |||
@@ -43,6 +43,13 @@ static_assert(sizeof(OldBufferDescriptorInfo) == sizeof(IMapper::BufferDescripto | |||
43 | offsetof(IMapper::BufferDescriptorInfo, usage), | 43 | offsetof(IMapper::BufferDescriptorInfo, usage), |
44 | ""); | 44 | ""); |
45 | 45 | ||
46 | Gralloc::Gralloc() : V2_0::vts::Gralloc() { | ||
47 | if (::testing::Test::HasFatalFailure()) { | ||
48 | return; | ||
49 | } | ||
50 | init(); | ||
51 | } | ||
52 | |||
46 | Gralloc::Gralloc(const std::string& allocatorServiceName, const std::string& mapperServiceName) | 53 | Gralloc::Gralloc(const std::string& allocatorServiceName, const std::string& mapperServiceName) |
47 | : V2_0::vts::Gralloc(allocatorServiceName, mapperServiceName) { | 54 | : V2_0::vts::Gralloc(allocatorServiceName, mapperServiceName) { |
48 | if (::testing::Test::HasFatalFailure()) { | 55 | if (::testing::Test::HasFatalFailure()) { |
diff --git a/graphics/mapper/2.1/utils/vts/include/mapper-vts/2.1/MapperVts.h b/graphics/mapper/2.1/utils/vts/include/mapper-vts/2.1/MapperVts.h index b7fa7519..423d4b3c 100644 --- a/graphics/mapper/2.1/utils/vts/include/mapper-vts/2.1/MapperVts.h +++ b/graphics/mapper/2.1/utils/vts/include/mapper-vts/2.1/MapperVts.h | |||
@@ -32,6 +32,7 @@ using V2_0::BufferDescriptor; | |||
32 | // A wrapper to IAllocator and IMapper. | 32 | // A wrapper to IAllocator and IMapper. |
33 | class Gralloc : public V2_0::vts::Gralloc { | 33 | class Gralloc : public V2_0::vts::Gralloc { |
34 | public: | 34 | public: |
35 | Gralloc(); | ||
35 | Gralloc(const std::string& allocatorServiceName, const std::string& mapperServiceName); | 36 | Gralloc(const std::string& allocatorServiceName, const std::string& mapperServiceName); |
36 | 37 | ||
37 | sp<IMapper> getMapper() const; | 38 | sp<IMapper> getMapper() const; |
diff --git a/keymaster/4.0/support/Keymaster.cpp b/keymaster/4.0/support/Keymaster.cpp index bf52c47c..fac00174 100644 --- a/keymaster/4.0/support/Keymaster.cpp +++ b/keymaster/4.0/support/Keymaster.cpp | |||
@@ -40,7 +40,7 @@ std::vector<std::unique_ptr<Keymaster>> enumerateDevices( | |||
40 | serviceManager->listByInterface(descriptor, [&](const hidl_vec<hidl_string>& names) { | 40 | serviceManager->listByInterface(descriptor, [&](const hidl_vec<hidl_string>& names) { |
41 | for (auto& name : names) { | 41 | for (auto& name : names) { |
42 | if (name == "default") foundDefault = true; | 42 | if (name == "default") foundDefault = true; |
43 | auto device = Wrapper::WrappedIKeymasterDevice::getService(); | 43 | auto device = Wrapper::WrappedIKeymasterDevice::getService(name); |
44 | CHECK(device) << "Failed to get service for " << descriptor << " with interface name " | 44 | CHECK(device) << "Failed to get service for " << descriptor << " with interface name " |
45 | << name; | 45 | << name; |
46 | result.push_back(std::unique_ptr<Keymaster>(new Wrapper(device, name))); | 46 | result.push_back(std::unique_ptr<Keymaster>(new Wrapper(device, name))); |