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_context_h_
23 #define __gc_hal_kernel_context_h_
25 #include "gc_hal_kernel_buffer.h"
31 /* Maps state locations within the context buffer. */
32 typedef struct _gcsSTATE_MAP * gcsSTATE_MAP_PTR;
33 typedef struct _gcsSTATE_MAP
35 /* Index of the state in the context buffer. */
44 typedef struct _gcsCONTEXT * gcsCONTEXT_PTR;
45 typedef struct _gcsCONTEXT
47 /* For debugging: the number of context buffer in the order of creation. */
48 #if gcmIS_DEBUG(gcdDEBUG_CODE)
52 /* Pointer to gckEVENT object. */
55 /* Context busy signal. */
58 /* Physical address of the context buffer. */
59 gctPHYS_ADDR physical;
61 /* Logical address of the context buffer. */
62 gctUINT32_PTR logical;
64 /* Pointer to the LINK commands. */
68 /* The number of pending state deltas. */
71 /* Pointer to the first delta to be applied. */
72 gcsSTATE_DELTA_PTR delta;
74 /* Next context buffer. */
79 /* gckCONTEXT structure that hold the current context. */
85 /* Pointer to gckOS object. */
88 /* Pointer to gckHARDWARE object. */
91 /* Command buffer alignment. */
93 gctSIZE_T reservedHead;
94 gctSIZE_T reservedTail;
96 /* Context buffer metrics. */
100 gctUINT32 linkIndex2D;
101 gctUINT32 linkIndex3D;
102 gctUINT32 linkIndexXD;
103 gctUINT32 entryOffset3D;
104 gctUINT32 entryOffsetXDFrom2D;
105 gctUINT32 entryOffsetXDFrom3D;
111 gcsCONTEXT_PTR dirtyBuffer;
114 gcsSTATE_MAP_PTR map;
116 /* List of context buffers. */
117 gcsCONTEXT_PTR buffer;
119 /* A copy of the user record array. */
120 gctUINT recordArraySize;
121 gcsSTATE_DELTA_RECORD_PTR recordArray;
123 /* Requested pipe select for context. */
124 gcePIPE_SELECT entryPipe;
125 gcePIPE_SELECT exitPipe;
127 /* Variables used for building state buffer. */
128 gctUINT32 lastAddress;
138 #if VIVANTE_PROFILER_CONTEXT
139 gcsPROFILER_COUNTERS latestProfiler;
140 gcsPROFILER_COUNTERS histroyProfiler;
141 gctUINT32 prevVSInstCount;
142 gctUINT32 prevVSBranchInstCount;
143 gctUINT32 prevVSTexInstCount;
144 gctUINT32 prevVSVertexCount;
145 gctUINT32 prevPSInstCount;
146 gctUINT32 prevPSBranchInstCount;
147 gctUINT32 prevPSTexInstCount;
148 gctUINT32 prevPSPixelCount;
156 #endif /* __gc_hal_kernel_context_h_ */