swr: [rasterizer core] remove KNOB_MAX_THREADS
[mesa.git] / src / gallium / drivers / swr / rasterizer / core / knobs.h
1 /****************************************************************************
2 * Copyright (C) 2014-2015 Intel Corporation. All Rights Reserved.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21 * IN THE SOFTWARE.
22 *
23 * @file knobs.h
24 *
25 * @brief Static (Compile-Time) Knobs for Core.
26 *
27 ******************************************************************************/
28 #pragma once
29
30 #include <stdint.h>
31 #include <gen_knobs.h>
32
33 #define KNOB_ARCH_AVX 0
34 #define KNOB_ARCH_AVX2 1
35 #define KNOB_ARCH_AVX512 2
36
37 ///////////////////////////////////////////////////////////////////////////////
38 // AVX512 Support
39 ///////////////////////////////////////////////////////////////////////////////
40
41 #define ENABLE_AVX512_SIMD16 0
42
43 ///////////////////////////////////////////////////////////////////////////////
44 // Architecture validation
45 ///////////////////////////////////////////////////////////////////////////////
46 #if !defined(KNOB_ARCH)
47 #define KNOB_ARCH KNOB_ARCH_AVX
48 #endif
49
50 #if (KNOB_ARCH == KNOB_ARCH_AVX)
51 #define KNOB_ARCH_ISA AVX
52 #define KNOB_ARCH_STR "AVX"
53 #define KNOB_SIMD_WIDTH 8
54 #define KNOB_SIMD_BYTES 32
55 #elif (KNOB_ARCH == KNOB_ARCH_AVX2)
56 #define KNOB_ARCH_ISA AVX2
57 #define KNOB_ARCH_STR "AVX2"
58 #define KNOB_SIMD_WIDTH 8
59 #define KNOB_SIMD_BYTES 32
60 #elif (KNOB_ARCH == KNOB_ARCH_AVX512)
61 #if 0
62 // not ready to enable this globally, enabled on the side (below)
63 #define KNOB_ARCH_ISA AVX512F
64 #define KNOB_ARCH_STR "AVX512"
65 #define KNOB_SIMD_WIDTH 16
66 #define KNOB_SIMD_BYTES 64
67 #else
68 #define KNOB_ARCH_ISA AVX2
69 #define KNOB_ARCH_STR "AVX2"
70 #define KNOB_SIMD_WIDTH 8
71 #define KNOB_SIMD_BYTES 32
72 #endif
73 #else
74 #error "Unknown architecture"
75 #endif
76
77 #if ENABLE_AVX512_SIMD16
78
79 #define KNOB_SIMD16_WIDTH 16
80 #define KNOB_SIMD16_BYTES 64
81
82 #if (KNOB_ARCH == KNOB_ARCH_AVX512)
83 #define ENABLE_AVX512_EMULATION 0
84 #else
85 #define ENABLE_AVX512_EMULATION 1
86 #endif
87
88 #endif
89
90 #define MAX_KNOB_ARCH_STR_LEN sizeof("AVX512_PLUS_PADDING")
91
92 ///////////////////////////////////////////////////////////////////////////////
93 // Configuration knobs
94 ///////////////////////////////////////////////////////////////////////////////
95 // Maximum supported number of active vertex buffer streams
96 #define KNOB_NUM_STREAMS 32
97
98 // Maximum supported number of attributes per vertex
99 #define KNOB_NUM_ATTRIBUTES 39
100
101 // Maximum supported active viewports and scissors
102 #define KNOB_NUM_VIEWPORTS_SCISSORS 16
103
104 // Guardband range used by the clipper
105 #define KNOB_GUARDBAND_WIDTH 32768.0f
106 #define KNOB_GUARDBAND_HEIGHT 32768.0f
107
108 ///////////////////////////////
109 // Macro tile configuration
110 ///////////////////////////////
111
112 // raster tile dimensions
113 #define KNOB_TILE_X_DIM 8
114 #define KNOB_TILE_X_DIM_SHIFT 3
115 #define KNOB_TILE_Y_DIM 8
116 #define KNOB_TILE_Y_DIM_SHIFT 3
117
118 // fixed macrotile pixel dimension for now, eventually will be
119 // dynamically set based on tile format and pixel size
120 #define KNOB_MACROTILE_X_DIM 32
121 #define KNOB_MACROTILE_Y_DIM 32
122 #define KNOB_MACROTILE_X_DIM_FIXED_SHIFT 13
123 #define KNOB_MACROTILE_Y_DIM_FIXED_SHIFT 13
124 #define KNOB_MACROTILE_X_DIM_FIXED (KNOB_MACROTILE_X_DIM << 8)
125 #define KNOB_MACROTILE_Y_DIM_FIXED (KNOB_MACROTILE_Y_DIM << 8)
126 #define KNOB_MACROTILE_X_DIM_IN_TILES (KNOB_MACROTILE_X_DIM >> KNOB_TILE_X_DIM_SHIFT)
127 #define KNOB_MACROTILE_Y_DIM_IN_TILES (KNOB_MACROTILE_Y_DIM >> KNOB_TILE_Y_DIM_SHIFT)
128
129 // total # of hot tiles available. This should be enough to
130 // fully render a 16kx16k 128bpp render target
131 #define KNOB_NUM_HOT_TILES_X 256
132 #define KNOB_NUM_HOT_TILES_Y 256
133 #define KNOB_COLOR_HOT_TILE_FORMAT R32G32B32A32_FLOAT
134 #define KNOB_DEPTH_HOT_TILE_FORMAT R32_FLOAT
135 #define KNOB_STENCIL_HOT_TILE_FORMAT R8_UINT
136
137 // Max scissor rectangle
138 #define KNOB_MAX_SCISSOR_X KNOB_NUM_HOT_TILES_X * KNOB_MACROTILE_X_DIM
139 #define KNOB_MAX_SCISSOR_Y KNOB_NUM_HOT_TILES_Y * KNOB_MACROTILE_Y_DIM
140
141 #if KNOB_SIMD_WIDTH==8 && KNOB_TILE_X_DIM < 4
142 #error "incompatible width/tile dimensions"
143 #elif KNOB_SIMD_WIDTH==16 && KNOB_TILE_X_DIM < 4
144 #error "incompatible width/tile dimensions"
145 #endif
146
147 #if ENABLE_AVX512_SIMD16
148 #if KNOB_SIMD16_WIDTH==16 && KNOB_TILE_X_DIM < 4
149 #error "incompatible width/tile dimensions"
150 #endif
151 #endif
152
153 #if KNOB_SIMD_WIDTH == 8
154 #define SIMD_TILE_X_DIM 4
155 #define SIMD_TILE_Y_DIM 2
156 #elif KNOB_SIMD_WIDTH == 16
157 #define SIMD_TILE_X_DIM 4
158 #define SIMD_TILE_Y_DIM 4
159 #else
160 #error "Invalid simd width"
161 #endif
162
163 #if ENABLE_AVX512_SIMD16
164 #if KNOB_SIMD16_WIDTH == 16
165 #define SIMD16_TILE_X_DIM 4
166 #define SIMD16_TILE_Y_DIM 4
167 #else
168 #error "Invalid simd width"
169 #endif
170 #endif
171
172 ///////////////////////////////////////////////////////////////////////////////
173 // Optimization knobs
174 ///////////////////////////////////////////////////////////////////////////////
175 #define KNOB_USE_FAST_SRGB TRUE
176
177 // enables cut-aware primitive assembler
178 #define KNOB_ENABLE_CUT_AWARE_PA TRUE
179
180 ///////////////////////////////////////////////////////////////////////////////
181 // Debug knobs
182 ///////////////////////////////////////////////////////////////////////////////
183 //#define KNOB_ENABLE_RDTSC
184
185 // Set to 1 to use the dynamic KNOB_TOSS_XXXX knobs.
186 #if !defined(KNOB_ENABLE_TOSS_POINTS)
187 #define KNOB_ENABLE_TOSS_POINTS 0
188 #endif
189