All of lore.kernel.org
 help / color / mirror / Atom feed
From: Owain Ainsworth <zerooa@googlemail.com>
To: Jesse Barnes <jbarnes@virtuousgeek.org>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 7/7] drm/i915: wait for actual vblank, not just 20ms
Date: Wed, 18 Aug 2010 21:48:50 +0100	[thread overview]
Message-ID: <20100818204850.GD4929@melanie.nicotinebsd.org> (raw)
In-Reply-To: <1282158036-1671-8-git-send-email-jbarnes@virtuousgeek.org>

On Wed, Aug 18, 2010 at 12:00:36PM -0700, Jesse Barnes wrote:
> Waiting for a hard coded 20ms isn't always enough to make sure a vblank
> period has actually occurred, so add code to make sure we really have
> passed through a vblank period (or that the pipe is off when disabling).
> 
> This prevents problems with mode setting and link training, and seems to
> fix a bug like https://bugs.freedesktop.org/show_bug.cgi?id=29278, but
> on an HP 8440p instead.  Hopefully also fixes
> https://bugs.freedesktop.org/show_bug.cgi?id=29141.
> 
> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
> ---
>  drivers/gpu/drm/i915/i915_reg.h      |    1 +
>  drivers/gpu/drm/i915/intel_crt.c     |    2 +-
>  drivers/gpu/drm/i915/intel_display.c |   75 ++++++++++++++++++++++++++--------
>  drivers/gpu/drm/i915/intel_dp.c      |    3 +-
>  drivers/gpu/drm/i915/intel_drv.h     |    3 +-
>  drivers/gpu/drm/i915/intel_sdvo.c    |    3 +-
>  drivers/gpu/drm/i915/intel_tv.c      |    9 ++--
>  7 files changed, 71 insertions(+), 25 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
> index cf41c67..822b21c 100644
> --- a/drivers/gpu/drm/i915/i915_reg.h
> +++ b/drivers/gpu/drm/i915/i915_reg.h
> @@ -2080,6 +2080,7 @@
>  #define PIPE_DITHER_TYPE_ST01		(1 << 2)
>  /* Pipe A */
>  #define PIPEADSL		0x70000
> +#define   DSL_LINEMASK	       	0x00000fff
>  #define PIPEACONF		0x70008
>  #define   PIPEACONF_ENABLE	(1<<31)
>  #define   PIPEACONF_DISABLE	0
> diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c
> index ee0732b..4a2f593 100644
> --- a/drivers/gpu/drm/i915/intel_crt.c
> +++ b/drivers/gpu/drm/i915/intel_crt.c
> @@ -331,7 +331,7 @@ intel_crt_load_detect(struct drm_crtc *crtc, struct intel_encoder *intel_encoder
>  		I915_WRITE(pipeconf_reg, pipeconf | PIPECONF_FORCE_BORDER);
>  		/* Wait for next Vblank to substitue
>  		 * border color for Color info */
> -		intel_wait_for_vblank(dev);
> +		intel_wait_for_vblank(dev, pipe);
>  		st00 = I915_READ8(VGA_MSR_WRITE);
>  		status = ((st00 & (1 << 4)) != 0) ?
>  			connector_status_connected :
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 928bcc2..27e60b8 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -972,11 +972,57 @@ intel_find_pll_g4x_dp(const intel_limit_t *limit, struct drm_crtc *crtc,
>      return true;
>  }
>  
> -void
> -intel_wait_for_vblank(struct drm_device *dev)
> +/**
> + * intel_wait_for_vblank - wait for vblank on a given pipe
> + * @dev: drm device
> + * @pipe: pipe to wait for
> + *
> + * Wait for vblank to occur on a given pipe.  Needed for various bits of
> + * mode setting code.
> + */
> +void intel_wait_for_vblank(struct drm_device *dev, int pipe)
> +{
> +	struct drm_i915_private *dev_priv = dev->dev_private;
> +	int pipestat_reg = (pipe == 0 ? PIPEASTAT : PIPEBSTAT);
> +	unsigned long timeout = jiffies + msecs_to_jiffies(100);
> +
> +	/* Wait for vblank interrupt bit to set */
> +	while (!(I915_READ(pipestat_reg) & PIPE_VBLANK_INTERRUPT_STATUS) &&
> +	       time_after(timeout, jiffies))
> +		mdelay(1);

Why not actually go to sleep and let the interrupt wake you up? let the
machine do something else in the meantime.

-0-
-- 
You cannot kill time without injuring eternity.

  reply	other threads:[~2010-08-18 20:49 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-18 19:00 More eDP mode setting fixes Jesse Barnes
2010-08-18 19:00 ` [PATCH 1/7] drm/i915: add panel reset workaround Jesse Barnes
2010-08-18 19:00 ` [PATCH 2/7] drm/i915: eDP mode set sequence corrections Jesse Barnes
2010-08-18 19:00 ` [PATCH 3/7] drm/i915: fix VGA plane disable for Ironlake+ Jesse Barnes
2010-08-18 19:00 ` [PATCH 4/7] drm/i915: make sure eDP PLL is enabled at the right time Jesse Barnes
2010-08-18 19:00 ` [PATCH 5/7] drm/i915: add MMIO debug output Jesse Barnes
2010-08-18 19:00 ` [PATCH 6/7] drm/i915: use vga get/put where needed around VGA plane disable Jesse Barnes
2010-08-18 19:00 ` [PATCH 7/7] drm/i915: wait for actual vblank, not just 20ms Jesse Barnes
2010-08-18 20:48   ` Owain Ainsworth [this message]
2010-08-18 21:05     ` Jesse Barnes
2010-08-18 21:12       ` Andrew Lutomirski
2010-08-18 19:55 ` More eDP mode setting fixes Adam Jackson
2010-08-18 20:24 ` Jesse Barnes
2010-08-22  6:24 ` Eric Anholt

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=20100818204850.GD4929@melanie.nicotinebsd.org \
    --to=zerooa@googlemail.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jbarnes@virtuousgeek.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.