2020-07-22 17:29:23 +00:00
|
|
|
/*
|
2020-08-02 22:22:19 +00:00
|
|
|
SPDX-FileCopyrightText: 2020 Aleix Pol Gonzalez <aleixpol@kde.org>
|
|
|
|
|
|
|
|
SPDX-License-Identifier: LGPL-2.0-or-later
|
|
|
|
*/
|
2020-07-22 17:29:23 +00:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
#include "kwin_export.h"
|
2022-05-13 09:06:17 +00:00
|
|
|
|
2022-05-17 10:36:34 +00:00
|
|
|
#include <memory>
|
2020-07-22 17:29:23 +00:00
|
|
|
|
|
|
|
namespace KWin
|
|
|
|
{
|
2022-04-11 16:46:10 +00:00
|
|
|
class GLFramebuffer;
|
2020-07-22 17:29:23 +00:00
|
|
|
class GLTexture;
|
|
|
|
|
2022-05-13 09:06:17 +00:00
|
|
|
struct DmaBufAttributes
|
|
|
|
{
|
2022-06-11 08:26:43 +00:00
|
|
|
int planeCount = 0;
|
|
|
|
int width = 0;
|
|
|
|
int height = 0;
|
|
|
|
uint32_t format = 0;
|
|
|
|
uint64_t modifier = 0;
|
|
|
|
|
|
|
|
int fd[4] = {-1, -1, -1, -1};
|
|
|
|
int offset[4] = {0, 0, 0, 0};
|
|
|
|
int pitch[4] = {0, 0, 0, 0};
|
2022-05-13 09:06:17 +00:00
|
|
|
};
|
|
|
|
|
2020-07-22 17:29:23 +00:00
|
|
|
class KWIN_EXPORT DmaBufTexture
|
|
|
|
{
|
|
|
|
public:
|
2022-05-17 10:36:34 +00:00
|
|
|
explicit DmaBufTexture(std::shared_ptr<GLTexture> texture, const DmaBufAttributes &attributes);
|
2020-07-22 17:29:23 +00:00
|
|
|
virtual ~DmaBufTexture();
|
|
|
|
|
2022-05-13 09:06:17 +00:00
|
|
|
DmaBufAttributes attributes() const;
|
|
|
|
GLTexture *texture() const;
|
|
|
|
GLFramebuffer *framebuffer() const;
|
2020-07-22 17:29:23 +00:00
|
|
|
|
|
|
|
protected:
|
2022-05-17 10:36:34 +00:00
|
|
|
std::shared_ptr<GLTexture> m_texture;
|
|
|
|
std::unique_ptr<GLFramebuffer> m_framebuffer;
|
2022-05-13 09:06:17 +00:00
|
|
|
DmaBufAttributes m_attributes;
|
2020-07-22 17:29:23 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|