KWayland::Server::BufferInterface
#include <buffer_interface.h>

Signals | |
void | aboutToBeDestroyed (KWayland::Server::BufferInterface *) |
void | sizeChanged () |
Public Member Functions | |
QImage | data () |
bool | hasAlphaChannel () const |
bool | isReferenced () const |
LinuxDmabufBuffer * | linuxDmabufBuffer () |
void | ref () |
wl_resource * | resource () const |
void | setSize (const QSize &size) |
wl_shm_buffer * | shmBuffer () |
QSize | size () const |
SurfaceInterface * | surface () const |
void | unref () |
![]() | |
QObject (QObject *parent) | |
bool | blockSignals (bool block) |
const QObjectList & | children () const const |
QMetaObject::Connection | connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const |
void | deleteLater () |
void | destroyed (QObject *obj) |
bool | disconnect (const char *signal, const QObject *receiver, const char *method) const const |
bool | disconnect (const QObject *receiver, const char *method) const const |
void | dumpObjectInfo () |
void | dumpObjectInfo () const const |
void | dumpObjectTree () |
void | dumpObjectTree () const const |
QList< QByteArray > | dynamicPropertyNames () const const |
virtual bool | event (QEvent *e) |
virtual bool | eventFilter (QObject *watched, QEvent *event) |
T | findChild (const QString &name, Qt::FindChildOptions options) const const |
QList< T > | findChildren (const QRegExp ®Exp, Qt::FindChildOptions options) const const |
QList< T > | findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const |
QList< T > | findChildren (const QString &name, Qt::FindChildOptions options) const const |
bool | inherits (const char *className) const const |
void | installEventFilter (QObject *filterObj) |
bool | isWidgetType () const const |
bool | isWindowType () const const |
void | killTimer (int id) |
virtual const QMetaObject * | metaObject () const const |
void | moveToThread (QThread *targetThread) |
QString | objectName () const const |
void | objectNameChanged (const QString &objectName) |
QObject * | parent () const const |
QVariant | property (const char *name) const const |
Q_CLASSINFO (Name, Value) | |
Q_DISABLE_COPY (Class) | |
Q_DISABLE_COPY_MOVE (Class) | |
Q_DISABLE_MOVE (Class) | |
Q_EMIT Q_EMIT | |
Q_ENUM (...) | |
Q_ENUM_NS (...) | |
Q_ENUMS (...) | |
Q_FLAG (...) | |
Q_FLAG_NS (...) | |
Q_FLAGS (...) | |
Q_GADGET Q_GADGET | |
Q_INTERFACES (...) | |
Q_INVOKABLE Q_INVOKABLE | |
Q_NAMESPACE Q_NAMESPACE | |
Q_NAMESPACE_EXPORT (EXPORT_MACRO) | |
Q_OBJECT Q_OBJECT | |
Q_PROPERTY (...) | |
Q_REVISION Q_REVISION | |
Q_SET_OBJECT_NAME (Object) | |
Q_SIGNAL Q_SIGNAL | |
Q_SIGNALS Q_SIGNALS | |
Q_SLOT Q_SLOT | |
Q_SLOTS Q_SLOTS | |
T | qFindChild (const QObject *obj, const QString &name) |
QList< T > | qFindChildren (const QObject *obj, const QRegExp ®Exp) |
QList< T > | qFindChildren (const QObject *obj, const QString &name) |
T | qobject_cast (const QObject *object) |
T | qobject_cast (QObject *object) |
QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT | |
void | removeEventFilter (QObject *obj) |
void | setObjectName (const QString &name) |
void | setParent (QObject *parent) |
bool | setProperty (const char *name, const QVariant &value) |
bool | signalsBlocked () const const |
int | startTimer (int interval, Qt::TimerType timerType) |
int | startTimer (std::chrono::milliseconds time, Qt::TimerType timerType) |
QThread * | thread () const const |
Static Public Member Functions | |
static BufferInterface * | get (wl_resource *r) |
![]() | |
QMetaObject::Connection | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, Functor functor) |
bool | disconnect (const QMetaObject::Connection &connection) |
bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method) |
bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method) |
bool | disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method) |
QString | tr (const char *sourceText, const char *disambiguation, int n) |
QString | trUtf8 (const char *sourceText, const char *disambiguation, int n) |
Additional Inherited Members | |
![]() | |
objectName | |
![]() | |
typedef | QObjectList |
![]() | |
virtual void | childEvent (QChildEvent *event) |
virtual void | connectNotify (const QMetaMethod &signal) |
virtual void | customEvent (QEvent *event) |
virtual void | disconnectNotify (const QMetaMethod &signal) |
bool | isSignalConnected (const QMetaMethod &signal) const const |
int | receivers (const char *signal) const const |
QObject * | sender () const const |
int | senderSignalIndex () const const |
virtual void | timerEvent (QTimerEvent *event) |
Detailed Description
Reference counted representation of a Wayland buffer on Server side.
This class encapsulates a rendering buffer which is normally attached to a SurfaceInterface. A client should not render to a Wayland buffer as long as the buffer gets used by the server. The server signals whether it's still used. This class provides a convenience access for this functionality by performing reference counting and deleting the BufferInterface instance automatically once it is no longer accessed.
The BufferInterface is referenced as long as it is attached to a SurfaceInterface. If one wants to keep access to the BufferInterface for a longer time ensure to call ref on first usage and unref again once access to it is no longer needed.
In Wayland the buffer is an abstract concept and a buffer might represent multiple different concrete buffer techniques. This class has direct support for shared memory buffers built and provides access to the native buffer for different (e.g. EGL/drm) buffers.
If the EGL display has been registered in the Display the BufferInterface can also provide some information about an EGL/drm buffer.
For shared memory buffers a direct conversion to a memory-mapped QImage possible using the data method. Please refer to the documentation for notes on the restrictions when using the shared memory-mapped QImages.
- See also
- Display
- SurfaceInterace
Definition at line 51 of file buffer_interface.h.
Member Function Documentation
◆ data()
QImage KWayland::Server::BufferInterface::data | ( | ) |
Creates a QImage for the shared memory buffer.
If the BufferInterface does not reference a shared memory buffer a null QImage is returned.
The QImage shares the memory with the buffer and this constraints how the returned QImage can be used and when this method can be invoked.
It is not safe to have two shared memory QImages for different BufferInterfaces at the same time. This method ensures that this does not happen and returns a null QImage if a different BufferInterface's data is still mapped to a QImage. Please note that this also applies to all implicitly data shared copies.
In case it is needed to keep a copy, a deep copy has to be performed by using QImage::copy.
As the underlying shared memory buffer is owned by a different client it is not safe to write to the returned QImage. The image is a read-only buffer. If there is need to modify the image, perform a deep copy.
Definition at line 268 of file buffer_interface.cpp.
◆ hasAlphaChannel()
bool KWayland::Server::BufferInterface::hasAlphaChannel | ( | ) | const |
Returns whether the format of the BufferInterface has an alpha channel.
For shared memory buffers returns true
for format WL_SHM_FORMAT_ARGB8888
, for all other formats returns false
.
For EGL buffers returns true
for format EGL_TEXTURE_RGBA
, for all other formats returns false
.
If the format cannot be queried the default value (false
) is returned.
- Since
- 5.4
Definition at line 336 of file buffer_interface.cpp.
◆ isReferenced()
bool KWayland::Server::BufferInterface::isReferenced | ( | ) | const |
- Returns
- whether the BufferInterface is currently referenced
Definition at line 297 of file buffer_interface.cpp.
◆ linuxDmabufBuffer()
LinuxDmabufBuffer * KWayland::Server::BufferInterface::linuxDmabufBuffer | ( | ) |
Returns a pointer to the LinuxDmabufBuffer when the buffer is a dmabuf buffer, and nullptr otherwise.
Definition at line 312 of file buffer_interface.cpp.
◆ ref()
void KWayland::Server::BufferInterface::ref | ( | ) |
Reference the BufferInterface.
As long as the reference counting has not reached 0
the BufferInterface is valid and blocked for usage by the client.
- See also
- unref
- isReferenced
Definition at line 235 of file buffer_interface.cpp.
◆ resource()
wl_resource * KWayland::Server::BufferInterface::resource | ( | ) | const |
- Returns
- the native wl_resource wrapped by this BufferInterface.
Definition at line 317 of file buffer_interface.cpp.
◆ setSize()
void KWayland::Server::BufferInterface::setSize | ( | const QSize & | size | ) |
Sets the size
for non shared memory buffers.
- See also
- size
- sizeChanged
- Since
- 5.3
Definition at line 327 of file buffer_interface.cpp.
◆ shmBuffer()
wl_shm_buffer * KWayland::Server::BufferInterface::shmBuffer | ( | ) |
- Returns
- The native wl_shm_buffer if the BufferInterface represents a shared memory buffer, otherwise
nullptr
.
Definition at line 307 of file buffer_interface.cpp.
◆ size()
QSize KWayland::Server::BufferInterface::size | ( | ) | const |
Returns the size of this BufferInterface.
Note: only for shared memory buffers (shmBuffer) the size can be derived, for other buffers it might be possible to derive the size if an EGL display is set on Display otherwise the user of the BufferInterface has to use setSize to provide the proper size.
- See also
- setSize
- Display::setEglDisplay
- Since
- 5.3
Definition at line 322 of file buffer_interface.cpp.
◆ sizeChanged
|
signal |
Emitted when the size of the Buffer changes.
- Since
- 5.3
◆ surface()
SurfaceInterface * KWayland::Server::BufferInterface::surface | ( | ) | const |
- Returns
- The SurfaceInterface this BufferInterface is attached to.
Definition at line 302 of file buffer_interface.cpp.
◆ unref()
void KWayland::Server::BufferInterface::unref | ( | ) |
Unreference the BufferInterface.
If the reference counting reached 0
the BufferInterface is released, so that the client can use it again. The instance of this BufferInterface will be automatically deleted.
- See also
- ref
- isReferenced
Definition at line 240 of file buffer_interface.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2023 The KDE developers.
Generated on Sun Jan 29 2023 03:54:10 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.