forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-06 08f87f769b595151be1afeff53e144f543faa614
kernel/drivers/gpu/drm/nouveau/dispnv50/curs507a.c
....@@ -24,21 +24,48 @@
2424 #include "head.h"
2525
2626 #include <nvif/cl507a.h>
27
+#include <nvif/timer.h>
28
+
29
+#include <nvhw/class/cl507a.h>
2730
2831 #include <drm/drm_atomic_helper.h>
2932 #include <drm/drm_plane_helper.h>
3033
31
-static void
32
-curs507a_update(struct nv50_wndw *wndw, u32 *interlock)
34
+bool
35
+curs507a_space(struct nv50_wndw *wndw)
3336 {
34
- nvif_wr32(&wndw->wimm.base.user, 0x0080, 0x00000000);
37
+ nvif_msec(&nouveau_drm(wndw->plane.dev)->client.device, 100,
38
+ if (NVIF_TV32(&wndw->wimm.base.user, NV507A, FREE, COUNT, >=, 4))
39
+ return true;
40
+ );
41
+
42
+ WARN_ON(1);
43
+ return false;
3544 }
3645
37
-static void
46
+static int
47
+curs507a_update(struct nv50_wndw *wndw, u32 *interlock)
48
+{
49
+ struct nvif_object *user = &wndw->wimm.base.user;
50
+ int ret = nvif_chan_wait(&wndw->wimm, 1);
51
+ if (ret == 0) {
52
+ NVIF_WR32(user, NV507A, UPDATE,
53
+ NVDEF(NV507A, UPDATE, INTERLOCK_WITH_CORE, DISABLE));
54
+ }
55
+ return ret;
56
+}
57
+
58
+static int
3859 curs507a_point(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
3960 {
40
- nvif_wr32(&wndw->wimm.base.user, 0x0084, asyw->point.y << 16 |
41
- asyw->point.x);
61
+ struct nvif_object *user = &wndw->wimm.base.user;
62
+ int ret = nvif_chan_wait(&wndw->wimm, 1);
63
+ if (ret == 0) {
64
+ NVIF_WR32(user, NV507A, SET_CURSOR_HOT_SPOT_POINT_OUT,
65
+ NVVAL(NV507A, SET_CURSOR_HOT_SPOT_POINT_OUT, X, asyw->point.x) |
66
+ NVVAL(NV507A, SET_CURSOR_HOT_SPOT_POINT_OUT, Y, asyw->point.y));
67
+ }
68
+ return ret;
4269 }
4370
4471 const struct nv50_wimm_func
....@@ -123,8 +150,8 @@
123150 if (*pwndw = wndw, ret)
124151 return ret;
125152
126
- ret = nvif_object_init(&disp->disp->object, 0, oclass, &args,
127
- sizeof(args), &wndw->wimm.base.user);
153
+ ret = nvif_object_ctor(&disp->disp->object, "kmsCurs", 0, oclass,
154
+ &args, sizeof(args), &wndw->wimm.base.user);
128155 if (ret) {
129156 NV_ERROR(drm, "curs%04x allocation failed: %d\n", oclass, ret);
130157 return ret;