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

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

#include <framebuffer.hh>

Inheritance diagram for FrameBuffer:
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 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 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)
 

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 65 of file framebuffer.hh.

Constructor & Destructor Documentation

◆ FrameBuffer() [1/2]

FrameBuffer::FrameBuffer ( unsigned  width,
unsigned  height 
)

Create a frame buffer of a given size.

Parameters
widthWidth in pixels
heightHeight in pixels

Definition at line 46 of file framebuffer.cc.

References clear().

◆ FrameBuffer() [2/2]

FrameBuffer::FrameBuffer ( )

Create an empty (0x0) frame buffer.

Definition at line 53 of file framebuffer.cc.

◆ ~FrameBuffer()

FrameBuffer::~FrameBuffer ( )
virtual

Definition at line 58 of file framebuffer.cc.

Member Function Documentation

◆ area()

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

◆ clear()

void FrameBuffer::clear ( )

Fill the frame buffer with black pixels.

Definition at line 96 of file framebuffer.cc.

References fill().

Referenced by FrameBuffer().

◆ copyIn() [1/2]

void 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 128 of file framebuffer.hh.

References copyIn(), and ArmISA::fb.

◆ copyIn() [2/2]

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.

Parameters
fbExternal frame buffer
convPixel 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().

◆ copyOut() [1/2]

void 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 147 of file framebuffer.hh.

References copyOut(), and ArmISA::fb.

◆ copyOut() [2/2]

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.

Parameters
fbExternal frame buffer
convPixel conversion helper

Definition at line 113 of file framebuffer.cc.

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

Referenced by copyOut().

◆ fill()

void FrameBuffer::fill ( const Pixel pixel)

Fill the frame buffer with a single pixel value.

Parameters
pixelPixel value to fill with.

Definition at line 89 of file framebuffer.cc.

References MipsISA::p, pixel(), and pixels.

Referenced by clear().

◆ getHash()

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

◆ height()

unsigned FrameBuffer::height ( ) const
inline

◆ pixel() [1/2]

Pixel& 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 170 of file framebuffer.hh.

References _height, _width, pixels, and RiscvISA::x.

◆ pixel() [2/2]

const Pixel& 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 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().

◆ resize()

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.

Parameters
withWidth in pixels.
heightHeight in pixels.

Definition at line 80 of file framebuffer.cc.

References _height, _width, height(), pixels, and width().

Referenced by BasePixelPump::updateTimings(), and Pl111::updateVideoParams().

◆ serialize()

void FrameBuffer::serialize ( CheckpointOut cp) const
overridevirtual

Serialize an object.

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

Parameters
cpCheckpoint state

Implements Serializable.

Definition at line 64 of file framebuffer.cc.

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

◆ unserialize()

void FrameBuffer::unserialize ( CheckpointIn cp)
overridevirtual

Unserialize an object.

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

Parameters
cpCheckpoint state

Implements Serializable.

Definition at line 72 of file framebuffer.cc.

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

◆ width()

unsigned FrameBuffer::width ( ) const
inline

Member Data Documentation

◆ _height

unsigned FrameBuffer::_height
protected

Height in pixels.

Definition at line 198 of file framebuffer.hh.

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

◆ _width

unsigned FrameBuffer::_width
protected

Width in pixels.

Definition at line 196 of file framebuffer.hh.

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

◆ dummy

const FrameBuffer 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 189 of file framebuffer.hh.

◆ pixels

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


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

Generated on Wed Sep 30 2020 14:02:24 for gem5 by doxygen 1.8.17