2015-05-05 13:13:36 +00:00
|
|
|
/********************************************************************
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
|
|
|
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
Copyright 2019 Roman Gilg <subdiff@gmail.com>
|
|
|
|
Copyright 2013, 2015 Martin Gräßlin <mgraesslin@kde.org>
|
2015-05-05 13:13:36 +00:00
|
|
|
|
|
|
|
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/>.
|
|
|
|
*********************************************************************/
|
|
|
|
#include "scene_qpainter_wayland_backend.h"
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
#include "wayland_backend.h"
|
|
|
|
#include "wayland_output.h"
|
|
|
|
|
2015-05-05 13:13:36 +00:00
|
|
|
#include "composite.h"
|
2015-05-05 15:27:03 +00:00
|
|
|
#include "logging.h"
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
|
2015-05-05 13:13:36 +00:00
|
|
|
#include <KWayland/Client/buffer.h>
|
|
|
|
#include <KWayland/Client/shm_pool.h>
|
|
|
|
#include <KWayland/Client/surface.h>
|
|
|
|
|
|
|
|
namespace KWin
|
|
|
|
{
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
namespace Wayland
|
|
|
|
{
|
2015-05-05 13:13:36 +00:00
|
|
|
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
WaylandQPainterOutput::WaylandQPainterOutput(WaylandOutput *output, QObject *parent)
|
|
|
|
: QObject(parent)
|
|
|
|
, m_waylandOutput(output)
|
2015-05-05 13:13:36 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
WaylandQPainterOutput::~WaylandQPainterOutput()
|
2015-05-05 13:13:36 +00:00
|
|
|
{
|
|
|
|
if (m_buffer) {
|
|
|
|
m_buffer.toStrongRef()->setUsed(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
bool WaylandQPainterOutput::init(KWayland::Client::ShmPool *pool)
|
2015-05-05 13:13:36 +00:00
|
|
|
{
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
m_pool = pool;
|
|
|
|
m_backBuffer = QImage(QSize(), QImage::Format_RGB32);
|
|
|
|
|
|
|
|
connect(pool, &KWayland::Client::ShmPool::poolResized, this, &WaylandQPainterOutput::remapBuffer);
|
|
|
|
connect(m_waylandOutput, &WaylandOutput::sizeChanged, this, &WaylandQPainterOutput::updateSize);
|
|
|
|
|
|
|
|
return true;
|
2015-05-05 13:13:36 +00:00
|
|
|
}
|
|
|
|
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
void WaylandQPainterOutput::remapBuffer()
|
2015-05-05 13:13:36 +00:00
|
|
|
{
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
if (!m_buffer) {
|
2015-05-05 13:13:36 +00:00
|
|
|
return;
|
|
|
|
}
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
auto b = m_buffer.toStrongRef();
|
|
|
|
if (!b->isUsed()){
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
const QSize size = m_backBuffer.size();
|
|
|
|
m_backBuffer = QImage(b->address(), size.width(), size.height(), QImage::Format_RGB32);
|
|
|
|
qCDebug(KWIN_WAYLAND_BACKEND) << "Remapped back buffer of surface" << m_waylandOutput->surface();
|
2015-05-05 13:13:36 +00:00
|
|
|
}
|
|
|
|
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
void WaylandQPainterOutput::updateSize(const QSize &size)
|
2015-05-05 13:13:36 +00:00
|
|
|
{
|
|
|
|
Q_UNUSED(size)
|
|
|
|
if (!m_buffer) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_buffer.toStrongRef()->setUsed(false);
|
|
|
|
m_buffer.clear();
|
|
|
|
}
|
|
|
|
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
void WaylandQPainterOutput::present(const QRegion &damage)
|
2015-05-05 13:13:36 +00:00
|
|
|
{
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
auto s = m_waylandOutput->surface();
|
|
|
|
s->attachBuffer(m_buffer);
|
|
|
|
s->damage(damage);
|
|
|
|
s->commit();
|
2015-05-05 13:13:36 +00:00
|
|
|
}
|
|
|
|
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
void WaylandQPainterOutput::prepareRenderingFrame()
|
2015-05-05 13:13:36 +00:00
|
|
|
{
|
|
|
|
if (m_buffer) {
|
|
|
|
auto b = m_buffer.toStrongRef();
|
|
|
|
if (b->isReleased()) {
|
|
|
|
// we can re-use this buffer
|
|
|
|
b->setReleased(false);
|
|
|
|
return;
|
|
|
|
} else {
|
|
|
|
// buffer is still in use, get a new one
|
|
|
|
b->setUsed(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
m_buffer.clear();
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
|
|
|
|
const QSize size(m_waylandOutput->geometry().size());
|
|
|
|
|
|
|
|
m_buffer = m_pool->getBuffer(size, size.width() * 4);
|
2015-05-05 13:13:36 +00:00
|
|
|
if (!m_buffer) {
|
2015-05-05 15:27:03 +00:00
|
|
|
qCDebug(KWIN_WAYLAND_BACKEND) << "Did not get a new Buffer from Shm Pool";
|
2015-05-05 13:13:36 +00:00
|
|
|
m_backBuffer = QImage();
|
|
|
|
return;
|
|
|
|
}
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
|
2015-05-05 13:13:36 +00:00
|
|
|
auto b = m_buffer.toStrongRef();
|
|
|
|
b->setUsed(true);
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
|
2015-05-05 13:13:36 +00:00
|
|
|
m_backBuffer = QImage(b->address(), size.width(), size.height(), QImage::Format_RGB32);
|
|
|
|
m_backBuffer.fill(Qt::transparent);
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
// qCDebug(KWIN_WAYLAND_BACKEND) << "Created a new back buffer for output surface" << m_waylandOutput->surface();
|
2015-05-05 13:13:36 +00:00
|
|
|
}
|
|
|
|
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
WaylandQPainterBackend::WaylandQPainterBackend(Wayland::WaylandBackend *b)
|
|
|
|
: QPainterBackend()
|
|
|
|
, m_backend(b)
|
|
|
|
, m_needsFullRepaint(true)
|
2015-05-05 13:13:36 +00:00
|
|
|
{
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
|
|
|
|
const auto waylandOutputs = m_backend->waylandOutputs();
|
|
|
|
for (auto *output: waylandOutputs) {
|
|
|
|
createOutput(output);
|
2015-05-05 13:13:36 +00:00
|
|
|
}
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
connect(m_backend, &WaylandBackend::outputAdded, this, &WaylandQPainterBackend::createOutput);
|
|
|
|
connect(m_backend, &WaylandBackend::outputRemoved, this,
|
|
|
|
[this] (WaylandOutput *waylandOutput) {
|
|
|
|
auto it = std::find_if(m_outputs.begin(), m_outputs.end(),
|
|
|
|
[waylandOutput] (WaylandQPainterOutput *output) {
|
|
|
|
return output->m_waylandOutput == waylandOutput;
|
|
|
|
}
|
|
|
|
);
|
|
|
|
if (it == m_outputs.end()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
delete *it;
|
|
|
|
m_outputs.erase(it);
|
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
WaylandQPainterBackend::~WaylandQPainterBackend()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
bool WaylandQPainterBackend::usesOverlayWindow() const
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool WaylandQPainterBackend::perScreenRendering() const
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void WaylandQPainterBackend::createOutput(WaylandOutput *waylandOutput)
|
|
|
|
{
|
|
|
|
auto *output = new WaylandQPainterOutput(waylandOutput, this);
|
|
|
|
output->init(m_backend->shmPool());
|
|
|
|
m_outputs << output;
|
|
|
|
}
|
|
|
|
|
|
|
|
void WaylandQPainterBackend::present(int mask, const QRegion &damage)
|
|
|
|
{
|
|
|
|
Q_UNUSED(mask)
|
|
|
|
|
|
|
|
Compositor::self()->aboutToSwapBuffers();
|
|
|
|
m_needsFullRepaint = false;
|
|
|
|
|
|
|
|
for (auto *output : m_outputs) {
|
|
|
|
output->present(damage);
|
2015-05-05 13:13:36 +00:00
|
|
|
}
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
QImage *WaylandQPainterBackend::buffer()
|
|
|
|
{
|
|
|
|
return bufferForScreen(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
QImage *WaylandQPainterBackend::bufferForScreen(int screenId)
|
|
|
|
{
|
|
|
|
auto *output = m_outputs[screenId];
|
|
|
|
return &output->m_backBuffer;
|
|
|
|
}
|
|
|
|
|
|
|
|
void WaylandQPainterBackend::prepareRenderingFrame()
|
|
|
|
{
|
|
|
|
for (auto *output : m_outputs) {
|
|
|
|
output->prepareRenderingFrame();
|
|
|
|
}
|
|
|
|
m_needsFullRepaint = true;
|
2015-05-05 13:13:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool WaylandQPainterBackend::needsFullRepaint() const
|
|
|
|
{
|
|
|
|
return m_needsFullRepaint;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
}
|