graphicsresourceservices/graphicsresourceimplementation/inc/sgdeviceimpl.h
branchRCL_3
changeset 19 bbf46f59e123
equal deleted inserted replaced
18:57c618273d5c 19:bbf46f59e123
       
     1 // Copyright (c) 2009 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 // Graphics Resource - logical device driver internal functionality
       
    15 //
       
    16 
       
    17 #ifndef SGDEVICEIMPL_H
       
    18 #define SGDEVICEIMPL_H
       
    19 
       
    20 #include <kernel/kernel.h>
       
    21 #include <sgresource/sgdevice.h>
       
    22 
       
    23 enum TSgDevicePanicReason
       
    24 	{
       
    25 	ESgPanicMetaDataSizeTooBig = 1,
       
    26 	ESgPanicDataSizeNegative = 2
       
    27 	};
       
    28 
       
    29 void Panic(TSgDevicePanicReason aReason);
       
    30 
       
    31 class DSgDevice: public DLogicalDevice
       
    32 	{
       
    33 public:
       
    34 	// From DLogicalDevice
       
    35 	TInt Install();
       
    36 	void GetCaps(TDes8& aDes) const;
       
    37 	TInt Create(DLogicalChannelBase*& aChannel);
       
    38 	};
       
    39 
       
    40 class DSgResource;
       
    41 
       
    42 class DSgChannel: public DLogicalChannelBase
       
    43 	{
       
    44 public:
       
    45 	~DSgChannel();
       
    46 	// From DLogicalChannelBase
       
    47 	TInt DoCreate(TInt aUnit, const TDesC8* aInfo, const TVersion& aVersion);
       
    48 	TInt Request(TInt aFunction, TAny* a1, TAny* a2);
       
    49 private:
       
    50 	TInt CreateResource(TUint32 aAttribs, const TDesC8& aMetaData, TInt aDataSize, TUint64& aId);
       
    51 	TInt OpenResource(TUint64 aId);
       
    52 	TInt CloseResource(TUint64 aId);
       
    53 	TUint32 ResourceAttributes(TUint64 aId) const;
       
    54 	TInt GetResourceMetaData(TUint64 aId, TDes8& aMetaData) const;
       
    55 	TAny* ResourceDataAddress(TUint64 aId) const;
       
    56 	TInt ResourceDataSize(TUint64 aId) const;
       
    57 	TInt GlobalResourceCount() const;
       
    58 	TInt LocalGraphicsMemoryUsed() const;
       
    59 	TInt GlobalGraphicsMemoryUsed() const;
       
    60 private:
       
    61 	class TResourceListItem
       
    62 		{
       
    63 	public:
       
    64 		TResourceListItem(DSgResource* aResource, TInt aChunkHandle);
       
    65 	public:
       
    66 		DSgResource* iResource;
       
    67 		TInt iChunkHandle;
       
    68 		};
       
    69 private:
       
    70 	static TInt Compare(const TUint64* aId, const TResourceListItem& aResourceListItem);
       
    71 	static TInt Compare(const TResourceListItem& aResourceListItem1, const TResourceListItem& aResourceListItem2);
       
    72 private:
       
    73 	DMutex* iMutex;
       
    74 	RArray<TResourceListItem> iResources;
       
    75 	};
       
    76 
       
    77 #endif // SGDEVICEIMPL_H