Giacomo Travaglini has submitted this change and it was merged. ( https://gem5-review.googlesource.com/5183 )

Change subject: dev: Using Configurable image writer in HDLcd
......................................................................

dev: Using Configurable image writer in HDLcd

The fixed image writer (which was dumping .bmp images only) has been
replaced by the configurable one in HDLcd device.  Default format is
Auto, which gives gem5 the freedom to choose the format it prefers.

Change-Id: I0643266556bb10b43cdebd628f6daa2cd5e105dd
Reviewed-by: Andreas Sandberg <andreas.sandb...@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/5183
Reviewed-by: Jason Lowe-Power <ja...@lowepower.com>
Maintainer: Andreas Sandberg <andreas.sandb...@arm.com>
---
M src/dev/arm/RealView.py
M src/dev/arm/hdlcd.cc
M src/dev/arm/hdlcd.hh
3 files changed, 17 insertions(+), 6 deletions(-)

Approvals:
  Jason Lowe-Power: Looks good to me, approved
  Andreas Sandberg: Looks good to me, approved; Looks good to me, approved



diff --git a/src/dev/arm/RealView.py b/src/dev/arm/RealView.py
index 51aa1cf..08145bf 100644
--- a/src/dev/arm/RealView.py
+++ b/src/dev/arm/RealView.py
@@ -56,6 +56,7 @@
 from EnergyCtrl import EnergyCtrl
 from ClockDomain import SrcClockDomain
 from SubSystem import SubSystem
+from Graphics import ImageFormat

 # Platforms with KVM support should generally use in-kernel GIC
 # emulation. Use a GIC model that automatically switches between
@@ -298,7 +299,10 @@
                                     "selector order in some kernels")
     workaround_dma_line_count = Param.Bool(True, "Workaround incorrect "
                                            "DMA line count (off by 1)")
- enable_capture = Param.Bool(True, "capture frame to system.framebuffer.bmp")
+    enable_capture = Param.Bool(True, "capture frame to "
+                                      "system.framebuffer.{extension}")
+    frame_format = Param.ImageFormat("Auto",
+                                     "image format of the captured frame")

     pixel_buffer_size = Param.MemorySize32("2kB", "Size of address range")

diff --git a/src/dev/arm/hdlcd.cc b/src/dev/arm/hdlcd.cc
index 98f2a3d..20dc7d4 100644
--- a/src/dev/arm/hdlcd.cc
+++ b/src/dev/arm/hdlcd.cc
@@ -47,6 +47,7 @@
 #include "debug/HDLcd.hh"
 #include "dev/arm/amba_device.hh"
 #include "dev/arm/base_gic.hh"
+#include "enums/ImageFormat.hh"
 #include "mem/packet.hh"
 #include "mem/packet_access.hh"
 #include "params/HDLcd.hh"
@@ -85,11 +86,13 @@

       virtRefreshEvent([this]{ virtRefresh(); }, name()),
       // Other
-      bmp(&pixelPump.fb), pic(NULL), conv(PixelConverter::rgba8888_le),
+ imgFormat(p->frame_format), pic(NULL), conv(PixelConverter::rgba8888_le),
       pixelPump(*this, *p->pxl_clk, p->pixel_chunk)
 {
     if (vnc)
         vnc->setFrameBuffer(&pixelPump.fb);
+
+    imgWriter = createImgWriter(imgFormat, &pixelPump.fb);
 }

 HDLcd::~HDLcd()
@@ -572,13 +575,14 @@
     if (enableCapture) {
         if (!pic) {
             pic = simout.create(
-                csprintf("%s.framebuffer.bmp", sys->name()),
+                csprintf("%s.framebuffer.%s",
+                         sys->name(), imgWriter->getImgExtension()),
                 true);
         }

         assert(pic);
         pic->stream()->seekp(0);
-        bmp.write(*pic->stream());
+        imgWriter->write(*pic->stream());
     }
 }

diff --git a/src/dev/arm/hdlcd.hh b/src/dev/arm/hdlcd.hh
index dd52e20..f737710 100644
--- a/src/dev/arm/hdlcd.hh
+++ b/src/dev/arm/hdlcd.hh
@@ -79,8 +79,8 @@
 #include <fstream>
 #include <memory>

-#include "base/bmpwriter.hh"
 #include "base/framebuffer.hh"
+#include "base/imgwriter.hh"
 #include "base/output.hh"
 #include "dev/arm/amba_device.hh"
 #include "dev/pixelpump.hh"
@@ -350,7 +350,10 @@
     EventFunctionWrapper virtRefreshEvent;

     /** Helper to write out bitmaps */
-    BmpWriter bmp;
+    std::unique_ptr<ImgWriter> imgWriter;
+
+    /** Image Format */
+    Enums::ImageFormat imgFormat;

     /** Picture of what the current frame buffer looks like */
     OutputStream *pic;

--
To view, visit https://gem5-review.googlesource.com/5183
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I0643266556bb10b43cdebd628f6daa2cd5e105dd
Gerrit-Change-Number: 5183
Gerrit-PatchSet: 3
Gerrit-Owner: Giacomo Travaglini <giacomo.travagl...@arm.com>
Gerrit-Reviewer: Andreas Sandberg <andreas.sandb...@arm.com>
Gerrit-Reviewer: Giacomo Travaglini <giacomo.travagl...@arm.com>
Gerrit-Reviewer: Jason Lowe-Power <ja...@lowepower.com>
_______________________________________________
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to