From patchwork Wed Jul 6 10:05:47 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mario Kleiner X-Patchwork-Id: 9216021 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 D425A60752 for ; Wed, 6 Jul 2016 10:06:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C52F6287CB for ; Wed, 6 Jul 2016 10:06:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B9EC5287EB; Wed, 6 Jul 2016 10:06:35 +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.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4899D287CB for ; Wed, 6 Jul 2016 10:06:35 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 294ED6E0F2; Wed, 6 Jul 2016 10:06:34 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm0-x243.google.com (mail-wm0-x243.google.com [IPv6:2a00:1450:400c:c09::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id 92A0F6E615 for ; Wed, 6 Jul 2016 10:06:32 +0000 (UTC) Received: by mail-wm0-x243.google.com with SMTP id a66so34471048wme.2 for ; Wed, 06 Jul 2016 03:06:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=SYsy6apDA1vCLioA/1THQoWCnHdYfViTS6BzoIFGF2E=; b=KxIBdGLeCP086VZhhPQfVwUHxMFSWCPAKAnngjLEc4MskH1lBWXtEDWlbj40q6aum4 gfq23H+aNiAs03BR21c5GCFHSuOiDNOzBzG/Cs+LfkRhenX/nMqzRYlMv6zWXLeW/6M+ bFPCMQsgBZqDIABFOMLInOMt5aP3hiAtmo3kUICMVTPzjSfD9B9R2HiG/VFvaQYfwMD6 n1ctZJyn2S1cz67ZTAvmZDnwc7wc1Z2Mm1tkhw1uB9YrgsKihjW4h6T1L0Fjc2Ulh5Hn cJIFdIlohUN9qwyud9E3movRB/8JjdzhNyoMHb617o6EEZou+15DrX9rcn8teUuQsw2m /QmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=SYsy6apDA1vCLioA/1THQoWCnHdYfViTS6BzoIFGF2E=; b=KdJHNQpVxds3flmgG/WAsGqUeOEQ6DkqG/HtUNeDJjU0szhCdbelR/HQwtuyK4lN4c vZSQjzLmn/41PIotXc8wXWx2qq3eX5DjnlmkPIXNVHHieQoDMJnq1feLPiJYAIhiWJhr sksexgJa1xfgM0IcY2lj0ksL1s7sIAoiSnHcDxxTjcq0PwIIVUKBY3H/Xslvyd1jfZjE iNSC7GOI0u1T1wOGNdBBjM/z9uYuJ4xUHAJZsXOS9CadyuwwurhMJF9GYh5BF+fcI9oe gt4J+UL5zM4tdE8UcSplGGsyegdfLnqI3fael5usFjMc11UwY1SK8Y0YTyYrA2VLj5Do SdYw== X-Gm-Message-State: ALyK8tJw41RUobGQEQcFc7zordcj6s+cVCRuBj9dKCgPF1rxVWqz6b7HIJE2aKApL6+7Iw== X-Received: by 10.194.220.234 with SMTP id pz10mr10201838wjc.142.1467799591088; Wed, 06 Jul 2016 03:06:31 -0700 (PDT) Received: from twisty.fritz.box (x4d02cd4b.dyn.telefonica.de. [77.2.205.75]) by smtp.gmail.com with ESMTPSA id ze10sm2261276wjb.2.2016.07.06.03.06.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 06 Jul 2016 03:06:30 -0700 (PDT) From: Mario Kleiner To: dri-devel@lists.freedesktop.org Subject: [PATCH 4/5] drm/intel/dp: Try harder to get bpc of a DP sink if EDID doesn't tell. Date: Wed, 6 Jul 2016 12:05:47 +0200 Message-Id: <1467799548-13229-5-git-send-email-mario.kleiner.de@gmail.com> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1467799548-13229-1-git-send-email-mario.kleiner.de@gmail.com> References: <1467799548-13229-1-git-send-email-mario.kleiner.de@gmail.com> MIME-Version: 1.0 Cc: Jani Nikula , Daniel Vetter X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP For DP sinks which don't expose color depth via EDID, use the drm_dp_sink_bpc() helper to derive the bpc of the sink. This should handle DP native sinks with the "Assume 6 bpc if EDID doesn't tell us" as mandated by DP spec. It gives more accurate values for DP->legacy converters for HDMI, DVI and VGA. Signed-off-by: Mario Kleiner Cc: Ville Syrjälä Cc: Daniel Vetter Cc: Jani Nikula --- drivers/gpu/drm/i915/intel_display.c | 26 +++++++++++++++++++++----- drivers/gpu/drm/i915/intel_dp.c | 7 +++++++ drivers/gpu/drm/i915/intel_drv.h | 1 + 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index c7854f4..1a5287f 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -12212,11 +12212,27 @@ connected_sink_compute_bpp(struct intel_connector *connector, pipe_config->pipe_bpp = connector->base.display_info.bpc*3; } - /* Clamp bpp to 8 on screens without EDID 1.4 */ - if (connector->base.display_info.bpc == 0 && bpp > 24) { - DRM_DEBUG_KMS("clamping display bpp (was %d) to default limit of 24\n", - bpp); - pipe_config->pipe_bpp = 24; + /* Clamp bpp to default limit on screens without EDID 1.4 */ + if (connector->base.display_info.bpc == 0) { + int type = connector->base.connector_type; + int clamp_bpp = 24; + + /* On DisplayPort try harder to find sink bpc */ + if (type == DRM_MODE_CONNECTOR_DisplayPort || + type == DRM_MODE_CONNECTOR_eDP) { + int sink_bpc = intel_dp_sink_bpc(&connector->base); + + if (sink_bpc) { + DRM_DEBUG_KMS("DP sink with bpc %d\n", sink_bpc); + clamp_bpp = 3 * sink_bpc; + } + } + + if (bpp > clamp_bpp) { + DRM_DEBUG_KMS("clamping display bpp (was %d) to default limit of %d\n", + bpp, clamp_bpp); + pipe_config->pipe_bpp = clamp_bpp; + } } } diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index ffa43ec..d8dab0b 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c @@ -5689,3 +5689,10 @@ void intel_dp_mst_resume(struct drm_device *dev) } } } + +/* XXX Only supports up to 1 downstream port atm. */ +int intel_dp_sink_bpc(struct drm_connector *connector) +{ + struct intel_dp *intel_dp = intel_attached_dp(connector); + return drm_dp_sink_bpc(intel_dp->dpcd, intel_dp->downstream_ports, 0); +} diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 089a425..e8feac1 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h @@ -1335,6 +1335,7 @@ void intel_edp_panel_off(struct intel_dp *intel_dp); void intel_dp_add_properties(struct intel_dp *intel_dp, struct drm_connector *connector); void intel_dp_mst_suspend(struct drm_device *dev); void intel_dp_mst_resume(struct drm_device *dev); +int intel_dp_sink_bpc(struct drm_connector *connector); int intel_dp_max_link_rate(struct intel_dp *intel_dp); int intel_dp_rate_select(struct intel_dp *intel_dp, int rate); void intel_dp_hot_plug(struct intel_encoder *intel_encoder);