forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-06 08f87f769b595151be1afeff53e144f543faa614
kernel/drivers/gpu/drm/nouveau/dispnv50/ovly827e.c
....@@ -24,29 +24,45 @@
2424
2525 #include <nouveau_bo.h>
2626
27
-static void
27
+#include <nvif/push507c.h>
28
+#include <nvif/timer.h>
29
+
30
+#include <nvhw/class/cl827e.h>
31
+
32
+static int
2833 ovly827e_image_set(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
2934 {
30
- u32 *push;
31
- if ((push = evo_wait(&wndw->wndw, 12))) {
32
- evo_mthd(push, 0x0084, 1);
33
- evo_data(push, asyw->image.interval << 4);
34
- evo_mthd(push, 0x00c0, 1);
35
- evo_data(push, asyw->image.handle[0]);
36
- evo_mthd(push, 0x0100, 1);
37
- evo_data(push, 0x00000002);
38
- evo_mthd(push, 0x0800, 1);
39
- evo_data(push, asyw->image.offset[0] >> 8);
40
- evo_mthd(push, 0x0808, 3);
41
- evo_data(push, asyw->image.h << 16 | asyw->image.w);
42
- evo_data(push, asyw->image.layout << 20 |
43
- (asyw->image.pitch[0] >> 8) << 8 |
44
- asyw->image.blocks[0] << 8 |
45
- asyw->image.blockh);
46
- evo_data(push, asyw->image.format << 8 |
47
- asyw->image.colorspace);
48
- evo_kick(push, &wndw->wndw);
49
- }
35
+ struct nvif_push *push = wndw->wndw.push;
36
+ int ret;
37
+
38
+ if ((ret = PUSH_WAIT(push, 12)))
39
+ return ret;
40
+
41
+ PUSH_MTHD(push, NV827E, SET_PRESENT_CONTROL,
42
+ NVDEF(NV827E, SET_PRESENT_CONTROL, BEGIN_MODE, ASAP) |
43
+ NVVAL(NV827E, SET_PRESENT_CONTROL, MIN_PRESENT_INTERVAL, asyw->image.interval));
44
+
45
+ PUSH_MTHD(push, NV827E, SET_CONTEXT_DMA_ISO, asyw->image.handle[0]);
46
+
47
+ PUSH_MTHD(push, NV827E, SET_COMPOSITION_CONTROL,
48
+ NVDEF(NV827E, SET_COMPOSITION_CONTROL, MODE, OPAQUE_SUSPEND_BASE));
49
+
50
+ PUSH_MTHD(push, NV827E, SURFACE_SET_OFFSET, asyw->image.offset[0] >> 8);
51
+
52
+ PUSH_MTHD(push, NV827E, SURFACE_SET_SIZE,
53
+ NVVAL(NV827E, SURFACE_SET_SIZE, WIDTH, asyw->image.w) |
54
+ NVVAL(NV827E, SURFACE_SET_SIZE, HEIGHT, asyw->image.h),
55
+
56
+ SURFACE_SET_STORAGE,
57
+ NVVAL(NV827E, SURFACE_SET_STORAGE, BLOCK_HEIGHT, asyw->image.blockh) |
58
+ NVVAL(NV827E, SURFACE_SET_STORAGE, PITCH, (asyw->image.pitch[0] >> 8)) |
59
+ NVVAL(NV827E, SURFACE_SET_STORAGE, PITCH, asyw->image.blocks[0]) |
60
+ NVVAL(NV827E, SURFACE_SET_STORAGE, MEMORY_LAYOUT, asyw->image.layout),
61
+
62
+ SURFACE_SET_PARAMS,
63
+ NVVAL(NV827E, SURFACE_SET_PARAMS, FORMAT, asyw->image.format) |
64
+ NVVAL(NV827E, SURFACE_SET_PARAMS, COLOR_SPACE, asyw->image.colorspace));
65
+ return 0;
5066 }
5167
5268 int
....@@ -54,8 +70,7 @@
5470 struct nvif_device *device)
5571 {
5672 s64 time = nvif_msec(device, 2000ULL,
57
- u32 data = nouveau_bo_rd32(bo, offset / 4 + 3);
58
- if ((data & 0xffff0000) == 0xffff0000)
73
+ if (NVBO_TD32(bo, offset, NV_DISP_NOTIFICATION_1, _3, STATUS, ==, BEGUN))
5974 break;
6075 usleep_range(1, 2);
6176 );
....@@ -65,24 +80,25 @@
6580 void
6681 ovly827e_ntfy_reset(struct nouveau_bo *bo, u32 offset)
6782 {
68
- nouveau_bo_wr32(bo, offset / 4 + 0, 0x00000000);
69
- nouveau_bo_wr32(bo, offset / 4 + 1, 0x00000000);
70
- nouveau_bo_wr32(bo, offset / 4 + 2, 0x00000000);
71
- nouveau_bo_wr32(bo, offset / 4 + 3, 0x80000000);
83
+ NVBO_WR32(bo, offset, NV_DISP_NOTIFICATION_1, TIME_STAMP_0, 0);
84
+ NVBO_WR32(bo, offset, NV_DISP_NOTIFICATION_1, TIME_STAMP_1, 0);
85
+ NVBO_WR32(bo, offset, NV_DISP_NOTIFICATION_1, _2, 0);
86
+ NVBO_WR32(bo, offset, NV_DISP_NOTIFICATION_1, _3,
87
+ NVDEF(NV_DISP_NOTIFICATION_1, _3, STATUS, NOT_BEGUN));
7288 }
7389
7490 static const struct nv50_wndw_func
7591 ovly827e = {
7692 .acquire = ovly507e_acquire,
7793 .release = ovly507e_release,
78
- .ntfy_set = ovly507e_ntfy_set,
79
- .ntfy_clr = ovly507e_ntfy_clr,
94
+ .ntfy_set = base507c_ntfy_set,
95
+ .ntfy_clr = base507c_ntfy_clr,
8096 .ntfy_reset = ovly827e_ntfy_reset,
8197 .ntfy_wait_begun = ovly827e_ntfy_wait_begun,
8298 .image_set = ovly827e_image_set,
83
- .image_clr = ovly507e_image_clr,
99
+ .image_clr = base507c_image_clr,
84100 .scale_set = ovly507e_scale_set,
85
- .update = ovly507e_update,
101
+ .update = base507c_update,
86102 };
87103
88104 const u32
....@@ -90,11 +106,8 @@
90106 DRM_FORMAT_YUYV,
91107 DRM_FORMAT_UYVY,
92108 DRM_FORMAT_XRGB8888,
93
- DRM_FORMAT_ARGB8888,
94109 DRM_FORMAT_XRGB1555,
95
- DRM_FORMAT_ARGB1555,
96110 DRM_FORMAT_XBGR2101010,
97
- DRM_FORMAT_ABGR2101010,
98111 0
99112 };
100113