blob: a645068cce5eb7015b519497f22d6f0298190bef (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
// Copyright (C) 2025 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef GL_OZONE_QT_H
#define GL_OZONE_QT_H
#include "ui/ozone/common/gl_ozone_egl.h"
namespace ui {
// Based on //ui/ozone/platform/x11/x11_surface_factory.cc
enum class NativePixmapSupportType {
// Importing native pixmaps not supported.
kNone,
// Native pixmaps are imported directly into EGL using the
// EGL_EXT_image_dma_buf_import extension.
kDMABuf,
// Native pixmaps are first imported as X11 pixmaps using DRI3 and then into
// EGL.
kX11Pixmap,
};
class GLOzoneQt : public GLOzoneEGL
{
public:
static NativePixmapSupportType getNativePixmapSupportType();
bool InitializeStaticGLBindings(const gl::GLImplementationParts &implementation) override;
bool InitializeExtensionSettingsOneOffPlatform(gl::GLDisplay *display) override;
scoped_refptr<gl::GLSurface> CreateViewGLSurface(gl::GLDisplay *display,
gfx::AcceleratedWidget window) override;
scoped_refptr<gl::GLSurface> CreateOffscreenGLSurface(gl::GLDisplay *display,
const gfx::Size &size) override;
bool CanImportNativePixmap(gfx::BufferFormat format) override;
std::unique_ptr<NativePixmapGLBinding>
ImportNativePixmap(scoped_refptr<gfx::NativePixmap> pixmap, gfx::BufferFormat plane_format,
gfx::BufferPlane plane, gfx::Size plane_size,
const gfx::ColorSpace &color_space, GLenum target,
GLuint texture_id) override;
protected:
// Returns native platform display handle. This is used to obtain the EGL
// display connection for the native display.
gl::EGLDisplayPlatform GetNativeDisplay() override;
// Sets up GL bindings for the native surface.
bool LoadGLES2Bindings(const gl::GLImplementationParts &implementation) override;
};
class GLOzoneANGLEQt : public GLOzoneQt
{
protected:
bool LoadGLES2Bindings(const gl::GLImplementationParts &implementation) override;
};
class GLOzoneEGLQt : public GLOzoneQt
{
public:
void ShutdownGL(gl::GLDisplay *display) override;
protected:
bool LoadGLES2Bindings(const gl::GLImplementationParts &implementation) override;
private:
void *m_nativeEGLHandle = nullptr;
};
} // namespace ui
#endif // GL_OZONE_QT_H
|