drm/nouveau/msvld: switch to instanced constructor
authorBen Skeggs <bskeggs@redhat.com>
Wed, 3 Feb 2021 22:40:18 +0000 (08:40 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Thu, 11 Feb 2021 01:49:59 +0000 (11:49 +1000)
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
16 files changed:
drivers/gpu/drm/nouveau/include/nvkm/core/device.h
drivers/gpu/drm/nouveau/include/nvkm/core/layout.h
drivers/gpu/drm/nouveau/include/nvkm/engine/msvld.h
drivers/gpu/drm/nouveau/nvkm/core/subdev.c
drivers/gpu/drm/nouveau/nvkm/engine/device/base.c
drivers/gpu/drm/nouveau/nvkm/engine/msvld/base.c
drivers/gpu/drm/nouveau/nvkm/engine/msvld/g98.c
drivers/gpu/drm/nouveau/nvkm/engine/msvld/gf100.c
drivers/gpu/drm/nouveau/nvkm/engine/msvld/gk104.c
drivers/gpu/drm/nouveau/nvkm/engine/msvld/gt215.c
drivers/gpu/drm/nouveau/nvkm/engine/msvld/mcp89.c
drivers/gpu/drm/nouveau/nvkm/engine/msvld/priv.h
drivers/gpu/drm/nouveau/nvkm/subdev/devinit/g98.c
drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gf100.c
drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gt215.c
drivers/gpu/drm/nouveau/nvkm/subdev/devinit/mcp89.c

index 3f632c86740bee44d4faf095c18c52cfe832ebc4..a504d7dd4112cd996894363f5022948f07e8ac69 100644 (file)
@@ -60,7 +60,6 @@ struct nvkm_device {
                struct notifier_block nb;
        } acpi;
 
-       struct nvkm_engine *msvld;
        struct nvkm_nvenc *nvenc[3];
        struct nvkm_nvdec *nvdec[3];
        struct nvkm_pm *pm;
@@ -109,7 +108,6 @@ struct nvkm_device_chip {
 #undef NVKM_LAYOUT_INST
 #undef NVKM_LAYOUT_ONCE
 
-       int (*msvld   )(struct nvkm_device *, int idx, struct nvkm_engine **);
        int (*nvenc[3])(struct nvkm_device *, int idx, struct nvkm_nvenc **);
        int (*nvdec[3])(struct nvkm_device *, int idx, struct nvkm_nvdec **);
        int (*pm      )(struct nvkm_device *, int idx, struct nvkm_pm **);
index 649c9ff51a3cb9651ea22d620d9636375921238b..dc718a462780cde22bf9fdcca5d82f3fc0f5d007 100644 (file)
@@ -38,4 +38,5 @@ NVKM_LAYOUT_ONCE(NVKM_ENGINE_MPEG    , struct nvkm_engine  ,     mpeg)
 NVKM_LAYOUT_ONCE(NVKM_ENGINE_MSENC   , struct nvkm_engine  ,    msenc)
 NVKM_LAYOUT_ONCE(NVKM_ENGINE_MSPDEC  , struct nvkm_engine  ,   mspdec)
 NVKM_LAYOUT_ONCE(NVKM_ENGINE_MSPPP   , struct nvkm_engine  ,    msppp)
+NVKM_LAYOUT_ONCE(NVKM_ENGINE_MSVLD   , struct nvkm_engine  ,    msvld)
 NVKM_LAYOUT_ONCE(NVKM_ENGINE_VP      , struct nvkm_engine  ,       vp)
index 9e11cefc9649d28095d3aa53b62935d89f8377f5..2d5fa961ba663f2094042f17362c47dd31f6c05c 100644 (file)
@@ -2,9 +2,9 @@
 #ifndef __NVKM_MSVLD_H__
 #define __NVKM_MSVLD_H__
 #include <engine/falcon.h>
-int g98_msvld_new(struct nvkm_device *, int, struct nvkm_engine **);
-int gt215_msvld_new(struct nvkm_device *, int, struct nvkm_engine **);
-int mcp89_msvld_new(struct nvkm_device *, int, struct nvkm_engine **);
-int gf100_msvld_new(struct nvkm_device *, int, struct nvkm_engine **);
-int gk104_msvld_new(struct nvkm_device *, int, struct nvkm_engine **);
+int g98_msvld_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_engine **);
+int gt215_msvld_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_engine **);
+int mcp89_msvld_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_engine **);
+int gf100_msvld_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_engine **);
+int gk104_msvld_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_engine **);
 #endif
index dff42fe7a12a13f7c4441fd329495d25da043f98..c1a3076eccf960b5a927384824bff11687949655 100644 (file)
@@ -33,7 +33,6 @@ nvkm_subdev_type[NVKM_SUBDEV_NR] = {
 #include <core/layout.h>
 #undef NVKM_LAYOUT_ONCE
 #undef NVKM_LAYOUT_INST
-       [NVKM_ENGINE_MSVLD   ] = "msvld",
        [NVKM_ENGINE_NVENC0  ] = "nvenc0",
        [NVKM_ENGINE_NVENC1  ] = "nvenc1",
        [NVKM_ENGINE_NVENC2  ] = "nvenc2",
index cabf6dc3234de6041d9dac2e5401e4176ae0707b..d18a24a616987b3ca01ab3f2e753f9aa033b3418 100644 (file)
@@ -1100,7 +1100,7 @@ nv98_chipset = {
        .gr       = { 0x00000001, g84_gr_new },
        .mspdec   = { 0x00000001, g98_mspdec_new },
        .msppp    = { 0x00000001, g98_msppp_new },
-       .msvld = g98_msvld_new,
+       .msvld    = { 0x00000001, g98_msvld_new },
        .pm = g84_pm_new,
        .sec = g98_sec_new,
        .sw = nv50_sw_new,
@@ -1167,7 +1167,7 @@ nva3_chipset = {
        .mpeg     = { 0x00000001, g84_mpeg_new },
        .mspdec   = { 0x00000001, gt215_mspdec_new },
        .msppp    = { 0x00000001, gt215_msppp_new },
-       .msvld = gt215_msvld_new,
+       .msvld    = { 0x00000001, gt215_msvld_new },
        .pm = gt215_pm_new,
        .sw = nv50_sw_new,
 };
@@ -1200,7 +1200,7 @@ nva5_chipset = {
        .gr       = { 0x00000001, gt215_gr_new },
        .mspdec   = { 0x00000001, gt215_mspdec_new },
        .msppp    = { 0x00000001, gt215_msppp_new },
-       .msvld = gt215_msvld_new,
+       .msvld    = { 0x00000001, gt215_msvld_new },
        .pm = gt215_pm_new,
        .sw = nv50_sw_new,
 };
@@ -1233,7 +1233,7 @@ nva8_chipset = {
        .gr       = { 0x00000001, gt215_gr_new },
        .mspdec   = { 0x00000001, gt215_mspdec_new },
        .msppp    = { 0x00000001, gt215_msppp_new },
-       .msvld = gt215_msvld_new,
+       .msvld    = { 0x00000001, gt215_msvld_new },
        .pm = gt215_pm_new,
        .sw = nv50_sw_new,
 };
@@ -1264,7 +1264,7 @@ nvaa_chipset = {
        .gr       = { 0x00000001, gt200_gr_new },
        .mspdec   = { 0x00000001, g98_mspdec_new },
        .msppp    = { 0x00000001, g98_msppp_new },
-       .msvld = g98_msvld_new,
+       .msvld    = { 0x00000001, g98_msvld_new },
        .pm = g84_pm_new,
        .sec = g98_sec_new,
        .sw = nv50_sw_new,
@@ -1296,7 +1296,7 @@ nvac_chipset = {
        .gr       = { 0x00000001, mcp79_gr_new },
        .mspdec   = { 0x00000001, g98_mspdec_new },
        .msppp    = { 0x00000001, g98_msppp_new },
-       .msvld = g98_msvld_new,
+       .msvld    = { 0x00000001, g98_msvld_new },
        .pm = g84_pm_new,
        .sec = g98_sec_new,
        .sw = nv50_sw_new,
@@ -1330,7 +1330,7 @@ nvaf_chipset = {
        .gr       = { 0x00000001, mcp89_gr_new },
        .mspdec   = { 0x00000001, gt215_mspdec_new },
        .msppp    = { 0x00000001, gt215_msppp_new },
-       .msvld = mcp89_msvld_new,
+       .msvld    = { 0x00000001, mcp89_msvld_new },
        .pm = gt215_pm_new,
        .sw = nv50_sw_new,
 };
@@ -1366,7 +1366,7 @@ nvc0_chipset = {
        .gr       = { 0x00000001, gf100_gr_new },
        .mspdec   = { 0x00000001, gf100_mspdec_new },
        .msppp    = { 0x00000001, gf100_msppp_new },
-       .msvld = gf100_msvld_new,
+       .msvld    = { 0x00000001, gf100_msvld_new },
        .pm = gf100_pm_new,
        .sw = gf100_sw_new,
 };
@@ -1402,7 +1402,7 @@ nvc1_chipset = {
        .gr       = { 0x00000001, gf108_gr_new },
        .mspdec   = { 0x00000001, gf100_mspdec_new },
        .msppp    = { 0x00000001, gf100_msppp_new },
-       .msvld = gf100_msvld_new,
+       .msvld    = { 0x00000001, gf100_msvld_new },
        .pm = gf108_pm_new,
        .sw = gf100_sw_new,
 };
@@ -1438,7 +1438,7 @@ nvc3_chipset = {
        .gr       = { 0x00000001, gf104_gr_new },
        .mspdec   = { 0x00000001, gf100_mspdec_new },
        .msppp    = { 0x00000001, gf100_msppp_new },
-       .msvld = gf100_msvld_new,
+       .msvld    = { 0x00000001, gf100_msvld_new },
        .pm = gf100_pm_new,
        .sw = gf100_sw_new,
 };
@@ -1474,7 +1474,7 @@ nvc4_chipset = {
        .gr       = { 0x00000001, gf104_gr_new },
        .mspdec   = { 0x00000001, gf100_mspdec_new },
        .msppp    = { 0x00000001, gf100_msppp_new },
-       .msvld = gf100_msvld_new,
+       .msvld    = { 0x00000001, gf100_msvld_new },
        .pm = gf100_pm_new,
        .sw = gf100_sw_new,
 };
@@ -1510,7 +1510,7 @@ nvc8_chipset = {
        .gr       = { 0x00000001, gf110_gr_new },
        .mspdec   = { 0x00000001, gf100_mspdec_new },
        .msppp    = { 0x00000001, gf100_msppp_new },
-       .msvld = gf100_msvld_new,
+       .msvld    = { 0x00000001, gf100_msvld_new },
        .pm = gf100_pm_new,
        .sw = gf100_sw_new,
 };
@@ -1546,7 +1546,7 @@ nvce_chipset = {
        .gr       = { 0x00000001, gf104_gr_new },
        .mspdec   = { 0x00000001, gf100_mspdec_new },
        .msppp    = { 0x00000001, gf100_msppp_new },
-       .msvld = gf100_msvld_new,
+       .msvld    = { 0x00000001, gf100_msvld_new },
        .pm = gf100_pm_new,
        .sw = gf100_sw_new,
 };
@@ -1582,7 +1582,7 @@ nvcf_chipset = {
        .gr       = { 0x00000001, gf104_gr_new },
        .mspdec   = { 0x00000001, gf100_mspdec_new },
        .msppp    = { 0x00000001, gf100_msppp_new },
-       .msvld = gf100_msvld_new,
+       .msvld    = { 0x00000001, gf100_msvld_new },
        .pm = gf100_pm_new,
        .sw = gf100_sw_new,
 };
@@ -1617,7 +1617,7 @@ nvd7_chipset = {
        .gr       = { 0x00000001, gf117_gr_new },
        .mspdec   = { 0x00000001, gf100_mspdec_new },
        .msppp    = { 0x00000001, gf100_msppp_new },
-       .msvld = gf100_msvld_new,
+       .msvld    = { 0x00000001, gf100_msvld_new },
        .pm = gf117_pm_new,
        .sw = gf100_sw_new,
 };
@@ -1653,7 +1653,7 @@ nvd9_chipset = {
        .gr       = { 0x00000001, gf119_gr_new },
        .mspdec   = { 0x00000001, gf100_mspdec_new },
        .msppp    = { 0x00000001, gf100_msppp_new },
-       .msvld = gf100_msvld_new,
+       .msvld    = { 0x00000001, gf100_msvld_new },
        .pm = gf117_pm_new,
        .sw = gf100_sw_new,
 };
@@ -1690,7 +1690,7 @@ nve4_chipset = {
        .gr       = { 0x00000001, gk104_gr_new },
        .mspdec   = { 0x00000001, gk104_mspdec_new },
        .msppp    = { 0x00000001, gf100_msppp_new },
-       .msvld = gk104_msvld_new,
+       .msvld    = { 0x00000001, gk104_msvld_new },
        .pm = gk104_pm_new,
        .sw = gf100_sw_new,
 };
@@ -1727,7 +1727,7 @@ nve6_chipset = {
        .gr       = { 0x00000001, gk104_gr_new },
        .mspdec   = { 0x00000001, gk104_mspdec_new },
        .msppp    = { 0x00000001, gf100_msppp_new },
-       .msvld = gk104_msvld_new,
+       .msvld    = { 0x00000001, gk104_msvld_new },
        .pm = gk104_pm_new,
        .sw = gf100_sw_new,
 };
@@ -1764,7 +1764,7 @@ nve7_chipset = {
        .gr       = { 0x00000001, gk104_gr_new },
        .mspdec   = { 0x00000001, gk104_mspdec_new },
        .msppp    = { 0x00000001, gf100_msppp_new },
-       .msvld = gk104_msvld_new,
+       .msvld    = { 0x00000001, gk104_msvld_new },
        .pm = gk104_pm_new,
        .sw = gf100_sw_new,
 };
@@ -1826,7 +1826,7 @@ nvf0_chipset = {
        .gr       = { 0x00000001, gk110_gr_new },
        .mspdec   = { 0x00000001, gk104_mspdec_new },
        .msppp    = { 0x00000001, gf100_msppp_new },
-       .msvld = gk104_msvld_new,
+       .msvld    = { 0x00000001, gk104_msvld_new },
        .sw = gf100_sw_new,
 };
 
@@ -1862,7 +1862,7 @@ nvf1_chipset = {
        .gr       = { 0x00000001, gk110b_gr_new },
        .mspdec   = { 0x00000001, gk104_mspdec_new },
        .msppp    = { 0x00000001, gf100_msppp_new },
-       .msvld = gk104_msvld_new,
+       .msvld    = { 0x00000001, gk104_msvld_new },
        .sw = gf100_sw_new,
 };
 
@@ -1898,7 +1898,7 @@ nv106_chipset = {
        .gr       = { 0x00000001, gk208_gr_new },
        .mspdec   = { 0x00000001, gk104_mspdec_new },
        .msppp    = { 0x00000001, gf100_msppp_new },
-       .msvld = gk104_msvld_new,
+       .msvld    = { 0x00000001, gk104_msvld_new },
        .sw = gf100_sw_new,
 };
 
@@ -1934,7 +1934,7 @@ nv108_chipset = {
        .gr       = { 0x00000001, gk208_gr_new },
        .mspdec   = { 0x00000001, gk104_mspdec_new },
        .msppp    = { 0x00000001, gf100_msppp_new },
-       .msvld = gk104_msvld_new,
+       .msvld    = { 0x00000001, gk104_msvld_new },
        .sw = gf100_sw_new,
 };
 
@@ -3174,7 +3174,6 @@ nvkm_device_ctor(const struct nvkm_device_func *func,
 #include <core/layout.h>
 #undef NVKM_LAYOUT_INST
 #undef NVKM_LAYOUT_ONCE
-               _(NVKM_ENGINE_MSVLD   ,    msvld);
                _(NVKM_ENGINE_NVENC0  , nvenc[0]);
                _(NVKM_ENGINE_NVENC1  , nvenc[1]);
                _(NVKM_ENGINE_NVENC2  , nvenc[2]);
index 745bbb653dc0890540f34bd4d5ee1e3204545057..7be42b980e577dcb7e364da48eb20ad73113b3a7 100644 (file)
@@ -25,7 +25,7 @@
 
 int
 nvkm_msvld_new_(const struct nvkm_falcon_func *func, struct nvkm_device *device,
-               int index, struct nvkm_engine **pengine)
+               enum nvkm_subdev_type type, int inst, struct nvkm_engine **pengine)
 {
-       return nvkm_falcon_new_(func, device, index, true, 0x084000, pengine);
+       return nvkm_falcon_new_(func, device, type, inst, true, 0x084000, pengine);
 }
index 4a2a9f0494af8aa625903ca5a7531808089ea03f..cfa2065319a6617c74483be34cc94d1ffcb3cb45 100644 (file)
@@ -43,8 +43,8 @@ g98_msvld = {
 };
 
 int
-g98_msvld_new(struct nvkm_device *device, int index,
+g98_msvld_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
              struct nvkm_engine **pengine)
 {
-       return nvkm_msvld_new_(&g98_msvld, device, index, pengine);
+       return nvkm_msvld_new_(&g98_msvld, device, type, inst, pengine);
 }
index 1695e532c081f543fd3b0b7166188737e56804f4..8d58ad8e04d33460a15daaa916f92a89d9e434ec 100644 (file)
@@ -43,8 +43,8 @@ gf100_msvld = {
 };
 
 int
-gf100_msvld_new(struct nvkm_device *device, int index,
+gf100_msvld_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
                struct nvkm_engine **pengine)
 {
-       return nvkm_msvld_new_(&gf100_msvld, device, index, pengine);
+       return nvkm_msvld_new_(&gf100_msvld, device, type, inst, pengine);
 }
index b640cd63ebe8593f96bbb75503385e2090673c70..b28be28046f1e042705181d7ff2141c9d8a8f58e 100644 (file)
@@ -35,8 +35,8 @@ gk104_msvld = {
 };
 
 int
-gk104_msvld_new(struct nvkm_device *device, int index,
+gk104_msvld_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
                struct nvkm_engine **pengine)
 {
-       return nvkm_msvld_new_(&gk104_msvld, device, index, pengine);
+       return nvkm_msvld_new_(&gk104_msvld, device, type, inst, pengine);
 }
index 201e8ef3519ec0941f2c0dde67733e91aff76d79..d7489f972c997341e59a24cdc880908b55c47466 100644 (file)
@@ -35,8 +35,8 @@ gt215_msvld = {
 };
 
 int
-gt215_msvld_new(struct nvkm_device *device, int index,
-             struct nvkm_engine **pengine)
+gt215_msvld_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
+               struct nvkm_engine **pengine)
 {
-       return nvkm_msvld_new_(&gt215_msvld, device, index, pengine);
+       return nvkm_msvld_new_(&gt215_msvld, device, type, inst, pengine);
 }
index a0f540ef257b8dbc418cc780f5644f0ca4bfc63e..16c30b62ab09985923a2af1b6273ce2c3c0c656b 100644 (file)
@@ -35,8 +35,8 @@ mcp89_msvld = {
 };
 
 int
-mcp89_msvld_new(struct nvkm_device *device, int index,
-             struct nvkm_engine **pengine)
+mcp89_msvld_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
+               struct nvkm_engine **pengine)
 {
-       return nvkm_msvld_new_(&mcp89_msvld, device, index, pengine);
+       return nvkm_msvld_new_(&mcp89_msvld, device, type, inst, pengine);
 }
index 5cd1e83badbbb8656846144cefec7351570e1f83..f729d919b0540f7524e22bed810633b9792366d1 100644 (file)
@@ -3,8 +3,8 @@
 #define __NVKM_MSVLD_PRIV_H__
 #include <engine/msvld.h>
 
-int nvkm_msvld_new_(const struct nvkm_falcon_func *, struct nvkm_device *,
-                   int index, struct nvkm_engine **);
+int nvkm_msvld_new_(const struct nvkm_falcon_func *, struct nvkm_device *, enum nvkm_subdev_type,
+                   int, struct nvkm_engine **);
 
 void g98_msvld_init(struct nvkm_falcon *);
 
index f274d6077319e66f2d45587f24caf14f690f5f2e..f4267429f59db46d82821608b74060b01faec91b 100644 (file)
@@ -36,14 +36,14 @@ g98_devinit_disable(struct nvkm_devinit *init)
 
        if (!(r001540 & 0x40000000)) {
                nvkm_subdev_disable(device, NVKM_ENGINE_MSPDEC, 0);
-               disable |= (1ULL << NVKM_ENGINE_MSVLD);
+               nvkm_subdev_disable(device, NVKM_ENGINE_MSVLD, 0);
                nvkm_subdev_disable(device, NVKM_ENGINE_MSPPP, 0);
        }
 
        if (!(r00154c & 0x00000004))
                nvkm_subdev_disable(device, NVKM_ENGINE_DISP, 0);
        if (!(r00154c & 0x00000020))
-               disable |= (1ULL << NVKM_ENGINE_MSVLD);
+               nvkm_subdev_disable(device, NVKM_ENGINE_MSVLD, 0);
        if (!(r00154c & 0x00000040))
                disable |= (1ULL << NVKM_ENGINE_SEC);
 
index c5a5064bebc10ec02950ae4acb677473280cea80..051cfd6a5caf5ce82bd55cc8f52bc21bfd541516 100644 (file)
@@ -79,7 +79,7 @@ gf100_devinit_disable(struct nvkm_devinit *init)
        }
 
        if (r022500 & 0x00000004)
-               disable |= (1ULL << NVKM_ENGINE_MSVLD);
+               nvkm_subdev_disable(device, NVKM_ENGINE_MSVLD, 0);
        if (r022500 & 0x00000008)
                nvkm_subdev_disable(device, NVKM_ENGINE_MSENC, 0);
        if (r022500 & 0x00000100)
index 88d70b34ee06f621dc424397d18d4cde4994587d..dc026ac1b5950cdf6ff40895974890f3468ffc04 100644 (file)
@@ -78,7 +78,7 @@ gt215_devinit_disable(struct nvkm_devinit *init)
        if (!(r00154c & 0x00000004))
                nvkm_subdev_disable(device, NVKM_ENGINE_DISP, 0);
        if (!(r00154c & 0x00000020))
-               disable |= (1ULL << NVKM_ENGINE_MSVLD);
+               nvkm_subdev_disable(device, NVKM_ENGINE_MSVLD, 0);
        if (!(r00154c & 0x00000200))
                nvkm_subdev_disable(device, NVKM_ENGINE_CE, 0);
 
index be59afa421897e384730c674553495b1ffde4176..0c92550536cf250911ecf134b5d8450745b58b9b 100644 (file)
@@ -42,7 +42,7 @@ mcp89_devinit_disable(struct nvkm_devinit *init)
        if (!(r00154c & 0x00000004))
                nvkm_subdev_disable(device, NVKM_ENGINE_DISP, 0);
        if (!(r00154c & 0x00000020))
-               disable |= (1ULL << NVKM_ENGINE_MSVLD);
+               nvkm_subdev_disable(device, NVKM_ENGINE_MSVLD, 0);
        if (!(r00154c & 0x00000040))
                disable |= (1ULL << NVKM_ENGINE_VIC);
        if (!(r00154c & 0x00000200))