1 /**********************************************************************
3 * Copyright(c) 2008 Imagination Technologies Ltd. All rights reserved.
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
9 * This program is distributed in the hope it will be useful but, except
10 * as otherwise stated in writing, without any warranty; without even the
11 * implied warranty of merchantability or fitness for a particular purpose.
12 * See the GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
18 * The full GNU General Public License is included in this distribution in
19 * the file called "COPYING".
21 * Contact Information:
22 * Imagination Technologies Ltd. <gpl-support@imgtec.com>
23 * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK
25 ******************************************************************************/
27 #ifndef __SGXAPI_KM_H__
28 #define __SGXAPI_KM_H__
32 #include "img_types.h"
34 #if defined(__KERNEL__)
35 #include <linux/unistd.h>
40 #define SGX_UNDEFINED_HEAP_ID (~0LU)
41 #define SGX_GENERAL_HEAP_ID 0
42 #define SGX_TADATA_HEAP_ID 1
43 #define SGX_KERNEL_CODE_HEAP_ID 2
44 #define SGX_KERNEL_DATA_HEAP_ID 3
45 #define SGX_PIXELSHADER_HEAP_ID 4
46 #define SGX_VERTEXSHADER_HEAP_ID 5
47 #define SGX_PDSPIXEL_CODEDATA_HEAP_ID 6
48 #define SGX_PDSVERTEX_CODEDATA_HEAP_ID 7
49 #define SGX_SYNCINFO_HEAP_ID 8
50 #define SGX_3DPARAMETERS_HEAP_ID 9
51 #define SGX_MAX_HEAP_ID 10
53 #define SGX_MAX_TA_STATUS_VALS 32
55 #define SGX_MAX_3D_STATUS_VALS 4
57 #define SGX_MAX_3D_STATUS_VALS 2
60 #define SGX_MAX_SRC_SYNCS 4
62 #define PVRSRV_SGX_HWPERF_NUM_COUNTERS 9
64 #define PVRSRV_SGX_HWPERF_INVALID 0x1
66 #define PVRSRV_SGX_HWPERF_TRANSFER 0x2
67 #define PVRSRV_SGX_HWPERF_TA 0x3
68 #define PVRSRV_SGX_HWPERF_3D 0x4
69 #define PVRSRV_SGX_HWPERF_2D 0x5
71 #define PVRSRV_SGX_HWPERF_MK_EVENT 0x101
72 #define PVRSRV_SGX_HWPERF_MK_TA 0x102
73 #define PVRSRV_SGX_HWPERF_MK_3D 0x103
74 #define PVRSRV_SGX_HWPERF_MK_2D 0x104
76 #define PVRSRV_SGX_HWPERF_TYPE_STARTEND_BIT 28
77 #define PVRSRV_SGX_HWPERF_TYPE_OP_MASK \
78 ((1 << PVRSRV_SGX_HWPERF_TYPE_STARTEND_BIT) - 1)
79 #define PVRSRV_SGX_HWPERF_TYPE_OP_START \
80 (0 << PVRSRV_SGX_HWPERF_TYPE_STARTEND_BIT)
81 #define PVRSRV_SGX_HWPERF_TYPE_OP_END \
82 (1 << PVRSRV_SGX_HWPERF_TYPE_STARTEND_BIT)
84 #define PVRSRV_SGX_HWPERF_TYPE_TRANSFER_START \
85 (PVRSRV_SGX_HWPERF_TRANSFER | PVRSRV_SGX_HWPERF_TYPE_OP_START)
86 #define PVRSRV_SGX_HWPERF_TYPE_TRANSFER_END \
87 (PVRSRV_SGX_HWPERF_TRANSFER | PVRSRV_SGX_HWPERF_TYPE_OP_END)
88 #define PVRSRV_SGX_HWPERF_TYPE_TA_START \
89 (PVRSRV_SGX_HWPERF_TA | PVRSRV_SGX_HWPERF_TYPE_OP_START)
90 #define PVRSRV_SGX_HWPERF_TYPE_TA_END \
91 (PVRSRV_SGX_HWPERF_TA | PVRSRV_SGX_HWPERF_TYPE_OP_END)
92 #define PVRSRV_SGX_HWPERF_TYPE_3D_START \
93 (PVRSRV_SGX_HWPERF_3D | PVRSRV_SGX_HWPERF_TYPE_OP_START)
94 #define PVRSRV_SGX_HWPERF_TYPE_3D_END \
95 (PVRSRV_SGX_HWPERF_3D | PVRSRV_SGX_HWPERF_TYPE_OP_END)
96 #define PVRSRV_SGX_HWPERF_TYPE_2D_START \
97 (PVRSRV_SGX_HWPERF_2D | PVRSRV_SGX_HWPERF_TYPE_OP_START)
98 #define PVRSRV_SGX_HWPERF_TYPE_2D_END \
99 (PVRSRV_SGX_HWPERF_2D | PVRSRV_SGX_HWPERF_TYPE_OP_END)
101 #define PVRSRV_SGX_HWPERF_TYPE_MK_EVENT_START \
102 (PVRSRV_SGX_HWPERF_MK_EVENT | PVRSRV_SGX_HWPERF_TYPE_OP_START)
103 #define PVRSRV_SGX_HWPERF_TYPE_MK_EVENT_END \
104 (PVRSRV_SGX_HWPERF_MK_EVENT | PVRSRV_SGX_HWPERF_TYPE_OP_END)
105 #define PVRSRV_SGX_HWPERF_TYPE_MK_TA_START \
106 (PVRSRV_SGX_HWPERF_MK_TA | PVRSRV_SGX_HWPERF_TYPE_OP_START)
107 #define PVRSRV_SGX_HWPERF_TYPE_MK_TA_END \
108 (PVRSRV_SGX_HWPERF_MK_TA | PVRSRV_SGX_HWPERF_TYPE_OP_END)
109 #define PVRSRV_SGX_HWPERF_TYPE_MK_3D_START \
110 (PVRSRV_SGX_HWPERF_MK_3D | PVRSRV_SGX_HWPERF_TYPE_OP_START)
111 #define PVRSRV_SGX_HWPERF_TYPE_MK_3D_END \
112 (PVRSRV_SGX_HWPERF_MK_3D | PVRSRV_SGX_HWPERF_TYPE_OP_END)
113 #define PVRSRV_SGX_HWPERF_TYPE_MK_2D_START \
114 (PVRSRV_SGX_HWPERF_MK_2D | PVRSRV_SGX_HWPERF_TYPE_OP_START)
115 #define PVRSRV_SGX_HWPERF_TYPE_MK_2D_END \
116 (PVRSRV_SGX_HWPERF_MK_2D | PVRSRV_SGX_HWPERF_TYPE_OP_END)
118 #define PVRSRV_SGX_HWPERF_OFF 0x0
119 #define PVRSRV_SGX_HWPERF_GRAPHICS_ON (1UL << 0)
120 #define PVRSRV_SGX_HWPERF_MK_EXECUTION_ON (1UL << 1)
122 struct PVRSRV_SGX_HWPERF_CB_ENTRY {
127 u32 ui32Counters[PVRSRV_SGX_HWPERF_NUM_COUNTERS];
130 struct PVRSRV_SGX_HWPERF_CBDATA {
133 u32 ui32StartTimeWraps;
135 u32 ui32EndTimeWraps;
141 struct SGX_MISC_INFO_HWPERF_RETRIEVE_CB {
142 struct PVRSRV_SGX_HWPERF_CBDATA *psHWPerfData;
149 struct IMG_DEV_VIRTADDR sStatusDevAddr;
153 enum SGX_MISC_INFO_REQUEST {
154 SGX_MISC_INFO_REQUEST_CLOCKSPEED = 0,
155 SGX_MISC_INFO_REQUEST_SGXREV,
156 SGX_MISC_INFO_REQUEST_DRIVER_SGXREV,
157 SGX_MISC_INFO_REQUEST_SET_HWPERF_STATUS,
158 SGX_MISC_INFO_REQUEST_HWPERF_CB_ON,
159 SGX_MISC_INFO_REQUEST_HWPERF_CB_OFF,
160 SGX_MISC_INFO_REQUEST_HWPERF_RETRIEVE_CB,
161 SGX_MISC_INFO_REQUEST_FORCE_I16 = 0x7fff
164 struct PVRSRV_SGX_MISCINFO_FEATURES {
171 u32 ui32BuildOptions;
174 struct SGX_MISC_INFO {
175 enum SGX_MISC_INFO_REQUEST eRequest;
179 struct PVRSRV_SGX_MISCINFO_FEATURES sSGXFeatures;
180 u32 ui32SGXClockSpeed;
181 u32 ui32NewHWPerfStatus;
182 struct SGX_MISC_INFO_HWPERF_RETRIEVE_CB sRetrieveCB;
186 enum render_state_buf_type {
187 RSB_USSE_VERTEX_PROG,
188 RSB_USSE_FRAGMENT_PROG,
191 struct render_state_buf_info {
195 enum render_state_buf_type type;
198 struct render_state_buf_list {
200 struct render_state_buf_info info[20];
203 #define SGX_KICKTA_DUMPBITMAP_MAX_NAME_LENGTH 256
205 struct SGX_KICKTA_DUMPBITMAP {
206 struct IMG_DEV_VIRTADDR sDevBaseAddr;
213 char pszName[SGX_KICKTA_DUMPBITMAP_MAX_NAME_LENGTH];
216 #define PVRSRV_SGX_PDUMP_CONTEXT_MAX_BITMAP_ARRAY_SIZE 16
218 struct PVRSRV_SGX_PDUMP_CONTEXT {
219 u32 ui32CacheControl;
222 struct SGX_KICKTA_DUMP_ROFF {
223 void *hKernelMemInfo;
230 struct SGX_KICKTA_DUMP_BUFFER {
235 u32 ui32BackEndLength;
237 void *hKernelMemInfo;
243 struct SGX_KICKTA_PDUMP {
245 struct SGX_KICKTA_DUMPBITMAP *psPDumpBitmapArray;
246 u32 ui32PDumpBitmapSize;
248 struct SGX_KICKTA_DUMP_BUFFER *psBufferArray;
249 u32 ui32BufferArraySize;
251 struct SGX_KICKTA_DUMP_ROFF *psROffArray;
252 u32 ui32ROffArraySize;
256 #define SGX_MAX_TRANSFER_STATUS_VALS 2
257 #define SGX_MAX_TRANSFER_SYNC_OPS 5