• Skip to content
  • Skip to link menu
Brand

API Documentation

  1. KDE API Reference
  2. The KDE Frameworks
  3. KWayland
  • KDE Home
  • Contact Us

Quick Links

Skip menu "KWayland"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • File List
  • Modules
  • Dependencies
  • Related Pages

Class Picker

About

Qt-style API to interact with the wayland-client and wayland-server API

Maintainer
Martin Flöser
Supported platforms
FreeBSD, Linux
Community
IRC: #kde-devel on Freenode
Mailing list: kde-frameworks-devel
Use with CMake
find_package(KF5Wayland)
target_link_libraries(yourapp KF5::WaylandClient KF5::WaylandServer)
Use with QMake
QT += KWaylandClient KWaylandServer 
Clone
git clone git://anongit.kde.org/kwayland.git
Browse source
KWayland on cgit.kde.org

KWayland

  • View on LXR
  • KWayland
  • Server
  • BufferInterface
Signals | Public Member Functions | Static Public Member Functions | List of all members
KWayland::Server::BufferInterface Class Reference

#include <buffer_interface.h>

Inheritance diagram for KWayland::Server::BufferInterface:
Inheritance graph
[legend]

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 ()
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
bool blockSignals (bool block)
 
const QObjectList & children () const
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method) const
 
bool disconnect (const QObject *receiver, const char *method) const
 
void dumpObjectInfo ()
 
void dumpObjectTree ()
 
QList< QByteArray > dynamicPropertyNames () const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
T findChild (const QString &name, QFlags< Qt::FindChildOption > options) const
 
QList< T > findChildren (const QString &name, QFlags< Qt::FindChildOption > options) const
 
QList< T > findChildren (const QRegExp &regExp, QFlags< Qt::FindChildOption > options) const
 
QList< T > findChildren (const QRegularExpression &re, QFlags< Qt::FindChildOption > options) const
 
bool inherits (const char *className) const
 
void installEventFilter (QObject *filterObj)
 
bool isWidgetType () const
 
bool isWindowType () const
 
void killTimer (int id)
 
virtual const QMetaObject * metaObject () const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const
 
void objectNameChanged (const QString &objectName)
 
QObject * parent () const
 
QVariant property (const char *name) const
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const
 
int startTimer (int interval, Qt::TimerType timerType)
 
QThread * thread () const
 

Static Public Member Functions

static BufferInterface * get (wl_resource *r)
 
- Static Public Member Functions inherited from QObject
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 *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
 
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, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 

Additional Inherited Members

- Properties inherited from QObject
 objectName
 
- Protected Member Functions inherited from QObject
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
 
int receivers (const char *signal) const
 
QObject * sender () const
 
int senderSignalIndex () 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 65 of file buffer_interface.h.

Member Function Documentation

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 280 of file buffer_interface.cpp.

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 347 of file buffer_interface.cpp.

bool KWayland::Server::BufferInterface::isReferenced ( ) const
Returns
whether the BufferInterface is currently referenced
See also
ref
unref

Definition at line 308 of file buffer_interface.cpp.

LinuxDmabufBuffer * KWayland::Server::BufferInterface::linuxDmabufBuffer ( )

Returns a pointer to the LinuxDmabufBuffer when the buffer is a dmabuf buffer, and nullptr otherwise.

Definition at line 323 of file buffer_interface.cpp.

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 247 of file buffer_interface.cpp.

wl_resource * KWayland::Server::BufferInterface::resource ( ) const
Returns
the native wl_resource wrapped by this BufferInterface.

Definition at line 328 of file buffer_interface.cpp.

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 338 of file buffer_interface.cpp.

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 318 of file buffer_interface.cpp.

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 333 of file buffer_interface.cpp.

void KWayland::Server::BufferInterface::sizeChanged ( )
signal

Emitted when the size of the Buffer changes.

Since
5.3
SurfaceInterface * KWayland::Server::BufferInterface::surface ( ) const
Returns
The SurfaceInterface this BufferInterface is attached to.

Definition at line 313 of file buffer_interface.cpp.

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 252 of file buffer_interface.cpp.


The documentation for this class was generated from the following files:
  • buffer_interface.h
  • buffer_interface.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2019 The KDE developers.
Generated on Mon Dec 9 2019 01:29:41 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal