The Pedigree Project 0.1
Classes | Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
VirtioGpu Class Referencefinal
+ Inheritance diagram for VirtioGpu:
+ Collaboration diagram for VirtioGpu:

Classes

class  GpuFramebuffer
 

Public Member Functions

 VirtioGpu (Device *pci)
 
bool initialise ()
 
void shutdown ()
 
void redraw (size_t x, size_t y, size_t width, size_t height)
 
void getName (String &name) override
 
void dump (String &description) override
 
void * getFramebuffer () override
 
bool getPixelFormat (PixelFormat &format) override
 
bool getCurrentScreenMode (ScreenMode &mode) override
 
bool getScreenModes (List< ScreenMode * > &modes) override
 
bool setScreenMode (ScreenMode mode) override
 
bool setScreenMode (size_t modeId) override
 
bool setScreenMode (size_t width, size_t height, size_t bpp) override
 
- Public Member Functions inherited from Display
 Display (Device *p)
 
virtual Type getType ()
 
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)
 
- 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 ()
 
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)
 

Private Member Functions

bool transact (const void *request, size_t requestLength, uint32_t expectedResponse, void *response, size_t responseLength)
 
bool update (size_t x, size_t y, size_t width, size_t height)
 
bool registerProvider ()
 
void unregisterProvider ()
 

Static Private Member Functions

static int refreshThread (void *context)
 

Private Attributes

Device * m_Pci
 
Virtio::PciTransport m_Transport
 
Virtio::Queue m_ControlQueue
 
MemoryRegion m_Commands
 
MemoryRegion m_Backing
 
MemoryRegion m_Pixels
 
Mutex m_CommandLock
 
GpuFramebuffer * m_Framebuffer
 
GraphicsService::GraphicsProvider * m_Provider
 
Thread * m_RefreshThread
 
ScreenMode m_Mode
 
uint64_t m_NextFence
 
uint32_t m_Scanout
 
bool m_Ready
 
bool m_Failed
 
bool m_Registered
 
bool m_Shutdown
 
bool m_Stopping
 

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 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)
 
- Public Attributes inherited from Display
struct Display::rgb_t PACKED
 
- 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
 
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

Definition at line 17 of file VirtioGpu.h.

Constructor & Destructor Documentation

◆ VirtioGpu()

VirtioGpu::VirtioGpu ( Device *  pci)
explicit

Definition at line 141 of file VirtioGpu.cc.

◆ ~VirtioGpu()

VirtioGpu::~VirtioGpu ( )
override

Definition at line 164 of file VirtioGpu.cc.

Member Function Documentation

◆ dump()

void VirtioGpu::dump ( String &  str)
overridevirtual

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

Reimplemented from Display.

Definition at line 507 of file VirtioGpu.cc.

◆ getCurrentScreenMode()

bool VirtioGpu::getCurrentScreenMode ( ScreenMode &  sm)
overridevirtual

Returns the current screen mode.

Returns
True if operation succeeded, false otherwise.

Reimplemented from Display.

Definition at line 520 of file VirtioGpu.cc.

◆ getFramebuffer()

void * VirtioGpu::getFramebuffer ( )
overridevirtual

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

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

Reimplemented from Display.

Definition at line 511 of file VirtioGpu.cc.

References MemoryRegion::virtualAddress().

◆ getName()

void VirtioGpu::getName ( String &  str)
overridevirtual

Stores the device's name in str.

Reimplemented from Display.

Definition at line 503 of file VirtioGpu.cc.

◆ getPixelFormat()

bool VirtioGpu::getPixelFormat ( PixelFormat &  pf)
overridevirtual

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

Returns
True if operation succeeded, false otherwise.

Reimplemented from Display.

Definition at line 515 of file VirtioGpu.cc.

◆ getScreenModes()

bool VirtioGpu::getScreenModes ( List< ScreenMode * > &  sms)
overridevirtual

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

Returns
True if operation succeeded, false otherwise.

Reimplemented from Display.

Definition at line 525 of file VirtioGpu.cc.

References List< T, nodePoolSize >::pushBack().

◆ initialise()

bool VirtioGpu::initialise ( )

Definition at line 237 of file VirtioGpu.cc.

◆ redraw()

void VirtioGpu::redraw ( size_t  x,
size_t  y,
size_t  width,
size_t  height 
)

Definition at line 420 of file VirtioGpu.cc.

◆ refreshThread()

int VirtioGpu::refreshThread ( void *  context)
staticprivate

Definition at line 434 of file VirtioGpu.cc.

◆ registerProvider()

bool VirtioGpu::registerProvider ( )
private

Definition at line 447 of file VirtioGpu.cc.

◆ setScreenMode() [1/3]

bool VirtioGpu::setScreenMode ( ScreenMode  sm)
overridevirtual

Sets the current screen mode.

Returns
True if operation succeeded, false otherwise.

Reimplemented from Display.

Definition at line 537 of file VirtioGpu.cc.

References Display::PixelFormat::nBpp.

◆ setScreenMode() [2/3]

bool VirtioGpu::setScreenMode ( size_t  modeId)
overridevirtual

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

Reimplemented from Display.

Definition at line 542 of file VirtioGpu.cc.

◆ setScreenMode() [3/3]

bool VirtioGpu::setScreenMode ( size_t  nWidth,
size_t  nHeight,
size_t  nBpp 
)
overridevirtual

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

Definition at line 547 of file VirtioGpu.cc.

◆ shutdown()

void VirtioGpu::shutdown ( )

Definition at line 473 of file VirtioGpu.cc.

◆ transact()

bool VirtioGpu::transact ( const void *  request,
size_t  requestLength,
uint32_t  expectedResponse,
void *  response,
size_t  responseLength 
)
private

Definition at line 168 of file VirtioGpu.cc.

◆ unregisterProvider()

void VirtioGpu::unregisterProvider ( )
private

Definition at line 462 of file VirtioGpu.cc.

◆ update()

bool VirtioGpu::update ( size_t  x,
size_t  y,
size_t  width,
size_t  height 
)
private

Definition at line 400 of file VirtioGpu.cc.

Member Data Documentation

◆ m_Backing

MemoryRegion VirtioGpu::m_Backing
private

Definition at line 63 of file VirtioGpu.h.

◆ m_CommandLock

Mutex VirtioGpu::m_CommandLock
private

Definition at line 65 of file VirtioGpu.h.

◆ m_Commands

MemoryRegion VirtioGpu::m_Commands
private

Definition at line 62 of file VirtioGpu.h.

◆ m_ControlQueue

Virtio::Queue VirtioGpu::m_ControlQueue
private

Definition at line 61 of file VirtioGpu.h.

◆ m_Failed

bool VirtioGpu::m_Failed
private

Definition at line 73 of file VirtioGpu.h.

◆ m_Framebuffer

GpuFramebuffer* VirtioGpu::m_Framebuffer
private

Definition at line 66 of file VirtioGpu.h.

◆ m_Mode

ScreenMode VirtioGpu::m_Mode
private

Definition at line 69 of file VirtioGpu.h.

◆ m_NextFence

uint64_t VirtioGpu::m_NextFence
private

Definition at line 70 of file VirtioGpu.h.

◆ m_Pci

Device* VirtioGpu::m_Pci
private

Definition at line 59 of file VirtioGpu.h.

◆ m_Pixels

MemoryRegion VirtioGpu::m_Pixels
private

Definition at line 64 of file VirtioGpu.h.

◆ m_Provider

GraphicsService::GraphicsProvider* VirtioGpu::m_Provider
private

Definition at line 67 of file VirtioGpu.h.

◆ m_Ready

bool VirtioGpu::m_Ready
private

Definition at line 72 of file VirtioGpu.h.

◆ m_RefreshThread

Thread* VirtioGpu::m_RefreshThread
private

Definition at line 68 of file VirtioGpu.h.

◆ m_Registered

bool VirtioGpu::m_Registered
private

Definition at line 74 of file VirtioGpu.h.

◆ m_Scanout

uint32_t VirtioGpu::m_Scanout
private

Definition at line 71 of file VirtioGpu.h.

◆ m_Shutdown

bool VirtioGpu::m_Shutdown
private

Definition at line 75 of file VirtioGpu.h.

◆ m_Stopping

bool VirtioGpu::m_Stopping
private

Definition at line 76 of file VirtioGpu.h.

◆ m_Transport

Virtio::PciTransport VirtioGpu::m_Transport
private

Definition at line 60 of file VirtioGpu.h.


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