From patchwork Fri Apr 26 10:50:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Kleiner X-Patchwork-Id: 10919023 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4862B92A for ; Fri, 26 Apr 2019 10:51:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3645F28DF6 for ; Fri, 26 Apr 2019 10:51:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 270E828DFA; Fri, 26 Apr 2019 10:51:03 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,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 D447D28DFA for ; Fri, 26 Apr 2019 10:51:02 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5FA7889226; Fri, 26 Apr 2019 10:51:01 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) by gabe.freedesktop.org (Postfix) with ESMTPS id 035328921A; Fri, 26 Apr 2019 10:51:00 +0000 (UTC) Received: by mail-wm1-x342.google.com with SMTP id h18so3756917wml.1; Fri, 26 Apr 2019 03:50:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=8UYZB4FXzLEMZ4nLNMup+ABlWt/sOs7nMPhx300ztGc=; b=mNkEA1JRBgf2E5jvDUMhqv5ts4dFDLfA95t1o4WRrfSR+1mLJw2RYeOCPkClKEEy7z AR8MDGUkxAO524lK2Bf81glIiW8Xuhtva+7NJTE23bkN+SIMcAE5bRMSc5fuLwcOgLZs LOhVi0XHAMQPQD33OjdMWmlF5bjCVzNgBqxtmJCdpTC6Y1jKzZ+RjL7uDomQ1NZ3upwH Krb9Jp/mHwm4uP3NN248tNFe2+acN6WKSd2EPs+hyCla4kjWo69hMFyKp4Y1HgDsFUZM FeBYuEfFItnd6pmo0oLcqrb0kKGv/Ddjm0QY7kpfqmcOnlYmEKZfhJeAFWfX5m7tmRcN BZeg== X-Gm-Message-State: APjAAAVwGZfm/M2VxXDeNe6lsHKmoVNbcVLjARpn5P3KEpGRJW8f5S9/ mzMRoWXcKPiISIYul0Sb6MXJEcN8 X-Google-Smtp-Source: APXvYqzU2Q+syvv+T0SdHTHtxuoVB3QQu8OQoQqRaqFUD5c6W2JwJKLjZquJfDoalgooq5w9CgPqxA== X-Received: by 2002:a1c:6c17:: with SMTP id h23mr7144667wmc.122.1556275858540; Fri, 26 Apr 2019 03:50:58 -0700 (PDT) Received: from twisty.localdomain ([2a01:c22:c870:100:55b4:804e:196c:cde9]) by smtp.gmail.com with ESMTPSA id f128sm31201538wme.28.2019.04.26.03.50.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Apr 2019 03:50:58 -0700 (PDT) From: Mario Kleiner To: amd-gfx@lists.freedesktop.org Subject: [PATCH 1/3] drm/amd/display: Fix and simplify apply_below_the_range() Date: Fri, 26 Apr 2019 12:50:14 +0200 Message-Id: <20190426105016.12210-2-mario.kleiner.de@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190426105016.12210-1-mario.kleiner.de@gmail.com> References: <20190426105016.12210-1-mario.kleiner.de@gmail.com> X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=8UYZB4FXzLEMZ4nLNMup+ABlWt/sOs7nMPhx300ztGc=; b=EvhqbSdsX0MJFoaJ9GtVb/0zAgj2lAho7/5BMMLCC6AsSZinkmC7+QRF952VvcGWvB 41JHwkqLawRrbqSRcZl/ce2DCn4tIPrPmNxIunmTMdDOCjYrIMlU1E2vSPaYat82fp5O tC0U3xpSJA10IWkwAiox2fgeK8Klb/pu9HDxYzoZEl/cvIUduZKiD3iFHLupLOzsq6bH 3Ou8sh+Rw7DitOseOS8xBcDf3mApLFDx3izu6pXLBYEPKLAQF6/H6jAv1VC+Yjq5gFeE 3+wubcQuJZcUztmis4zem8Lxj/BlHkHJlZ8D4QzIw6FabT19LomwcXxww3XyK8xcyjf8 9/1w== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: nicholas.kazlauskas@amd.com, dri-devel@lists.freedesktop.org MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP The comparison of inserted_frame_duration_in_us against a duration calculated from max_refresh_in_uhz is both wrong in its math and not needed, as the min_duration_in_us value is already cached in in_out_vrr for reuse. No need to recalculate it wrongly at each invocation. Signed-off-by: Mario Kleiner Reviewed-by: Nicholas Kazlauskas --- drivers/gpu/drm/amd/display/modules/freesync/freesync.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/amd/display/modules/freesync/freesync.c b/drivers/gpu/drm/amd/display/modules/freesync/freesync.c index 71274683da04..e56543c36eba 100644 --- a/drivers/gpu/drm/amd/display/modules/freesync/freesync.c +++ b/drivers/gpu/drm/amd/display/modules/freesync/freesync.c @@ -437,10 +437,8 @@ static void apply_below_the_range(struct core_freesync *core_freesync, inserted_frame_duration_in_us = last_render_time_in_us / frames_to_insert; - if (inserted_frame_duration_in_us < - (1000000 / in_out_vrr->max_refresh_in_uhz)) - inserted_frame_duration_in_us = - (1000000 / in_out_vrr->max_refresh_in_uhz); + if (inserted_frame_duration_in_us < in_out_vrr->min_duration_in_us) + inserted_frame_duration_in_us = in_out_vrr->min_duration_in_us; /* Cache the calculated variables */ in_out_vrr->btr.inserted_duration_in_us =