diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2022-06-01 20:46:27 +1000 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2022-07-27 09:05:46 +1000 |
commit | 168c02994399f2714bc6c73f85b7ce4d827f97aa (patch) | |
tree | d305dc131d0e39b2fa1b78dfa6c548a4d7719467 /drivers/gpu/drm/nouveau/nvif/disp.c | |
parent | 92fba5d3c8f5b757c4e3fdc89afe76a8f6c4da68 (diff) | |
download | linux-stable-168c02994399f2714bc6c73f85b7ce4d827f97aa.tar.gz |
drm/nouveau/disp: add common class handling between <nv50 and >=nv50
About to expose head/output path/connector objects everywhere, so we will
need support for child classes prior to nv50 now.
Somewhat cleaner than the code >=nv50 used previously.
v2:
- use ?: (lyude)
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/nvif/disp.c')
-rw-r--r-- | drivers/gpu/drm/nouveau/nvif/disp.c | 54 |
1 files changed, 32 insertions, 22 deletions
diff --git a/drivers/gpu/drm/nouveau/nvif/disp.c b/drivers/gpu/drm/nouveau/nvif/disp.c index 529cb60d5efb..3a6b7ffeb97a 100644 --- a/drivers/gpu/drm/nouveau/nvif/disp.c +++ b/drivers/gpu/drm/nouveau/nvif/disp.c @@ -21,8 +21,10 @@ */ #include <nvif/disp.h> #include <nvif/device.h> +#include <nvif/printf.h> #include <nvif/class.h> +#include <nvif/if0010.h> void nvif_disp_dtor(struct nvif_disp *disp) @@ -31,33 +33,41 @@ nvif_disp_dtor(struct nvif_disp *disp) } int -nvif_disp_ctor(struct nvif_device *device, const char *name, s32 oclass, - struct nvif_disp *disp) +nvif_disp_ctor(struct nvif_device *device, const char *name, s32 oclass, struct nvif_disp *disp) { static const struct nvif_mclass disps[] = { - { GA102_DISP, -1 }, - { TU102_DISP, -1 }, - { GV100_DISP, -1 }, - { GP102_DISP, -1 }, - { GP100_DISP, -1 }, - { GM200_DISP, -1 }, - { GM107_DISP, -1 }, - { GK110_DISP, -1 }, - { GK104_DISP, -1 }, - { GF110_DISP, -1 }, - { GT214_DISP, -1 }, - { GT206_DISP, -1 }, - { GT200_DISP, -1 }, - { G82_DISP, -1 }, - { NV50_DISP, -1 }, - { NV04_DISP, -1 }, + { GA102_DISP, 0 }, + { TU102_DISP, 0 }, + { GV100_DISP, 0 }, + { GP102_DISP, 0 }, + { GP100_DISP, 0 }, + { GM200_DISP, 0 }, + { GM107_DISP, 0 }, + { GK110_DISP, 0 }, + { GK104_DISP, 0 }, + { GF110_DISP, 0 }, + { GT214_DISP, 0 }, + { GT206_DISP, 0 }, + { GT200_DISP, 0 }, + { G82_DISP, 0 }, + { NV50_DISP, 0 }, + { NV04_DISP, 0 }, {} }; - int cid = nvif_sclass(&device->object, disps, oclass); + struct nvif_disp_v0 args; + int cid, ret; + + cid = nvif_sclass(&device->object, disps, oclass); disp->object.client = NULL; - if (cid < 0) + if (cid < 0) { + NVIF_ERRON(cid, &device->object, "[NEW disp%04x] not supported", oclass); return cid; + } + + args.version = 0; - return nvif_object_ctor(&device->object, name ? name : "nvifDisp", 0, - disps[cid].oclass, NULL, 0, &disp->object); + ret = nvif_object_ctor(&device->object, name ?: "nvifDisp", 0, + disps[cid].oclass, &args, sizeof(args), &disp->object); + NVIF_ERRON(ret, &device->object, "[NEW disp%04x]", disps[cid].oclass); + return ret; } |