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_
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
52 gcsSTATE_DELTA_RECORD
;
55 typedef struct _gcsSTATE_DELTA
57 /* For debugging: the number of delta in the order of creation. */
58 #if gcmIS_DEBUG(gcdDEBUG_CODE)
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
73 /* The number of contexts pending modification by the delta. */
76 /* Vertex element count for the delta buffer. */
79 /* Number of states currently stored in the record array. */
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
;
101 /* Command buffer object. */
107 /* Command buffer entry and exit pipes. */
108 gcePIPE_SELECT entryPipe
;
109 gcePIPE_SELECT exitPipe
;
111 /* Feature usage flags. */
114 gctBOOL usingFilterBlit
;
115 gctBOOL usingPalette
;
117 /* Physical address of command buffer. */
118 gctPHYS_ADDR physical
;
120 /* Logical address of command buffer. */
123 /* Number of bytes in command buffer. */
126 /* Start offset into the command buffer. */
127 gctUINT32 startOffset
;
129 /* Current offset into the command buffer. */
132 /* Number of free bytes in command buffer. */
135 /* Location of the last reserved area. */
136 gctPOINTER lastReserve
;
140 /* Hint array for the current command buffer. */
141 gctUINT hintArraySize
;
142 gctUINT32_PTR hintArray
;
143 gctUINT32_PTR hintArrayTail
;
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
;
154 typedef struct _gcsQUEUE
156 /* Pointer to next gcsQUEUE structure. */
159 /* Event information. */
160 gcsHAL_INTERFACE iface
;
170 /* Pointer to current event queue. */
175 /* Buffer for records. */
176 gcsQUEUE_PTR records
;
180 /* List of free records. */
181 gcsQUEUE_PTR freeList
;
183 #define gcdIN_QUEUE_RECORD_LIMIT 16
184 /* Number of records currently in queue */
185 gctUINT32 recordCount
;
192 #endif /* __gc_hal_kernel_buffer_h_ */