Add support for multiple color modes
Bug: 29044347
Change-Id: Iea048eaa62f072a9bbefc4f3a6c29a9e593eab69
diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.cpp b/services/surfaceflinger/DisplayHardware/HWComposer.cpp
index 2629794..133e5f1 100644
--- a/services/surfaceflinger/DisplayHardware/HWComposer.cpp
+++ b/services/surfaceflinger/DisplayHardware/HWComposer.cpp
@@ -359,6 +359,27 @@
return config;
}
+std::vector<int32_t> HWComposer::getColorModes(int32_t displayId) const {
+ std::vector<int32_t> modes;
+
+ if (!isValidDisplay(displayId)) {
+ ALOGE("getColorModes: Attempted to access invalid display %d",
+ displayId);
+ return modes;
+ }
+ const std::shared_ptr<HWC2::Display>& hwcDisplay =
+ mDisplayData[displayId].hwcDisplay;
+
+ auto error = hwcDisplay->getColorModes(&modes);
+ if (error != HWC2::Error::None) {
+ ALOGE("getColorModes failed for display %d: %s (%d)", displayId,
+ to_string(error).c_str(), static_cast<int32_t>(error));
+ return std::vector<int32_t>();
+ }
+
+ return modes;
+}
+
void HWComposer::setVsyncEnabled(int32_t disp, HWC2::Vsync enabled) {
if (disp < 0 || disp >= HWC_DISPLAY_VIRTUAL) {
ALOGD("setVsyncEnabled: Ignoring for virtual display %d", disp);
diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.h b/services/surfaceflinger/DisplayHardware/HWComposer.h
index 1a2a153..aa233df 100644
--- a/services/surfaceflinger/DisplayHardware/HWComposer.h
+++ b/services/surfaceflinger/DisplayHardware/HWComposer.h
@@ -149,6 +149,8 @@
std::shared_ptr<const HWC2::Display::Config>
getActiveConfig(int32_t displayId) const;
+ std::vector<int32_t> getColorModes(int32_t displayId) const;
+
// for debugging ----------------------------------------------------------
void dump(String8& out) const;