From: Lukas Wunner <lukas@wunner.de>
To: Wayne Boyer <wayne.boyer@intel.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>,
intel-gfx@lists.freedesktop.org, "Goel,
Akash" <akash.goel@intel.com>,
stable@vger.kernel.org
Subject: Re: [PATCH] drm/i915: Pin the ifbdev for the info->system_base GGTT mmapping
Date: Sun, 25 Oct 2015 15:34:16 +0100 [thread overview]
Message-ID: <20151025143416.GA19554@wunner.de> (raw)
In-Reply-To: <1444337421-20784-1-git-send-email-wayne.boyer@intel.com>
Hi,
On Thu, Oct 08, 2015 at 01:50:21PM -0700, Wayne Boyer wrote:
> From: Chris Wilson <chris@chris-wilson.co.uk>
>
> 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 <chris@chris-wilson.co.uk>
> Cc: "Goel, Akash" <akash.goel@intel.com>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
> Cc: stable@vger.kernel.org
> Reviewed-by: Deepak S <deepak.s@linux.intel.com>
> Signed-off-by: Wayne Boyer <wayne.boyer@intel.com>
> ---
> 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: <e08c113c04191ecd66904423da4f1908f48b5ef6.1445771693.git.lukas@wunner.de>
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(&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
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
WARNING: multiple messages have this Message-ID (diff)
From: Lukas Wunner <lukas@wunner.de>
To: Wayne Boyer <wayne.boyer@intel.com>
Cc: intel-gfx@lists.freedesktop.org,
Daniel Vetter <daniel.vetter@ffwll.ch>,
stable@vger.kernel.org, "Goel, Akash" <akash.goel@intel.com>
Subject: Re: [Intel-gfx] [PATCH] drm/i915: Pin the ifbdev for the info->system_base GGTT mmapping
Date: Sun, 25 Oct 2015 15:34:16 +0100 [thread overview]
Message-ID: <20151025143416.GA19554@wunner.de> (raw)
In-Reply-To: <1444337421-20784-1-git-send-email-wayne.boyer@intel.com>
Hi,
On Thu, Oct 08, 2015 at 01:50:21PM -0700, Wayne Boyer wrote:
> From: Chris Wilson <chris@chris-wilson.co.uk>
>
> 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 <chris@chris-wilson.co.uk>
> Cc: "Goel, Akash" <akash.goel@intel.com>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
> Cc: stable@vger.kernel.org
> Reviewed-by: Deepak S <deepak.s@linux.intel.com>
> Signed-off-by: Wayne Boyer <wayne.boyer@intel.com>
> ---
> 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: <e08c113c04191ecd66904423da4f1908f48b5ef6.1445771693.git.lukas@wunner.de>
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(&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
next prev parent reply other threads:[~2015-10-25 14:34 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-25 16:48 [PATCH] drm/i915: Pin the ifbdev for the info->system_base GGTT mmapping Chris Wilson
2015-08-26 8:23 ` Deepak
2015-10-02 22:16 ` Boyer, Wayne
2015-10-06 8:25 ` Daniel Vetter
2015-10-07 18:34 ` Wayne Boyer
2015-10-07 18:34 ` Wayne Boyer
2015-10-08 9:07 ` Chris Wilson
2015-10-08 14:45 ` Jesse Barnes
2015-10-08 14:45 ` Jesse Barnes
2015-10-08 20:50 ` Wayne Boyer
2015-10-09 9:11 ` Chris Wilson
2015-10-09 12:00 ` Jani Nikula
2015-10-09 12:00 ` [Intel-gfx] " Jani Nikula
2015-10-23 21:17 ` Dave Gordon
2015-10-30 16:18 ` Daniel Vetter
2015-10-30 17:17 ` Chris Wilson
2015-10-25 14:34 ` Lukas Wunner [this message]
2015-10-25 14:34 ` [Intel-gfx] " Lukas Wunner
2015-10-25 14:53 ` Lukas Wunner
2015-10-25 14:53 ` [Intel-gfx] " Lukas Wunner
2015-08-26 11:55 ` [PATCH] drm/i915: Set the map-and-fenceable flag for preallocated objects Chris Wilson
2015-08-26 13:06 ` Daniel Vetter
2015-08-26 13:08 ` Daniel Vetter
2015-08-26 13:08 ` Daniel Vetter
2015-08-26 13:51 ` Chris Wilson
2015-08-27 8:36 ` Jani Nikula
2015-08-27 8:36 ` [Intel-gfx] " Jani Nikula
2015-08-27 16:19 ` Jesse Barnes
2015-08-27 16:19 ` [Intel-gfx] " Jesse Barnes
2015-08-27 16:36 ` Chris Wilson
2015-08-28 7:00 ` Jani Nikula
2015-08-28 7:00 ` [Intel-gfx] " Jani Nikula
2015-08-30 18:28 ` shuang.he
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=20151025143416.GA19554@wunner.de \
--to=lukas@wunner.de \
--cc=akash.goel@intel.com \
--cc=daniel.vetter@ffwll.ch \
--cc=intel-gfx@lists.freedesktop.org \
--cc=stable@vger.kernel.org \
--cc=wayne.boyer@intel.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.