KWin
Loading...
Searching...
No Matches
renderbackend.cpp
Go to the documentation of this file.
1/*
2 SPDX-FileCopyrightText: 2021 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#include "renderbackend.h"
8#include "renderloop_p.h"
9#include "scene/surfaceitem.h"
10
11#include <drm_fourcc.h>
12
13namespace KWin
14{
15
17 : m_loop(loop)
18{
19}
20
22
23void OutputFrame::addFeedback(std::unique_ptr<PresentationFeedback> &&feedback)
24{
25 m_feedbacks.push_back(std::move(feedback));
26}
27
28void OutputFrame::presented(std::chrono::nanoseconds refreshDuration, std::chrono::nanoseconds timestamp, std::chrono::nanoseconds renderTime, PresentationMode mode)
29{
30 RenderLoopPrivate::get(m_loop)->notifyFrameCompleted(timestamp, renderTime, mode);
31 for (const auto &feedback : m_feedbacks) {
32 feedback->presented(refreshDuration, timestamp, mode);
33 }
34}
35
40
42{
43 m_contentType = type;
44}
45
46std::optional<ContentType> OutputFrame::contentType() const
47{
48 return m_contentType;
49}
50
52{
53 m_presentationMode = mode;
54}
55
57{
58 return m_presentationMode;
59}
60
62 : QObject(parent)
63{
64}
65
67{
68 return nullptr;
69}
70
72{
73 return nullptr;
74}
75
77{
78 return false;
79}
80
85
87{
88 return false;
89}
90
91QHash<uint32_t, QList<uint64_t>> RenderBackend::supportedFormats() const
92{
93 return QHash<uint32_t, QList<uint64_t>>{{DRM_FORMAT_XRGB8888, QList<uint64_t>{DRM_FORMAT_MOD_LINEAR}}};
94}
95
96std::unique_ptr<SurfaceTexture> RenderBackend::createSurfaceTextureX11(SurfacePixmapX11 *pixmap)
97{
98 return nullptr;
99}
100
101std::unique_ptr<SurfaceTexture> RenderBackend::createSurfaceTextureWayland(SurfacePixmap *pixmap)
102{
103 return nullptr;
104}
105
106} // namespace KWin
107
108#include "moc_renderbackend.cpp"
OutputFrame(RenderLoop *loop)
std::optional< ContentType > contentType() const
PresentationMode presentationMode() const
void addFeedback(std::unique_ptr< PresentationFeedback > &&feedback)
void setPresentationMode(PresentationMode mode)
void setContentType(ContentType type)
void presented(std::chrono::nanoseconds refreshDuration, std::chrono::nanoseconds timestamp, std::chrono::nanoseconds renderTime, PresentationMode mode)
virtual bool testImportBuffer(GraphicsBuffer *buffer)
virtual GraphicsBufferAllocator * graphicsBufferAllocator() const
virtual OverlayWindow * overlayWindow() const
virtual std::unique_ptr< SurfaceTexture > createSurfaceTextureX11(SurfacePixmapX11 *pixmap)
virtual bool checkGraphicsReset()
RenderBackend(QObject *parent=nullptr)
virtual OutputLayer * cursorLayer(Output *output)
virtual QHash< uint32_t, QList< uint64_t > > supportedFormats() const
virtual std::unique_ptr< SurfaceTexture > createSurfaceTextureWayland(SurfacePixmap *pixmap)
static RenderLoopPrivate * get(RenderLoop *loop)
void notifyFrameCompleted(std::chrono::nanoseconds timestamp, std::chrono::nanoseconds renderTime, PresentationMode mode=PresentationMode::VSync)
Session::Type type
Definition session.cpp:17
PresentationMode
Definition globals.h:276
ContentType
Definition globals.h:284