52 unsigned hbp,
unsigned h_sync,
unsigned hfp,
53 unsigned vbp,
unsigned v_sync,
unsigned vfp)
54 :
width(_width), height(_height),
55 hBackPorch(hbp), hFrontPorch(hfp), hSync(h_sync),
56 vBackPorch(vbp), vFrontPorch(vfp), vSync(v_sync)
94 pixelChunk(pixel_chunk),
96 evVSyncBegin(
"evVSyncBegin", this, &
BasePixelPump::onVSyncBegin),
98 evHSyncBegin(
"evHSyncBegin", this, &
BasePixelPump::onHSyncBegin),
101 evRenderPixels(
"evRenderPixels", this, &
BasePixelPump::renderPixels),
103 line(0), _posX(0), _underrun(false)
145 panic_if(
active(),
"Trying to update timings in active PixelPump\n");
200 const Cycles h_sync_begin(0);
224 const unsigned pxl_count(x_end -
_posX);
225 const unsigned pos_y(
posY());
227 Pixel pixel(0, 0, 0);
228 const Pixel underrun_pixel(0, 0, 0);
231 warn(
"Input buffer underrun in BasePixelPump (%u, %u)\n",
235 pixel = underrun_pixel;
289 const unsigned pos_y =
posY();
290 const size_t _width =
fb.
width();
292 auto pixel_it =
fb.
pixels.begin() + _width * pos_y;
294 "Unexpected underrun in BasePixelPump (%u, %u)", _width, pos_y);
301 _name(
name), parent(*_parent), func(_func),
326 assert(!scheduled());
338 assert(!scheduled());
348 relativeTick = when() -
curTick();
349 parent.deschedule(
this);
355 assert(!scheduled());
357 parent.schedule(
this, relativeTick +
curTick());
Callback helper class with suspend support.
PixelEvent(const char *name, BasePixelPump *parent, CallbackType func)
DrainState drain() override
Draining is the process of clearing out the states of SimObjects.These are the SimObjects that are pa...
void unserialize(CheckpointIn &cp) override
Unserialize an object.
void drainResume() override
Resume execution after a successful drain.
void serialize(CheckpointOut &cp) const override
Serialize an object.
Timing generator for a pixel-based display.
void stop()
Immediately stop pushing pixels.
void unserialize(CheckpointIn &cp) override
Unserialize an object.
bool active() const
Is the pixel pump active and refreshing the display?
std::vector< PixelEvent * > pixelEvents
Convenience vector when doing operations on all events.
void updateTimings(const DisplayTimings &timings)
Update frame size using display timing.
FrameBuffer fb
Output frame buffer.
virtual void onHSyncEnd()
Start of the first pixel after the HSync region.
virtual void onVSyncBegin()
First pixel clock of the first VSync line.
BasePixelPump(EventManager &em, ClockDomain &pxl_clk, unsigned pixel_chunk)
const unsigned pixelChunk
Maximum number of pixels to handle per render callback.
bool _underrun
Did a buffer underrun occur within this refresh interval?
virtual void onVSyncEnd()
Callback on the first pixel of the line after the end VSync region (typically the first pixel of the ...
void serialize(CheckpointOut &cp) const override
Serialize an object.
virtual size_t nextLine(std::vector< Pixel >::iterator ps, size_t line_length)
Get the next line of pixels directly from memory.
PixelEvent evRenderPixels
void start()
Starting pushing pixels in timing mode.
virtual void onHSyncBegin()
Start of the HSync region.
void renderLine()
Fast and event-free line rendering function.
virtual bool nextPixel(Pixel &p)=0
Get the next pixel from the scan line buffer.
void renderFrame()
Render an entire frame in non-caching mode.
unsigned posY() const
Current pixel position within the visible area.
const DisplayTimings & timings() const
Get a constant reference of the current display timings.
virtual void onUnderrun(unsigned x, unsigned y)
Buffer underrun occurred on a frame.
unsigned line
Current line (including back porch, front porch, and vsync) within a frame.
unsigned _posX
X-coordinate within the visible region of a frame.
virtual void onFrameDone()
Finished displaying the visible region of a frame.
The ClockDomain provides clock to group of clocked objects bundled under the same clock domain.
Helper class for objects that need to be clocked.
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...
Cycles is a wrapper class for representing cycle counts, i.e.
Interface for objects that might require draining before checkpointing.
void unserialize(CheckpointIn &cp) override
Unserialize an object.
void serialize(CheckpointOut &cp) const override
Serialize an object.
std::vector< Pixel > pixels
Frame buffer backing store.
unsigned height() const
Frame buffer height in pixels.
void resize(unsigned width, unsigned height)
Resize the frame buffer.
const Pixel & pixel(unsigned x, unsigned y) const
Get a pixel from an (x, y) coordinate.
unsigned width() const
Frame buffer width in pixels.
Basic support for object serialization.
DrainState
Object drain/handover states.
@ Drained
Buffers drained, ready for serialization/handover.
void deschedule(Event &event)
bool scheduled() const
Determine if the current event is scheduled.
void schedule(Event &event, Tick when)
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
#define UNSERIALIZE_OBJ(obj)
#define SERIALIZE_OBJ(obj)
This macro serializes an object into its own section.
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
Tick curTick()
The universal simulation clock.
std::ostream CheckpointOut
#define UNSERIALIZE_SCALAR(scalar)
#define SERIALIZE_SCALAR(scalar)
unsigned vSync
Vertical sync signal in lines.
void unserialize(CheckpointIn &cp) override
Unserialize an object.
unsigned linesPerFrame() const
Calculate the total number of lines in a frame.
unsigned height
Display height in pixels.
unsigned width
Display width in pixels.
unsigned lineVBackPorchStart() const
Calculate the first line of the vertical back porch.
unsigned hFrontPorch
Horizontal front porch in pixels.
unsigned lineFrontPorchStart() const
Calculate the first line of the back porch.
unsigned hSync
Horizontal sync signal length in pixels.
void serialize(CheckpointOut &cp) const override
Serialize an object.
static const DisplayTimings vga
Cycles cyclesPerLine() const
How many pixel clocks are required for one line?
DisplayTimings(unsigned width, unsigned height, unsigned hbp, unsigned h_sync, unsigned hfp, unsigned vbp, unsigned v_sync, unsigned vfp)
Create a display timing configuration struct.
unsigned vFrontPorch
Vertical front porch in lines.
unsigned hBackPorch
Horizontal back porch in pixels.
unsigned vBackPorch
Vertical back porch in lines.
unsigned lineVSyncStart() const
Calculate the first line of the vsync signal.
unsigned lineFirstVisible() const
Calculate the first line of the visible region.
Internal gem5 representation of a Pixel.
const std::string & name()