hwc2: Fixes to find the right display mode
* Fix incorrect P3 string
* Enumerate DCI P3 as Display P3 to the framework
* If the color gamut attribute is not found, try the mode name.
Change-Id: I57d574a4672474a9357794afb45d4f27237f8413
CRs-Fixed: 2047471
diff --git a/sdm/include/private/color_params.h b/sdm/include/private/color_params.h
index 14ec40f..fdab206 100644
--- a/sdm/include/private/color_params.h
+++ b/sdm/include/private/color_params.h
@@ -89,7 +89,7 @@
static const std::string kSdr = "sdr";
static const std::string kNative = "native";
-static const std::string kDcip3 = "dci_p3";
+static const std::string kDcip3 = "dcip3";
static const std::string kSrgb = "srgb";
static const std::string kDisplayP3 = "display_p3";
diff --git a/sdm/libs/hwc2/hwc_display.cpp b/sdm/libs/hwc2/hwc_display.cpp
index f7a9dec..e2bd805 100644
--- a/sdm/libs/hwc2/hwc_display.cpp
+++ b/sdm/libs/hwc2/hwc_display.cpp
@@ -208,8 +208,8 @@
DLOGV_IF(kTagQDCM, "Color Mode[%d] = %s", i, mode_string.c_str());
AttrVal attr;
error = display_intf_->GetColorModeAttr(mode_string, &attr);
+ std::string color_gamut, dynamic_range, pic_quality;
if (!attr.empty()) {
- std::string color_gamut, dynamic_range, pic_quality;
for (auto &it : attr) {
if (it.first.find(kColorGamutAttribute) != std::string::npos) {
color_gamut = it.second;
@@ -230,12 +230,15 @@
PopulateTransform(HAL_COLOR_MODE_SRGB, mode_string, color_transform);
} else if ((color_gamut == kDcip3) &&
(pic_quality.empty() || pic_quality == kStandard)) {
- PopulateTransform(HAL_COLOR_MODE_DCI_P3, mode_string, color_transform);
+ PopulateTransform(HAL_COLOR_MODE_DISPLAY_P3, mode_string, color_transform);
} else if ((color_gamut == kDisplayP3) &&
(pic_quality.empty() || pic_quality == kStandard)) {
PopulateTransform(HAL_COLOR_MODE_DISPLAY_P3, mode_string, color_transform);
}
- } else {
+ }
+
+ // Look at the mode name, if no color gamut is found
+ if (color_gamut.empty()) {
if (mode_string.find("hal_native") != std::string::npos) {
PopulateTransform(HAL_COLOR_MODE_NATIVE, mode_string, mode_string);
} else if (mode_string.find("hal_srgb") != std::string::npos) {