![]() |
1.10 |
Screen in an KMS dumb buffer. More...
#include <kmsscreen.h>
Public Types | |
enum class | plane_type { overlay , primary , cursor } |
Available plane types. More... | |
![]() | |
using | DamageArray = std::vector< Rect > |
Type used for damage arrays. | |
Public Member Functions | |
KMSScreen (bool allocate_primary_plane=true, PixelFormat format=PixelFormat::rgb565) | |
KMSScreen (const KMSScreen &)=delete | |
KMSScreen (KMSScreen &&) noexcept | |
~KMSScreen () noexcept override | |
unique_plane_t | allocate_overlay (const Size &size, PixelFormat format=PixelFormat::argb8888, WindowHint hint=WindowHint::automatic) |
Allocate an overlay plane. | |
EGT_NODISCARD size_t | brightness () const override |
Get the current brightness of the screen. | |
void | brightness (size_t brightness) override |
Set the brightness of the screen. | |
void | close () |
Close and release the screen. | |
uint32_t | count_planes (plane_type type=plane_type::overlay) |
Count the number of available hardware planes with a specific type. | |
void | deallocate_overlay (plane_data *plane) |
Deallocate an overlay plane. | |
EGT_NODISCARD bool | have_planes () const override |
Returns true if the screen supports planes. | |
uint32_t | index () override |
If the screen implementation manages multiple buffers, this will return the index of the current buffer. | |
EGT_NODISCARD size_t | max_brightness () const override |
Get the max brightness of the screen. | |
KMSScreen & | operator= (const KMSScreen &)=delete |
KMSScreen & | operator= (KMSScreen &&) noexcept |
void | schedule_flip () override |
Schedule a flip to occur later. | |
![]() | |
Screen () noexcept | |
Screen (const Screen &)=default | |
Screen (Screen &&) noexcept=default | |
virtual | ~Screen () noexcept=default |
void | async_flip (bool async) |
Set if asynchronous buffer flips are used. | |
EGT_NODISCARD Rect | box () const |
Bounding box for the screen. | |
EGT_NODISCARD shared_cairo_t | context () const |
Get the context for the screen. | |
virtual void | flip (const DamageArray &damage) |
Perform a flip of the buffers. | |
EGT_NODISCARD PixelFormat | format () const |
Get the format of the screen. | |
virtual void | high_fidelity () |
Configure high fidelity options. | |
virtual EGT_NODISCARD bool | is_composer () const |
Returns true if this is a screen used with the Microchip Graphic Composer. | |
virtual void | low_fidelity () |
Configure low fidelity options. | |
Screen & | operator= (const Screen &)=default |
Screen & | operator= (Screen &&) noexcept=default |
EGT_NODISCARD Size | size () const |
Size of the screen. | |
Static Public Member Functions | |
static KMSScreen * | instance () |
Get a pointer to the KMSScreen instance. | |
static uint32_t | max_buffers () |
Get the number of buffers to use for KMS planes. | |
![]() | |
static void | damage_algorithm (Screen::DamageArray &damage, Rect rect) |
This function implements the algorithm for adding damage rectangles to a list. | |
Protected Member Functions | |
plane_data * | overlay_plane_create (const Size &size, PixelFormat format, plane_type type) |
Allocate an overlay plane. | |
![]() | |
virtual void | copy_to_buffer (ScreenBuffer &buffer) |
Copy the framebuffer to the current composition buffer. | |
void | copy_to_buffer_software (ScreenBuffer &buffer) |
Copy the framebuffer to the current composition buffer. | |
void | init (const Size &size, PixelFormat format=PixelFormat::argb8888) |
void | init (void **ptr, uint32_t count, const Size &size, PixelFormat format=PixelFormat::argb8888) |
Protected Attributes | |
struct kms_device * | m_device {nullptr} |
Instance of the KMS device. | |
int | m_fd {-1} |
Internal DRM/KMS file descriptor. | |
bool | m_gfx2d {false} |
Enable GFX2D. | |
uint32_t | m_index {0} |
Current flip index. | |
unique_plane_t | m_plane |
Plane instance pointer. | |
std::unique_ptr< FlipThread > | m_pool |
Internal thread pool for flipping. | |
![]() | |
bool | m_async {false} |
Perform flips asynchronously if supported. | |
BufferArray | m_buffers |
Screen buffer array. | |
shared_cairo_t | m_cr |
Composition surface context. | |
PixelFormat | m_format {} |
Format of the screen. | |
Size | m_size |
Size of the screen. | |
shared_cairo_surface_t | m_surface |
Composition surface. | |
Static Protected Attributes | |
static std::vector< planeid > | m_used |
Global array used to keep track of allocated planes. | |
Friends | |
class | detail::KMSOverlay |
Additional Inherited Members | |
![]() | |
using | BufferArray = std::vector< ScreenBuffer > |
Type used for an array of ScreenBuffer objects. | |
Screen in an KMS dumb buffer.
This uses libplanes to modeset and configure planes.
|
strong |
|
explicit |
allocate_primary_plane | Allocate a primary plane, or create a trash buffer instead. |
format | Requested format for the screen. |
|
overridenoexcept |
unique_plane_t allocate_overlay | ( | const Size & | size, |
PixelFormat | format = PixelFormat::argb8888 , |
||
WindowHint | hint = WindowHint::automatic |
||
) |
Allocate an overlay plane.
|
overridevirtual |
Get the current brightness of the screen.
Reimplemented from Screen.
|
overridevirtual |
Set the brightness of the screen.
brightness | Value from 0 to max_brightness(). |
Reimplemented from Screen.
void close | ( | ) |
Close and release the screen.
uint32_t count_planes | ( | plane_type | type = plane_type::overlay | ) |
Count the number of available hardware planes with a specific type.
void deallocate_overlay | ( | plane_data * | plane | ) |
Deallocate an overlay plane.
|
inlineoverridevirtual |
Returns true if the screen supports planes.
Reimplemented from Screen.
|
overridevirtual |
If the screen implementation manages multiple buffers, this will return the index of the current buffer.
Reimplemented from Screen.
|
overridevirtual |
Get the max brightness of the screen.
Reimplemented from Screen.
|
static |
Get the number of buffers to use for KMS planes.
|
protected |
Allocate an overlay plane.
|
overridevirtual |
Schedule a flip to occur later.
This is needed if a flip should occur sometime in the future to the hardware.
Implements Screen.
|
friend |
|
protected |
Instance of the KMS device.
|
protected |
Internal DRM/KMS file descriptor.
|
protected |
Enable GFX2D.
|
protected |
Current flip index.
|
protected |
Plane instance pointer.
|
protected |
Internal thread pool for flipping.
|
staticprotected |
Global array used to keep track of allocated planes.