gem5 v24.0.0.0
|
Internal gem5 representation of a frame buffer. More...
#include <framebuffer.hh>
Public Member Functions | |
FrameBuffer (unsigned width, unsigned height) | |
Create a frame buffer of a given size. | |
FrameBuffer () | |
Create an empty (0x0) frame buffer. | |
virtual | ~FrameBuffer () |
void | serialize (CheckpointOut &cp) const override |
Serialize an object. | |
void | unserialize (CheckpointIn &cp) override |
Unserialize an object. | |
void | resize (unsigned width, unsigned height) |
Resize the frame buffer. | |
unsigned | width () const |
Frame buffer width in pixels. | |
unsigned | height () const |
Frame buffer height in pixels. | |
unsigned | area () const |
Total number of pixels in frame buffer. | |
void | fill (const Pixel &pixel) |
Fill the frame buffer with a single pixel value. | |
void | clear () |
Fill the frame buffer with black pixels. | |
void | copyIn (const uint8_t *fb, const PixelConverter &conv) |
Fill the frame buffer with pixel data from an external buffer of the same width and height as this frame buffer. | |
void | copyIn (const std::vector< uint8_t > &fb, const PixelConverter &conv) |
Fill the frame buffer with pixel data from an external buffer of the same width and height as this frame buffer. | |
void | copyOut (uint8_t *fb, const PixelConverter &conv) const |
Store the contents of this frame buffer in an external buffer of the same width and height as this frame buffer. | |
void | copyOut (std::vector< uint8_t > &fb, const PixelConverter &conv) const |
Store the contents of this frame buffer in an external buffer of the same width and height as this frame buffer. | |
const Pixel & | pixel (unsigned x, unsigned y) const |
Get a pixel from an (x, y) coordinate. | |
Pixel & | pixel (unsigned x, unsigned y) |
Get a pixel from an (x, y) coordinate. | |
uint64_t | getHash () const |
Create a hash of the image that can be used for quick comparisons. | |
Public Member Functions inherited from gem5::Serializable | |
Serializable () | |
virtual | ~Serializable () |
void | serializeSection (CheckpointOut &cp, const char *name) const |
Serialize an object into a new section. | |
void | serializeSection (CheckpointOut &cp, const std::string &name) const |
void | unserializeSection (CheckpointIn &cp, const char *name) |
Unserialize an a child object. | |
void | unserializeSection (CheckpointIn &cp, const std::string &name) |
Public Attributes | |
std::vector< Pixel > | pixels |
Frame buffer backing store. | |
Static Public Attributes | |
static const FrameBuffer | dummy |
Static "dummy" frame buffer. | |
Protected Attributes | |
unsigned | _width |
Width in pixels. | |
unsigned | _height |
Height in pixels. | |
Additional Inherited Members | |
Static Public Member Functions inherited from gem5::Serializable | |
static const std::string & | currentSection () |
Gets the fully-qualified name of the active section. | |
static void | generateCheckpointOut (const std::string &cpt_dir, std::ofstream &outstream) |
Generate a checkpoint file so that the serialization can be routed to it. | |
Internal gem5 representation of a frame buffer.
Display controllers and other devices producing images are expected to use this class to represent the final image.
Pixels are indexed relative to the upper left corner of the image. That is, the pixel at position (0, 0) is the upper left corner. The backing store is a linear vector of Pixels ordered left to right starting in the upper left corner.
Definition at line 68 of file framebuffer.hh.
gem5::FrameBuffer::FrameBuffer | ( | unsigned | width, |
unsigned | height ) |
Create a frame buffer of a given size.
width | Width in pixels |
height | Height in pixels |
Definition at line 49 of file framebuffer.cc.
References clear().
gem5::FrameBuffer::FrameBuffer | ( | ) |
Create an empty (0x0) frame buffer.
Definition at line 56 of file framebuffer.cc.
|
virtual |
Definition at line 61 of file framebuffer.cc.
|
inline |
Total number of pixels in frame buffer.
Definition at line 103 of file framebuffer.hh.
References _height, and _width.
Referenced by gem5::BmpWriter::getCompleteHeader(), getHash(), and gem5::PngWriter::write().
void gem5::FrameBuffer::clear | ( | ) |
Fill the frame buffer with black pixels.
Definition at line 99 of file framebuffer.cc.
References gem5::MipsISA::fill.
Referenced by FrameBuffer().
|
inline |
Fill the frame buffer with pixel data from an external buffer of the same width and height as this frame buffer.
fb | External frame buffer |
conv | Pixel conversion helper |
Definition at line 131 of file framebuffer.hh.
References copyIn(), and gem5::ArmISA::fb.
void gem5::FrameBuffer::copyIn | ( | const uint8_t * | fb, |
const PixelConverter & | conv ) |
Fill the frame buffer with pixel data from an external buffer of the same width and height as this frame buffer.
fb | External frame buffer |
conv | Pixel conversion helper |
Definition at line 107 of file framebuffer.cc.
References gem5::ArmISA::fb, gem5::PixelConverter::length, gem5::MipsISA::p, pixels, and gem5::PixelConverter::toPixel().
Referenced by copyIn(), gem5::Pl111::dmaDone(), and gem5::Pl111::unserialize().
|
inline |
Store the contents of this frame buffer in an external buffer of the same width and height as this frame buffer.
fb | External frame buffer |
conv | Pixel conversion helper |
Definition at line 150 of file framebuffer.hh.
References copyOut(), and gem5::ArmISA::fb.
void gem5::FrameBuffer::copyOut | ( | uint8_t * | fb, |
const PixelConverter & | conv ) const |
Store the contents of this frame buffer in an external buffer of the same width and height as this frame buffer.
fb | External frame buffer |
conv | Pixel conversion helper |
Definition at line 116 of file framebuffer.cc.
References gem5::ArmISA::fb, gem5::PixelConverter::fromPixel(), gem5::PixelConverter::length, gem5::MipsISA::p, and pixels.
Referenced by copyOut().
void gem5::FrameBuffer::fill | ( | const Pixel & | pixel | ) |
Fill the frame buffer with a single pixel value.
pixel | Pixel value to fill with. |
Definition at line 92 of file framebuffer.cc.
References gem5::MipsISA::p, pixel(), and pixels.
uint64_t gem5::FrameBuffer::getHash | ( | ) | const |
Create a hash of the image that can be used for quick comparisons.
Definition at line 125 of file framebuffer.cc.
References area(), and pixels.
Referenced by gem5::VncInput::captureFrameBuffer().
|
inline |
Frame buffer height in pixels.
Definition at line 101 of file framebuffer.hh.
References _height.
Referenced by gem5::BmpWriter::getCompleteHeader(), resize(), gem5::VncServer::sendFrameBufferUpdate(), gem5::VncInput::setDirty(), gem5::BasePixelPump::updateTimings(), gem5::BmpWriter::write(), and gem5::PngWriter::write().
|
inline |
Get a pixel from an (x, y) coordinate.
x | Distance from the left margin. |
y | Distance from the top of the frame. |
Definition at line 173 of file framebuffer.hh.
References _height, _width, pixels, and gem5::RiscvISA::x.
|
inline |
Get a pixel from an (x, y) coordinate.
x | Distance from the left margin. |
y | Distance from the top of the frame. |
Definition at line 160 of file framebuffer.hh.
References _height, _width, pixels, and gem5::RiscvISA::x.
Referenced by fill(), gem5::BasePixelPump::renderPixels(), gem5::VncServer::sendFrameBufferUpdate(), gem5::BmpWriter::write(), and gem5::PngWriter::write().
void gem5::FrameBuffer::resize | ( | unsigned | width, |
unsigned | height ) |
Resize the frame buffer.
This method resizes frame buffer including the backing store. The contents of the backing store are undefined after this operation.
with | Width in pixels. |
height | Height in pixels. |
Definition at line 83 of file framebuffer.cc.
References _height, _width, height(), pixels, and width().
Referenced by gem5::BasePixelPump::updateTimings(), and gem5::Pl111::updateVideoParams().
|
overridevirtual |
Serialize an object.
Output an object's state into the current checkpoint section.
cp | Checkpoint state |
Implements gem5::Serializable.
Definition at line 67 of file framebuffer.cc.
References _height, _width, pixels, SERIALIZE_CONTAINER, and SERIALIZE_SCALAR.
|
overridevirtual |
Unserialize an object.
Read an object's state from the current checkpoint section.
cp | Checkpoint state |
Implements gem5::Serializable.
Definition at line 75 of file framebuffer.cc.
References _height, _width, pixels, UNSERIALIZE_CONTAINER, and UNSERIALIZE_SCALAR.
|
inline |
Frame buffer width in pixels.
Definition at line 99 of file framebuffer.hh.
References _width.
Referenced by gem5::BmpWriter::getCompleteHeader(), gem5::BasePixelPump::renderLine(), resize(), gem5::VncServer::sendFrameBufferUpdate(), gem5::VncInput::setDirty(), gem5::BasePixelPump::updateTimings(), gem5::BmpWriter::write(), and gem5::PngWriter::write().
|
protected |
Height in pixels.
Definition at line 201 of file framebuffer.hh.
Referenced by area(), height(), pixel(), pixel(), resize(), serialize(), and unserialize().
|
protected |
Width in pixels.
Definition at line 199 of file framebuffer.hh.
Referenced by area(), pixel(), pixel(), resize(), serialize(), unserialize(), and width().
|
static |
Static "dummy" frame buffer.
This is a dummy frame buffer that can be used as a place holder for devices that always expect a frame buffer to be present.
Definition at line 192 of file framebuffer.hh.
std::vector<Pixel> gem5::FrameBuffer::pixels |
Frame buffer backing store.
Definition at line 195 of file framebuffer.hh.
Referenced by copyIn(), copyOut(), fill(), getHash(), pixel(), pixel(), gem5::BasePixelPump::renderLine(), resize(), serialize(), and unserialize().