From patchwork Fri Apr 22 07:47:02 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 8906761 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 4C8989F39A for ; Fri, 22 Apr 2016 07:47:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 629712026F for ; Fri, 22 Apr 2016 07:47:17 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 58F23201F2 for ; Fri, 22 Apr 2016 07:47:16 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B278A6EDF7; Fri, 22 Apr 2016 07:47:14 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wm0-x244.google.com (mail-wm0-x244.google.com [IPv6:2a00:1450:400c:c09::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id 148A46EDF7 for ; Fri, 22 Apr 2016 07:47:13 +0000 (UTC) Received: by mail-wm0-x244.google.com with SMTP id w143so1016648wmw.3 for ; Fri, 22 Apr 2016 00:47:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id; bh=rUFhjYrUXqYsqXRLmh0ZJJstebJDSTaFrrZWqH7jUtY=; b=TIn/4SVvq8hQSQ3P5OcxyeWnY84nK7iJBrfwdytmGDHcSDdIrCrLpbrYs3UU9se+5V do9/eEgFXlJw9ZYlyzWIoavGtko0HzUIWWbZdgZycZ/6/QMkfvQ8X1ROu5WqGa9pwSDG JBycWzYx1br6N9kVqtXlMgUw6hog0gDwY4VNEKU6On6/uU/vXu3WtHz4aNhDdwimn9wU 3s0kyJ/kSbCelw97ihG3zvN+xspAGMfVNMzegn8VOcaRGG+57GNCd//Ufw4R/BJu5yFo QqACnzNwK1Ff4ZNLtwth9aMRnxUu/Gri8jmgFR3GMIKCay/q5uaicn1LSrbqczedCtb1 BIIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=rUFhjYrUXqYsqXRLmh0ZJJstebJDSTaFrrZWqH7jUtY=; b=AQO8BAKUnc4LDdDeNDK6NSvUxVZ0o+3bYA/vdrEmf7owf1+gBtf0QDC8aruNGXk4o4 Rc9HRJ2l35laQgNCu12HetVdBNWJNWm1GwLblC6bVAHP6Hqj8ZEfmUXm+LNuPd8FOifG R+xtQWU13Zny3EhwGnz3cjsdlnpSECb+Jwf5cy0bEl84TFaqubpO0/fDA1zya1ZFqytK ck/RwNmadc6A5bvInTV1sNG6itItZaPwdS/S3A/d4XctA5aGrRHAtz+vCyUrekP/UNma Ho5nBUv13pNwXJFiXuo/cKeh83i1gnSWbOTUzdWjbeG9q1Inoonmmu6A8vpZoq+b6dJY 9gcg== X-Gm-Message-State: AOPr4FUbIdG1lwEwFEz/44+Ws1DaFjT7/ZXLP83WxL5OQB/J14MPvEgc6KsH79TW4lkJMw== X-Received: by 10.194.179.168 with SMTP id dh8mr21379499wjc.130.1461311231456; Fri, 22 Apr 2016 00:47:11 -0700 (PDT) Received: from haswell.alporthouse.com ([78.156.65.138]) by smtp.gmail.com with ESMTPSA id t4sm1985304wmf.8.2016.04.22.00.47.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 22 Apr 2016 00:47:10 -0700 (PDT) From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Fri, 22 Apr 2016 08:47:02 +0100 Message-Id: <1461311222-32406-1-git-send-email-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.8.1 Cc: Mika Kuoppala Subject: [Intel-gfx] [PATCH] drm/i915/fbdev: Call intel_unpin_fb_obj() on release 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=-5.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham 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 When releasing the intel_fbdev, we should unpin the framebuffer that we pinned during construction. Signed-off-by: Chris Wilson --- I'm hoping this explains some of the flip-flip in DMESG-WARN for drv_module_reload_basic... -Chris --- drivers/gpu/drm/i915/intel_display.c | 2 +- drivers/gpu/drm/i915/intel_drv.h | 1 + drivers/gpu/drm/i915/intel_fbdev.c | 7 ++++++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index ff60241b1f76..a59fe7b032b0 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -2309,7 +2309,7 @@ err_pm: return ret; } -static void intel_unpin_fb_obj(struct drm_framebuffer *fb, unsigned int rotation) +void intel_unpin_fb_obj(struct drm_framebuffer *fb, unsigned int rotation) { struct drm_i915_gem_object *obj = intel_fb_obj(fb); struct i915_ggtt_view view; diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index beed9e81252b..e336b19adb37 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h @@ -1161,6 +1161,7 @@ void intel_release_load_detect_pipe(struct drm_connector *connector, struct drm_modeset_acquire_ctx *ctx); int intel_pin_and_fence_fb_obj(struct drm_framebuffer *fb, unsigned int rotation); +void intel_unpin_fb_obj(struct drm_framebuffer *fb, unsigned int rotation); struct drm_framebuffer * __intel_framebuffer_create(struct drm_device *dev, struct drm_mode_fb_cmd2 *mode_cmd, diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c index 79ac202f3870..c3c265d6f521 100644 --- a/drivers/gpu/drm/i915/intel_fbdev.c +++ b/drivers/gpu/drm/i915/intel_fbdev.c @@ -287,7 +287,7 @@ static int intelfb_create(struct drm_fb_helper *helper, out_destroy_fbi: drm_fb_helper_release_fbi(helper); out_unpin: - i915_gem_object_ggtt_unpin(obj); + intel_unpin_fb_obj(&ifbdev->fb->base, BIT(DRM_ROTATE_0)); out_unlock: mutex_unlock(&dev->struct_mutex); return ret; @@ -551,6 +551,11 @@ static void intel_fbdev_destroy(struct drm_device *dev, if (ifbdev->fb) { drm_framebuffer_unregister_private(&ifbdev->fb->base); + + mutex_lock(&dev->struct_mutex); + intel_unpin_fb_obj(&ifbdev->fb->base, BIT(DRM_ROTATE_0)); + mutex_unlock(&dev->struct_mutex); + drm_framebuffer_remove(&ifbdev->fb->base); } }