Merge changes from topics "b_208879711", "hwc_present_time"

* changes:
  composer: DisplayCommand.colorTransform is just a matrix
  composer: pass expetcedPresentTime
This commit is contained in:
Ady Abraham 2021-12-22 23:14:05 +00:00 committed by Android (Google) Code Review
commit 5b2858b709
7 changed files with 168 additions and 61 deletions

View file

@ -33,7 +33,6 @@
package android.hardware.graphics.composer3;
@VintfStability
parcelable ColorTransformPayload {
float[] matrix;
android.hardware.graphics.common.ColorTransform hint;
parcelable ClockMonotonicTimestamp {
long timestamp;
}

View file

@ -36,9 +36,10 @@ package android.hardware.graphics.composer3;
parcelable DisplayCommand {
long display;
android.hardware.graphics.composer3.LayerCommand[] layers;
@nullable android.hardware.graphics.composer3.ColorTransformPayload colorTransform;
@nullable float[] colorTransformMatrix;
@nullable android.hardware.graphics.composer3.ClientTarget clientTarget;
@nullable android.hardware.graphics.composer3.Buffer virtualDisplayOutputBuffer;
@nullable android.hardware.graphics.composer3.ClockMonotonicTimestamp expectedPresentTime;
boolean validateDisplay;
boolean acceptDisplayChanges;
boolean presentDisplay;

View file

@ -16,18 +16,10 @@
package android.hardware.graphics.composer3;
import android.hardware.graphics.common.ColorTransform;
/**
* Represents a nanoseconds timestamp in CLOCK_MONOTONIC.
*/
@VintfStability
parcelable ColorTransformPayload {
/**
* 4x4 transform matrix (16 floats) as described in DisplayCommand.colorTransform.
*/
float[] matrix;
/**
* Hint value which may be used instead of the given matrix unless it
* is ColorTransform.ARBITRARY.
*/
ColorTransform hint;
parcelable ClockMonotonicTimestamp {
long timestamp;
}

View file

@ -18,7 +18,7 @@ package android.hardware.graphics.composer3;
import android.hardware.graphics.composer3.Buffer;
import android.hardware.graphics.composer3.ClientTarget;
import android.hardware.graphics.composer3.ColorTransformPayload;
import android.hardware.graphics.composer3.ClockMonotonicTimestamp;
import android.hardware.graphics.composer3.LayerCommand;
@VintfStability
@ -38,11 +38,7 @@ parcelable DisplayCommand {
/**
* Sets a color transform which will be applied after composition.
*
* If hint is not ColorTransform.ARBITRARY, then the device may use the
* hint to apply the desired color transform instead of using the color
* matrix directly.
*
* If the device is not capable of either using the hint or the matrix to
* If the device is not capable of either using the matrix to
* apply the desired color transform, it must force all layers to client
* composition during VALIDATE_DISPLAY.
*
@ -70,7 +66,7 @@ parcelable DisplayCommand {
* B_out = R_in * r.b + G_in * g.b + B_in * b.b + Tb
*
*/
@nullable ColorTransformPayload colorTransform;
@nullable float[] colorTransformMatrix;
/**
* Sets the buffer handle which will receive the output of client
@ -114,6 +110,14 @@ parcelable DisplayCommand {
*/
@nullable Buffer virtualDisplayOutputBuffer;
/**
* Sets the expected present time to present the current content on screen.
* The implementation should try to present the display as close as possible
* to the given expectedPresentTime. If expectedPresentTime is 0, the
* implementation should present the display as soon as possible.
*/
@nullable ClockMonotonicTimestamp expectedPresentTime;
/**
* Instructs the device to inspect all of the layer state and determine if
* there are any composition type changes necessary before presenting the

View file

@ -258,7 +258,7 @@ TEST_P(GraphicsCompositionTest, SingleSolidColorLayer) {
writeLayers(layers);
ASSERT_TRUE(mReader.takeErrors().empty());
mWriter.validateDisplay(mPrimaryDisplay);
mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
execute();
// if hwc cannot handle and asks for composition change,
// just succeed the test
@ -317,7 +317,7 @@ TEST_P(GraphicsCompositionTest, SetLayerBuffer) {
writeLayers(layers);
ASSERT_TRUE(mReader.takeErrors().empty());
mWriter.validateDisplay(mPrimaryDisplay);
mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
execute();
std::vector<int64_t> changedCompositionLayers;
@ -377,7 +377,7 @@ TEST_P(GraphicsCompositionTest, SetLayerBufferNoEffect) {
mDisplayWidth, mDisplayHeight, mPixelFormat, mDataspace);
ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer());
mWriter.validateDisplay(mPrimaryDisplay);
mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
execute();
std::vector<int64_t> changedCompositionLayers;
@ -492,7 +492,7 @@ TEST_P(GraphicsCompositionTest, ClientComposition) {
ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer());
writeLayers(layers);
ASSERT_TRUE(mReader.takeErrors().empty());
mWriter.validateDisplay(mPrimaryDisplay);
mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
execute();
std::vector<int64_t> changedCompositionLayers;
@ -606,7 +606,7 @@ TEST_P(GraphicsCompositionTest, DeviceAndClientComposition) {
clientLayer->setDisplayFrame(clientFrame);
clientLayer->setZOrder(0);
clientLayer->write(mWriter);
mWriter.validateDisplay(mPrimaryDisplay);
mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
execute();
std::vector<int64_t> changedCompositionLayers;
@ -685,7 +685,7 @@ TEST_P(GraphicsCompositionTest, SetLayerDamage) {
writeLayers(layers);
ASSERT_TRUE(mReader.takeErrors().empty());
mWriter.validateDisplay(mPrimaryDisplay);
mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
execute();
std::vector<int64_t> changedCompositionLayers;
std::vector<Composition> changedCompositionTypes;
@ -715,7 +715,7 @@ TEST_P(GraphicsCompositionTest, SetLayerDamage) {
writeLayers(layers);
ASSERT_TRUE(mReader.takeErrors().empty());
mWriter.validateDisplay(mPrimaryDisplay);
mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
execute();
ASSERT_TRUE(mReader.takeErrors().empty());
mReader.takeChangedCompositionTypes(mPrimaryDisplay, &changedCompositionLayers,
@ -756,7 +756,7 @@ TEST_P(GraphicsCompositionTest, SetLayerPlaneAlpha) {
writeLayers(layers);
ASSERT_TRUE(mReader.takeErrors().empty());
mWriter.validateDisplay(mPrimaryDisplay);
mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
execute();
std::vector<int64_t> changedCompositionLayers;
std::vector<Composition> changedCompositionTypes;
@ -819,7 +819,7 @@ TEST_P(GraphicsCompositionTest, SetLayerSourceCrop) {
ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer());
writeLayers(layers);
ASSERT_TRUE(mReader.takeErrors().empty());
mWriter.validateDisplay(mPrimaryDisplay);
mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
execute();
std::vector<int64_t> changedCompositionLayers;
std::vector<Composition> changedCompositionTypes;
@ -877,7 +877,7 @@ TEST_P(GraphicsCompositionTest, SetLayerZOrder) {
writeLayers(layers);
ASSERT_TRUE(mReader.takeErrors().empty());
mWriter.validateDisplay(mPrimaryDisplay);
mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
execute();
std::vector<int64_t> changedCompositionLayers;
std::vector<Composition> changedCompositionTypes;
@ -902,7 +902,7 @@ TEST_P(GraphicsCompositionTest, SetLayerZOrder) {
writeLayers(layers);
ASSERT_TRUE(mReader.takeErrors().empty());
mWriter.validateDisplay(mPrimaryDisplay);
mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
execute();
mReader.takeChangedCompositionTypes(mPrimaryDisplay, &changedCompositionLayers,
&changedCompositionTypes);
@ -1027,7 +1027,7 @@ TEST_P(GraphicsBlendModeCompositionTest, None) {
ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer());
writeLayers(mLayers);
ASSERT_TRUE(mReader.takeErrors().empty());
mWriter.validateDisplay(mPrimaryDisplay);
mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
execute();
std::vector<int64_t> changedCompositionLayers;
std::vector<Composition> changedCompositionTypes;
@ -1072,7 +1072,7 @@ TEST_P(GraphicsBlendModeCompositionTest, Coverage) {
ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer());
writeLayers(mLayers);
ASSERT_TRUE(mReader.takeErrors().empty());
mWriter.validateDisplay(mPrimaryDisplay);
mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
execute();
std::vector<int64_t> changedCompositionLayers;
std::vector<Composition> changedCompositionTypes;
@ -1112,7 +1112,7 @@ TEST_P(GraphicsBlendModeCompositionTest, Premultiplied) {
ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer());
writeLayers(mLayers);
ASSERT_TRUE(mReader.takeErrors().empty());
mWriter.validateDisplay(mPrimaryDisplay);
mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
execute();
std::vector<int64_t> changedCompositionLayers;
std::vector<Composition> changedCompositionTypes;
@ -1195,7 +1195,7 @@ TEST_P(GraphicsTransformCompositionTest, FLIP_H) {
writeLayers(mLayers);
ASSERT_TRUE(mReader.takeErrors().empty());
mWriter.validateDisplay(mPrimaryDisplay);
mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
execute();
std::vector<int64_t> changedCompositionLayers;
std::vector<Composition> changedCompositionTypes;
@ -1241,7 +1241,7 @@ TEST_P(GraphicsTransformCompositionTest, FLIP_V) {
writeLayers(mLayers);
ASSERT_TRUE(mReader.takeErrors().empty());
mWriter.validateDisplay(mPrimaryDisplay);
mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
execute();
std::vector<int64_t> changedCompositionLayers;
std::vector<Composition> changedCompositionTypes;
@ -1287,7 +1287,7 @@ TEST_P(GraphicsTransformCompositionTest, ROT_180) {
writeLayers(mLayers);
ASSERT_TRUE(mReader.takeErrors().empty());
mWriter.validateDisplay(mPrimaryDisplay);
mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
execute();
std::vector<int64_t> layers;
std::vector<Composition> types;

View file

@ -17,6 +17,7 @@
#include <android/hardware/graphics/composer3/ComposerClientWriter.h>
#include <binder/ProcessState.h>
#include <gtest/gtest.h>
#include <ui/Fence.h>
#include <ui/GraphicBuffer.h>
#include <ui/PixelFormat.h>
#include <algorithm>
@ -993,14 +994,14 @@ TEST_P(GraphicsComposerAidlTest, SetActiveConfigPowerCycle) {
TEST_P(GraphicsComposerAidlTest, SetPowerModeUnsupported) {
std::vector<DisplayCapability> capabilities;
const auto error = mComposerClient->getDisplayCapabilities(mPrimaryDisplay, &capabilities);
auto error = mComposerClient->getDisplayCapabilities(mPrimaryDisplay, &capabilities);
ASSERT_TRUE(error.isOk());
const bool isDozeSupported = std::find(capabilities.begin(), capabilities.end(),
DisplayCapability::DOZE) != capabilities.end();
const bool isSuspendSupported = std::find(capabilities.begin(), capabilities.end(),
DisplayCapability::SUSPEND) != capabilities.end();
if (!isDozeSupported) {
auto error = mComposerClient->setPowerMode(mPrimaryDisplay, PowerMode::DOZE);
error = mComposerClient->setPowerMode(mPrimaryDisplay, PowerMode::DOZE);
EXPECT_FALSE(error.isOk());
EXPECT_EQ(IComposerClient::EX_UNSUPPORTED, error.getServiceSpecificError());
@ -1010,7 +1011,7 @@ TEST_P(GraphicsComposerAidlTest, SetPowerModeUnsupported) {
}
if (!isSuspendSupported) {
auto error = mComposerClient->setPowerMode(mPrimaryDisplay, PowerMode::ON_SUSPEND);
error = mComposerClient->setPowerMode(mPrimaryDisplay, PowerMode::ON_SUSPEND);
EXPECT_FALSE(error.isOk());
EXPECT_EQ(IComposerClient::EX_UNSUPPORTED, error.getServiceSpecificError());
@ -1283,7 +1284,7 @@ class GraphicsComposerAidlCommandTest : public GraphicsComposerAidlTest {
mWriter.setLayerBuffer(display.get(), layer, 0, buffer->handle, -1);
mWriter.setLayerDataspace(display.get(), layer, common::Dataspace::UNKNOWN);
mWriter.validateDisplay(display.get());
mWriter.validateDisplay(display.get(), ComposerClientWriter::kNoTimestamp);
execute();
ASSERT_TRUE(mReader.takeErrors().empty());
@ -1299,7 +1300,7 @@ class GraphicsComposerAidlCommandTest : public GraphicsComposerAidlTest {
mWriter.setLayerBuffer(display.get(), layer, 0, buffer->handle, -1);
mWriter.setLayerSurfaceDamage(display.get(), layer,
std::vector<Rect>(1, {0, 0, 10, 10}));
mWriter.validateDisplay(display.get());
mWriter.validateDisplay(display.get(), ComposerClientWriter::kNoTimestamp);
execute();
ASSERT_TRUE(mReader.takeErrors().empty());
@ -1310,6 +1311,53 @@ class GraphicsComposerAidlCommandTest : public GraphicsComposerAidlTest {
ASSERT_NO_FATAL_FAILURE(destroyLayer(display, layer));
}
sp<::android::Fence> presentAndGetFence(
std::optional<ClockMonotonicTimestamp> expectedPresentTime) {
mWriter.validateDisplay(mPrimaryDisplay, expectedPresentTime);
execute();
EXPECT_TRUE(mReader.takeErrors().empty());
mWriter.presentDisplay(mPrimaryDisplay);
execute();
EXPECT_TRUE(mReader.takeErrors().empty());
int presentFence;
mReader.takePresentFence(mPrimaryDisplay, &presentFence);
EXPECT_NE(-1, presentFence);
return sp<::android::Fence>::make(presentFence);
}
int32_t getVsyncPeriod() {
int32_t activeConfig;
EXPECT_TRUE(mComposerClient->getActiveConfig(mPrimaryDisplay, &activeConfig).isOk());
int32_t vsyncPeriod;
EXPECT_TRUE(mComposerClient
->getDisplayAttribute(mPrimaryDisplay, activeConfig,
DisplayAttribute::VSYNC_PERIOD, &vsyncPeriod)
.isOk());
return vsyncPeriod;
}
int64_t createOnScreenLayer() {
const int64_t layer = createLayer(mDisplays[0]);
mWriter.setLayerCompositionType(mPrimaryDisplay, layer, Composition::DEVICE);
mWriter.setLayerDisplayFrame(mPrimaryDisplay, layer, {0, 0, mDisplayWidth, mDisplayHeight});
mWriter.setLayerPlaneAlpha(mPrimaryDisplay, layer, 1);
mWriter.setLayerSourceCrop(
mPrimaryDisplay, layer,
{0, 0, static_cast<float>(mDisplayWidth), static_cast<float>(mDisplayHeight)});
mWriter.setLayerTransform(mPrimaryDisplay, layer, static_cast<Transform>(0));
mWriter.setLayerVisibleRegion(mPrimaryDisplay, layer,
std::vector<Rect>(1, {0, 0, mDisplayWidth, mDisplayHeight}));
mWriter.setLayerZOrder(mPrimaryDisplay, layer, 10);
mWriter.setLayerBlendMode(mPrimaryDisplay, layer, BlendMode::NONE);
mWriter.setLayerSurfaceDamage(mPrimaryDisplay, layer,
std::vector<Rect>(1, {0, 0, mDisplayWidth, mDisplayHeight}));
mWriter.setLayerDataspace(mPrimaryDisplay, layer, common::Dataspace::UNKNOWN);
return layer;
}
void Test_setActiveConfigWithConstraints(const TestParameters& params) {
for (VtsDisplay& display : mDisplays) {
forEachTwoConfigs(display.get(), [&](int32_t config1, int32_t config2) {
@ -1400,6 +1448,47 @@ class GraphicsComposerAidlCommandTest : public GraphicsComposerAidlTest {
}
}
void Test_expectedPresentTime(std::optional<int> framesDelay) {
ASSERT_TRUE(mComposerClient->setPowerMode(mPrimaryDisplay, PowerMode::ON).isOk());
const auto vsyncPeriod = getVsyncPeriod();
const auto buffer1 = allocate();
const auto buffer2 = allocate();
ASSERT_NE(nullptr, buffer1);
ASSERT_NE(nullptr, buffer2);
const auto layer = createOnScreenLayer();
mWriter.setLayerBuffer(mPrimaryDisplay, layer, 0, buffer1->handle, -1);
const sp<::android::Fence> presentFence1 =
presentAndGetFence(ComposerClientWriter::kNoTimestamp);
presentFence1->waitForever(LOG_TAG);
auto expectedPresentTime = presentFence1->getSignalTime() + vsyncPeriod;
if (framesDelay.has_value()) {
expectedPresentTime += *framesDelay * vsyncPeriod;
}
mWriter.setLayerBuffer(mPrimaryDisplay, layer, 0, buffer2->handle, -1);
const auto setExpectedPresentTime = [&]() -> std::optional<ClockMonotonicTimestamp> {
if (!framesDelay.has_value()) {
return ComposerClientWriter::kNoTimestamp;
} else if (*framesDelay == 0) {
return ClockMonotonicTimestamp{0};
}
return ClockMonotonicTimestamp{expectedPresentTime};
}();
const sp<::android::Fence> presentFence2 = presentAndGetFence(setExpectedPresentTime);
presentFence2->waitForever(LOG_TAG);
const auto actualPresentTime = presentFence2->getSignalTime();
const auto presentError = std::abs(expectedPresentTime - actualPresentTime);
EXPECT_LE(presentError, vsyncPeriod / 2);
ASSERT_TRUE(mComposerClient->setPowerMode(mPrimaryDisplay, PowerMode::OFF).isOk());
}
// clang-format off
const std::array<float, 16> kIdentity = {{
1.0f, 0.0f, 0.0f, 0.0f,
@ -1414,7 +1503,7 @@ class GraphicsComposerAidlCommandTest : public GraphicsComposerAidlTest {
};
TEST_P(GraphicsComposerAidlCommandTest, SET_COLOR_TRANSFORM) {
mWriter.setColorTransform(mPrimaryDisplay, kIdentity.data(), ColorTransform::IDENTITY);
mWriter.setColorTransform(mPrimaryDisplay, kIdentity.data());
execute();
}
@ -1462,19 +1551,19 @@ TEST_P(GraphicsComposerAidlCommandTest, SET_OUTPUT_BUFFER) {
}
TEST_P(GraphicsComposerAidlCommandTest, VALIDATE_DISPLAY) {
mWriter.validateDisplay(mPrimaryDisplay);
mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
execute();
}
TEST_P(GraphicsComposerAidlCommandTest, ACCEPT_DISPLAY_CHANGES) {
mWriter.validateDisplay(mPrimaryDisplay);
mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
mWriter.acceptDisplayChanges(mPrimaryDisplay);
execute();
}
// TODO(b/208441745) fix the test failure
TEST_P(GraphicsComposerAidlCommandTest, PRESENT_DISPLAY) {
mWriter.validateDisplay(mPrimaryDisplay);
mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
mWriter.presentDisplay(mPrimaryDisplay);
execute();
}
@ -1523,7 +1612,7 @@ TEST_P(GraphicsComposerAidlCommandTest, PRESENT_DISPLAY_NO_LAYER_STATE_CHANGES)
mWriter.setLayerBuffer(mPrimaryDisplay, layer, 0, handle, -1);
mWriter.setLayerDataspace(mPrimaryDisplay, layer, Dataspace::UNKNOWN);
mWriter.validateDisplay(mPrimaryDisplay);
mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
execute();
std::vector<int64_t> layers;
std::vector<Composition> types;
@ -1570,7 +1659,7 @@ TEST_P(GraphicsComposerAidlCommandTest, SET_LAYER_CURSOR_POSITION) {
mWriter.setLayerBlendMode(mPrimaryDisplay, layer, BlendMode::NONE);
mWriter.setLayerSurfaceDamage(mPrimaryDisplay, layer, std::vector<Rect>(1, displayFrame));
mWriter.setLayerDataspace(mPrimaryDisplay, layer, Dataspace::UNKNOWN);
mWriter.validateDisplay(mPrimaryDisplay);
mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
execute();
std::vector<int64_t> layers;
@ -1587,7 +1676,7 @@ TEST_P(GraphicsComposerAidlCommandTest, SET_LAYER_CURSOR_POSITION) {
execute();
mWriter.setLayerCursorPosition(mPrimaryDisplay, layer, 0, 0);
mWriter.validateDisplay(mPrimaryDisplay);
mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
mWriter.presentDisplay(mPrimaryDisplay);
execute();
}
@ -1947,6 +2036,18 @@ TEST_P(GraphicsComposerAidlCommandTest, setActiveConfigWithConstraints_SeamlessN
}
}
TEST_P(GraphicsComposerAidlCommandTest, expectedPresentTime_NoTimestamp) {
ASSERT_NO_FATAL_FAILURE(Test_expectedPresentTime(std::nullopt));
}
TEST_P(GraphicsComposerAidlCommandTest, expectedPresentTime_0) {
ASSERT_NO_FATAL_FAILURE(Test_expectedPresentTime(0));
}
TEST_P(GraphicsComposerAidlCommandTest, expectedPresentTime_5) {
ASSERT_NO_FATAL_FAILURE(Test_expectedPresentTime(5));
}
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(GraphicsComposerAidlCommandTest);
INSTANTIATE_TEST_SUITE_P(
PerInstance, GraphicsComposerAidlCommandTest,

View file

@ -63,6 +63,8 @@ namespace aidl::android::hardware::graphics::composer3 {
class ComposerClientWriter {
public:
static constexpr std::optional<ClockMonotonicTimestamp> kNoTimestamp = std::nullopt;
ComposerClientWriter() { reset(); }
virtual ~ComposerClientWriter() { reset(); }
@ -73,11 +75,11 @@ class ComposerClientWriter {
mCommands.clear();
}
void setColorTransform(int64_t display, const float* matrix, ColorTransform hint) {
ColorTransformPayload colorTransformPayload;
colorTransformPayload.matrix.assign(matrix, matrix + 16);
colorTransformPayload.hint = hint;
getDisplayCommand(display).colorTransform.emplace(std::move(colorTransformPayload));
void setColorTransform(int64_t display, const float* matrix) {
std::vector<float> matVec;
matVec.reserve(16);
matVec.assign(matrix, matrix + 16);
getDisplayCommand(display).colorTransformMatrix.emplace(std::move(matVec));
}
void setClientTarget(int64_t display, uint32_t slot, const native_handle_t* target,
@ -95,10 +97,18 @@ class ComposerClientWriter {
getBuffer(slot, buffer, releaseFence));
}
void validateDisplay(int64_t display) { getDisplayCommand(display).validateDisplay = true; }
void validateDisplay(int64_t display,
std::optional<ClockMonotonicTimestamp> expectedPresentTime) {
auto& command = getDisplayCommand(display);
command.expectedPresentTime = expectedPresentTime;
command.validateDisplay = true;
}
void presentOrvalidateDisplay(int64_t display) {
getDisplayCommand(display).presentOrValidateDisplay = true;
void presentOrvalidateDisplay(int64_t display,
std::optional<ClockMonotonicTimestamp> expectedPresentTime) {
auto& command = getDisplayCommand(display);
command.expectedPresentTime = expectedPresentTime;
command.presentOrValidateDisplay = true;
}
void acceptDisplayChanges(int64_t display) {