linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Veera Sundaram Sankaran <veeras@codeaurora.org>
To: dri-devel@lists.freedesktop.org, linux-media@vger.kernel.org,
	sumit.semwal@linaro.org, gustavo@padovan.org, airlied@linux.ie,
	daniel@ffwll.ch
Cc: Veera Sundaram Sankaran <veeras@codeaurora.org>,
	robdclark@gmail.com, sean@poorly.run, pdhaval@codeaurora.org,
	abhinavk@codeaurora.org, jsanka@codeaurora.org
Subject: [PATCH RESEND 2/2] drm/drm_vblank: set the dma-fence timestamp during send_vblank_event
Date: Thu, 12 Nov 2020 10:27:23 -0800	[thread overview]
Message-ID: <1605205643-12746-2-git-send-email-veeras@codeaurora.org> (raw)
In-Reply-To: <1605205643-12746-1-git-send-email-veeras@codeaurora.org>

The explicit out-fences in crtc are signaled as part of vblank event,
indicating all framebuffers present on the Atomic Commit request are
scanned out on the screen. Though the fence signal and the vblank event
notification happens at the same time, triggered by the same hardware
vsync event, the timestamp set in both are different. With drivers
supporting precise vblank timestamp the difference between the two
timestamps would be even higher. This might have an impact on use-mode
frameworks using these fence timestamps for purposes other than simple
buffer usage. For instance, the Android framework uses the retire-fences
as an alternative to vblank when frame-updates are in progress Set the
fence timestamp during send vblank event to avoid discrepancies.

Signed-off-by: Veera Sundaram Sankaran <veeras@codeaurora.org>
---
 drivers/gpu/drm/drm_vblank.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
index b18e1ef..b38e50c 100644
--- a/drivers/gpu/drm/drm_vblank.c
+++ b/drivers/gpu/drm/drm_vblank.c
@@ -24,6 +24,7 @@
  * OTHER DEALINGS IN THE SOFTWARE.
  */
 
+#include <linux/dma-fence.h>
 #include <linux/export.h>
 #include <linux/kthread.h>
 #include <linux/moduleparam.h>
@@ -999,6 +1000,14 @@ static void send_vblank_event(struct drm_device *dev,
 		e->event.seq.time_ns = ktime_to_ns(now);
 		break;
 	}
+
+	/*
+	 * update fence timestamp with the same vblank timestamp as both
+	 * are signaled by the same event
+	 */
+	if (e->base.fence)
+		e->base.fence->timestamp = now;
+
 	trace_drm_vblank_event_delivered(e->base.file_priv, e->pipe, seq);
 	drm_send_event_locked(dev, &e->base);
 }
-- 
2.7.4


  reply	other threads:[~2020-11-12 18:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-12 18:27 [PATCH RESEND 1/2] dma-fence: allow signaling drivers to set fence timestamp Veera Sundaram Sankaran
2020-11-12 18:27 ` Veera Sundaram Sankaran [this message]
2020-11-13 20:45   ` [PATCH RESEND 2/2] drm/drm_vblank: set the dma-fence timestamp during send_vblank_event Daniel Vetter
2020-11-19  1:26     ` veeras
2020-11-19 11:50       ` Daniel Vetter
2020-11-18 20:27 ` [PATCH RESEND 1/2] dma-fence: allow signaling drivers to set fence timestamp veeras
2020-11-18 20:45   ` Daniel Vetter
2020-11-19 11:58 ` Daniel Vetter
2020-12-03  1:14   ` veeras

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1605205643-12746-2-git-send-email-veeras@codeaurora.org \
    --to=veeras@codeaurora.org \
    --cc=abhinavk@codeaurora.org \
    --cc=airlied@linux.ie \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gustavo@padovan.org \
    --cc=jsanka@codeaurora.org \
    --cc=linux-media@vger.kernel.org \
    --cc=pdhaval@codeaurora.org \
    --cc=robdclark@gmail.com \
    --cc=sean@poorly.run \
    --cc=sumit.semwal@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).