|
1 // Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #ifndef KHRONOSAPIWRAPPER_H |
|
17 #define KHRONOSAPIWRAPPER_H |
|
18 |
|
19 #ifndef PSU_PLATFORMTHREADING_H |
|
20 #include "platformthreading.h" |
|
21 #endif |
|
22 |
|
23 #ifndef PSU_PLATFORMTYPES_H |
|
24 #include "platformtypes.h" |
|
25 #endif |
|
26 |
|
27 #include "requestbuffer.h" |
|
28 |
|
29 class APIWrapperStack; |
|
30 class RemoteFunctionCall; |
|
31 class RemoteFunctionCallData; |
|
32 class DriverAPIWrapper; |
|
33 class OpenVGAPIWrapper; |
|
34 class EGLAPIWrapper; |
|
35 class OGLES11Wrapper; |
|
36 |
|
37 #define KHRONOS_API_W_MULTITHREAD |
|
38 |
|
39 #ifdef WIN32 |
|
40 #ifdef KHRONOSAPIWRAPPER_EXPORTS |
|
41 #define KHRONOSAPIWRAPPER_API __declspec(dllexport) |
|
42 #else |
|
43 #define KHRONOSAPIWRAPPER_API __declspec(dllimport) |
|
44 #endif |
|
45 #else |
|
46 #define KHRONOSAPIWRAPPER_API |
|
47 #endif |
|
48 |
|
49 class MGraphicsVHWCallback; |
|
50 |
|
51 class KHRONOSAPIWRAPPER_API KhronosAPIWrapper: private MRequestBufferBookKeepingReader |
|
52 { |
|
53 public: |
|
54 |
|
55 KhronosAPIWrapper( MGraphicsVHWCallback* aServiceIf, void* framebuffer, |
|
56 void* inputdata, void* outputdata ); |
|
57 ~KhronosAPIWrapper(); |
|
58 |
|
59 void WorkerThread(); |
|
60 |
|
61 unsigned long Execute(); |
|
62 unsigned long InputParameterOffset(); |
|
63 |
|
64 void SetInputBufferTail(uint32_t p_val); |
|
65 uint32_t InputBufferTail(); |
|
66 void SetInputBufferHead(uint32_t p_val); |
|
67 uint32_t InputBufferHead(); |
|
68 void SetInputBufferReadCount(uint32_t p_val); |
|
69 uint32_t InputBufferReadCount(); |
|
70 void SetInputBufferWriteCount(uint32_t p_val); |
|
71 uint32_t InputBufferWriteCount(); |
|
72 void IncrementInputBufferReadCount( TUint32 aReadCount ); |
|
73 TUint32 InputMaxTailIndex(); |
|
74 void SetInputMaxTailIndex( TUint32 aIndex ); |
|
75 |
|
76 //For the purpose of wrappers that need each other's services |
|
77 DriverAPIWrapper* GetDriverWrapper() { return m_DriverAPIWrapper; } |
|
78 EGLAPIWrapper* GetEGLWrapper() { return m_EGLWrapper; } |
|
79 |
|
80 private: |
|
81 //From MRequestBufferBookKeeping |
|
82 TUint32 GetWriteCount(); |
|
83 void IncrementReadCount( TUint32 aReadCount ); |
|
84 TUint32 GetReadCount(); |
|
85 |
|
86 TUint32 BufferTail(); |
|
87 void SetBufferTail( TUint32 aIndex ); |
|
88 TUint32 BufferHead(); |
|
89 |
|
90 TUint32 MaxTailIndex(); |
|
91 void SetMaxTailIndex( TUint32 aIndex ); |
|
92 |
|
93 protected: |
|
94 int HandleNextRequest(); |
|
95 bool m_initDone; |
|
96 void* m_currentResult; |
|
97 void* m_currentInput; |
|
98 MGraphicsVHWCallback* iServiceIf; |
|
99 Psu::PLATFORM_THREAD_T m_threadHandle; |
|
100 Psu::PLATFORM_SEMAPHORE_T m_SemapHandle; |
|
101 bool m_exit; |
|
102 void* m_frameBuffer; |
|
103 |
|
104 //Input buffer |
|
105 Psu::PLATFORM_MUTEX_T m_InputBufferMutex; |
|
106 uint32_t m_InputBufferTail; |
|
107 uint32_t m_InputBufferHead; |
|
108 uint32_t m_InputBufferReadCount; |
|
109 uint32_t m_InputbufferWriteCount; |
|
110 uint32_t m_InputBufferMaxTailIndex; |
|
111 private: |
|
112 RequestBufferReader* m_InputRequestBuffer; |
|
113 APIWrapperStack* iStack; |
|
114 TUint32 m_lastProcessId; |
|
115 TUint32 m_lastThreadId; |
|
116 int m_lastVgError; |
|
117 int m_lastEglError; |
|
118 DriverAPIWrapper* m_DriverAPIWrapper; |
|
119 OpenVGAPIWrapper* m_OpenVGWrapper; |
|
120 OGLES11Wrapper* m_OGLESWrapper; |
|
121 EGLAPIWrapper* m_EGLWrapper; |
|
122 |
|
123 RemoteFunctionCallData* iRFCData; |
|
124 }; |
|
125 #endif |