1 /*
2  * Copyright 2013 Red Hat Inc.
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 shall be included in
12  * all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20  * OTHER DEALINGS IN THE SOFTWARE.
21  *
22  * Authors: Ben Skeggs <bskeggs@redhat.com>
23  */
24 
25 #include "ctxnvc0.h"
26 
27 /*******************************************************************************
28  * PGRAPH context register lists
29  ******************************************************************************/
30 
31 static const struct nvc0_gr_init
32 gk110b_grctx_init_sm_0[] = {
33 	{ 0x419e04,   1, 0x04, 0x00000000 },
34 	{ 0x419e08,   1, 0x04, 0x0000001d },
35 	{ 0x419e0c,   1, 0x04, 0x00000000 },
36 	{ 0x419e10,   1, 0x04, 0x00001c02 },
37 	{ 0x419e44,   1, 0x04, 0x0013eff2 },
38 	{ 0x419e48,   1, 0x04, 0x00000000 },
39 	{ 0x419e4c,   1, 0x04, 0x0000007f },
40 	{ 0x419e50,   2, 0x04, 0x00000000 },
41 	{ 0x419e58,   1, 0x04, 0x00000001 },
42 	{ 0x419e5c,   3, 0x04, 0x00000000 },
43 	{ 0x419e68,   1, 0x04, 0x00000002 },
44 	{ 0x419e6c,  12, 0x04, 0x00000000 },
45 	{ 0x419eac,   1, 0x04, 0x00001f8f },
46 	{ 0x419eb0,   1, 0x04, 0x0db00d2f },
47 	{ 0x419eb8,   1, 0x04, 0x00000000 },
48 	{ 0x419ec8,   1, 0x04, 0x0001304f },
49 	{ 0x419f30,   4, 0x04, 0x00000000 },
50 	{ 0x419f40,   1, 0x04, 0x00000018 },
51 	{ 0x419f44,   3, 0x04, 0x00000000 },
52 	{ 0x419f58,   1, 0x04, 0x00000000 },
53 	{ 0x419f70,   1, 0x04, 0x00006300 },
54 	{ 0x419f78,   1, 0x04, 0x000000eb },
55 	{ 0x419f7c,   1, 0x04, 0x00000404 },
56 	{}
57 };
58 
59 static const struct nvc0_gr_pack
60 gk110b_grctx_pack_tpc[] = {
61 	{ nvd7_grctx_init_pe_0 },
62 	{ nvf0_grctx_init_tex_0 },
63 	{ nvf0_grctx_init_mpc_0 },
64 	{ nvf0_grctx_init_l1c_0 },
65 	{ gk110b_grctx_init_sm_0 },
66 	{}
67 };
68 
69 /*******************************************************************************
70  * PGRAPH context implementation
71  ******************************************************************************/
72 
73 struct nouveau_oclass *
74 gk110b_grctx_oclass = &(struct nvc0_grctx_oclass) {
75 	.base.handle = NV_ENGCTX(GR, 0xf1),
76 	.base.ofuncs = &(struct nouveau_ofuncs) {
77 		.ctor = nvc0_gr_context_ctor,
78 		.dtor = nvc0_gr_context_dtor,
79 		.init = _nouveau_gr_context_init,
80 		.fini = _nouveau_gr_context_fini,
81 		.rd32 = _nouveau_gr_context_rd32,
82 		.wr32 = _nouveau_gr_context_wr32,
83 	},
84 	.main  = nve4_grctx_generate_main,
85 	.unkn  = nve4_grctx_generate_unkn,
86 	.hub   = nvf0_grctx_pack_hub,
87 	.gpc   = nvf0_grctx_pack_gpc,
88 	.zcull = nvc0_grctx_pack_zcull,
89 	.tpc   = gk110b_grctx_pack_tpc,
90 	.ppc   = nvf0_grctx_pack_ppc,
91 	.icmd  = nvf0_grctx_pack_icmd,
92 	.mthd  = nvf0_grctx_pack_mthd,
93 	.bundle = nve4_grctx_generate_bundle,
94 	.bundle_size = 0x3000,
95 	.bundle_min_gpm_fifo_depth = 0x180,
96 	.bundle_token_limit = 0x600,
97 	.pagepool = nve4_grctx_generate_pagepool,
98 	.pagepool_size = 0x8000,
99 	.attrib = nvd7_grctx_generate_attrib,
100 	.attrib_nr_max = 0x324,
101 	.attrib_nr = 0x218,
102 	.alpha_nr_max = 0x7ff,
103 	.alpha_nr = 0x648,
104 }.base;
105