forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-31 f70575805708cabdedea7498aaa3f710fde4d920
kernel/drivers/gpu/drm/nouveau/dispnv50/ovly507e.c
....@@ -23,95 +23,73 @@
2323 #include "atom.h"
2424
2525 #include <drm/drm_atomic_helper.h>
26
+#include <drm/drm_fourcc.h>
2627 #include <drm/drm_plane_helper.h>
2728
2829 #include <nvif/cl507e.h>
2930 #include <nvif/event.h>
31
+#include <nvif/push507c.h>
3032
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>
4134
42
-void
35
+int
4336 ovly507e_scale_set(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
4437 {
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;
5355 }
5456
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
6958 ovly507e_image_set(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
7059 {
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;
9362
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;
10465
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;
11593 }
11694
11795 void
....@@ -145,14 +123,14 @@
145123 ovly507e = {
146124 .acquire = ovly507e_acquire,
147125 .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,
150128 .ntfy_reset = base507c_ntfy_reset,
151129 .ntfy_wait_begun = base507c_ntfy_wait_begun,
152130 .image_set = ovly507e_image_set,
153
- .image_clr = ovly507e_image_clr,
131
+ .image_clr = base507c_image_clr,
154132 .scale_set = ovly507e_scale_set,
155
- .update = ovly507e_update,
133
+ .update = base507c_update,
156134 };
157135
158136 static const u32
....@@ -160,9 +138,7 @@
160138 DRM_FORMAT_YUYV,
161139 DRM_FORMAT_UYVY,
162140 DRM_FORMAT_XRGB8888,
163
- DRM_FORMAT_ARGB8888,
164141 DRM_FORMAT_XRGB1555,
165
- DRM_FORMAT_ARGB1555,
166142 0
167143 };
168144
....@@ -187,13 +163,14 @@
187163
188164 ret = nv50_dmac_create(&drm->client.device, &disp->disp->object,
189165 &oclass, 0, &args, sizeof(args),
190
- disp->sync->bo.offset, &wndw->wndw);
166
+ disp->sync->offset, &wndw->wndw);
191167 if (ret) {
192168 NV_ERROR(drm, "ovly%04x allocation failed: %d\n", oclass, ret);
193169 return ret;
194170 }
195171
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,
197174 NV50_DISP_OVERLAY_CHANNEL_DMA_V0_NTFY_UEVENT,
198175 &(struct nvif_notify_uevent_req) {},
199176 sizeof(struct nvif_notify_uevent_req),