Merge 0ad4f296a6a50221722e7d77f22d29e5243b9d51 on remote branch
Change-Id: I20f1576a65f42366a0d26baea4988a2fa78a744e
diff --git a/gralloc/Android.mk b/gralloc/Android.mk
index ee37c1f..242dbfa 100644
--- a/gralloc/Android.mk
+++ b/gralloc/Android.mk
@@ -1,6 +1,7 @@
# Gralloc module
LOCAL_PATH := $(call my-dir)
include $(LOCAL_PATH)/../common.mk
+include $(LIBION_HEADER_PATH_WRAPPER)
include $(CLEAR_VARS)
LOCAL_MODULE := gralloc.$(TARGET_BOARD_PLATFORM)
@@ -41,8 +42,7 @@
LOCAL_VENDOR_MODULE := true
LOCAL_MODULE_TAGS := optional
LOCAL_C_INCLUDES := $(common_includes) \
- system/core/libion/include \
- system/core/libion/kernel-headers \
+ $(LIBION_HEADER_PATHS) \
$(kernel_includes)
LOCAL_HEADER_LIBRARIES := display_headers
@@ -66,7 +66,6 @@
LOCAL_HEADER_LIBRARIES := display_headers
LOCAL_SHARED_LIBRARIES := $(common_libs) \
libhidlbase \
- libhidltransport \
libqdMetaData \
libgrallocutils \
libgralloccore \
@@ -90,7 +89,6 @@
LOCAL_HEADER_LIBRARIES := display_headers
LOCAL_SHARED_LIBRARIES := $(common_libs) \
libhidlbase \
- libhidltransport\
libqdMetaData \
libgrallocutils \
libgralloccore \
diff --git a/include/Android.mk b/include/Android.mk
index f787fbc..85e7554 100644
--- a/include/Android.mk
+++ b/include/Android.mk
@@ -7,8 +7,7 @@
# LOCAL_HEADER_LIBRARIES := display_headers
LOCAL_VENDOR_MODULE := true
LOCAL_COPY_HEADERS_TO := $(common_header_export_path)
-LOCAL_COPY_HEADERS := display_color_processing.h \
- display_properties.h \
+LOCAL_COPY_HEADERS := display_properties.h \
../libqdutils/qd_utils.h \
../libqdutils/display_config.h \
../libqservice/QServiceUtils.h \
diff --git a/include/display_color_processing.h b/include/display_color_processing.h
deleted file mode 100644
index dfe9b91..0000000
--- a/include/display_color_processing.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
-* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are
-* met:
-* * Redistributions of source code must retain the above copyright
-* notice, this list of conditions and the following disclaimer.
-* * Redistributions in binary form must reproduce the above
-* copyright notice, this list of conditions and the following
-* disclaimer in the documentation and/or other materials provided
-* with the distribution.
-* * Neither the name of The Linux Foundation nor the names of its
-* contributors may be used to endorse or promote products derived
-* from this software without specific prior written permission.
-
-* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
-* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
-* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
-* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
-* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
-* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#ifndef __DISP_COLOR_PROCESSING_H__
-#define __DISP_COLOR_PROCESSING_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define LUT3D_ENTRIES_SIZE (17 * 17 * 17)
-
-struct rgb {
- uint32_t r;
- uint32_t g;
- uint32_t b;
-};
-
-struct rgb_entry {
- struct rgb in;
- struct rgb out;
-};
-
-/*
-struct lut3d_info
- flags -- Reserved
- lut3d_id -- Unique ID used to distinguish individual 3D Lut tables
- uniform -- Identifies if coefficients are uniform (1) or non-uniform (0)
- num_entries-- Identifies the number of lut values in the table
- entries -- Table buffer holding the lut values.
-
- All coefficients are expected to be tightly packed in the
- structure, any unused buffer space shall exist at the end
- of the buffer.
-*/
-struct lut3d_info {
- uint32_t flags;
- uint32_t lut3d_id;
- uint32_t uniform;
- uint32_t num_entries;
- struct rgb_entry entries[LUT3D_ENTRIES_SIZE];
-};
-
-/*
-struct lut1d_info
- flags -- Reserved
- bit_width -- Bit width of each entry
- num_entries -- Identifies the number of lut values in the table
- entries -- Table buffer holding the lut values
-*/
-#define LUT1D_ENTRIES_SIZE (256)
-struct lut1d_info {
- uint32_t flags;
- uint32_t bit_width;
- uint32_t strength;
- uint32_t num_entries;
- struct rgb entries[LUT1D_ENTRIES_SIZE];
-};
-
-#ifdef __cplusplus
-}
-#endif
-#endif // __DISP_COLOR_PROCESSING_H__
diff --git a/sdm/libs/core/display_base.cpp b/sdm/libs/core/display_base.cpp
index 709b1ce..72751e5 100755
--- a/sdm/libs/core/display_base.cpp
+++ b/sdm/libs/core/display_base.cpp
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2014 - 2019, The Linux Foundation. All rights reserved.
+* Copyright (c) 2014 - 2020, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following conditions are met:
@@ -1505,6 +1505,7 @@
hw_layer.input_buffer.size = sdm_layer->input_buffer.size;
hw_layer.input_buffer.acquire_fence_fd = sdm_layer->input_buffer.acquire_fence_fd;
hw_layer.input_buffer.handle_id = sdm_layer->input_buffer.handle_id;
+ hw_layer.input_buffer.buffer_id = sdm_layer->input_buffer.buffer_id;
// TODO(user): Other FBT layer attributes like surface damage, dataspace, secure camera and
// secure display flags are also updated during SetClientTarget() called between validate and
// commit. Need to revist this and update it accordingly for FBT layer.
diff --git a/sdm/libs/hwc2/hwc_layers.cpp b/sdm/libs/hwc2/hwc_layers.cpp
index c43f3ac..ecc1802 100644
--- a/sdm/libs/hwc2/hwc_layers.cpp
+++ b/sdm/libs/hwc2/hwc_layers.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014-2019, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014-2020, The Linux Foundation. All rights reserved.
* Not a Contribution.
*
* Copyright 2015 The Android Open Source Project
@@ -39,6 +39,7 @@
if (csc == ITU_R_601_FR || csc == ITU_R_2020_FR) {
color_metadata->range = Range_Full;
}
+ color_metadata->transfer = Transfer_sRGB;
switch (csc) {
case ITU_R_601:
@@ -593,7 +594,7 @@
content_light.maxContentLightLevel = UINT32(metadata[i]);
break;
case PerFrameMetadataKey::MAX_FRAME_AVERAGE_LIGHT_LEVEL:
- content_light.minPicAverageLightLevel = UINT32(metadata[i] * 10000);
+ content_light.minPicAverageLightLevel = UINT32(metadata[i]);
break;
default:
break;
@@ -601,7 +602,6 @@
}
if ((!SameConfig(&old_mastering_display, &mastering_display, UINT32(sizeof(MasteringDisplay)))) ||
(!SameConfig(&old_content_light, &content_light, UINT32(sizeof(ContentLightLevel))))) {
- per_frame_hdr_metadata_ = true;
layer_->update_mask.set(kMetadataUpdate);
geometry_changes_ |= kDataspace;
}
@@ -625,7 +625,6 @@
DLOGE("Size of HDR10_PLUS_SEI = %d", sizes[i]);
return HWC2::Error::BadParameter;
}
- per_frame_hdr_metadata_ = false;
// if dynamic metadata changes, store and set needs validate
if (!SameConfig(static_cast<const uint8_t*>(color_metadata.dynamicMetaDataPayload),
metadata, sizes[i])) {
@@ -633,7 +632,6 @@
color_metadata.dynamicMetaDataValid = true;
color_metadata.dynamicMetaDataLen = sizes[i];
std::memcpy(color_metadata.dynamicMetaDataPayload, metadata, sizes[i]);
- per_frame_hdr_metadata_ = true;
layer_->update_mask.set(kMetadataUpdate);
}
break;
@@ -929,11 +927,6 @@
}
void HWCLayer::ValidateAndSetCSC(const private_handle_t *handle) {
- if (per_frame_hdr_metadata_) {
- // Since client has set PerFrameMetadata, dataspace will be valid
- // so we can skip reading from ColorMetaData.
- return;
- }
LayerBuffer *layer_buffer = &layer_->input_buffer;
bool use_color_metadata = true;
ColorMetaData csc = {};
@@ -957,29 +950,67 @@
}
}
- // Only Video module populates the Color Metadata in handle.
- if (layer_buffer->flags.video && IsBT2020(layer_buffer->color_metadata.colorPrimaries)) {
+ if (IsBT2020(layer_buffer->color_metadata.colorPrimaries)) {
// android_dataspace_t doesnt support mastering display and light levels
// so retrieve it from metadata for BT2020(HDR)
use_color_metadata = true;
}
- // Since client has set PerFrameMetadata, dataspace will be valid
- // so we can skip reading from ColorMetaData.
- if (use_color_metadata && !per_frame_hdr_metadata_) {
- ColorMetaData old_meta_data = layer_buffer->color_metadata;
- if (sdm::SetCSC(handle, &layer_buffer->color_metadata) == kErrorNone) {
- if ((layer_buffer->color_metadata.colorPrimaries != old_meta_data.colorPrimaries) ||
- (layer_buffer->color_metadata.transfer != old_meta_data.transfer) ||
- (layer_buffer->color_metadata.range != old_meta_data.range)) {
+ if (use_color_metadata) {
+ ColorMetaData new_metadata = layer_buffer->color_metadata;
+ if (sdm::SetCSC(handle, &new_metadata) == kErrorNone) {
+ // If dataspace is KNOWN, overwrite the gralloc metadata CSC using the previously derived CSC
+ // from dataspace.
+ if (dataspace_ != HAL_DATASPACE_UNKNOWN) {
+ new_metadata.colorPrimaries = layer_buffer->color_metadata.colorPrimaries;
+ new_metadata.transfer = layer_buffer->color_metadata.transfer;
+ new_metadata.range = layer_buffer->color_metadata.range;
+ }
+ if ((layer_buffer->color_metadata.colorPrimaries != new_metadata.colorPrimaries) ||
+ (layer_buffer->color_metadata.transfer != new_metadata.transfer) ||
+ (layer_buffer->color_metadata.range != new_metadata.range)) {
+ layer_buffer->color_metadata.colorPrimaries = new_metadata.colorPrimaries;
+ layer_buffer->color_metadata.transfer = new_metadata.transfer;
+ layer_buffer->color_metadata.range = new_metadata.range;
layer_->update_mask.set(kMetadataUpdate);
}
- DLOGV_IF(kTagClient, "Dynamic Metadata valid = %d size = %d",
- layer_buffer->color_metadata.dynamicMetaDataValid,
- layer_buffer->color_metadata.dynamicMetaDataLen);
- if (layer_buffer->color_metadata.dynamicMetaDataValid &&
+ if (layer_buffer->color_metadata.matrixCoefficients != new_metadata.matrixCoefficients) {
+ layer_buffer->color_metadata.matrixCoefficients = new_metadata.matrixCoefficients;
+ layer_->update_mask.set(kMetadataUpdate);
+ }
+ DLOGV_IF(kTagClient, "Layer id = %lld ColorVolEnabled = %d ContentLightLevelEnabled = %d "
+ "cRIEnabled = %d Dynamic Metadata valid = %d size = %d", id_,
+ new_metadata.masteringDisplayInfo.colorVolumeSEIEnabled,
+ new_metadata.contentLightLevel.lightLevelSEIEnabled,
+ new_metadata.cRI.criEnabled, new_metadata.dynamicMetaDataValid,
+ new_metadata.dynamicMetaDataLen);
+ // Read color metadata from gralloc handle if it's enabled by clients, this will override the
+ // values set using the Composer API's(SetLayerPerFrameMetaData)
+ if (new_metadata.masteringDisplayInfo.colorVolumeSEIEnabled &&
+ !SameConfig(&new_metadata.masteringDisplayInfo,
+ &layer_buffer->color_metadata.masteringDisplayInfo, UINT32(sizeof(MasteringDisplay)))) {
+ layer_buffer->color_metadata.masteringDisplayInfo = new_metadata.masteringDisplayInfo;
+ layer_->update_mask.set(kMetadataUpdate);
+ }
+ if (new_metadata.contentLightLevel.lightLevelSEIEnabled &&
+ !SameConfig(&new_metadata.contentLightLevel,
+ &layer_buffer->color_metadata.contentLightLevel, UINT32(sizeof(ContentLightLevel)))) {
+ layer_buffer->color_metadata.contentLightLevel = new_metadata.contentLightLevel;
+ layer_->update_mask.set(kMetadataUpdate);
+ }
+ if (new_metadata.cRI.criEnabled &&
+ !SameConfig(&new_metadata.cRI, &layer_buffer->color_metadata.cRI,
+ UINT32(sizeof(ColorRemappingInfo)))) {
+ layer_buffer->color_metadata.cRI = new_metadata.cRI;
+ layer_->update_mask.set(kMetadataUpdate);
+ }
+ if (new_metadata.dynamicMetaDataValid &&
!SameConfig(layer_buffer->color_metadata.dynamicMetaDataPayload,
- old_meta_data.dynamicMetaDataPayload, HDR_DYNAMIC_META_DATA_SZ)) {
+ new_metadata.dynamicMetaDataPayload, HDR_DYNAMIC_META_DATA_SZ)) {
+ layer_buffer->color_metadata.dynamicMetaDataValid = true;
+ layer_buffer->color_metadata.dynamicMetaDataLen = new_metadata.dynamicMetaDataLen;
+ std::memcpy(layer_buffer->color_metadata.dynamicMetaDataPayload,
+ new_metadata.dynamicMetaDataPayload, new_metadata.dynamicMetaDataLen);
layer_->update_mask.set(kMetadataUpdate);
}
} else {
diff --git a/sdm/libs/hwc2/hwc_layers.h b/sdm/libs/hwc2/hwc_layers.h
index aa77e60..f6e9d71 100644
--- a/sdm/libs/hwc2/hwc_layers.h
+++ b/sdm/libs/hwc2/hwc_layers.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014-2019, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014-2020, The Linux Foundation. All rights reserved.
* Not a Contribution.
*
* Copyright 2015 The Android Open Source Project
@@ -139,7 +139,6 @@
bool non_integral_source_crop_ = false;
bool has_metadata_refresh_rate_ = false;
bool buffer_flipped_ = false;
- bool per_frame_hdr_metadata_ = false; // used to track if perframe metadata and blob is set.
// Composition requested by client(SF) Original
HWC2::Composition client_requested_orig_ = HWC2::Composition::Device;