gem5  v22.1.0.0
Classes | Public Member Functions | Public Attributes | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
gem5::BasePixelPump Class Referenceabstract

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

#include <pixelpump.hh>

Inheritance diagram for gem5::BasePixelPump:
gem5::EventManager gem5::Clocked gem5::Serializable gem5::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 non-caching 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 gem5::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 gem5::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 gem5::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 size_t nextLine (std::vector< Pixel >::iterator ps, size_t line_length)
 Get the next line of pixels directly from memory. 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 gem5::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 gem5::Serializable
static const std::string & currentSection ()
 Gets the fully-qualified name of the active section. More...
 
static void generateCheckpointOut (const std::string &cpt_dir, std::ofstream &outstream)
 Generate a checkpoint file so that the serialization can be routed to it. More...
 
- Protected Attributes inherited from gem5::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 163 of file pixelpump.hh.

Constructor & Destructor Documentation

◆ BasePixelPump()

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

Definition at line 91 of file pixelpump.cc.

◆ ~BasePixelPump()

gem5::BasePixelPump::~BasePixelPump ( )
virtual

Definition at line 107 of file pixelpump.cc.

Member Function Documentation

◆ active()

bool gem5::BasePixelPump::active ( ) const
inline

Is the pixel pump active and refreshing the display?

Definition at line 192 of file pixelpump.hh.

References gem5::BasePixelPump::PixelEvent::active(), and evBeginLine.

Referenced by gem5::HDLcd::drainResume(), and updateTimings().

◆ beginLine()

void gem5::BasePixelPump::beginLine ( )
private

◆ nextLine()

virtual size_t gem5::BasePixelPump::nextLine ( std::vector< Pixel >::iterator  ps,
size_t  line_length 
)
inlineprotectedvirtual

Get the next line of pixels directly from memory.

This is for use from the renderFrame which is called in non-caching mode.

The default implementation falls back to calling nextPixel over and over, but a more efficient implementation could retrieve the entire line of pixels all at once using fewer access to memory which bypass any intermediate structures like an incoming FIFO.

Parameters
psA vector iterator to store retrieved pixels into.
line_lengthThe number of pixels being requested.
Returns
The number of pixels actually retrieved.

Reimplemented in gem5::HDLcd::PixelPump.

Definition at line 241 of file pixelpump.hh.

References gem5::X86ISA::count, nextPixel(), and gem5::ArmISA::ps.

Referenced by renderLine().

◆ nextPixel()

virtual bool gem5::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 gem5::HDLcd::PixelPump.

Referenced by nextLine(), and renderPixels().

◆ onFrameDone()

virtual void gem5::BasePixelPump::onFrameDone ( )
inlineprotectedvirtual

Finished displaying the visible region of a frame.

Reimplemented in gem5::HDLcd::PixelPump.

Definition at line 287 of file pixelpump.hh.

Referenced by renderFrame(), and renderPixels().

◆ onHSyncBegin()

virtual void gem5::BasePixelPump::onHSyncBegin ( )
inlineprotectedvirtual

Start of the HSync region.

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

Definition at line 264 of file pixelpump.hh.

Referenced by renderFrame().

◆ onHSyncEnd()

virtual void gem5::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 272 of file pixelpump.hh.

Referenced by renderFrame().

◆ onUnderrun()

virtual void gem5::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 gem5::HDLcd::PixelPump.

Definition at line 284 of file pixelpump.hh.

Referenced by renderPixels().

◆ onVSyncBegin()

virtual void gem5::BasePixelPump::onVSyncBegin ( )
inlineprotectedvirtual

First pixel clock of the first VSync line.

Reimplemented in gem5::HDLcd::PixelPump.

Definition at line 250 of file pixelpump.hh.

Referenced by beginLine(), and renderFrame().

◆ onVSyncEnd()

virtual void gem5::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 gem5::HDLcd::PixelPump.

Definition at line 256 of file pixelpump.hh.

Referenced by beginLine(), and renderFrame().

◆ posX()

unsigned gem5::BasePixelPump::posX ( ) const
inline

Current pixel position within the visible area.

Definition at line 206 of file pixelpump.hh.

References _posX.

◆ posY()

unsigned gem5::BasePixelPump::posY ( ) const
inline

Current pixel position within the visible area.

Definition at line 210 of file pixelpump.hh.

References _timings, line, gem5::DisplayTimings::lineFirstVisible(), and visibleLine().

Referenced by renderLine(), and renderPixels().

◆ renderFrame()

void gem5::BasePixelPump::renderFrame ( )

◆ renderLine()

void gem5::BasePixelPump::renderLine ( )
private

Fast and event-free line rendering function.

Definition at line 287 of file pixelpump.cc.

References fb, nextLine(), panic_if, gem5::FrameBuffer::pixels, posY(), and gem5::FrameBuffer::width().

Referenced by renderFrame().

◆ renderPixels()

void gem5::BasePixelPump::renderPixels ( )
private

◆ serialize()

void gem5::BasePixelPump::serialize ( CheckpointOut cp) const
overridevirtual

Serialize an object.

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

Parameters
cpCheckpoint state

Implements gem5::Serializable.

Definition at line 112 of file pixelpump.cc.

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

◆ start()

void gem5::BasePixelPump::start ( )

Starting pushing pixels in timing mode.

Definition at line 159 of file pixelpump.cc.

References gem5::Clocked::clockEdge(), evBeginLine, and gem5::EventManager::schedule().

Referenced by gem5::HDLcd::cmdEnable().

◆ stop()

void gem5::BasePixelPump::stop ( )

Immediately stop pushing pixels.

Definition at line 166 of file pixelpump.cc.

References gem5::EventManager::deschedule(), evBeginLine, evHSyncBegin, evHSyncEnd, evRenderPixels, evVSyncEnd, and gem5::Event::scheduled().

Referenced by gem5::HDLcd::cmdDisable().

◆ timings()

const DisplayTimings& gem5::BasePixelPump::timings ( ) const
inline

Get a constant reference of the current display timings.

Definition at line 189 of file pixelpump.hh.

References _timings.

Referenced by updateTimings().

◆ underrun()

bool gem5::BasePixelPump::underrun ( ) const
inline

Did a buffer underrun occur within this refresh interval?

Definition at line 195 of file pixelpump.hh.

References _underrun.

◆ unserialize()

void gem5::BasePixelPump::unserialize ( CheckpointIn cp)
overridevirtual

Unserialize an object.

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

Parameters
cpCheckpoint state

Implements gem5::Serializable.

Definition at line 126 of file pixelpump.cc.

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

Referenced by gem5::HDLcd::unserialize().

◆ updateTimings()

void gem5::BasePixelPump::updateTimings ( const DisplayTimings timings)

◆ visibleLine()

bool gem5::BasePixelPump::visibleLine ( ) const
inline

Is the current line within the visible range?

Definition at line 199 of file pixelpump.hh.

References _timings, line, gem5::DisplayTimings::lineFirstVisible(), and gem5::DisplayTimings::lineFrontPorchStart().

Referenced by posY().

Member Data Documentation

◆ _posX

unsigned gem5::BasePixelPump::_posX
private

X-coordinate within the visible region of a frame.

Definition at line 362 of file pixelpump.hh.

Referenced by beginLine(), posX(), renderFrame(), renderPixels(), serialize(), and unserialize().

◆ _timings

DisplayTimings gem5::BasePixelPump::_timings
private

◆ _underrun

bool gem5::BasePixelPump::_underrun
private

Did a buffer underrun occur within this refresh interval?

Definition at line 365 of file pixelpump.hh.

Referenced by beginLine(), renderFrame(), renderPixels(), serialize(), underrun(), and unserialize().

◆ evBeginLine

PixelEvent gem5::BasePixelPump::evBeginLine
private

Definition at line 351 of file pixelpump.hh.

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

◆ evHSyncBegin

PixelEvent gem5::BasePixelPump::evHSyncBegin
private

Definition at line 349 of file pixelpump.hh.

Referenced by beginLine(), and stop().

◆ evHSyncEnd

PixelEvent gem5::BasePixelPump::evHSyncEnd
private

Definition at line 350 of file pixelpump.hh.

Referenced by beginLine(), and stop().

◆ evRenderPixels

PixelEvent gem5::BasePixelPump::evRenderPixels
private

Definition at line 352 of file pixelpump.hh.

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

◆ evVSyncBegin

PixelEvent gem5::BasePixelPump::evVSyncBegin
private

Definition at line 347 of file pixelpump.hh.

◆ evVSyncEnd

PixelEvent gem5::BasePixelPump::evVSyncEnd
private

Definition at line 348 of file pixelpump.hh.

Referenced by stop().

◆ fb

FrameBuffer gem5::BasePixelPump::fb

Output frame buffer.

Definition at line 216 of file pixelpump.hh.

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

◆ line

unsigned gem5::BasePixelPump::line
private

Current line (including back porch, front porch, and vsync) within a frame.

Definition at line 360 of file pixelpump.hh.

Referenced by beginLine(), posY(), renderFrame(), serialize(), unserialize(), updateTimings(), and visibleLine().

◆ pixelChunk

const unsigned gem5::BasePixelPump::pixelChunk
private

Maximum number of pixels to handle per render callback.

Definition at line 291 of file pixelpump.hh.

Referenced by renderPixels().

◆ pixelEvents

std::vector<PixelEvent *> gem5::BasePixelPump::pixelEvents
private

Convenience vector when doing operations on all events.

Definition at line 345 of file pixelpump.hh.

Referenced by gem5::BasePixelPump::PixelEvent::PixelEvent(), serialize(), and unserialize().


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

Generated on Wed Dec 21 2022 10:23:21 for gem5 by doxygen 1.9.1