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),
#define panic(...)
This implements a cprintf based panic() function.
unsigned lineFrontPorchStart() const
Calculate the first line of the back porch.
unsigned vSync
Vertical sync signal in lines.
void serialize(CheckpointOut &cp) const override
Serialize an object.
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.
virtual void onFrameDone()
Finished displaying the visible region of a frame.
void unserialize(CheckpointIn &cp) override
Unserialize an object.
unsigned lineVSyncStart() const
Calculate the first line of the vsync signal.
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.
Tick when() const
Get the time that the event is scheduled.
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.
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.
const Pixel & pixel(unsigned x, unsigned y) const
Get a pixel from an (x, y) coordinate.
unsigned vFrontPorch
Vertical front porch in lines.
void start()
Starting pushing pixels in timing mode.
const DisplayTimings & timings() const
Get a constant reference of the current display timings.
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Cycles cyclesPerLine() const
How many pixel clocks are required for one line?
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.
unsigned lineVBackPorchStart() const
Calculate the first line of the vertical back porch.
Interface for objects that might require draining before checkpointing.
#define UNSERIALIZE_SCALAR(scalar)
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.
bool scheduled() const
Determine if the current event is scheduled.
bool active() const
Is the pixel pump active and refreshing the display?
void serialize(CheckpointOut &cp) const override
Serialize an object.
unsigned linesPerFrame() const
Calculate the total number of lines in a frame.
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)
unsigned posY() const
Current pixel position within the visible area.
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.
unsigned lineFirstVisible() const
Calculate the first line of the visible region.
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.
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...
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 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
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 width() const
Frame buffer width in pixels.
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
void drainResume() override
Resume execution after a successful drain.
unsigned height() const
Frame buffer height in pixels.
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.