From patchwork Tue Oct 7 20:25:23 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jesse Barnes X-Patchwork-Id: 5049011 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 87532C11AB for ; Tue, 7 Oct 2014 20:25:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A9E9C20204 for ; Tue, 7 Oct 2014 20:25:37 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 8417820200 for ; Tue, 7 Oct 2014 20:25:36 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E3D26897E9; Tue, 7 Oct 2014 13:25:34 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from gproxy7-pub.mail.unifiedlayer.com (gproxy7-pub.mail.unifiedlayer.com [70.40.196.235]) by gabe.freedesktop.org (Postfix) with SMTP id ADC6A897E9 for ; Tue, 7 Oct 2014 13:25:33 -0700 (PDT) Received: (qmail 30508 invoked by uid 0); 7 Oct 2014 20:25:31 -0000 Received: from unknown (HELO cmgw3) (10.0.90.84) by gproxy7.mail.unifiedlayer.com with SMTP; 7 Oct 2014 20:25:31 -0000 Received: from box514.bluehost.com ([74.220.219.114]) by cmgw3 with id 0SRS1p00E2UhLwi01SRVbp; Tue, 07 Oct 2014 20:25:30 -0600 X-Authority-Analysis: v=2.1 cv=F6LEKMRN c=1 sm=1 tr=0 a=9W6Fsu4pMcyimqnCr1W0/w==:117 a=9W6Fsu4pMcyimqnCr1W0/w==:17 a=cNaOj0WVAAAA:8 a=f5113yIGAAAA:8 a=3ROhxo7VqVMA:10 a=TBVoxVdAAAAA:8 a=GhZ5P8ky69gA:10 a=noBwr2J6l1kA:10 a=bRbXYtqNI1fezJ-KKbQA:9 a=rW6DTWptwo0A:10 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=virtuousgeek.org; s=default; h=Message-Id:Date:Subject:Cc:To:From; bh=QcNgrRWn2ku+R+/KxgDVo1+5W0whxZUBE+WTIpy5So8=; b=tBpJmkeOYkC2dM0E3G9E5rHT2TFiCLp0qV96VAFYm8wVnrPipNz02JavVQgdIHUD5DT2xu8tHYXyVAUA91hwW+Caim7Z5gAg90r4REIj2l7wDYn3yO6VwERlW9d930iv; Received: from [67.161.37.189] (port=44893 helo=localhost.localdomain) by box514.bluehost.com with esmtpsa (TLSv1.2:AES128-SHA256:128) (Exim 4.82) (envelope-from ) id 1XbbK3-0007Mp-5g; Tue, 07 Oct 2014 14:25:27 -0600 From: Jesse Barnes To: intel-gfx@lists.freedesktop.org Date: Tue, 7 Oct 2014 13:25:23 -0700 Message-Id: <1412713523-14011-1-git-send-email-jbarnes@virtuousgeek.org> X-Mailer: git-send-email 1.9.1 X-Identified-User: {10642:box514.bluehost.com:virtuous:virtuousgeek.org} {sentby:smtp auth 67.161.37.189 authed with jbarnes@virtuousgeek.org} Cc: shuang.he@linux.intel.com Subject: [Intel-gfx] [PATCH] drm/i915: use delayed work for resume hotplug v2 X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.15 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.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_RP_MATCHES_RCVD, 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 Gets the detect code (which may take awhile) out of the resume path, speeding things up a bit. v2: use a delayed work queue instead (Daniel) Signed-off-by: Jesse Barnes --- drivers/gpu/drm/i915/i915_dma.c | 10 ++++++++++ drivers/gpu/drm/i915/i915_drv.c | 8 ++++++-- drivers/gpu/drm/i915/i915_drv.h | 1 + 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index 85d14e1..633095d 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c @@ -1303,6 +1303,15 @@ static const struct vga_switcheroo_client_ops i915_switcheroo_ops = { .can_switch = i915_switcheroo_can_switch, }; +static void intel_resume_hotplug(struct work_struct *work) +{ + struct drm_i915_private *dev_priv = + container_of(work, struct drm_i915_private, + hotplug_resume_work.work); + + drm_helper_hpd_irq_event(dev_priv->dev); +} + static int i915_load_modeset_init(struct drm_device *dev) { struct drm_i915_private *dev_priv = dev->dev_private; @@ -1364,6 +1373,7 @@ static int i915_load_modeset_init(struct drm_device *dev) /* Only enable hotplug handling once the fbdev is fully set up. */ intel_hpd_init(dev_priv); + INIT_DELAYED_WORK(&dev_priv->hotplug_resume_work, intel_resume_hotplug); /* * Some ports require correctly set-up hpd registers for detection to diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index a05a1d0..83075f9 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c @@ -726,8 +726,12 @@ static int __i915_drm_thaw(struct drm_device *dev, bool restore_gtt_mappings) * notifications. * */ intel_hpd_init(dev_priv); - /* Config may have changed between suspend and resume */ - drm_helper_hpd_irq_event(dev); + /* Config may have changed between suspend and resume. Just + * try to make sure the rest of driver resume is finished + * before we start probing for config changes. + */ + schedule_delayed_work(&dev_priv->hotplug_resume_work, + msecs_to_jiffies(50)); } intel_opregion_init(dev); diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 1e476b5..6273ad6 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -1521,6 +1521,7 @@ struct drm_i915_private { } hpd_stats[HPD_NUM_PINS]; u32 hpd_event_bits; struct delayed_work hotplug_reenable_work; + struct delayed_work hotplug_resume_work; struct i915_fbc fbc; struct i915_drrs drrs;