gem5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Public Member Functions | Public Attributes | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
BasePixelPump Class Referenceabstract

Timing generator for a pixel-based display. More...

#include <pixelpump.hh>

Inheritance diagram for BasePixelPump:
EventManager Clocked Serializable HDLcd::PixelPump

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 DisplayTimingstimings () 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)
 
EventQueueeventQueue () 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
 
Clockedoperator= (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
EventQueueeventq
 A pointer to this object's event queue. More...
 

Detailed Description

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:

  1. Vertical Sync (starting at line 0)
  2. Vertical back porch
  3. Visible lines
  4. Vertical front porch

Pixel order within a scan line:

  1. Horizontal Sync
  2. Horizontal Back Porch
  3. Visible pixels
  4. Horizontal Front Porch

Definition at line 146 of file pixelpump.hh.

Constructor & Destructor Documentation

BasePixelPump::BasePixelPump ( EventManager em,
ClockDomain pxl_clk,
unsigned  pixel_chunk 
)

Definition at line 88 of file pixelpump.cc.

BasePixelPump::~BasePixelPump ( )
virtual

Definition at line 104 of file pixelpump.cc.

Member Function Documentation

bool BasePixelPump::active ( ) const
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().

void BasePixelPump::beginLine ( )
private
virtual bool BasePixelPump::nextPixel ( Pixel p)
protectedpure virtual

Get the next pixel from the scan line buffer.

Parameters
pOutput pixel value, undefined on underrun
Returns
true on success, false on buffer underrun

Implemented in HDLcd::PixelPump.

Referenced by renderLine(), and renderPixels().

virtual void BasePixelPump::onFrameDone ( )
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().

virtual void BasePixelPump::onHSyncBegin ( )
inlineprotectedvirtual

Start of the HSync region.

Note
This is called even for scan lines outside of the visible region.

Definition at line 221 of file pixelpump.hh.

Referenced by renderFrame().

virtual void BasePixelPump::onHSyncEnd ( )
inlineprotectedvirtual

Start of the first pixel after the HSync region.

Note
This is called even for scan lines outside of the visible region.

Definition at line 229 of file pixelpump.hh.

Referenced by renderFrame().

virtual void BasePixelPump::onUnderrun ( unsigned  x,
unsigned  y 
)
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.

Parameters
xCoordinate within the visible region.
yCoordinate within the visible region.

Reimplemented in HDLcd::PixelPump.

Definition at line 241 of file pixelpump.hh.

Referenced by renderPixels().

virtual void BasePixelPump::onVSyncBegin ( )
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().

virtual void BasePixelPump::onVSyncEnd ( )
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().

unsigned BasePixelPump::posX ( ) const
inline

Current pixel position within the visible area.

Definition at line 187 of file pixelpump.hh.

References _posX.

unsigned BasePixelPump::posY ( ) const
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 ( )
void BasePixelPump::renderLine ( )
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().

void BasePixelPump::renderPixels ( )
private
void BasePixelPump::serialize ( CheckpointOut cp) const
overridevirtual

Serialize an object.

Output an object's state into the current checkpoint section.

Parameters
cpCheckpoint 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().

const DisplayTimings& BasePixelPump::timings ( ) const
inline

Get a constant reference of the current display timings.

Definition at line 172 of file pixelpump.hh.

References _timings.

Referenced by updateTimings().

bool BasePixelPump::underrun ( ) const
inline

Did a buffer underrun occur within this refresh interval?

Definition at line 178 of file pixelpump.hh.

References _underrun.

void BasePixelPump::unserialize ( CheckpointIn cp)
overridevirtual

Unserialize an object.

Read an object's state from the current checkpoint section.

Parameters
cpCheckpoint 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)
bool BasePixelPump::visibleLine ( ) const
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().

Member Data Documentation

unsigned BasePixelPump::_posX
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().

DisplayTimings BasePixelPump::_timings
private
bool BasePixelPump::_underrun
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().

PixelEvent BasePixelPump::evBeginLine
private

Definition at line 305 of file pixelpump.hh.

Referenced by active(), beginLine(), start(), and stop().

PixelEvent BasePixelPump::evHSyncBegin
private

Definition at line 303 of file pixelpump.hh.

Referenced by beginLine(), and stop().

PixelEvent BasePixelPump::evHSyncEnd
private

Definition at line 304 of file pixelpump.hh.

Referenced by beginLine(), and stop().

PixelEvent BasePixelPump::evRenderPixels
private

Definition at line 306 of file pixelpump.hh.

Referenced by beginLine(), renderPixels(), and stop().

PixelEvent BasePixelPump::evVSyncBegin
private

Definition at line 301 of file pixelpump.hh.

PixelEvent BasePixelPump::evVSyncEnd
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().

unsigned BasePixelPump::line
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().

const unsigned BasePixelPump::pixelChunk
private

Maximum number of pixels to handle per render callback.

Definition at line 244 of file pixelpump.hh.

Referenced by renderPixels().

std::vector<PixelEvent *> BasePixelPump::pixelEvents
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().


The documentation for this class was generated from the following files:

Generated on Fri Jun 9 2017 13:04:03 for gem5 by doxygen 1.8.6