From: Imre Deak <imre.deak@intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915: fix for_each_digital_port
Date: Fri, 17 Apr 2015 15:27:32 +0300 [thread overview]
Message-ID: <1429273652.9616.10.camel@intel.com> (raw)
In-Reply-To: <1429271890-7949-1-git-send-email-imre.deak@intel.com>
On pe, 2015-04-17 at 14:58 +0300, Imre Deak wrote:
> We should check if a given encoder is of a digital type before casting
> it to a digital port object. This broke on HSW when iterating the VGA
> encoder.
>
> Introduced in
> commit b403745c84592b26a0713e6944c2b109f6df5c82
> Author: Damien Lespiau <damien.lespiau@intel.com>
> Date: Mon Aug 4 22:01:33 2014 +0100
>
> drm/i915: Iterate through the initialized DDIs to prepare their buffers
>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90067
> Signed-off-by: Imre Deak <imre.deak@intel.com>
> ---
> drivers/gpu/drm/i915/i915_drv.h | 10 ++++++----
> drivers/gpu/drm/i915/intel_ddi.c | 3 ++-
> drivers/gpu/drm/i915/intel_drv.h | 10 ++++++++++
> 3 files changed, 18 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 40ef672..7160fc8 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -251,10 +251,12 @@ enum hpd_pin {
> &dev->mode_config.connector_list, \
> base.head)
>
> -#define for_each_digital_port(dev, digital_port) \
> - list_for_each_entry(digital_port, \
> - &dev->mode_config.encoder_list, \
> - base.base.head)
> +#define for_each_digital_port(dev, __intel_encoder, digital_port) \
> + list_for_each_entry(__intel_encoder, \
> + &dev->mode_config.encoder_list, \
> + base.head) \
> + if (intel_enc_is_digital(__intel_encoder) && \
> + ((digital_port) = enc_to_dig_port(&__intel_encoder->base)))
>
> #define for_each_encoder_on_crtc(dev, __crtc, intel_encoder) \
> list_for_each_entry((intel_encoder), &(dev)->mode_config.encoder_list, base.head) \
> diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
> index 455d44b..b5d7e74 100644
> --- a/drivers/gpu/drm/i915/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/intel_ddi.c
> @@ -370,13 +370,14 @@ static void intel_prepare_ddi_buffers(struct drm_device *dev,
> */
> void intel_prepare_ddi(struct drm_device *dev)
> {
> + struct intel_encoder *__intel_encoder;
> struct intel_digital_port *intel_dig_port;
> bool visited[I915_MAX_PORTS] = { 0, };
>
> if (!HAS_DDI(dev))
> return;
>
> - for_each_digital_port(dev, intel_dig_port) {
> + for_each_digital_port(dev, __intel_encoder, intel_dig_port) {
> if (visited[intel_dig_port->port])
> continue;
>
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index 23a42a4..a354f26 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -870,6 +870,16 @@ hdmi_to_dig_port(struct intel_hdmi *intel_hdmi)
> return container_of(intel_hdmi, struct intel_digital_port, hdmi);
> }
>
> +static inline bool intel_enc_is_digital(struct intel_encoder *intel_encoder)
> +{
> + return intel_encoder->type == INTEL_OUTPUT_HDMI ||
> + intel_encoder->type == INTEL_OUTPUT_DISPLAYPORT ||
> + intel_encoder->type == INTEL_OUTPUT_EDP ||
> + intel_encoder->type == INTEL_OUTPUT_UNKNOWN ||
> + intel_encoder->type == INTEL_OUTPUT_DP_MST;
> +
> +}
This should probably have a MISSING_CASE for the other types, I can
change that if there are no other comments.
> +
> /*
> * Returns the number of planes for this pipe, ie the number of sprites + 1
> * (primary plane). This doesn't count the cursor plane then.
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2015-04-17 12:27 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-17 11:58 [PATCH] drm/i915: fix for_each_digital_port Imre Deak
2015-04-17 12:27 ` Imre Deak [this message]
2015-04-17 12:36 ` Paulo Zanoni
2015-04-17 16:29 ` Imre Deak
2015-04-17 16:31 ` [PATCH v2 1/2] drm/i915: factor out ddi_get_encoder_port Imre Deak
2015-04-27 17:24 ` Damien Lespiau
2015-04-17 16:31 ` [PATCH v2 2/2] drm/i915: fix intel_prepare_ddi Imre Deak
2015-04-23 21:37 ` shuang.he
2015-04-27 17:29 ` Damien Lespiau
2015-04-30 9:37 ` Jani Nikula
2015-04-23 21:39 ` [PATCH] drm/i915: fix for_each_digital_port shuang.he
2015-04-27 17:05 ` Damien Lespiau
2015-04-27 17:15 ` Damien Lespiau
2015-04-27 17:18 ` 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=1429273652.9616.10.camel@intel.com \
--to=imre.deak@intel.com \
--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.