Skip to content

Commit c854bf9

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

File tree

4 files changed

+26
-23
lines changed

4 files changed

+26
-23
lines changed

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

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
#include <nvif/cl0002.h>
1010
#include <nvif/timer.h>
1111

12+
#include <nvhw/class/cl907d.h>
13+
1214
#include "nouveau_drv.h"
1315
#include "core.h"
1416
#include "head.h"
@@ -478,10 +480,6 @@ void nv50_crc_atomic_clr(struct nv50_head *head)
478480
func->set_src(head, 0, NV50_CRC_SOURCE_TYPE_NONE, NULL, 0);
479481
}
480482

481-
#define NV50_CRC_RASTER_ACTIVE 0
482-
#define NV50_CRC_RASTER_COMPLETE 1
483-
#define NV50_CRC_RASTER_INACTIVE 2
484-
485483
static inline int
486484
nv50_crc_raster_type(enum nv50_crc_source source)
487485
{
@@ -490,11 +488,11 @@ nv50_crc_raster_type(enum nv50_crc_source source)
490488
case NV50_CRC_SOURCE_AUTO:
491489
case NV50_CRC_SOURCE_RG:
492490
case NV50_CRC_SOURCE_OUTP_ACTIVE:
493-
return NV50_CRC_RASTER_ACTIVE;
491+
return NV907D_HEAD_SET_CONTROL_OUTPUT_RESOURCE_CRC_MODE_ACTIVE_RASTER;
494492
case NV50_CRC_SOURCE_OUTP_COMPLETE:
495-
return NV50_CRC_RASTER_COMPLETE;
493+
return NV907D_HEAD_SET_CONTROL_OUTPUT_RESOURCE_CRC_MODE_COMPLETE_RASTER;
496494
case NV50_CRC_SOURCE_OUTP_INACTIVE:
497-
return NV50_CRC_RASTER_INACTIVE;
495+
return NV907D_HEAD_SET_CONTROL_OUTPUT_RESOURCE_CRC_MODE_NON_ACTIVE_RASTER;
498496
}
499497

500498
return 0;

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

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,14 @@ head907d_or(struct nv50_head *head, struct nv50_head_atom *asyh)
4343
if ((ret = PUSH_WAIT(push, 3)))
4444
return ret;
4545

46-
PUSH_NVSQ(push, NV907D, 0x0404 + (i * 0x300), asyh->or.depth << 6 |
47-
asyh->or.nvsync << 4 |
48-
asyh->or.nhsync << 3 |
49-
asyh->or.crc_raster,
50-
0x0408 + (i * 0x300), 0x31ec6000 |
51-
head->base.index << 25 |
52-
asyh->mode.interlace);
46+
PUSH_MTHD(push, NV907D, HEAD_SET_CONTROL_OUTPUT_RESOURCE(i),
47+
NVVAL(NV907D, HEAD_SET_CONTROL_OUTPUT_RESOURCE, CRC_MODE, asyh->or.crc_raster) |
48+
NVVAL(NV907D, HEAD_SET_CONTROL_OUTPUT_RESOURCE, HSYNC_POLARITY, asyh->or.nhsync) |
49+
NVVAL(NV907D, HEAD_SET_CONTROL_OUTPUT_RESOURCE, VSYNC_POLARITY, asyh->or.nvsync) |
50+
NVVAL(NV907D, HEAD_SET_CONTROL_OUTPUT_RESOURCE, PIXEL_DEPTH, asyh->or.depth),
51+
52+
HEAD_SET_CONTROL(i), 0x31ec6000 | head->base.index << 25 |
53+
NVVAL(NV907D, HEAD_SET_CONTROL, STRUCTURE, asyh->mode.interlace));
5354
return 0;
5455
}
5556

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,12 @@ headc37d_or(struct nv50_head *head, struct nv50_head_atom *asyh)
5252
if ((ret = PUSH_WAIT(push, 2)))
5353
return ret;
5454

55-
PUSH_NVSQ(push, NVC37D, 0x2004 + (i * 0x400), depth << 4 |
56-
asyh->or.nvsync << 3 |
57-
asyh->or.nhsync << 2 |
58-
asyh->or.crc_raster);
55+
PUSH_MTHD(push, NVC37D, HEAD_SET_CONTROL_OUTPUT_RESOURCE(i),
56+
NVVAL(NVC37D, HEAD_SET_CONTROL_OUTPUT_RESOURCE, CRC_MODE, asyh->or.crc_raster) |
57+
NVVAL(NVC37D, HEAD_SET_CONTROL_OUTPUT_RESOURCE, HSYNC_POLARITY, asyh->or.nhsync) |
58+
NVVAL(NVC37D, HEAD_SET_CONTROL_OUTPUT_RESOURCE, VSYNC_POLARITY, asyh->or.nvsync) |
59+
NVVAL(NVC37D, HEAD_SET_CONTROL_OUTPUT_RESOURCE, PIXEL_DEPTH, depth) |
60+
NVDEF(NVC37D, HEAD_SET_CONTROL_OUTPUT_RESOURCE, COLOR_SPACE_OVERRIDE, DISABLE));
5961
return 0;
6062
}
6163

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,13 @@ headc57d_or(struct nv50_head *head, struct nv50_head_atom *asyh)
5252
if ((ret = PUSH_WAIT(push, 2)))
5353
return ret;
5454

55-
PUSH_NVSQ(push, NVC57D, 0x2004 + (i * 0x400), 0xfc000000 |
56-
depth << 4 |
57-
asyh->or.nvsync << 3 |
58-
asyh->or.nhsync << 2 |
59-
asyh->or.crc_raster);
55+
PUSH_MTHD(push, NVC57D, HEAD_SET_CONTROL_OUTPUT_RESOURCE(i),
56+
NVVAL(NVC57D, HEAD_SET_CONTROL_OUTPUT_RESOURCE, CRC_MODE, asyh->or.crc_raster) |
57+
NVVAL(NVC57D, HEAD_SET_CONTROL_OUTPUT_RESOURCE, HSYNC_POLARITY, asyh->or.nhsync) |
58+
NVVAL(NVC57D, HEAD_SET_CONTROL_OUTPUT_RESOURCE, VSYNC_POLARITY, asyh->or.nvsync) |
59+
NVVAL(NVC57D, HEAD_SET_CONTROL_OUTPUT_RESOURCE, PIXEL_DEPTH, depth) |
60+
NVDEF(NVC57D, HEAD_SET_CONTROL_OUTPUT_RESOURCE, COLOR_SPACE_OVERRIDE, DISABLE) |
61+
NVDEF(NVC57D, HEAD_SET_CONTROL_OUTPUT_RESOURCE, EXT_PACKET_WIN, NONE));
6062
return 0;
6163
}
6264

0 commit comments

Comments
 (0)