From patchwork Tue Aug 14 04:34:48 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Keith Packard X-Patchwork-Id: 1317931 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork1.kernel.org (Postfix) with ESMTP id D317D3FD8C for ; Tue, 14 Aug 2012 04:34:58 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B6821A0300 for ; Mon, 13 Aug 2012 21:34:58 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from keithp.com (home.keithp.com [63.227.221.253]) by gabe.freedesktop.org (Postfix) with ESMTP id 8AFEC9E77F; Mon, 13 Aug 2012 21:34:42 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by keithp.com (Postfix) with ESMTP id 4DCF6BF423D; Mon, 13 Aug 2012 21:34:42 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at keithp.com Received: from keithp.com ([127.0.0.1]) by localhost (keithp.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id kJHVDmYMJ+kG; Mon, 13 Aug 2012 21:34:38 -0700 (PDT) Received: by keithp.com (Postfix, from userid 1033) id 23E6776021D; Mon, 13 Aug 2012 21:34:38 -0700 (PDT) Received: from miki.keithp.com (localhost [127.0.0.1]) by keithp.com (Postfix) with ESMTP id 17059760215; Mon, 13 Aug 2012 21:34:38 -0700 (PDT) Received: by miki.keithp.com (Postfix, from userid 1001) id 695E72F77; Mon, 13 Aug 2012 21:34:56 -0700 (PDT) From: Keith Packard To: intel-gfx@lists.freedesktop.org, Daniel Vetter Subject: [PATCH 4/7] drm/i915: Check display_bpc against max_fdi_bpp after display_bpc is set Date: Mon, 13 Aug 2012 21:34:48 -0700 Message-Id: <1344918891-6283-5-git-send-email-keithp@keithp.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1344918891-6283-1-git-send-email-keithp@keithp.com> References: <1344918891-6283-1-git-send-email-keithp@keithp.com> Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org display_bpc might not have been set before comparing with the requested mode, so wait until afterwards before comparing with the supported fdi bandwidth. Not a significant change as any case that mattered would have worked; this just makes the debug messages look nicer. Signed-off-by: Keith Packard --- drivers/gpu/drm/i915/intel_display.c | 39 ++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 95248bd..b099a17 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -3804,15 +3804,6 @@ static bool intel_choose_pipe_bpp_dither(struct drm_crtc *crtc, display_bpc = 6; } - if (display_bpc * 3 > max_fdi_bpp) { - if (max_fdi_bpp < 24) - display_bpc = 6; - else if (max_fdi_bpp < 30) - display_bpc = 8; - else if (max_fdi_bpp < 36) - display_bpc = 10; - DRM_DEBUG_KMS("Dithering FDI to %dbpc\n", display_bpc); - } /* * We could just drive the pipe at the highest bpc all the time and * enable dithering as needed, but that costs bandwidth. So choose @@ -3845,8 +3836,20 @@ static bool intel_choose_pipe_bpp_dither(struct drm_crtc *crtc, display_bpc = min(display_bpc, bpc); - DRM_DEBUG_KMS("setting pipe bpc to %d (max display bpc %d)\n", - bpc, display_bpc); + display_bpc = 6; + + if (display_bpc * 3 > max_fdi_bpp) { + if (max_fdi_bpp < 24) + display_bpc = 6; + else if (max_fdi_bpp < 30) + display_bpc = 8; + else if (max_fdi_bpp < 36) + display_bpc = 10; + DRM_DEBUG_KMS("Dithering FDI to %dbpc\n", display_bpc); + } + + DRM_DEBUG_KMS("setting pipe bpc to %d (max display bpc %d) (max_fdi_bpp %d)\n", + bpc, display_bpc, max_fdi_bpp); *pipe_bpp = display_bpc * 3; @@ -4737,8 +4740,7 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc, max_fdi_bpp = 0; max_lane = lane; } else { - u32 fdi_bw; - + u32 fdi_bw, pps; /* [e]DP over FDI requires target mode clock instead of link clock */ if (is_dp) @@ -4763,9 +4765,12 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc, * Compute the available FDI bandwidth, use that * to compute the maximum supported BPP */ - fdi_bw = link_bw * max_lane * 19 / 20; - max_fdi_bpp = fdi_bw / target_clock; - DRM_DEBUG_KMS("max lane %d yields max fdi bpp %d\n", max_lane, max_fdi_bpp); + fdi_bw = (link_bw * 8) * max_lane; + pps = target_clock * 21 / 20; + + max_fdi_bpp = fdi_bw / pps; + DRM_DEBUG_KMS("link_bw %d max_lane %d fdi_bw %u pps %u max_fdi_bpp %d\n", + link_bw, max_lane, fdi_bw, pps, max_fdi_bpp); } /* [e]DP over FDI requires target mode clock instead of link clock. */ @@ -4809,6 +4814,8 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc, */ u32 bps = target_clock * pipe_bpp * 21 / 20; lane = bps / (link_bw * 8) + 1; + DRM_DEBUG_KMS("target_clock %u pipe_bpp %u bps %u link_bw %u lane %u\n", + target_clock, pipe_bpp, bps, link_bw, lane); if (lane > max_lane) { DRM_ERROR("Not enough lanes available for mode! (want %d have %d)\n", lane, max_lane);