From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Damien Lespiau <damien.lespiau@intel.com>
Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 07/12] drm/i915/hdmi: Port the infoframe code to the common hdmi helpers
Date: Wed, 7 Aug 2013 14:00:36 +0300 [thread overview]
Message-ID: <20130807110036.GV5004@intel.com> (raw)
In-Reply-To: <1375817544-14565-8-git-send-email-damien.lespiau@intel.com>
On Tue, Aug 06, 2013 at 08:32:19PM +0100, Damien Lespiau wrote:
> Let's use the drivers/video/hmdi.c and drm infoframe helpers to build
> our infoframes.
>
> v2: Simplify the logic to compute the buffer size. We can just take the
> maximum infoframe size rounded to 32, which happens to be what the
> hardware let us write anyway.
>
> v3: Remove unnecessary memset() (Ville Syrjälä)
>
> Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
> drivers/gpu/drm/i915/intel_hdmi.c | 82 +++++++++++++++++++++++++++------------
> 1 file changed, 58 insertions(+), 24 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
> index ee67e23..455dfa7 100644
> --- a/drivers/gpu/drm/i915/intel_hdmi.c
> +++ b/drivers/gpu/drm/i915/intel_hdmi.c
> @@ -325,14 +325,43 @@ static void hsw_write_infoframe(struct drm_encoder *encoder,
> POSTING_READ(ctl_reg);
> }
>
> +/*
> + * The data we write to the DIP data buffer registers is 1 byte bigger than the
> + * HDMI infoframe size because of an ECC/reserved byte at position 3 (starting
> + * at 0). It's also a byte used by DisplayPort so the same DIP registers can be
> + * used for both technologies.
> + *
> + * DW0: Reserved/ECC/DP | HB2 | HB1 | HB0
> + * DW1: DB3 | DB2 | DB1 | DB0
> + * DW2: DB7 | DB6 | DB5 | DB4
> + * DW3: ...
> + *
> + * (HB is Header Byte, DB is Data Byte)
> + *
> + * The hdmi pack() functions don't know about that hardware specific hole so we
> + * trick them by giving an offset into the buffer and moving back the header
> + * bytes by one.
> + */
> static void intel_set_infoframe(struct drm_encoder *encoder,
> - struct dip_infoframe *frame)
> + union hdmi_infoframe *frame)
> {
> struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder);
> + uint8_t buffer[VIDEO_DIP_DATA_SIZE];
> + ssize_t len;
>
> - intel_dip_infoframe_csum(frame);
> - intel_hdmi->write_infoframe(encoder, frame->type, (uint8_t *)frame,
> - DIP_HEADER_SIZE + frame->len);
> + /* see comment above for the reason for this offset */
> + len = hdmi_infoframe_pack(frame, buffer + 1, sizeof(buffer) - 1);
> + if (len < 0)
> + return;
> +
> + /* Insert the 'hole' (see big comment above) at position 3 */
> + buffer[0] = buffer[1];
> + buffer[1] = buffer[2];
> + buffer[2] = buffer[3];
> + buffer[3] = 0;
> + len++;
> +
> + intel_hdmi->write_infoframe(encoder, frame->any.type, buffer, len);
> }
>
> static void intel_hdmi_set_avi_infoframe(struct drm_encoder *encoder,
> @@ -340,40 +369,45 @@ static void intel_hdmi_set_avi_infoframe(struct drm_encoder *encoder,
> {
> struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder);
> struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
> - struct dip_infoframe avi_if = {
> - .type = DIP_TYPE_AVI,
> - .ver = DIP_VERSION_AVI,
> - .len = DIP_LEN_AVI,
> - };
> + union hdmi_infoframe frame;
> + int ret;
> +
> + ret = drm_hdmi_avi_infoframe_from_display_mode(&frame.avi,
> + adjusted_mode);
> + if (ret < 0) {
> + DRM_ERROR("couldn't fill AVI infoframe\n");
> + return;
> + }
>
> if (adjusted_mode->flags & DRM_MODE_FLAG_DBLCLK)
> - avi_if.body.avi.YQ_CN_PR |= DIP_AVI_PR_2;
> + frame.avi.pixel_repeat = 1;
>
> if (intel_hdmi->rgb_quant_range_selectable) {
> if (intel_crtc->config.limited_color_range)
> - avi_if.body.avi.ITC_EC_Q_SC |= DIP_AVI_RGB_QUANT_RANGE_LIMITED;
> + frame.avi.quantization_range =
> + HDMI_QUANTIZATION_RANGE_LIMITED;
> else
> - avi_if.body.avi.ITC_EC_Q_SC |= DIP_AVI_RGB_QUANT_RANGE_FULL;
> + frame.avi.quantization_range =
> + HDMI_QUANTIZATION_RANGE_FULL;
> }
>
> - avi_if.body.avi.VIC = drm_match_cea_mode(adjusted_mode);
> -
> - intel_set_infoframe(encoder, &avi_if);
> + intel_set_infoframe(encoder, &frame);
> }
>
> static void intel_hdmi_set_spd_infoframe(struct drm_encoder *encoder)
> {
> - struct dip_infoframe spd_if;
> + union hdmi_infoframe frame;
> + int ret;
> +
> + ret = hdmi_spd_infoframe_init(&frame.spd, "Intel", "Integrated gfx");
> + if (ret < 0) {
> + DRM_ERROR("couldn't fill SPD infoframe\n");
> + return;
> + }
>
> - memset(&spd_if, 0, sizeof(spd_if));
> - spd_if.type = DIP_TYPE_SPD;
> - spd_if.ver = DIP_VERSION_SPD;
> - spd_if.len = DIP_LEN_SPD;
> - strcpy(spd_if.body.spd.vn, "Intel");
> - strcpy(spd_if.body.spd.pd, "Integrated gfx");
> - spd_if.body.spd.sdi = DIP_SPD_PC;
> + frame.spd.sdi = HDMI_SPD_SDI_PC;
>
> - intel_set_infoframe(encoder, &spd_if);
> + intel_set_infoframe(encoder, &frame);
> }
>
> static void g4x_set_infoframes(struct drm_encoder *encoder,
> --
> 1.8.3.1
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
--
Ville Syrjälä
Intel OTC
next prev parent reply other threads:[~2013-08-07 11:00 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-06 19:32 Port the i915 HDMI infoframe code to the common infrastructure v2 Damien Lespiau
2013-08-06 19:32 ` [PATCH 01/12] video/hdmi: Replace the payload length by their defines Damien Lespiau
2013-08-07 2:06 ` Alex Deucher
2013-08-07 8:13 ` Daniel Vetter
2013-08-06 19:32 ` [PATCH 02/12] video/hdmi: Introduce a generic hdmi_infoframe union Damien Lespiau
2013-08-06 19:32 ` [PATCH 03/12] video/hdmi: Add a macro to return the size of a full infoframe Damien Lespiau
2013-08-06 19:32 ` [PATCH 04/12] video/hmdi: Clear the whole incoming buffer, not just the infoframe size Damien Lespiau
2013-08-07 10:56 ` [Intel-gfx] " Ville Syrjälä
2013-08-07 11:02 ` Damien Lespiau
2013-08-06 19:32 ` [PATCH 05/12] drm: Don't generate invalid AVI infoframes for CEA modes Damien Lespiau
2013-08-06 19:32 ` [PATCH 06/12] drm/i915/hdmi: Change the write_infoframe vfunc to take a buffer and a type Damien Lespiau
2013-08-07 10:58 ` Ville Syrjälä
2013-08-06 19:32 ` [PATCH 07/12] drm/i915/hdmi: Port the infoframe code to the common hdmi helpers Damien Lespiau
2013-08-07 11:00 ` Ville Syrjälä [this message]
2013-08-06 19:32 ` [PATCH 08/12] drm/i915/sdvo: Port the infoframe code to the shared infrastructure Damien Lespiau
2013-08-06 19:32 ` [PATCH 09/12] drm/i915: Remove the now obsolete infoframe definitions Damien Lespiau
2013-08-06 19:32 ` [PATCH 10/12] drm: Handle the DBLCLK flag in the common infoframe helper Damien Lespiau
2013-08-06 19:32 ` [PATCH 11/12] drm: Set aspect ratio fields in the AVI infoframe even for non CEA modes Damien Lespiau
2013-08-06 19:32 ` [PATCH 12/12] drm/i915/hmdi: Rename set_infoframe() to write_infoframe() Damien Lespiau
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=20130807110036.GV5004@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=damien.lespiau@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.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.