From patchwork Thu Oct 8 20:50:21 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wayne Boyer X-Patchwork-Id: 7355311 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 5F7919F4DC for ; Thu, 8 Oct 2015 20:52:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 61EA7207B3 for ; Thu, 8 Oct 2015 20:52:29 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 726B3207B1 for ; Thu, 8 Oct 2015 20:52:28 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BD59E6E03E; Thu, 8 Oct 2015 13:52:27 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by gabe.freedesktop.org (Postfix) with ESMTP id E92EC6E03E for ; Thu, 8 Oct 2015 13:52:25 -0700 (PDT) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga103.jf.intel.com with ESMTP; 08 Oct 2015 13:51:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,655,1437462000"; d="scan'208";a="787960135" Received: from wboyerdev.jf.intel.com ([10.7.197.85]) by orsmga001.jf.intel.com with ESMTP; 08 Oct 2015 13:51:54 -0700 From: Wayne Boyer To: intel-gfx@lists.freedesktop.org Date: Thu, 8 Oct 2015 13:50:21 -0700 Message-Id: <1444337421-20784-1-git-send-email-wayne.boyer@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <20151008090737.GJ27939@nuc-i3427.alporthouse.com> References: <20151008090737.GJ27939@nuc-i3427.alporthouse.com> Cc: Daniel Vetter , stable@vger.kernel.org, "Goel, Akash" Subject: [Intel-gfx] [PATCH] drm/i915: Pin the ifbdev for the info->system_base GGTT mmapping X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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: 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);