author | Matt Plumtree <matt.plumtree@nokia.com> |
Mon, 15 Nov 2010 09:56:25 +0000 | |
branch | bug235_bringup_0 |
changeset 77 | b0395290e61f |
parent 71 | 243bbc1d70db |
permissions | -rw-r--r-- |
24 | 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 |
// |
|
15 |
||
16 |
#ifdef WIN32 |
|
17 |
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers |
|
18 |
#include <windows.h> |
|
19 |
#endif |
|
20 |
||
21 |
||
22 |
#include <stdio.h> |
|
23 |
#include <stdlib.h> |
|
24 |
#include <EGL/egl.h> |
|
25 |
#include "eglapiwrapper.h" |
|
26 |
#include "serializedfunctioncall.h" |
|
27 |
#include "remotefunctioncall.h" |
|
28 |
#include "khronosapiwrapperdefs.h" |
|
29 |
#include "KhronosAPIWrapper.h" |
|
30 |
#include "DriverAPIWrapper.h" |
|
31 |
||
32 |
||
33 |
EGLAPIWrapper::EGLAPIWrapper( RemoteFunctionCallData& currentFunctionCallData, |
|
34 |
APIWrapperStack* stack, |
|
35 |
void* result, |
|
36 |
MGraphicsVHWCallback* serviceIf, |
|
30
f204b762818d
Rename use of "frame" buffer to "surface" buffer, to reduce confusion.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
24
diff
changeset
|
37 |
void* surfacebuffer, |
24 | 38 |
KhronosAPIWrapper* aAPIWrapper ): |
39 |
APIWrapper( currentFunctionCallData, stack, result, serviceIf ), |
|
40 |
m_currentFunctionCall( m_currentFunctionCallData ), |
|
30
f204b762818d
Rename use of "frame" buffer to "surface" buffer, to reduce confusion.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
24
diff
changeset
|
41 |
m_surfaceBuffer( surfacebuffer ), |
24 | 42 |
m_APIWrapper( aAPIWrapper ) |
43 |
{ |
|
44 |
TRACE("EGLAPIWrapper::EGLAPIWrapper()\n"); |
|
45 |
} |
|
46 |
||
47 |
void EGLAPIWrapper::SetProcessInformation( TUint32 aProcess, TUint32 aThread ) |
|
48 |
{ |
|
49 |
TRACE("EGLAPIWrapper::SetProcessInformation()\n"); |
|
56
40cc73c24bf8
Host components now buildable in their correct locations (although stil using CMake). Use build.bat in package root.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
53
diff
changeset
|
50 |
::eglSimulatorSetProcessInformation( aProcess, aThread ); |
24 | 51 |
} |
52 |
||
53 |
void EGLAPIWrapper::Cleanup( TUint32 aProcess, TUint32 aThread ) |
|
54 |
{ |
|
55 |
TRACE("EGLAPIWrapper::Cleanup()\n"); |
|
56
40cc73c24bf8
Host components now buildable in their correct locations (although stil using CMake). Use build.bat in package root.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
53
diff
changeset
|
56 |
::eglSimulatorSetProcessInformation( aProcess, aThread ); |
24 | 57 |
::eglReleaseThread(); |
58 |
} |
|
59 |
||
60 |
int EGLAPIWrapper::WriteReply() |
|
61 |
{ |
|
62 |
TRACE("EGLAPIWrapper::WriteReply()\n"); |
|
63 |
#ifdef LOG_ERROR |
|
71
243bbc1d70db
Expose wrapper C interface for Syborg from KhronosAPIWrapper. Needs update to QEMU!
Matt Plumtree <matt.plumtree@nokia.com>
parents:
56
diff
changeset
|
64 |
#ifdef PRINT_TRACES |
24 | 65 |
int operationid = (int)m_currentFunctionCall.Data().Header().iOpCode; |
71
243bbc1d70db
Expose wrapper C interface for Syborg from KhronosAPIWrapper. Needs update to QEMU!
Matt Plumtree <matt.plumtree@nokia.com>
parents:
56
diff
changeset
|
66 |
#endif |
56
40cc73c24bf8
Host components now buildable in their correct locations (although stil using CMake). Use build.bat in package root.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
53
diff
changeset
|
67 |
int eglerror = ::eglSimulatorGetError(); |
24 | 68 |
if ( m_lastEglError != eglerror ) |
69 |
{ |
|
70 |
if ( EGL_SUCCESS != eglerror ) |
|
71 |
{ |
|
72 |
TRACE("EGL error 0x%X, for request %d\n", eglerror, operationid ); |
|
73 |
} |
|
74 |
m_lastEglError = eglerror; |
|
75 |
} |
|
76 |
#endif |
|
77 |
return APIWrapper::WriteReply(); |
|
78 |
} |
|
79 |
||
80 |
int EGLAPIWrapper::eglGetError() |
|
81 |
{ |
|
82 |
TRACE("EGLAPIWrapper::eglGetError()\n"); |
|
83 |
EGLint error = ::eglGetError(); |
|
84 |
m_currentFunctionCall.SetReturnValue( error ); |
|
85 |
return WriteReply(); |
|
86 |
} |
|
87 |
||
88 |
||
89 |
int EGLAPIWrapper::eglGetDisplay() |
|
90 |
{ |
|
91 |
TRACE("EGLAPIWrapper::eglGetDisplay() ->\n"); |
|
92 |
EGLNativeDisplayType display_id; |
|
93 |
m_currentFunctionCall.GetEGLNativeDisplayType( display_id, 0 ); |
|
94 |
/*EGLint display*/EGLDisplay display = ::eglGetDisplay( display_id ); |
|
95 |
m_currentFunctionCall.SetReturnValue( (TUint32)display ); |
|
96 |
TRACE("EGLAPIWrapper::eglGetDisplay() <-\n"); |
|
97 |
return WriteReply(); |
|
98 |
} |
|
99 |
||
100 |
||
101 |
int EGLAPIWrapper::eglInitialize() |
|
102 |
{ |
|
103 |
TRACE("EGLAPIWrapper::eglInitialize() ->\n"); |
|
104 |
EGLDisplay dpy; |
|
105 |
m_currentFunctionCall.GetEGLDisplay( dpy, 0 ); |
|
106 |
// The major and minor version numbers are set from the host side |
|
107 |
EGLBoolean ret = ::eglInitialize( dpy, NULL, NULL); |
|
108 |
m_currentFunctionCall.SetReturnValue(ret); |
|
109 |
TRACE("EGLAPIWrapper::eglInitialize() <-\n"); |
|
110 |
return WriteReply(); |
|
111 |
} |
|
112 |
||
113 |
||
114 |
int EGLAPIWrapper::eglTerminate() |
|
115 |
{ |
|
116 |
TRACE("EGLAPIWrapper::eglTerminate ->()\n"); |
|
117 |
EGLDisplay dpy; |
|
118 |
m_currentFunctionCall.GetEGLDisplay( dpy, 0 ); |
|
119 |
EGLBoolean result = ::eglTerminate( dpy ); |
|
120 |
m_currentFunctionCall.SetReturnValue( result ); |
|
121 |
TRACE("EGLAPIWrapper::eglTerminate <-()\n"); |
|
122 |
return WriteReply(); |
|
123 |
} |
|
124 |
||
125 |
||
126 |
int EGLAPIWrapper::eglQueryString() |
|
127 |
{ |
|
128 |
TRACE("EGLAPIWrapper::eglQueryString() ->\n"); |
|
129 |
EGLDisplay dpy; |
|
130 |
EGLint name; |
|
131 |
||
132 |
m_currentFunctionCall.GetEGLDisplay( dpy, 0 ); |
|
133 |
m_currentFunctionCall.GetEGLint( name, 1 ); |
|
134 |
const char* result = ::eglQueryString( dpy, name ); |
|
135 |
m_currentFunctionCall.SetReturnValue( result ? 1 : 0 ); |
|
136 |
TRACE("EGLAPIWrapper::eglQueryString() <-\n"); |
|
137 |
return WriteReply(); |
|
138 |
} |
|
139 |
||
140 |
||
141 |
int EGLAPIWrapper::eglGetConfigs() |
|
142 |
{ |
|
143 |
TRACE("EGLAPIWrapper::eglGetConfigs() ->\n"); |
|
144 |
EGLDisplay dpy; |
|
145 |
m_currentFunctionCall.GetEGLDisplay( dpy, 0 ); |
|
146 |
||
147 |
EGLint num_config = 0; |
|
148 |
EGLint config_size = 0; |
|
149 |
EGLint config_limit = 0; |
|
150 |
EGLConfig* configs = 0; |
|
151 |
EGLint* num_config_data = 0; |
|
152 |
EGLint num_config_size = 0; |
|
153 |
||
154 |
m_currentFunctionCall.GetEGLConfigVectorData( configs, config_size, 1 ); |
|
155 |
if ( config_size ) |
|
156 |
{ |
|
157 |
configs = (EGLConfig*)iStack->AllocFromStack( config_size*m_currentFunctionCall.GetTypeSize( EglRFC::EEGLConfig), |
|
158 |
m_currentFunctionCall.GetTypeAlignment( EglRFC::EEGLConfig) ); |
|
159 |
} |
|
160 |
m_currentFunctionCall.GetEGLint( config_limit, 2 ); |
|
161 |
m_currentFunctionCall.GetEGLintVectorData( num_config_data, num_config_size, 3 ); |
|
162 |
EGLBoolean result = ::eglGetConfigs( dpy, configs, config_limit, num_config_size ? &num_config : NULL); |
|
163 |
||
164 |
if(configs) |
|
165 |
{ |
|
166 |
m_currentFunctionCall.SetEGLConfigVectorData( configs, config_limit, 1 ); |
|
167 |
} |
|
168 |
if (num_config_size) |
|
169 |
{ |
|
170 |
if (config_size && num_config > config_limit) |
|
171 |
num_config = config_limit; |
|
172 |
m_currentFunctionCall.SetEGLintVectorData( &num_config, 1, 3 ); |
|
173 |
} |
|
174 |
||
175 |
m_currentFunctionCall.SetReturnValue( result ); |
|
176 |
int reply = WriteReply(); |
|
177 |
||
178 |
iStack->ClearStack(); |
|
179 |
configs = NULL; |
|
180 |
TRACE("EGLAPIWrapper::eglGetConfigs() <-\n"); |
|
181 |
return reply; |
|
182 |
} |
|
183 |
||
184 |
||
185 |
int EGLAPIWrapper::eglChooseConfig() |
|
186 |
{ |
|
187 |
TRACE("EGLAPIWrapper::eglChooseConfig() ->\n"); |
|
188 |
EGLDisplay dpy; |
|
189 |
m_currentFunctionCall.GetEGLDisplay( dpy, 0 ); |
|
190 |
||
191 |
EGLint num_config = 0; |
|
192 |
EGLint config_size = 0; |
|
193 |
EGLint config_limit = 0; |
|
194 |
EGLConfig* configs = 0; |
|
195 |
EGLint* attribs = 0; |
|
196 |
EGLint attrib_size = 0; |
|
197 |
EGLint* num_config_data = 0; |
|
198 |
EGLint num_config_size = 0; |
|
199 |
||
200 |
m_currentFunctionCall.GetEGLintVectorData( attribs, attrib_size, 1 ); |
|
201 |
m_currentFunctionCall.GetEGLConfigVectorData( configs, config_size, 2 ); |
|
202 |
if ( config_size ) |
|
203 |
{ |
|
204 |
configs = (EGLConfig*)iStack->AllocFromStack( config_size*m_currentFunctionCall.GetTypeSize( EglRFC::EEGLConfig), |
|
205 |
m_currentFunctionCall.GetTypeAlignment( EglRFC::EEGLConfig) ); |
|
206 |
} |
|
207 |
m_currentFunctionCall.GetEGLint( config_limit, 3 ); |
|
208 |
m_currentFunctionCall.GetEGLintVectorData( num_config_data, num_config_size, 4 ); |
|
209 |
EGLBoolean result = ::eglChooseConfig( dpy, attribs, configs, config_limit, num_config_size ? &num_config : NULL ); |
|
210 |
if(configs) |
|
211 |
{ |
|
212 |
m_currentFunctionCall.SetEGLConfigVectorData( configs, config_limit, 2 ); |
|
213 |
} |
|
214 |
if (num_config_size) |
|
215 |
{ |
|
216 |
if (config_size && num_config > config_limit) |
|
217 |
num_config = config_limit; |
|
218 |
m_currentFunctionCall.SetEGLintVectorData( &num_config, 1, 4 ); |
|
219 |
} |
|
220 |
||
221 |
m_currentFunctionCall.SetReturnValue( result ); |
|
222 |
int reply = WriteReply(); |
|
223 |
||
224 |
iStack->ClearStack(); |
|
225 |
configs = NULL; |
|
226 |
TRACE("EGLAPIWrapper::eglChooseConfig() <-\n"); |
|
227 |
return reply; |
|
228 |
} |
|
229 |
||
230 |
||
231 |
int EGLAPIWrapper::eglGetConfigAttrib() |
|
232 |
{ |
|
233 |
TRACE("EGLAPIWrapper::eglGetConfigAttrib() ->\n"); |
|
234 |
EGLDisplay dpy; |
|
235 |
EGLConfig config; |
|
236 |
EGLint attrib; |
|
237 |
EGLint value = 0; |
|
238 |
EGLint* value_data; |
|
239 |
EGLint value_size; |
|
240 |
||
241 |
m_currentFunctionCall.GetEGLDisplay( dpy, 0 ); |
|
242 |
m_currentFunctionCall.GetEGLConfig( config, 1 ); |
|
243 |
m_currentFunctionCall.GetEGLint( attrib, 2 ); |
|
244 |
m_currentFunctionCall.GetEGLintVectorData( value_data, value_size, 3 ); |
|
245 |
EGLBoolean result = ::eglGetConfigAttrib( dpy, config, attrib, value_size ? &value : NULL); |
|
246 |
||
247 |
if (value_size) |
|
248 |
{ |
|
249 |
m_currentFunctionCall.SetEGLintVectorData( &value, 1, 3 ); |
|
250 |
} |
|
251 |
||
252 |
m_currentFunctionCall.SetReturnValue( result ); |
|
253 |
TRACE("EGLAPIWrapper::eglGetConfigAttrib() <-\n"); |
|
254 |
return WriteReply(); |
|
255 |
} |
|
256 |
||
257 |
||
258 |
int EGLAPIWrapper::eglCreateWindowSurface() |
|
259 |
{ |
|
260 |
TRACE("EGLAPIWrapper::eglCreateWindowSurface() ->\n"); |
|
261 |
EGLDisplay dpy; |
|
262 |
EGLConfig config; |
|
263 |
EGLNativeWindowType window; |
|
264 |
||
265 |
m_currentFunctionCall.GetEGLDisplay( dpy, 0 ); |
|
266 |
m_currentFunctionCall.GetEGLConfig( config, 1 ); |
|
267 |
m_currentFunctionCall.GetEGLNativeWindowType( window, 2 ); |
|
268 |
||
269 |
EGLint* attribs; |
|
270 |
EGLint attrib_size; |
|
271 |
||
272 |
m_currentFunctionCall.GetEGLintVectorData( attribs, attrib_size, 3 ); |
|
273 |
||
274 |
int width; |
|
275 |
int height; |
|
276 |
int horizontalPitch; |
|
277 |
int verticalPitch; |
|
278 |
m_currentFunctionCall.GetEGLint( width, 4); |
|
279 |
m_currentFunctionCall.GetEGLint( height, 5); |
|
280 |
m_currentFunctionCall.GetEGLint( horizontalPitch, 6); |
|
281 |
m_currentFunctionCall.GetEGLint( verticalPitch, 7); |
|
282 |
||
283 |
SymbianWindow* nativeWindow = new SymbianWindow; |
|
284 |
nativeWindow->id = (int)window; |
|
285 |
nativeWindow->width = width; |
|
286 |
nativeWindow->height = height; |
|
287 |
nativeWindow->horizontalPitch = horizontalPitch; |
|
288 |
nativeWindow->verticalPitch = verticalPitch; |
|
289 |
||
290 |
EGLSurface surface = ::eglCreateWindowSurface( dpy, config, (EGLNativeWindowType)nativeWindow, attribs ); |
|
291 |
||
292 |
if ( EGL_NO_SURFACE != surface ) |
|
293 |
{ |
|
294 |
//Takes ownership of nativeWindow |
|
295 |
//m_windowMap.insert( std::pair<std::pair<int,int>,SymbianWindow*>( std::pair<int,int>(dpy, surface), nativeWindow ) ); |
|
296 |
m_windowMap.insert( std::pair<TSurfaceKey,TSurfaceData>( TSurfaceKey((int)dpy, (int)surface, m_currentFunctionCall.Data().Header().iProcessId ), TSurfaceData( nativeWindow ) ) ); |
|
297 |
} |
|
298 |
else |
|
299 |
{ |
|
300 |
delete nativeWindow; |
|
301 |
} |
|
302 |
||
303 |
m_currentFunctionCall.SetReturnValue( (TUint32)surface ); |
|
304 |
TRACE("EGLAPIWrapper::eglCreateWindowSurface() <-\n"); |
|
305 |
return WriteReply(); |
|
306 |
} |
|
307 |
||
308 |
||
309 |
int EGLAPIWrapper::eglCreatePbufferSurface() |
|
310 |
{ |
|
311 |
TRACE("EGLAPIWrapper::eglCreatePbufferSurface() ->\n"); |
|
312 |
EGLDisplay dpy; |
|
313 |
EGLConfig config; |
|
314 |
||
315 |
m_currentFunctionCall.GetEGLDisplay( dpy, 0 ); |
|
316 |
m_currentFunctionCall.GetEGLConfig( config, 1 ); |
|
317 |
||
318 |
EGLint* attribs; |
|
319 |
EGLint attrib_size; |
|
320 |
||
321 |
m_currentFunctionCall.GetEGLintVectorData( attribs, attrib_size, 2 ); |
|
322 |
||
323 |
EGLSurface surface = ::eglCreatePbufferSurface( dpy, config, attribs ); |
|
324 |
m_currentFunctionCall.SetReturnValue( (TUint32)surface ); |
|
325 |
TRACE("EGLAPIWrapper::eglCreatePbufferSurface() <-\n"); |
|
326 |
return WriteReply(); |
|
327 |
} |
|
328 |
||
329 |
||
330 |
int EGLAPIWrapper::eglCreatePixmapSurface() |
|
331 |
{ |
|
332 |
TRACE("EGLAPIWrapper::eglCreatePixmapSurface() ->\n"); |
|
333 |
EGLDisplay display; |
|
334 |
EGLConfig config; |
|
335 |
EGLNativePixmapType pixmap; |
|
336 |
EGLint format; |
|
337 |
EGLint width; |
|
338 |
EGLint height; |
|
339 |
EGLint stride; |
|
340 |
EGLint pixmapType; |
|
341 |
||
342 |
m_currentFunctionCall.GetEGLDisplay( display, 0 ); |
|
343 |
m_currentFunctionCall.GetEGLConfig( config, 1 ); |
|
344 |
m_currentFunctionCall.GetEGLNativePixmapType( pixmap, 2 ); |
|
345 |
m_currentFunctionCall.GetEGLint( format, 3 ); |
|
346 |
m_currentFunctionCall.GetEGLint( width, 4 ); |
|
347 |
m_currentFunctionCall.GetEGLint( height, 5 ); |
|
348 |
m_currentFunctionCall.GetEGLint( stride, 6 ); |
|
349 |
m_currentFunctionCall.GetEGLint( pixmapType, 7 ); |
|
350 |
||
351 |
SymbianPixmap* nativeBitmap = new SymbianPixmap; |
|
352 |
nativeBitmap->data = new unsigned long[(stride*height+3)/4]; |
|
353 |
nativeBitmap->format = (TDisplayMode)format; |
|
354 |
nativeBitmap->width = width; |
|
355 |
nativeBitmap->height = height; |
|
356 |
nativeBitmap->stride = stride; |
|
357 |
nativeBitmap->type = pixmapType; |
|
358 |
||
359 |
EGLint* attribs; |
|
360 |
EGLint attrib_size; |
|
361 |
||
362 |
m_currentFunctionCall.GetEGLintVectorData( attribs, attrib_size, 8 ); |
|
363 |
||
364 |
//Takes ownership of nativeBitmap |
|
365 |
EGLSurface surface = ::eglCreatePixmapSurface( display, config, (EGLNativePixmapType)nativeBitmap, attribs ); |
|
366 |
m_currentFunctionCall.SetReturnValue( (TUint32)surface ); |
|
367 |
TRACE("EGLAPIWrapper::eglCreatePixmapSurface() <-\n"); |
|
368 |
return WriteReply(); |
|
369 |
} |
|
370 |
||
371 |
||
372 |
int EGLAPIWrapper::eglDestroySurface() |
|
373 |
{ |
|
374 |
TRACE("EGLAPIWrapper::eglDestroySurface() ->\n"); |
|
375 |
EGLDisplay dpy; |
|
376 |
EGLConfig surface; |
|
377 |
||
378 |
m_currentFunctionCall.GetEGLDisplay( dpy, 0 ); |
|
379 |
m_currentFunctionCall.GetEGLSurface( surface, 1 ); |
|
380 |
||
381 |
EGLBoolean result = ::eglDestroySurface( dpy, surface ); |
|
382 |
||
383 |
if ( result ) |
|
384 |
{ |
|
385 |
if ( EGL_NO_SURFACE != surface ) |
|
386 |
{ |
|
387 |
TSurfaceMap::iterator cur = m_windowMap.find( TSurfaceKey((int)dpy, (int)surface, m_currentFunctionCall.Data().Header().iProcessId ) ); |
|
388 |
if ( m_windowMap.end() != cur ) |
|
389 |
{ |
|
390 |
SymbianWindow* nativeWindow( cur->second.iWindow ); |
|
391 |
m_windowMap.erase(cur); |
|
392 |
delete nativeWindow; |
|
393 |
} |
|
394 |
} |
|
395 |
} |
|
396 |
||
397 |
m_currentFunctionCall.SetReturnValue( result ); |
|
398 |
TRACE("EGLAPIWrapper::eglDestroySurface() <-\n"); |
|
399 |
return WriteReply(); |
|
400 |
} |
|
401 |
||
402 |
||
403 |
int EGLAPIWrapper::eglQuerySurface() |
|
404 |
{ |
|
405 |
TRACE("EGLAPIWrapper::eglQuerySurface() ->\n"); |
|
406 |
EGLDisplay dpy; |
|
407 |
EGLConfig surface; |
|
408 |
EGLint attrib; |
|
409 |
EGLint value = 0; |
|
410 |
EGLint* value_data; |
|
411 |
EGLint value_size; |
|
412 |
||
413 |
m_currentFunctionCall.GetEGLDisplay( dpy, 0 ); |
|
414 |
m_currentFunctionCall.GetEGLSurface( surface, 1 ); |
|
415 |
m_currentFunctionCall.GetEGLint( attrib, 2 ); |
|
416 |
m_currentFunctionCall.GetEGLintVectorData( value_data, value_size, 3 ); |
|
417 |
EGLBoolean result = ::eglQuerySurface( dpy, surface, attrib, value_size ? &value : NULL); |
|
418 |
if (value_size) |
|
419 |
m_currentFunctionCall.SetEGLintVectorData( &value, 1, 3 ); |
|
420 |
||
421 |
m_currentFunctionCall.SetReturnValue( result ); |
|
422 |
TRACE("EGLAPIWrapper::eglQuerySurface() <-\n"); |
|
423 |
return WriteReply(); |
|
424 |
} |
|
425 |
||
426 |
||
427 |
int EGLAPIWrapper::eglBindAPI() |
|
428 |
{ |
|
429 |
TRACE("EGLAPIWrapper::eglBindAPI() ->\n"); |
|
430 |
EGLenum api; |
|
431 |
m_currentFunctionCall.GetEGLenum( api, 0 ); |
|
432 |
EGLBoolean result = ::eglBindAPI( api ); |
|
433 |
m_currentFunctionCall.SetReturnValue( result ); |
|
434 |
TRACE("EGLAPIWrapper::eglBindAPI() <-\n"); |
|
435 |
return WriteReply(); |
|
436 |
} |
|
437 |
||
438 |
||
439 |
int EGLAPIWrapper::eglQueryAPI() |
|
440 |
{ |
|
441 |
TRACE("EGLAPIWrapper::eglQueryAPI() ->\n"); |
|
442 |
EGLenum result = ::eglQueryAPI(); |
|
443 |
m_currentFunctionCall.SetReturnValue( result ); |
|
444 |
TRACE("EGLAPIWrapper::eglQueryAPI() <-\n"); |
|
445 |
return WriteReply(); |
|
446 |
} |
|
447 |
||
448 |
||
449 |
int EGLAPIWrapper::eglWaitClient() |
|
450 |
{ |
|
451 |
TRACE("EGLAPIWrapper::eglWaitClient() ->\n"); |
|
452 |
EGLBoolean result = ::eglWaitClient(); |
|
453 |
m_currentFunctionCall.SetReturnValue( result ); |
|
454 |
TRACE("EGLAPIWrapper::eglWaitClient() <-\n"); |
|
455 |
return WriteReply(); |
|
456 |
} |
|
457 |
||
458 |
||
459 |
int EGLAPIWrapper::eglReleaseThread() |
|
460 |
{ |
|
461 |
TRACE("EGLAPIWrapper::eglReleaseThread() ->\n"); |
|
462 |
EGLBoolean result = ::eglReleaseThread(); |
|
463 |
m_currentFunctionCall.SetReturnValue( result ); |
|
464 |
TRACE("EGLAPIWrapper::eglReleaseThread() <-\n"); |
|
465 |
return WriteReply(); |
|
466 |
} |
|
467 |
||
468 |
||
469 |
int EGLAPIWrapper::eglCreatePbufferFromClientBuffer() |
|
470 |
{ |
|
471 |
TRACE("EGLAPIWrapper::eglCreatePbufferFromClientBuffer() ->\n"); |
|
472 |
EGLDisplay dpy; |
|
473 |
EGLenum buftype; |
|
474 |
EGLClientBuffer buffer; |
|
475 |
EGLConfig config; |
|
476 |
||
477 |
m_currentFunctionCall.GetEGLDisplay( dpy, 0 ); |
|
478 |
m_currentFunctionCall.GetEGLenum( buftype, 1 ); |
|
479 |
m_currentFunctionCall.GetEGLClientBuffer( buffer, 2 ); |
|
480 |
m_currentFunctionCall.GetEGLConfig( config, 3 ); |
|
481 |
||
482 |
if( buftype == EGL_OPENVG_IMAGE && |
|
483 |
m_APIWrapper->GetDriverWrapper()->IsSgBackingVGImage( (VGImage)buffer ) ) |
|
484 |
{ |
|
485 |
//TODO EGL_BAD_ADDRESS |
|
486 |
} |
|
487 |
||
488 |
EGLint* attribs; |
|
489 |
EGLint attrib_size; |
|
490 |
||
491 |
m_currentFunctionCall.GetEGLintVectorData( attribs, attrib_size, 4 ); |
|
492 |
||
493 |
EGLSurface surface = ::eglCreatePbufferFromClientBuffer( dpy, buftype, buffer, config, attribs ); |
|
494 |
m_currentFunctionCall.SetReturnValue( (TUint32)surface ); |
|
495 |
TRACE("EGLAPIWrapper::eglCreateBufferFromClientBuffer() <-\n"); |
|
496 |
return WriteReply(); |
|
497 |
} |
|
498 |
||
499 |
||
500 |
int EGLAPIWrapper::eglSurfaceAttrib() |
|
501 |
{ |
|
502 |
TRACE("EGLAPIWrapper::eglSurfaceAttrib() ->\n"); |
|
503 |
EGLDisplay dpy; |
|
504 |
EGLSurface surface; |
|
505 |
EGLint attrib; |
|
506 |
EGLint value; |
|
507 |
||
508 |
m_currentFunctionCall.GetEGLDisplay( dpy, 0 ); |
|
509 |
m_currentFunctionCall.GetEGLSurface( surface, 1 ); |
|
510 |
m_currentFunctionCall.GetEGLint( attrib, 2 ); |
|
511 |
m_currentFunctionCall.GetEGLint( value, 3 ); |
|
512 |
||
513 |
EGLBoolean result = ::eglSurfaceAttrib( dpy, surface, attrib, value ); |
|
514 |
m_currentFunctionCall.SetReturnValue( result ); |
|
515 |
TRACE("EGLAPIWrapper::eglSurfaceAttrib() <-\n"); |
|
516 |
return WriteReply(); |
|
517 |
} |
|
518 |
||
519 |
||
520 |
int EGLAPIWrapper::eglBindTexImage() |
|
521 |
{ |
|
522 |
TRACE("EGLAPIWrapper::eglBindTexImage() ->\n"); |
|
523 |
EGLDisplay dpy; |
|
524 |
EGLSurface surface; |
|
525 |
EGLint buffer; |
|
526 |
||
527 |
m_currentFunctionCall.GetEGLDisplay( dpy, 0 ); |
|
528 |
m_currentFunctionCall.GetEGLSurface( surface, 1 ); |
|
529 |
m_currentFunctionCall.GetEGLint( buffer, 2 ); |
|
530 |
||
531 |
EGLBoolean result = ::eglBindTexImage( dpy, surface, buffer ); |
|
532 |
m_currentFunctionCall.SetReturnValue( result ); |
|
533 |
TRACE("EGLAPIWrapper::eglBindTexImage() <-\n"); |
|
534 |
return WriteReply(); |
|
535 |
} |
|
536 |
||
537 |
||
538 |
int EGLAPIWrapper::eglReleaseTexImage() |
|
539 |
{ |
|
540 |
TRACE("EGLAPIWrapper::eglReleaseTexImage() ->\n"); |
|
541 |
EGLDisplay dpy; |
|
542 |
EGLSurface surface; |
|
543 |
EGLint buffer; |
|
544 |
||
545 |
m_currentFunctionCall.GetEGLDisplay( dpy, 0 ); |
|
546 |
m_currentFunctionCall.GetEGLSurface( surface, 1 ); |
|
547 |
m_currentFunctionCall.GetEGLint( buffer, 2 ); |
|
548 |
||
549 |
EGLBoolean result = ::eglReleaseTexImage( dpy, surface, buffer ); |
|
550 |
m_currentFunctionCall.SetReturnValue( result ); |
|
551 |
TRACE("EGLAPIWrapper::eglReleaseTexImage() <-\n"); |
|
552 |
return WriteReply(); |
|
553 |
} |
|
554 |
||
555 |
||
556 |
int EGLAPIWrapper::eglSwapInterval() |
|
557 |
{ |
|
558 |
TRACE("EGLAPIWrapper::eglSwapInterval() ->\n"); |
|
559 |
EGLDisplay dpy; |
|
560 |
EGLint interval; |
|
561 |
||
562 |
m_currentFunctionCall.GetEGLDisplay( dpy, 0 ); |
|
563 |
m_currentFunctionCall.GetEGLint( interval, 1 ); |
|
564 |
||
565 |
EGLBoolean result = ::eglSwapInterval( dpy, interval ); |
|
566 |
m_currentFunctionCall.SetReturnValue( result ); |
|
567 |
TRACE("EGLAPIWrapper::eglSwapInterval() <-\n"); |
|
568 |
return WriteReply(); |
|
569 |
} |
|
570 |
||
571 |
||
572 |
int EGLAPIWrapper::eglCreateContext() |
|
573 |
{ |
|
574 |
TRACE("EGLAPIWrapper::eglCreateContext() ->\n"); |
|
575 |
EGLDisplay dpy; |
|
576 |
EGLConfig config; |
|
577 |
EGLContext share_context; |
|
578 |
||
579 |
m_currentFunctionCall.GetEGLDisplay( dpy, 0 ); |
|
580 |
m_currentFunctionCall.GetEGLConfig( config, 1 ); |
|
581 |
m_currentFunctionCall.GetEGLContext( share_context, 2 ); |
|
582 |
||
583 |
if( share_context == EGL_NO_CONTEXT ) |
|
584 |
{ |
|
585 |
share_context = m_APIWrapper->GetDriverWrapper()->GetPoolContext(); |
|
586 |
} |
|
587 |
||
588 |
EGLint* attribs; |
|
589 |
EGLint attrib_size; |
|
590 |
||
591 |
m_currentFunctionCall.GetEGLintVectorData( attribs, attrib_size, 3 ); |
|
592 |
||
593 |
EGLContext context = ::eglCreateContext( dpy, config, share_context, attribs ); |
|
594 |
m_currentFunctionCall.SetReturnValue( (TUint32)context ); |
|
595 |
TRACE("EGLAPIWrapper::eglCreateContext() <-\n"); |
|
596 |
return WriteReply(); |
|
597 |
} |
|
598 |
||
599 |
||
600 |
int EGLAPIWrapper::eglDestroyContext() |
|
601 |
{ |
|
602 |
TRACE("EGLAPIWrapper::eglDestroyContext() ->\n"); |
|
603 |
EGLDisplay dpy; |
|
604 |
EGLContext context; |
|
605 |
||
606 |
m_currentFunctionCall.GetEGLDisplay( dpy, 0 ); |
|
607 |
m_currentFunctionCall.GetEGLContext( context, 1 ); |
|
608 |
||
609 |
EGLBoolean result = ::eglDestroyContext( dpy, context ); |
|
610 |
m_currentFunctionCall.SetReturnValue( result ); |
|
611 |
TRACE("EGLAPIWrapper::eglDestroyContext() <-\n"); |
|
612 |
return WriteReply(); |
|
613 |
} |
|
614 |
||
615 |
||
616 |
int EGLAPIWrapper::eglMakeCurrent() |
|
617 |
{ |
|
618 |
TRACE("EGLAPIWrapper::eglMakeCurrent() ->\n"); |
|
619 |
EGLDisplay dpy; |
|
620 |
EGLSurface draw; |
|
621 |
EGLSurface read; |
|
622 |
EGLContext context; |
|
623 |
EGLint syncNeed(0); |
|
624 |
EGLint src(0); |
|
625 |
||
626 |
m_currentFunctionCall.GetEGLDisplay( dpy, 0 ); |
|
627 |
m_currentFunctionCall.GetEGLSurface( draw, 1 ); |
|
628 |
m_currentFunctionCall.GetEGLSurface( read, 2 ); |
|
629 |
m_currentFunctionCall.GetEGLContext( context, 3 ); |
|
630 |
if( m_currentFunctionCall.Data().Header().iParameterCount > 4 ) |
|
631 |
{ |
|
632 |
m_currentFunctionCall.GetEGLint( syncNeed, 4 ); |
|
633 |
m_currentFunctionCall.GetEGLint( src, 5 ); |
|
634 |
} |
|
635 |
||
636 |
//Call eglMakeCurrent first |
|
637 |
EGLBoolean result = ::eglMakeCurrent( dpy, draw, read, context ); |
|
638 |
||
639 |
//If the surface is "dirty", then it needs to be drawn the vgImage onto |
|
640 |
if( syncNeed & KSyncReadSurface ) |
|
641 |
{ |
|
642 |
int width; |
|
643 |
int height; |
|
644 |
::eglQuerySurface(dpy, read, EGL_WIDTH, &width ); |
|
645 |
::eglQuerySurface(dpy, read, EGL_HEIGHT, &height ); |
|
646 |
m_APIWrapper->GetDriverWrapper()->SyncPBufferFromVGImage( (int)src, width, height ); |
|
647 |
} |
|
648 |
if( syncNeed & KSyncDrawSurface ) |
|
649 |
{ |
|
650 |
int width; |
|
651 |
int height; |
|
652 |
::eglQuerySurface(dpy, draw, EGL_WIDTH, &width ); |
|
653 |
::eglQuerySurface(dpy, draw, EGL_HEIGHT, &height ); |
|
654 |
m_APIWrapper->GetDriverWrapper()->SyncPBufferFromVGImage( (int)src, width, height ); |
|
655 |
} |
|
656 |
||
657 |
m_currentFunctionCall.SetReturnValue( result ); |
|
658 |
TRACE("EGLAPIWrapper::eglMakeCurrent() <-\n"); |
|
659 |
return WriteReply(); |
|
660 |
} |
|
661 |
||
662 |
||
663 |
int EGLAPIWrapper::eglGetCurrentContext() |
|
664 |
{ |
|
665 |
TRACE("EGLAPIWrapper::eglGetCurrentContext() ->\n"); |
|
666 |
EGLContext context = ::eglGetCurrentContext(); |
|
667 |
m_currentFunctionCall.SetReturnValue( (TUint32)context ); |
|
668 |
TRACE("EGLAPIWrapper::eglGetCurrentContext() <-\n"); |
|
669 |
return WriteReply(); |
|
670 |
} |
|
671 |
||
672 |
||
673 |
int EGLAPIWrapper::eglGetCurrentSurface() |
|
674 |
{ |
|
675 |
TRACE("EGLAPIWrapper::eglGetCurrentSurface() ->\n"); |
|
676 |
EGLint readdraw; |
|
677 |
||
678 |
m_currentFunctionCall.GetEGLint( readdraw, 0 ); |
|
679 |
||
680 |
EGLSurface surface = ::eglGetCurrentSurface( readdraw ); |
|
681 |
m_currentFunctionCall.SetReturnValue( (TUint32)surface ); |
|
682 |
TRACE("EGLAPIWrapper::eglGetCurrentSurface() <-\n"); |
|
683 |
return WriteReply(); |
|
684 |
} |
|
685 |
||
686 |
||
687 |
int EGLAPIWrapper::eglGetCurrentDisplay() |
|
688 |
{ |
|
689 |
TRACE("EGLAPIWrapper::eglGetCurrentDisplay() ->\n"); |
|
690 |
EGLDisplay display = ::eglGetCurrentDisplay(); |
|
691 |
m_currentFunctionCall.SetReturnValue( (TUint32)display ); |
|
692 |
TRACE("EGLAPIWrapper::eglGetCurrentDisplay() <-\n"); |
|
693 |
return WriteReply(); |
|
694 |
} |
|
695 |
||
696 |
||
697 |
int EGLAPIWrapper::eglQueryContext() |
|
698 |
{ |
|
699 |
TRACE("EGLAPIWrapper::eglQueryContext() ->\n"); |
|
700 |
EGLDisplay dpy; |
|
701 |
EGLContext context; |
|
702 |
EGLint attrib; |
|
703 |
EGLint value = 0; |
|
704 |
EGLint* value_data; |
|
705 |
EGLint value_size; |
|
706 |
||
707 |
m_currentFunctionCall.GetEGLDisplay( dpy, 0 ); |
|
708 |
m_currentFunctionCall.GetEGLContext( context, 1 ); |
|
709 |
m_currentFunctionCall.GetEGLint( attrib, 2 ); |
|
710 |
m_currentFunctionCall.GetEGLintVectorData( value_data, value_size, 3 ); |
|
711 |
EGLBoolean result = ::eglQueryContext( dpy, context, attrib, value_size ? &value : NULL); |
|
712 |
if (value_size) |
|
713 |
m_currentFunctionCall.SetEGLintVectorData( &value, 1, 3 ); |
|
714 |
m_currentFunctionCall.SetReturnValue( result ); |
|
715 |
TRACE("EGLAPIWrapper::eglQueryContext() <-\n"); |
|
716 |
return WriteReply(); |
|
717 |
} |
|
718 |
||
719 |
||
720 |
int EGLAPIWrapper::eglWaitGL() |
|
721 |
{ |
|
722 |
TRACE("EGLAPIWrapper::eglWaitGL() ->\n"); |
|
723 |
EGLBoolean result = ::eglWaitGL(); |
|
724 |
m_currentFunctionCall.SetReturnValue( result ); |
|
725 |
TRACE("EGLAPIWrapper::() <-\n"); |
|
726 |
return WriteReply(); |
|
727 |
} |
|
728 |
||
729 |
||
730 |
int EGLAPIWrapper::eglWaitNative() |
|
731 |
{ |
|
732 |
TRACE("EGLAPIWrapper::eglWaitNative() ->\n"); |
|
733 |
EGLint engine; |
|
734 |
||
735 |
m_currentFunctionCall.GetEGLint( engine, 0 ); |
|
736 |
||
737 |
EGLBoolean result = ::eglWaitNative( engine ); |
|
738 |
m_currentFunctionCall.SetReturnValue( result ); |
|
739 |
TRACE("EGLAPIWrapper::eglWaitNative() <-\n"); |
|
740 |
return WriteReply(); |
|
741 |
} |
|
742 |
||
743 |
||
744 |
int EGLAPIWrapper::eglSwapBuffers() |
|
745 |
{ |
|
746 |
TRACE("EGLAPIWrapper::eglSwapBuffers() ->\n"); |
|
747 |
EGLDisplay display; |
|
748 |
EGLSurface surface; |
|
749 |
int width; |
|
750 |
int height; |
|
751 |
m_currentFunctionCall.GetEGLDisplay( display, 0 ); |
|
752 |
m_currentFunctionCall.GetEGLSurface( surface, 1 ); |
|
753 |
m_currentFunctionCall.GetEGLint( width, 2 ); |
|
754 |
m_currentFunctionCall.GetEGLint( height, 3 ); |
|
755 |
//TWindowMap::const_iterator cur = m_windowMap.find(std::pair<int,int>( display, surface )); |
|
756 |
TSurfaceMap::const_iterator cur = m_windowMap.find(TSurfaceKey( (int)display, (int)surface, m_currentFunctionCall.Data().Header().iProcessId )); |
|
757 |
||
758 |
//Only found for windows surfaces |
|
759 |
if ( m_windowMap.end() != cur ) |
|
760 |
{ |
|
761 |
cur->second.iWindow->width = width; |
|
762 |
cur->second.iWindow->height = height; |
|
763 |
} |
|
764 |
||
765 |
EGLBoolean result = ::eglSwapBuffers( display, surface ); |
|
766 |
||
767 |
m_currentFunctionCall.SetReturnValue( (TUint32)result ); |
|
768 |
TRACE("EGLAPIWrapper::eglSwapBuffers() <-\n"); |
|
769 |
return WriteReply(); |
|
770 |
} |
|
771 |
||
772 |
||
773 |
int EGLAPIWrapper::eglCopyBuffers() |
|
774 |
{ |
|
775 |
TRACE("EGLAPIWrapper::eglCopyBuffers() ->\n"); |
|
776 |
EGLDisplay display(0); |
|
777 |
EGLSurface surface(0); |
|
778 |
||
779 |
m_currentFunctionCall.GetEGLDisplay( display, 0 ); |
|
780 |
m_currentFunctionCall.GetEGLSurface( surface, 1 ); |
|
781 |
||
782 |
void* data(NULL); |
|
783 |
int size(0); |
|
784 |
m_currentFunctionCall.GetVectorData( data, size, 2 ); |
|
785 |
||
786 |
SymbianPixmap* bitmap(NULL); |
|
787 |
if ( size ) |
|
788 |
{ |
|
789 |
bitmap = (SymbianPixmap*)iStack->AllocFromStack( sizeof(SymbianPixmap), |
|
790 |
m_currentFunctionCall.GetTypeAlignment( EglRFC::EEGLVoid ) ); |
|
791 |
bitmap->data = (unsigned long*)iStack->AllocFromStack( size, |
|
792 |
m_currentFunctionCall.GetTypeAlignment( EglRFC::EEGLVoid ) ); |
|
793 |
EGLint format; |
|
794 |
m_currentFunctionCall.GetEGLint( format, 3 ); |
|
795 |
bitmap->format = (TDisplayMode)format; |
|
796 |
m_currentFunctionCall.GetEGLint( bitmap->width, 4 ); |
|
797 |
m_currentFunctionCall.GetEGLint( bitmap->height, 5 ); |
|
798 |
m_currentFunctionCall.GetEGLint( bitmap->stride, 6 ); |
|
799 |
m_currentFunctionCall.GetEGLint( bitmap->type, 7 ); |
|
800 |
} |
|
801 |
else |
|
802 |
{ |
|
803 |
data = NULL; |
|
804 |
} |
|
805 |
||
806 |
EGLBoolean result = ::eglCopyBuffers( display, surface, (EGLNativePixmapType)bitmap ); |
|
807 |
||
808 |
if ( result ) |
|
809 |
{ |
|
810 |
m_currentFunctionCall.SetVectorData( bitmap->data, size, 2 ); |
|
811 |
} |
|
812 |
||
813 |
m_currentFunctionCall.SetReturnValue( result ); |
|
814 |
int ret = WriteReply(); |
|
815 |
iStack->ClearStack(); |
|
816 |
TRACE("EGLAPIWrapper::eglCopyBiffers() <-\n"); |
|
817 |
return ret; |
|
818 |
} |
|
819 |
||
820 |
||
56
40cc73c24bf8
Host components now buildable in their correct locations (although stil using CMake). Use build.bat in package root.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
53
diff
changeset
|
821 |
int EGLAPIWrapper::eglSimulatorSetSurfaceParams() |
24 | 822 |
{ |
56
40cc73c24bf8
Host components now buildable in their correct locations (although stil using CMake). Use build.bat in package root.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
53
diff
changeset
|
823 |
TRACE("EGLAPIWrapper::eglSimulatorSetSurfaceParams() ->\n"); |
24 | 824 |
EGLDisplay display; |
825 |
EGLSurface surface; |
|
826 |
EGLint width; |
|
827 |
EGLint height; |
|
828 |
EGLint stride; |
|
829 |
EGLint buffer0Offset(0); |
|
830 |
EGLint buffer1Offset(0); |
|
831 |
NativeWindowType win(0); |
|
832 |
||
833 |
m_currentFunctionCall.GetEGLDisplay( display, 0 ); |
|
834 |
m_currentFunctionCall.GetEGLSurface( surface, 1 ); |
|
835 |
m_currentFunctionCall.GetEGLNativeWindowType( win, 2 ); |
|
836 |
m_currentFunctionCall.GetEGLint( width, 3 ); |
|
837 |
m_currentFunctionCall.GetEGLint( height, 4 ); |
|
838 |
m_currentFunctionCall.GetEGLint( stride, 5 ); |
|
839 |
m_currentFunctionCall.GetEGLint( buffer0Offset, 6 ); |
|
840 |
m_currentFunctionCall.GetEGLint( buffer1Offset, 7 ); |
|
841 |
||
30
f204b762818d
Rename use of "frame" buffer to "surface" buffer, to reduce confusion.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
24
diff
changeset
|
842 |
void* buffer0 = (void*)((EGLint)m_surfaceBuffer + buffer0Offset); |
f204b762818d
Rename use of "frame" buffer to "surface" buffer, to reduce confusion.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
24
diff
changeset
|
843 |
void* buffer1 = (void*)((EGLint)m_surfaceBuffer + buffer1Offset); |
24 | 844 |
|
56
40cc73c24bf8
Host components now buildable in their correct locations (although stil using CMake). Use build.bat in package root.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
53
diff
changeset
|
845 |
::eglSimulatorSetSurfaceParams(display, surface, width, height, stride, buffer0, buffer1); |
24 | 846 |
m_currentFunctionCall.SetReturnValue( 0 ); |
56
40cc73c24bf8
Host components now buildable in their correct locations (although stil using CMake). Use build.bat in package root.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
53
diff
changeset
|
847 |
TRACE("EGLAPIWrapper::eglSimulatorSetSurfaceParams() <-\n"); |
24 | 848 |
return WriteReply(); |
849 |
} |
|
850 |
||
851 |
||
56
40cc73c24bf8
Host components now buildable in their correct locations (although stil using CMake). Use build.bat in package root.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
53
diff
changeset
|
852 |
int EGLAPIWrapper::eglSimulatorCopyImageData() |
24 | 853 |
{ |
56
40cc73c24bf8
Host components now buildable in their correct locations (although stil using CMake). Use build.bat in package root.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
53
diff
changeset
|
854 |
TRACE("EGLAPIWrapper::eglSimulatorCopyImageData() ->\n"); |
24 | 855 |
void* data(NULL); |
856 |
int size(0); |
|
857 |
m_currentFunctionCall.GetVectorData( data, size, 0 ); |
|
858 |
||
859 |
if ( size ) |
|
860 |
{ |
|
861 |
EGLDisplay display = ::eglGetCurrentDisplay(); |
|
862 |
EGLSurface surface = ::eglGetCurrentSurface(EGL_DRAW); |
|
56
40cc73c24bf8
Host components now buildable in their correct locations (although stil using CMake). Use build.bat in package root.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
53
diff
changeset
|
863 |
NativePixmapType nativePixmap = eglSimulatorGetPixmapSurfaceBitmap(display,surface); |
24 | 864 |
SymbianPixmap* symbianBitmap = (SymbianPixmap*)nativePixmap; |
865 |
if ( symbianBitmap ) |
|
866 |
{ |
|
867 |
m_currentFunctionCall.SetVectorData( symbianBitmap->data, size, 0 ); |
|
868 |
} |
|
869 |
} |
|
56
40cc73c24bf8
Host components now buildable in their correct locations (although stil using CMake). Use build.bat in package root.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
53
diff
changeset
|
870 |
TRACE("EGLAPIWrapper::eglSimulatorCopyImageData() <-\n"); |
24 | 871 |
return WriteReply(); |
872 |
} |
|
873 |
||
874 |
int EGLAPIWrapper::eglPixmapSurfaceSizeChanged() |
|
875 |
{ |
|
876 |
TRACE("EGLAPIWrapper::eglPixmapSurfaceSizeChanged() ->\n"); |
|
877 |
EGLDisplay display; |
|
878 |
m_currentFunctionCall.GetEGLDisplay( display, 0 ); |
|
879 |
EGLSurface surface; |
|
880 |
m_currentFunctionCall.GetEGLSurface( surface, 1 ); |
|
881 |
NativePixmapType dtype; |
|
882 |
m_currentFunctionCall.GetEGLNativePixmapType( dtype, 2); |
|
883 |
EGLint format; |
|
884 |
m_currentFunctionCall.GetEGLint( format, 3 ); |
|
885 |
EGLint width; |
|
886 |
m_currentFunctionCall.GetEGLint( width, 4 ); |
|
887 |
EGLint height; |
|
888 |
m_currentFunctionCall.GetEGLint( height, 5 ); |
|
889 |
EGLint stride; |
|
890 |
m_currentFunctionCall.GetEGLint( stride, 6 ); |
|
891 |
||
56
40cc73c24bf8
Host components now buildable in their correct locations (although stil using CMake). Use build.bat in package root.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
53
diff
changeset
|
892 |
NativePixmapType nativePixmap = eglSimulatorGetPixmapSurfaceBitmap(display,surface); |
24 | 893 |
SymbianPixmap* symbianBitmap = (SymbianPixmap*)nativePixmap; |
894 |
if ( symbianBitmap ) |
|
895 |
{ |
|
896 |
symbianBitmap->format = (TDisplayMode)format; |
|
897 |
symbianBitmap->width = width; |
|
898 |
symbianBitmap->height = height; |
|
899 |
symbianBitmap->stride = stride; |
|
900 |
delete [] symbianBitmap->data; |
|
901 |
symbianBitmap->data = new unsigned long[(stride*height+3)/4]; |
|
902 |
} |
|
903 |
TRACE("EGLAPIWrapper::eglPixmapSurfaceSizeChanged() <-\n"); |
|
904 |
return WriteReply(); |
|
905 |
} |
|
906 |
||
907 |
int EGLAPIWrapper::eglMetaGetConfigs() |
|
908 |
{ |
|
909 |
TRACE("EGLAPIWrapper::eglMetaGetConfigs() ->\n"); |
|
910 |
bool abortOper = false; |
|
911 |
int fetchMode(0); |
|
912 |
m_currentFunctionCall.GetEGLint( fetchMode, 1 );//2nd parameter |
|
913 |
||
914 |
EGLint* attributes; |
|
915 |
||
916 |
EGLint red, green, blue, alpha; |
|
917 |
||
918 |
//For storing the sg-compatible configs (for a single call to eglChooseConfig) |
|
919 |
EGLConfig* sgConfigs = 0; |
|
920 |
EGLint sgConfigsSize = 0;//size of the array |
|
921 |
EGLint sgConfigsCnt = 0;//Number of actually received configurations |
|
922 |
||
923 |
//The sgConfigs for returning them |
|
924 |
EGLConfig* sgConfigsToReturn; |
|
925 |
EGLint sgConfigsToReturnCnt; |
|
926 |
int sgConfigsToReturnIndex = 0; |
|
927 |
||
928 |
//For storing all the configs |
|
929 |
EGLConfig* allConfigs = 0; |
|
930 |
EGLint allConfigsCnt = 0;//Number of actually received configurations |
|
931 |
||
932 |
//Allocate temporary storage for the attributes for each config |
|
933 |
//This is actually obtained from the remote function call |
|
934 |
EGLint* attributesForAllConfigs(0); |
|
935 |
int sizeAttributesForAllConfigs(0); |
|
936 |
int sizeAttributesForAllConfigsMax(0); |
|
937 |
||
938 |
||
939 |
static EGLint SgPixelFormats[] = |
|
940 |
{ |
|
941 |
EUidPixelFormatXRGB_8888, |
|
942 |
EUidPixelFormatARGB_8888, |
|
943 |
EUidPixelFormatARGB_8888_PRE, |
|
944 |
EUidPixelFormatRGB_565, |
|
945 |
EUidPixelFormatA_8 |
|
946 |
}; |
|
947 |
||
948 |
int sgPixelFormatsCnt = sizeof(SgPixelFormats)/sizeof(EGLint); |
|
949 |
||
950 |
//This is for storing all the attributes. This struct's values will be queried from the configs |
|
951 |
static EGLint configAttributes[] = |
|
952 |
{ |
|
953 |
EGL_BUFFER_SIZE, |
|
954 |
EGL_RED_SIZE, |
|
955 |
EGL_GREEN_SIZE, |
|
956 |
EGL_BLUE_SIZE, |
|
957 |
EGL_LUMINANCE_SIZE, |
|
958 |
EGL_ALPHA_SIZE, |
|
959 |
EGL_ALPHA_MASK_SIZE, |
|
960 |
EGL_BIND_TO_TEXTURE_RGB, |
|
961 |
EGL_BIND_TO_TEXTURE_RGBA, |
|
962 |
EGL_COLOR_BUFFER_TYPE, |
|
963 |
EGL_CONFIG_CAVEAT, |
|
964 |
EGL_CONFIG_ID, |
|
965 |
EGL_CONFORMANT, |
|
966 |
EGL_DEPTH_SIZE, |
|
967 |
EGL_LEVEL, |
|
968 |
EGL_MATCH_NATIVE_PIXMAP, |
|
969 |
EGL_MAX_SWAP_INTERVAL, |
|
970 |
EGL_MIN_SWAP_INTERVAL, |
|
971 |
EGL_NATIVE_RENDERABLE, |
|
972 |
EGL_NATIVE_VISUAL_TYPE, |
|
973 |
EGL_RENDERABLE_TYPE, |
|
974 |
EGL_SAMPLE_BUFFERS, |
|
975 |
EGL_SAMPLES, |
|
976 |
EGL_STENCIL_SIZE, |
|
977 |
EGL_SURFACE_TYPE, |
|
978 |
EGL_TRANSPARENT_TYPE, |
|
979 |
EGL_TRANSPARENT_RED_VALUE, |
|
980 |
EGL_TRANSPARENT_GREEN_VALUE, |
|
981 |
EGL_TRANSPARENT_BLUE_VALUE |
|
982 |
}; |
|
983 |
int cntConfigAttributes = sizeof(configAttributes) / sizeof(EGLint); |
|
984 |
||
985 |
sizeAttributesForAllConfigsMax = cntConfigAttributes * KConfigsMaxCnt; |
|
986 |
TRACE("\nEGLAPIWrapper::eglMetaGetConfigs get Vector datas\n" ); |
|
987 |
m_currentFunctionCall.GetEGLConfigVectorData( sgConfigsToReturn, sgConfigsToReturnCnt, 0 ); |
|
988 |
//m_currentFunctionCall.GetEGLConfigVectorData( attributesForAllConfigs, sizeAttributesForAllConfigs, 1 ); |
|
989 |
m_currentFunctionCall.GetEGLintVectorData( attributesForAllConfigs, sizeAttributesForAllConfigs, 1 ); |
|
990 |
TRACE("\nEGLAPIWrapper::eglMetaGetConfigs eglGetConfigs\n" ); |
|
991 |
//Get the total number of all the configs |
|
992 |
::eglGetConfigs( m_APIWrapper->GetDriverWrapper()->getDisplay(), NULL, 0, &allConfigsCnt ); |
|
993 |
TRACE("\nEGLAPIWrapper::eglMetaGetConfigs all configs count=%d\n", allConfigsCnt ); |
|
994 |
ASSERT( allConfigsCnt <= KConfigsMaxCnt ); |
|
995 |
||
996 |
if ( sizeAttributesForAllConfigs <= sizeAttributesForAllConfigsMax ) |
|
997 |
{ |
|
998 |
attributesForAllConfigs = (EGLint*)iStack->AllocFromStack( sizeAttributesForAllConfigs*m_currentFunctionCall.GetTypeSize( EglRFC::EEGLint ), |
|
999 |
m_currentFunctionCall.GetTypeAlignment( EglRFC::EEGLint ) ); |
|
1000 |
//Allocate room for holding the configs |
|
1001 |
TRACE("\nEGLAPIWrapper::eglMetaGetConfigs attribs cnt = %d\n", cntConfigAttributes ); |
|
1002 |
switch( fetchMode ) |
|
1003 |
{ |
|
1004 |
case EMetaGetConfigsSg: |
|
1005 |
{ |
|
1006 |
for( int i = 0; i < sgPixelFormatsCnt; ++i )//Go through all the pixel formats, fetching configs matching them |
|
1007 |
{ |
|
1008 |
TRACE("\nEGLAPIWrapper::eglMetaGetConfigs sg pixel formats %d\n", i ); |
|
1009 |
//This is for temporary storage. We are only interested in picking the attribute values for each configuration |
|
1010 |
sgConfigs = new EGLConfig[KConfigsMaxCnt];//(EGLConfig*)iStack->AllocFromStack( KConfigsMaxCnt*m_currentFunctionCall.GetTypeSize( EglRFC::EEGLConfig), |
|
1011 |
//m_currentFunctionCall.GetTypeAlignment( EglRFC::EEGLConfig) ); |
|
1012 |
sgConfigsSize = KConfigsMaxCnt; |
|
1013 |
attributes = m_APIWrapper->GetDriverWrapper()->getColorAttributes( SgPixelFormats[i], red, green, blue, alpha ); |
|
1014 |
if( ::eglChooseConfig( m_APIWrapper->GetDriverWrapper()->getDisplay(), |
|
1015 |
attributes, |
|
1016 |
sgConfigs, |
|
1017 |
sgConfigsSize, |
|
1018 |
&sgConfigsCnt ) ) |
|
1019 |
{ |
|
1020 |
//TRACE("\nEGLAPIWrapper::eglMetaGetConfigs sg configs cnt / size = %d / %d\n", sgConfigsCnt, sgConfigsSize ); |
|
1021 |
sizeAttributesForAllConfigs = sgConfigsCnt * sizeof(EGLint) * cntConfigAttributes; |
|
1022 |
for( int config_i = 0; config_i < sgConfigsCnt; ++config_i ) |
|
1023 |
{ |
|
1024 |
*(sgConfigsToReturn + (sgConfigsToReturnIndex++)) = sgConfigs[config_i]; |
|
1025 |
//Go through all the configs, recording the attributes |
|
1026 |
for( int attr_i = 0; attr_i < cntConfigAttributes; ++attr_i ) |
|
1027 |
{ |
|
1028 |
EGLint attribValue; |
|
1029 |
if( ::eglGetConfigAttrib( m_APIWrapper->GetDriverWrapper()->getDisplay(), sgConfigs[config_i], configAttributes[attr_i], &attribValue ) ) |
|
1030 |
{ |
|
1031 |
// #config #attribute |
|
1032 |
*( attributesForAllConfigs + config_i * cntConfigAttributes + attr_i ) = attribValue; |
|
1033 |
//TRACE("\nEGLAPIWrapper::eglMetaGetConfigs sg pixformat %d, config %d, attr %d = %d\n", i, config_i, attr_i, attribValue ); |
|
1034 |
} |
|
1035 |
else |
|
1036 |
{ |
|
1037 |
//Could not obtain the config attribute, now we are going to abort everything |
|
1038 |
goto ATTRIBUTESARRAYDELETE; |
|
1039 |
} |
|
1040 |
}//end for all attribs within a config |
|
1041 |
}//end for all configs returned |
|
1042 |
ATTRIBUTESARRAYDELETE: |
|
1043 |
//We have not been able to populate the attributes list, just abort now |
|
1044 |
delete[] sgConfigs; |
|
1045 |
abortOper = true; |
|
1046 |
}//end if eglGetConfigs succeeded |
|
1047 |
else |
|
1048 |
{ |
|
1049 |
//Problems: can't get the configs. Maybe just abort the whole business |
|
1050 |
abortOper = true; |
|
1051 |
break; |
|
1052 |
} |
|
1053 |
}//end for all pixel formats |
|
1054 |
break; |
|
1055 |
}//end case EMetaGetConfigsSg |
|
1056 |
}//end switch fetchMode |
|
1057 |
||
1058 |
if( !abortOper ) |
|
1059 |
{ |
|
1060 |
//Param 0: |
|
1061 |
TRACE("EGLAPIWrapper::eglMetaGetConfigs sgConfigsToReturnIndex = %d", sgConfigsToReturnIndex ); |
|
1062 |
//m_currentFunctionCall.SetEGLintVectorData( sgConfigsToReturn, sgConfigsToReturnIndex+1, 0 ); |
|
1063 |
m_currentFunctionCall.SetEGLConfigVectorData( sgConfigsToReturn, sgConfigsToReturnIndex+1, 0 ); |
|
1064 |
TRACE("EGLAPIWrapper::eglMetaGetConfigs sizeAttributesForAllConfigs = %d", sizeAttributesForAllConfigs / sizeof( EGLint ) ); |
|
1065 |
m_currentFunctionCall.SetEGLintVectorData( attributesForAllConfigs, sizeAttributesForAllConfigs / sizeof( EGLint ), 1 ); |
|
1066 |
} |
|
1067 |
}//end if config_size >= KConfigsMaxCnt |
|
1068 |
else |
|
1069 |
{ |
|
1070 |
abortOper = true; |
|
1071 |
} |
|
1072 |
m_currentFunctionCall.SetReturnValue( abortOper?EGL_FALSE:EGL_TRUE ); |
|
1073 |
int reply = WriteReply(); |
|
1074 |
iStack->ClearStack(); |
|
1075 |
sgConfigs = NULL; |
|
1076 |
allConfigs = NULL; |
|
1077 |
TRACE("EGLAPIWrapper::eglGetConfigs() <-\n"); |
|
1078 |
return reply; |
|
1079 |
} |
|
1080 |
||
1081 |
int EGLAPIWrapper::DispatchRequest( unsigned long aCode ) |
|
1082 |
{ |
|
1083 |
int ret(0); |
|
1084 |
||
1085 |
switch ( aCode ) |
|
1086 |
{ |
|
1087 |
case EglRFC::EeglGetError: |
|
1088 |
{ |
|
1089 |
ret = eglGetError(); |
|
1090 |
break; |
|
1091 |
} |
|
1092 |
case EglRFC::EeglGetDisplay: |
|
1093 |
{ |
|
1094 |
ret = eglGetDisplay(); |
|
1095 |
break; |
|
1096 |
} |
|
1097 |
case EglRFC::EeglInitialize: |
|
1098 |
{ |
|
1099 |
ret = eglInitialize(); |
|
1100 |
break; |
|
1101 |
} |
|
1102 |
case EglRFC::EeglTerminate: |
|
1103 |
{ |
|
1104 |
ret = eglTerminate(); |
|
1105 |
break; |
|
1106 |
} |
|
1107 |
case EglRFC::EeglQueryString: |
|
1108 |
{ |
|
1109 |
ret = eglQueryString(); |
|
1110 |
break; |
|
1111 |
} |
|
1112 |
case EglRFC::EeglGetConfigs: |
|
1113 |
{ |
|
1114 |
ret = eglGetConfigs(); |
|
1115 |
break; |
|
1116 |
} |
|
1117 |
case EglRFC::EeglChooseConfig: |
|
1118 |
{ |
|
1119 |
ret = eglChooseConfig(); |
|
1120 |
break; |
|
1121 |
} |
|
1122 |
case EglRFC::EeglGetConfigAttrib: |
|
1123 |
{ |
|
1124 |
ret = eglGetConfigAttrib(); |
|
1125 |
break; |
|
1126 |
} |
|
1127 |
case EglRFC::EeglCreateWindowSurface: |
|
1128 |
{ |
|
1129 |
ret = eglCreateWindowSurface(); |
|
1130 |
break; |
|
1131 |
} |
|
1132 |
case EglRFC::EeglCreatePbufferSurface: |
|
1133 |
{ |
|
1134 |
ret = eglCreatePbufferSurface(); |
|
1135 |
break; |
|
1136 |
} |
|
1137 |
case EglRFC::EeglCreatePixmapSurface: |
|
1138 |
{ |
|
1139 |
ret = eglCreatePixmapSurface(); |
|
1140 |
break; |
|
1141 |
} |
|
1142 |
case EglRFC::EeglDestroySurface: |
|
1143 |
{ |
|
1144 |
ret = eglDestroySurface(); |
|
1145 |
break; |
|
1146 |
} |
|
1147 |
case EglRFC::EeglQuerySurface: |
|
1148 |
{ |
|
1149 |
ret = eglQuerySurface(); |
|
1150 |
break; |
|
1151 |
} |
|
1152 |
case EglRFC::EeglBindAPI: |
|
1153 |
{ |
|
1154 |
ret = eglBindAPI(); |
|
1155 |
break; |
|
1156 |
} |
|
1157 |
case EglRFC::EeglQueryAPI: |
|
1158 |
{ |
|
1159 |
ret = eglQueryAPI(); |
|
1160 |
break; |
|
1161 |
} |
|
1162 |
case EglRFC::EeglWaitClient: |
|
1163 |
{ |
|
1164 |
ret = eglWaitClient(); |
|
1165 |
break; |
|
1166 |
} |
|
1167 |
case EglRFC::EeglReleaseThread: |
|
1168 |
{ |
|
1169 |
ret = eglReleaseThread(); |
|
1170 |
break; |
|
1171 |
} |
|
1172 |
case EglRFC::EeglCreatePbufferFromClientBuffer: |
|
1173 |
{ |
|
1174 |
ret = eglCreatePbufferFromClientBuffer(); |
|
1175 |
break; |
|
1176 |
} |
|
1177 |
case EglRFC::EeglSurfaceAttrib: |
|
1178 |
{ |
|
1179 |
ret = eglSurfaceAttrib(); |
|
1180 |
break; |
|
1181 |
} |
|
1182 |
case EglRFC::EeglBindTexImage: |
|
1183 |
{ |
|
1184 |
ret = eglBindTexImage(); |
|
1185 |
break; |
|
1186 |
} |
|
1187 |
case EglRFC::EeglReleaseTexImage: |
|
1188 |
{ |
|
1189 |
ret = eglReleaseTexImage(); |
|
1190 |
break; |
|
1191 |
} |
|
1192 |
case EglRFC::EeglSwapInterval: |
|
1193 |
{ |
|
1194 |
ret = eglSwapInterval(); |
|
1195 |
break; |
|
1196 |
} |
|
1197 |
case EglRFC::EeglCreateContext: |
|
1198 |
{ |
|
1199 |
ret = eglCreateContext(); |
|
1200 |
break; |
|
1201 |
} |
|
1202 |
case EglRFC::EeglDestroyContext: |
|
1203 |
{ |
|
1204 |
ret = eglDestroyContext(); |
|
1205 |
break; |
|
1206 |
} |
|
1207 |
case EglRFC::EeglMakeCurrent: |
|
1208 |
{ |
|
1209 |
ret = eglMakeCurrent(); |
|
1210 |
break; |
|
1211 |
} |
|
1212 |
case EglRFC::EeglMakeCurrentSg: |
|
1213 |
{ |
|
1214 |
break; |
|
1215 |
} |
|
1216 |
case EglRFC::EeglGetCurrentContext: |
|
1217 |
{ |
|
1218 |
ret = eglGetCurrentContext(); |
|
1219 |
break; |
|
1220 |
} |
|
1221 |
case EglRFC::EeglGetCurrentSurface: |
|
1222 |
{ |
|
1223 |
ret = eglGetCurrentSurface(); |
|
1224 |
break; |
|
1225 |
} |
|
1226 |
case EglRFC::EeglGetCurrentDisplay: |
|
1227 |
{ |
|
1228 |
ret = eglGetCurrentDisplay(); |
|
1229 |
break; |
|
1230 |
} |
|
1231 |
case EglRFC::EeglQueryContext: |
|
1232 |
{ |
|
1233 |
ret = eglQueryContext(); |
|
1234 |
break; |
|
1235 |
} |
|
1236 |
case EglRFC::EeglWaitGL: |
|
1237 |
{ |
|
1238 |
ret = eglWaitGL(); |
|
1239 |
break; |
|
1240 |
} |
|
1241 |
case EglRFC::EeglWaitNative: |
|
1242 |
{ |
|
1243 |
ret = eglWaitNative(); |
|
1244 |
break; |
|
1245 |
} |
|
1246 |
case EglRFC::EeglSwapBuffers: |
|
1247 |
{ |
|
1248 |
ret = eglSwapBuffers(); |
|
1249 |
break; |
|
1250 |
} |
|
1251 |
case EglRFC::EeglCopyBuffers: |
|
1252 |
{ |
|
1253 |
ret = eglCopyBuffers(); |
|
1254 |
break; |
|
1255 |
} |
|
1256 |
case EglRFC::EeglSimulatorSetSurfaceParams: |
|
1257 |
{ |
|
56
40cc73c24bf8
Host components now buildable in their correct locations (although stil using CMake). Use build.bat in package root.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
53
diff
changeset
|
1258 |
ret = eglSimulatorSetSurfaceParams(); |
24 | 1259 |
break; |
1260 |
} |
|
1261 |
case EglRFC::EeglSimulatorCopyImageData: |
|
1262 |
{ |
|
56
40cc73c24bf8
Host components now buildable in their correct locations (although stil using CMake). Use build.bat in package root.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
53
diff
changeset
|
1263 |
ret = eglSimulatorCopyImageData(); |
24 | 1264 |
break; |
1265 |
} |
|
1266 |
case EglRFC::EeglPixmapSurfaceSizeChanged: |
|
1267 |
{ |
|
1268 |
ret = eglPixmapSurfaceSizeChanged(); |
|
1269 |
break; |
|
1270 |
} |
|
1271 |
case EglRFC::EeglMetaGetConfigs: |
|
1272 |
{ |
|
1273 |
ret = eglMetaGetConfigs(); |
|
1274 |
break; |
|
1275 |
} |
|
1276 |
default: |
|
1277 |
TRACE("Unimplemented EGL Op code %u\n",aCode); |
|
1278 |
break; |
|
1279 |
} |
|
1280 |
return ret; |
|
1281 |
} |