Skip to content

Commit 6162638

Browse files
author
Ben Skeggs
committed
drm/nouveau/kms/nv50-: use NVIDIA's headers for core crc_set_src()
Signed-off-by: Ben Skeggs <[email protected]> Reviewed-by: Lyude Paul <[email protected]>
1 parent c854bf9 commit 6162638

File tree

2 files changed

+30
-21
lines changed

2 files changed

+30
-21
lines changed

drivers/gpu/drm/nouveau/dispnv50/crc907d.c

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
#include <nvif/push507c.h>
1010

11+
#include <nvhw/class/cl907d.h>
12+
1113
#define CRC907D_MAX_ENTRIES 255
1214

1315
struct crc907d_notifier {
@@ -25,42 +27,45 @@ crc907d_set_src(struct nv50_head *head, int or,
2527
enum nv50_crc_source_type source,
2628
struct nv50_crc_notifier_ctx *ctx, u32 wndw)
2729
{
28-
struct drm_crtc *crtc = &head->base.base;
2930
struct nvif_push *push = nv50_disp(head->base.base.dev)->core->chan.push;
3031
const int i = head->base.index;
31-
u32 crc_args = 0xfff00000;
32+
u32 crc_args = NVDEF(NV907D, HEAD_SET_CRC_CONTROL, CONTROLLING_CHANNEL, CORE) |
33+
NVDEF(NV907D, HEAD_SET_CRC_CONTROL, EXPECT_BUFFER_COLLAPSE, FALSE) |
34+
NVDEF(NV907D, HEAD_SET_CRC_CONTROL, TIMESTAMP_MODE, FALSE) |
35+
NVDEF(NV907D, HEAD_SET_CRC_CONTROL, SECONDARY_OUTPUT, NONE) |
36+
NVDEF(NV907D, HEAD_SET_CRC_CONTROL, CRC_DURING_SNOOZE, DISABLE);
3237
int ret;
3338

3439
switch (source) {
3540
case NV50_CRC_SOURCE_TYPE_SOR:
36-
crc_args |= (0x00000f0f + or * 16) << 8;
41+
crc_args |= NVDEF(NV907D, HEAD_SET_CRC_CONTROL, PRIMARY_OUTPUT, SOR(or));
3742
break;
3843
case NV50_CRC_SOURCE_TYPE_PIOR:
39-
crc_args |= (0x000000ff + or * 256) << 8;
44+
crc_args |= NVDEF(NV907D, HEAD_SET_CRC_CONTROL, PRIMARY_OUTPUT, PIOR(or));
4045
break;
4146
case NV50_CRC_SOURCE_TYPE_DAC:
42-
crc_args |= (0x00000ff0 + or) << 8;
47+
crc_args |= NVDEF(NV907D, HEAD_SET_CRC_CONTROL, PRIMARY_OUTPUT, DAC(or));
4348
break;
4449
case NV50_CRC_SOURCE_TYPE_RG:
45-
crc_args |= (0x00000ff8 + drm_crtc_index(crtc)) << 8;
50+
crc_args |= NVDEF(NV907D, HEAD_SET_CRC_CONTROL, PRIMARY_OUTPUT, RG(i));
4651
break;
4752
case NV50_CRC_SOURCE_TYPE_SF:
48-
crc_args |= (0x00000f8f + drm_crtc_index(crtc) * 16) << 8;
53+
crc_args |= NVDEF(NV907D, HEAD_SET_CRC_CONTROL, PRIMARY_OUTPUT, SF(i));
4954
break;
5055
case NV50_CRC_SOURCE_NONE:
51-
crc_args |= 0x000fff00;
56+
crc_args |= NVDEF(NV907D, HEAD_SET_CRC_CONTROL, PRIMARY_OUTPUT, NONE);
5257
break;
5358
}
5459

5560
if ((ret = PUSH_WAIT(push, 4)))
5661
return ret;
5762

5863
if (source) {
59-
PUSH_NVSQ(push, NV907D, 0x0438 + (i * 0x300), ctx->ntfy.handle);
60-
PUSH_NVSQ(push, NV907D, 0x0430 + (i * 0x300), crc_args);
64+
PUSH_MTHD(push, NV907D, HEAD_SET_CONTEXT_DMA_CRC(i), ctx->ntfy.handle);
65+
PUSH_MTHD(push, NV907D, HEAD_SET_CRC_CONTROL(i), crc_args);
6166
} else {
62-
PUSH_NVSQ(push, NV907D, 0x0430 + (i * 0x300), crc_args);
63-
PUSH_NVSQ(push, NV907D, 0x0438 + (i * 0x300), 0);
67+
PUSH_MTHD(push, NV907D, HEAD_SET_CRC_CONTROL(i), crc_args);
68+
PUSH_MTHD(push, NV907D, HEAD_SET_CONTEXT_DMA_CRC(i), 0);
6469
}
6570

6671
return 0;

drivers/gpu/drm/nouveau/dispnv50/crcc37d.c

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
#include <nvif/push507c.h>
1010

11+
#include <nvhw/class/clc37d.h>
12+
1113
#define CRCC37D_MAX_ENTRIES 2047
1214

1315
struct crcc37d_notifier {
@@ -39,33 +41,35 @@ crcc37d_set_src(struct nv50_head *head, int or,
3941
{
4042
struct nvif_push *push = nv50_disp(head->base.base.dev)->core->chan.push;
4143
const int i = head->base.index;
42-
u32 crc_args;
44+
u32 crc_args = NVVAL(NVC37D, HEAD_SET_CRC_CONTROL, CONTROLLING_CHANNEL, wndw) |
45+
NVDEF(NVC37D, HEAD_SET_CRC_CONTROL, EXPECT_BUFFER_COLLAPSE, FALSE) |
46+
NVDEF(NVC37D, HEAD_SET_CRC_CONTROL, SECONDARY_CRC, NONE) |
47+
NVDEF(NVC37D, HEAD_SET_CRC_CONTROL, CRC_DURING_SNOOZE, DISABLE);
4348
int ret;
4449

4550
switch (source) {
4651
case NV50_CRC_SOURCE_TYPE_SOR:
47-
crc_args = (0x00000050 + or) << 12;
52+
crc_args |= NVDEF(NVC37D, HEAD_SET_CRC_CONTROL, PRIMARY_CRC, SOR(or));
4853
break;
4954
case NV50_CRC_SOURCE_TYPE_PIOR:
50-
crc_args = (0x00000060 + or) << 12;
55+
crc_args |= NVDEF(NVC37D, HEAD_SET_CRC_CONTROL, PRIMARY_CRC, PIOR(or));
5156
break;
5257
case NV50_CRC_SOURCE_TYPE_SF:
53-
crc_args = 0x00000030 << 12;
58+
crc_args |= NVDEF(NVC37D, HEAD_SET_CRC_CONTROL, PRIMARY_CRC, SF);
5459
break;
5560
default:
56-
crc_args = 0;
5761
break;
5862
}
5963

6064
if ((ret = PUSH_WAIT(push, 4)))
6165
return ret;
6266

6367
if (source) {
64-
PUSH_NVSQ(push, NVC37D, 0x2180 + (i * 0x400), ctx->ntfy.handle);
65-
PUSH_NVSQ(push, NVC37D, 0x2184 + (i * 0x400), crc_args | wndw);
68+
PUSH_MTHD(push, NVC37D, HEAD_SET_CONTEXT_DMA_CRC(i), ctx->ntfy.handle);
69+
PUSH_MTHD(push, NVC37D, HEAD_SET_CRC_CONTROL(i), crc_args);
6670
} else {
67-
PUSH_NVSQ(push, NVC37D, 0x2184 + (i * 0x400), 0);
68-
PUSH_NVSQ(push, NVC37D, 0x2180 + (i * 0x400), 0);
71+
PUSH_MTHD(push, NVC37D, HEAD_SET_CRC_CONTROL(i), 0);
72+
PUSH_MTHD(push, NVC37D, HEAD_SET_CONTEXT_DMA_CRC(i), 0);
6973
}
7074

7175
return 0;

0 commit comments

Comments
 (0)