gem5  v20.1.0.0
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
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)
 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
 
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...
 
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
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 144 of file pixelpump.hh.

Constructor & Destructor Documentation

◆ BasePixelPump()

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

Definition at line 86 of file pixelpump.cc.

◆ ~BasePixelPump()

BasePixelPump::~BasePixelPump ( )
virtual

Definition at line 102 of file pixelpump.cc.

Member Function Documentation

◆ active()

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

◆ beginLine()

void BasePixelPump::beginLine ( )
private

◆ nextPixel()

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

◆ onFrameDone()

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

◆ onHSyncBegin()

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 219 of file pixelpump.hh.

Referenced by renderFrame().

◆ onHSyncEnd()

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 227 of file pixelpump.hh.

Referenced by renderFrame().

◆ onUnderrun()

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 239 of file pixelpump.hh.

Referenced by renderPixels().

◆ onVSyncBegin()

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

◆ onVSyncEnd()

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 211 of file pixelpump.hh.

Referenced by beginLine(), and renderFrame().

◆ posX()

unsigned BasePixelPump::posX ( ) const
inline

Current pixel position within the visible area.

Definition at line 185 of file pixelpump.hh.

References _posX.

◆ posY()

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

◆ renderFrame()

void BasePixelPump::renderFrame ( )

◆ renderLine()

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

◆ renderPixels()

void BasePixelPump::renderPixels ( )
private

◆ serialize()

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 107 of file pixelpump.cc.

References _posX, _timings, _underrun, MipsISA::event, fb, line, pixelEvents, SERIALIZE_OBJ, and SERIALIZE_SCALAR.

◆ start()

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

◆ stop()

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

◆ timings()

const DisplayTimings& BasePixelPump::timings ( ) const
inline

Get a constant reference of the current display timings.

Definition at line 170 of file pixelpump.hh.

References _timings.

Referenced by updateTimings().

◆ underrun()

bool BasePixelPump::underrun ( ) const
inline

Did a buffer underrun occur within this refresh interval?

Definition at line 176 of file pixelpump.hh.

References _underrun.

◆ unserialize()

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 121 of file pixelpump.cc.

References _posX, _timings, _underrun, MipsISA::event, fb, line, pixelEvents, UNSERIALIZE_OBJ, and UNSERIALIZE_SCALAR.

Referenced by HDLcd::unserialize().

◆ updateTimings()

void BasePixelPump::updateTimings ( const DisplayTimings timings)

◆ visibleLine()

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

Member Data Documentation

◆ _posX

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

◆ _timings

DisplayTimings BasePixelPump::_timings
private

◆ _underrun

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

◆ evBeginLine

PixelEvent BasePixelPump::evBeginLine
private

Definition at line 303 of file pixelpump.hh.

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

◆ evHSyncBegin

PixelEvent BasePixelPump::evHSyncBegin
private

Definition at line 301 of file pixelpump.hh.

Referenced by beginLine(), and stop().

◆ evHSyncEnd

PixelEvent BasePixelPump::evHSyncEnd
private

Definition at line 302 of file pixelpump.hh.

Referenced by beginLine(), and stop().

◆ evRenderPixels

PixelEvent BasePixelPump::evRenderPixels
private

Definition at line 304 of file pixelpump.hh.

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

◆ evVSyncBegin

PixelEvent BasePixelPump::evVSyncBegin
private

Definition at line 299 of file pixelpump.hh.

◆ evVSyncEnd

PixelEvent BasePixelPump::evVSyncEnd
private

Definition at line 300 of file pixelpump.hh.

Referenced by stop().

◆ fb

FrameBuffer BasePixelPump::fb

Output frame buffer.

Definition at line 193 of file pixelpump.hh.

Referenced by renderLine(), renderPixels(), serialize(), unserialize(), and updateTimings().

◆ line

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

◆ pixelChunk

const unsigned BasePixelPump::pixelChunk
private

Maximum number of pixels to handle per render callback.

Definition at line 242 of file pixelpump.hh.

Referenced by renderPixels().

◆ pixelEvents

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


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

Generated on Wed Sep 30 2020 14:02:21 for gem5 by doxygen 1.8.17