kwin/src/dmabuftexture.h
Vlad Zahorodnii c3c87ed8fa plugins/screencast: Introduce base ScreenCastSource type
Currently, when screencasting a window, kwin may render a window into a
temporary offscreen texture, copy that offscreen texture to the dma-buf
render target, and discard the offscreen texture.

Allocating and deallocating offscreen textures is inefficient. Another
issue is that the screencast plugin uses Scene::Window::windowTexture().
It's a blocker for killing scene windows.

This change introduces a base ScreenCastSource type. It allows us to
move away from Scene::Window::windowTexture() and make the dma-buf code
path efficient with applications such as Firefox that utilize
sub-surfaces.

With the ScreenCastSource, kwin can also provide screen cast frames with
arbitrary device pixel ratio.
2021-11-16 07:24:03 +00:00

32 lines
653 B
C++

/*
SPDX-FileCopyrightText: 2020 Aleix Pol Gonzalez <aleixpol@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
#pragma once
#include "kwin_export.h"
#include <QScopedPointer>
namespace KWin
{
class GLRenderTarget;
class GLTexture;
class KWIN_EXPORT DmaBufTexture
{
public:
explicit DmaBufTexture(KWin::GLTexture* texture);
virtual ~DmaBufTexture();
virtual quint32 stride() const = 0;
virtual int fd() const = 0;
KWin::GLTexture *texture() const;
KWin::GLRenderTarget* framebuffer() const;
protected:
QScopedPointer<KWin::GLTexture> m_texture;
QScopedPointer<KWin::GLRenderTarget> m_framebuffer;
};
}