The Pedigree Project 0.1
Classes | Public Member Functions | Public Attributes | List of all members
Display Class Reference

#include <Display.h>

+ Inheritance diagram for Display:
+ Collaboration diagram for Display:

Classes

struct  PixelFormat
 
struct  rgb_t
 
struct  ScreenMode
 

Public Member Functions

 Display (Device *p)
 
virtual Type getType ()
 
virtual void getName (String &str)
 
virtual void dump (String &str)
 
virtual void * getFramebuffer ()
 
virtual rgb_t * newBuffer ()
 
virtual void setCurrentBuffer (rgb_t *pBuffer)
 
virtual void updateBuffer (rgb_t *pBuffer, size_t x1=~0UL, size_t y1=~0UL, size_t x2=~0UL, size_t y2=~0UL)
 
virtual void killBuffer (rgb_t *pBuffer)
 
virtual void bitBlit (rgb_t *pBuffer, size_t fromX, size_t fromY, size_t toX, size_t toY, size_t width, size_t height)
 
virtual void fillRectangle (rgb_t *pBuffer, size_t x, size_t y, size_t width, size_t height, rgb_t colour)
 
virtual bool getPixelFormat (PixelFormat &pf)
 
virtual bool getCurrentScreenMode (ScreenMode &sm)
 
virtual bool getScreenModes (List< ScreenMode * > &sms)
 
virtual bool setScreenMode (ScreenMode sm)
 
virtual bool setScreenMode (size_t modeId)
 
virtual bool setScreenMode (size_t nWidth, size_t nHeight, size_t nBpp)
 
- Public Member Functions inherited from Device
 Device (Device *p)
 
Device * getParent () const
 
void setParent (Device *p)
 
virtual const String & getSpecificType ()
 
virtual void setSpecificType (String str)
 
void setPciPosition (uint32_t bus, uint32_t device, uint32_t func)
 
void setPciIdentifiers (uint8_t classCode, uint8_t subclassCode, uint16_t vendorId, uint16_t deviceId, uint8_t progIf)
 
void setPciConfigHeader (const PciBus::ConfigSpace &space)
 
PciBus::ConfigSpace getPciConfigHeader () const
 
uint8_t getPciClassCode ()
 
uint8_t getPciSubclassCode ()
 
uint16_t getPciVendorId ()
 
uint16_t getPciDeviceId ()
 
uint8_t getPciProgInterface ()
 
uint32_t getPciBusPosition ()
 
uint32_t getPciDevicePosition ()
 
uint32_t getPciFunctionNumber ()
 
Device * getPhysicalFunction () const
 
size_t getVirtualFunctionIndex () const
 
void setVirtualFunction (Device *physicalFunction, size_t index)
 
virtual Vector< Address * > & addresses ()
 
virtual uintptr_t getInterruptNumber ()
 
virtual void setInterruptNumber (uintptr_t n)
 
void addChild (Device *pDevice)
 
Device * getChild (size_t n)
 
size_t getNumChildren ()
 
void removeChild (size_t n)
 
void removeChild (Device *d)
 
void replaceChild (Device *src, Device *dest)
 

Public Attributes

struct Display::rgb_t PACKED
 

Additional Inherited Members

- Public Types inherited from Device
enum  Type {
  Generic , Root , Disk , Bus ,
  Display , Network , Sound , Console ,
  Mouse , Controller , UsbController , UsbGeneric ,
  UsbContainer
}
 
typedef Device *(* Callback) (Device *)
 
- Static Public Member Functions inherited from Device
static bool treeLockHeldByCurrentThread ()
 
static void foreach (Callback callback, Device *root=0)
 
template<class F , class... Args>
static void foreach (pedigree_std::Callable< F > &callback, Device *root, Args... args)
 
static void addToRoot (Device *device)
 
static void searchByVendorId (uint16_t vendorId, void(*callback)(Device *), Device *root=0)
 
static void searchByVendorIdAndDeviceId (uint16_t vendorId, uint16_t deviceId, void(*callback)(Device *), Device *root=0)
 
static void searchByClass (uint16_t classCode, void(*callback)(Device *), Device *root=0)
 
static void searchByClassAndSubclass (uint16_t classCode, uint16_t subclassCode, void(*callback)(Device *), Device *root=0)
 
static void searchByClassSubclassAndProgInterface (uint16_t classCode, uint16_t subclassCode, uint8_t progInterface, void(*callback)(Device *), Device *root=0)
 
- Protected Member Functions inherited from Device
 NOT_COPYABLE_OR_ASSIGNABLE (Device)
 
- Static Protected Member Functions inherited from Device
static Device & root ()
 
- Protected Attributes inherited from Device
Vector< Address * > m_Addresses
 
Vector< Device * > m_Children
 
Device * m_pParent
 
Device * m_PhysicalFunction
 
size_t m_VirtualFunctionIndex
 
uintptr_t m_InterruptNumber
 
String m_SpecificType
 
PciBus::ConfigSpace m_ConfigHeader
 
uint8_t m_ClassCode
 
uint8_t m_SubclassCode
 
uint16_t m_VendorId
 
uint16_t m_DeviceId
 
uint8_t m_ProgInterface
 
uint32_t m_PciBusPos
 
uint32_t m_PciDevicePos
 
uint32_t m_PciFunctionNum
 
- Static Protected Attributes inherited from Device
static Device m_Root
 
static Mutex m_TreeLock
 

Detailed Description

A display is either a dumb framebuffer or something more accelerated.

The general use case for writing to the screen:

Definition at line 45 of file Display.h.

Constructor & Destructor Documentation

◆ Display() [1/2]

Display::Display ( )

Definition at line 38 of file Display.cc.

◆ Display() [2/2]

Display::Display ( Device *  p)

Definition at line 42 of file Display.cc.

◆ ~Display()

Display::~Display ( )
virtual

Definition at line 44 of file Display.cc.

Member Function Documentation

◆ bitBlit()

void Display::bitBlit ( rgb_t *  pBuffer,
size_t  fromX,
size_t  fromY,
size_t  toX,
size_t  toY,
size_t  width,
size_t  height 
)
virtual

Blits data from [fromX,fromY] to [toX,toY], with the given width and height.

Definition at line 72 of file Display.cc.

◆ dump()

void Display::dump ( String &  str)
virtual

Dumps a textual representation of the device into the given string.

Reimplemented from Device.

Reimplemented in VirtioGpu, and VmwareGraphics.

Definition at line 54 of file Display.cc.

◆ fillRectangle()

void Display::fillRectangle ( rgb_t *  pBuffer,
size_t  x,
size_t  y,
size_t  width,
size_t  height,
rgb_t  colour 
)
virtual

Fills the rectangle from [x,y] extending by [width,height] with the given colour.

Definition at line 75 of file Display.cc.

◆ getCurrentScreenMode()

bool Display::getCurrentScreenMode ( ScreenMode &  sm)
virtual

Returns the current screen mode.

Returns
True if operation succeeded, false otherwise.

Reimplemented in VmwareGraphics, and VirtioGpu.

Definition at line 82 of file Display.cc.

Referenced by FramebufferFile::command().

+ Here is the caller graph for this function:

◆ getFramebuffer()

void * Display::getFramebuffer ( )
virtual

Returns a pointer to a linear framebuffer. Returns 0 if none available.

Warning
Not intended to be used - use the buffer functions instead.

Reimplemented in VirtioGpu.

Definition at line 58 of file Display.cc.

◆ getName()

void Display::getName ( String &  str)
virtual

Stores the device's name in str.

Reimplemented from Device.

Reimplemented in VirtioGpu, and VmwareGraphics.

Definition at line 50 of file Display.cc.

◆ getPixelFormat()

bool Display::getPixelFormat ( PixelFormat &  pf)
virtual

Returns the format of each pixel in the framebuffer, along with the bits-per-pixel.

Returns
True if operation succeeded, false otherwise.

Reimplemented in VirtioGpu.

Definition at line 78 of file Display.cc.

◆ getScreenModes()

bool Display::getScreenModes ( List< ScreenMode * > &  sms)
virtual

Fills the given List with all of the available screen modes.

Returns
True if operation succeeded, false otherwise.

Reimplemented in VmwareGraphics, and VirtioGpu.

Definition at line 86 of file Display.cc.

Referenced by setScreenMode(), and setScreenMode().

+ Here is the caller graph for this function:

◆ getType()

Device::Type Display::getType ( )
virtual

Returns the (abstract) type of the device.

Reimplemented from Device.

Definition at line 46 of file Display.cc.

References Device::Display.

◆ killBuffer()

void Display::killBuffer ( rgb_t *  pBuffer)
virtual

If a buffer is no longer being used, it can be deleted using this function.

Definition at line 70 of file Display.cc.

◆ newBuffer()

Display::rgb_t * Display::newBuffer ( )
virtual

Returns a new back buffer. This is the primary method for drawing to the screen. The buffer returned is in RGB 24-bit format and is the width and height of the screen.

Definition at line 62 of file Display.cc.

◆ setCurrentBuffer()

void Display::setCurrentBuffer ( rgb_t *  pBuffer)
virtual

Sets the currently viewed buffer to pBuffer.

Definition at line 66 of file Display.cc.

◆ setScreenMode() [1/3]

bool Display::setScreenMode ( ScreenMode  sm)
virtual

Sets the current screen mode.

Returns
True if operation succeeded, false otherwise.

Reimplemented in VmwareGraphics, and VirtioGpu.

Definition at line 90 of file Display.cc.

Referenced by FramebufferFile::command(), panic(), VmwareGraphics::setScreenMode(), setScreenMode(), setScreenMode(), and Debugger::start().

+ Here is the caller graph for this function:

◆ setScreenMode() [2/3]

bool Display::setScreenMode ( size_t  modeId)
virtual

Sets the current screen mode using a set of well-defined VBE IDs. Example: 0x117 = 1024x768x16.

Reimplemented in VmwareGraphics, and VirtioGpu.

Definition at line 94 of file Display.cc.

References List< T, nodePoolSize >::begin(), List< T, nodePoolSize >::end(), getScreenModes(), and setScreenMode().

◆ setScreenMode() [3/3]

bool Display::setScreenMode ( size_t  nWidth,
size_t  nHeight,
size_t  nBpp 
)
virtual

Sets the current screen mode using a width, height, and pixel depth

Todo:
"Closest match": allow a threshold for a match in case the specific mode specified cannot be set.

Reimplemented in VmwareGraphics, and VirtioGpu.

Definition at line 114 of file Display.cc.

References List< T, nodePoolSize >::begin(), Dec, List< T, nodePoolSize >::end(), getScreenModes(), Hex, and setScreenMode().

◆ updateBuffer()

void Display::updateBuffer ( rgb_t *  pBuffer,
size_t  x1 = ~0UL,
size_t  y1 = ~0UL,
size_t  x2 = ~0UL,
size_t  y2 = ~0UL 
)
virtual

Updates the contents of pBuffer to the screen, or more specifically to video memory. If this buffer is not current (i.e. via a call to setCurrentBuffer) the screen content will obviously not change.

Optionally a rectangle can be provided - only this region will be updated.

Definition at line 68 of file Display.cc.


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