wayland: Switch to ClientBuffer
The main motivation behind the split is to simplify client buffer code and allow adding new features easier, for example referencing the shm pool when a shm buffer is destroyed, or monitoring for readable linux dmabuf file descriptors, etc. Also, a referenced ClientBuffer cannot be destroyed, unlike the old BufferInterface.icc-effect-5.26.4
parent
95e954da30
commit
964c487d4f
|
@ -31,7 +31,6 @@
|
||||||
#include <KWayland/Client/shm_pool.h>
|
#include <KWayland/Client/shm_pool.h>
|
||||||
#include <KWayland/Client/surface.h>
|
#include <KWayland/Client/surface.h>
|
||||||
|
|
||||||
#include <KWaylandServer/buffer_interface.h>
|
|
||||||
#include <KWaylandServer/clientconnection.h>
|
#include <KWaylandServer/clientconnection.h>
|
||||||
#include <KWaylandServer/seat_interface.h>
|
#include <KWaylandServer/seat_interface.h>
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
#include <KWayland/Client/seat.h>
|
#include <KWayland/Client/seat.h>
|
||||||
#include <KWayland/Client/surface.h>
|
#include <KWayland/Client/surface.h>
|
||||||
#include <KWayland/Client/pointer.h>
|
#include <KWayland/Client/pointer.h>
|
||||||
#include <KWaylandServer/buffer_interface.h>
|
#include <KWaylandServer/shmclientbuffer.h>
|
||||||
#include <KWaylandServer/surface_interface.h>
|
#include <KWaylandServer/surface_interface.h>
|
||||||
|
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
|
@ -347,7 +347,8 @@ void SceneQPainterTest::testX11Window()
|
||||||
QVERIFY(waitForXwaylandBuffer(client, client->size()));
|
QVERIFY(waitForXwaylandBuffer(client, client->size()));
|
||||||
QImage compareImage(client->clientSize(), QImage::Format_RGB32);
|
QImage compareImage(client->clientSize(), QImage::Format_RGB32);
|
||||||
compareImage.fill(Qt::white);
|
compareImage.fill(Qt::white);
|
||||||
QCOMPARE(client->surface()->buffer()->data().copy(QRect(client->clientPos(), client->clientSize())), compareImage);
|
auto buffer = qobject_cast<KWaylandServer::ShmClientBuffer *>(client->surface()->buffer());
|
||||||
|
QCOMPARE(buffer->data().copy(QRect(client->clientPos(), client->clientSize())), compareImage);
|
||||||
|
|
||||||
// enough time for rendering the window
|
// enough time for rendering the window
|
||||||
QTest::qWait(100);
|
QTest::qWait(100);
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
#include "ui_debug_console.h"
|
#include "ui_debug_console.h"
|
||||||
|
|
||||||
// KWayland
|
// KWayland
|
||||||
#include <KWaylandServer/buffer_interface.h>
|
#include <KWaylandServer/shmclientbuffer.h>
|
||||||
#include <KWaylandServer/clientconnection.h>
|
#include <KWaylandServer/clientconnection.h>
|
||||||
#include <KWaylandServer/subcompositor_interface.h>
|
#include <KWaylandServer/subcompositor_interface.h>
|
||||||
#include <KWaylandServer/surface_interface.h>
|
#include <KWaylandServer/surface_interface.h>
|
||||||
|
@ -1422,10 +1422,8 @@ QVariant SurfaceTreeModel::data(const QModelIndex &index, int role) const
|
||||||
.arg(surface->client()->processId())
|
.arg(surface->client()->processId())
|
||||||
.arg(surface->id());
|
.arg(surface->id());
|
||||||
} else if (role == Qt::DecorationRole) {
|
} else if (role == Qt::DecorationRole) {
|
||||||
if (auto buffer = surface->buffer()) {
|
if (auto buffer = qobject_cast<KWaylandServer::ShmClientBuffer *>(surface->buffer())) {
|
||||||
if (buffer->shmBuffer()) {
|
return buffer->data().scaled(QSize(64, 64), Qt::KeepAspectRatio);
|
||||||
return buffer->data().scaled(QSize(64, 64), Qt::KeepAspectRatio);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
#include <KWaylandServer/fakeinput_interface.h>
|
#include <KWaylandServer/fakeinput_interface.h>
|
||||||
#include <KWaylandServer/relativepointer_v1_interface.h>
|
#include <KWaylandServer/relativepointer_v1_interface.h>
|
||||||
#include <KWaylandServer/seat_interface.h>
|
#include <KWaylandServer/seat_interface.h>
|
||||||
#include <KWaylandServer/buffer_interface.h>
|
#include <KWaylandServer/shmclientbuffer.h>
|
||||||
#include <KWaylandServer/surface_interface.h>
|
#include <KWaylandServer/surface_interface.h>
|
||||||
#include <KWaylandServer/tablet_v2_interface.h>
|
#include <KWaylandServer/tablet_v2_interface.h>
|
||||||
#include <KWaylandServer/keyboard_interface.h>
|
#include <KWaylandServer/keyboard_interface.h>
|
||||||
|
@ -1594,7 +1594,7 @@ public:
|
||||||
private:
|
private:
|
||||||
void refresh()
|
void refresh()
|
||||||
{
|
{
|
||||||
auto buffer = m_surface->buffer();
|
auto buffer = qobject_cast<KWaylandServer::ShmClientBuffer *>(m_surface->buffer());
|
||||||
if (!buffer) {
|
if (!buffer) {
|
||||||
updateCursor({}, {});
|
updateCursor({}, {});
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -10,56 +10,40 @@
|
||||||
|
|
||||||
#include "wayland_server.h"
|
#include "wayland_server.h"
|
||||||
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
namespace KWin
|
namespace KWin
|
||||||
{
|
{
|
||||||
|
|
||||||
DmabufBuffer::DmabufBuffer(const QVector<Plane> &planes,
|
LinuxDmaBufV1ClientBuffer::LinuxDmaBufV1ClientBuffer(const QVector<KWaylandServer::LinuxDmaBufV1Plane> &planes,
|
||||||
uint32_t format,
|
quint32 format,
|
||||||
const QSize &size,
|
const QSize &size,
|
||||||
Flags flags)
|
quint32 flags)
|
||||||
: KWaylandServer::LinuxDmabufUnstableV1Buffer(format, size)
|
: KWaylandServer::LinuxDmaBufV1ClientBuffer(size, format, flags, planes)
|
||||||
, m_planes(planes)
|
|
||||||
, m_format(format)
|
|
||||||
, m_size(size)
|
|
||||||
, m_flags(flags)
|
|
||||||
{
|
{
|
||||||
waylandServer()->addLinuxDmabufBuffer(this);
|
waylandServer()->addLinuxDmabufBuffer(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
DmabufBuffer::~DmabufBuffer()
|
LinuxDmaBufV1ClientBuffer::~LinuxDmaBufV1ClientBuffer()
|
||||||
{
|
{
|
||||||
// Close all open file descriptors
|
|
||||||
for (int i = 0; i < m_planes.count(); i++) {
|
|
||||||
if (m_planes[i].fd != -1)
|
|
||||||
::close(m_planes[i].fd);
|
|
||||||
m_planes[i].fd = -1;
|
|
||||||
}
|
|
||||||
if (waylandServer()) {
|
if (waylandServer()) {
|
||||||
waylandServer()->removeLinuxDmabufBuffer(this);
|
waylandServer()->removeLinuxDmabufBuffer(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LinuxDmabuf::LinuxDmabuf()
|
LinuxDmaBufV1RendererInterface::LinuxDmaBufV1RendererInterface()
|
||||||
: KWaylandServer::LinuxDmabufUnstableV1Interface::Impl()
|
|
||||||
{
|
{
|
||||||
Q_ASSERT(waylandServer());
|
Q_ASSERT(waylandServer());
|
||||||
waylandServer()->linuxDmabuf()->setImpl(this);
|
waylandServer()->linuxDmabuf()->setRendererInterface(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
LinuxDmabuf::~LinuxDmabuf()
|
LinuxDmaBufV1RendererInterface::~LinuxDmaBufV1RendererInterface()
|
||||||
{
|
{
|
||||||
waylandServer()->linuxDmabuf()->setImpl(nullptr);
|
waylandServer()->linuxDmabuf()->setRendererInterface(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
using Plane = KWaylandServer::LinuxDmabufUnstableV1Interface::Plane;
|
KWaylandServer::LinuxDmaBufV1ClientBuffer *LinuxDmaBufV1RendererInterface::importBuffer(const QVector<KWaylandServer::LinuxDmaBufV1Plane> &planes,
|
||||||
using Flags = KWaylandServer::LinuxDmabufUnstableV1Interface::Flags;
|
quint32 format,
|
||||||
|
const QSize &size,
|
||||||
KWaylandServer::LinuxDmabufUnstableV1Buffer* LinuxDmabuf::importBuffer(const QVector<Plane> &planes,
|
quint32 flags)
|
||||||
uint32_t format,
|
|
||||||
const QSize &size,
|
|
||||||
Flags flags)
|
|
||||||
{
|
{
|
||||||
Q_UNUSED(planes)
|
Q_UNUSED(planes)
|
||||||
Q_UNUSED(format)
|
Q_UNUSED(format)
|
||||||
|
@ -69,7 +53,7 @@ KWaylandServer::LinuxDmabufUnstableV1Buffer* LinuxDmabuf::importBuffer(const QVe
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LinuxDmabuf::setSupportedFormatsAndModifiers(QHash<uint32_t, QSet<uint64_t> > &set)
|
void LinuxDmaBufV1RendererInterface::setSupportedFormatsAndModifiers(const QHash<uint32_t, QSet<uint64_t>> &set)
|
||||||
{
|
{
|
||||||
waylandServer()->linuxDmabuf()->setSupportedFormatsWithModifiers(set);
|
waylandServer()->linuxDmabuf()->setSupportedFormatsWithModifiers(set);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,54 +10,34 @@
|
||||||
|
|
||||||
#include <kwin_export.h>
|
#include <kwin_export.h>
|
||||||
|
|
||||||
#include <KWaylandServer/linuxdmabuf_v1_interface.h>
|
#include <KWaylandServer/linuxdmabufv1clientbuffer.h>
|
||||||
|
|
||||||
#include <QVector>
|
|
||||||
|
|
||||||
namespace KWin
|
namespace KWin
|
||||||
{
|
{
|
||||||
|
|
||||||
class KWIN_EXPORT DmabufBuffer : public KWaylandServer::LinuxDmabufUnstableV1Buffer
|
class KWIN_EXPORT LinuxDmaBufV1ClientBuffer : public KWaylandServer::LinuxDmaBufV1ClientBuffer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
using Plane = KWaylandServer::LinuxDmabufUnstableV1Interface::Plane;
|
LinuxDmaBufV1ClientBuffer(const QVector<KWaylandServer::LinuxDmaBufV1Plane> &planes,
|
||||||
using Flags = KWaylandServer::LinuxDmabufUnstableV1Interface::Flags;
|
quint32 format,
|
||||||
|
const QSize &size,
|
||||||
DmabufBuffer(const QVector<Plane> &planes,
|
quint32 flags);
|
||||||
uint32_t format,
|
~LinuxDmaBufV1ClientBuffer() override;
|
||||||
const QSize &size,
|
|
||||||
Flags flags);
|
|
||||||
|
|
||||||
~DmabufBuffer() override;
|
|
||||||
|
|
||||||
const QVector<Plane> &planes() const { return m_planes; }
|
|
||||||
uint32_t format() const { return m_format; }
|
|
||||||
QSize size() const { return m_size; }
|
|
||||||
Flags flags() const { return m_flags; }
|
|
||||||
|
|
||||||
private:
|
|
||||||
QVector<Plane> m_planes;
|
|
||||||
uint32_t m_format;
|
|
||||||
QSize m_size;
|
|
||||||
Flags m_flags;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class KWIN_EXPORT LinuxDmabuf : public KWaylandServer::LinuxDmabufUnstableV1Interface::Impl
|
class KWIN_EXPORT LinuxDmaBufV1RendererInterface : public KWaylandServer::LinuxDmaBufV1ClientBufferIntegration::RendererInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
using Plane = KWaylandServer::LinuxDmabufUnstableV1Interface::Plane;
|
explicit LinuxDmaBufV1RendererInterface();
|
||||||
using Flags = KWaylandServer::LinuxDmabufUnstableV1Interface::Flags;
|
~LinuxDmaBufV1RendererInterface() override;
|
||||||
|
|
||||||
explicit LinuxDmabuf();
|
KWaylandServer::LinuxDmaBufV1ClientBuffer *importBuffer(const QVector<KWaylandServer::LinuxDmaBufV1Plane> &planes,
|
||||||
~LinuxDmabuf() override;
|
quint32 format,
|
||||||
|
const QSize &size,
|
||||||
KWaylandServer::LinuxDmabufUnstableV1Buffer *importBuffer(const QVector<Plane> &planes,
|
quint32 flags) override;
|
||||||
uint32_t format,
|
|
||||||
const QSize &size,
|
|
||||||
Flags flags) override;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void setSupportedFormatsAndModifiers(QHash<uint32_t, QSet<uint64_t> > &set);
|
void setSupportedFormatsAndModifiers(const QHash<uint32_t, QSet<uint64_t>> &set);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,8 +11,9 @@
|
||||||
#include "logging.h"
|
#include "logging.h"
|
||||||
#include "surfaceitem_wayland.h"
|
#include "surfaceitem_wayland.h"
|
||||||
|
|
||||||
#include <KWaylandServer/buffer_interface.h>
|
#include <KWaylandServer/drmclientbuffer.h>
|
||||||
#include <KWaylandServer/linuxdmabuf_v1_interface.h>
|
#include <KWaylandServer/linuxdmabufv1clientbuffer.h>
|
||||||
|
#include <KWaylandServer/shmclientbuffer.h>
|
||||||
|
|
||||||
namespace KWin
|
namespace KWin
|
||||||
{
|
{
|
||||||
|
@ -35,16 +36,14 @@ AbstractEglBackend *BasicEGLSurfaceTextureWayland::backend() const
|
||||||
|
|
||||||
bool BasicEGLSurfaceTextureWayland::create()
|
bool BasicEGLSurfaceTextureWayland::create()
|
||||||
{
|
{
|
||||||
KWaylandServer::BufferInterface *buffer = m_pixmap->buffer();
|
if (auto buffer = qobject_cast<KWaylandServer::LinuxDmaBufV1ClientBuffer *>(m_pixmap->buffer())) {
|
||||||
if (Q_UNLIKELY(!buffer)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (buffer->linuxDmabufBuffer()) {
|
|
||||||
return loadDmabufTexture(buffer);
|
return loadDmabufTexture(buffer);
|
||||||
} else if (buffer->shmBuffer()) {
|
} else if (auto buffer = qobject_cast<KWaylandServer::ShmClientBuffer *>(m_pixmap->buffer())) {
|
||||||
return loadShmTexture(buffer);
|
return loadShmTexture(buffer);
|
||||||
} else {
|
} else if (auto buffer = qobject_cast<KWaylandServer::DrmClientBuffer *>(m_pixmap->buffer())) {
|
||||||
return loadEglTexture(buffer);
|
return loadEglTexture(buffer);
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,20 +59,16 @@ void BasicEGLSurfaceTextureWayland::destroy()
|
||||||
|
|
||||||
void BasicEGLSurfaceTextureWayland::update(const QRegion ®ion)
|
void BasicEGLSurfaceTextureWayland::update(const QRegion ®ion)
|
||||||
{
|
{
|
||||||
KWaylandServer::BufferInterface *buffer = m_pixmap->buffer();
|
if (auto buffer = qobject_cast<KWaylandServer::LinuxDmaBufV1ClientBuffer *>(m_pixmap->buffer())) {
|
||||||
if (Q_UNLIKELY(!buffer)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (buffer->linuxDmabufBuffer()) {
|
|
||||||
updateDmabufTexture(buffer);
|
updateDmabufTexture(buffer);
|
||||||
} else if (buffer->shmBuffer()) {
|
} else if (auto buffer = qobject_cast<KWaylandServer::ShmClientBuffer *>(m_pixmap->buffer())) {
|
||||||
updateShmTexture(buffer, region);
|
updateShmTexture(buffer, region);
|
||||||
} else {
|
} else if (auto buffer = qobject_cast<KWaylandServer::DrmClientBuffer *>(m_pixmap->buffer())) {
|
||||||
updateEglTexture(buffer);
|
updateEglTexture(buffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BasicEGLSurfaceTextureWayland::loadShmTexture(KWaylandServer::BufferInterface *buffer)
|
bool BasicEGLSurfaceTextureWayland::loadShmTexture(KWaylandServer::ShmClientBuffer *buffer)
|
||||||
{
|
{
|
||||||
const QImage &image = buffer->data();
|
const QImage &image = buffer->data();
|
||||||
if (Q_UNLIKELY(image.isNull())) {
|
if (Q_UNLIKELY(image.isNull())) {
|
||||||
|
@ -89,7 +84,7 @@ bool BasicEGLSurfaceTextureWayland::loadShmTexture(KWaylandServer::BufferInterfa
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BasicEGLSurfaceTextureWayland::updateShmTexture(KWaylandServer::BufferInterface *buffer, const QRegion ®ion)
|
void BasicEGLSurfaceTextureWayland::updateShmTexture(KWaylandServer::ShmClientBuffer *buffer, const QRegion ®ion)
|
||||||
{
|
{
|
||||||
if (Q_UNLIKELY(m_bufferType != BufferType::Shm)) {
|
if (Q_UNLIKELY(m_bufferType != BufferType::Shm)) {
|
||||||
destroy();
|
destroy();
|
||||||
|
@ -108,7 +103,7 @@ void BasicEGLSurfaceTextureWayland::updateShmTexture(KWaylandServer::BufferInter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BasicEGLSurfaceTextureWayland::loadEglTexture(KWaylandServer::BufferInterface *buffer)
|
bool BasicEGLSurfaceTextureWayland::loadEglTexture(KWaylandServer::DrmClientBuffer *buffer)
|
||||||
{
|
{
|
||||||
const AbstractEglBackendFunctions *funcs = backend()->functions();
|
const AbstractEglBackendFunctions *funcs = backend()->functions();
|
||||||
if (Q_UNLIKELY(!funcs->eglQueryWaylandBufferWL)) {
|
if (Q_UNLIKELY(!funcs->eglQueryWaylandBufferWL)) {
|
||||||
|
@ -137,13 +132,16 @@ bool BasicEGLSurfaceTextureWayland::loadEglTexture(KWaylandServer::BufferInterfa
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BasicEGLSurfaceTextureWayland::updateEglTexture(KWaylandServer::BufferInterface *buffer)
|
void BasicEGLSurfaceTextureWayland::updateEglTexture(KWaylandServer::DrmClientBuffer *buffer)
|
||||||
{
|
{
|
||||||
if (Q_UNLIKELY(m_bufferType != BufferType::Egl)) {
|
if (Q_UNLIKELY(m_bufferType != BufferType::Egl)) {
|
||||||
destroy();
|
destroy();
|
||||||
create();
|
create();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (Q_UNLIKELY(!buffer->resource())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m_texture->bind();
|
m_texture->bind();
|
||||||
EGLImageKHR image = attach(buffer);
|
EGLImageKHR image = attach(buffer);
|
||||||
|
@ -156,9 +154,9 @@ void BasicEGLSurfaceTextureWayland::updateEglTexture(KWaylandServer::BufferInter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BasicEGLSurfaceTextureWayland::loadDmabufTexture(KWaylandServer::BufferInterface *buffer)
|
bool BasicEGLSurfaceTextureWayland::loadDmabufTexture(KWaylandServer::LinuxDmaBufV1ClientBuffer *buffer)
|
||||||
{
|
{
|
||||||
auto dmabuf = static_cast<EglDmabufBuffer *>(buffer->linuxDmabufBuffer());
|
auto dmabuf = static_cast<EglDmabufBuffer *>(buffer);
|
||||||
if (Q_UNLIKELY(dmabuf->images().constFirst() == EGL_NO_IMAGE_KHR)) {
|
if (Q_UNLIKELY(dmabuf->images().constFirst() == EGL_NO_IMAGE_KHR)) {
|
||||||
qCritical(KWIN_OPENGL) << "Invalid dmabuf-based wl_buffer";
|
qCritical(KWIN_OPENGL) << "Invalid dmabuf-based wl_buffer";
|
||||||
return false;
|
return false;
|
||||||
|
@ -172,13 +170,13 @@ bool BasicEGLSurfaceTextureWayland::loadDmabufTexture(KWaylandServer::BufferInte
|
||||||
m_texture->bind();
|
m_texture->bind();
|
||||||
glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, static_cast<GLeglImageOES>(dmabuf->images().constFirst()));
|
glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, static_cast<GLeglImageOES>(dmabuf->images().constFirst()));
|
||||||
m_texture->unbind();
|
m_texture->unbind();
|
||||||
m_texture->setYInverted(!(dmabuf->flags() & KWaylandServer::LinuxDmabufUnstableV1Interface::YInverted));
|
m_texture->setYInverted(dmabuf->origin() == KWaylandServer::ClientBuffer::Origin::TopLeft);
|
||||||
m_bufferType = BufferType::DmaBuf;
|
m_bufferType = BufferType::DmaBuf;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BasicEGLSurfaceTextureWayland::updateDmabufTexture(KWaylandServer::BufferInterface *buffer)
|
void BasicEGLSurfaceTextureWayland::updateDmabufTexture(KWaylandServer::LinuxDmaBufV1ClientBuffer *buffer)
|
||||||
{
|
{
|
||||||
if (Q_UNLIKELY(m_bufferType != BufferType::DmaBuf)) {
|
if (Q_UNLIKELY(m_bufferType != BufferType::DmaBuf)) {
|
||||||
destroy();
|
destroy();
|
||||||
|
@ -186,35 +184,22 @@ void BasicEGLSurfaceTextureWayland::updateDmabufTexture(KWaylandServer::BufferIn
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto dmabuf = static_cast<EglDmabufBuffer *>(buffer->linuxDmabufBuffer());
|
auto dmabuf = static_cast<EglDmabufBuffer *>(buffer);
|
||||||
m_texture->bind();
|
m_texture->bind();
|
||||||
glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, static_cast<GLeglImageOES>(dmabuf->images().constFirst()));
|
glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, static_cast<GLeglImageOES>(dmabuf->images().constFirst()));
|
||||||
m_texture->unbind();
|
m_texture->unbind();
|
||||||
// The origin in a dmabuf-buffer is at the upper-left corner, so the meaning
|
// The origin in a dmabuf-buffer is at the upper-left corner, so the meaning
|
||||||
// of Y-inverted is the inverse of OpenGL.
|
// of Y-inverted is the inverse of OpenGL.
|
||||||
m_texture->setYInverted(!(dmabuf->flags() & KWaylandServer::LinuxDmabufUnstableV1Interface::YInverted));
|
m_texture->setYInverted(dmabuf->origin() == KWaylandServer::ClientBuffer::Origin::TopLeft);
|
||||||
}
|
}
|
||||||
|
|
||||||
EGLImageKHR BasicEGLSurfaceTextureWayland::attach(KWaylandServer::BufferInterface *buffer)
|
EGLImageKHR BasicEGLSurfaceTextureWayland::attach(KWaylandServer::DrmClientBuffer *buffer)
|
||||||
{
|
{
|
||||||
const AbstractEglBackendFunctions *funcs = backend()->functions();
|
if (buffer->textureFormat() != EGL_TEXTURE_RGB && buffer->textureFormat() != EGL_TEXTURE_RGBA) {
|
||||||
|
qCDebug(KWIN_OPENGL) << "Unsupported texture format: " << buffer->textureFormat();
|
||||||
EGLint format;
|
|
||||||
funcs->eglQueryWaylandBufferWL(backend()->eglDisplay(), buffer->resource(),
|
|
||||||
EGL_TEXTURE_FORMAT, &format);
|
|
||||||
if (format != EGL_TEXTURE_RGB && format != EGL_TEXTURE_RGBA) {
|
|
||||||
qCDebug(KWIN_OPENGL) << "Unsupported texture format: " << format;
|
|
||||||
return EGL_NO_IMAGE_KHR;
|
return EGL_NO_IMAGE_KHR;
|
||||||
}
|
}
|
||||||
|
|
||||||
EGLint yInverted;
|
|
||||||
if (!funcs->eglQueryWaylandBufferWL(backend()->eglDisplay(), buffer->resource(),
|
|
||||||
EGL_WAYLAND_Y_INVERTED_WL, &yInverted)) {
|
|
||||||
// If EGL_WAYLAND_Y_INVERTED_WL is not supported wl_buffer should be treated as
|
|
||||||
// if value were EGL_TRUE.
|
|
||||||
yInverted = EGL_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
const EGLint attribs[] = {
|
const EGLint attribs[] = {
|
||||||
EGL_WAYLAND_PLANE_WL, 0,
|
EGL_WAYLAND_PLANE_WL, 0,
|
||||||
EGL_NONE
|
EGL_NONE
|
||||||
|
@ -224,7 +209,7 @@ EGLImageKHR BasicEGLSurfaceTextureWayland::attach(KWaylandServer::BufferInterfac
|
||||||
static_cast<EGLClientBuffer>(buffer->resource()), attribs);
|
static_cast<EGLClientBuffer>(buffer->resource()), attribs);
|
||||||
if (image != EGL_NO_IMAGE_KHR) {
|
if (image != EGL_NO_IMAGE_KHR) {
|
||||||
glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, static_cast<GLeglImageOES>(image));
|
glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, static_cast<GLeglImageOES>(image));
|
||||||
m_texture->setYInverted(yInverted);
|
m_texture->setYInverted(buffer->origin() == KWaylandServer::ClientBuffer::Origin::TopLeft);
|
||||||
}
|
}
|
||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,9 @@
|
||||||
|
|
||||||
namespace KWaylandServer
|
namespace KWaylandServer
|
||||||
{
|
{
|
||||||
class BufferInterface;
|
class DrmClientBuffer;
|
||||||
|
class ShmClientBuffer;
|
||||||
|
class LinuxDmaBufV1ClientBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace KWin
|
namespace KWin
|
||||||
|
@ -32,13 +34,13 @@ public:
|
||||||
void update(const QRegion ®ion) override;
|
void update(const QRegion ®ion) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool loadShmTexture(KWaylandServer::BufferInterface *buffer);
|
bool loadShmTexture(KWaylandServer::ShmClientBuffer *buffer);
|
||||||
void updateShmTexture(KWaylandServer::BufferInterface *buffer, const QRegion ®ion);
|
void updateShmTexture(KWaylandServer::ShmClientBuffer *buffer, const QRegion ®ion);
|
||||||
bool loadEglTexture(KWaylandServer::BufferInterface *buffer);
|
bool loadEglTexture(KWaylandServer::DrmClientBuffer *buffer);
|
||||||
void updateEglTexture(KWaylandServer::BufferInterface *buffer);
|
void updateEglTexture(KWaylandServer::DrmClientBuffer *buffer);
|
||||||
bool loadDmabufTexture(KWaylandServer::BufferInterface *buffer);
|
bool loadDmabufTexture(KWaylandServer::LinuxDmaBufV1ClientBuffer *buffer);
|
||||||
void updateDmabufTexture(KWaylandServer::BufferInterface *buffer);
|
void updateDmabufTexture(KWaylandServer::LinuxDmaBufV1ClientBuffer *buffer);
|
||||||
EGLImageKHR attach(KWaylandServer::BufferInterface *buffer);
|
EGLImageKHR attach(KWaylandServer::DrmClientBuffer *buffer);
|
||||||
void destroy();
|
void destroy();
|
||||||
|
|
||||||
enum class BufferType {
|
enum class BufferType {
|
||||||
|
|
|
@ -122,10 +122,10 @@ YuvFormat yuvFormats[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
EglDmabufBuffer::EglDmabufBuffer(EGLImage image,
|
EglDmabufBuffer::EglDmabufBuffer(EGLImage image,
|
||||||
const QVector<Plane> &planes,
|
const QVector<KWaylandServer::LinuxDmaBufV1Plane> &planes,
|
||||||
uint32_t format,
|
uint32_t format,
|
||||||
const QSize &size,
|
const QSize &size,
|
||||||
Flags flags,
|
quint32 flags,
|
||||||
EglDmabuf *interfaceImpl)
|
EglDmabuf *interfaceImpl)
|
||||||
: EglDmabufBuffer(planes, format, size, flags, interfaceImpl)
|
: EglDmabufBuffer(planes, format, size, flags, interfaceImpl)
|
||||||
{
|
{
|
||||||
|
@ -134,12 +134,12 @@ EglDmabufBuffer::EglDmabufBuffer(EGLImage image,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EglDmabufBuffer::EglDmabufBuffer(const QVector<Plane> &planes,
|
EglDmabufBuffer::EglDmabufBuffer(const QVector<KWaylandServer::LinuxDmaBufV1Plane> &planes,
|
||||||
uint32_t format,
|
uint32_t format,
|
||||||
const QSize &size,
|
const QSize &size,
|
||||||
Flags flags,
|
quint32 flags,
|
||||||
EglDmabuf *interfaceImpl)
|
EglDmabuf *interfaceImpl)
|
||||||
: DmabufBuffer(planes, format, size, flags)
|
: LinuxDmaBufV1ClientBuffer(planes, format, size, flags)
|
||||||
, m_interfaceImpl(interfaceImpl)
|
, m_interfaceImpl(interfaceImpl)
|
||||||
{
|
{
|
||||||
m_importType = ImportType::Conversion;
|
m_importType = ImportType::Conversion;
|
||||||
|
@ -168,10 +168,7 @@ void EglDmabufBuffer::removeImages()
|
||||||
m_images.clear();
|
m_images.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
using Plane = KWaylandServer::LinuxDmabufUnstableV1Interface::Plane;
|
EGLImage EglDmabuf::createImage(const QVector<KWaylandServer::LinuxDmaBufV1Plane> &planes,
|
||||||
using Flags = KWaylandServer::LinuxDmabufUnstableV1Interface::Flags;
|
|
||||||
|
|
||||||
EGLImage EglDmabuf::createImage(const QVector<Plane> &planes,
|
|
||||||
uint32_t format,
|
uint32_t format,
|
||||||
const QSize &size)
|
const QSize &size)
|
||||||
{
|
{
|
||||||
|
@ -248,10 +245,10 @@ EGLImage EglDmabuf::createImage(const QVector<Plane> &planes,
|
||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
|
||||||
KWaylandServer::LinuxDmabufUnstableV1Buffer* EglDmabuf::importBuffer(const QVector<Plane> &planes,
|
KWaylandServer::LinuxDmaBufV1ClientBuffer *EglDmabuf::importBuffer(const QVector<KWaylandServer::LinuxDmaBufV1Plane> &planes,
|
||||||
uint32_t format,
|
quint32 format,
|
||||||
const QSize &size,
|
const QSize &size,
|
||||||
Flags flags)
|
quint32 flags)
|
||||||
{
|
{
|
||||||
Q_ASSERT(planes.count() > 0);
|
Q_ASSERT(planes.count() > 0);
|
||||||
|
|
||||||
|
@ -268,10 +265,10 @@ KWaylandServer::LinuxDmabufUnstableV1Buffer* EglDmabuf::importBuffer(const QVect
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
KWaylandServer::LinuxDmabufUnstableV1Buffer* EglDmabuf::yuvImport(const QVector<Plane> &planes,
|
KWaylandServer::LinuxDmaBufV1ClientBuffer *EglDmabuf::yuvImport(const QVector<KWaylandServer::LinuxDmaBufV1Plane> &planes,
|
||||||
uint32_t format,
|
quint32 format,
|
||||||
const QSize &size,
|
const QSize &size,
|
||||||
Flags flags)
|
quint32 flags)
|
||||||
{
|
{
|
||||||
YuvFormat yuvFormat;
|
YuvFormat yuvFormat;
|
||||||
for (YuvFormat f : yuvFormats) {
|
for (YuvFormat f : yuvFormats) {
|
||||||
|
@ -291,7 +288,7 @@ KWaylandServer::LinuxDmabufUnstableV1Buffer* EglDmabuf::yuvImport(const QVector<
|
||||||
|
|
||||||
for (int i = 0; i < yuvFormat.outputPlanes; i++) {
|
for (int i = 0; i < yuvFormat.outputPlanes; i++) {
|
||||||
int planeIndex = yuvFormat.planes[i].planeIndex;
|
int planeIndex = yuvFormat.planes[i].planeIndex;
|
||||||
Plane plane = {
|
KWaylandServer::LinuxDmaBufV1Plane plane = {
|
||||||
planes[planeIndex].fd,
|
planes[planeIndex].fd,
|
||||||
planes[planeIndex].offset,
|
planes[planeIndex].offset,
|
||||||
planes[planeIndex].stride,
|
planes[planeIndex].stride,
|
||||||
|
@ -300,7 +297,7 @@ KWaylandServer::LinuxDmabufUnstableV1Buffer* EglDmabuf::yuvImport(const QVector<
|
||||||
const auto planeFormat = yuvFormat.planes[i].format;
|
const auto planeFormat = yuvFormat.planes[i].format;
|
||||||
const auto planeSize = QSize(size.width() / yuvFormat.planes[i].widthDivisor,
|
const auto planeSize = QSize(size.width() / yuvFormat.planes[i].widthDivisor,
|
||||||
size.height() / yuvFormat.planes[i].heightDivisor);
|
size.height() / yuvFormat.planes[i].heightDivisor);
|
||||||
auto *image = createImage(QVector<Plane>(1, plane),
|
auto *image = createImage(QVector<KWaylandServer::LinuxDmaBufV1Plane>(1, plane),
|
||||||
planeFormat,
|
planeFormat,
|
||||||
planeSize);
|
planeSize);
|
||||||
if (!image) {
|
if (!image) {
|
||||||
|
@ -332,8 +329,7 @@ EglDmabuf* EglDmabuf::factory(AbstractEglBackend *backend)
|
||||||
}
|
}
|
||||||
|
|
||||||
EglDmabuf::EglDmabuf(AbstractEglBackend *backend)
|
EglDmabuf::EglDmabuf(AbstractEglBackend *backend)
|
||||||
: LinuxDmabuf()
|
: m_backend(backend)
|
||||||
, m_backend(backend)
|
|
||||||
{
|
{
|
||||||
auto prevBuffersSet = waylandServer()->linuxDmabufBuffers();
|
auto prevBuffersSet = waylandServer()->linuxDmabufBuffers();
|
||||||
for (auto *buffer : prevBuffersSet) {
|
for (auto *buffer : prevBuffersSet) {
|
||||||
|
@ -439,7 +435,7 @@ void EglDmabuf::setSupportedFormatsAndModifiers()
|
||||||
set.insert(format, QSet<uint64_t>());
|
set.insert(format, QSet<uint64_t>());
|
||||||
}
|
}
|
||||||
|
|
||||||
LinuxDmabuf::setSupportedFormatsAndModifiers(set);
|
LinuxDmaBufV1RendererInterface::setSupportedFormatsAndModifiers(set);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,28 +19,25 @@ namespace KWin
|
||||||
{
|
{
|
||||||
class EglDmabuf;
|
class EglDmabuf;
|
||||||
|
|
||||||
class EglDmabufBuffer : public DmabufBuffer
|
class EglDmabufBuffer : public LinuxDmaBufV1ClientBuffer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
using Plane = KWaylandServer::LinuxDmabufUnstableV1Interface::Plane;
|
|
||||||
using Flags = KWaylandServer::LinuxDmabufUnstableV1Interface::Flags;
|
|
||||||
|
|
||||||
enum class ImportType {
|
enum class ImportType {
|
||||||
Direct,
|
Direct,
|
||||||
Conversion
|
Conversion
|
||||||
};
|
};
|
||||||
|
|
||||||
EglDmabufBuffer(EGLImage image,
|
EglDmabufBuffer(EGLImage image,
|
||||||
const QVector<Plane> &planes,
|
const QVector<KWaylandServer::LinuxDmaBufV1Plane> &planes,
|
||||||
uint32_t format,
|
quint32 format,
|
||||||
const QSize &size,
|
const QSize &size,
|
||||||
Flags flags,
|
quint32 flags,
|
||||||
EglDmabuf *interfaceImpl);
|
EglDmabuf *interfaceImpl);
|
||||||
|
|
||||||
EglDmabufBuffer(const QVector<Plane> &planes,
|
EglDmabufBuffer(const QVector<KWaylandServer::LinuxDmaBufV1Plane> &planes,
|
||||||
uint32_t format,
|
quint32 format,
|
||||||
const QSize &size,
|
const QSize &size,
|
||||||
Flags flags,
|
quint32 flags,
|
||||||
EglDmabuf *interfaceImpl);
|
EglDmabuf *interfaceImpl);
|
||||||
|
|
||||||
~EglDmabufBuffer() override;
|
~EglDmabufBuffer() override;
|
||||||
|
@ -57,31 +54,28 @@ private:
|
||||||
ImportType m_importType;
|
ImportType m_importType;
|
||||||
};
|
};
|
||||||
|
|
||||||
class EglDmabuf : public LinuxDmabuf
|
class EglDmabuf : public LinuxDmaBufV1RendererInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
using Plane = KWaylandServer::LinuxDmabufUnstableV1Interface::Plane;
|
|
||||||
using Flags = KWaylandServer::LinuxDmabufUnstableV1Interface::Flags;
|
|
||||||
|
|
||||||
static EglDmabuf* factory(AbstractEglBackend *backend);
|
static EglDmabuf* factory(AbstractEglBackend *backend);
|
||||||
|
|
||||||
explicit EglDmabuf(AbstractEglBackend *backend);
|
explicit EglDmabuf(AbstractEglBackend *backend);
|
||||||
~EglDmabuf() override;
|
~EglDmabuf() override;
|
||||||
|
|
||||||
KWaylandServer::LinuxDmabufUnstableV1Buffer *importBuffer(const QVector<Plane> &planes,
|
KWaylandServer::LinuxDmaBufV1ClientBuffer *importBuffer(const QVector<KWaylandServer::LinuxDmaBufV1Plane> &planes,
|
||||||
uint32_t format,
|
quint32 format,
|
||||||
const QSize &size,
|
const QSize &size,
|
||||||
Flags flags) override;
|
quint32 flags) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
EGLImage createImage(const QVector<Plane> &planes,
|
EGLImage createImage(const QVector<KWaylandServer::LinuxDmaBufV1Plane> &planes,
|
||||||
uint32_t format,
|
uint32_t format,
|
||||||
const QSize &size);
|
const QSize &size);
|
||||||
|
|
||||||
KWaylandServer::LinuxDmabufUnstableV1Buffer *yuvImport(const QVector<Plane> &planes,
|
KWaylandServer::LinuxDmaBufV1ClientBuffer *yuvImport(const QVector<KWaylandServer::LinuxDmaBufV1Plane> &planes,
|
||||||
uint32_t format,
|
quint32 format,
|
||||||
const QSize &size,
|
const QSize &size,
|
||||||
Flags flags);
|
quint32 flags);
|
||||||
|
|
||||||
void setSupportedFormatsAndModifiers();
|
void setSupportedFormatsAndModifiers();
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
#include "platformqpaintersurfacetexture_wayland.h"
|
#include "platformqpaintersurfacetexture_wayland.h"
|
||||||
#include "surfaceitem_wayland.h"
|
#include "surfaceitem_wayland.h"
|
||||||
|
|
||||||
#include <KWaylandServer/buffer_interface.h>
|
#include <KWaylandServer/shmclientbuffer.h>
|
||||||
#include <KWaylandServer/surface_interface.h>
|
#include <KWaylandServer/surface_interface.h>
|
||||||
|
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
|
@ -24,7 +24,7 @@ PlatformQPainterSurfaceTextureWayland::PlatformQPainterSurfaceTextureWayland(QPa
|
||||||
|
|
||||||
bool PlatformQPainterSurfaceTextureWayland::create()
|
bool PlatformQPainterSurfaceTextureWayland::create()
|
||||||
{
|
{
|
||||||
KWaylandServer::BufferInterface *buffer = m_pixmap->buffer();
|
auto buffer = qobject_cast<KWaylandServer::ShmClientBuffer *>(m_pixmap->buffer());
|
||||||
if (Q_LIKELY(buffer)) {
|
if (Q_LIKELY(buffer)) {
|
||||||
// The buffer data is copied as the buffer interface returns a QImage
|
// The buffer data is copied as the buffer interface returns a QImage
|
||||||
// which doesn't own the data of the underlying wl_shm_buffer object.
|
// which doesn't own the data of the underlying wl_shm_buffer object.
|
||||||
|
@ -35,7 +35,7 @@ bool PlatformQPainterSurfaceTextureWayland::create()
|
||||||
|
|
||||||
void PlatformQPainterSurfaceTextureWayland::update(const QRegion ®ion)
|
void PlatformQPainterSurfaceTextureWayland::update(const QRegion ®ion)
|
||||||
{
|
{
|
||||||
KWaylandServer::BufferInterface *buffer = m_pixmap->buffer();
|
auto buffer = qobject_cast<KWaylandServer::ShmClientBuffer *>(m_pixmap->buffer());
|
||||||
if (Q_UNLIKELY(!buffer)) {
|
if (Q_UNLIKELY(!buffer)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
#include <xf86drmMode.h>
|
#include <xf86drmMode.h>
|
||||||
#include <gbm.h>
|
#include <gbm.h>
|
||||||
// KWaylandServer
|
// KWaylandServer
|
||||||
#include "KWaylandServer/buffer_interface.h"
|
#include "KWaylandServer/clientbuffer.h"
|
||||||
#include <drm_fourcc.h>
|
#include <drm_fourcc.h>
|
||||||
|
|
||||||
namespace KWin
|
namespace KWin
|
||||||
|
@ -35,14 +35,13 @@ GbmBuffer::GbmBuffer(GbmSurface *surface, gbm_bo *bo)
|
||||||
m_stride = gbm_bo_get_stride(m_bo);
|
m_stride = gbm_bo_get_stride(m_bo);
|
||||||
}
|
}
|
||||||
|
|
||||||
GbmBuffer::GbmBuffer(gbm_bo *buffer, KWaylandServer::BufferInterface *bufferInterface)
|
GbmBuffer::GbmBuffer(gbm_bo *buffer, KWaylandServer::ClientBuffer *clientBuffer)
|
||||||
: m_bo(buffer)
|
: m_bo(buffer)
|
||||||
, m_bufferInterface(bufferInterface)
|
, m_clientBuffer(clientBuffer)
|
||||||
, m_stride(gbm_bo_get_stride(m_bo))
|
, m_stride(gbm_bo_get_stride(m_bo))
|
||||||
{
|
{
|
||||||
if (m_bufferInterface) {
|
if (m_clientBuffer) {
|
||||||
m_bufferInterface->ref();
|
m_clientBuffer->ref();
|
||||||
connect(m_bufferInterface, &KWaylandServer::BufferInterface::aboutToBeDestroyed, this, &GbmBuffer::clearBufferInterface);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,8 +52,9 @@ GbmBuffer::~GbmBuffer()
|
||||||
|
|
||||||
void GbmBuffer::releaseBuffer()
|
void GbmBuffer::releaseBuffer()
|
||||||
{
|
{
|
||||||
if (m_bufferInterface) {
|
if (m_clientBuffer) {
|
||||||
clearBufferInterface();
|
m_clientBuffer->unref();
|
||||||
|
m_clientBuffer = nullptr;
|
||||||
}
|
}
|
||||||
if (!m_bo) {
|
if (!m_bo) {
|
||||||
return;
|
return;
|
||||||
|
@ -83,12 +83,6 @@ bool GbmBuffer::map(uint32_t flags)
|
||||||
return m_data;
|
return m_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GbmBuffer::clearBufferInterface()
|
|
||||||
{
|
|
||||||
disconnect(m_bufferInterface, &KWaylandServer::BufferInterface::aboutToBeDestroyed, this, &DrmGbmBuffer::clearBufferInterface);
|
|
||||||
m_bufferInterface->unref();
|
|
||||||
m_bufferInterface = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
DrmGbmBuffer::DrmGbmBuffer(DrmGpu *gpu, GbmSurface *surface, gbm_bo *bo)
|
DrmGbmBuffer::DrmGbmBuffer(DrmGpu *gpu, GbmSurface *surface, gbm_bo *bo)
|
||||||
: DrmBuffer(gpu), GbmBuffer(surface, bo)
|
: DrmBuffer(gpu), GbmBuffer(surface, bo)
|
||||||
|
@ -96,8 +90,8 @@ DrmGbmBuffer::DrmGbmBuffer(DrmGpu *gpu, GbmSurface *surface, gbm_bo *bo)
|
||||||
initialize();
|
initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
DrmGbmBuffer::DrmGbmBuffer(DrmGpu *gpu, gbm_bo *buffer, KWaylandServer::BufferInterface *bufferInterface)
|
DrmGbmBuffer::DrmGbmBuffer(DrmGpu *gpu, gbm_bo *buffer, KWaylandServer::ClientBuffer *clientBuffer)
|
||||||
: DrmBuffer(gpu), GbmBuffer(buffer, bufferInterface)
|
: DrmBuffer(gpu), GbmBuffer(buffer, clientBuffer)
|
||||||
{
|
{
|
||||||
initialize();
|
initialize();
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ struct gbm_bo;
|
||||||
|
|
||||||
namespace KWaylandServer
|
namespace KWaylandServer
|
||||||
{
|
{
|
||||||
class BufferInterface;
|
class ClientBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace KWin
|
namespace KWin
|
||||||
|
@ -31,7 +31,7 @@ class GbmBuffer : public QObject
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
GbmBuffer(GbmSurface *surface, gbm_bo *bo);
|
GbmBuffer(GbmSurface *surface, gbm_bo *bo);
|
||||||
GbmBuffer(gbm_bo *buffer, KWaylandServer::BufferInterface *bufferInterface);
|
GbmBuffer(gbm_bo *buffer, KWaylandServer::ClientBuffer *clientBuffer);
|
||||||
virtual ~GbmBuffer();
|
virtual ~GbmBuffer();
|
||||||
|
|
||||||
gbm_bo* getBo() const {
|
gbm_bo* getBo() const {
|
||||||
|
@ -51,20 +51,18 @@ public:
|
||||||
protected:
|
protected:
|
||||||
GbmSurface *m_surface = nullptr;
|
GbmSurface *m_surface = nullptr;
|
||||||
gbm_bo *m_bo = nullptr;
|
gbm_bo *m_bo = nullptr;
|
||||||
KWaylandServer::BufferInterface *m_bufferInterface = nullptr;
|
KWaylandServer::ClientBuffer *m_clientBuffer = nullptr;
|
||||||
|
|
||||||
void *m_data = nullptr;
|
void *m_data = nullptr;
|
||||||
void *m_mapping = nullptr;
|
void *m_mapping = nullptr;
|
||||||
uint32_t m_stride = 0;
|
uint32_t m_stride = 0;
|
||||||
|
|
||||||
void clearBufferInterface();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class DrmGbmBuffer : public DrmBuffer, public GbmBuffer
|
class DrmGbmBuffer : public DrmBuffer, public GbmBuffer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DrmGbmBuffer(DrmGpu *gpu, GbmSurface *surface, gbm_bo *bo);
|
DrmGbmBuffer(DrmGpu *gpu, GbmSurface *surface, gbm_bo *bo);
|
||||||
DrmGbmBuffer(DrmGpu *gpu, gbm_bo *buffer, KWaylandServer::BufferInterface *bufferInterface);
|
DrmGbmBuffer(DrmGpu *gpu, gbm_bo *buffer, KWaylandServer::ClientBuffer *clientBuffer);
|
||||||
~DrmGbmBuffer() override;
|
~DrmGbmBuffer() override;
|
||||||
|
|
||||||
bool needsModeChange(DrmBuffer *b) const override {
|
bool needsModeChange(DrmBuffer *b) const override {
|
||||||
|
|
|
@ -33,12 +33,10 @@
|
||||||
#include <gbm.h>
|
#include <gbm.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <egl_dmabuf.h>
|
|
||||||
#include <drm_fourcc.h>
|
#include <drm_fourcc.h>
|
||||||
// kwayland server
|
// kwayland server
|
||||||
#include "KWaylandServer/surface_interface.h"
|
#include "KWaylandServer/surface_interface.h"
|
||||||
#include "KWaylandServer/buffer_interface.h"
|
#include "KWaylandServer/linuxdmabufv1clientbuffer.h"
|
||||||
#include "KWaylandServer/linuxdmabuf_v1_interface.h"
|
|
||||||
#include "KWaylandServer/clientconnection.h"
|
#include "KWaylandServer/clientconnection.h"
|
||||||
|
|
||||||
namespace KWin
|
namespace KWin
|
||||||
|
@ -598,47 +596,50 @@ bool EglGbmBackend::scanout(int screenId, SurfaceItem *surfaceItem)
|
||||||
}
|
}
|
||||||
|
|
||||||
KWaylandServer::SurfaceInterface *surface = item->surface();
|
KWaylandServer::SurfaceInterface *surface = item->surface();
|
||||||
if (!surface || !surface->buffer() || !surface->buffer()->linuxDmabufBuffer()) {
|
if (!surface) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto buffer = qobject_cast<KWaylandServer::LinuxDmaBufV1ClientBuffer *>(surface->buffer());
|
||||||
|
if (!buffer) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
auto buffer = surface->buffer();
|
|
||||||
Output &output = m_outputs[screenId];
|
Output &output = m_outputs[screenId];
|
||||||
if (buffer->linuxDmabufBuffer()->size() != output.output->modeSize()) {
|
if (buffer->size() != output.output->modeSize()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
EglDmabufBuffer *dmabuf = static_cast<EglDmabufBuffer*>(buffer->linuxDmabufBuffer());
|
if (!buffer->planes().count() ||
|
||||||
if (!dmabuf || !dmabuf->planes().count() ||
|
!gbm_device_is_format_supported(m_gpu->gbmDevice(), buffer->format(), GBM_BO_USE_SCANOUT)) {
|
||||||
!gbm_device_is_format_supported(m_gpu->gbmDevice(), dmabuf->format(), GBM_BO_USE_SCANOUT)) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
gbm_bo *importedBuffer;
|
gbm_bo *importedBuffer;
|
||||||
if (dmabuf->planes()[0].modifier != DRM_FORMAT_MOD_INVALID
|
if (buffer->planes()[0].modifier != DRM_FORMAT_MOD_INVALID
|
||||||
|| dmabuf->planes()[0].offset > 0
|
|| buffer->planes()[0].offset > 0
|
||||||
|| dmabuf->planes().size() > 1) {
|
|| buffer->planes().size() > 1) {
|
||||||
if (!m_gpu->addFB2ModifiersSupported()) {
|
if (!m_gpu->addFB2ModifiersSupported()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
gbm_import_fd_modifier_data data = {};
|
gbm_import_fd_modifier_data data = {};
|
||||||
data.format = dmabuf->format();
|
data.format = buffer->format();
|
||||||
data.width = (uint32_t) dmabuf->size().width();
|
data.width = (uint32_t) buffer->size().width();
|
||||||
data.height = (uint32_t) dmabuf->size().height();
|
data.height = (uint32_t) buffer->size().height();
|
||||||
data.num_fds = dmabuf->planes().count();
|
data.num_fds = buffer->planes().count();
|
||||||
data.modifier = dmabuf->planes()[0].modifier;
|
data.modifier = buffer->planes()[0].modifier;
|
||||||
for (int i = 0; i < dmabuf->planes().count(); i++) {
|
for (int i = 0; i < buffer->planes().count(); i++) {
|
||||||
auto plane = dmabuf->planes()[i];
|
auto plane = buffer->planes()[i];
|
||||||
data.fds[i] = plane.fd;
|
data.fds[i] = plane.fd;
|
||||||
data.offsets[i] = plane.offset;
|
data.offsets[i] = plane.offset;
|
||||||
data.strides[i] = plane.stride;
|
data.strides[i] = plane.stride;
|
||||||
}
|
}
|
||||||
importedBuffer = gbm_bo_import(m_gpu->gbmDevice(), GBM_BO_IMPORT_FD_MODIFIER, &data, GBM_BO_USE_SCANOUT);
|
importedBuffer = gbm_bo_import(m_gpu->gbmDevice(), GBM_BO_IMPORT_FD_MODIFIER, &data, GBM_BO_USE_SCANOUT);
|
||||||
} else {
|
} else {
|
||||||
auto plane = dmabuf->planes()[0];
|
auto plane = buffer->planes()[0];
|
||||||
gbm_import_fd_data data = {};
|
gbm_import_fd_data data = {};
|
||||||
data.fd = plane.fd;
|
data.fd = plane.fd;
|
||||||
data.width = (uint32_t) dmabuf->size().width();
|
data.width = (uint32_t) buffer->size().width();
|
||||||
data.height = (uint32_t) dmabuf->size().height();
|
data.height = (uint32_t) buffer->size().height();
|
||||||
data.stride = plane.stride;
|
data.stride = plane.stride;
|
||||||
data.format = dmabuf->format();
|
data.format = buffer->format();
|
||||||
importedBuffer = gbm_bo_import(m_gpu->gbmDevice(), GBM_BO_IMPORT_FD, &data, GBM_BO_USE_SCANOUT);
|
importedBuffer = gbm_bo_import(m_gpu->gbmDevice(), GBM_BO_IMPORT_FD, &data, GBM_BO_USE_SCANOUT);
|
||||||
}
|
}
|
||||||
if (!importedBuffer) {
|
if (!importedBuffer) {
|
||||||
|
|
|
@ -19,7 +19,6 @@ struct gbm_bo;
|
||||||
|
|
||||||
namespace KWaylandServer
|
namespace KWaylandServer
|
||||||
{
|
{
|
||||||
class BufferInterface;
|
|
||||||
class SurfaceInterface;
|
class SurfaceInterface;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
#include "drm_pipeline.h"
|
#include "drm_pipeline.h"
|
||||||
|
|
||||||
#include <QOpenGLContext>
|
#include <QOpenGLContext>
|
||||||
#include <KWaylandServer/buffer_interface.h>
|
#include <KWaylandServer/clientbuffer.h>
|
||||||
#include <KWaylandServer/display.h>
|
#include <KWaylandServer/display.h>
|
||||||
#include <KWaylandServer/eglstream_controller_interface.h>
|
#include <KWaylandServer/eglstream_controller_interface.h>
|
||||||
#include <KWaylandServer/resource.h>
|
#include <KWaylandServer/resource.h>
|
||||||
|
@ -664,7 +664,7 @@ void EglStreamSurfaceTextureWayland::copyExternalTexture(GLuint tex)
|
||||||
glViewport(oldViewport[0], oldViewport[1], oldViewport[2], oldViewport[3]);
|
glViewport(oldViewport[0], oldViewport[1], oldViewport[2], oldViewport[3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EglStreamSurfaceTextureWayland::attachBuffer(KWaylandServer::BufferInterface *buffer)
|
bool EglStreamSurfaceTextureWayland::attachBuffer(KWaylandServer::ClientBuffer *buffer)
|
||||||
{
|
{
|
||||||
GLenum oldFormat = m_format;
|
GLenum oldFormat = m_format;
|
||||||
m_format = buffer->hasAlphaChannel() ? GL_RGBA : GL_RGB;
|
m_format = buffer->hasAlphaChannel() ? GL_RGBA : GL_RGB;
|
||||||
|
@ -679,7 +679,7 @@ bool EglStreamSurfaceTextureWayland::attachBuffer(KWaylandServer::BufferInterfac
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EglStreamSurfaceTextureWayland::checkBuffer(KWaylandServer::SurfaceInterface *surface,
|
bool EglStreamSurfaceTextureWayland::checkBuffer(KWaylandServer::SurfaceInterface *surface,
|
||||||
KWaylandServer::BufferInterface *buffer)
|
KWaylandServer::ClientBuffer *buffer)
|
||||||
{
|
{
|
||||||
EGLAttrib attribs[] = {
|
EGLAttrib attribs[] = {
|
||||||
EGL_WAYLAND_EGLSTREAM_WL, (EGLAttrib)buffer->resource(),
|
EGL_WAYLAND_EGLSTREAM_WL, (EGLAttrib)buffer->resource(),
|
||||||
|
|
|
@ -98,9 +98,9 @@ private:
|
||||||
bool acquireStreamFrame(EGLStreamKHR stream);
|
bool acquireStreamFrame(EGLStreamKHR stream);
|
||||||
void createFbo();
|
void createFbo();
|
||||||
void copyExternalTexture(GLuint tex);
|
void copyExternalTexture(GLuint tex);
|
||||||
bool attachBuffer(KWaylandServer::BufferInterface *buffer);
|
bool attachBuffer(KWaylandServer::ClientBuffer *buffer);
|
||||||
bool checkBuffer(KWaylandServer::SurfaceInterface *surface,
|
bool checkBuffer(KWaylandServer::SurfaceInterface *surface,
|
||||||
KWaylandServer::BufferInterface *buffer);
|
KWaylandServer::ClientBuffer *buffer);
|
||||||
|
|
||||||
EglStreamBackend *m_backend;
|
EglStreamBackend *m_backend;
|
||||||
GLuint m_fbo, m_rbo, m_textureId;
|
GLuint m_fbo, m_rbo, m_textureId;
|
||||||
|
|
|
@ -31,7 +31,6 @@
|
||||||
|
|
||||||
// KDE
|
// KDE
|
||||||
#include <KWayland/Client/surface.h>
|
#include <KWayland/Client/surface.h>
|
||||||
#include <KWaylandServer/buffer_interface.h>
|
|
||||||
#include <KWaylandServer/display.h>
|
#include <KWaylandServer/display.h>
|
||||||
|
|
||||||
// Qt
|
// Qt
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
// KDecoration
|
// KDecoration
|
||||||
#include <KDecoration2/Decoration>
|
#include <KDecoration2/Decoration>
|
||||||
// KWayland
|
// KWayland
|
||||||
#include <KWaylandServer/buffer_interface.h>
|
#include <KWaylandServer/shmclientbuffer.h>
|
||||||
#include <KWaylandServer/datadevice_interface.h>
|
#include <KWaylandServer/datadevice_interface.h>
|
||||||
#include <KWaylandServer/display.h>
|
#include <KWaylandServer/display.h>
|
||||||
#include <KWaylandServer/pointer_interface.h>
|
#include <KWaylandServer/pointer_interface.h>
|
||||||
|
@ -1115,7 +1115,7 @@ void CursorImage::updateServerCursor()
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto buffer = cursorSurface->buffer();
|
auto buffer = qobject_cast<KWaylandServer::ShmClientBuffer *>(cursorSurface->buffer());
|
||||||
if (!buffer) {
|
if (!buffer) {
|
||||||
if (needsEmit) {
|
if (needsEmit) {
|
||||||
Q_EMIT changed();
|
Q_EMIT changed();
|
||||||
|
@ -1184,7 +1184,7 @@ void CursorImage::updateDragCursor()
|
||||||
QImage additionalIcon;
|
QImage additionalIcon;
|
||||||
if (auto ddi = waylandServer()->seat()->dragSource()) {
|
if (auto ddi = waylandServer()->seat()->dragSource()) {
|
||||||
if (const KWaylandServer::DragAndDropIcon *dragIcon = ddi->icon()) {
|
if (const KWaylandServer::DragAndDropIcon *dragIcon = ddi->icon()) {
|
||||||
if (KWaylandServer::BufferInterface *buffer = dragIcon->surface()->buffer()) {
|
if (auto buffer = qobject_cast<KWaylandServer::ShmClientBuffer *>(dragIcon->surface()->buffer())) {
|
||||||
additionalIcon = buffer->data().copy();
|
additionalIcon = buffer->data().copy();
|
||||||
additionalIcon.setDevicePixelRatio(dragIcon->surface()->bufferScale());
|
additionalIcon.setDevicePixelRatio(dragIcon->surface()->bufferScale());
|
||||||
additionalIcon.setOffset(dragIcon->position());
|
additionalIcon.setOffset(dragIcon->position());
|
||||||
|
@ -1212,7 +1212,7 @@ void CursorImage::updateDragCursor()
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto buffer = cursorSurface->buffer();
|
auto buffer = qobject_cast<KWaylandServer::ShmClientBuffer *>(cursorSurface->buffer());
|
||||||
if (!buffer) {
|
if (!buffer) {
|
||||||
if (needsEmit) {
|
if (needsEmit) {
|
||||||
Q_EMIT changed();
|
Q_EMIT changed();
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
#include <KDecoration2/Decoration>
|
#include <KDecoration2/Decoration>
|
||||||
#include <KDecoration2/DecorationShadow>
|
#include <KDecoration2/DecorationShadow>
|
||||||
|
|
||||||
#include <KWaylandServer/buffer_interface.h>
|
#include <KWaylandServer/shmclientbuffer.h>
|
||||||
#include <KWaylandServer/shadow_interface.h>
|
#include <KWaylandServer/shadow_interface.h>
|
||||||
#include <KWaylandServer/surface_interface.h>
|
#include <KWaylandServer/surface_interface.h>
|
||||||
|
|
||||||
|
@ -214,20 +214,29 @@ bool Shadow::init(KDecoration2::Decoration *decoration)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static QPixmap shadowTileForBuffer(KWaylandServer::ClientBuffer *buffer)
|
||||||
|
{
|
||||||
|
auto shmBuffer = qobject_cast<KWaylandServer::ShmClientBuffer *>(buffer);
|
||||||
|
if (shmBuffer) {
|
||||||
|
return QPixmap::fromImage(shmBuffer->data().copy());
|
||||||
|
}
|
||||||
|
return QPixmap();
|
||||||
|
}
|
||||||
|
|
||||||
bool Shadow::init(const QPointer< KWaylandServer::ShadowInterface > &shadow)
|
bool Shadow::init(const QPointer< KWaylandServer::ShadowInterface > &shadow)
|
||||||
{
|
{
|
||||||
if (!shadow) {
|
if (!shadow) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_shadowElements[ShadowElementTop] = shadow->top() ? QPixmap::fromImage(shadow->top()->data().copy()) : QPixmap();
|
m_shadowElements[ShadowElementTop] = shadowTileForBuffer(shadow->top());
|
||||||
m_shadowElements[ShadowElementTopRight] = shadow->topRight() ? QPixmap::fromImage(shadow->topRight()->data().copy()) : QPixmap();
|
m_shadowElements[ShadowElementTopRight] = shadowTileForBuffer(shadow->topRight());
|
||||||
m_shadowElements[ShadowElementRight] = shadow->right() ? QPixmap::fromImage(shadow->right()->data().copy()) : QPixmap();
|
m_shadowElements[ShadowElementRight] = shadowTileForBuffer(shadow->right());
|
||||||
m_shadowElements[ShadowElementBottomRight] = shadow->bottomRight() ? QPixmap::fromImage(shadow->bottomRight()->data().copy()) : QPixmap();
|
m_shadowElements[ShadowElementBottomRight] = shadowTileForBuffer(shadow->bottomRight());
|
||||||
m_shadowElements[ShadowElementBottom] = shadow->bottom() ? QPixmap::fromImage(shadow->bottom()->data().copy()) : QPixmap();
|
m_shadowElements[ShadowElementBottom] = shadowTileForBuffer(shadow->bottom());
|
||||||
m_shadowElements[ShadowElementBottomLeft] = shadow->bottomLeft() ? QPixmap::fromImage(shadow->bottomLeft()->data().copy()) : QPixmap();
|
m_shadowElements[ShadowElementBottomLeft] = shadowTileForBuffer(shadow->bottomLeft());
|
||||||
m_shadowElements[ShadowElementLeft] = shadow->left() ? QPixmap::fromImage(shadow->left()->data().copy()) : QPixmap();
|
m_shadowElements[ShadowElementLeft] = shadowTileForBuffer(shadow->left());
|
||||||
m_shadowElements[ShadowElementTopLeft] = shadow->topLeft() ? QPixmap::fromImage(shadow->topLeft()->data().copy()) : QPixmap();
|
m_shadowElements[ShadowElementTopLeft] = shadowTileForBuffer(shadow->topLeft());
|
||||||
|
|
||||||
m_offset = shadow->offset().toMargins();
|
m_offset = shadow->offset().toMargins();
|
||||||
Q_EMIT offsetChanged();
|
Q_EMIT offsetChanged();
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
#include "composite.h"
|
#include "composite.h"
|
||||||
#include "scene.h"
|
#include "scene.h"
|
||||||
|
|
||||||
#include <KWaylandServer/buffer_interface.h>
|
#include <KWaylandServer/clientbuffer.h>
|
||||||
#include <KWaylandServer/subcompositor_interface.h>
|
#include <KWaylandServer/subcompositor_interface.h>
|
||||||
#include <KWaylandServer/surface_interface.h>
|
#include <KWaylandServer/surface_interface.h>
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ void SurfaceItemWayland::handleChildSubSurfacesChanged()
|
||||||
SurfaceItemWayland *subsurfaceItem = getOrCreateSubSurfaceItem(below[i]);
|
SurfaceItemWayland *subsurfaceItem = getOrCreateSubSurfaceItem(below[i]);
|
||||||
subsurfaceItem->setZ(i - below.count());
|
subsurfaceItem->setZ(i - below.count());
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < above.count(); ++i) {
|
for (int i = 0; i < above.count(); ++i) {
|
||||||
SurfaceItemWayland *subsurfaceItem = getOrCreateSubSurfaceItem(above[i]);
|
SurfaceItemWayland *subsurfaceItem = getOrCreateSubSurfaceItem(above[i]);
|
||||||
subsurfaceItem->setZ(i);
|
subsurfaceItem->setZ(i);
|
||||||
|
@ -149,7 +149,7 @@ KWaylandServer::SurfaceInterface *SurfacePixmapWayland::surface() const
|
||||||
return m_item->surface();
|
return m_item->surface();
|
||||||
}
|
}
|
||||||
|
|
||||||
KWaylandServer::BufferInterface *SurfacePixmapWayland::buffer() const
|
KWaylandServer::ClientBuffer *SurfacePixmapWayland::buffer() const
|
||||||
{
|
{
|
||||||
return m_buffer;
|
return m_buffer;
|
||||||
}
|
}
|
||||||
|
@ -169,31 +169,20 @@ void SurfacePixmapWayland::update()
|
||||||
|
|
||||||
bool SurfacePixmapWayland::isValid() const
|
bool SurfacePixmapWayland::isValid() const
|
||||||
{
|
{
|
||||||
// Referenced buffers get destroyed under our nose, check also the platform texture
|
return m_buffer;
|
||||||
// to work around BufferInterface's weird api.
|
|
||||||
return m_buffer || platformTexture()->isValid();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SurfacePixmapWayland::clearBuffer()
|
void SurfacePixmapWayland::setBuffer(KWaylandServer::ClientBuffer *buffer)
|
||||||
{
|
|
||||||
setBuffer(nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SurfacePixmapWayland::setBuffer(KWaylandServer::BufferInterface *buffer)
|
|
||||||
{
|
{
|
||||||
if (m_buffer == buffer) {
|
if (m_buffer == buffer) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (m_buffer) {
|
if (m_buffer) {
|
||||||
disconnect(m_buffer, &KWaylandServer::BufferInterface::aboutToBeDestroyed,
|
|
||||||
this, &SurfacePixmapWayland::clearBuffer);
|
|
||||||
m_buffer->unref();
|
m_buffer->unref();
|
||||||
}
|
}
|
||||||
m_buffer = buffer;
|
m_buffer = buffer;
|
||||||
if (m_buffer) {
|
if (m_buffer) {
|
||||||
m_buffer->ref();
|
m_buffer->ref();
|
||||||
connect(m_buffer, &KWaylandServer::BufferInterface::aboutToBeDestroyed,
|
|
||||||
this, &SurfacePixmapWayland::clearBuffer);
|
|
||||||
m_hasAlphaChannel = m_buffer->hasAlphaChannel();
|
m_hasAlphaChannel = m_buffer->hasAlphaChannel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
namespace KWaylandServer
|
namespace KWaylandServer
|
||||||
{
|
{
|
||||||
class BufferInterface;
|
class ClientBuffer;
|
||||||
class SubSurfaceInterface;
|
class SubSurfaceInterface;
|
||||||
class SurfaceInterface;
|
class SurfaceInterface;
|
||||||
}
|
}
|
||||||
|
@ -63,18 +63,17 @@ public:
|
||||||
|
|
||||||
SurfaceItemWayland *item() const;
|
SurfaceItemWayland *item() const;
|
||||||
KWaylandServer::SurfaceInterface *surface() const;
|
KWaylandServer::SurfaceInterface *surface() const;
|
||||||
KWaylandServer::BufferInterface *buffer() const;
|
KWaylandServer::ClientBuffer *buffer() const;
|
||||||
|
|
||||||
void create() override;
|
void create() override;
|
||||||
void update() override;
|
void update() override;
|
||||||
bool isValid() const override;
|
bool isValid() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void clearBuffer();
|
void setBuffer(KWaylandServer::ClientBuffer *buffer);
|
||||||
void setBuffer(KWaylandServer::BufferInterface *buffer);
|
|
||||||
|
|
||||||
SurfaceItemWayland *m_item;
|
SurfaceItemWayland *m_item;
|
||||||
KWaylandServer::BufferInterface *m_buffer = nullptr;
|
KWaylandServer::ClientBuffer *m_buffer = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -42,7 +42,7 @@
|
||||||
#include <KWaylandServer/dpms_interface.h>
|
#include <KWaylandServer/dpms_interface.h>
|
||||||
#include <KWaylandServer/idle_interface.h>
|
#include <KWaylandServer/idle_interface.h>
|
||||||
#include <KWaylandServer/idleinhibit_v1_interface.h>
|
#include <KWaylandServer/idleinhibit_v1_interface.h>
|
||||||
#include <KWaylandServer/linuxdmabuf_v1_interface.h>
|
#include <KWaylandServer/linuxdmabufv1clientbuffer.h>
|
||||||
#include <KWaylandServer/output_interface.h>
|
#include <KWaylandServer/output_interface.h>
|
||||||
#include <KWaylandServer/plasmashell_interface.h>
|
#include <KWaylandServer/plasmashell_interface.h>
|
||||||
#include <KWaylandServer/plasmavirtualdesktop_interface.h>
|
#include <KWaylandServer/plasmavirtualdesktop_interface.h>
|
||||||
|
@ -537,11 +537,10 @@ bool WaylandServer::init(InitializationFlags flags)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
KWaylandServer::LinuxDmabufUnstableV1Interface *WaylandServer::linuxDmabuf()
|
KWaylandServer::LinuxDmaBufV1ClientBufferIntegration *WaylandServer::linuxDmabuf()
|
||||||
{
|
{
|
||||||
if (!m_linuxDmabuf) {
|
if (!m_linuxDmabuf) {
|
||||||
m_linuxDmabuf = new LinuxDmabufUnstableV1Interface(m_display, m_display);
|
m_linuxDmabuf = new LinuxDmaBufV1ClientBufferIntegration(m_display);
|
||||||
m_linuxDmabuf->create();
|
|
||||||
}
|
}
|
||||||
return m_linuxDmabuf;
|
return m_linuxDmabuf;
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,8 +54,8 @@ class OutputConfigurationInterface;
|
||||||
class XdgForeignV2Interface;
|
class XdgForeignV2Interface;
|
||||||
class XdgOutputManagerV1Interface;
|
class XdgOutputManagerV1Interface;
|
||||||
class KeyStateInterface;
|
class KeyStateInterface;
|
||||||
class LinuxDmabufUnstableV1Interface;
|
class LinuxDmaBufV1ClientBufferIntegration;
|
||||||
class LinuxDmabufUnstableV1Buffer;
|
class LinuxDmaBufV1ClientBuffer;
|
||||||
class TabletManagerV2Interface;
|
class TabletManagerV2Interface;
|
||||||
class KeyboardShortcutsInhibitManagerV1Interface;
|
class KeyboardShortcutsInhibitManagerV1Interface;
|
||||||
class XdgDecorationManagerV1Interface;
|
class XdgDecorationManagerV1Interface;
|
||||||
|
@ -137,7 +137,7 @@ public:
|
||||||
|
|
||||||
bool isKeyboardShortcutsInhibited() const;
|
bool isKeyboardShortcutsInhibited() const;
|
||||||
|
|
||||||
KWaylandServer::LinuxDmabufUnstableV1Interface *linuxDmabuf();
|
KWaylandServer::LinuxDmaBufV1ClientBufferIntegration *linuxDmabuf();
|
||||||
|
|
||||||
KWaylandServer::InputMethodV1Interface *inputMethod() const {
|
KWaylandServer::InputMethodV1Interface *inputMethod() const {
|
||||||
return m_inputMethod;
|
return m_inputMethod;
|
||||||
|
@ -235,13 +235,13 @@ public:
|
||||||
void simulateUserActivity();
|
void simulateUserActivity();
|
||||||
void updateKeyState(KWin::Xkb::LEDs leds);
|
void updateKeyState(KWin::Xkb::LEDs leds);
|
||||||
|
|
||||||
QSet<KWaylandServer::LinuxDmabufUnstableV1Buffer*> linuxDmabufBuffers() const {
|
QSet<KWaylandServer::LinuxDmaBufV1ClientBuffer*> linuxDmabufBuffers() const {
|
||||||
return m_linuxDmabufBuffers;
|
return m_linuxDmabufBuffers;
|
||||||
}
|
}
|
||||||
void addLinuxDmabufBuffer(KWaylandServer::LinuxDmabufUnstableV1Buffer *buffer) {
|
void addLinuxDmabufBuffer(KWaylandServer::LinuxDmaBufV1ClientBuffer *buffer) {
|
||||||
m_linuxDmabufBuffers << buffer;
|
m_linuxDmabufBuffers << buffer;
|
||||||
}
|
}
|
||||||
void removeLinuxDmabufBuffer(KWaylandServer::LinuxDmabufUnstableV1Buffer *buffer) {
|
void removeLinuxDmabufBuffer(KWaylandServer::LinuxDmaBufV1ClientBuffer *buffer) {
|
||||||
m_linuxDmabufBuffers.remove(buffer);
|
m_linuxDmabufBuffers.remove(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -288,9 +288,9 @@ private:
|
||||||
KWaylandServer::IdleInterface *m_idle = nullptr;
|
KWaylandServer::IdleInterface *m_idle = nullptr;
|
||||||
KWaylandServer::XdgOutputManagerV1Interface *m_xdgOutputManagerV1 = nullptr;
|
KWaylandServer::XdgOutputManagerV1Interface *m_xdgOutputManagerV1 = nullptr;
|
||||||
KWaylandServer::XdgDecorationManagerV1Interface *m_xdgDecorationManagerV1 = nullptr;
|
KWaylandServer::XdgDecorationManagerV1Interface *m_xdgDecorationManagerV1 = nullptr;
|
||||||
KWaylandServer::LinuxDmabufUnstableV1Interface *m_linuxDmabuf = nullptr;
|
KWaylandServer::LinuxDmaBufV1ClientBufferIntegration *m_linuxDmabuf = nullptr;
|
||||||
KWaylandServer::KeyboardShortcutsInhibitManagerV1Interface *m_keyboardShortcutsInhibitManager = nullptr;
|
KWaylandServer::KeyboardShortcutsInhibitManagerV1Interface *m_keyboardShortcutsInhibitManager = nullptr;
|
||||||
QSet<KWaylandServer::LinuxDmabufUnstableV1Buffer*> m_linuxDmabufBuffers;
|
QSet<KWaylandServer::LinuxDmaBufV1ClientBuffer*> m_linuxDmabufBuffers;
|
||||||
QPointer<KWaylandServer::ClientConnection> m_xwaylandConnection;
|
QPointer<KWaylandServer::ClientConnection> m_xwaylandConnection;
|
||||||
KWaylandServer::InputMethodV1Interface *m_inputMethod = nullptr;
|
KWaylandServer::InputMethodV1Interface *m_inputMethod = nullptr;
|
||||||
KWaylandServer::ClientConnection *m_inputMethodServerConnection = nullptr;
|
KWaylandServer::ClientConnection *m_inputMethodServerConnection = nullptr;
|
||||||
|
|
|
@ -12,9 +12,9 @@
|
||||||
#include "workspace.h"
|
#include "workspace.h"
|
||||||
|
|
||||||
#include <KWaylandServer/display.h>
|
#include <KWaylandServer/display.h>
|
||||||
|
#include <KWaylandServer/clientbuffer.h>
|
||||||
#include <KWaylandServer/clientconnection.h>
|
#include <KWaylandServer/clientconnection.h>
|
||||||
#include <KWaylandServer/surface_interface.h>
|
#include <KWaylandServer/surface_interface.h>
|
||||||
#include <KWaylandServer/buffer_interface.h>
|
|
||||||
|
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,6 @@
|
||||||
#include <KDecoration2/DecoratedClient>
|
#include <KDecoration2/DecoratedClient>
|
||||||
#include <KDecoration2/Decoration>
|
#include <KDecoration2/Decoration>
|
||||||
#include <KWaylandServer/appmenu_interface.h>
|
#include <KWaylandServer/appmenu_interface.h>
|
||||||
#include <KWaylandServer/buffer_interface.h>
|
|
||||||
#include <KWaylandServer/output_interface.h>
|
#include <KWaylandServer/output_interface.h>
|
||||||
#include <KWaylandServer/plasmashell_interface.h>
|
#include <KWaylandServer/plasmashell_interface.h>
|
||||||
#include <KWaylandServer/seat_interface.h>
|
#include <KWaylandServer/seat_interface.h>
|
||||||
|
|
Loading…
Reference in New Issue