From patchwork Fri Sep 11 05:19:32 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhenyu Wang X-Patchwork-Id: 46792 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 n8B5JbO1030161 for ; Fri, 11 Sep 2009 05:19:37 GMT Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BFC60A094B; Thu, 10 Sep 2009 22:19:36 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from fmsmga102.fm.intel.com (mga10.intel.com [192.55.52.92]) by gabe.freedesktop.org (Postfix) with ESMTP id 99C2FA093F for ; Thu, 10 Sep 2009 22:19:35 -0700 (PDT) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP; 10 Sep 2009 22:08:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.44,368,1249282800"; d="scan'208";a="725954429" Received: from debian-i915.sh.intel.com (HELO localhost.localdomain) ([10.239.36.110]) by fmsmga001.fm.intel.com with ESMTP; 10 Sep 2009 22:22:35 -0700 From: Zhenyu Wang To: intel-gfx@lists.freedesktop.org Date: Fri, 11 Sep 2009 13:19:32 +0800 Message-Id: <1252646372-9881-1-git-send-email-zhenyuw@linux.intel.com> X-Mailer: git-send-email 1.6.3.3 Subject: [Intel-gfx] [PATCH] drm/i915: fix screen blank issue in TV detect 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: , MIME-Version: 1.0 Sender: intel-gfx-bounces@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org In load time, this one trys to detect TV by current encoder state instead of load-detect method. Because load-detect will set mode which disable VGA mode entirely, but couldn't restore back later. Destroy VGA mode which is the mode after system boot caused black screen problem, although load fbcon or X later could setup the mode on LVDS without problem. That fixes screen blank issue seen on Macbook after boot and before fbcon or X kicks in, actually this affects all laptops with TV out, or without real port but our TV encoder probe fails to detect. Signed-off-by: Zhenyu Wang --- drivers/gpu/drm/i915/intel_tv.c | 24 ++++++++++++++++++++++++ 1 files changed, 24 insertions(+), 0 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c index 5b1c9e9..edb4e6e 100644 --- a/drivers/gpu/drm/i915/intel_tv.c +++ b/drivers/gpu/drm/i915/intel_tv.c @@ -38,6 +38,11 @@ #include "i915_drm.h" #include "i915_drv.h" +/* + * This shortcut TV detect in load time for checking current state only. + */ +static bool load_time_detect = true; + enum tv_margin { TV_MARGIN_LEFT, TV_MARGIN_TOP, TV_MARGIN_RIGHT, TV_MARGIN_BOTTOM @@ -1451,9 +1456,28 @@ intel_tv_detect(struct drm_connector *connector) struct intel_output *intel_output = to_intel_output(connector); struct intel_tv_priv *tv_priv = intel_output->dev_priv; struct drm_encoder *encoder = &intel_output->enc; + struct drm_i915_private *dev_priv = connector->dev->dev_private; int dpms_mode; int type = tv_priv->type; + /* + * In driver load time, TV load detect will try to set mode, + * during which VGA mode will be disabled and never could be + * restored later. This will blank screen which is in VGA mode + * after boot. + * + * So here we only check current TV encoder state when loading. + * Future TV detect for fbcon or X still work as before. + * + */ + if (load_time_detect) { + load_time_detect = false; + if (!(I915_READ(TV_CTL) & TV_ENC_ENABLE)) + return connector_status_disconnected; + else + return connector_status_connected; + } + mode = reported_modes[0]; drm_mode_set_crtcinfo(&mode, CRTC_INTERLACE_HALVE_V);