From patchwork Fri Apr 26 21:40: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: 10919747 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 A545992A for ; Fri, 26 Apr 2019 21:40:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 93E2B2818E for ; Fri, 26 Apr 2019 21:40:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8573028DD5; Fri, 26 Apr 2019 21:40:37 +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 468142818E for ; Fri, 26 Apr 2019 21:40:37 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1924789230; Fri, 26 Apr 2019 21:40:36 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3118289230; Fri, 26 Apr 2019 21:40:35 +0000 (UTC) Received: by mail-wm1-x341.google.com with SMTP id n25so6227119wmk.4; Fri, 26 Apr 2019 14:40:35 -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=OekTb4b5pTeIg6Ej34tUoXQZ1VxCnS4gxi2xgPhqtFoI1AxrZS8TrFnRYtnz4Y+deM 97u8aOY72d8EY2bi+hyL8wwItYLK3vUs7i6dDiv1wFBQbS/VFfy/+3IRGmYoDJzau2PW CqAytNfJnFNnoG4+16pN8HfE0mXI9iDP3WVc3Di18Qdfaloy9bFhi1fzG1vaD0ff2DYq 9c5CYF1k4icpnDeRHflDBlYzwn018kgG1QI/oyjIv+ulEts9TSnLKXTVFpY1OrvDfSxj BLk9xcfl3C1bKu9qgN5GJBfYBvj1JiBiRRh7cptHoLXaAvFvfae4AEooR+lFuQxgGy7q nafg== X-Gm-Message-State: APjAAAXXnK5MWbx4UsyjQPXal67Rmd6Nznq0WVueVmzK5SdODI8eN6/u wfQKec3ADDsZOyqGmNok3D6xNE/A X-Google-Smtp-Source: APXvYqym7EN4gaKOUe2029rot82KKSKZoVmUTY+2ORYF7vvJ1W+AY5qIzJ4U2TlMWcDy/qG8rSE2gw== X-Received: by 2002:a7b:cd93:: with SMTP id y19mr9015843wmj.113.1556314833690; Fri, 26 Apr 2019 14:40:33 -0700 (PDT) Received: from twisty.localdomain ([2a01:c22:c870:100:55b4:804e:196c:cde9]) by smtp.gmail.com with ESMTPSA id p18sm14091408wrp.38.2019.04.26.14.40.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Apr 2019 14:40:33 -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 23:40:14 +0200 Message-Id: <20190426214016.24667-2-mario.kleiner.de@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190426214016.24667-1-mario.kleiner.de@gmail.com> References: <20190426214016.24667-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=kh3wK+WM4y2zSYYzmeMvKs+b+k444iplYOC+EyBl/ZHL4bZSBdbQgTQUsN1kfAlpdj ldEoWEoB7+8bgRQM5JDLr8mdSl5v4FtTHXv17PZzhw3eyxeQqtcuGuGlQg7pPf/xdKpf HGtAUu/cwdqMpObD6pHmIADGI/450yzqBfMKb6dVBHsihOum1YXjtxRUjG5uYNyxHhNP akPifjJUXSPsV2JjlK3iC/y4njiCmqV0YwvWcTrhPbowLDNFcDonJr/tAtpcPPwoHJHE JY3mdUXLXXWO1iEdwqcfYzE+b49Wl3Zq49ln02jAkw25B/0gnbOrlYgGr8sf5np1cpM6 XMvg== 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 =