From patchwork Fri Nov 1 15:41:26 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jesse Barnes X-Patchwork-Id: 3126211 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.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 5DEDF9F432 for ; Fri, 1 Nov 2013 15:41:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1B0C120340 for ; Fri, 1 Nov 2013 15:41:44 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id C7E4B20481 for ; Fri, 1 Nov 2013 15:41:40 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 81252F06A3; Fri, 1 Nov 2013 08:41:37 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from oproxy13-pub.mail.unifiedlayer.com (oproxy13-pub.mail.unifiedlayer.com [69.89.16.30]) by gabe.freedesktop.org (Postfix) with SMTP id D8F47F06A2 for ; Fri, 1 Nov 2013 08:41:32 -0700 (PDT) Received: (qmail 2963 invoked by uid 0); 1 Nov 2013 15:41:32 -0000 Received: from unknown (HELO box514.bluehost.com) (74.220.219.114) by oproxy13.mail.unifiedlayer.com with SMTP; 1 Nov 2013 15:41:32 -0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=virtuousgeek.org; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:To:From; bh=WPORitUx/a5sYmMG7jMj4woMWVA1K27QJ7uYYqktBuw=; b=nFUbELXW/Wim1gtOv54Es5xazmrIxPPTZxWsrMpgd2l3xLU/L1yv3mTBM8uib+8mvOGqioa17OhnM8TKnepA/tZzUBQ0zGZOIUfZvka93U/EtA1TSuN88EnJpfTaxEDI; Received: from [67.161.37.189] (port=38882 helo=localhost.localdomain) by box514.bluehost.com with esmtpsa (TLSv1:CAMELLIA256-SHA:256) (Exim 4.80) (envelope-from ) id 1VcGqp-0004AP-QC for intel-gfx@lists.freedesktop.org; Fri, 01 Nov 2013 09:41:31 -0600 From: Jesse Barnes To: intel-gfx@lists.freedesktop.org Date: Fri, 1 Nov 2013 08:41:26 -0700 Message-Id: <1383320487-790-3-git-send-email-jbarnes@virtuousgeek.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1383320487-790-1-git-send-email-jbarnes@virtuousgeek.org> References: <1383320487-790-1-git-send-email-jbarnes@virtuousgeek.org> X-Identified-User: {10642:box514.bluehost.com:virtuous:virtuousgeek.org} {sentby:smtp auth 67.161.37.189 authed with jbarnes@virtuousgeek.org} Subject: [Intel-gfx] [PATCH 3/4] drm/i915: add modeset_global_pipes callback for global config adjustments X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org X-Spam-Status: No, score=-4.6 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 In some cases we may need to turn off more pipes than just the ones affected by a connector or encoder change, probably due to modifying some global resource that requires all pipes to shut down. Add a hook for this purpose to allow platform code to adjust the prepare_pipes mask, which allows otherwise active pipes to get shut down for the duration of the mode set, then restored at the end. Signed-off-by: Jesse Barnes --- drivers/gpu/drm/i915/i915_drv.h | 12 ++++++++++++ drivers/gpu/drm/i915/intel_display.c | 7 +++++++ 2 files changed, 19 insertions(+) diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 5edf9bb..7530cd4 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -380,6 +380,18 @@ struct drm_i915_display_funcs { struct drm_crtc *crtc, uint32_t sprite_width, int pixel_size, bool enable, bool scaled); + /** + * modeset_global_pipes - figure out which pipes need to be disabled + * @dev: drm device + * @prepare_pipes: bitmask of pipes to disable + * + * In some cases, adjusting a global resource may require shutting + * down seemingly unrelated pipes on a mode set. This function + * should determine that and adjust the prepare_pipes bitmask + * as needed. + */ + void (*modeset_global_pipes)(struct drm_device *dev, + unsigned *prepare_pipes); void (*modeset_global_resources)(struct drm_device *dev); /* Returns the active state of the crtc, and if the crtc is active, * fills out the pipe-config with the hw state. */ diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 606a594..faa7548 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -9298,6 +9298,13 @@ static int __intel_set_mode(struct drm_crtc *crtc, intel_modeset_affected_pipes(crtc, &modeset_pipes, &prepare_pipes, &disable_pipes); + /* + * See if the config requires any additional preparation, e.g. + * to adjust global state with pipes off. + */ + if (dev_priv->display.modeset_global_pipes) + dev_priv->display.modeset_global_pipes(dev, &prepare_pipes); + *saved_hwmode = crtc->hwmode; *saved_mode = crtc->mode;