drm_hwcomposer: Fix HDR metadata handling
Remove const qualifiers from luminance data variables.
Set an empty HDR_OUTPUT_METADATA blob to ensure the property is
cleared when switching color modes.
Change-Id: I15d1477a98a1f4e103ef0202c157b8dfb5af8f86
Signed-off-by: Sasha McIntosh <sashamcintosh@google.com>
diff --git a/hwc2_device/HwcDisplay.cpp b/hwc2_device/HwcDisplay.cpp
index 977ab1a..a438263 100644
--- a/hwc2_device/HwcDisplay.cpp
+++ b/hwc2_device/HwcDisplay.cpp
@@ -863,25 +863,25 @@
switch (mode) {
case HAL_COLOR_MODE_NATIVE:
- hdr_metadata_.reset();
+ hdr_metadata_ = std::make_shared<hdr_output_metadata>();
colorspace_ = Colorspace::kDefault;
break;
case HAL_COLOR_MODE_STANDARD_BT601_625:
case HAL_COLOR_MODE_STANDARD_BT601_625_UNADJUSTED:
case HAL_COLOR_MODE_STANDARD_BT601_525:
case HAL_COLOR_MODE_STANDARD_BT601_525_UNADJUSTED:
- hdr_metadata_.reset();
+ hdr_metadata_ = std::make_shared<hdr_output_metadata>();
// The DP spec does not say whether this is the 525 or the 625 line version.
colorspace_ = Colorspace::kBt601Ycc;
break;
case HAL_COLOR_MODE_STANDARD_BT709:
case HAL_COLOR_MODE_SRGB:
- hdr_metadata_.reset();
+ hdr_metadata_ = std::make_shared<hdr_output_metadata>();
colorspace_ = Colorspace::kBt709Ycc;
break;
case HAL_COLOR_MODE_DCI_P3:
case HAL_COLOR_MODE_DISPLAY_P3:
- hdr_metadata_.reset();
+ hdr_metadata_ = std::make_shared<hdr_output_metadata>();
colorspace_ = Colorspace::kDciP3RgbD65;
break;
case HAL_COLOR_MODE_DISPLAY_BT2020: {
diff --git a/utils/EdidWrapper.h b/utils/EdidWrapper.h
index 137e8be..651c284 100644
--- a/utils/EdidWrapper.h
+++ b/utils/EdidWrapper.h
@@ -41,9 +41,9 @@
types.clear();
};
virtual void GetHdrCapabilities(std::vector<ui::Hdr> &types,
- const float * /*max_luminance*/,
- const float * /*max_average_luminance*/,
- const float * /*min_luminance*/) {
+ float * /*max_luminance*/,
+ float * /*max_average_luminance*/,
+ float * /*min_luminance*/) {
GetSupportedHdrTypes(types);
};
virtual void GetColorModes(std::vector<Colormode> &color_modes) {
@@ -75,9 +75,9 @@
void GetSupportedHdrTypes(std::vector<ui::Hdr> &types) override;
void GetHdrCapabilities(std::vector<ui::Hdr> &types,
- const float *max_luminance,
- const float *max_average_luminance,
- const float *min_luminance) override;
+ float *max_luminance,
+ float *max_average_luminance,
+ float *min_luminance) override;
void GetColorModes(std::vector<Colormode> &color_modes) override;
diff --git a/utils/LibdisplayEdidWrapper.cpp b/utils/LibdisplayEdidWrapper.cpp
index e35b461..ad737a2 100644
--- a/utils/LibdisplayEdidWrapper.cpp
+++ b/utils/LibdisplayEdidWrapper.cpp
@@ -53,15 +53,15 @@
}
void LibdisplayEdidWrapper::GetHdrCapabilities(
- std::vector<ui::Hdr> &types, const float *max_luminance,
- const float *max_average_luminance, const float *min_luminance) {
+ std::vector<ui::Hdr> &types, float *max_luminance,
+ float *max_average_luminance, float *min_luminance) {
GetSupportedHdrTypes(types);
const auto *hdr_static_meta = di_info_get_hdr_static_metadata(info_);
- max_luminance = &hdr_static_meta->desired_content_max_luminance;
- max_average_luminance = &hdr_static_meta
+ *max_luminance = hdr_static_meta->desired_content_max_luminance;
+ *max_average_luminance = hdr_static_meta
->desired_content_max_frame_avg_luminance;
- min_luminance = &hdr_static_meta->desired_content_min_luminance;
+ *min_luminance = hdr_static_meta->desired_content_min_luminance;
}
void LibdisplayEdidWrapper::GetColorModes(std::vector<Colormode> &color_modes) {