Skip Validate
b/37474580
b/62806392
Test: marlin, ryu
Change-Id: I9d4ece40a8a093d768bcb4edd332cf0188735e66
diff --git a/current.txt b/current.txt
index e18cec0..a476f51 100644
--- a/current.txt
+++ b/current.txt
@@ -101,7 +101,7 @@
4f6dedbcdd21c309dfc650acea81a096d6b242493ffe49c8d61bd3c43aad354e android.hardware.graphics.common@1.0::types
b3aac6c3817f039964fcd62268274b3039e17bd7d0d5b40b4d1d1c7b19a1f866 android.hardware.graphics.composer@2.1::IComposer
b19d00eb8a8b3b0034a0321f22e8f32162bf4c2aebbce6da22c025f56e459ea2 android.hardware.graphics.composer@2.1::IComposerCallback
-e992684e690dfe67a8cbeab5005bfa3fa9c2bf3d4b0b75657fb1f0c2d5dd2bae android.hardware.graphics.composer@2.1::IComposerClient
+61ee43ffe6fb6dbe8b22dc17c51ff3d5ba703fc6029cba211f901f3d79c8a72d android.hardware.graphics.composer@2.1::IComposerClient
1c98c2f5154345312ec054871792a2982ec5f3e2bc2abfb61a10c0b517978e20 android.hardware.graphics.composer@2.1::types
a695898589e1ef15b2b2510f11edd6aafac9918d9cf8d74b4b6143b309dee542 android.hardware.graphics.mapper@2.0::IMapper
28507d385a3dd224bf3c32f1bfd9f96092c4701b9c1cc66caa578fc3efc97877 android.hardware.graphics.mapper@2.0::types
diff --git a/graphics/composer/2.1/IComposerClient.hal b/graphics/composer/2.1/IComposerClient.hal
index 85572d4..f2ff932 100644
--- a/graphics/composer/2.1/IComposerClient.hal
+++ b/graphics/composer/2.1/IComposerClient.hal
@@ -1117,6 +1117,7 @@
VALIDATE_DISPLAY = 0x203 << OPCODE_SHIFT,
ACCEPT_DISPLAY_CHANGES = 0x204 << OPCODE_SHIFT,
PRESENT_DISPLAY = 0x205 << OPCODE_SHIFT,
+ PRESENT_OR_VALIDATE_DISPLAY = 0x206 << OPCODE_SHIFT,
/** layer commands (VALIDATE_DISPLAY not required) */
SET_LAYER_CURSOR_POSITION = 0x300 << OPCODE_SHIFT,
@@ -1135,6 +1136,7 @@
SET_LAYER_TRANSFORM = 0x408 << OPCODE_SHIFT,
SET_LAYER_VISIBLE_REGION = 0x409 << OPCODE_SHIFT,
SET_LAYER_Z_ORDER = 0x40a << OPCODE_SHIFT,
+ SET_PRESENT_OR_VALIDATE_DISPLAY_RESULT = 0x40b << OPCODE_SHIFT,
/** 0x800 - 0xfff are reserved for vendor extensions */
/** 0x1000 - 0xffff are reserved */
diff --git a/graphics/composer/2.1/default/ComposerClient.cpp b/graphics/composer/2.1/default/ComposerClient.cpp
index ce4e17f..5a96e29 100644
--- a/graphics/composer/2.1/default/ComposerClient.cpp
+++ b/graphics/composer/2.1/default/ComposerClient.cpp
@@ -562,6 +562,8 @@
return parseSetOutputBuffer(length);
case IComposerClient::Command::VALIDATE_DISPLAY:
return parseValidateDisplay(length);
+ case IComposerClient::Command::PRESENT_OR_VALIDATE_DISPLAY:
+ return parsePresentOrValidateDisplay(length);
case IComposerClient::Command::ACCEPT_DISPLAY_CHANGES:
return parseAcceptDisplayChanges(length);
case IComposerClient::Command::PRESENT_DISPLAY:
@@ -739,6 +741,47 @@
return true;
}
+bool ComposerClient::CommandReader::parsePresentOrValidateDisplay(uint16_t length)
+{
+ if (length != CommandWriterBase::kPresentOrValidateDisplayLength) {
+ return false;
+ }
+
+ // First try to Present as is.
+ int presentFence = -1;
+ std::vector<Layer> layers;
+ std::vector<int> fences;
+ auto err = mHal.presentDisplay(mDisplay, &presentFence, &layers, &fences);
+ if (err == Error::NONE) {
+ mWriter.setPresentOrValidateResult(1);
+ mWriter.setPresentFence(presentFence);
+ mWriter.setReleaseFences(layers, fences);
+ return true;
+ }
+
+ // Present has failed. We need to fallback to validate
+ std::vector<Layer> changedLayers;
+ std::vector<IComposerClient::Composition> compositionTypes;
+ uint32_t displayRequestMask = 0x0;
+ std::vector<Layer> requestedLayers;
+ std::vector<uint32_t> requestMasks;
+
+ err = mHal.validateDisplay(mDisplay, &changedLayers,
+ &compositionTypes, &displayRequestMask,
+ &requestedLayers, &requestMasks);
+ if (err == Error::NONE) {
+ mWriter.setPresentOrValidateResult(0);
+ mWriter.setChangedCompositionTypes(changedLayers,
+ compositionTypes);
+ mWriter.setDisplayRequests(displayRequestMask,
+ requestedLayers, requestMasks);
+ } else {
+ mWriter.setError(getCommandLoc(), err);
+ }
+
+ return true;
+}
+
bool ComposerClient::CommandReader::parseAcceptDisplayChanges(uint16_t length)
{
if (length != CommandWriterBase::kAcceptDisplayChangesLength) {
diff --git a/graphics/composer/2.1/default/ComposerClient.h b/graphics/composer/2.1/default/ComposerClient.h
index 3d10f80..ee825fe 100644
--- a/graphics/composer/2.1/default/ComposerClient.h
+++ b/graphics/composer/2.1/default/ComposerClient.h
@@ -141,6 +141,7 @@
bool parseSetClientTarget(uint16_t length);
bool parseSetOutputBuffer(uint16_t length);
bool parseValidateDisplay(uint16_t length);
+ bool parsePresentOrValidateDisplay(uint16_t length);
bool parseAcceptDisplayChanges(uint16_t length);
bool parsePresentDisplay(uint16_t length);
bool parseSetLayerCursorPosition(uint16_t length);
diff --git a/graphics/composer/2.1/default/IComposerCommandBuffer.h b/graphics/composer/2.1/default/IComposerCommandBuffer.h
index fb78ef8..9ee5f4f 100644
--- a/graphics/composer/2.1/default/IComposerCommandBuffer.h
+++ b/graphics/composer/2.1/default/IComposerCommandBuffer.h
@@ -152,6 +152,13 @@
endCommand();
}
+ static constexpr uint32_t kPresentOrValidateDisplayResultLength = 1;
+ void setPresentOrValidateResult(uint32_t state) {
+ beginCommand(IComposerClient::Command::SET_PRESENT_OR_VALIDATE_DISPLAY_RESULT, kPresentOrValidateDisplayResultLength);
+ write(state);
+ endCommand();
+ }
+
void setChangedCompositionTypes(const std::vector<Layer>& layers,
const std::vector<IComposerClient::Composition>& types)
{
@@ -284,6 +291,14 @@
endCommand();
}
+ static constexpr uint16_t kPresentOrValidateDisplayLength = 0;
+ void presentOrvalidateDisplay()
+ {
+ beginCommand(IComposerClient::Command::PRESENT_OR_VALIDATE_DISPLAY,
+ kPresentOrValidateDisplayLength);
+ endCommand();
+ }
+
static constexpr uint16_t kAcceptDisplayChangesLength = 0;
void acceptDisplayChanges()
{