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: 10784717 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 45BDC922 for ; Mon, 28 Jan 2019 20:43:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 28CE22C378 for ; Mon, 28 Jan 2019 20:43:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1CA992C388; Mon, 28 Jan 2019 20:43:13 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BA3B02C378 for ; Mon, 28 Jan 2019 20:43:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726859AbfA1UnM (ORCPT ); Mon, 28 Jan 2019 15:43:12 -0500 Received: from mail-yw1-f67.google.com ([209.85.161.67]:40042 "EHLO mail-yw1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726719AbfA1UnM (ORCPT ); Mon, 28 Jan 2019 15:43:12 -0500 Received: by mail-yw1-f67.google.com with SMTP id g194so7297433ywe.7 for ; Mon, 28 Jan 2019 12:43:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=poorly.run; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=9LEeFc4h44UE10UMeYOxbhRx47PBnxwQW01uNVsby5o=; b=XKgJ11xcPhG3/cwNa24gL8lCOkjgjlR738MIGMLQQ4Gc8GpPcr45Cg7Yl0YR8y99cw C6im5NnmF0CmQDPgSBIOYq5x9t66d6SGl7GrzvZHN5zasTUEnLeT7RCFPUIRvwV9P1bX ZKA9RbiK/Evr4CpSBeAWVIOyuXSBr6uu9+hbjjyeO9I5o9+sQKIh+SeHyfPgR3iswXDf j3LZLreTNYnLsdimDX3Fhbra8wvNxUyLDQnkADVP3W76eTkmNbK1kzjxnsEiz+wx4/pg geOsxNtVKTUtzXa+7lxQaA2jb7c9HCo4lqlYEGpCkoZ7efAzbq8gof4618NviJpwGXLX CSBA== 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=DiaiUX9j8HQyhiqcX9d6lkYPyqlKt1R7Xfftup8YGHUYMoe9NBNlVBtV46n4z2Xqe3 j59fZeatEruumBo0tSt2xL4M48EOgSpy/SO6ZwWaQRxq7GTZxd3Lxp+RbjiSMqLLquPC 4jSCh9jWFBo+HpsQI9Tsb3tUNNcVctkhq8R5yDN9h67Gp57YZf9Sd35ZHyON6pGX/VaZ fCtquwwH1fIlGL+8VwgaU5z5s1qzeMlveamacalofp002rpXJF4oIQ+g/ovkwr61pI9V it8Tiq4BJsnVt7lrYyZtinImzobL9OCknUdxGWGUYlPlRZ1TV2WO2S/JAtU+xmUQ4yjU /VEg== X-Gm-Message-State: AJcUukfOLBsD4YTyQardDA2mc7oxAVcT7K3IEQeS+VWD8Ik/bvE5ZdxC H6d3CGUG7bzfAA710riAW/PCYQ== 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 Cc: robdclark@gmail.com, Sean Paul , linux-arm-msm@vger.kernel.org, dri-devel@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 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org 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);