Remove screenGeometryChanged() in OpenGLBackend and QPainterBackend

The screenGeometryChanged() function is very X11-specific. On Wayland,
it's effectively unused.
This commit is contained in:
Vlad Zahorodnii 2021-07-26 10:39:21 +03:00
parent 4ecb00889c
commit cb219da766
24 changed files with 18 additions and 90 deletions

View file

@ -783,7 +783,6 @@ bool EffectsHandlerImpl::hasKeyboardGrab() const
void EffectsHandlerImpl::desktopResized(const QSize &size)
{
m_scene->screenGeometryChanged(size);
Q_EMIT screenGeometryChanged(size);
}

View file

@ -51,8 +51,6 @@ public:
virtual void init() = 0;
virtual void screenGeometryChanged(const QSize &size) = 0;
virtual PlatformSurfaceTexture *createPlatformSurfaceTextureInternal(SurfacePixmapInternal *pixmap);
virtual PlatformSurfaceTexture *createPlatformSurfaceTextureX11(SurfacePixmapX11 *pixmap);
virtual PlatformSurfaceTexture *createPlatformSurfaceTextureWayland(SurfacePixmapWayland *pixmap);

View file

@ -35,11 +35,6 @@ PlatformSurfaceTexture *QPainterBackend::createPlatformSurfaceTextureWayland(Sur
return new PlatformQPainterSurfaceTextureWayland(this, pixmap);
}
void QPainterBackend::screenGeometryChanged(const QSize &size)
{
Q_UNUSED(size)
}
void QPainterBackend::setFailed(const QString &reason)
{
qCWarning(KWIN_QPAINTER) << "Creating the QPainter backend failed: " << reason;

View file

@ -35,14 +35,6 @@ public:
virtual void endFrame(int screenId, const QRegion &damage) = 0;
virtual QRegion beginFrame(int screenId) = 0;
/**
* @brief React on screen geometry changes.
*
* Default implementation does nothing. Override if specific functionality is required.
*
* @param size The new screen size
*/
virtual void screenGeometryChanged(const QSize &size);
/**
* @brief Whether the creation of the Backend failed.
*

View file

@ -23,8 +23,3 @@ AbstractEglDrmBackend::AbstractEglDrmBackend(DrmBackend *drmBackend, DrmGpu *gpu
connect(m_gpu, &DrmGpu::outputEnabled, this, &AbstractEglDrmBackend::addOutput);
connect(m_gpu, &DrmGpu::outputDisabled, this, &AbstractEglDrmBackend::removeOutput);
}
void AbstractEglDrmBackend::screenGeometryChanged(const QSize &size)
{
Q_UNUSED(size)
}

View file

@ -25,8 +25,6 @@ class AbstractEglDrmBackend : public AbstractEglBackend
Q_OBJECT
public:
void screenGeometryChanged(const QSize &size) override;
virtual int screenCount() const = 0;
virtual bool addOutput(DrmOutput *output) = 0;
virtual void removeOutput(DrmOutput *output) = 0;

View file

@ -108,11 +108,6 @@ QSharedPointer<GLTexture> EglMultiBackend::textureForOutput(AbstractOutput *requ
return m_backends[0]->textureForOutput(requestedOutput);
}
void EglMultiBackend::screenGeometryChanged(const QSize &size)
{
Q_UNUSED(size)
}
AbstractEglDrmBackend *EglMultiBackend::findBackend(int screenId, int& internalScreenId) const
{
int screens = 0;

View file

@ -35,8 +35,6 @@ public:
PlatformSurfaceTexture *createPlatformSurfaceTextureWayland(SurfacePixmapWayland *pixmap) override;
QSharedPointer<GLTexture> textureForOutput(AbstractOutput *requestedOutput) const override;
void screenGeometryChanged(const QSize &size) override;
bool directScanoutAllowed(int screen) const override;
public Q_SLOTS:

View file

@ -145,12 +145,6 @@ bool EglGbmBackend::initBufferConfigs()
return true;
}
void EglGbmBackend::screenGeometryChanged(const QSize &size)
{
Q_UNUSED(size)
// TODO, create new buffer?
}
PlatformSurfaceTexture *EglGbmBackend::createPlatformSurfaceTextureInternal(SurfacePixmapInternal *pixmap)
{
return new BasicEGLSurfaceTextureInternal(this, pixmap);

View file

@ -26,7 +26,6 @@ class EglGbmBackend : public AbstractEglBackend
public:
EglGbmBackend(VirtualBackend *b);
~EglGbmBackend() override;
void screenGeometryChanged(const QSize &size) override;
PlatformSurfaceTexture *createPlatformSurfaceTextureInternal(SurfacePixmapInternal *pixmap) override;
PlatformSurfaceTexture *createPlatformSurfaceTextureWayland(SurfacePixmapWayland *pixmap) override;
QRegion beginFrame(int screenId) override;

View file

@ -75,6 +75,7 @@ bool EglWaylandOutput::init(EglWaylandBackend *backend)
connect(m_waylandOutput, &WaylandOutput::sizeChanged, this, &EglWaylandOutput::updateSize);
connect(m_waylandOutput, &WaylandOutput::modeChanged, this, &EglWaylandOutput::updateSize);
connect(m_waylandOutput, &WaylandOutput::geometryChanged, this, &EglWaylandOutput::resetBufferAge);
return true;
}
@ -83,6 +84,12 @@ void EglWaylandOutput::updateSize()
{
const QSize nativeSize = m_waylandOutput->geometry().size() * m_waylandOutput->scale();
wl_egl_window_resize(m_overlay, nativeSize.width(), nativeSize.height(), 0, 0);
resetBufferAge();
}
void EglWaylandOutput::resetBufferAge()
{
m_bufferAge = 0;
}
EglWaylandBackend::EglWaylandBackend(WaylandBackend *b)
@ -333,18 +340,6 @@ void EglWaylandBackend::presentOnSurface(EglWaylandOutput *output, const QRegion
}
void EglWaylandBackend::screenGeometryChanged(const QSize &size)
{
Q_UNUSED(size)
// no backend specific code needed
// TODO: base implementation in OpenGLBackend
// The back buffer contents are now undefined
for (auto *output : qAsConst(m_outputs)) {
output->m_bufferAge = 0;
}
}
PlatformSurfaceTexture *EglWaylandBackend::createPlatformSurfaceTextureInternal(SurfacePixmapInternal *pixmap)
{
return new BasicEGLSurfaceTextureInternal(this, pixmap);

View file

@ -38,6 +38,8 @@ public:
void updateSize();
private:
void resetBufferAge();
WaylandOutput *m_waylandOutput;
wl_egl_window *m_overlay = nullptr;
EGLSurface m_eglSurface = EGL_NO_SURFACE;
@ -69,7 +71,6 @@ public:
PlatformSurfaceTexture *createPlatformSurfaceTextureInternal(SurfacePixmapInternal *pixmap) override;
PlatformSurfaceTexture *createPlatformSurfaceTextureWayland(SurfacePixmapWayland *pixmap) override;
void screenGeometryChanged(const QSize &size) override;
QRegion beginFrame(int screenId) override;
void endFrame(int screenId, const QRegion &damage, const QRegion &damagedRegion) override;
void init() override;

View file

@ -37,6 +37,7 @@ EglBackend::EglBackend(Display *display, X11StandalonePlatform *backend)
m_vsyncMonitor->setRefreshRate(backend->renderLoop()->refreshRate());
connect(m_vsyncMonitor, &VsyncMonitor::vblankOccurred, this, &EglBackend::vblank);
connect(screens(), &Screens::sizeChanged, this, &EglBackend::screenGeometryChanged);
}
EglBackend::~EglBackend()
@ -79,9 +80,9 @@ void EglBackend::init()
EglOnXBackend::init();
}
void EglBackend::screenGeometryChanged(const QSize &size)
void EglBackend::screenGeometryChanged()
{
overlayWindow()->resize(size);
overlayWindow()->resize(screens()->size());
// The back buffer contents are now undefined
m_bufferAge = 0;

View file

@ -32,9 +32,9 @@ public:
PlatformSurfaceTexture *createPlatformSurfaceTextureX11(SurfacePixmapX11 *texture) override;
QRegion beginFrame(int screenId) override;
void endFrame(int screenId, const QRegion &damage, const QRegion &damagedRegion) override;
void screenGeometryChanged(const QSize &size) override;
private:
void screenGeometryChanged();
void presentSurface(EGLSurface surface, const QRegion &damage, const QRect &screenGeometry);
void vblank(std::chrono::nanoseconds timestamp);

View file

@ -111,6 +111,8 @@ GlxBackend::GlxBackend(Display *display, X11StandalonePlatform *backend)
// to make it call XESetWireToEvent callbacks, which is required
// by Mesa when using DRI2.
QOpenGLContext::supportsThreadedOpenGL();
connect(screens(), &Screens::sizeChanged, this, &GlxBackend::screenGeometryChanged);
}
GlxBackend::~GlxBackend()
@ -719,8 +721,9 @@ void GlxBackend::present(const QRegion &damage)
}
}
void GlxBackend::screenGeometryChanged(const QSize &size)
void GlxBackend::screenGeometryChanged()
{
const QSize size = screens()->size();
doneCurrent();
XMoveResizeWindow(display(), window, 0, 0, size.width(), size.height());

View file

@ -70,7 +70,6 @@ class GlxBackend : public OpenGLBackend
public:
GlxBackend(Display *display, X11StandalonePlatform *backend);
~GlxBackend() override;
void screenGeometryChanged(const QSize &size) override;
PlatformSurfaceTexture *createPlatformSurfaceTextureX11(SurfacePixmapX11 *pixmap) override;
QRegion beginFrame(int screenId) override;
void endFrame(int screenId, const QRegion &damage, const QRegion &damagedRegion) override;
@ -91,6 +90,7 @@ private:
bool initFbConfig();
void initVisualDepthHashTable();
void setSwapInterval(int interval);
void screenGeometryChanged();
int visualDepth(xcb_visualid_t visual) const;
FBConfigInfo *infoForVisual(xcb_visualid_t visual);

View file

@ -104,11 +104,6 @@ void EglX11Backend::presentSurface(EGLSurface surface, const QRegion &damage, co
}
}
void EglX11Backend::screenGeometryChanged(const QSize &size)
{
Q_UNUSED(size)
}
PlatformSurfaceTexture *EglX11Backend::createPlatformSurfaceTextureWayland(SurfacePixmapWayland *pixmap)
{
return new BasicEGLSurfaceTextureWayland(this, pixmap);

View file

@ -31,7 +31,6 @@ public:
void init() override;
QRegion beginFrame(int screenId) override;
void endFrame(int screenId, const QRegion &damage, const QRegion &damagedRegion) override;
void screenGeometryChanged(const QSize &size) override;
protected:
void cleanupSurfaces() override;

View file

@ -558,15 +558,6 @@ bool SceneOpenGL::viewportLimitsMatched(const QSize &size) const {
return true;
}
void SceneOpenGL::screenGeometryChanged(const QSize &size)
{
if (!viewportLimitsMatched(size))
return;
Scene::screenGeometryChanged(size);
m_backend->screenGeometryChanged(size);
GLRenderTarget::setVirtualScreenSize(size);
}
void SceneOpenGL::paintDesktop(int desktop, int mask, const QRegion &region, ScreenPaintData &data)
{
const QRect r = region.boundingRect();

View file

@ -36,7 +36,6 @@ public:
RenderLoop *renderLoop) override;
Scene::EffectFrame *createEffectFrame(EffectFrameImpl *frame) override;
Shadow *createShadow(Toplevel *toplevel) override;
void screenGeometryChanged(const QSize &size) override;
OverlayWindow *overlayWindow() const override;
bool makeOpenGLContextCurrent() override;
void doneOpenGLContextCurrent() override;

View file

@ -159,12 +159,6 @@ Shadow *SceneQPainter::createShadow(Toplevel *toplevel)
return new SceneQPainterShadow(toplevel);
}
void SceneQPainter::screenGeometryChanged(const QSize &size)
{
Scene::screenGeometryChanged(size);
m_backend->screenGeometryChanged(size);
}
QImage *SceneQPainter::qpainterRenderBuffer(int screenId) const
{
return m_backend->bufferForScreen(screenId);

View file

@ -32,7 +32,6 @@ public:
EffectFrame *createEffectFrame(EffectFrameImpl *frame) override;
Shadow *createShadow(Toplevel *toplevel) override;
DecorationRenderer *createDecorationRenderer(Decoration::DecoratedClientImpl *impl) override;
void screenGeometryChanged(const QSize &size) override;
PlatformSurfaceTexture *createPlatformSurfaceTextureInternal(SurfacePixmapInternal *pixmap) override;
PlatformSurfaceTexture *createPlatformSurfaceTextureWayland(SurfacePixmapWayland *pixmap) override;

View file

@ -528,11 +528,6 @@ void Scene::extendPaintRegion(QRegion &region, bool opaqueFullscreen)
Q_UNUSED(opaqueFullscreen);
}
void Scene::screenGeometryChanged(const QSize &size)
{
Q_UNUSED(size)
}
bool Scene::makeOpenGLContextCurrent()
{
return false;

View file

@ -109,13 +109,6 @@ public:
* @param toplevel The Toplevel for which the Shadow needs to be created.
*/
virtual Shadow *createShadow(Toplevel *toplevel) = 0;
/**
* Method invoked when the screen geometry is changed.
* Reimplementing classes should also invoke the parent method
* as it takes care of resizing the overlay window.
* @param size The new screen geometry size
*/
virtual void screenGeometryChanged(const QSize &size);
// Flags controlling how painting is done.
enum {
// Window (or at least part of it) will be painted opaque.