Setting layer dataspace to match the color mode
Bug: 135045017 Test: build, boot, VtsHalGraphicsComposerV2_2TargetTest Change-Id: I7188c53ca92895a98da062a248f6b781202671b8
This commit is contained in:
parent
b97e853841
commit
92d1226f9c
3 changed files with 304 additions and 179 deletions
|
@ -287,7 +287,6 @@ TestBufferLayer::~TestBufferLayer() {
|
||||||
void TestBufferLayer::write(const std::shared_ptr<CommandWriterBase>& writer) {
|
void TestBufferLayer::write(const std::shared_ptr<CommandWriterBase>& writer) {
|
||||||
TestLayer::write(writer);
|
TestLayer::write(writer);
|
||||||
writer->setLayerCompositionType(mComposition);
|
writer->setLayerCompositionType(mComposition);
|
||||||
writer->setLayerDataspace(Dataspace::UNKNOWN);
|
|
||||||
writer->setLayerVisibleRegion(std::vector<IComposerClient::Rect>(1, mDisplayFrame));
|
writer->setLayerVisibleRegion(std::vector<IComposerClient::Rect>(1, mDisplayFrame));
|
||||||
if (mBufferHandle != nullptr) writer->setLayerBuffer(0, mBufferHandle, mFillFence);
|
if (mBufferHandle != nullptr) writer->setLayerBuffer(0, mBufferHandle, mFillFence);
|
||||||
}
|
}
|
||||||
|
@ -337,6 +336,12 @@ void TestBufferLayer::setBuffer(std::vector<IComposerClient::Color> colors) {
|
||||||
mFormat, mUsage, mStride));
|
mFormat, mUsage, mStride));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TestBufferLayer::setDataspace(Dataspace dataspace,
|
||||||
|
const std::shared_ptr<CommandWriterBase>& writer) {
|
||||||
|
writer->selectLayer(mLayer);
|
||||||
|
writer->setLayerDataspace(dataspace);
|
||||||
|
}
|
||||||
|
|
||||||
void TestBufferLayer::setToClientComposition(const std::shared_ptr<CommandWriterBase>& writer) {
|
void TestBufferLayer::setToClientComposition(const std::shared_ptr<CommandWriterBase>& writer) {
|
||||||
writer->selectLayer(mLayer);
|
writer->selectLayer(mLayer);
|
||||||
writer->setLayerCompositionType(IComposerClient::Composition::CLIENT);
|
writer->setLayerCompositionType(IComposerClient::Composition::CLIENT);
|
||||||
|
|
|
@ -123,6 +123,8 @@ class TestBufferLayer : public TestLayer {
|
||||||
|
|
||||||
void setBuffer(std::vector<IComposerClient::Color> colors);
|
void setBuffer(std::vector<IComposerClient::Color> colors);
|
||||||
|
|
||||||
|
void setDataspace(Dataspace dataspace, const std::shared_ptr<CommandWriterBase>& writer);
|
||||||
|
|
||||||
void setToClientComposition(const std::shared_ptr<CommandWriterBase>& writer);
|
void setToClientComposition(const std::shared_ptr<CommandWriterBase>& writer);
|
||||||
|
|
||||||
uint32_t mWidth;
|
uint32_t mWidth;
|
||||||
|
|
|
@ -268,6 +268,7 @@ TEST_F(GraphicsComposerReadbackTest, SetLayerBuffer) {
|
||||||
PixelFormat::RGBA_8888);
|
PixelFormat::RGBA_8888);
|
||||||
layer->setDisplayFrame({0, 0, mDisplayWidth, mDisplayHeight});
|
layer->setDisplayFrame({0, 0, mDisplayWidth, mDisplayHeight});
|
||||||
layer->setZOrder(10);
|
layer->setZOrder(10);
|
||||||
|
layer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode), mWriter);
|
||||||
ASSERT_NO_FATAL_FAILURE(layer->setBuffer(expectedColors));
|
ASSERT_NO_FATAL_FAILURE(layer->setBuffer(expectedColors));
|
||||||
|
|
||||||
std::vector<std::shared_ptr<TestLayer>> layers = {layer};
|
std::vector<std::shared_ptr<TestLayer>> layers = {layer};
|
||||||
|
@ -398,6 +399,7 @@ TEST_F(GraphicsComposerReadbackTest, ClientComposition) {
|
||||||
PixelFormat::RGBA_FP16);
|
PixelFormat::RGBA_FP16);
|
||||||
layer->setDisplayFrame({0, 0, mDisplayWidth, mDisplayHeight});
|
layer->setDisplayFrame({0, 0, mDisplayWidth, mDisplayHeight});
|
||||||
layer->setZOrder(10);
|
layer->setZOrder(10);
|
||||||
|
layer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode), mWriter);
|
||||||
|
|
||||||
std::vector<std::shared_ptr<TestLayer>> layers = {layer};
|
std::vector<std::shared_ptr<TestLayer>> layers = {layer};
|
||||||
|
|
||||||
|
@ -519,6 +521,7 @@ TEST_F(GraphicsComposerReadbackTest, DeviceAndClientComposition) {
|
||||||
deviceLayer->setDisplayFrame({0, 0, static_cast<int32_t>(deviceLayer->mWidth),
|
deviceLayer->setDisplayFrame({0, 0, static_cast<int32_t>(deviceLayer->mWidth),
|
||||||
static_cast<int32_t>(deviceLayer->mHeight)});
|
static_cast<int32_t>(deviceLayer->mHeight)});
|
||||||
deviceLayer->setZOrder(10);
|
deviceLayer->setZOrder(10);
|
||||||
|
deviceLayer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode), mWriter);
|
||||||
ASSERT_NO_FATAL_FAILURE(deviceLayer->setBuffer(deviceColors));
|
ASSERT_NO_FATAL_FAILURE(deviceLayer->setBuffer(deviceColors));
|
||||||
deviceLayer->write(mWriter);
|
deviceLayer->write(mWriter);
|
||||||
|
|
||||||
|
@ -631,6 +634,7 @@ TEST_F(GraphicsComposerReadbackTest, SetLayerDamage) {
|
||||||
PixelFormat::RGBA_8888);
|
PixelFormat::RGBA_8888);
|
||||||
layer->setDisplayFrame({0, 0, mDisplayWidth, mDisplayHeight});
|
layer->setDisplayFrame({0, 0, mDisplayWidth, mDisplayHeight});
|
||||||
layer->setZOrder(10);
|
layer->setZOrder(10);
|
||||||
|
layer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode), mWriter);
|
||||||
ASSERT_NO_FATAL_FAILURE(layer->setBuffer(expectedColors));
|
ASSERT_NO_FATAL_FAILURE(layer->setBuffer(expectedColors));
|
||||||
|
|
||||||
std::vector<std::shared_ptr<TestLayer>> layers = {layer};
|
std::vector<std::shared_ptr<TestLayer>> layers = {layer};
|
||||||
|
@ -775,6 +779,7 @@ TEST_F(GraphicsComposerReadbackTest, SetLayerSourceCrop) {
|
||||||
PixelFormat::RGBA_8888);
|
PixelFormat::RGBA_8888);
|
||||||
layer->setDisplayFrame({0, 0, mDisplayWidth, mDisplayHeight});
|
layer->setDisplayFrame({0, 0, mDisplayWidth, mDisplayHeight});
|
||||||
layer->setZOrder(10);
|
layer->setZOrder(10);
|
||||||
|
layer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode), mWriter);
|
||||||
layer->setSourceCrop({0, static_cast<float>(mDisplayHeight / 2),
|
layer->setSourceCrop({0, static_cast<float>(mDisplayHeight / 2),
|
||||||
static_cast<float>(mDisplayWidth),
|
static_cast<float>(mDisplayWidth),
|
||||||
static_cast<float>(mDisplayHeight)});
|
static_cast<float>(mDisplayHeight)});
|
||||||
|
@ -894,6 +899,7 @@ class GraphicsComposerBlendModeReadbackTest : public GraphicsComposerReadbackTes
|
||||||
public:
|
public:
|
||||||
void SetUp() override {
|
void SetUp() override {
|
||||||
GraphicsComposerReadbackTest::SetUp();
|
GraphicsComposerReadbackTest::SetUp();
|
||||||
|
mTestColorModes = {ColorMode::SRGB}; // TODO: add more color mode support
|
||||||
mBackgroundColor = BLACK;
|
mBackgroundColor = BLACK;
|
||||||
mTopLayerColor = RED;
|
mTopLayerColor = RED;
|
||||||
}
|
}
|
||||||
|
@ -920,6 +926,7 @@ class GraphicsComposerBlendModeReadbackTest : public GraphicsComposerReadbackTes
|
||||||
PixelFormat::RGBA_8888);
|
PixelFormat::RGBA_8888);
|
||||||
layer->setDisplayFrame({0, 0, mDisplayWidth, mDisplayHeight});
|
layer->setDisplayFrame({0, 0, mDisplayWidth, mDisplayHeight});
|
||||||
layer->setZOrder(10);
|
layer->setZOrder(10);
|
||||||
|
layer->setDataspace(Dataspace::UNKNOWN, mWriter);
|
||||||
ASSERT_NO_FATAL_FAILURE(layer->setBuffer(topLayerPixelColors));
|
ASSERT_NO_FATAL_FAILURE(layer->setBuffer(topLayerPixelColors));
|
||||||
|
|
||||||
layer->setBlendMode(blendMode);
|
layer->setBlendMode(blendMode);
|
||||||
|
@ -970,109 +977,162 @@ class GraphicsComposerBlendModeReadbackTest : public GraphicsComposerReadbackTes
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST_P(GraphicsComposerBlendModeReadbackTest, None) {
|
TEST_P(GraphicsComposerBlendModeReadbackTest, None) {
|
||||||
if (!mHasReadbackBuffer) {
|
for (ColorMode mode : mTestColorModes) {
|
||||||
GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
|
std::cout << "---Testing Color Mode " << ReadbackHelper::getColorModeString(mode) << "---"
|
||||||
return;
|
<< std::endl;
|
||||||
|
mWriter->selectDisplay(mPrimaryDisplay);
|
||||||
|
ASSERT_NO_FATAL_FAILURE(
|
||||||
|
mComposerClient->setColorMode(mPrimaryDisplay, mode, RenderIntent::COLORIMETRIC));
|
||||||
|
|
||||||
|
mComposerClient->getRaw()->getReadbackBufferAttributes(
|
||||||
|
mPrimaryDisplay,
|
||||||
|
[&](const auto& tmpError, const auto& tmpPixelFormat, const auto& tmpDataspace) {
|
||||||
|
mHasReadbackBuffer = ReadbackHelper::readbackSupported(tmpPixelFormat,
|
||||||
|
tmpDataspace, tmpError);
|
||||||
|
mPixelFormat = tmpPixelFormat;
|
||||||
|
mDataspace = tmpDataspace;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!mHasReadbackBuffer) {
|
||||||
|
std::cout << "Readback not supported or unsupported pixelFormat/dataspace" << std::endl;
|
||||||
|
GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
mWriter->selectDisplay(mPrimaryDisplay);
|
||||||
|
|
||||||
|
std::vector<IComposerClient::Color> expectedColors(mDisplayWidth * mDisplayHeight);
|
||||||
|
|
||||||
|
setBackgroundColor(BLACK);
|
||||||
|
setTopLayerColor(TRANSLUCENT_RED);
|
||||||
|
setUpLayers(IComposerClient::BlendMode::NONE);
|
||||||
|
setExpectedColors(expectedColors);
|
||||||
|
|
||||||
|
ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mGralloc, mDisplayWidth,
|
||||||
|
mDisplayHeight, mPixelFormat, mDataspace);
|
||||||
|
ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer());
|
||||||
|
writeLayers(mLayers);
|
||||||
|
ASSERT_EQ(0, mReader->mErrors.size());
|
||||||
|
mWriter->validateDisplay();
|
||||||
|
execute();
|
||||||
|
if (mReader->mCompositionChanges.size() != 0) {
|
||||||
|
clearCommandReaderState();
|
||||||
|
GTEST_SUCCEED();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ASSERT_EQ(0, mReader->mErrors.size());
|
||||||
|
mWriter->presentDisplay();
|
||||||
|
execute();
|
||||||
|
ASSERT_EQ(0, mReader->mErrors.size());
|
||||||
|
|
||||||
|
ASSERT_NO_FATAL_FAILURE(readbackBuffer.checkReadbackBuffer(expectedColors));
|
||||||
}
|
}
|
||||||
|
|
||||||
mWriter->selectDisplay(mPrimaryDisplay);
|
|
||||||
|
|
||||||
std::vector<IComposerClient::Color> expectedColors(mDisplayWidth * mDisplayHeight);
|
|
||||||
|
|
||||||
setBackgroundColor(BLACK);
|
|
||||||
setTopLayerColor(TRANSLUCENT_RED);
|
|
||||||
setUpLayers(IComposerClient::BlendMode::NONE);
|
|
||||||
setExpectedColors(expectedColors);
|
|
||||||
|
|
||||||
ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mGralloc, mDisplayWidth,
|
|
||||||
mDisplayHeight, mPixelFormat, mDataspace);
|
|
||||||
ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer());
|
|
||||||
writeLayers(mLayers);
|
|
||||||
ASSERT_EQ(0, mReader->mErrors.size());
|
|
||||||
mWriter->validateDisplay();
|
|
||||||
execute();
|
|
||||||
if (mReader->mCompositionChanges.size() != 0) {
|
|
||||||
clearCommandReaderState();
|
|
||||||
GTEST_SUCCEED();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ASSERT_EQ(0, mReader->mErrors.size());
|
|
||||||
mWriter->presentDisplay();
|
|
||||||
execute();
|
|
||||||
ASSERT_EQ(0, mReader->mErrors.size());
|
|
||||||
|
|
||||||
ASSERT_NO_FATAL_FAILURE(readbackBuffer.checkReadbackBuffer(expectedColors));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: bug 116865056: Readback returns (245, 0, 0) for layer plane
|
// TODO: bug 116865056: Readback returns (245, 0, 0) for layer plane
|
||||||
// alpha of .2, expected 10.2
|
// alpha of .2, expected 10.2
|
||||||
TEST_P(GraphicsComposerBlendModeReadbackTest, DISABLED_Coverage) {
|
TEST_P(GraphicsComposerBlendModeReadbackTest, DISABLED_Coverage) {
|
||||||
if (!mHasReadbackBuffer) {
|
for (ColorMode mode : mTestColorModes) {
|
||||||
GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
|
std::cout << "---Testing Color Mode " << ReadbackHelper::getColorModeString(mode) << "---"
|
||||||
return;
|
<< std::endl;
|
||||||
|
mWriter->selectDisplay(mPrimaryDisplay);
|
||||||
|
ASSERT_NO_FATAL_FAILURE(
|
||||||
|
mComposerClient->setColorMode(mPrimaryDisplay, mode, RenderIntent::COLORIMETRIC));
|
||||||
|
|
||||||
|
mComposerClient->getRaw()->getReadbackBufferAttributes(
|
||||||
|
mPrimaryDisplay,
|
||||||
|
[&](const auto& tmpError, const auto& tmpPixelFormat, const auto& tmpDataspace) {
|
||||||
|
mHasReadbackBuffer = ReadbackHelper::readbackSupported(tmpPixelFormat,
|
||||||
|
tmpDataspace, tmpError);
|
||||||
|
mPixelFormat = tmpPixelFormat;
|
||||||
|
mDataspace = tmpDataspace;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!mHasReadbackBuffer) {
|
||||||
|
std::cout << "Readback not supported or unsupported pixelFormat/dataspace" << std::endl;
|
||||||
|
GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
mWriter->selectDisplay(mPrimaryDisplay);
|
||||||
|
|
||||||
|
std::vector<IComposerClient::Color> expectedColors(mDisplayWidth * mDisplayHeight);
|
||||||
|
|
||||||
|
setBackgroundColor(BLACK);
|
||||||
|
setTopLayerColor(TRANSLUCENT_RED);
|
||||||
|
|
||||||
|
setUpLayers(IComposerClient::BlendMode::COVERAGE);
|
||||||
|
setExpectedColors(expectedColors);
|
||||||
|
|
||||||
|
ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mGralloc, mDisplayWidth,
|
||||||
|
mDisplayHeight, mPixelFormat, mDataspace);
|
||||||
|
ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer());
|
||||||
|
writeLayers(mLayers);
|
||||||
|
ASSERT_EQ(0, mReader->mErrors.size());
|
||||||
|
mWriter->validateDisplay();
|
||||||
|
execute();
|
||||||
|
if (mReader->mCompositionChanges.size() != 0) {
|
||||||
|
clearCommandReaderState();
|
||||||
|
GTEST_SUCCEED();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ASSERT_EQ(0, mReader->mErrors.size());
|
||||||
|
mWriter->presentDisplay();
|
||||||
|
execute();
|
||||||
|
ASSERT_EQ(0, mReader->mErrors.size());
|
||||||
|
ASSERT_NO_FATAL_FAILURE(readbackBuffer.checkReadbackBuffer(expectedColors));
|
||||||
}
|
}
|
||||||
|
|
||||||
mWriter->selectDisplay(mPrimaryDisplay);
|
|
||||||
|
|
||||||
std::vector<IComposerClient::Color> expectedColors(mDisplayWidth * mDisplayHeight);
|
|
||||||
|
|
||||||
setBackgroundColor(BLACK);
|
|
||||||
setTopLayerColor(TRANSLUCENT_RED);
|
|
||||||
|
|
||||||
setUpLayers(IComposerClient::BlendMode::COVERAGE);
|
|
||||||
setExpectedColors(expectedColors);
|
|
||||||
|
|
||||||
ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mGralloc, mDisplayWidth,
|
|
||||||
mDisplayHeight, mPixelFormat, mDataspace);
|
|
||||||
ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer());
|
|
||||||
writeLayers(mLayers);
|
|
||||||
ASSERT_EQ(0, mReader->mErrors.size());
|
|
||||||
mWriter->validateDisplay();
|
|
||||||
execute();
|
|
||||||
if (mReader->mCompositionChanges.size() != 0) {
|
|
||||||
clearCommandReaderState();
|
|
||||||
GTEST_SUCCEED();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ASSERT_EQ(0, mReader->mErrors.size());
|
|
||||||
mWriter->presentDisplay();
|
|
||||||
execute();
|
|
||||||
ASSERT_EQ(0, mReader->mErrors.size());
|
|
||||||
ASSERT_NO_FATAL_FAILURE(readbackBuffer.checkReadbackBuffer(expectedColors));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_P(GraphicsComposerBlendModeReadbackTest, Premultiplied) {
|
TEST_P(GraphicsComposerBlendModeReadbackTest, Premultiplied) {
|
||||||
if (!mHasReadbackBuffer) {
|
for (ColorMode mode : mTestColorModes) {
|
||||||
GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
|
std::cout << "---Testing Color Mode " << ReadbackHelper::getColorModeString(mode) << "---"
|
||||||
return;
|
<< std::endl;
|
||||||
|
mWriter->selectDisplay(mPrimaryDisplay);
|
||||||
|
ASSERT_NO_FATAL_FAILURE(
|
||||||
|
mComposerClient->setColorMode(mPrimaryDisplay, mode, RenderIntent::COLORIMETRIC));
|
||||||
|
|
||||||
|
mComposerClient->getRaw()->getReadbackBufferAttributes(
|
||||||
|
mPrimaryDisplay,
|
||||||
|
[&](const auto& tmpError, const auto& tmpPixelFormat, const auto& tmpDataspace) {
|
||||||
|
mHasReadbackBuffer = ReadbackHelper::readbackSupported(tmpPixelFormat,
|
||||||
|
tmpDataspace, tmpError);
|
||||||
|
mPixelFormat = tmpPixelFormat;
|
||||||
|
mDataspace = tmpDataspace;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!mHasReadbackBuffer) {
|
||||||
|
std::cout << "Readback not supported or unsupported pixelFormat/dataspace" << std::endl;
|
||||||
|
GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
mWriter->selectDisplay(mPrimaryDisplay);
|
||||||
|
|
||||||
|
std::vector<IComposerClient::Color> expectedColors(mDisplayWidth * mDisplayHeight);
|
||||||
|
|
||||||
|
setBackgroundColor(BLACK);
|
||||||
|
setTopLayerColor(TRANSLUCENT_RED);
|
||||||
|
setUpLayers(IComposerClient::BlendMode::PREMULTIPLIED);
|
||||||
|
setExpectedColors(expectedColors);
|
||||||
|
|
||||||
|
ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mGralloc, mDisplayWidth,
|
||||||
|
mDisplayHeight, mPixelFormat, mDataspace);
|
||||||
|
ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer());
|
||||||
|
writeLayers(mLayers);
|
||||||
|
ASSERT_EQ(0, mReader->mErrors.size());
|
||||||
|
mWriter->validateDisplay();
|
||||||
|
execute();
|
||||||
|
if (mReader->mCompositionChanges.size() != 0) {
|
||||||
|
clearCommandReaderState();
|
||||||
|
GTEST_SUCCEED();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ASSERT_EQ(0, mReader->mErrors.size());
|
||||||
|
mWriter->presentDisplay();
|
||||||
|
execute();
|
||||||
|
ASSERT_EQ(0, mReader->mErrors.size());
|
||||||
|
ASSERT_NO_FATAL_FAILURE(readbackBuffer.checkReadbackBuffer(expectedColors));
|
||||||
}
|
}
|
||||||
|
|
||||||
mWriter->selectDisplay(mPrimaryDisplay);
|
|
||||||
|
|
||||||
std::vector<IComposerClient::Color> expectedColors(mDisplayWidth * mDisplayHeight);
|
|
||||||
|
|
||||||
setBackgroundColor(BLACK);
|
|
||||||
setTopLayerColor(TRANSLUCENT_RED);
|
|
||||||
setUpLayers(IComposerClient::BlendMode::PREMULTIPLIED);
|
|
||||||
setExpectedColors(expectedColors);
|
|
||||||
|
|
||||||
ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mGralloc, mDisplayWidth,
|
|
||||||
mDisplayHeight, mPixelFormat, mDataspace);
|
|
||||||
ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer());
|
|
||||||
writeLayers(mLayers);
|
|
||||||
ASSERT_EQ(0, mReader->mErrors.size());
|
|
||||||
mWriter->validateDisplay();
|
|
||||||
execute();
|
|
||||||
if (mReader->mCompositionChanges.size() != 0) {
|
|
||||||
clearCommandReaderState();
|
|
||||||
GTEST_SUCCEED();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ASSERT_EQ(0, mReader->mErrors.size());
|
|
||||||
mWriter->presentDisplay();
|
|
||||||
execute();
|
|
||||||
ASSERT_EQ(0, mReader->mErrors.size());
|
|
||||||
ASSERT_NO_FATAL_FAILURE(readbackBuffer.checkReadbackBuffer(expectedColors));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
INSTANTIATE_TEST_CASE_P(BlendModeTest, GraphicsComposerBlendModeReadbackTest,
|
INSTANTIATE_TEST_CASE_P(BlendModeTest, GraphicsComposerBlendModeReadbackTest,
|
||||||
|
@ -1117,102 +1177,160 @@ class GraphicsComposerTransformReadbackTest : public GraphicsComposerReadbackTes
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST_F(GraphicsComposerTransformReadbackTest, FLIP_H) {
|
TEST_F(GraphicsComposerTransformReadbackTest, FLIP_H) {
|
||||||
if (!mHasReadbackBuffer) {
|
for (ColorMode mode : mTestColorModes) {
|
||||||
GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
|
std::cout << "---Testing Color Mode " << ReadbackHelper::getColorModeString(mode) << "---"
|
||||||
return;
|
<< std::endl;
|
||||||
}
|
mWriter->selectDisplay(mPrimaryDisplay);
|
||||||
ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mGralloc, mDisplayWidth,
|
ASSERT_NO_FATAL_FAILURE(
|
||||||
mDisplayHeight, mPixelFormat, mDataspace);
|
mComposerClient->setColorMode(mPrimaryDisplay, mode, RenderIntent::COLORIMETRIC));
|
||||||
ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer());
|
|
||||||
mLayer->setTransform(Transform::FLIP_H);
|
|
||||||
std::vector<IComposerClient::Color> expectedColors(mDisplayWidth * mDisplayHeight);
|
|
||||||
ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth,
|
|
||||||
{mSideLength / 2, 0, mSideLength, mSideLength / 2}, RED);
|
|
||||||
ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth,
|
|
||||||
{0, mSideLength / 2, mSideLength / 2, mSideLength}, BLUE);
|
|
||||||
|
|
||||||
writeLayers(mLayers);
|
mComposerClient->getRaw()->getReadbackBufferAttributes(
|
||||||
ASSERT_EQ(0, mReader->mErrors.size());
|
mPrimaryDisplay,
|
||||||
mWriter->validateDisplay();
|
[&](const auto& tmpError, const auto& tmpPixelFormat, const auto& tmpDataspace) {
|
||||||
execute();
|
mHasReadbackBuffer = ReadbackHelper::readbackSupported(tmpPixelFormat,
|
||||||
if (mReader->mCompositionChanges.size() != 0) {
|
tmpDataspace, tmpError);
|
||||||
clearCommandReaderState();
|
mPixelFormat = tmpPixelFormat;
|
||||||
GTEST_SUCCEED();
|
mDataspace = tmpDataspace;
|
||||||
return;
|
});
|
||||||
}
|
|
||||||
ASSERT_EQ(0, mReader->mErrors.size());
|
|
||||||
mWriter->presentDisplay();
|
|
||||||
execute();
|
|
||||||
ASSERT_EQ(0, mReader->mErrors.size());
|
|
||||||
|
|
||||||
ASSERT_NO_FATAL_FAILURE(readbackBuffer.checkReadbackBuffer(expectedColors));
|
if (!mHasReadbackBuffer) {
|
||||||
|
std::cout << "Readback not supported or unsupported pixelFormat/dataspace" << std::endl;
|
||||||
|
GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mGralloc, mDisplayWidth,
|
||||||
|
mDisplayHeight, mPixelFormat, mDataspace);
|
||||||
|
ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer());
|
||||||
|
mLayer->setTransform(Transform::FLIP_H);
|
||||||
|
mLayer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode), mWriter);
|
||||||
|
|
||||||
|
std::vector<IComposerClient::Color> expectedColors(mDisplayWidth * mDisplayHeight);
|
||||||
|
ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth,
|
||||||
|
{mSideLength / 2, 0, mSideLength, mSideLength / 2}, RED);
|
||||||
|
ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth,
|
||||||
|
{0, mSideLength / 2, mSideLength / 2, mSideLength}, BLUE);
|
||||||
|
|
||||||
|
writeLayers(mLayers);
|
||||||
|
ASSERT_EQ(0, mReader->mErrors.size());
|
||||||
|
mWriter->validateDisplay();
|
||||||
|
execute();
|
||||||
|
if (mReader->mCompositionChanges.size() != 0) {
|
||||||
|
clearCommandReaderState();
|
||||||
|
GTEST_SUCCEED();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ASSERT_EQ(0, mReader->mErrors.size());
|
||||||
|
mWriter->presentDisplay();
|
||||||
|
execute();
|
||||||
|
ASSERT_EQ(0, mReader->mErrors.size());
|
||||||
|
|
||||||
|
ASSERT_NO_FATAL_FAILURE(readbackBuffer.checkReadbackBuffer(expectedColors));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(GraphicsComposerTransformReadbackTest, FLIP_V) {
|
TEST_F(GraphicsComposerTransformReadbackTest, FLIP_V) {
|
||||||
if (!mHasReadbackBuffer) {
|
for (ColorMode mode : mTestColorModes) {
|
||||||
GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
|
std::cout << "---Testing Color Mode " << ReadbackHelper::getColorModeString(mode) << "---"
|
||||||
return;
|
<< std::endl;
|
||||||
|
mWriter->selectDisplay(mPrimaryDisplay);
|
||||||
|
ASSERT_NO_FATAL_FAILURE(
|
||||||
|
mComposerClient->setColorMode(mPrimaryDisplay, mode, RenderIntent::COLORIMETRIC));
|
||||||
|
|
||||||
|
mComposerClient->getRaw()->getReadbackBufferAttributes(
|
||||||
|
mPrimaryDisplay,
|
||||||
|
[&](const auto& tmpError, const auto& tmpPixelFormat, const auto& tmpDataspace) {
|
||||||
|
mHasReadbackBuffer = ReadbackHelper::readbackSupported(tmpPixelFormat,
|
||||||
|
tmpDataspace, tmpError);
|
||||||
|
mPixelFormat = tmpPixelFormat;
|
||||||
|
mDataspace = tmpDataspace;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!mHasReadbackBuffer) {
|
||||||
|
std::cout << "Readback not supported or unsupported pixelFormat/dataspace" << std::endl;
|
||||||
|
GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mGralloc, mDisplayWidth,
|
||||||
|
mDisplayHeight, mPixelFormat, mDataspace);
|
||||||
|
ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer());
|
||||||
|
|
||||||
|
mLayer->setTransform(Transform::FLIP_V);
|
||||||
|
mLayer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode), mWriter);
|
||||||
|
|
||||||
|
std::vector<IComposerClient::Color> expectedColors(mDisplayWidth * mDisplayHeight);
|
||||||
|
ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth,
|
||||||
|
{0, mSideLength / 2, mSideLength / 2, mSideLength}, RED);
|
||||||
|
ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth,
|
||||||
|
{mSideLength / 2, 0, mSideLength, mSideLength / 2}, BLUE);
|
||||||
|
|
||||||
|
writeLayers(mLayers);
|
||||||
|
ASSERT_EQ(0, mReader->mErrors.size());
|
||||||
|
mWriter->validateDisplay();
|
||||||
|
execute();
|
||||||
|
if (mReader->mCompositionChanges.size() != 0) {
|
||||||
|
clearCommandReaderState();
|
||||||
|
GTEST_SUCCEED();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ASSERT_EQ(0, mReader->mErrors.size());
|
||||||
|
mWriter->presentDisplay();
|
||||||
|
execute();
|
||||||
|
ASSERT_EQ(0, mReader->mErrors.size());
|
||||||
|
ASSERT_NO_FATAL_FAILURE(readbackBuffer.checkReadbackBuffer(expectedColors));
|
||||||
}
|
}
|
||||||
ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mGralloc, mDisplayWidth,
|
|
||||||
mDisplayHeight, mPixelFormat, mDataspace);
|
|
||||||
ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer());
|
|
||||||
|
|
||||||
mLayer->setTransform(Transform::FLIP_V);
|
|
||||||
|
|
||||||
std::vector<IComposerClient::Color> expectedColors(mDisplayWidth * mDisplayHeight);
|
|
||||||
ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth,
|
|
||||||
{0, mSideLength / 2, mSideLength / 2, mSideLength}, RED);
|
|
||||||
ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth,
|
|
||||||
{mSideLength / 2, 0, mSideLength, mSideLength / 2}, BLUE);
|
|
||||||
|
|
||||||
writeLayers(mLayers);
|
|
||||||
ASSERT_EQ(0, mReader->mErrors.size());
|
|
||||||
mWriter->validateDisplay();
|
|
||||||
execute();
|
|
||||||
if (mReader->mCompositionChanges.size() != 0) {
|
|
||||||
clearCommandReaderState();
|
|
||||||
GTEST_SUCCEED();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ASSERT_EQ(0, mReader->mErrors.size());
|
|
||||||
mWriter->presentDisplay();
|
|
||||||
execute();
|
|
||||||
ASSERT_EQ(0, mReader->mErrors.size());
|
|
||||||
ASSERT_NO_FATAL_FAILURE(readbackBuffer.checkReadbackBuffer(expectedColors));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(GraphicsComposerTransformReadbackTest, ROT_180) {
|
TEST_F(GraphicsComposerTransformReadbackTest, ROT_180) {
|
||||||
if (!mHasReadbackBuffer) {
|
for (ColorMode mode : mTestColorModes) {
|
||||||
GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
|
std::cout << "---Testing Color Mode " << ReadbackHelper::getColorModeString(mode) << "---"
|
||||||
return;
|
<< std::endl;
|
||||||
|
mWriter->selectDisplay(mPrimaryDisplay);
|
||||||
|
ASSERT_NO_FATAL_FAILURE(
|
||||||
|
mComposerClient->setColorMode(mPrimaryDisplay, mode, RenderIntent::COLORIMETRIC));
|
||||||
|
|
||||||
|
mComposerClient->getRaw()->getReadbackBufferAttributes(
|
||||||
|
mPrimaryDisplay,
|
||||||
|
[&](const auto& tmpError, const auto& tmpPixelFormat, const auto& tmpDataspace) {
|
||||||
|
mHasReadbackBuffer = ReadbackHelper::readbackSupported(tmpPixelFormat,
|
||||||
|
tmpDataspace, tmpError);
|
||||||
|
mPixelFormat = tmpPixelFormat;
|
||||||
|
mDataspace = tmpDataspace;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!mHasReadbackBuffer) {
|
||||||
|
std::cout << "Readback not supported or unsupported pixelFormat/dataspace" << std::endl;
|
||||||
|
GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mGralloc, mDisplayWidth,
|
||||||
|
mDisplayHeight, mPixelFormat, mDataspace);
|
||||||
|
ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer());
|
||||||
|
|
||||||
|
mLayer->setTransform(Transform::ROT_180);
|
||||||
|
mLayer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode), mWriter);
|
||||||
|
|
||||||
|
std::vector<IComposerClient::Color> expectedColors(mDisplayWidth * mDisplayHeight);
|
||||||
|
ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth,
|
||||||
|
{mSideLength / 2, mSideLength / 2, mSideLength, mSideLength},
|
||||||
|
RED);
|
||||||
|
ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth,
|
||||||
|
{0, 0, mSideLength / 2, mSideLength / 2}, BLUE);
|
||||||
|
|
||||||
|
writeLayers(mLayers);
|
||||||
|
ASSERT_EQ(0, mReader->mErrors.size());
|
||||||
|
mWriter->validateDisplay();
|
||||||
|
execute();
|
||||||
|
if (mReader->mCompositionChanges.size() != 0) {
|
||||||
|
clearCommandReaderState();
|
||||||
|
GTEST_SUCCEED();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ASSERT_EQ(0, mReader->mErrors.size());
|
||||||
|
mWriter->presentDisplay();
|
||||||
|
execute();
|
||||||
|
ASSERT_EQ(0, mReader->mErrors.size());
|
||||||
|
ASSERT_NO_FATAL_FAILURE(readbackBuffer.checkReadbackBuffer(expectedColors));
|
||||||
}
|
}
|
||||||
ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mGralloc, mDisplayWidth,
|
|
||||||
mDisplayHeight, mPixelFormat, mDataspace);
|
|
||||||
ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer());
|
|
||||||
|
|
||||||
mLayer->setTransform(Transform::ROT_180);
|
|
||||||
|
|
||||||
std::vector<IComposerClient::Color> expectedColors(mDisplayWidth * mDisplayHeight);
|
|
||||||
ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth,
|
|
||||||
{mSideLength / 2, mSideLength / 2, mSideLength, mSideLength},
|
|
||||||
RED);
|
|
||||||
ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth,
|
|
||||||
{0, 0, mSideLength / 2, mSideLength / 2}, BLUE);
|
|
||||||
|
|
||||||
writeLayers(mLayers);
|
|
||||||
ASSERT_EQ(0, mReader->mErrors.size());
|
|
||||||
mWriter->validateDisplay();
|
|
||||||
execute();
|
|
||||||
if (mReader->mCompositionChanges.size() != 0) {
|
|
||||||
clearCommandReaderState();
|
|
||||||
GTEST_SUCCEED();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ASSERT_EQ(0, mReader->mErrors.size());
|
|
||||||
mWriter->presentDisplay();
|
|
||||||
execute();
|
|
||||||
ASSERT_EQ(0, mReader->mErrors.size());
|
|
||||||
ASSERT_NO_FATAL_FAILURE(readbackBuffer.checkReadbackBuffer(expectedColors));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // anonymous namespace
|
} // anonymous namespace
|
||||||
|
|
Loading…
Reference in a new issue