summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/nouveau/nvkm/engine/disp/rootgf119.c
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2017-05-19 23:59:34 +1000
committerBen Skeggs <bskeggs@redhat.com>2017-06-16 14:04:48 +1000
commita1c930789aa51b928f804c9186f9821efd070ce1 (patch)
tree383e8145267b88db8feed522b492a7fa476b35b5 /drivers/gpu/drm/nouveau/nvkm/engine/disp/rootgf119.c
parent4b2b42f8e910c65aceb8b2d12fe392a7b7955449 (diff)
drm/nouveau/disp: introduce object to track per-head functions/state
Primarily intended as a way to pass per-head state around during supervisor handling, and share logic between NV50/GF119. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/nvkm/engine/disp/rootgf119.c')
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/disp/rootgf119.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/rootgf119.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/rootgf119.c
index 335d88823c22..f1159dd4db87 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/rootgf119.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/rootgf119.c
@@ -22,6 +22,7 @@
* Authors: Ben Skeggs
*/
#include "rootnv50.h"
+#include "head.h"
#include "dmacnv50.h"
#include <core/client.h>
@@ -78,6 +79,7 @@ int
gf119_disp_root_init(struct nv50_disp_root *root)
{
struct nv50_disp *disp = root->disp;
+ struct nvkm_head *head;
struct nvkm_device *device = disp->base.engine.subdev.device;
u32 tmp;
int i;
@@ -88,13 +90,14 @@ gf119_disp_root_init(struct nv50_disp_root *root)
*/
/* ... CRTC caps */
- for (i = 0; i < disp->base.head.nr; i++) {
- tmp = nvkm_rd32(device, 0x616104 + (i * 0x800));
- nvkm_wr32(device, 0x6101b4 + (i * 0x800), tmp);
- tmp = nvkm_rd32(device, 0x616108 + (i * 0x800));
- nvkm_wr32(device, 0x6101b8 + (i * 0x800), tmp);
- tmp = nvkm_rd32(device, 0x61610c + (i * 0x800));
- nvkm_wr32(device, 0x6101bc + (i * 0x800), tmp);
+ list_for_each_entry(head, &disp->base.head, head) {
+ const u32 hoff = head->id * 0x800;
+ tmp = nvkm_rd32(device, 0x616104 + hoff);
+ nvkm_wr32(device, 0x6101b4 + hoff, tmp);
+ tmp = nvkm_rd32(device, 0x616108 + hoff);
+ nvkm_wr32(device, 0x6101b8 + hoff, tmp);
+ tmp = nvkm_rd32(device, 0x61610c + hoff);
+ nvkm_wr32(device, 0x6101bc + hoff, tmp);
}
/* ... DAC caps */
@@ -134,8 +137,10 @@ gf119_disp_root_init(struct nv50_disp_root *root)
*
* ftp://download.nvidia.com/open-gpu-doc/gk104-disable-underflow-reporting/1/gk104-disable-underflow-reporting.txt
*/
- for (i = 0; i < disp->base.head.nr; i++)
- nvkm_mask(device, 0x616308 + (i * 0x800), 0x00000111, 0x00000010);
+ list_for_each_entry(head, &disp->base.head, head) {
+ const u32 hoff = head->id * 0x800;
+ nvkm_mask(device, 0x616308 + hoff, 0x00000111, 0x00000010);
+ }
return 0;
}