From patchwork Mon Aug 10 07:26:09 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhang, Xiong Y" X-Patchwork-Id: 6980251 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 38F4FC05AC for ; Mon, 10 Aug 2015 07:20:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3755A206AA for ; Mon, 10 Aug 2015 07:20:03 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 2C5862062A for ; Mon, 10 Aug 2015 07:20:02 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 998FF6E205; Mon, 10 Aug 2015 00:20:01 -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 985FE6E205 for ; Mon, 10 Aug 2015 00:19:59 -0700 (PDT) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 10 Aug 2015 00:20:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,643,1432623600"; d="scan'208";a="780299300" Received: from panda-dev.bj.intel.com ([10.238.154.59]) by fmsmga002.fm.intel.com with ESMTP; 10 Aug 2015 00:19:58 -0700 From: Xiong Zhang To: intel-gfx@lists.freedesktop.org Date: Mon, 10 Aug 2015 15:26:09 +0800 Message-Id: <1439191571-25847-2-git-send-email-xiong.y.zhang@intel.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1439191571-25847-1-git-send-email-xiong.y.zhang@intel.com> References: <1439191571-25847-1-git-send-email-xiong.y.zhang@intel.com> Subject: [Intel-gfx] [PATCH 2/4] drm/i915: Adding Panel Filter function for DP X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 Only internal eDP, LVDS, DVI screen could set scalling mode, some customers need to set scalling mode for external DP, HDMI, VGA screen. Let's fulfill this. bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90989 Signed-off-by: Xiong Zhang --- drivers/gpu/drm/i915/intel_dp.c | 63 ++++++++++++++++++++++++++++------------- 1 file changed, 44 insertions(+), 19 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index f1b9f93..2da334b 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c @@ -207,7 +207,13 @@ intel_dp_mode_valid(struct drm_connector *connector, int target_clock = mode->clock; int max_rate, mode_rate, max_lanes, max_link_clock; - if (is_edp(intel_dp) && fixed_mode) { + if (mode->clock < 10000) + return MODE_CLOCK_LOW; + + if (mode->flags & DRM_MODE_FLAG_DBLCLK) + return MODE_H_ILLEGAL; + + if (!intel_panel_scale_none(&intel_connector->panel)) { if (mode->hdisplay > fixed_mode->hdisplay) return MODE_PANEL; @@ -226,12 +232,6 @@ intel_dp_mode_valid(struct drm_connector *connector, if (mode_rate > max_rate) return MODE_CLOCK_HIGH; - if (mode->clock < 10000) - return MODE_CLOCK_LOW; - - if (mode->flags & DRM_MODE_FLAG_DBLCLK) - return MODE_H_ILLEGAL; - return MODE_OK; } @@ -1378,7 +1378,7 @@ intel_dp_compute_config(struct intel_encoder *encoder, pipe_config->has_drrs = false; pipe_config->has_audio = intel_dp->has_audio && port != PORT_A; - if (is_edp(intel_dp) && intel_connector->panel.fixed_mode) { + if (!intel_panel_scale_none(&intel_connector->panel)) { intel_fixed_panel_mode(intel_connector->panel.fixed_mode, adjusted_mode); @@ -4592,6 +4592,23 @@ static int intel_dp_get_modes(struct drm_connector *connector) edid = intel_connector->detect_edid; if (edid) { int ret = intel_connector_update_modes(connector, edid); + + if (ret && intel_connector->panel.fixed_mode == NULL) { + /* init fixed mode as preferred mode for DP */ + struct drm_display_mode *fixed_mode = NULL; + struct drm_display_mode *scan; + + list_for_each_entry(scan, &connector->probed_modes, head) { + if (scan->type & DRM_MODE_TYPE_PREFERRED) + fixed_mode = drm_mode_duplicate(connector->dev, + scan); + } + + if (fixed_mode) + intel_panel_init(&intel_connector->panel, + fixed_mode, NULL); + } + if (ret) return ret; } @@ -4688,15 +4705,14 @@ intel_dp_set_property(struct drm_connector *connector, goto done; } - if (is_edp(intel_dp) && - property == connector->dev->mode_config.scaling_mode_property) { - if (val == DRM_MODE_SCALE_NONE) { - DRM_DEBUG_KMS("no scaling not supported\n"); + if (property == connector->dev->mode_config.scaling_mode_property) { + if (is_edp(intel_dp) && val == DRM_MODE_SCALE_NONE) { + DRM_DEBUG_KMS("eDP: no scaling not supported\n"); return -EINVAL; } if (intel_connector->panel.fitting_mode == val) { - /* the eDP scaling property is not changed */ + /* the connector scaling property is not changed */ return 0; } intel_connector->panel.fitting_mode = val; @@ -4989,13 +5005,22 @@ intel_dp_add_properties(struct intel_dp *intel_dp, struct drm_connector *connect intel_attach_broadcast_rgb_property(connector); intel_dp->color_range_auto = true; - if (is_edp(intel_dp)) { + /* Each pipe has panel filter since Ironlake. */ + if (INTEL_INFO(connector->dev)->gen >= 5) { drm_mode_create_scaling_mode_property(connector->dev); - drm_object_attach_property( - &connector->base, - connector->dev->mode_config.scaling_mode_property, - DRM_MODE_SCALE_ASPECT); - intel_connector->panel.fitting_mode = DRM_MODE_SCALE_ASPECT; + if (is_edp(intel_dp)) { + drm_object_attach_property( + &connector->base, + connector->dev->mode_config.scaling_mode_property, + DRM_MODE_SCALE_ASPECT); + intel_connector->panel.fitting_mode = DRM_MODE_SCALE_ASPECT; + } else { + drm_object_attach_property( + &connector->base, + connector->dev->mode_config.scaling_mode_property, + DRM_MODE_SCALE_NONE); + intel_connector->panel.fitting_mode = DRM_MODE_SCALE_NONE; + } } }