kernel/eka/include/drivers/display.h
changeset 4 56f325a607ea
parent 0 a41df078684a
equal deleted inserted replaced
2:4122176ea935 4:56f325a607ea
     9 // Nokia Corporation - initial contribution.
     9 // Nokia Corporation - initial contribution.
    10 //
    10 //
    11 // Contributors:
    11 // Contributors:
    12 //
    12 //
    13 // Description:
    13 // Description:
    14 // e32\include\drivers\display.h 
    14 // os\kernelhwsrv\kernel\eka\include\drivers\display.h 
    15 // Interface to LDD of the Display GCE driver
    15 // Interface to LDD of the Display GCE driver
    16 // Kernel side definitions for the GCE driver
    16 // Kernel side definitions for the GCE driver
    17 // 
       
    18 //
    17 //
    19 
    18 
    20 /**
    19 /**
    21  @file
    20  @file
    22  @internalTechnology
    21  @internalTechnology
    39 const TInt KDisplayUBMax = 8;
    38 const TInt KDisplayUBMax = 8;
    40 
    39 
    41 
    40 
    42 const TInt KPendingReqArraySize  = RDisplayChannel::EReqWaitForPost +1;
    41 const TInt KPendingReqArraySize  = RDisplayChannel::EReqWaitForPost +1;
    43   
    42   
       
    43 const TInt KMaxQueuedRequests 	 = 3;
    44 
    44 
    45 class DDisplayChannel;
    45 class DDisplayChannel;
    46 
    46 
    47 
    47 
    48 enum TBufferType
    48 enum TBufferType
    82 /**
    82 /**
    83 An object encapsulating a request from the client(iOwningThread) to the GCE driver. 
    83 An object encapsulating a request from the client(iOwningThread) to the GCE driver. 
    84 */ 
    84 */ 
    85 typedef struct
    85 typedef struct
    86 {
    86 {
    87 	  /** The request status associated with the request - used to signal completion of the request and pass back a
    87 	  
       
    88 	  /** The TClientRequest object associated with the request - used to signal completion of the request and pass back a
    88 	   completion code. */
    89 	   completion code. */
    89 	  TRequestStatus* 	iStatus;
    90 	  TClientRequest*   iTClientReq;
    90 	  
    91 	  
    91 	  /** The thread which issued the request and which supplied the request status. */
    92 	  /** The thread which issued the request and which supplied the request status. */
    92 	  DThread* 			iOwningThread;
    93 	  DThread* 			iOwningThread;
    93 	  
    94 	  
    94 } TRequestNode;
    95 } TRequestNode;
   142 	DDisplayLdd();
   143 	DDisplayLdd();
   143 
   144 
   144 private:
   145 private:
   145 	// Implementation for the differnt kinds of messages sent through RBusLogicalChannel
   146 	// Implementation for the differnt kinds of messages sent through RBusLogicalChannel
   146 	TInt  			DoControl(TInt aFunction, TAny* a1, TAny* a2, DThread* aClient);
   147 	TInt  			DoControl(TInt aFunction, TAny* a1, TAny* a2, DThread* aClient);
   147 	TInt  			DoRequest(TInt aReqNo, TRequestStatus* aStatus, TAny* a1, TAny* a2, DThread* aClient);
   148 	TInt  			DoRequest(TInt aReqNo, TAny* a1, TAny* a2,  TInt index, DThread* aClient);
   148 	void  			DoCancel(TUint aMask);
   149 	void  			DoCancel(TUint aMask);
   149            
   150 	
       
   151 	TInt 		    SendRequest(TMessageBase* aMsg);
       
   152 	TInt 		    SendControl(TMessageBase* aMsg);
       
   153 	TInt 		    SendMsg(TMessageBase* aMsg);	 
   150        
   154        
   151     TBufferNode*  	FindUserBufferNode(TInt aBufferId);  
   155     TBufferNode*  	FindUserBufferNode(TInt aBufferId);  
   152     TInt 			CheckAndOpenUserBuffer(TBufferNode* aNode, TInt aHandle, TInt aOffset, DThread* aClient);         
   156     TInt 			CheckAndOpenUserBuffer(TBufferNode* aNode, TInt aHandle, TInt aOffset, DThread* aClient);         
   153     TInt  			FreeUserBufferNode(TBufferNode* aNode);
   157     TInt  			FreeUserBufferNode(TBufferNode* aNode);
   154     
   158     
   155     void 			CompleteRequest(DThread* aThread,TRequestStatus*& aStatus,TInt aReason);
   159     void 			CompleteRequest(DThread* aThread, TClientRequest*& aTClientReq, TInt aReason);
   156           
   160           
   157     DDisplayPdd * 	Pdd();  
   161     DDisplayPdd * 	Pdd();  
   158     	
   162     	
   159 public: 	
   163 public: 	
   160  	virtual TInt 	RequestComplete(TInt aRequest, TInt );
   164  	virtual TInt 	RequestComplete(TInt aRequest, TInt );
   178     TBufferNode 	iLegacyBuffer[KDisplayLBMax];
   182     TBufferNode 	iLegacyBuffer[KDisplayLBMax];
   179     TBufferNode 	iCompositionBuffer[KDisplayCBMax];
   183     TBufferNode 	iCompositionBuffer[KDisplayCBMax];
   180     TBufferNode 	iUserBuffer[KDisplayUBMax];
   184     TBufferNode 	iUserBuffer[KDisplayUBMax];
   181      
   185      
   182     //pending queue for asynchronous requests
   186     //pending queue for asynchronous requests
   183     TRequestNode 	iPendingReq[KPendingReqArraySize];
   187     TRequestNode 	iPendingReq[KPendingReqArraySize][KMaxQueuedRequests];
       
   188         
       
   189     //Queue of TClientRequest objects, one for each type of asynchronous request.
       
   190     TClientRequest* iClientRequest[KPendingReqArraySize][KMaxQueuedRequests];
       
   191 	
       
   192 	//The index in structures iPendingReq and iClientRequest that identifies the active TClientRequest object.
       
   193 	//For each type of asynchronous request, iPendingIndex is the index of the active TClientRequest object 
       
   194 	//in iPendingReq
       
   195 	TInt			iPendingIndex[KPendingReqArraySize];
       
   196     
       
   197     // Protect access of iClientRequest
       
   198     DMutex * 		 iClientRequestMutex;
       
   199     
   184      
   200      
   185     // current index
   201     // current index
   186     TInt    		iLegacyBuffIdx;
   202     TInt    		iLegacyBuffIdx;
   187 	TInt    		iCompositionBuffIdx;
   203 	TInt    		iCompositionBuffIdx;
   188     TInt    		iUserBuffIdx;
   204     TInt    		iUserBuffIdx;
   189      
   205      
   190     // rotations
   206     
   191     TInt    		iLegacyRotation;
   207     RDisplayChannel::TDisplayRotation 	iLegacyRotation;
   192     TInt    		iCurrentRotation;
   208     RDisplayChannel::TDisplayRotation   iCurrentRotation;
       
   209     
   193     
   210     
   194     TBool    		iReady;  
   211     TBool    		iReady;  
   195     
   212     
   196     /** Used in debug builds to track that all calls to DThread::Open() are balanced with a close before the driver closes. */
   213     /** Used in debug builds to track that all calls to DThread::Open() are balanced with a close before the driver closes. */
   197 	TInt iThreadOpenCount; 
   214 	TInt iThreadOpenCount; 
   198      
   215 	
       
   216 	/** Used in debug builds to track the number of asynchronous requests that are queued is equal to the number of 
       
   217 	requests that are completed, before the driver closes.*/
       
   218 	TInt iAsyncReqCount; 
       
   219 
       
   220 	/** Chunk used in UDEB only for testing user buffers. */
       
   221 	DChunk*	iChunk;
   199 	};
   222 	};
   200 
   223 
   201 
   224 
   202  /**
   225  /**
   203     Display PDD base class with GCE support.
   226     Display PDD base class with GCE support.
   225      /**
   248      /**
   226      Called by the LDD to handle the device specific part of setting the rotation.
   249      Called by the LDD to handle the device specific part of setting the rotation.
   227      
   250      
   228      @return KErrNone if successful; or one of the other system wide error codes.
   251      @return KErrNone if successful; or one of the other system wide error codes.
   229      */       
   252      */       
   230     virtual TInt  SetRotation(TInt aRotation)=0;
   253     virtual TInt  SetRotation(RDisplayChannel::TDisplayRotation aRotation)=0;
   231 
   254 
   232      /**
   255      /**
   233      Called by the LDD to handle the device specific part of posting a User Buffer.
   256      Called by the LDD to handle the device specific part of posting a User Buffer.
   234      
   257      
   235      @return KErrNone if successful; or one of the other system wide error codes.
   258      @return KErrNone if successful; or one of the other system wide error codes.
   314 inline TInt DDisplayPdd::RequestComplete(TInt aRequest, TInt aReason)
   337 inline TInt DDisplayPdd::RequestComplete(TInt aRequest, TInt aReason)
   315 	{ return iLdd->RequestComplete(aRequest,aReason); }
   338 	{ return iLdd->RequestComplete(aRequest,aReason); }
   316 
   339 
   317 
   340 
   318 
   341 
       
   342 
   319 //#define _GCE_DISPLAY_DEBUG
   343 //#define _GCE_DISPLAY_DEBUG
   320 
   344 
   321 #ifdef _GCE_DISPLAY_DEBUG
   345 #ifdef _GCE_DISPLAY_DEBUG
   322 
   346 
   323 #define  __DEBUG_PRINT(a) 		Kern::Printf(a)
   347 #define  __DEBUG_PRINT(a) 			Kern::Printf(a)
   324 #define  __DEBUG_PRINT2(a,b) 	Kern::Printf(a,b)
   348 #define  __DEBUG_PRINT2(a,b) 		Kern::Printf(a,b)
       
   349 #define  __DEBUG_PRINT3(a,b,c) 		Kern::Printf(a,b,c)
       
   350 #define  __DEBUG_PRINT4(a,b,c,d) 	Kern::Printf(a,b,c,d)
       
   351 #define  __DEBUG_PRINT5(a,b,c,d,e) 	Kern::Printf(a,b,c,d,e)
   325 
   352 
   326 #else
   353 #else
   327 
       
   328 #define  __DEBUG_PRINT(a)
   354 #define  __DEBUG_PRINT(a)
   329 #define  __DEBUG_PRINT2(a,b)
   355 #define  __DEBUG_PRINT2(a,b)
       
   356 #define  __DEBUG_PRINT3(a,b,c)
       
   357 #define  __DEBUG_PRINT4(a,b,c,d) 
       
   358 #define  __DEBUG_PRINT5(a,b,c,d,e)
   330 
   359 
   331 #endif
   360 #endif
   332 
   361 
   333 
   362 
   334 #endif	// __DISPLAY_H__ 
   363 #endif	// __DISPLAY_H__