Merge remote-tracking branch 'public/master' into vulkan
[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 // Architecture validation
39 ///////////////////////////////////////////////////////////////////////////////
40 #if !defined(KNOB_ARCH)
41 #define KNOB_ARCH KNOB_ARCH_AVX
42 #endif
43
44 #if (KNOB_ARCH == KNOB_ARCH_AVX)
45 #define KNOB_ARCH_ISA AVX
46 #define KNOB_ARCH_STR "AVX"
47 #define KNOB_SIMD_WIDTH 8
48 #define KNOB_SIMD_BYTES 32
49 #elif (KNOB_ARCH == KNOB_ARCH_AVX2)
50 #define KNOB_ARCH_ISA AVX2
51 #define KNOB_ARCH_STR "AVX2"
52 #define KNOB_SIMD_WIDTH 8
53 #define KNOB_SIMD_BYTES 32
54 #elif (KNOB_ARCH == KNOB_ARCH_AVX512)
55 #define KNOB_ARCH_ISA AVX512F
56 #define KNOB_ARCH_STR "AVX512"
57 #define KNOB_SIMD_WIDTH 16
58 #define KNOB_SIMD_BYTES 64
59 #error "AVX512 not yet supported"
60 #else
61 #error "Unknown architecture"
62 #endif
63
64 #define MAX_KNOB_ARCH_STR_LEN sizeof("AVX512_PLUS_PADDING")
65
66 ///////////////////////////////////////////////////////////////////////////////
67 // Configuration knobs
68 ///////////////////////////////////////////////////////////////////////////////
69 #define KNOB_MAX_NUM_THREADS 256 // Supports up to dual-HSW-Xeon.
70
71 // Maximum supported number of active vertex buffer streams
72 #define KNOB_NUM_STREAMS 32
73
74 // Maximum supported number of attributes per vertex
75 #define KNOB_NUM_ATTRIBUTES 38
76
77 // Maximum supported active viewports and scissors
78 #define KNOB_NUM_VIEWPORTS_SCISSORS 16
79
80 // Guardband range used by the clipper
81 #define KNOB_GUARDBAND_WIDTH 32768.0f
82 #define KNOB_GUARDBAND_HEIGHT 32768.0f
83
84 ///////////////////////////////
85 // Macro tile configuration
86 ///////////////////////////////
87
88 // raster tile dimensions
89 #define KNOB_TILE_X_DIM 8
90 #define KNOB_TILE_X_DIM_SHIFT 3
91 #define KNOB_TILE_Y_DIM 8
92 #define KNOB_TILE_Y_DIM_SHIFT 3
93
94 // fixed macrotile pixel dimension for now, eventually will be
95 // dynamically set based on tile format and pixel size
96 #define KNOB_MACROTILE_X_DIM 64
97 #define KNOB_MACROTILE_Y_DIM 64
98 #define KNOB_MACROTILE_X_DIM_FIXED (KNOB_MACROTILE_X_DIM << 8)
99 #define KNOB_MACROTILE_Y_DIM_FIXED (KNOB_MACROTILE_Y_DIM << 8)
100 #define KNOB_MACROTILE_X_DIM_FIXED_SHIFT 14
101 #define KNOB_MACROTILE_Y_DIM_FIXED_SHIFT 14
102 #define KNOB_MACROTILE_X_DIM_IN_TILES (KNOB_MACROTILE_X_DIM >> KNOB_TILE_X_DIM_SHIFT)
103 #define KNOB_MACROTILE_Y_DIM_IN_TILES (KNOB_MACROTILE_Y_DIM >> KNOB_TILE_Y_DIM_SHIFT)
104
105 // total # of hot tiles available. This should be enough to
106 // fully render a 16kx16k 128bpp render target
107 #define KNOB_NUM_HOT_TILES_X 256
108 #define KNOB_NUM_HOT_TILES_Y 256
109 #define KNOB_COLOR_HOT_TILE_FORMAT R32G32B32A32_FLOAT
110 #define KNOB_DEPTH_HOT_TILE_FORMAT R32_FLOAT
111 #define KNOB_STENCIL_HOT_TILE_FORMAT R8_UINT
112
113 // Max scissor rectangle
114 #define KNOB_MAX_SCISSOR_X KNOB_NUM_HOT_TILES_X * KNOB_MACROTILE_X_DIM
115 #define KNOB_MAX_SCISSOR_Y KNOB_NUM_HOT_TILES_Y * KNOB_MACROTILE_Y_DIM
116
117 #if KNOB_SIMD_WIDTH==8 && KNOB_TILE_X_DIM < 4
118 #error "incompatible width/tile dimensions"
119 #endif
120
121 #if KNOB_SIMD_WIDTH == 8
122 #define SIMD_TILE_X_DIM 4
123 #define SIMD_TILE_Y_DIM 2
124 #else
125 #error "Invalid simd width"
126 #endif
127
128 ///////////////////////////////////////////////////////////////////////////////
129 // Optimization knobs
130 ///////////////////////////////////////////////////////////////////////////////
131 #define KNOB_USE_FAST_SRGB TRUE
132
133 // enables cut-aware primitive assembler
134 #define KNOB_ENABLE_CUT_AWARE_PA TRUE
135
136 ///////////////////////////////////////////////////////////////////////////////
137 // Debug knobs
138 ///////////////////////////////////////////////////////////////////////////////
139 //#define KNOB_ENABLE_RDTSC
140
141 // Set to 1 to use the dynamic KNOB_TOSS_XXXX knobs.
142 #if !defined(KNOB_ENABLE_TOSS_POINTS)
143 #define KNOB_ENABLE_TOSS_POINTS 0
144 #endif
145