plugins/screencast: hardcode DRM_FORMAT_ARGB8888 for screencasts

It's universally supported, and our format negotiation code needs improvements to
properly handle the receiving application not suporting the actual output format
This commit is contained in:
Xaver Hugl 2024-01-24 16:03:40 +01:00 committed by Vlad Zahorodnii
parent 06230e43d6
commit bb2391133d
29 changed files with 4 additions and 119 deletions

View file

@ -79,11 +79,6 @@ void EglGbmCursorLayer::releaseBuffers()
m_surface.destroyResources();
}
quint32 EglGbmCursorLayer::format() const
{
return m_surface.currentBuffer()->buffer()->dmabufAttributes()->format;
}
std::chrono::nanoseconds EglGbmCursorLayer::queryRenderTime() const
{
return m_surface.queryRenderTime();

View file

@ -34,7 +34,6 @@ public:
QRegion currentDamage() const override;
bool checkTestBuffer() override;
void releaseBuffers() override;
quint32 format() const override;
std::chrono::nanoseconds queryRenderTime() const override;
std::optional<QSize> fixedSize() const override;

View file

@ -22,11 +22,6 @@ QRegion DrmOutputLayer::currentDamage() const
return {};
}
quint32 DrmOutputLayer::format() const
{
return DRM_FORMAT_RGBA8888;
}
std::shared_ptr<GLTexture> DrmOutputLayer::texture() const
{
return nullptr;

View file

@ -29,7 +29,6 @@ public:
virtual std::shared_ptr<GLTexture> texture() const;
virtual QRegion currentDamage() const;
virtual void releaseBuffers() = 0;
quint32 format() const override;
};
class DrmPipelineLayer : public DrmOutputLayer

View file

@ -96,11 +96,6 @@ void DrmQPainterLayer::releaseBuffers()
m_swapchain.reset();
}
quint32 DrmQPainterLayer::format() const
{
return DRM_FORMAT_XRGB8888;
}
std::chrono::nanoseconds DrmQPainterLayer::queryRenderTime() const
{
return m_renderTime;

View file

@ -33,7 +33,6 @@ public:
std::shared_ptr<DrmFramebuffer> currentBuffer() const override;
QRegion currentDamage() const override;
void releaseBuffers() override;
quint32 format() const override;
std::chrono::nanoseconds queryRenderTime() const override;
private:

View file

@ -184,14 +184,6 @@ void VirtualEglGbmLayer::releaseBuffers()
}
}
quint32 VirtualEglGbmLayer::format() const
{
if (!m_gbmSwapchain) {
return DRM_FORMAT_ARGB8888;
}
return m_gbmSwapchain->format();
}
std::chrono::nanoseconds VirtualEglGbmLayer::queryRenderTime() const
{
m_eglBackend->makeCurrent();

View file

@ -41,7 +41,6 @@ public:
QRegion currentDamage() const override;
std::shared_ptr<GLTexture> texture() const override;
void releaseBuffers() override;
quint32 format() const override;
std::chrono::nanoseconds queryRenderTime() const override;
private:

View file

@ -69,11 +69,6 @@ bool VirtualEglLayer::endFrame(const QRegion &renderedRegion, const QRegion &dam
return true;
}
quint32 VirtualEglLayer::format() const
{
return DRM_FORMAT_XRGB8888;
}
std::chrono::nanoseconds VirtualEglLayer::queryRenderTime() const
{
if (m_query) {

View file

@ -34,7 +34,6 @@ public:
bool endFrame(const QRegion &renderedRegion, const QRegion &damagedRegion) override;
std::shared_ptr<GLTexture> texture() const;
quint32 format() const override;
std::chrono::nanoseconds queryRenderTime() const override;
private:

View file

@ -59,11 +59,6 @@ QImage *VirtualQPainterLayer::image()
return m_current->view()->image();
}
quint32 VirtualQPainterLayer::format() const
{
return DRM_FORMAT_XRGB8888;
}
std::chrono::nanoseconds VirtualQPainterLayer::queryRenderTime() const
{
return m_renderTime;

View file

@ -35,7 +35,6 @@ public:
std::optional<OutputLayerBeginFrameInfo> beginFrame() override;
bool endFrame(const QRegion &renderedRegion, const QRegion &damagedRegion) override;
QImage *image();
quint32 format() const override;
std::chrono::nanoseconds queryRenderTime() const override;
private:

View file

@ -124,11 +124,6 @@ void WaylandEglPrimaryLayer::present()
m_swapchain->release(m_buffer);
}
quint32 WaylandEglPrimaryLayer::format() const
{
return m_buffer->buffer()->dmabufAttributes()->format;
}
std::chrono::nanoseconds WaylandEglPrimaryLayer::queryRenderTime() const
{
m_backend->makeCurrent();
@ -200,11 +195,6 @@ bool WaylandEglCursorLayer::endFrame(const QRegion &renderedRegion, const QRegio
return true;
}
quint32 WaylandEglCursorLayer::format() const
{
return m_buffer->buffer()->dmabufAttributes()->format;
}
std::chrono::nanoseconds WaylandEglCursorLayer::queryRenderTime() const
{
m_backend->makeCurrent();

View file

@ -41,7 +41,6 @@ public:
std::optional<OutputLayerBeginFrameInfo> beginFrame() override;
bool endFrame(const QRegion &renderedRegion, const QRegion &damagedRegion) override;
quint32 format() const override;
std::chrono::nanoseconds queryRenderTime() const override;
private:
@ -65,7 +64,6 @@ public:
std::optional<OutputLayerBeginFrameInfo> beginFrame() override;
bool endFrame(const QRegion &renderedRegion, const QRegion &damagedRegion) override;
quint32 format() const override;
std::chrono::nanoseconds queryRenderTime() const override;
private:

View file

@ -80,11 +80,6 @@ bool WaylandQPainterPrimaryLayer::endFrame(const QRegion &renderedRegion, const
return true;
}
quint32 WaylandQPainterPrimaryLayer::format() const
{
return DRM_FORMAT_RGBA8888;
}
std::chrono::nanoseconds WaylandQPainterPrimaryLayer::queryRenderTime() const
{
return m_renderTime;
@ -131,11 +126,6 @@ bool WaylandQPainterCursorLayer::endFrame(const QRegion &renderedRegion, const Q
return true;
}
quint32 WaylandQPainterCursorLayer::format() const
{
return DRM_FORMAT_RGBA8888;
}
std::chrono::nanoseconds WaylandQPainterCursorLayer::queryRenderTime() const
{
return m_renderTime;

View file

@ -39,7 +39,6 @@ public:
std::optional<OutputLayerBeginFrameInfo> beginFrame() override;
bool endFrame(const QRegion &renderedRegion, const QRegion &damagedRegion) override;
quint32 format() const override;
std::chrono::nanoseconds queryRenderTime() const override;
void present();
@ -69,7 +68,6 @@ public:
std::optional<OutputLayerBeginFrameInfo> beginFrame() override;
bool endFrame(const QRegion &renderedRegion, const QRegion &damagedRegion) override;
quint32 format() const override;
std::chrono::nanoseconds queryRenderTime() const override;
private:

View file

@ -44,11 +44,6 @@ bool EglLayer::endFrame(const QRegion &renderedRegion, const QRegion &damagedReg
return true;
}
uint EglLayer::format() const
{
return DRM_FORMAT_RGBA8888;
}
std::chrono::nanoseconds EglLayer::queryRenderTime() const
{
return m_backend->queryRenderTime();

View file

@ -33,7 +33,6 @@ public:
std::optional<OutputLayerBeginFrameInfo> beginFrame() override;
bool endFrame(const QRegion &renderedRegion, const QRegion &damagedRegion) override;
uint format() const override;
std::chrono::nanoseconds queryRenderTime() const override;
private:

View file

@ -115,11 +115,6 @@ bool GlxLayer::endFrame(const QRegion &renderedRegion, const QRegion &damagedReg
return true;
}
uint GlxLayer::format() const
{
return DRM_FORMAT_RGBA8888;
}
std::chrono::nanoseconds GlxLayer::queryRenderTime() const
{
return m_backend->queryRenderTime();

View file

@ -68,7 +68,6 @@ public:
std::optional<OutputLayerBeginFrameInfo> beginFrame() override;
bool endFrame(const QRegion &renderedRegion, const QRegion &damagedRegion) override;
uint format() const override;
std::chrono::nanoseconds queryRenderTime() const override;
private:

View file

@ -112,11 +112,6 @@ std::shared_ptr<GLTexture> X11WindowedEglPrimaryLayer::texture() const
return m_buffer->texture();
}
quint32 X11WindowedEglPrimaryLayer::format() const
{
return DRM_FORMAT_RGBA8888;
}
std::chrono::nanoseconds X11WindowedEglPrimaryLayer::queryRenderTime() const
{
m_backend->makeCurrent();
@ -175,11 +170,6 @@ bool X11WindowedEglCursorLayer::endFrame(const QRegion &renderedRegion, const QR
return true;
}
quint32 X11WindowedEglCursorLayer::format() const
{
return DRM_FORMAT_RGBA8888;
}
std::chrono::nanoseconds X11WindowedEglCursorLayer::queryRenderTime() const
{
m_backend->makeCurrent();

View file

@ -31,7 +31,6 @@ public:
std::optional<OutputLayerBeginFrameInfo> beginFrame() override;
bool endFrame(const QRegion &renderedRegion, const QRegion &damagedRegion) override;
quint32 format() const override;
std::chrono::nanoseconds queryRenderTime() const override;
std::shared_ptr<GLTexture> texture() const;
@ -55,7 +54,6 @@ public:
std::optional<OutputLayerBeginFrameInfo> beginFrame() override;
bool endFrame(const QRegion &renderedRegion, const QRegion &damagedRegion) override;
quint32 format() const override;
std::chrono::nanoseconds queryRenderTime() const override;
private:

View file

@ -90,11 +90,6 @@ void X11WindowedQPainterPrimaryLayer::present()
nullptr);
}
quint32 X11WindowedQPainterPrimaryLayer::format() const
{
return m_current->buffer()->shmAttributes()->format;
}
std::chrono::nanoseconds X11WindowedQPainterPrimaryLayer::queryRenderTime() const
{
return m_renderTime;
@ -120,11 +115,6 @@ std::optional<OutputLayerBeginFrameInfo> X11WindowedQPainterCursorLayer::beginFr
};
}
quint32 X11WindowedQPainterCursorLayer::format() const
{
return DRM_FORMAT_ARGB8888;
}
std::chrono::nanoseconds X11WindowedQPainterCursorLayer::queryRenderTime() const
{
return m_renderTime;

View file

@ -36,7 +36,6 @@ public:
std::optional<OutputLayerBeginFrameInfo> beginFrame() override;
bool endFrame(const QRegion &renderedRegion, const QRegion &damagedRegion) override;
quint32 format() const override;
std::chrono::nanoseconds queryRenderTime() const override;
void present();
@ -59,7 +58,6 @@ public:
std::optional<OutputLayerBeginFrameInfo> beginFrame() override;
bool endFrame(const QRegion &renderedRegion, const QRegion &damagedRegion) override;
quint32 format() const override;
std::chrono::nanoseconds queryRenderTime() const override;
private:

View file

@ -133,12 +133,6 @@ void Compositor::handleFrameRequested(RenderLoop *renderLoop)
composite(renderLoop);
}
uint Compositor::outputFormat(Output *output)
{
OutputLayer *primaryLayer = m_backend->primaryLayer(output);
return primaryLayer->format();
}
void Compositor::composite(RenderLoop *renderLoop)
{
if (m_backend->checkGraphicsReset()) {

View file

@ -110,13 +110,6 @@ public:
*/
virtual bool openGLCompositingIsBroken() const;
/**
* @returns the format of the contents in the @p output
*
* This format is provided using the drm fourcc encoding
*/
uint outputFormat(Output *output);
virtual void inhibit(Window *window);
virtual void uninhibit(Window *window);

View file

@ -65,11 +65,6 @@ public:
virtual std::optional<OutputLayerBeginFrameInfo> beginFrame() = 0;
virtual bool endFrame(const QRegion &renderedRegion, const QRegion &damagedRegion) = 0;
/**
* Format in which the output data is internally stored in a drm fourcc format
*/
virtual quint32 format() const = 0;
/**
* Tries to import the newest buffer of the surface for direct scanout
* Returns @c true if scanout succeeds, @c false if rendering is necessary

View file

@ -14,6 +14,8 @@
#include "opengl/glutils.h"
#include "scene/workspacescene.h"
#include <drm_fourcc.h>
namespace KWin
{
@ -36,7 +38,7 @@ bool OutputScreenCastSource::hasAlphaChannel() const
quint32 OutputScreenCastSource::drmFormat() const
{
return Compositor::self()->outputFormat(m_output);
return DRM_FORMAT_ARGB8888;
}
QSize OutputScreenCastSource::textureSize() const

View file

@ -33,7 +33,7 @@ WindowScreenCastSource::WindowScreenCastSource(Window *window, QObject *parent)
quint32 WindowScreenCastSource::drmFormat() const
{
return DRM_FORMAT_RGBA8888;
return DRM_FORMAT_ARGB8888;
}
bool WindowScreenCastSource::hasAlphaChannel() const