os/graphics/graphicsresourceservices/graphicsresourceimplementation/inc/sgdeviceimpl.h
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/graphics/graphicsresourceservices/graphicsresourceimplementation/inc/sgdeviceimpl.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,77 @@
1.4 +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// Graphics Resource - logical device driver internal functionality
1.18 +//
1.19 +
1.20 +#ifndef SGDEVICEIMPL_H
1.21 +#define SGDEVICEIMPL_H
1.22 +
1.23 +#include <kernel/kernel.h>
1.24 +#include <sgresource/sgdevice.h>
1.25 +
1.26 +enum TSgDevicePanicReason
1.27 + {
1.28 + ESgPanicMetaDataSizeTooBig = 1,
1.29 + ESgPanicDataSizeNegative = 2
1.30 + };
1.31 +
1.32 +void Panic(TSgDevicePanicReason aReason);
1.33 +
1.34 +class DSgDevice: public DLogicalDevice
1.35 + {
1.36 +public:
1.37 + // From DLogicalDevice
1.38 + TInt Install();
1.39 + void GetCaps(TDes8& aDes) const;
1.40 + TInt Create(DLogicalChannelBase*& aChannel);
1.41 + };
1.42 +
1.43 +class DSgResource;
1.44 +
1.45 +class DSgChannel: public DLogicalChannelBase
1.46 + {
1.47 +public:
1.48 + ~DSgChannel();
1.49 + // From DLogicalChannelBase
1.50 + TInt DoCreate(TInt aUnit, const TDesC8* aInfo, const TVersion& aVersion);
1.51 + TInt Request(TInt aFunction, TAny* a1, TAny* a2);
1.52 +private:
1.53 + TInt CreateResource(TUint32 aAttribs, const TDesC8& aMetaData, TInt aDataSize, TUint64& aId);
1.54 + TInt OpenResource(TUint64 aId);
1.55 + TInt CloseResource(TUint64 aId);
1.56 + TUint32 ResourceAttributes(TUint64 aId) const;
1.57 + TInt GetResourceMetaData(TUint64 aId, TDes8& aMetaData) const;
1.58 + TAny* ResourceDataAddress(TUint64 aId) const;
1.59 + TInt ResourceDataSize(TUint64 aId) const;
1.60 + TInt GlobalResourceCount() const;
1.61 + TInt LocalGraphicsMemoryUsed() const;
1.62 + TInt GlobalGraphicsMemoryUsed() const;
1.63 +private:
1.64 + class TResourceListItem
1.65 + {
1.66 + public:
1.67 + TResourceListItem(DSgResource* aResource, TInt aChunkHandle);
1.68 + public:
1.69 + DSgResource* iResource;
1.70 + TInt iChunkHandle;
1.71 + };
1.72 +private:
1.73 + static TInt Compare(const TUint64* aId, const TResourceListItem& aResourceListItem);
1.74 + static TInt Compare(const TResourceListItem& aResourceListItem1, const TResourceListItem& aResourceListItem2);
1.75 +private:
1.76 + DMutex* iMutex;
1.77 + RArray<TResourceListItem> iResources;
1.78 + };
1.79 +
1.80 +#endif // SGDEVICEIMPL_H