1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22#include "wimm.h"
23#include "atom.h"
24#include "wndw.h"
25
26#include <nvif/clc37b.h>
27#include <nvif/pushc37b.h>
28
29#include <nvhw/class/clc37b.h>
30
31static int
32wimmc37b_update(struct nv50_wndw *wndw, u32 *interlock)
33{
34 struct nvif_push *push = wndw->wimm.push;
35 int ret;
36
37 if ((ret = PUSH_WAIT(push, 2)))
38 return ret;
39
40 PUSH_MTHD(push, NVC37B, UPDATE, 0x00000001 |
41 NVVAL(NVC37B, UPDATE, INTERLOCK_WITH_WINDOW,
42 !!(interlock[NV50_DISP_INTERLOCK_WNDW] & wndw->interlock.data)));
43 return PUSH_KICK(push);
44}
45
46static int
47wimmc37b_point(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
48{
49 struct nvif_push *push = wndw->wimm.push;
50 int ret;
51
52 if ((ret = PUSH_WAIT(push, 2)))
53 return ret;
54
55 PUSH_MTHD(push, NVC37B, SET_POINT_OUT(0),
56 NVVAL(NVC37B, SET_POINT_OUT, X, asyw->point.x) |
57 NVVAL(NVC37B, SET_POINT_OUT, Y, asyw->point.y));
58 return 0;
59}
60
61static const struct nv50_wimm_func
62wimmc37b = {
63 .point = wimmc37b_point,
64 .update = wimmc37b_update,
65};
66
67static int
68wimmc37b_init_(const struct nv50_wimm_func *func, struct nouveau_drm *drm,
69 s32 oclass, struct nv50_wndw *wndw)
70{
71 struct nvc37b_window_imm_channel_dma_v0 args = {
72 .pushbuf = 0xb0007b00 | wndw->id,
73 .index = wndw->id,
74 };
75 struct nv50_disp *disp = nv50_disp(drm->dev);
76 int ret;
77
78 ret = nv50_dmac_create(&drm->client.device, &disp->disp->object,
79 &oclass, 0, &args, sizeof(args), -1,
80 &wndw->wimm);
81 if (ret) {
82 NV_ERROR(drm, "wimm%04x allocation failed: %d\n", oclass, ret);
83 return ret;
84 }
85
86 wndw->interlock.wimm = wndw->interlock.data;
87 wndw->immd = func;
88 return 0;
89}
90
91int
92wimmc37b_init(struct nouveau_drm *drm, s32 oclass, struct nv50_wndw *wndw)
93{
94 return wimmc37b_init_(&wimmc37b, drm, oclass, wndw);
95}
96