sdm: Add support to report the pixel format of the display

Add support to report the pixel format of the display as part of
the display attributes.

CRs-Fixed: 814136
Change-Id: I68f7a6c35c010c67ba91e89c74607dc52b404025
diff --git a/libqdutils/display_config.cpp b/libqdutils/display_config.cpp
index 1470223..3415ac6 100644
--- a/libqdutils/display_config.cpp
+++ b/libqdutils/display_config.cpp
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2013-2014 The Linux Foundation. All rights reserved.
+* Copyright (c) 2013-2014, 2016, 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
@@ -253,6 +253,7 @@
             dpyattr.xdpi = outParcel.readFloat();
             dpyattr.ydpi = outParcel.readFloat();
             dpyattr.panel_type = (char) outParcel.readInt32();
+            dpyattr.is_yuv = outParcel.readInt32();
             ALOGI("%s() Received attrs for index %d: xres %d, yres %d",
                     __FUNCTION__, configIndex, dpyattr.xres, dpyattr.yres);
         } else {
diff --git a/libqdutils/display_config.h b/libqdutils/display_config.h
index 05a7f29..15aba94 100644
--- a/libqdutils/display_config.h
+++ b/libqdutils/display_config.h
@@ -85,8 +85,9 @@
     float xdpi;
     float ydpi;
     char panel_type;
+    bool is_yuv;
     DisplayAttributes() : vsync_period(0), xres(0), yres(0), xdpi(0.0f),
-            ydpi(0.0f), panel_type(0) {}
+            ydpi(0.0f), panel_type(0), is_yuv(false) {}
 } DisplayAttributes_t;
 
 //=============================================================================
diff --git a/sdm/include/core/display_interface.h b/sdm/include/core/display_interface.h
index a74b34b..adb1851 100644
--- a/sdm/include/core/display_interface.h
+++ b/sdm/include/core/display_interface.h
@@ -96,6 +96,7 @@
   float y_dpi = 0.0f;             //!< Dots per inch in Y-direction.
   uint32_t fps = 0;               //!< Frame rate per second.
   uint32_t vsync_period_ns = 0;   //!< VSync period in nanoseconds.
+  bool is_yuv = false;            //!< If the display output is in YUV format.
 };
 
 /*! @brief Event data associated with VSync event.
diff --git a/sdm/include/private/hw_info_types.h b/sdm/include/private/hw_info_types.h
index 38ccf21..bc5361c 100644
--- a/sdm/include/private/hw_info_types.h
+++ b/sdm/include/private/hw_info_types.h
@@ -455,7 +455,8 @@
             (vsync_period_ns != attributes.vsync_period_ns) ||
             (v_front_porch != attributes.v_front_porch) ||
             (v_back_porch != attributes.v_back_porch) ||
-            (v_pulse_width != attributes.v_pulse_width));
+            (v_pulse_width != attributes.v_pulse_width) ||
+            (is_yuv != attributes.is_yuv));
   }
 
   bool operator ==(const HWDisplayAttributes &attributes) {
diff --git a/sdm/libs/core/fb/hw_hdmi.cpp b/sdm/libs/core/fb/hw_hdmi.cpp
index 6d4bf9b..db7a2d9 100644
--- a/sdm/libs/core/fb/hw_hdmi.cpp
+++ b/sdm/libs/core/fb/hw_hdmi.cpp
@@ -260,6 +260,7 @@
   }
 
   GetDisplayS3DSupport(index, display_attributes);
+  display_attributes->is_yuv = IS_BIT_SET(timing_mode->pixel_formats, 1);
 
   return kErrorNone;
 }
diff --git a/sdm/libs/hwc/hwc_session.cpp b/sdm/libs/hwc/hwc_session.cpp
index 7928765..9632d71 100644
--- a/sdm/libs/hwc/hwc_session.cpp
+++ b/sdm/libs/hwc/hwc_session.cpp
@@ -939,6 +939,7 @@
       output_parcel->writeFloat(attributes.x_dpi);
       output_parcel->writeFloat(attributes.y_dpi);
       output_parcel->writeInt32(0);  // Panel type, unsupported.
+      output_parcel->writeInt32(attributes.is_yuv);
     }
   }