Skip to content

Commit

Permalink
sdm:hwc2: Store higher order mode id in case of clash
Browse files Browse the repository at this point in the history
If we get the same mode name from the XML files, give preference
to the higher order mode ID.

Bug: 27346522
Change-Id: Iadb55d29aca54ad22732ed3c17a7c2c62a1e4f40
  • Loading branch information
naseer authored and spfetsch committed Jul 25, 2016
1 parent a36d58b commit 29b756a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
14 changes: 11 additions & 3 deletions msm8996/sdm/libs/core/display_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,7 @@ DisplayError DisplayBase::GetColorModeCount(uint32_t *mode_count) {
return kErrorNotSupported;
}

DLOGI("Number of color modes = %d", num_color_modes_);
DLOGV_IF(kTagQDCM, "Number of modes from color manager = %d", num_color_modes_);
*mode_count = num_color_modes_;

return kErrorNone;
Expand Down Expand Up @@ -720,7 +720,15 @@ DisplayError DisplayBase::GetColorModes(uint32_t *mode_count,
for (uint32_t i = 0; i < num_color_modes_; i++) {
DLOGV_IF(kTagQDCM, "Color Mode[%d]: Name = %s mode_id = %d", i, color_modes_[i].name,
color_modes_[i].id);
color_mode_map_.insert(std::make_pair(color_modes_[i].name, &color_modes_[i]));
auto it = color_mode_map_.find(color_modes_[i].name);
if (it != color_mode_map_.end()) {
if (it->second->id < color_modes_[i].id) {
color_mode_map_.erase(it);
color_mode_map_.insert(std::make_pair(color_modes_[i].name, &color_modes_[i]));
}
} else {
color_mode_map_.insert(std::make_pair(color_modes_[i].name, &color_modes_[i]));
}
}
}

Expand Down Expand Up @@ -749,7 +757,7 @@ DisplayError DisplayBase::SetColorMode(const std::string &color_mode) {

SDEDisplayMode *sde_display_mode = it->second;

DLOGV_IF(kTagQDCM, "Color Mode Name = %s corresponding mode_id = %d", sde_display_mode->name,
DLOGD("Color Mode Name = %s corresponding mode_id = %d", sde_display_mode->name,
sde_display_mode->id);
DisplayError error = kErrorNone;
error = color_mgr_->ColorMgrSetMode(sde_display_mode->id);
Expand Down
4 changes: 2 additions & 2 deletions msm8996/sdm/libs/hwc2/hwc_display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,14 +169,14 @@ void HWCColorMode::PopulateColorModes() {
return;
}

DLOGI("Color Modes supported count = %d", color_mode_count);
DLOGV_IF(kTagQDCM, "Color Modes supported count = %d", color_mode_count);

std::vector<std::string> color_modes(color_mode_count);
error = display_intf_->GetColorModes(&color_mode_count, &color_modes);

for (uint32_t i = 0; i < color_mode_count; i++) {
std::string &mode_string = color_modes.at(i);
DLOGI("Color Mode[%d] = %s", i, mode_string.c_str());
DLOGV_IF(kTagQDCM, "Color Mode[%d] = %s", i, mode_string.c_str());
if (mode_string.find("hal_native") != std::string::npos) {
PopulateTransform(HAL_COLOR_MODE_NATIVE, mode_string);
} else if (mode_string.find("hal_srgb") != std::string::npos) {
Expand Down

0 comments on commit 29b756a

Please sign in to comment.