Merge "[Lut HAL] Move layer out of Lut interface." into main

This commit is contained in:
Sally Qi
2024-08-29 16:05:15 +00:00
committed by Android (Google) Code Review
6 changed files with 36 additions and 19 deletions

View File

@@ -35,5 +35,9 @@ package android.hardware.graphics.composer3;
@VintfStability
parcelable DisplayLuts {
long display;
android.hardware.graphics.composer3.Lut[] luts;
android.hardware.graphics.composer3.DisplayLuts.LayerLut[] layerLuts;
parcelable LayerLut {
long layer;
android.hardware.graphics.composer3.Lut lut;
}
}

View File

@@ -34,7 +34,6 @@
package android.hardware.graphics.composer3;
@VintfStability
parcelable Lut {
long layer;
@nullable ParcelFileDescriptor pfd;
android.hardware.graphics.composer3.LutProperties lutProperties;
}

View File

@@ -27,12 +27,20 @@ import android.hardware.graphics.composer3.Lut;
@VintfStability
parcelable DisplayLuts {
/**
* The display which this commands refers to.
* The display which the layerLuts list is for.
*/
long display;
/**
* A Lut list specified by the HWC for given HDR layers that don't have Luts provided.
*/
Lut[] luts;
parcelable LayerLut {
/**
* The layer that the HWC is requesting a LUT to be applied during GPU composition.
*/
long layer;
/**
* A Lut specified by the HWC for given HDR layers that don't have Luts provided.
*/
Lut lut;
}
LayerLut[] layerLuts;
}

View File

@@ -27,11 +27,6 @@ import android.hardware.graphics.composer3.LutProperties;
@VintfStability
parcelable Lut {
/**
* The layer which this commands refer to.
*/
long layer;
/**
* A handle to a memory region.
* If the file descriptor is not set, this means that the HWC doesn't specify a Lut.

View File

@@ -186,7 +186,7 @@ class ComposerClientReader {
}
// Get the lut(s) requested by hardware composer.
std::vector<Lut> takeDisplayLuts(int64_t display) {
std::vector<DisplayLuts::LayerLut> takeDisplayLuts(int64_t display) {
LOG_ALWAYS_FATAL_IF(mDisplay && display != *mDisplay);
auto found = mReturnData.find(display);
@@ -196,7 +196,7 @@ class ComposerClientReader {
}
ReturnData& data = found->second;
return std::move(data.luts);
return std::move(data.layerLuts);
}
private:
@@ -247,10 +247,11 @@ class ComposerClientReader {
void parseSetDisplayLuts(DisplayLuts&& displayLuts) {
LOG_ALWAYS_FATAL_IF(mDisplay && displayLuts.display != *mDisplay);
auto& data = mReturnData[displayLuts.display];
for (auto& lut : displayLuts.luts) {
if (lut.pfd.get() >= 0) {
data.luts.push_back({lut.layer, ndk::ScopedFileDescriptor(lut.pfd.release()),
lut.lutProperties});
for (auto& layerLut : displayLuts.layerLuts) {
if (layerLut.lut.pfd.get() >= 0) {
data.layerLuts.push_back(
{layerLut.layer, Lut{ndk::ScopedFileDescriptor(layerLut.lut.pfd.release()),
layerLut.lut.lutProperties}});
}
}
}
@@ -266,7 +267,7 @@ class ComposerClientReader {
.clientTargetProperty = {common::PixelFormat::RGBA_8888, Dataspace::UNKNOWN},
.brightness = 1.f,
};
std::vector<Lut> luts;
std::vector<DisplayLuts::LayerLut> layerLuts;
};
std::vector<CommandError> mErrors;

View File

@@ -30,6 +30,7 @@
#include <aidl/android/hardware/graphics/composer3/DisplayBrightness.h>
#include <aidl/android/hardware/graphics/composer3/LayerBrightness.h>
#include <aidl/android/hardware/graphics/composer3/LayerLifecycleBatchCommandType.h>
#include <aidl/android/hardware/graphics/composer3/Lut.h>
#include <aidl/android/hardware/graphics/composer3/PerFrameMetadata.h>
#include <aidl/android/hardware/graphics/composer3/PerFrameMetadataBlob.h>
@@ -245,6 +246,15 @@ class ComposerClientWriter final {
getLayerCommand(display, layer).blockingRegion.emplace(blocking.begin(), blocking.end());
}
void setLayerLuts(int64_t display, int64_t layer, std::vector<Lut>& luts) {
std::vector<std::optional<Lut>> currentLuts;
for (auto& lut : luts) {
currentLuts.push_back(std::make_optional<Lut>(
{ndk::ScopedFileDescriptor(lut.pfd.release()), lut.lutProperties}));
}
getLayerCommand(display, layer).luts.emplace(std::move(currentLuts));
}
std::vector<DisplayCommand> takePendingCommands() {
flushLayerCommand();
flushDisplayCommand();