Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qdmabuftextureimporter_p.h
Go to the documentation of this file.
1// Copyright (C) 2026 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3#ifndef QDMABUFTEXTUREIMPORTER_P_H
4#define QDMABUFTEXTUREIMPORTER_P_H
5
6//
7// W A R N I N G
8// -------------
9//
10// This file is not part of the Qt API. It exists purely as an
11// implementation detail. This header file may change from version to
12// version without notice, or even be removed.
13//
14// We mean it.
15//
16
18
19#include <QtMultimedia/qvideoframeformat.h>
20#include <QtMultimedia/private/qmultimedia_drm_support_p.h>
21#include <QtMultimedia/private/qmultimedia_gl_support_p.h>
22#include <QtMultimedia/private/qtmultimediaglobal_p.h>
23
24#include <QtGui/qopenglfunctions.h>
25
26#include <QtCore/qsize.h>
27#include <QtCore/private/qexpected_p.h>
28
29#include <EGL/egl.h>
30
31#include <array>
32#include <memory>
33
34static_assert(QT_CONFIG(linux_dmabuf));
35
36QT_BEGIN_NAMESPACE
37
38class QRhi;
39class QOpenGLContext;
40
41namespace QtMultimediaPrivate {
42
43class Q_MULTIMEDIA_EXPORT DmaBufEglContext
44{
45public:
46 explicit DmaBufEglContext(QRhi *rhi);
47
48 bool isValid() const { return m_valid; }
49 void invalidate() { m_valid = false; }
50
53
54private:
55 QOpenGLContext *m_glContext = nullptr;
56 EGLDisplay m_eglDisplay = nullptr;
57 bool m_valid = false;
58};
59
60class Q_MULTIMEDIA_EXPORT DmaBufTextureHandles final : public QVideoFrameTexturesHandles
61{
62public:
64 std::shared_ptr<void> parentKeepAlive = {});
65
67
69
70private:
71 const std::shared_ptr<void> m_parentKeepAlive; // keep the backend alive
72 QRhi &m_rhi;
74};
75
76// Severity of a failure to import DMABUF planes as GL textures.
77enum class FailureSeverity {
78 recoverable, // the caller may retry, e.g. with a different frame
79 unrecoverable, // the caller should permanently disable DMABUF import
80};
81
85 std::shared_ptr<void> parentKeepAlive = {});
86
87} // namespace QtMultimediaPrivate
88
89QT_END_NAMESPACE
90
91#endif // QDMABUFTEXTUREIMPORTER_P_H
static bool dmaModifierIsNotSupportedByDisplay(const DmaBufPlane &plane, EGLDisplay eglDisplay)
q23::expected< QVideoFrameTexturesHandlesUPtr, FailureSeverity > importDmaBufTextures(QRhi &rhi, const DmaBufEglContext &eglContext, QSpan< const DmaBufPlane > planes, QVideoFrameFormat::PixelFormat qtFormat, QSize frameSize, std::shared_ptr< void > parentKeepAlive)
QT_BEGIN_NAMESPACE Q_STATIC_LOGGING_CATEGORY(lcSynthesizedIterableAccess, "qt.iterable.synthesized", QtWarningMsg)