File indexing completed on 2024-11-03 13:42:26

0001 /*
0002     KWin - the KDE window manager
0003     This file is part of the KDE project.
0004 
0005     SPDX-FileCopyrightText: 2019 Roman Gilg <subdiff@gmail.com>
0006 
0007     SPDX-License-Identifier: GPL-2.0-or-later
0008 */
0009 #include "linux_dmabuf.h"
0010 
0011 #include "wayland_server.h"
0012 
0013 namespace KWin
0014 {
0015 
0016 LinuxDmaBufV1ClientBuffer::LinuxDmaBufV1ClientBuffer(DmaBufAttributes &&attrs, quint32 flags)
0017     : KWaylandServer::LinuxDmaBufV1ClientBuffer(std::move(attrs), flags)
0018 {
0019     waylandServer()->addLinuxDmabufBuffer(this);
0020 }
0021 
0022 LinuxDmaBufV1ClientBuffer::~LinuxDmaBufV1ClientBuffer()
0023 {
0024     if (waylandServer()) {
0025         waylandServer()->removeLinuxDmabufBuffer(this);
0026     }
0027 }
0028 
0029 LinuxDmaBufV1RendererInterface::LinuxDmaBufV1RendererInterface()
0030 {
0031     Q_ASSERT(waylandServer());
0032     waylandServer()->linuxDmabuf()->setRendererInterface(this);
0033 }
0034 
0035 LinuxDmaBufV1RendererInterface::~LinuxDmaBufV1RendererInterface()
0036 {
0037     waylandServer()->linuxDmabuf()->setRendererInterface(nullptr);
0038 }
0039 
0040 KWaylandServer::LinuxDmaBufV1ClientBuffer *LinuxDmaBufV1RendererInterface::importBuffer(DmaBufAttributes &&attrs, quint32 flags)
0041 {
0042     return nullptr;
0043 }
0044 
0045 void LinuxDmaBufV1RendererInterface::setSupportedFormatsAndModifiers(const QVector<KWaylandServer::LinuxDmaBufV1Feedback::Tranche> &tranches)
0046 {
0047     waylandServer()->linuxDmabuf()->setSupportedFormatsWithModifiers(tranches);
0048 }
0049 
0050 }