From patchwork Mon Jan 28 20:42:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 10784725 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 D041B184E for ; Mon, 28 Jan 2019 20:43:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C072D2BD58 for ; Mon, 28 Jan 2019 20:43:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B438C2C38A; Mon, 28 Jan 2019 20:43:16 +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,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 709482C372 for ; Mon, 28 Jan 2019 20:43:16 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 524BB6E535; Mon, 28 Jan 2019 20:43:13 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-yw1-xc42.google.com (mail-yw1-xc42.google.com [IPv6:2607:f8b0:4864:20::c42]) by gabe.freedesktop.org (Postfix) with ESMTPS id D1CA66E529 for ; Mon, 28 Jan 2019 20:43:11 +0000 (UTC) Received: by mail-yw1-xc42.google.com with SMTP id g75so7328554ywb.1 for ; Mon, 28 Jan 2019 12:43:11 -0800 (PST) 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:mime-version:content-transfer-encoding; bh=9LEeFc4h44UE10UMeYOxbhRx47PBnxwQW01uNVsby5o=; b=l8qqsbbOWis05HJp7k3LjGGn+YSK5kPan5Mrfac/7byUhtyc5zG9r1TwzfX9Y0zfWV hh++YHzmceSbcjB7TO19hq4rowWOUlU2TOE/vNao+FqFKZIn3MrNOTmlSGHUg3KPr92M sPbAkPqcVWsxgacz/Q5X2rD1yH1Yr1DbieblYIKWEu8CpyDKkgBKjW2ntCqs76GO1L18 NG0NqANOTKRAi/U45DX0zKKjoWuoxtrLMd3EiwlcBEp36DlvB1NTbBBlG9hBDx4L5+0k +fd3eyi+CDWidDDQ2MNWYKeUq1/jO6Bdf/WEb0LWUOV7anvjRgEDfgYjBs3U1HwIgbVt 9wxg== X-Gm-Message-State: AJcUukctbx7gnxL3sguUZC8AdRAl2314v/4ccInEc2UPFPU8OHnT3Wz9 S8AtbH0gFrM1t7Yk9s7kkBQNBg== X-Google-Smtp-Source: ALg8bN5Y4GI6MZbXgSs6JqsvnpUyDH1ce0UJvAb1YgHFM+GaadXmJV4qSH5pbvqWlCCXz+MXIjxnXA== X-Received: by 2002:a81:e40b:: with SMTP id r11mr22135215ywl.56.1548708191001; Mon, 28 Jan 2019 12:43:11 -0800 (PST) Received: from rosewood.cam.corp.google.com ([2620:0:1013:11:89c6:2139:5435:371d]) by smtp.gmail.com with ESMTPSA id a7sm24119760ywb.18.2019.01.28.12.43.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 Jan 2019 12:43:10 -0800 (PST) From: Sean Paul To: freedreno@lists.freedesktop.org Subject: [PATCH 2/4] drm/msm: dpu: Simplify frame_done watchdog timeout calculation Date: Mon, 28 Jan 2019 15:42:49 -0500 Message-Id: <20190128204306.95076-2-sean@poorly.run> X-Mailer: git-send-email 2.20.1.495.gaa96b0ce6b-goog In-Reply-To: <20190128204306.95076-1-sean@poorly.run> References: <20190128204306.95076-1-sean@poorly.run> MIME-Version: 1.0 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: linux-arm-msm@vger.kernel.org, Sean Paul , dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Sean Paul Instead of setting the timeout and then immediately reading it back (along with the hand-rolled msecs_to_jiffies calculation), just calculate it once and set it in both places at the same time. Signed-off-by: Sean Paul Reviewed-by: Abhinav Kumar Reviewed-by: Jeykumar Sankaran --- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c index dd71cb6ba4f5c..83a4c47dbed2d 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c @@ -1791,6 +1791,7 @@ void dpu_encoder_kickoff(struct drm_encoder *drm_enc, bool async) { struct dpu_encoder_virt *dpu_enc; struct dpu_encoder_phys *phys; + unsigned long timeout_ms; ktime_t wakeup_time; unsigned int i; @@ -1803,11 +1804,12 @@ void dpu_encoder_kickoff(struct drm_encoder *drm_enc, bool async) trace_dpu_enc_kickoff(DRMID(drm_enc)); - atomic_set(&dpu_enc->frame_done_timeout, - DPU_FRAME_DONE_TIMEOUT * 1000 / - drm_mode_vrefresh(&drm_enc->crtc->state->adjusted_mode)); - mod_timer(&dpu_enc->frame_done_timer, jiffies + - ((atomic_read(&dpu_enc->frame_done_timeout) * HZ) / 1000)); + timeout_ms = DPU_FRAME_DONE_TIMEOUT * 1000 / + drm_mode_vrefresh(&drm_enc->crtc->state->adjusted_mode); + + atomic_set(&dpu_enc->frame_done_timeout, timeout_ms); + mod_timer(&dpu_enc->frame_done_timer, + jiffies + msecs_to_jiffies(timeout_ms)); /* All phys encs are ready to go, trigger the kickoff */ _dpu_encoder_kickoff_phys(dpu_enc, async);