diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2017-05-19 23:59:35 +1000 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2017-06-16 14:04:48 +1000 |
commit | 14187b007e646c0dbf0813d22f7733cf6eebc099 (patch) | |
tree | 044cdaac6f9d652e537e2d53f600e90e5a77a22b | |
parent | a1c930789aa51b928f804c9186f9821efd070ce1 (diff) |
drm/nouveau/disp: move vblank_{get,put} methods into nvkm_head
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
20 files changed, 60 insertions, 99 deletions
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/base.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/base.c index 8489d0246cb3..1c655c18097e 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/base.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/base.c @@ -38,17 +38,21 @@ #include <nvif/unpack.h> static void -nvkm_disp_vblank_fini(struct nvkm_event *event, int type, int head) +nvkm_disp_vblank_fini(struct nvkm_event *event, int type, int id) { struct nvkm_disp *disp = container_of(event, typeof(*disp), vblank); - disp->func->head.vblank_fini(disp, head); + struct nvkm_head *head = nvkm_head_find(disp, id); + if (head) + head->func->vblank_put(head); } static void -nvkm_disp_vblank_init(struct nvkm_event *event, int type, int head) +nvkm_disp_vblank_init(struct nvkm_event *event, int type, int id) { struct nvkm_disp *disp = container_of(event, typeof(*disp), vblank); - disp->func->head.vblank_init(disp, head); + struct nvkm_head *head = nvkm_head_find(disp, id); + if (head) + head->func->vblank_get(head); } static int diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/g84.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/g84.c index 0de04221da48..1b74072e28fe 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/g84.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/g84.c @@ -32,8 +32,6 @@ g84_disp = { .super = nv50_disp_super, .root = &g84_disp_root_oclass, .head.new = nv50_head_new, - .head.vblank_init = nv50_disp_vblank_init, - .head.vblank_fini = nv50_disp_vblank_fini, .head.scanoutpos = nv50_disp_root_scanoutpos, .outp.internal.crt = nv50_dac_output_new, .outp.internal.tmds = nv50_sor_output_new, diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/g94.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/g94.c index 8010d381bc7d..38a5d165c11c 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/g94.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/g94.c @@ -32,8 +32,6 @@ g94_disp = { .super = nv50_disp_super, .root = &g94_disp_root_oclass, .head.new = nv50_head_new, - .head.vblank_init = nv50_disp_vblank_init, - .head.vblank_fini = nv50_disp_vblank_fini, .head.scanoutpos = nv50_disp_root_scanoutpos, .outp.internal.crt = nv50_dac_output_new, .outp.internal.tmds = nv50_sor_output_new, diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/gf119.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/gf119.c index 59bf3f950eea..e9cf53e918af 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/gf119.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/gf119.c @@ -31,20 +31,6 @@ #include <subdev/bios/pll.h> #include <subdev/devinit.h> -void -gf119_disp_vblank_init(struct nv50_disp *disp, int head) -{ - struct nvkm_device *device = disp->base.engine.subdev.device; - nvkm_mask(device, 0x6100c0 + (head * 0x800), 0x00000001, 0x00000001); -} - -void -gf119_disp_vblank_fini(struct nv50_disp *disp, int head) -{ - struct nvkm_device *device = disp->base.engine.subdev.device; - nvkm_mask(device, 0x6100c0 + (head * 0x800), 0x00000001, 0x00000000); -} - static struct nvkm_output * exec_lookup(struct nv50_disp *disp, int head, int or, u32 ctrl, u32 *data, u8 *ver, u8 *hdr, u8 *cnt, u8 *len, @@ -515,8 +501,6 @@ gf119_disp = { .super = gf119_disp_super, .root = &gf119_disp_root_oclass, .head.new = gf119_head_new, - .head.vblank_init = gf119_disp_vblank_init, - .head.vblank_fini = gf119_disp_vblank_fini, .head.scanoutpos = gf119_disp_root_scanoutpos, .outp.internal.crt = nv50_dac_output_new, .outp.internal.tmds = nv50_sor_output_new, diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/gk104.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/gk104.c index 89561496570b..3dd530298a28 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/gk104.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/gk104.c @@ -33,8 +33,6 @@ gk104_disp = { .super = gf119_disp_super, .root = &gk104_disp_root_oclass, .head.new = gf119_head_new, - .head.vblank_init = gf119_disp_vblank_init, - .head.vblank_fini = gf119_disp_vblank_fini, .head.scanoutpos = gf119_disp_root_scanoutpos, .outp.internal.crt = nv50_dac_output_new, .outp.internal.tmds = nv50_sor_output_new, diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/gk110.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/gk110.c index 9400d2ad79b9..8c4cabec036d 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/gk110.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/gk110.c @@ -33,8 +33,6 @@ gk110_disp = { .super = gf119_disp_super, .root = &gk110_disp_root_oclass, .head.new = gf119_head_new, - .head.vblank_init = gf119_disp_vblank_init, - .head.vblank_fini = gf119_disp_vblank_fini, .head.scanoutpos = gf119_disp_root_scanoutpos, .outp.internal.crt = nv50_dac_output_new, .outp.internal.tmds = nv50_sor_output_new, diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/gm107.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/gm107.c index b7570fb0fb1f..dfb32c14558e 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/gm107.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/gm107.c @@ -33,8 +33,6 @@ gm107_disp = { .super = gf119_disp_super, .root = &gm107_disp_root_oclass, .head.new = gf119_head_new, - .head.vblank_init = gf119_disp_vblank_init, - .head.vblank_fini = gf119_disp_vblank_fini, .head.scanoutpos = gf119_disp_root_scanoutpos, .outp.internal.crt = nv50_dac_output_new, .outp.internal.tmds = nv50_sor_output_new, diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/gm200.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/gm200.c index b3e52080d4b7..97ca9434e1f3 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/gm200.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/gm200.c @@ -33,8 +33,6 @@ gm200_disp = { .super = gf119_disp_super, .root = &gm200_disp_root_oclass, .head.new = gf119_head_new, - .head.vblank_init = gf119_disp_vblank_init, - .head.vblank_fini = gf119_disp_vblank_fini, .head.scanoutpos = gf119_disp_root_scanoutpos, .outp.internal.crt = nv50_dac_output_new, .outp.internal.tmds = nv50_sor_output_new, diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/gp100.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/gp100.c index 3d1c65ff5620..e0d5ed423f19 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/gp100.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/gp100.c @@ -33,8 +33,6 @@ gp100_disp = { .super = gf119_disp_super, .root = &gp100_disp_root_oclass, .head.new = gf119_head_new, - .head.vblank_init = gf119_disp_vblank_init, - .head.vblank_fini = gf119_disp_vblank_fini, .head.scanoutpos = gf119_disp_root_scanoutpos, .outp.internal.crt = nv50_dac_output_new, .outp.internal.tmds = nv50_sor_output_new, diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/gp102.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/gp102.c index fac8e88fd2d1..56eeee4dd634 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/gp102.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/gp102.c @@ -59,8 +59,6 @@ gp102_disp = { .super = gf119_disp_super, .root = &gp102_disp_root_oclass, .head.new = gf119_head_new, - .head.vblank_init = gf119_disp_vblank_init, - .head.vblank_fini = gf119_disp_vblank_fini, .head.scanoutpos = gf119_disp_root_scanoutpos, .outp.internal.crt = nv50_dac_output_new, .outp.internal.tmds = nv50_sor_output_new, diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/gt200.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/gt200.c index a0e7c3c78e97..fa8eea41dfa2 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/gt200.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/gt200.c @@ -32,8 +32,6 @@ gt200_disp = { .super = nv50_disp_super, .root = >200_disp_root_oclass, .head.new = nv50_head_new, - .head.vblank_init = nv50_disp_vblank_init, - .head.vblank_fini = nv50_disp_vblank_fini, .head.scanoutpos = nv50_disp_root_scanoutpos, .outp.internal.crt = nv50_dac_output_new, .outp.internal.tmds = nv50_sor_output_new, diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/gt215.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/gt215.c index 5f8a8d855673..b211757910e2 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/gt215.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/gt215.c @@ -32,8 +32,6 @@ gt215_disp = { .super = nv50_disp_super, .root = >215_disp_root_oclass, .head.new = nv50_head_new, - .head.vblank_init = nv50_disp_vblank_init, - .head.vblank_fini = nv50_disp_vblank_fini, .head.scanoutpos = nv50_disp_root_scanoutpos, .outp.internal.crt = nv50_dac_output_new, .outp.internal.tmds = nv50_sor_output_new, diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/head.h b/drivers/gpu/drm/nouveau/nvkm/engine/disp/head.h index a8ae6cbc0ff1..68866a7fba01 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/head.h +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/head.h @@ -15,6 +15,8 @@ void nvkm_head_del(struct nvkm_head **); struct nvkm_head *nvkm_head_find(struct nvkm_disp *, int id); struct nvkm_head_func { + void (*vblank_get)(struct nvkm_head *); + void (*vblank_put)(struct nvkm_head *); }; #define HEAD_MSG(h,l,f,a...) do { \ diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/headgf119.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/headgf119.c index 062fa07e1ece..8ac76445b07a 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/headgf119.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/headgf119.c @@ -23,8 +23,26 @@ */ #include "head.h" +static void +gf119_head_vblank_put(struct nvkm_head *head) +{ + struct nvkm_device *device = head->disp->engine.subdev.device; + const u32 hoff = head->id * 0x800; + nvkm_mask(device, 0x6100c0 + hoff, 0x00000001, 0x00000000); +} + +static void +gf119_head_vblank_get(struct nvkm_head *head) +{ + struct nvkm_device *device = head->disp->engine.subdev.device; + const u32 hoff = head->id * 0x800; + nvkm_mask(device, 0x6100c0 + hoff, 0x00000001, 0x00000001); +} + static const struct nvkm_head_func gf119_head = { + .vblank_get = gf119_head_vblank_get, + .vblank_put = gf119_head_vblank_put, }; int diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/headnv04.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/headnv04.c index f581327f695c..d8d6fbef88ae 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/headnv04.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/headnv04.c @@ -23,8 +23,24 @@ */ #include "head.h" +static void +nv04_head_vblank_put(struct nvkm_head *head) +{ + struct nvkm_device *device = head->disp->engine.subdev.device; + nvkm_wr32(device, 0x600140 + (head->id * 0x2000) , 0x00000000); +} + +static void +nv04_head_vblank_get(struct nvkm_head *head) +{ + struct nvkm_device *device = head->disp->engine.subdev.device; + nvkm_wr32(device, 0x600140 + (head->id * 0x2000) , 0x00000001); +} + static const struct nvkm_head_func nv04_head = { + .vblank_get = nv04_head_vblank_get, + .vblank_put = nv04_head_vblank_put, }; int diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/headnv50.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/headnv50.c index e48865c91046..b3aaa68c0daa 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/headnv50.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/headnv50.c @@ -23,8 +23,24 @@ */ #include "head.h" +static void +nv50_head_vblank_put(struct nvkm_head *head) +{ + struct nvkm_device *device = head->disp->engine.subdev.device; + nvkm_mask(device, 0x61002c, (4 << head->id), 0); +} + +static void +nv50_head_vblank_get(struct nvkm_head *head) +{ + struct nvkm_device *device = head->disp->engine.subdev.device; + nvkm_mask(device, 0x61002c, (4 << head->id), (4 << head->id)); +} + static const struct nvkm_head_func nv50_head = { + .vblank_get = nv50_head_vblank_get, + .vblank_put = nv50_head_vblank_put, }; int diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/nv04.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/nv04.c index 978e3ad488d9..b780ba1a3bc7 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/nv04.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/nv04.c @@ -31,20 +31,6 @@ nv04_disp_root(struct nvkm_disp *disp) } static void -nv04_disp_vblank_init(struct nvkm_disp *disp, int head) -{ - struct nvkm_device *device = disp->engine.subdev.device; - nvkm_wr32(device, 0x600140 + (head * 0x2000) , 0x00000001); -} - -static void -nv04_disp_vblank_fini(struct nvkm_disp *disp, int head) -{ - struct nvkm_device *device = disp->engine.subdev.device; - nvkm_wr32(device, 0x600140 + (head * 0x2000) , 0x00000000); -} - -static void nv04_disp_intr(struct nvkm_disp *disp) { struct nvkm_subdev *subdev = &disp->engine.subdev; @@ -75,8 +61,6 @@ static const struct nvkm_disp_func nv04_disp = { .intr = nv04_disp_intr, .root = nv04_disp_root, - .head.vblank_init = nv04_disp_vblank_init, - .head.vblank_fini = nv04_disp_vblank_fini, }; int diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/nv50.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/nv50.c index 9787a4cc4cce..6f2314d5dac1 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/nv50.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/nv50.c @@ -99,20 +99,6 @@ nv50_disp_outp_external_dp_(struct nvkm_disp *base, int index, } static void -nv50_disp_vblank_fini_(struct nvkm_disp *base, int head) -{ - struct nv50_disp *disp = nv50_disp(base); - disp->func->head.vblank_fini(disp, head); -} - -static void -nv50_disp_vblank_init_(struct nvkm_disp *base, int head) -{ - struct nv50_disp *disp = nv50_disp(base); - disp->func->head.vblank_init(disp, head); -} - -static void nv50_disp_intr_(struct nvkm_disp *base) { struct nv50_disp *disp = nv50_disp(base); @@ -138,8 +124,6 @@ nv50_disp_ = { .outp.internal.dp = nv50_disp_outp_internal_dp_, .outp.external.tmds = nv50_disp_outp_external_tmds_, .outp.external.dp = nv50_disp_outp_external_dp_, - .head.vblank_init = nv50_disp_vblank_init_, - .head.vblank_fini = nv50_disp_vblank_fini_, }; int @@ -168,20 +152,6 @@ nv50_disp_new_(const struct nv50_disp_func *func, struct nvkm_device *device, return nvkm_event_init(func->uevent, 1, 1 + (heads * 4), &disp->uevent); } -void -nv50_disp_vblank_fini(struct nv50_disp *disp, int head) -{ - struct nvkm_device *device = disp->base.engine.subdev.device; - nvkm_mask(device, 0x61002c, (4 << head), 0); -} - -void -nv50_disp_vblank_init(struct nv50_disp *disp, int head) -{ - struct nvkm_device *device = disp->base.engine.subdev.device; - nvkm_mask(device, 0x61002c, (4 << head), (4 << head)); -} - static struct nvkm_output * exec_lookup(struct nv50_disp *disp, int head, int or, u32 ctrl, u32 *data, u8 *ver, u8 *hdr, u8 *cnt, u8 *len, @@ -827,8 +797,6 @@ nv50_disp = { .super = nv50_disp_super, .root = &nv50_disp_root_oclass, .head.new = nv50_head_new, - .head.vblank_init = nv50_disp_vblank_init, - .head.vblank_fini = nv50_disp_vblank_fini, .head.scanoutpos = nv50_disp_root_scanoutpos, .outp.internal.crt = nv50_dac_output_new, .outp.internal.tmds = nv50_sor_output_new, diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/nv50.h b/drivers/gpu/drm/nouveau/nvkm/engine/disp/nv50.h index 0361f0c2ba1a..5047e719dc58 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/nv50.h +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/nv50.h @@ -76,8 +76,6 @@ struct nv50_disp_func { struct { int (*new)(struct nvkm_disp *, int id); - void (*vblank_init)(struct nv50_disp *, int head); - void (*vblank_fini)(struct nv50_disp *, int head); int (*scanoutpos)(NV50_DISP_MTHD_V0); } head; @@ -106,13 +104,9 @@ struct nv50_disp_func { } pior; }; -void nv50_disp_vblank_init(struct nv50_disp *, int); -void nv50_disp_vblank_fini(struct nv50_disp *, int); void nv50_disp_intr(struct nv50_disp *); void nv50_disp_super(struct work_struct *); -void gf119_disp_vblank_init(struct nv50_disp *, int); -void gf119_disp_vblank_fini(struct nv50_disp *, int); void gf119_disp_intr(struct nv50_disp *); void gf119_disp_super(struct work_struct *); void gf119_disp_intr_error(struct nv50_disp *, int); diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/priv.h b/drivers/gpu/drm/nouveau/nvkm/engine/disp/priv.h index 4bb05a09a60b..e8dcae14a9ae 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/priv.h +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/priv.h @@ -29,11 +29,6 @@ struct nvkm_disp_func { const struct nvkm_disp_oclass *(*root)(struct nvkm_disp *); struct { - void (*vblank_init)(struct nvkm_disp *, int head); - void (*vblank_fini)(struct nvkm_disp *, int head); - } head; - - struct { const struct nvkm_disp_func_outp internal; const struct nvkm_disp_func_outp external; } outp; |