gem5
v20.1.0.0
|
Timing generator for a pixel-based display. More...
#include <pixelpump.hh>
Classes | |
class | PixelEvent |
Callback helper class with suspend support. More... | |
Public Member Functions | |
BasePixelPump (EventManager &em, ClockDomain &pxl_clk, unsigned pixel_chunk) | |
virtual | ~BasePixelPump () |
void | serialize (CheckpointOut &cp) const override |
Serialize an object. More... | |
void | unserialize (CheckpointIn &cp) override |
Unserialize an object. More... | |
void | updateTimings (const DisplayTimings &timings) |
Update frame size using display timing. More... | |
void | renderFrame () |
Render an entire frame in KVM execution mode. More... | |
void | start () |
Starting pushing pixels in timing mode. More... | |
void | stop () |
Immediately stop pushing pixels. More... | |
const DisplayTimings & | timings () const |
Get a constant reference of the current display timings. More... | |
bool | active () const |
Is the pixel pump active and refreshing the display? More... | |
bool | underrun () const |
Did a buffer underrun occur within this refresh interval? More... | |
bool | visibleLine () const |
Is the current line within the visible range? More... | |
unsigned | posX () const |
Current pixel position within the visible area. More... | |
unsigned | posY () const |
Current pixel position within the visible area. More... | |
Public Member Functions inherited from EventManager | |
EventQueue * | eventQueue () const |
void | schedule (Event &event, Tick when) |
void | deschedule (Event &event) |
void | reschedule (Event &event, Tick when, bool always=false) |
void | schedule (Event *event, Tick when) |
void | deschedule (Event *event) |
void | reschedule (Event *event, Tick when, bool always=false) |
void | wakeupEventQueue (Tick when=(Tick) -1) |
This function is not needed by the usual gem5 event loop but may be necessary in derived EventQueues which host gem5 on other schedulers. More... | |
void | setCurTick (Tick newVal) |
EventManager (EventManager &em) | |
Event manger manages events in the event queue. More... | |
EventManager (EventManager *em) | |
EventManager (EventQueue *eq) | |
Public Member Functions inherited from Clocked | |
void | updateClockPeriod () |
Update the tick to the current tick. More... | |
Tick | clockEdge (Cycles cycles=Cycles(0)) const |
Determine the tick when a cycle begins, by default the current one, but the argument also enables the caller to determine a future cycle. More... | |
Cycles | curCycle () const |
Determine the current cycle, corresponding to a tick aligned to a clock edge. More... | |
Tick | nextCycle () const |
Based on the clock of the object, determine the start tick of the first cycle that is at least one cycle in the future. More... | |
uint64_t | frequency () const |
Tick | clockPeriod () const |
double | voltage () const |
Cycles | ticksToCycles (Tick t) const |
Tick | cyclesToTicks (Cycles c) const |
Public Member Functions inherited from Serializable | |
Serializable () | |
virtual | ~Serializable () |
void | serializeSection (CheckpointOut &cp, const char *name) const |
Serialize an object into a new section. More... | |
void | serializeSection (CheckpointOut &cp, const std::string &name) const |
void | unserializeSection (CheckpointIn &cp, const char *name) |
Unserialize an a child object. More... | |
void | unserializeSection (CheckpointIn &cp, const std::string &name) |
Public Attributes | |
FrameBuffer | fb |
Output frame buffer. More... | |
Protected Member Functions | |
virtual bool | nextPixel (Pixel &p)=0 |
Get the next pixel from the scan line buffer. More... | |
virtual void | onVSyncBegin () |
First pixel clock of the first VSync line. More... | |
virtual void | onVSyncEnd () |
Callback on the first pixel of the line after the end VSync region (typically the first pixel of the vertical back porch). More... | |
virtual void | onHSyncBegin () |
Start of the HSync region. More... | |
virtual void | onHSyncEnd () |
Start of the first pixel after the HSync region. More... | |
virtual void | onUnderrun (unsigned x, unsigned y) |
Buffer underrun occurred on a frame. More... | |
virtual void | onFrameDone () |
Finished displaying the visible region of a frame. More... | |
Protected Member Functions inherited from Clocked | |
Clocked (ClockDomain &clk_domain) | |
Create a clocked object and set the clock domain based on the parameters. More... | |
Clocked (Clocked &)=delete | |
Clocked & | operator= (Clocked &)=delete |
virtual | ~Clocked () |
Virtual destructor due to inheritance. More... | |
void | resetClock () const |
Reset the object's clock using the current global tick value. More... | |
virtual void | clockPeriodUpdated () |
A hook subclasses can implement so they can do any extra work that's needed when the clock rate is changed. More... | |
Private Member Functions | |
void | beginLine () |
void | renderPixels () |
void | renderLine () |
Fast and event-free line rendering function. More... | |
Private Attributes | |
const unsigned | pixelChunk |
Maximum number of pixels to handle per render callback. More... | |
std::vector< PixelEvent * > | pixelEvents |
Convenience vector when doing operations on all events. More... | |
PixelEvent | evVSyncBegin |
PixelEvent | evVSyncEnd |
PixelEvent | evHSyncBegin |
PixelEvent | evHSyncEnd |
PixelEvent | evBeginLine |
PixelEvent | evRenderPixels |
DisplayTimings | _timings |
unsigned | line |
Current line (including back porch, front porch, and vsync) within a frame. More... | |
unsigned | _posX |
X-coordinate within the visible region of a frame. More... | |
bool | _underrun |
Did a buffer underrun occur within this refresh interval? More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from Serializable | |
static const std::string & | currentSection () |
Gets the fully-qualified name of the active section. More... | |
static void | serializeAll (const std::string &cpt_dir) |
Serializes all the SimObjects. More... | |
static void | unserializeGlobals (CheckpointIn &cp) |
Protected Attributes inherited from EventManager | |
EventQueue * | eventq |
A pointer to this object's event queue. More... | |
Timing generator for a pixel-based display.
Pixels are ordered relative to the top left corner of the display. Scan lines appear in the following order:
Pixel order within a scan line:
Definition at line 144 of file pixelpump.hh.
BasePixelPump::BasePixelPump | ( | EventManager & | em, |
ClockDomain & | pxl_clk, | ||
unsigned | pixel_chunk | ||
) |
Definition at line 86 of file pixelpump.cc.
|
virtual |
Definition at line 102 of file pixelpump.cc.
|
inline |
Is the pixel pump active and refreshing the display?
Definition at line 173 of file pixelpump.hh.
References BasePixelPump::PixelEvent::active(), and evBeginLine.
Referenced by HDLcd::drainResume(), and updateTimings().
|
private |
Definition at line 180 of file pixelpump.cc.
References _posX, _timings, _underrun, Clocked::clockEdge(), DisplayTimings::cyclesPerLine(), evBeginLine, evHSyncBegin, evHSyncEnd, evRenderPixels, DisplayTimings::hBackPorch, DisplayTimings::hSync, line, DisplayTimings::lineFirstVisible(), DisplayTimings::lineFrontPorchStart(), DisplayTimings::linesPerFrame(), DisplayTimings::lineVBackPorchStart(), DisplayTimings::lineVSyncStart(), onVSyncBegin(), onVSyncEnd(), and EventManager::schedule().
|
protectedpure virtual |
Get the next pixel from the scan line buffer.
p | Output pixel value, undefined on underrun |
Implemented in HDLcd::PixelPump.
Referenced by renderLine(), and renderPixels().
|
inlineprotectedvirtual |
Finished displaying the visible region of a frame.
Reimplemented in HDLcd::PixelPump.
Definition at line 242 of file pixelpump.hh.
Referenced by renderFrame(), and renderPixels().
|
inlineprotectedvirtual |
Start of the HSync region.
Definition at line 219 of file pixelpump.hh.
Referenced by renderFrame().
|
inlineprotectedvirtual |
Start of the first pixel after the HSync region.
Definition at line 227 of file pixelpump.hh.
Referenced by renderFrame().
|
inlineprotectedvirtual |
Buffer underrun occurred on a frame.
This method is called once if there is buffer underrun while refreshing the display. The underrun state is reset on the next refresh.
x | Coordinate within the visible region. |
y | Coordinate within the visible region. |
Reimplemented in HDLcd::PixelPump.
Definition at line 239 of file pixelpump.hh.
Referenced by renderPixels().
|
inlineprotectedvirtual |
First pixel clock of the first VSync line.
Reimplemented in HDLcd::PixelPump.
Definition at line 205 of file pixelpump.hh.
Referenced by beginLine(), and renderFrame().
|
inlineprotectedvirtual |
Callback on the first pixel of the line after the end VSync region (typically the first pixel of the vertical back porch).
Reimplemented in HDLcd::PixelPump.
Definition at line 211 of file pixelpump.hh.
Referenced by beginLine(), and renderFrame().
|
inline |
Current pixel position within the visible area.
Definition at line 185 of file pixelpump.hh.
References _posX.
|
inline |
Current pixel position within the visible area.
Definition at line 188 of file pixelpump.hh.
References _timings, line, DisplayTimings::lineFirstVisible(), and visibleLine().
Referenced by renderLine(), and renderPixels().
void BasePixelPump::renderFrame | ( | ) |
Render an entire frame in KVM execution mode.
Definition at line 250 of file pixelpump.cc.
References _posX, _timings, _underrun, line, DisplayTimings::lineFirstVisible(), DisplayTimings::lineFrontPorchStart(), DisplayTimings::lineVBackPorchStart(), DisplayTimings::lineVSyncStart(), onFrameDone(), onHSyncBegin(), onHSyncEnd(), onVSyncBegin(), onVSyncEnd(), and renderLine().
Referenced by HDLcd::virtRefresh().
|
private |
Fast and event-free line rendering function.
Definition at line 282 of file pixelpump.cc.
References _posX, _timings, fb, nextPixel(), panic, FrameBuffer::pixel(), posY(), and DisplayTimings::width.
Referenced by renderFrame().
|
private |
Definition at line 213 of file pixelpump.cc.
References _posX, _timings, _underrun, Clocked::clockEdge(), evRenderPixels, fb, DisplayTimings::height, nextPixel(), onFrameDone(), onUnderrun(), FrameBuffer::pixel(), pixelChunk, posY(), EventManager::schedule(), warn, and DisplayTimings::width.
|
overridevirtual |
Serialize an object.
Output an object's state into the current checkpoint section.
cp | Checkpoint state |
Implements Serializable.
Definition at line 107 of file pixelpump.cc.
References _posX, _timings, _underrun, MipsISA::event, fb, line, pixelEvents, SERIALIZE_OBJ, and SERIALIZE_SCALAR.
void BasePixelPump::start | ( | ) |
Starting pushing pixels in timing mode.
Definition at line 154 of file pixelpump.cc.
References Clocked::clockEdge(), evBeginLine, and EventManager::schedule().
Referenced by HDLcd::cmdEnable().
void BasePixelPump::stop | ( | ) |
Immediately stop pushing pixels.
Definition at line 161 of file pixelpump.cc.
References EventManager::deschedule(), evBeginLine, evHSyncBegin, evHSyncEnd, evRenderPixels, evVSyncEnd, and Event::scheduled().
Referenced by HDLcd::cmdDisable().
|
inline |
Get a constant reference of the current display timings.
Definition at line 170 of file pixelpump.hh.
References _timings.
Referenced by updateTimings().
|
inline |
Did a buffer underrun occur within this refresh interval?
Definition at line 176 of file pixelpump.hh.
References _underrun.
|
overridevirtual |
Unserialize an object.
Read an object's state from the current checkpoint section.
cp | Checkpoint state |
Implements Serializable.
Definition at line 121 of file pixelpump.cc.
References _posX, _timings, _underrun, MipsISA::event, fb, line, pixelEvents, UNSERIALIZE_OBJ, and UNSERIALIZE_SCALAR.
Referenced by HDLcd::unserialize().
void BasePixelPump::updateTimings | ( | const DisplayTimings & | timings | ) |
Update frame size using display timing.
Definition at line 138 of file pixelpump.cc.
References _timings, active(), fb, FrameBuffer::height(), DisplayTimings::height, line, DisplayTimings::linesPerFrame(), panic_if, FrameBuffer::resize(), timings(), FrameBuffer::width(), and DisplayTimings::width.
Referenced by HDLcd::cmdEnable().
|
inline |
Is the current line within the visible range?
Definition at line 179 of file pixelpump.hh.
References _timings, line, DisplayTimings::lineFirstVisible(), and DisplayTimings::lineFrontPorchStart().
Referenced by posY().
|
private |
X-coordinate within the visible region of a frame.
Definition at line 314 of file pixelpump.hh.
Referenced by beginLine(), posX(), renderFrame(), renderLine(), renderPixels(), serialize(), and unserialize().
|
private |
Definition at line 306 of file pixelpump.hh.
Referenced by beginLine(), posY(), renderFrame(), renderLine(), renderPixels(), serialize(), timings(), unserialize(), updateTimings(), and visibleLine().
|
private |
Did a buffer underrun occur within this refresh interval?
Definition at line 317 of file pixelpump.hh.
Referenced by beginLine(), renderFrame(), renderPixels(), serialize(), underrun(), and unserialize().
|
private |
Definition at line 303 of file pixelpump.hh.
Referenced by active(), beginLine(), start(), and stop().
|
private |
Definition at line 301 of file pixelpump.hh.
Referenced by beginLine(), and stop().
|
private |
Definition at line 302 of file pixelpump.hh.
Referenced by beginLine(), and stop().
|
private |
Definition at line 304 of file pixelpump.hh.
Referenced by beginLine(), renderPixels(), and stop().
|
private |
Definition at line 299 of file pixelpump.hh.
|
private |
Definition at line 300 of file pixelpump.hh.
Referenced by stop().
FrameBuffer BasePixelPump::fb |
Output frame buffer.
Definition at line 193 of file pixelpump.hh.
Referenced by renderLine(), renderPixels(), serialize(), unserialize(), and updateTimings().
|
private |
Current line (including back porch, front porch, and vsync) within a frame.
Definition at line 312 of file pixelpump.hh.
Referenced by beginLine(), posY(), renderFrame(), serialize(), unserialize(), updateTimings(), and visibleLine().
|
private |
Maximum number of pixels to handle per render callback.
Definition at line 242 of file pixelpump.hh.
Referenced by renderPixels().
|
private |
Convenience vector when doing operations on all events.
Definition at line 297 of file pixelpump.hh.
Referenced by BasePixelPump::PixelEvent::PixelEvent(), serialize(), and unserialize().