author | Faisal Memon <faisal.memon@nokia.com> |
Mon, 16 Aug 2010 10:28:15 +0100 | |
changeset 0 | 91fe342bd9c4 |
permissions | -rwxr-xr-x |
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-2009 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 |
|
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
23 |
#include <e32base.h> |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
24 |
#include <graphics/surfacemanager.h> |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
25 |
#include "../inc/surfacemanagerdriver.h" |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
26 |
|
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 |
Default constructor |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
29 |
*/ |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
30 |
EXPORT_C RSurfaceManager::RSurfaceManager() |
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 |
__ASSERT_COMPILE(sizeof(RSurfaceManagerDriver) <= sizeof(iDriverBuf)); |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
33 |
new(iDriverBuf) RSurfaceManagerDriver(); |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
34 |
} |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
35 |
|
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
36 |
/** |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
37 |
Opens a connection to the Surface Manager. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
38 |
|
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
39 |
The connection needs to be closed by calling Close() when it is no longer required. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
40 |
@return Returns KErrNone if successful, otherwise a system wide error code. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
41 |
*/ |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
42 |
EXPORT_C TInt RSurfaceManager::Open() |
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 |
TInt err = User::LoadLogicalDevice( RSurfaceManagerDriver::Name() ); |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
45 |
if(! ((KErrNone == err) || (KErrAlreadyExists == err))) |
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 |
return err; |
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 |
return Driver().Open(); |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
50 |
} |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
51 |
|
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
52 |
/** |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
53 |
Closes the connection to the Surface Manager. |
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 |
Cleanup is performed by the Surface Manager when a client process exits or |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
56 |
closes its last connection. It is not guaranteed that the resources held by the |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
57 |
Surface Manager are going to be released synchronously. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
58 |
*/ |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
59 |
EXPORT_C void RSurfaceManager::Close() |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
60 |
{ |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
61 |
Driver().Close(); |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
62 |
} |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
63 |
|
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
64 |
/** |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
65 |
Returns information specific to the Surface Manager implementation. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
66 |
@param aAttrib Attribute to retrieve |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
67 |
@param aValue Output parameter set to the value for the specified attribute |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
68 |
@return KErrNone if successful, KErrNotReady if the Surface Manager hasn't been |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
69 |
opened, KErrArgument if the attribute UID is not recognized, otherwise a system |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
70 |
wide error code. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
71 |
*/ |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
72 |
EXPORT_C TInt RSurfaceManager::GetSurfaceManagerAttrib(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
|
73 |
{ |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
74 |
return Driver().GetSurfaceManagerAttrib(aAttrib, aValue); |
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 |
Opens a surface. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
79 |
|
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
80 |
If the surface is already open in this process, this call increments the |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
81 |
reference count for the surface for this process. If the surface hasn't been opened |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
82 |
in this process, it opens the surface in this process and sets the reference count |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
83 |
to 1 for this process. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
84 |
|
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
85 |
A surface will be deleted when all its reference counts are 0. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
86 |
@param aSurfaceId The surface id originally returned when the surface was created. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
87 |
@pre The surface id is for an existing surface. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
88 |
@post The surface is open in this process. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
89 |
@return KErrNone if successful otherwise a system wide error code. |
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 |
EXPORT_C TInt RSurfaceManager::OpenSurface(const TSurfaceId& aSurfaceId) |
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 |
return Driver().OpenSurface(aSurfaceId); |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
94 |
} |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
95 |
|
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
96 |
/** |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
97 |
Creates a surface and returns its global unique identifier. |
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 |
Depending on the implementation, this method will allocate the surface in a new |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
100 |
shared chunk or in external memory. Surfaces created in external memory cannot |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
101 |
be mapped (see TSurfaceInfoV01::iMappable for more information). If the creation |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
102 |
succeeds, the surface will be opened with a reference count of 1 in the calling |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
103 |
process. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
104 |
|
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
105 |
The Surface Manager implementation should validate at least the following: |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
106 |
- The alignment is 1, 2, 4, 8, 16, 32, 64 or TPageAlignment::EPageAligned. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
107 |
- The offset to first buffer is correctly aligned. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
108 |
- The width and height are both greater than zero. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
109 |
- There is at least one buffer. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
110 |
- The calculated chunk size isn't so big that it will exceed a signed int. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
111 |
- The caching attribute is valid |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
112 |
- If the offset between the start of one buffer and the next is specified |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
113 |
(not zero), it must be correctly aligned and at least as big as the |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
114 |
buffer size calculated from the height and stride. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
115 |
- A surface hint key of zero is allowed when creating a surface, it is ignored |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
116 |
|
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
117 |
The Surface Manager implementation will treat iStride, iOffsetToFirstBuffer, and |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
118 |
iOffsetBetweenBuffers as minimum values as opposed to required values. The caller |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
119 |
of this method must not rely on the passed values as it is not guaranteed that |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
120 |
they remain the same after surface creation (SurfaceInfo() and GetBufferOffset() |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
121 |
should be used instead). |
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 |
If iOffsetBetweenBuffers is zero, the Surface Manager implementation will layout |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
124 |
buffer at its own discretion. Although, a buffer's offset must remain constant |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
125 |
during the surface's lifetime. |
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 |
If iMappable is EFalse the surface won't be mappable, hence calls to MapSurface() |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
128 |
will fail. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
129 |
|
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
130 |
@param aReqs Input parameter, specifies attributes of the surface required. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
131 |
@param aSurfaceId Output parameter, the surface ID, set if the call succeeds. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
132 |
@pre The Surface Manager has been successfully opened. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
133 |
@post The surface is created and opened in the creating process. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
134 |
@return KErrNone if it succeeds, KErrArgument if the surface attributes are incorrect, |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
135 |
KErrNoMemory if the surface cannot be created due to out of memory, KErrOverflow if |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
136 |
the chunk limit has been exceeded in the moving memory model, otherwise a standard |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
137 |
Symbian error code. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
138 |
*/ |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
139 |
EXPORT_C TInt RSurfaceManager::CreateSurface(const TSurfaceCreationAttributesBuf& aReqs, TSurfaceId& aSurfaceId) |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
140 |
{ |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
141 |
return Driver().CreateSurface(aReqs,aSurfaceId); |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
142 |
} |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
143 |
|
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
144 |
/** |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
145 |
Creates a surface in an existing shared chunk specified by the caller and returns |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
146 |
its global unique identifier. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
147 |
|
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
148 |
If the creation succeeds, the surface will be opened with a reference count of 1 in the calling |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
149 |
process. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
150 |
|
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
151 |
The Surface Manager implementation should validate at least the following: |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
152 |
- The alignment is 1, 2, 4, 8, 16, 32, 64 or TPageAlignment::EPageAligned. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
153 |
- The offset to first buffer is correctly aligned. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
154 |
- The width and height are both greater than zero. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
155 |
- There is at least one buffer. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
156 |
- The calculated chunk size isn't so big that it will exceed a signed int. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
157 |
- The caching attribute is valid |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
158 |
- If the offset between the start of one buffer and the next is specified |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
159 |
(not zero), it must be correctly aligned and at least as big as the |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
160 |
buffer size calculated from the height and stride. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
161 |
- A surface hint key of zero is allowed when creating a surface, it is ignored |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
162 |
|
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
163 |
If iOffsetBetweenBuffers is zero, the Surface Manager implementation will layout |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
164 |
buffer at its own discretion. Although, a buffer's offset must remain constant |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
165 |
during the surface's lifetime. |
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 |
The attributes iContiguous and iCacheAttribute are ignored for existing chunks. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
168 |
|
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
169 |
Also, note that surface manager will not do any rounding for offset to first |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
170 |
buffer and offset between buffers. It is up to the user, to give exact aligned |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
171 |
values for this attributes, otherwise surface creation will fail. |
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 |
If iMappable is EFalse the surface won't be mappable, hence calls to MapSurface() |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
174 |
will fail. |
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 |
@param aReqs Input parameter, specifies attributes of the surface required. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
177 |
@param aSurfaceId Output parameter, the surface ID, set if the call succeeds. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
178 |
@param aChunkHandle Handle of the existing shared chunk. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
179 |
@pre The Surface Manager has been successfully opened. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
180 |
@pre A valid shared chunk exists. The shared chunk type should be Shared Kernel |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
181 |
multiple and should be right the size, i.e. the size should be calculated as |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
182 |
Offset to first buffer + (the number of buffers * ((stride * height * |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
183 |
pixel depth in bytes) rounded up to the specified alignment) all rounded to a page size |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
184 |
@post The Surface Manager has opened the chunk. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
185 |
@post The surface is created and opened in the creating process. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
186 |
@return KErrNone if it succeeds, KErrArgument if the surface attributes are incorrect. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
187 |
KErrNotReady if the handle is of an invalid shared chunk memory |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
188 |
*/ |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
189 |
EXPORT_C TInt RSurfaceManager::CreateSurface(const TSurfaceCreationAttributesBuf& aReqs, TSurfaceId& aSurfaceId, const RChunk& aChunkHandle) |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
190 |
{ |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
191 |
return Driver().CreateSurface(aReqs,aSurfaceId,aChunkHandle); |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
192 |
} |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
193 |
|
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
194 |
/** |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
195 |
Closes the surface. Decrements the reference count for the surface for the calling |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
196 |
process. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
197 |
|
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
198 |
If the surface has other owners, it will not be deleted from memory. If this is |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
199 |
the last process to close the surface, the surface will be deleted and the |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
200 |
surface ID will become invalid. Resources associated with the surface are not |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
201 |
guaranteed to be released synchronously. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
202 |
@param aSurfaceId The surface identifier originally returned when the surface was created. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
203 |
@pre The surface is open. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
204 |
@post The surface is closed. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
205 |
@return KErrNone if successful, KErrArgument if the surface ID does not refer to a surface, |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
206 |
KErrAccessDenied if the surface is not open in the current process, otherwise a system wide |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
207 |
error code. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
208 |
*/ |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
209 |
EXPORT_C TInt RSurfaceManager::CloseSurface(const TSurfaceId& aSurfaceId) |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
210 |
{ |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
211 |
return Driver().CloseSurface(aSurfaceId); |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
212 |
} |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
213 |
|
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
214 |
/** |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
215 |
Maps the surface into the current client process address space. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
216 |
|
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
217 |
The actual memory will remain mapped into the calling process for as long as |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
218 |
the RChunk handle aChunk is open. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
219 |
|
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
220 |
Whether or not a surface is mappable is determined at creation time, see |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
221 |
TSurfaceCreationAttributes::iMappable. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
222 |
|
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
223 |
The address of the pixel data in buffer N is chunk.Base() + GetBufferOffset(N). |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
224 |
|
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
225 |
Surfaces created with existing shared chunks will get the same chunk handle. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
226 |
|
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
227 |
The RChunk handle is owned by the calling thread, so will need to be duplicated |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
228 |
if passed to other threads in the process. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
229 |
@param aSurfaceId The surface identifier originally returned when the surface was created. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
230 |
@param aHandle Output parameter, handle to the implementation specific Shared Chunk. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
231 |
@pre The surface is open. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
232 |
@post The surface memory will be mapped into the calling process's address space. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
233 |
The surface is mapped. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
234 |
@return KErrNone if successful, KErrArgument if the surface ID does not refer to a |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
235 |
surface, KErrAccessDenied if the surface is not open in the current process, |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
236 |
KErrNotSupported if the surface is not mappable, KErrOverflow if the chunk limit has been |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
237 |
exceeded in the moving memory model, otherwise a system wide error code. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
238 |
@see RChunk |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
239 |
@see RHandleBase::Duplicate |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
240 |
@see TSurfaceCreationAttributes::iMappable |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
241 |
*/ |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
242 |
EXPORT_C TInt RSurfaceManager::MapSurface(const TSurfaceId& aSurfaceId, RChunk& aHandle) |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
243 |
{ |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
244 |
return Driver().MapSurface(aSurfaceId,aHandle); |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
245 |
} |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
246 |
|
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
247 |
/** |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
248 |
Returns information about a particular surface identified by its surface ID. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
249 |
@param aSurfaceId The surface identifier originally returned when the surface |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
250 |
was created. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
251 |
@param aInfo TInfoBuf to receive the information about the surface. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
252 |
@pre The surface is open in the calling process. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
253 |
@return KErrNone if successful, KErrArgument if the surface ID does not refer to a surface, |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
254 |
KErrAccessDenied if the surface is not open in the current process, otherwise a system wide |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
255 |
error code. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
256 |
*/ |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
257 |
EXPORT_C TInt RSurfaceManager::SurfaceInfo(const TSurfaceId& aSurfaceId, TInfoBuf& aInfo) |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
258 |
{ |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
259 |
return Driver().SurfaceInfo(aSurfaceId,aInfo); |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
260 |
} |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
261 |
|
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
262 |
/** |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
263 |
This function ensures the memory is updated consistently before and/or after |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
264 |
triggering non CPU hardware access. Also ensures the CPU cache and the physical |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
265 |
memory are in a consistent state before and after non CPU hardware or DMA access |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
266 |
to the physical memory. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
267 |
@param aSurfaceId The surface identifier originally returned when the surface |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
268 |
was created. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
269 |
@param aBuffer The buffer number indexed from 0 within the surface whose memory |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
270 |
region is to be flushed. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
271 |
@param aOperation Specifies the sync operation as before non CPU hardware reads |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
272 |
or before non CPU hardware writes or after non CPU hardware writes between |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
273 |
physical memory of the surface and the cache contents. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
274 |
@pre The surface is open in the calling process. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
275 |
@post The surface buffer memory will be synchronized properly with cache contents. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
276 |
@return KErrNone if successful, KErrArgument if the surface ID is invalid or |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
277 |
buffer number is invalid, KErrAccessDenied if the surface is not open in this |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
278 |
process, otherwise a system wide error code. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
279 |
*/ |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
280 |
EXPORT_C TInt RSurfaceManager::SynchronizeCache(const TSurfaceId& aSurfaceId, TInt aBuffer, TSyncOperation aOperation) |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
281 |
{ |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
282 |
return Driver().SynchronizeCache(aSurfaceId,aBuffer,aOperation); |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
283 |
} |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
284 |
|
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
285 |
/** |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
286 |
Get the surface hint value for the given surface ID and hint pair key. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
287 |
@param aSurfaceId The surface identifier originally returned when the surface |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
288 |
was created. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
289 |
@param aHint The hint value for the requested hint pair key. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
290 |
@pre The surface is open in the calling process. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
291 |
@pre Hint key should be a key for a hint set for this surface. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
292 |
@post The hint value will be updated in the hint pair. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
293 |
@return KErrNone if successful, KErrArgument if the surface ID is invalid or |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
294 |
invalid hint pair key used, KErrAccessDenied if the surface is not open in the |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
295 |
current process, otherwise a system wide error code. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
296 |
*/ |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
297 |
EXPORT_C TInt RSurfaceManager::GetSurfaceHint(const TSurfaceId& aSurfaceId, THintPair& aHint) |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
298 |
{ |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
299 |
return Driver().GetSurfaceHint(aSurfaceId,aHint); |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
300 |
} |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
301 |
|
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
302 |
/** |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
303 |
Set the surface hint value for 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
|
304 |
@param aSurfaceId The surface identifier originally returned when the surface |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
305 |
was created. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
306 |
@param aHint The value of the hint pair to set. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
307 |
@pre The surface is open in the calling process. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
308 |
@pre The hint key should be a key for a hint set for this surface. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
309 |
@pre Only mutable hints can be updated. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
310 |
@post The hint value will be updated in the surface hint pair. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
311 |
@return KErrNone if successful, KErrArgument if the surface ID is invalid or if invalid |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
312 |
hint key used, KErrAccessDenied if the hint pair is immutable or the surface is not open |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
313 |
in the current process, otherwise a system wide error code. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
314 |
*/ |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
315 |
EXPORT_C TInt RSurfaceManager::SetSurfaceHint(const TSurfaceId& aSurfaceId, const THintPair& aHint) |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
316 |
{ |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
317 |
return Driver().SetSurfaceHint(aSurfaceId,aHint); |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
318 |
} |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
319 |
|
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
320 |
/** |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
321 |
Adds a new surface hint to the surface. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
322 |
|
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
323 |
This function will fail if the surface already has its maximum number of hints |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
324 |
or if the hint key is a duplicate or invalid. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
325 |
@param aSurfaceId The surface identifier originally returned when the surface |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
326 |
was created. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
327 |
@param aHint The value of the hint pair to add. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
328 |
@pre The surface is open in the calling process. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
329 |
@pre At least one free space to add a hint pair. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
330 |
@pre The new hint key should be non zero and unique for this surface. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
331 |
@post New hint pair will be added in the surface. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
332 |
@return Returns KErrNone if successful, KErrArgument if the surface ID is invalid or the |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
333 |
hint pair has invalid key UID, KErrAccessDenied if the surface is not open in the current |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
334 |
process, KErrAlreadyExists if duplicate hint key used, KErrOverflow if no space to add new |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
335 |
pair, otherwise a system wide error code. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
336 |
*/ |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
337 |
EXPORT_C TInt RSurfaceManager::AddSurfaceHint(const TSurfaceId& aSurfaceId, const THintPair& aHint) |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
338 |
{ |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
339 |
return Driver().AddSurfaceHint(aSurfaceId,aHint); |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
340 |
} |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
341 |
|
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
342 |
/** |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
343 |
Get the offset of the specified buffer from the base address of the underlying |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
344 |
chunk. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
345 |
|
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
346 |
To obtain the address of the buffer, the offset returned must be added onto the |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
347 |
base address of the RChunk returned in a call to MapSurface(). Note that |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
348 |
buffer offsets are immutable during the lifetime of the surface. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
349 |
@param aSurfaceId The surface identifier originally returned when the surface |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
350 |
was created. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
351 |
@param aBuffer The buffer for which the offset is requested. Indexed from 0. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
352 |
@param aOffset Output parameter set to the offset within the chunk. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
353 |
@pre The surface is open in the calling process. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
354 |
@return KErrNone if successful, KErrArgument if aSurfaceId or aBuffer are invalid, |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
355 |
KErrAccessDenied if the surface is not open in the current process, KErrNotSupported if |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
356 |
the surface is not mappable, otherwise a system wide error code. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
357 |
*/ |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
358 |
EXPORT_C TInt RSurfaceManager::GetBufferOffset(const TSurfaceId& aSurfaceId, TInt aBuffer, TInt& aOffset) |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
359 |
{ |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
360 |
return Driver().GetBufferOffset(aSurfaceId, aBuffer, aOffset); |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
361 |
} |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
362 |
|
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
363 |
/** |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
364 |
Get a reference of the implementation of the surface manager. |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
365 |
@return reference of the implementation of the surface manager |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
366 |
*/ |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
367 |
inline RSurfaceManagerDriver& RSurfaceManager::Driver() |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
368 |
{ |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
369 |
return reinterpret_cast<RSurfaceManagerDriver&>(*iDriverBuf); |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
370 |
} |
91fe342bd9c4
Provide code to deliver both syborg and reference implementations of surface manager.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff
changeset
|
371 |