/* KWin - the KDE window manager This file is part of the KDE project. SPDX-FileCopyrightText: 2015 Martin Gräßlin SPDX-License-Identifier: GPL-2.0-or-later */ #include "drm_qpainter_backend.h" #include "drm_backend.h" #include "drm_gpu.h" #include "drm_output.h" #include "drm_pipeline.h" #include "drm_qpainter_layer.h" #include "drm_virtual_output.h" #include namespace KWin { DrmQPainterBackend::DrmQPainterBackend(DrmBackend *backend) : QPainterBackend() , m_backend(backend) { m_backend->setRenderBackend(this); m_backend->createLayers(); } DrmQPainterBackend::~DrmQPainterBackend() { m_backend->releaseBuffers(); m_backend->setRenderBackend(nullptr); } DrmDevice *DrmQPainterBackend::drmDevice() const { return m_backend->primaryGpu()->drmDevice(); } bool DrmQPainterBackend::present(Output *output, const std::shared_ptr &frame) { return static_cast(output)->present(frame); } void DrmQPainterBackend::repairPresentation(Output *output) { // read back drm properties, most likely our info is out of date somehow // or we need a modeset QTimer::singleShot(0, m_backend, &DrmBackend::updateOutputs); } OutputLayer *DrmQPainterBackend::primaryLayer(Output *output) { return static_cast(output)->primaryLayer(); } OutputLayer *DrmQPainterBackend::cursorLayer(Output *output) { return static_cast(output)->cursorLayer(); } std::shared_ptr DrmQPainterBackend::createDrmPlaneLayer(DrmPipeline *pipeline, DrmPlane::TypeIndex type) { return std::make_shared(pipeline, type); } std::shared_ptr DrmQPainterBackend::createLayer(DrmVirtualOutput *output) { return std::make_shared(output); } } #include "moc_drm_qpainter_backend.cpp"