gem5
v20.1.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. More... | |
FrameBuffer () | |
Create an empty (0x0) frame buffer. More... | |
virtual | ~FrameBuffer () |
void | serialize (CheckpointOut &cp) const override |
Serialize an object. More... | |
void | unserialize (CheckpointIn &cp) override |
Unserialize an object. More... | |
void | resize (unsigned width, unsigned height) |
Resize the frame buffer. More... | |
unsigned | width () const |
Frame buffer width in pixels. More... | |
unsigned | height () const |
Frame buffer height in pixels. More... | |
unsigned | area () const |
Total number of pixels in frame buffer. More... | |
void | fill (const Pixel &pixel) |
Fill the frame buffer with a single pixel value. More... | |
void | clear () |
Fill the frame buffer with black pixels. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
const Pixel & | pixel (unsigned x, unsigned y) const |
Get a pixel from an (x, y) coordinate. More... | |
Pixel & | pixel (unsigned x, unsigned y) |
Get a pixel from an (x, y) coordinate. More... | |
uint64_t | getHash () const |
Create a hash of the image that can be used for quick comparisons. More... | |
Public Member Functions inherited from Serializable | |
Serializable () | |
virtual | ~Serializable () |
void | serializeSection (CheckpointOut &cp, const char *name) const |
Serialize an object into a new section. More... | |
void | serializeSection (CheckpointOut &cp, const std::string &name) const |
void | unserializeSection (CheckpointIn &cp, const char *name) |
Unserialize an a child object. More... | |
void | unserializeSection (CheckpointIn &cp, const std::string &name) |
Public Attributes | |
std::vector< Pixel > | pixels |
Frame buffer backing store. More... | |
Static Public Attributes | |
static const FrameBuffer | dummy |
Static "dummy" frame buffer. More... | |
Protected Attributes | |
unsigned | _width |
Width in pixels. More... | |
unsigned | _height |
Height in pixels. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from Serializable | |
static const std::string & | currentSection () |
Gets the fully-qualified name of the active section. More... | |
static void | serializeAll (const std::string &cpt_dir) |
Serializes all the SimObjects. More... | |
static void | unserializeGlobals (CheckpointIn &cp) |
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 65 of file framebuffer.hh.
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 46 of file framebuffer.cc.
References clear().
FrameBuffer::FrameBuffer | ( | ) |
Create an empty (0x0) frame buffer.
Definition at line 53 of file framebuffer.cc.
|
virtual |
Definition at line 58 of file framebuffer.cc.
|
inline |
Total number of pixels in frame buffer.
Definition at line 100 of file framebuffer.hh.
References _height, and _width.
Referenced by BmpWriter::getCompleteHeader(), getHash(), and PngWriter::write().
void FrameBuffer::clear | ( | ) |
Fill the frame buffer with black pixels.
Definition at line 96 of file framebuffer.cc.
References 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 128 of file framebuffer.hh.
References copyIn(), and ArmISA::fb.
void 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 104 of file framebuffer.cc.
References ArmISA::fb, PixelConverter::length, MipsISA::p, pixels, and PixelConverter::toPixel().
Referenced by copyIn(), Pl111::dmaDone(), and 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 147 of file framebuffer.hh.
References copyOut(), and ArmISA::fb.
void 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 113 of file framebuffer.cc.
References ArmISA::fb, PixelConverter::fromPixel(), PixelConverter::length, MipsISA::p, and pixels.
Referenced by copyOut().
void FrameBuffer::fill | ( | const Pixel & | pixel | ) |
Fill the frame buffer with a single pixel value.
pixel | Pixel value to fill with. |
Definition at line 89 of file framebuffer.cc.
References MipsISA::p, pixel(), and pixels.
Referenced by clear().
uint64_t FrameBuffer::getHash | ( | ) | const |
Create a hash of the image that can be used for quick comparisons.
Definition at line 122 of file framebuffer.cc.
References area(), and pixels.
Referenced by VncInput::captureFrameBuffer().
|
inline |
Frame buffer height in pixels.
Definition at line 98 of file framebuffer.hh.
References _height.
Referenced by BmpWriter::getCompleteHeader(), resize(), VncServer::sendFrameBufferUpdate(), VncInput::setDirty(), BasePixelPump::updateTimings(), BmpWriter::write(), and 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 170 of file framebuffer.hh.
References _height, _width, pixels, and 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 157 of file framebuffer.hh.
References _height, _width, pixels, and RiscvISA::x.
Referenced by fill(), BasePixelPump::renderLine(), BasePixelPump::renderPixels(), VncServer::sendFrameBufferUpdate(), BmpWriter::write(), and PngWriter::write().
void 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 80 of file framebuffer.cc.
References _height, _width, height(), pixels, and width().
Referenced by BasePixelPump::updateTimings(), and Pl111::updateVideoParams().
|
overridevirtual |
Serialize an object.
Output an object's state into the current checkpoint section.
cp | Checkpoint state |
Implements Serializable.
Definition at line 64 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 Serializable.
Definition at line 72 of file framebuffer.cc.
References _height, _width, pixels, UNSERIALIZE_CONTAINER, and UNSERIALIZE_SCALAR.
|
inline |
Frame buffer width in pixels.
Definition at line 96 of file framebuffer.hh.
References _width.
Referenced by BmpWriter::getCompleteHeader(), resize(), VncServer::sendFrameBufferUpdate(), VncInput::setDirty(), BasePixelPump::updateTimings(), BmpWriter::write(), and PngWriter::write().
|
protected |
Height in pixels.
Definition at line 198 of file framebuffer.hh.
Referenced by area(), height(), pixel(), resize(), serialize(), and unserialize().
|
protected |
Width in pixels.
Definition at line 196 of file framebuffer.hh.
Referenced by area(), 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 189 of file framebuffer.hh.
std::vector<Pixel> FrameBuffer::pixels |
Frame buffer backing store.
Definition at line 192 of file framebuffer.hh.
Referenced by copyIn(), copyOut(), fill(), getHash(), pixel(), resize(), serialize(), and unserialize().