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