diff options
| author | manuel <manuel@mausz.at> | 2020-10-19 00:52:24 +0200 |
|---|---|---|
| committer | manuel <manuel@mausz.at> | 2020-10-19 00:52:24 +0200 |
| commit | be933ef2241d79558f91796cc5b3a161f72ebf9c (patch) | |
| tree | fe3ab2f130e20c99001f2d7a81d610c78c96a3f4 /xbmc/utils/EGLImage.h | |
| parent | 5f8335c1e49ce108ef3481863833c98efa00411b (diff) | |
| download | kodi-pvr-build-be933ef2241d79558f91796cc5b3a161f72ebf9c.tar.gz kodi-pvr-build-be933ef2241d79558f91796cc5b3a161f72ebf9c.tar.bz2 kodi-pvr-build-be933ef2241d79558f91796cc5b3a161f72ebf9c.zip | |
sync with upstream
Diffstat (limited to 'xbmc/utils/EGLImage.h')
| -rw-r--r-- | xbmc/utils/EGLImage.h | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/xbmc/utils/EGLImage.h b/xbmc/utils/EGLImage.h new file mode 100644 index 0000000..d9a63e5 --- /dev/null +++ b/xbmc/utils/EGLImage.h | |||
| @@ -0,0 +1,58 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2017-2018 Team Kodi | ||
| 3 | * This file is part of Kodi - https://kodi.tv | ||
| 4 | * | ||
| 5 | * SPDX-License-Identifier: GPL-2.0-or-later | ||
| 6 | * See LICENSES/README.md for more information. | ||
| 7 | */ | ||
| 8 | |||
| 9 | #pragma once | ||
| 10 | |||
| 11 | #include <array> | ||
| 12 | |||
| 13 | #include <EGL/egl.h> | ||
| 14 | #include <EGL/eglext.h> | ||
| 15 | #include <drm_fourcc.h> | ||
| 16 | |||
| 17 | #include "system_gl.h" | ||
| 18 | |||
| 19 | class CEGLImage | ||
| 20 | { | ||
| 21 | public: | ||
| 22 | static const int MAX_NUM_PLANES{3}; | ||
| 23 | |||
| 24 | struct EglPlane | ||
| 25 | { | ||
| 26 | int fd{0}; | ||
| 27 | int offset{0}; | ||
| 28 | int pitch{0}; | ||
| 29 | uint64_t modifier{DRM_FORMAT_MOD_INVALID}; | ||
| 30 | }; | ||
| 31 | |||
| 32 | struct EglAttrs | ||
| 33 | { | ||
| 34 | int width{0}; | ||
| 35 | int height{0}; | ||
| 36 | uint32_t format{0}; | ||
| 37 | int colorSpace{0}; | ||
| 38 | int colorRange{0}; | ||
| 39 | std::array<EglPlane, MAX_NUM_PLANES> planes; | ||
| 40 | }; | ||
| 41 | |||
| 42 | explicit CEGLImage(EGLDisplay display); | ||
| 43 | |||
| 44 | CEGLImage(CEGLImage const& other) = delete; | ||
| 45 | CEGLImage& operator=(CEGLImage const& other) = delete; | ||
| 46 | |||
| 47 | bool CreateImage(EglAttrs imageAttrs); | ||
| 48 | void UploadImage(GLenum textureTarget); | ||
| 49 | void DestroyImage(); | ||
| 50 | |||
| 51 | private: | ||
| 52 | EGLDisplay m_display{nullptr}; | ||
| 53 | EGLImageKHR m_image{nullptr}; | ||
| 54 | |||
| 55 | PFNEGLCREATEIMAGEKHRPROC m_eglCreateImageKHR{nullptr}; | ||
| 56 | PFNEGLDESTROYIMAGEKHRPROC m_eglDestroyImageKHR{nullptr}; | ||
| 57 | PFNGLEGLIMAGETARGETTEXTURE2DOESPROC m_glEGLImageTargetTexture2DOES{nullptr}; | ||
| 58 | }; | ||
