From patchwork Thu Apr 18 03:51:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Kleiner X-Patchwork-Id: 10906463 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 16FAF18FD for ; Thu, 18 Apr 2019 03:51:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 00A9028BDD for ; Thu, 18 Apr 2019 03:51:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E925C28BE5; Thu, 18 Apr 2019 03:51:55 +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 A9E0D28BDD for ; Thu, 18 Apr 2019 03:51:55 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7B3276E0BE; Thu, 18 Apr 2019 03:51:53 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by gabe.freedesktop.org (Postfix) with ESMTPS id 27DE76E0BD; Thu, 18 Apr 2019 03:51:51 +0000 (UTC) Received: by mail-wr1-x442.google.com with SMTP id f14so459481wrj.5; Wed, 17 Apr 2019 20:51:51 -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=3CyfB0mw/wqAd1bq2GO9R/cFbPVKQ2dzKueWsobLosk=; b=WX8drCqmaGc7StaulS3zR6NjDVDHc8lrABtJVpIwzZBkKiCKlPPDj4qAbLSDX70Edx TstuWgF2zj7LbVEYWgFeiM6KbgL8BhAUMsIPuO5wDTMjIzWNk7CoAYXhNgnJxmk4pJgg XlDjoCMivNvOVnJIagvi6FxLTkSvmPAtmwpBVN5/mUrPnVmtrb5kTi8bQSXd47qjbMq4 rVylS2Q+WCpW0oQVF9YCiba+D45GM32j6HFgK34L8kW1VbErljYta2I8/cgxndEJSiNZ DaXlAEiMnTpP/As1a8hNw8Z0V75zWiaVe6TRin6VQKebym24f0yLP85h2z9x0H56yuAZ zTuw== X-Gm-Message-State: APjAAAUoTiZFPKnCIThPk+VWodXta9Xcj7I8vfVJvZTE78iQINgdz2kV OoeXKK9doo1fLYIloYg/WKlyoxQ+ X-Google-Smtp-Source: APXvYqzpM7/XnFwAFCbVYDFCwda04EwHgHt6Vl7jDGvUUJJv8culvleD9ZTs04bDDvW74VukjDoLpw== X-Received: by 2002:a5d:6947:: with SMTP id r7mr26156157wrw.167.1555559509708; Wed, 17 Apr 2019 20:51:49 -0700 (PDT) Received: from twisty.localdomain ([2a01:c23:7856:4600:55b4:804e:196c:cde9]) by smtp.gmail.com with ESMTPSA id x192sm665054wmf.48.2019.04.17.20.51.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 Apr 2019 20:51:49 -0700 (PDT) From: Mario Kleiner To: amd-gfx@lists.freedesktop.org Subject: [PATCH 2/4] drm/amd/display: Fix and simplify apply_below_the_range() Date: Thu, 18 Apr 2019 05:51:20 +0200 Message-Id: <20190418035122.15791-3-mario.kleiner.de@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190418035122.15791-1-mario.kleiner.de@gmail.com> References: <20190418035122.15791-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=3CyfB0mw/wqAd1bq2GO9R/cFbPVKQ2dzKueWsobLosk=; b=LvfaDd2ZNh2M+IwKu5Y33/570eBEGFnKKy9rDvk+2RU4NNfNYzZQfLN9P8NGP+3EHr 2ql1Z0K99f+2D37aIbBWg5KqY2BI97kVDxxO2BrsF+TlRbftZzTS50rdcWUUg7zf5s9V V7PSVkQmnCDpSmWgRWUjceYqpvr5gEjvVAxtc5iZpCTP9zZnYJ5kGIYzF8Bpj4ErFobC uT70/f/p+DQd+tswI8IljqzqZdFhDwkuUXGnvhYJCTJre0Ry72lZDjFBAxXivG2ayyTZ gxIZmnLBqTEcsFMcwC0DISgOYXhRGlJ9OxPS5H1fOUdnKcmyLicRcO7ZbWWyDofcYmwQ O5zQ== 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 =