OSDN Git Service

Overlaylayer: Dump more information
authorHarish Krupo <harish.krupo.kps@intel.com>
Sun, 6 May 2018 06:49:32 +0000 (12:19 +0530)
committerKalyan Kondapally <kalyan.kondapally@intel.com>
Tue, 15 May 2018 05:35:20 +0000 (22:35 -0700)
Dump Source crop, display frame and surface damage
when ENABLE_DISPLAY_DUMP is enabled.

Jira: None
Test: When ENABLE_DISPLAY_DUMP is defined, each layer's
      surface damage, souce crop and display frame rects
      are dumped.

Signed-off-by: Harish Krupo <harish.krupo.kps@intel.com>
common/core/overlaylayer.cpp
common/utils/hwcutils.cpp
public/hwcutils.h

index 0a5ec95..5e8fcfa 100644 (file)
@@ -536,6 +536,9 @@ void OverlayLayer::Dump() {
   DUMPTRACE("SourceHeight: %d", source_crop_height_);
   DUMPTRACE("DstWidth: %d", display_frame_width_);
   DUMPTRACE("DstHeight: %d", display_frame_height_);
+  DUMPTRACE("Source crop %s", StringifyRect(source_crop_).c_str());
+  DUMPTRACE("Display frame %s", StringifyRect(display_frame_).c_str());
+  DUMPTRACE("Surface Damage %s", StringifyRect(surface_damage_).c_str());
   DUMPTRACE("AquireFence: %d", imported_buffer_->acquire_fence_);
 
   imported_buffer_->buffer_->Dump();
index abef1be..db46d85 100644 (file)
@@ -144,4 +144,26 @@ uint32_t GetTotalPlanesForFormat(uint32_t format) {
   return 1;
 }
 
+std::string StringifyRect(HwcRect<int> rect) {
+  std::stringstream ss;
+  ss << "{(" << rect.left << "," << rect.top << ") "
+     << "(" << rect.right << "," << rect.bottom << ")}";
+
+  return ss.str();
+}
+
+std::string StringifyRegion(HwcRegion region) {
+  std::stringstream ss;
+  std::string separator = "";
+
+  ss << "[";
+  for (auto& rect : region) {
+    ss << separator << StringifyRect(rect);
+    separator = ", ";
+  }
+  ss << "]";
+
+  return ss.str();
+}
+
 }  // namespace hwcomposer
index d43a82d..4142a04 100644 (file)
@@ -18,6 +18,7 @@
 #define COMMON_UTILS_HWCUTILS_H_
 
 #include <hwcdefs.h>
+#include <sstream>
 
 namespace hwcomposer {
 
@@ -87,6 +88,16 @@ inline OverlapType AnalyseOverlap(const hwcomposer::HwcRect<int>& rect,
   }
 }
 
+/**
+ * Pretty-print HwcRect for debugging.
+ */
+std::string StringifyRect(HwcRect<int> rect);
+
+/**
+ * Pretty-print HwcRegion for debugging.
+ */
+std::string StringifyRegion(HwcRegion region);
+
 }  // namespace hwcomposer
 
 #endif  // COMMON_UTILS_HWCUTILS_H_