The Pedigree Project
0.1
|
Abstracts the system's framebuffer offering. More...
#include <Framebuffer.h>
Public Member Functions | |
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) |
size_t | getWidth () const |
size_t | getHeight () const |
Graphics::PixelFormat | getFormat () const |
bool | getActive () const |
void | setActive (bool b) |
void | setPalette (uint32_t *palette, size_t nEntries) |
uint32_t * | getPalette () const |
virtual void * | getRawBuffer () const |
virtual Graphics::Buffer * | createBuffer (const void *srcData, Graphics::PixelFormat srcFormat, size_t width, size_t height, uint32_t *pPalette=0) |
virtual void | destroyBuffer (Graphics::Buffer *pBuffer) |
void | redraw (size_t x=~0UL, size_t y=~0UL, size_t w=~0UL, size_t h=~0UL, bool bChild=false) |
virtual void | blit (Graphics::Buffer *pBuffer, size_t srcx, size_t srcy, size_t destx, size_t desty, size_t width, size_t height, bool bLowestCall=true) |
virtual void | draw (void *pBuffer, size_t srcx, size_t srcy, size_t destx, size_t desty, size_t width, size_t height, Graphics::PixelFormat format=Graphics::Bits32_Argb, bool bLowestCall=true) |
virtual void | rect (size_t x, size_t y, size_t width, size_t height, uint32_t colour, Graphics::PixelFormat format=Graphics::Bits32_Argb, bool bLowestCall=true) |
virtual void | copy (size_t srcx, size_t srcy, size_t destx, size_t desty, size_t w, size_t h, bool bLowestCall=true) |
virtual void | line (size_t x1, size_t y1, size_t x2, size_t y2, uint32_t colour, Graphics::PixelFormat format=Graphics::Bits32_Argb, bool bLowestCall=true) |
void | setPixel (size_t x, size_t y, uint32_t colour, Graphics::PixelFormat format=Graphics::Bits32_Argb, bool bLowestCall=true) |
void | setXPos (size_t x) |
void | setYPos (size_t y) |
void | setWidth (size_t w) |
void | setHeight (size_t h) |
void | setFormat (Graphics::PixelFormat pf) |
void | setBytesPerPixel (size_t b) |
uint32_t | getBytesPerPixel () const |
void | setBytesPerLine (size_t b) |
uint32_t | getBytesPerLine () const |
void | setParent (Framebuffer *p) |
Framebuffer * | getParent () const |
virtual void | setFramebuffer (uintptr_t p) |
bool | initialise () |
void | storeMode () |
void | restoreMode () |
int | enterMode (size_t desiredW, size_t desiredH, size_t desiredBpp) |
void * | getFramebuffer () const |
void | flush (size_t x, size_t y, size_t w, size_t h) |
cairo_format_t | getFormat () const |
size_t | getWidth () const |
size_t | getHeight () const |
Public Member Functions inherited from Display | |
Display (Device *p) | |
virtual Type | getType () |
virtual void | getName (String &str) |
virtual void | dump (String &str) |
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 | 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 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) |
Public Attributes | |
size_t | m_XPos |
X position on our parent's framebuffer. More... | |
size_t | m_YPos |
Y position on our parent's framebuffer. | |
size_t | m_nWidth |
Width of the framebuffer in pixels. | |
size_t | m_nHeight |
Height of the framebuffer in pixels. | |
Graphics::PixelFormat | m_PixelFormat |
Framebuffer pixel format. | |
size_t | m_nBytesPerPixel |
Bytes per pixel in this framebuffer. | |
size_t | m_nBytesPerLine |
Bytes per line in this framebuffer. | |
Framebuffer * | m_pParent |
Parent of this framebuffer. | |
Public Attributes inherited from Display | |
struct Display::rgb_t | PACKED |
Protected Member Functions | |
Graphics::Buffer | bufferFromSelf () |
virtual void | draw (Graphics::Buffer *pBuffer, size_t srcx, size_t srcy, size_t destx, size_t desty, size_t width, size_t height, bool bLowestCall=true) |
void | swBlit (Graphics::Buffer *pBuffer, size_t srcx, size_t srcy, size_t destx, size_t desty, size_t width, size_t height) |
void | swRect (size_t x, size_t y, size_t width, size_t height, uint32_t colour, Graphics::PixelFormat format) |
void | swCopy (size_t srcx, size_t srcy, size_t destx, size_t desty, size_t w, size_t h) |
void | swLine (size_t x1, size_t y1, size_t x2, size_t y2, uint32_t colour, Graphics::PixelFormat format) |
void | swDraw (void *pBuffer, size_t srcx, size_t srcy, size_t destx, size_t desty, size_t width, size_t height, Graphics::PixelFormat format=Graphics::Bits32_Argb, bool bLowestCall=true) |
void | swDraw (Graphics::Buffer *pBuffer, size_t srcx, size_t srcy, size_t destx, size_t desty, size_t width, size_t height, bool bLowestCall=true) |
Graphics::Buffer * | swCreateBuffer (const void *srcData, Graphics::PixelFormat srcFormat, size_t width, size_t height, uint32_t *pPalette) |
void | swDestroyBuffer (Graphics::Buffer *pBuffer) |
virtual void | hwRedraw (size_t x=~0UL, size_t y=~0UL, size_t w=~0UL, size_t h=~0UL) |
Inherited by drivers that provide a hardware redraw function. | |
Protected Member Functions inherited from Device | |
NOT_COPYABLE_OR_ASSIGNABLE (Device) | |
Protected Attributes | |
uintptr_t | m_FramebufferBase |
uint32_t * | m_Palette |
Current graphics palette - an array of 256 32-bit RGBA entries. | |
bool | m_bActive |
Whether this framebuffer is active or not. | |
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 |
Private Member Functions | |
void | swSetPixel (size_t x, size_t y, uint32_t colour, Graphics::PixelFormat format=Graphics::Bits32_Argb) |
Private Attributes | |
Display::ScreenMode | m_Mode |
void * | m_pFramebuffer |
size_t | m_FramebufferSize |
cairo_format_t | m_Format |
size_t | m_Width |
size_t | m_Height |
int | m_Fb |
bool | m_bStoredMode |
pedigree_fb_mode | m_StoredMode |
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) |
Static Protected Member Functions inherited from Device | |
static Device & | root () |
Static Protected Attributes inherited from Device | |
static Device | m_Root |
static Mutex | m_TreeLock |
Abstracts the system's framebuffer offering.
This class is a wrapper around the standard PPC Vga driver, to provide access to it as a device tree node.
This class provides a generic interface for interfacing with a framebuffer. Each display driver specialises this class to define the "base address" of the framebuffer in its own way (eg, allocate memory, or use a DMA region). There are a variety of default software-only operations, which are used by default if the main operational methods are not overridden.
This is needed to abstract out the Pedigree-specific framebuffer parts so the window manager can be run under SDL on Linux for rapid development.
Definition at line 29 of file modules/drivers/ppc/framebuffer/Framebuffer.h.
|
virtual |
Blits a given buffer to the screen. See createBuffer.
bLowestCall | whether this is the lowest level call for the chain or a call being passed up from a child somewhere in the chain. |
Definition at line 156 of file Framebuffer.cc.
|
virtual |
Copies a rectangle already on the framebuffer to a new location
Reimplemented in VmwareGraphics::VmwareFramebuffer.
Definition at line 190 of file Framebuffer.cc.
|
virtual |
Creates a new buffer to be used for blits from the given raw pixel data. Performs automatic conversion of the pixel format to the pixel format of the current display mode. Do not modify any of the members of the buffer structure, or attempt to inject your own pixels into the buffer. Once a buffer is created, it is only used for blitting to the screen and cannot be modified. It is expected that the buffer has been packed to its bit depth, and does not have any padding on each scanline at all. Do not delete the returned buffer yourself, pass it to destroyBuffer which performs a proper cleanup of all resources related to the buffer. The buffer should be padded to finish on a DWORD boundary. This is not padding per scanline but rather padding per buffer.
Definition at line 94 of file Framebuffer.cc.
Referenced by StreamingScreenLogger::callback().
|
virtual |
Destroys a created buffer. Frees its memory in both the system RAM and any references still in VRAM.
Definition at line 104 of file Framebuffer.cc.
Referenced by StreamingScreenLogger::callback().
|
virtual |
Draws given raw pixel data to the screen. Used for framebuffer chains and applications which need to render constantly changing pixel buffers.
Definition at line 168 of file Framebuffer.cc.
Referenced by StreamingScreenLogger::callback().
|
protectedvirtual |
Special implementation of draw() where a Graphics::Buffer is already available. For use in redraw, and similar.
Definition at line 297 of file Framebuffer.cc.
int Framebuffer::enterMode | ( | size_t | desiredW, |
size_t | desiredH, | ||
size_t | desiredBpp | ||
) |
void Framebuffer::flush | ( | size_t | x, |
size_t | y, | ||
size_t | w, | ||
size_t | h | ||
) |
Flush framebuffer in the given region.
Definition at line 186 of file fb.cc.
Referenced by getFramebuffer().
|
virtual |
Returns the current screen mode.
Reimplemented from Display.
|
inline |
Get framebuffer colour format.
Definition at line 65 of file pedigree_fb.h.
|
virtual |
Returns a pointer to a linear framebuffer. Returns 0 if none available.
Reimplemented from Display.
Referenced by VbeDisplay::fillRectangle(), and VbeDisplay::newBuffer().
|
inline |
Retrieve base address of the framebuffer.
Definition at line 56 of file pedigree_fb.h.
References flush().
|
virtual |
Gets a raw pointer to the framebuffer itself. There is no way to know if this pointer points to an MMIO region or real RAM, so it cannot be guaranteed to be safe.
Definition at line 87 of file Framebuffer.cc.
|
virtual |
|
inline |
Get framebuffer dimensions.
Definition at line 71 of file pedigree_fb.h.
bool Framebuffer::initialise | ( | ) |
General system-specific initialisation.
Definition at line 56 of file fb.cc.
References File::open().
|
virtual |
Draws a line one pixel wide between two points on the screen
Definition at line 202 of file Framebuffer.cc.
|
virtual |
Draws a single rectangle to the screen with the given colour.
Definition at line 179 of file Framebuffer.cc.
Referenced by StreamingScreenLogger::callback().
void Framebuffer::redraw | ( | size_t | x = ~0UL , |
size_t | y = ~0UL , |
||
size_t | w = ~0UL , |
||
size_t | h = ~0UL , |
||
bool | bChild = false |
||
) |
Performs an update of a region of this framebuffer. This function can be used by drivers to request an area of the framebuffer be redrawn, but is useless for non-hardware-accelerated devices.
x | leftmost x co-ordinate of the redraw area, ~0 for "invalid" |
y | topmost y co-ordinate of the redraw area, ~0 for "invalid" |
w | width of the redraw area, ~0 for "invalid" |
h | height of the redraw area, ~0 for "invalid" |
bChild | non-zero if a child began the redraw, zero otherwise |
Definition at line 112 of file Framebuffer.cc.
References ERROR.
Referenced by StreamingScreenLogger::callback(), and FramebufferFile::command().
void Framebuffer::setPalette | ( | uint32_t * | palette, |
size_t | nEntries | ||
) |
Sets the palette used for palette-based colour formats. Takes an array of pixels in Bits32_Argb format.
Definition at line 71 of file Framebuffer.cc.
void Framebuffer::setPixel | ( | size_t | x, |
size_t | y, | ||
uint32_t | colour, | ||
Graphics::PixelFormat | format = Graphics::Bits32_Argb , |
||
bool | bLowestCall = true |
||
) |
Sets an individual pixel on the framebuffer. Not inheritable.
Definition at line 214 of file Framebuffer.cc.
References Graphics::Buffer::base, Graphics::Buffer::bufferId, Graphics::Buffer::bytesPerPixel, Graphics::Buffer::format, Graphics::Buffer::height, Graphics::Buffer::pBacking, and Graphics::Buffer::width.
|
virtual |
Sets the current screen mode.
Reimplemented from Display.
Referenced by VbeDisplay::setScreenMode().
void Framebuffer::storeMode | ( | ) |
|
protected |
Definition at line 436 of file Framebuffer.cc.
References Graphics::Buffer::base, Graphics::Buffer::bytesPerPixel, Graphics::Buffer::height, UNLIKELY, and Graphics::Buffer::width.
|
protected |
Definition at line 646 of file Framebuffer.cc.
References UNLIKELY.
|
protected |
Definition at line 304 of file Framebuffer.cc.
References PhysicalMemoryManager::allocateRegion(), Graphics::Buffer::base, Graphics::Buffer::bufferId, Graphics::Buffer::bytesPerPixel, Graphics::Buffer::format, Graphics::Buffer::height, PhysicalMemoryManager::instance(), Graphics::Buffer::pBacking, UNLIKELY, MemoryRegion::virtualAddress(), Graphics::Buffer::width, and VirtualAddressSpace::Write.
|
protected |
Definition at line 502 of file Framebuffer.cc.
References UNLIKELY.
|
private |
Sets an individual pixel on the framebuffer. Not inheritable.
Definition at line 804 of file Framebuffer.cc.
References UNLIKELY.
|
private |
Copy constructor is private. Current mode.
Definition at line 50 of file modules/drivers/ppc/framebuffer/Framebuffer.h.
size_t Framebuffer::m_XPos |
X position on our parent's framebuffer.
Class friendship isn't inheritable, so these have to be public for graphics drivers to use. They shouldn't be touched by anything that isn't a graphics driver.
Definition at line 144 of file system/include/pedigree/kernel/machine/Framebuffer.h.