From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mailout2.hostsharing.net ([83.223.90.233]:52176 "EHLO mailout2.hostsharing.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752436AbbJYO7S (ORCPT ); Sun, 25 Oct 2015 10:59:18 -0400 Date: Sun, 25 Oct 2015 15:53:49 +0100 From: Lukas Wunner To: Wayne Boyer Cc: intel-gfx@lists.freedesktop.org, Daniel Vetter , stable@vger.kernel.org, "Goel, Akash" , Chris Wilson Subject: Re: [Intel-gfx] [PATCH] drm/i915: Pin the ifbdev for the info->system_base GGTT mmapping Message-ID: <20151025145349.GA19581@wunner.de> References: <20151008090737.GJ27939@nuc-i3427.alporthouse.com> <1444337421-20784-1-git-send-email-wayne.boyer@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1444337421-20784-1-git-send-email-wayne.boyer@intel.com> Sender: stable-owner@vger.kernel.org List-ID: Another observation that occurred to me only after sending away my previous message (sorry): On Thu, Oct 08, 2015 at 01:50:21PM -0700, Wayne Boyer wrote: > From: Chris Wilson > > A long time ago (before 3.14) we relied on a permanent pinning of the > ifbdev to lock the fb in place inside the GGTT. However, the > introduction of stealing the BIOS framebuffer and reusing its address in > the GGTT for the fbdev has muddied waters and we use an inherited fb. > However, the inherited fb is only pinned whilst it is active and we no > longer have an explicit pin for the info->system_base mmapping used by > the fbdev. The result is that after some aperture pressure the fbdev may > be evicted, but we continue to write the fbcon into the same GGTT > address - overwriting anything else that may be put into that offset. > The effect is most pronounced across suspend/resume as > intel_fbdev_set_suspend() does a full clear over the whole scanout. Since this only concerns the case when the fb was inherited from BIOS, why don't you invoke i915_gem_obj_ggtt_pin() only in this particular case? It's discernible from the prealloc variable. I think then you also don't need to call i915_gem_object_ggtt_unpin() twice. > > v2: rebased on latest nightly (Wayne) > v3: changed i915_gem_object_ggtt_pin() to i915_gem_obj_ggtt_pin() based > on Chris' review. (Wayne) > > Signed-off-by: Chris Wilson > Cc: "Goel, Akash" > Cc: Daniel Vetter > Cc: Jesse Barnes > Cc: stable@vger.kernel.org > Reviewed-by: Deepak S > Signed-off-by: Wayne Boyer > --- > drivers/gpu/drm/i915/intel_fbdev.c | 15 +++++++++++++++ > 1 file changed, 15 insertions(+) > > diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c > index 6532912..0ad46521 100644 > --- a/drivers/gpu/drm/i915/intel_fbdev.c > +++ b/drivers/gpu/drm/i915/intel_fbdev.c > @@ -215,6 +215,16 @@ static int intelfb_create(struct drm_fb_helper *helper, > obj = intel_fb->obj; > size = obj->base.size; > > + /* The fb constructor will have already pinned us (or inherited a > + * GGTT region from the BIOS) suitable for a scanout, so > + * this should just be a no-op and increment the pin count for the > + * fbdev mmapping. It does have a useful side-effect of validating > + * the pin for fbdev's use via a GGTT mmapping. > + */ > + ret = i915_gem_obj_ggtt_pin(obj, 0, PIN_MAPPABLE); > + if (ret) > + goto out_unlock; > + > info = drm_fb_helper_alloc_fbi(helper); > if (IS_ERR(info)) { > ret = PTR_ERR(info); > @@ -274,6 +284,9 @@ static int intelfb_create(struct drm_fb_helper *helper, > out_destroy_fbi: > drm_fb_helper_release_fbi(helper); > out_unpin: > + /* Once for info->screen_base mmaping... */ > + i915_gem_object_ggtt_unpin(obj); > + /* ...and once for the intel_fb */ > i915_gem_object_ggtt_unpin(obj); > drm_gem_object_unreference(&obj->base); > out_unlock: > @@ -514,6 +527,8 @@ static const struct drm_fb_helper_funcs intel_fb_helper_funcs = { > static void intel_fbdev_destroy(struct drm_device *dev, > struct intel_fbdev *ifbdev) > { > + /* Release the pinning for the info->screen_base mmaping. */ > + i915_gem_object_ggtt_unpin(ifbdev->fb->obj); > > drm_fb_helper_unregister_fbi(&ifbdev->helper); > drm_fb_helper_release_fbi(&ifbdev->helper); > -- > 1.9.1 > > _______________________________________________ > Intel-gfx mailing list > Intel-gfx@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/intel-gfx