- transition from "ioctl" interface Signed-off-by: Ben Skeggs <bskeggs@xxxxxxxxxx> --- drivers/gpu/drm/nouveau/dispnv50/disp.c | 18 +++------ .../gpu/drm/nouveau/include/nvif/driverif.h | 7 ++++ drivers/gpu/drm/nouveau/include/nvif/if0012.h | 13 ------- drivers/gpu/drm/nouveau/include/nvif/outp.h | 3 +- drivers/gpu/drm/nouveau/nvif/outp.c | 7 ++-- .../gpu/drm/nouveau/nvkm/engine/disp/uoutp.c | 38 +++++++++++-------- 6 files changed, 40 insertions(+), 46 deletions(-) diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c b/drivers/gpu/drm/nouveau/dispnv50/disp.c index e2d71916326f..0bac0e813184 100644 --- a/drivers/gpu/drm/nouveau/dispnv50/disp.c +++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c @@ -755,10 +755,7 @@ nv50_hdmi_enable(struct drm_encoder *encoder, struct nouveau_crtc *nv_crtc, union hdmi_infoframe infoframe = { 0 }; const u8 rekey = 56; /* binary driver, and tegra, constant */ u32 max_ac_packet; - struct { - struct nvif_outp_infoframe_v0 infoframe; - u8 data[17]; - } args = { 0 }; + u8 data[17] = {}; int ret, size; max_ac_packet = mode->htotal - mode->hdisplay; @@ -795,29 +792,26 @@ nv50_hdmi_enable(struct drm_encoder *encoder, struct nouveau_crtc *nv_crtc, return; /* AVI InfoFrame. */ - args.infoframe.version = 0; - args.infoframe.head = nv_crtc->index; - if (!drm_hdmi_avi_infoframe_from_display_mode(&infoframe.avi, &nv_connector->base, mode)) { drm_hdmi_avi_infoframe_quant_range(&infoframe.avi, &nv_connector->base, mode, HDMI_QUANTIZATION_RANGE_FULL); - size = hdmi_infoframe_pack(&infoframe, args.data, ARRAY_SIZE(args.data)); + size = hdmi_infoframe_pack(&infoframe, data, ARRAY_SIZE(data)); } else { size = 0; } - nvif_outp_infoframe(&nv_encoder->outp, NVIF_OUTP_INFOFRAME_V0_AVI, &args.infoframe, size); + nvif_outp_infoframe(&nv_encoder->outp, nv_crtc->index, NVIF_OUTP_INFOFRAME_AVI, data, size); /* Vendor InfoFrame. */ - memset(&args.data, 0, sizeof(args.data)); + memset(data, 0, sizeof(data)); if (!drm_hdmi_vendor_infoframe_from_display_mode(&infoframe.vendor.hdmi, &nv_connector->base, mode)) - size = hdmi_infoframe_pack(&infoframe, args.data, ARRAY_SIZE(args.data)); + size = hdmi_infoframe_pack(&infoframe, data, ARRAY_SIZE(data)); else size = 0; - nvif_outp_infoframe(&nv_encoder->outp, NVIF_OUTP_INFOFRAME_V0_VSI, &args.infoframe, size); + nvif_outp_infoframe(&nv_encoder->outp, nv_crtc->index, NVIF_OUTP_INFOFRAME_VSI, data, size); nv_encoder->hdmi.enabled = true; } diff --git a/drivers/gpu/drm/nouveau/include/nvif/driverif.h b/drivers/gpu/drm/nouveau/include/nvif/driverif.h index 6f1ec831b4d7..cef19e04f208 100644 --- a/drivers/gpu/drm/nouveau/include/nvif/driverif.h +++ b/drivers/gpu/drm/nouveau/include/nvif/driverif.h @@ -244,6 +244,11 @@ struct nvif_conn_impl { const struct nvif_event_impl **, struct nvif_event_priv **); }; +enum nvif_outp_infoframe_type { + NVIF_OUTP_INFOFRAME_AVI, + NVIF_OUTP_INFOFRAME_VSI, +}; + enum nvif_outp_detect_status { NVIF_OUTP_DETECT_NOT_PRESENT, NVIF_OUTP_DETECT_PRESENT, @@ -295,6 +300,8 @@ struct nvif_outp_impl { int (*config)(struct nvif_outp_priv *, u8 head, bool enable, u8 max_ac_packet, u8 rekey, u32 khz, bool scdc, bool scdc_scrambling, bool scdc_low_rates); + int (*infoframe)(struct nvif_outp_priv *, u8 head, enum nvif_outp_infoframe_type, + u8 *data, u8 size); } hdmi; struct { diff --git a/drivers/gpu/drm/nouveau/include/nvif/if0012.h b/drivers/gpu/drm/nouveau/include/nvif/if0012.h index c2a3af721116..a045c66fc1ca 100644 --- a/drivers/gpu/drm/nouveau/include/nvif/if0012.h +++ b/drivers/gpu/drm/nouveau/include/nvif/if0012.h @@ -4,7 +4,6 @@ #include <drm/display/drm_dp.h> -#define NVIF_OUTP_V0_INFOFRAME 0x60 #define NVIF_OUTP_V0_HDA_ELD 0x61 #define NVIF_OUTP_V0_DP_AUX_PWR 0x70 @@ -17,18 +16,6 @@ #define NVIF_OUTP_V0_DP_MST_ID_PUT 0x77 #define NVIF_OUTP_V0_DP_MST_VCPI 0x78 -union nvif_outp_infoframe_args { - struct nvif_outp_infoframe_v0 { - __u8 version; -#define NVIF_OUTP_INFOFRAME_V0_AVI 0 -#define NVIF_OUTP_INFOFRAME_V0_VSI 1 - __u8 type; - __u8 head; - __u8 pad03[5]; - __u8 data[]; - } v0; -}; - union nvif_outp_hda_eld_args { struct nvif_outp_hda_eld_v0 { __u8 version; diff --git a/drivers/gpu/drm/nouveau/include/nvif/outp.h b/drivers/gpu/drm/nouveau/include/nvif/outp.h index 7a64a7d2ac97..8be799c88aff 100644 --- a/drivers/gpu/drm/nouveau/include/nvif/outp.h +++ b/drivers/gpu/drm/nouveau/include/nvif/outp.h @@ -49,7 +49,8 @@ int nvif_outp_lvds(struct nvif_outp *, bool dual, bool bpc8); int nvif_outp_hdmi(struct nvif_outp *, int head, bool enable, u8 max_ac_packet, u8 rekey, u32 khz, bool scdc, bool scdc_scrambling, bool scdc_low_rates); -int nvif_outp_infoframe(struct nvif_outp *, u8 type, struct nvif_outp_infoframe_v0 *, u32 size); +int nvif_outp_infoframe(struct nvif_outp *, int head, enum nvif_outp_infoframe_type, + u8 *data, u8 size); int nvif_outp_hda_eld(struct nvif_outp *, int head, void *data, u32 size); int nvif_outp_dp_aux_pwr(struct nvif_outp *, bool enable); diff --git a/drivers/gpu/drm/nouveau/nvif/outp.c b/drivers/gpu/drm/nouveau/nvif/outp.c index 99a1e0073166..4ecdc44eb84a 100644 --- a/drivers/gpu/drm/nouveau/nvif/outp.c +++ b/drivers/gpu/drm/nouveau/nvif/outp.c @@ -214,13 +214,12 @@ nvif_outp_hda_eld(struct nvif_outp *outp, int head, void *data, u32 size) } int -nvif_outp_infoframe(struct nvif_outp *outp, u8 type, struct nvif_outp_infoframe_v0 *args, u32 size) +nvif_outp_infoframe(struct nvif_outp *outp, int head, enum nvif_outp_infoframe_type type, + u8 *data, u8 size) { int ret; - args->type = type; - - ret = nvif_mthd(&outp->object, NVIF_OUTP_V0_INFOFRAME, args, sizeof(*args) + size); + ret = outp->impl->hdmi.infoframe(outp->priv, head, type, data, size); NVIF_ERRON(ret, &outp->object, "[INFOFRAME type:%d size:%d]", type, size); return ret; } diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/uoutp.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/uoutp.c index 325af91075ab..a694a43fd495 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/uoutp.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/uoutp.c @@ -245,29 +245,35 @@ nvkm_uoutp_mthd_hda_eld(struct nvkm_outp *outp, void *argv, u32 argc) } static int -nvkm_uoutp_mthd_infoframe(struct nvkm_outp *outp, void *argv, u32 argc) +nvkm_uoutp_infoframe(struct nvif_outp_priv *uoutp, u8 head, + enum nvif_outp_infoframe_type type, u8 *data, u8 size) { - struct nvkm_ior *ior = outp->ior; - union nvif_outp_infoframe_args *args = argv; - ssize_t size = argc - sizeof(*args); + struct nvkm_ior *ior; + int ret; - if (argc < sizeof(args->v0) || args->v0.version != 0) - return -ENOSYS; - if (!nvkm_head_find(outp->disp, args->v0.head)) + if (!nvkm_head_find(uoutp->outp->disp, head)) return -EINVAL; - switch (ior->func->hdmi ? args->v0.type : 0xff) { - case NVIF_OUTP_INFOFRAME_V0_AVI: - ior->func->hdmi->infoframe_avi(ior, args->v0.head, &args->v0.data, size); - return 0; - case NVIF_OUTP_INFOFRAME_V0_VSI: - ior->func->hdmi->infoframe_vsi(ior, args->v0.head, &args->v0.data, size); - return 0; + ret = nvkm_uoutp_lock_acquired(uoutp); + if (ret) + return ret; + + ior = uoutp->outp->ior; + + switch (ior->func->hdmi ? type : 0xff) { + case NVIF_OUTP_INFOFRAME_AVI: + ior->func->hdmi->infoframe_avi(ior, head, data, size); + break; + case NVIF_OUTP_INFOFRAME_VSI: + ior->func->hdmi->infoframe_vsi(ior, head, data, size); + break; default: + ret = -EINVAL; break; } - return -EINVAL; + nvkm_uoutp_unlock(uoutp); + return ret; } static int @@ -533,7 +539,6 @@ static int nvkm_uoutp_mthd_acquired(struct nvkm_outp *outp, u32 mthd, void *argv, u32 argc) { switch (mthd) { - case NVIF_OUTP_V0_INFOFRAME : return nvkm_uoutp_mthd_infoframe (outp, argv, argc); case NVIF_OUTP_V0_HDA_ELD : return nvkm_uoutp_mthd_hda_eld (outp, argv, argc); case NVIF_OUTP_V0_DP_TRAIN : return nvkm_uoutp_mthd_dp_train (outp, argv, argc); case NVIF_OUTP_V0_DP_DRIVE : return nvkm_uoutp_mthd_dp_drive (outp, argv, argc); @@ -670,6 +675,7 @@ nvkm_uoutp_new(struct nvkm_disp *disp, u8 id, const struct nvif_outp_impl **pimp } uoutp->impl.proto = NVIF_OUTP_TMDS; uoutp->impl.hdmi.config = nvkm_uoutp_hdmi; + uoutp->impl.hdmi.infoframe = nvkm_uoutp_infoframe; break; case DCB_OUTPUT_LVDS: uoutp->impl.type = NVIF_OUTP_SOR; -- 2.41.0