KWin
Loading...
Searching...
No Matches
src
utils
drm_format_helper.h
Go to the documentation of this file.
1
/*
2
KWin - the KDE window manager
3
This file is part of the KDE project.
4
5
SPDX-FileCopyrightText: 2023 Xaver Hugl <xaver.hugl@gmail.com>
6
7
SPDX-License-Identifier: GPL-2.0-or-later
8
*/
9
#pragma once
10
#include "kwin_export.h"
11
12
#include <QHash>
13
#include <QList>
14
#include <QString>
15
16
#include <epoxy/gl.h>
17
#include <libdrm/drm_fourcc.h>
18
#include <optional>
19
#include <stdint.h>
20
21
namespace
KWin
22
{
23
24
struct
YuvFormat
25
{
26
uint32_t
format
= DRM_FORMAT_YUYV;
27
uint32_t
widthDivisor
= 1;
28
uint32_t
heightDivisor
= 1;
29
};
30
struct
YuvConversion
31
{
32
QList<struct YuvFormat>
plane
= {};
33
};
34
35
static
const
QHash<uint32_t, YuvConversion> s_drmConversions = {
36
{DRM_FORMAT_NV12, YuvConversion{
37
{YuvFormat{DRM_FORMAT_R8, 1, 1}, YuvFormat{DRM_FORMAT_GR88, 2, 2}},
38
}},
39
};
40
41
struct
KWIN_EXPORT
FormatInfo
42
{
43
uint32_t
drmFormat
;
44
uint32_t
bitsPerColor
;
45
uint32_t
alphaBits
;
46
uint32_t
bitsPerPixel
;
47
GLint
openglFormat
;
48
49
std::optional<YuvConversion>
yuvConversion
()
const
50
{
51
const
auto
it = s_drmConversions.find(drmFormat);
52
return
it != s_drmConversions.end() ? *it : std::optional<YuvConversion>{};
53
}
54
55
static
std::optional<FormatInfo> get(uint32_t drmFormat);
56
static
QString drmFormatName(
const
QString &prefix, uint32_t format);
57
};
58
}
KWin
Definition
activation_test.cpp:20
KWin::FormatInfo
Definition
drm_format_helper.h:42
KWin::FormatInfo::openglFormat
GLint openglFormat
Definition
drm_format_helper.h:47
KWin::FormatInfo::bitsPerColor
uint32_t bitsPerColor
Definition
drm_format_helper.h:44
KWin::FormatInfo::bitsPerPixel
uint32_t bitsPerPixel
Definition
drm_format_helper.h:46
KWin::FormatInfo::alphaBits
uint32_t alphaBits
Definition
drm_format_helper.h:45
KWin::FormatInfo::yuvConversion
std::optional< YuvConversion > yuvConversion() const
Definition
drm_format_helper.h:49
KWin::FormatInfo::drmFormat
uint32_t drmFormat
Definition
drm_format_helper.h:43
KWin::YuvConversion
Definition
drm_format_helper.h:31
KWin::YuvConversion::plane
QList< struct YuvFormat > plane
Definition
drm_format_helper.h:32
KWin::YuvFormat
Definition
drm_format_helper.h:25
KWin::YuvFormat::widthDivisor
uint32_t widthDivisor
Definition
drm_format_helper.h:27
KWin::YuvFormat::format
uint32_t format
Definition
drm_format_helper.h:26
KWin::YuvFormat::heightDivisor
uint32_t heightDivisor
Definition
drm_format_helper.h:28
Generated on Sat Feb 17 2024 01:42:10 for KWin by
1.10.0