From patchwork Mon Jul 17 10:31:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maarten Lankhorst X-Patchwork-Id: 9844463 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 0439C60212 for ; Mon, 17 Jul 2017 10:31:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EA01727FB3 for ; Mon, 17 Jul 2017 10:31:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DEF9A27FB7; Mon, 17 Jul 2017 10:31:31 +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=unavailable 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 AB49B27FB3 for ; Mon, 17 Jul 2017 10:31:31 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 999C06E1D8; Mon, 17 Jul 2017 10:31:29 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by gabe.freedesktop.org (Postfix) with ESMTPS id B0D096E1AE; Mon, 17 Jul 2017 10:31:28 +0000 (UTC) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Jul 2017 03:31:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.40,374,1496127600"; d="scan'208";a="879654705" Received: from xhallade-desk.ger.corp.intel.com (HELO patser.lan) ([10.252.44.160]) by FMSMGA003.fm.intel.com with ESMTP; 17 Jul 2017 03:31:25 -0700 To: Mahesh Kumar , Jani Nikula , David Binderman , "daniel.vetter@intel.com" , "intel-gfx@lists.freedesktop.org" , "dri-devel@lists.freedesktop.org" References: <878tjnjsq2.fsf@nikula.org> <4299ba3e-1a63-392d-021c-020c094ddc70@intel.com> From: Maarten Lankhorst Message-ID: Date: Mon, 17 Jul 2017 12:31:25 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <4299ba3e-1a63-392d-021c-020c094ddc70@intel.com> Content-Language: en-US Subject: Re: [Intel-gfx] drivers/gpu/drm/i915/intel_pm.c:4467: bad comparison ? 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: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP Op 17-07-17 om 12:32 schreef Mahesh Kumar: > Hi, > > > On Monday 17 July 2017 03:22 PM, Jani Nikula wrote: >> On Mon, 17 Jul 2017, David Binderman wrote: >>> Hello there, >> Hello. No need to include LKML for stuff like this. But Cc'd the folks >> from the broken commit. >> >>> drivers/gpu/drm/i915/intel_pm.c:4467]: (warning) Comparison of a boolean expression with an integer other than 0 or 1. >>> >>> Source code is >>> >>> else if ((ddb_allocation && ddb_allocation / >>> fixed_16_16_to_u32_round_up(plane_blocks_per_line)) >= 1) > ddb_allocation being integer was intentional. > Other than that code has improper parentheses as well. > intention was if ddb_allocation is not 0 & (ddb_allocation / plane_blocks_per_line >= 1) then execute the condition. > it should have been > else if (ddb_allocation && (ddb_allocation / fixed_16_16_to_u32_round_up(plane_blocks_per_line) >= 1)) > > will post a fix. > > thanks. > > -Mahesh >> Broken by >> >> commit d555cb5827d603244969e08444340e3db78c8a37 >> Author: Kumar, Mahesh >> Date: Wed May 17 17:28:29 2017 +0530 >> >> drm/i915/skl+: use linetime latency if ddb size is not available >> >> The broken code has since been removed by bb9d85f6e9de ("drm/i915/skl: >> New ddb allocation algorithm") but restored by 9a30a26122c3 ("Revert >> "drm/i915/skl: New ddb allocation algorithm""). *sigh*. >> >> Mahesh et al, please figure it out. >> >> >> BR, >> Jani. >> >> > Would this work? diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c index 78b9acfc64c0..b9b3d8d45016 100644 --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c @@ -4681,8 +4681,8 @@ static int skl_compute_plane_wm(const struct drm_i915_private *dev_priv, if ((cpp * cstate->base.adjusted_mode.crtc_htotal / 512 < 1) && (plane_bytes_per_line / 512 < 1)) selected_result = method2; - else if ((ddb_allocation && ddb_allocation / - fixed_16_16_to_u32_round_up(plane_blocks_per_line)) >= 1) + else if (ddb_allocation >= + fixed_16_16_to_u32_round_up(plane_blocks_per_line)) selected_result = min_fixed_16_16(method1, method2); else if (latency >= linetime_us) selected_result = min_fixed_16_16(method1, method2);