Skip Validate

b/37474580
b/62806392

Test: marlin, ryu

Change-Id: I9d4ece40a8a093d768bcb4edd332cf0188735e66
This commit is contained in:
Fabien Sanglard 2017-06-19 19:25:31 -07:00 committed by Iliyan Malchev
parent c4f859d1b5
commit 11ec393689
5 changed files with 62 additions and 1 deletions

View file

@ -101,7 +101,7 @@ b8a75617b9ec12bea641f3a73d4025a33e8b9a2f9169dd46094af56adf9249c5 android.hardwar
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

View file

@ -1117,6 +1117,7 @@ interface IComposerClient {
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 @@ interface IComposerClient {
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 */

View file

@ -562,6 +562,8 @@ bool ComposerClient::CommandReader::parseCommand(
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 @@ bool ComposerClient::CommandReader::parseValidateDisplay(uint16_t length)
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) {

View file

@ -141,6 +141,7 @@ protected:
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);

View file

@ -152,6 +152,13 @@ public:
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 @@ public:
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()
{