From patchwork Fri Aug 12 21:00:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Srivatsa, Anusha" X-Patchwork-Id: 9277949 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A772F60780 for ; Fri, 12 Aug 2016 21:04:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8B37A28AF3 for ; Fri, 12 Aug 2016 21:04:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7C35E28AF1; Fri, 12 Aug 2016 21:04:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 07A0E28AF1 for ; Fri, 12 Aug 2016 21:04:45 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 95BF66EC40; Fri, 12 Aug 2016 21:04:44 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTP id 2FBBC6EC40 for ; Fri, 12 Aug 2016 21:04:43 +0000 (UTC) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP; 12 Aug 2016 14:04:44 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.28,512,1464678000"; d="scan'208"; a="1013456084" Received: from anusha.jf.intel.com ([10.7.198.61]) by orsmga001.jf.intel.com with ESMTP; 12 Aug 2016 14:04:43 -0700 From: Anusha Srivatsa To: intel-gfx@lists.freedesktop.org Date: Fri, 12 Aug 2016 14:00:46 -0700 Message-Id: <1471035647-5384-1-git-send-email-anusha.srivatsa@intel.com> X-Mailer: git-send-email 2.7.4 Cc: dhinakaran.pandiyan@intel.com Subject: [Intel-gfx] [PATCH v2 1/2] drm/i915/mst: Validate modes against available link bandwidth 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-Virus-Scanned: ClamAV using ClamSMTP Validate the modes against available link bandwidth rather than maximum link bandwidth so that we have a better idea as to whether a proposed mode can truly run beside existing stream. v2: Put the Signed-off to the end of the commit message Cc: dhinakaran.pandiyan@intel.com Signed-off-by: Anusha Srivatsa --- drivers/gpu/drm/i915/intel_dp_mst.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c b/drivers/gpu/drm/i915/intel_dp_mst.c index 629337d..e7e87d7 100644 --- a/drivers/gpu/drm/i915/intel_dp_mst.c +++ b/drivers/gpu/drm/i915/intel_dp_mst.c @@ -352,13 +352,23 @@ static enum drm_mode_status intel_dp_mst_mode_valid(struct drm_connector *connector, struct drm_display_mode *mode) { + int req_pbn = 0; + int avail_pbn = 0; + struct intel_connector *intel_connector = to_intel_connector(connector); + struct intel_dp *intel_dp = intel_connector->mst_port; + struct drm_dp_mst_topology_mgr *mgr = &intel_dp->mst_mgr; + struct drm_dp_mst_port *port = (struct drm_dp_mst_port *) (intel_connector->port); int max_dotclk = to_i915(connector->dev)->max_dotclk_freq; - /* TODO - validate mode against available PBN for link */ + avail_pbn = drm_dp_mst_get_avail_pbn(mgr, port); + req_pbn = drm_dp_calc_pbn_mode(mode->clock, 24); + if (req_pbn > avail_pbn) + return MODE_H_ILLEGAL; + if (mode->clock < 10000) return MODE_CLOCK_LOW; - if (mode->flags & DRM_MODE_FLAG_DBLCLK) + if (mode->flags & DRM_MODE_FLAG_DBLCLK) return MODE_H_ILLEGAL; if (mode->clock > max_dotclk)