]> git.kernelconcepts.de Git - karo-tx-linux.git/blob - drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_kernel_buffer.h
0608e437f54d83b274f5c709a2ee8c616b488a57
[karo-tx-linux.git] / drivers / mxc / gpu-viv / hal / kernel / inc / gc_hal_kernel_buffer.h
1 /****************************************************************************
2 *
3 *    Copyright (C) 2005 - 2013 by Vivante Corp.
4 *
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.
9 *
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.
14 *
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.
18 *
19 *****************************************************************************/
20
21
22 #ifndef __gc_hal_kernel_buffer_h_
23 #define __gc_hal_kernel_buffer_h_
24
25
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29
30 /******************************************************************************\
31 ************************ Command Buffer and Event Objects **********************
32 \******************************************************************************/
33
34 /* The number of context buffers per user. */
35 #define gcdCONTEXT_BUFFER_COUNT 2
36
37 /* State delta record. */
38 typedef struct _gcsSTATE_DELTA_RECORD * gcsSTATE_DELTA_RECORD_PTR;
39 typedef struct _gcsSTATE_DELTA_RECORD
40 {
41     /* State address. */
42     gctUINT                     address;
43
44     /* State mask. */
45     gctUINT32                   mask;
46
47     /* State data. */
48     gctUINT32                   data;
49 }
50 gcsSTATE_DELTA_RECORD;
51
52 /* State delta. */
53 typedef struct _gcsSTATE_DELTA
54 {
55     /* For debugging: the number of delta in the order of creation. */
56 #if gcmIS_DEBUG(gcdDEBUG_CODE)
57     gctUINT                     num;
58 #endif
59
60     /* Main state delta ID. Every time state delta structure gets reinitialized,
61        main ID is incremented. If main state ID overflows, all map entry IDs get
62        reinitialized to make sure there is no potential erroneous match after
63        the overflow.*/
64     gctUINT                     id;
65
66     /* The number of contexts pending modification by the delta. */
67     gctINT                      refCount;
68
69     /* Vertex element count for the delta buffer. */
70     gctUINT                     elementCount;
71
72     /* Number of states currently stored in the record array. */
73     gctUINT                     recordCount;
74
75     /* Record array; holds all modified states in gcsSTATE_DELTA_RECORD. */
76     gctUINT64                   recordArray;
77
78     /* Map entry ID is used for map entry validation. If map entry ID does not
79        match the main state delta ID, the entry and the corresponding state are
80        considered not in use. */
81     gctUINT64                   mapEntryID;
82     gctUINT                     mapEntryIDSize;
83
84     /* If the map entry ID matches the main state delta ID, index points to
85        the state record in the record array. */
86     gctUINT64                   mapEntryIndex;
87
88     /* Previous and next state deltas in gcsSTATE_DELTA. */
89     gctUINT64                   prev;
90     gctUINT64                   next;
91 }
92 gcsSTATE_DELTA;
93
94 /* Command buffer object. */
95 struct _gcoCMDBUF
96 {
97     /* The object. */
98     gcsOBJECT                   object;
99
100     /* Command buffer entry and exit pipes. */
101     gcePIPE_SELECT              entryPipe;
102     gcePIPE_SELECT              exitPipe;
103
104     /* Feature usage flags. */
105     gctBOOL                     using2D;
106     gctBOOL                     using3D;
107     gctBOOL                     usingFilterBlit;
108     gctBOOL                     usingPalette;
109
110     /* Physical address of command buffer. Just a name. */
111     gctUINT32                   physical;
112
113     /* Logical address of command buffer. */
114     gctUINT64                   logical;
115
116     /* Number of bytes in command buffer. */
117     gctUINT                     bytes;
118
119     /* Start offset into the command buffer. */
120     gctUINT                     startOffset;
121
122     /* Current offset into the command buffer. */
123     gctUINT                     offset;
124
125     /* Number of free bytes in command buffer. */
126     gctUINT                     free;
127
128     /* Location of the last reserved area. */
129     gctUINT64                   lastReserve;
130     gctUINT                     lastOffset;
131
132 #if gcdSECURE_USER
133     /* Hint array for the current command buffer. */
134     gctUINT                     hintArraySize;
135     gctUINT64                   hintArray;
136     gctUINT64                   hintArrayTail;
137 #endif
138
139 #if gcmIS_DEBUG(gcdDEBUG_CODE)
140     /* Last load state command location and hardware address. */
141     gctUINT64                   lastLoadStatePtr;
142     gctUINT32                   lastLoadStateAddress;
143     gctUINT32                   lastLoadStateCount;
144 #endif
145 };
146
147 typedef struct _gcsQUEUE
148 {
149     /* Pointer to next gcsQUEUE structure in gcsQUEUE. */
150     gctUINT64                   next;
151
152     /* Event information. */
153     gcsHAL_INTERFACE            iface;
154 }
155 gcsQUEUE;
156
157 /* Event queue. */
158 struct _gcoQUEUE
159 {
160     /* The object. */
161     gcsOBJECT                   object;
162
163     /* Pointer to current event queue. */
164     gcsQUEUE_PTR                head;
165     gcsQUEUE_PTR                tail;
166
167 #ifdef __QNXNTO__
168     /* Buffer for records. */
169     gcsQUEUE_PTR                records;
170     gctUINT32                   freeBytes;
171     gctUINT32                   offset;
172 #else
173     /* List of free records. */
174     gcsQUEUE_PTR                freeList;
175 #endif
176     #define gcdIN_QUEUE_RECORD_LIMIT 16
177     /* Number of records currently in queue */
178     gctUINT32                   recordCount;
179 };
180
181 #ifdef __cplusplus
182 }
183 #endif
184
185 #endif /* __gc_hal_kernel_buffer_h_ */