forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-06 08f87f769b595151be1afeff53e144f543faa614
kernel/drivers/gpu/drm/nouveau/dispnv50/ovly907e.c
....@@ -22,49 +22,75 @@
2222 #include "ovly.h"
2323 #include "atom.h"
2424
25
-static void
25
+#include <nvif/push507c.h>
26
+
27
+#include <nvhw/class/cl907e.h>
28
+
29
+static int
2630 ovly907e_image_set(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
2731 {
28
- u32 *push;
29
- if ((push = evo_wait(&wndw->wndw, 12))) {
30
- evo_mthd(push, 0x0084, 1);
31
- evo_data(push, asyw->image.interval << 4);
32
- evo_mthd(push, 0x00c0, 1);
33
- evo_data(push, asyw->image.handle[0]);
34
- evo_mthd(push, 0x0100, 1);
35
- evo_data(push, 0x00000002);
36
- evo_mthd(push, 0x0400, 1);
37
- evo_data(push, asyw->image.offset[0] >> 8);
38
- evo_mthd(push, 0x0408, 3);
39
- evo_data(push, asyw->image.h << 16 | asyw->image.w);
40
- evo_data(push, asyw->image.layout << 24 |
41
- (asyw->image.pitch[0] >> 8) << 8 |
42
- asyw->image.blocks[0] << 8 |
43
- asyw->image.blockh);
44
- evo_data(push, asyw->image.format << 8 |
45
- asyw->image.colorspace);
46
- evo_kick(push, &wndw->wndw);
47
- }
32
+ struct nvif_push *push = wndw->wndw.push;
33
+ int ret;
34
+
35
+ if ((ret = PUSH_WAIT(push, 12)))
36
+ return ret;
37
+
38
+ PUSH_MTHD(push, NV907E, SET_PRESENT_CONTROL,
39
+ NVDEF(NV907E, SET_PRESENT_CONTROL, BEGIN_MODE, ASAP) |
40
+ NVVAL(NV907E, SET_PRESENT_CONTROL, MIN_PRESENT_INTERVAL, asyw->image.interval));
41
+
42
+ PUSH_MTHD(push, NV907E, SET_CONTEXT_DMA_ISO, asyw->image.handle[0]);
43
+
44
+ PUSH_MTHD(push, NV907E, SET_COMPOSITION_CONTROL,
45
+ NVDEF(NV907E, SET_COMPOSITION_CONTROL, MODE, OPAQUE));
46
+
47
+ PUSH_MTHD(push, NV907E, SURFACE_SET_OFFSET, asyw->image.offset[0] >> 8);
48
+
49
+ PUSH_MTHD(push, NV907E, SURFACE_SET_SIZE,
50
+ NVVAL(NV907E, SURFACE_SET_SIZE, WIDTH, asyw->image.w) |
51
+ NVVAL(NV907E, SURFACE_SET_SIZE, HEIGHT, asyw->image.h),
52
+
53
+ SURFACE_SET_STORAGE,
54
+ NVVAL(NV907E, SURFACE_SET_STORAGE, BLOCK_HEIGHT, asyw->image.blockh) |
55
+ NVVAL(NV907E, SURFACE_SET_STORAGE, PITCH, (asyw->image.pitch[0] >> 8)) |
56
+ NVVAL(NV907E, SURFACE_SET_STORAGE, PITCH, asyw->image.blocks[0]) |
57
+ NVVAL(NV907E, SURFACE_SET_STORAGE, MEMORY_LAYOUT, asyw->image.layout),
58
+
59
+ SURFACE_SET_PARAMS,
60
+ NVVAL(NV907E, SURFACE_SET_PARAMS, FORMAT, asyw->image.format) |
61
+ NVVAL(NV907E, SURFACE_SET_PARAMS, COLOR_SPACE, asyw->image.colorspace));
62
+ return 0;
4863 }
4964
5065 const struct nv50_wndw_func
5166 ovly907e = {
5267 .acquire = ovly507e_acquire,
5368 .release = ovly507e_release,
54
- .ntfy_set = ovly507e_ntfy_set,
55
- .ntfy_clr = ovly507e_ntfy_clr,
69
+ .ntfy_set = base507c_ntfy_set,
70
+ .ntfy_clr = base507c_ntfy_clr,
5671 .ntfy_reset = ovly827e_ntfy_reset,
5772 .ntfy_wait_begun = ovly827e_ntfy_wait_begun,
5873 .image_set = ovly907e_image_set,
59
- .image_clr = ovly507e_image_clr,
74
+ .image_clr = base507c_image_clr,
6075 .scale_set = ovly507e_scale_set,
61
- .update = ovly507e_update,
76
+ .update = base507c_update,
77
+};
78
+
79
+static const u32
80
+ovly907e_format[] = {
81
+ DRM_FORMAT_YUYV,
82
+ DRM_FORMAT_UYVY,
83
+ DRM_FORMAT_XRGB8888,
84
+ DRM_FORMAT_XRGB1555,
85
+ DRM_FORMAT_XBGR2101010,
86
+ DRM_FORMAT_XBGR16161616F,
87
+ 0
6288 };
6389
6490 int
6591 ovly907e_new(struct nouveau_drm *drm, int head, s32 oclass,
6692 struct nv50_wndw **pwndw)
6793 {
68
- return ovly507e_new_(&ovly907e, ovly827e_format, drm, head, oclass,
94
+ return ovly507e_new_(&ovly907e, ovly907e_format, drm, head, oclass,
6995 0x00000004 << (head * 4), pwndw);
7096 }