gem5
|
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... | |
Static Public Attributes inherited from Serializable | |
static int | ckptCount = 0 |
static int | ckptMaxCount = 0 |
static int | ckptPrevCount = -1 |
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 () |
Get the fully-qualified name of the active section. More... | |
static void | serializeAll (const std::string &cpt_dir) |
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 244 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 109 of file framebuffer.cc.
References clear().
FrameBuffer::FrameBuffer | ( | ) |
Create an empty (0x0) frame buffer.
Definition at line 116 of file framebuffer.cc.
|
virtual |
Definition at line 121 of file framebuffer.cc.
|
inline |
Total number of pixels in frame buffer.
Definition at line 279 of file framebuffer.hh.
References _height, and _width.
Referenced by Bitmap::getCompleteHeader(), and getHash().
void FrameBuffer::clear | ( | ) |
Fill the frame buffer with black pixels.
Definition at line 159 of file framebuffer.cc.
References fill().
Referenced by FrameBuffer().
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 167 of file framebuffer.cc.
References PixelConverter::length, MipsISA::p, pixels, and PixelConverter::toPixel().
Referenced by copyIn(), Pl111::dmaDone(), and Pl111::unserialize().
|
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 307 of file framebuffer.hh.
References copyIn().
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 176 of file framebuffer.cc.
References PixelConverter::fromPixel(), PixelConverter::length, MipsISA::p, and pixels.
Referenced by copyOut().
|
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 326 of file framebuffer.hh.
References 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 152 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 185 of file framebuffer.cc.
References area(), and pixels.
Referenced by VncInput::captureFrameBuffer().
|
inline |
Frame buffer height in pixels.
Definition at line 277 of file framebuffer.hh.
References _height.
Referenced by Bitmap::getCompleteHeader(), resize(), VncServer::sendFrameBufferUpdate(), VncInput::setDirty(), BasePixelPump::updateTimings(), and Bitmap::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 336 of file framebuffer.hh.
References _height, _width, pixels, and X86ISA::x.
Referenced by fill(), BasePixelPump::renderLine(), BasePixelPump::renderPixels(), VncServer::sendFrameBufferUpdate(), and Bitmap::write().
|
inline |
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 143 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 127 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 135 of file framebuffer.cc.
References _height, _width, pixels, UNSERIALIZE_CONTAINER, and UNSERIALIZE_SCALAR.
|
inline |
Frame buffer width in pixels.
Definition at line 275 of file framebuffer.hh.
References _width.
Referenced by Bitmap::getCompleteHeader(), resize(), VncServer::sendFrameBufferUpdate(), VncInput::setDirty(), BasePixelPump::updateTimings(), and Bitmap::write().
|
protected |
Height in pixels.
Definition at line 377 of file framebuffer.hh.
Referenced by area(), height(), pixel(), resize(), serialize(), and unserialize().
|
protected |
Width in pixels.
Definition at line 375 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 368 of file framebuffer.hh.
std::vector<Pixel> FrameBuffer::pixels |
Frame buffer backing store.
Definition at line 371 of file framebuffer.hh.
Referenced by copyIn(), copyOut(), fill(), getHash(), pixel(), resize(), serialize(), and unserialize().