drm/nouveau/kms/nv50-: use NVIDIA's headers for wimm point()
authorBen Skeggs <bskeggs@redhat.com>
Sun, 21 Jun 2020 00:25:58 +0000 (10:25 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Fri, 24 Jul 2020 08:50:58 +0000 (18:50 +1000)
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
drivers/gpu/drm/nouveau/dispnv50/curs507a.c
drivers/gpu/drm/nouveau/dispnv50/cursc37a.c
drivers/gpu/drm/nouveau/dispnv50/wimmc37b.c
drivers/gpu/drm/nouveau/include/nvhw/class/clc37a.h [new file with mode: 0644]

index 070328aca16dd643ed922d313139e35f6639f57c..5e03b94848b4592d40d06f9efa56c102fb8db6df 100644 (file)
@@ -55,10 +55,12 @@ curs507a_update(struct nv50_wndw *wndw, u32 *interlock)
 static int
 curs507a_point(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
 {
+       struct nvif_object *user = &wndw->wimm.base.user;
        int ret = nvif_chan_wait(&wndw->wimm, 1);
        if (ret == 0) {
-               nvif_wr32(&wndw->wimm.base.user, 0x0084, asyw->point.y << 16 |
-                                                        asyw->point.x);
+               NVIF_WR32(user, NV507A, SET_CURSOR_HOT_SPOT_POINT_OUT,
+                         NVVAL(NV507A, SET_CURSOR_HOT_SPOT_POINT_OUT, X, asyw->point.x) |
+                         NVVAL(NV507A, SET_CURSOR_HOT_SPOT_POINT_OUT, Y, asyw->point.y));
        }
        return ret;
 }
index 9d96a246b39a3dd82c084e20c05f8e8de1c90d03..5bfb6f67c8c3f96941122cb775be21be12c7b7ba 100644 (file)
@@ -22,6 +22,8 @@
 #include "curs.h"
 #include "atom.h"
 
+#include <nvhw/class/clc37a.h>
+
 static int
 cursc37a_update(struct nv50_wndw *wndw, u32 *interlock)
 {
@@ -34,10 +36,12 @@ cursc37a_update(struct nv50_wndw *wndw, u32 *interlock)
 static int
 cursc37a_point(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
 {
+       struct nvif_object *user = &wndw->wimm.base.user;
        int ret = nvif_chan_wait(&wndw->wimm, 1);
        if (ret == 0) {
-               nvif_wr32(&wndw->wimm.base.user, 0x0208, asyw->point.y << 16 |
-                                                        asyw->point.x);
+               NVIF_WR32(user, NVC37A, SET_CURSOR_HOT_SPOT_POINT_OUT(0),
+                         NVVAL(NVC37A, SET_CURSOR_HOT_SPOT_POINT_OUT, X, asyw->point.x) |
+                         NVVAL(NVC37A, SET_CURSOR_HOT_SPOT_POINT_OUT, Y, asyw->point.y));
        }
        return ret;
 }
index c2009d4777360cdb7ae8016aa5869a7b29f369c8..d013f89cc371ca3313e4e38f480a51d89c7af859 100644 (file)
@@ -26,6 +26,8 @@
 #include <nvif/clc37b.h>
 #include <nvif/pushc37b.h>
 
+#include <nvhw/class/clc37b.h>
+
 static int
 wimmc37b_update(struct nv50_wndw *wndw, u32 *interlock)
 {
@@ -50,7 +52,9 @@ wimmc37b_point(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
        if ((ret = PUSH_WAIT(push, 2)))
                return ret;
 
-       PUSH_NVSQ(push, NVC37B, 0x0208, asyw->point.y << 16 | asyw->point.x);
+       PUSH_MTHD(push, NVC37B, SET_POINT_OUT(0),
+                 NVVAL(NVC37B, SET_POINT_OUT, X, asyw->point.x) |
+                 NVVAL(NVC37B, SET_POINT_OUT, Y, asyw->point.y));
        return 0;
 }
 
diff --git a/drivers/gpu/drm/nouveau/include/nvhw/class/clc37a.h b/drivers/gpu/drm/nouveau/include/nvhw/class/clc37a.h
new file mode 100644 (file)
index 0000000..ded616f
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 1993-2017, NVIDIA CORPORATION. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef _clc37a__h_
+#define _clc37a__h_
+
+#define NVC37A_UPDATE                                                           (0x00000200)
+#define NVC37A_SET_CURSOR_HOT_SPOT_POINT_OUT(b)                                 (0x00000208 + (b)*0x00000004)
+#define NVC37A_SET_CURSOR_HOT_SPOT_POINT_OUT_X                                  15:0
+#define NVC37A_SET_CURSOR_HOT_SPOT_POINT_OUT_Y                                  31:16
+#endif // _clc37a_h