47 unsigned hbp,
unsigned h_sync,
unsigned hfp,
48 unsigned vbp,
unsigned v_sync,
unsigned vfp)
49 :
width(_width), height(_height),
50 hBackPorch(hbp), hFrontPorch(hfp), hSync(h_sync),
51 vBackPorch(vbp), vFrontPorch(vfp), vSync(v_sync)
89 pixelChunk(pixel_chunk),
91 evVSyncBegin(
"evVSyncBegin", this, &
BasePixelPump::onVSyncBegin),
93 evHSyncBegin(
"evHSyncBegin", this, &
BasePixelPump::onHSyncBegin),
96 evRenderPixels(
"evRenderPixels", this, &
BasePixelPump::renderPixels),
98 line(0), _posX(0), _underrun(false)
117 event->serializeSection(cp,
event->name());
134 event->unserializeSection(cp,
event->name());
140 panic_if(
active(),
"Trying to update timings in active PixelPump\n");
195 const Cycles h_sync_begin(0);
219 const unsigned pxl_count(x_end -
_posX);
220 const unsigned pos_y(
posY());
222 Pixel pixel(0, 0, 0);
223 const Pixel underrun_pixel(0, 0, 0);
226 warn(
"Input buffer underrun in BasePixelPump (%u, %u)\n",
230 pixel = underrun_pixel;
284 const unsigned pos_y(
posY());
286 Pixel pixel(0, 0, 0);
289 panic(
"Unexpected underrun in BasePixelPump (%u, %u)\n",
300 _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.
#define UNSERIALIZE_OBJ(obj)
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?
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.
void stop()
Immediately stop pushing pixels.
unsigned hBackPorch
Horizontal back porch in pixels.
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?
DrainState
Object drain/handover states.
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)
Draining buffers pending serialization/handover.
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 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.
unsigned posY() const
Current pixel position within the visible area.
#define SERIALIZE_OBJ(obj)
void unserialize(CheckpointIn &cp) override
Unserialize an object.
void deschedule(Event &event)
void schedule(Event &event, Tick when)
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.
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.
bool scheduled() const
Determine if the current event is scheduled.
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 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...
Tick when() const
Get the time that the event is scheduled.
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.