vghwinterface/vghwapiwrapper/src/eglapiwrapper.cpp
author Matt Plumtree <matt.plumtree@nokia.com>
Thu, 07 Oct 2010 18:44:04 +0100
branchbug235_bringup_0
changeset 56 40cc73c24bf8
parent 53 c2ef9095503a
child 71 243bbc1d70db
permissions -rw-r--r--
Host components now buildable in their correct locations (although stil using CMake). Use build.bat in package root. Note holdingarea build no longer works and everything except llvm will be removed soon. Fix ups to references to components moved to vghwinterface. Move package common headers up to pacakge level inc directory.
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
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
    64
	int operationid = (int)m_currentFunctionCall.Data().Header().iOpCode;
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
    65
	int eglerror = ::eglSimulatorGetError();
24
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
    66
	if ( m_lastEglError != eglerror )
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
    67
	{
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
    68
		if ( EGL_SUCCESS != 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
			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
    71
			}
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
    72
		m_lastEglError = eglerror;
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
#endif
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
    75
	return APIWrapper::WriteReply();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
    76
}
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
    77
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
    78
int EGLAPIWrapper::eglGetError()
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
    TRACE("EGLAPIWrapper::eglGetError()\n");
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
    81
    EGLint error = ::eglGetError();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
    82
    m_currentFunctionCall.SetReturnValue( error );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
    83
    return WriteReply();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
    84
}
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
    85
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
int EGLAPIWrapper::eglGetDisplay()
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
    TRACE("EGLAPIWrapper::eglGetDisplay() ->\n");
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
    90
    EGLNativeDisplayType display_id;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
    91
    m_currentFunctionCall.GetEGLNativeDisplayType( display_id, 0 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
    92
    /*EGLint display*/EGLDisplay display = ::eglGetDisplay( display_id );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
    93
    m_currentFunctionCall.SetReturnValue( (TUint32)display );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
    94
    TRACE("EGLAPIWrapper::eglGetDisplay() <-\n");
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
    95
    return WriteReply();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
    96
}
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
    97
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
int EGLAPIWrapper::eglInitialize()
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
    TRACE("EGLAPIWrapper::eglInitialize() ->\n");
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   102
    EGLDisplay dpy;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   103
    m_currentFunctionCall.GetEGLDisplay( dpy, 0 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   104
    // 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
   105
    EGLBoolean ret = ::eglInitialize( dpy, NULL, NULL);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   106
    m_currentFunctionCall.SetReturnValue(ret);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   107
    TRACE("EGLAPIWrapper::eglInitialize() <-\n");
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   108
    return WriteReply();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   109
}
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   110
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
int EGLAPIWrapper::eglTerminate()
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
    TRACE("EGLAPIWrapper::eglTerminate ->()\n");
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   115
    EGLDisplay dpy;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   116
    m_currentFunctionCall.GetEGLDisplay( dpy, 0 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   117
    EGLBoolean result = ::eglTerminate( dpy );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   118
    m_currentFunctionCall.SetReturnValue( result );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   119
    TRACE("EGLAPIWrapper::eglTerminate <-()\n");
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   120
    return WriteReply();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   121
}
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   122
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
int EGLAPIWrapper::eglQueryString()
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
    TRACE("EGLAPIWrapper::eglQueryString() ->\n");
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   127
    EGLDisplay dpy;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   128
    EGLint name;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   129
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   130
    m_currentFunctionCall.GetEGLDisplay( dpy, 0 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   131
    m_currentFunctionCall.GetEGLint( name, 1 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   132
    const char* result = ::eglQueryString( dpy, name );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   133
    m_currentFunctionCall.SetReturnValue( result ? 1 : 0 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   134
    TRACE("EGLAPIWrapper::eglQueryString() <-\n");
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   135
    return WriteReply();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   136
}
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   137
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
int EGLAPIWrapper::eglGetConfigs()
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
    TRACE("EGLAPIWrapper::eglGetConfigs() ->\n");
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   142
    EGLDisplay dpy;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   143
    m_currentFunctionCall.GetEGLDisplay( dpy, 0 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   144
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   145
    EGLint num_config = 0;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   146
    EGLint config_size = 0;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   147
    EGLint config_limit = 0;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   148
    EGLConfig* configs = 0;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   149
    EGLint* num_config_data = 0;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   150
    EGLint num_config_size = 0;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   151
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   152
    m_currentFunctionCall.GetEGLConfigVectorData( configs, config_size, 1 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   153
    if ( config_size )
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   154
    {
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   155
        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
   156
            m_currentFunctionCall.GetTypeAlignment( EglRFC::EEGLConfig) );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   157
    }
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   158
    m_currentFunctionCall.GetEGLint( config_limit, 2 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   159
    m_currentFunctionCall.GetEGLintVectorData( num_config_data, num_config_size, 3 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   160
    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
   161
    
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   162
    if(configs)
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
        m_currentFunctionCall.SetEGLConfigVectorData( configs, config_limit, 1 );
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
    if (num_config_size)
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 (config_size && num_config > config_limit)
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   169
            num_config = config_limit;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   170
        m_currentFunctionCall.SetEGLintVectorData( &num_config, 1, 3 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   171
    }
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   172
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   173
    m_currentFunctionCall.SetReturnValue( result );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   174
    int reply = WriteReply();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   175
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   176
    iStack->ClearStack();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   177
    configs = NULL;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   178
    TRACE("EGLAPIWrapper::eglGetConfigs() <-\n");
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   179
    return reply;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   180
}
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   181
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
int EGLAPIWrapper::eglChooseConfig()
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
    TRACE("EGLAPIWrapper::eglChooseConfig() ->\n");
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   186
    EGLDisplay dpy;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   187
    m_currentFunctionCall.GetEGLDisplay( dpy, 0 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   188
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   189
    EGLint num_config = 0;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   190
    EGLint config_size = 0;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   191
    EGLint config_limit = 0;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   192
    EGLConfig* configs = 0;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   193
    EGLint* attribs = 0;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   194
    EGLint attrib_size = 0;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   195
    EGLint* num_config_data = 0;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   196
    EGLint num_config_size = 0;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   197
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   198
    m_currentFunctionCall.GetEGLintVectorData( attribs, attrib_size, 1 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   199
    m_currentFunctionCall.GetEGLConfigVectorData( configs, config_size, 2 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   200
    if ( config_size )
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   201
    {
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   202
        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
   203
            m_currentFunctionCall.GetTypeAlignment( EglRFC::EEGLConfig) );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   204
    }
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   205
    m_currentFunctionCall.GetEGLint( config_limit, 3 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   206
    m_currentFunctionCall.GetEGLintVectorData( num_config_data, num_config_size, 4 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   207
    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
   208
    if(configs)
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   209
    {
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   210
        m_currentFunctionCall.SetEGLConfigVectorData( configs, config_limit, 2 );
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
    if (num_config_size)
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 (config_size && num_config > config_limit)
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   215
            num_config = config_limit;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   216
        m_currentFunctionCall.SetEGLintVectorData( &num_config, 1, 4 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   217
    }
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   218
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   219
    m_currentFunctionCall.SetReturnValue( result );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   220
    int reply = WriteReply();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   221
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   222
    iStack->ClearStack();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   223
    configs = NULL;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   224
    TRACE("EGLAPIWrapper::eglChooseConfig() <-\n");
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   225
    return reply;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   226
}
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   227
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
int EGLAPIWrapper::eglGetConfigAttrib()
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
    TRACE("EGLAPIWrapper::eglGetConfigAttrib() ->\n");
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   232
    EGLDisplay dpy;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   233
    EGLConfig config;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   234
    EGLint attrib;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   235
    EGLint value = 0;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   236
    EGLint* value_data;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   237
    EGLint value_size;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   238
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   239
    m_currentFunctionCall.GetEGLDisplay( dpy, 0 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   240
    m_currentFunctionCall.GetEGLConfig( config, 1 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   241
    m_currentFunctionCall.GetEGLint( attrib, 2 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   242
    m_currentFunctionCall.GetEGLintVectorData( value_data, value_size, 3 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   243
    EGLBoolean result = ::eglGetConfigAttrib( dpy, config, attrib, value_size ? &value : NULL);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   244
    
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   245
	if (value_size)
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
        m_currentFunctionCall.SetEGLintVectorData( &value, 1, 3 );
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
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   250
    m_currentFunctionCall.SetReturnValue( result );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   251
    TRACE("EGLAPIWrapper::eglGetConfigAttrib() <-\n");
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   252
    return WriteReply();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   253
}
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   254
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
int EGLAPIWrapper::eglCreateWindowSurface()
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
    TRACE("EGLAPIWrapper::eglCreateWindowSurface() ->\n");
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   259
    EGLDisplay dpy;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   260
    EGLConfig config;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   261
    EGLNativeWindowType window;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   262
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   263
    m_currentFunctionCall.GetEGLDisplay( dpy, 0 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   264
    m_currentFunctionCall.GetEGLConfig( config, 1 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   265
    m_currentFunctionCall.GetEGLNativeWindowType( window, 2 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   266
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   267
    EGLint* attribs;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   268
    EGLint attrib_size;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   269
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   270
    m_currentFunctionCall.GetEGLintVectorData( attribs, attrib_size, 3 );
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
	int width;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   273
	int height;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   274
	int horizontalPitch;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   275
    int verticalPitch;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   276
	m_currentFunctionCall.GetEGLint( width, 4);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   277
	m_currentFunctionCall.GetEGLint( height, 5);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   278
	m_currentFunctionCall.GetEGLint( horizontalPitch, 6);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   279
	m_currentFunctionCall.GetEGLint( verticalPitch, 7);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   280
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   281
	SymbianWindow* nativeWindow = new SymbianWindow;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   282
	nativeWindow->id = (int)window;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   283
	nativeWindow->width = width;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   284
	nativeWindow->height = height;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   285
	nativeWindow->horizontalPitch = horizontalPitch;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   286
    nativeWindow->verticalPitch = verticalPitch;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   287
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   288
    EGLSurface surface = ::eglCreateWindowSurface( dpy, config, (EGLNativeWindowType)nativeWindow, attribs );
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
	if ( EGL_NO_SURFACE != surface )
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
		//Takes ownership of nativeWindow
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   293
		//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
   294
		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
   295
	}
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   296
	else
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
		delete nativeWindow;
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
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   301
    m_currentFunctionCall.SetReturnValue( (TUint32)surface );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   302
    TRACE("EGLAPIWrapper::eglCreateWindowSurface() <-\n");
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   303
    return WriteReply();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   304
}
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   305
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
int EGLAPIWrapper::eglCreatePbufferSurface()
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
    TRACE("EGLAPIWrapper::eglCreatePbufferSurface() ->\n");
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   310
    EGLDisplay dpy;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   311
    EGLConfig config;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   312
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   313
    m_currentFunctionCall.GetEGLDisplay( dpy, 0 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   314
    m_currentFunctionCall.GetEGLConfig( config, 1 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   315
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   316
    EGLint* attribs;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   317
    EGLint attrib_size;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   318
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   319
    m_currentFunctionCall.GetEGLintVectorData( attribs, attrib_size, 2 );
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
    EGLSurface surface = ::eglCreatePbufferSurface( dpy, config, attribs );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   322
    m_currentFunctionCall.SetReturnValue( (TUint32)surface );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   323
    TRACE("EGLAPIWrapper::eglCreatePbufferSurface() <-\n");
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   324
    return WriteReply();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   325
}
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   326
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
int EGLAPIWrapper::eglCreatePixmapSurface()
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
    TRACE("EGLAPIWrapper::eglCreatePixmapSurface() ->\n");
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   331
    EGLDisplay display;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   332
    EGLConfig config;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   333
    EGLNativePixmapType pixmap;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   334
    EGLint format;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   335
    EGLint width;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   336
    EGLint height;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   337
    EGLint stride;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   338
    EGLint pixmapType;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   339
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   340
	m_currentFunctionCall.GetEGLDisplay( display, 0 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   341
    m_currentFunctionCall.GetEGLConfig( config, 1 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   342
    m_currentFunctionCall.GetEGLNativePixmapType( pixmap, 2 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   343
    m_currentFunctionCall.GetEGLint( format, 3 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   344
    m_currentFunctionCall.GetEGLint( width, 4 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   345
    m_currentFunctionCall.GetEGLint( height, 5 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   346
    m_currentFunctionCall.GetEGLint( stride, 6 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   347
    m_currentFunctionCall.GetEGLint( pixmapType, 7 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   348
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   349
	SymbianPixmap* nativeBitmap = new SymbianPixmap;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   350
	nativeBitmap->data = new unsigned long[(stride*height+3)/4];
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   351
	nativeBitmap->format = (TDisplayMode)format;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   352
	nativeBitmap->width = width;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   353
	nativeBitmap->height = height;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   354
	nativeBitmap->stride = stride;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   355
	nativeBitmap->type = pixmapType;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   356
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   357
    EGLint* attribs;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   358
    EGLint attrib_size;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   359
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   360
    m_currentFunctionCall.GetEGLintVectorData( attribs, attrib_size, 8 );
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
	//Takes ownership of nativeBitmap 
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   363
    EGLSurface surface = ::eglCreatePixmapSurface( display, config, (EGLNativePixmapType)nativeBitmap, attribs );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   364
    m_currentFunctionCall.SetReturnValue( (TUint32)surface );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   365
    TRACE("EGLAPIWrapper::eglCreatePixmapSurface() <-\n");
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   366
	return WriteReply();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   367
}
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   368
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
int EGLAPIWrapper::eglDestroySurface()
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
    TRACE("EGLAPIWrapper::eglDestroySurface() ->\n");
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   373
    EGLDisplay dpy;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   374
    EGLConfig surface;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   375
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   376
    m_currentFunctionCall.GetEGLDisplay( dpy, 0 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   377
    m_currentFunctionCall.GetEGLSurface( surface, 1 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   378
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   379
    EGLBoolean result = ::eglDestroySurface( dpy, surface );
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
	if ( result )
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 ( EGL_NO_SURFACE != surface )
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
			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
   386
			if ( m_windowMap.end() != cur )
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   387
			{
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   388
				SymbianWindow* nativeWindow( cur->second.iWindow );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   389
				m_windowMap.erase(cur);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   390
				delete nativeWindow;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   391
			}
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   392
		}
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
    m_currentFunctionCall.SetReturnValue( result );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   396
    TRACE("EGLAPIWrapper::eglDestroySurface() <-\n");
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   397
    return WriteReply();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   398
}
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   399
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
int EGLAPIWrapper::eglQuerySurface()
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
    TRACE("EGLAPIWrapper::eglQuerySurface() ->\n");
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   404
    EGLDisplay dpy;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   405
    EGLConfig surface;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   406
    EGLint attrib;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   407
    EGLint value = 0;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   408
    EGLint* value_data;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   409
    EGLint value_size;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   410
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   411
    m_currentFunctionCall.GetEGLDisplay( dpy, 0 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   412
    m_currentFunctionCall.GetEGLSurface( surface, 1 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   413
    m_currentFunctionCall.GetEGLint( attrib, 2 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   414
    m_currentFunctionCall.GetEGLintVectorData( value_data, value_size, 3 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   415
    EGLBoolean result = ::eglQuerySurface( dpy, surface, attrib, value_size ? &value : NULL);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   416
    if (value_size)
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   417
        m_currentFunctionCall.SetEGLintVectorData( &value, 1, 3 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   418
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   419
    m_currentFunctionCall.SetReturnValue( result );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   420
    TRACE("EGLAPIWrapper::eglQuerySurface() <-\n");
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   421
    return WriteReply();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   422
}
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   423
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
int EGLAPIWrapper::eglBindAPI()
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
    TRACE("EGLAPIWrapper::eglBindAPI() ->\n");
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   428
    EGLenum api;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   429
    m_currentFunctionCall.GetEGLenum( api, 0 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   430
    EGLBoolean result = ::eglBindAPI( api );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   431
    m_currentFunctionCall.SetReturnValue( result );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   432
    TRACE("EGLAPIWrapper::eglBindAPI() <-\n");
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   433
    return WriteReply();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   434
}
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   435
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
int EGLAPIWrapper::eglQueryAPI()
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
    TRACE("EGLAPIWrapper::eglQueryAPI() ->\n");
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   440
    EGLenum result = ::eglQueryAPI();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   441
    m_currentFunctionCall.SetReturnValue( result );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   442
    TRACE("EGLAPIWrapper::eglQueryAPI() <-\n");
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   443
    return WriteReply();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   444
}
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   445
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
int EGLAPIWrapper::eglWaitClient()
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
    TRACE("EGLAPIWrapper::eglWaitClient() ->\n");
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   450
    EGLBoolean result = ::eglWaitClient();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   451
    m_currentFunctionCall.SetReturnValue( result );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   452
    TRACE("EGLAPIWrapper::eglWaitClient() <-\n");
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   453
    return WriteReply();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   454
}
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   455
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
int EGLAPIWrapper::eglReleaseThread()
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
    TRACE("EGLAPIWrapper::eglReleaseThread() ->\n");
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   460
    EGLBoolean result = ::eglReleaseThread();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   461
    m_currentFunctionCall.SetReturnValue( result );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   462
    TRACE("EGLAPIWrapper::eglReleaseThread() <-\n");
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   463
    return WriteReply();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   464
}
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   465
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
int EGLAPIWrapper::eglCreatePbufferFromClientBuffer()
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
    TRACE("EGLAPIWrapper::eglCreatePbufferFromClientBuffer() ->\n");
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   470
    EGLDisplay dpy;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   471
    EGLenum buftype;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   472
    EGLClientBuffer buffer;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   473
    EGLConfig config;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   474
	
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   475
    m_currentFunctionCall.GetEGLDisplay( dpy, 0 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   476
    m_currentFunctionCall.GetEGLenum( buftype, 1 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   477
    m_currentFunctionCall.GetEGLClientBuffer( buffer, 2 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   478
    m_currentFunctionCall.GetEGLConfig( config, 3 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   479
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   480
	if( buftype == EGL_OPENVG_IMAGE &&
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   481
		m_APIWrapper->GetDriverWrapper()->IsSgBackingVGImage( (VGImage)buffer ) )
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   482
	{
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   483
		//TODO EGL_BAD_ADDRESS
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
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   486
    EGLint* attribs;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   487
    EGLint attrib_size;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   488
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   489
    m_currentFunctionCall.GetEGLintVectorData( attribs, attrib_size, 4 );
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
    EGLSurface surface = ::eglCreatePbufferFromClientBuffer( dpy, buftype, buffer, config, attribs );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   492
    m_currentFunctionCall.SetReturnValue( (TUint32)surface );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   493
    TRACE("EGLAPIWrapper::eglCreateBufferFromClientBuffer() <-\n");
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   494
    return WriteReply();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   495
}
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   496
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
int EGLAPIWrapper::eglSurfaceAttrib()
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
    TRACE("EGLAPIWrapper::eglSurfaceAttrib() ->\n");
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   501
    EGLDisplay dpy;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   502
    EGLSurface surface;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   503
    EGLint attrib;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   504
    EGLint value;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   505
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   506
    m_currentFunctionCall.GetEGLDisplay( dpy, 0 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   507
    m_currentFunctionCall.GetEGLSurface( surface, 1 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   508
    m_currentFunctionCall.GetEGLint( attrib, 2 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   509
    m_currentFunctionCall.GetEGLint( value, 3 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   510
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   511
    EGLBoolean result = ::eglSurfaceAttrib( dpy, surface, attrib, value );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   512
    m_currentFunctionCall.SetReturnValue( result );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   513
    TRACE("EGLAPIWrapper::eglSurfaceAttrib() <-\n");
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   514
    return WriteReply();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   515
}
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   516
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
int EGLAPIWrapper::eglBindTexImage()
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
    TRACE("EGLAPIWrapper::eglBindTexImage() ->\n");
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   521
    EGLDisplay dpy;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   522
    EGLSurface surface;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   523
    EGLint buffer;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   524
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   525
    m_currentFunctionCall.GetEGLDisplay( dpy, 0 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   526
    m_currentFunctionCall.GetEGLSurface( surface, 1 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   527
    m_currentFunctionCall.GetEGLint( buffer, 2 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   528
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   529
    EGLBoolean result = ::eglBindTexImage( dpy, surface, buffer );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   530
    m_currentFunctionCall.SetReturnValue( result );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   531
    TRACE("EGLAPIWrapper::eglBindTexImage() <-\n");
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   532
    return WriteReply();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   533
}
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   534
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
int EGLAPIWrapper::eglReleaseTexImage()
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
    TRACE("EGLAPIWrapper::eglReleaseTexImage() ->\n");
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   539
    EGLDisplay dpy;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   540
    EGLSurface surface;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   541
    EGLint buffer;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   542
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   543
    m_currentFunctionCall.GetEGLDisplay( dpy, 0 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   544
    m_currentFunctionCall.GetEGLSurface( surface, 1 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   545
    m_currentFunctionCall.GetEGLint( buffer, 2 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   546
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   547
    EGLBoolean result = ::eglReleaseTexImage( dpy, surface, buffer );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   548
    m_currentFunctionCall.SetReturnValue( result );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   549
    TRACE("EGLAPIWrapper::eglReleaseTexImage() <-\n");
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   550
    return WriteReply();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   551
}
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   552
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
int EGLAPIWrapper::eglSwapInterval()
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
    TRACE("EGLAPIWrapper::eglSwapInterval() ->\n");
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   557
    EGLDisplay dpy;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   558
    EGLint interval;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   559
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   560
    m_currentFunctionCall.GetEGLDisplay( dpy, 0 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   561
    m_currentFunctionCall.GetEGLint( interval, 1 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   562
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   563
    EGLBoolean result = ::eglSwapInterval( dpy, interval );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   564
    m_currentFunctionCall.SetReturnValue( result );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   565
    TRACE("EGLAPIWrapper::eglSwapInterval() <-\n");
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   566
    return WriteReply();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   567
}
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   568
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
int EGLAPIWrapper::eglCreateContext()
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
    TRACE("EGLAPIWrapper::eglCreateContext() ->\n");
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   573
    EGLDisplay dpy;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   574
    EGLConfig config;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   575
    EGLContext share_context;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   576
	EGLBoolean sgSupporting(EGL_FALSE);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   577
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   578
    m_currentFunctionCall.GetEGLDisplay( dpy, 0 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   579
    m_currentFunctionCall.GetEGLConfig( config, 1 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   580
    m_currentFunctionCall.GetEGLContext( share_context, 2 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   581
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   582
	if( share_context == EGL_NO_CONTEXT )
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   583
	{
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   584
		share_context = m_APIWrapper->GetDriverWrapper()->GetPoolContext();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   585
	}
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
    EGLint* attribs;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   588
    EGLint attrib_size;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   589
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   590
    m_currentFunctionCall.GetEGLintVectorData( attribs, attrib_size, 3 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   591
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   592
    EGLContext context = ::eglCreateContext( dpy, config, share_context, attribs );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   593
    m_currentFunctionCall.SetReturnValue( (TUint32)context );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   594
    TRACE("EGLAPIWrapper::eglCreateContext() <-\n");
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   595
    return WriteReply();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   596
}
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
int EGLAPIWrapper::eglDestroyContext()
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   600
{
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   601
    TRACE("EGLAPIWrapper::eglDestroyContext() ->\n");
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   602
    EGLDisplay dpy;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   603
    EGLContext context;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   604
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   605
    m_currentFunctionCall.GetEGLDisplay( dpy, 0 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   606
    m_currentFunctionCall.GetEGLContext( context, 1 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   607
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   608
    EGLBoolean result = ::eglDestroyContext( dpy, context );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   609
    m_currentFunctionCall.SetReturnValue( result );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   610
    TRACE("EGLAPIWrapper::eglDestroyContext() <-\n");
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   611
    return WriteReply();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   612
}
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
int EGLAPIWrapper::eglMakeCurrent()
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   616
{
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   617
    TRACE("EGLAPIWrapper::eglMakeCurrent() ->\n");
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   618
    EGLDisplay dpy;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   619
    EGLSurface draw;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   620
    EGLSurface read;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   621
    EGLContext context;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   622
	EGLint syncNeed(0);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   623
	EGLint src(0);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   624
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   625
    m_currentFunctionCall.GetEGLDisplay( dpy, 0 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   626
    m_currentFunctionCall.GetEGLSurface( draw, 1 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   627
    m_currentFunctionCall.GetEGLSurface( read, 2 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   628
    m_currentFunctionCall.GetEGLContext( context, 3 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   629
	if( m_currentFunctionCall.Data().Header().iParameterCount > 4 )
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   630
	{
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   631
		m_currentFunctionCall.GetEGLint( syncNeed, 4 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   632
		m_currentFunctionCall.GetEGLint( src, 5 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   633
	}
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
	//Call eglMakeCurrent first
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   636
	EGLBoolean result = ::eglMakeCurrent( dpy, draw, read, context );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   637
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   638
	//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
   639
	if( syncNeed & KSyncReadSurface )
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   640
	{
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   641
		int width;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   642
		int height;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   643
		::eglQuerySurface(dpy, read, EGL_WIDTH, &width );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   644
		::eglQuerySurface(dpy, read, EGL_HEIGHT, &height );		
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   645
		m_APIWrapper->GetDriverWrapper()->SyncPBufferFromVGImage( (int)src, width, height );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   646
	}
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   647
	if( syncNeed & KSyncDrawSurface )
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   648
	{
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   649
		int width;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   650
		int height;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   651
		::eglQuerySurface(dpy, draw, EGL_WIDTH, &width );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   652
		::eglQuerySurface(dpy, draw, EGL_HEIGHT, &height );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   653
		m_APIWrapper->GetDriverWrapper()->SyncPBufferFromVGImage( (int)src, width, height );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   654
	}
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
    m_currentFunctionCall.SetReturnValue( result );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   657
    TRACE("EGLAPIWrapper::eglMakeCurrent() <-\n");
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   658
    return WriteReply();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   659
}
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
int EGLAPIWrapper::eglGetCurrentContext()
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   663
{
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   664
    TRACE("EGLAPIWrapper::eglGetCurrentContext() ->\n");
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   665
    EGLContext context = ::eglGetCurrentContext();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   666
    m_currentFunctionCall.SetReturnValue( (TUint32)context );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   667
    TRACE("EGLAPIWrapper::eglGetCurrentContext() <-\n");
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   668
    return WriteReply();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   669
}
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
int EGLAPIWrapper::eglGetCurrentSurface()
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   673
{
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   674
    TRACE("EGLAPIWrapper::eglGetCurrentSurface() ->\n");
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   675
    EGLint readdraw;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   676
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   677
    m_currentFunctionCall.GetEGLint( readdraw, 0 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   678
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   679
    EGLSurface surface = ::eglGetCurrentSurface( readdraw );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   680
    m_currentFunctionCall.SetReturnValue( (TUint32)surface );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   681
    TRACE("EGLAPIWrapper::eglGetCurrentSurface() <-\n");
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   682
    return WriteReply();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   683
}
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
int EGLAPIWrapper::eglGetCurrentDisplay()
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   687
{
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   688
    TRACE("EGLAPIWrapper::eglGetCurrentDisplay() ->\n");
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   689
    EGLDisplay display = ::eglGetCurrentDisplay();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   690
    m_currentFunctionCall.SetReturnValue( (TUint32)display );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   691
    TRACE("EGLAPIWrapper::eglGetCurrentDisplay() <-\n");
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   692
    return WriteReply();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   693
}
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
int EGLAPIWrapper::eglQueryContext()
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   697
{
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   698
    TRACE("EGLAPIWrapper::eglQueryContext() ->\n");
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   699
    EGLDisplay dpy;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   700
    EGLContext context;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   701
    EGLint attrib;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   702
    EGLint value = 0;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   703
    EGLint* value_data;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   704
    EGLint value_size;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   705
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   706
    m_currentFunctionCall.GetEGLDisplay( dpy, 0 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   707
    m_currentFunctionCall.GetEGLContext( context, 1 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   708
    m_currentFunctionCall.GetEGLint( attrib, 2 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   709
    m_currentFunctionCall.GetEGLintVectorData( value_data, value_size, 3 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   710
    EGLBoolean result = ::eglQueryContext( dpy, context, attrib, value_size ? &value : NULL);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   711
    if (value_size)
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   712
        m_currentFunctionCall.SetEGLintVectorData( &value, 1, 3 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   713
    m_currentFunctionCall.SetReturnValue( result );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   714
    TRACE("EGLAPIWrapper::eglQueryContext() <-\n");
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   715
    return WriteReply();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   716
}
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
int EGLAPIWrapper::eglWaitGL()
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   720
{
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   721
    TRACE("EGLAPIWrapper::eglWaitGL() ->\n");
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   722
    EGLBoolean result = ::eglWaitGL();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   723
    m_currentFunctionCall.SetReturnValue( result );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   724
    TRACE("EGLAPIWrapper::() <-\n");
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   725
    return WriteReply();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   726
}
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
int EGLAPIWrapper::eglWaitNative()
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   730
{
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   731
    TRACE("EGLAPIWrapper::eglWaitNative() ->\n");
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   732
    EGLint engine;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   733
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   734
    m_currentFunctionCall.GetEGLint( engine, 0 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   735
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   736
    EGLBoolean result = ::eglWaitNative( engine );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   737
    m_currentFunctionCall.SetReturnValue( result );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   738
    TRACE("EGLAPIWrapper::eglWaitNative() <-\n");
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   739
    return WriteReply();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   740
}
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
int EGLAPIWrapper::eglSwapBuffers()
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   744
{
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   745
    TRACE("EGLAPIWrapper::eglSwapBuffers() ->\n");
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   746
    EGLDisplay display;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   747
    EGLSurface surface;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   748
	int width;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   749
	int height;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   750
    m_currentFunctionCall.GetEGLDisplay( display, 0 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   751
    m_currentFunctionCall.GetEGLSurface( surface, 1 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   752
    m_currentFunctionCall.GetEGLint( width, 2 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   753
    m_currentFunctionCall.GetEGLint( height, 3 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   754
	//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
   755
	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
   756
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   757
	//Only found for windows surfaces
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   758
	if ( m_windowMap.end() != cur )
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   759
	{
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   760
		cur->second.iWindow->width = width;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   761
		cur->second.iWindow->height = height;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   762
	}
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
    EGLBoolean result = ::eglSwapBuffers( display, surface );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   765
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   766
    m_currentFunctionCall.SetReturnValue( (TUint32)result );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   767
    TRACE("EGLAPIWrapper::eglSwapBuffers() <-\n");
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   768
    return WriteReply();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   769
}
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
int EGLAPIWrapper::eglCopyBuffers()
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   773
{
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   774
    TRACE("EGLAPIWrapper::eglCopyBuffers() ->\n");
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   775
    EGLDisplay display(0);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   776
    EGLSurface surface(0);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   777
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   778
    m_currentFunctionCall.GetEGLDisplay( display, 0 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   779
    m_currentFunctionCall.GetEGLSurface( surface, 1 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   780
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   781
	void* data(NULL);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   782
    int size(0);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   783
    m_currentFunctionCall.GetVectorData( data, size, 2 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   784
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   785
	SymbianPixmap* bitmap(NULL);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   786
	if ( size )
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   787
	{
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   788
		bitmap = (SymbianPixmap*)iStack->AllocFromStack( sizeof(SymbianPixmap),
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   789
            m_currentFunctionCall.GetTypeAlignment( EglRFC::EEGLVoid ) );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   790
		bitmap->data = (unsigned long*)iStack->AllocFromStack( size,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   791
            m_currentFunctionCall.GetTypeAlignment( EglRFC::EEGLVoid ) );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   792
		EGLint format;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   793
		m_currentFunctionCall.GetEGLint( format, 3 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   794
		bitmap->format = (TDisplayMode)format;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   795
		m_currentFunctionCall.GetEGLint( bitmap->width, 4 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   796
		m_currentFunctionCall.GetEGLint( bitmap->height, 5 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   797
		m_currentFunctionCall.GetEGLint( bitmap->stride, 6 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   798
		m_currentFunctionCall.GetEGLint( bitmap->type, 7 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   799
	}
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   800
	else
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   801
	{
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   802
		data = NULL;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   803
	}
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
    EGLBoolean result = ::eglCopyBuffers( display, surface, (EGLNativePixmapType)bitmap );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   806
    
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   807
	if ( result )
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   808
		{
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   809
		m_currentFunctionCall.SetVectorData( bitmap->data, size, 2 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   810
		}
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
    m_currentFunctionCall.SetReturnValue( result );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   813
	int ret = WriteReply();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   814
	iStack->ClearStack();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   815
	TRACE("EGLAPIWrapper::eglCopyBiffers() <-\n");
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   816
    return ret;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   817
}
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
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
   820
int EGLAPIWrapper::eglSimulatorSetSurfaceParams()
24
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   821
{
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
   822
    TRACE("EGLAPIWrapper::eglSimulatorSetSurfaceParams() ->\n");
24
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   823
    EGLDisplay display;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   824
    EGLSurface surface;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   825
    EGLint width;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   826
    EGLint height;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   827
    EGLint stride;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   828
    EGLint buffer0Offset(0);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   829
    EGLint buffer1Offset(0);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   830
	NativeWindowType win(0);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   831
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   832
    m_currentFunctionCall.GetEGLDisplay( display, 0 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   833
    m_currentFunctionCall.GetEGLSurface( surface, 1 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   834
    m_currentFunctionCall.GetEGLNativeWindowType( win, 2 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   835
    m_currentFunctionCall.GetEGLint( width, 3 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   836
    m_currentFunctionCall.GetEGLint( height, 4 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   837
    m_currentFunctionCall.GetEGLint( stride, 5 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   838
    m_currentFunctionCall.GetEGLint( buffer0Offset, 6 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   839
    m_currentFunctionCall.GetEGLint( buffer1Offset, 7 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   840
30
f204b762818d Rename use of "frame" buffer to "surface" buffer, to reduce confusion.
Matt Plumtree <matt.plumtree@nokia.com>
parents: 24
diff changeset
   841
    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
   842
    void* buffer1 = (void*)((EGLint)m_surfaceBuffer + buffer1Offset);
24
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   843
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
   844
	::eglSimulatorSetSurfaceParams(display, surface, width, height, stride, buffer0, buffer1);
24
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   845
	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
   846
	TRACE("EGLAPIWrapper::eglSimulatorSetSurfaceParams() <-\n");
24
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   847
    return WriteReply();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   848
}
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
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
   851
int EGLAPIWrapper::eglSimulatorCopyImageData()
24
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   852
{
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
   853
    TRACE("EGLAPIWrapper::eglSimulatorCopyImageData() ->\n");
24
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   854
    void* data(NULL);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   855
    int size(0);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   856
    m_currentFunctionCall.GetVectorData( data, size, 0 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   857
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   858
	if ( size )
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   859
		{
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   860
		EGLDisplay display = ::eglGetCurrentDisplay();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   861
		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
   862
		NativePixmapType nativePixmap = eglSimulatorGetPixmapSurfaceBitmap(display,surface);
24
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   863
		SymbianPixmap* symbianBitmap = (SymbianPixmap*)nativePixmap;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   864
		if ( symbianBitmap )
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   865
			{
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   866
			m_currentFunctionCall.SetVectorData( symbianBitmap->data, size, 0 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   867
			}
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   868
		}	
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
   869
    TRACE("EGLAPIWrapper::eglSimulatorCopyImageData() <-\n");
24
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   870
    return WriteReply();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   871
}
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
int EGLAPIWrapper::eglPixmapSurfaceSizeChanged()
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   874
{
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   875
    TRACE("EGLAPIWrapper::eglPixmapSurfaceSizeChanged() ->\n");
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   876
	EGLDisplay display;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   877
	m_currentFunctionCall.GetEGLDisplay( display, 0 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   878
	EGLSurface surface;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   879
	m_currentFunctionCall.GetEGLSurface( surface, 1 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   880
	NativePixmapType dtype;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   881
    m_currentFunctionCall.GetEGLNativePixmapType( dtype, 2);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   882
	EGLint format;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   883
	m_currentFunctionCall.GetEGLint( format, 3 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   884
	EGLint width;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   885
    m_currentFunctionCall.GetEGLint( width, 4 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   886
	EGLint height;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   887
    m_currentFunctionCall.GetEGLint( height, 5 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   888
	EGLint stride;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   889
    m_currentFunctionCall.GetEGLint( stride, 6 );
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   890
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
   891
	NativePixmapType nativePixmap = eglSimulatorGetPixmapSurfaceBitmap(display,surface);
24
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   892
	SymbianPixmap* symbianBitmap = (SymbianPixmap*)nativePixmap;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   893
	if ( symbianBitmap )
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   894
	{
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   895
		symbianBitmap->format = (TDisplayMode)format;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   896
		symbianBitmap->width = width;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   897
		symbianBitmap->height = height;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   898
		symbianBitmap->stride = stride;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   899
		delete [] symbianBitmap->data;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   900
		symbianBitmap->data = new unsigned long[(stride*height+3)/4];
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   901
	}
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   902
    TRACE("EGLAPIWrapper::eglPixmapSurfaceSizeChanged() <-\n");
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   903
    return WriteReply();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   904
}
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
int EGLAPIWrapper::eglMetaGetConfigs()
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   907
{
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   908
    TRACE("EGLAPIWrapper::eglMetaGetConfigs() ->\n");
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   909
	bool abortOper = false;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   910
	int fetchMode(0);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   911
	m_currentFunctionCall.GetEGLint( fetchMode, 1 );//2nd parameter
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   912
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   913
	EGLint* attributes;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   914
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   915
	EGLint red, green, blue, alpha;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   916
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   917
	//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
   918
	EGLConfig* sgConfigs = 0;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   919
	EGLint     sgConfigsSize = 0;//size of the array
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   920
	EGLint     sgConfigsCnt = 0;//Number of actually received configurations
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   921
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   922
	//The sgConfigs for returning them
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   923
	EGLConfig* sgConfigsToReturn;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   924
	EGLint     sgConfigsToReturnCnt;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   925
	int        sgConfigsToReturnIndex = 0;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   926
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   927
	//For storing all the configs
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   928
	EGLConfig*  allConfigs = 0;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 23
diff changeset
   929
	EGLint      allConfigsSize = 0;//size of the array
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
}