KWin
Loading...
Searching...
No Matches
src
core
graphicsbuffer.cpp
Go to the documentation of this file.
1
/*
2
SPDX-FileCopyrightText: 2023 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
3
4
SPDX-License-Identifier: GPL-2.0-or-later
5
*/
6
7
#include "
core/graphicsbuffer.h
"
8
#include "
utils/drm_format_helper.h
"
9
10
#include <drm_fourcc.h>
11
12
namespace
KWin
13
{
14
15
GraphicsBuffer::GraphicsBuffer
(QObject *parent)
16
: QObject(parent)
17
{
18
}
19
20
bool
GraphicsBuffer::isReferenced
()
const
21
{
22
return
m_refCount
> 0;
23
}
24
25
bool
GraphicsBuffer::isDropped
()
const
26
{
27
return
m_dropped
;
28
}
29
30
void
GraphicsBuffer::ref
()
31
{
32
++
m_refCount
;
33
}
34
35
void
GraphicsBuffer::unref
()
36
{
37
Q_ASSERT(
m_refCount
> 0);
38
--
m_refCount
;
39
if
(!
m_refCount
) {
40
if
(
m_dropped
) {
41
delete
this
;
42
}
else
{
43
Q_EMIT
released
();
44
}
45
}
46
}
47
48
void
GraphicsBuffer::drop
()
49
{
50
m_dropped
=
true
;
51
52
if
(!
m_refCount
) {
53
delete
this
;
54
}
55
}
56
57
GraphicsBuffer::Map
GraphicsBuffer::map
(MapFlags flags)
58
{
59
return
{};
60
}
61
62
void
GraphicsBuffer::unmap
()
63
{
64
}
65
66
const
DmaBufAttributes
*
GraphicsBuffer::dmabufAttributes
()
const
67
{
68
return
nullptr
;
69
}
70
71
const
ShmAttributes
*
GraphicsBuffer::shmAttributes
()
const
72
{
73
return
nullptr
;
74
}
75
76
bool
GraphicsBuffer::alphaChannelFromDrmFormat
(uint32_t
format
)
77
{
78
const
auto
info =
FormatInfo::get
(
format
);
79
return
info && info->alphaBits > 0;
80
}
81
82
}
// namespace KWin
83
84
#include "moc_graphicsbuffer.cpp"
KWin::GraphicsBuffer::map
virtual Map map(MapFlags flags)
Definition
graphicsbuffer.cpp:57
KWin::GraphicsBuffer::m_refCount
int m_refCount
Definition
graphicsbuffer.h:96
KWin::GraphicsBuffer::alphaChannelFromDrmFormat
static bool alphaChannelFromDrmFormat(uint32_t format)
Definition
graphicsbuffer.cpp:76
KWin::GraphicsBuffer::drop
void drop()
Definition
graphicsbuffer.cpp:48
KWin::GraphicsBuffer::unmap
virtual void unmap()
Definition
graphicsbuffer.cpp:62
KWin::GraphicsBuffer::dmabufAttributes
virtual const DmaBufAttributes * dmabufAttributes() const
Definition
graphicsbuffer.cpp:66
KWin::GraphicsBuffer::unref
void unref()
Definition
graphicsbuffer.cpp:35
KWin::GraphicsBuffer::isDropped
bool isDropped() const
Definition
graphicsbuffer.cpp:25
KWin::GraphicsBuffer::ref
void ref()
Definition
graphicsbuffer.cpp:30
KWin::GraphicsBuffer::shmAttributes
virtual const ShmAttributes * shmAttributes() const
Definition
graphicsbuffer.cpp:71
KWin::GraphicsBuffer::m_dropped
bool m_dropped
Definition
graphicsbuffer.h:97
KWin::GraphicsBuffer::GraphicsBuffer
GraphicsBuffer(QObject *parent=nullptr)
Definition
graphicsbuffer.cpp:15
KWin::GraphicsBuffer::released
void released()
KWin::GraphicsBuffer::isReferenced
bool isReferenced() const
Definition
graphicsbuffer.cpp:20
drm_format_helper.h
graphicsbuffer.h
KWin
Definition
activation_test.cpp:20
KWin::format
GLenum format
Definition
gltexture.cpp:49
KWin::DmaBufAttributes
Definition
graphicsbuffer.h:20
KWin::FormatInfo::get
static std::optional< FormatInfo > get(uint32_t drmFormat)
Definition
drm_format_helper.cpp:14
KWin::GraphicsBuffer::Map
Definition
graphicsbuffer.h:77
KWin::ShmAttributes
Definition
graphicsbuffer.h:33
Generated on Sat Feb 17 2024 01:42:09 for KWin by
1.10.0