hwc2: Fix solid fill

* Solid fill layers need a valid src rect
* Fix color values and packing

Bug: 30255380
Bug: 30257604
Change-Id: Iee92a053e145898688a9b3494d2d9cbdffdf9f56
CRs-Fixed: 1045472
diff --git a/msm8996/sdm/libs/hwc/hwc_color_manager.cpp b/msm8996/sdm/libs/hwc/hwc_color_manager.cpp
index 8e11fce..203ab09 100644
--- a/msm8996/sdm/libs/hwc/hwc_color_manager.cpp
+++ b/msm8996/sdm/libs/hwc/hwc_color_manager.cpp
@@ -53,8 +53,8 @@
 namespace sdm {
 
 uint32_t HWCColorManager::Get8BitsARGBColorValue(const PPColorFillParams &params) {
-  uint32_t argb_color = ((params.color.r << 16) & 0xff0000) | ((params.color.g) & 0xff)
-                        | ((params.color.b << 8) & 0xff00);
+  uint32_t argb_color = ((params.color.r << 16) & 0xff0000) | ((params.color.g << 8) & 0xff00) |
+                        ((params.color.b) & 0xff);
   return argb_color;
 }
 
diff --git a/msm8996/sdm/libs/hwc2/hwc_color_manager.cpp b/msm8996/sdm/libs/hwc2/hwc_color_manager.cpp
index c40ec4b..9ab4952 100644
--- a/msm8996/sdm/libs/hwc2/hwc_color_manager.cpp
+++ b/msm8996/sdm/libs/hwc2/hwc_color_manager.cpp
@@ -53,8 +53,8 @@
 namespace sdm {
 
 uint32_t HWCColorManager::Get8BitsARGBColorValue(const PPColorFillParams &params) {
-  uint32_t argb_color = ((params.color.r << 16) & 0xff0000) | ((params.color.g) & 0xff) |
-                        ((params.color.b << 8) & 0xff00);
+  uint32_t argb_color = ((params.color.r << 16) & 0xff0000) | ((params.color.g << 8) & 0xff00) |
+                        ((params.color.b) & 0xff);
   return argb_color;
 }
 
diff --git a/msm8996/sdm/libs/hwc2/hwc_display.cpp b/msm8996/sdm/libs/hwc2/hwc_display.cpp
index 3e582b9..a047694 100644
--- a/msm8996/sdm/libs/hwc2/hwc_display.cpp
+++ b/msm8996/sdm/libs/hwc2/hwc_display.cpp
@@ -369,8 +369,17 @@
     ApplyScanAdjustment(&scaled_display_frame);
     hwc_layer->SetLayerDisplayFrame(scaled_display_frame);
     ApplyDeInterlaceAdjustment(layer);
-    // TODO(user): Verify if we still need to configure the solid fill layerbuffer,
-    // it should already have a valid dst_rect by this point
+    // SDM requires these details even for solid fill
+    if (layer->flags.solid_fill) {
+      LayerBuffer *layer_buffer = layer->input_buffer;
+      uint32_t display_width = 0, display_height = 0;
+      GetMixerResolution(&display_width, &display_height);
+      layer_buffer->width = display_width;
+      layer_buffer->height = display_height;
+      layer_buffer->acquire_fence_fd = -1;
+      layer_buffer->release_fence_fd = -1;
+      layer->src_rect = layer->dst_rect;
+    }
 
     if (layer->frame_rate > metadata_refresh_rate_) {
       metadata_refresh_rate_ = SanitizeRefreshRate(layer->frame_rate);
diff --git a/msm8996/sdm/libs/hwc2/hwc_layers.cpp b/msm8996/sdm/libs/hwc2/hwc_layers.cpp
index d35523d..098959b 100644
--- a/msm8996/sdm/libs/hwc2/hwc_layers.cpp
+++ b/msm8996/sdm/libs/hwc2/hwc_layers.cpp
@@ -128,9 +128,8 @@
 HWC2::Error HWCLayer::SetLayerColor(hwc_color_t color) {
   layer_->solid_fill_color = GetUint32Color(color);
   layer_->input_buffer->format = kFormatARGB8888;
-  DLOGD("Layer color set to: %u", layer_->solid_fill_color);
-  DLOGD("[%" PRIu64 "][%" PRIu64 "] Layer color set to %u  %" PRIu64, display_id_, id_,
-        layer_->solid_fill_color);
+  DLOGV_IF(kTagCompManager, "[%" PRIu64 "][%" PRIu64 "] Layer color set to %x", display_id_, id_,
+           layer_->solid_fill_color);
   return HWC2::Error::None;
 }
 
@@ -278,7 +277,7 @@
   uint32_t r = UINT32(source.r) << 16;
   uint32_t g = UINT32(source.g) << 8;
   uint32_t b = UINT32(source.b);
-  uint32_t color = a & r & g & b;
+  uint32_t color = a | r | g | b;
   return color;
 }