summaryrefslogtreecommitdiff
path: root/src/dev/pixelpump.cc
diff options
context:
space:
mode:
authorSudhanshu Jha <sudhanshu.jha@arm.com>2017-02-24 13:34:22 +0000
committerAndreas Sandberg <andreas.sandberg@arm.com>2017-03-07 11:14:28 +0000
commit9dd54d10ab63c395b84bff31b5ff94b35c44e18f (patch)
tree80c7755669f3db6651b424ba5e2fae7f687b5b56 /src/dev/pixelpump.cc
parent82a8230aa761e193a91ade0fa3c109a5c0f08aed (diff)
downloadgem5-9dd54d10ab63c395b84bff31b5ff94b35c44e18f.tar.xz
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.sandberg@arm.com> Reviewed-on: https://gem5-review.googlesource.com/2241 Reviewed-by: Rahul Thakur <rjthakur@google.com> Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Diffstat (limited to 'src/dev/pixelpump.cc')
-rw-r--r--src/dev/pixelpump.cc61
1 files changed, 58 insertions, 3 deletions
diff --git a/src/dev/pixelpump.cc b/src/dev/pixelpump.cc
index 3ffe96d96..e1cf73af6 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 @@ BasePixelPump::unserialize(CheckpointIn &cp)
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,9 +150,15 @@ BasePixelPump::start(const DisplayTimings &timings)
// 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 @@ BasePixelPump::renderPixels()
}
}
+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(),