All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] drm/i915: add sanity checks for hsync and htotal
@ 2012-06-20 20:15 Jani Nikula
  2012-06-20 20:15 ` [PATCH 2/2] drm/i915: Cantiga+ cannot handle a hsync front porch of 0 Jani Nikula
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Jani Nikula @ 2012-06-20 20:15 UTC (permalink / raw)
  To: intel-gfx; +Cc: jani.nikula

Restrict hsync start, end, hdisplay and htotal to be according to hw
spec. Through drm_mode_set_crtcinfo(), these will also limit hblank start,
end.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>

---

Let's see if this will be frowned upon... seems better to have these
separate from the follow-up workaround patch, which addresses a specific hw
constraint.

Embarrassingly, I have to acknowledge I didn't test this. I seem to have
trouble with creating an initrd that would tackle the disk encryption that
I have on this laptop I'm currently restricted to. *sigh*.
---
 drivers/gpu/drm/i915/intel_display.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 9730162..ada736d 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -3420,6 +3420,11 @@ static bool intel_crtc_mode_fixup(struct drm_crtc *crtc,
 	if (!(adjusted_mode->private_flags & INTEL_MODE_CRTC_TIMINGS_SET))
 		drm_mode_set_crtcinfo(adjusted_mode, 0);
 
+	if (adjusted_mode->hsync_start < adjusted_mode->hdisplay ||
+		adjusted_mode->hsync_end > adjusted_mode->htotal ||
+		adjusted_mode->hsync_start >= adjusted_mode->hsync_end)
+		return false;
+
 	return true;
 }
 
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/2] drm/i915: Cantiga+ cannot handle a hsync front porch of 0
  2012-06-20 20:15 [PATCH 1/2] drm/i915: add sanity checks for hsync and htotal Jani Nikula
@ 2012-06-20 20:15 ` Jani Nikula
  2012-06-20 21:36 ` [PATCH 1/2] drm/i915: add sanity checks for hsync and htotal Adam Jackson
  2012-06-21 10:19 ` [PATCH v2] drm/i915: Cantiga+ cannot handle a hsync front porch of 0 Jani Nikula
  2 siblings, 0 replies; 7+ messages in thread
From: Jani Nikula @ 2012-06-20 20:15 UTC (permalink / raw)
  To: intel-gfx; +Cc: jani.nikula

From: Chris Wilson <chris@chris-wilson.co.uk>

This addresses WaPruneModeWithIncorrectHsyncOffset.

Bugzilla: http://bugs.freedesktop.org/show_bug.cgi?id=50236
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/i915/intel_display.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index ada736d..526bd8b 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -3425,6 +3425,13 @@ static bool intel_crtc_mode_fixup(struct drm_crtc *crtc,
 		adjusted_mode->hsync_start >= adjusted_mode->hsync_end)
 		return false;
 
+	/* WaPruneModeWithIncorrectHsyncOffset: Cantiga+ cannot handle modes
+	 * with a hsync front porch of 0.
+	 */
+	if ((INTEL_INFO(dev)->gen > 4 || IS_G4X(dev)) &&
+		adjusted_mode->hsync_start == adjusted_mode->hdisplay)
+		return false;
+
 	return true;
 }
 
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] drm/i915: add sanity checks for hsync and htotal
  2012-06-20 20:15 [PATCH 1/2] drm/i915: add sanity checks for hsync and htotal Jani Nikula
  2012-06-20 20:15 ` [PATCH 2/2] drm/i915: Cantiga+ cannot handle a hsync front porch of 0 Jani Nikula
@ 2012-06-20 21:36 ` Adam Jackson
  2012-06-21  7:33   ` Jani Nikula
  2012-06-21 10:19 ` [PATCH v2] drm/i915: Cantiga+ cannot handle a hsync front porch of 0 Jani Nikula
  2 siblings, 1 reply; 7+ messages in thread
From: Adam Jackson @ 2012-06-20 21:36 UTC (permalink / raw)
  To: Jani Nikula; +Cc: intel-gfx


[-- Attachment #1.1: Type: text/plain, Size: 489 bytes --]

On Wed, 2012-06-20 at 23:15 +0300, Jani Nikula wrote:
> Restrict hsync start, end, hdisplay and htotal to be according to hw
> spec. Through drm_mode_set_crtcinfo(), these will also limit hblank start,
> end.

I'm pretty sure any physical hardware would balk at modes like this.
Virtual framebuffers probably wouldn't care, I guess.  Still, seems
wrong to have this in i915 when it should be common.

Is this a problem we've seen in the wild, or is this just paranoia?

- ajax

[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] drm/i915: add sanity checks for hsync and htotal
  2012-06-20 21:36 ` [PATCH 1/2] drm/i915: add sanity checks for hsync and htotal Adam Jackson
@ 2012-06-21  7:33   ` Jani Nikula
  0 siblings, 0 replies; 7+ messages in thread
From: Jani Nikula @ 2012-06-21  7:33 UTC (permalink / raw)
  To: Adam Jackson; +Cc: intel-gfx

On Thu, 21 Jun 2012, Adam Jackson <ajax@redhat.com> wrote:
> On Wed, 2012-06-20 at 23:15 +0300, Jani Nikula wrote:
>> Restrict hsync start, end, hdisplay and htotal to be according to hw
>> spec. Through drm_mode_set_crtcinfo(), these will also limit hblank start,
>> end.
>
> I'm pretty sure any physical hardware would balk at modes like this.
> Virtual framebuffers probably wouldn't care, I guess.  Still, seems
> wrong to have this in i915 when it should be common.
>
> Is this a problem we've seen in the wild, or is this just paranoia?

Looking at patch 2/2 I thought this would be a sensible thing to
do. That patch adds a check for a condition people might expect to work,
but doesn't, on Cantiga and later. It seemed a bit odd to merely add a
check for hsync_start == hdisplay while hsync_start < hdisplay (and the
other related conditions) would fail too.

BR,
Jani.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v2] drm/i915: Cantiga+ cannot handle a hsync front porch of 0
  2012-06-20 20:15 [PATCH 1/2] drm/i915: add sanity checks for hsync and htotal Jani Nikula
  2012-06-20 20:15 ` [PATCH 2/2] drm/i915: Cantiga+ cannot handle a hsync front porch of 0 Jani Nikula
  2012-06-20 21:36 ` [PATCH 1/2] drm/i915: add sanity checks for hsync and htotal Adam Jackson
@ 2012-06-21 10:19 ` Jani Nikula
  2012-06-21 12:16   ` Ville Syrjälä
  2012-08-22 15:39   ` Daniel Vetter
  2 siblings, 2 replies; 7+ messages in thread
From: Jani Nikula @ 2012-06-21 10:19 UTC (permalink / raw)
  To: intel-gfx; +Cc: jani.nikula

From: Chris Wilson <chris@chris-wilson.co.uk>

This addresses WaPruneModeWithIncorrectHsyncOffset.

Bugzilla: http://bugs.freedesktop.org/show_bug.cgi?id=50236
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>

---

v2: drop patch 1/2, to be addressed later.
---
 drivers/gpu/drm/i915/intel_display.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 9730162..76516b9 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -3420,6 +3420,13 @@ static bool intel_crtc_mode_fixup(struct drm_crtc *crtc,
 	if (!(adjusted_mode->private_flags & INTEL_MODE_CRTC_TIMINGS_SET))
 		drm_mode_set_crtcinfo(adjusted_mode, 0);
 
+	/* WaPruneModeWithIncorrectHsyncOffset: Cantiga+ cannot handle modes
+	 * with a hsync front porch of 0.
+	 */
+	if ((INTEL_INFO(dev)->gen > 4 || IS_G4X(dev)) &&
+		adjusted_mode->hsync_start == adjusted_mode->hdisplay)
+		return false;
+
 	return true;
 }
 
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] drm/i915: Cantiga+ cannot handle a hsync front porch of 0
  2012-06-21 10:19 ` [PATCH v2] drm/i915: Cantiga+ cannot handle a hsync front porch of 0 Jani Nikula
@ 2012-06-21 12:16   ` Ville Syrjälä
  2012-08-22 15:39   ` Daniel Vetter
  1 sibling, 0 replies; 7+ messages in thread
From: Ville Syrjälä @ 2012-06-21 12:16 UTC (permalink / raw)
  To: Jani Nikula; +Cc: intel-gfx

On Thu, Jun 21, 2012 at 01:19:59PM +0300, Jani Nikula wrote:
> From: Chris Wilson <chris@chris-wilson.co.uk>
> 
> This addresses WaPruneModeWithIncorrectHsyncOffset.
> 
> Bugzilla: http://bugs.freedesktop.org/show_bug.cgi?id=50236
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> 
> ---
> 
> v2: drop patch 1/2, to be addressed later.
> ---
>  drivers/gpu/drm/i915/intel_display.c |    7 +++++++
>  1 files changed, 7 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 9730162..76516b9 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -3420,6 +3420,13 @@ static bool intel_crtc_mode_fixup(struct drm_crtc *crtc,
>  	if (!(adjusted_mode->private_flags & INTEL_MODE_CRTC_TIMINGS_SET))
>  		drm_mode_set_crtcinfo(adjusted_mode, 0);
>  
> +	/* WaPruneModeWithIncorrectHsyncOffset: Cantiga+ cannot handle modes
> +	 * with a hsync front porch of 0.
> +	 */
> +	if ((INTEL_INFO(dev)->gen > 4 || IS_G4X(dev)) &&
> +		adjusted_mode->hsync_start == adjusted_mode->hdisplay)
> +		return false;

Rejecting the mode seems quite drastic for something as small as this.
How about we just push hsync_start forward a little bit?

-- 
Ville Syrjälä
Intel OTC

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] drm/i915: Cantiga+ cannot handle a hsync front porch of 0
  2012-06-21 10:19 ` [PATCH v2] drm/i915: Cantiga+ cannot handle a hsync front porch of 0 Jani Nikula
  2012-06-21 12:16   ` Ville Syrjälä
@ 2012-08-22 15:39   ` Daniel Vetter
  1 sibling, 0 replies; 7+ messages in thread
From: Daniel Vetter @ 2012-08-22 15:39 UTC (permalink / raw)
  To: Jani Nikula; +Cc: intel-gfx

On Thu, Jun 21, 2012 at 01:19:59PM +0300, Jani Nikula wrote:
> From: Chris Wilson <chris@chris-wilson.co.uk>
> 
> This addresses WaPruneModeWithIncorrectHsyncOffset.
> 
> Bugzilla: http://bugs.freedesktop.org/show_bug.cgi?id=50236
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Queued for -next (just to close another annoying bugzilla entry), thanks
for the patch.
-Daniel
> 
> ---
> 
> v2: drop patch 1/2, to be addressed later.
> ---
>  drivers/gpu/drm/i915/intel_display.c |    7 +++++++
>  1 files changed, 7 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 9730162..76516b9 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -3420,6 +3420,13 @@ static bool intel_crtc_mode_fixup(struct drm_crtc *crtc,
>  	if (!(adjusted_mode->private_flags & INTEL_MODE_CRTC_TIMINGS_SET))
>  		drm_mode_set_crtcinfo(adjusted_mode, 0);
>  
> +	/* WaPruneModeWithIncorrectHsyncOffset: Cantiga+ cannot handle modes
> +	 * with a hsync front porch of 0.
> +	 */
> +	if ((INTEL_INFO(dev)->gen > 4 || IS_G4X(dev)) &&
> +		adjusted_mode->hsync_start == adjusted_mode->hdisplay)
> +		return false;
> +
>  	return true;
>  }
>  
> -- 
> 1.7.4.1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Mail: daniel@ffwll.ch
Mobile: +41 (0)79 365 57 48

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-08-22 15:39 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-20 20:15 [PATCH 1/2] drm/i915: add sanity checks for hsync and htotal Jani Nikula
2012-06-20 20:15 ` [PATCH 2/2] drm/i915: Cantiga+ cannot handle a hsync front porch of 0 Jani Nikula
2012-06-20 21:36 ` [PATCH 1/2] drm/i915: add sanity checks for hsync and htotal Adam Jackson
2012-06-21  7:33   ` Jani Nikula
2012-06-21 10:19 ` [PATCH v2] drm/i915: Cantiga+ cannot handle a hsync front porch of 0 Jani Nikula
2012-06-21 12:16   ` Ville Syrjälä
2012-08-22 15:39   ` Daniel Vetter

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.