author | Faisal Memon <faisal.memon@nokia.com> |
Fri, 24 Sep 2010 10:52:02 +0100 | |
branch | bug235_bringup_0 |
changeset 40 | eaa1315a8556 |
parent 39 | c8311e991ee3 |
child 41 | 2110890eb027 |
permissions | -rwxr-xr-x |
13 | 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 |
// Guest EGL implementation |
|
15 |
||
16 |
#include <graphics/surfacemanager.h> |
|
17 |
#include <graphics/surfaceconfiguration.h> |
|
18 |
#include <graphics/suerror.h> |
|
19 |
#include <graphics/surface_hints.h> |
|
20 |
#include <e32debug.h> |
|
21 |
#include <stdlib.h> // for malloc |
|
22 |
#include "eglapi.h" |
|
23 |
||
24 |
#include <graphics/guestvideodriverinterfaceconstants.h> |
|
25 |
||
26 |
||
27 |
// FAISALMEMON HOLE 0 |
|
28 |
||
29 |
// ----------------------------------------------------------------------------- |
|
30 |
// constructor |
|
31 |
// ----------------------------------------------------------------------------- |
|
32 |
// |
|
33 |
||
34 |
// FAISALMEMON STUB CODE |
|
35 |
#define EGL_CHECK_ERROR(a, b, c) /* This does no checking; just a stub */ |
|
36 |
void CGuestEGL::EglInternalFunction_DestroyWindowSurface(TSurfaceInfo&) |
|
37 |
{ |
|
38 |
return; // stub code |
|
39 |
} |
|
40 |
||
41 |
EGLBoolean CGuestEGL::EglInternalFunction_SurfaceResized(TEglThreadState&, TSurfaceInfo&, int, int) |
|
42 |
{ |
|
43 |
return EFalse; // stub code |
|
44 |
} |
|
45 |
||
46 |
TBool CGuestEGL::EglInternalFunction_SwapWindowSurface(TEglThreadState&, int, int) |
|
47 |
{ |
|
48 |
return EFalse; // stub code |
|
49 |
} |
|
50 |
TSymbianPixmapTypeId CGuestEGL::EglInternalFunction_GetNativePixmapType(void*) |
|
51 |
{ |
|
52 |
return EPixmapTypeNone; // stub code |
|
53 |
} |
|
54 |
TBool CGuestEGL::EglInternalFunction_IsValidNativePixmap(void*, TSymbianPixmapTypeId) |
|
55 |
{ |
|
56 |
return EFalse; // stub code |
|
57 |
} |
|
58 |
const char * CGuestEGL::EglInternalFunction_QueryExtensionList() |
|
59 |
{ |
|
60 |
return NULL; // stub code |
|
61 |
} |
|
18
3064c37a6509
Add TPIP-free implementation of eglGetProcAddress
Faisal Memon <faisal.memon@nokia.com>
parents:
17
diff
changeset
|
62 |
|
3064c37a6509
Add TPIP-free implementation of eglGetProcAddress
Faisal Memon <faisal.memon@nokia.com>
parents:
17
diff
changeset
|
63 |
/** |
3064c37a6509
Add TPIP-free implementation of eglGetProcAddress
Faisal Memon <faisal.memon@nokia.com>
parents:
17
diff
changeset
|
64 |
Obtain extension function pointer. |
3064c37a6509
Add TPIP-free implementation of eglGetProcAddress
Faisal Memon <faisal.memon@nokia.com>
parents:
17
diff
changeset
|
65 |
|
3064c37a6509
Add TPIP-free implementation of eglGetProcAddress
Faisal Memon <faisal.memon@nokia.com>
parents:
17
diff
changeset
|
66 |
Provide support for the Symbian Graphics SHAI for EGL Extensions |
3064c37a6509
Add TPIP-free implementation of eglGetProcAddress
Faisal Memon <faisal.memon@nokia.com>
parents:
17
diff
changeset
|
67 |
@param aName Name of extension |
3064c37a6509
Add TPIP-free implementation of eglGetProcAddress
Faisal Memon <faisal.memon@nokia.com>
parents:
17
diff
changeset
|
68 |
@return Function pointer, or NULL if not available. |
3064c37a6509
Add TPIP-free implementation of eglGetProcAddress
Faisal Memon <faisal.memon@nokia.com>
parents:
17
diff
changeset
|
69 |
|
19
da7c1a80df0d
Identify the actual EGL extension functions, just returning NULL for the moment. Prototype code, needs bring-up before testing
Faisal Memon <faisal.memon@nokia.com>
parents:
18
diff
changeset
|
70 |
@note Known extensions and their directly associated functions: |
da7c1a80df0d
Identify the actual EGL extension functions, just returning NULL for the moment. Prototype code, needs bring-up before testing
Faisal Memon <faisal.memon@nokia.com>
parents:
18
diff
changeset
|
71 |
1. EGL_KHR_image |
da7c1a80df0d
Identify the actual EGL extension functions, just returning NULL for the moment. Prototype code, needs bring-up before testing
Faisal Memon <faisal.memon@nokia.com>
parents:
18
diff
changeset
|
72 |
None |
da7c1a80df0d
Identify the actual EGL extension functions, just returning NULL for the moment. Prototype code, needs bring-up before testing
Faisal Memon <faisal.memon@nokia.com>
parents:
18
diff
changeset
|
73 |
2. EGL_KHR_image_base |
da7c1a80df0d
Identify the actual EGL extension functions, just returning NULL for the moment. Prototype code, needs bring-up before testing
Faisal Memon <faisal.memon@nokia.com>
parents:
18
diff
changeset
|
74 |
eglCreateImageKHR, |
da7c1a80df0d
Identify the actual EGL extension functions, just returning NULL for the moment. Prototype code, needs bring-up before testing
Faisal Memon <faisal.memon@nokia.com>
parents:
18
diff
changeset
|
75 |
eglDestroyImageKHR |
18
3064c37a6509
Add TPIP-free implementation of eglGetProcAddress
Faisal Memon <faisal.memon@nokia.com>
parents:
17
diff
changeset
|
76 |
3. EGL_KHR_image_pixmap |
19
da7c1a80df0d
Identify the actual EGL extension functions, just returning NULL for the moment. Prototype code, needs bring-up before testing
Faisal Memon <faisal.memon@nokia.com>
parents:
18
diff
changeset
|
77 |
None |
18
3064c37a6509
Add TPIP-free implementation of eglGetProcAddress
Faisal Memon <faisal.memon@nokia.com>
parents:
17
diff
changeset
|
78 |
4. EGL_KHR_vg_parent_image |
19
da7c1a80df0d
Identify the actual EGL extension functions, just returning NULL for the moment. Prototype code, needs bring-up before testing
Faisal Memon <faisal.memon@nokia.com>
parents:
18
diff
changeset
|
79 |
None |
18
3064c37a6509
Add TPIP-free implementation of eglGetProcAddress
Faisal Memon <faisal.memon@nokia.com>
parents:
17
diff
changeset
|
80 |
5. EGL_KHR_gl_texture_2D_image |
19
da7c1a80df0d
Identify the actual EGL extension functions, just returning NULL for the moment. Prototype code, needs bring-up before testing
Faisal Memon <faisal.memon@nokia.com>
parents:
18
diff
changeset
|
81 |
None |
18
3064c37a6509
Add TPIP-free implementation of eglGetProcAddress
Faisal Memon <faisal.memon@nokia.com>
parents:
17
diff
changeset
|
82 |
6. EGL_KHR_gl_texture_cubemap_image |
19
da7c1a80df0d
Identify the actual EGL extension functions, just returning NULL for the moment. Prototype code, needs bring-up before testing
Faisal Memon <faisal.memon@nokia.com>
parents:
18
diff
changeset
|
83 |
EGLImageTargetTexture2DOES, |
da7c1a80df0d
Identify the actual EGL extension functions, just returning NULL for the moment. Prototype code, needs bring-up before testing
Faisal Memon <faisal.memon@nokia.com>
parents:
18
diff
changeset
|
84 |
EGLImageTargetRenderbufferStorageOES |
da7c1a80df0d
Identify the actual EGL extension functions, just returning NULL for the moment. Prototype code, needs bring-up before testing
Faisal Memon <faisal.memon@nokia.com>
parents:
18
diff
changeset
|
85 |
7. EGL_KHR_lock_surface2 |
da7c1a80df0d
Identify the actual EGL extension functions, just returning NULL for the moment. Prototype code, needs bring-up before testing
Faisal Memon <faisal.memon@nokia.com>
parents:
18
diff
changeset
|
86 |
eglLockSurfaceKHR, |
da7c1a80df0d
Identify the actual EGL extension functions, just returning NULL for the moment. Prototype code, needs bring-up before testing
Faisal Memon <faisal.memon@nokia.com>
parents:
18
diff
changeset
|
87 |
eglUnlockSurfaceKHR |
18
3064c37a6509
Add TPIP-free implementation of eglGetProcAddress
Faisal Memon <faisal.memon@nokia.com>
parents:
17
diff
changeset
|
88 |
8. EGL_NOK_resource_profiling2 |
19
da7c1a80df0d
Identify the actual EGL extension functions, just returning NULL for the moment. Prototype code, needs bring-up before testing
Faisal Memon <faisal.memon@nokia.com>
parents:
18
diff
changeset
|
89 |
eglQueryProfilingDataNOK |
18
3064c37a6509
Add TPIP-free implementation of eglGetProcAddress
Faisal Memon <faisal.memon@nokia.com>
parents:
17
diff
changeset
|
90 |
9. EGL_SYMBIAN_composition |
19
da7c1a80df0d
Identify the actual EGL extension functions, just returning NULL for the moment. Prototype code, needs bring-up before testing
Faisal Memon <faisal.memon@nokia.com>
parents:
18
diff
changeset
|
91 |
None |
18
3064c37a6509
Add TPIP-free implementation of eglGetProcAddress
Faisal Memon <faisal.memon@nokia.com>
parents:
17
diff
changeset
|
92 |
10. EGL_NOK_image_endpoint |
19
da7c1a80df0d
Identify the actual EGL extension functions, just returning NULL for the moment. Prototype code, needs bring-up before testing
Faisal Memon <faisal.memon@nokia.com>
parents:
18
diff
changeset
|
93 |
eglCreateEndpointNOK, |
da7c1a80df0d
Identify the actual EGL extension functions, just returning NULL for the moment. Prototype code, needs bring-up before testing
Faisal Memon <faisal.memon@nokia.com>
parents:
18
diff
changeset
|
94 |
eglDestroyEndpointNOK, |
da7c1a80df0d
Identify the actual EGL extension functions, just returning NULL for the moment. Prototype code, needs bring-up before testing
Faisal Memon <faisal.memon@nokia.com>
parents:
18
diff
changeset
|
95 |
eglGetEndpointAttribNOK, |
da7c1a80df0d
Identify the actual EGL extension functions, just returning NULL for the moment. Prototype code, needs bring-up before testing
Faisal Memon <faisal.memon@nokia.com>
parents:
18
diff
changeset
|
96 |
eglSetEndpointAttribNOK, |
da7c1a80df0d
Identify the actual EGL extension functions, just returning NULL for the moment. Prototype code, needs bring-up before testing
Faisal Memon <faisal.memon@nokia.com>
parents:
18
diff
changeset
|
97 |
eglEndpointBeginStreamingNOK, |
da7c1a80df0d
Identify the actual EGL extension functions, just returning NULL for the moment. Prototype code, needs bring-up before testing
Faisal Memon <faisal.memon@nokia.com>
parents:
18
diff
changeset
|
98 |
eglEndpointEndStreamingNOK, |
da7c1a80df0d
Identify the actual EGL extension functions, just returning NULL for the moment. Prototype code, needs bring-up before testing
Faisal Memon <faisal.memon@nokia.com>
parents:
18
diff
changeset
|
99 |
eglAcquireImageNOK, |
da7c1a80df0d
Identify the actual EGL extension functions, just returning NULL for the moment. Prototype code, needs bring-up before testing
Faisal Memon <faisal.memon@nokia.com>
parents:
18
diff
changeset
|
100 |
eglReleaseImageNOK, |
da7c1a80df0d
Identify the actual EGL extension functions, just returning NULL for the moment. Prototype code, needs bring-up before testing
Faisal Memon <faisal.memon@nokia.com>
parents:
18
diff
changeset
|
101 |
eglGetEndpointDirtyAreaNOK, |
da7c1a80df0d
Identify the actual EGL extension functions, just returning NULL for the moment. Prototype code, needs bring-up before testing
Faisal Memon <faisal.memon@nokia.com>
parents:
18
diff
changeset
|
102 |
eglEndpointRequestNotificationNOK, |
da7c1a80df0d
Identify the actual EGL extension functions, just returning NULL for the moment. Prototype code, needs bring-up before testing
Faisal Memon <faisal.memon@nokia.com>
parents:
18
diff
changeset
|
103 |
eglEndpointCancelNotificationNOK, |
da7c1a80df0d
Identify the actual EGL extension functions, just returning NULL for the moment. Prototype code, needs bring-up before testing
Faisal Memon <faisal.memon@nokia.com>
parents:
18
diff
changeset
|
104 |
eglCreateEndpointNOK |
18
3064c37a6509
Add TPIP-free implementation of eglGetProcAddress
Faisal Memon <faisal.memon@nokia.com>
parents:
17
diff
changeset
|
105 |
11. NOK_pixmap_type_rsgimage |
19
da7c1a80df0d
Identify the actual EGL extension functions, just returning NULL for the moment. Prototype code, needs bring-up before testing
Faisal Memon <faisal.memon@nokia.com>
parents:
18
diff
changeset
|
106 |
None |
da7c1a80df0d
Identify the actual EGL extension functions, just returning NULL for the moment. Prototype code, needs bring-up before testing
Faisal Memon <faisal.memon@nokia.com>
parents:
18
diff
changeset
|
107 |
12. EGL_NOK_swap_region |
da7c1a80df0d
Identify the actual EGL extension functions, just returning NULL for the moment. Prototype code, needs bring-up before testing
Faisal Memon <faisal.memon@nokia.com>
parents:
18
diff
changeset
|
108 |
eglSwapBuffersRegionNOK |
18
3064c37a6509
Add TPIP-free implementation of eglGetProcAddress
Faisal Memon <faisal.memon@nokia.com>
parents:
17
diff
changeset
|
109 |
|
3064c37a6509
Add TPIP-free implementation of eglGetProcAddress
Faisal Memon <faisal.memon@nokia.com>
parents:
17
diff
changeset
|
110 |
@see Khronos EGL 1.4 Specification, eglGetProcAddress() |
3064c37a6509
Add TPIP-free implementation of eglGetProcAddress
Faisal Memon <faisal.memon@nokia.com>
parents:
17
diff
changeset
|
111 |
@author Faisal Memon Community EGL project |
3064c37a6509
Add TPIP-free implementation of eglGetProcAddress
Faisal Memon <faisal.memon@nokia.com>
parents:
17
diff
changeset
|
112 |
|
3064c37a6509
Add TPIP-free implementation of eglGetProcAddress
Faisal Memon <faisal.memon@nokia.com>
parents:
17
diff
changeset
|
113 |
*/ |
3064c37a6509
Add TPIP-free implementation of eglGetProcAddress
Faisal Memon <faisal.memon@nokia.com>
parents:
17
diff
changeset
|
114 |
ProcPointer CGuestEGL::eglGetProcAddress(const char* aName) |
13 | 115 |
{ |
19
da7c1a80df0d
Identify the actual EGL extension functions, just returning NULL for the moment. Prototype code, needs bring-up before testing
Faisal Memon <faisal.memon@nokia.com>
parents:
18
diff
changeset
|
116 |
if (strncmp("eglCreateImageKHR", aName, strlen("eglCreateImageKHR")) == 0) |
18
3064c37a6509
Add TPIP-free implementation of eglGetProcAddress
Faisal Memon <faisal.memon@nokia.com>
parents:
17
diff
changeset
|
117 |
{ |
3064c37a6509
Add TPIP-free implementation of eglGetProcAddress
Faisal Memon <faisal.memon@nokia.com>
parents:
17
diff
changeset
|
118 |
return NULL; |
3064c37a6509
Add TPIP-free implementation of eglGetProcAddress
Faisal Memon <faisal.memon@nokia.com>
parents:
17
diff
changeset
|
119 |
} |
19
da7c1a80df0d
Identify the actual EGL extension functions, just returning NULL for the moment. Prototype code, needs bring-up before testing
Faisal Memon <faisal.memon@nokia.com>
parents:
18
diff
changeset
|
120 |
else if (strncmp("eglDestroyImageKHR", aName, strlen("eglDestroyImageKHR")) == 0) |
18
3064c37a6509
Add TPIP-free implementation of eglGetProcAddress
Faisal Memon <faisal.memon@nokia.com>
parents:
17
diff
changeset
|
121 |
{ |
3064c37a6509
Add TPIP-free implementation of eglGetProcAddress
Faisal Memon <faisal.memon@nokia.com>
parents:
17
diff
changeset
|
122 |
return NULL; |
3064c37a6509
Add TPIP-free implementation of eglGetProcAddress
Faisal Memon <faisal.memon@nokia.com>
parents:
17
diff
changeset
|
123 |
} |
19
da7c1a80df0d
Identify the actual EGL extension functions, just returning NULL for the moment. Prototype code, needs bring-up before testing
Faisal Memon <faisal.memon@nokia.com>
parents:
18
diff
changeset
|
124 |
else if (strncmp("EGLImageTargetTexture2DOES", aName, strlen("EGLImageTargetTexture2DOES")) == 0) |
18
3064c37a6509
Add TPIP-free implementation of eglGetProcAddress
Faisal Memon <faisal.memon@nokia.com>
parents:
17
diff
changeset
|
125 |
{ |
3064c37a6509
Add TPIP-free implementation of eglGetProcAddress
Faisal Memon <faisal.memon@nokia.com>
parents:
17
diff
changeset
|
126 |
return NULL; |
3064c37a6509
Add TPIP-free implementation of eglGetProcAddress
Faisal Memon <faisal.memon@nokia.com>
parents:
17
diff
changeset
|
127 |
} |
19
da7c1a80df0d
Identify the actual EGL extension functions, just returning NULL for the moment. Prototype code, needs bring-up before testing
Faisal Memon <faisal.memon@nokia.com>
parents:
18
diff
changeset
|
128 |
else if (strncmp("EGLImageTargetRenderbufferStorageOES", aName, strlen("EGLImageTargetRenderbufferStorageOES")) == 0) |
18
3064c37a6509
Add TPIP-free implementation of eglGetProcAddress
Faisal Memon <faisal.memon@nokia.com>
parents:
17
diff
changeset
|
129 |
{ |
3064c37a6509
Add TPIP-free implementation of eglGetProcAddress
Faisal Memon <faisal.memon@nokia.com>
parents:
17
diff
changeset
|
130 |
return NULL; |
3064c37a6509
Add TPIP-free implementation of eglGetProcAddress
Faisal Memon <faisal.memon@nokia.com>
parents:
17
diff
changeset
|
131 |
} |
19
da7c1a80df0d
Identify the actual EGL extension functions, just returning NULL for the moment. Prototype code, needs bring-up before testing
Faisal Memon <faisal.memon@nokia.com>
parents:
18
diff
changeset
|
132 |
else if (strncmp("eglLockSurfaceKHR", aName, strlen("eglLockSurfaceKHR")) == 0) |
18
3064c37a6509
Add TPIP-free implementation of eglGetProcAddress
Faisal Memon <faisal.memon@nokia.com>
parents:
17
diff
changeset
|
133 |
{ |
3064c37a6509
Add TPIP-free implementation of eglGetProcAddress
Faisal Memon <faisal.memon@nokia.com>
parents:
17
diff
changeset
|
134 |
return NULL; |
3064c37a6509
Add TPIP-free implementation of eglGetProcAddress
Faisal Memon <faisal.memon@nokia.com>
parents:
17
diff
changeset
|
135 |
} |
19
da7c1a80df0d
Identify the actual EGL extension functions, just returning NULL for the moment. Prototype code, needs bring-up before testing
Faisal Memon <faisal.memon@nokia.com>
parents:
18
diff
changeset
|
136 |
else if (strncmp("eglUnlockSurfaceKHR", aName, strlen("eglUnlockSurfaceKHR")) == 0) |
18
3064c37a6509
Add TPIP-free implementation of eglGetProcAddress
Faisal Memon <faisal.memon@nokia.com>
parents:
17
diff
changeset
|
137 |
{ |
3064c37a6509
Add TPIP-free implementation of eglGetProcAddress
Faisal Memon <faisal.memon@nokia.com>
parents:
17
diff
changeset
|
138 |
return NULL; |
3064c37a6509
Add TPIP-free implementation of eglGetProcAddress
Faisal Memon <faisal.memon@nokia.com>
parents:
17
diff
changeset
|
139 |
} |
3064c37a6509
Add TPIP-free implementation of eglGetProcAddress
Faisal Memon <faisal.memon@nokia.com>
parents:
17
diff
changeset
|
140 |
else if (strncmp("EGL_KHR_lock_surface", aName, strlen("EGL_KHR_lock_surface")) == 0) |
3064c37a6509
Add TPIP-free implementation of eglGetProcAddress
Faisal Memon <faisal.memon@nokia.com>
parents:
17
diff
changeset
|
141 |
{ |
3064c37a6509
Add TPIP-free implementation of eglGetProcAddress
Faisal Memon <faisal.memon@nokia.com>
parents:
17
diff
changeset
|
142 |
return NULL; |
3064c37a6509
Add TPIP-free implementation of eglGetProcAddress
Faisal Memon <faisal.memon@nokia.com>
parents:
17
diff
changeset
|
143 |
} |
19
da7c1a80df0d
Identify the actual EGL extension functions, just returning NULL for the moment. Prototype code, needs bring-up before testing
Faisal Memon <faisal.memon@nokia.com>
parents:
18
diff
changeset
|
144 |
else if (strncmp("eglQueryProfilingDataNOK", aName, strlen("eglQueryProfilingDataNOK")) == 0) |
da7c1a80df0d
Identify the actual EGL extension functions, just returning NULL for the moment. Prototype code, needs bring-up before testing
Faisal Memon <faisal.memon@nokia.com>
parents:
18
diff
changeset
|
145 |
{ |
da7c1a80df0d
Identify the actual EGL extension functions, just returning NULL for the moment. Prototype code, needs bring-up before testing
Faisal Memon <faisal.memon@nokia.com>
parents:
18
diff
changeset
|
146 |
return NULL; |
da7c1a80df0d
Identify the actual EGL extension functions, just returning NULL for the moment. Prototype code, needs bring-up before testing
Faisal Memon <faisal.memon@nokia.com>
parents:
18
diff
changeset
|
147 |
} |
da7c1a80df0d
Identify the actual EGL extension functions, just returning NULL for the moment. Prototype code, needs bring-up before testing
Faisal Memon <faisal.memon@nokia.com>
parents:
18
diff
changeset
|
148 |
else if (strncmp("eglCreateEndpointNOK", aName, strlen("eglCreateEndpointNOK")) == 0) |
da7c1a80df0d
Identify the actual EGL extension functions, just returning NULL for the moment. Prototype code, needs bring-up before testing
Faisal Memon <faisal.memon@nokia.com>
parents:
18
diff
changeset
|
149 |
{ |
da7c1a80df0d
Identify the actual EGL extension functions, just returning NULL for the moment. Prototype code, needs bring-up before testing
Faisal Memon <faisal.memon@nokia.com>
parents:
18
diff
changeset
|
150 |
return NULL; |
da7c1a80df0d
Identify the actual EGL extension functions, just returning NULL for the moment. Prototype code, needs bring-up before testing
Faisal Memon <faisal.memon@nokia.com>
parents:
18
diff
changeset
|
151 |
} |
da7c1a80df0d
Identify the actual EGL extension functions, just returning NULL for the moment. Prototype code, needs bring-up before testing
Faisal Memon <faisal.memon@nokia.com>
parents:
18
diff
changeset
|
152 |
else if (strncmp("eglDestroyEndpointNOK", aName, strlen("eglDestroyEndpointNOK")) == 0) |
da7c1a80df0d
Identify the actual EGL extension functions, just returning NULL for the moment. Prototype code, needs bring-up before testing
Faisal Memon <faisal.memon@nokia.com>
parents:
18
diff
changeset
|
153 |
{ |
da7c1a80df0d
Identify the actual EGL extension functions, just returning NULL for the moment. Prototype code, needs bring-up before testing
Faisal Memon <faisal.memon@nokia.com>
parents:
18
diff
changeset
|
154 |
return NULL; |
da7c1a80df0d
Identify the actual EGL extension functions, just returning NULL for the moment. Prototype code, needs bring-up before testing
Faisal Memon <faisal.memon@nokia.com>
parents:
18
diff
changeset
|
155 |
} |
da7c1a80df0d
Identify the actual EGL extension functions, just returning NULL for the moment. Prototype code, needs bring-up before testing
Faisal Memon <faisal.memon@nokia.com>
parents:
18
diff
changeset
|
156 |
else if (strncmp("eglGetEndpointAttribNOK", aName, strlen("eglGetEndpointAttribNOK")) == 0) |
da7c1a80df0d
Identify the actual EGL extension functions, just returning NULL for the moment. Prototype code, needs bring-up before testing
Faisal Memon <faisal.memon@nokia.com>
parents:
18
diff
changeset
|
157 |
{ |
da7c1a80df0d
Identify the actual EGL extension functions, just returning NULL for the moment. Prototype code, needs bring-up before testing
Faisal Memon <faisal.memon@nokia.com>
parents:
18
diff
changeset
|
158 |
return NULL; |
da7c1a80df0d
Identify the actual EGL extension functions, just returning NULL for the moment. Prototype code, needs bring-up before testing
Faisal Memon <faisal.memon@nokia.com>
parents:
18
diff
changeset
|
159 |
} |
da7c1a80df0d
Identify the actual EGL extension functions, just returning NULL for the moment. Prototype code, needs bring-up before testing
Faisal Memon <faisal.memon@nokia.com>
parents:
18
diff
changeset
|
160 |
else if (strncmp("eglEndpointBeginStreamingNOK", aName, strlen("eglEndpointBeginStreamingNOK")) == 0) |
18
3064c37a6509
Add TPIP-free implementation of eglGetProcAddress
Faisal Memon <faisal.memon@nokia.com>
parents:
17
diff
changeset
|
161 |
{ |
3064c37a6509
Add TPIP-free implementation of eglGetProcAddress
Faisal Memon <faisal.memon@nokia.com>
parents:
17
diff
changeset
|
162 |
return NULL; |
3064c37a6509
Add TPIP-free implementation of eglGetProcAddress
Faisal Memon <faisal.memon@nokia.com>
parents:
17
diff
changeset
|
163 |
} |
19
da7c1a80df0d
Identify the actual EGL extension functions, just returning NULL for the moment. Prototype code, needs bring-up before testing
Faisal Memon <faisal.memon@nokia.com>
parents:
18
diff
changeset
|
164 |
else if (strncmp("eglEndpointEndStreamingNOK", aName, strlen("eglEndpointEndStreamingNOK")) == 0) |
da7c1a80df0d
Identify the actual EGL extension functions, just returning NULL for the moment. Prototype code, needs bring-up before testing
Faisal Memon <faisal.memon@nokia.com>
parents:
18
diff
changeset
|
165 |
{ |
da7c1a80df0d
Identify the actual EGL extension functions, just returning NULL for the moment. Prototype code, needs bring-up before testing
Faisal Memon <faisal.memon@nokia.com>
parents:
18
diff
changeset
|
166 |
return NULL; |
da7c1a80df0d
Identify the actual EGL extension functions, just returning NULL for the moment. Prototype code, needs bring-up before testing
Faisal Memon <faisal.memon@nokia.com>
parents:
18
diff
changeset
|
167 |
} |
da7c1a80df0d
Identify the actual EGL extension functions, just returning NULL for the moment. Prototype code, needs bring-up before testing
Faisal Memon <faisal.memon@nokia.com>
parents:
18
diff
changeset
|
168 |
else if (strncmp("eglAcquireImageNOK", aName, strlen("eglAcquireImageNOK")) == 0) |
da7c1a80df0d
Identify the actual EGL extension functions, just returning NULL for the moment. Prototype code, needs bring-up before testing
Faisal Memon <faisal.memon@nokia.com>
parents:
18
diff
changeset
|
169 |
{ |
da7c1a80df0d
Identify the actual EGL extension functions, just returning NULL for the moment. Prototype code, needs bring-up before testing
Faisal Memon <faisal.memon@nokia.com>
parents:
18
diff
changeset
|
170 |
return NULL; |
da7c1a80df0d
Identify the actual EGL extension functions, just returning NULL for the moment. Prototype code, needs bring-up before testing
Faisal Memon <faisal.memon@nokia.com>
parents:
18
diff
changeset
|
171 |
} |
da7c1a80df0d
Identify the actual EGL extension functions, just returning NULL for the moment. Prototype code, needs bring-up before testing
Faisal Memon <faisal.memon@nokia.com>
parents:
18
diff
changeset
|
172 |
else if (strncmp("eglReleaseImageNOK", aName, strlen("eglReleaseImageNOK")) == 0) |
18
3064c37a6509
Add TPIP-free implementation of eglGetProcAddress
Faisal Memon <faisal.memon@nokia.com>
parents:
17
diff
changeset
|
173 |
{ |
3064c37a6509
Add TPIP-free implementation of eglGetProcAddress
Faisal Memon <faisal.memon@nokia.com>
parents:
17
diff
changeset
|
174 |
return NULL; |
3064c37a6509
Add TPIP-free implementation of eglGetProcAddress
Faisal Memon <faisal.memon@nokia.com>
parents:
17
diff
changeset
|
175 |
} |
19
da7c1a80df0d
Identify the actual EGL extension functions, just returning NULL for the moment. Prototype code, needs bring-up before testing
Faisal Memon <faisal.memon@nokia.com>
parents:
18
diff
changeset
|
176 |
else if (strncmp("eglGetEndpointDirtyAreaNOK", aName, strlen("eglGetEndpointDirtyAreaNOK")) == 0) |
18
3064c37a6509
Add TPIP-free implementation of eglGetProcAddress
Faisal Memon <faisal.memon@nokia.com>
parents:
17
diff
changeset
|
177 |
{ |
3064c37a6509
Add TPIP-free implementation of eglGetProcAddress
Faisal Memon <faisal.memon@nokia.com>
parents:
17
diff
changeset
|
178 |
return NULL; |
3064c37a6509
Add TPIP-free implementation of eglGetProcAddress
Faisal Memon <faisal.memon@nokia.com>
parents:
17
diff
changeset
|
179 |
} |
19
da7c1a80df0d
Identify the actual EGL extension functions, just returning NULL for the moment. Prototype code, needs bring-up before testing
Faisal Memon <faisal.memon@nokia.com>
parents:
18
diff
changeset
|
180 |
else if (strncmp("eglEndpointRequestNotificationNOK", aName, strlen("eglEndpointRequestNotificationNOK")) == 0) |
da7c1a80df0d
Identify the actual EGL extension functions, just returning NULL for the moment. Prototype code, needs bring-up before testing
Faisal Memon <faisal.memon@nokia.com>
parents:
18
diff
changeset
|
181 |
{ |
da7c1a80df0d
Identify the actual EGL extension functions, just returning NULL for the moment. Prototype code, needs bring-up before testing
Faisal Memon <faisal.memon@nokia.com>
parents:
18
diff
changeset
|
182 |
return NULL; |
da7c1a80df0d
Identify the actual EGL extension functions, just returning NULL for the moment. Prototype code, needs bring-up before testing
Faisal Memon <faisal.memon@nokia.com>
parents:
18
diff
changeset
|
183 |
} |
da7c1a80df0d
Identify the actual EGL extension functions, just returning NULL for the moment. Prototype code, needs bring-up before testing
Faisal Memon <faisal.memon@nokia.com>
parents:
18
diff
changeset
|
184 |
else if (strncmp("eglEndpointCancelNotificationNOK", aName, strlen("eglEndpointCancelNotificationNOK")) == 0) |
da7c1a80df0d
Identify the actual EGL extension functions, just returning NULL for the moment. Prototype code, needs bring-up before testing
Faisal Memon <faisal.memon@nokia.com>
parents:
18
diff
changeset
|
185 |
{ |
da7c1a80df0d
Identify the actual EGL extension functions, just returning NULL for the moment. Prototype code, needs bring-up before testing
Faisal Memon <faisal.memon@nokia.com>
parents:
18
diff
changeset
|
186 |
return NULL; |
da7c1a80df0d
Identify the actual EGL extension functions, just returning NULL for the moment. Prototype code, needs bring-up before testing
Faisal Memon <faisal.memon@nokia.com>
parents:
18
diff
changeset
|
187 |
} |
da7c1a80df0d
Identify the actual EGL extension functions, just returning NULL for the moment. Prototype code, needs bring-up before testing
Faisal Memon <faisal.memon@nokia.com>
parents:
18
diff
changeset
|
188 |
else if (strncmp("eglCreateEndpointNOK", aName, strlen("eglCreateEndpointNOK")) == 0) |
18
3064c37a6509
Add TPIP-free implementation of eglGetProcAddress
Faisal Memon <faisal.memon@nokia.com>
parents:
17
diff
changeset
|
189 |
{ |
3064c37a6509
Add TPIP-free implementation of eglGetProcAddress
Faisal Memon <faisal.memon@nokia.com>
parents:
17
diff
changeset
|
190 |
return NULL; |
3064c37a6509
Add TPIP-free implementation of eglGetProcAddress
Faisal Memon <faisal.memon@nokia.com>
parents:
17
diff
changeset
|
191 |
} |
3064c37a6509
Add TPIP-free implementation of eglGetProcAddress
Faisal Memon <faisal.memon@nokia.com>
parents:
17
diff
changeset
|
192 |
else if (strncmp("eglSwapBuffersRegionNOK", aName, strlen("eglSwapBuffersRegionNOK")) == 0) |
3064c37a6509
Add TPIP-free implementation of eglGetProcAddress
Faisal Memon <faisal.memon@nokia.com>
parents:
17
diff
changeset
|
193 |
{ |
3064c37a6509
Add TPIP-free implementation of eglGetProcAddress
Faisal Memon <faisal.memon@nokia.com>
parents:
17
diff
changeset
|
194 |
return NULL; |
3064c37a6509
Add TPIP-free implementation of eglGetProcAddress
Faisal Memon <faisal.memon@nokia.com>
parents:
17
diff
changeset
|
195 |
} |
3064c37a6509
Add TPIP-free implementation of eglGetProcAddress
Faisal Memon <faisal.memon@nokia.com>
parents:
17
diff
changeset
|
196 |
else |
3064c37a6509
Add TPIP-free implementation of eglGetProcAddress
Faisal Memon <faisal.memon@nokia.com>
parents:
17
diff
changeset
|
197 |
{ |
3064c37a6509
Add TPIP-free implementation of eglGetProcAddress
Faisal Memon <faisal.memon@nokia.com>
parents:
17
diff
changeset
|
198 |
return NULL; |
3064c37a6509
Add TPIP-free implementation of eglGetProcAddress
Faisal Memon <faisal.memon@nokia.com>
parents:
17
diff
changeset
|
199 |
} |
13 | 200 |
} |
201 |
||
39
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
202 |
EGLSurface CGuestEGL::eglCreateWindowSurface(TEglThreadState& aThreadState, EGLDisplay aDisplay, EGLConfig aConfig, |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
203 |
EGLNativeWindowType aNativeWindow, const EGLint *aAttribList) |
13 | 204 |
{ |
39
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
205 |
|
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
206 |
// FAISALMEMON NEW |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
207 |
/** |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
208 |
* pseudo code: |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
209 |
* |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
210 |
* surfacemamanger. |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
211 |
* open() |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
212 |
* createsurface(2 buffers, width, height, pixel format,...) |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
213 |
* map surface -> get chunk |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
214 |
* serialization.eglCreateWindowSurface(..) |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
215 |
* eglinternalfunctioncreatesurface(chunk, width, height, ..) |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
216 |
* egl.... setwindowsurfacebuffers(...) |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
217 |
* surfaceupdatesession.connect() |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
218 |
* wnd.setbackgroundsurface() |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
219 |
*/ |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
220 |
EGL_TRACE( "CGuestEGL::eglCreateWindowSurface"); |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
221 |
EGL_TRACE_ATTRIB_LIST(aAttribList); |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
222 |
|
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
223 |
RWindow* window; |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
224 |
window = (RWindow*) aNativeWindow; |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
225 |
TSize size = window->Size(); |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
226 |
|
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
227 |
EGLSurface newSurfaceId = EGL_NO_SURFACE; |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
228 |
TSurfaceInfo* surfaceInfo = NULL; |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
229 |
EGLint error = EGL_BAD_DISPLAY; |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
230 |
TSurfaceId surfaceId; |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
231 |
|
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
232 |
RSurfaceManager::TSurfaceCreationAttributesBuf buf; |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
233 |
RSurfaceManager::TSurfaceCreationAttributes& attributes = buf(); |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
234 |
|
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
235 |
attributes.iSize = size; |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
236 |
attributes.iBuffers = 2; // REQUIREMENT because host side assumes exactly two buffers |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
237 |
attributes.iPixelFormat = EUidPixelFormatARGB_8888; // this is a guess; either query or hardcode to match syborg |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
238 |
attributes.iStride = 4 * size.iWidth; // Number of bytes between start of one line and start of next |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
239 |
attributes.iOffsetToFirstBuffer = 0; |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
240 |
attributes.iAlignment = EPageAligned; // alignment, 1,2,4,8,16,32,64 byte aligned or EPageAligned |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
241 |
attributes.iHintCount=0; |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
242 |
attributes.iSurfaceHints = NULL; |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
243 |
attributes.iOffsetBetweenBuffers = 0; |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
244 |
attributes.iContiguous = ETrue; |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
245 |
attributes.iCacheAttrib = RSurfaceManager::ENotCached; // Cache attributes |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
246 |
|
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
247 |
iDisplayMapLock.WriteLock(); |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
248 |
CEglDisplayInfo** pDispInfo; |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
249 |
pDispInfo = iDisplayMap.Find(aDisplay); |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
250 |
|
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
251 |
if (pDispInfo && *pDispInfo) |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
252 |
{ |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
253 |
RHeap* threadHeap = CVghwUtils::SwitchToVghwHeap(); |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
254 |
|
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
255 |
surfaceInfo = new TSurfaceInfo(); |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
256 |
if (surfaceInfo) |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
257 |
{ |
40
eaa1315a8556
added eglSwapBuffers integration; this change has not been compiled so don't sync to this changelist
Faisal Memon <faisal.memon@nokia.com>
parents:
39
diff
changeset
|
258 |
surfaceInfo->iNativeWindow = (RWindow*)aNativeWindow; |
39
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
259 |
surfaceInfo->iConfigId = aConfig; |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
260 |
surfaceInfo->iSurfaceManager.Open(); |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
261 |
surfaceInfo->iSurfaceManager.CreateSurface(buf, surfaceId); |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
262 |
(*pDispInfo)->iSurfaceMap.Insert(surfaceId, surfaceInfo); |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
263 |
(void) surfaceInfo->iSurfaceManager.MapSurface(surfaceId, surfaceInfo->iChunk); |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
264 |
RemoteFunctionCallData rfcdata; |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
265 |
EglRFC eglApiData( rfcdata ); |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
266 |
eglApiData.Init( EglRFC::EeglCreateWindowSurface); |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
267 |
eglApiData.AppendEGLDisplay(aDisplay); |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
268 |
eglApiData.AppendEGLConfig(aConfig); |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
269 |
eglApiData.AppendEGLNativeWindowType(aNativeWindow); |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
270 |
eglApiData.AppendEGLintVector(aAttribList, TAttribUtils::AttribListLength(aAttribList) ); |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
271 |
eglApiData.AppendEGLint(size.iWidth); |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
272 |
eglApiData.AppendEGLint(size.iHeight); |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
273 |
eglApiData.AppendEGLint(1000); // horizontalPitch arbitrary |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
274 |
eglApiData.AppendEGLint(1000); // verticalPitch arbitrary |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
275 |
surfaceInfo->iHostSurfaceId = aThreadState.ExecEglSurfaceCmd(eglApiData); // todo check if is valid |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
276 |
EglInternalFunction_CreateSurface(aThreadState, aDisplay, surfaceInfo->iHostSurfaceId, aConfig, window, *surfaceInfo); |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
277 |
surfaceInfo->iSurfaceUpdateSession.Connect(); |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
278 |
TSurfaceConfiguration surfaceConfig; |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
279 |
surfaceConfig.SetSurfaceId(surfaceId); |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
280 |
window->SetBackgroundSurface(surfaceConfig, ETrue); |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
281 |
} |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
282 |
CVghwUtils::SwitchFromVghwHeap(threadHeap); |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
283 |
} |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
284 |
|
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
285 |
iDisplayMapLock.Unlock(); |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
286 |
|
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
287 |
aThreadState.SetEglError(EGL_SUCCESS); |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
288 |
|
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
289 |
return surfaceInfo->iHostSurfaceId; |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
290 |
|
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
291 |
// FAISALMEMON END OF NEW |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
292 |
|
13 | 293 |
} |
39
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
294 |
|
13 | 295 |
const char* CGuestEGL::eglQueryString(EGLDisplay aDisplay, EGLint aName) |
296 |
{ |
|
297 |
return NULL; // stub code |
|
298 |
} |
|
299 |
// FAISALMEMON END OF STUB CODE |
|
300 |
||
301 |
CGuestEGL::CGuestEGL() : |
|
302 |
iEglSyncExtension(NULL) |
|
303 |
{ |
|
304 |
} |
|
305 |
||
306 |
#ifdef FAISALMEMON_S4_SGIMAGE |
|
307 |
void CGuestEGL::OpenSgResources() |
|
308 |
{ |
|
309 |
// ToDo delay opening SgDriver until needed, as it force loads Open GL ES 1.1, GL ES 2 and Open VG DLLs if it finds them |
|
310 |
TInt err = iSgDriver.Open(); |
|
311 |
EGL_TRACE(" CGuestEGL::Create SgDriver.Open err=%d", err); |
|
312 |
EGLPANIC_ASSERT(err == KErrNone, EEglPanicSgDriverCreateLocalFailed); |
|
313 |
||
314 |
TVersion sgImageVer = RSgDriver::Version(); |
|
315 |
EGL_TRACE(" CGuestEGL::Create sgImageVer=%d.%d", sgImageVer.iMajor, sgImageVer.iMinor); |
|
316 |
EGLPANIC_ASSERT(sgImageVer.iMajor == 1, EEglPanicBadSgDriverVersion); |
|
317 |
||
318 |
} |
|
319 |
void CGuestEGL::CloseSgResources() |
|
320 |
{ |
|
321 |
iSgDriver.Close(); |
|
322 |
} |
|
323 |
#else |
|
324 |
void CGuestEGL::CloseSgResources() |
|
325 |
{ |
|
326 |
} |
|
327 |
||
328 |
void CGuestEGL::OpenSgResources() |
|
329 |
{ |
|
330 |
} |
|
331 |
#endif |
|
332 |
||
333 |
// ----------------------------------------------------------------------------- |
|
334 |
// destructor |
|
335 |
// ----------------------------------------------------------------------------- |
|
336 |
// |
|
337 |
CGuestEGL::~CGuestEGL() |
|
338 |
{ |
|
339 |
EGL_TRACE("CGuestEGL::~CGuestEGL"); |
|
340 |
// only expected to be called during process termination |
|
341 |
if (iEglSyncExtension) |
|
342 |
{ |
|
343 |
delete iEglSyncExtension; |
|
344 |
iEglSyncExtension = NULL; |
|
345 |
} |
|
346 |
iDisplayMapLock.Close(); |
|
347 |
CloseSgResources(); |
|
348 |
iEglImageLock.Close(); |
|
349 |
} |
|
350 |
||
351 |
// ----------------------------------------------------------------------------- |
|
352 |
// 2nd phase constructor |
|
353 |
// ----------------------------------------------------------------------------- |
|
354 |
// |
|
355 |
void CGuestEGL::Create() |
|
356 |
{ |
|
357 |
EGL_TRACE(" CGuestEGL::Create -->"); |
|
358 |
OpenSgResources(); |
|
359 |
TInt err; |
|
360 |
err = iDisplayMapLock.CreateLocal(); |
|
361 |
EGLPANIC_ASSERT(err == KErrNone, EEglPanicDisplayMapLockCreateLocalFailed); |
|
362 |
||
363 |
err = iEglImageLock.CreateLocal(); |
|
364 |
EGLPANIC_ASSERT(err == KErrNone, EEglPanicEglImageLockCreateLocalFailed); |
|
365 |
||
366 |
InitialiseExtensions(); |
|
367 |
||
368 |
const char* initExtensionList = EglInternalFunction_QueryExtensionList(); |
|
369 |
EGL_TRACE(" CGuestEGL::Create initExtensionList=0x%x (\"%s\") <--", |
|
370 |
initExtensionList, initExtensionList ? initExtensionList : ""); |
|
371 |
} |
|
372 |
||
373 |
// ----------------------------------------------------------------------------- |
|
374 |
// |
|
375 |
// ----------------------------------------------------------------------------- |
|
376 |
// |
|
377 |
CGuestEGL* CGuestEGL::New() |
|
378 |
{ |
|
379 |
EGL_TRACE("CGuestEGL::New start -->"); |
|
380 |
RHeap* threadHeap = CVghwUtils::SwitchToVghwHeap(); |
|
381 |
CGuestEGL* result = new CGuestEGL(); |
|
382 |
CVghwUtils::SwitchFromVghwHeap(threadHeap); |
|
383 |
EGLPANIC_ASSERT(result, EEglPanicGuestGraphicsAllocFailed); |
|
384 |
if (result) |
|
385 |
{ |
|
386 |
result->Create(); |
|
387 |
} |
|
388 |
EGL_TRACE("CGuestEGL::New end - result=0x%x <--", result); |
|
389 |
return result; |
|
390 |
} |
|
391 |
||
392 |
// ----------------------------------------------------------------------------- |
|
393 |
// |
|
394 |
// ----------------------------------------------------------------------------- |
|
395 |
// |
|
396 |
void CGuestEGL::SetError(EGLint aError) |
|
397 |
{ // ToDo remove - everything except EGL Sync already uses threadState->SetEglError |
|
398 |
EGL_TRACE( "CGuestEGL::SetError EGL error=0x%x", aError); |
|
399 |
TEglThreadState* threadState = CVghwUtils::EglThreadState(); |
|
400 |
if (threadState) |
|
401 |
{ |
|
402 |
threadState->SetEglError(aError); |
|
403 |
} |
|
404 |
} |
|
405 |
||
406 |
EGLint CGuestEGL::CheckColorAttributes(const EGLint* aAttribList, EGLint aColorBufferType, EGLint aLuminanceBits, EGLint aRedBits, |
|
407 |
EGLint aGreenBits, EGLint aBlueBits, EGLint aAlphaBits) |
|
408 |
{ |
|
409 |
const EGLint* pValue = TAttribUtils::FindAttribValue(aAttribList, EGL_COLOR_BUFFER_TYPE); |
|
410 |
if (pValue && (*pValue != aColorBufferType)) |
|
411 |
{ |
|
412 |
return EGL_BAD_MATCH; |
|
413 |
} |
|
414 |
EGLint colorBits = 0; |
|
415 |
if (aColorBufferType == EGL_RGB_BUFFER) |
|
416 |
{ |
|
417 |
colorBits = aRedBits + aGreenBits + aBlueBits + aAlphaBits; |
|
418 |
pValue = TAttribUtils::FindAttribValue(aAttribList, EGL_RED_SIZE); |
|
419 |
if (pValue && (*pValue < aRedBits)) |
|
420 |
{ |
|
421 |
return EGL_BAD_MATCH; |
|
422 |
} |
|
423 |
pValue = TAttribUtils::FindAttribValue(aAttribList, EGL_GREEN_SIZE); |
|
424 |
if (pValue && (*pValue < aGreenBits)) |
|
425 |
{ |
|
426 |
return EGL_BAD_MATCH; |
|
427 |
} |
|
428 |
pValue = TAttribUtils::FindAttribValue(aAttribList, EGL_BLUE_SIZE); |
|
429 |
if (pValue && (*pValue < aBlueBits)) |
|
430 |
{ |
|
431 |
return EGL_BAD_MATCH; |
|
432 |
} |
|
433 |
pValue = TAttribUtils::FindAttribValue(aAttribList, EGL_LUMINANCE_SIZE); |
|
434 |
if (pValue && (*pValue != 0)) |
|
435 |
{ |
|
436 |
return EGL_BAD_MATCH; |
|
437 |
} |
|
438 |
} |
|
439 |
else |
|
440 |
{ // EGL_LUMINANCE_BUFFER |
|
441 |
colorBits = aLuminanceBits + aAlphaBits; |
|
442 |
pValue = TAttribUtils::FindAttribValue(aAttribList, EGL_RED_SIZE); |
|
443 |
if (pValue && (*pValue != 0)) |
|
444 |
{ |
|
445 |
return EGL_BAD_MATCH; |
|
446 |
} |
|
447 |
pValue = TAttribUtils::FindAttribValue(aAttribList, EGL_GREEN_SIZE); |
|
448 |
if (pValue && (*pValue != 0)) |
|
449 |
{ |
|
450 |
return EGL_BAD_MATCH; |
|
451 |
} |
|
452 |
pValue = TAttribUtils::FindAttribValue(aAttribList, EGL_BLUE_SIZE); |
|
453 |
if (pValue && (*pValue != 0)) |
|
454 |
{ |
|
455 |
return EGL_BAD_MATCH; |
|
456 |
} |
|
457 |
pValue = TAttribUtils::FindAttribValue(aAttribList, EGL_LUMINANCE_SIZE); |
|
458 |
if (pValue && (*pValue < aLuminanceBits)) |
|
459 |
{ |
|
460 |
return EGL_BAD_MATCH; |
|
461 |
} |
|
462 |
} |
|
463 |
||
464 |
if (aAlphaBits) |
|
465 |
{ |
|
466 |
pValue = TAttribUtils::FindAttribValue(aAttribList, EGL_ALPHA_SIZE); |
|
467 |
if (pValue && (*pValue < aAlphaBits)) |
|
468 |
{ |
|
469 |
return EGL_BAD_MATCH; |
|
470 |
} |
|
471 |
} |
|
472 |
||
473 |
pValue = TAttribUtils::FindAttribValue(aAttribList, EGL_BUFFER_SIZE); |
|
474 |
if (pValue && (*pValue < colorBits)) |
|
475 |
{ |
|
476 |
return EGL_BAD_MATCH; |
|
477 |
} |
|
478 |
return EGL_SUCCESS; |
|
479 |
} |
|
480 |
||
481 |
void CGuestEGL::AppendColorAttributes(EGLint* aAttribList, EGLint aColorBufferType, EGLint aLuminanceBits, EGLint aRedBits, |
|
482 |
EGLint aGreenBits, EGLint aBlueBits, EGLint aAlphaBits, TBool aSetVgPreMultAlpha) |
|
483 |
{ |
|
484 |
const EGLint* pValue = TAttribUtils::FindAttribValue(aAttribList, EGL_COLOR_BUFFER_TYPE); |
|
485 |
if (!pValue) |
|
486 |
{ |
|
487 |
TAttribUtils::AppendAttribValue(aAttribList, EGL_COLOR_BUFFER_TYPE, aColorBufferType); |
|
488 |
} |
|
489 |
||
490 |
EGLint colorBits = 0; |
|
491 |
if (aColorBufferType == EGL_RGB_BUFFER) |
|
492 |
{ |
|
493 |
colorBits = aRedBits + aGreenBits + aBlueBits + aAlphaBits; |
|
494 |
pValue = TAttribUtils::FindAttribValue(aAttribList, EGL_RED_SIZE); |
|
495 |
if (!pValue) |
|
496 |
{ |
|
497 |
TAttribUtils::AppendAttribValue(aAttribList, EGL_RED_SIZE, aRedBits); |
|
498 |
} |
|
499 |
pValue = TAttribUtils::FindAttribValue(aAttribList, EGL_GREEN_SIZE); |
|
500 |
if (!pValue) |
|
501 |
{ |
|
502 |
TAttribUtils::AppendAttribValue(aAttribList, EGL_GREEN_SIZE, aGreenBits); |
|
503 |
} |
|
504 |
pValue = TAttribUtils::FindAttribValue(aAttribList, EGL_BLUE_SIZE); |
|
505 |
if (!pValue) |
|
506 |
{ |
|
507 |
TAttribUtils::AppendAttribValue(aAttribList, EGL_BLUE_SIZE, aBlueBits); |
|
508 |
} |
|
509 |
} |
|
510 |
else |
|
511 |
{ // EGL_LUMINANCE_BUFFER |
|
512 |
colorBits = aLuminanceBits + aAlphaBits; |
|
513 |
pValue = TAttribUtils::FindAttribValue(aAttribList, EGL_LUMINANCE_SIZE); |
|
514 |
if (!pValue) |
|
515 |
{ |
|
516 |
TAttribUtils::AppendAttribValue(aAttribList, EGL_LUMINANCE_SIZE, aLuminanceBits); |
|
517 |
} |
|
518 |
} |
|
519 |
||
520 |
pValue = TAttribUtils::FindAttribValue(aAttribList, EGL_BUFFER_SIZE); |
|
521 |
if (!pValue) |
|
522 |
{ |
|
523 |
TAttribUtils::AppendAttribValue(aAttribList, EGL_BUFFER_SIZE, colorBits); |
|
524 |
} |
|
525 |
||
526 |
if (aAlphaBits) |
|
527 |
{ |
|
528 |
pValue = TAttribUtils::FindAttribValue(aAttribList, EGL_ALPHA_SIZE); |
|
529 |
if (!pValue) |
|
530 |
{ |
|
531 |
TAttribUtils::AppendAttribValue(aAttribList, EGL_ALPHA_SIZE, aAlphaBits); |
|
532 |
} |
|
533 |
} |
|
534 |
if (aSetVgPreMultAlpha) |
|
535 |
{ |
|
536 |
EGLint* pSurfaceType = TAttribUtils::FindAttribValue(aAttribList, EGL_SURFACE_TYPE); |
|
537 |
if (pSurfaceType) |
|
538 |
{ |
|
539 |
*pSurfaceType |= EGL_VG_ALPHA_FORMAT_PRE_BIT; |
|
540 |
} |
|
541 |
} |
|
542 |
} |
|
543 |
||
544 |
EGLBoolean CGuestEGL::ChooseConfigForPixmapSurface(TEglThreadState& aThreadState, EGLDisplay aDisplay, const EGLint* aAttribList, EGLConfig* aConfigs, EGLint aConfigSize, |
|
545 |
EGLint* aNumConfig, const void* aPixmap) |
|
546 |
{ |
|
547 |
EGLint error = EGL_SUCCESS; |
|
548 |
EGLint* newList = NULL; |
|
549 |
||
550 |
switch ( EglInternalFunction_GetNativePixmapType((EGLNativePixmapType) (aPixmap)) ) |
|
551 |
{ |
|
552 |
case EPixmapTypeFbsBitmap: |
|
553 |
EGL_TRACE("CGuestEGL::ChooseConfigForPixmapSurface 1.a pixmap type is FbsBitmap (aPixmap=0x%x)", aPixmap); |
|
554 |
error = ChooseConfigAttribsForFbsBitmap(aThreadState, aAttribList, reinterpret_cast<const CFbsBitmap*>(aPixmap), &newList); |
|
555 |
break; |
|
556 |
||
557 |
#ifdef FAISALMEMON_S4_SGIMAGE |
|
558 |
case EPixmapTypeSgImage: |
|
559 |
EGL_TRACE("CGuestEGL::ChooseConfigForPixmapSurface 1.b pixmap type is SgImage (aPixmap=0x%x)", aPixmap); |
|
560 |
error = ChooseConfigAttribsForSgImage(aThreadState, aAttribList, reinterpret_cast<const RSgImage*>(aPixmap), &newList); |
|
561 |
break; |
|
562 |
#endif |
|
563 |
||
564 |
case EPixmapTypeNone: |
|
565 |
default: |
|
566 |
EGL_TRACE("CGuestEGL::ChooseConfigForPixmapSurface 1.c pixmap type is unknown (aPixmap=0x%x)", aPixmap); |
|
567 |
error = EGL_BAD_NATIVE_PIXMAP; |
|
568 |
break; |
|
569 |
} |
|
570 |
||
571 |
if (error != EGL_SUCCESS) |
|
572 |
{ |
|
573 |
aThreadState.SetEglError(error); |
|
574 |
EGL_TRACE("CGuestEGL::ChooseConfigForPixmapSurface 2.a encountered error=0x%x", error); |
|
575 |
if (newList) |
|
576 |
{ |
|
577 |
CVghwUtils::Free(newList); |
|
578 |
} |
|
579 |
return EGL_FALSE; |
|
580 |
} |
|
581 |
||
582 |
EGLPANIC_ASSERT(newList, EEglPanicTemp); |
|
583 |
EGL_TRACE("CGuestEGL::ChooseConfigForPixmapSurface 2.b temp AttribList ... (*newList=0x%x)", *newList); |
|
584 |
EGL_TRACE_ATTRIB_LIST(newList); |
|
585 |
||
586 |
RemoteFunctionCallData rfcdata; EglRFC eglApiData( rfcdata ); |
|
587 |
eglApiData.Init( EglRFC::EeglChooseConfig ); |
|
588 |
eglApiData.AppendEGLDisplay(aDisplay); |
|
589 |
eglApiData.AppendEGLintVector(newList, TAttribUtils::AttribListLength(newList) ); |
|
590 |
eglApiData.AppendEGLConfigVector(aConfigs, aConfigSize, RemoteFunctionCallData::EOut); |
|
591 |
eglApiData.AppendEGLint(aConfigSize); |
|
592 |
eglApiData.AppendEGLintVector(aNumConfig, 1, RemoteFunctionCallData::EOut); |
|
593 |
EGLBoolean result = aThreadState.ExecEglBooleanCmd(eglApiData); |
|
594 |
EGL_TRACE("CGuestEGL::ChooseConfigForPixmapSurface 3. Host EGL success=%d", result); |
|
595 |
||
596 |
CVghwUtils::Free(newList); |
|
597 |
return result; |
|
598 |
} |
|
599 |
||
600 |
#ifdef FAISALMEMON_S4_SGIMAGE |
|
601 |
EGLBoolean CGuestEGL::ChooseConfigForNativeSgImagePixmapSurface( TEglThreadState& aThreadState, EGLDisplay aDisplay, const EGLint* aAttribList, EGLConfig* aConfigs, EGLint aConfigSize, |
|
602 |
EGLint* aNumConfig, const EGLint* aPixmap ) |
|
603 |
{ |
|
604 |
EGLConfig* sgConfigs; |
|
605 |
EGLint sgConfigCnt; |
|
606 |
TBool* sgConfigsMatchingAttributes; |
|
607 |
TInt sgConfigsMatchingAttributesCnt=0; |
|
608 |
EGLint* sgConfigAttribs; |
|
609 |
EGLint sgConfigsAttribtCnt; |
|
610 |
EGL_TRACE( "CGuestEGL::eglChooseConfig: ChooseConfigForNativePixmapSurface" ); |
|
611 |
EglInternalFunction_MetaGetConfigs( aThreadState, sgConfigs, sgConfigCnt, sgConfigAttribs, sgConfigsAttribtCnt ); |
|
612 |
EGL_TRACE( "EglInternalFunction_MetaGetConfigAttirb cnt = %d ", sgConfigsAttribtCnt ); |
|
613 |
||
614 |
sgConfigsMatchingAttributes = new TBool[sgConfigCnt]; |
|
615 |
||
616 |
TInt attribs_per_config = EglRFC::MetaGetConfigAttributeCnt(); |
|
617 |
TInt configcnt = (TInt) sgConfigsAttribtCnt / attribs_per_config; |
|
618 |
EGL_TRACE( "EglInternalFunction_MetaGetConfigs cnt = %d ", configcnt ); |
|
619 |
||
620 |
//The attribute values of aAttribList, in the order of MetaGetConfigAttribute(i) |
|
621 |
EGLint* specAttribVals = new EGLint[ attribs_per_config ]; |
|
622 |
for( TInt i=0;i<attribs_per_config;++i ) |
|
623 |
{ |
|
624 |
*( specAttribVals + i ) = -1; |
|
625 |
} |
|
626 |
int spec_attrib_kind; |
|
627 |
int i_spec_attrib = 0; |
|
628 |
//Go through all the given attributes |
|
629 |
while( (spec_attrib_kind = *(aAttribList + i_spec_attrib )) != EGL_NONE ) |
|
630 |
{ |
|
631 |
//Check which type of attribute is specified, then set the value if types match |
|
632 |
for( TInt i=0;i<attribs_per_config;++i ) |
|
633 |
{ |
|
634 |
if( spec_attrib_kind == EglRFC::MetaGetConfigAttribute( i ) ) |
|
635 |
*(specAttribVals + i) = *( aAttribList + i_spec_attrib ); |
|
636 |
} |
|
637 |
i_spec_attrib += 2; |
|
638 |
} |
|
639 |
||
640 |
//Go through the configurations |
|
641 |
for( TInt i_config = 0;i_config < configcnt; ++i_config ) |
|
642 |
{ |
|
643 |
TBool pass = ETrue;//true, unless we bump into an attribute that doesn't match |
|
644 |
//Go throught the attributes of this configuration |
|
645 |
for( TInt i_attr = 0; i_attr < attribs_per_config; ++i_attr ) |
|
646 |
{ |
|
647 |
EGL_TRACE( "cnf %d, attr %d = %d ", i_config, i_attr, *( sgConfigAttribs + i_config*attribs_per_config + i_attr ) ); |
|
648 |
//Match attribute values here, if the client-specified attribute value isn't empty |
|
649 |
if( *( specAttribVals + i_attr ) != -1 ) |
|
650 |
{ |
|
651 |
switch( EglRFC::MetaGetConfigAttributeSelCriteria( i_attr ) ) |
|
652 |
{ |
|
653 |
case EExact: |
|
654 |
{ |
|
655 |
if( *( specAttribVals + i_attr ) != *( sgConfigAttribs + i_config*attribs_per_config + i_attr ) ) |
|
656 |
{ |
|
657 |
pass = EFalse; |
|
658 |
} |
|
659 |
break; |
|
660 |
} |
|
661 |
case EAtLeast: |
|
662 |
{ |
|
663 |
if( *( specAttribVals + i_attr ) > *( sgConfigAttribs + i_config*attribs_per_config + i_attr ) ) |
|
664 |
{ |
|
665 |
pass = EFalse; |
|
666 |
} |
|
667 |
break; |
|
668 |
} |
|
669 |
case EMask: |
|
670 |
{ |
|
671 |
if( !(*( specAttribVals + i_attr ) & *( sgConfigAttribs + i_config*attribs_per_config + i_attr )) ) |
|
672 |
{ |
|
673 |
pass = EFalse; |
|
674 |
} |
|
675 |
break; |
|
676 |
} |
|
677 |
}//switch comparison method |
|
678 |
||
679 |
}//if attribute value specified by client |
|
680 |
}//for through the attributes of a configuration |
|
681 |
if( pass ) |
|
682 |
{ |
|
683 |
*(sgConfigsMatchingAttributes + i_config) = ETrue; |
|
684 |
} |
|
685 |
else |
|
686 |
{ |
|
687 |
*(sgConfigsMatchingAttributes + i_config) = EFalse; |
|
688 |
} |
|
689 |
}//end for through the configurations |
|
690 |
||
691 |
//Now get the configs that match, and return those |
|
692 |
TInt aConfigsIndex = 0; |
|
693 |
for( TInt i_config = 0;i_config < configcnt; ++i_config ) |
|
694 |
{ |
|
695 |
if( *(sgConfigsMatchingAttributes + i_config) ) |
|
696 |
{ |
|
697 |
if( aConfigsIndex < aConfigSize ) |
|
698 |
{ |
|
699 |
*(aConfigs + (aConfigsIndex++)) = *(sgConfigs + i_config); |
|
700 |
++sgConfigsMatchingAttributesCnt; |
|
701 |
} |
|
702 |
} |
|
703 |
} |
|
704 |
//Ok, all done. Delete allocated memory |
|
705 |
// ToDo use correct Heap! |
|
706 |
delete[] sgConfigs; |
|
707 |
delete[] sgConfigsMatchingAttributes; |
|
708 |
delete[] sgConfigAttribs; |
|
709 |
delete[] specAttribVals; |
|
710 |
return EGL_TRUE; |
|
711 |
} |
|
712 |
#endif |
|
713 |
||
714 |
EGLint CGuestEGL::ChooseConfigAttribsForFbsBitmap(TEglThreadState& aThreadState, const EGLint* aAttribList, const CFbsBitmap* aBitmap, EGLint** aNewList) |
|
715 |
{ |
|
716 |
EGLPANIC_ASSERT_DEBUG(aNewList, EEglPanicTemp); |
|
717 |
EGLint error = EGL_SUCCESS; |
|
718 |
const TInt listLength = TAttribUtils::AttribListLength(aAttribList); |
|
719 |
ASSERT(listLength); |
|
720 |
TDisplayMode mode = ENone; |
|
721 |
const EGLint* pRenderType = TAttribUtils::FindAttribValue(aAttribList, EGL_RENDERABLE_TYPE); |
|
722 |
||
723 |
mode = aBitmap->DisplayMode(); |
|
724 |
EGL_TRACE("CGuestEGL::ChooseConfigAttribsForFbsBitmap bitmap addr=0x%x, Display Mode=%d", aBitmap, mode); |
|
725 |
switch (mode) |
|
726 |
{ |
|
727 |
case EColor64K: |
|
728 |
error = CheckColorAttributes(aAttribList, EGL_RGB_BUFFER, 0, 5, 6, 5); |
|
729 |
break; |
|
730 |
case EColor16M: |
|
731 |
case EColor16MU: |
|
732 |
error = CheckColorAttributes(aAttribList, EGL_RGB_BUFFER, 0, 8, 8, 8); |
|
733 |
break; |
|
734 |
case EColor16MA: |
|
735 |
error = CheckColorAttributes(aAttribList, EGL_RGB_BUFFER, 0, 8, 8, 8, 8); |
|
736 |
break; |
|
737 |
case EColor16MAP: |
|
738 |
error = CheckColorAttributes(aAttribList, EGL_RGB_BUFFER, 0, 8, 8, 8, 8); |
|
739 |
break; |
|
740 |
default: // pixmap not supported |
|
741 |
error = EGL_BAD_NATIVE_PIXMAP; |
|
742 |
break; |
|
743 |
} |
|
744 |
||
745 |
if (error != EGL_SUCCESS) |
|
746 |
{ |
|
747 |
return error; |
|
748 |
} |
|
749 |
||
750 |
const TInt KExpansionSpace = 10 * 2; // want enough space for 10 extra attribute/value pairs |
|
751 |
*aNewList = (EGLint*) CVghwUtils::Alloc( (listLength + KExpansionSpace) * sizeof(EGLint) ); |
|
752 |
if (!*aNewList) |
|
753 |
{ |
|
754 |
return EGL_BAD_ALLOC; |
|
755 |
} |
|
756 |
memcpy(*aNewList, aAttribList, listLength * sizeof(EGLint)); |
|
757 |
||
758 |
switch (mode) |
|
759 |
{ |
|
760 |
case EColor64K: |
|
761 |
AppendColorAttributes(*aNewList, EGL_RGB_BUFFER, 0, 5, 6, 5); |
|
762 |
break; |
|
763 |
case EColor16M: |
|
764 |
case EColor16MU: |
|
765 |
AppendColorAttributes(*aNewList, EGL_RGB_BUFFER, 0, 8, 8, 8); |
|
766 |
break; |
|
767 |
case EColor16MA: |
|
768 |
AppendColorAttributes(*aNewList, EGL_RGB_BUFFER, 0, 8, 8, 8, 8); |
|
769 |
break; |
|
770 |
case EColor16MAP: |
|
771 |
if (pRenderType && ( (*pRenderType) & EGL_OPENVG_BIT) ) |
|
772 |
{ |
|
773 |
AppendColorAttributes(*aNewList, EGL_RGB_BUFFER, 0, 8, 8, 8, 8, ETrue); |
|
774 |
} |
|
775 |
else |
|
776 |
{ |
|
777 |
AppendColorAttributes(*aNewList, EGL_RGB_BUFFER, 0, 8, 8, 8, 8); |
|
778 |
} |
|
779 |
break; |
|
780 |
default: |
|
781 |
EGLPANIC_ALWAYS(EEglPanicTemp); |
|
782 |
} |
|
783 |
||
784 |
return EGL_SUCCESS; |
|
785 |
} |
|
786 |
||
787 |
#ifdef FAISALMEMON_S4_SGIMAGE |
|
788 |
EGLint CGuestEGL::ChooseConfigAttribsForSgImage(TEglThreadState& aThreadState, const EGLint* aAttribList, const RSgImage* aSgImage, EGLint** aNewList) |
|
789 |
{ |
|
790 |
ASSERT(aNewList); |
|
791 |
EGLint error = EGL_SUCCESS; |
|
792 |
const TInt listLength = TAttribUtils::AttribListLength(aAttribList); |
|
793 |
ASSERT(listLength); |
|
794 |
const EGLint* pRenderType = TAttribUtils::FindAttribValue(aAttribList, EGL_RENDERABLE_TYPE); |
|
795 |
||
796 |
/* |
|
797 |
if (!iSgConfigAttribs) |
|
798 |
{ |
|
799 |
EGL_TRACE( "CGuestEGL::ChooseConfigAttribsForSgImage 1. EglInternalFunction_MetaGetConfigs" ); |
|
800 |
EGLConfig* config; |
|
801 |
EGLint config_cnt; |
|
802 |
EglInternalFunction_MetaGetConfigs(aThreadState, config, config_cnt, iSgConfigAttribs, iSgConfigsAttribtCnt); |
|
803 |
EGL_TRACE( "EglInternalFunction_MetaGetConfigs cnt = %d ", iSgConfigsAttribtCnt ); |
|
804 |
} |
|
805 |
if (!iSgConfigAttribs) |
|
806 |
{ // exit if EglInternalFunction_MetaGetConfigs still failed |
|
807 |
return EGL_BAD_ALLOC; |
|
808 |
} |
|
809 |
*/ |
|
810 |
// ToDo use iSgConfigAttribs |
|
811 |
||
812 |
// temporarily open a handle to the SgImage |
|
813 |
TSgDrawableId sgId = aSgImage->Id(); |
|
814 |
RSgDrawable sgHandle; |
|
815 |
TSgImageInfo imgInfo; |
|
816 |
EGL_TRACE("CGuestEGL::ChooseConfigAttribsForSgImage 1. SgImage Id=0x%lx", sgId); |
|
817 |
||
818 |
// ToDo check SgImage usage bits |
|
819 |
if ( (sgId != KSgNullDrawableId) && (KErrNone == sgHandle.Open(sgId)) && (KErrNone == aSgImage->GetInfo(imgInfo)) ) |
|
820 |
{ |
|
821 |
EGL_TRACE("CGuestEGL::ChooseConfigAttribsForSgImage 2. SgImage PixelFormat=0x%x; size=%d,%d; Usage=0x%x", |
|
822 |
imgInfo.iPixelFormat, imgInfo.iSizeInPixels.iWidth, imgInfo.iSizeInPixels.iHeight, imgInfo.iUsage); |
|
823 |
||
824 |
switch (imgInfo.iPixelFormat) |
|
825 |
{ |
|
826 |
case ESgPixelFormatARGB_8888_PRE: // == EUidPixelFormatARGB_8888_PRE |
|
827 |
case ESgPixelFormatARGB_8888: // == EUidPixelFormatARGB_8888, |
|
828 |
error = CheckColorAttributes(aAttribList, EGL_RGB_BUFFER, 0, 8, 8, 8, 8); |
|
829 |
break; |
|
830 |
case ESgPixelFormatXRGB_8888: // == EUidPixelFormatXRGB_8888, |
|
831 |
error = CheckColorAttributes(aAttribList, EGL_RGB_BUFFER, 0, 8, 8, 8); |
|
832 |
break; |
|
833 |
case ESgPixelFormatRGB_565: // == EUidPixelFormatRGB_565, |
|
834 |
error = CheckColorAttributes(aAttribList, EGL_RGB_BUFFER, 0, 5, 6, 5); |
|
835 |
break; |
|
836 |
case ESgPixelFormatA_8: // == EUidPixelFormatA_8 |
|
837 |
error = CheckColorAttributes(aAttribList, EGL_LUMINANCE_BUFFER, 8, 0, 0, 0); |
|
838 |
break; |
|
839 |
default: // pixmap not supported |
|
840 |
error = EGL_BAD_NATIVE_PIXMAP; |
|
841 |
break; |
|
842 |
} |
|
843 |
} |
|
844 |
else |
|
845 |
{ |
|
846 |
error = EGL_BAD_PARAMETER; |
|
847 |
} |
|
848 |
sgHandle.Close(); |
|
849 |
||
850 |
||
851 |
if (error != EGL_SUCCESS) |
|
852 |
{ |
|
853 |
return error; |
|
854 |
} |
|
855 |
||
856 |
const TInt KExpansionSpace = 10 * 2; // want enough space for 10 extra attribute/value pairs |
|
857 |
*aNewList = (EGLint*) CVghwUtils::Alloc( (listLength + KExpansionSpace) * sizeof(EGLint) ); |
|
858 |
if (!*aNewList) |
|
859 |
{ |
|
860 |
return EGL_BAD_ALLOC; |
|
861 |
} |
|
862 |
memcpy(*aNewList, aAttribList, listLength * sizeof(EGLint)); |
|
863 |
||
864 |
switch (imgInfo.iPixelFormat) |
|
865 |
{ |
|
866 |
case ESgPixelFormatARGB_8888_PRE: // == EUidPixelFormatARGB_8888_PRE |
|
867 |
if (pRenderType && ( (*pRenderType) & EGL_OPENVG_BIT) ) |
|
868 |
{ |
|
869 |
AppendColorAttributes(*aNewList, EGL_RGB_BUFFER, 0, 8, 8, 8, 8, ETrue); |
|
870 |
} |
|
871 |
else |
|
872 |
{ |
|
873 |
AppendColorAttributes(*aNewList, EGL_RGB_BUFFER, 0, 8, 8, 8, 8); |
|
874 |
} |
|
875 |
break; |
|
876 |
case ESgPixelFormatARGB_8888: // == EUidPixelFormatARGB_8888, |
|
877 |
AppendColorAttributes(*aNewList, EGL_RGB_BUFFER, 0, 8, 8, 8, 8); |
|
878 |
break; |
|
879 |
case ESgPixelFormatXRGB_8888: // == EUidPixelFormatXRGB_8888, |
|
880 |
AppendColorAttributes(*aNewList, EGL_RGB_BUFFER, 0, 8, 8, 8); |
|
881 |
break; |
|
882 |
case ESgPixelFormatRGB_565: // == EUidPixelFormatRGB_565, |
|
883 |
AppendColorAttributes(*aNewList, EGL_RGB_BUFFER, 0, 5, 6, 5); |
|
884 |
break; |
|
885 |
case ESgPixelFormatA_8: // == EUidPixelFormatA_8 |
|
886 |
AppendColorAttributes(*aNewList, EGL_LUMINANCE_BUFFER, 8, 0, 0, 0); |
|
887 |
break; |
|
888 |
default: // pixmap not supported - panic because this code should be in-sync with supported SgImage formats |
|
889 |
EGLPANIC_ALWAYS(EEglPanicTemp); |
|
890 |
break; |
|
891 |
} |
|
892 |
||
893 |
// change requested surface type from pixmap to Pbuffer |
|
894 |
EGLint* pSurfaceType = TAttribUtils::FindAttribValue(*aNewList, EGL_SURFACE_TYPE); |
|
895 |
EGLint surfaceType = *pSurfaceType; |
|
896 |
*pSurfaceType = EGL_PBUFFER_BIT | (surfaceType & ~EGL_PIXMAP_BIT); |
|
897 |
||
898 |
TAttribUtils::RemoveAttrib(*aNewList, EGL_MATCH_NATIVE_PIXMAP); |
|
899 |
return EGL_SUCCESS; |
|
900 |
} |
|
901 |
#endif |
|
902 |
||
903 |
/* |
|
904 |
Create an information object for an opened Display. |
|
905 |
*/ |
|
906 |
TBool CGuestEGL::CreateDisplayInfo(EGLDisplay aDisplay) |
|
907 |
{ |
|
908 |
TBool result = EFalse; |
|
909 |
EGL_TRACE("CGuestEGL::CreateDisplayInfo begin aDisplay=%d", aDisplay); |
|
910 |
iDisplayMapLock.WriteLock(); |
|
911 |
RHeap* threadHeap = CVghwUtils::SwitchToVghwHeap(); |
|
912 |
if (NULL != iDisplayMap.Find( aDisplay)) |
|
913 |
{ |
|
914 |
result = ETrue; |
|
915 |
} |
|
916 |
else |
|
917 |
{ |
|
918 |
TInt err = KErrNoMemory; |
|
919 |
CEglDisplayInfo* dispInfo = new CEglDisplayInfo; |
|
920 |
||
921 |
if (dispInfo) |
|
922 |
{ |
|
923 |
err = iDisplayMap.Insert(aDisplay, dispInfo); |
|
924 |
// EGL_TRACE("CreateDisplayInfo - DisplayMap insert error %d", err); |
|
925 |
EGLPANIC_ASSERT_DEBUG(err == KErrNone, EEglPanicDisplayMapInsertFailed); |
|
926 |
||
927 |
//added for egl sync extension benefit |
|
928 |
if (iEglSyncExtension) |
|
929 |
{ |
|
930 |
err = iEglSyncExtension->EglSyncDisplayCreate(aDisplay); |
|
931 |
// EGL_TRACE("CreateDisplayInfo - EglSyncDisplayCreate error %d", err); |
|
932 |
EGLPANIC_ASSERT_DEBUG(err == KErrNone, EEglPanicEglSyncDisplayCreateFailed); |
|
933 |
||
934 |
if (err) |
|
935 |
{ |
|
936 |
iDisplayMap.Remove(aDisplay); |
|
937 |
} |
|
938 |
} |
|
939 |
} |
|
940 |
||
941 |
if (err == KErrNone) |
|
942 |
{ |
|
943 |
result = ETrue; |
|
944 |
} |
|
945 |
} |
|
946 |
CVghwUtils::SwitchFromVghwHeap(threadHeap); |
|
947 |
iDisplayMapLock.Unlock(); |
|
948 |
||
949 |
EGL_TRACE("CreateDisplayInfo end, result=%d", result); |
|
950 |
return result; |
|
951 |
} |
|
952 |
||
953 |
/* |
|
954 |
Mark information object for Display as Initialised |
|
955 |
*/ |
|
956 |
TBool CGuestEGL::InitializeDisplayInfo(EGLDisplay aDisplay) |
|
957 |
{ |
|
958 |
TBool result = EFalse; |
|
959 |
EGL_TRACE("CGuestEGL::InitialiseDisplayInfo begin aDisplay=%d", aDisplay); |
|
960 |
iDisplayMapLock.WriteLock(); |
|
961 |
CEglDisplayInfo** pDispInfo = iDisplayMap.Find(aDisplay); |
|
962 |
if (pDispInfo && *pDispInfo) |
|
963 |
{ |
|
964 |
(*pDispInfo)->iInitialized = ETrue; |
|
965 |
result = ETrue; |
|
966 |
} |
|
967 |
iDisplayMapLock.Unlock(); |
|
968 |
||
969 |
EGL_TRACE("InitialiseDisplayInfo end, result=%d", result); |
|
970 |
return result; |
|
971 |
} |
|
972 |
||
973 |
/* |
|
974 |
Check whether Display exists and is Initialised |
|
975 |
*/ |
|
976 |
TBool CGuestEGL::IsDisplayInitialized(EGLDisplay aDisplay) |
|
977 |
{ |
|
978 |
TBool result = EFalse; |
|
979 |
EGL_TRACE("CGuestEGL::IsDisplayInitialized begin aDisplay=%d", aDisplay); |
|
980 |
iDisplayMapLock.ReadLock(); |
|
981 |
CEglDisplayInfo** pDispInfo = iDisplayMap.Find(aDisplay); |
|
982 |
if ( pDispInfo && *pDispInfo && (*pDispInfo)->iInitialized) |
|
983 |
{ |
|
984 |
result = ETrue; |
|
985 |
} |
|
986 |
iDisplayMapLock.Unlock(); |
|
987 |
||
988 |
EGL_TRACE("IsDisplayInitialized end, result=%d", result); |
|
989 |
return result; |
|
990 |
} |
|
991 |
||
992 |
EGLBoolean CGuestEGL::eglSwapBuffers(TEglThreadState& aThreadState, EGLDisplay aDisplay, EGLSurface aSurface) |
|
993 |
{ |
|
39
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
994 |
/** |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
995 |
* PSEUDO CODE |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
996 |
* serialization.eglSwapBuffers |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
997 |
* (maybe finish currently bound api) |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
998 |
* surfaceupdatesession.notifywhenavailable |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
999 |
* .whendisplayed() (alternative choice from above) |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
1000 |
* surfaceupdatesession.submitupdated() |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
1001 |
* user:waitforrequestl |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
1002 |
*/ |
40
eaa1315a8556
added eglSwapBuffers integration; this change has not been compiled so don't sync to this changelist
Faisal Memon <faisal.memon@nokia.com>
parents:
39
diff
changeset
|
1003 |
|
eaa1315a8556
added eglSwapBuffers integration; this change has not been compiled so don't sync to this changelist
Faisal Memon <faisal.memon@nokia.com>
parents:
39
diff
changeset
|
1004 |
RHeap* threadHeap = CVghwUtils::SwitchToVghwHeap(); |
13 | 1005 |
TSurfaceInfo* surfaceInfo = EglInternalFunction_GetPlatformSurface( aDisplay, aSurface ); |
40
eaa1315a8556
added eglSwapBuffers integration; this change has not been compiled so don't sync to this changelist
Faisal Memon <faisal.memon@nokia.com>
parents:
39
diff
changeset
|
1006 |
RemoteFunctionCallData rfcdata; |
eaa1315a8556
added eglSwapBuffers integration; this change has not been compiled so don't sync to this changelist
Faisal Memon <faisal.memon@nokia.com>
parents:
39
diff
changeset
|
1007 |
EglRFC eglApiData( rfcdata ); |
eaa1315a8556
added eglSwapBuffers integration; this change has not been compiled so don't sync to this changelist
Faisal Memon <faisal.memon@nokia.com>
parents:
39
diff
changeset
|
1008 |
eglApiData.Init(EglRFC::EeglSwapBuffers); |
eaa1315a8556
added eglSwapBuffers integration; this change has not been compiled so don't sync to this changelist
Faisal Memon <faisal.memon@nokia.com>
parents:
39
diff
changeset
|
1009 |
TSize size = surfaceInfo->iNativeWindow->Size(); |
eaa1315a8556
added eglSwapBuffers integration; this change has not been compiled so don't sync to this changelist
Faisal Memon <faisal.memon@nokia.com>
parents:
39
diff
changeset
|
1010 |
|
eaa1315a8556
added eglSwapBuffers integration; this change has not been compiled so don't sync to this changelist
Faisal Memon <faisal.memon@nokia.com>
parents:
39
diff
changeset
|
1011 |
eglApiData.AppendEGLDisplay(aDisplay); |
eaa1315a8556
added eglSwapBuffers integration; this change has not been compiled so don't sync to this changelist
Faisal Memon <faisal.memon@nokia.com>
parents:
39
diff
changeset
|
1012 |
eglApiData.AppendEGLSurface(surfaceInfo->iHostSurfaceId); |
eaa1315a8556
added eglSwapBuffers integration; this change has not been compiled so don't sync to this changelist
Faisal Memon <faisal.memon@nokia.com>
parents:
39
diff
changeset
|
1013 |
eglApiData.AppendEGLint(size.iWidth); |
eaa1315a8556
added eglSwapBuffers integration; this change has not been compiled so don't sync to this changelist
Faisal Memon <faisal.memon@nokia.com>
parents:
39
diff
changeset
|
1014 |
eglApiData.AppendEGLint(size.iHeight); |
13 | 1015 |
|
40
eaa1315a8556
added eglSwapBuffers integration; this change has not been compiled so don't sync to this changelist
Faisal Memon <faisal.memon@nokia.com>
parents:
39
diff
changeset
|
1016 |
EGLBoolean result = aThreadState.ExecEglBooleanCmd(eglApiData); |
eaa1315a8556
added eglSwapBuffers integration; this change has not been compiled so don't sync to this changelist
Faisal Memon <faisal.memon@nokia.com>
parents:
39
diff
changeset
|
1017 |
TRequestStatus status; |
eaa1315a8556
added eglSwapBuffers integration; this change has not been compiled so don't sync to this changelist
Faisal Memon <faisal.memon@nokia.com>
parents:
39
diff
changeset
|
1018 |
TTimeStamp timestampLocalToThread; |
eaa1315a8556
added eglSwapBuffers integration; this change has not been compiled so don't sync to this changelist
Faisal Memon <faisal.memon@nokia.com>
parents:
39
diff
changeset
|
1019 |
surfaceInfo->iSurfaceUpdateSession.NotifyWhenDisplayed(status, timestampLocalToThread); |
eaa1315a8556
added eglSwapBuffers integration; this change has not been compiled so don't sync to this changelist
Faisal Memon <faisal.memon@nokia.com>
parents:
39
diff
changeset
|
1020 |
surfaceInfo->iSurfaceUpdateSession.SubmitUpdate(surfaceInfo->iNativeWindow->ScreenNumber(),surfaceInfo->iSurfaceId, surfaceInfo->iFrontBuffer); |
eaa1315a8556
added eglSwapBuffers integration; this change has not been compiled so don't sync to this changelist
Faisal Memon <faisal.memon@nokia.com>
parents:
39
diff
changeset
|
1021 |
User::WaitForRequest(status); |
eaa1315a8556
added eglSwapBuffers integration; this change has not been compiled so don't sync to this changelist
Faisal Memon <faisal.memon@nokia.com>
parents:
39
diff
changeset
|
1022 |
|
eaa1315a8556
added eglSwapBuffers integration; this change has not been compiled so don't sync to this changelist
Faisal Memon <faisal.memon@nokia.com>
parents:
39
diff
changeset
|
1023 |
if (surfaceInfo->iFrontBuffer == 0) |
eaa1315a8556
added eglSwapBuffers integration; this change has not been compiled so don't sync to this changelist
Faisal Memon <faisal.memon@nokia.com>
parents:
39
diff
changeset
|
1024 |
{ |
eaa1315a8556
added eglSwapBuffers integration; this change has not been compiled so don't sync to this changelist
Faisal Memon <faisal.memon@nokia.com>
parents:
39
diff
changeset
|
1025 |
surfaceInfo->iFrontBuffer = 1; |
eaa1315a8556
added eglSwapBuffers integration; this change has not been compiled so don't sync to this changelist
Faisal Memon <faisal.memon@nokia.com>
parents:
39
diff
changeset
|
1026 |
} |
eaa1315a8556
added eglSwapBuffers integration; this change has not been compiled so don't sync to this changelist
Faisal Memon <faisal.memon@nokia.com>
parents:
39
diff
changeset
|
1027 |
else |
eaa1315a8556
added eglSwapBuffers integration; this change has not been compiled so don't sync to this changelist
Faisal Memon <faisal.memon@nokia.com>
parents:
39
diff
changeset
|
1028 |
{ |
eaa1315a8556
added eglSwapBuffers integration; this change has not been compiled so don't sync to this changelist
Faisal Memon <faisal.memon@nokia.com>
parents:
39
diff
changeset
|
1029 |
surfaceInfo->iFrontBuffer = 0; |
eaa1315a8556
added eglSwapBuffers integration; this change has not been compiled so don't sync to this changelist
Faisal Memon <faisal.memon@nokia.com>
parents:
39
diff
changeset
|
1030 |
} |
eaa1315a8556
added eglSwapBuffers integration; this change has not been compiled so don't sync to this changelist
Faisal Memon <faisal.memon@nokia.com>
parents:
39
diff
changeset
|
1031 |
|
13 | 1032 |
if (size != surfaceInfo->iSize) |
1033 |
{ |
|
1034 |
EGL_TRACE("CGuestEGL::eglSwapBuffers Surface Resized size=%d,%d, surfaceInfo->iSize=%d,%d", |
|
1035 |
size.iHeight, size.iWidth, surfaceInfo->iSize.iHeight, surfaceInfo->iSize.iWidth); |
|
40
eaa1315a8556
added eglSwapBuffers integration; this change has not been compiled so don't sync to this changelist
Faisal Memon <faisal.memon@nokia.com>
parents:
39
diff
changeset
|
1036 |
|
eaa1315a8556
added eglSwapBuffers integration; this change has not been compiled so don't sync to this changelist
Faisal Memon <faisal.memon@nokia.com>
parents:
39
diff
changeset
|
1037 |
CVghwUtils::SwitchFromVghwHeap(threadHeap); |
eaa1315a8556
added eglSwapBuffers integration; this change has not been compiled so don't sync to this changelist
Faisal Memon <faisal.memon@nokia.com>
parents:
39
diff
changeset
|
1038 |
return EglInternalFunction_SurfaceResized(aThreadState, *surfaceInfo, aDisplay, aSurface); // TODO handling of resize |
13 | 1039 |
} |
40
eaa1315a8556
added eglSwapBuffers integration; this change has not been compiled so don't sync to this changelist
Faisal Memon <faisal.memon@nokia.com>
parents:
39
diff
changeset
|
1040 |
|
eaa1315a8556
added eglSwapBuffers integration; this change has not been compiled so don't sync to this changelist
Faisal Memon <faisal.memon@nokia.com>
parents:
39
diff
changeset
|
1041 |
CVghwUtils::SwitchFromVghwHeap(threadHeap); |
eaa1315a8556
added eglSwapBuffers integration; this change has not been compiled so don't sync to this changelist
Faisal Memon <faisal.memon@nokia.com>
parents:
39
diff
changeset
|
1042 |
|
eaa1315a8556
added eglSwapBuffers integration; this change has not been compiled so don't sync to this changelist
Faisal Memon <faisal.memon@nokia.com>
parents:
39
diff
changeset
|
1043 |
return result; |
13 | 1044 |
} |
1045 |
||
1046 |
EGLBoolean CGuestEGL::eglMakeCurrent(TEglThreadState& aThreadState, EGLDisplay aDisplay, EGLSurface aDraw, EGLSurface aRead, EGLContext aContext) |
|
1047 |
{ |
|
1048 |
if (aContext == EGL_NO_CONTEXT) |
|
1049 |
{ |
|
1050 |
if ( (aDraw != EGL_NO_SURFACE) || (aRead != EGL_NO_SURFACE) ) |
|
1051 |
{ |
|
1052 |
aThreadState.SetEglError(EGL_BAD_SURFACE); |
|
1053 |
return EGL_FALSE; |
|
1054 |
} |
|
1055 |
EGL_TRACE("CGuestEGL::eglMakeCurrent call host"); |
|
1056 |
RemoteFunctionCallData rfcdata; EglRFC eglApiData( rfcdata ); |
|
1057 |
eglApiData.Init( EglRFC::EeglMakeCurrent ); |
|
1058 |
eglApiData.AppendEGLDisplay(aDisplay); |
|
1059 |
eglApiData.AppendEGLSurface(EGL_NO_SURFACE); |
|
1060 |
eglApiData.AppendEGLSurface(EGL_NO_SURFACE); |
|
1061 |
eglApiData.AppendEGLContext(EGL_NO_CONTEXT); |
|
1062 |
||
1063 |
EGLBoolean ret = aThreadState.ExecEglBooleanCmd(eglApiData); |
|
1064 |
EGL_TRACE("CGuestEGL::eglMakeCurrent end success=%d", ret); |
|
1065 |
return (EGLBoolean)ret; |
|
1066 |
} |
|
1067 |
else |
|
1068 |
{ |
|
1069 |
if ( (aDraw == EGL_NO_SURFACE) || (aRead == EGL_NO_SURFACE) ) |
|
1070 |
{ |
|
1071 |
aThreadState.SetEglError(EGL_BAD_SURFACE); |
|
1072 |
return EGL_FALSE; |
|
1073 |
} |
|
1074 |
// ToDo use new CEglContext code |
|
1075 |
const TInt KMaxSurfaces( 2 ); |
|
1076 |
EGLSurface surfaces[KMaxSurfaces]; |
|
1077 |
TSurfaceInfo* surfaceInfo[KMaxSurfaces] = {NULL, NULL}; |
|
1078 |
surfaces[0] = aDraw; |
|
1079 |
if (aDraw != aRead) |
|
1080 |
{ |
|
1081 |
surfaces[1] = aRead; |
|
1082 |
} |
|
1083 |
else |
|
1084 |
{ |
|
1085 |
surfaces[1] = EGL_NO_SURFACE; |
|
1086 |
} |
|
1087 |
||
1088 |
for ( TInt i = 0; i < KMaxSurfaces; i++ ) |
|
1089 |
{ |
|
1090 |
if ( EGL_NO_SURFACE != surfaces[i] ) |
|
1091 |
{ |
|
1092 |
EGL_TRACE("CGuestEGL::eglMakeCurrent check surface %d", surfaces[i] ); |
|
1093 |
surfaceInfo[i] = EglInternalFunction_GetPlatformSurface( aDisplay, surfaces[i] ); |
|
1094 |
//EGL_CHECK_ERROR( surfaceInfo, EGL_BAD_SURFACE , EGL_FALSE ); |
|
1095 |
if ( surfaceInfo[i] ) |
|
1096 |
{ |
|
1097 |
TSize newSize; |
|
1098 |
switch (surfaceInfo[i]->iSurfaceType) |
|
1099 |
{ |
|
1100 |
case ESurfaceTypePixmapFbsBitmap: |
|
1101 |
EGLPANIC_ASSERT_DEBUG(surfaceInfo[i]->iFbsBitmap, EEglPanicTemp); |
|
1102 |
newSize = surfaceInfo[i]->iFbsBitmap->SizeInPixels(); |
|
1103 |
break; |
|
1104 |
case ESurfaceTypeWindow: |
|
1105 |
EGLPANIC_ASSERT_DEBUG(surfaceInfo[i]->iNativeWindow, EEglPanicTemp); |
|
1106 |
newSize = surfaceInfo[i]->iNativeWindow->Size(); |
|
1107 |
break; |
|
1108 |
default: |
|
1109 |
// size cannot change for other surface types |
|
1110 |
newSize = surfaceInfo[i]->iSize; |
|
1111 |
break; |
|
1112 |
} |
|
1113 |
if (newSize != surfaceInfo[i]->iSize) |
|
1114 |
{ |
|
1115 |
EGL_TRACE("CGuestEGL::eglMakeCurrent resize surface"); |
|
1116 |
if ( !EglInternalFunction_SurfaceResized(aThreadState, *surfaceInfo[i], aDisplay, surfaces[i] ) ) |
|
1117 |
{ |
|
1118 |
return EGL_FALSE; |
|
1119 |
} |
|
1120 |
surfaceInfo[i]->iSize = newSize; |
|
1121 |
} |
|
1122 |
} |
|
1123 |
} |
|
1124 |
} |
|
1125 |
||
1126 |
// adapt to only some surfaces having CEglSurfaceInfo objects so far |
|
1127 |
EGLSurface drawId = surfaceInfo[0] ? surfaceInfo[0]->iHostSurfaceId : aDraw; |
|
1128 |
EGLSurface readId = aRead; |
|
1129 |
if ((aRead == aDraw) && surfaceInfo[0]) |
|
1130 |
{ |
|
1131 |
readId = surfaceInfo[0]->iHostSurfaceId; |
|
1132 |
} |
|
1133 |
else if (surfaceInfo[1]) |
|
1134 |
{ |
|
1135 |
readId = surfaceInfo[1]->iHostSurfaceId; |
|
1136 |
} |
|
1137 |
||
1138 |
EGL_TRACE(" eglMakeCurrent surfaces[0]=0x%x, surfaces[1]=0x%x", surfaces[0], surfaces[1]); |
|
1139 |
EGL_TRACE(" eglMakeCurrent surfacesInfo[0]=0x%x, surfacesInfo[0].iHostSurfaceId=0x%x", |
|
1140 |
surfaceInfo[0], surfaceInfo[0] ? surfaceInfo[0]->iHostSurfaceId : NULL); |
|
1141 |
EGL_TRACE(" eglMakeCurrent surfacesInfo[1]=0x%x, surfacesInfo[1].iHostSurfaceId=0x%x", |
|
1142 |
surfaceInfo[1], surfaceInfo[1] ? surfaceInfo[1]->iHostSurfaceId : NULL); |
|
1143 |
||
1144 |
EGL_TRACE("CGuestEGL::eglMakeCurrent call host"); |
|
1145 |
RemoteFunctionCallData rfcdata; EglRFC eglApiData( rfcdata ); |
|
1146 |
eglApiData.Init( EglRFC::EeglMakeCurrent ); |
|
1147 |
eglApiData.AppendEGLDisplay(aDisplay); |
|
1148 |
||
1149 |
EGL_TRACE(" eglApiData.AppendEGLSurface(drawId = 0x%x)", drawId); |
|
1150 |
eglApiData.AppendEGLSurface(drawId); |
|
1151 |
EGL_TRACE(" eglApiData.AppendEGLSurface(readId = 0x%x);", readId); |
|
1152 |
eglApiData.AppendEGLSurface(readId); |
|
1153 |
||
1154 |
eglApiData.AppendEGLContext(aContext); |
|
1155 |
EGLBoolean ret = aThreadState.ExecEglBooleanCmd(eglApiData); |
|
1156 |
EGL_TRACE("CGuestEGL::eglMakeCurrent end success=%d", ret); |
|
1157 |
return (EGLBoolean)ret; |
|
1158 |
} |
|
1159 |
} |
|
1160 |
||
1161 |
// FAISALMEMON HOLE 0.1 |
|
1162 |
||
1163 |
||
1164 |
// ----------------------------------------------------------------------------- |
|
1165 |
// |
|
1166 |
// ----------------------------------------------------------------------------- |
|
1167 |
// |
|
1168 |
TBool CGuestEGL::EglInternalFunction_CreateSurface(TEglThreadState& aThreadState, EGLDisplay aDisplay, EGLSurface aSurface, EGLConfig aConfig, RWindow* aNativeWindow, |
|
1169 |
TSurfaceInfo& aSurfaceInfo) |
|
1170 |
{ |
|
1171 |
RSurfaceManager::TSurfaceCreationAttributesBuf attributes; |
|
1172 |
RSurfaceManager::TInfoBuf info; |
|
1173 |
||
1174 |
aSurfaceInfo.iNativeWindow = aNativeWindow; |
|
1175 |
aSurfaceInfo.iSurfaceType = ESurfaceTypeWindow; |
|
1176 |
aSurfaceInfo.iSize = aNativeWindow->Size(); |
|
1177 |
aSurfaceInfo.iConfigId = aConfig; |
|
1178 |
aSurfaceInfo.iHostSurfaceId = aSurface; |
|
1179 |
||
1180 |
// ToDo have function variants that do not validate parameters |
|
1181 |
eglQuerySurface(aThreadState, aDisplay, aSurface, EGL_VG_ALPHA_FORMAT, &aSurfaceInfo.iAlphaFormat); |
|
1182 |
eglGetConfigAttrib(aThreadState, aDisplay, aConfig, EGL_BUFFER_SIZE, &aSurfaceInfo.iColorBits); |
|
1183 |
eglGetConfigAttrib(aThreadState, aDisplay, aConfig, EGL_RED_SIZE, &aSurfaceInfo.iRedBits); |
|
1184 |
eglGetConfigAttrib(aThreadState, aDisplay, aConfig, EGL_GREEN_SIZE, &aSurfaceInfo.iGreenBits); |
|
1185 |
eglGetConfigAttrib(aThreadState, aDisplay, aConfig, EGL_BLUE_SIZE, &aSurfaceInfo.iBlueBits); |
|
1186 |
eglGetConfigAttrib(aThreadState, aDisplay, aConfig, EGL_ALPHA_SIZE, &aSurfaceInfo.iAlphaBits); |
|
1187 |
||
1188 |
/* |
|
1189 |
TInt err = LastError(); |
|
1190 |
EGL_CHECK_ERROR( EGL_SUCCESS == err, err, EGL_FALSE ); |
|
1191 |
*/ |
|
1192 |
EGL_TRACE(" Win surface details: width=%d height=%d colorbits=%d red=%d green=%d blue=%d alpha=%d alphaformat=0x%x", |
|
1193 |
aSurfaceInfo.iSize.iWidth, aSurfaceInfo.iSize.iHeight, aSurfaceInfo.iColorBits, aSurfaceInfo.iRedBits, |
|
1194 |
aSurfaceInfo.iGreenBits, aSurfaceInfo.iBlueBits, aSurfaceInfo.iAlphaBits, aSurfaceInfo.iAlphaFormat); |
|
1195 |
||
1196 |
TSize size; |
|
1197 |
||
1198 |
// FAISALMEMON HOLE 1 |
|
1199 |
||
1200 |
// FAISALMEMON STUB CODE |
|
1201 |
TUint8 offsetToFirstBuffer = 0; // This is wrong; just stub code |
|
1202 |
TUint8 offsetToSecondBuffer = 0; // This is wrong; just stub code |
|
1203 |
// FAISALMEMON END OF STUB CODE |
|
1204 |
||
1205 |
TUint32 chunkHWBase = 0; |
|
39
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
1206 |
(void)CVghwUtils::MapToHWAddress(aSurfaceInfo.iChunk.Handle(), chunkHWBase); |
13 | 1207 |
// FAISALMEMON write code to handle errors in the above function |
1208 |
EGL_TRACE("CGuestEGL::EglInternalFunction_CreateSurface AFTER VGHWUtils::MapToHWAddress"); |
|
1209 |
||
28
9464ab1666a0
Fix guestegl to use dynamic framebuffer
Faisal Memon <faisal.memon@nokia.com>
parents:
19
diff
changeset
|
1210 |
TUint32 frameBufferBaseAddress(0); |
9464ab1666a0
Fix guestegl to use dynamic framebuffer
Faisal Memon <faisal.memon@nokia.com>
parents:
19
diff
changeset
|
1211 |
(void)CVghwUtils::GetFrameBufferBaseAddress(frameBufferBaseAddress); |
9464ab1666a0
Fix guestegl to use dynamic framebuffer
Faisal Memon <faisal.memon@nokia.com>
parents:
19
diff
changeset
|
1212 |
EGL_TRACE("CPlatsimEGL::egliCreateSurface AFTER VGHWUtils::MapToHWAddress"); |
9464ab1666a0
Fix guestegl to use dynamic framebuffer
Faisal Memon <faisal.memon@nokia.com>
parents:
19
diff
changeset
|
1213 |
|
13 | 1214 |
/* Store the pointer to the pixel data */ |
39
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
1215 |
aSurfaceInfo.iBuffer0 = aSurfaceInfo.iChunk.Base() + offsetToFirstBuffer; |
c8311e991ee3
interim checkin, no compilation check done so don't sync to this changeset
Faisal Memon <faisal.memon@nokia.com>
parents:
28
diff
changeset
|
1216 |
aSurfaceInfo.iBuffer1 = aSurfaceInfo.iChunk.Base() + offsetToSecondBuffer; |
13 | 1217 |
|
28
9464ab1666a0
Fix guestegl to use dynamic framebuffer
Faisal Memon <faisal.memon@nokia.com>
parents:
19
diff
changeset
|
1218 |
aSurfaceInfo.iBuffer0Index = (chunkHWBase + offsetToFirstBuffer) - frameBufferBaseAddress; |
9464ab1666a0
Fix guestegl to use dynamic framebuffer
Faisal Memon <faisal.memon@nokia.com>
parents:
19
diff
changeset
|
1219 |
aSurfaceInfo.iBuffer1Index = (chunkHWBase + offsetToSecondBuffer) - frameBufferBaseAddress; |
40
eaa1315a8556
added eglSwapBuffers integration; this change has not been compiled so don't sync to this changelist
Faisal Memon <faisal.memon@nokia.com>
parents:
39
diff
changeset
|
1220 |
|
eaa1315a8556
added eglSwapBuffers integration; this change has not been compiled so don't sync to this changelist
Faisal Memon <faisal.memon@nokia.com>
parents:
39
diff
changeset
|
1221 |
aSurfaceInfo.iFrontBuffer = 0; // Assume host peer also starts rendering buffer 0 as its front buffer |
13 | 1222 |
EGL_TRACE("CGuestEGL::EglInternalFunction_CreateSurface %u %x %x %x %x",chunkHWBase, offsetToFirstBuffer, offsetToSecondBuffer, |
1223 |
aSurfaceInfo.iBuffer0Index, |
|
1224 |
aSurfaceInfo.iBuffer1Index); |
|
1225 |
||
1226 |
if ( !EglInternalFunction_CallSetSurfaceParams(aThreadState, aDisplay, aSurface, aSurfaceInfo) ) |
|
1227 |
{ |
|
1228 |
EGL_TRACE("CGuestEGL::EglInternalFunction_CreateSurface end failure"); |
|
1229 |
||
1230 |
return EGL_FALSE; |
|
1231 |
} |
|
1232 |
EGL_TRACE("CGuestEGL::EglInternalFunction_CreateSurface end success"); |
|
1233 |
||
1234 |
return EGL_TRUE; |
|
1235 |
} |
|
1236 |
||
1237 |
// ----------------------------------------------------------------------------- |
|
1238 |
// |
|
1239 |
// ----------------------------------------------------------------------------- |
|
1240 |
// |
|
1241 |
EGLBoolean CGuestEGL::eglDestroySurface(TEglThreadState& aThreadState, EGLDisplay aDisplay, EGLSurface aSurface) |
|
1242 |
{ |
|
1243 |
RemoteFunctionCallData rfcdata; EglRFC eglApiData( rfcdata ); |
|
1244 |
EGLBoolean result = EGL_FALSE; |
|
1245 |
||
1246 |
// do not destroy SgImage surfaces on the Host! |
|
1247 |
TSurfaceInfo* surfaceInfo = EglInternalFunction_GetPlatformSurface(aDisplay, aSurface); |
|
1248 |
if (!surfaceInfo) |
|
1249 |
{ // Note: Pbuffer surfaces are not currently recorded in client |
|
1250 |
eglApiData.Init( EglRFC::EeglDestroySurface ); |
|
1251 |
eglApiData.AppendEGLDisplay(aDisplay); |
|
1252 |
eglApiData.AppendEGLSurface(aSurface); |
|
1253 |
result = aThreadState.ExecEglBooleanCmd(eglApiData); |
|
1254 |
} |
|
1255 |
else |
|
1256 |
{ |
|
1257 |
if (surfaceInfo->iSurfaceType != ESurfaceTypePixmapSgImage) |
|
1258 |
{ // destroy surface allocated by Host EGL |
|
1259 |
eglApiData.Init( EglRFC::EeglDestroySurface ); |
|
1260 |
eglApiData.AppendEGLDisplay(aDisplay); |
|
1261 |
eglApiData.AppendEGLSurface(surfaceInfo->iHostSurfaceId); |
|
1262 |
result = aThreadState.ExecEglBooleanCmd(eglApiData); |
|
1263 |
} |
|
1264 |
#ifdef FAISALMEMON_S4_SGIMAGE |
|
1265 |
else |
|
1266 |
{ // release SgImage handle |
|
1267 |
surfaceInfo->iSgHandle.Close(); |
|
1268 |
} |
|
1269 |
#endif |
|
1270 |
||
1271 |
DestroySurfaceInfo(aDisplay, aSurface); |
|
1272 |
} |
|
1273 |
||
1274 |
return result; |
|
1275 |
} |
|
1276 |
// ----------------------------------------------------------------------------- |
|
1277 |
// |
|
1278 |
// ----------------------------------------------------------------------------- |
|
1279 |
// |
|
1280 |
void CGuestEGL::DestroySurfaceInfo(EGLDisplay aDisplay, EGLSurface aSurface) |
|
1281 |
{ |
|
1282 |
EGL_TRACE("DestroySurfaceInfo begin"); |
|
1283 |
||
1284 |
iDisplayMapLock.ReadLock(); |
|
1285 |
CEglDisplayInfo** pDispInfo = iDisplayMap.Find(aDisplay); |
|
1286 |
if (!pDispInfo || !*pDispInfo) |
|
1287 |
{ |
|
1288 |
EGL_TRACE("cannot find display %d", aDisplay); |
|
1289 |
} |
|
1290 |
else |
|
1291 |
{ |
|
1292 |
TSurfaceInfo** pSurfaceInfo = (*pDispInfo)->iSurfaceMap.Find(aSurface); |
|
1293 |
if (!pSurfaceInfo) |
|
1294 |
{ |
|
1295 |
EGL_TRACE("cannot find surface %d for display %d", aSurface, aDisplay); |
|
1296 |
} |
|
1297 |
else |
|
1298 |
{ |
|
1299 |
TSurfaceInfo* surfaceInfo = *pSurfaceInfo; |
|
1300 |
RHeap* threadHeap = CVghwUtils::SwitchToVghwHeap(); |
|
1301 |
if (surfaceInfo->iNativeWindow) |
|
1302 |
{ |
|
1303 |
EglInternalFunction_DestroyWindowSurface(*surfaceInfo); |
|
1304 |
} |
|
1305 |
delete surfaceInfo; |
|
1306 |
(*pDispInfo)->iSurfaceMap.Remove( aSurface ); |
|
1307 |
CVghwUtils::SwitchFromVghwHeap(threadHeap); |
|
1308 |
EGL_TRACE("DestroySurfaceInfo end"); |
|
1309 |
} |
|
1310 |
} |
|
1311 |
||
1312 |
iDisplayMapLock.Unlock(); |
|
1313 |
} |
|
1314 |
||
1315 |
// ----------------------------------------------------------------------------- |
|
1316 |
// |
|
1317 |
// ----------------------------------------------------------------------------- |
|
1318 |
// |
|
1319 |
TBool CGuestEGL::DestroyDisplayInfo (EGLDisplay aDisplay) |
|
1320 |
{ |
|
1321 |
EGL_TRACE("DestroyDisplayInfo begin aDisplay=%d", aDisplay); |
|
1322 |
TBool success = EFalse; |
|
1323 |
||
1324 |
iDisplayMapLock.WriteLock(); |
|
1325 |
CEglDisplayInfo** pDispInfo = iDisplayMap.Find(aDisplay); |
|
1326 |
if (!pDispInfo || !*pDispInfo) |
|
1327 |
{ |
|
1328 |
EGL_TRACE("cannot find display %d", aDisplay); |
|
1329 |
} |
|
1330 |
else |
|
1331 |
{ |
|
1332 |
success = ETrue; |
|
1333 |
RHeap* threadHeap = CVghwUtils::SwitchToVghwHeap(); |
|
1334 |
RHashMap<TInt, TSurfaceInfo*>::TIter iter((*pDispInfo)->iSurfaceMap); |
|
1335 |
for (;;) |
|
1336 |
{ |
|
1337 |
TSurfaceInfo** pSurfaceInfo = const_cast<TSurfaceInfo**>(iter.NextValue()); |
|
1338 |
if (!pSurfaceInfo) |
|
1339 |
{ |
|
1340 |
break; |
|
1341 |
} |
|
1342 |
||
1343 |
EGL_TRACE("destroying surface %d", *iter.CurrentKey()); |
|
1344 |
||
1345 |
TSurfaceInfo* surfaceInfo = *pSurfaceInfo; |
|
1346 |
if (surfaceInfo->iNativeWindow) |
|
1347 |
{ |
|
1348 |
EglInternalFunction_DestroyWindowSurface(*surfaceInfo); |
|
1349 |
} |
|
1350 |
delete surfaceInfo; |
|
1351 |
} |
|
1352 |
iDisplayMap.Remove(aDisplay); |
|
1353 |
CVghwUtils::SwitchFromVghwHeap(threadHeap); |
|
1354 |
||
1355 |
//added for egl sync extension benefit |
|
1356 |
if (iEglSyncExtension) |
|
1357 |
{ |
|
1358 |
iEglSyncExtension->EglSyncDisplayDestroy(aDisplay); |
|
1359 |
} |
|
1360 |
} |
|
1361 |
||
1362 |
iDisplayMapLock.Unlock(); |
|
1363 |
EGL_TRACE("DestroyDisplayInfo end - ret=%d", success); |
|
1364 |
return success; |
|
1365 |
} |
|
1366 |
||
1367 |
||
1368 |
// ----------------------------------------------------------------------------- |
|
1369 |
// |
|
1370 |
// ----------------------------------------------------------------------------- |
|
1371 |
// |
|
1372 |
EGLBoolean CGuestEGL::EglInternalFunction_CallSetSurfaceParams(TEglThreadState& aThreadState, EGLDisplay aDisplay, EGLSurface aSurface, TSurfaceInfo& aSurfaceInfo) |
|
1373 |
{ |
|
1374 |
EGL_TRACE("EglInternalFunction_CallSetSurfaceParams begin"); |
|
1375 |
||
1376 |
RemoteFunctionCallData rfcdata; |
|
1377 |
EglRFC eglApiData( rfcdata ); |
|
1378 |
eglApiData.Init(EglRFC::EeglSimulatorSetSurfaceParams); |
|
1379 |
eglApiData.AppendEGLDisplay(aDisplay); |
|
1380 |
eglApiData.AppendEGLSurface( aSurface ); |
|
1381 |
EGLNativeWindowType win = (EGLNativeWindowType)aSurfaceInfo.iNativeWindow->ClientHandle(); |
|
1382 |
eglApiData.AppendEGLNativeWindowType( win ); |
|
1383 |
eglApiData.AppendEGLSize(aSurfaceInfo.iSize); |
|
1384 |
eglApiData.AppendEGLint(aSurfaceInfo.iStride); |
|
1385 |
eglApiData.AppendEGLint(aSurfaceInfo.iBuffer0Index); |
|
1386 |
eglApiData.AppendEGLint(aSurfaceInfo.iBuffer1Index); |
|
1387 |
aThreadState.ExecuteEglNeverErrorCmd(eglApiData); |
|
1388 |
||
1389 |
EGL_TRACE("EglInternalFunction_CallSetSurfaceParams end"); |
|
1390 |
return EGL_TRUE; |
|
1391 |
} |
|
1392 |
||
1393 |
// ----------------------------------------------------------------------------- |
|
1394 |
// |
|
1395 |
// ----------------------------------------------------------------------------- |
|
1396 |
// |
|
1397 |
EGLint CGuestEGL::ConfigMatchesFbsBitmapPixmap(TEglThreadState& aThreadState, EGLDisplay aDisplay, EGLConfig aConfig, const EGLint* aAttribList, TDisplayMode aMode) |
|
1398 |
{ |
|
1399 |
// ToDo check EGL_VG_ALPHA_FORMAT ? |
|
1400 |
EGLint colorBits, redBits, greenBits, blueBits, alphaBits; |
|
1401 |
EGLint wantColorBits, wantRedBits, wantGreenBits, wantBlueBits; |
|
1402 |
EGLint wantAlphaBits = 0; |
|
1403 |
switch (aMode) |
|
1404 |
{ |
|
1405 |
case EColor64K: |
|
1406 |
wantColorBits = 12; |
|
1407 |
wantRedBits = 5; |
|
1408 |
wantGreenBits = 6; |
|
1409 |
wantBlueBits = 5; |
|
1410 |
break; |
|
1411 |
case EColor16M: |
|
1412 |
case EColor16MU: |
|
1413 |
wantColorBits = 24; |
|
1414 |
wantRedBits = 8; |
|
1415 |
wantGreenBits = 8; |
|
1416 |
wantBlueBits = 8; |
|
1417 |
break; |
|
1418 |
case EColor16MA: |
|
1419 |
wantColorBits = 32; |
|
1420 |
wantRedBits = 8; |
|
1421 |
wantGreenBits = 8; |
|
1422 |
wantBlueBits = 8; |
|
1423 |
wantAlphaBits = 8; |
|
1424 |
break; |
|
1425 |
case EColor16MAP: |
|
1426 |
wantColorBits = 32; |
|
1427 |
wantRedBits = 8; |
|
1428 |
wantGreenBits = 8; |
|
1429 |
wantBlueBits = 8; |
|
1430 |
wantAlphaBits = 8; |
|
1431 |
break; |
|
1432 |
default: // pixmap format not supported |
|
1433 |
return EGL_BAD_NATIVE_PIXMAP; |
|
1434 |
} |
|
1435 |
||
1436 |
// ToDo version of these functions lighter on parameter checking - maybe use cached values |
|
1437 |
if (!eglGetConfigAttrib(aThreadState, aDisplay, aConfig, EGL_BUFFER_SIZE, &colorBits) || |
|
1438 |
!eglGetConfigAttrib(aThreadState, aDisplay, aConfig, EGL_RED_SIZE, &redBits) || |
|
1439 |
!eglGetConfigAttrib(aThreadState, aDisplay, aConfig, EGL_GREEN_SIZE, &greenBits) || |
|
1440 |
!eglGetConfigAttrib(aThreadState, aDisplay, aConfig, EGL_BLUE_SIZE, &blueBits) || |
|
1441 |
!eglGetConfigAttrib(aThreadState, aDisplay, aConfig, EGL_ALPHA_SIZE, &alphaBits) ) |
|
1442 |
{ // fetch failed |
|
1443 |
return EGL_BAD_MATCH; |
|
1444 |
} |
|
1445 |
||
1446 |
EGL_TRACE("CGuestEGL::ConfigMatchesFbsBitmapPixmap: want %d bpp, %d red, %d green, %d blue, %d alpha\n\tconfig has %d bpp, %d red, %d green, %d blue, %d alpha", |
|
1447 |
wantColorBits, wantRedBits, wantGreenBits, wantBlueBits, wantAlphaBits, |
|
1448 |
colorBits, redBits, greenBits, blueBits, alphaBits); |
|
1449 |
||
1450 |
if ( (colorBits < wantColorBits) || (redBits < wantRedBits) || (greenBits < wantGreenBits) || |
|
1451 |
(blueBits < wantBlueBits) || (alphaBits < wantAlphaBits) ) |
|
1452 |
{ // config does not match bitmap |
|
1453 |
return EGL_BAD_MATCH; |
|
1454 |
} |
|
1455 |
||
1456 |
return EGL_SUCCESS; |
|
1457 |
} |
|
1458 |
||
1459 |
/* |
|
1460 |
Returns EGL_NO_SURFACE on failure. If the attributes of pixmap do not |
|
1461 |
correspond to config, then an EGL_BAD_MATCH error is generated. If config does |
|
1462 |
not support rendering to pixmaps (the EGL_SURFACE_TYPE attribute does not |
|
1463 |
contain EGL_PIXMAP_BIT), an EGL_BAD_MATCH error is generated. If config does |
|
1464 |
not support the colorspace or alpha format attributes specified in attrib list |
|
1465 |
(as defined for eglCreateWindowSurface), an EGL_BAD_MATCH error is generated. |
|
1466 |
If config is not a valid EGLConfig, an EGL_BAD_CONFIG error is generated. If |
|
1467 |
pixmap is not a valid native pixmap handle, then an EGL_BAD_NATIVE_PIXMAP |
|
1468 |
error should be generated. If there is already an EGLSurface associated with |
|
1469 |
pixmap (as a result of a previous eglCreatePixmapSurface call), then a |
|
1470 |
EGL_BAD_ALLOC error is generated. Finally, if the implementation cannotallocate |
|
1471 |
resources for the new EGL pixmap, an EGL_BAD_ALLOC error is generated. |
|
1472 |
*/ |
|
1473 |
EGLSurface CGuestEGL::eglCreatePixmapSurface(TEglThreadState& aThreadState, EGLDisplay aDisplay, EGLConfig aConfig, EGLNativePixmapType aNativePixmap, const EGLint *aAttribList) |
|
1474 |
{ |
|
1475 |
EGL_TRACE( "CGuestEGL::eglCreatePixmapSurface"); |
|
1476 |
EGL_TRACE_ATTRIB_LIST(aAttribList); |
|
1477 |
||
1478 |
EGLSurface newSurfaceId = EGL_NO_SURFACE; |
|
1479 |
TSurfaceInfo* surfaceInfo = NULL; |
|
1480 |
EGLint error = EGL_BAD_DISPLAY; |
|
1481 |
TSymbianPixmapTypeId pixmapType = EPixmapTypeNone; |
|
1482 |
||
1483 |
const EGLint* pixmapMatch = TAttribUtils::FindAttribValue(aAttribList, EGL_MATCH_NATIVE_PIXMAP); |
|
1484 |
if ( pixmapMatch && ( (*pixmapMatch) != (EGLint)(aNativePixmap) ) ) |
|
1485 |
{ // if EGL_MATCH_NATIVE_PIXMAP is in the attribute list it must be the same pixmap as aNativePixmap |
|
1486 |
error = EGL_BAD_MATCH; |
|
1487 |
} |
|
1488 |
else |
|
1489 |
{ |
|
1490 |
iDisplayMapLock.WriteLock(); |
|
1491 |
CEglDisplayInfo** pDispInfo; |
|
1492 |
pDispInfo = iDisplayMap.Find(aDisplay); |
|
1493 |
||
1494 |
if (pDispInfo && *pDispInfo) |
|
1495 |
{ |
|
1496 |
RHeap* threadHeap = CVghwUtils::SwitchToVghwHeap(); |
|
1497 |
||
1498 |
surfaceInfo = new TSurfaceInfo(); |
|
1499 |
if (surfaceInfo) |
|
1500 |
{ |
|
1501 |
surfaceInfo->iConfigId = aConfig; |
|
1502 |
pixmapType = EglInternalFunction_GetNativePixmapType(aNativePixmap); |
|
1503 |
switch (pixmapType) |
|
1504 |
{ |
|
1505 |
case EPixmapTypeFbsBitmap: |
|
1506 |
newSurfaceId = CreateFbsBitmapSurface(aThreadState, aDisplay, aConfig, reinterpret_cast<CFbsBitmap*>(aNativePixmap), aAttribList, |
|
1507 |
*surfaceInfo); |
|
1508 |
break; |
|
1509 |
#ifdef FAISALMEMON_S4_SGIMAGE |
|
1510 |
case EPixmapTypeSgImage: |
|
1511 |
newSurfaceId = CreateSgImageSurface(aThreadState, aDisplay, aConfig, reinterpret_cast<const RSgImage*>(aNativePixmap), aAttribList, |
|
1512 |
*surfaceInfo); |
|
1513 |
break; |
|
1514 |
#endif |
|
1515 |
default: |
|
1516 |
break; |
|
1517 |
} |
|
1518 |
if (newSurfaceId == EGL_NO_SURFACE) |
|
1519 |
{ |
|
1520 |
error = EGL_BAD_NATIVE_PIXMAP; |
|
1521 |
} |
|
1522 |
else |
|
1523 |
{ |
|
1524 |
error = EGL_SUCCESS; |
|
1525 |
EGL_TRACE( "CGuestEGL::eglCreatePixmapSurface inserting surface 0x%x to display %d", newSurfaceId, aDisplay); |
|
1526 |
if (KErrNone != (*pDispInfo)->iSurfaceMap.Insert(newSurfaceId, surfaceInfo)) |
|
1527 |
{ |
|
1528 |
error = EGL_BAD_ALLOC; |
|
1529 |
if (pixmapType == EPixmapTypeFbsBitmap) |
|
1530 |
{ |
|
1531 |
(void) eglDestroySurface(aThreadState, aDisplay, newSurfaceId); |
|
1532 |
} |
|
1533 |
newSurfaceId = EGL_NO_SURFACE; |
|
1534 |
} |
|
1535 |
} |
|
1536 |
if (error != EGL_SUCCESS) |
|
1537 |
{ |
|
1538 |
delete surfaceInfo; |
|
1539 |
surfaceInfo = NULL; |
|
1540 |
} |
|
1541 |
} |
|
1542 |
else |
|
1543 |
{ |
|
1544 |
error = EGL_BAD_ALLOC; |
|
1545 |
} |
|
1546 |
CVghwUtils::SwitchFromVghwHeap(threadHeap); |
|
1547 |
} // dispInfo |
|
1548 |
iDisplayMapLock.Unlock(); |
|
1549 |
} |
|
1550 |
||
1551 |
aThreadState.SetEglError(error); |
|
1552 |
||
1553 |
// parameter check failed |
|
1554 |
if (error != EGL_SUCCESS) |
|
1555 |
{ |
|
1556 |
EGLPANIC_ASSERT_DEBUG(newSurfaceId == EGL_NO_SURFACE, EEglPanicTemp); |
|
1557 |
EGLPANIC_ASSERT_DEBUG(surfaceInfo == NULL, EEglPanicTemp); |
|
1558 |
return EGL_NO_SURFACE; |
|
1559 |
} |
|
1560 |
||
1561 |
EGLPANIC_ASSERT_DEBUG(newSurfaceId != EGL_NO_SURFACE, EEglPanicTemp); |
|
1562 |
EGLPANIC_ASSERT_DEBUG(surfaceInfo != NULL, EEglPanicTemp); |
|
1563 |
||
1564 |
return newSurfaceId; |
|
1565 |
} |
|
1566 |
||
1567 |
EGLSurface CGuestEGL::CreateFbsBitmapSurface(TEglThreadState& aThreadState, EGLDisplay aDisplay, EGLConfig aConfig, CFbsBitmap* aBitmap, |
|
1568 |
const EGLint *aAttribList, TSurfaceInfo& aSurfaceInfo) |
|
1569 |
{ |
|
1570 |
EGLSurface newSurfaceId = EGL_NO_SURFACE; |
|
1571 |
aSurfaceInfo.iSurfaceType = ESurfaceTypePixmapFbsBitmap; |
|
1572 |
aSurfaceInfo.iFbsBitmap = aBitmap; |
|
1573 |
||
1574 |
TDisplayMode mode = ENone; |
|
1575 |
TInt stride; |
|
1576 |
aSurfaceInfo.iSize = aBitmap->SizeInPixels(); |
|
1577 |
EGL_TRACE("CGuestEGL::CreateFbsBitmapSurface image width=%d, height=%d", aSurfaceInfo.iSize.iWidth, aSurfaceInfo.iSize.iHeight); |
|
1578 |
||
1579 |
// check that a pixmap surface has not previously been created from this CFbsBitmap |
|
1580 |
if (!EglInternalFunction_PixmapSurfacePreviouslyCreated(aBitmap, EPixmapTypeFbsBitmap)) |
|
1581 |
{ |
|
1582 |
// error = EGL_BAD_ALLOC; |
|
1583 |
return EGL_NO_SURFACE; |
|
1584 |
} |
|
1585 |
else |
|
1586 |
{ |
|
1587 |
mode = aBitmap->DisplayMode(); |
|
1588 |
if (EGL_SUCCESS != ConfigMatchesFbsBitmapPixmap(aThreadState, aDisplay, aConfig, aAttribList, mode)) |
|
1589 |
{ |
|
1590 |
return EGL_NO_SURFACE; |
|
1591 |
} |
|
1592 |
} |
|
1593 |
||
1594 |
RemoteFunctionCallData rfcdata; EglRFC eglApiData( rfcdata ); |
|
1595 |
stride = CFbsBitmap::ScanLineLength(aSurfaceInfo.iSize.iWidth, mode); |
|
1596 |
eglApiData.Init( EglRFC::EeglCreatePixmapSurface ); |
|
1597 |
eglApiData.AppendEGLDisplay(aDisplay); |
|
1598 |
eglApiData.AppendEGLConfig(aConfig); |
|
1599 |
eglApiData.AppendEGLNativePixmapType((EGLNativePixmapType) aBitmap); |
|
1600 |
eglApiData.AppendEGLint(mode); |
|
1601 |
eglApiData.AppendEGLSize(aSurfaceInfo.iSize); |
|
1602 |
eglApiData.AppendEGLint(stride); |
|
1603 |
eglApiData.AppendEGLint(EPixmapTypeFbsBitmap); |
|
1604 |
eglApiData.AppendEGLintVector(aAttribList, TAttribUtils::AttribListLength(aAttribList)); |
|
1605 |
newSurfaceId = aThreadState.ExecEglSurfaceCmd(eglApiData); |
|
1606 |
EGL_TRACE( "EeglCreatePixmapSurface aDisplay=%d, config=%d, format=%d, width=%d, height=%d, stride=%d, pixmapType=%d, newSurface=%d", |
|
1607 |
aDisplay, aConfig, mode, aSurfaceInfo.iSize.iWidth, aSurfaceInfo.iSize.iHeight, stride, EPixmapTypeFbsBitmap, newSurfaceId); |
|
1608 |
||
1609 |
aSurfaceInfo.iHostSurfaceId = newSurfaceId; |
|
1610 |
return newSurfaceId; |
|
1611 |
} |
|
1612 |
||
1613 |
#ifdef FAISALMEMON_S4_SGIMAGE |
|
1614 |
EGLSurface CGuestEGL::CreateSgImageSurface(TEglThreadState& aThreadState, EGLDisplay aDisplay, EGLConfig aConfig, const RSgImage* aSgImage, |
|
1615 |
const EGLint *aAttribList, TSurfaceInfo& aSurfaceInfo) |
|
1616 |
{ |
|
1617 |
// ToDo check that the SgImage is not already being used for a surface or EglImage |
|
1618 |
aSurfaceInfo.iSurfaceType = ESurfaceTypePixmapSgImage; |
|
1619 |
aSurfaceInfo.iSgId = aSgImage->Id(); |
|
1620 |
||
1621 |
EGL_TRACE("CGuestEGL::CreateSgImageSurface sgImage id 0x%lx", aSurfaceInfo.iSgId); |
|
1622 |
TSgImageInfo imgInfo; |
|
1623 |
// ToDo ensure SgImage has correct suitable usage bits |
|
1624 |
if ( (aSurfaceInfo.iSgId != KSgNullDrawableId) && (KErrNone == aSurfaceInfo.iSgHandle.Open(aSurfaceInfo.iSgId)) && |
|
1625 |
(KErrNone == aSgImage->GetInfo(imgInfo)) ) |
|
1626 |
{ |
|
1627 |
EGL_TRACE("CGuestEGL::CreateSgImageSurface 1. SgImage PixelFormat=%d; size=%d,%d; Usage=0x%x", |
|
1628 |
imgInfo.iPixelFormat, imgInfo.iSizeInPixels.iWidth, imgInfo.iSizeInPixels.iHeight, imgInfo.iUsage); |
|
1629 |
aSurfaceInfo.iSize = imgInfo.iSizeInPixels; |
|
1630 |
||
1631 |
/* Package the handles to 64-bit value, since there's only one parameter available. |
|
1632 |
pbufferHandle is the lower 32 bits, VGImageHandle is the upper bits. */ |
|
1633 |
TUint64 sgHandles; |
|
1634 |
EGLint hostResult = CVghwUtils::EglGetSgHandles(aSurfaceInfo.iSgId.iId, &sgHandles); |
|
1635 |
EGL_TRACE("CGuestEGL::CreateSgImageSurface 2. EglGetSgHandles result=%d, sgHandles=0x%lx", hostResult, sgHandles); |
|
1636 |
aSurfaceInfo.iHostSurfaceId = (EGLSurface)(sgHandles&0xFFFFFFFF); |
|
1637 |
return aSurfaceInfo.iHostSurfaceId; |
|
1638 |
} |
|
1639 |
||
1640 |
aSurfaceInfo.iSgHandle.Close(); |
|
1641 |
return EGL_NO_SURFACE; |
|
1642 |
} |
|
1643 |
#endif |
|
1644 |
||
1645 |
// ----------------------------------------------------------------------------- |
|
1646 |
// |
|
1647 |
// ----------------------------------------------------------------------------- |
|
1648 |
// |
|
1649 |
TSurfaceInfo* CGuestEGL::EglInternalFunction_GetPlatformSurface( EGLDisplay display, EGLSurface surface ) |
|
1650 |
{ |
|
1651 |
EGL_TRACE( "CGuestEGL::EglInternalFunction_GetPlatformSurface"); |
|
1652 |
TSurfaceInfo* result = NULL; |
|
1653 |
||
1654 |
iDisplayMapLock.ReadLock(); |
|
1655 |
||
1656 |
CEglDisplayInfo** pDispInfo = iDisplayMap.Find( display ); |
|
1657 |
if (pDispInfo && *pDispInfo) |
|
1658 |
{ |
|
1659 |
TSurfaceInfo** pSurfaceInfo = (*pDispInfo)->iSurfaceMap.Find( surface ); |
|
1660 |
if (pSurfaceInfo) |
|
1661 |
{ |
|
1662 |
result = *pSurfaceInfo; |
|
1663 |
} |
|
1664 |
} |
|
1665 |
||
1666 |
// TODO on success should probably Unlock() the surface in the caller |
|
1667 |
iDisplayMapLock.Unlock(); |
|
1668 |
||
1669 |
/* TODO review calling code, to see if this suggestion makes sense |
|
1670 |
if (result == NULL) |
|
1671 |
{ |
|
1672 |
EGL_RAISE_ERROR( EGL_BAD_SURFACE, NULL); //Enable this when all surfaces are in surface map |
|
1673 |
} |
|
1674 |
*/ |
|
1675 |
return result; |
|
1676 |
} |
|
1677 |
||
1678 |
// ----------------------------------------------------------------------------- |
|
1679 |
// |
|
1680 |
// ----------------------------------------------------------------------------- |
|
1681 |
// |
|
1682 |
EGLBoolean CGuestEGL::eglWaitClient(TEglThreadState& aThreadState) |
|
1683 |
{ |
|
1684 |
EGL_TRACE( "CGuestEGL::eglWaitClient"); |
|
1685 |
RemoteFunctionCallData rfcdata; EglRFC eglApiData( rfcdata ); |
|
1686 |
eglApiData.Init(EglRFC::EeglWaitClient); |
|
1687 |
EGLBoolean result = aThreadState.ExecEglBooleanCmd(eglApiData); |
|
1688 |
||
1689 |
if (result) |
|
1690 |
{ |
|
1691 |
// ToDo cache in client, check results are not EGL_NO_DISPLAY / EGL_NO_SURFACE |
|
1692 |
EGLDisplay display = eglGetCurrentDisplay(aThreadState); |
|
1693 |
EGLSurface surface = eglGetCurrentSurface(aThreadState, EGL_DRAW); |
|
1694 |
iDisplayMapLock.ReadLock(); |
|
1695 |
CEglDisplayInfo** pDispInfo = iDisplayMap.Find( display ); |
|
1696 |
TSurfaceInfo* surfaceInfo = NULL; |
|
1697 |
||
1698 |
if (!pDispInfo || !*pDispInfo) |
|
1699 |
{ |
|
1700 |
EGL_TRACE( "cannot find display %d", display ); |
|
1701 |
} |
|
1702 |
else |
|
1703 |
{ |
|
1704 |
TSurfaceInfo** pSurfaceInfo = (*pDispInfo)->iSurfaceMap.Find( surface ); |
|
1705 |
if (!pSurfaceInfo) |
|
1706 |
{ |
|
1707 |
EGL_TRACE( "cannot find surface %d for display %d", surface, display ); |
|
1708 |
} |
|
1709 |
else |
|
1710 |
{ |
|
1711 |
surfaceInfo = *pSurfaceInfo; |
|
1712 |
} |
|
1713 |
} |
|
1714 |
iDisplayMapLock.Unlock(); |
|
1715 |
if (surfaceInfo == NULL) |
|
1716 |
{ |
|
1717 |
return EGL_FALSE; |
|
1718 |
} |
|
1719 |
if (surfaceInfo->iSurfaceType == ESurfaceTypePixmapFbsBitmap) |
|
1720 |
{ |
|
1721 |
EGLPANIC_ASSERT_DEBUG(surfaceInfo->iFbsBitmap, EEglPanicTemp); |
|
1722 |
surfaceInfo->iFbsBitmap->BeginDataAccess(); |
|
1723 |
||
1724 |
RemoteFunctionCallData rfcdata; EglRFC eglApiData( rfcdata ); |
|
1725 |
eglApiData.Init( EglRFC::EeglSimulatorCopyImageData ); |
|
1726 |
const TSize sizePixels( surfaceInfo->iFbsBitmap->Header().iSizeInPixels ); |
|
1727 |
eglApiData.AppendVector( (void*)surfaceInfo->iFbsBitmap->DataAddress(), |
|
1728 |
CFbsBitmap::ScanLineLength( sizePixels.iWidth, surfaceInfo->iFbsBitmap->DisplayMode() )*sizePixels.iHeight, |
|
1729 |
RemoteFunctionCallData::EOut ); |
|
1730 |
aThreadState.ExecuteEglNeverErrorCmd(eglApiData); |
|
1731 |
||
1732 |
surfaceInfo->iFbsBitmap->EndDataAccess(); |
|
1733 |
} |
|
1734 |
} |
|
1735 |
||
1736 |
return result; |
|
1737 |
} |
|
1738 |
||
1739 |
// ----------------------------------------------------------------------------- |
|
1740 |
// |
|
1741 |
// ----------------------------------------------------------------------------- |
|
1742 |
// |
|
1743 |
EGLSurface CGuestEGL::eglGetCurrentSurface(TEglThreadState& aThreadState, EGLint aReadDraw) |
|
1744 |
{ |
|
1745 |
// ToDo cache in client |
|
1746 |
RemoteFunctionCallData rfcdata; EglRFC eglApiData( rfcdata ); |
|
1747 |
eglApiData.Init(EglRFC::EeglGetCurrentSurface); |
|
1748 |
eglApiData.AppendEGLint(aReadDraw); |
|
1749 |
return ExecEglSurfaceNoErrorCmd(aThreadState, eglApiData); |
|
1750 |
} |
|
1751 |
||
1752 |
// ----------------------------------------------------------------------------- |
|
1753 |
// |
|
1754 |
// ----------------------------------------------------------------------------- |
|
1755 |
// |
|
1756 |
EGLDisplay CGuestEGL::eglGetCurrentDisplay(TEglThreadState& aThreadState) |
|
1757 |
{ |
|
1758 |
// ToDo cache in client |
|
1759 |
EGL_TRACE("CGuestEGL::eglGetCurrentDisplay"); |
|
1760 |
RemoteFunctionCallData rfcdata; EglRFC eglApiData( rfcdata ); |
|
1761 |
eglApiData.Init(EglRFC::EeglGetCurrentDisplay); |
|
1762 |
return ExecEglDisplayNoErrorCmd(aThreadState, eglApiData); |
|
1763 |
} |
|
1764 |
||
1765 |
// ----------------------------------------------------------------------------- |
|
1766 |
// |
|
1767 |
// ----------------------------------------------------------------------------- |
|
1768 |
// |
|
1769 |
EGLBoolean CGuestEGL::eglCopyBuffers(TEglThreadState& aThreadState, EGLDisplay aDisplay, EGLSurface aSurface, EGLNativePixmapType aTarget) |
|
1770 |
{ |
|
1771 |
TSize pixmapSize; |
|
1772 |
||
1773 |
EGL_TRACE("CGuestEGL::eglCopyBuffers"); |
|
1774 |
EGLBoolean hostResult = EGL_FALSE; |
|
1775 |
TSymbianPixmapTypeId targetPixmapType = EglInternalFunction_GetNativePixmapType(aTarget); |
|
1776 |
||
1777 |
// Only CFbsBitmap native pixmaps are supported by this API. (SgImages are not supported, as per the SgImsge Lite spec.) |
|
1778 |
if ( (targetPixmapType == EPixmapTypeFbsBitmap) && EglInternalFunction_IsValidNativePixmap(aTarget, targetPixmapType) ) |
|
1779 |
{ |
|
1780 |
RemoteFunctionCallData rfcdata; EglRFC eglApiData(rfcdata); |
|
1781 |
CFbsBitmap* bitmap = (CFbsBitmap*)aTarget; |
|
1782 |
TSize pixmapSize = bitmap->SizeInPixels(); |
|
1783 |
bitmap->BeginDataAccess(); |
|
1784 |
||
1785 |
TDisplayMode mode = bitmap->DisplayMode(); |
|
1786 |
EGLint stride = CFbsBitmap::ScanLineLength(bitmap->Header().iSizeInPixels.iWidth, mode); |
|
1787 |
void* data = bitmap->DataAddress(); |
|
1788 |
||
1789 |
#ifdef _DEBUG |
|
1790 |
char* modeName = NULL; |
|
1791 |
switch (mode) |
|
1792 |
{ |
|
1793 |
case ENone: modeName = "ENone"; break; |
|
1794 |
case EGray2: modeName = "EGray2"; break; |
|
1795 |
case EGray4: modeName = "EGray4"; break; |
|
1796 |
case EGray16: modeName = "EGray16"; break; |
|
1797 |
case EGray256: modeName = "EGray256"; break; |
|
1798 |
case EColor16: modeName = "EColor16"; break; |
|
1799 |
case EColor256: modeName = "EColor256"; break; |
|
1800 |
case EColor64K: modeName = "EColor64K"; break; |
|
1801 |
case EColor16M: modeName = "EColor16M"; break; |
|
1802 |
case ERgb: modeName = "ERgb"; break; |
|
1803 |
case EColor4K: modeName = "EColor4K"; break; |
|
1804 |
case EColor16MU: modeName = "EColor16MU"; break; |
|
1805 |
case EColor16MA: modeName = "EColor16MA"; break; |
|
1806 |
case EColor16MAP: modeName = "EColor16MAP"; break; |
|
1807 |
case EColorLast: modeName = "EColorLast"; break; |
|
1808 |
default: modeName = "unknown"; break; |
|
1809 |
} |
|
1810 |
EGL_TRACE("EglInternalFunction_GetNativePixmapInfo (0x%x) -> CFbsBitmap: DisplayMode=%d (\"%s\"), ScanLineLength=%d, data addr=0x%x", |
|
1811 |
bitmap, mode, modeName, stride, data); |
|
1812 |
#endif |
|
1813 |
||
1814 |
eglApiData.Init(EglRFC::EeglCopyBuffers); |
|
1815 |
eglApiData.AppendEGLDisplay(aDisplay); |
|
1816 |
eglApiData.AppendEGLSurface(aSurface); |
|
1817 |
const TSize sizePixels( bitmap->Header().iSizeInPixels ); |
|
1818 |
eglApiData.AppendVector((void*)bitmap->DataAddress(), |
|
1819 |
stride*pixmapSize.iHeight, |
|
1820 |
RemoteFunctionCallData::EOut); |
|
1821 |
||
1822 |
eglApiData.AppendEGLint((EGLint) mode); |
|
1823 |
eglApiData.AppendEGLSize(pixmapSize); |
|
1824 |
eglApiData.AppendEGLint(stride); |
|
1825 |
eglApiData.AppendEGLint(targetPixmapType); |
|
1826 |
||
1827 |
hostResult = aThreadState.ExecEglBooleanCmd(eglApiData); |
|
1828 |
bitmap->EndDataAccess(); |
|
1829 |
} |
|
1830 |
else |
|
1831 |
{ |
|
1832 |
aThreadState.SetEglError(EGL_BAD_NATIVE_PIXMAP); |
|
1833 |
} |
|
1834 |
||
1835 |
return hostResult; |
|
1836 |
} |
|
1837 |
||
1838 |
// ----------------------------------------------------------------------------- |
|
1839 |
// |
|
1840 |
// ----------------------------------------------------------------------------- |
|
1841 |
// |
|
1842 |
// Beware odd logic: EFalse if surface is found, otherwise ETrue |
|
1843 |
TBool CGuestEGL::EglInternalFunction_PixmapSurfacePreviouslyCreated(EGLNativePixmapType pixmap, TSymbianPixmapTypeId pixmapType) |
|
1844 |
{ |
|
1845 |
// ToDo keep a hashmap of pixmap addresses currently used for surfaces |
|
1846 |
TBool result = ETrue; |
|
1847 |
if(pixmapType == EPixmapTypeFbsBitmap) |
|
1848 |
{ |
|
1849 |
iDisplayMapLock.ReadLock(); |
|
1850 |
RHashMap<TInt, CEglDisplayInfo*>::TIter iter( iDisplayMap ); |
|
1851 |
for (;;) |
|
1852 |
{ |
|
1853 |
CEglDisplayInfo** pDispInfo = const_cast<CEglDisplayInfo**>(iter.NextValue()); |
|
1854 |
if (!pDispInfo || !*pDispInfo) |
|
1855 |
{ |
|
1856 |
break; |
|
1857 |
} |
|
1858 |
||
1859 |
RHashMap<TInt, TSurfaceInfo*>::TIter iter2((*pDispInfo)->iSurfaceMap); |
|
1860 |
for (;;) |
|
1861 |
{ |
|
1862 |
TSurfaceInfo** pSurfaceInfo = const_cast<TSurfaceInfo**>(iter2.NextValue()); |
|
1863 |
if (!pSurfaceInfo) |
|
1864 |
{ |
|
1865 |
break; |
|
1866 |
} |
|
1867 |
||
1868 |
TSurfaceInfo* surfaceInfo = *pSurfaceInfo; |
|
1869 |
if ( (surfaceInfo->iSurfaceType == ESurfaceTypePixmapFbsBitmap) && (surfaceInfo->iFbsBitmap == pixmap) ) |
|
1870 |
{ |
|
1871 |
result = EFalse; |
|
1872 |
} |
|
1873 |
} |
|
1874 |
} |
|
1875 |
iDisplayMapLock.Unlock(); |
|
1876 |
} |
|
1877 |
||
1878 |
EGL_TRACE("CGuestEGL::EglInternalFunction_PixmapSurfacePreviouslyCreated %d", result); |
|
1879 |
return result; |
|
1880 |
} |
|
1881 |
||
1882 |
// FAISALMEMON HOLE 2 |
|
1883 |
||
1884 |
EGLDisplay CGuestEGL::eglGetDisplay(TEglThreadState& aThreadState, EGLNativeDisplayType aDisplayId) |
|
1885 |
{ |
|
1886 |
RemoteFunctionCallData rfcdata; EglRFC eglApiData(rfcdata); |
|
1887 |
eglApiData.Init(EglRFC::EeglGetDisplay); |
|
1888 |
eglApiData.AppendEGLNativeDisplayType(aDisplayId); |
|
1889 |
EGLDisplay display = ExecEglDisplayNoErrorCmd(aThreadState, eglApiData); |
|
1890 |
||
1891 |
if (display != EGL_NO_DISPLAY) |
|
1892 |
{ |
|
1893 |
if (!CreateDisplayInfo(display)) |
|
1894 |
{ // alloc failed |
|
1895 |
display = EGL_NO_DISPLAY; |
|
1896 |
} |
|
1897 |
} |
|
1898 |
return display; |
|
1899 |
} |
|
1900 |
||
1901 |
// ----------------------------------------------------------------------------- |
|
1902 |
// |
|
1903 |
// ----------------------------------------------------------------------------- |
|
1904 |
// |
|
1905 |
EGLint CGuestEGL::InitialiseExtensions() |
|
1906 |
{ |
|
1907 |
iEglSyncExtension = CEglSyncExtension::Create(*this); |
|
1908 |
return EGL_SUCCESS; |
|
1909 |
} |
|
1910 |
||
1911 |
||
1912 |
// API supporting EGL sync extension |
|
1913 |
// lock the display once found |
|
1914 |
EGLint CGuestEGL::FindAndLockDisplay(EGLDisplay aDisplay) |
|
1915 |
{ |
|
1916 |
EGLint result = EGL_BAD_DISPLAY; |
|
1917 |
EGL_TRACE("CGuestEGL::FindAndLockDisplay aDisplay=%d", aDisplay); |
|
1918 |
iDisplayMapLock.ReadLock(); |
|
1919 |
CEglDisplayInfo** pDisp = iDisplayMap.Find(aDisplay); |
|
1920 |
if (pDisp && *pDisp) |
|
1921 |
{ |
|
1922 |
CEglDisplayInfo* disp = *pDisp; |
|
1923 |
if (disp->iInitialized) |
|
1924 |
{ |
|
1925 |
EGL_TRACE("CGuestEGL::FindAndLockDisplay display found"); |
|
1926 |
result = EGL_SUCCESS; |
|
1927 |
} |
|
1928 |
else |
|
1929 |
{ |
|
1930 |
EGL_TRACE("CGuestEGL::FindAndLockDisplay display not initialized"); |
|
1931 |
result = EGL_NOT_INITIALIZED; |
|
1932 |
} |
|
1933 |
} |
|
1934 |
else |
|
1935 |
{ |
|
1936 |
EGL_TRACE("CGuestEGL::FindAndLockDisplay cannot find display"); |
|
1937 |
} |
|
1938 |
if (result != EGL_SUCCESS) |
|
1939 |
{ |
|
1940 |
iDisplayMapLock.Unlock(); |
|
1941 |
} |
|
1942 |
return result; |
|
1943 |
} |
|
1944 |
||
1945 |
// release the lock |
|
1946 |
void CGuestEGL::ReleaseDisplayLock(EGLDisplay aDisplay) |
|
1947 |
{ |
|
1948 |
EGL_TRACE("CGuestEGL::ReleaseDisplayLock aDisplay=%d", aDisplay); |
|
1949 |
iDisplayMapLock.Unlock(); |
|
1950 |
} |
|
1951 |
||
1952 |
||
1953 |
CEglSyncExtension* CGuestEGL::EGLSyncExtension() |
|
1954 |
{ |
|
1955 |
return iEglSyncExtension; |
|
1956 |
} |
|
1957 |
||
1958 |
||
1959 |
/* |
|
1960 |
EGL_FALSE is returned on failure and major and minor are not updated. An |
|
1961 |
EGL_BAD_DISPLAY error is generated if the dpy argument does not refer to a valid |
|
1962 |
EGLDisplay. An EGL_NOT_INITIALIZED error is generated if EGL cannot be |
|
1963 |
initialized for an otherwise valid dpy. |
|
1964 |
*/ |
|
1965 |
EGLBoolean CGuestEGL::eglInitialize(TEglThreadState& aThreadState, EGLDisplay aDisplay, EGLint *aMajor, EGLint *aMinor) |
|
1966 |
{ |
|
1967 |
if ((aDisplay == EGL_NO_DISPLAY) || !InitializeDisplayInfo(aDisplay)) |
|
1968 |
{ |
|
1969 |
aThreadState.SetEglError(EGL_BAD_DISPLAY); |
|
1970 |
return EGL_FALSE; |
|
1971 |
} |
|
1972 |
||
1973 |
RemoteFunctionCallData rfcdata; EglRFC eglApiData(rfcdata); |
|
1974 |
eglApiData.Init(EglRFC::EeglInitialize); |
|
1975 |
eglApiData.AppendEGLDisplay(aDisplay); |
|
1976 |
EGLBoolean ret = aThreadState.ExecEglBooleanCmd(eglApiData); |
|
1977 |
||
1978 |
if(ret) |
|
1979 |
{ |
|
1980 |
if(aMajor) |
|
1981 |
*aMajor = EGL_VERSION_MAJOR; |
|
1982 |
if(aMinor) |
|
1983 |
*aMinor = EGL_VERSION_MINOR; |
|
1984 |
} |
|
1985 |
EGL_TRACE("eglInitialize <-" ); |
|
1986 |
return ret; |
|
1987 |
} |
|
1988 |
||
1989 |
/* |
|
1990 |
Returns EGL_FALSE on failure and value is not updated. If attribute is not a |
|
1991 |
valid EGL surface attribute, then an EGL_BAD_ATTRIBUTE error is generated. If |
|
1992 |
surface is not a valid EGLSurface then an EGL_BAD_SURFACE error is generated. |
|
1993 |
*/ |
|
1994 |
EGLBoolean CGuestEGL::eglQuerySurface(TEglThreadState& aThreadState, EGLDisplay aDisplay, EGLSurface aSurface, EGLint aAttribute, EGLint *aValue) |
|
1995 |
{ |
|
1996 |
// ToDo more parameter validation, and possibly use cached values |
|
1997 |
if ( (aValue == NULL) || (3 & (TUint32)aValue) ) |
|
1998 |
{ |
|
1999 |
aThreadState.SetEglError(EGL_BAD_PARAMETER); |
|
2000 |
return EGL_FALSE; |
|
2001 |
} |
|
2002 |
RemoteFunctionCallData rfcdata; EglRFC eglApiData( rfcdata ); |
|
2003 |
eglApiData.Init(EglRFC::EeglQuerySurface); |
|
2004 |
eglApiData.AppendEGLDisplay(aDisplay); |
|
2005 |
eglApiData.AppendEGLSurface(aSurface); |
|
2006 |
eglApiData.AppendEGLint(aAttribute); |
|
2007 |
eglApiData.AppendEGLintVector(aValue, 1, RemoteFunctionCallData::EOut); |
|
2008 |
||
2009 |
EGLBoolean result = aThreadState.ExecEglBooleanCmd(eglApiData); |
|
2010 |
EGL_TRACE_GET_ATTRIB("eglQuerySurface", "surface", aDisplay, aSurface, aAttribute, aValue, result); |
|
2011 |
return result; |
|
2012 |
} |
|
2013 |
||
2014 |
/* |
|
2015 |
On failure eglCreatePbufferFromClientBuffer returns EGL_NO_SURFACE. In |
|
2016 |
addition to the errors described eglCreatePbufferSurface, |
|
2017 |
eglCreatePbufferFromClientBuffer may fail and generate errors for the |
|
2018 |
following reasons: |
|
2019 |
* If buftype is not a recognized client API resource type (e.g. is not |
|
2020 |
EGL_OPENVG_IMAGE), an EGL_BAD_PARAMETER error is generated. |
|
2021 |
* If buffer is not a valid handle or name of a client API resource of the |
|
2022 |
specified buftype in the currently bound context corresponding to that |
|
2023 |
type, an EGL_BAD_PARAMETER error is generated. |
|
2024 |
* If the buffers contained in buffer do not correspond to a proper subset |
|
2025 |
of the buffers described by config, and match the bit depths for those |
|
2026 |
buffers specified in config, then an EGL_BAD_MATCH error is generated. |
|
2027 |
For example, a VGImage with pixel format VG_lRGBA_8888 corresponds to an |
|
2028 |
EGLConfig with EGL_RED_SIZE, EGL_GREEN_SIZE, EGL_BLUE_SIZE, and |
|
2029 |
EGL_ALPHA_SIZE values of 8. |
|
2030 |
* If no context corresponding to the specified buftype is current, an |
|
2031 |
EGL_BAD_ACCESS error is generated. |
|
2032 |
* There may be additional constraints on which types of buffers may be |
|
2033 |
bound to EGL surfaces, as described in client API specifications. If |
|
2034 |
those constraints are violated, then an EGL_BAD_MATCH error is generated. |
|
2035 |
* If buffer is already bound to another pbuffer, or is in use by a client |
|
2036 |
API an EGL_BAD_ACCESS error is generated. |
|
2037 |
*/ |
|
2038 |
EGLSurface CGuestEGL::eglCreatePbufferFromClientBuffer(TEglThreadState& aThreadState, |
|
2039 |
EGLDisplay aDisplay, EGLenum aBufType, EGLClientBuffer aBuffer, EGLConfig aConfig, const EGLint *aAttribList) |
|
2040 |
{ |
|
2041 |
// ToDo validate parameters |
|
2042 |
// ToDo SgImage Design Spec 5.12 - eglCreatePbufferFromClientBuffer should fail with EGL_BAD_ACCESS for VgImages derived from SgImages |
|
2043 |
EGL_TRACE("eglCreatePbufferFromClientBuffer %d %d %d", aDisplay, aBufType, aConfig); |
|
2044 |
RemoteFunctionCallData rfcdata; EglRFC eglApiData( rfcdata ); |
|
2045 |
eglApiData.Init(EglRFC::EeglCreatePbufferFromClientBuffer); |
|
2046 |
eglApiData.AppendEGLDisplay(aDisplay); |
|
2047 |
eglApiData.AppendEGLenum(aBufType); |
|
2048 |
eglApiData.AppendEGLClientBuffer(aBuffer); |
|
2049 |
eglApiData.AppendEGLConfig(aConfig); |
|
2050 |
eglApiData.AppendEGLintVector(aAttribList, TAttribUtils::AttribListLength(aAttribList) ); |
|
2051 |
||
2052 |
return aThreadState.ExecEglSurfaceCmd(eglApiData); |
|
2053 |
} |
|
2054 |
||
2055 |
/* |
|
2056 |
If the dpy argument does not refer to a valid EGLDisplay, EGL_FALSE is |
|
2057 |
returned, and an EGL_BAD_DISPLAY error is generated. |
|
2058 |
*/ |
|
2059 |
EGLBoolean CGuestEGL::eglTerminate(TEglThreadState& aThreadState, EGLDisplay aDisplay) |
|
2060 |
{ |
|
2061 |
EGLBoolean success = EGL_FALSE; |
|
2062 |
if (DestroyDisplayInfo(aDisplay)) |
|
2063 |
{ |
|
2064 |
RemoteFunctionCallData rfcdata; EglRFC eglApiData( rfcdata ); |
|
2065 |
eglApiData.Init(EglRFC::EeglTerminate); |
|
2066 |
eglApiData.AppendEGLDisplay(aDisplay); |
|
2067 |
||
2068 |
success = aThreadState.ExecEglBooleanCmd(eglApiData); |
|
2069 |
EGL_TRACE("eglTerminate display=%d ret=%d", aDisplay, success); |
|
2070 |
} |
|
2071 |
else |
|
2072 |
{ |
|
2073 |
aThreadState.SetEglError(EGL_BAD_DISPLAY); |
|
2074 |
} |
|
2075 |
||
2076 |
return success; |
|
2077 |
} |
|
2078 |
||
2079 |
/* |
|
2080 |
On failure, EGL_FALSE is returned. An EGL_NOT_INITIALIZED error is generated |
|
2081 |
if EGL is not initialized on dpy. An EGL_BAD_PARAMETER error is generated |
|
2082 |
if num config is NULL. |
|
2083 |
*/ |
|
2084 |
EGLBoolean CGuestEGL::eglGetConfigs(TEglThreadState& aThreadState, EGLDisplay aDisplay, EGLConfig *aConfigs, |
|
2085 |
EGLint aConfigSize, EGLint *aNumConfig) |
|
2086 |
{ |
|
2087 |
EGLint error = EGL_SUCCESS; |
|
2088 |
||
2089 |
if (aNumConfig == NULL) |
|
2090 |
{ |
|
2091 |
error = EGL_BAD_PARAMETER; |
|
2092 |
} |
|
2093 |
||
2094 |
// ToDo check display is valid |
|
2095 |
if (error != EGL_SUCCESS) |
|
2096 |
{ |
|
2097 |
aThreadState.SetEglError(EGL_BAD_PARAMETER); |
|
2098 |
return EGL_FALSE; |
|
2099 |
} |
|
2100 |
if (aConfigs && !aConfigSize) |
|
2101 |
aConfigSize = 1; |
|
2102 |
else if (!aConfigs) |
|
2103 |
aConfigSize = 0; |
|
2104 |
||
2105 |
RemoteFunctionCallData rfcdata; EglRFC eglApiData( rfcdata ); |
|
2106 |
eglApiData.Init(EglRFC::EeglGetConfigs); |
|
2107 |
eglApiData.AppendEGLDisplay(aDisplay); |
|
2108 |
eglApiData.AppendEGLConfigVector(aConfigs, aConfigSize, RemoteFunctionCallData::EOut); |
|
2109 |
eglApiData.AppendEGLint(aConfigSize); |
|
2110 |
eglApiData.AppendEGLintVector(aNumConfig, 1, RemoteFunctionCallData::EOut); |
|
2111 |
||
2112 |
// ToDo cache successful result for next time |
|
2113 |
EGLBoolean result = aThreadState.ExecEglBooleanCmd(eglApiData); |
|
2114 |
return result; |
|
2115 |
} |
|
2116 |
||
2117 |
EGLBoolean CGuestEGL::eglChooseConfig(TEglThreadState& aThreadState, EGLDisplay aDisplay, const EGLint *aAttribList, |
|
2118 |
EGLConfig *aConfigs, EGLint aConfigSize, EGLint *aNumConfig) |
|
2119 |
{ |
|
2120 |
if (aConfigs && !aConfigSize) |
|
2121 |
{ |
|
2122 |
aConfigSize = 1; |
|
2123 |
} |
|
2124 |
else if (!aConfigs) |
|
2125 |
{ |
|
2126 |
aConfigSize = 0; |
|
2127 |
} |
|
2128 |
||
2129 |
const EGLint* surfaceType = TAttribUtils::FindAttribValue(aAttribList, EGL_SURFACE_TYPE); |
|
2130 |
if (surfaceType && (*surfaceType & EGL_PIXMAP_BIT)) |
|
2131 |
{ |
|
2132 |
EGL_TRACE("CGuestEGL::eglChooseConfig for Pixmap Surface"); |
|
2133 |
const EGLint* pixmapMatch = TAttribUtils::FindAttribValue(aAttribList, EGL_MATCH_NATIVE_PIXMAP); |
|
2134 |
if (pixmapMatch && *pixmapMatch) |
|
2135 |
{ |
|
2136 |
EGL_TRACE("CGuestEGL::eglChooseConfig attributes include EGL_MATCH_NATIVE_PIXMAP, value is 0x%x", *pixmapMatch); |
|
2137 |
// check/copy color & alpha sizes from pixmap |
|
2138 |
return ChooseConfigForPixmapSurface(aThreadState, aDisplay, aAttribList, aConfigs, aConfigSize, aNumConfig, (const void*)*pixmapMatch); |
|
2139 |
} |
|
2140 |
else |
|
2141 |
{ // Pixmap to match is missing |
|
2142 |
EGL_TRACE("CGuestEGL::eglChooseConfig EGL_MATCH_NATIVE_PIXMAP attribute is missing or NULL"); |
|
2143 |
aThreadState.SetEglError(EGL_BAD_PARAMETER); |
|
2144 |
return EGL_FALSE; |
|
2145 |
} |
|
2146 |
} |
|
2147 |
||
2148 |
RemoteFunctionCallData rfcdata; EglRFC eglApiData( rfcdata ); |
|
2149 |
eglApiData.Init( EglRFC::EeglChooseConfig ); |
|
2150 |
eglApiData.AppendEGLDisplay(aDisplay); |
|
2151 |
eglApiData.AppendEGLintVector(aAttribList, TAttribUtils::AttribListLength(aAttribList)); |
|
2152 |
eglApiData.AppendEGLConfigVector(aConfigs, aConfigSize, RemoteFunctionCallData::EOut ); |
|
2153 |
eglApiData.AppendEGLint(aConfigSize); |
|
2154 |
eglApiData.AppendEGLintVector(aNumConfig, 1, RemoteFunctionCallData::EOut); |
|
2155 |
||
2156 |
return aThreadState.ExecEglBooleanCmd(eglApiData); |
|
2157 |
} |
|
2158 |
||
2159 |
/* |
|
2160 |
On failure returns EGL_FALSE. If attribute |
|
2161 |
is not a valid attribute then EGL_BAD_ATTRIBUTE is generated. |
|
2162 |
*/ |
|
2163 |
EGLBoolean CGuestEGL::eglGetConfigAttrib(TEglThreadState& aThreadState, EGLDisplay aDisplay, EGLConfig aConfig, |
|
2164 |
EGLint aAttribute, EGLint *aValue) |
|
2165 |
{ |
|
2166 |
// ToDo validate display & aAttribute, and maybe get result from local cache |
|
2167 |
RemoteFunctionCallData rfcdata; EglRFC eglApiData( rfcdata ); |
|
2168 |
eglApiData.Init(EglRFC::EeglGetConfigAttrib); |
|
2169 |
eglApiData.AppendEGLDisplay(aDisplay); |
|
2170 |
eglApiData.AppendEGLConfig(aConfig); |
|
2171 |
eglApiData.AppendEGLint(aAttribute); |
|
2172 |
eglApiData.AppendEGLintVector(aValue, 1, RemoteFunctionCallData::EOut); |
|
2173 |
||
2174 |
EGLBoolean result = aThreadState.ExecEglBooleanCmd(eglApiData); |
|
2175 |
EGL_TRACE_GET_ATTRIB("eglGetConfigAttrib", "config", aDisplay, aConfig, aAttribute, aValue, result); |
|
2176 |
return result; |
|
2177 |
} |
|
2178 |
||
2179 |
/* |
|
2180 |
Returns EGL_FALSE on failure and value is not updated. If attribute is not a |
|
2181 |
valid EGL surface attribute, then an EGL_BAD_ATTRIBUTE error is generated. If |
|
2182 |
surface is not a valid EGLSurface then an EGL_BAD_SURFACE error is generated. |
|
2183 |
*/ |
|
2184 |
EGLBoolean CGuestEGL::eglSurfaceAttrib(TEglThreadState& aThreadState, EGLDisplay aDisplay, EGLSurface aSurface, |
|
2185 |
EGLint aAttribute, EGLint aValue) |
|
2186 |
{ |
|
2187 |
EGL_TRACE_SET_ATTRIB("eglSurfaceAttrib", "surface", aDisplay, aSurface, aAttribute, aValue); |
|
2188 |
||
2189 |
RemoteFunctionCallData rfcdata; EglRFC eglApiData( rfcdata ); |
|
2190 |
eglApiData.Init(EglRFC::EeglSurfaceAttrib); |
|
2191 |
eglApiData.AppendEGLDisplay(aDisplay); |
|
2192 |
eglApiData.AppendEGLSurface(aSurface); |
|
2193 |
eglApiData.AppendEGLint(aAttribute); |
|
2194 |
eglApiData.AppendEGLint(aValue); |
|
2195 |
return aThreadState.ExecEglBooleanCmd(eglApiData); |
|
2196 |
} |
|
2197 |
||
2198 |
/* |
|
2199 |
If eglBindTexImage is called and the surface attribute EGL_TEXTURE_FORMAT is set |
|
2200 |
to EGL_NO_TEXTURE, then an EGL_BAD_MATCH error is returned. If buffer is already |
|
2201 |
bound to a texture then an EGL_BAD_ACCESS error is returned. If buffer is not a |
|
2202 |
valid buffer, then an EGL_BAD_PARAMETER error is generated. If surface is not a |
|
2203 |
valid EGLSurface, or is not a pbuffer surface supporting texture |
|
2204 |
binding, then an EGL_BAD_SURFACE error is generated. |
|
2205 |
*/ |
|
2206 |
EGLBoolean CGuestEGL::eglBindTexImage(TEglThreadState& aThreadState, EGLDisplay aDisplay, EGLSurface aSurface, EGLint aBuffer) |
|
2207 |
{ |
|
2208 |
// ToDo validate parameters |
|
2209 |
if ( (aBuffer == NULL) || (3 & (TUint)aBuffer)) |
|
2210 |
{ |
|
2211 |
aThreadState.SetEglError(EGL_BAD_PARAMETER); |
|
2212 |
return EGL_FALSE; |
|
2213 |
} |
|
2214 |
RemoteFunctionCallData rfcdata; EglRFC eglApiData( rfcdata ); |
|
2215 |
eglApiData.Init(EglRFC::EeglBindTexImage); |
|
2216 |
eglApiData.AppendEGLDisplay(aDisplay); |
|
2217 |
eglApiData.AppendEGLSurface(aSurface); |
|
2218 |
eglApiData.AppendEGLint(aBuffer); |
|
2219 |
return aThreadState.ExecEglBooleanCmd(eglApiData); |
|
2220 |
} |
|
2221 |
||
2222 |
/* |
|
2223 |
If the value of surface attribute EGL_TEXTURE_FORMAT is EGL_NO_TEXTURE, |
|
2224 |
then an EGL_BAD_MATCH error is returned. If buffer is not a valid buffer |
|
2225 |
(currently only EGL_BACK_BUFFER may be specified), then an |
|
2226 |
EGL_BAD_PARAMETER error is generated. If surface is not a valid EGLSurface, |
|
2227 |
or is not a bound pbuffer surface, then an EGL_BAD_SURFACE error is |
|
2228 |
returned. |
|
2229 |
*/ |
|
2230 |
EGLBoolean CGuestEGL::eglReleaseTexImage(TEglThreadState& aThreadState, EGLDisplay aDisplay, EGLSurface aSurface, EGLint aBuffer) |
|
2231 |
{ |
|
2232 |
// ToDo validate parameters |
|
2233 |
if ( (aBuffer == NULL) || (3 & (TUint)aBuffer)) |
|
2234 |
{ |
|
2235 |
aThreadState.SetEglError(EGL_BAD_PARAMETER); |
|
2236 |
return EGL_FALSE; |
|
2237 |
} |
|
2238 |
RemoteFunctionCallData rfcdata; EglRFC eglApiData( rfcdata ); |
|
2239 |
eglApiData.Init(EglRFC::EeglReleaseTexImage); |
|
2240 |
eglApiData.AppendEGLDisplay(aDisplay); |
|
2241 |
eglApiData.AppendEGLSurface(aSurface); |
|
2242 |
eglApiData.AppendEGLint(aBuffer); |
|
2243 |
return aThreadState.ExecEglBooleanCmd(eglApiData); |
|
2244 |
} |
|
2245 |
||
2246 |
/* |
|
2247 |
Returns EGL_FALSE on failure. If there is no current context on the calling |
|
2248 |
thread, a EGL_BAD_CONTEXT error is generated. If there is no surface bound |
|
2249 |
to the current context, a EGL_BAD_SURFACE error is generated. |
|
2250 |
*/ |
|
2251 |
EGLBoolean CGuestEGL::eglSwapInterval(TEglThreadState& aThreadState, EGLDisplay aDisplay, EGLint aInterval) |
|
2252 |
{ |
|
2253 |
// ToDo validate parameters |
|
2254 |
RemoteFunctionCallData rfcdata; EglRFC eglApiData( rfcdata ); |
|
2255 |
eglApiData.Init(EglRFC::EeglSwapInterval); |
|
2256 |
eglApiData.AppendEGLDisplay(aDisplay); |
|
2257 |
eglApiData.AppendEGLint(aInterval); |
|
2258 |
return aThreadState.ExecEglBooleanCmd(eglApiData); |
|
2259 |
} |
|
2260 |
||
2261 |
/* |
|
2262 |
On failure returns EGL_NO_CONTEXT. If the current rendering api is EGL_NONE, |
|
2263 |
then an EGL_BAD_MATCH error is generated (this situation can only arise in |
|
2264 |
an implementation which does not support OpenGL ES, and prior to the first |
|
2265 |
call to eglBindAPI). If share context is neither zero nor a valid context |
|
2266 |
of the same client API type as the newly created context, then an EGL_- |
|
2267 |
BAD_CONTEXT error is generated. |
|
2268 |
||
2269 |
... |
|
2270 |
*/ |
|
2271 |
EGLContext CGuestEGL::eglCreateContext(TEglThreadState& aThreadState, EGLDisplay aDisplay, EGLConfig aConfig, |
|
2272 |
EGLContext aShareContext, const EGLint *aAttribList) |
|
2273 |
{ |
|
2274 |
EGLContext result = EGL_NO_CONTEXT; |
|
2275 |
iDisplayMapLock.ReadLock(); |
|
2276 |
CEglDisplayInfo** pDispInfo = iDisplayMap.Find(aDisplay); |
|
2277 |
if (!pDispInfo || !*pDispInfo) |
|
2278 |
{ |
|
2279 |
EGL_TRACE("cannot find display %d", aDisplay); |
|
2280 |
} |
|
2281 |
else |
|
2282 |
{ |
|
2283 |
CEglContext* shareContext = NULL; |
|
2284 |
if (aShareContext) |
|
2285 |
{ |
|
2286 |
CEglContext** pContext = (*pDispInfo)->iContextMap.Find(aShareContext); |
|
2287 |
if (!pContext || (*pContext)->IsDestroyed()) |
|
2288 |
{ |
|
2289 |
EGL_TRACE("cannot find share context %d for display %d, or it is destroyed", aShareContext, aDisplay); |
|
2290 |
aThreadState.SetEglError(EGL_BAD_CONTEXT); |
|
2291 |
iDisplayMapLock.Unlock(); |
|
2292 |
return EGL_NO_CONTEXT; |
|
2293 |
} |
|
2294 |
} |
|
2295 |
||
2296 |
CEglContext* newContext = CEglContext::Create(aThreadState, aDisplay, aConfig, shareContext, aAttribList); |
|
2297 |
if (newContext) |
|
2298 |
{ |
|
2299 |
RHeap* threadHeap = CVghwUtils::SwitchToVghwHeap(); |
|
2300 |
TInt err = (*pDispInfo)->iContextMap.Insert(newContext->ClientContext(), newContext); |
|
2301 |
CVghwUtils::SwitchFromVghwHeap(threadHeap); |
|
2302 |
if (err != KErrNone) |
|
2303 |
{ |
|
2304 |
newContext->Destroy(aThreadState); |
|
2305 |
aThreadState.SetEglError(EGL_BAD_ALLOC); |
|
2306 |
} |
|
2307 |
else |
|
2308 |
{ |
|
2309 |
result = newContext->ClientContext(); |
|
2310 |
} |
|
2311 |
} |
|
2312 |
} |
|
2313 |
||
2314 |
iDisplayMapLock.Unlock(); |
|
2315 |
return result; |
|
2316 |
} |
|
2317 |
||
2318 |
/* |
|
2319 |
Returns EGL_FALSE on failure. An EGL_BAD_CONTEXT error is generated if ctx is |
|
2320 |
not a valid context. |
|
2321 |
*/ |
|
2322 |
EGLBoolean CGuestEGL::eglDestroyContext(TEglThreadState& aThreadState, EGLDisplay aDisplay, EGLContext aContext) |
|
2323 |
{ |
|
2324 |
EGLBoolean success = EGL_FALSE; |
|
2325 |
iDisplayMapLock.ReadLock(); |
|
2326 |
CEglDisplayInfo** pDispInfo = iDisplayMap.Find(aDisplay); |
|
2327 |
if (!pDispInfo || !*pDispInfo) |
|
2328 |
{ |
|
2329 |
EGL_TRACE("cannot find display %d", aDisplay); |
|
2330 |
aThreadState.SetEglError(EGL_BAD_DISPLAY); |
|
2331 |
} |
|
2332 |
else |
|
2333 |
{ |
|
2334 |
CEglContext** pContext = (*pDispInfo)->iContextMap.Find(aContext); |
|
2335 |
if (!pContext || (*pContext)->IsDestroyed()) |
|
2336 |
{ |
|
2337 |
EGL_TRACE("cannot find context %d for display %d, or it is destroyed", aContext, aDisplay); |
|
2338 |
aThreadState.SetEglError(EGL_BAD_CONTEXT); |
|
2339 |
} |
|
2340 |
else |
|
2341 |
{ |
|
2342 |
success = EGL_TRUE; |
|
2343 |
if ((*pContext)->Destroy(aThreadState)) |
|
2344 |
{ |
|
2345 |
RHeap* threadHeap = CVghwUtils::SwitchToVghwHeap(); |
|
2346 |
(*pDispInfo)->iContextMap.Remove(aContext); |
|
2347 |
CVghwUtils::SwitchFromVghwHeap(threadHeap); |
|
2348 |
} |
|
2349 |
EGL_TRACE("eglDestroyContext end"); |
|
2350 |
} |
|
2351 |
} |
|
2352 |
||
2353 |
iDisplayMapLock.Unlock(); |
|
2354 |
return success; |
|
2355 |
} |
|
2356 |
||
2357 |
/* |
|
2358 |
Returns EGL_FALSE on failure and value is not updated. If attribute is not |
|
2359 |
a valid EGL context attribute, then an EGL_BAD_ATTRIBUTE error is generated. |
|
2360 |
If ctx is invalid, an EGL_BAD_CONTEXT error is generated. |
|
2361 |
*/ |
|
2362 |
EGLBoolean CGuestEGL::eglQueryContext(TEglThreadState& aThreadState, EGLDisplay aDisplay, EGLContext aContext, EGLint aAttribute, EGLint *aValue) |
|
2363 |
{ |
|
2364 |
EGLBoolean success = EGL_FALSE; |
|
2365 |
iDisplayMapLock.ReadLock(); |
|
2366 |
CEglDisplayInfo** pDispInfo = iDisplayMap.Find(aDisplay); |
|
2367 |
if (!pDispInfo || !*pDispInfo) |
|
2368 |
{ |
|
2369 |
EGL_TRACE("cannot find display %d", aDisplay); |
|
2370 |
aThreadState.SetEglError(EGL_BAD_DISPLAY); |
|
2371 |
} |
|
2372 |
else |
|
2373 |
{ |
|
2374 |
CEglContext** pContext = (*pDispInfo)->iContextMap.Find(aContext); |
|
2375 |
if (!pContext || (*pContext)->IsDestroyed()) |
|
2376 |
{ |
|
2377 |
EGL_TRACE("cannot find context %d for display %d, or it is destroyed", aContext, aDisplay); |
|
2378 |
aThreadState.SetEglError(EGL_BAD_CONTEXT); |
|
2379 |
} |
|
2380 |
else |
|
2381 |
{ |
|
2382 |
success = (*pContext)->QueryAttribute(aThreadState, aAttribute, aValue); |
|
2383 |
} |
|
2384 |
} |
|
2385 |
||
2386 |
iDisplayMapLock.Unlock(); |
|
2387 |
return success; |
|
2388 |
} |
|
2389 |
||
2390 |
/* |
|
2391 |
On failure returns EGL_NO_SURFACE. If the pbuffer could not be created due |
|
2392 |
to insufficient resources, then an EGL_BAD_ALLOC error is generated. If |
|
2393 |
config is not a valid EGLConfig, an EGL_BAD_CONFIG error is generated. If |
|
2394 |
the value specified for either EGL_WIDTH or EGL_HEIGHT is less than zero, |
|
2395 |
an EGL_BAD_PARAMETER error is generated. If config does not support |
|
2396 |
pbuffers, an EGL_BAD_MATCH error is generated. |
|
2397 |
||
2398 |
... see also comment on exported API |
|
2399 |
*/ |
|
2400 |
EGLSurface CGuestEGL::eglCreatePbufferSurface(TEglThreadState& aThreadState, EGLDisplay aDisplay, EGLConfig aConfig, const EGLint *aAttribList) |
|
2401 |
{ |
|
2402 |
// ToDo validate parameters |
|
2403 |
// ToDo store info about surface |
|
2404 |
RemoteFunctionCallData rfcdata; EglRFC eglApiData( rfcdata ); |
|
2405 |
eglApiData.Init(EglRFC::EeglCreatePbufferSurface); |
|
2406 |
eglApiData.AppendEGLDisplay(aDisplay); |
|
2407 |
eglApiData.AppendEGLConfig(aConfig); |
|
2408 |
eglApiData.AppendEGLintVector(aAttribList, TAttribUtils::AttribListLength(aAttribList) ); |
|
2409 |
return aThreadState.ExecEglBooleanCmd(eglApiData); |
|
2410 |
} |
|
2411 |
||
2412 |
/* |
|
2413 |
If there is no current context for the current rendering API, or if the |
|
2414 |
current rendering API is EGL_NONE, then EGL_NO_CONTEXT is returned (this |
|
2415 |
is not an error). |
|
2416 |
*/ |
|
2417 |
EGLContext CGuestEGL::eglGetCurrentContext(TEglThreadState& aThreadState) |
|
2418 |
{ |
|
2419 |
// ToDo should have this information cached |
|
2420 |
RemoteFunctionCallData rfcdata; EglRFC eglApiData( rfcdata ); |
|
2421 |
eglApiData.Init(EglRFC::EeglGetCurrentContext); |
|
2422 |
return ExecEglContextNoErrorCmd(aThreadState, eglApiData); |
|
2423 |
} |
|
2424 |
||
2425 |
/** |
|
2426 |
* |
|
2427 |
* |
|
2428 |
* @param aConfigs handle to an EGLConfig pointer, where the new configuration data will be. Ownership is transferred to the client. |
|
2429 |
* @param aConfigsCnt number of configs that will be in aConfigs upon returning |
|
2430 |
* |
|
2431 |
* @param aConfigAttribs handle to a pointer, where the memory will be allocated, and data copied. This will contain a list of |
|
2432 |
* config attribute _values_, in the order set out in eglrfc::MetaGetConfigAttribute(). |
|
2433 |
* Format: c1attrval1, c1attrval2, ..., c2attrval1, c2attrval2, ... cNattrvalM |
|
2434 |
* (the number of attribute values per config is eglrfc::MetaGetConfigAttributeCnt() |
|
2435 |
* Ownership is transferred to the client. |
|
2436 |
* @param aConfigAttribsLen handle to an integer value, where the size of the above vector will be stored. |
|
2437 |
* @param aFetchMode: which configs to fetch, default = EMetaGetConfigsSg (get configs that support sgImage), possible values are |
|
2438 |
* EMetaGetConfigsAll, //get all the configs available |
|
2439 |
* EMetaGetConfigsSg, //get configs supporting sg images |
|
2440 |
* EMetaGetConfigsNonSg, //get configs not supporting sg images |
|
2441 |
* (only sgImage implemented!) |
|
2442 |
* |
|
2443 |
*/ |
|
2444 |
TBool CGuestEGL::EglInternalFunction_MetaGetConfigs(TEglThreadState& aThreadState, EGLConfig*& aConfigs, EGLint& aConfigCnt, EGLint*& aConfigAttribs, EGLint& aConfigAttribsLen, TMetaGetConfigsMode aFetchMode ) |
|
2445 |
{ |
|
2446 |
aConfigCnt = KConfigsMaxCnt; |
|
2447 |
//TODO: optimize this so that the length is the number of returned items |
|
2448 |
aConfigs = (EGLConfig*) CVghwUtils::Alloc( sizeof(EGLConfig) * aConfigCnt ); |
|
2449 |
aConfigAttribsLen = KConfigsMaxCnt * 29; |
|
2450 |
//TODO: optimize this so that the length is the number of returned items |
|
2451 |
aConfigAttribs = (EGLint*) CVghwUtils::Alloc( sizeof(EGLint) * aConfigAttribsLen ); |
|
2452 |
||
2453 |
RemoteFunctionCallData rfcdata; EglRFC call( rfcdata ); |
|
2454 |
call.Init( EglRFC::EeglMetaGetConfigs ); |
|
2455 |
call.AppendEGLintVector( aConfigs, aConfigCnt, RemoteFunctionCallData::EInOut ); |
|
2456 |
call.AppendEGLintVector( aConfigAttribs, aConfigAttribsLen, RemoteFunctionCallData::EInOut ); |
|
2457 |
||
2458 |
call.AppendEGLint( (EGLint)aFetchMode ); |
|
2459 |
||
2460 |
return aThreadState.ExecEglBooleanCmd( call ); |
|
2461 |
} |
|
2462 |
||
2463 |
||
2464 |
// Private interfaces for EGL to call into Open VG & Open GL ES |
|
2465 |
// class MVgApiForEgl - redirects via CVghwUtils to exported functions from Open VG |
|
2466 |
ExtensionProcPointer CGuestEGL::guestGetVgProcAddress (const char *aProcName) |
|
2467 |
{ |
|
2468 |
if (!iVgApiForEgl) |
|
2469 |
{ |
|
2470 |
iVgApiForEgl = CVghwUtils::VgApiForEgl(); |
|
2471 |
} |
|
2472 |
if (iVgApiForEgl) |
|
2473 |
{ |
|
2474 |
return iVgApiForEgl->guestGetVgProcAddress(aProcName); |
|
2475 |
} |
|
2476 |
return NULL; |
|
2477 |
} |
|
2478 |
||
2479 |
||
2480 |
// class MGles11ApiForEgl - redirects via CVghwUtils to exported functions from Open GL ES 1.1 |
|
2481 |
ExtensionProcPointer CGuestEGL::guestGetGles11ProcAddress (const char *aProcName) |
|
2482 |
{ |
|
2483 |
if (!iGles11ApiForEgl) |
|
2484 |
{ |
|
2485 |
iGles11ApiForEgl = CVghwUtils::Gles11ApiForEgl(); |
|
2486 |
} |
|
2487 |
if (iGles11ApiForEgl) |
|
2488 |
{ |
|
2489 |
return iGles11ApiForEgl->guestGetGles11ProcAddress(aProcName); |
|
2490 |
} |
|
2491 |
return NULL; |
|
2492 |
} |
|
2493 |
||
2494 |
||
2495 |
// class MGles2ApiForEgl - redirects via CVghwUtils to exported functions from Open GL ES 2 |
|
2496 |
ExtensionProcPointer CGuestEGL::guestGetGles2ProcAddress (const char *aProcName) |
|
2497 |
{ |
|
2498 |
if (!iGles2ApiForEgl) |
|
2499 |
{ |
|
2500 |
iGles2ApiForEgl = CVghwUtils::Gles2ApiForEgl(); |
|
2501 |
} |
|
2502 |
if (iGles2ApiForEgl) |
|
2503 |
{ |
|
2504 |
return iGles2ApiForEgl->guestGetGles2ProcAddress(aProcName); |
|
2505 |
} |
|
2506 |
return NULL; |
|
2507 |
} |