From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5EF93C388F7 for ; Fri, 13 Nov 2020 08:38:25 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E1D7B20B80 for ; Fri, 13 Nov 2020 08:38:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E1D7B20B80 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C5C6B6E44D; Fri, 13 Nov 2020 08:38:03 +0000 (UTC) Received: from alexa-out-sd-01.qualcomm.com (alexa-out-sd-01.qualcomm.com [199.106.114.38]) by gabe.freedesktop.org (Postfix) with ESMTPS id 750B36E32A for ; Thu, 12 Nov 2020 18:27:36 +0000 (UTC) Received: from unknown (HELO ironmsg01-sd.qualcomm.com) ([10.53.140.141]) by alexa-out-sd-01.qualcomm.com with ESMTP; 12 Nov 2020 10:27:35 -0800 X-QCInternal: smtphost Received: from veeras-linux.qualcomm.com ([10.134.68.137]) by ironmsg01-sd.qualcomm.com with ESMTP; 12 Nov 2020 10:27:35 -0800 Received: by veeras-linux.qualcomm.com (Postfix, from userid 330320) id 70F3221A36; Thu, 12 Nov 2020 10:27:35 -0800 (PST) From: Veera Sundaram Sankaran To: dri-devel@lists.freedesktop.org, linux-media@vger.kernel.org, sumit.semwal@linaro.org, gustavo@padovan.org, airlied@linux.ie, daniel@ffwll.ch 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 Message-Id: <1605205643-12746-2-git-send-email-veeras@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1605205643-12746-1-git-send-email-veeras@codeaurora.org> References: <1605205643-12746-1-git-send-email-veeras@codeaurora.org> X-Mailman-Approved-At: Fri, 13 Nov 2020 08:38:02 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Veera Sundaram Sankaran , abhinavk@codeaurora.org, pdhaval@codeaurora.org, sean@poorly.run MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 --- 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 #include #include #include @@ -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 _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EBB0CC2D0E4 for ; Thu, 12 Nov 2020 18:27:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9874C2223C for ; Thu, 12 Nov 2020 18:27:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726530AbgKLS1h (ORCPT ); Thu, 12 Nov 2020 13:27:37 -0500 Received: from alexa-out-sd-01.qualcomm.com ([199.106.114.38]:63634 "EHLO alexa-out-sd-01.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726181AbgKLS1g (ORCPT ); Thu, 12 Nov 2020 13:27:36 -0500 Received: from unknown (HELO ironmsg01-sd.qualcomm.com) ([10.53.140.141]) by alexa-out-sd-01.qualcomm.com with ESMTP; 12 Nov 2020 10:27:35 -0800 X-QCInternal: smtphost Received: from veeras-linux.qualcomm.com ([10.134.68.137]) by ironmsg01-sd.qualcomm.com with ESMTP; 12 Nov 2020 10:27:35 -0800 Received: by veeras-linux.qualcomm.com (Postfix, from userid 330320) id 70F3221A36; Thu, 12 Nov 2020 10:27:35 -0800 (PST) From: Veera Sundaram Sankaran 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 , 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 Message-Id: <1605205643-12746-2-git-send-email-veeras@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1605205643-12746-1-git-send-email-veeras@codeaurora.org> References: <1605205643-12746-1-git-send-email-veeras@codeaurora.org> Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.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 --- 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 #include #include #include @@ -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