2 * Copyright 2018 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.
24 #include <core/client.h>
26 #include <nvif/clc37e.h>
27 #include <nvif/unpack.h>
29 static const struct nv50_disp_mthd_list
30 gv100_disp_wndw_mthd_base = {
100 { 0x032c, 0x69032c },
101 { 0x033c, 0x69033c },
102 { 0x0340, 0x690340 },
103 { 0x0344, 0x690344 },
104 { 0x0348, 0x690348 },
105 { 0x034c, 0x69034c },
106 { 0x0350, 0x690350 },
107 { 0x0354, 0x690354 },
108 { 0x0358, 0x690358 },
109 { 0x0364, 0x690364 },
110 { 0x0368, 0x690368 },
111 { 0x036c, 0x69036c },
112 { 0x0370, 0x690370 },
113 { 0x0374, 0x690374 },
114 { 0x0380, 0x690380 },
119 const struct nv50_disp_chan_mthd
120 gv100_disp_wndw_mthd = {
125 { "Global", 1, &gv100_disp_wndw_mthd_base },
131 gv100_disp_wndw_intr(struct nv50_disp_chan *chan, bool en)
133 struct nvkm_device *device = chan->disp->base.engine.subdev.device;
134 const u32 mask = 0x00000001 << chan->head;
135 const u32 data = en ? mask : 0;
136 nvkm_mask(device, 0x611da4, mask, data);
139 const struct nv50_disp_chan_func
141 .init = gv100_disp_dmac_init,
142 .fini = gv100_disp_dmac_fini,
143 .intr = gv100_disp_wndw_intr,
144 .user = gv100_disp_chan_user,
145 .bind = gv100_disp_dmac_bind,
149 gv100_disp_wndw_new_(const struct nv50_disp_chan_func *func,
150 const struct nv50_disp_chan_mthd *mthd,
151 struct nv50_disp *disp, int chid,
152 const struct nvkm_oclass *oclass, void *argv, u32 argc,
153 struct nvkm_object **pobject)
156 struct nvc37e_window_channel_dma_v0 v0;
158 struct nvkm_object *parent = oclass->parent;
159 int wndw, ret = -ENOSYS;
162 nvif_ioctl(parent, "create window channel dma size %d\n", argc);
163 if (!(ret = nvif_unpack(ret, &argv, &argc, args->v0, 0, 0, false))) {
164 nvif_ioctl(parent, "create window channel dma vers %d "
165 "pushbuf %016llx index %d\n",
166 args->v0.version, args->v0.pushbuf, args->v0.index);
167 if (!(disp->wndw.mask & BIT(args->v0.index)))
169 push = args->v0.pushbuf;
170 wndw = args->v0.index;
174 return nv50_disp_dmac_new_(func, mthd, disp, chid + wndw,
175 wndw, push, oclass, pobject);
179 gv100_disp_wndw_new(const struct nvkm_oclass *oclass, void *argv, u32 argc,
180 struct nv50_disp *disp, struct nvkm_object **pobject)
182 return gv100_disp_wndw_new_(&gv100_disp_wndw, &gv100_disp_wndw_mthd,
183 disp, 1, oclass, argv, argc, pobject);