guestrendering/guestegl/inc/guestegl.h
branchbug235_bringup_0
changeset 13 220791dae4c4
child 17 c9d1eb0bfac8
equal deleted inserted replaced
12:a4c94be9fb92 13:220791dae4c4
       
     1 // Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Guest Egl Header file
       
    15 
       
    16 #ifndef __GUEST__EGL_H
       
    17 #define __GUEST__EGL_H
       
    18 
       
    19 
       
    20 // CLASS DECLARATION
       
    21 typedef enum
       
    22 	{
       
    23     EPixmapTypeNone,
       
    24     EPixmapTypeFbsBitmap,
       
    25     EPixmapTypeSgImage,
       
    26 	} TSymbianPixmapTypeId;
       
    27 
       
    28 
       
    29 typedef enum
       
    30 	{
       
    31 	ESurfaceTypeWindow = 0,
       
    32 	ESurfaceTypePbuffer = 1,
       
    33 	ESurfaceTypePixmapFbsBitmap = 2,
       
    34 	ESurfaceTypePixmapSgImage = 3,
       
    35 	} TEglSurfaceType;
       
    36 
       
    37 
       
    38 class RSurfaceManager;
       
    39 class CEglContext;
       
    40 
       
    41 // client side info about a surface
       
    42 struct TSurfaceInfo
       
    43     {
       
    44     TSize                   iSize;
       
    45     TEglSurfaceType         iSurfaceType; //Surface type
       
    46     EGLConfig               iConfigId;
       
    47     CFbsBitmap*             iFbsBitmap;       // Handle for CFbsBitmap
       
    48 #ifdef FAISALMEMON_S4_SGIMAGE
       
    49     RSgDrawable             iSgHandle;        // Handle for RSgImge - keeps image open
       
    50     TSgDrawableId           iSgId;            // SgImage Id - to detect 2nd attempted surface using the same SgImage 
       
    51 #endif
       
    52     EGLSurface              iHostSurfaceId;
       
    53 	// Note: most member data is only used by Window surfaces
       
    54     TSurfaceId              iSurfaceId;        /*<! Target system surface allocated by EGL.                                              */
       
    55     // FAISALMEMON HOLE 0                                                   
       
    56     void*                   iBuffer0;          /*<! Pointer to the first buffer pixels                                                   */
       
    57     void*                   iBuffer1;          /*<! Pointer to the second buffer pixels                                                  */
       
    58     TInt                    iBuffer0Index;          /*<! Pointer to the first buffer pixels                                                   */
       
    59     TInt                    iBuffer1Index;          /*<! Pointer to the second buffer pixels                                                  */
       
    60     RChunk*                 iChunk;            /*<! chunk of the backbuffer surface memory                                               */
       
    61     // FAISALMEMON HOLE 1
       
    62     RWindow*                iNativeWindow;
       
    63     EGLint                  iRedBits;
       
    64     EGLint                  iGreenBits;
       
    65     EGLint                  iBlueBits;
       
    66     EGLint                  iAlphaBits;
       
    67     EGLenum                 iAlphaFormat;
       
    68     EGLint                  iColorBits;
       
    69     EGLint                  iStride;
       
    70     // FAISALMEMON HOLE 2
       
    71     };
       
    72 
       
    73 
       
    74 // Container for Symbian client side information about an EGL Display
       
    75 NONSHARABLE_CLASS(CEglDisplayInfo) : public CBase
       
    76 	{
       
    77 public:
       
    78 	TBool                              iInitialized;
       
    79 //	RMutex                             iSurfaceMapLock;
       
    80     RHashMap<TInt, TSurfaceInfo*>      iSurfaceMap;
       
    81 //private:
       
    82 //	RMutex                             iContextMapLock;
       
    83     RHashMap<EGLContext, CEglContext*> iContextMap;
       
    84     };
       
    85 
       
    86 
       
    87 // prototype to help eglGetProcAddress() API 
       
    88 typedef void (*ProcPointer)(...);
       
    89 
       
    90 
       
    91 // Collection of static functions for processing EGL Attribute Lists
       
    92 class TAttribUtils
       
    93 	{
       
    94 public: // definitions in eglattribs.cpp
       
    95 	static TInt AttribListLength(const EGLint* aAttribList);
       
    96 	static const EGLint* FindAttribValue(const EGLint* aAttribList, EGLint aAttrib);
       
    97 	// NB only use these on AttribLists with adequate space for editing
       
    98 	static EGLint* FindAttribValue(EGLint* aAttribList, EGLint aAttrib);
       
    99 	static void AppendAttribValue(EGLint* aAttribList, EGLint aAttrib, EGLint aValue);
       
   100 	static void RemoveAttrib(EGLint* aAttribList, EGLint aAttrib);
       
   101 #ifdef _DEBUG
       
   102 	// definitions in egldebug.cpp
       
   103 	static void TraceAttribList(const EGLint* aAttribList);
       
   104 	static void TraceAttribNames(EGLint aAttrib, EGLint aValue, char** aAttrName, char** aValueName);
       
   105 	static void TraceGetAttrib(char* aApiName, char* aObjType, EGLDisplay aDisplay, EGLint aObject, EGLint aAttribute, EGLint *aValue, EGLBoolean aResult);
       
   106 	static void TraceSetAttrib(char* aApiName, char* aObjType, EGLDisplay aDisplay, EGLint aObject, EGLint aAttribute, EGLint aValue);
       
   107 #endif
       
   108 	};
       
   109 
       
   110 
       
   111 // CEglContext represents an EGLContext on Host EGL
       
   112 NONSHARABLE_CLASS(CEglContext) : public CBase
       
   113 	{
       
   114 public:
       
   115 	// factory function
       
   116 	static CEglContext* Create(TEglThreadState& aThreadState, EGLDisplay aDisplay, EGLConfig aConfig, CEglContext* aShareContext, const EGLint* aAttribList);
       
   117 	EGLBoolean MakeCurrent(TEglThreadState& aThreadState, EGLSurface aDraw, EGLSurface aRead);
       
   118 	EGLBoolean QueryAttribute(TEglThreadState& aThreadState, EGLint aAttribute, EGLint* aValue);
       
   119 	// These functions return ETrue if they delete themselves 
       
   120 	TBool Destroy(TEglThreadState& aThreadState);
       
   121 	TBool MakeNotCurrent(TEglThreadState& aThreadState);
       
   122 	EGLContext ShareContextFamily();
       
   123 	inline EGLContext HostContext() { return iHostContext; }
       
   124 	inline EGLContext ClientContext() { return iHostContext; }
       
   125 	inline TBool IsDestroyed() { return iIsDestroyed; }
       
   126 
       
   127 private:
       
   128 	CEglContext(EGLDisplay aDisplay, EGLConfig aConfig, EGLContext aShareContextFamily, EGLenum aRenderingApi, EGLint aGlesClientVersion);
       
   129 	void Delete(TEglThreadState& aThreadState);
       
   130 	~CEglContext();
       
   131 private:
       
   132 	RMutex     iCtxMutex;
       
   133 	TBool      iFirstUse;    // for eglMakeCurrent
       
   134 	EGLContext iHostContext; // corresponding Host EGL Context
       
   135 	// info from eglCreateContext & eglMakeCurrent
       
   136 	EGLDisplay iDisplay;
       
   137 	EGLContext iShareContextFamily;
       
   138 	EGLConfig  iConfigId;     // Config id used to create context
       
   139 	EGLenum    iRenderingApi; // set by current bound API at creation
       
   140 	EGLSurface iDrawSurface;  // currently bound draw surface, if any
       
   141 	// for GL ES Contexts
       
   142 	EGLSurface iReadSurface;  // currently bound read surface, if any
       
   143 	EGLint     iGlesClientVersion; // set by EGL_CONTEXT_CLIENT_VERSION attribute at creation (default is 1)
       
   144 	// object lifetime management
       
   145 	TBool      iIsDestroyed;
       
   146 	};
       
   147 
       
   148 
       
   149 NONSHARABLE_CLASS(CEglImage) : public CBase
       
   150 	{
       
   151 public:
       
   152 	CEglImage();
       
   153 	~CEglImage();
       
   154 #ifdef FAISALMEMON_S4_SGIMAGE 
       
   155 	inline void Create(TSgDrawableId aSgImageId, EGLDisplay aDisplay, TSgImageInfo& aSgImageInfo, TInt aPbufferHandle, VGHandle aVgHandle);
       
   156 	TSgDrawableId SgImageId() const;
       
   157 #endif
       
   158 	inline void Duplicate();
       
   159 	inline TBool OpenForVgImage(TSize& aSize, VGHandle& aVgHandle, TUint64& aSgImageId);
       
   160 	inline TBool Close();
       
   161 	inline TBool Destroy();
       
   162 	inline TBool IsDestroyed() const;
       
   163 	inline TInt RefCount();
       
   164 	inline EGLDisplay Display() const;
       
   165 
       
   166 private:
       
   167 #ifdef FAISALMEMON_S4_SGIMAGE
       
   168 	RSgDrawable  iSgHandle;				// Client Handle
       
   169 	TSgImageInfo iSgImageInfo;
       
   170 #endif
       
   171 	EGLDisplay   iDisplay;
       
   172 	TInt         iPbufferHandle;		// Handle of the underlying Pbuffer, if any
       
   173 	VGHandle     iVgHandle;				// Handle of the underlying Host VgImage, if any
       
   174 	TInt         iCreateCount;
       
   175 	TInt         iOpenCount;
       
   176 	TBool        iIsDestroyed;
       
   177 	};
       
   178 
       
   179 const TInt KEglConfigSize = 29;
       
   180 
       
   181 
       
   182 class XGuestEglInitialiser
       
   183 	{
       
   184 public:
       
   185 	XGuestEglInitialiser();
       
   186 	~XGuestEglInitialiser();
       
   187 	};
       
   188 
       
   189 
       
   190 /**
       
   191  *  CCGuestEGL
       
   192  *
       
   193  */
       
   194 NONSHARABLE_CLASS(CGuestEGL) : public CBase, public MEglManagementApi,
       
   195 		public MVgApiForEgl, public MGles11ApiForEgl, public MGles2ApiForEgl
       
   196     {
       
   197 public:
       
   198     // Constructors and destructor
       
   199 
       
   200     /**
       
   201      * Destructor.
       
   202      */
       
   203     ~CGuestEGL();
       
   204 
       
   205     /**
       
   206      * Public constructor.
       
   207      */
       
   208     static CGuestEGL* New();
       
   209 
       
   210 	// class MEglManagementApi - exported as a vtable via CVghwUtils for Open VG and Open GL ES to access EGL info
       
   211 	virtual TBool EglImageOpenForVgImage(EGLImageKHR aImage, TSize& aSize, VGHandle& aVgHandle, TUint64& aSgImageId);
       
   212 	virtual void EglImageClose(EGLImageKHR aImage);
       
   213 
       
   214 
       
   215 	// Private interfaces for EGL to call into Open VG & Open GL ES 
       
   216 	// class MVgApiForEgl - redirects via CVghwUtils to exported functions from Open VG
       
   217 	virtual ExtensionProcPointer guestGetVgProcAddress (const char *aProcName);
       
   218 	// class MGles11ApiForEgl - redirects via CVghwUtils to exported functions from Open GL ES 1.1
       
   219 	virtual ExtensionProcPointer guestGetGles11ProcAddress (const char *aProcName);
       
   220 	// class MGles2ApiForEgl - redirects via CVghwUtils to exported functions from Open GL ES 2
       
   221 	virtual ExtensionProcPointer guestGetGles2ProcAddress (const char *aProcName);
       
   222 
       
   223 
       
   224 	// public support functions for EGL C API
       
   225 	static EGLint CheckColorAttributes(const EGLint* aAttribList, EGLint aColorBufferType, EGLint aLuminanceBits,
       
   226 			EGLint aRedBits, EGLint aGreenBits, EGLint aBlueBits, EGLint aAlphaBits=0);
       
   227 	static void AppendColorAttributes(EGLint* aAttribList, EGLint aColorBufferType, EGLint aLuminanceBits, EGLint aRedBits,
       
   228 			EGLint aGreenBits, EGLint aBlueBits, EGLint aAlphaBits=0, TBool aSetVgPreMultAlpha=EFalse);
       
   229 
       
   230 	const char *QueryExtensionList();
       
   231 
       
   232 	// ToDo probably remove this after EGL Sync refactoring
       
   233 	void SetError( EGLint aError );
       
   234 	void DestroySurfaceInfo(EGLDisplay aDisplay, EGLSurface aSurface);
       
   235 
       
   236 	// static functions directly implementing an EGL API
       
   237 	ProcPointer eglGetProcAddress(const char *aProcName);
       
   238 
       
   239 	// functions directly implementing an EGL API
       
   240 	EGLBoolean eglBindTexImage(TEglThreadState& aThreadState, EGLDisplay aDisplay, EGLSurface aSurface, EGLint aBuffer);
       
   241 	EGLBoolean eglChooseConfig(TEglThreadState& aThreadState, EGLDisplay aDisplay, const EGLint *aAttribList,
       
   242 				   EGLConfig *aConfigs, EGLint aConfigSize, EGLint *aNumConfig);
       
   243 	EGLBoolean eglCopyBuffers(TEglThreadState& aThreadState, EGLDisplay aDisplay, EGLSurface aSurface, EGLNativePixmapType aTarget);
       
   244 	EGLContext eglCreateContext(TEglThreadState& aThreadState, EGLDisplay aDisplay, EGLConfig aConfig,
       
   245 					EGLContext aShareContext, const EGLint *aAttribList);
       
   246 	EGLImageKHR eglCreateImageKHR(TEglThreadState& aThreadState, EGLDisplay aDisplay, EGLContext aContext, EGLenum aTarget,
       
   247 			EGLClientBuffer aBuffer, const EGLint *aAttribList);
       
   248 	EGLSurface eglCreatePbufferFromClientBuffer(TEglThreadState& aThreadState, EGLDisplay aDisplay, EGLenum aBufType,
       
   249 			EGLClientBuffer aBuffer, EGLConfig aConfig, const EGLint *aAttribList);
       
   250 	EGLSurface eglCreatePbufferSurface(TEglThreadState& aThreadState, EGLDisplay aDisplay, EGLConfig aConfig, const EGLint *aAttribList);
       
   251 	EGLSurface eglCreatePixmapSurface(TEglThreadState& aThreadState, EGLDisplay aDisplay, EGLConfig aConfig, 
       
   252 			EGLNativePixmapType aNativePixmap, const EGLint *aAttribList);
       
   253 	EGLSurface eglCreateWindowSurface(TEglThreadState& aThreadState, EGLDisplay aDisplay, EGLConfig aConfig, 
       
   254 			EGLNativeWindowType aNativeWindow, const EGLint *aAttribList);
       
   255 	EGLBoolean eglDestroyContext(TEglThreadState& aThreadState, EGLDisplay aDisplay, EGLContext aContext);
       
   256 	EGLBoolean eglDestroyImageKHR(TEglThreadState& aThreadState, EGLDisplay aDisplay, EGLImageKHR aImage);
       
   257 	EGLBoolean eglDestroySurface(TEglThreadState& aThreadState, EGLDisplay aDisplay, EGLSurface aSurface);
       
   258 	EGLBoolean eglGetConfigAttrib(TEglThreadState& aThreadState, EGLDisplay aDisplay, EGLConfig aConfig,
       
   259 				      EGLint aAttribute, EGLint *aValue);
       
   260 	EGLBoolean eglGetConfigs(TEglThreadState& aThreadState, EGLDisplay aDisplay, EGLConfig *aConfigs,
       
   261 				 EGLint aConfigSize, EGLint *aNumConfig);
       
   262 	EGLContext eglGetCurrentContext(TEglThreadState& aThreadState);
       
   263 	EGLDisplay eglGetCurrentDisplay(TEglThreadState& aThreadState);
       
   264 	EGLSurface eglGetCurrentSurface(TEglThreadState& aThreadState, EGLint aReadDraw);
       
   265 	EGLDisplay eglGetDisplay(TEglThreadState& aThreadState, EGLNativeDisplayType aDisplayId);
       
   266 	EGLBoolean eglInitialize(TEglThreadState& aThreadState, EGLDisplay aDisplay, EGLint *aMajor, EGLint *aMinor);
       
   267 	EGLBoolean eglMakeCurrent(TEglThreadState& aThreadState, EGLDisplay aDisplay, EGLSurface aDraw, EGLSurface aRead,
       
   268 			EGLContext aContext);
       
   269 	EGLBoolean eglQueryContext(TEglThreadState& aThreadState, EGLDisplay aDisplay, EGLContext aContext, EGLint aAttribute, EGLint *aValue);
       
   270 	const char* eglQueryString(EGLDisplay aDisplay, EGLint aName);
       
   271 	EGLBoolean eglQuerySurface(TEglThreadState& aThreadState, EGLDisplay aDisplay, EGLSurface aSurface, EGLint aAttribute,
       
   272 			EGLint *aValue);
       
   273 	EGLBoolean eglReleaseTexImage(TEglThreadState& aThreadState, EGLDisplay aDisplay, EGLSurface aSurface, EGLint aBuffer);
       
   274 	EGLBoolean eglSurfaceAttrib(TEglThreadState& aThreadState, EGLDisplay aDisplay, EGLSurface aSurface,
       
   275 				    EGLint aAttribute, EGLint aValue);
       
   276 	EGLBoolean eglSwapBuffers(TEglThreadState& aThreadState, EGLDisplay aDisplay, EGLSurface aSurface);
       
   277 	EGLBoolean eglSwapInterval(TEglThreadState& aThreadState, EGLDisplay aDisplay, EGLint aInterval);
       
   278 	EGLBoolean eglTerminate(TEglThreadState& aThreadState, EGLDisplay aDisplay);
       
   279 	EGLBoolean eglWaitClient(TEglThreadState& aThreadState);
       
   280 
       
   281 public:
       
   282     // API supporting EGL sync extension
       
   283     /*-------------------------------------------------------------------*//*!
       
   284      * \brief   Query and request to lock a specified display
       
   285      * \ingroup eglSync
       
   286      * \param   aEglDisplay a display identifier
       
   287      * \return  EGL_SUCCESS if successful;
       
   288      *          EGL_BAD_DISPLAY is not a name of a valid EGLDisplay
       
   289      *          EGL_NOT_INITIALIZED if the display object associated
       
   290      *          with the <aEglDisplay> has not been initialized
       
   291      *//*-------------------------------------------------------------------*/
       
   292     EGLint FindAndLockDisplay(EGLDisplay aDisplay);
       
   293 
       
   294     /*-------------------------------------------------------------------*//*!
       
   295      * \brief   Releases the lock associated with a valid EGLDisplay
       
   296      * \ingroup eglSync
       
   297      * \param   aEglDisplay a display identifier
       
   298      *//*-------------------------------------------------------------------*/
       
   299     void ReleaseDisplayLock(EGLDisplay aDisplay);
       
   300 
       
   301     /*-------------------------------------------------------------------*//*!
       
   302      * \brief   Returns pointer to the EGL sync instance
       
   303      * \ingroup eglSync
       
   304      *//*-------------------------------------------------------------------*/
       
   305     CEglSyncExtension* EGLSyncExtension();
       
   306 
       
   307 private:
       
   308     /**
       
   309      * private constructor, 2nd phase constructor
       
   310      */
       
   311 	CGuestEGL();
       
   312 	void Create();
       
   313 	void CloseSgResources();
       
   314 	void OpenSgResources();
       
   315 
       
   316 	// private function with "EglInternalFunction_" prefix
       
   317 	TBool EglInternalFunction_CreateSurface(TEglThreadState& aThreadState, EGLDisplay aDisplay, EGLSurface aSurface, EGLConfig aConfig, RWindow* aNativeWindow, TSurfaceInfo& aSurfaceInfo);
       
   318 	void EglInternalFunction_DestroyWindowSurface(TSurfaceInfo& aSurfaceInfo);
       
   319 	TUidPixelFormat EglInternalFunction_GetSymbianPixelFormat(const TSurfaceInfo& aSurfaceInfo);
       
   320 	EGLBoolean EglInternalFunction_CallSetSurfaceParams(TEglThreadState& aThreadState, EGLDisplay aDisplay, EGLSurface aSurface, TSurfaceInfo& aSurfaceInfo);
       
   321 	TBool EglInternalFunction_PixmapSurfacePreviouslyCreated(EGLNativePixmapType pixmap, TSymbianPixmapTypeId pixmapType);
       
   322 	static TSymbianPixmapTypeId EglInternalFunction_GetNativePixmapType(EGLNativePixmapType pixmap);
       
   323 	const char* EglInternalFunction_QueryExtensionList();
       
   324 	TBool EglInternalFunction_IsValidNativePixmap(EGLNativePixmapType pixmap, TSymbianPixmapTypeId pixmapType);
       
   325 	EGLBoolean EglInternalFunction_SurfaceResized(TEglThreadState& aThreadState, TSurfaceInfo& aSurfaceInfo, EGLDisplay aDisplay, EGLSurface aSurface);
       
   326 	TSurfaceInfo* EglInternalFunction_GetPlatformSurface( EGLDisplay display, EGLSurface surface );
       
   327 	void EglInternalFunction_AbortWindowInit(TEglThreadState& aThreadState, EGLDisplay aDisplay, EGLSurface aSurface, TSurfaceInfo* ps, RWindow* window, CWsScreenDevice* screenDevice);
       
   328 	TBool EglInternalFunction_SwapWindowSurface(TEglThreadState& aThreadState, EGLDisplay aDisplay, EGLSurface aSurface);
       
   329 	TInt EglInternalFunction_GetPitch( RWindow* aNativeWindow, TInt& aHorizontalPitch, TInt& aVerticalPitch );
       
   330 	TBool EglInternalFunction_MetaGetConfigs( TEglThreadState& aThreadState, EGLConfig*& aConfigs, EGLint& aConfigCnt, EGLint*& aConfigAttribs, EGLint& aConfigAttribsLen, TMetaGetConfigsMode aFetchMode = EMetaGetConfigsSg );
       
   331 
       
   332 	// more private functions
       
   333 	
       
   334 	EGLint ConfigMatchesFbsBitmapPixmap(TEglThreadState& aThreadState, EGLDisplay aDisplay, EGLConfig aConfig, const EGLint* aAttribList, TDisplayMode aMode);
       
   335 	EGLBoolean ChooseConfigForPixmapSurface(TEglThreadState& aThreadState, EGLDisplay aDisplay, const EGLint* aAttribList, EGLConfig* aConfigs, EGLint aConfigSize,
       
   336 			EGLint* aNumConfig, const void* aPixmap);
       
   337 	EGLSurface CreateFbsBitmapSurface(TEglThreadState& aThreadState, EGLDisplay aDisplay, EGLConfig aConfig, CFbsBitmap* aBitmap, const EGLint *aAttribList, TSurfaceInfo& aSurfaceInfo);
       
   338 	
       
   339 	EGLint ChooseConfigAttribsForFbsBitmap(TEglThreadState& aThreadState, const EGLint* aAttribList, const CFbsBitmap* aBitmap, EGLint** aNewList);
       
   340 	
       
   341 	EGLint ValidateEglImageTarget(EGLDisplay aDisplay, EGLContext aContext, EGLenum aTarget,
       
   342 			EGLClientBuffer aBuffer, const EGLint *aAttribList, TSymbianPixmapTypeId aTargetPixmapType);
       
   343 	
       
   344 	
       
   345 	TBool CreateDisplayInfo(EGLDisplay aDisplay);
       
   346 	TBool InitializeDisplayInfo(EGLDisplay aDisplay);
       
   347 	TBool IsDisplayInitialized(EGLDisplay aDisplay);
       
   348 	TBool DestroyDisplayInfo(EGLDisplay aDisplay);
       
   349     
       
   350 #ifdef FAISALMEMON_S4_SGIMAGE
       
   351     EGLSurface CreateSgImageSurface(TEglThreadState& aThreadState, EGLDisplay aDisplay, EGLConfig aConfig, const RSgImage* aSgImage, const EGLint *aAttribList,
       
   352 			TSurfaceInfo& aSurfaceInfo);
       
   353     EGLImageKHR CreateNewEglImage(TEglThreadState& aThreadState, EGLDisplay aDisplay, TSgDrawableId aSgId, TSgImageInfo aSgImageInfo);
       
   354     EGLImageKHR DuplicateEglImageIfItExists(EGLDisplay aDisplay, TSgDrawableId aSgId);
       
   355     EGLint ChooseConfigAttribsForSgImage(TEglThreadState& aThreadState, const EGLint* aAttribList, const RSgImage* aSgImage, EGLint** aNewList);
       
   356     EGLBoolean ChooseConfigForNativeSgImagePixmapSurface(TEglThreadState& aThreadState, EGLDisplay aDisplay, const EGLint* aAttribList, EGLConfig* aConfigs, EGLint aConfigSize,
       
   357 			EGLint* aNumConfig, const EGLint* aPixmap);
       
   358 #endif
       
   359 private:
       
   360 	//new methods supporting EGL Sync extension
       
   361 	EGLint InitialiseExtensions();
       
   362 
       
   363 private:
       
   364 	RReadWriteLock				 iDisplayMapLock; // protects the iDisplayMap for multi-threaded clients
       
   365 	RHashMap<TInt, CEglDisplayInfo*> iDisplayMap;
       
   366 
       
   367 	RMutex                       iEglImageLock; // protects the iEglImageArray for multi-threaded clients
       
   368 	RPointerArray<CEglImage>     iEglImageArray; // ToDo use a Unique Id for the index/handle, rather than the object address
       
   369 
       
   370 #ifdef FAISALMEMON_S4_SGIMAGE
       
   371 	EGLint* iSgConfigAttribs;
       
   372 	EGLint  iSgConfigsAttribtCnt;
       
   373 	// ToDo (SgImage Design Spec 3.5) ARM EGL should maintain its own lists of native window handles, pixmap handles etc
       
   374 
       
   375 	char* iEglExtnNameList; // supporting data for eglQueryString()
       
   376     RSgDriver                    iSgDriver;
       
   377 #endif
       
   378 	//data members supporting EGL Sync extension
       
   379 	CEglSyncExtension* iEglSyncExtension;
       
   380 	// vtable pointers populated from CVghwUtils - to access Open VG & GL ES internals, e.g. to support eglGetProcAddress
       
   381 	MVgApiForEgl*        iVgApiForEgl;
       
   382 	MGles11ApiForEgl*    iGles11ApiForEgl;
       
   383 	MGles2ApiForEgl*     iGles2ApiForEgl;
       
   384 	};
       
   385 
       
   386 
       
   387 /* Execute host EGL functions that cannot fail
       
   388    These functions do not set the flag to say that an EGL command has been executed since the last host eglGetError.
       
   389    */
       
   390 
       
   391 inline EGLContext ExecEglContextNoErrorCmd(TEglThreadState& aThreadState, EglRFC& aEglApiData)
       
   392 	{
       
   393 	aThreadState.ExecuteEglNeverErrorCmd(aEglApiData);
       
   394 	return (EGLContext) aEglApiData.ReturnValue();
       
   395 	}
       
   396 
       
   397 inline EGLSurface ExecEglSurfaceNoErrorCmd(TEglThreadState& aThreadState, EglRFC& aEglApiData)
       
   398 	{
       
   399 	aThreadState.ExecuteEglNeverErrorCmd(aEglApiData);
       
   400 	return (EGLSurface) aEglApiData.ReturnValue();
       
   401 	}
       
   402 
       
   403 inline EGLDisplay ExecEglDisplayNoErrorCmd(TEglThreadState& aThreadState, EglRFC& aEglApiData)
       
   404 	{
       
   405 	aThreadState.ExecuteEglNeverErrorCmd(aEglApiData);
       
   406 	return (EGLDisplay) aEglApiData.ReturnValue();
       
   407 	}
       
   408 
       
   409 
       
   410 #endif // __GUEST__EGL_H