.. | .. |
---|
23 | 23 | #include "atom.h" |
---|
24 | 24 | |
---|
25 | 25 | #include <drm/drm_atomic_helper.h> |
---|
| 26 | +#include <drm/drm_fourcc.h> |
---|
26 | 27 | #include <drm/drm_plane_helper.h> |
---|
27 | 28 | |
---|
28 | 29 | #include <nvif/cl507e.h> |
---|
29 | 30 | #include <nvif/event.h> |
---|
| 31 | +#include <nvif/push507c.h> |
---|
30 | 32 | |
---|
31 | | -void |
---|
32 | | -ovly507e_update(struct nv50_wndw *wndw, u32 *interlock) |
---|
33 | | -{ |
---|
34 | | - u32 *push; |
---|
35 | | - if ((push = evo_wait(&wndw->wndw, 2))) { |
---|
36 | | - evo_mthd(push, 0x0080, 1); |
---|
37 | | - evo_data(push, interlock[NV50_DISP_INTERLOCK_CORE]); |
---|
38 | | - evo_kick(push, &wndw->wndw); |
---|
39 | | - } |
---|
40 | | -} |
---|
| 33 | +#include <nvhw/class/cl507e.h> |
---|
41 | 34 | |
---|
42 | | -void |
---|
| 35 | +int |
---|
43 | 36 | ovly507e_scale_set(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw) |
---|
44 | 37 | { |
---|
45 | | - u32 *push; |
---|
46 | | - if ((push = evo_wait(&wndw->wndw, 4))) { |
---|
47 | | - evo_mthd(push, 0x00e0, 3); |
---|
48 | | - evo_data(push, asyw->scale.sy << 16 | asyw->scale.sx); |
---|
49 | | - evo_data(push, asyw->scale.sh << 16 | asyw->scale.sw); |
---|
50 | | - evo_data(push, asyw->scale.dw); |
---|
51 | | - evo_kick(push, &wndw->wndw); |
---|
52 | | - } |
---|
| 38 | + struct nvif_push *push = wndw->wndw.push; |
---|
| 39 | + int ret; |
---|
| 40 | + |
---|
| 41 | + if ((ret = PUSH_WAIT(push, 4))) |
---|
| 42 | + return ret; |
---|
| 43 | + |
---|
| 44 | + PUSH_MTHD(push, NV507E, SET_POINT_IN, |
---|
| 45 | + NVVAL(NV507E, SET_POINT_IN, X, asyw->scale.sx) | |
---|
| 46 | + NVVAL(NV507E, SET_POINT_IN, Y, asyw->scale.sy), |
---|
| 47 | + |
---|
| 48 | + SET_SIZE_IN, |
---|
| 49 | + NVVAL(NV507E, SET_SIZE_IN, WIDTH, asyw->scale.sw) | |
---|
| 50 | + NVVAL(NV507E, SET_SIZE_IN, HEIGHT, asyw->scale.sh), |
---|
| 51 | + |
---|
| 52 | + SET_SIZE_OUT, |
---|
| 53 | + NVVAL(NV507E, SET_SIZE_OUT, WIDTH, asyw->scale.dw)); |
---|
| 54 | + return 0; |
---|
53 | 55 | } |
---|
54 | 56 | |
---|
55 | | -void |
---|
56 | | -ovly507e_image_clr(struct nv50_wndw *wndw) |
---|
57 | | -{ |
---|
58 | | - u32 *push; |
---|
59 | | - if ((push = evo_wait(&wndw->wndw, 4))) { |
---|
60 | | - evo_mthd(push, 0x0084, 1); |
---|
61 | | - evo_data(push, 0x00000000); |
---|
62 | | - evo_mthd(push, 0x00c0, 1); |
---|
63 | | - evo_data(push, 0x00000000); |
---|
64 | | - evo_kick(push, &wndw->wndw); |
---|
65 | | - } |
---|
66 | | -} |
---|
67 | | - |
---|
68 | | -static void |
---|
| 57 | +static int |
---|
69 | 58 | ovly507e_image_set(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw) |
---|
70 | 59 | { |
---|
71 | | - u32 *push; |
---|
72 | | - if ((push = evo_wait(&wndw->wndw, 12))) { |
---|
73 | | - evo_mthd(push, 0x0084, 1); |
---|
74 | | - evo_data(push, asyw->image.interval << 4); |
---|
75 | | - evo_mthd(push, 0x00c0, 1); |
---|
76 | | - evo_data(push, asyw->image.handle[0]); |
---|
77 | | - evo_mthd(push, 0x0100, 1); |
---|
78 | | - evo_data(push, 0x00000002); |
---|
79 | | - evo_mthd(push, 0x0800, 1); |
---|
80 | | - evo_data(push, asyw->image.offset[0] >> 8); |
---|
81 | | - evo_mthd(push, 0x0808, 3); |
---|
82 | | - evo_data(push, asyw->image.h << 16 | asyw->image.w); |
---|
83 | | - evo_data(push, asyw->image.layout << 20 | |
---|
84 | | - (asyw->image.pitch[0] >> 8) << 8 | |
---|
85 | | - asyw->image.blocks[0] << 8 | |
---|
86 | | - asyw->image.blockh); |
---|
87 | | - evo_data(push, asyw->image.kind << 16 | |
---|
88 | | - asyw->image.format << 8 | |
---|
89 | | - asyw->image.colorspace); |
---|
90 | | - evo_kick(push, &wndw->wndw); |
---|
91 | | - } |
---|
92 | | -} |
---|
| 60 | + struct nvif_push *push = wndw->wndw.push; |
---|
| 61 | + int ret; |
---|
93 | 62 | |
---|
94 | | -void |
---|
95 | | -ovly507e_ntfy_clr(struct nv50_wndw *wndw) |
---|
96 | | -{ |
---|
97 | | - u32 *push; |
---|
98 | | - if ((push = evo_wait(&wndw->wndw, 2))) { |
---|
99 | | - evo_mthd(push, 0x00a4, 1); |
---|
100 | | - evo_data(push, 0x00000000); |
---|
101 | | - evo_kick(push, &wndw->wndw); |
---|
102 | | - } |
---|
103 | | -} |
---|
| 63 | + if ((ret = PUSH_WAIT(push, 12))) |
---|
| 64 | + return ret; |
---|
104 | 65 | |
---|
105 | | -void |
---|
106 | | -ovly507e_ntfy_set(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw) |
---|
107 | | -{ |
---|
108 | | - u32 *push; |
---|
109 | | - if ((push = evo_wait(&wndw->wndw, 3))) { |
---|
110 | | - evo_mthd(push, 0x00a0, 2); |
---|
111 | | - evo_data(push, asyw->ntfy.awaken << 30 | asyw->ntfy.offset); |
---|
112 | | - evo_data(push, asyw->ntfy.handle); |
---|
113 | | - evo_kick(push, &wndw->wndw); |
---|
114 | | - } |
---|
| 66 | + PUSH_MTHD(push, NV507E, SET_PRESENT_CONTROL, |
---|
| 67 | + NVDEF(NV507E, SET_PRESENT_CONTROL, BEGIN_MODE, ASAP) | |
---|
| 68 | + NVVAL(NV507E, SET_PRESENT_CONTROL, MIN_PRESENT_INTERVAL, asyw->image.interval)); |
---|
| 69 | + |
---|
| 70 | + PUSH_MTHD(push, NV507E, SET_CONTEXT_DMA_ISO, asyw->image.handle[0]); |
---|
| 71 | + |
---|
| 72 | + PUSH_MTHD(push, NV507E, SET_COMPOSITION_CONTROL, |
---|
| 73 | + NVDEF(NV507E, SET_COMPOSITION_CONTROL, MODE, OPAQUE_SUSPEND_BASE)); |
---|
| 74 | + |
---|
| 75 | + PUSH_MTHD(push, NV507E, SURFACE_SET_OFFSET, asyw->image.offset[0] >> 8); |
---|
| 76 | + |
---|
| 77 | + PUSH_MTHD(push, NV507E, SURFACE_SET_SIZE, |
---|
| 78 | + NVVAL(NV507E, SURFACE_SET_SIZE, WIDTH, asyw->image.w) | |
---|
| 79 | + NVVAL(NV507E, SURFACE_SET_SIZE, HEIGHT, asyw->image.h), |
---|
| 80 | + |
---|
| 81 | + SURFACE_SET_STORAGE, |
---|
| 82 | + NVVAL(NV507E, SURFACE_SET_STORAGE, BLOCK_HEIGHT, asyw->image.blockh) | |
---|
| 83 | + NVVAL(NV507E, SURFACE_SET_STORAGE, PITCH, (asyw->image.pitch[0] >> 8)) | |
---|
| 84 | + NVVAL(NV507E, SURFACE_SET_STORAGE, PITCH, asyw->image.blocks[0]) | |
---|
| 85 | + NVVAL(NV507E, SURFACE_SET_STORAGE, MEMORY_LAYOUT, asyw->image.layout), |
---|
| 86 | + |
---|
| 87 | + SURFACE_SET_PARAMS, |
---|
| 88 | + NVVAL(NV507E, SURFACE_SET_PARAMS, FORMAT, asyw->image.format) | |
---|
| 89 | + NVVAL(NV507E, SURFACE_SET_PARAMS, COLOR_SPACE, asyw->image.colorspace) | |
---|
| 90 | + NVVAL(NV507E, SURFACE_SET_PARAMS, KIND, asyw->image.kind) | |
---|
| 91 | + NVDEF(NV507E, SURFACE_SET_PARAMS, PART_STRIDE, PARTSTRIDE_256)); |
---|
| 92 | + return 0; |
---|
115 | 93 | } |
---|
116 | 94 | |
---|
117 | 95 | void |
---|
.. | .. |
---|
145 | 123 | ovly507e = { |
---|
146 | 124 | .acquire = ovly507e_acquire, |
---|
147 | 125 | .release = ovly507e_release, |
---|
148 | | - .ntfy_set = ovly507e_ntfy_set, |
---|
149 | | - .ntfy_clr = ovly507e_ntfy_clr, |
---|
| 126 | + .ntfy_set = base507c_ntfy_set, |
---|
| 127 | + .ntfy_clr = base507c_ntfy_clr, |
---|
150 | 128 | .ntfy_reset = base507c_ntfy_reset, |
---|
151 | 129 | .ntfy_wait_begun = base507c_ntfy_wait_begun, |
---|
152 | 130 | .image_set = ovly507e_image_set, |
---|
153 | | - .image_clr = ovly507e_image_clr, |
---|
| 131 | + .image_clr = base507c_image_clr, |
---|
154 | 132 | .scale_set = ovly507e_scale_set, |
---|
155 | | - .update = ovly507e_update, |
---|
| 133 | + .update = base507c_update, |
---|
156 | 134 | }; |
---|
157 | 135 | |
---|
158 | 136 | static const u32 |
---|
.. | .. |
---|
160 | 138 | DRM_FORMAT_YUYV, |
---|
161 | 139 | DRM_FORMAT_UYVY, |
---|
162 | 140 | DRM_FORMAT_XRGB8888, |
---|
163 | | - DRM_FORMAT_ARGB8888, |
---|
164 | 141 | DRM_FORMAT_XRGB1555, |
---|
165 | | - DRM_FORMAT_ARGB1555, |
---|
166 | 142 | 0 |
---|
167 | 143 | }; |
---|
168 | 144 | |
---|
.. | .. |
---|
187 | 163 | |
---|
188 | 164 | ret = nv50_dmac_create(&drm->client.device, &disp->disp->object, |
---|
189 | 165 | &oclass, 0, &args, sizeof(args), |
---|
190 | | - disp->sync->bo.offset, &wndw->wndw); |
---|
| 166 | + disp->sync->offset, &wndw->wndw); |
---|
191 | 167 | if (ret) { |
---|
192 | 168 | NV_ERROR(drm, "ovly%04x allocation failed: %d\n", oclass, ret); |
---|
193 | 169 | return ret; |
---|
194 | 170 | } |
---|
195 | 171 | |
---|
196 | | - ret = nvif_notify_init(&wndw->wndw.base.user, wndw->notify.func, false, |
---|
| 172 | + ret = nvif_notify_ctor(&wndw->wndw.base.user, "kmsOvlyNtfy", |
---|
| 173 | + wndw->notify.func, false, |
---|
197 | 174 | NV50_DISP_OVERLAY_CHANNEL_DMA_V0_NTFY_UEVENT, |
---|
198 | 175 | &(struct nvif_notify_uevent_req) {}, |
---|
199 | 176 | sizeof(struct nvif_notify_uevent_req), |
---|