linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Xi Ruoyao <xry111@outlook.com>
To: daniel.vetter@intel.com, jani.nikula@linux.intel.com, airlied@linux.ie
Cc: intel-gfx@lists.freedesktop.org, dri-level@lists.freedesktop.org,
	linux-kernel@vger.kernel.org, Xi Ruoyao <xry111@outlook.com>
Subject: [PATCH v2] drm/i915: Fix BUG in i915_gem.c when switch to console
Date: Thu, 12 Mar 2015 14:50:43 +0800	[thread overview]
Message-ID: <BLU437-SMTP1243ACEB42883EC0AD0869E060@phx.gbl> (raw)

In intel_crtc_page_flip, intel_display.c, the code changed the framebuffer
assigned to plane crtc->primary by

crtc->primary->fb = fb;

However, it forgot to change crtc->primary->state->fb. However, when we
switch to console, some kernel code will read crtc->primary->state->fb
to get the framebuffer assigned to crtc->primaty. Then a framebuffer
object can be unpinned twice and a kernel BUG will be produced in i915_gem.c.

So, update crtc->primary->state->fb in intel_display.c using
drm_atomic_set_fb_for_plane to fix the BUG.

Signed-off-by: Xi Ruoyao <xry111@outlook.com>
Fixed: Bug 93711 <https://bugzilla.kernel.org/show_bug.cgi?id=93711>
---
 Sorry, the previous patch is mangled by email client, so I am re-sending it.

 drivers/gpu/drm/i915/intel_display.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index e730789..97083fd 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -37,6 +37,7 @@
 #include <drm/i915_drm.h>
 #include "i915_drv.h"
 #include "i915_trace.h"
+#include <drm/drm_atomic.h>
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_dp_helper.h>
 #include <drm/drm_crtc_helper.h>
@@ -9816,6 +9817,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
 	drm_gem_object_reference(&obj->base);
 
 	crtc->primary->fb = fb;
+	drm_atomic_set_fb_for_plane(crtc->primary->state, fb);
 
 	work->pending_flip_obj = obj;
 
-- 
1.9.1


             reply	other threads:[~2015-03-12  6:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-12  6:50 Xi Ruoyao [this message]
2015-03-12  8:28 ` [PATCH v2] drm/i915: Fix BUG in i915_gem.c when switch to console Jani Nikula
2015-03-12 11:24   ` Xi Ruoyao
2015-03-12 16:00   ` Matt Roper

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=BLU437-SMTP1243ACEB42883EC0AD0869E060@phx.gbl \
    --to=xry111@outlook.com \
    --cc=airlied@linux.ie \
    --cc=daniel.vetter@intel.com \
    --cc=dri-level@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).