blob: 25df6b93c93ad3bd9e11fc382d605832c2dae89f [file] [log] [blame]
Ben Skeggs70cabe42012-08-14 10:04:04 +10001/*
2 * Copyright 2012 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
23 */
24
25#include <engine/software.h>
26#include <engine/disp.h>
27
Ben Skeggs370c00f2012-08-14 14:11:49 +100028#include <core/class.h>
29
Ben Skeggs70cabe42012-08-14 10:04:04 +100030#include "nv50.h"
31
Ben Skeggsa8f8b482014-02-20 21:33:34 +100032/*******************************************************************************
33 * Base display object
34 ******************************************************************************/
35
Ben Skeggs70cabe42012-08-14 10:04:04 +100036static struct nouveau_oclass
37nva3_disp_sclass[] = {
Ben Skeggs2c04ae02014-08-10 04:10:25 +100038 { NVA3_DISP_MAST_CLASS, &nv50_disp_mast_ofuncs.base },
39 { NVA3_DISP_SYNC_CLASS, &nv50_disp_sync_ofuncs.base },
40 { NVA3_DISP_OVLY_CLASS, &nv50_disp_ovly_ofuncs.base },
41 { NVA3_DISP_OIMM_CLASS, &nv50_disp_oimm_ofuncs.base },
42 { NVA3_DISP_CURS_CLASS, &nv50_disp_curs_ofuncs.base },
Ben Skeggs70cabe42012-08-14 10:04:04 +100043 {}
44};
45
46static struct nouveau_oclass
47nva3_disp_base_oclass[] = {
Ben Skeggs4952b4d2014-08-10 04:10:27 +100048 { NVA3_DISP_CLASS, &nv50_disp_base_ofuncs },
Ben Skeggs370c00f2012-08-14 14:11:49 +100049 {}
Ben Skeggs70cabe42012-08-14 10:04:04 +100050};
51
Ben Skeggsa8f8b482014-02-20 21:33:34 +100052/*******************************************************************************
53 * Display engine implementation
54 ******************************************************************************/
55
Ben Skeggs70cabe42012-08-14 10:04:04 +100056static int
57nva3_disp_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
58 struct nouveau_oclass *oclass, void *data, u32 size,
59 struct nouveau_object **pobject)
60{
61 struct nv50_disp_priv *priv;
62 int ret;
63
Ben Skeggs1d7c71a2013-01-31 09:23:34 +100064 ret = nouveau_disp_create(parent, engine, oclass, 2, "PDISP",
Ben Skeggs70cabe42012-08-14 10:04:04 +100065 "display", &priv);
66 *pobject = nv_object(priv);
67 if (ret)
68 return ret;
69
70 nv_engine(priv)->sclass = nva3_disp_base_oclass;
71 nv_engine(priv)->cclass = &nv50_disp_cclass;
72 nv_subdev(priv)->intr = nv50_disp_intr;
Ben Skeggs5cc027f2013-02-18 17:50:51 -050073 INIT_WORK(&priv->supervisor, nv50_disp_intr_supervisor);
Ben Skeggs70cabe42012-08-14 10:04:04 +100074 priv->sclass = nva3_disp_sclass;
75 priv->head.nr = 2;
76 priv->dac.nr = 3;
77 priv->sor.nr = 4;
Ben Skeggsa2bc2832013-02-11 09:11:08 +100078 priv->pior.nr = 3;
Ben Skeggsef22c8b2012-11-09 09:32:56 +100079 priv->dac.power = nv50_dac_power;
Ben Skeggs7ebb38b2012-11-09 09:38:06 +100080 priv->dac.sense = nv50_dac_sense;
Ben Skeggsef22c8b2012-11-09 09:32:56 +100081 priv->sor.power = nv50_sor_power;
Ben Skeggsa4feaf42012-11-09 10:38:10 +100082 priv->sor.hda_eld = nva3_hda_eld;
Ben Skeggs8e9e3d22012-11-09 10:54:38 +100083 priv->sor.hdmi = nva3_hdmi_ctrl;
Ben Skeggsa2bc2832013-02-11 09:11:08 +100084 priv->pior.power = nv50_pior_power;
Ben Skeggs70cabe42012-08-14 10:04:04 +100085 return 0;
86}
87
Ben Skeggsa8f8b482014-02-20 21:33:34 +100088struct nouveau_oclass *
89nva3_disp_oclass = &(struct nv50_disp_impl) {
90 .base.base.handle = NV_ENGINE(DISP, 0x85),
91 .base.base.ofuncs = &(struct nouveau_ofuncs) {
Ben Skeggs70cabe42012-08-14 10:04:04 +100092 .ctor = nva3_disp_ctor,
93 .dtor = _nouveau_disp_dtor,
94 .init = _nouveau_disp_init,
95 .fini = _nouveau_disp_fini,
96 },
Ben Skeggs79ca2772014-08-10 04:10:20 +100097 .base.vblank = &nv50_disp_vblank_func,
Ben Skeggsb8407c92014-05-17 11:19:54 +100098 .base.outp = nv94_disp_outp_sclass,
Ben Skeggsd67d92c2014-02-20 15:14:10 +100099 .mthd.core = &nv94_disp_mast_mthd_chan,
100 .mthd.base = &nv84_disp_sync_mthd_chan,
101 .mthd.ovly = &nv84_disp_ovly_mthd_chan,
102 .mthd.prev = 0x000004,
Ben Skeggs4952b4d2014-08-10 04:10:27 +1000103 .head.scanoutpos = nv50_disp_base_scanoutpos,
Ben Skeggsa8f8b482014-02-20 21:33:34 +1000104}.base.base;