From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jesse Barnes Subject: [PATCH] drm/i915: add modeset_global_pipes callback for global config adjustments Date: Fri, 1 Nov 2013 12:24:06 -0700 Message-ID: <1383333846-805-1-git-send-email-jbarnes@virtuousgeek.org> References: <1383333216-1428-1-git-send-email-jbarnes@virtuousgeek.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from oproxy12-pub.mail.unifiedlayer.com (oproxy12-pub.mail.unifiedlayer.com [50.87.16.10]) by gabe.freedesktop.org (Postfix) with SMTP id BB4EAEFF2A for ; Fri, 1 Nov 2013 12:24:10 -0700 (PDT) Received: from [67.161.37.189] (port=34943 helo=localhost.localdomain) by box514.bluehost.com with esmtpsa (TLSv1:CAMELLIA256-SHA:256) (Exim 4.80) (envelope-from ) id 1VcKKH-0005sC-96 for intel-gfx@lists.freedesktop.org; Fri, 01 Nov 2013 13:24:09 -0600 In-Reply-To: <1383333216-1428-1-git-send-email-jbarnes@virtuousgeek.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org To: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org 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; -- 1.8.3.1