The Pedigree Project  0.1
Classes | Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
VbeDisplay Class Reference
+ Inheritance diagram for VbeDisplay:
+ Collaboration diagram for VbeDisplay:

Classes

struct  Buffer
 

Public Types

enum  VbeVersion { Vbe1_2, Vbe2_0, Vbe3_0 }
 
- Public Types inherited from Device
enum  Type {
  Generic, Root, Disk, Bus,
  Display, Network, Sound, Console,
  Mouse, Controller, UsbController, UsbGeneric,
  UsbContainer
}
 
typedef Device *(* Callback) (Device *)
 

Public Member Functions

 VbeDisplay (Device *p, VbeVersion version, List< Display::ScreenMode * > &sms, size_t vidMemSz, size_t displayNum)
 
virtual void * getFramebuffer ()
 
virtual bool getPixelFormat (Display::PixelFormat &pPf)
 
virtual bool getCurrentScreenMode (Display::ScreenMode &sm)
 
virtual bool getScreenModes (List< Display::ScreenMode * > &sms)
 
virtual bool setScreenMode (Display::ScreenMode sm)
 
virtual bool setScreenMode (size_t modeId)
 
virtual bool setScreenMode (size_t nWidth, size_t nHeight, size_t nBpp)
 
virtual rgb_tnewBuffer ()
 
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)
 
size_t getModeId ()
 
virtual void setLogicalFramebuffer (Framebuffer *p)
 
- Public Member Functions inherited from Display
 Display (Device *p)
 
virtual Type getType ()
 
virtual void getName (String &str)
 
virtual void dump (String &str)
 
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)
 
DevicegetParent () const
 
void setParent (Device *p)
 
virtual 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)
 
DevicegetChild (size_t n)
 
size_t getNumChildren ()
 
void removeChild (size_t n)
 
void removeChild (Device *d)
 
void replaceChild (Device *src, Device *dest)
 

Private Types

enum  ModeType { Mode_16bpp_5r6g5b, Mode_24bpp_8r8g8b, Mode_Generic }
 

Private Member Functions

 VbeDisplay (const VbeDisplay &)
 
VbeDisplayoperator= (const VbeDisplay &)
 
void packColour (rgb_t colour, size_t idx, uintptr_t pFb)
 

Private Attributes

VbeVersion m_VbeVersion
 
List< Display::ScreenMode * > m_ModeList
 
Display::ScreenMode m_Mode
 
MemoryMappedIom_pFramebuffer
 
Framebufferm_pLogicalFramebuffer
 
Device::Addressm_pFramebufferRawAddress
 
Tree< rgb_t *, Buffer * > m_Buffers
 
ModeType m_SpecialisedMode
 
MemoryAllocator m_Allocator
 

Additional Inherited Members

- 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 Deviceroot ()
 
- Protected Attributes inherited from Device
Vector< Address * > m_Addresses
 
Vector< Device * > m_Children
 
Devicem_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 35 of file VbeDisplay.h.

Member Enumeration Documentation

enum VbeDisplay::ModeType
private

Possible display modes that we have specialised code for.

Definition at line 109 of file VbeDisplay.h.

VBE versions, in order.

Definition at line 39 of file VbeDisplay.h.

Constructor & Destructor Documentation

VbeDisplay::VbeDisplay ( const VbeDisplay )
private

Copy constructor is private.

Member Function Documentation

void VbeDisplay::fillRectangle ( rgb_t pBuffer,
size_t  x,
size_t  y,
size_t  width,
size_t  height,
rgb_t  colour 
)
virtual
Todo:
This needs to properly handle the case where there's more than one byte per pixel? (or less, I guess)

Definition at line 496 of file VbeDisplay.cc.

References ERROR, Framebuffer::getFramebuffer(), Display::PixelFormat::mBlue, Display::PixelFormat::mGreen, Display::PixelFormat::mRed, Display::PixelFormat::nBpp, Display::PixelFormat::pBlue, Display::PixelFormat::pGreen, Display::PixelFormat::pRed, and WARNING.

Referenced by setScreenMode().

+ Here is the caller graph for this function:

bool VbeDisplay::getCurrentScreenMode ( Display::ScreenMode sm)
virtual

Returns the current screen mode.

Returns
True if operation succeeded, false otherwise.

Reimplemented from Display.

Definition at line 129 of file VbeDisplay.cc.

void * VbeDisplay::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 from Display.

Definition at line 118 of file VbeDisplay.cc.

bool VbeDisplay::getPixelFormat ( Display::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 from Display.

Definition at line 123 of file VbeDisplay.cc.

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

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

Returns
True if operation succeeded, false otherwise.

Reimplemented from Display.

Definition at line 135 of file VbeDisplay.cc.

VbeDisplay::rgb_t * VbeDisplay::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.

Reimplemented from Display.

Definition at line 254 of file VbeDisplay.cc.

References ERROR, Framebuffer::getFramebuffer(), PhysicalMemoryManager::getPageSize(), PhysicalMemoryManager::instance(), Display::PixelFormat::nBpp, Display::PixelFormat::nPitch, MemoryRegion::virtualAddress(), and VirtualAddressSpace::Write.

Referenced by setScreenMode().

+ Here is the caller graph for this function:

bool VbeDisplay::setScreenMode ( Display::ScreenMode  sm)
virtual
bool VbeDisplay::setScreenMode ( size_t  modeId)
virtual

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

Reimplemented from Display.

Definition at line 141 of file VbeDisplay.cc.

References List< T, nodePoolSize >::begin(), ERROR, and Framebuffer::setScreenMode().

virtual bool VbeDisplay::setScreenMode ( size_t  nWidth,
size_t  nHeight,
size_t  nBpp 
)
inlinevirtual

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 59 of file VbeDisplay.h.

References fillRectangle(), m_Mode, newBuffer(), and Display::setScreenMode().

Member Data Documentation

MemoryAllocator VbeDisplay::m_Allocator
private

Memory allocator for video memory.

Definition at line 141 of file VbeDisplay.h.

Tree<rgb_t *, Buffer *> VbeDisplay::m_Buffers
private

Buffers.

Definition at line 135 of file VbeDisplay.h.

Display::ScreenMode VbeDisplay::m_Mode
private

Current mode.

Definition at line 101 of file VbeDisplay.h.

Referenced by setScreenMode().

List<Display::ScreenMode *> VbeDisplay::m_ModeList
private

Screen modes.

Definition at line 98 of file VbeDisplay.h.

ModeType VbeDisplay::m_SpecialisedMode
private

Mode.

Definition at line 138 of file VbeDisplay.h.

VbeVersion VbeDisplay::m_VbeVersion
private

VBE version.

Definition at line 95 of file VbeDisplay.h.


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