From patchwork Thu Aug 6 01:02:00 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhao, Yakui" X-Patchwork-Id: 39487 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 n7611DS4016255 for ; Thu, 6 Aug 2009 01:01:13 GMT Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0E4249F759; Wed, 5 Aug 2009 18:01:13 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by gabe.freedesktop.org (Postfix) with ESMTP id E165E9E747 for ; Wed, 5 Aug 2009 18:01:08 -0700 (PDT) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 05 Aug 2009 17:59:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.43,331,1246863600"; d="scan'208";a="481129801" Received: from yakui_zhao.sh.intel.com (HELO localhost.localdomain) ([10.239.13.194]) by fmsmga002.fm.intel.com with ESMTP; 05 Aug 2009 17:54:05 -0700 From: yakui.zhao@intel.com To: eric@anholt.net Date: Thu, 6 Aug 2009 09:02:00 +0800 Message-Id: <1249520522-28941-2-git-send-email-yakui.zhao@intel.com> X-Mailer: git-send-email 1.5.4.5 In-Reply-To: <1249520522-28941-1-git-send-email-yakui.zhao@intel.com> References: <1249520522-28941-1-git-send-email-yakui.zhao@intel.com> Cc: Ma Ling , intel-gfx@lists.freedesktop.org Subject: [Intel-gfx] [PATCH 2/3] drm/i915: Set crtc/clone mask in different output devices 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 From: Ma Ling Based on Bspec each encoder has different sharing pipe property, i.e. Integrated or SDVO TV both will occupy one pipe exlusively, and sdvo-non-tv and crt are allowed to share one. The patch moves sharing judgment into differnet output functions, and set right clone bit. This will be to vaoid that one pipe is shared by both HDMI. https://bugs.freedesktop.org/show_bug.cgi?id=22247 Signed-off-by: Ma Ling Reviewed-by : Jesse Barnes Signed-off-by: Zhao Yakui --- In this version, set crtc_mask for each output, and update dvo output. drivers/gpu/drm/i915/intel_crt.c | 4 ++ drivers/gpu/drm/i915/intel_display.c | 49 ++--------------------------------- drivers/gpu/drm/i915/intel_dp.c | 12 ++++++++ drivers/gpu/drm/i915/intel_drv.h | 20 ++++++++++++++ drivers/gpu/drm/i915/intel_dvo.c | 6 ++++ drivers/gpu/drm/i915/intel_hdmi.c | 18 ++++++++---- drivers/gpu/drm/i915/intel_lvds.c | 2 + drivers/gpu/drm/i915/intel_sdvo.c | 11 +++++++ drivers/gpu/drm/i915/intel_tv.c | 2 + 9 files changed, 73 insertions(+), 51 deletions(-) Index: linux-2.6/drivers/gpu/drm/i915/intel_crt.c =================================================================== --- linux-2.6.orig/drivers/gpu/drm/i915/intel_crt.c 2009-08-05 16:56:38.000000000 +0800 +++ linux-2.6/drivers/gpu/drm/i915/intel_crt.c 2009-08-06 08:32:38.000000000 +0800 @@ -537,6 +537,10 @@ } intel_output->type = INTEL_OUTPUT_ANALOG; + intel_output->clone_mask = (1 << INTEL_SDVO_NON_TV_CLONE_BIT) | + (1 << INTEL_ANALOG_CLONE_BIT) | + (1 << INTEL_SDVO_LVDS_CLONE_BIT); + intel_output->crtc_mask = (1 << 0) | (1 << 1); connector->interlace_allowed = 0; connector->doublescan_allowed = 0; Index: linux-2.6/drivers/gpu/drm/i915/intel_dp.c =================================================================== --- linux-2.6.orig/drivers/gpu/drm/i915/intel_dp.c 2009-08-05 16:56:38.000000000 +0800 +++ linux-2.6/drivers/gpu/drm/i915/intel_dp.c 2009-08-06 08:32:38.000000000 +0800 @@ -1254,6 +1254,18 @@ else intel_output->type = INTEL_OUTPUT_DISPLAYPORT; + if (output_reg == DP_B) + intel_output->clone_mask = (1 << INTEL_DP_B_CLONE_BIT); + else if (output_reg == DP_C) + intel_output->clone_mask = (1 << INTEL_DP_C_CLONE_BIT); + else if (output_reg == DP_D) + intel_output->clone_mask = (1 << INTEL_DP_D_CLONE_BIT); + + if (IS_eDP(intel_output)) { + intel_output->crtc_mask = (1 << 1); + intel_output->clone_mask = (1 << INTEL_OUTPUT_EDP); + } else + intel_output->crtc_mask = (1 << 0) | (1 << 1); connector->interlace_allowed = true; connector->doublescan_allowed = 0; Index: linux-2.6/drivers/gpu/drm/i915/intel_drv.h =================================================================== --- linux-2.6.orig/drivers/gpu/drm/i915/intel_drv.h 2009-08-05 16:56:38.000000000 +0800 +++ linux-2.6/drivers/gpu/drm/i915/intel_drv.h 2009-08-06 08:32:38.000000000 +0800 @@ -57,6 +57,24 @@ #define INTEL_OUTPUT_DISPLAYPORT 7 #define INTEL_OUTPUT_EDP 8 +/* Intel Pipe Clone Bit */ +#define INTEL_HDMIB_CLONE_BIT 1 +#define INTEL_HDMIC_CLONE_BIT 2 +#define INTEL_HDMID_CLONE_BIT 3 +#define INTEL_HDMIE_CLONE_BIT 4 +#define INTEL_HDMIF_CLONE_BIT 5 +#define INTEL_SDVO_NON_TV_CLONE_BIT 6 +#define INTEL_SDVO_TV_CLONE_BIT 7 +#define INTEL_SDVO_LVDS_CLONE_BIT 8 +#define INTEL_ANALOG_CLONE_BIT 9 +#define INTEL_TV_CLONE_BIT 10 +#define INTEL_DP_B_CLONE_BIT 11 +#define INTEL_DP_C_CLONE_BIT 12 +#define INTEL_DP_D_CLONE_BIT 13 +#define INTEL_LVDS_CLONE_BIT 14 +#define INTEL_DVO_TMDS_CLONE_BIT 15 +#define INTEL_DVO_LVDS_CLONE_BIT 16 + #define INTEL_DVO_CHIP_NONE 0 #define INTEL_DVO_CHIP_LVDS 1 #define INTEL_DVO_CHIP_TMDS 2 @@ -86,6 +104,8 @@ bool needs_tv_clock; void *dev_priv; void (*hot_plug)(struct intel_output *); + int crtc_mask; + int clone_mask; }; struct intel_crtc { Index: linux-2.6/drivers/gpu/drm/i915/intel_dvo.c =================================================================== --- linux-2.6.orig/drivers/gpu/drm/i915/intel_dvo.c 2009-08-05 16:56:38.000000000 +0800 +++ linux-2.6/drivers/gpu/drm/i915/intel_dvo.c 2009-08-06 08:32:38.000000000 +0800 @@ -435,14 +435,20 @@ continue; intel_output->type = INTEL_OUTPUT_DVO; + intel_output->crtc_mask = (1 << 0) | (1 << 1); switch (dvo->type) { case INTEL_DVO_CHIP_TMDS: + intel_output->clone_mask = + (1 << INTEL_DVO_TMDS_CLONE_BIT) | + (1 << INTEL_ANALOG_CLONE_BIT); drm_connector_init(dev, connector, &intel_dvo_connector_funcs, DRM_MODE_CONNECTOR_DVII); encoder_type = DRM_MODE_ENCODER_TMDS; break; case INTEL_DVO_CHIP_LVDS: + intel_output->clone_mask = + (1 << INTEL_DVO_LVDS_CLONE_BIT); drm_connector_init(dev, connector, &intel_dvo_connector_funcs, DRM_MODE_CONNECTOR_LVDS); Index: linux-2.6/drivers/gpu/drm/i915/intel_hdmi.c =================================================================== --- linux-2.6.orig/drivers/gpu/drm/i915/intel_hdmi.c 2009-08-05 16:56:38.000000000 +0800 +++ linux-2.6/drivers/gpu/drm/i915/intel_hdmi.c 2009-08-06 08:32:38.000000000 +0800 @@ -230,22 +230,28 @@ connector->interlace_allowed = 0; connector->doublescan_allowed = 0; + intel_output->crtc_mask = (1 << 0) | (1 << 1); /* Set up the DDC bus. */ - if (sdvox_reg == SDVOB) + if (sdvox_reg == SDVOB) { + intel_output->clone_mask = (1 << INTEL_HDMIB_CLONE_BIT); intel_output->ddc_bus = intel_i2c_create(dev, GPIOE, "HDMIB"); - else if (sdvox_reg == SDVOC) + } else if (sdvox_reg == SDVOC) { + intel_output->clone_mask = (1 << INTEL_HDMIC_CLONE_BIT); intel_output->ddc_bus = intel_i2c_create(dev, GPIOD, "HDMIC"); - else if (sdvox_reg == HDMIB) + } else if (sdvox_reg == HDMIB) { + intel_output->clone_mask = (1 << INTEL_HDMID_CLONE_BIT); intel_output->ddc_bus = intel_i2c_create(dev, PCH_GPIOE, "HDMIB"); - else if (sdvox_reg == HDMIC) + } else if (sdvox_reg == HDMIC) { + intel_output->clone_mask = (1 << INTEL_HDMIE_CLONE_BIT); intel_output->ddc_bus = intel_i2c_create(dev, PCH_GPIOD, "HDMIC"); - else if (sdvox_reg == HDMID) + } else if (sdvox_reg == HDMID) { + intel_output->clone_mask = (1 << INTEL_HDMIF_CLONE_BIT); intel_output->ddc_bus = intel_i2c_create(dev, PCH_GPIOF, "HDMID"); - + } if (!intel_output->ddc_bus) goto err_connector; Index: linux-2.6/drivers/gpu/drm/i915/intel_lvds.c =================================================================== --- linux-2.6.orig/drivers/gpu/drm/i915/intel_lvds.c 2009-08-05 16:56:38.000000000 +0800 +++ linux-2.6/drivers/gpu/drm/i915/intel_lvds.c 2009-08-06 08:32:38.000000000 +0800 @@ -916,6 +916,8 @@ drm_mode_connector_attach_encoder(&intel_output->base, &intel_output->enc); intel_output->type = INTEL_OUTPUT_LVDS; + intel_output->clone_mask = (1 << INTEL_LVDS_CLONE_BIT); + intel_output->crtc_mask = (1 << 1); drm_encoder_helper_add(encoder, &intel_lvds_helper_funcs); drm_connector_helper_add(connector, &intel_lvds_connector_helper_funcs); connector->display_info.subpixel_order = SubPixelHorizontalRGB; Index: linux-2.6/drivers/gpu/drm/i915/intel_tv.c =================================================================== --- linux-2.6.orig/drivers/gpu/drm/i915/intel_tv.c 2009-08-05 16:56:38.000000000 +0800 +++ linux-2.6/drivers/gpu/drm/i915/intel_tv.c 2009-08-06 08:32:38.000000000 +0800 @@ -1718,6 +1718,7 @@ if (!intel_output) { return; } + connector = &intel_output->base; drm_connector_init(dev, connector, &intel_tv_connector_funcs, @@ -1729,6 +1730,7 @@ drm_mode_connector_attach_encoder(&intel_output->base, &intel_output->enc); tv_priv = (struct intel_tv_priv *)(intel_output + 1); intel_output->type = INTEL_OUTPUT_TVOUT; + intel_output->clone_mask = (1 << INTEL_TV_CLONE_BIT); intel_output->enc.possible_crtcs = ((1 << 0) | (1 << 1)); intel_output->enc.possible_clones = (1 << INTEL_OUTPUT_TVOUT); intel_output->dev_priv = tv_priv; Index: linux-2.6/drivers/gpu/drm/i915/intel_display.c =================================================================== --- linux-2.6.orig/drivers/gpu/drm/i915/intel_display.c 2009-08-06 08:32:25.000000000 +0800 +++ linux-2.6/drivers/gpu/drm/i915/intel_display.c 2009-08-06 08:32:38.000000000 +0800 @@ -3170,7 +3170,7 @@ list_for_each_entry(connector, &dev->mode_config.connector_list, head) { struct intel_output *intel_output = to_intel_output(connector); - if (type_mask & (1 << intel_output->type)) + if (type_mask & intel_output->clone_mask) index_mask |= (1 << entry); entry++; } @@ -3253,51 +3253,10 @@ list_for_each_entry(connector, &dev->mode_config.connector_list, head) { struct intel_output *intel_output = to_intel_output(connector); struct drm_encoder *encoder = &intel_output->enc; - int crtc_mask = 0, clone_mask = 0; - /* valid crtcs */ - switch(intel_output->type) { - case INTEL_OUTPUT_HDMI: - crtc_mask = ((1 << 0)| - (1 << 1)); - clone_mask = ((1 << INTEL_OUTPUT_HDMI)); - break; - case INTEL_OUTPUT_DVO: - case INTEL_OUTPUT_SDVO: - crtc_mask = ((1 << 0)| - (1 << 1)); - clone_mask = ((1 << INTEL_OUTPUT_ANALOG) | - (1 << INTEL_OUTPUT_DVO) | - (1 << INTEL_OUTPUT_SDVO)); - break; - case INTEL_OUTPUT_ANALOG: - crtc_mask = ((1 << 0)| - (1 << 1)); - clone_mask = ((1 << INTEL_OUTPUT_ANALOG) | - (1 << INTEL_OUTPUT_DVO) | - (1 << INTEL_OUTPUT_SDVO)); - break; - case INTEL_OUTPUT_LVDS: - crtc_mask = (1 << 1); - clone_mask = (1 << INTEL_OUTPUT_LVDS); - break; - case INTEL_OUTPUT_TVOUT: - crtc_mask = ((1 << 0) | - (1 << 1)); - clone_mask = (1 << INTEL_OUTPUT_TVOUT); - break; - case INTEL_OUTPUT_DISPLAYPORT: - crtc_mask = ((1 << 0) | - (1 << 1)); - clone_mask = (1 << INTEL_OUTPUT_DISPLAYPORT); - break; - case INTEL_OUTPUT_EDP: - crtc_mask = (1 << 1); - clone_mask = (1 << INTEL_OUTPUT_EDP); - break; - } - encoder->possible_crtcs = crtc_mask; - encoder->possible_clones = intel_connector_clones(dev, clone_mask); + encoder->possible_crtcs = intel_output->crtc_mask; + encoder->possible_clones = intel_connector_clones(dev, + intel_output->clone_mask); } } Index: linux-2.6/drivers/gpu/drm/i915/intel_sdvo.c =================================================================== --- linux-2.6.orig/drivers/gpu/drm/i915/intel_sdvo.c 2009-08-05 16:56:38.000000000 +0800 +++ linux-2.6/drivers/gpu/drm/i915/intel_sdvo.c 2009-08-06 08:32:38.000000000 +0800 @@ -1967,6 +1967,9 @@ intel_sdvo_set_colorimetry(intel_output, SDVO_COLORIMETRY_RGB256); connector->connector_type = DRM_MODE_CONNECTOR_HDMIA; + intel_output->clone_mask = + (1 << INTEL_SDVO_NON_TV_CLONE_BIT) | + (1 << INTEL_ANALOG_CLONE_BIT); } } else if (flags & SDVO_OUTPUT_SVID0) { @@ -1975,11 +1978,14 @@ connector->connector_type = DRM_MODE_CONNECTOR_SVIDEO; sdvo_priv->is_tv = true; intel_output->needs_tv_clock = true; + intel_output->clone_mask = 1 << INTEL_SDVO_TV_CLONE_BIT; } else if (flags & SDVO_OUTPUT_RGB0) { sdvo_priv->controlled_output = SDVO_OUTPUT_RGB0; encoder->encoder_type = DRM_MODE_ENCODER_DAC; connector->connector_type = DRM_MODE_CONNECTOR_VGA; + intel_output->clone_mask = (1 << INTEL_SDVO_NON_TV_CLONE_BIT) | + (1 << INTEL_ANALOG_CLONE_BIT); } else if (flags & SDVO_OUTPUT_RGB1) { sdvo_priv->controlled_output = SDVO_OUTPUT_RGB1; @@ -1991,12 +1997,16 @@ encoder->encoder_type = DRM_MODE_ENCODER_LVDS; connector->connector_type = DRM_MODE_CONNECTOR_LVDS; sdvo_priv->is_lvds = true; + intel_output->clone_mask = (1 << INTEL_ANALOG_CLONE_BIT) | + (1 << INTEL_SDVO_LVDS_CLONE_BIT); } else if (flags & SDVO_OUTPUT_LVDS1) { sdvo_priv->controlled_output = SDVO_OUTPUT_LVDS1; encoder->encoder_type = DRM_MODE_ENCODER_LVDS; connector->connector_type = DRM_MODE_CONNECTOR_LVDS; sdvo_priv->is_lvds = true; + intel_output->clone_mask = (1 << INTEL_ANALOG_CLONE_BIT) | + (1 << INTEL_SDVO_LVDS_CLONE_BIT); } else { unsigned char bytes[2]; @@ -2009,6 +2019,7 @@ bytes[0], bytes[1]); ret = false; } + intel_output->crtc_mask = (1 << 0) | (1 << 1); if (ret && registered) ret = drm_sysfs_connector_add(connector) == 0 ? true : false;