blob: 5dd68df3a1096994002f795fadf675e6b5232517 [file] [log] [blame]
Valerie Haub019fd72019-05-23 12:50:12 -07001/*
2 * Copyright 2019 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include <composer-vts/2.2/ReadbackVts.h>
Alec Mouri2a6ef4e2021-04-16 16:36:21 +000018#include <composer-vts/2.2/RenderEngineVts.h>
19#include "renderengine/ExternalTexture.h"
Vishnu Nair59329712022-01-13 07:59:37 -080020#include "renderengine/impl/ExternalTexture.h"
Valerie Haub019fd72019-05-23 12:50:12 -070021
Brian Lindahld103cd62022-12-09 07:26:28 -070022using ::android::status_t;
23
Valerie Haub019fd72019-05-23 12:50:12 -070024namespace android {
25namespace hardware {
26namespace graphics {
27namespace composer {
28namespace V2_2 {
29namespace vts {
30
31void TestLayer::write(const std::shared_ptr<CommandWriterBase>& writer) {
32 writer->selectLayer(mLayer);
33 writer->setLayerDisplayFrame(mDisplayFrame);
34 writer->setLayerSourceCrop(mSourceCrop);
35 writer->setLayerZOrder(mZOrder);
36 writer->setLayerSurfaceDamage(mSurfaceDamage);
37 writer->setLayerTransform(mTransform);
38 writer->setLayerPlaneAlpha(mAlpha);
39 writer->setLayerBlendMode(mBlendMode);
40}
41
Valerie Hau7c8eb682019-06-12 14:24:27 -070042const std::vector<ColorMode> ReadbackHelper::colorModes = {ColorMode::SRGB, ColorMode::DISPLAY_P3};
43const std::vector<Dataspace> ReadbackHelper::dataspaces = {Dataspace::V0_SRGB,
44 Dataspace::DISPLAY_P3};
45
46std::string ReadbackHelper::getColorModeString(ColorMode mode) {
47 switch (mode) {
48 case ColorMode::SRGB:
49 return std::string("SRGB");
50 case ColorMode::DISPLAY_P3:
51 return std::string("DISPLAY_P3");
52 default:
53 return std::string("Unsupported color mode for readback");
54 }
55}
56
57std::string ReadbackHelper::getDataspaceString(Dataspace dataspace) {
58 switch (dataspace) {
59 case Dataspace::V0_SRGB:
60 return std::string("V0_SRGB");
61 case Dataspace::DISPLAY_P3:
62 return std::string("DISPLAY_P3");
Valerie Hau37edd052019-07-11 15:48:38 -070063 case Dataspace::UNKNOWN:
64 return std::string("UNKNOWN");
Valerie Hau7c8eb682019-06-12 14:24:27 -070065 default:
66 return std::string("Unsupported dataspace for readback");
67 }
68}
69
Valerie Hau37edd052019-07-11 15:48:38 -070070Dataspace ReadbackHelper::getDataspaceForColorMode(ColorMode mode) {
71 switch (mode) {
72 case ColorMode::DISPLAY_P3:
73 return Dataspace::DISPLAY_P3;
74 case ColorMode::SRGB:
75 default:
76 return Dataspace::UNKNOWN;
77 }
78}
79
Adam Bodnar5bf9dc62019-05-24 09:20:04 -070080LayerSettings TestLayer::toRenderEngineLayerSettings() {
81 LayerSettings layerSettings;
82
83 layerSettings.alpha = half(mAlpha);
84 layerSettings.disableBlending = mBlendMode == IComposerClient::BlendMode::NONE;
85 layerSettings.geometry.boundaries = FloatRect(
86 static_cast<float>(mDisplayFrame.left), static_cast<float>(mDisplayFrame.top),
87 static_cast<float>(mDisplayFrame.right), static_cast<float>(mDisplayFrame.bottom));
88
Adam Bodnard0aef4d2019-07-11 10:35:42 -070089 const mat4 translation = mat4::translate(
90 vec4((mTransform & Transform::FLIP_H ? -mDisplayFrame.right : 0.0f),
91 (mTransform & Transform::FLIP_V ? -mDisplayFrame.bottom : 0.0f), 0.0f, 1.0f));
Adam Bodnar5bf9dc62019-05-24 09:20:04 -070092
93 const mat4 scale = mat4::scale(vec4(mTransform & Transform::FLIP_H ? -1.0f : 1.0f,
94 mTransform & Transform::FLIP_V ? -1.0f : 1.0f, 1.0f, 1.0f));
95
Adam Bodnard0aef4d2019-07-11 10:35:42 -070096 layerSettings.geometry.positionTransform = scale * translation;
Adam Bodnar5bf9dc62019-05-24 09:20:04 -070097
98 return layerSettings;
99}
100
Valerie Haub019fd72019-05-23 12:50:12 -0700101int32_t ReadbackHelper::GetBytesPerPixel(PixelFormat pixelFormat) {
102 switch (pixelFormat) {
103 case PixelFormat::RGBA_8888:
104 return 4;
105 case PixelFormat::RGB_888:
106 return 3;
107 default:
108 return -1;
109 }
110}
111
Brian Lindahld103cd62022-12-09 07:26:28 -0700112void ReadbackHelper::fillBufferAndGetFence(const sp<GraphicBuffer>& graphicBuffer,
113 IComposerClient::Color desiredColor, int* fillFence) {
114 ASSERT_NE(nullptr, fillFence);
115 std::vector<IComposerClient::Color> desiredColors(
116 static_cast<size_t>(graphicBuffer->getWidth() * graphicBuffer->getHeight()));
117 ::android::Rect bounds = graphicBuffer->getBounds();
118 fillColorsArea(desiredColors, static_cast<int32_t>(graphicBuffer->getWidth()),
119 {bounds.left, bounds.top, bounds.right, bounds.bottom}, desiredColor);
120 ASSERT_NO_FATAL_FAILURE(fillBufferAndGetFence(graphicBuffer, desiredColors, fillFence));
121}
122
123void ReadbackHelper::fillBufferAndGetFence(const sp<GraphicBuffer>& graphicBuffer,
124 const std::vector<IComposerClient::Color>& desiredColors,
125 int* fillFence) {
126 ASSERT_TRUE(graphicBuffer->getPixelFormat() == ::android::PIXEL_FORMAT_RGB_888 ||
127 graphicBuffer->getPixelFormat() == ::android::PIXEL_FORMAT_RGBA_8888);
128 void* bufData;
129 int32_t bytesPerPixel = -1;
130 int32_t bytesPerStride = -1;
131 status_t status =
132 graphicBuffer->lock(GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN,
133 &bufData, &bytesPerPixel, &bytesPerStride);
134 ASSERT_EQ(::android::OK, status);
135
136 const uint32_t stride = (bytesPerPixel > 0 && bytesPerStride > 0)
137 ? static_cast<uint32_t>(bytesPerStride / bytesPerPixel)
138 : graphicBuffer->getStride();
139 ReadbackHelper::fillBuffer(graphicBuffer->getWidth(), graphicBuffer->getHeight(), stride,
140 bufData, static_cast<PixelFormat>(graphicBuffer->getPixelFormat()),
141 desiredColors);
142 status = graphicBuffer->unlockAsync(fillFence);
143 ASSERT_EQ(::android::OK, status);
144}
145
Valerie Haub019fd72019-05-23 12:50:12 -0700146void ReadbackHelper::fillBuffer(int32_t width, int32_t height, uint32_t stride, void* bufferData,
147 PixelFormat pixelFormat,
148 std::vector<IComposerClient::Color> desiredPixelColors) {
149 ASSERT_TRUE(pixelFormat == PixelFormat::RGB_888 || pixelFormat == PixelFormat::RGBA_8888);
150 int32_t bytesPerPixel = GetBytesPerPixel(pixelFormat);
151 ASSERT_NE(-1, bytesPerPixel);
152 for (int row = 0; row < height; row++) {
153 for (int col = 0; col < width; col++) {
154 int pixel = row * width + col;
Brian Lindahld103cd62022-12-09 07:26:28 -0700155 IComposerClient::Color desiredColor = desiredPixelColors[pixel];
Valerie Haub019fd72019-05-23 12:50:12 -0700156
157 int offset = (row * stride + col) * bytesPerPixel;
158 uint8_t* pixelColor = (uint8_t*)bufferData + offset;
Brian Lindahld103cd62022-12-09 07:26:28 -0700159 pixelColor[0] = desiredColor.r;
160 pixelColor[1] = desiredColor.g;
161 pixelColor[2] = desiredColor.b;
Valerie Haub019fd72019-05-23 12:50:12 -0700162
163 if (bytesPerPixel == 4) {
Brian Lindahld103cd62022-12-09 07:26:28 -0700164 pixelColor[3] = desiredColor.a;
Valerie Haub019fd72019-05-23 12:50:12 -0700165 }
166 }
167 }
168}
169
170void ReadbackHelper::clearColors(std::vector<IComposerClient::Color>& expectedColors, int32_t width,
171 int32_t height, int32_t displayWidth) {
172 for (int row = 0; row < height; row++) {
173 for (int col = 0; col < width; col++) {
174 int pixel = row * displayWidth + col;
175 expectedColors[pixel] = BLACK;
176 }
177 }
178}
179
180void ReadbackHelper::fillColorsArea(std::vector<IComposerClient::Color>& expectedColors,
181 int32_t stride, IComposerClient::Rect area,
182 IComposerClient::Color color) {
183 for (int row = area.top; row < area.bottom; row++) {
184 for (int col = area.left; col < area.right; col++) {
185 int pixel = row * stride + col;
186 expectedColors[pixel] = color;
187 }
188 }
189}
190
Brian Lindahld103cd62022-12-09 07:26:28 -0700191bool ReadbackHelper::readbackSupported(PixelFormat pixelFormat, Dataspace dataspace, Error error) {
Valerie Haub019fd72019-05-23 12:50:12 -0700192 if (error != Error::NONE) {
193 return false;
194 }
Brian Lindahld103cd62022-12-09 07:26:28 -0700195 return readbackSupported(pixelFormat, dataspace);
196}
197
198bool ReadbackHelper::readbackSupported(PixelFormat pixelFormat, Dataspace dataspace) {
Valerie Haub019fd72019-05-23 12:50:12 -0700199 if (pixelFormat != PixelFormat::RGB_888 && pixelFormat != PixelFormat::RGBA_8888) {
200 return false;
201 }
Valerie Hau7c8eb682019-06-12 14:24:27 -0700202 if (std::find(dataspaces.begin(), dataspaces.end(), dataspace) == dataspaces.end()) {
Valerie Haub019fd72019-05-23 12:50:12 -0700203 return false;
204 }
205 return true;
206}
207
Brian Lindahld103cd62022-12-09 07:26:28 -0700208void ReadbackHelper::createReadbackBuffer(uint32_t width, uint32_t height, PixelFormat pixelFormat,
209 Dataspace dataspace, sp<GraphicBuffer>* graphicBuffer) {
210 ASSERT_NE(nullptr, graphicBuffer);
211 if (!readbackSupported(pixelFormat, dataspace)) {
212 *graphicBuffer = nullptr;
213 }
214 android::PixelFormat bufferFormat = static_cast<android::PixelFormat>(pixelFormat);
215 uint32_t layerCount = 1;
216 uint64_t usage = static_cast<uint64_t>(static_cast<uint64_t>(BufferUsage::CPU_READ_OFTEN) |
217 static_cast<uint64_t>(BufferUsage::GPU_TEXTURE));
218 *graphicBuffer = sp<GraphicBuffer>::make(width, height, bufferFormat, layerCount, usage,
219 "ReadbackBuffer");
220 ASSERT_NE(nullptr, *graphicBuffer);
221 ASSERT_EQ(::android::OK, (*graphicBuffer)->initCheck());
222}
Adam Bodnar5bf9dc62019-05-24 09:20:04 -0700223
Brian Lindahld103cd62022-12-09 07:26:28 -0700224void ReadbackHelper::compareColorToBuffer(IComposerClient::Color expectedColor,
225 const sp<GraphicBuffer>& graphicBuffer, int32_t fence) {
226 std::vector<IComposerClient::Color> expectedColors(
227 static_cast<size_t>(graphicBuffer->getWidth() * graphicBuffer->getHeight()));
228 ::android::Rect bounds = graphicBuffer->getBounds();
229 fillColorsArea(expectedColors, static_cast<int32_t>(graphicBuffer->getWidth()),
230 {bounds.left, bounds.top, bounds.right, bounds.bottom}, expectedColor);
231 compareColorsToBuffer(expectedColors, graphicBuffer, fence);
232}
233
234void ReadbackHelper::compareColorsToBuffer(std::vector<IComposerClient::Color>& expectedColors,
235 const sp<GraphicBuffer>& graphicBuffer, int32_t fence) {
236 ASSERT_TRUE(graphicBuffer->getPixelFormat() == ::android::PIXEL_FORMAT_RGB_888 ||
237 graphicBuffer->getPixelFormat() == ::android::PIXEL_FORMAT_RGBA_8888);
238
239 int bytesPerPixel = -1;
240 int bytesPerStride = -1;
241 void* bufData = nullptr;
242 status_t status = graphicBuffer->lockAsync(GRALLOC_USAGE_SW_READ_OFTEN, &bufData, fence,
243 &bytesPerPixel, &bytesPerStride);
244 ASSERT_EQ(::android::OK, status);
245
246 const uint32_t stride = (bytesPerPixel > 0 && bytesPerStride > 0)
247 ? static_cast<uint32_t>(bytesPerStride / bytesPerPixel)
248 : graphicBuffer->getStride();
249
250 if (bytesPerPixel == -1) {
251 PixelFormat pixelFormat = static_cast<PixelFormat>(graphicBuffer->getPixelFormat());
252 bytesPerPixel = ReadbackHelper::GetBytesPerPixel(pixelFormat);
253 }
254 ASSERT_NE(-1, bytesPerPixel);
255 for (int row = 0; row < graphicBuffer->getHeight(); row++) {
256 for (int col = 0; col < graphicBuffer->getWidth(); col++) {
257 int pixel = row * static_cast<int32_t>(graphicBuffer->getWidth()) + col;
258 int offset = (row * static_cast<int32_t>(stride) + col) * bytesPerPixel;
259 uint8_t* pixelColor = (uint8_t*)bufData + offset;
260 const IComposerClient::Color expectedColor = expectedColors[static_cast<size_t>(pixel)];
261 ASSERT_EQ(std::round(255.0f * expectedColor.r), pixelColor[0]);
262 ASSERT_EQ(std::round(255.0f * expectedColor.g), pixelColor[1]);
263 ASSERT_EQ(std::round(255.0f * expectedColor.b), pixelColor[2]);
Adam Bodnar5bf9dc62019-05-24 09:20:04 -0700264 }
265 }
Brian Lindahld103cd62022-12-09 07:26:28 -0700266
267 status = graphicBuffer->unlock();
268 ASSERT_EQ(::android::OK, status);
Adam Bodnar5bf9dc62019-05-24 09:20:04 -0700269}
270
Valerie Haub019fd72019-05-23 12:50:12 -0700271ReadbackBuffer::ReadbackBuffer(Display display, const std::shared_ptr<ComposerClient>& client,
Brian Lindahld103cd62022-12-09 07:26:28 -0700272 uint32_t width, uint32_t height, PixelFormat pixelFormat) {
Valerie Haub019fd72019-05-23 12:50:12 -0700273 mDisplay = display;
Valerie Haub019fd72019-05-23 12:50:12 -0700274 mComposerClient = client;
Valerie Hauc1dc3132019-06-13 09:49:44 -0700275 mWidth = width;
276 mHeight = height;
Brian Lindahld103cd62022-12-09 07:26:28 -0700277 mPixelFormat = pixelFormat;
Valerie Hauc1dc3132019-06-13 09:49:44 -0700278 mLayerCount = 1;
Valerie Hauc1dc3132019-06-13 09:49:44 -0700279 mUsage = static_cast<uint64_t>(BufferUsage::CPU_READ_OFTEN | BufferUsage::GPU_TEXTURE);
Valerie Haub019fd72019-05-23 12:50:12 -0700280}
281
Valerie Haub019fd72019-05-23 12:50:12 -0700282void ReadbackBuffer::setReadbackBuffer() {
Brian Lindahld103cd62022-12-09 07:26:28 -0700283 mGraphicBuffer = sp<GraphicBuffer>::make(mWidth, mHeight,
284 static_cast<::android::PixelFormat>(mPixelFormat),
285 mLayerCount, mUsage, "ReadbackBuffer");
286 ASSERT_NE(nullptr, mGraphicBuffer);
287 ASSERT_EQ(::android::OK, mGraphicBuffer->initCheck());
288 mComposerClient->setReadbackBuffer(mDisplay, mGraphicBuffer->handle, -1 /* fence */);
Valerie Haub019fd72019-05-23 12:50:12 -0700289}
290
291void ReadbackBuffer::checkReadbackBuffer(std::vector<IComposerClient::Color> expectedColors) {
292 // lock buffer for reading
293 int32_t fenceHandle;
294 ASSERT_NO_FATAL_FAILURE(mComposerClient->getReadbackBufferFence(mDisplay, &fenceHandle));
Brian Lindahld103cd62022-12-09 07:26:28 -0700295 ReadbackHelper::compareColorsToBuffer(expectedColors, mGraphicBuffer, fenceHandle);
Valerie Haub019fd72019-05-23 12:50:12 -0700296}
297
298void TestColorLayer::write(const std::shared_ptr<CommandWriterBase>& writer) {
299 TestLayer::write(writer);
300 writer->setLayerCompositionType(IComposerClient::Composition::SOLID_COLOR);
301 writer->setLayerColor(mColor);
302}
303
Adam Bodnar5bf9dc62019-05-24 09:20:04 -0700304LayerSettings TestColorLayer::toRenderEngineLayerSettings() {
305 LayerSettings layerSettings = TestLayer::toRenderEngineLayerSettings();
306
307 layerSettings.source.solidColor =
308 half3(static_cast<half>(mColor.r) / 255.0, static_cast<half>(mColor.g) / 255.0,
309 static_cast<half>(mColor.b) / 255.0);
310 layerSettings.alpha = mAlpha * (static_cast<half>(mColor.a) / 255.0);
311 return layerSettings;
312}
313
Valerie Haub019fd72019-05-23 12:50:12 -0700314TestBufferLayer::TestBufferLayer(const std::shared_ptr<ComposerClient>& client,
Alec Mouri2a6ef4e2021-04-16 16:36:21 +0000315 const std::shared_ptr<Gralloc>& gralloc,
316 TestRenderEngine& renderEngine, Display display, int32_t width,
317 int32_t height, PixelFormat format,
Valerie Haub019fd72019-05-23 12:50:12 -0700318 IComposerClient::Composition composition)
Alec Mouri2a6ef4e2021-04-16 16:36:21 +0000319 : TestLayer{client, display}, mRenderEngine(renderEngine) {
Valerie Haub019fd72019-05-23 12:50:12 -0700320 mGralloc = gralloc;
321 mComposition = composition;
Valerie Hauc1dc3132019-06-13 09:49:44 -0700322 mWidth = width;
323 mHeight = height;
324 mLayerCount = 1;
325 mFormat = format;
326 mUsage = static_cast<uint64_t>(BufferUsage::CPU_READ_OFTEN | BufferUsage::CPU_WRITE_OFTEN |
Ady Abraham203bdee2021-03-16 23:59:45 +0000327 BufferUsage::COMPOSER_OVERLAY | BufferUsage::GPU_TEXTURE);
Valerie Haub019fd72019-05-23 12:50:12 -0700328
329 mAccessRegion.top = 0;
330 mAccessRegion.left = 0;
331 mAccessRegion.width = width;
332 mAccessRegion.height = height;
333
334 setSourceCrop({0, 0, (float)width, (float)height});
335}
336
Valerie Haub019fd72019-05-23 12:50:12 -0700337void TestBufferLayer::write(const std::shared_ptr<CommandWriterBase>& writer) {
338 TestLayer::write(writer);
339 writer->setLayerCompositionType(mComposition);
Valerie Haub019fd72019-05-23 12:50:12 -0700340 writer->setLayerVisibleRegion(std::vector<IComposerClient::Rect>(1, mDisplayFrame));
Marin Shalamanov513ae732021-06-14 11:07:30 +0200341 if (mBufferHandle != nullptr) writer->setLayerBuffer(0, mBufferHandle->get(), mFillFence);
Valerie Haub019fd72019-05-23 12:50:12 -0700342}
343
Adam Bodnar5bf9dc62019-05-24 09:20:04 -0700344LayerSettings TestBufferLayer::toRenderEngineLayerSettings() {
345 LayerSettings layerSettings = TestLayer::toRenderEngineLayerSettings();
Vishnu Nair59329712022-01-13 07:59:37 -0800346 layerSettings.source.buffer.buffer = std::make_shared<renderengine::impl::ExternalTexture>(
Marin Shalamanov513ae732021-06-14 11:07:30 +0200347 new GraphicBuffer(mBufferHandle->get(), GraphicBuffer::CLONE_HANDLE, mWidth, mHeight,
Alec Mouri2a6ef4e2021-04-16 16:36:21 +0000348 static_cast<int32_t>(mFormat), 1, mUsage, mStride),
349 mRenderEngine.getInternalRenderEngine(),
Vishnu Nair59329712022-01-13 07:59:37 -0800350 renderengine::impl::ExternalTexture::Usage::READABLE);
Adam Bodnard0aef4d2019-07-11 10:35:42 -0700351
352 layerSettings.source.buffer.usePremultipliedAlpha =
353 mBlendMode == IComposerClient::BlendMode::PREMULTIPLIED;
Adam Bodnar5bf9dc62019-05-24 09:20:04 -0700354
355 const float scaleX = (mSourceCrop.right - mSourceCrop.left) / (mWidth);
356 const float scaleY = (mSourceCrop.bottom - mSourceCrop.top) / (mHeight);
357 const float translateX = mSourceCrop.left / (mWidth);
358 const float translateY = mSourceCrop.top / (mHeight);
359
360 layerSettings.source.buffer.textureTransform =
361 mat4::translate(vec4(translateX, translateY, 0, 1)) *
362 mat4::scale(vec4(scaleX, scaleY, 1.0, 1.0));
363
364 return layerSettings;
365}
366
Valerie Haub019fd72019-05-23 12:50:12 -0700367void TestBufferLayer::fillBuffer(std::vector<IComposerClient::Color> expectedColors) {
Marin Shalamanov513ae732021-06-14 11:07:30 +0200368 void* bufData = mGralloc->lock(mBufferHandle->get(), mUsage, mAccessRegion, -1);
Valerie Hauc1dc3132019-06-13 09:49:44 -0700369 ASSERT_NO_FATAL_FAILURE(
370 ReadbackHelper::fillBuffer(mWidth, mHeight, mStride, bufData, mFormat, expectedColors));
Marin Shalamanov513ae732021-06-14 11:07:30 +0200371 mFillFence = mGralloc->unlock(mBufferHandle->get());
Valerie Haub019fd72019-05-23 12:50:12 -0700372 if (mFillFence != -1) {
373 sync_wait(mFillFence, -1);
374 close(mFillFence);
375 }
376}
Adam Bodnar5bf9dc62019-05-24 09:20:04 -0700377
Valerie Haub019fd72019-05-23 12:50:12 -0700378void TestBufferLayer::setBuffer(std::vector<IComposerClient::Color> colors) {
Marin Shalamanov513ae732021-06-14 11:07:30 +0200379 mBufferHandle.reset(new Gralloc::NativeHandleWrapper(
380 mGralloc->allocate(mWidth, mHeight, mLayerCount, mFormat, mUsage,
381 /*import*/ true, &mStride)));
382 ASSERT_NE(nullptr, mBufferHandle->get());
Valerie Haub019fd72019-05-23 12:50:12 -0700383 ASSERT_NO_FATAL_FAILURE(fillBuffer(colors));
Marin Shalamanov513ae732021-06-14 11:07:30 +0200384 ASSERT_NE(false, mGralloc->validateBufferSize(mBufferHandle->get(), mWidth, mHeight,
385 mLayerCount, mFormat, mUsage, mStride));
Valerie Haub019fd72019-05-23 12:50:12 -0700386}
387
Valerie Hau92d12262019-07-22 10:18:34 -0700388void TestBufferLayer::setDataspace(Dataspace dataspace,
389 const std::shared_ptr<CommandWriterBase>& writer) {
390 writer->selectLayer(mLayer);
391 writer->setLayerDataspace(dataspace);
392}
393
Valerie Haub019fd72019-05-23 12:50:12 -0700394void TestBufferLayer::setToClientComposition(const std::shared_ptr<CommandWriterBase>& writer) {
395 writer->selectLayer(mLayer);
396 writer->setLayerCompositionType(IComposerClient::Composition::CLIENT);
397}
398
399} // namespace vts
400} // namespace V2_2
401} // namespace composer
402} // namespace graphics
403} // namespace hardware
404} // namespace android