public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH 1/2] drm/i915: Clear unused fields of mode for framebuffer creation
@ 2012-11-05 22:25 Chris Wilson
  2012-11-05 22:25 ` [PATCH 2/2] drm/i915: Update load-detect failure paths for modeset-rework Chris Wilson
  2012-11-06 11:27 ` [PATCH 1/2] drm/i915: Clear unused fields of mode for framebuffer creation Ville Syrjälä
  0 siblings, 2 replies; 4+ messages in thread
From: Chris Wilson @ 2012-11-05 22:25 UTC (permalink / raw)
  To: intel-gfx

With the stricter checks introduced in
commit ac911edae5960d7dccd9883f5fa5d25b591520de
Author: Ville Syrjälä <ville.syrjala@linux.intel.com>
Date:   Wed Oct 31 17:50:19 2012 +0200

    drm/i915: Check the framebuffer offset

(and friends), it became especially prudent to make sure that the
additional fields inside the mode were cleared before attempting to
create a framebuffer. In particular, the fb created for load detection
failed to do so and hence failed.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_display.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 9b2fbf9..5345f0e 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -6607,7 +6607,7 @@ intel_framebuffer_create_for_mode(struct drm_device *dev,
 				  int depth, int bpp)
 {
 	struct drm_i915_gem_object *obj;
-	struct drm_mode_fb_cmd2 mode_cmd;
+	struct drm_mode_fb_cmd2 mode_cmd = { 0 };
 
 	obj = i915_gem_alloc_object(dev,
 				    intel_framebuffer_size_for_mode(mode, bpp));
-- 
1.7.10.4

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

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

* [PATCH 2/2] drm/i915: Update load-detect failure paths for modeset-rework
  2012-11-05 22:25 [PATCH 1/2] drm/i915: Clear unused fields of mode for framebuffer creation Chris Wilson
@ 2012-11-05 22:25 ` Chris Wilson
  2012-11-10 13:46   ` Daniel Vetter
  2012-11-06 11:27 ` [PATCH 1/2] drm/i915: Clear unused fields of mode for framebuffer creation Ville Syrjälä
  1 sibling, 1 reply; 4+ messages in thread
From: Chris Wilson @ 2012-11-05 22:25 UTC (permalink / raw)
  To: intel-gfx; +Cc: Daniel Vetter

After the rework, intel_set_mode() became a little better behaved in
restoring the current mode if we failed to apply the requested modeline.
However, the failure path for load-detect would clobber the existing
state, leading to an oops during BIOS takeover on older machines.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/i915/intel_display.c |    9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 5345f0e..622ada8 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -6737,24 +6737,19 @@ bool intel_get_load_detect_pipe(struct drm_connector *connector,
 		DRM_DEBUG_KMS("reusing fbdev for load-detection framebuffer\n");
 	if (IS_ERR(fb)) {
 		DRM_DEBUG_KMS("failed to allocate framebuffer for load-detection\n");
-		goto fail;
+		return false;
 	}
 
 	if (!intel_set_mode(crtc, mode, 0, 0, fb)) {
 		DRM_DEBUG_KMS("failed to set mode on load-detect pipe\n");
 		if (old->release_fb)
 			old->release_fb->funcs->destroy(old->release_fb);
-		goto fail;
+		return false;
 	}
 
 	/* let the connector get through one full cycle before testing */
 	intel_wait_for_vblank(dev, intel_crtc->pipe);
-
 	return true;
-fail:
-	connector->encoder = NULL;
-	encoder->crtc = NULL;
-	return false;
 }
 
 void intel_release_load_detect_pipe(struct drm_connector *connector,
-- 
1.7.10.4

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

* Re: [PATCH 1/2] drm/i915: Clear unused fields of mode for framebuffer creation
  2012-11-05 22:25 [PATCH 1/2] drm/i915: Clear unused fields of mode for framebuffer creation Chris Wilson
  2012-11-05 22:25 ` [PATCH 2/2] drm/i915: Update load-detect failure paths for modeset-rework Chris Wilson
@ 2012-11-06 11:27 ` Ville Syrjälä
  1 sibling, 0 replies; 4+ messages in thread
From: Ville Syrjälä @ 2012-11-06 11:27 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

On Mon, Nov 05, 2012 at 10:25:07PM +0000, Chris Wilson wrote:
> With the stricter checks introduced in
> commit ac911edae5960d7dccd9883f5fa5d25b591520de
> Author: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Date:   Wed Oct 31 17:50:19 2012 +0200
> 
>     drm/i915: Check the framebuffer offset
> 
> (and friends), it became especially prudent to make sure that the
> additional fields inside the mode were cleared before attempting to
> create a framebuffer. In particular, the fb created for load detection
> failed to do so and hence failed.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>

I fixed one of these earlier, but apparently I missed this one.

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

> ---
>  drivers/gpu/drm/i915/intel_display.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 9b2fbf9..5345f0e 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -6607,7 +6607,7 @@ intel_framebuffer_create_for_mode(struct drm_device *dev,
>  				  int depth, int bpp)
>  {
>  	struct drm_i915_gem_object *obj;
> -	struct drm_mode_fb_cmd2 mode_cmd;
> +	struct drm_mode_fb_cmd2 mode_cmd = { 0 };
>  
>  	obj = i915_gem_alloc_object(dev,
>  				    intel_framebuffer_size_for_mode(mode, bpp));
> -- 
> 1.7.10.4

-- 
Ville Syrjälä
Intel OTC

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

* Re: [PATCH 2/2] drm/i915: Update load-detect failure paths for modeset-rework
  2012-11-05 22:25 ` [PATCH 2/2] drm/i915: Update load-detect failure paths for modeset-rework Chris Wilson
@ 2012-11-10 13:46   ` Daniel Vetter
  0 siblings, 0 replies; 4+ messages in thread
From: Daniel Vetter @ 2012-11-10 13:46 UTC (permalink / raw)
  To: Chris Wilson; +Cc: Daniel Vetter, intel-gfx

On Mon, Nov 05, 2012 at 10:25:08PM +0000, Chris Wilson wrote:
> After the rework, intel_set_mode() became a little better behaved in
> restoring the current mode if we failed to apply the requested modeline.
> However, the failure path for load-detect would clobber the existing
> state, leading to an oops during BIOS takeover on older machines.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>

Both patches applied to dinq.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

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

end of thread, other threads:[~2012-11-10 13:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-05 22:25 [PATCH 1/2] drm/i915: Clear unused fields of mode for framebuffer creation Chris Wilson
2012-11-05 22:25 ` [PATCH 2/2] drm/i915: Update load-detect failure paths for modeset-rework Chris Wilson
2012-11-10 13:46   ` Daniel Vetter
2012-11-06 11:27 ` [PATCH 1/2] drm/i915: Clear unused fields of mode for framebuffer creation Ville Syrjälä

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox