1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
/*
* Copyright 2009 Joakim Sindholt <opensource@zhasha.com>
* Corbin Simpson <MostAwesomeDude@gmail.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* on the rights to use, copy, modify, merge, publish, distribute, sub
* license, and/or sell copies of the Software, and to permit persons to whom
* the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
* THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
* USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include "r300_state_invariant.h"
/* Calculate and emit invariant state. This is data that the 3D engine
* will probably want at the beginning of every CS, but it's not currently
* handled by any CSO setup, and in addition it doesn't really change much.
*
* Note that eventually this should be empty, but it's useful for development
* and general unduplication of code. */
void r300_emit_invariant_state(struct r300_context* r300)
{
struct r300_capabilities* caps = r300_screen(r300->context.screen)->caps;
CS_LOCALS(r300);
BEGIN_CS(24 + (caps->has_tcl ? 2: 0));
/* Various GB enables */
OUT_CS_REG(R300_GB_ENABLE, R300_GB_POINT_STUFF_ENABLE |
R300_GB_LINE_STUFF_ENABLE | R300_GB_TRIANGLE_STUFF_ENABLE);
/* Subpixel multisampling for AA */
OUT_CS_REG(R300_GB_MSPOS0, 0x66666666);
OUT_CS_REG(R300_GB_MSPOS1, 0x66666666);
/* GB tile config and pipe setup */
OUT_CS_REG(R300_GB_TILE_CONFIG, R300_GB_TILE_DISABLE |
r300_translate_gb_pipes(caps->num_frag_pipes));
/* Source of fog depth */
OUT_CS_REG(R300_GB_SELECT, R300_GB_FOG_SELECT_1_1_W);
/* AA enable */
OUT_CS_REG(R300_GB_AA_CONFIG, 0x0);
/* GA errata fixes. */
if (caps->is_r500) {
OUT_CS_REG(R300_GA_ENHANCE,
R300_GA_ENHANCE_DEADLOCK_CNTL_PREVENT_TCL |
R300_GA_ENHANCE_FASTSYNC_CNTL_ENABLE |
R500_GA_ENHANCE_REG_READWRITE_ENABLE |
R500_GA_ENHANCE_REG_NOSTALL_ENABLE);
} else {
OUT_CS_REG(R300_GA_ENHANCE,
R300_GA_ENHANCE_DEADLOCK_CNTL_PREVENT_TCL |
R300_GA_ENHANCE_FASTSYNC_CNTL_ENABLE);
}
/* Fog block. */
OUT_CS_REG(R300_FG_FOG_BLEND, 0x00000000);
OUT_CS_REG(R300_FG_FOG_COLOR_R, 0x00000000);
OUT_CS_REG(R300_FG_FOG_COLOR_G, 0x00000000);
OUT_CS_REG(R300_FG_FOG_COLOR_B, 0x00000000);
OUT_CS_REG(R300_FG_DEPTH_SRC, 0x00000000);
/* TCL-only stuff */
if (caps->has_tcl) {
/* Amount of time to wait for vertex fetches in PVS */
OUT_CS_REG(VAP_PVS_VTX_TIMEOUT_REG, 0xffff);
}
END_CS;
}
|