graphicscompositionref/surfacemgrcommon/inc/surfacemanager_dev.h
author Faisal Memon <faisal.memon@nokia.com>
Mon, 16 Aug 2010 10:28:15 +0100
changeset 0 91fe342bd9c4
permissions -rwxr-xr-x
Provide code to deliver both syborg and reference implementations of surface manager.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
     1
// Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
     2
// All rights reserved.
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
     3
// This component and the accompanying materials are made available
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
     4
// under the terms of "Eclipse Public License v1.0"
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
     5
// which accompanies this distribution, and is available
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
     7
//
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
     8
// Initial Contributors:
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
     9
// Nokia Corporation - initial contribution.
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    10
//
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    11
// Contributors:
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    12
//
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    13
// Description:
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    14
//
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    15
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    16
/**
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    17
 @file
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    18
 @publishedPartner
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    19
 @prototype
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    20
*/
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    21
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    22
#ifndef __SURFACEMANAGER_DEV_H__
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    23
#define __SURFACEMANAGER_DEV_H__
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    24
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    25
#include <graphics/surface.h>
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    26
#include "surfacemanagerdriver.h"
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    27
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    28
#ifdef GRAPHICS_SURFACEMANAGER_SYBORG
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    29
#include "syborgvirtualhwmemory.h"
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    30
#endif
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    31
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    32
#if 0
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    33
#define TRACE(x) x
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    34
#else
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    35
#define TRACE(x)
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    36
#endif
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    37
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    38
/** Maximum number of HintPairs per surface */
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    39
const TInt KMaxHintsPerSurface = 16;
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    40
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    41
/** Maximum number of elements in the table. This value must be a power of 2 */
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    42
#define KMaxLists 16
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    43
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    44
/**
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    45
  Logical Device (factory class) for Surface manager
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    46
*/
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    47
class DSurfaceManagerFactory : public DLogicalDevice
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    48
	{
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    49
public:
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    50
	DSurfaceManagerFactory();
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    51
	TInt Install();
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    52
	void GetCaps(TDes8& aDes) const;
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    53
	TInt Create(DLogicalChannelBase*& aChannel);
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    54
	};
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    55
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    56
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    57
/**
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    58
  Logical Channel class for SurfaceManager
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    59
*/
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    60
class DSurfaceManagerChannel : public DLogicalChannelBase
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    61
	{
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    62
public:
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    63
	DSurfaceManagerChannel();
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    64
	~DSurfaceManagerChannel();
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    65
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    66
	// Inherited from DLogicalChannelBase
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    67
	TInt DoCreate(TInt aUnit, const TDesC8* aInfo, const TVersion& aVer);
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    68
	TInt Request(TInt aReqNo, TAny* a1, TAny* a2);
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    69
private:
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    70
	// Implementation for the different kinds of messages sent through RBusLogicalChannel
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    71
	TInt DoControl(TInt aFunction, TAny* a1, TAny* a2);
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    72
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    73
private:
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    74
	DProcess* iOwner;
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    75
	};
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    76
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    77
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    78
/**
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    79
Class to hold a reference count and process pointer. 
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    80
Each surface has a linked list of these owning processes.
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    81
The surface manager has a linked list of these to track connections.
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    82
@internalTechnology
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    83
*/
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    84
class TProcessListItem
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    85
	{
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    86
public:
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    87
	TProcessListItem* iNext;	//pointer to next one in list
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    88
	DProcess* iOwningProcess;	//pointer to the process object which is being reference counted
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    89
	TInt iCount;				//reference count
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    90
	};
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    91
	
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    92
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    93
/**
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    94
Class to hold the information about a surface.
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    95
Each surface has a linked list of owners.  The surfaces are arranged in a linked list,
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    96
with these objects being elements in the list.
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    97
@internalTechnology
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    98
*/
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    99
class TSurface					//one of these per surface
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   100
	{
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   101
public:
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   102
	TSurface* iNext;			//singly linked list, points to next surface
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   103
	TSurfaceId	iId;			//the surface id
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   104
	TSize iSize;				//pixel width/height
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   105
	TInt iBuffers;				//number of buffers
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   106
	TUidPixelFormat iPixelFormat;			//pixel format
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   107
	TInt iStride;				//offset from start of one line to the next, in bytes
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   108
	TInt iOffsetToFirstBuffer;	//offset between the start of the surface memory and the start of the first pixel buffer
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   109
	TInt iOffsetBetweenBuffers;	//offset between pixel buffers
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   110
	TInt  iAlignment;			//byte alignment of the pixel buffers
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   111
	TBool iContiguous;			//if it is in contiguous physical memory
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   112
	DChunk* iChunk;				//ptr to the shared chunk
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   113
	RSurfaceManager::TCacheAttribute iCacheAttrib;			//Caching attribute to create chunks memory
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   114
	RSurfaceManager::THintPair iSurfaceHints[KMaxHintsPerSurface];	//Arbitrary key-value pairs associated with a surface
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   115
	TBool iMappable;			//Is the Surface Mappable
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   116
	TProcessListItem* iOwners;	//owner list. Singly linked list, points to next surface owner
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   117
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   118
public:	
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   119
	TProcessListItem* ProcessOwnerInfo(const DProcess* aProcess);
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   120
	};
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   121
	
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   122
/**
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   123
Surface manager extension object.
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   124
There is one static instance of this in the kernel extension.
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   125
@internalTechnology
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   126
*/
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   127
class DSurfaceManager : public DBase
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   128
	{
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   129
public:
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   130
	TInt CreateSurface(const TDesC8* aConfig, TSurfaceId* aId);
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   131
	TInt SurfaceInfo(const TSurfaceId* aId, TDes8* aInfo);
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   132
	TInt OpenSurface(const TSurfaceId* aId);
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   133
	TInt CloseSurface(const TSurfaceId* aId);
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   134
	TInt MapSurface(const TSurfaceId* aId);
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   135
	TInt AddConnection(const DProcess* iProcess);
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   136
	void RemoveConnection(const DProcess* iProcess);
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   137
	TInt CreateSurface(RSurfaceManagerDriver::TDeviceParam* aParam, TInt aChunkHandle);
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   138
	TInt SynchronizeCache(RSurfaceManagerDriver::TDeviceParam* aId, RSurfaceManager::TSyncOperation aOperation);
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   139
	TInt GetSurfaceHint(const TSurfaceId* aSurfaceId, RSurfaceManager::THintPair* aHintPair);
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   140
	TInt SetSurfaceHint(const TSurfaceId* aSurfaceId, const RSurfaceManager::THintPair* aHintPair);
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   141
	TInt AddSurfaceHint(const TSurfaceId* aSurfaceId, const RSurfaceManager::THintPair* aHintPair);
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   142
	TInt GetBufferOffset(RSurfaceManagerDriver::TDeviceParam* aParam,TUint* aOffset);
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   143
	TInt GetSurfaceManagerAttrib(RSurfaceManager::TSurfaceManagerAttrib* aAttrib,TInt* aValue);
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   144
private:
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   145
	void GenerateSurfaceId(TSurfaceId& aId);
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   146
	TInt  CreateSurfaceChunk(const RSurfaceManager::TSurfaceCreationAttributes& attribs);
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   147
	TInt ValidateAndCalculateChunkSize(RSurfaceManager::TSurfaceCreationAttributes& aAttribs, TInt& aOffset, 
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   148
			TUint& aActualBufferSize, const TBool aNewChunk = EFalse);
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   149
	TInt ValidatePhysicalMemory(DChunk* aChunk, const RSurfaceManager::TSurfaceCreationAttributes& aAttribs, 
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   150
			TUint aBuffersize, TUint32& aMapAttr, TBool &aIsContiguous); 
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   151
	TSurface* FindSurfaceById(const TSurfaceId& aId);
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   152
	void CloseSurfaceHandlesForProcess(const DProcess* iProcess);
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   153
	TProcessListItem* FindConnectedProcess(const DProcess* aProcess);
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   154
	TInt FindHintKey(const RSurfaceManager::THintPair* aHints, TUint32 aKey) const;
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   155
	TBool SortHints(RSurfaceManager::THintPair* aHints, TInt aNumberOfHints) const;
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   156
	TInt InsertHintKey(RSurfaceManager::THintPair* aHints, const RSurfaceManager::THintPair& aHintPair) const;
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   157
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   158
#ifdef GRAPHICS_SURFACEMANAGER_SYBORG
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   159
	TInt CreateMemory();
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   160
#endif
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   161
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   162
private:
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   163
	TSurface* iSurfacesIndex[KMaxLists]; 			// A table with elements pointing to the head of each singly linked list
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   164
	NFastMutex iMutex;						// Mutex to protect access to surface lists
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   165
	TProcessListItem* iConnectedProcesses;	//reference counted list of processes connected to the driver
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   166
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   167
#ifdef GRAPHICS_SURFACEMANAGER_SYBORG
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   168
	DVirtualHWMemoryManager* iVHWMemoryManager;
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   169
#endif
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   170
	};
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   171
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   172
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   173
#endif
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   174
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   175
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   176
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   177
91fe342bd9c4 Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   178