From patchwork Tue Apr 19 07:52:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maarten Lankhorst X-Patchwork-Id: 8877571 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.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 3E773BF29F for ; Tue, 19 Apr 2016 07:54:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 59417201E4 for ; Tue, 19 Apr 2016 07:54:20 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 366252026C for ; Tue, 19 Apr 2016 07:54:18 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AB34D6E6CC; Tue, 19 Apr 2016 07:54:16 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mblankhorst.nl (mblankhorst.nl [IPv6:2a02:2308::216:3eff:fe92:dfa3]) by gabe.freedesktop.org (Postfix) with ESMTPS id D64296E6D1 for ; Tue, 19 Apr 2016 07:52:50 +0000 (UTC) From: Maarten Lankhorst To: intel-gfx@lists.freedesktop.org Date: Tue, 19 Apr 2016 09:52:35 +0200 Message-Id: <1461052359-24154-16-git-send-email-maarten.lankhorst@linux.intel.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1461052359-24154-1-git-send-email-maarten.lankhorst@linux.intel.com> References: <1461052359-24154-1-git-send-email-maarten.lankhorst@linux.intel.com> Subject: [Intel-gfx] [PATCH 15/19] drm/i915: Prepare MST connector removal for async unpin. 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.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 check_connector_state might get called from unpin_work, which means that the mst removal function has to flush it, and it has to use for_each_intel_connector because it cannot check if connection_mutex is held. Signed-off-by: Maarten Lankhorst Reviewed-by: Patrik Jakobsson --- drivers/gpu/drm/i915/intel_display.c | 12 ++++++------ drivers/gpu/drm/i915/intel_dp_mst.c | 11 +++++++++++ drivers/gpu/drm/i915/intel_drv.h | 1 + 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 5d60b3a8f06c..6feb8c6ccb8c 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -3900,7 +3900,7 @@ static void page_flip_completed(struct intel_crtc *intel_crtc, struct intel_flip queue_work(dev_priv->wq, &work->unpin_work); } -static int intel_crtc_wait_for_pending_flips(struct drm_crtc *crtc) +int intel_crtc_wait_for_pending_flips(struct drm_crtc *crtc) { struct drm_device *dev = crtc->dev; struct drm_i915_private *dev_priv = dev->dev_private; @@ -12458,16 +12458,16 @@ static void verify_wm_state(struct drm_crtc *crtc, static void verify_connector_state(struct drm_device *dev, struct drm_crtc *crtc) { - struct drm_connector *connector; + struct intel_connector *connector; - drm_for_each_connector(connector, dev) { - struct drm_encoder *encoder = connector->encoder; - struct drm_connector_state *state = connector->state; + for_each_intel_connector(dev, connector) { + struct drm_connector_state *state = connector->base.state; + struct drm_encoder *encoder = connector->base.encoder; if (state->crtc != crtc) continue; - intel_connector_verify_state(to_intel_connector(connector)); + intel_connector_verify_state(connector); I915_STATE_WARN(state->best_encoder != encoder, "connector's atomic encoder doesn't match legacy encoder\n"); diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c b/drivers/gpu/drm/i915/intel_dp_mst.c index 94b4e833dadd..ab24f3ea08bc 100644 --- a/drivers/gpu/drm/i915/intel_dp_mst.c +++ b/drivers/gpu/drm/i915/intel_dp_mst.c @@ -501,6 +501,7 @@ static void intel_dp_destroy_mst_connector(struct drm_dp_mst_topology_mgr *mgr, { struct intel_connector *intel_connector = to_intel_connector(connector); struct drm_device *dev = connector->dev; + struct drm_crtc *crtc; intel_connector->unregister(intel_connector); @@ -518,6 +519,16 @@ static void intel_dp_destroy_mst_connector(struct drm_dp_mst_topology_mgr *mgr, WARN(ret, "Disabling mst crtc failed with %i\n", ret); } + /* Ensure any hw state checker call is completed */ + for_each_crtc(dev, crtc) + intel_crtc_wait_for_pending_flips(crtc); + + /* + * Before removing the connector, make sure all work is flushed + * because it may traverse the connector list. + */ + flush_workqueue(to_i915(dev)->wq); + intel_connector_remove_from_fbdev(intel_connector); drm_connector_cleanup(connector); drm_modeset_unlock_all(dev); diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 0ec81df35710..d2cfb50332be 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h @@ -1145,6 +1145,7 @@ intel_wait_for_vblank_if_active(struct drm_device *dev, int pipe) if (crtc->active) intel_wait_for_vblank(dev, pipe); } +int intel_crtc_wait_for_pending_flips(struct drm_crtc *crtc); u32 intel_crtc_get_vblank_counter(struct intel_crtc *crtc);