2021-07-18 20:21:59 +00:00
|
|
|
/*
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
|
|
|
|
|
|
|
SPDX-FileCopyrightText: 2022 Xaver Hugl <xaver.hugl@gmail.com>
|
|
|
|
|
|
|
|
SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
*/
|
|
|
|
|
2022-11-10 14:05:37 +00:00
|
|
|
#include <QSize>
|
2023-07-03 19:28:19 +00:00
|
|
|
#include <QTest>
|
2021-07-18 20:21:59 +00:00
|
|
|
|
|
|
|
#include "mock_drm.h"
|
|
|
|
|
2023-06-14 07:20:49 +00:00
|
|
|
#include "core/outputlayer.h"
|
2023-03-23 11:39:20 +00:00
|
|
|
#include "core/session.h"
|
2021-07-18 20:21:59 +00:00
|
|
|
#include "drm_backend.h"
|
2023-03-23 11:39:20 +00:00
|
|
|
#include "drm_connector.h"
|
|
|
|
#include "drm_crtc.h"
|
2021-07-18 20:21:59 +00:00
|
|
|
#include "drm_egl_backend.h"
|
|
|
|
#include "drm_gpu.h"
|
|
|
|
#include "drm_output.h"
|
|
|
|
#include "drm_pipeline.h"
|
2023-03-23 11:39:20 +00:00
|
|
|
#include "drm_plane.h"
|
2021-07-18 20:21:59 +00:00
|
|
|
#include "drm_pointer.h"
|
2023-03-23 11:39:20 +00:00
|
|
|
#include "platformsupport/scenes/qpainter/qpainterbackend.h"
|
2021-07-18 20:21:59 +00:00
|
|
|
|
|
|
|
#include <drm_fourcc.h>
|
2023-06-14 07:20:49 +00:00
|
|
|
#include <fcntl.h>
|
|
|
|
#include <sys/utsname.h>
|
2021-07-18 20:21:59 +00:00
|
|
|
|
|
|
|
using namespace KWin;
|
|
|
|
|
2023-06-14 07:20:49 +00:00
|
|
|
static std::unique_ptr<MockGpu> findPrimaryDevice(int crtcCount)
|
|
|
|
{
|
|
|
|
const int deviceCount = drmGetDevices2(0, nullptr, 0);
|
|
|
|
if (deviceCount <= 0) {
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2023-10-19 06:50:15 +00:00
|
|
|
QList<drmDevice *> devices(deviceCount);
|
2023-06-14 07:20:49 +00:00
|
|
|
if (drmGetDevices2(0, devices.data(), devices.size()) < 0) {
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
auto deviceCleanup = qScopeGuard([&devices]() {
|
|
|
|
drmFreeDevices(devices.data(), devices.size());
|
|
|
|
});
|
|
|
|
|
|
|
|
for (drmDevice *device : std::as_const(devices)) {
|
|
|
|
if (device->available_nodes & (1 << DRM_NODE_PRIMARY)) {
|
|
|
|
int fd = open(device->nodes[DRM_NODE_PRIMARY], O_RDWR | O_CLOEXEC);
|
|
|
|
if (fd != -1) {
|
|
|
|
return std::make_unique<MockGpu>(fd, device->nodes[DRM_NODE_PRIMARY], crtcCount);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2021-07-18 20:21:59 +00:00
|
|
|
class DrmTest : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
private Q_SLOTS:
|
|
|
|
void testAmsDetection();
|
|
|
|
void testOutputDetection();
|
|
|
|
void testZeroModesHandling();
|
2022-11-10 14:05:37 +00:00
|
|
|
void testModeGeneration_data();
|
2022-10-30 22:12:30 +00:00
|
|
|
void testModeGeneration();
|
2022-12-28 23:05:08 +00:00
|
|
|
void testConnectorLifetime();
|
2023-04-11 16:32:19 +00:00
|
|
|
void testModeset_data();
|
|
|
|
void testModeset();
|
2021-07-18 20:21:59 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static void verifyCleanup(MockGpu *mockGpu)
|
|
|
|
{
|
|
|
|
QVERIFY(mockGpu->drmConnectors.isEmpty());
|
|
|
|
QVERIFY(mockGpu->drmEncoders.isEmpty());
|
|
|
|
QVERIFY(mockGpu->drmCrtcs.isEmpty());
|
|
|
|
QVERIFY(mockGpu->drmPlanes.isEmpty());
|
|
|
|
QVERIFY(mockGpu->drmPlaneRes.isEmpty());
|
|
|
|
QVERIFY(mockGpu->fbs.isEmpty());
|
|
|
|
QVERIFY(mockGpu->drmProps.isEmpty());
|
|
|
|
QVERIFY(mockGpu->drmObjectProperties.isEmpty());
|
|
|
|
QVERIFY(mockGpu->drmPropertyBlobs.isEmpty());
|
|
|
|
}
|
|
|
|
|
|
|
|
void DrmTest::testAmsDetection()
|
|
|
|
{
|
|
|
|
const auto session = Session::create(Session::Type::Noop);
|
|
|
|
const auto backend = std::make_unique<DrmBackend>(session.get());
|
|
|
|
|
|
|
|
// gpu without planes should use legacy mode
|
2023-06-14 07:20:49 +00:00
|
|
|
{
|
|
|
|
const auto mockGpu = findPrimaryDevice(0);
|
2024-03-20 19:47:48 +00:00
|
|
|
auto gpu = std::make_unique<DrmGpu>(backend.get(), mockGpu->fd, DrmDevice::open(mockGpu->devNode));
|
2023-06-14 07:20:49 +00:00
|
|
|
QVERIFY(!gpu->atomicModeSetting());
|
|
|
|
}
|
2021-07-18 20:21:59 +00:00
|
|
|
|
|
|
|
// gpu with planes should use AMS
|
2023-06-14 07:20:49 +00:00
|
|
|
{
|
|
|
|
const auto mockGpu = findPrimaryDevice(0);
|
|
|
|
mockGpu->planes << std::make_shared<MockPlane>(mockGpu.get(), PlaneType::Primary, 0);
|
2024-03-20 19:47:48 +00:00
|
|
|
auto gpu = std::make_unique<DrmGpu>(backend.get(), mockGpu->fd, DrmDevice::open(mockGpu->devNode));
|
|
|
|
gpu = std::make_unique<DrmGpu>(backend.get(), mockGpu->fd, DrmDevice::open(mockGpu->devNode));
|
2023-06-14 07:20:49 +00:00
|
|
|
QVERIFY(gpu->atomicModeSetting());
|
|
|
|
}
|
2021-07-18 20:21:59 +00:00
|
|
|
|
|
|
|
// but not if the kernel doesn't allow it
|
2023-06-14 07:20:49 +00:00
|
|
|
{
|
|
|
|
const auto mockGpu = findPrimaryDevice(0);
|
|
|
|
mockGpu->deviceCaps[MOCKDRM_DEVICE_CAP_ATOMIC] = 0;
|
2024-03-20 19:47:48 +00:00
|
|
|
auto gpu = std::make_unique<DrmGpu>(backend.get(), mockGpu->fd, DrmDevice::open(mockGpu->devNode));
|
2023-06-14 07:20:49 +00:00
|
|
|
QVERIFY(!gpu->atomicModeSetting());
|
|
|
|
gpu.reset();
|
|
|
|
verifyCleanup(mockGpu.get());
|
|
|
|
}
|
2021-07-18 20:21:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void DrmTest::testOutputDetection()
|
|
|
|
{
|
2023-06-14 07:20:49 +00:00
|
|
|
const auto mockGpu = findPrimaryDevice(5);
|
2021-07-18 20:21:59 +00:00
|
|
|
|
|
|
|
const auto one = std::make_shared<MockConnector>(mockGpu.get());
|
|
|
|
const auto two = std::make_shared<MockConnector>(mockGpu.get());
|
|
|
|
const auto vr = std::make_shared<MockConnector>(mockGpu.get(), true);
|
|
|
|
mockGpu->connectors.push_back(one);
|
|
|
|
mockGpu->connectors.push_back(two);
|
|
|
|
mockGpu->connectors.push_back(vr);
|
|
|
|
|
|
|
|
const auto session = Session::create(Session::Type::Noop);
|
|
|
|
const auto backend = std::make_unique<DrmBackend>(session.get());
|
|
|
|
const auto renderBackend = backend->createQPainterBackend();
|
2024-03-20 19:47:48 +00:00
|
|
|
auto gpu = std::make_unique<DrmGpu>(backend.get(), mockGpu->fd, DrmDevice::open(mockGpu->devNode));
|
2021-07-18 20:21:59 +00:00
|
|
|
QVERIFY(gpu->updateOutputs());
|
|
|
|
|
|
|
|
// 3 outputs should be detected, one of them non-desktop
|
|
|
|
const auto outputs = gpu->drmOutputs();
|
|
|
|
QCOMPARE(outputs.size(), 3);
|
|
|
|
const auto vrOutput = std::find_if(outputs.begin(), outputs.end(), [](const auto &output) {
|
|
|
|
return output->isNonDesktop();
|
|
|
|
});
|
|
|
|
QVERIFY(vrOutput != outputs.end());
|
|
|
|
QVERIFY(static_cast<DrmOutput *>(*vrOutput)->connector()->id() == vr->id);
|
|
|
|
|
|
|
|
// test hotunplugging
|
|
|
|
mockGpu->connectors.removeOne(one);
|
|
|
|
QVERIFY(gpu->updateOutputs());
|
|
|
|
QCOMPARE(gpu->drmOutputs().size(), 2);
|
|
|
|
|
|
|
|
// test hotplugging
|
|
|
|
mockGpu->connectors.push_back(one);
|
|
|
|
QVERIFY(gpu->updateOutputs());
|
|
|
|
QCOMPARE(gpu->drmOutputs().size(), 3);
|
|
|
|
|
|
|
|
// connector state changing to disconnected should count as a hotunplug
|
|
|
|
one->connection = DRM_MODE_DISCONNECTED;
|
|
|
|
QVERIFY(gpu->updateOutputs());
|
|
|
|
QCOMPARE(gpu->drmOutputs().size(), 2);
|
|
|
|
|
|
|
|
// don't crash if all connectors are disconnected
|
|
|
|
two->connection = DRM_MODE_DISCONNECTED;
|
|
|
|
vr->connection = DRM_MODE_DISCONNECTED;
|
|
|
|
QVERIFY(gpu->updateOutputs());
|
|
|
|
QVERIFY(gpu->drmOutputs().empty());
|
|
|
|
|
|
|
|
gpu.reset();
|
|
|
|
verifyCleanup(mockGpu.get());
|
|
|
|
}
|
|
|
|
|
|
|
|
void DrmTest::testZeroModesHandling()
|
|
|
|
{
|
2023-06-14 07:20:49 +00:00
|
|
|
const auto mockGpu = findPrimaryDevice(5);
|
2021-07-18 20:21:59 +00:00
|
|
|
|
|
|
|
const auto conn = std::make_shared<MockConnector>(mockGpu.get());
|
|
|
|
mockGpu->connectors.push_back(conn);
|
|
|
|
|
|
|
|
const auto session = Session::create(Session::Type::Noop);
|
|
|
|
const auto backend = std::make_unique<DrmBackend>(session.get());
|
|
|
|
const auto renderBackend = backend->createQPainterBackend();
|
2024-03-20 19:47:48 +00:00
|
|
|
auto gpu = std::make_unique<DrmGpu>(backend.get(), mockGpu->fd, DrmDevice::open(mockGpu->devNode));
|
2021-07-18 20:21:59 +00:00
|
|
|
|
|
|
|
// connector with zero modes should be ignored
|
|
|
|
conn->modes.clear();
|
|
|
|
QVERIFY(gpu->updateOutputs());
|
|
|
|
QVERIFY(gpu->drmOutputs().empty());
|
|
|
|
|
|
|
|
// once it has modes, it should be detected
|
|
|
|
conn->addMode(1920, 1080, 60);
|
|
|
|
QVERIFY(gpu->updateOutputs());
|
|
|
|
QCOMPARE(gpu->drmOutputs().size(), 1);
|
|
|
|
|
|
|
|
// if an update says it has no modes anymore but it's still connected, ignore that
|
|
|
|
conn->modes.clear();
|
|
|
|
QVERIFY(gpu->updateOutputs());
|
|
|
|
QCOMPARE(gpu->drmOutputs().size(), 1);
|
|
|
|
QVERIFY(!gpu->drmOutputs().constFirst()->modes().empty());
|
|
|
|
|
|
|
|
gpu.reset();
|
|
|
|
verifyCleanup(mockGpu.get());
|
|
|
|
}
|
|
|
|
|
2022-11-10 14:05:37 +00:00
|
|
|
void DrmTest::testModeGeneration_data()
|
|
|
|
{
|
|
|
|
QTest::addColumn<QSize>("nativeMode");
|
2023-10-19 06:50:15 +00:00
|
|
|
QTest::addColumn<QList<QSize>>("expectedModes");
|
2022-11-10 14:05:37 +00:00
|
|
|
|
2023-10-19 06:50:15 +00:00
|
|
|
QTest::newRow("2160p") << QSize(3840, 2160) << QList<QSize>{
|
2022-11-10 14:05:37 +00:00
|
|
|
QSize(1600, 1200),
|
|
|
|
QSize(1280, 1024),
|
|
|
|
QSize(1024, 768),
|
|
|
|
QSize(2560, 1600),
|
|
|
|
QSize(1920, 1200),
|
|
|
|
QSize(1280, 800),
|
|
|
|
QSize(3840, 2160),
|
|
|
|
QSize(3200, 1800),
|
|
|
|
QSize(2880, 1620),
|
|
|
|
QSize(2560, 1440),
|
|
|
|
QSize(1920, 1080),
|
|
|
|
QSize(1600, 900),
|
|
|
|
QSize(1368, 768),
|
|
|
|
QSize(1280, 720),
|
|
|
|
};
|
2023-10-19 06:50:15 +00:00
|
|
|
QTest::newRow("1440p") << QSize(2560, 1440) << QList<QSize>{
|
2022-11-10 14:05:37 +00:00
|
|
|
QSize(1600, 1200),
|
|
|
|
QSize(1280, 1024),
|
|
|
|
QSize(1024, 768),
|
|
|
|
QSize(1920, 1200),
|
|
|
|
QSize(1280, 800),
|
|
|
|
QSize(2560, 1440),
|
|
|
|
QSize(1920, 1080),
|
|
|
|
QSize(1600, 900),
|
|
|
|
QSize(1368, 768),
|
|
|
|
QSize(1280, 720),
|
|
|
|
};
|
2023-10-19 06:50:15 +00:00
|
|
|
QTest::newRow("1080p") << QSize(1920, 1080) << QList<QSize>{
|
2022-11-10 14:05:37 +00:00
|
|
|
QSize(1280, 1024),
|
|
|
|
QSize(1024, 768),
|
|
|
|
QSize(1280, 800),
|
|
|
|
QSize(1920, 1080),
|
|
|
|
QSize(1600, 900),
|
|
|
|
QSize(1368, 768),
|
|
|
|
QSize(1280, 720),
|
|
|
|
};
|
|
|
|
|
2023-10-19 06:50:15 +00:00
|
|
|
QTest::newRow("2160p 21:9") << QSize(5120, 2160) << QList<QSize>{
|
2022-11-10 14:05:37 +00:00
|
|
|
QSize(5120, 2160),
|
|
|
|
QSize(1600, 1200),
|
|
|
|
QSize(1280, 1024),
|
|
|
|
QSize(1024, 768),
|
|
|
|
QSize(2560, 1600),
|
|
|
|
QSize(1920, 1200),
|
|
|
|
QSize(1280, 800),
|
|
|
|
QSize(3840, 2160),
|
|
|
|
QSize(3200, 1800),
|
|
|
|
QSize(2880, 1620),
|
|
|
|
QSize(2560, 1440),
|
|
|
|
QSize(1920, 1080),
|
|
|
|
QSize(1600, 900),
|
|
|
|
QSize(1368, 768),
|
|
|
|
QSize(1280, 720),
|
|
|
|
};
|
2023-10-19 06:50:15 +00:00
|
|
|
QTest::newRow("1440p 21:9") << QSize(3440, 1440) << QList<QSize>{
|
2022-11-10 14:05:37 +00:00
|
|
|
QSize(3440, 1440),
|
|
|
|
QSize(1600, 1200),
|
|
|
|
QSize(1280, 1024),
|
|
|
|
QSize(1024, 768),
|
|
|
|
QSize(1920, 1200),
|
|
|
|
QSize(1280, 800),
|
|
|
|
QSize(2560, 1440),
|
|
|
|
QSize(1920, 1080),
|
|
|
|
QSize(1600, 900),
|
|
|
|
QSize(1368, 768),
|
|
|
|
QSize(1280, 720),
|
|
|
|
};
|
2023-10-19 06:50:15 +00:00
|
|
|
QTest::newRow("1080p 21:9") << QSize(2560, 1080) << QList<QSize>{
|
2022-11-10 14:05:37 +00:00
|
|
|
QSize(2560, 1080),
|
|
|
|
QSize(1280, 1024),
|
|
|
|
QSize(1024, 768),
|
|
|
|
QSize(1280, 800),
|
|
|
|
QSize(1920, 1080),
|
|
|
|
QSize(1600, 900),
|
|
|
|
QSize(1368, 768),
|
|
|
|
QSize(1280, 720),
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2022-10-30 22:12:30 +00:00
|
|
|
void DrmTest::testModeGeneration()
|
|
|
|
{
|
2023-06-14 07:20:49 +00:00
|
|
|
const auto mockGpu = findPrimaryDevice(5);
|
2022-10-30 22:12:30 +00:00
|
|
|
|
|
|
|
const auto conn = std::make_shared<MockConnector>(mockGpu.get());
|
|
|
|
mockGpu->connectors.push_back(conn);
|
|
|
|
|
|
|
|
const auto session = Session::create(Session::Type::Noop);
|
|
|
|
const auto backend = std::make_unique<DrmBackend>(session.get());
|
|
|
|
const auto renderBackend = backend->createQPainterBackend();
|
2024-03-20 19:47:48 +00:00
|
|
|
auto gpu = std::make_unique<DrmGpu>(backend.get(), mockGpu->fd, DrmDevice::open(mockGpu->devNode));
|
2022-10-30 22:12:30 +00:00
|
|
|
|
2022-11-10 14:05:37 +00:00
|
|
|
QFETCH(QSize, nativeMode);
|
2023-10-19 06:50:15 +00:00
|
|
|
QFETCH(QList<QSize>, expectedModes);
|
2022-11-10 14:05:37 +00:00
|
|
|
|
2022-10-30 22:12:30 +00:00
|
|
|
conn->modes.clear();
|
2022-11-10 14:05:37 +00:00
|
|
|
conn->addMode(nativeMode.width(), nativeMode.height(), 60);
|
2022-10-30 22:12:30 +00:00
|
|
|
QVERIFY(gpu->updateOutputs());
|
|
|
|
QCOMPARE(gpu->drmOutputs().size(), 1);
|
2023-03-25 16:51:52 +00:00
|
|
|
// no mode generation without the scaling property
|
|
|
|
QCOMPARE(gpu->drmOutputs().front()->modes().size(), 1);
|
|
|
|
|
|
|
|
mockGpu->connectors.removeAll(conn);
|
|
|
|
QVERIFY(gpu->updateOutputs());
|
|
|
|
|
2023-10-19 06:50:15 +00:00
|
|
|
conn->props.emplace_back(conn.get(), QStringLiteral("scaling mode"), 0, DRM_MODE_PROP_ENUM, QList<QByteArray>{"None", "Full", "Center", "Full aspect"});
|
2023-03-25 16:51:52 +00:00
|
|
|
mockGpu->connectors.push_back(conn);
|
|
|
|
QVERIFY(gpu->updateOutputs());
|
2022-10-30 22:12:30 +00:00
|
|
|
|
|
|
|
DrmOutput *const output = gpu->drmOutputs().front();
|
2022-11-10 14:05:37 +00:00
|
|
|
QCOMPARE(output->modes().size(), expectedModes.size());
|
2022-10-30 22:12:30 +00:00
|
|
|
for (const auto &mode : output->modes()) {
|
2022-11-10 14:05:37 +00:00
|
|
|
QVERIFY(expectedModes.contains(mode->size()));
|
|
|
|
QVERIFY(mode->size().width() <= nativeMode.width());
|
|
|
|
QVERIFY(mode->size().height() <= nativeMode.height());
|
2022-10-30 22:12:30 +00:00
|
|
|
QVERIFY(mode->refreshRate() <= 60000);
|
|
|
|
}
|
|
|
|
|
|
|
|
gpu.reset();
|
|
|
|
verifyCleanup(mockGpu.get());
|
|
|
|
}
|
|
|
|
|
2022-12-28 23:05:08 +00:00
|
|
|
void DrmTest::testConnectorLifetime()
|
|
|
|
{
|
|
|
|
// don't crash if output lifetime is extended beyond the connector
|
2023-06-14 07:20:49 +00:00
|
|
|
const auto mockGpu = findPrimaryDevice(5);
|
2022-12-28 23:05:08 +00:00
|
|
|
|
|
|
|
const auto conn = std::make_shared<MockConnector>(mockGpu.get());
|
|
|
|
mockGpu->connectors.push_back(conn);
|
|
|
|
|
|
|
|
const auto session = Session::create(Session::Type::Noop);
|
|
|
|
const auto backend = std::make_unique<DrmBackend>(session.get());
|
|
|
|
const auto renderBackend = backend->createQPainterBackend();
|
2024-03-20 19:47:48 +00:00
|
|
|
auto gpu = std::make_unique<DrmGpu>(backend.get(), mockGpu->fd, DrmDevice::open(mockGpu->devNode));
|
2022-12-28 23:05:08 +00:00
|
|
|
|
|
|
|
QVERIFY(gpu->updateOutputs());
|
|
|
|
QCOMPARE(gpu->drmOutputs().size(), 1);
|
|
|
|
|
|
|
|
DrmOutput *const output = gpu->drmOutputs().front();
|
|
|
|
|
|
|
|
output->ref();
|
|
|
|
mockGpu->connectors.clear();
|
|
|
|
QVERIFY(gpu->updateOutputs());
|
|
|
|
output->unref();
|
|
|
|
|
|
|
|
gpu.reset();
|
|
|
|
verifyCleanup(mockGpu.get());
|
|
|
|
}
|
|
|
|
|
2023-04-11 16:32:19 +00:00
|
|
|
void DrmTest::testModeset_data()
|
|
|
|
{
|
|
|
|
QTest::addColumn<int>("AMS");
|
|
|
|
// TODO to uncomment this, implement page flip callbacks
|
|
|
|
// QTest::newRow("disabled") << 0;
|
|
|
|
QTest::newRow("enabled") << 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
void DrmTest::testModeset()
|
|
|
|
{
|
|
|
|
// test if doing a modeset would succeed
|
|
|
|
QFETCH(int, AMS);
|
2023-06-14 07:20:49 +00:00
|
|
|
const auto mockGpu = findPrimaryDevice(5);
|
2023-04-11 16:32:19 +00:00
|
|
|
mockGpu->deviceCaps[MOCKDRM_DEVICE_CAP_ATOMIC] = AMS;
|
|
|
|
|
|
|
|
const auto conn = std::make_shared<MockConnector>(mockGpu.get());
|
|
|
|
mockGpu->connectors.push_back(conn);
|
|
|
|
|
|
|
|
const auto session = Session::create(Session::Type::Noop);
|
|
|
|
const auto backend = std::make_unique<DrmBackend>(session.get());
|
|
|
|
const auto renderBackend = backend->createQPainterBackend();
|
2024-03-20 19:47:48 +00:00
|
|
|
auto gpu = std::make_unique<DrmGpu>(backend.get(), mockGpu->fd, DrmDevice::open(mockGpu->devNode));
|
2023-04-11 16:32:19 +00:00
|
|
|
|
|
|
|
QVERIFY(gpu->updateOutputs());
|
|
|
|
QCOMPARE(gpu->drmOutputs().size(), 1);
|
|
|
|
const auto output = gpu->drmOutputs().front();
|
2023-06-14 07:20:49 +00:00
|
|
|
const auto layer = renderBackend->primaryLayer(output);
|
|
|
|
layer->beginFrame();
|
2023-06-22 12:44:07 +00:00
|
|
|
output->renderLoop()->prepareNewFrame();
|
|
|
|
output->renderLoop()->beginPaint();
|
2023-12-25 00:30:08 +00:00
|
|
|
const auto frame = std::make_shared<OutputFrame>(output->renderLoop(), std::chrono::nanoseconds(1'000'000'000'000 / output->refreshRate()));
|
2024-02-29 16:29:26 +00:00
|
|
|
layer->endFrame(infiniteRegion(), infiniteRegion(), frame.get());
|
|
|
|
QVERIFY(output->present(frame));
|
2023-04-11 16:32:19 +00:00
|
|
|
|
|
|
|
gpu.reset();
|
|
|
|
verifyCleanup(mockGpu.get());
|
|
|
|
}
|
|
|
|
|
2021-07-18 20:21:59 +00:00
|
|
|
QTEST_GUILESS_MAIN(DrmTest)
|
|
|
|
#include "drmTest.moc"
|