ENGR00156850 gpu-viv: add gpu-viv driver source
[wandboard.git] / drivers / mxc / gpu-viv / hal / kernel / inc / gc_hal_kernel_buffer.h
blobc8c14f308aa044779274db11b2df7512adf1ad69
1 /****************************************************************************
3 * Copyright (C) 2005 - 2011 by Vivante Corp.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the license, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 *****************************************************************************/
24 #ifndef __gc_hal_kernel_buffer_h_
25 #define __gc_hal_kernel_buffer_h_
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
32 /******************************************************************************\
33 ************************ Command Buffer and Event Objects **********************
34 \******************************************************************************/
36 /* The number of context buffers per user. */
37 #define gcdCONTEXT_BUFFER_COUNT 2
39 /* State delta record. */
40 typedef struct _gcsSTATE_DELTA_RECORD * gcsSTATE_DELTA_RECORD_PTR;
41 typedef struct _gcsSTATE_DELTA_RECORD
43 /* State address. */
44 gctUINT address;
46 /* State mask. */
47 gctUINT32 mask;
49 /* State data. */
50 gctUINT32 data;
52 gcsSTATE_DELTA_RECORD;
54 /* State delta. */
55 typedef struct _gcsSTATE_DELTA
57 /* For debugging: the number of delta in the order of creation. */
58 #if gcmIS_DEBUG(gcdDEBUG_CODE)
59 gctUINT num;
60 #endif
62 /* For dumping. */
63 #if gcdDUMP
64 gcoOS os;
65 #endif
67 /* Main state delta ID. Every time state delta structure gets reinitialized,
68 main ID is incremented. If main state ID overflows, all map entry IDs get
69 reinitialized to make sure there is no potential erroneous match after
70 the overflow.*/
71 gctUINT id;
73 /* The number of contexts pending modification by the delta. */
74 gctINT refCount;
76 /* Vertex element count for the delta buffer. */
77 gctUINT elementCount;
79 /* Number of states currently stored in the record array. */
80 gctUINT recordCount;
82 /* Record array; holds all modified states. */
83 gcsSTATE_DELTA_RECORD_PTR recordArray;
85 /* Map entry ID is used for map entry validation. If map entry ID does not
86 match the main state delta ID, the entry and the corresponding state are
87 considered not in use. */
88 gctUINT_PTR mapEntryID;
89 gctUINT mapEntryIDSize;
91 /* If the map entry ID matches the main state delta ID, index points to
92 the state record in the record array. */
93 gctUINT_PTR mapEntryIndex;
95 /* Previous and next state deltas. */
96 gcsSTATE_DELTA_PTR prev;
97 gcsSTATE_DELTA_PTR next;
99 gcsSTATE_DELTA;
101 /* Command buffer object. */
102 struct _gcoCMDBUF
104 /* The object. */
105 gcsOBJECT object;
107 /* Command buffer entry and exit pipes. */
108 gcePIPE_SELECT entryPipe;
109 gcePIPE_SELECT exitPipe;
111 /* Feature usage flags. */
112 gctBOOL using2D;
113 gctBOOL using3D;
114 gctBOOL usingFilterBlit;
115 gctBOOL usingPalette;
117 /* Physical address of command buffer. */
118 gctPHYS_ADDR physical;
120 /* Logical address of command buffer. */
121 gctPOINTER logical;
123 /* Number of bytes in command buffer. */
124 gctSIZE_T bytes;
126 /* Start offset into the command buffer. */
127 gctUINT32 startOffset;
129 /* Current offset into the command buffer. */
130 gctUINT32 offset;
132 /* Number of free bytes in command buffer. */
133 gctSIZE_T free;
135 /* Location of the last reserved area. */
136 gctPOINTER lastReserve;
137 gctUINT lastOffset;
139 #if gcdSECURE_USER
140 /* Hint array for the current command buffer. */
141 gctUINT hintArraySize;
142 gctUINT32_PTR hintArray;
143 gctUINT32_PTR hintArrayTail;
144 #endif
146 #if gcmIS_DEBUG(gcdDEBUG_CODE)
147 /* Last load state command location and hardware address. */
148 gctUINT32_PTR lastLoadStatePtr;
149 gctUINT32 lastLoadStateAddress;
150 gctUINT32 lastLoadStateCount;
151 #endif
154 typedef struct _gcsQUEUE
156 /* Pointer to next gcsQUEUE structure. */
157 gcsQUEUE_PTR next;
159 /* Event information. */
160 gcsHAL_INTERFACE iface;
162 gcsQUEUE;
164 /* Event queue. */
165 struct _gcoQUEUE
167 /* The object. */
168 gcsOBJECT object;
170 /* Pointer to current event queue. */
171 gcsQUEUE_PTR head;
172 gcsQUEUE_PTR tail;
174 #ifdef __QNXNTO__
175 /* Buffer for records. */
176 gcsQUEUE_PTR records;
177 gctUINT32 freeBytes;
178 gctUINT32 offset;
179 #else
180 /* List of free records. */
181 gcsQUEUE_PTR freeList;
182 #endif
183 #define gcdIN_QUEUE_RECORD_LIMIT 16
184 /* Number of records currently in queue */
185 gctUINT32 recordCount;
188 #ifdef __cplusplus
190 #endif
192 #endif /* __gc_hal_kernel_buffer_h_ */