KWin
Loading...
Searching...
No Matches
drm_abstract_output.cpp
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: 2021 Xaver Hugl <xaver.hugl@gmail.com>
6
7 SPDX-License-Identifier: GPL-2.0-or-later
8*/
10#include "core/renderbackend.h"
11#include "drm_backend.h"
12#include "drm_gpu.h"
13#include "drm_layer.h"
14
15namespace KWin
16{
17
19 : Output(gpu->platform())
20 , m_renderLoop(std::make_unique<RenderLoop>(this))
21 , m_gpu(gpu)
22{
23}
24
26{
27 return m_renderLoop.get();
28}
29
31{
32 m_frame->failed();
33}
34
35void DrmAbstractOutput::pageFlipped(std::chrono::nanoseconds timestamp, PresentationMode mode)
36{
37 const auto gpuTime = primaryLayer() ? primaryLayer()->queryRenderTime() : std::chrono::nanoseconds::zero();
38 m_frame->presented(std::chrono::nanoseconds(1'000'000'000'000 / refreshRate()), timestamp, gpuTime, mode);
39 m_frame.reset();
40}
41
43{
44 return m_gpu;
45}
46
48{
49 State next = m_state;
50 next.enabled = enabled;
51 setState(next);
52}
53
54}
55
56#include "moc_drm_abstract_output.cpp"
void pageFlipped(std::chrono::nanoseconds timestamp, PresentationMode mode)
std::shared_ptr< OutputFrame > m_frame
std::unique_ptr< RenderLoop > m_renderLoop
void updateEnabled(bool enabled)
virtual DrmOutputLayer * primaryLayer() const =0
RenderLoop * renderLoop() const override
uint32_t refreshRate() const
Definition output.cpp:475
void setState(const State &state)
Definition output.cpp:562
State m_state
Definition output.h:477
virtual std::chrono::nanoseconds queryRenderTime() const =0
PresentationMode
Definition globals.h:276