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

Commit afa0f570 authored by Peiyong Lin's avatar Peiyong Lin
Browse files

Plumb getClientTargetProperty API.

getClientTargetProperty will give hardware composer the ability to request some
properties of the client target that hardware composer wants. Prior to this
API, the client will does its best to produce the client target of which the
properties are pretty much fixed.

This patch implements the parsing of SET_CLIENT_TARGET_PROPERTY command in
order to get the client target property from hardware composer.

BUG: b/145968912
Test: m -j32
Change-Id: I3e738b2617e4472c7876aa283c0964e2240b144b
parent f588b2f4
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
@@ -36,6 +36,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
@@ -1333,8 +1333,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;
        }

@@ -1361,6 +1360,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;
@@ -1498,6 +1500,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