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

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

Merge "[SurfaceFlinger] Plumb setLayerColorTransform."

parents 2c9fa63f 698147a3
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -64,6 +64,7 @@ sharedLibraries = [
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",
    "libdvr_headers",
    "libsurfaceflinger_headers",
]
+1 −0
Original line number Diff line number Diff line
@@ -65,6 +65,7 @@ cc_defaults {
    header_libs: [
        "android.hardware.graphics.composer@2.1-command-buffer",
        "android.hardware.graphics.composer@2.2-command-buffer",
        "android.hardware.graphics.composer@2.3-command-buffer",
    ],
    export_static_lib_headers: [
        "librenderengine",
+12 −0
Original line number Diff line number Diff line
@@ -991,6 +991,18 @@ Error Composer::getDisplayIdentificationData(Display display, uint8_t* outPort,
    return error;
}

Error Composer::setLayerColorTransform(Display display, Layer layer, const float* matrix)
{
    if (!mClient_2_3) {
        return Error::UNSUPPORTED;
    }

    mWriter.selectDisplay(display);
    mWriter.selectLayer(layer);
    mWriter.setLayerColorTransform(matrix);
    return Error::NONE;
}

CommandReader::~CommandReader()
{
    resetData();
+6 −3
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@
#include <android/hardware/graphics/common/1.1/types.h>
#include <android/hardware/graphics/composer/2.3/IComposer.h>
#include <android/hardware/graphics/composer/2.3/IComposerClient.h>
#include <composer-command-buffer/2.2/ComposerCommandBuffer.h>
#include <composer-command-buffer/2.3/ComposerCommandBuffer.h>
#include <gui/HdrMetadata.h>
#include <math/mat4.h>
#include <ui/GraphicBuffer.h>
@@ -60,8 +60,8 @@ using V2_1::Error;
using V2_1::IComposerCallback;
using V2_1::Layer;

using V2_2::CommandReaderBase;
using V2_2::CommandWriterBase;
using V2_3::CommandReaderBase;
using V2_3::CommandWriterBase;

using V2_3::IComposer;
using V2_3::IComposerClient;
@@ -191,6 +191,8 @@ public:
    // Composer HAL 2.3
    virtual Error getDisplayIdentificationData(Display display, uint8_t* outPort,
                                               std::vector<uint8_t>* outData) = 0;
    virtual Error setLayerColorTransform(Display display, Layer layer,
                                         const float* matrix) = 0;
};

namespace impl {
@@ -389,6 +391,7 @@ public:
    // Composer HAL 2.3
    Error getDisplayIdentificationData(Display display, uint8_t* outPort,
                                       std::vector<uint8_t>* outData) override;
    Error setLayerColorTransform(Display display, Layer layer, const float* matrix) override;

private:
    class CommandWriter : public CommandWriterBase {
+12 −1
Original line number Diff line number Diff line
@@ -781,7 +781,8 @@ Layer::Layer(android::Hwc2::Composer& composer, const std::unordered_set<Capabil
  : mComposer(composer),
    mCapabilities(capabilities),
    mDisplayId(displayId),
    mId(layerId)
    mId(layerId),
    mColorMatrix(android::mat4())
{
    ALOGV("Created layer %" PRIu64 " on display %" PRIu64, layerId, displayId);
}
@@ -988,4 +989,14 @@ Error Layer::setInfo(uint32_t type, uint32_t appId)
  return static_cast<Error>(intError);
}

// Composer HAL 2.3
Error Layer::setColorTransform(const android::mat4& matrix) {
    if (matrix == mColorMatrix) {
        return Error::None;
    }
    mColorMatrix = matrix;
    auto intError = mComposer.setLayerColorTransform(mDisplayId, mId, matrix.asArray());
    return static_cast<Error>(intError);
}

} // namespace HWC2
Loading