diff --git a/src/backends/wayland/wayland_qpainter_backend.cpp b/src/backends/wayland/wayland_qpainter_backend.cpp index a7b77ed7e0..f4e1bcbcdd 100644 --- a/src/backends/wayland/wayland_qpainter_backend.cpp +++ b/src/backends/wayland/wayland_qpainter_backend.cpp @@ -10,7 +10,6 @@ #include "wayland_qpainter_backend.h" #include "core/shmgraphicsbufferallocator.h" #include "wayland_backend.h" -#include "wayland_display.h" #include "wayland_logging.h" #include "wayland_output.h" @@ -38,7 +37,7 @@ static QImage::Format drmFormatToQImageFormat(uint32_t drmFormat) } } -WaylandQPainterBufferSlot::WaylandQPainterBufferSlot(WaylandDisplay *display, ShmGraphicsBuffer *graphicsBuffer) +WaylandQPainterBufferSlot::WaylandQPainterBufferSlot(ShmGraphicsBuffer *graphicsBuffer) : graphicsBuffer(graphicsBuffer) { const ShmAttributes *attributes = graphicsBuffer->shmAttributes(); @@ -62,9 +61,8 @@ WaylandQPainterBufferSlot::~WaylandQPainterBufferSlot() graphicsBuffer->drop(); } -WaylandQPainterSwapchain::WaylandQPainterSwapchain(WaylandOutput *output, const QSize &size, uint32_t format) +WaylandQPainterSwapchain::WaylandQPainterSwapchain(const QSize &size, uint32_t format) : m_allocator(std::make_unique()) - , m_output(output) , m_size(size) , m_format(format) { @@ -89,7 +87,7 @@ std::shared_ptr WaylandQPainterSwapchain::acquire() return nullptr; } - auto slot = std::make_shared(m_output->backend()->display(), buffer); + auto slot = std::make_shared(buffer); m_slots.push_back(slot); return slot; @@ -134,7 +132,7 @@ std::optional WaylandQPainterPrimaryLayer::beginFrame { const QSize nativeSize(m_waylandOutput->modeSize()); if (!m_swapchain || m_swapchain->size() != nativeSize) { - m_swapchain = std::make_unique(m_waylandOutput, nativeSize, DRM_FORMAT_XRGB8888); + m_swapchain = std::make_unique(nativeSize, DRM_FORMAT_XRGB8888); } m_back = m_swapchain->acquire(); @@ -169,7 +167,7 @@ std::optional WaylandQPainterCursorLayer::beginFrame( const auto tmp = size().expandedTo(QSize(64, 64)); const QSize bufferSize(std::ceil(tmp.width()), std::ceil(tmp.height())); if (!m_swapchain || m_swapchain->size() != bufferSize) { - m_swapchain = std::make_unique(m_output, bufferSize, DRM_FORMAT_ARGB8888); + m_swapchain = std::make_unique(bufferSize, DRM_FORMAT_ARGB8888); } m_back = m_swapchain->acquire(); diff --git a/src/backends/wayland/wayland_qpainter_backend.h b/src/backends/wayland/wayland_qpainter_backend.h index b23d71e6d3..ab7eb84e3a 100644 --- a/src/backends/wayland/wayland_qpainter_backend.h +++ b/src/backends/wayland/wayland_qpainter_backend.h @@ -32,7 +32,7 @@ class WaylandQPainterBackend; class WaylandQPainterBufferSlot { public: - WaylandQPainterBufferSlot(WaylandDisplay *display, ShmGraphicsBuffer *graphicsBuffer); + WaylandQPainterBufferSlot(ShmGraphicsBuffer *graphicsBuffer); ~WaylandQPainterBufferSlot(); ShmGraphicsBuffer *graphicsBuffer; @@ -45,7 +45,7 @@ public: class WaylandQPainterSwapchain { public: - WaylandQPainterSwapchain(WaylandOutput *output, const QSize &size, uint32_t format); + WaylandQPainterSwapchain(const QSize &size, uint32_t format); QSize size() const; @@ -54,7 +54,6 @@ public: private: std::unique_ptr m_allocator; - WaylandOutput *m_output; QSize m_size; uint32_t m_format; std::vector> m_slots; diff --git a/src/backends/x11/windowed/x11_windowed_qpainter_backend.cpp b/src/backends/x11/windowed/x11_windowed_qpainter_backend.cpp index ba681d3b8d..4305e3f81e 100644 --- a/src/backends/x11/windowed/x11_windowed_qpainter_backend.cpp +++ b/src/backends/x11/windowed/x11_windowed_qpainter_backend.cpp @@ -34,7 +34,7 @@ static QImage::Format drmFormatToQImageFormat(uint32_t drmFormat) } } -X11WindowedQPainterLayerBuffer::X11WindowedQPainterLayerBuffer(ShmGraphicsBuffer *buffer, X11WindowedOutput *output) +X11WindowedQPainterLayerBuffer::X11WindowedQPainterLayerBuffer(ShmGraphicsBuffer *buffer) : m_graphicsBuffer(buffer) { const ShmAttributes *attributes = buffer->shmAttributes(); @@ -68,9 +68,8 @@ QImage *X11WindowedQPainterLayerBuffer::view() const return m_view.get(); } -X11WindowedQPainterLayerSwapchain::X11WindowedQPainterLayerSwapchain(const QSize &size, uint32_t format, X11WindowedOutput *output) - : m_output(output) - , m_size(size) +X11WindowedQPainterLayerSwapchain::X11WindowedQPainterLayerSwapchain(const QSize &size, uint32_t format) + : m_size(size) , m_format(format) , m_allocator(std::make_unique()) { @@ -95,7 +94,7 @@ std::shared_ptr X11WindowedQPainterLayerSwapchai return nullptr; } - auto buffer = std::make_shared(graphicsBuffer, m_output); + auto buffer = std::make_shared(graphicsBuffer); m_buffers.push_back(buffer); return buffer; @@ -110,7 +109,7 @@ std::optional X11WindowedQPainterPrimaryLayer::beginF { const QSize bufferSize = m_output->modeSize(); if (!m_swapchain || m_swapchain->size() != bufferSize) { - m_swapchain = std::make_unique(bufferSize, m_output->backend()->driFormatForDepth(m_output->depth()), m_output); + m_swapchain = std::make_unique(bufferSize, m_output->backend()->driFormatForDepth(m_output->depth())); } m_current = m_swapchain->acquire(); diff --git a/src/backends/x11/windowed/x11_windowed_qpainter_backend.h b/src/backends/x11/windowed/x11_windowed_qpainter_backend.h index 32b87fd91c..ca1fca8d54 100644 --- a/src/backends/x11/windowed/x11_windowed_qpainter_backend.h +++ b/src/backends/x11/windowed/x11_windowed_qpainter_backend.h @@ -28,7 +28,7 @@ class X11WindowedOutput; class X11WindowedQPainterLayerBuffer { public: - X11WindowedQPainterLayerBuffer(ShmGraphicsBuffer *buffer, X11WindowedOutput *output); + X11WindowedQPainterLayerBuffer(ShmGraphicsBuffer *buffer); ~X11WindowedQPainterLayerBuffer(); ShmGraphicsBuffer *graphicsBuffer() const; @@ -44,14 +44,13 @@ private: class X11WindowedQPainterLayerSwapchain { public: - X11WindowedQPainterLayerSwapchain(const QSize &size, uint32_t format, X11WindowedOutput *output); + X11WindowedQPainterLayerSwapchain(const QSize &size, uint32_t format); QSize size() const; std::shared_ptr acquire(); private: - X11WindowedOutput *m_output; QSize m_size; uint32_t m_format; std::unique_ptr m_allocator;