2 * Copyright 2012 Red Hat Inc.
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:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
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.
26 #include <nvif/class.h>
28 /*******************************************************************************
29 * EVO master channel object
30 ******************************************************************************/
32 const struct nv50_disp_mthd_list
33 g84_disp_core_mthd_dac = {
44 const struct nv50_disp_mthd_list
45 g84_disp_core_mthd_head = {
96 const struct nv50_disp_mthd_chan
97 g84_disp_core_mthd_chan = {
101 { "Global", 1, &nv50_disp_core_mthd_base },
102 { "DAC", 3, &g84_disp_core_mthd_dac },
103 { "SOR", 2, &nv50_disp_core_mthd_sor },
104 { "PIOR", 3, &nv50_disp_core_mthd_pior },
105 { "HEAD", 2, &g84_disp_core_mthd_head },
110 /*******************************************************************************
111 * EVO sync channel objects
112 ******************************************************************************/
114 static const struct nv50_disp_mthd_list
115 g84_disp_base_mthd_base = {
119 { 0x0080, 0x000000 },
120 { 0x0084, 0x0008c4 },
121 { 0x0088, 0x0008d0 },
122 { 0x008c, 0x0008dc },
123 { 0x0090, 0x0008e4 },
124 { 0x0094, 0x610884 },
125 { 0x00a0, 0x6108a0 },
126 { 0x00a4, 0x610878 },
127 { 0x00c0, 0x61086c },
128 { 0x00c4, 0x610800 },
129 { 0x00c8, 0x61080c },
130 { 0x00cc, 0x610818 },
131 { 0x00e0, 0x610858 },
132 { 0x00e4, 0x610860 },
133 { 0x00e8, 0x6108ac },
134 { 0x00ec, 0x6108b4 },
135 { 0x00fc, 0x610824 },
136 { 0x0100, 0x610894 },
137 { 0x0104, 0x61082c },
138 { 0x0110, 0x6108bc },
139 { 0x0114, 0x61088c },
144 const struct nv50_disp_mthd_chan
145 g84_disp_base_mthd_chan = {
149 { "Global", 1, &g84_disp_base_mthd_base },
150 { "Image", 2, &nv50_disp_base_mthd_image },
155 /*******************************************************************************
156 * EVO overlay channel objects
157 ******************************************************************************/
159 static const struct nv50_disp_mthd_list
160 g84_disp_ovly_mthd_base = {
164 { 0x0080, 0x000000 },
165 { 0x0084, 0x6109a0 },
166 { 0x0088, 0x6109c0 },
167 { 0x008c, 0x6109c8 },
168 { 0x0090, 0x6109b4 },
169 { 0x0094, 0x610970 },
170 { 0x00a0, 0x610998 },
171 { 0x00a4, 0x610964 },
172 { 0x00c0, 0x610958 },
173 { 0x00e0, 0x6109a8 },
174 { 0x00e4, 0x6109d0 },
175 { 0x00e8, 0x6109d8 },
176 { 0x0100, 0x61094c },
177 { 0x0104, 0x610984 },
178 { 0x0108, 0x61098c },
179 { 0x0800, 0x6109f8 },
180 { 0x0808, 0x610a08 },
181 { 0x080c, 0x610a10 },
182 { 0x0810, 0x610a00 },
187 const struct nv50_disp_mthd_chan
188 g84_disp_ovly_mthd_chan = {
192 { "Global", 1, &g84_disp_ovly_mthd_base },
197 /*******************************************************************************
198 * Base display object
199 ******************************************************************************/
201 static struct nvkm_oclass
202 g84_disp_sclass[] = {
203 { G82_DISP_CORE_CHANNEL_DMA, &nv50_disp_core_ofuncs.base },
204 { G82_DISP_BASE_CHANNEL_DMA, &nv50_disp_base_ofuncs.base },
205 { G82_DISP_OVERLAY_CHANNEL_DMA, &nv50_disp_ovly_ofuncs.base },
206 { G82_DISP_OVERLAY, &nv50_disp_oimm_ofuncs.base },
207 { G82_DISP_CURSOR, &nv50_disp_curs_ofuncs.base },
211 static struct nvkm_oclass
212 g84_disp_main_oclass[] = {
213 { G82_DISP, &nv50_disp_main_ofuncs },
217 /*******************************************************************************
218 * Display engine implementation
219 ******************************************************************************/
222 g84_disp_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
223 struct nvkm_oclass *oclass, void *data, u32 size,
224 struct nvkm_object **pobject)
226 struct nv50_disp_priv *priv;
229 ret = nvkm_disp_create(parent, engine, oclass, 2, "PDISP",
231 *pobject = nv_object(priv);
235 ret = nvkm_event_init(&nv50_disp_chan_uevent, 1, 9, &priv->uevent);
239 nv_engine(priv)->sclass = g84_disp_main_oclass;
240 nv_engine(priv)->cclass = &nv50_disp_cclass;
241 nv_subdev(priv)->intr = nv50_disp_intr;
242 INIT_WORK(&priv->supervisor, nv50_disp_intr_supervisor);
243 priv->sclass = g84_disp_sclass;
248 priv->dac.power = nv50_dac_power;
249 priv->dac.sense = nv50_dac_sense;
250 priv->sor.power = nv50_sor_power;
251 priv->sor.hdmi = g84_hdmi_ctrl;
252 priv->pior.power = nv50_pior_power;
257 g84_disp_oclass = &(struct nv50_disp_impl) {
258 .base.base.handle = NV_ENGINE(DISP, 0x82),
259 .base.base.ofuncs = &(struct nvkm_ofuncs) {
260 .ctor = g84_disp_ctor,
261 .dtor = _nvkm_disp_dtor,
262 .init = _nvkm_disp_init,
263 .fini = _nvkm_disp_fini,
265 .base.vblank = &nv50_disp_vblank_func,
266 .base.outp = nv50_disp_outp_sclass,
267 .mthd.core = &g84_disp_core_mthd_chan,
268 .mthd.base = &g84_disp_base_mthd_chan,
269 .mthd.ovly = &g84_disp_ovly_mthd_chan,
270 .mthd.prev = 0x000004,
271 .head.scanoutpos = nv50_disp_main_scanoutpos,