8#include <wayland-kms.h>
12#include <private/qwaylandquickhardwarelayer_p.h>
13#include <private/qwaylandquickitem_p.h>
14#include <private/qwaylandview_p.h>
15#include <QWaylandQuickOutput>
16#include <QQuickWindow>
18#include <qpa/qlatformscreen_p.h>
25 : dmabufFd(kmsBuffer->
fd)
26 , bytesPerLine(kmsBuffer->
stride)
27 , drmPixelFormat(kmsBuffer->
format)
36 m_screen =
dynamic_cast<QVsp2Screen*
>(wlItem->window()->screen()->handle());
40 integration->recreateVspLayers();
52 auto *kmsBuffer = nextKmsBuffer();
69 m_screen->removeLayer(m_layerIndex);
81 auto *kmsBuffer = nextKmsBuffer();
85 bool formatChanged =
false;
87 formatChanged |= newBuffer.
size != m_buffer.
size;
90 qWarning() <<
"The VSP2 Wayland hardware layer integration doesn't support changing"
91 <<
"surface formats, this will most likely fail";
96 m_screen->setLayerBuffer(m_layerIndex, m_buffer.
dmabufFd);
114 this->m_surface = newSurface;
120 QRectF localGeometry(0, 0, wlItem->width(), wlItem->height());
122 auto globalGeometry = lastMatrix.mapRect(localGeometry);
124 if (m_buffer.
size != globalGeometry.size().toSize()) {
125 qWarning() <<
"wl_buffer size != WaylandQuickItem size and scaling has not been"
126 <<
"implemented for the vsp2 hardware layer integration";
129 m_position = globalGeometry.topLeft().toPoint();
131 m_screen->setLayerPosition(m_layerIndex, m_position);
138 m_screen->setLayerAlpha(m_layerIndex, opacity);
142wl_kms_buffer *Vsp2Layer::nextKmsBuffer()
146 auto view = wlItem->view();
150 auto wlBuffer =
view->currentBuffer().wl_buffer();
155 struct wl_kms_buffer *kmsBuffer = wayland_kms_buffer_get(wlBuffer);
158 qWarning() <<
"Failed to get wl_kms_buffer for wl_buffer:" << wl_resource_get_id(wlBuffer);
163void Vsp2HardwareLayerIntegration::enableVspLayers()
167 layer->enableVspLayer();
171void Vsp2HardwareLayerIntegration::disableVspLayers()
174 if ((*it)->isEnabled())
175 (*it)->disableVspLayer();
179void Vsp2HardwareLayerIntegration::sortLayersByDepth()
182 return l1->hwLayer()->stackingLevel() < l2->hwLayer()->stackingLevel();
186void Vsp2HardwareLayerIntegration::recreateVspLayers() {
195 qWarning() <<
"Vsp2 layers are currently only supported on the eglfs platform plugin"
196 <<
"with the eglfs_kms_vsp2 device integration.\n"
197 <<
"You need to set QT_QPA_PLATFORM=eglfs and QT_QPA_EGLFS_INTEGRATION=eglfs_kms_vsp2";
201 screen->addBlendListener([](){
218 if ((*it)->hwLayer() == hwLayer) {
229 if (
auto *surface =
layer->hwLayer()->waylandItem()->surface())
230 surface->sendFrameCallbacks();
QScreen * primaryScreen
the primary (or default) screen of the application.
QString platformName
The name of the underlying platform plugin.
iterator erase(const_iterator begin, const_iterator end)
reverse_iterator rbegin()
void append(parameter_type t)
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
QQuickWindow * window() const
Returns the window in which this item is rendered.
qreal opacity
\qmlproperty real QtQuick::Item::opacity
\inmodule QtCore\reentrant
QPlatformScreen * handle() const
Get the platform screen handle.
void setSceneGraphPainting(bool)
void stackingLevelChanged()
QWaylandQuickItem * waylandItem() const
static const QWaylandQuickItemPrivate * get(const QWaylandQuickItem *item)
\qmltype WaylandQuickItem \instantiates QWaylandQuickItem \inqmlmodule QtWayland.Compositor
QWaylandView * view() const
Returns the view rendered by this QWaylandQuickItem.
QWaylandSurface * surface
\qmlproperty WaylandSurface QtWayland.Compositor::WaylandQuickItem::surface
Q_INVOKABLE void frameStarted()
Prepares all frame callbacks for sending.
static QWaylandViewPrivate * get(QWaylandView *view)
Vsp2HardwareLayerIntegration()
void sendFrameCallbacks()
void add(QWaylandQuickHardwareLayer *layer) override
void remove(QWaylandQuickHardwareLayer *layer) override
QList< QSharedPointer< Vsp2Layer > > m_layers
Vsp2Layer(QWaylandQuickHardwareLayer *m_hwLayer, Vsp2HardwareLayerIntegration *integration)
void handleSurfaceChanged()
void handleBufferCommitted()
QWaylandQuickHardwareLayer * hwLayer() const
QSet< QString >::iterator it
Combined button and popup list for selecting options.
GLint GLsizei GLsizei height
GLenum GLuint GLintptr GLsizeiptr size
[1]
const void GLsizei GLsizei stride
GLint GLsizei GLsizei GLenum format
myObject disconnect()
[26]