46 #include "debug/Checkpoint.hh"
47 #include "debug/HDLcd.hh"
52 #include "params/HDLcd.hh"
63 workaroundSwapRB(p->workaround_swap_rb),
64 workaroundDmaLineCount(p->workaround_dma_line_count),
66 enableCapture(
p->enable_capture),
67 pixelBufferSize(
p->pixel_buffer_size),
68 virtRefreshRate(
p->virt_refresh_rate),
71 version(VERSION_RESETV),
72 int_rawstat(0), int_mask(0),
74 fb_base(0), fb_line_length(0), fb_line_count(0), fb_line_pitch(0),
75 bus_options(BUS_OPTIONS_RESETV),
77 v_sync(0), v_back_porch(0), v_data(0), v_front_porch(0),
78 h_sync(0), h_back_porch(0), h_data(0), h_front_porch(0),
84 red_select(0), green_select(0), blue_select(0),
86 virtRefreshEvent(
this),
89 pixelPump(*
this, *
p->pxl_clk,
p->pixel_chunk)
92 vnc->setFrameBuffer(&pixelPump.fb);
104 using namespace Stats;
107 .name(
name() +
".underruns")
108 .desc(
"number of buffer underruns")
116 DPRINTF(Checkpoint,
"Serializing ARM HDLCD\n");
147 dmaEngine->serializeSection(cp,
"dmaEngine");
153 DPRINTF(Checkpoint,
"Unserializing ARM HDLCD\n");
195 dmaEngine->unserializeSection(cp,
"dmaEngine");
242 "Unhandled read size (address: 0x.4x, size: %u)",
246 DPRINTF(
HDLcd,
"read register 0x%04x: 0x%x\n", daddr, data);
262 "Unhandled read size (address: 0x.4x, size: %u)",
264 const uint32_t
data(pkt->
get<uint32_t>());
265 DPRINTF(
HDLcd,
"write register 0x%04x: 0x%x\n", daddr, data);
281 panic(
"HDLCD INT_CLEAR register is Write-Only\n");
308 panic(
"Tried to read HDLCD register that doesn't exist\n", offset);
317 panic(
"HDLCD VERSION register is read-Only\n");
329 panic(
"HDLCD INT_STATUS register is read-Only\n");
352 if (
bus_options.max_outstanding != old_bus_options.max_outstanding) {
354 "Changing HDLcd outstanding DMA transactions: %d -> %d\n",
360 if (
bus_options.burst_len != old_bus_options.burst_len) {
362 "Changing HDLcd DMA burst flags: 0x%x -> 0x%x\n",
400 if (new_command.enable !=
command.enable) {
402 new_command.enable ?
"on" :
"off");
404 if (new_command.enable) {
428 panic(
"Tried to write HDLCD register that doesn't exist\n", offset);
469 warn(
"Maximum number of outstanding DMA transfers set to 0.");
473 const uint32_t dma_burst_flags(
bus_options.burst_len);
474 const uint32_t dma_burst_len(
482 const uint32_t dma_lines(
550 DPRINTF(
HDLcd,
"Buffer underrun, stopping DMA fill.\n");
562 warn(
"HDLCD %u bytes still in FIFO after frame: Ensure that DMA "
563 "and PixelPump configuration is consistent\n",
601 unsigned request_size,
unsigned max_pending,
602 size_t line_size, ssize_t line_pitch,
unsigned num_lines)
604 _parent.
dmaPort, size, request_size, max_pending,
607 lineSize(line_size), linePitch(line_pitch), numLines(num_lines),
634 frameEnd = fb_base + numLines * linePitch;
636 startFill(nextLineAddr, lineSize);
642 nextLineAddr = frameEnd;
651 inform(
"DMA line size: %u bytes", lineSize);
652 inform(
"DMA line pitch: %i bytes", linePitch);
653 inform(
"DMA num lines: %u", numLines);
659 if (nextLineAddr == frameEnd)
664 nextLineAddr += linePitch;
665 if (nextLineAddr != frameEnd)
666 startFill(nextLineAddr, lineSize);
672 parent.intRaise(INT_DMA_END);
685 inform(
"PixelPump horizontal fron porch: %u", t.
hSync);
689 inform(
"PixelPump vertical fron porch: %u", t.
vSync);
694 HDLcdParams::create()
696 return new HDLcd(
this);
TimingReg v_back_porch
Vertical back porch width register.
void unserialize(CheckpointIn &cp) override
Unserialize an object.
void serialize(CheckpointOut &cp) const override
Serialize an object.
AddrRange RangeSize(Addr start, Addr size)
Pixel toPixel(uint32_t word) const
Get the Pixel representation of a color word.
unsigned vSync
Vertical sync signal in lines.
std::ostream * stream() const
Get the output underlying output stream.
void set(T v, ByteOrder endian)
Set the value in the data pointer to v using the specified endianness.
static constexpr size_t MAX_PIXEL_SIZE
Maximum number of bytes per pixel.
virtual void clearInt(uint32_t num)=0
Clear an interrupt from a device that is connected to the GIC.
void serialize(CheckpointOut &cp) const override
Serialize an object.
uint32_t fb_base
Frame buffer base address register.
Buffered DMA engine helper class.
OutputStream * create(const std::string &name, bool binary=false, bool no_gz=false)
Creates a file in this directory (optionally compressed).
TimingReg h_front_porch
Horizontal front porch width reg.
const bool workaroundDmaLineCount
void serialize(CheckpointOut &cp) const override
Serialize an object.
unsigned length
Bytes per pixel when stored in memory (including padding)
Bitfield< 11, 8 > max_outstanding
void intMask(uint32_t mask)
Convenience function to update the interrupt mask.
bool bypassCaches() const
Should caches be bypassed?
DmaEngine(HDLcd &_parent, size_t size, unsigned request_size, unsigned max_pending, size_t line_size, ssize_t line_pitch, unsigned num_lines)
panic_if(!root,"Invalid expression\n")
bool scheduled() const
Determine if the current event is scheduled.
void stop()
Immediately stop pushing pixels.
PixelFormatReg pixel_format
Pixel format register.
unsigned hBackPorch
Horizontal back porch in pixels.
ColorSelectReg green_select
Green color select register.
ColorSelectReg blue_select
Blue color select register.
CommandReg command
Command register.
BusOptsReg bus_options
Bus options register.
unsigned vFrontPorch
Vertical front porch in lines.
void start()
Starting pushing pixels in timing mode.
void unserialize(CheckpointIn &cp) override
Unserialize an object.
const Tick virtRefreshRate
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Implementiation of the ARM HDLcd controller.
HDLcd(const HDLcdParams *p)
TimingReg v_front_porch
Vertical front porch width register.
void deschedule(Event &event)
T get(ByteOrder endian) const
Get the data in the packet byte swapped from the specified endianness.
static constexpr size_t MAX_BURST_LEN
max number of beats delivered in one dma burst
void startFrame(Addr fb_base)
const Addr pixelBufferSize
std::unique_ptr< DmaEngine > dmaEngine
#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...
OutputStream * pic
Picture of what the current frame buffer looks like.
TimingReg h_back_porch
Horizontal back porch width register.
Tick curTick()
The current simulated tick.
std::string csprintf(const char *format, const Args &...args)
uint32_t int_mask
Interrupt mask register.
bool active() const
Is the pixel pump active and refreshing the display?
PixelConverter pixelConverter() const
uint32_t fb_line_length
Frame buffer Line length register.
This is a base class for AMBA devices that have to respond to Device and Implementer ID calls...
virtual void sendInt(uint32_t num)=0
Post an interrupt from a device that is connected to the GIC.
void makeAtomicResponse()
void renderFrame()
Render an entire frame in KVM execution mode.
uint64_t Tick
Tick count type.
#define SERIALIZE_OBJ(obj)
TimingReg h_sync
Horizontal sync width register.
void intClear(uint32_t ints)
Convenience function to clear interrupts.
static const PixelConverter rgba8888_le
Predefined 32-bit RGB (red in least significant bits, 8 bits/channel, little endian) conversion helpe...
PolaritiesReg polarities
Polarities register.
PixelConverter conv
Cached pixel converter, set when the converter is enabled.
void updateTimings(const DisplayTimings &timings)
Update frame size using display timing.
EventWrapper< HDLcd,&HDLcd::virtRefresh > virtRefreshEvent
Tick read(PacketPtr pkt) override
Pure virtual function that the device must implement.
void setInterrupts(uint32_t ints, uint32_t mask)
Assign new interrupt values and update interrupt signals.
TimingReg h_data
Horizontal data width register.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
void onIdle() override
Last response received callback.
unsigned height
Display height in pixels.
#define SERIALIZE_SCALAR(scalar)
void unserialize(CheckpointIn &cp) override
Unserialize an object.
ColorSelectReg red_select
Red color select register.
unsigned hFrontPorch
Horizontal front porch in pixels.
static constexpr size_t AXI_PORT_WIDTH
AXI port width in bytes.
void write(std::ostream &bmp) const
Write the frame buffer data into the provided ostream.
uint32_t int_rawstat
Interrupt raw status register.
unsigned hSync
Horizontal sync signal length in pixels.
virtual const std::string name() const
Base class for ARM GIC implementations.
void virtRefresh()
Handler for fast frame refresh in KVM-mode.
Declaration of the Packet class.
std::ostream CheckpointOut
void writeReg(Addr offset, uint32_t value)
int32_t fb_line_pitch
Frame buffer Line pitch register.
virtual void drainResume()
Resume execution after a successful drain.
bool sectionExists(const std::string §ion)
Tick write(PacketPtr pkt) override
Pure virtual function that the device must implement.
static const std::string & currentSection()
Get the fully-qualified name of the active section.
uint32_t readReg(Addr offset)
int findMsbSet(uint64_t val)
Returns the bit position of the MSB that is set in the input.
Bitmap bmp
Helper to write out bitmaps.
void schedule(Event &event, Tick when)
static constexpr uint32_t INT_VSYNC
unsigned vBackPorch
Vertical back porch in lines.
const bool workaroundSwapRB
Configurable RGB pixel converter.
Internal gem5 representation of a Pixel.
void drainResume() override
Resume execution after a successful drain.
DisplayTimings displayTimings() const
static constexpr uint32_t INT_UNDERRUN
Scoped checkpoint section helper class.
const FlagsType nozero
Don't print if this is zero.
uint32_t intStatus() const
Masked interrupt status register.
unsigned width
Display width in pixels.
void regStats() override
Register statistics for this object.
void intRaise(uint32_t ints)
Convenience function to raise a new interrupt.
TimingReg v_sync
Vertical sync width register.
void regStats() override
Register statistics for this object.
TimingReg v_data
Vertical data width register.
void onEndOfBlock() override
End of block callback.