summaryrefslogtreecommitdiff
path: root/graphics/composer/2.1/utils/command-buffer/include/composer-command-buffer
diff options
context:
space:
mode:
authorPeiyong Lin <lpy@google.com>2018-03-28 12:09:42 -0700
committerPeiyong Lin <lpy@google.com>2018-04-02 15:56:45 -0700
commita2acfa2219bda99e384b16df365274f9ab4aa471 (patch)
tree15d16a6af0ce3f8a1b93d3225a16a9e108868ae1 /graphics/composer/2.1/utils/command-buffer/include/composer-command-buffer
parentaa6eca99e3916b0cbbe600b6c68669bf25db1949 (diff)
[Graphics] Update CommandWriter APIs to common::V1_1::* enum.
Previously we introduced Dataspace V1.1 and PixelFormat V1.1, thus APIs accepting Dataspace should also be updated to accept V1_1::Dataspace and V1_1::PixelFormat. BUG: 77156734 Test: adb shell /data/nativetest/VtsHalGraphicsComposerV2_2TargetTest/VtsHalGraphicsComposerV2_2TargetTest Change-Id: I00d00749f2895b727a18a28903256128a33e8b97
Diffstat (limited to 'graphics/composer/2.1/utils/command-buffer/include/composer-command-buffer')
-rw-r--r--graphics/composer/2.1/utils/command-buffer/include/composer-command-buffer/2.1/ComposerCommandBuffer.h47
1 files changed, 29 insertions, 18 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 df529ec615..2742207132 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 {
void setClientTarget(uint32_t slot, const native_handle_t* target, int acquireFence,
Dataspace dataspace, const std::vector<IComposerClient::Rect>& damage) {
- bool doWrite = (damage.size() <= (kMaxLength - 4) / 4);
- size_t length = 4 + ((doWrite) ? damage.size() * 4 : 0);
-
- beginCommand(IComposerClient::Command::SET_CLIENT_TARGET, length);
- write(slot);
- writeHandle(target, true);
- writeFence(acquireFence);
- writeSigned(static_cast<int32_t>(dataspace));
- // When there are too many rectangles in the damage region and doWrite
- // is false, we write no rectangle at all which means the entire
- // client target is damaged.
- if (doWrite) {
- writeRegion(damage);
- }
- endCommand();
+ setClientTargetInternal(slot, target, acquireFence, static_cast<int32_t>(dataspace),
+ damage);
}
static constexpr uint16_t kSetOutputBufferLength = 3;
@@ -354,9 +341,7 @@ class CommandWriterBase {
static constexpr uint16_t kSetLayerDataspaceLength = 1;
void setLayerDataspace(Dataspace dataspace) {
- beginCommand(IComposerClient::Command::SET_LAYER_DATASPACE, kSetLayerDataspaceLength);
- writeSigned(static_cast<int32_t>(dataspace));
- endCommand();
+ setLayerDataspaceInternal(static_cast<int32_t>(dataspace));
}
static constexpr uint16_t kSetLayerDisplayFrameLength = 4;
@@ -418,6 +403,32 @@ class CommandWriterBase {
}
protected:
+ void setClientTargetInternal(uint32_t slot, const native_handle_t* target, int acquireFence,
+ int32_t dataspace,
+ const std::vector<IComposerClient::Rect>& damage) {
+ bool doWrite = (damage.size() <= (kMaxLength - 4) / 4);
+ size_t length = 4 + ((doWrite) ? damage.size() * 4 : 0);
+
+ beginCommand(IComposerClient::Command::SET_CLIENT_TARGET, length);
+ write(slot);
+ writeHandle(target, true);
+ writeFence(acquireFence);
+ writeSigned(dataspace);
+ // When there are too many rectangles in the damage region and doWrite
+ // is false, we write no rectangle at all which means the entire
+ // client target is damaged.
+ if (doWrite) {
+ writeRegion(damage);
+ }
+ endCommand();
+ }
+
+ void setLayerDataspaceInternal(int32_t dataspace) {
+ beginCommand(IComposerClient::Command::SET_LAYER_DATASPACE, kSetLayerDataspaceLength);
+ writeSigned(dataspace);
+ endCommand();
+ }
+
void beginCommand(IComposerClient::Command command, uint16_t length) {
if (mCommandEnd) {
LOG_FATAL("endCommand was not called before command 0x%x", command);