Re: [PATCH 1/2] drm/i915: Don't dereference fb when disabling primary plane

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Aug 27, 2014 at 04:51:21PM +0300, ville.syrjala@xxxxxxxxxxxxxxx wrote:
> From: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>
> 
> During driver init we may not have a valid framebuffer for the primary
> plane even though the plane is enabled due to failed BIOS fb takeover.
> This means we have to avoid dereferencing the fb in
> .update_primary_plane() when disabling the plane.

Ok, that's a bit non-obvious from the code.

Perhaps, something like

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index fac2f6859cd2..a575454b6f45 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -2388,15 +2388,13 @@ static void i9xx_update_primary_plane(struct drm_crtc *crtc,
        struct drm_device *dev = crtc->dev;
        struct drm_i915_private *dev_priv = dev->dev_private;
        struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
-       struct drm_i915_gem_object *obj = intel_fb_obj(fb);
+       struct drm_i915_gem_object *obj;
        int plane = intel_crtc->plane;
        unsigned long linear_offset;
        u32 dspcntr;
        u32 reg = DSPCNTR(plane);
        int pixel_size;
 
-       pixel_size = drm_format_plane_cpp(fb->pixel_format, 0);
-
        if (!intel_crtc->primary_enabled) {
                I915_WRITE(reg, 0);
                if (INTEL_INFO(dev)->gen >= 4)
@@ -2407,8 +2405,13 @@ static void i9xx_update_primary_plane(struct drm_crtc *crtc,
                return;
        }
 
-       dspcntr = DISPPLANE_GAMMA_ENABLE;
+       obj = intel_fb_obj(fb);
+       if (WARN_ON(obj == NULL))
+               return;
+
+       pixel_size = drm_format_plane_cpp(fb->pixel_format, 0);
 
+       dspcntr = DISPPLANE_GAMMA_ENABLE;
        dspcntr |= DISPLAY_PLANE_ENABLE;
 
        if (INTEL_INFO(dev)->gen < 4) {

would help.
-Chris

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





[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux