gem5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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...
 
- 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)
 

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

Constructor & Destructor Documentation

FrameBuffer::FrameBuffer ( unsigned  width,
unsigned  height 
)

Create a frame buffer of a given size.

Parameters
widthWidth in pixels
heightHeight 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.

FrameBuffer::~FrameBuffer ( )
virtual

Definition at line 121 of file framebuffer.cc.

Member Function Documentation

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

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

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

Parameters
fbExternal frame buffer
convPixel conversion helper

Definition at line 176 of file framebuffer.cc.

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

Referenced by copyOut().

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

References copyOut().

void FrameBuffer::fill ( const Pixel pixel)

Fill the frame buffer with a single pixel value.

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

unsigned FrameBuffer::height ( ) const
inline
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 336 of file framebuffer.hh.

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

Referenced by fill(), BasePixelPump::renderLine(), BasePixelPump::renderPixels(), VncServer::sendFrameBufferUpdate(), and Bitmap::write().

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

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

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 143 of file framebuffer.cc.

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

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

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 127 of file framebuffer.cc.

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

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 135 of file framebuffer.cc.

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

unsigned FrameBuffer::width ( ) const
inline

Member Data Documentation

unsigned FrameBuffer::_height
protected

Height in pixels.

Definition at line 377 of file framebuffer.hh.

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

unsigned FrameBuffer::_width
protected

Width in pixels.

Definition at line 375 of file framebuffer.hh.

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

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


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

Generated on Fri Jun 9 2017 13:04:10 for gem5 by doxygen 1.8.6