Merge 6fa447bf0f1dbe441905488ea2d82a27bb637aca on remote branch

Change-Id: I8f66e159b2505752e1b1134f07892eb76f6483b9
diff --git a/composer/QtiComposerClient.cpp b/composer/QtiComposerClient.cpp
index 2d37d74..b772193 100644
--- a/composer/QtiComposerClient.cpp
+++ b/composer/QtiComposerClient.cpp
@@ -1996,7 +1996,7 @@
   for (const auto& m : metadata) {
     keys.push_back(static_cast<int32_t>(m.key));
     sizes_of_metablob_.push_back(m.blob.size());
-    for (uint8_t i = 0; i < m.blob.size(); i++) {
+    for (size_t i = 0; i < m.blob.size(); i++) {
       blob_of_data_.push_back(m.blob[i]);
     }
   }
diff --git a/gralloc/gr_buf_mgr.cpp b/gralloc/gr_buf_mgr.cpp
index 4c839a1..5c47884 100644
--- a/gralloc/gr_buf_mgr.cpp
+++ b/gralloc/gr_buf_mgr.cpp
@@ -1473,7 +1473,10 @@
       if (android::gralloc4::decodeDataspace(in, &dataspace)) {
         return Error::UNSUPPORTED;
       }
-      dataspaceToColorMetadata(dataspace, &metadata->color);
+      // Avoid setting standard dataspace flag for unknown/invalid dataspace
+      if (dataspaceToColorMetadata(dataspace, &metadata->color) != Error::NONE) {
+        return Error::NONE;
+      }
       break;
     case (int64_t)StandardMetadataType::BLEND_MODE:
       BlendMode mode;
diff --git a/sdm/libs/core/display_base.cpp b/sdm/libs/core/display_base.cpp
index e14268c..331a0cc 100644
--- a/sdm/libs/core/display_base.cpp
+++ b/sdm/libs/core/display_base.cpp
@@ -4067,6 +4067,19 @@
         }
       }
 
+      switch (de_tuning_cfg_data->params.content_type) {
+        case kDeContentTypeVideo:
+          de_data.content_type = kContentTypeVideo;
+          break;
+        case kDeContentTypeGraphics:
+          de_data.content_type = kContentTypeGraphics;
+          break;
+        case kDeContentTypeUnknown:
+        default:
+          de_data.content_type = kContentTypeUnknown;
+          break;
+      }
+
       if (de_tuning_cfg_data->params.flags & kDeTuningFlagDeBlend) {
         de_data.override_flags |= kOverrideDEBlend;
         de_data.de_blend = de_tuning_cfg_data->params.de_blend;
diff --git a/sdm/libs/core/display_builtin.cpp b/sdm/libs/core/display_builtin.cpp
index 4cace41..1a853be 100644
--- a/sdm/libs/core/display_builtin.cpp
+++ b/sdm/libs/core/display_builtin.cpp
@@ -949,11 +949,14 @@
 
 DisplayError DisplayBuiltIn::PostCommit(HWLayersInfo *hw_layers_info) {
   DisplayBase::PostCommit(hw_layers_info);
-
-  if (pending_brightness_) {
-    Fence::Wait(retire_fence_);
-    SetPanelBrightness(cached_brightness_);
-    pending_brightness_ = false;
+  // Mutex scope
+  {
+    lock_guard<recursive_mutex> obj(brightness_lock_);
+    if (pending_brightness_) {
+      Fence::Wait(retire_fence_);
+      SetPanelBrightness(cached_brightness_);
+      pending_brightness_ = false;
+    }
   }
 
   if (commit_event_enabled_) {