Andreas Sandberg has submitted this change and it was merged. ( https://gem5-review.googlesource.com/2241 )

Change subject: dev: Add support for single-pass scan out in the PixelPump
......................................................................

dev: Add support for single-pass scan out in the PixelPump

Add a helper function to scan out an entire frame in one time
step. This requires the public PixelPump to be changed somewhat to
separate timing updates from general PixelPump control. Instead of
calling PixelPump::start(timings), timings now need to be updated
using a separate call to PixelPump::updateTimings(timings) before
calling PixelPump::start().

Display controllers that don't need accurate timing (e.g., in KVM
mode), can use the new PixelPump::renderFrame() API to render an
entire frame in one step. This call results in the same callbacks
(e.g., calls to nextPixel()) as the timing calls, but they all happen
in immediately. Unlike the timing counterpart, renderFrame() doesn't
support buffer underruns and will panic if nextPixle() indicates an
underrun.

Change-Id: I76c84db04249b02d4207c5281d82aa693d0881be
Signed-off-by: Andreas Sandberg <andreas.sandb...@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/2241
Reviewed-by: Rahul Thakur <rjtha...@google.com>
Reviewed-by: Jason Lowe-Power <ja...@lowepower.com>
---
M src/dev/arm/hdlcd.cc
M src/dev/pixelpump.cc
M src/dev/pixelpump.hh
3 files changed, 82 insertions(+), 11 deletions(-)

Approvals:
  Rahul Thakur: Looks good to me, approved
  Jason Lowe-Power: Looks good to me, but someone else must approve
  Andreas Sandberg: Looks good to me, approved



diff --git a/src/dev/arm/hdlcd.cc b/src/dev/arm/hdlcd.cc
index 363aeba..a92ae46 100644
--- a/src/dev/arm/hdlcd.cc
+++ b/src/dev/arm/hdlcd.cc
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010-2013, 2015 ARM Limited
+ * Copyright (c) 2010-2013, 2015, 2017 ARM Limited
  * All rights reserved
  *
  * The license below extends only to copyright in the software and shall
@@ -204,8 +204,11 @@
     // We restored from an old checkpoint without a pixel pump, start
     // an new refresh. This typically happens when restoring from old
     // checkpoints.
-    if (enabled() && !pixelPump.active())
-        pixelPump.start(displayTimings());
+    if (enabled() && !pixelPump.active()) {
+        // Update timing parameter before rendering frames
+        pixelPump.updateTimings(displayTimings());
+        pixelPump.start();
+    }

     // We restored from a checkpoint and need to update the VNC server
     if (pixelPump.active() && vnc)
@@ -476,7 +479,10 @@
 {
     createDmaEngine();
     conv = pixelConverter();
-    pixelPump.start(displayTimings());
+
+    // Update timing parameter before rendering frames
+    pixelPump.updateTimings(displayTimings());
+    pixelPump.start();
 }

 void
diff --git a/src/dev/pixelpump.cc b/src/dev/pixelpump.cc
index 3ffe96d..e1cf73a 100644
--- a/src/dev/pixelpump.cc
+++ b/src/dev/pixelpump.cc
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 ARM Limited
+ * Copyright (c) 2015, 2017 ARM Limited
  * All rights reserved
  *
  * The license below extends only to copyright in the software and shall
@@ -136,10 +136,11 @@
         event->unserializeSection(cp, event->name());
 }

-
 void
-BasePixelPump::start(const DisplayTimings &timings)
+BasePixelPump::updateTimings(const DisplayTimings &timings)
 {
+    panic_if(active(), "Trying to update timings in active PixelPump\n");
+
     _timings = timings;

     // Resize the frame buffer if needed
@@ -149,8 +150,14 @@
     // Set the current line past the last line in the frame. This
     // triggers the new frame logic in beginLine().
     line = _timings.linesPerFrame();
+}
+
+void
+BasePixelPump::start()
+{
     schedule(evBeginLine, clockEdge());
 }
+

 void
 BasePixelPump::stop()
@@ -241,6 +248,54 @@
     }
 }

+void
+BasePixelPump::renderFrame()
+{
+    _underrun = false;
+    line = 0;
+
+    // Signal vsync end and render the frame
+    line = _timings.lineVBackPorchStart();
+    onVSyncEnd();
+
+    // We only care about the visible screen area when rendering the
+    // frame
+    for (line = _timings.lineFirstVisible();
+        line < _timings.lineFrontPorchStart();
+        ++line) {
+
+        _posX = 0;
+
+        onHSyncBegin();
+        onHSyncEnd();
+
+        renderLine();
+    }
+
+    line = _timings.lineFrontPorchStart() - 1;
+    onFrameDone();
+
+    // Signal vsync until the next frame begins
+    line = _timings.lineVSyncStart();
+    onVSyncBegin();
+}
+
+void
+BasePixelPump::renderLine()
+{
+    const unsigned pos_y(posY());
+
+    Pixel pixel(0, 0, 0);
+    for (_posX = 0; _posX < _timings.width; ++_posX) {
+        if (!nextPixel(pixel)) {
+            panic("Unexpected underrun in BasePixelPump (%u, %u)\n",
+                 _posX, pos_y);
+        }
+        fb.pixel(_posX, pos_y) = pixel;
+    }
+}
+
+
 BasePixelPump::PixelEvent::PixelEvent(
     const char *name, BasePixelPump *_parent, CallbackType _func)
     : Event(), Drainable(),
diff --git a/src/dev/pixelpump.hh b/src/dev/pixelpump.hh
index 159ee79..bc21fca 100644
--- a/src/dev/pixelpump.hh
+++ b/src/dev/pixelpump.hh
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 ARM Limited
+ * Copyright (c) 2015, 2017 ARM Limited
  * All rights reserved
  *
  * The license below extends only to copyright in the software and shall
@@ -148,15 +148,22 @@
       public Serializable
 {
   public:
- BasePixelPump(EventManager &em, ClockDomain &pxl_clk, unsigned pixel_chunk);
+    BasePixelPump(EventManager &em, ClockDomain &pxl_clk,
+                  unsigned pixel_chunk);
     virtual ~BasePixelPump();

     void serialize(CheckpointOut &cp) const override;
     void unserialize(CheckpointIn &cp) override;

   public: // Public API
-    /** Starting pushing pixels using the supplied display timings. */
-    void start(const DisplayTimings &timings);
+    /** Update frame size using display timing */
+    void updateTimings(const DisplayTimings &timings);
+
+    /** Render an entire frame in KVM execution mode */
+    void renderFrame();
+
+    /** Starting pushing pixels in timing mode */
+    void start();

     /** Immediately stop pushing pixels */
     void stop();
@@ -285,6 +292,9 @@
     void beginLine();
     void renderPixels();

+    /** Fast and event-free line rendering function */
+    void renderLine();
+
     /** Convenience vector when doing operations on all events */
     std::vector<PixelEvent *> pixelEvents;


--
To view, visit https://gem5-review.googlesource.com/2241
To unsubscribe, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I76c84db04249b02d4207c5281d82aa693d0881be
Gerrit-Change-Number: 2241
Gerrit-PatchSet: 2
Gerrit-Owner: Andreas Sandberg <andreas.sandb...@arm.com>
Gerrit-Reviewer: Andreas Sandberg <andreas.sandb...@arm.com>
Gerrit-Reviewer: Jason Lowe-Power <ja...@lowepower.com>
Gerrit-Reviewer: Rahul Thakur <rjtha...@google.com>
_______________________________________________
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to