summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2020-03-13 23:17:41 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2020-03-13 23:17:41 +0000
commitefdc4690445aacfde6dad014d0c9bd78cad6c531 (patch)
tree6c5e07f8d610d2244d9553ef1120b2905dc31bdb
parent918d9adcb47b58b3a9906d853c47de3b0af2f7fc (diff)
parent98f20382053f0deae461989145ce9dc5e209ae6c (diff)
downloaddisplay-android10-d4-release.tar.gz
Snap for 6294593 from 98f20382053f0deae461989145ce9dc5e209ae6c to qt-d4-releaseandroid-10.0.0_r45android-10.0.0_r44android-10.0.0_r43android-10.0.0_r42android10-d4-s1-releaseandroid10-d4-release
Change-Id: I54ac5e088db5aee02e58189a4a3c5a85736ef6ca
-rw-r--r--sdm/include/utils/constants.h6
-rw-r--r--sdm/libs/hwc2/hwc_display.cpp4
-rw-r--r--sdm/libs/hwc2/hwc_layers.cpp6
-rw-r--r--sdm/libs/hwc2/hwc_layers.h3
-rw-r--r--sdm/libs/hwc2/hwc_session.cpp8
5 files changed, 27 insertions, 0 deletions
diff --git a/sdm/include/utils/constants.h b/sdm/include/utils/constants.h
index ffa8d12b..f97f5397 100644
--- a/sdm/include/utils/constants.h
+++ b/sdm/include/utils/constants.h
@@ -79,6 +79,12 @@ namespace sdm {
const int kPageSize = 4096;
const uint32_t kGridSize = 129; // size used for non-linear transformation before Tone-mapping
const uint32_t kLutDim = 17; // Dim of the 3d LUT for tone-mapping.
+ constexpr int kColorTransformMatrixSize = 16;
+ constexpr float kIdentityMatrix[kColorTransformMatrixSize] = { 1.0, 0.0, 0.0, 0.0,
+ 0.0, 1.0, 0.0, 0.0,
+ 0.0, 0.0, 1.0, 0.0,
+ 0.0, 0.0, 0.0, 1.0 };
+
typedef void * Handle;
diff --git a/sdm/libs/hwc2/hwc_display.cpp b/sdm/libs/hwc2/hwc_display.cpp
index 597ade14..ab937b9c 100644
--- a/sdm/libs/hwc2/hwc_display.cpp
+++ b/sdm/libs/hwc2/hwc_display.cpp
@@ -674,6 +674,10 @@ void HWCDisplay::BuildLayerStack() {
layer->flags.skip = true;
}
+ if (hwc_layer->IsColorTransformSet()) {
+ layer->flags.skip = true;
+ }
+
// set default composition as GPU for SDM
layer->composition = kCompositionGPU;
diff --git a/sdm/libs/hwc2/hwc_layers.cpp b/sdm/libs/hwc2/hwc_layers.cpp
index f288a3d9..49900877 100644
--- a/sdm/libs/hwc2/hwc_layers.cpp
+++ b/sdm/libs/hwc2/hwc_layers.cpp
@@ -545,6 +545,12 @@ HWC2::Error HWCLayer::SetLayerZOrder(uint32_t z) {
return HWC2::Error::None;
}
+HWC2::Error HWCLayer::SetLayerColorTransform(const float *matrix) {
+ color_transform_matrix_set_ =
+ (std::memcmp(matrix, kIdentityMatrix, sizeof(kIdentityMatrix)) != 0);
+ return HWC2::Error::None;
+}
+
HWC2::Error HWCLayer::SetLayerPerFrameMetadata(uint32_t num_elements,
const PerFrameMetadataKey *keys,
const float *metadata) {
diff --git a/sdm/libs/hwc2/hwc_layers.h b/sdm/libs/hwc2/hwc_layers.h
index 538f4df3..9b4730d6 100644
--- a/sdm/libs/hwc2/hwc_layers.h
+++ b/sdm/libs/hwc2/hwc_layers.h
@@ -94,6 +94,7 @@ class HWCLayer {
HWC2::Error SetLayerPerFrameMetadataBlobs(uint32_t num_elements, const PerFrameMetadataKey *keys,
const uint32_t *sizes, const uint8_t* metadata);
HWC2::Error SetLayerZOrder(uint32_t z);
+ HWC2::Error SetLayerColorTransform(const float *matrix);
void SetComposition(const LayerComposition &sdm_composition);
HWC2::Composition GetClientRequestedCompositionType() { return client_requested_; }
HWC2::Composition GetOrigClientRequestedCompositionType() { return client_requested_orig_; }
@@ -116,6 +117,7 @@ class HWCLayer {
void SetPartialUpdate(bool enabled) { partial_update_enabled_ = enabled; }
bool IsNonIntegralSourceCrop() { return non_integral_source_crop_; }
bool HasMetaDataRefreshRate() { return has_metadata_refresh_rate_; }
+ bool IsColorTransformSet() const { return color_transform_matrix_set_; }
void SetLayerAsMask();
bool BufferLatched() { return buffer_flipped_; }
void ResetBufferFlip() { buffer_flipped_ = false; }
@@ -138,6 +140,7 @@ class HWCLayer {
bool surface_updated_ = true;
bool non_integral_source_crop_ = false;
bool has_metadata_refresh_rate_ = false;
+ bool color_transform_matrix_set_ = false;
bool buffer_flipped_ = false;
bool per_frame_hdr_metadata_ = false; // used to track if perframe metadata and blob is set.
diff --git a/sdm/libs/hwc2/hwc_session.cpp b/sdm/libs/hwc2/hwc_session.cpp
index 11f9b0a2..5e41d253 100644
--- a/sdm/libs/hwc2/hwc_session.cpp
+++ b/sdm/libs/hwc2/hwc_session.cpp
@@ -1002,6 +1002,12 @@ static int32_t SetLayerZOrder(hwc2_device_t *device, hwc2_display_t display, hwc
return HWCSession::CallDisplayFunction(device, display, &HWCDisplay::SetLayerZOrder, layer, z);
}
+static int32_t SetLayerColorTransform(hwc2_device_t *device, hwc2_display_t display,
+ hwc2_layer_t layer, const float *matrix) {
+ return HWCSession::CallLayerFunction(device, display, layer, &HWCLayer::SetLayerColorTransform,
+ matrix);
+}
+
int32_t HWCSession::SetOutputBuffer(hwc2_device_t *device, hwc2_display_t display,
buffer_handle_t buffer, int32_t releaseFence) {
if (!device) {
@@ -1234,6 +1240,8 @@ hwc2_function_pointer_t HWCSession::GetFunction(struct hwc2_device *device,
return AsFP<HWC2_PFN_SET_LAYER_VISIBLE_REGION>(SetLayerVisibleRegion);
case HWC2::FunctionDescriptor::SetLayerZOrder:
return AsFP<HWC2_PFN_SET_LAYER_Z_ORDER>(SetLayerZOrder);
+ case HWC2::FunctionDescriptor::SetLayerColorTransform:
+ return AsFP<HWC2_PFN_SET_LAYER_COLOR_TRANSFORM>(SetLayerColorTransform);
case HWC2::FunctionDescriptor::SetOutputBuffer:
return AsFP<HWC2_PFN_SET_OUTPUT_BUFFER>(SetOutputBuffer);
case HWC2::FunctionDescriptor::SetPowerMode: