[wayland] Add support for zwp_linux_dmabuf
Summary: This adds support for LinuxDmabufUnstableV1Interface in kwin.
Test Plan: Session starts. `weston-simple-dmabuf-egl` and `weston-simple-dmabuf-drm` execute without errors.
Reviewers: #kwin, #plasma, davidedmundson, mart, graesslin, fredrik
Subscribers: meven, zzag, romangg, anthonyfieroni, plasma-devel, kwin
Tags: #kwin
Maniphest Tasks: T8067
Differential Revision: https://phabricator.kde.org/D10750
2019-06-30 23:13:26 +00:00
|
|
|
/********************************************************************
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
|
|
|
|
|
|
|
Copyright © 2019 Roman Gilg <subdiff@gmail.com>
|
|
|
|
Copyright © 2018 Fredrik Höglund <fredrik@kde.org>
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*********************************************************************/
|
|
|
|
#pragma once
|
|
|
|
|
2019-10-26 03:40:01 +00:00
|
|
|
#include "../../../linux_dmabuf.h"
|
[wayland] Add support for zwp_linux_dmabuf
Summary: This adds support for LinuxDmabufUnstableV1Interface in kwin.
Test Plan: Session starts. `weston-simple-dmabuf-egl` and `weston-simple-dmabuf-drm` execute without errors.
Reviewers: #kwin, #plasma, davidedmundson, mart, graesslin, fredrik
Subscribers: meven, zzag, romangg, anthonyfieroni, plasma-devel, kwin
Tags: #kwin
Maniphest Tasks: T8067
Differential Revision: https://phabricator.kde.org/D10750
2019-06-30 23:13:26 +00:00
|
|
|
|
2019-10-26 03:40:01 +00:00
|
|
|
#include "abstract_egl_backend.h"
|
[wayland] Add support for zwp_linux_dmabuf
Summary: This adds support for LinuxDmabufUnstableV1Interface in kwin.
Test Plan: Session starts. `weston-simple-dmabuf-egl` and `weston-simple-dmabuf-drm` execute without errors.
Reviewers: #kwin, #plasma, davidedmundson, mart, graesslin, fredrik
Subscribers: meven, zzag, romangg, anthonyfieroni, plasma-devel, kwin
Tags: #kwin
Maniphest Tasks: T8067
Differential Revision: https://phabricator.kde.org/D10750
2019-06-30 23:13:26 +00:00
|
|
|
|
|
|
|
#include <QVector>
|
|
|
|
|
|
|
|
namespace KWin
|
|
|
|
{
|
2019-10-26 03:40:01 +00:00
|
|
|
class EglDmabuf;
|
[wayland] Add support for zwp_linux_dmabuf
Summary: This adds support for LinuxDmabufUnstableV1Interface in kwin.
Test Plan: Session starts. `weston-simple-dmabuf-egl` and `weston-simple-dmabuf-drm` execute without errors.
Reviewers: #kwin, #plasma, davidedmundson, mart, graesslin, fredrik
Subscribers: meven, zzag, romangg, anthonyfieroni, plasma-devel, kwin
Tags: #kwin
Maniphest Tasks: T8067
Differential Revision: https://phabricator.kde.org/D10750
2019-06-30 23:13:26 +00:00
|
|
|
|
2019-10-26 03:40:01 +00:00
|
|
|
class EglDmabufBuffer : public DmabufBuffer
|
[wayland] Add support for zwp_linux_dmabuf
Summary: This adds support for LinuxDmabufUnstableV1Interface in kwin.
Test Plan: Session starts. `weston-simple-dmabuf-egl` and `weston-simple-dmabuf-drm` execute without errors.
Reviewers: #kwin, #plasma, davidedmundson, mart, graesslin, fredrik
Subscribers: meven, zzag, romangg, anthonyfieroni, plasma-devel, kwin
Tags: #kwin
Maniphest Tasks: T8067
Differential Revision: https://phabricator.kde.org/D10750
2019-06-30 23:13:26 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
using Plane = KWayland::Server::LinuxDmabufUnstableV1Interface::Plane;
|
|
|
|
using Flags = KWayland::Server::LinuxDmabufUnstableV1Interface::Flags;
|
|
|
|
|
|
|
|
enum class ImportType {
|
|
|
|
Direct,
|
|
|
|
Conversion
|
|
|
|
};
|
|
|
|
|
2019-10-26 03:40:01 +00:00
|
|
|
EglDmabufBuffer(EGLImage image,
|
|
|
|
const QVector<Plane> &planes,
|
|
|
|
uint32_t format,
|
|
|
|
const QSize &size,
|
|
|
|
Flags flags,
|
|
|
|
EglDmabuf *interfaceImpl);
|
[wayland] Add support for zwp_linux_dmabuf
Summary: This adds support for LinuxDmabufUnstableV1Interface in kwin.
Test Plan: Session starts. `weston-simple-dmabuf-egl` and `weston-simple-dmabuf-drm` execute without errors.
Reviewers: #kwin, #plasma, davidedmundson, mart, graesslin, fredrik
Subscribers: meven, zzag, romangg, anthonyfieroni, plasma-devel, kwin
Tags: #kwin
Maniphest Tasks: T8067
Differential Revision: https://phabricator.kde.org/D10750
2019-06-30 23:13:26 +00:00
|
|
|
|
2019-10-26 03:40:01 +00:00
|
|
|
EglDmabufBuffer(const QVector<Plane> &planes,
|
|
|
|
uint32_t format,
|
|
|
|
const QSize &size,
|
|
|
|
Flags flags,
|
|
|
|
EglDmabuf *interfaceImpl);
|
[wayland] Add support for zwp_linux_dmabuf
Summary: This adds support for LinuxDmabufUnstableV1Interface in kwin.
Test Plan: Session starts. `weston-simple-dmabuf-egl` and `weston-simple-dmabuf-drm` execute without errors.
Reviewers: #kwin, #plasma, davidedmundson, mart, graesslin, fredrik
Subscribers: meven, zzag, romangg, anthonyfieroni, plasma-devel, kwin
Tags: #kwin
Maniphest Tasks: T8067
Differential Revision: https://phabricator.kde.org/D10750
2019-06-30 23:13:26 +00:00
|
|
|
|
2019-10-26 03:40:01 +00:00
|
|
|
~EglDmabufBuffer() override;
|
[wayland] Add support for zwp_linux_dmabuf
Summary: This adds support for LinuxDmabufUnstableV1Interface in kwin.
Test Plan: Session starts. `weston-simple-dmabuf-egl` and `weston-simple-dmabuf-drm` execute without errors.
Reviewers: #kwin, #plasma, davidedmundson, mart, graesslin, fredrik
Subscribers: meven, zzag, romangg, anthonyfieroni, plasma-devel, kwin
Tags: #kwin
Maniphest Tasks: T8067
Differential Revision: https://phabricator.kde.org/D10750
2019-06-30 23:13:26 +00:00
|
|
|
|
2019-10-26 03:40:01 +00:00
|
|
|
void setInterfaceImplementation(EglDmabuf *interfaceImpl);
|
[wayland] Add support for zwp_linux_dmabuf
Summary: This adds support for LinuxDmabufUnstableV1Interface in kwin.
Test Plan: Session starts. `weston-simple-dmabuf-egl` and `weston-simple-dmabuf-drm` execute without errors.
Reviewers: #kwin, #plasma, davidedmundson, mart, graesslin, fredrik
Subscribers: meven, zzag, romangg, anthonyfieroni, plasma-devel, kwin
Tags: #kwin
Maniphest Tasks: T8067
Differential Revision: https://phabricator.kde.org/D10750
2019-06-30 23:13:26 +00:00
|
|
|
void addImage(EGLImage image);
|
|
|
|
void removeImages();
|
|
|
|
|
|
|
|
QVector<EGLImage> images() const { return m_images; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
QVector<EGLImage> m_images;
|
2019-10-26 03:40:01 +00:00
|
|
|
EglDmabuf *m_interfaceImpl;
|
[wayland] Add support for zwp_linux_dmabuf
Summary: This adds support for LinuxDmabufUnstableV1Interface in kwin.
Test Plan: Session starts. `weston-simple-dmabuf-egl` and `weston-simple-dmabuf-drm` execute without errors.
Reviewers: #kwin, #plasma, davidedmundson, mart, graesslin, fredrik
Subscribers: meven, zzag, romangg, anthonyfieroni, plasma-devel, kwin
Tags: #kwin
Maniphest Tasks: T8067
Differential Revision: https://phabricator.kde.org/D10750
2019-06-30 23:13:26 +00:00
|
|
|
ImportType m_importType;
|
|
|
|
};
|
|
|
|
|
2019-10-26 03:40:01 +00:00
|
|
|
class EglDmabuf : public LinuxDmabuf
|
[wayland] Add support for zwp_linux_dmabuf
Summary: This adds support for LinuxDmabufUnstableV1Interface in kwin.
Test Plan: Session starts. `weston-simple-dmabuf-egl` and `weston-simple-dmabuf-drm` execute without errors.
Reviewers: #kwin, #plasma, davidedmundson, mart, graesslin, fredrik
Subscribers: meven, zzag, romangg, anthonyfieroni, plasma-devel, kwin
Tags: #kwin
Maniphest Tasks: T8067
Differential Revision: https://phabricator.kde.org/D10750
2019-06-30 23:13:26 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
using Plane = KWayland::Server::LinuxDmabufUnstableV1Interface::Plane;
|
|
|
|
using Flags = KWayland::Server::LinuxDmabufUnstableV1Interface::Flags;
|
|
|
|
|
2019-10-26 03:40:01 +00:00
|
|
|
static EglDmabuf* factory(AbstractEglBackend *backend);
|
[wayland] Add support for zwp_linux_dmabuf
Summary: This adds support for LinuxDmabufUnstableV1Interface in kwin.
Test Plan: Session starts. `weston-simple-dmabuf-egl` and `weston-simple-dmabuf-drm` execute without errors.
Reviewers: #kwin, #plasma, davidedmundson, mart, graesslin, fredrik
Subscribers: meven, zzag, romangg, anthonyfieroni, plasma-devel, kwin
Tags: #kwin
Maniphest Tasks: T8067
Differential Revision: https://phabricator.kde.org/D10750
2019-06-30 23:13:26 +00:00
|
|
|
|
2019-10-26 03:40:01 +00:00
|
|
|
explicit EglDmabuf(AbstractEglBackend *backend);
|
|
|
|
~EglDmabuf();
|
[wayland] Add support for zwp_linux_dmabuf
Summary: This adds support for LinuxDmabufUnstableV1Interface in kwin.
Test Plan: Session starts. `weston-simple-dmabuf-egl` and `weston-simple-dmabuf-drm` execute without errors.
Reviewers: #kwin, #plasma, davidedmundson, mart, graesslin, fredrik
Subscribers: meven, zzag, romangg, anthonyfieroni, plasma-devel, kwin
Tags: #kwin
Maniphest Tasks: T8067
Differential Revision: https://phabricator.kde.org/D10750
2019-06-30 23:13:26 +00:00
|
|
|
|
|
|
|
KWayland::Server::LinuxDmabufUnstableV1Buffer *importBuffer(const QVector<Plane> &planes,
|
|
|
|
uint32_t format,
|
|
|
|
const QSize &size,
|
|
|
|
Flags flags) override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
EGLImage createImage(const QVector<Plane> &planes,
|
|
|
|
uint32_t format,
|
|
|
|
const QSize &size);
|
|
|
|
|
|
|
|
KWayland::Server::LinuxDmabufUnstableV1Buffer *yuvImport(const QVector<Plane> &planes,
|
|
|
|
uint32_t format,
|
|
|
|
const QSize &size,
|
|
|
|
Flags flags);
|
|
|
|
|
|
|
|
void setSupportedFormatsAndModifiers();
|
|
|
|
|
|
|
|
AbstractEglBackend *m_backend;
|
|
|
|
|
2019-10-26 03:40:01 +00:00
|
|
|
friend class EglDmabufBuffer;
|
[wayland] Add support for zwp_linux_dmabuf
Summary: This adds support for LinuxDmabufUnstableV1Interface in kwin.
Test Plan: Session starts. `weston-simple-dmabuf-egl` and `weston-simple-dmabuf-drm` execute without errors.
Reviewers: #kwin, #plasma, davidedmundson, mart, graesslin, fredrik
Subscribers: meven, zzag, romangg, anthonyfieroni, plasma-devel, kwin
Tags: #kwin
Maniphest Tasks: T8067
Differential Revision: https://phabricator.kde.org/D10750
2019-06-30 23:13:26 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|