diff options
author | Kevin F. Haggerty <haggertk@lineageos.org> | 2020-06-01 22:21:30 -0600 |
---|---|---|
committer | Kevin F. Haggerty <haggertk@lineageos.org> | 2020-06-01 22:21:30 -0600 |
commit | bf445fa9369441c8711d0b5968ec20d4c70ad583 (patch) | |
tree | 32c30b85a1b566da669fb49f8374830a7c98a5ca | |
parent | f6278091477f0c13d0b9906a051827d1c8ad1b7d (diff) | |
parent | 73352811c004e87b80ef587e04403f5e91d98619 (diff) | |
download | android_hardware_qcom_sdm845_display-lineage-17.1.tar.gz android_hardware_qcom_sdm845_display-lineage-17.1.tar.bz2 android_hardware_qcom_sdm845_display-lineage-17.1.zip |
Merge tag 'android-10.0.0_r37' into staging/lineage-17.1_merge-android-10.0.0_r37HEADlineage-17.1
Android 10.0.0 Release 37 (QQ3A.200605.001)
* tag 'android-10.0.0_r37':
sdm: Add support of SetLayerColorTransform with GL composition fallback
Change-Id: I0fc76ce81a365d377fe2cbf75cc50d331ec09ef3
-rw-r--r-- | sdm/include/utils/constants.h | 6 | ||||
-rw-r--r-- | sdm/libs/hwc2/hwc_display.cpp | 4 | ||||
-rw-r--r-- | sdm/libs/hwc2/hwc_layers.cpp | 6 | ||||
-rw-r--r-- | sdm/libs/hwc2/hwc_layers.h | 3 | ||||
-rw-r--r-- | sdm/libs/hwc2/hwc_session.cpp | 8 |
5 files changed, 27 insertions, 0 deletions
diff --git a/sdm/include/utils/constants.h b/sdm/include/utils/constants.h index 5efe3571..608b192d 100644 --- a/sdm/include/utils/constants.h +++ b/sdm/include/utils/constants.h @@ -75,6 +75,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 45effc06..18923b03 100644 --- a/sdm/libs/hwc2/hwc_display.cpp +++ b/sdm/libs/hwc2/hwc_display.cpp @@ -707,6 +707,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 9b08308c..eff1f80f 100644 --- a/sdm/libs/hwc2/hwc_layers.cpp +++ b/sdm/libs/hwc2/hwc_layers.cpp @@ -536,6 +536,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 a24f5a44..ce3bd1f3 100644 --- a/sdm/libs/hwc2/hwc_layers.h +++ b/sdm/libs/hwc2/hwc_layers.h @@ -91,6 +91,7 @@ class HWCLayer { HWC2::Error SetLayerPerFrameMetadata(uint32_t num_elements, const PerFrameMetadataKey *keys, const float *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_; } void UpdateClientCompositionType(HWC2::Composition type) { client_requested_ = type; } @@ -112,6 +113,7 @@ class HWCLayer { bool IsNonIntegralSourceCrop() { return non_integral_source_crop_; } bool HasMetaDataRefreshRate() { return has_metadata_refresh_rate_; } void SetPartialUpdate(bool enabled) { partial_update_enabled_ = enabled; } + bool IsColorTransformSet() const { return color_transform_matrix_set_; } private: Layer *layer_ = nullptr; @@ -131,6 +133,7 @@ class HWCLayer { bool has_metadata_refresh_rate_ = false; bool partial_update_enabled_ = false; bool surface_updated_ = true; + bool color_transform_matrix_set_ = false; // Composition requested by client(SF) HWC2::Composition client_requested_ = HWC2::Composition::Device; diff --git a/sdm/libs/hwc2/hwc_session.cpp b/sdm/libs/hwc2/hwc_session.cpp index 259c2049..b35beb3b 100644 --- a/sdm/libs/hwc2/hwc_session.cpp +++ b/sdm/libs/hwc2/hwc_session.cpp @@ -850,6 +850,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) { @@ -1112,6 +1118,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: |