diff options
author | Peiyong Lin | 2018-04-03 00:15:30 -0500 |
---|---|---|
committer | android-build-merger | 2018-04-03 00:15:30 -0500 |
commit | 71641ca35999f086aef2d279353e98288a3a6390 (patch) | |
tree | c274ab0ac1bc784d96ff87afb0abb94fa009b583 /graphics | |
parent | 34f70e48945d46cb1fa715e485314e9f142ea87b (diff) | |
parent | 584ee3b94ab8d774dbad8401ab589183f8154d4a (diff) | |
download | platform-hardware-interfaces-71641ca35999f086aef2d279353e98288a3a6390.tar.gz platform-hardware-interfaces-71641ca35999f086aef2d279353e98288a3a6390.tar.xz platform-hardware-interfaces-71641ca35999f086aef2d279353e98288a3a6390.zip |
Merge "[Graphics] Update CommandWriter APIs to common::V1_1::* enum." into pi-dev
am: 584ee3b94a
Change-Id: Ieb29aadc2e9034a9ff76495755d290fc0432e781
Diffstat (limited to 'graphics')
13 files changed, 256 insertions, 36 deletions
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/IComposerClient.hal b/graphics/composer/2.2/IComposerClient.hal index 657bcac8..b7ba6a60 100644 --- a/graphics/composer/2.2/IComposerClient.hal +++ b/graphics/composer/2.2/IComposerClient.hal | |||
@@ -16,13 +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::Dataspace; | ||
20 | import android.hardware.graphics.common@1.0::PixelFormat; | ||
21 | import android.hardware.graphics.common@1.1::ColorMode; | 19 | import android.hardware.graphics.common@1.1::ColorMode; |
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; | 22 | import android.hardware.graphics.common@1.1::RenderIntent; |
23 | import @2.1::IComposerClient; | 23 | import @2.1::IComposerClient; |
24 | import @2.1::Display; | 24 | import @2.1::Display; |
25 | import @2.1::Error; | 25 | import @2.1::Error; |
26 | import @2.1::IComposerClient; | ||
26 | 27 | ||
27 | interface IComposerClient extends @2.1::IComposerClient { | 28 | interface IComposerClient extends @2.1::IComposerClient { |
28 | 29 | ||
@@ -248,6 +249,65 @@ interface IComposerClient extends @2.1::IComposerClient { | |||
248 | setReadbackBuffer(Display display, handle buffer, handle releaseFence) generates (Error error); | 249 | setReadbackBuffer(Display display, handle buffer, handle releaseFence) generates (Error error); |
249 | 250 | ||
250 | /** | 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 | /** | ||
251 | * setPowerMode_2_2 | 311 | * setPowerMode_2_2 |
252 | * 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 |
253 | * 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 |
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 b499ca97..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, |
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 ba6723de..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,6 +99,25 @@ 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 | } |
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 12191bee..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,9 +28,9 @@ namespace composer { | |||
28 | namespace V2_2 { | 28 | namespace V2_2 { |
29 | namespace hal { | 29 | namespace hal { |
30 | 30 | ||
31 | using common::V1_0::Dataspace; | ||
32 | using common::V1_0::PixelFormat; | ||
33 | using common::V1_1::ColorMode; | 31 | using common::V1_1::ColorMode; |
32 | using common::V1_1::Dataspace; | ||
33 | using common::V1_1::PixelFormat; | ||
34 | using common::V1_1::RenderIntent; | 34 | using common::V1_1::RenderIntent; |
35 | using V2_1::Display; | 35 | using V2_1::Display; |
36 | using V2_1::Error; | 36 | using V2_1::Error; |
@@ -38,6 +38,17 @@ using V2_1::Layer; | |||
38 | 38 | ||
39 | class ComposerHal : public V2_1::hal::ComposerHal { | 39 | class ComposerHal : public V2_1::hal::ComposerHal { |
40 | 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 | } | ||
41 | // superceded by setPowerMode_2_2 | 52 | // superceded by setPowerMode_2_2 |
42 | Error setPowerMode(Display display, V2_1::IComposerClient::PowerMode mode) override { | 53 | Error setPowerMode(Display display, V2_1::IComposerClient::PowerMode mode) override { |
43 | return setPowerMode_2_2(display, static_cast<IComposerClient::PowerMode>(mode)); | 54 | return setPowerMode_2_2(display, static_cast<IComposerClient::PowerMode>(mode)); |
@@ -64,7 +75,10 @@ class ComposerHal : public V2_1::hal::ComposerHal { | |||
64 | virtual Error setReadbackBuffer(Display display, const native_handle_t* bufferHandle, | 75 | virtual Error setReadbackBuffer(Display display, const native_handle_t* bufferHandle, |
65 | base::unique_fd fenceFd) = 0; | 76 | base::unique_fd fenceFd) = 0; |
66 | virtual Error getReadbackBufferFence(Display display, base::unique_fd* outFenceFd) = 0; | 77 | virtual Error getReadbackBufferFence(Display display, base::unique_fd* outFenceFd) = 0; |
67 | 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; | ||
68 | virtual Error setPowerMode_2_2(Display display, IComposerClient::PowerMode mode) = 0; | 82 | virtual Error setPowerMode_2_2(Display display, IComposerClient::PowerMode mode) = 0; |
69 | 83 | ||
70 | virtual Error setLayerFloatColor(Display display, Layer layer, | 84 | virtual Error setLayerFloatColor(Display display, Layer layer, |
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 7e38a797..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,9 +34,9 @@ namespace passthrough { | |||
34 | 34 | ||
35 | namespace detail { | 35 | namespace detail { |
36 | 36 | ||
37 | using common::V1_0::Dataspace; | ||
38 | using common::V1_0::PixelFormat; | ||
39 | using common::V1_1::ColorMode; | 37 | using common::V1_1::ColorMode; |
38 | using common::V1_1::Dataspace; | ||
39 | using common::V1_1::PixelFormat; | ||
40 | using common::V1_1::RenderIntent; | 40 | using common::V1_1::RenderIntent; |
41 | using V2_1::Display; | 41 | using V2_1::Display; |
42 | using V2_1::Error; | 42 | using V2_1::Error; |
@@ -134,6 +134,19 @@ class HwcHalImpl : public V2_1::passthrough::detail::HwcHalImpl<Hal> { | |||
134 | return static_cast<Error>(error); | 134 | return static_cast<Error>(error); |
135 | } | 135 | } |
136 | 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 | |||
137 | Error setPowerMode_2_2(Display display, IComposerClient::PowerMode mode) override { | 150 | Error setPowerMode_2_2(Display display, IComposerClient::PowerMode mode) override { |
138 | if (mode == IComposerClient::PowerMode::ON_SUSPEND) { | 151 | if (mode == IComposerClient::PowerMode::ON_SUSPEND) { |
139 | return Error::UNSUPPORTED; | 152 | return Error::UNSUPPORTED; |
@@ -271,6 +284,8 @@ class HwcHalImpl : public V2_1::passthrough::detail::HwcHalImpl<Hal> { | |||
271 | using BaseType2_1::getColorModes; | 284 | using BaseType2_1::getColorModes; |
272 | using BaseType2_1::mDevice; | 285 | using BaseType2_1::mDevice; |
273 | using BaseType2_1::setColorMode; | 286 | using BaseType2_1::setColorMode; |
287 | using BaseType2_1::createVirtualDisplay; | ||
288 | using BaseType2_1::getClientTargetSupport; | ||
274 | using BaseType2_1::setPowerMode; | 289 | using BaseType2_1::setPowerMode; |
275 | }; | 290 | }; |
276 | 291 | ||
diff --git a/graphics/composer/2.2/utils/vts/ComposerVts.cpp b/graphics/composer/2.2/utils/vts/ComposerVts.cpp index 9a035f65..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"; |
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 5467011e..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,10 @@ 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::Dataspace; | ||
40 | using android::hardware::graphics::common::V1_0::Hdr; | 39 | using android::hardware::graphics::common::V1_0::Hdr; |
41 | using android::hardware::graphics::common::V1_0::PixelFormat; | ||
42 | using android::hardware::graphics::common::V1_1::ColorMode; | 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::common::V1_1::RenderIntent; |
44 | using android::hardware::graphics::composer::V2_2::IComposer; | 44 | using android::hardware::graphics::composer::V2_2::IComposer; |
45 | using android::hardware::graphics::composer::V2_2::IComposerClient; | 45 | using android::hardware::graphics::composer::V2_2::IComposerClient; |
@@ -67,6 +67,10 @@ class ComposerClient_v2_2 | |||
67 | 67 | ||
68 | std::vector<IComposerClient::PerFrameMetadataKey> getPerFrameMetadataKeys(Display display); | 68 | std::vector<IComposerClient::PerFrameMetadataKey> getPerFrameMetadataKeys(Display display); |
69 | 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); | ||
70 | void setPowerMode_2_2(Display display, V2_2::IComposerClient::PowerMode mode); | 74 | void setPowerMode_2_2(Display display, V2_2::IComposerClient::PowerMode mode); |
71 | 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); |
72 | void getReadbackBufferAttributes(Display display, PixelFormat* outPixelFormat, | 76 | void getReadbackBufferAttributes(Display display, PixelFormat* outPixelFormat, |
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 3103d10f..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 { |
@@ -34,14 +34,14 @@ 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::ColorTransform; | 36 | using android::hardware::graphics::common::V1_0::ColorTransform; |
37 | using android::hardware::graphics::common::V1_0::Dataspace; | ||
38 | using android::hardware::graphics::common::V1_0::PixelFormat; | ||
39 | using android::hardware::graphics::common::V1_0::Transform; | 37 | using android::hardware::graphics::common::V1_0::Transform; |
40 | using android::hardware::graphics::common::V1_1::ColorMode; | 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::common::V1_1::RenderIntent; |
42 | using android::hardware::graphics::composer::V2_2::IComposerClient; | 42 | using android::hardware::graphics::composer::V2_2::IComposerClient; |
43 | using android::hardware::graphics::mapper::V2_0::IMapper; | 43 | using android::hardware::graphics::mapper::V2_1::IMapper; |
44 | using android::hardware::graphics::mapper::V2_0::vts::Gralloc; | 44 | using android::hardware::graphics::mapper::V2_1::vts::Gralloc; |
45 | using GrallocError = android::hardware::graphics::mapper::V2_0::Error; | 45 | using GrallocError = android::hardware::graphics::mapper::V2_0::Error; |
46 | 46 | ||
47 | // Test environment for graphics.composer | 47 | // Test environment for graphics.composer |
@@ -193,6 +193,55 @@ TEST_F(GraphicsComposerHidlCommandTest, SET_LAYER_PER_FRAME_METADATA) { | |||
193 | TEST_F(GraphicsComposerHidlTest, GetPerFrameMetadataKeys) { | 193 | TEST_F(GraphicsComposerHidlTest, GetPerFrameMetadataKeys) { |
194 | mComposerClient->getPerFrameMetadataKeys(mPrimaryDisplay); | 194 | mComposerClient->getPerFrameMetadataKeys(mPrimaryDisplay); |
195 | } | 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 | |||
196 | /** | 245 | /** |
197 | * Test IComposerClient::setPowerMode_2_2. | 246 | * Test IComposerClient::setPowerMode_2_2. |
198 | */ | 247 | */ |
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; |