Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b8c73683 authored by Peiyong Lin's avatar Peiyong Lin Committed by Android (Google) Code Review
Browse files

Merge "Plumb getClientTargetProperty API."

parents 2c596099 afa0f570
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -66,6 +66,7 @@ headerLibraries = [
    "android.hardware.graphics.composer@2.1-command-buffer",
    "android.hardware.graphics.composer@2.2-command-buffer",
    "android.hardware.graphics.composer@2.3-command-buffer",
    "android.hardware.graphics.composer@2.4-command-buffer",
    "libdvr_headers",
    "libsurfaceflinger_headers",
]
+1 −0
Original line number Diff line number Diff line
@@ -79,6 +79,7 @@ cc_defaults {
        "android.hardware.graphics.composer@2.1-command-buffer",
        "android.hardware.graphics.composer@2.2-command-buffer",
        "android.hardware.graphics.composer@2.3-command-buffer",
        "android.hardware.graphics.composer@2.4-command-buffer",
    ],
    export_static_lib_headers: [
        "libcompositionengine",
+1 −0
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@ cc_defaults {
        "android.hardware.graphics.composer@2.1-command-buffer",
        "android.hardware.graphics.composer@2.2-command-buffer",
        "android.hardware.graphics.composer@2.3-command-buffer",
        "android.hardware.graphics.composer@2.4-command-buffer",
        "libsurfaceflinger_headers",
    ],
}
+13 −2
Original line number Diff line number Diff line
@@ -1337,8 +1337,7 @@ Error CommandReader::parse()
    uint16_t length = 0;

    while (!isEmpty()) {
        auto command_2_1 = reinterpret_cast<V2_1::IComposerClient::Command*>(&command);
        if (!beginCommand(command_2_1, &length)) {
        if (!beginCommand(&command, &length)) {
            break;
        }

@@ -1365,6 +1364,9 @@ Error CommandReader::parse()
        case IComposerClient::Command ::SET_PRESENT_OR_VALIDATE_DISPLAY_RESULT:
            parsed = parseSetPresentOrValidateDisplayResult(length);
            break;
        case IComposerClient::Command::SET_CLIENT_TARGET_PROPERTY:
            parsed = parseSetClientTargetProperty(length);
            break;
        default:
            parsed = false;
            break;
@@ -1502,6 +1504,15 @@ bool CommandReader::parseSetPresentOrValidateDisplayResult(uint16_t length)
    return true;
}

bool CommandReader::parseSetClientTargetProperty(uint16_t length) {
    if (length != CommandWriterBase::kSetClientTargetPropertyLength || !mCurrentReturnData) {
        return false;
    }
    mCurrentReturnData->clientTargetProperty.pixelFormat = static_cast<PixelFormat>(readSigned());
    mCurrentReturnData->clientTargetProperty.dataspace = static_cast<Dataspace>(readSigned());
    return true;
}

void CommandReader::resetData()
{
    mErrors.clear();
+11 −3
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@
#include <android/hardware/graphics/common/1.1/types.h>
#include <android/hardware/graphics/composer/2.4/IComposer.h>
#include <android/hardware/graphics/composer/2.4/IComposerClient.h>
#include <composer-command-buffer/2.3/ComposerCommandBuffer.h>
#include <composer-command-buffer/2.4/ComposerCommandBuffer.h>
#include <gui/HdrMetadata.h>
#include <math/mat4.h>
#include <ui/DisplayedFrameStats.h>
@@ -63,8 +63,8 @@ using V2_1::Config;
using V2_1::Display;
using V2_1::Error;
using V2_1::Layer;
using V2_3::CommandReaderBase;
using V2_3::CommandWriterBase;
using V2_4::CommandReaderBase;
using V2_4::CommandWriterBase;
using V2_4::IComposer;
using V2_4::IComposerCallback;
using V2_4::IComposerClient;
@@ -280,6 +280,7 @@ private:
    bool parseSetPresentFence(uint16_t length);
    bool parseSetReleaseFences(uint16_t length);
    bool parseSetPresentOrValidateDisplayResult(uint16_t length);
    bool parseSetClientTargetProperty(uint16_t length);

    struct ReturnData {
        uint32_t displayRequests = 0;
@@ -296,6 +297,13 @@ private:
        std::vector<int> releaseFences;

        uint32_t presentOrValidateState;

        // Composer 2.4 implementation can return a client target property
        // structure to indicate the client target properties that hardware
        // composer requests. The composer client must change the client target
        // properties to match this request.
        IComposerClient::ClientTargetProperty clientTargetProperty{PixelFormat::RGBA_8888,
                                                                   Dataspace::UNKNOWN};
    };

    std::vector<CommandError> mErrors;
Loading