| 1 | /****************************************************************************
|
|---|
| 2 | **
|
|---|
| 3 | ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
|---|
| 4 | ** All rights reserved.
|
|---|
| 5 | ** Contact: Nokia Corporation ([email protected])
|
|---|
| 6 | **
|
|---|
| 7 | ** This file is part of the plugins of the Qt Toolkit.
|
|---|
| 8 | **
|
|---|
| 9 | ** $QT_BEGIN_LICENSE:LGPL$
|
|---|
| 10 | ** Commercial Usage
|
|---|
| 11 | ** Licensees holding valid Qt Commercial licenses may use this file in
|
|---|
| 12 | ** accordance with the Qt Commercial License Agreement provided with the
|
|---|
| 13 | ** Software or, alternatively, in accordance with the terms contained in
|
|---|
| 14 | ** a written agreement between you and Nokia.
|
|---|
| 15 | **
|
|---|
| 16 | ** GNU Lesser General Public License Usage
|
|---|
| 17 | ** Alternatively, this file may be used under the terms of the GNU Lesser
|
|---|
| 18 | ** General Public License version 2.1 as published by the Free Software
|
|---|
| 19 | ** Foundation and appearing in the file LICENSE.LGPL included in the
|
|---|
| 20 | ** packaging of this file. Please review the following information to
|
|---|
| 21 | ** ensure the GNU Lesser General Public License version 2.1 requirements
|
|---|
| 22 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|---|
| 23 | **
|
|---|
| 24 | ** In addition, as a special exception, Nokia gives you certain additional
|
|---|
| 25 | ** rights. These rights are described in the Nokia Qt LGPL Exception
|
|---|
| 26 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|---|
| 27 | **
|
|---|
| 28 | ** GNU General Public License Usage
|
|---|
| 29 | ** Alternatively, this file may be used under the terms of the GNU
|
|---|
| 30 | ** General Public License version 3.0 as published by the Free Software
|
|---|
| 31 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
|---|
| 32 | ** packaging of this file. Please review the following information to
|
|---|
| 33 | ** ensure the GNU General Public License version 3.0 requirements will be
|
|---|
| 34 | ** met: http://www.gnu.org/copyleft/gpl.html.
|
|---|
| 35 | **
|
|---|
| 36 | ** If you have questions regarding the use of this file, please contact
|
|---|
| 37 | ** Nokia at [email protected].
|
|---|
| 38 | ** $QT_END_LICENSE$
|
|---|
| 39 | **
|
|---|
| 40 | ****************************************************************************/
|
|---|
| 41 |
|
|---|
| 42 | #ifndef MEXTENSIONS_H
|
|---|
| 43 | #define MEXTENSIONS_H
|
|---|
| 44 |
|
|---|
| 45 | #include <private/qgl_p.h>
|
|---|
| 46 | #include <private/qeglcontext_p.h>
|
|---|
| 47 | #include <private/qpixmapdata_gl_p.h>
|
|---|
| 48 | #include <EGL/egl.h>
|
|---|
| 49 | #include <GLES2/gl2.h>
|
|---|
| 50 | #include <GLES2/gl2ext.h>
|
|---|
| 51 |
|
|---|
| 52 | /* Extensions decls */
|
|---|
| 53 |
|
|---|
| 54 | #ifndef EGL_SHARED_IMAGE_NOK
|
|---|
| 55 | #define EGL_SHARED_IMAGE_NOK 0x30DA
|
|---|
| 56 | typedef void* EGLNativeSharedImageTypeNOK;
|
|---|
| 57 | #endif
|
|---|
| 58 |
|
|---|
| 59 | #ifndef EGL_GL_TEXTURE_2D_KHR
|
|---|
| 60 | #define EGL_GL_TEXTURE_2D_KHR 0x30B1
|
|---|
| 61 | #endif
|
|---|
| 62 |
|
|---|
| 63 | #ifndef EGL_FIXED_WIDTH_NOK
|
|---|
| 64 | #define EGL_FIXED_WIDTH_NOK 0x30DB
|
|---|
| 65 | #define EGL_FIXED_HEIGHT_NOK 0x30DC
|
|---|
| 66 | #endif
|
|---|
| 67 |
|
|---|
| 68 | #ifndef EGL_BITMAP_POINTER_KHR
|
|---|
| 69 | #define EGL_BITMAP_POINTER_KHR 0x30C6
|
|---|
| 70 | #define EGL_BITMAP_PITCH_KHR 0x30C7
|
|---|
| 71 | #endif
|
|---|
| 72 |
|
|---|
| 73 | #ifndef EGL_MAP_PRESERVE_PIXELS_KHR
|
|---|
| 74 | #define EGL_MAP_PRESERVE_PIXELS_KHR 0x30C4
|
|---|
| 75 | #define EGL_LOCK_USAGE_HINT_KHR 0x30C5
|
|---|
| 76 | #define EGL_READ_SURFACE_BIT_KHR 0x0001
|
|---|
| 77 | #define EGL_WRITE_SURFACE_BIT_KHR 0x0002
|
|---|
| 78 | #endif
|
|---|
| 79 |
|
|---|
| 80 | #ifndef EGL_SYNC_FENCE_KHR
|
|---|
| 81 | #define EGL_SYNC_FENCE_KHR 0x30F9
|
|---|
| 82 | #define EGL_SYNC_TYPE_KHR 0x30F7
|
|---|
| 83 | #define EGL_SYNC_STATUS_KHR 0x30F1
|
|---|
| 84 | #define EGL_SYNC_CONDITION_KHR 0x30F8
|
|---|
| 85 | #define EGL_SIGNALED_KHR 0x30F2
|
|---|
| 86 | #define EGL_UNSIGNALED_KHR 0x30F3
|
|---|
| 87 | #define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR 0x30F0
|
|---|
| 88 | #define EGL_SYNC_FLUSH_COMMANDS_BIT_KHR 0x0001
|
|---|
| 89 | #define EGL_FOREVER_KHR 0xFFFFFFFFFFFFFFFFull
|
|---|
| 90 | #define EGL_TIMEOUT_EXPIRED_KHR 0x30F5
|
|---|
| 91 | #define EGL_CONDITION_SATISFIED_KHR 0x30F6
|
|---|
| 92 | #define EGL_NO_SYNC_KHR ((EGLSyncKHR)0)
|
|---|
| 93 | typedef void* EGLSyncKHR;
|
|---|
| 94 | typedef khronos_utime_nanoseconds_t EGLTimeKHR;
|
|---|
| 95 | #endif
|
|---|
| 96 |
|
|---|
| 97 | /* Class */
|
|---|
| 98 |
|
|---|
| 99 | class QMeeGoExtensions
|
|---|
| 100 | {
|
|---|
| 101 | public:
|
|---|
| 102 | static void ensureInitialized();
|
|---|
| 103 |
|
|---|
| 104 | static EGLNativeSharedImageTypeNOK eglCreateSharedImageNOK(EGLDisplay dpy, EGLImageKHR image, EGLint *props);
|
|---|
| 105 | static bool eglQueryImageNOK(EGLDisplay dpy, EGLImageKHR image, EGLint prop, EGLint *v);
|
|---|
| 106 | static bool eglDestroySharedImageNOK(EGLDisplay dpy, EGLNativeSharedImageTypeNOK img);
|
|---|
| 107 | static bool eglSetSurfaceScalingNOK(EGLDisplay dpy, EGLSurface surface, int x, int y, int width, int height);
|
|---|
| 108 | static bool eglLockSurfaceKHR(EGLDisplay display, EGLSurface surface, const EGLint *attrib_list);
|
|---|
| 109 | static bool eglUnlockSurfaceKHR(EGLDisplay display, EGLSurface surface);
|
|---|
| 110 | static EGLSyncKHR eglCreateSyncKHR(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list);
|
|---|
| 111 | static bool eglDestroySyncKHR(EGLDisplay dpy, EGLSyncKHR sync);
|
|---|
| 112 | static EGLint eglClientWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout);
|
|---|
| 113 | static EGLBoolean eglGetSyncAttribKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value);
|
|---|
| 114 |
|
|---|
| 115 | private:
|
|---|
| 116 | static void initialize();
|
|---|
| 117 |
|
|---|
| 118 | static bool initialized;
|
|---|
| 119 | static bool hasImageShared;
|
|---|
| 120 | static bool hasSurfaceScaling;
|
|---|
| 121 | static bool hasLockSurface;
|
|---|
| 122 | static bool hasFenceSync;
|
|---|
| 123 | };
|
|---|
| 124 |
|
|---|
| 125 | #endif
|
|---|