|
1 // Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // Header file for guest egl implementation |
|
15 |
|
16 #ifndef EGLAPI_H_ |
|
17 #define EGLAPI_H_ |
|
18 |
|
19 // INCLUDES |
|
20 #include <e32std.h> |
|
21 #include <e32base.h> |
|
22 #include <e32hashtab.h> |
|
23 #include <w32std.h> |
|
24 #include <graphics/surface.h> |
|
25 #include <graphics/surfaceupdateclient.h> |
|
26 #include <pixelformats.h> |
|
27 #include <e32cmn.h> |
|
28 |
|
29 #ifdef FAISALMEMON_S4_SGIMAGE |
|
30 #include <sgresource/sgimage.h> |
|
31 #endif |
|
32 |
|
33 #define EGL_EGLEXT_PROTOTYPES |
|
34 #include <EGL/egl.h> |
|
35 |
|
36 class CEglSyncExtension; |
|
37 #include "remotefunctioncall.h" // data serialisation data types |
|
38 #include "eglsync.h" // EGL Sync extension |
|
39 #include "eglrfc.h" // data serialisation stuff |
|
40 #include "vghwutils.h" // VGHW Utils DLL |
|
41 #include "guestegl.h" // CGuestEGL class |
|
42 |
|
43 |
|
44 extern CGuestEGL* guestEGL; |
|
45 |
|
46 /* |
|
47 Change value to control how much tracing is generated in UDEB builds |
|
48 0 = API traces only |
|
49 1 = API traces and parameter validation diagnostics |
|
50 2 = API traces, param validation, extra diagnostics |
|
51 */ |
|
52 #define EGL_TRACE_LEVEL 0 |
|
53 |
|
54 /* |
|
55 EGL version info |
|
56 */ |
|
57 #define EGL_VERSION_MAJOR 1 |
|
58 #define EGL_VERSION_MINOR 4 |
|
59 #define MAKE_VERSION_STRING(major, minor) #major "." #minor |
|
60 |
|
61 // tracing |
|
62 #include <e32debug.h> |
|
63 #ifdef _DEBUG |
|
64 #define EGL_TRACE(fmt, args...) RDebug::Printf(fmt, ##args) |
|
65 #define EGL_TRACE_DETAIL(level, fmt, args...) if (level <= EGL_TRACE_LEVEL) RDebug::Printf(fmt, ##args) |
|
66 #define EGLPANIC_ASSERT(condition, panic) if (!(condition)) { EglPanic(panic, #panic, #condition, __FILE__, __LINE__); } |
|
67 #define EGLPANIC_ASSERT_DEBUG(condition, panic) if (!(condition)) { EglPanic(panic, #panic, #condition, __FILE__, __LINE__); } |
|
68 #define EGLPANIC_ALWAYS(panic) { EglPanic(panic, #panic, NULL, __FILE__, __LINE__); } |
|
69 #define EGLPANIC_DEBUG(panic) { EglPanic(panic, #panic, NULL, __FILE__, __LINE__); } |
|
70 #define EGL_TRACE_ATTRIB_LIST(aAttribList) TAttribUtils::TraceAttribList(aAttribList) |
|
71 #define EGL_TRACE_GET_ATTRIB(N, T, D, O, A, V, R) TAttribUtils::TraceGetAttrib(N, T, D, O, A, V, R) |
|
72 #define EGL_TRACE_SET_ATTRIB(N, T, D, O, A, V) TAttribUtils::TraceSetAttrib(N, T, D, O, A, V) |
|
73 #else |
|
74 #define EGL_TRACE(fmt, args...) |
|
75 #define EGL_TRACE_DETAIL(level, fmt, args...) |
|
76 #define EGLPANIC_ASSERT(condition, panic) if (!(condition)) { EglPanic(panic, NULL, NULL, NULL, __LINE__); } |
|
77 #define EGLPANIC_ASSERT_DEBUG(condition, panic) |
|
78 #define EGLPANIC_ALWAYS(panic) { EglPanic(panic, NULL, NULL, NULL, __LINE__); } |
|
79 #define EGLPANIC_DEBUG(panic) |
|
80 #define EGL_TRACE_ATTRIB_LIST(aAttribList) |
|
81 #define EGL_TRACE_GET_ATTRIB(N, T, D, O, A, V, R) |
|
82 #define EGL_TRACE_SET_ATTRIB(N, T, D, O, A, V) |
|
83 #endif |
|
84 |
|
85 |
|
86 // Guest EGL panic codes |
|
87 typedef enum |
|
88 { |
|
89 EEglPanicCGuestEGLAllocFailed=1, |
|
90 EEglPanicDisplayMapLockCreateLocalFailed, |
|
91 EEglPanicGuestGraphicsAllocFailed, |
|
92 EEglPanicSgImageHandleInvalid, |
|
93 EEglPanicExtensionListAllocFailed, |
|
94 EEglPanicExtensionListCreationError, |
|
95 EEglPanicHostAndClientBoundApiOutOfSync, |
|
96 EEglPanicUnexpectedBoundApi, |
|
97 EEglPanicSymbianPixmapNotSetInSurface, |
|
98 EEglPanicSymbianWindowNotSetInSurface, // 10 |
|
99 EEglPanicHostAndClientEglInitOutOfSync, |
|
100 EEglPanicHostAndClientEglTerminateOutOfSync, |
|
101 EEglPanicErrorNotSet, |
|
102 EEglPanicThreadStateNotValidInInternalFunction, |
|
103 EEglPanicNotReplyOpcode, |
|
104 EEglPanicDisplayMapInsertFailed, |
|
105 EEglPanicEglSyncDisplayCreateFailed, |
|
106 EEglPanicReleaseInvalidDisplay, |
|
107 EEglPanicNullDisplayPointerInMap, |
|
108 EEglPanicLockedDisplayNotFound, // 20 |
|
109 EEglPanicStrayDisplayUnlock, |
|
110 EEglPanicDisplayNotLockedForWriting, |
|
111 EEglPanicDisplayAlreadyLocked, |
|
112 EEglPanicReadLockExpected, |
|
113 EEglPanicReadFromUnlockedDisplay, |
|
114 EEglPanicDisplayAlreadyInMap, |
|
115 EEglPanicDisplayNotFound, |
|
116 EEglPanicSgDriverCreateLocalFailed, |
|
117 EEglPanicInvalidNativePixmap, |
|
118 EEglPanicEglImageLockCreateLocalFailed, // 30 |
|
119 EEglPanicBadSgDriverVersion, |
|
120 EEglPanicEglImageRefCountNonZero, |
|
121 EEglPanicEglImageIsDestroyed, |
|
122 EEglPanicAtribListLengthTooLong, |
|
123 EEglPanicTemp, // temporary panic in development code |
|
124 } TEglPanic; |
|
125 |
|
126 void EglPanic(TEglPanic aPanicCode, char* aPanicName, char* aCondition, char* aFile, TInt aLine); |
|
127 |
|
128 |
|
129 inline CGuestEGL& Instance() |
|
130 { |
|
131 CGuestEGL* result = (CGuestEGL*)guestEGL; // read value and cast away volatile attribute |
|
132 EGLPANIC_ASSERT(result, EEglPanicTemp); |
|
133 return *result; |
|
134 } |
|
135 |
|
136 #endif /* EGLAPI_H_ */ |