drm/nouveau/disp: move vblank_{get,put} methods into nvkm_head
authorBen Skeggs <bskeggs@redhat.com>
Fri, 19 May 2017 13:59:35 +0000 (23:59 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Fri, 16 Jun 2017 04:04:48 +0000 (14:04 +1000)
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
20 files changed:
drivers/gpu/drm/nouveau/nvkm/engine/disp/base.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/g84.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/g94.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/gf119.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/gk104.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/gk110.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/gm107.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/gm200.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/gp100.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/gp102.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/gt200.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/gt215.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/head.h
drivers/gpu/drm/nouveau/nvkm/engine/disp/headgf119.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/headnv04.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/headnv50.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/nv04.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/nv50.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/nv50.h
drivers/gpu/drm/nouveau/nvkm/engine/disp/priv.h

index 8489d0246cb322f96a31a57b3ed679c0f31a69b4..1c655c18097e349e1baf2cf14624aea004fe6ca6 100644 (file)
 #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
index 0de04221da4814ee99f05650eaaa1c86ce092afa..1b74072e28fedcb535bf90d23a2d686418ef1e04 100644 (file)
@@ -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,
index 8010d381bc7d2966a075c5d2bd9f749cebb92a8e..38a5d165c11c0aa95feeb4a863a8ce8ee878e8a2 100644 (file)
@@ -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,
index 59bf3f950eeafeb33c3c999df84f5e7c850f88ab..e9cf53e918afe4e31a9215b6c75085e4ff6f16d2 100644 (file)
 #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,
index 89561496570bf65b07ebd0b14042a01be42612f6..3dd530298a288565bf48759c8fdff8b029002f8f 100644 (file)
@@ -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,
index 9400d2ad79b9d04a7b03e96aa22798e6b81c50a3..8c4cabec036d1ae490d6555604aa77131969697a 100644 (file)
@@ -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,
index b7570fb0fb1f3f3de214b2c703dc19cb32db6311..dfb32c14558e227c3edcacb7f1817f083f77be21 100644 (file)
@@ -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,
index b3e52080d4b712629a614c727d592f3ff3978dad..97ca9434e1f3bbf8a62bb79c14a5167fcaebd82a 100644 (file)
@@ -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,
index 3d1c65ff5620762aad3b26b7f2b89ba327249c15..e0d5ed423f1972c59ffce2f123cd165fac6d64b6 100644 (file)
@@ -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,
index fac8e88fd2d14e0dafbc777f3fcca75aa0584a7f..56eeee4dd63439b4b3654378fd869bdfcb5093a3 100644 (file)
@@ -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,
index a0e7c3c78e971a86919d97c8df688f76cb704227..fa8eea41dfa2b74e5a168167600132a8fe0424ea 100644 (file)
@@ -32,8 +32,6 @@ gt200_disp = {
        .super = nv50_disp_super,
        .root = &gt200_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,
index 5f8a8d85567304d64edf3e12650fe09f8ac2dbd7..b211757910e21023dfda70dbfe8326a8d3fcb616 100644 (file)
@@ -32,8 +32,6 @@ gt215_disp = {
        .super = nv50_disp_super,
        .root = &gt215_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,
index a8ae6cbc0ff12a6da564aca2eb0f40726cc9c620..68866a7fba013179ccd1cc810f210d079c0d6d9c 100644 (file)
@@ -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 {                                              \
index 062fa07e1eced0ff6c952819511526673b3880cd..8ac76445b07a5dced4bc7691ce94149527bfe51f 100644 (file)
  */
 #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
index f581327f695c9f449a9e114972061607aec04f58..d8d6fbef88ae4bb7fbd0649f8a3325e3e5190ce8 100644 (file)
  */
 #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
index e48865c91046ef4a94e3d15002068dabeb203931..b3aaa68c0daac6aa64a38c473b2056130d4323ea 100644 (file)
  */
 #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
index 978e3ad488d9e742b557a3bc1fafb0cf48ea77ae..b780ba1a3bc7fa31f2338bf184955dfc18e80be2 100644 (file)
@@ -30,20 +30,6 @@ nv04_disp_root(struct nvkm_disp *disp)
        return &nv04_disp_root_oclass;
 }
 
-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)
 {
@@ -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
index 9787a4cc4cce815140a374d738f22fa46c2f7562..6f2314d5dac11160ca4cab428ff7e66fd855ebed 100644 (file)
@@ -98,20 +98,6 @@ nv50_disp_outp_external_dp_(struct nvkm_disp *base, int index,
        return -ENODEV;
 }
 
-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)
 {
@@ -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,
index 0361f0c2ba1aba16230e7907f22f216b883f9755..5047e719dc58c7d79c9b712c31b54c8fe504de92 100644 (file)
@@ -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);
index 4bb05a09a60be5aba6859873ca3c7ef33a188852..e8dcae14a9ae595b35fdcd9ef0b22b75638cac34 100644 (file)
@@ -28,11 +28,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;