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 <memory>
32#include <vector>
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:
65 std::shared_ptr<void> parentKeepAlive = {});
66
68
74
75private:
76 const std::shared_ptr<void> m_parentKeepAlive; // keep the backend alive
77 QRhi &m_rhi;
80};
81
82// Severity of a failure to import DMABUF planes as GL textures.
83enum class FailureSeverity {
84 recoverable, // the caller may retry, e.g. with a different frame
85 unrecoverable, // the caller should permanently disable DMABUF import
86};
87
91 std::shared_ptr<void> parentKeepAlive = {},
93
94} // namespace QtMultimediaPrivate
95
96QT_END_NAMESPACE
97
98#endif // QDMABUFTEXTUREIMPORTER_P_H
static bool dmaModifierIsNotSupportedByDisplay(const DmaBufPlane &plane, EGLDisplay eglDisplay)
static bool isExternalOesOnly(const QEglImageFunctions &eglFunctions, EGLDisplay eglDisplay, const DmaBufPlane &plane)
q23::expected< QVideoFrameTexturesHandlesUPtr, FailureSeverity > importDmaBufTextures(QRhi &rhi, const DmaBufEglContext &eglContext, QSpan< const DmaBufPlane > planes, QVideoFrameFormat::PixelFormat qtFormat, QSize frameSize, std::shared_ptr< void > parentKeepAlive, DmaBufImportMode importMode)
QT_BEGIN_NAMESPACE Q_STATIC_LOGGING_CATEGORY(lcSynthesizedIterableAccess, "qt.iterable.synthesized", QtWarningMsg)