49 unsigned hbp,
unsigned h_sync,
unsigned hfp,
50 unsigned vbp,
unsigned v_sync,
unsigned vfp)
51 :
width(_width), height(_height),
52 hBackPorch(hbp), hFrontPorch(hfp), hSync(h_sync),
53 vBackPorch(vbp), vFrontPorch(vfp), vSync(v_sync)
91 pixelChunk(pixel_chunk),
93 evVSyncBegin(
"evVSyncBegin", this, &
BasePixelPump::onVSyncBegin),
95 evHSyncBegin(
"evHSyncBegin", this, &
BasePixelPump::onHSyncBegin),
98 evRenderPixels(
"evRenderPixels", this, &
BasePixelPump::renderPixels),
100 line(0), _posX(0), _underrun(false)
119 event->serializeSection(cp,
event->name());
136 event->unserializeSection(cp,
event->name());
142 panic_if(
active(),
"Trying to update timings in active PixelPump\n");
197 const Cycles h_sync_begin(0);
221 const unsigned pxl_count(x_end -
_posX);
222 const unsigned pos_y(
posY());
224 Pixel pixel(0, 0, 0);
225 const Pixel underrun_pixel(0, 0, 0);
228 warn(
"Input buffer underrun in BasePixelPump (%u, %u)\n",
232 pixel = underrun_pixel;
286 const unsigned pos_y(
posY());
288 Pixel pixel(0, 0, 0);
291 panic(
"Unexpected underrun in BasePixelPump (%u, %u)\n",
302 _name(name), parent(*_parent), func(_func),
327 assert(!scheduled());
339 assert(!scheduled());
349 relativeTick = when() -
curTick();
350 parent.deschedule(
this);
356 assert(!scheduled());
358 parent.schedule(
this, relativeTick +
curTick());
unsigned vSync
Vertical sync signal in lines.
void serialize(CheckpointOut &cp) const override
Serialize an object.
const Pixel & pixel(unsigned x, unsigned y) const
Get a pixel from an (x, y) coordinate.
std::vector< PixelEvent * > pixelEvents
Convenience vector when doing operations on all events.
Timing generator for a pixel-based display.
Cycles is a wrapper class for representing cycle counts, i.e.
unsigned lineFrontPorchStart() const
Calculate the first line of the back porch.
virtual void onFrameDone()
Finished displaying the visible region of a frame.
void unserialize(CheckpointIn &cp) override
Unserialize an object.
const std::string & name()
bool _underrun
Did a buffer underrun occur within this refresh interval?
DrainState
Object drain/handover states.
virtual void onHSyncBegin()
Start of the HSync region.
void resize(unsigned width, unsigned height)
Resize the frame buffer.
DrainState drain() override
Notify an object that it needs to drain its state.
unsigned line
Current line (including back porch, front porch, and vsync) within a frame.
panic_if(!root,"Invalid expression\n")
bool scheduled() const
Determine if the current event is scheduled.
unsigned posY() const
Current pixel position within the visible area.
void stop()
Immediately stop pushing pixels.
unsigned hBackPorch
Horizontal back porch in pixels.
#define UNSERIALIZE_OBJ(obj)
void renderLine()
Fast and event-free line rendering function.
unsigned linesPerFrame() const
Calculate the total number of lines in a frame.
unsigned vFrontPorch
Vertical front porch in lines.
Cycles cyclesPerLine() const
How many pixel clocks are required for one line?
void start()
Starting pushing pixels in timing mode.
void unserialize(CheckpointIn &cp) override
Unserialize an object.
void deschedule(Event &event)
PixelEvent(const char *name, BasePixelPump *parent, CallbackType func)
BasePixelPump(EventManager &em, ClockDomain &pxl_clk, unsigned pixel_chunk)
Callback helper class with suspend support.
Interface for objects that might require draining before checkpointing.
#define UNSERIALIZE_SCALAR(scalar)
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...
virtual void onUnderrun(unsigned x, unsigned y)
Buffer underrun occurred on a frame.
Tick curTick()
The current simulated tick.
void unserialize(CheckpointIn &cp) override
Unserialize an object.
unsigned height() const
Frame buffer height in pixels.
bool active() const
Is the pixel pump active and refreshing the display?
void serialize(CheckpointOut &cp) const override
Serialize an object.
virtual void onVSyncEnd()
Callback on the first pixel of the line after the end VSync region (typically the first pixel of the ...
void renderFrame()
Render an entire frame in KVM execution mode.
virtual void onHSyncEnd()
Start of the first pixel after the HSync region.
#define SERIALIZE_OBJ(obj)
void unserialize(CheckpointIn &cp) override
Unserialize an object.
unsigned _posX
X-coordinate within the visible region of a frame.
void updateTimings(const DisplayTimings &timings)
Update frame size using display timing.
FrameBuffer fb
Output frame buffer.
virtual void onVSyncBegin()
First pixel clock of the first VSync line.
Helper class for objects that need to be clocked.
Draining buffers pending serialization/handover.
unsigned height
Display height in pixels.
Basic support for object serialization.
PixelEvent evRenderPixels
const unsigned pixelChunk
Maximum number of pixels to handle per render callback.
#define SERIALIZE_SCALAR(scalar)
unsigned hFrontPorch
Horizontal front porch in pixels.
unsigned lineFirstVisible() const
Calculate the first line of the visible region.
unsigned hSync
Horizontal sync signal length in pixels.
void serialize(CheckpointOut &cp) const override
Serialize an object.
The ClockDomain provides clock to group of clocked objects bundled under the same clock domain...
void serialize(CheckpointOut &cp) const override
Serialize an object.
std::ostream CheckpointOut
unsigned width() const
Frame buffer width in pixels.
void schedule(Event &event, Tick when)
unsigned vBackPorch
Vertical back porch in lines.
static const DisplayTimings vga
virtual bool nextPixel(Pixel &p)=0
Get the next pixel from the scan line buffer.
Internal gem5 representation of a Pixel.
unsigned lineVBackPorchStart() const
Calculate the first line of the vertical back porch.
unsigned lineVSyncStart() const
Calculate the first line of the vsync signal.
void drainResume() override
Resume execution after a successful drain.
unsigned width
Display width in pixels.
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.
const DisplayTimings & timings() const
Get a constant reference of the current display timings.