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