public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915: Don't try to look up object for non-existent fb
@ 2014-06-25  0:05 Matt Roper
  2014-06-25  8:28 ` Chris Wilson
  0 siblings, 1 reply; 3+ messages in thread
From: Matt Roper @ 2014-06-25  0:05 UTC (permalink / raw)
  To: intel-gfx; +Cc: Daniel Vetter

crtc->primary->fb may be NULL upon entry to intel_pipe_set_base() if the
primary plane has previously been disabled via the universal plane
interface.  We need to check for NULL before trying to reference
old_fb's obj.

This fixes a regression introduced in

        commit a071fa00647bc9a3c53f917b236fff9aea175e3a
        Author: Daniel Vetter <daniel.vetter@ffwll.ch>
        Date:   Wed Jun 18 23:28:09 2014 +0200

        drm/i915: Introduce accurate frontbuffer tracking

Testcase: igt/kms_universal_plane
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
---
 drivers/gpu/drm/i915/intel_display.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index fa77557..539ac3b 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -2690,6 +2690,7 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y,
 	enum pipe pipe = intel_crtc->pipe;
 	struct drm_framebuffer *old_fb;
 	struct drm_i915_gem_object *obj = to_intel_framebuffer(fb)->obj;
+	struct drm_i915_gem_object *old_obj;
 	int ret;
 
 	if (intel_crtc_has_pending_flip(crtc)) {
@@ -2711,11 +2712,12 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y,
 	}
 
 	old_fb = crtc->primary->fb;
+	old_obj = old_fb ? to_intel_framebuffer(old_fb)->obj : NULL;
 
 	mutex_lock(&dev->struct_mutex);
 	ret = intel_pin_and_fence_fb_obj(dev, obj, NULL);
 	if (ret == 0)
-		i915_gem_track_fb(to_intel_framebuffer(old_fb)->obj, obj,
+		i915_gem_track_fb(old_obj, obj,
 				  INTEL_FRONTBUFFER_PRIMARY(pipe));
 	mutex_unlock(&dev->struct_mutex);
 	if (ret != 0) {
-- 
1.8.5.1

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

* Re: [PATCH] drm/i915: Don't try to look up object for non-existent fb
  2014-06-25  0:05 [PATCH] drm/i915: Don't try to look up object for non-existent fb Matt Roper
@ 2014-06-25  8:28 ` Chris Wilson
  2014-06-25 10:12   ` Jani Nikula
  0 siblings, 1 reply; 3+ messages in thread
From: Chris Wilson @ 2014-06-25  8:28 UTC (permalink / raw)
  To: Matt Roper; +Cc: Daniel Vetter, intel-gfx

On Tue, Jun 24, 2014 at 05:05:02PM -0700, Matt Roper wrote:
> crtc->primary->fb may be NULL upon entry to intel_pipe_set_base() if the
> primary plane has previously been disabled via the universal plane
> interface.  We need to check for NULL before trying to reference
> old_fb's obj.
> 
> This fixes a regression introduced in
> 
>         commit a071fa00647bc9a3c53f917b236fff9aea175e3a
>         Author: Daniel Vetter <daniel.vetter@ffwll.ch>
>         Date:   Wed Jun 18 23:28:09 2014 +0200
> 
>         drm/i915: Introduce accurate frontbuffer tracking
> 
> Testcase: igt/kms_universal_plane
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Signed-off-by: Matt Roper <matthew.d.roper@intel.com>

Oh for a safe version of to_fb_obj().
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre

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

* Re: [PATCH] drm/i915: Don't try to look up object for non-existent fb
  2014-06-25  8:28 ` Chris Wilson
@ 2014-06-25 10:12   ` Jani Nikula
  0 siblings, 0 replies; 3+ messages in thread
From: Jani Nikula @ 2014-06-25 10:12 UTC (permalink / raw)
  To: Chris Wilson, Matt Roper; +Cc: Daniel Vetter, intel-gfx

On Wed, 25 Jun 2014, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> On Tue, Jun 24, 2014 at 05:05:02PM -0700, Matt Roper wrote:
>> crtc->primary->fb may be NULL upon entry to intel_pipe_set_base() if the
>> primary plane has previously been disabled via the universal plane
>> interface.  We need to check for NULL before trying to reference
>> old_fb's obj.
>> 
>> This fixes a regression introduced in
>> 
>>         commit a071fa00647bc9a3c53f917b236fff9aea175e3a
>>         Author: Daniel Vetter <daniel.vetter@ffwll.ch>
>>         Date:   Wed Jun 18 23:28:09 2014 +0200
>> 
>>         drm/i915: Introduce accurate frontbuffer tracking
>> 
>> Testcase: igt/kms_universal_plane
>> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
>> Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
>
> Oh for a safe version of to_fb_obj().
> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>

Pushed to dinq, thanks for the patch and review.

BR,
Jani.


> -Chris
>
> -- 
> Chris Wilson, Intel Open Source Technology Centre
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Jani Nikula, Intel Open Source Technology Center

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

end of thread, other threads:[~2014-06-25 10:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-25  0:05 [PATCH] drm/i915: Don't try to look up object for non-existent fb Matt Roper
2014-06-25  8:28 ` Chris Wilson
2014-06-25 10:12   ` Jani Nikula

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