1 /****************************************************************************
3 * Copyright (C) 2005 - 2013 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 *****************************************************************************/
22 #ifndef __gc_hal_kernel_buffer_h_
23 #define __gc_hal_kernel_buffer_h_
30 /******************************************************************************\
31 ************************ Command Buffer and Event Objects **********************
32 \******************************************************************************/
34 /* The number of context buffers per user. */
35 #define gcdCONTEXT_BUFFER_COUNT 2
37 /* State delta record. */
38 typedef struct _gcsSTATE_DELTA_RECORD * gcsSTATE_DELTA_RECORD_PTR;
39 typedef struct _gcsSTATE_DELTA_RECORD
50 gcsSTATE_DELTA_RECORD;
53 typedef struct _gcsSTATE_DELTA
55 /* For debugging: the number of delta in the order of creation. */
56 #if gcmIS_DEBUG(gcdDEBUG_CODE)
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
66 /* The number of contexts pending modification by the delta. */
69 /* Vertex element count for the delta buffer. */
72 /* Number of states currently stored in the record array. */
75 /* Record array; holds all modified states in gcsSTATE_DELTA_RECORD. */
76 gctUINT64 recordArray;
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. */
82 gctUINT mapEntryIDSize;
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;
88 /* Previous and next state deltas in gcsSTATE_DELTA. */
94 /* Command buffer object. */
100 /* Command buffer entry and exit pipes. */
101 gcePIPE_SELECT entryPipe;
102 gcePIPE_SELECT exitPipe;
104 /* Feature usage flags. */
107 gctBOOL usingFilterBlit;
108 gctBOOL usingPalette;
110 /* Physical address of command buffer. Just a name. */
113 /* Logical address of command buffer. */
116 /* Number of bytes in command buffer. */
119 /* Start offset into the command buffer. */
122 /* Current offset into the command buffer. */
125 /* Number of free bytes in command buffer. */
128 /* Location of the last reserved area. */
129 gctUINT64 lastReserve;
133 /* Hint array for the current command buffer. */
134 gctUINT hintArraySize;
136 gctUINT64 hintArrayTail;
139 #if gcmIS_DEBUG(gcdDEBUG_CODE)
140 /* Last load state command location and hardware address. */
141 gctUINT64 lastLoadStatePtr;
142 gctUINT32 lastLoadStateAddress;
143 gctUINT32 lastLoadStateCount;
147 typedef struct _gcsQUEUE
149 /* Pointer to next gcsQUEUE structure in gcsQUEUE. */
152 /* Event information. */
153 gcsHAL_INTERFACE iface;
163 /* Pointer to current event queue. */
168 /* Buffer for records. */
169 gcsQUEUE_PTR records;
173 /* List of free records. */
174 gcsQUEUE_PTR freeList;
176 #define gcdIN_QUEUE_RECORD_LIMIT 16
177 /* Number of records currently in queue */
178 gctUINT32 recordCount;
185 #endif /* __gc_hal_kernel_buffer_h_ */