|
The Pedigree Project 0.1
|
#include <Framebuffer.h>
Inheritance diagram for Framebuffer:
Collaboration diagram for Framebuffer:Classes | |
| class | FrameGuard |
Public Member Functions | |
| 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 physical_uintptr_t | getPhysicalPage (size_t offset) const |
| size_t | getMappingFlags () const |
| void | setMappingFlags (size_t flags) |
| 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 () |
| bool | claimTerminal () |
| bool | takeRedraw () |
| void | storeMode () |
| void | restoreMode () |
| int | enterMode (size_t desiredW, size_t desiredH, size_t desiredBpp) |
| int | useCurrentMode () |
| 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 |
| size_t | getBytesPerLine () const |
Public Attributes | |
| size_t | m_XPos |
| X position on our parent's framebuffer. | |
| 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. | |
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 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. | |
Private Member Functions | |
| void | swSetPixel (size_t x, size_t y, uint32_t colour, Graphics::PixelFormat format=Graphics::Bits32_Argb) |
| int | mapMode (const pedigree_fb_mode &mode) |
| void | releaseTerminal () |
Static Private Member Functions | |
| static void | terminalSignal (int signal) |
Private Attributes | |
| size_t | m_MappingFlags = 0 |
| void * | m_pFramebuffer |
| size_t | m_FramebufferSize |
| cairo_format_t | m_Format |
| size_t | m_Width |
| size_t | m_Height |
| size_t | m_BytesPerLine |
| int | m_Fb |
| bool | m_bStoredMode |
| pedigree_fb_mode | m_StoredMode |
| int | m_Terminal = -1 |
| volatile sig_atomic_t | m_TerminalActive = 1 |
| volatile sig_atomic_t | m_TerminalRedraw = 0 |
| int | m_PreviousDisplayMode = 0 |
| vt_mode | m_PreviousTerminalMode = {} |
| struct sigaction | m_PreviousReleaseAction = {} |
| struct sigaction | m_PreviousAcquireAction = {} |
| sigset_t | m_PreviousTerminalMask |
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. The drawing and palette entry points are retained for external display-driver ABI compatibility, even where there are no in-tree callers. Preserve their signatures and virtual method order.
Abstracts the system's framebuffer offering.
Definition at line 35 of file Framebuffer.h.
| Framebuffer::Framebuffer | ( | ) |
Definition at line 27 of file Framebuffer.cc.
|
virtual |
Definition at line 39 of file Framebuffer.cc.
|
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 134 of file Framebuffer.cc.
References blit(), m_pParent, m_XPos, m_YPos, and swBlit().
Referenced by blit().
Here is the caller graph for this function:
|
protected |
Definition at line 231 of file Framebuffer.cc.
| bool Framebuffer::claimTerminal | ( | ) |
|
virtual |
Copies a rectangle already on the framebuffer to a new location
Reimplemented in VmwareGraphics::VmwareFramebuffer.
Definition at line 159 of file Framebuffer.cc.
References copy(), m_pParent, m_XPos, m_YPos, and swCopy().
Referenced by copy().
Here is the caller graph for this function:
|
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 83 of file Framebuffer.cc.
References createBuffer(), m_pParent, and swCreateBuffer().
Referenced by createBuffer().
Here is the caller graph for this function:
|
virtual |
Destroys a created buffer. Frees its memory in both the system RAM and any references still in VRAM.
Definition at line 90 of file Framebuffer.cc.
|
protectedvirtual |
Special implementation of draw() where a Graphics::Buffer is already available. For use in redraw, and similar.
Definition at line 243 of file Framebuffer.cc.
|
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 142 of file Framebuffer.cc.
Referenced by redraw().
Here is the caller graph for this function:| 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 | ||
| ) |
| bool Framebuffer::getActive | ( | ) | const |
Definition at line 53 of file Framebuffer.cc.
| uint32_t Framebuffer::getBytesPerLine | ( | ) | const |
Definition at line 215 of file Framebuffer.cc.
|
inline |
Definition at line 93 of file pedigree_fb.h.
| uint32_t Framebuffer::getBytesPerPixel | ( | ) | const |
Definition at line 207 of file Framebuffer.cc.
| Graphics::PixelFormat Framebuffer::getFormat | ( | ) | const |
Definition at line 49 of file Framebuffer.cc.
|
inline |
Get framebuffer colour format.
Definition at line 82 of file pedigree_fb.h.
|
inline |
Retrieve base address of the framebuffer.
Definition at line 74 of file pedigree_fb.h.
| size_t Framebuffer::getHeight | ( | ) | const |
Definition at line 45 of file Framebuffer.cc.
|
inline |
Definition at line 90 of file pedigree_fb.h.
|
inline |
Definition at line 65 of file Framebuffer.h.
| uint32_t * Framebuffer::getPalette | ( | ) | const |
Definition at line 69 of file Framebuffer.cc.
| Framebuffer * Framebuffer::getParent | ( | ) | const |
Definition at line 223 of file Framebuffer.cc.
|
virtual |
Gets the physical page backing an offset in the framebuffer. This is used by direct framebuffer mappings such as /dev/fb. Providers backed only by a virtual buffer should retain the default failure.
Reimplemented in VirtioGpu::GpuFramebuffer.
Definition at line 79 of file Framebuffer.cc.
Referenced by FramebufferFile::getPhysicalPage().
Here is the caller graph for this function:
|
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 73 of file Framebuffer.cc.
References getRawBuffer(), and m_pParent.
Referenced by getRawBuffer(), and FramebufferFile::readBlock().
Here is the caller graph for this function:| size_t Framebuffer::getWidth | ( | ) | const |
Definition at line 41 of file Framebuffer.cc.
|
inline |
Get framebuffer dimensions.
Definition at line 87 of file pedigree_fb.h.
|
protectedvirtual |
Inherited by drivers that provide a hardware redraw function.
Reimplemented in VirtioGpu::GpuFramebuffer, and VmwareGraphics::VmwareFramebuffer.
Definition at line 704 of file Framebuffer.cc.
Referenced by redraw().
Here is the caller graph for this function:| bool Framebuffer::initialise | ( | ) |
|
virtual |
|
private |
|
virtual |
| 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 97 of file Framebuffer.cc.
References draw(), hwRedraw(), m_PixelFormat, m_pParent, m_XPos, m_YPos, and redraw().
Referenced by FramebufferFile::command(), X86Vga::moveCursor(), redraw(), and takeRedraw().
Here is the caller graph for this function:| void Framebuffer::setActive | ( | bool | b | ) |
Definition at line 57 of file Framebuffer.cc.
| void Framebuffer::setBytesPerLine | ( | size_t | b | ) |
Definition at line 211 of file Framebuffer.cc.
| void Framebuffer::setBytesPerPixel | ( | size_t | b | ) |
Definition at line 203 of file Framebuffer.cc.
| void Framebuffer::setFormat | ( | Graphics::PixelFormat | pf | ) |
Definition at line 199 of file Framebuffer.cc.
|
virtual |
Definition at line 227 of file Framebuffer.cc.
| void Framebuffer::setHeight | ( | size_t | h | ) |
Definition at line 195 of file Framebuffer.cc.
|
inline |
Definition at line 68 of file Framebuffer.h.
| 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 61 of file Framebuffer.cc.
References Dec, Hex, and m_Palette.
Referenced by FramebufferFile::command().
Here is the caller graph for this function:| void Framebuffer::setParent | ( | Framebuffer * | p | ) |
Definition at line 219 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 175 of file Framebuffer.cc.
References m_pParent, m_XPos, m_YPos, setPixel(), and swSetPixel().
Referenced by setPixel().
Here is the caller graph for this function:| void Framebuffer::setWidth | ( | size_t | w | ) |
Definition at line 191 of file Framebuffer.cc.
| void Framebuffer::setXPos | ( | size_t | x | ) |
Definition at line 183 of file Framebuffer.cc.
| void Framebuffer::setYPos | ( | size_t | y | ) |
Definition at line 187 of file Framebuffer.cc.
| void Framebuffer::storeMode | ( | ) |
|
protected |
Definition at line 351 of file Framebuffer.cc.
References Graphics::Buffer::base, Graphics::Buffer::bytesPerPixel, Graphics::Buffer::height, m_nBytesPerLine, m_nBytesPerPixel, m_nHeight, m_nWidth, UNLIKELY, and Graphics::Buffer::width.
Referenced by blit().
Here is the caller graph for this function:
|
protected |
Definition at line 518 of file Framebuffer.cc.
References m_nBytesPerLine, m_nBytesPerPixel, m_nHeight, m_nWidth, and UNLIKELY.
Referenced by copy().
Here is the caller graph for this function:
|
protected |
Definition at line 248 of file Framebuffer.cc.
References PhysicalMemoryManager::allocateRegion(), Graphics::Buffer::base, Graphics::Buffer::bufferId, Graphics::Buffer::bytesPerPixel, Graphics::Buffer::format, PhysicalMemoryManager::getPageSize(), Graphics::Buffer::height, PhysicalMemoryManager::instance(), m_nBytesPerPixel, m_PixelFormat, Graphics::Buffer::pBacking, UNLIKELY, MemoryRegion::virtualAddress(), Graphics::Buffer::width, and VirtualAddressSpace::Write.
Referenced by createBuffer().
Here is the caller graph for this function:
|
protected |
Definition at line 341 of file Framebuffer.cc.
|
protected |
Definition at line 699 of file Framebuffer.cc.
|
protected |
Definition at line 686 of file Framebuffer.cc.
|
protected |
Definition at line 572 of file Framebuffer.cc.
|
protected |
Definition at line 409 of file Framebuffer.cc.
References m_nBytesPerLine, m_nBytesPerPixel, m_nHeight, m_nWidth, m_Palette, m_PixelFormat, and UNLIKELY.
Referenced by rect().
Here is the caller graph for this function:
|
private |
Sets an individual pixel on the framebuffer. Not inheritable.
Definition at line 650 of file Framebuffer.cc.
References m_nBytesPerLine, m_nBytesPerPixel, m_nHeight, m_nWidth, m_Palette, m_PixelFormat, and UNLIKELY.
Referenced by setPixel().
Here is the caller graph for this function:| bool Framebuffer::takeRedraw | ( | ) |
| int Framebuffer::useCurrentMode | ( | ) |
|
protected |
Whether this framebuffer is active or not.
Definition at line 196 of file Framebuffer.h.
|
private |
Definition at line 113 of file pedigree_fb.h.
|
private |
Definition at line 109 of file pedigree_fb.h.
|
private |
Definition at line 111 of file pedigree_fb.h.
|
private |
Definition at line 105 of file pedigree_fb.h.
|
protected |
Definition at line 190 of file Framebuffer.h.
|
private |
Definition at line 103 of file pedigree_fb.h.
|
private |
Definition at line 108 of file pedigree_fb.h.
|
private |
Definition at line 232 of file Framebuffer.h.
| size_t Framebuffer::m_nBytesPerLine |
Bytes per line in this framebuffer.
Definition at line 171 of file Framebuffer.h.
Referenced by swBlit(), swCopy(), swRect(), and swSetPixel().
| size_t Framebuffer::m_nBytesPerPixel |
Bytes per pixel in this framebuffer.
Definition at line 166 of file Framebuffer.h.
Referenced by swBlit(), swCopy(), swCreateBuffer(), swRect(), and swSetPixel().
| size_t Framebuffer::m_nHeight |
Height of the framebuffer in pixels.
Definition at line 158 of file Framebuffer.h.
Referenced by swBlit(), swCopy(), swRect(), and swSetPixel().
| size_t Framebuffer::m_nWidth |
Width of the framebuffer in pixels.
Definition at line 154 of file Framebuffer.h.
Referenced by swBlit(), swCopy(), swRect(), and swSetPixel().
|
protected |
Current graphics palette - an array of 256 32-bit RGBA entries.
Definition at line 193 of file Framebuffer.h.
Referenced by setPalette(), swRect(), and swSetPixel().
|
private |
Definition at line 102 of file pedigree_fb.h.
| Graphics::PixelFormat Framebuffer::m_PixelFormat |
Framebuffer pixel format.
Definition at line 162 of file Framebuffer.h.
Referenced by redraw(), swCreateBuffer(), swRect(), and swSetPixel().
| Framebuffer* Framebuffer::m_pParent |
Parent of this framebuffer.
Definition at line 176 of file Framebuffer.h.
Referenced by blit(), copy(), createBuffer(), getRawBuffer(), line(), rect(), redraw(), and setPixel().
|
private |
Definition at line 122 of file pedigree_fb.h.
|
private |
Definition at line 119 of file pedigree_fb.h.
|
private |
Definition at line 121 of file pedigree_fb.h.
|
private |
Definition at line 123 of file pedigree_fb.h.
|
private |
Definition at line 120 of file pedigree_fb.h.
|
private |
Definition at line 114 of file pedigree_fb.h.
|
private |
Definition at line 116 of file pedigree_fb.h.
|
private |
Definition at line 117 of file pedigree_fb.h.
|
private |
Definition at line 118 of file pedigree_fb.h.
|
private |
Definition at line 107 of file pedigree_fb.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 146 of file Framebuffer.h.
Referenced by blit(), copy(), line(), rect(), redraw(), and setPixel().
| size_t Framebuffer::m_YPos |
Y position on our parent's framebuffer.
Definition at line 150 of file Framebuffer.h.
Referenced by blit(), copy(), line(), rect(), redraw(), and setPixel().