aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/pvr/ra.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/pvr/ra.h')
-rw-r--r--drivers/gpu/pvr/ra.h159
1 files changed, 159 insertions, 0 deletions
diff --git a/drivers/gpu/pvr/ra.h b/drivers/gpu/pvr/ra.h
new file mode 100644
index 00000000000..f28ce4cd755
--- /dev/null
+++ b/drivers/gpu/pvr/ra.h
@@ -0,0 +1,159 @@
1/**********************************************************************
2 *
3 * Copyright(c) 2008 Imagination Technologies Ltd. All rights reserved.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful but, except
10 * as otherwise stated in writing, without any warranty; without even the
11 * implied warranty of merchantability or fitness for a particular purpose.
12 * See the GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
17 *
18 * The full GNU General Public License is included in this distribution in
19 * the file called "COPYING".
20 *
21 * Contact Information:
22 * Imagination Technologies Ltd. <gpl-support@imgtec.com>
23 * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK
24 *
25 ******************************************************************************/
26
27#ifndef _RA_H_
28#define _RA_H_
29
30#include "img_types.h"
31#include "hash.h"
32#include "osfunc.h"
33
34typedef struct _RA_ARENA_ RA_ARENA;
35typedef struct _BM_MAPPING_ BM_MAPPING;
36
37
38
39#define RA_STATS
40
41
42struct _RA_STATISTICS_
43{
44
45 IMG_SIZE_T uSpanCount;
46
47
48 IMG_SIZE_T uLiveSegmentCount;
49
50
51 IMG_SIZE_T uFreeSegmentCount;
52
53
54 IMG_SIZE_T uTotalResourceCount;
55
56
57 IMG_SIZE_T uFreeResourceCount;
58
59
60 IMG_SIZE_T uCumulativeAllocs;
61
62
63 IMG_SIZE_T uCumulativeFrees;
64
65
66 IMG_SIZE_T uImportCount;
67
68
69 IMG_SIZE_T uExportCount;
70};
71typedef struct _RA_STATISTICS_ RA_STATISTICS;
72
73struct _RA_SEGMENT_DETAILS_
74{
75 IMG_SIZE_T uiSize;
76 IMG_CPU_PHYADDR sCpuPhyAddr;
77 IMG_HANDLE hSegment;
78};
79typedef struct _RA_SEGMENT_DETAILS_ RA_SEGMENT_DETAILS;
80
81RA_ARENA *
82RA_Create (IMG_CHAR *name,
83 IMG_UINTPTR_T base,
84 IMG_SIZE_T uSize,
85 BM_MAPPING *psMapping,
86 IMG_SIZE_T uQuantum,
87 IMG_BOOL (*imp_alloc)(IMG_VOID *_h,
88 IMG_SIZE_T uSize,
89 IMG_SIZE_T *pActualSize,
90 BM_MAPPING **ppsMapping,
91 IMG_UINT32 uFlags,
92 IMG_UINTPTR_T *pBase),
93 IMG_VOID (*imp_free) (IMG_VOID *,
94 IMG_UINTPTR_T,
95 BM_MAPPING *),
96 IMG_VOID (*backingstore_free) (IMG_VOID *,
97 IMG_SIZE_T,
98 IMG_SIZE_T,
99 IMG_HANDLE),
100 IMG_VOID *import_handle);
101
102IMG_VOID
103RA_Delete (RA_ARENA *pArena);
104
105IMG_BOOL
106RA_TestDelete (RA_ARENA *pArena);
107
108IMG_BOOL
109RA_Add (RA_ARENA *pArena, IMG_UINTPTR_T base, IMG_SIZE_T uSize);
110
111IMG_BOOL
112RA_Alloc (RA_ARENA *pArena,
113 IMG_SIZE_T uSize,
114 IMG_SIZE_T *pActualSize,
115 BM_MAPPING **ppsMapping,
116 IMG_UINT32 uFlags,
117 IMG_UINT32 uAlignment,
118 IMG_UINT32 uAlignmentOffset,
119 IMG_UINTPTR_T *pBase);
120
121IMG_VOID
122RA_Free (RA_ARENA *pArena, IMG_UINTPTR_T base, IMG_BOOL bFreeBackingStore);
123
124
125#ifdef RA_STATS
126
127#define CHECK_SPACE(total) \
128{ \
129 if((total)<100) \
130 return PVRSRV_ERROR_INVALID_PARAMS; \
131}
132
133#define UPDATE_SPACE(str, count, total) \
134{ \
135 if((count) == -1) \
136 return PVRSRV_ERROR_INVALID_PARAMS; \
137 else \
138 { \
139 (str) += (count); \
140 (total) -= (count); \
141 } \
142}
143
144
145IMG_BOOL RA_GetNextLiveSegment(IMG_HANDLE hArena, RA_SEGMENT_DETAILS *psSegDetails);
146
147
148PVRSRV_ERROR RA_GetStats(RA_ARENA *pArena,
149 IMG_CHAR **ppszStr,
150 IMG_UINT32 *pui32StrLen);
151
152PVRSRV_ERROR RA_GetStatsFreeMem(RA_ARENA *pArena,
153 IMG_CHAR **ppszStr,
154 IMG_UINT32 *pui32StrLen);
155
156#endif
157
158#endif
159