gem5
|
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 | |
EventManager (EventManager &em) | |
EventManager (EventManager *em) | |
EventManager (EventQueue *eq) | |
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) |
void | setCurTick (Tick newVal) |
Public Member Functions inherited from Clocked | |
void | updateClockPeriod () const |
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... | |
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 () |
Get the fully-qualified name of the active section. More... | |
static void | serializeAll (const std::string &cpt_dir) |
static void | unserializeGlobals (CheckpointIn &cp) |
Static Public Attributes inherited from Serializable | |
static int | ckptCount = 0 |
static int | ckptMaxCount = 0 |
static int | ckptPrevCount = -1 |
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 146 of file pixelpump.hh.
BasePixelPump::BasePixelPump | ( | EventManager & | em, |
ClockDomain & | pxl_clk, | ||
unsigned | pixel_chunk | ||
) |
Definition at line 88 of file pixelpump.cc.
|
virtual |
Definition at line 104 of file pixelpump.cc.
|
inline |
Is the pixel pump active and refreshing the display?
Definition at line 175 of file pixelpump.hh.
References BasePixelPump::PixelEvent::active(), and evBeginLine.
Referenced by HDLcd::drainResume(), and updateTimings().
|
private |
Definition at line 182 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 244 of file pixelpump.hh.
Referenced by renderFrame(), and renderPixels().
|
inlineprotectedvirtual |
Start of the HSync region.
Definition at line 221 of file pixelpump.hh.
Referenced by renderFrame().
|
inlineprotectedvirtual |
Start of the first pixel after the HSync region.
Definition at line 229 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 241 of file pixelpump.hh.
Referenced by renderPixels().
|
inlineprotectedvirtual |
First pixel clock of the first VSync line.
Reimplemented in HDLcd::PixelPump.
Definition at line 207 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 213 of file pixelpump.hh.
Referenced by beginLine(), and renderFrame().
|
inline |
Current pixel position within the visible area.
Definition at line 187 of file pixelpump.hh.
References _posX.
|
inline |
Current pixel position within the visible area.
Definition at line 190 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 252 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 284 of file pixelpump.cc.
References _posX, _timings, fb, nextPixel(), panic, FrameBuffer::pixel(), posY(), and DisplayTimings::width.
Referenced by renderFrame().
|
private |
Definition at line 215 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 109 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 156 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 163 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 172 of file pixelpump.hh.
References _timings.
Referenced by updateTimings().
|
inline |
Did a buffer underrun occur within this refresh interval?
Definition at line 178 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 123 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 140 of file pixelpump.cc.
References _timings, active(), fb, DisplayTimings::height, FrameBuffer::height(), line, DisplayTimings::linesPerFrame(), panic_if(), FrameBuffer::resize(), timings(), DisplayTimings::width, and FrameBuffer::width().
Referenced by HDLcd::cmdEnable().
|
inline |
Is the current line within the visible range?
Definition at line 181 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 316 of file pixelpump.hh.
Referenced by beginLine(), posX(), renderFrame(), renderLine(), renderPixels(), serialize(), and unserialize().
|
private |
Definition at line 308 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 319 of file pixelpump.hh.
Referenced by beginLine(), renderFrame(), renderPixels(), serialize(), underrun(), and unserialize().
|
private |
Definition at line 305 of file pixelpump.hh.
Referenced by active(), beginLine(), start(), and stop().
|
private |
Definition at line 303 of file pixelpump.hh.
Referenced by beginLine(), and stop().
|
private |
Definition at line 304 of file pixelpump.hh.
Referenced by beginLine(), and stop().
|
private |
Definition at line 306 of file pixelpump.hh.
Referenced by beginLine(), renderPixels(), and stop().
|
private |
Definition at line 301 of file pixelpump.hh.
|
private |
Definition at line 302 of file pixelpump.hh.
Referenced by stop().
FrameBuffer BasePixelPump::fb |
Output frame buffer.
Definition at line 195 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 314 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 244 of file pixelpump.hh.
Referenced by renderPixels().
|
private |
Convenience vector when doing operations on all events.
Definition at line 299 of file pixelpump.hh.
Referenced by BasePixelPump::PixelEvent::PixelEvent(), serialize(), and unserialize().