gem5  v22.1.0.0
Public Member Functions | Public Attributes | Static Public Attributes | Protected Attributes | List of all members
gem5::FrameBuffer Class Reference

Internal gem5 representation of a frame buffer. More...

#include <framebuffer.hh>

Inheritance diagram for gem5::FrameBuffer:
gem5::Serializable

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 Pixelpixel (unsigned x, unsigned y) const
 Get a pixel from an (x, y) coordinate. More...
 
Pixelpixel (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 gem5::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< Pixelpixels
 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 gem5::Serializable
static const std::string & currentSection ()
 Gets the fully-qualified name of the active section. More...
 
static void generateCheckpointOut (const std::string &cpt_dir, std::ofstream &outstream)
 Generate a checkpoint file so that the serialization can be routed to it. More...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ FrameBuffer() [1/2]

gem5::FrameBuffer::FrameBuffer ( unsigned  width,
unsigned  height 
)

Create a frame buffer of a given size.

Parameters
widthWidth in pixels
heightHeight in pixels

Definition at line 49 of file framebuffer.cc.

References clear().

◆ FrameBuffer() [2/2]

gem5::FrameBuffer::FrameBuffer ( )

Create an empty (0x0) frame buffer.

Definition at line 56 of file framebuffer.cc.

◆ ~FrameBuffer()

gem5::FrameBuffer::~FrameBuffer ( )
virtual

Definition at line 61 of file framebuffer.cc.

Member Function Documentation

◆ area()

unsigned gem5::FrameBuffer::area ( ) const
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().

◆ clear()

void gem5::FrameBuffer::clear ( )

Fill the frame buffer with black pixels.

Definition at line 99 of file framebuffer.cc.

References fill().

Referenced by FrameBuffer().

◆ copyIn() [1/2]

void gem5::FrameBuffer::copyIn ( const std::vector< uint8_t > &  fb,
const PixelConverter conv 
)
inline

Fill the frame buffer with pixel data from an external buffer of the same width and height as this frame buffer.

Parameters
fbExternal frame buffer
convPixel conversion helper

Definition at line 131 of file framebuffer.hh.

References copyIn(), and gem5::ArmISA::fb.

◆ copyIn() [2/2]

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.

Parameters
fbExternal frame buffer
convPixel conversion helper

Definition at line 107 of file framebuffer.cc.

References gem5::ArmISA::fb, gem5::PixelConverter::length, gem5::VegaISA::p, pixels, and gem5::PixelConverter::toPixel().

Referenced by copyIn(), gem5::Pl111::dmaDone(), and gem5::Pl111::unserialize().

◆ copyOut() [1/2]

void gem5::FrameBuffer::copyOut ( std::vector< uint8_t > &  fb,
const PixelConverter conv 
) const
inline

Store the contents of this frame buffer in an external buffer of the same width and height as this frame buffer.

Parameters
fbExternal frame buffer
convPixel conversion helper

Definition at line 150 of file framebuffer.hh.

References copyOut(), and gem5::ArmISA::fb.

◆ copyOut() [2/2]

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.

Parameters
fbExternal frame buffer
convPixel conversion helper

Definition at line 116 of file framebuffer.cc.

References gem5::ArmISA::fb, gem5::PixelConverter::fromPixel(), gem5::PixelConverter::length, gem5::VegaISA::p, and pixels.

Referenced by copyOut().

◆ fill()

void gem5::FrameBuffer::fill ( const Pixel pixel)

Fill the frame buffer with a single pixel value.

Parameters
pixelPixel value to fill with.

Definition at line 92 of file framebuffer.cc.

References gem5::VegaISA::p, pixel(), and pixels.

Referenced by clear().

◆ getHash()

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().

◆ height()

unsigned gem5::FrameBuffer::height ( ) const
inline

◆ pixel() [1/2]

Pixel& gem5::FrameBuffer::pixel ( unsigned  x,
unsigned  y 
)
inline

Get a pixel from an (x, y) coordinate.

Parameters
xDistance from the left margin.
yDistance from the top of the frame.

Definition at line 173 of file framebuffer.hh.

References _height, _width, pixels, and gem5::VegaISA::x.

◆ pixel() [2/2]

const Pixel& gem5::FrameBuffer::pixel ( unsigned  x,
unsigned  y 
) const
inline

Get a pixel from an (x, y) coordinate.

Parameters
xDistance from the left margin.
yDistance from the top of the frame.

Definition at line 160 of file framebuffer.hh.

References _height, _width, pixels, and gem5::VegaISA::x.

Referenced by fill(), gem5::BasePixelPump::renderPixels(), gem5::VncServer::sendFrameBufferUpdate(), gem5::BmpWriter::write(), and gem5::PngWriter::write().

◆ resize()

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.

Parameters
withWidth in pixels.
heightHeight 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().

◆ serialize()

void gem5::FrameBuffer::serialize ( CheckpointOut cp) const
overridevirtual

Serialize an object.

Output an object's state into the current checkpoint section.

Parameters
cpCheckpoint state

Implements gem5::Serializable.

Definition at line 67 of file framebuffer.cc.

References _height, _width, pixels, SERIALIZE_CONTAINER, and SERIALIZE_SCALAR.

◆ unserialize()

void gem5::FrameBuffer::unserialize ( CheckpointIn cp)
overridevirtual

Unserialize an object.

Read an object's state from the current checkpoint section.

Parameters
cpCheckpoint state

Implements gem5::Serializable.

Definition at line 75 of file framebuffer.cc.

References _height, _width, pixels, UNSERIALIZE_CONTAINER, and UNSERIALIZE_SCALAR.

◆ width()

unsigned gem5::FrameBuffer::width ( ) const
inline

Member Data Documentation

◆ _height

unsigned gem5::FrameBuffer::_height
protected

Height in pixels.

Definition at line 201 of file framebuffer.hh.

Referenced by area(), height(), pixel(), resize(), serialize(), and unserialize().

◆ _width

unsigned gem5::FrameBuffer::_width
protected

Width in pixels.

Definition at line 199 of file framebuffer.hh.

Referenced by area(), pixel(), resize(), serialize(), unserialize(), and width().

◆ dummy

const FrameBuffer gem5::FrameBuffer::dummy
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.

◆ pixels

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(), gem5::BasePixelPump::renderLine(), resize(), serialize(), and unserialize().


The documentation for this class was generated from the following files:

Generated on Wed Dec 21 2022 10:23:12 for gem5 by doxygen 1.9.1