All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ilia Mirkin <imirkin-FrUbXkNCsVf2fBVCVOL8/A@public.gmane.org>
To: Alastair Bridgewater
	<alastair.bridgewater-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: "nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org"
	<nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>
Subject: Re: [PATCH 2/6] drm/nouveau: Pass mode-dependent AVI and Vendor HDMI InfoFrames to NVKM
Date: Tue, 17 Jan 2017 22:31:41 -0500	[thread overview]
Message-ID: <CAKb7UvhhvHY8fG-XwJb-cF_ja_ELO+UfzNU8WVtRq+FqiJJ=pg@mail.gmail.com> (raw)
In-Reply-To: <20170117224204.27516-3-alastair.bridgewater-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

On Tue, Jan 17, 2017 at 5:42 PM, Alastair Bridgewater
<alastair.bridgewater@gmail.com> wrote:
> Now that we have mechanism by which to pass mode-dependent HDMI
> InfoFrames to the low-level hardware driver, it is incumbent upon
> us to do so.
>
> Experimentation on a gt215 device suggests that the Audio InfoFrame
> is not required here, possibly being provided by the HDA device
> when necessary (because where else would it come from?).

Presumably it's necessary on G84, which doesn't have the HDA device?
Looks like there's no helper for computing such a thing in drm_edid.
It's a pretty fixed setup on G84... you're supposed to hook the audio
from your sound card into an internal S/PDIF connector, so just
leaving the default audio infoframe on in there might be enough.

>
> Signed-off-by: Alastair Bridgewater <alastair.bridgewater@gmail.com>
> ---
>  drivers/gpu/drm/nouveau/nv50_display.c | 49 +++++++++++++++++++++++++++++++++-
>  1 file changed, 48 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c
> index 2c2c645..d52d0b8 100644
> --- a/drivers/gpu/drm/nouveau/nv50_display.c
> +++ b/drivers/gpu/drm/nouveau/nv50_display.c
> @@ -23,6 +23,7 @@
>   */
>
>  #include <linux/dma-mapping.h>
> +#include <linux/hdmi.h>
>
>  #include <drm/drmP.h>
>  #include <drm/drm_atomic.h>
> @@ -31,6 +32,7 @@
>  #include <drm/drm_dp_helper.h>
>  #include <drm/drm_fb_helper.h>
>  #include <drm/drm_plane_helper.h>
> +#include <drm/drm_edid.h>
>
>  #include <nvif/class.h>
>  #include <nvif/cl0002.h>
> @@ -2772,6 +2774,28 @@ nv50_hdmi_disable(struct drm_encoder *encoder, struct nouveau_crtc *nv_crtc)
>         nvif_mthd(disp->disp, 0, &args, sizeof(args));
>  }
>
> +static ssize_t
> +nv50_hdmi_pack_infoframe(struct nv50_disp_sor_hdmi_pwr_v0_infoframe *frame_out,
> +                        union hdmi_infoframe *frame_in)
> +{
> +       uint8_t buffer[17]; /* The header plus two "subpacks" */
> +       ssize_t len;
> +
> +       len = hdmi_infoframe_pack(frame_in, buffer, sizeof(buffer));
> +
> +       frame_out->header = buffer[0] | (buffer[1] << 8) | (buffer[2] << 16);
> +       frame_out->subpack0_low = buffer[3] | (buffer[4] << 8) |
> +               (buffer[5] << 16) | (buffer[6] << 24);
> +       frame_out->subpack0_high = buffer[7] | (buffer[8] << 8) |
> +               (buffer[9] << 16);
> +       frame_out->subpack1_low = buffer[10] | (buffer[11] << 8) |
> +               (buffer[12] << 16) | (buffer[13] << 24);
> +       frame_out->subpack1_high = buffer[14] | (buffer[15] << 8) |
> +               (buffer[16] << 16);
> +
> +       return len;
> +}
> +
>  static void
>  nv50_hdmi_enable(struct drm_encoder *encoder, struct drm_display_mode *mode)
>  {
> @@ -2781,6 +2805,7 @@ nv50_hdmi_enable(struct drm_encoder *encoder, struct drm_display_mode *mode)
>         struct {
>                 struct nv50_disp_mthd_v1 base;
>                 struct nv50_disp_sor_hdmi_pwr_v0 pwr;
> +               struct nv50_disp_sor_hdmi_pwr_v0_infoframe iframe[3];
>         } args = {
>                 .base.version = 1,
>                 .base.method = NV50_DISP_MTHD_V1_SOR_HDMI_PWR,
> @@ -2792,17 +2817,39 @@ nv50_hdmi_enable(struct drm_encoder *encoder, struct drm_display_mode *mode)
>         };
>         struct nouveau_connector *nv_connector;
>         u32 max_ac_packet;
> +       union hdmi_infoframe avi_frame;
> +       union hdmi_infoframe vendor_frame;
> +       int ret;
> +       int size;
> +       int frame = 0;
>
>         nv_connector = nouveau_encoder_connector_get(nv_encoder);
>         if (!drm_detect_hdmi_monitor(nv_connector->edid))
>                 return;
>
> +       /* Audio InfoFrame apparently not required (supplied by HDA device?) */
> +
> +       ret = drm_hdmi_avi_infoframe_from_display_mode(&avi_frame.avi, mode);
> +       if (ret >= 0) {

if (!ret) or if (ret == 0) is more idiomatic.

> +               /* We have an AVI InfoFrame, populate it to the display */
> +               args.pwr.flags |= NV50_DISP_MTHD_V1_SOR_HDMI_PWR_FLAG_AVI_INFOFRAME;
> +               nv50_hdmi_pack_infoframe(&args.iframe[frame++], &avi_frame);
> +       }
> +
> +       ret = drm_hdmi_vendor_infoframe_from_display_mode(&vendor_frame.vendor.hdmi, mode);
> +       if (ret >= 0) {
> +               /* We have a Vendor InfoFrame, populate it to the display */
> +               args.pwr.flags |= NV50_DISP_MTHD_V1_SOR_HDMI_PWR_FLAG_VENDOR_INFOFRAME;
> +               nv50_hdmi_pack_infoframe(&args.iframe[frame++], &vendor_frame);
> +       }
> +
>         max_ac_packet  = mode->htotal - mode->hdisplay;
>         max_ac_packet -= args.pwr.rekey;
>         max_ac_packet -= 18; /* constant from tegra */
>         args.pwr.max_ac_packet = max_ac_packet / 32;
>
> -       nvif_mthd(disp->disp, 0, &args, sizeof(args));
> +       size = sizeof(args.base) + sizeof(args.pwr) + frame * sizeof(args.iframe[0]);
> +       nvif_mthd(disp->disp, 0, &args, size);
>         nv50_audio_enable(encoder, mode);
>  }
>
> --
> 2.10.2
>
> _______________________________________________
> Nouveau mailing list
> Nouveau@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/nouveau
_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

  parent reply	other threads:[~2017-01-18  3:31 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-17 22:41 [PATCH 0/6] drm/nouveau: Enable HDMI Stereoscopy Alastair Bridgewater
     [not found] ` <20170117224204.27516-1-alastair.bridgewater-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-01-17 22:41   ` [PATCH 1/6] drm/nouveau: Extend NVKM HDMI power control method to set InfoFrames Alastair Bridgewater
     [not found]     ` <20170117224204.27516-2-alastair.bridgewater-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-01-18  3:19       ` Ilia Mirkin
2017-01-17 22:42   ` [PATCH 2/6] drm/nouveau: Pass mode-dependent AVI and Vendor HDMI InfoFrames to NVKM Alastair Bridgewater
     [not found]     ` <20170117224204.27516-3-alastair.bridgewater-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-01-18  3:31       ` Ilia Mirkin [this message]
2017-01-17 22:42   ` [PATCH 3/6] drm/nouveau: Use supplied HDMI InfoFrames on GT215 hardware Alastair Bridgewater
2017-01-17 22:42   ` [PATCH 4/6] drm/nouveau: Use supplied HDMI InfoFrames on GK104 hardware Alastair Bridgewater
2017-01-17 22:42   ` [PATCH 5/6] drm: Delete "mandatory" stereographic modes Alastair Bridgewater
     [not found]     ` <20170117224204.27516-6-alastair.bridgewater-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-01-18  5:10       ` Ilia Mirkin
     [not found]         ` <CAKb7UvigMUdD93eqa=3bM9VHSGztV3DWgv-8hx8ho7EmHrhtqA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-01-18 11:45           ` Damien Lespiau
     [not found]             ` <20170118114554.GA6460-q+Y1yDQJ1rIB9AHHLWeGtNQXobZC6xk2@public.gmane.org>
2017-01-18 16:27               ` Ilia Mirkin
     [not found]                 ` <CAKb7Uvg0wgmZG+S39XNP-r0Qny6ikDhwvyy9TAspOZQ_dEp1RQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-01-18 16:33                   ` Damien Lespiau
     [not found]                     ` <20170118163343.GD6460-q+Y1yDQJ1rIB9AHHLWeGtNQXobZC6xk2@public.gmane.org>
2017-01-18 16:41                       ` Damien Lespiau
2017-01-18 16:57                         ` [Nouveau] " Ilia Mirkin
2017-01-18 18:48                           ` Ilia Mirkin
     [not found]                             ` <CAKb7UviODH0YPH-EMUmO9Ssu5BrBb3GVa82SGawbQbiO5NKXAw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-01-18 19:01                               ` Damien Lespiau
     [not found]                                 ` <20170118190119.GF6460-q+Y1yDQJ1rIB9AHHLWeGtNQXobZC6xk2@public.gmane.org>
2017-01-18 21:35                                   ` Alastair Bridgewater
2017-01-17 22:42   ` [PATCH 6/6] drm/nouveau: Enable stereoscopic 3D output over HDMI Alastair Bridgewater
2017-03-27 21:57   ` [PATCH v2 00/10] Enable HDMI Stereoscopy Alastair Bridgewater
     [not found]     ` <20170327215807.8461-1-alastair.bridgewater-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-03-27 21:57       ` [PATCH v2 01/10] drm/nouveau: Use drm_mode_set_crtcinfo() to compensate for vscan / ilace Alastair Bridgewater
2017-03-27 21:57       ` [PATCH v2 02/10] drm/nouveau: Extend NVKM HDMI power control method to set InfoFrames Alastair Bridgewater
2017-03-27 21:58       ` [PATCH v2 03/10] drm/nouveau: Pass mode-dependent AVI and Vendor HDMI InfoFrames to NVKM Alastair Bridgewater
2017-03-27 21:58       ` [PATCH v2 04/10] drm/nouveau: Add mechanism to convert HDMI InfoFrames to hardware format Alastair Bridgewater
2017-03-27 21:58       ` [PATCH v2 05/10] drm/nouveau: Use supplied HDMI InfoFrames on G84 hardware Alastair Bridgewater
2017-03-27 21:58       ` [PATCH v2 06/10] drm/nouveau: Use supplied HDMI InfoFrames on GT215 hardware Alastair Bridgewater
2017-03-27 21:58       ` [PATCH v2 07/10] drm/nouveau: Use supplied HDMI InfoFrames on GF119 hardware Alastair Bridgewater
2017-03-27 21:58       ` [PATCH v2 08/10] drm/nouveau: Use supplied HDMI InfoFrames on GK104 hardware Alastair Bridgewater
2017-03-27 21:58       ` [PATCH v2 09/10] drm/nouveau: Handle frame-packing mode geometry and timing effects Alastair Bridgewater
     [not found]         ` <20170327215807.8461-10-alastair.bridgewater-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-03-28  1:54           ` kbuild test robot
2017-03-27 21:58       ` [PATCH v2 10/10] drm/nouveau: Enable stereoscopic 3D output over HDMI Alastair Bridgewater
2017-03-29 12:02       ` [PATCH v2 00/10] Enable HDMI Stereoscopy Ville Syrjälä
     [not found]         ` <20170329120247.GX30290-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2017-03-29 14:24           ` Alastair Bridgewater
     [not found]             ` <CAEcYz2Qb74b27efw=s+ZSSO4SEQQ2_mVKXz4D3za1GkVh_AHgg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-03-29 14:42               ` Ville Syrjälä
2017-03-29 14:48               ` Ilia Mirkin
2017-04-11 17:11   ` [PATCH v3 00/10] drm/nouveau " Alastair Bridgewater
     [not found]     ` <20170411171125.10496-1-alastair.bridgewater-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-04-11 17:11       ` [PATCH v3 01/10] drm/nouveau: Clean up nv50_head_atomic_check_mode() and fix blankus calculation Alastair Bridgewater
2017-04-11 17:11       ` [PATCH v3 02/10] drm/nouveau: Extend NVKM HDMI power control method to set InfoFrames Alastair Bridgewater
2017-04-11 17:11       ` [PATCH v3 03/10] drm/nouveau: Pass mode-dependent AVI and Vendor HDMI InfoFrames to NVKM Alastair Bridgewater
2017-04-11 17:11       ` [PATCH v3 04/10] drm/nouveau: Add mechanism to convert HDMI InfoFrames to hardware format Alastair Bridgewater
2017-04-11 17:11       ` [PATCH v3 05/10] drm/nouveau: Use supplied HDMI InfoFrames on G84 hardware Alastair Bridgewater
2017-04-11 17:11       ` [PATCH v3 06/10] drm/nouveau: Use supplied HDMI InfoFrames on GT215 hardware Alastair Bridgewater
2017-04-11 17:11       ` [PATCH v3 07/10] drm/nouveau: Use supplied HDMI InfoFrames on GF119 hardware Alastair Bridgewater
2017-04-11 17:11       ` [PATCH v3 08/10] drm/nouveau: Use supplied HDMI InfoFrames on GK104 hardware Alastair Bridgewater
2017-04-11 17:11       ` [PATCH v3 09/10] drm/nouveau: Handle frame-packing mode geometry and timing effects Alastair Bridgewater
2017-04-11 17:11       ` [PATCH v3 10/10] drm/nouveau: Enable stereoscopic 3D output over HDMI Alastair Bridgewater
2017-04-11 17:32         ` [Nouveau] " Ilia Mirkin
     [not found]           ` <CAKb7UvjimkWMZdi1-NwWDf6BK99d1epo+i1dwrONQYrcf+n57A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-04-12 15:22             ` Alastair Bridgewater
2017-04-13  8:34               ` [Nouveau] " Ben Skeggs

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAKb7UvhhvHY8fG-XwJb-cF_ja_ELO+UfzNU8WVtRq+FqiJJ=pg@mail.gmail.com' \
    --to=imirkin-frubxkncsvf2fbvcvol8/a@public.gmane.org \
    --cc=alastair.bridgewater-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.