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
qeglimagefunctions_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 QEGLIMAGEFUNCTIONS_P_H
4#define QEGLIMAGEFUNCTIONS_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
17#include <QtMultimedia/private/qmultimedia_drm_support_p.h>
18#include <QtMultimedia/private/qmultimedia_gl_support_p.h>
19#include <QtMultimedia/private/qtmultimediaglobal_p.h>
20#include <QtGui/qopengl.h>
21#include <QtCore/qspan.h>
22
23#include <EGL/egl.h>
24#include <EGL/eglext.h>
25
26#include <optional>
27
28QT_BEGIN_NAMESPACE
29
30namespace QtMultimediaPrivate {
31
32class Q_MULTIMEDIA_EXPORT QEglImageFunctions
33{
35
36public:
37 static const QEglImageFunctions &instance();
38
39 bool isValid() const;
40
42
43 EGLImageHandle eglCreateImage(EGLDisplay, EGLContext, EGLenum, EGLClientBuffer,
44 QSpan<const EGLAttrib> attribs = {}) const;
45 EGLBoolean eglDestroyImage(EGLDisplay, EGLImage) const;
46
47 // Returns whether `modifier` is a supported dma-buf import modifier for `drmFormat` on
48 // `display`, or nullopt if this EGL implementation doesn't support querying modifiers at
49 // all (EGL_EXT_image_dma_buf_import_modifiers unavailable).
50 std::optional<bool> isDmaBufModifierSupported(EGLDisplay display, DRMFormat drmFormat,
51 DRMModifier modifier) const;
52
53 // Returns whether images of `drmFormat` with `modifier` can only be sampled through
54 // GL_TEXTURE_EXTERNAL_OES, or nullopt if that can't be determined.
55 std::optional<bool> isDmaBufModifierExternalOesOnly(EGLDisplay display, DRMFormat drmFormat,
56 DRMModifier modifier) const;
57
58private:
59#ifdef GL_OES_EGL_image
61#endif
62
63#ifdef EGL_VERSION_1_5
64 // egl.h declares eglCreateImage/eglDestroyImage, but the egl library may not provide the
65 // symbols, so we need to resolve them at run-time.
66
67 // NB: android does not declare these function pointer types
69 EGLClientBuffer, const EGLAttrib *);
70 typedef EGLBoolean(EGLAPIENTRYP PFNEGLDESTROYIMAGEPROC)(EGLDisplay, EGLImage);
71
72 const PFNEGLCREATEIMAGEPROC m_eglCreateImage = nullptr;
73 const PFNEGLDESTROYIMAGEPROC m_eglDestroyImage = nullptr;
74#endif
75#if defined(EGL_KHR_image)
76 const PFNEGLCREATEIMAGEKHRPROC m_eglCreateImageKHR = nullptr;
77 const PFNEGLDESTROYIMAGEKHRPROC m_eglDestroyImageKHR = nullptr;
78#endif
79#if defined(EGL_EXT_image_dma_buf_import_modifiers)
80 const PFNEGLQUERYDMABUFMODIFIERSEXTPROC m_eglQueryDmaBufModifiersEXT = nullptr;
81#endif
82};
83
84} // namespace QtMultimediaPrivate
85
86QT_END_NAMESPACE
87
88#endif // QEGLIMAGEFUNCTIONS_P_H
std::optional< bool > isDmaBufModifierSupported(EGLDisplay display, DRMFormat drmFormat, DRMModifier modifier) const
void glEGLImageTargetTexture2DOES(GLenum, GLeglImageOES) const
EGLBoolean eglDestroyImage(EGLDisplay, EGLImage) const
std::optional< bool > isDmaBufModifierExternalOesOnly(EGLDisplay display, DRMFormat drmFormat, DRMModifier modifier) const
EGLImageHandle eglCreateImage(EGLDisplay, EGLContext, EGLenum, EGLClientBuffer, QSpan< const EGLAttrib > attribs={}) const