From patchwork Thu Oct 22 06:42:41 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jesse Barnes X-Patchwork-Id: 55266 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n9M6gpBa012477 for ; Thu, 22 Oct 2009 06:42:51 GMT Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4543C9E7A7; Wed, 21 Oct 2009 23:42:50 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from outbound-mail-114.bluehost.com (outbound-mail-114.bluehost.com [69.89.24.4]) by gabe.freedesktop.org (Postfix) with SMTP id 4B8479E779 for ; Wed, 21 Oct 2009 23:42:47 -0700 (PDT) Received: (qmail 9322 invoked by uid 0); 22 Oct 2009 06:42:47 -0000 Received: from unknown (HELO box514.bluehost.com) (74.220.219.114) by outboundproxy3.bluehost.com with SMTP; 22 Oct 2009 06:42:47 -0000 Received: from s10.itokyofl3.vectant.ne.jp ([202.231.68.10] helo=jbarnes-x200) by box514.bluehost.com with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.69) (envelope-from ) id 1N0rNn-0003zG-02; Thu, 22 Oct 2009 00:42:47 -0600 Date: Thu, 22 Oct 2009 15:42:41 +0900 From: Jesse Barnes To: dri-devel@lists.sourceforge.net, intel-gfx@lists.freedesktop.org, mjg59@srcf.ucam.org Message-ID: <20091022154241.446fb048@jbarnes-x200> X-Mailer: Claws Mail 3.7.2 (GTK+ 2.18.2; x86_64-pc-linux-gnu) Mime-Version: 1.0 X-Identified-User: {10642:box514.bluehost.com:virtuous:virtuousgeek.org} {sentby:smtp auth 202.231.68.10 authed with jbarnes@virtuousgeek.org} Cc: hpa@zytor.com Subject: [Intel-gfx] [RFC] drm/i915: support zero flicker boot X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.9 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c index fe86974..3c5abd8 100644 --- a/drivers/gpu/drm/drm_crtc_helper.c +++ b/drivers/gpu/drm/drm_crtc_helper.c @@ -753,9 +753,8 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set) /* We should be able to check here if the fb has the same properties * and then just flip_or_move it */ if (set->crtc->fb != set->fb) { - /* If we have no fb then treat it as a full mode set */ - if (set->crtc->fb == NULL) { - DRM_DEBUG_KMS("crtc has no fb, full mode set\n"); + /* If the CRTC is off then treat it as a full mode set */ + if (!set->crtc->enabled) { mode_changed = true; } else if (set->fb == NULL) { mode_changed = true; diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 298d317..ed60508 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -3573,11 +3573,15 @@ struct drm_display_mode *intel_crtc_mode_get(struct drm_device *dev, struct intel_crtc *intel_crtc = to_intel_crtc(crtc); int pipe = intel_crtc->pipe; struct drm_display_mode *mode; + int pipeconf = I915_READ((pipe == 0) ? PIPEACONF : PIPEBCONF); int htot = I915_READ((pipe == 0) ? HTOTAL_A : HTOTAL_B); int hsync = I915_READ((pipe == 0) ? HSYNC_A : HSYNC_B); int vtot = I915_READ((pipe == 0) ? VTOTAL_A : VTOTAL_B); int vsync = I915_READ((pipe == 0) ? VSYNC_A : VSYNC_B); + if (!(pipeconf & PIPEACONF_ENABLE)) + return NULL; + mode = kzalloc(sizeof(*mode), GFP_KERNEL); if (!mode) return NULL; @@ -4310,6 +4314,29 @@ static void intel_init_display(struct drm_device *dev) } } +/** + * intel_get_current_modes - get current mode timings for each CRTC + * @dev: DRM device + * + * Setting each CRTC's mode field with the current values can help us avoid + * flicker in the case where the BIOS already put us in a native mode. + */ +static void intel_get_current_modes(struct drm_device *dev) +{ + struct drm_crtc *crtc; + struct drm_display_mode *mode; + + list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { + mode = intel_crtc_mode_get(dev, crtc); + if (!mode) { + crtc->enabled = false; + continue; + } + crtc->mode = *mode; /* copy the mode over */ + kfree(mode); + } +} + void intel_modeset_init(struct drm_device *dev) { struct drm_i915_private *dev_priv = dev->dev_private; @@ -4362,6 +4389,8 @@ void intel_modeset_init(struct drm_device *dev) intel_init_clock_gating(dev); + intel_get_current_modes(dev); + INIT_WORK(&dev_priv->idle_work, intel_idle_update); setup_timer(&dev_priv->idle_timer, intel_gpu_idle_timer, (unsigned long)dev);