Re: [Intel-gfx] [PATCH] drm/i915: Pin the ifbdev for the info->system_base GGTT mmapping
On Fri, Oct 23, 2015 at 10:17:44PM +0100, Dave Gordon wrote: > On 08/10/15 21:50, 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. > > > >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: sta...@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(>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(>helper); > > drm_fb_helper_release_fbi(>helper); > > Hmm .. pinning now done by i915_gem_obj_ggtt_pin(), but the unpinning > function is i915_gem_object_ggtt_unpin(). Just the sort of asymmetry that > helps everyone understand what's going on :( > > Could we not have a mass rename of the various i915_gem_obj{ect} functions > to ONE consistent naming convention? (Personally I prefer 'obj' because it's > shorter, but consistency is more important than saving just 3 letters). Of course, just needs someone to do it, and make sure to not step onto too many toes. I'd love if more people actually take charge of gem instead of piling more on top. -Daniel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH] drm/i915: Pin the ifbdev for the info->system_base GGTT mmapping
On Fri, Oct 30, 2015 at 05:18:15PM +0100, Daniel Vetter wrote: > On Fri, Oct 23, 2015 at 10:17:44PM +0100, Dave Gordon wrote: > > On 08/10/15 21:50, 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. > > > > > >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: sta...@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(>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(>helper); > > > drm_fb_helper_release_fbi(>helper); > > > > Hmm .. pinning now done by i915_gem_obj_ggtt_pin(), but the unpinning > > function is i915_gem_object_ggtt_unpin(). Just the sort of asymmetry that > > helps everyone understand what's going on :( > > > > Could we not have a mass rename of the various i915_gem_obj{ect} functions > > to ONE consistent naming convention? (Personally I prefer 'obj' because it's > > shorter, but consistency is more important than saving just 3 letters). > > Of course, just needs someone to do it, and make sure to not step onto too > many toes. I'd love if more people actually take charge of gem instead of > piling more on top. I have patches to remove as much of the nonsense as I could. I have sent some of them before, but no one looked at them it seems. Now they are about 150 patches from the top of the queue. -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
Re: [Intel-gfx] [PATCH] drm/i915: Pin the ifbdev for the info->system_base GGTT mmapping
Hi, 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. > > 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: sta...@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; I think a DRM_ERROR() should be added here, otherwise if this check fails, the user will never be notified thereof. It's not sufficient to just return a negative int because this just gets passed up the call stack to intel_fbdev_initial_config() which ignores it. I'm adding DRM_ERROR() invocations to the two existing error conditions in this function with patch 4 of the series I just posted to intel-gfx: Link: http://lists.freedesktop.org/archives/intel-gfx/2015-October/078837.html Message-Id: Best regards, Lukas > + > 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(>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(>helper); > drm_fb_helper_release_fbi(>helper); > -- > 1.9.1 > > ___ > Intel-gfx mailing list > Intel-gfx@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/intel-gfx ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH] drm/i915: Pin the ifbdev for the info->system_base GGTT mmapping
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: sta...@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(>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(>helper); > drm_fb_helper_release_fbi(>helper); > -- > 1.9.1 > > ___ > Intel-gfx mailing list > Intel-gfx@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/intel-gfx ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH] drm/i915: Pin the ifbdev for the info->system_base GGTT mmapping
On 08/10/15 21:50, Wayne Boyer wrote: From: Chris WilsonA 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. 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: sta...@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(>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(>helper); drm_fb_helper_release_fbi(>helper); Hmm .. pinning now done by i915_gem_obj_ggtt_pin(), but the unpinning function is i915_gem_object_ggtt_unpin(). Just the sort of asymmetry that helps everyone understand what's going on :( Could we not have a mass rename of the various i915_gem_obj{ect} functions to ONE consistent naming convention? (Personally I prefer 'obj' because it's shorter, but consistency is more important than saving just 3 letters). .Dave. ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH] drm/i915: Pin the ifbdev for the info->system_base GGTT mmapping
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. > > v2: rebased on latest nightly (Wayne) > v3: changed i915_gem_object_ggtt_pin() to i915_gem_obj_ggtt_pin() based > on Chris' review. (Wayne) Note that this patch also depends on the drm/i915: Set the map-and-fenceable flag for preallocated objects fix as well http://patchwork.freedesktop.org/patch/58026/ -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
Re: [Intel-gfx] [PATCH] drm/i915: Pin the ifbdev for the info->system_base GGTT mmapping
On Fri, 09 Oct 2015, Chris Wilsonwrote: > 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. >> >> v2: rebased on latest nightly (Wayne) >> v3: changed i915_gem_object_ggtt_pin() to i915_gem_obj_ggtt_pin() based >> on Chris' review. (Wayne) > > Note that this patch also depends on the > > drm/i915: Set the map-and-fenceable flag for preallocated objects > > fix as well > http://patchwork.freedesktop.org/patch/58026/ Jesse, please provide your Tested-by on that plus this patch, since you reported the breakage [1] that got the two patches reverted in the first place. Thanks, Jani. [1] http://mid.gmane.org/55df3886.1060...@virtuousgeek.org > -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 ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH] drm/i915: Pin the ifbdev for the info->system_base GGTT mmapping
On Wed, Oct 07, 2015 at 11:34:17AM -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. > > v2: rebased on latest nightly (Wayne) > > Signed-off-by: Chris Wilson > Cc: "Goel, Akash" > Cc: Daniel Vetter > Cc: Jesse Barnes > Cc: sta...@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..c6aa4f9 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_object_ggtt_pin(obj, NULL, 0, PIN_MAPPABLE); This should be i915_gem_obj_ggtt_pin(obj, 0, PIN_MAPPABLE); At which point I just rage quit. -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
Re: [Intel-gfx] [PATCH] drm/i915: Pin the ifbdev for the info->system_base GGTT mmapping
On 10/08/2015 02:07 AM, Chris Wilson wrote: > On Wed, Oct 07, 2015 at 11:34:17AM -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. >> >> v2: rebased on latest nightly (Wayne) >> >> Signed-off-by: Chris Wilson >> Cc: "Goel, Akash" >> Cc: Daniel Vetter >> Cc: Jesse Barnes >> Cc: sta...@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..c6aa4f9 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_object_ggtt_pin(obj, NULL, 0, PIN_MAPPABLE); > > This should be i915_gem_obj_ggtt_pin(obj, 0, PIN_MAPPABLE); > At which point I just rage quit. LOL GEM naming strikes again! Jesse ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH] drm/i915: Pin the ifbdev for the info->system_base GGTT mmapping
On Fri, Oct 02, 2015 at 10:16:26PM +, Boyer, Wayne wrote: > On 8/26/15, 1:23 AM, Deepakwrote: > > > > > > > >On 08/25/2015 10:18 PM, Chris Wilson wrote: > >> 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. > > > >Yup this is a critical fix :) by keeping the internal FB pinned we avoid > >alloc of buffer within same FB GTT offset > >Reviewed-by: Deepak S > > Daniel, > > Is there anything else that needs to happen before this gets pulled in? Someone needs to send out the rebased-on-upstream version. The patches have been merged but then had to be dropped again since they where based on top of Chris' tree. -Daniel > > Thanks, > Wayne > > > > >> Signed-off-by: Chris Wilson > >> Cc: "Goel, Akash" > >> Cc: Daniel Vetter > >> Cc: Jesse Barnes > >> Cc: sta...@vger.kernel.org > >> --- > >> 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 96476d7d7ed2..082f2938ec97 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_object_ggtt_pin(obj, NULL, 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(>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(>helper); > >>drm_fb_helper_release_fbi(>helper); > > > >___ > >Intel-gfx mailing list > >Intel-gfx@lists.freedesktop.org > >http://lists.freedesktop.org/mailman/listinfo/intel-gfx > -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH] drm/i915: Pin the ifbdev for the info->system_base GGTT mmapping
On 8/26/15, 1:23 AM, Deepakwrote: > > >On 08/25/2015 10:18 PM, Chris Wilson wrote: >> 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. > >Yup this is a critical fix :) by keeping the internal FB pinned we avoid >alloc of buffer within same FB GTT offset >Reviewed-by: Deepak S Daniel, Is there anything else that needs to happen before this gets pulled in? Thanks, Wayne > >> Signed-off-by: Chris Wilson >> Cc: "Goel, Akash" >> Cc: Daniel Vetter >> Cc: Jesse Barnes >> Cc: sta...@vger.kernel.org >> --- >> 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 96476d7d7ed2..082f2938ec97 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_object_ggtt_pin(obj, NULL, 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(>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(>helper); >> drm_fb_helper_release_fbi(>helper); > >___ >Intel-gfx mailing list >Intel-gfx@lists.freedesktop.org >http://lists.freedesktop.org/mailman/listinfo/intel-gfx ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH] drm/i915: Pin the ifbdev for the info-system_base GGTT mmapping
On 08/25/2015 10:18 PM, Chris Wilson wrote: 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. Yup this is a critical fix :) by keeping the internal FB pinned we avoid alloc of buffer within same FB GTT offset Reviewed-by: Deepak S deepa...@linux.intel.com Signed-off-by: Chris Wilson ch...@chris-wilson.co.uk Cc: Goel, Akash akash.g...@intel.com Cc: Daniel Vetter daniel.vet...@ffwll.ch Cc: Jesse Barnes jbar...@virtuousgeek.org Cc: sta...@vger.kernel.org --- 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 96476d7d7ed2..082f2938ec97 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_object_ggtt_pin(obj, NULL, 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); ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx