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=-6.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS 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 B70AFC33CA2 for ; Fri, 10 Jan 2020 10:24:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8B1B52077C for ; Fri, 10 Jan 2020 10:24:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727240AbgAJKYS (ORCPT ); Fri, 10 Jan 2020 05:24:18 -0500 Received: from mga17.intel.com ([192.55.52.151]:12822 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727168AbgAJKYR (ORCPT ); Fri, 10 Jan 2020 05:24:17 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Jan 2020 02:24:17 -0800 X-IronPort-AV: E=Sophos;i="5.69,416,1571727600"; d="scan'208";a="223700705" Received: from jnikula-mobl3.fi.intel.com (HELO localhost) ([10.237.66.161]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Jan 2020 02:24:09 -0800 From: Jani Nikula To: Thomas Zimmermann , airlied@linux.ie, daniel@ffwll.ch, alexander.deucher@amd.com, christian.koenig@amd.com, David1.Zhou@amd.com, maarten.lankhorst@linux.intel.com, patrik.r.jakobsson@gmail.com, robdclark@gmail.com, sean@poorly.run, benjamin.gaignard@linaro.org, vincent.abriou@st.com, yannick.fertre@st.com, philippe.cornu@st.com, mcoquelin.stm32@gmail.com, alexandre.torgue@st.com, eric@anholt.net, rodrigosiqueiramelo@gmail.com, hamohammed.sa@gmail.com, linux-graphics-maintainer@vmware.com, thellstrom@vmware.com, bskeggs@redhat.com, harry.wentland@amd.com, sunpeng.li@amd.com, joonas.lahtinen@linux.intel.com, rodrigo.vivi@intel.com Cc: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, nouveau@lists.freedesktop.org, Thomas Zimmermann Subject: Re: [PATCH 01/23] drm: Add get_scanout_position() to struct drm_crtc_helper_funcs In-Reply-To: <20200110092127.27847-2-tzimmermann@suse.de> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo References: <20200110092127.27847-1-tzimmermann@suse.de> <20200110092127.27847-2-tzimmermann@suse.de> Date: Fri, 10 Jan 2020 12:24:06 +0200 Message-ID: <87muavobi1.fsf@intel.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org On Fri, 10 Jan 2020, Thomas Zimmermann wrote: > The new callback get_scanout_position() reads the current location of > the scanout process. The operation is currentyl located in struct > drm_driver, but really belongs to the CRTC. Drivers will be converted > in separate patches. > > Signed-off-by: Thomas Zimmermann > --- > drivers/gpu/drm/drm_vblank.c | 24 ++++++++---- > include/drm/drm_drv.h | 7 +--- > include/drm/drm_modeset_helper_vtables.h | 47 ++++++++++++++++++++++++ > 3 files changed, 65 insertions(+), 13 deletions(-) > > diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c > index 1659b13b178c..c12f0b333e14 100644 > --- a/drivers/gpu/drm/drm_vblank.c > +++ b/drivers/gpu/drm/drm_vblank.c > @@ -30,6 +30,7 @@ > #include > #include > #include > +#include > #include > #include > > @@ -590,7 +591,7 @@ EXPORT_SYMBOL(drm_calc_timestamping_constants); > * Implements calculation of exact vblank timestamps from given drm_display_mode > * timings and current video scanout position of a CRTC. This can be directly > * used as the &drm_driver.get_vblank_timestamp implementation of a kms driver > - * if &drm_driver.get_scanout_position is implemented. > + * if &drm_crtc_helper_funcs.get_scanout_position is implemented. > * > * The current implementation only handles standard video modes. For double scan > * and interlaced modes the driver is supposed to adjust the hardware mode > @@ -632,8 +633,9 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev, > } > > /* Scanout position query not supported? Should not happen. */ > - if (!dev->driver->get_scanout_position) { > - DRM_ERROR("Called from driver w/o get_scanout_position()!?\n"); > + if (!dev->driver->get_scanout_position || > + !crtc->helper_private->get_scanout_position) { ITYM s/||/&&/ BR, Jani. > + DRM_ERROR("Called from CRTC w/o get_scanout_position()!?\n"); > return false; > } > > @@ -664,11 +666,17 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev, > * Get vertical and horizontal scanout position vpos, hpos, > * and bounding timestamps stime, etime, pre/post query. > */ > - vbl_status = dev->driver->get_scanout_position(dev, pipe, > - in_vblank_irq, > - &vpos, &hpos, > - &stime, &etime, > - mode); > + if (crtc->helper_private->get_scanout_position) { > + vbl_status = > + crtc->helper_private->get_scanout_position( > + crtc, in_vblank_irq, &vpos, &hpos, > + &stime, &etime, mode); > + } else { > + vbl_status = > + dev->driver->get_scanout_position( > + dev, pipe, in_vblank_irq, &vpos, > + &hpos, &stime, &etime, mode); > + } > > /* Return as no-op if scanout query unsupported or failed. */ > if (!vbl_status) { > diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h > index cf13470810a5..d0049e5786fc 100644 > --- a/include/drm/drm_drv.h > +++ b/include/drm/drm_drv.h > @@ -362,11 +362,8 @@ struct drm_driver { > * True on success, false if a reliable scanout position counter could > * not be read out. > * > - * FIXME: > - * > - * Since this is a helper to implement @get_vblank_timestamp, we should > - * move it to &struct drm_crtc_helper_funcs, like all the other > - * helper-internal hooks. > + * This is deprecated and should not be used by new drivers. > + * Use &drm_crtc_helper_funcs.get_scanout_position instead. > */ > bool (*get_scanout_position) (struct drm_device *dev, unsigned int pipe, > bool in_vblank_irq, int *vpos, int *hpos, > diff --git a/include/drm/drm_modeset_helper_vtables.h b/include/drm/drm_modeset_helper_vtables.h > index 5a87f1bd7a3f..e398512bfd5f 100644 > --- a/include/drm/drm_modeset_helper_vtables.h > +++ b/include/drm/drm_modeset_helper_vtables.h > @@ -450,6 +450,53 @@ struct drm_crtc_helper_funcs { > */ > void (*atomic_disable)(struct drm_crtc *crtc, > struct drm_crtc_state *old_crtc_state); > + > + /** > + * @get_scanout_position: > + * > + * Called by vblank timestamping code. > + * > + * Returns the current display scanout position from a CRTC and an > + * optional accurate ktime_get() timestamp of when the position was > + * measured. Note that this is a helper callback which is only used > + * if a driver uses drm_calc_vbltimestamp_from_scanoutpos() for the > + * @drm_driver.get_vblank_timestamp callback. > + * > + * Parameters: > + * > + * crtc: > + * The CRTC. > + * in_vblank_irq: > + * True when called from drm_crtc_handle_vblank(). Some drivers > + * need to apply some workarounds for gpu-specific vblank irq > + * quirks if the flag is set. > + * vpos: > + * Target location for current vertical scanout position. > + * hpos: > + * Target location for current horizontal scanout position. > + * stime: > + * Target location for timestamp taken immediately before > + * scanout position query. Can be NULL to skip timestamp. > + * etime: > + * Target location for timestamp taken immediately after > + * scanout position query. Can be NULL to skip timestamp. > + * mode: > + * Current display timings. > + * > + * Returns vpos as a positive number while in active scanout area. > + * Returns vpos as a negative number inside vblank, counting the number > + * of scanlines to go until end of vblank, e.g., -1 means "one scanline > + * until start of active scanout / end of vblank." > + * > + * Returns: > + * > + * True on success, false if a reliable scanout position counter could > + * not be read out. > + */ > + bool (*get_scanout_position)(struct drm_crtc *crtc, > + bool in_vblank_irq, int *vpos, int *hpos, > + ktime_t *stime, ktime_t *etime, > + const struct drm_display_mode *mode); > }; > > /** -- Jani Nikula, Intel Open Source Graphics Center From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jani Nikula Subject: Re: [PATCH 01/23] drm: Add get_scanout_position() to struct drm_crtc_helper_funcs Date: Fri, 10 Jan 2020 12:24:06 +0200 Message-ID: <87muavobi1.fsf@intel.com> References: <20200110092127.27847-1-tzimmermann@suse.de> <20200110092127.27847-2-tzimmermann@suse.de> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20200110092127.27847-2-tzimmermann-l3A5Bk7waGM@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org Sender: "amd-gfx" To: airlied-cv59FeDIM0c@public.gmane.org, daniel-/w4YWyX8dFk@public.gmane.org, alexander.deucher-5C7GfCeVMHo@public.gmane.org, christian.koenig-5C7GfCeVMHo@public.gmane.org, David1.Zhou-5C7GfCeVMHo@public.gmane.org, maarten.lankhorst-VuQAYsv1563Yd54FQh9/CA@public.gmane.org, patrik.r.jakobsson-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, robdclark-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org, benjamin.gaignard-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org, vincent.abriou-qxv4g6HH51o@public.gmane.org, yannick.fertre-qxv4g6HH51o@public.gmane.org, philippe.cornu-qxv4g6HH51o@public.gmane.org, mcoquelin.stm32-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, alexandre.torgue-qxv4g6HH51o@public.gmane.org, eric-WhKQ6XTQaPysTnJN9+BGXg@public.gmane.org, rodrigosiqueiramelo-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, hamohammed.sa-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, linux-graphics-maintainer-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org, thellstrom-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org, bskeggs-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org, harry.wentland-5C7GfCeVMHo@public.gmane.org, sunpeng.li-5C7GfCeVMHo@public.gmane.org, joonas.lahtinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org, rodrigo.vivi-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org Cc: linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, intel-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org, dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org, Thomas Zimmermann , nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org, freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org List-Id: nouveau.vger.kernel.org On Fri, 10 Jan 2020, Thomas Zimmermann wrote: > The new callback get_scanout_position() reads the current location of > the scanout process. The operation is currentyl located in struct > drm_driver, but really belongs to the CRTC. Drivers will be converted > in separate patches. > > Signed-off-by: Thomas Zimmermann > --- > drivers/gpu/drm/drm_vblank.c | 24 ++++++++---- > include/drm/drm_drv.h | 7 +--- > include/drm/drm_modeset_helper_vtables.h | 47 ++++++++++++++++++++++++ > 3 files changed, 65 insertions(+), 13 deletions(-) > > diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c > index 1659b13b178c..c12f0b333e14 100644 > --- a/drivers/gpu/drm/drm_vblank.c > +++ b/drivers/gpu/drm/drm_vblank.c > @@ -30,6 +30,7 @@ > #include > #include > #include > +#include > #include > #include > > @@ -590,7 +591,7 @@ EXPORT_SYMBOL(drm_calc_timestamping_constants); > * Implements calculation of exact vblank timestamps from given drm_display_mode > * timings and current video scanout position of a CRTC. This can be directly > * used as the &drm_driver.get_vblank_timestamp implementation of a kms driver > - * if &drm_driver.get_scanout_position is implemented. > + * if &drm_crtc_helper_funcs.get_scanout_position is implemented. > * > * The current implementation only handles standard video modes. For double scan > * and interlaced modes the driver is supposed to adjust the hardware mode > @@ -632,8 +633,9 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev, > } > > /* Scanout position query not supported? Should not happen. */ > - if (!dev->driver->get_scanout_position) { > - DRM_ERROR("Called from driver w/o get_scanout_position()!?\n"); > + if (!dev->driver->get_scanout_position || > + !crtc->helper_private->get_scanout_position) { ITYM s/||/&&/ BR, Jani. > + DRM_ERROR("Called from CRTC w/o get_scanout_position()!?\n"); > return false; > } > > @@ -664,11 +666,17 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev, > * Get vertical and horizontal scanout position vpos, hpos, > * and bounding timestamps stime, etime, pre/post query. > */ > - vbl_status = dev->driver->get_scanout_position(dev, pipe, > - in_vblank_irq, > - &vpos, &hpos, > - &stime, &etime, > - mode); > + if (crtc->helper_private->get_scanout_position) { > + vbl_status = > + crtc->helper_private->get_scanout_position( > + crtc, in_vblank_irq, &vpos, &hpos, > + &stime, &etime, mode); > + } else { > + vbl_status = > + dev->driver->get_scanout_position( > + dev, pipe, in_vblank_irq, &vpos, > + &hpos, &stime, &etime, mode); > + } > > /* Return as no-op if scanout query unsupported or failed. */ > if (!vbl_status) { > diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h > index cf13470810a5..d0049e5786fc 100644 > --- a/include/drm/drm_drv.h > +++ b/include/drm/drm_drv.h > @@ -362,11 +362,8 @@ struct drm_driver { > * True on success, false if a reliable scanout position counter could > * not be read out. > * > - * FIXME: > - * > - * Since this is a helper to implement @get_vblank_timestamp, we should > - * move it to &struct drm_crtc_helper_funcs, like all the other > - * helper-internal hooks. > + * This is deprecated and should not be used by new drivers. > + * Use &drm_crtc_helper_funcs.get_scanout_position instead. > */ > bool (*get_scanout_position) (struct drm_device *dev, unsigned int pipe, > bool in_vblank_irq, int *vpos, int *hpos, > diff --git a/include/drm/drm_modeset_helper_vtables.h b/include/drm/drm_modeset_helper_vtables.h > index 5a87f1bd7a3f..e398512bfd5f 100644 > --- a/include/drm/drm_modeset_helper_vtables.h > +++ b/include/drm/drm_modeset_helper_vtables.h > @@ -450,6 +450,53 @@ struct drm_crtc_helper_funcs { > */ > void (*atomic_disable)(struct drm_crtc *crtc, > struct drm_crtc_state *old_crtc_state); > + > + /** > + * @get_scanout_position: > + * > + * Called by vblank timestamping code. > + * > + * Returns the current display scanout position from a CRTC and an > + * optional accurate ktime_get() timestamp of when the position was > + * measured. Note that this is a helper callback which is only used > + * if a driver uses drm_calc_vbltimestamp_from_scanoutpos() for the > + * @drm_driver.get_vblank_timestamp callback. > + * > + * Parameters: > + * > + * crtc: > + * The CRTC. > + * in_vblank_irq: > + * True when called from drm_crtc_handle_vblank(). Some drivers > + * need to apply some workarounds for gpu-specific vblank irq > + * quirks if the flag is set. > + * vpos: > + * Target location for current vertical scanout position. > + * hpos: > + * Target location for current horizontal scanout position. > + * stime: > + * Target location for timestamp taken immediately before > + * scanout position query. Can be NULL to skip timestamp. > + * etime: > + * Target location for timestamp taken immediately after > + * scanout position query. Can be NULL to skip timestamp. > + * mode: > + * Current display timings. > + * > + * Returns vpos as a positive number while in active scanout area. > + * Returns vpos as a negative number inside vblank, counting the number > + * of scanlines to go until end of vblank, e.g., -1 means "one scanline > + * until start of active scanout / end of vblank." > + * > + * Returns: > + * > + * True on success, false if a reliable scanout position counter could > + * not be read out. > + */ > + bool (*get_scanout_position)(struct drm_crtc *crtc, > + bool in_vblank_irq, int *vpos, int *hpos, > + ktime_t *stime, ktime_t *etime, > + const struct drm_display_mode *mode); > }; > > /** -- Jani Nikula, Intel Open Source Graphics Center 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=-6.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 99ECCC33CA3 for ; Fri, 10 Jan 2020 10:24:24 +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 7711C20721 for ; Fri, 10 Jan 2020 10:24:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7711C20721 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com 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 3A5556E9B5; Fri, 10 Jan 2020 10:24:20 +0000 (UTC) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by gabe.freedesktop.org (Postfix) with ESMTPS id 311FC6E9AF; Fri, 10 Jan 2020 10:24:18 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Jan 2020 02:24:17 -0800 X-IronPort-AV: E=Sophos;i="5.69,416,1571727600"; d="scan'208";a="223700705" Received: from jnikula-mobl3.fi.intel.com (HELO localhost) ([10.237.66.161]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Jan 2020 02:24:09 -0800 From: Jani Nikula To: Thomas Zimmermann , airlied@linux.ie, daniel@ffwll.ch, alexander.deucher@amd.com, christian.koenig@amd.com, David1.Zhou@amd.com, maarten.lankhorst@linux.intel.com, patrik.r.jakobsson@gmail.com, robdclark@gmail.com, sean@poorly.run, benjamin.gaignard@linaro.org, vincent.abriou@st.com, yannick.fertre@st.com, philippe.cornu@st.com, mcoquelin.stm32@gmail.com, alexandre.torgue@st.com, eric@anholt.net, rodrigosiqueiramelo@gmail.com, hamohammed.sa@gmail.com, linux-graphics-maintainer@vmware.com, thellstrom@vmware.com, bskeggs@redhat.com, harry.wentland@amd.com, sunpeng.li@amd.com, joonas.lahtinen@linux.intel.com, rodrigo.vivi@intel.com Subject: Re: [PATCH 01/23] drm: Add get_scanout_position() to struct drm_crtc_helper_funcs In-Reply-To: <20200110092127.27847-2-tzimmermann@suse.de> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo References: <20200110092127.27847-1-tzimmermann@suse.de> <20200110092127.27847-2-tzimmermann@suse.de> Date: Fri, 10 Jan 2020 12:24:06 +0200 Message-ID: <87muavobi1.fsf@intel.com> MIME-Version: 1.0 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: linux-arm-msm@vger.kernel.org, intel-gfx@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, Thomas Zimmermann , nouveau@lists.freedesktop.org, freedreno@lists.freedesktop.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Fri, 10 Jan 2020, Thomas Zimmermann wrote: > The new callback get_scanout_position() reads the current location of > the scanout process. The operation is currentyl located in struct > drm_driver, but really belongs to the CRTC. Drivers will be converted > in separate patches. > > Signed-off-by: Thomas Zimmermann > --- > drivers/gpu/drm/drm_vblank.c | 24 ++++++++---- > include/drm/drm_drv.h | 7 +--- > include/drm/drm_modeset_helper_vtables.h | 47 ++++++++++++++++++++++++ > 3 files changed, 65 insertions(+), 13 deletions(-) > > diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c > index 1659b13b178c..c12f0b333e14 100644 > --- a/drivers/gpu/drm/drm_vblank.c > +++ b/drivers/gpu/drm/drm_vblank.c > @@ -30,6 +30,7 @@ > #include > #include > #include > +#include > #include > #include > > @@ -590,7 +591,7 @@ EXPORT_SYMBOL(drm_calc_timestamping_constants); > * Implements calculation of exact vblank timestamps from given drm_display_mode > * timings and current video scanout position of a CRTC. This can be directly > * used as the &drm_driver.get_vblank_timestamp implementation of a kms driver > - * if &drm_driver.get_scanout_position is implemented. > + * if &drm_crtc_helper_funcs.get_scanout_position is implemented. > * > * The current implementation only handles standard video modes. For double scan > * and interlaced modes the driver is supposed to adjust the hardware mode > @@ -632,8 +633,9 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev, > } > > /* Scanout position query not supported? Should not happen. */ > - if (!dev->driver->get_scanout_position) { > - DRM_ERROR("Called from driver w/o get_scanout_position()!?\n"); > + if (!dev->driver->get_scanout_position || > + !crtc->helper_private->get_scanout_position) { ITYM s/||/&&/ BR, Jani. > + DRM_ERROR("Called from CRTC w/o get_scanout_position()!?\n"); > return false; > } > > @@ -664,11 +666,17 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev, > * Get vertical and horizontal scanout position vpos, hpos, > * and bounding timestamps stime, etime, pre/post query. > */ > - vbl_status = dev->driver->get_scanout_position(dev, pipe, > - in_vblank_irq, > - &vpos, &hpos, > - &stime, &etime, > - mode); > + if (crtc->helper_private->get_scanout_position) { > + vbl_status = > + crtc->helper_private->get_scanout_position( > + crtc, in_vblank_irq, &vpos, &hpos, > + &stime, &etime, mode); > + } else { > + vbl_status = > + dev->driver->get_scanout_position( > + dev, pipe, in_vblank_irq, &vpos, > + &hpos, &stime, &etime, mode); > + } > > /* Return as no-op if scanout query unsupported or failed. */ > if (!vbl_status) { > diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h > index cf13470810a5..d0049e5786fc 100644 > --- a/include/drm/drm_drv.h > +++ b/include/drm/drm_drv.h > @@ -362,11 +362,8 @@ struct drm_driver { > * True on success, false if a reliable scanout position counter could > * not be read out. > * > - * FIXME: > - * > - * Since this is a helper to implement @get_vblank_timestamp, we should > - * move it to &struct drm_crtc_helper_funcs, like all the other > - * helper-internal hooks. > + * This is deprecated and should not be used by new drivers. > + * Use &drm_crtc_helper_funcs.get_scanout_position instead. > */ > bool (*get_scanout_position) (struct drm_device *dev, unsigned int pipe, > bool in_vblank_irq, int *vpos, int *hpos, > diff --git a/include/drm/drm_modeset_helper_vtables.h b/include/drm/drm_modeset_helper_vtables.h > index 5a87f1bd7a3f..e398512bfd5f 100644 > --- a/include/drm/drm_modeset_helper_vtables.h > +++ b/include/drm/drm_modeset_helper_vtables.h > @@ -450,6 +450,53 @@ struct drm_crtc_helper_funcs { > */ > void (*atomic_disable)(struct drm_crtc *crtc, > struct drm_crtc_state *old_crtc_state); > + > + /** > + * @get_scanout_position: > + * > + * Called by vblank timestamping code. > + * > + * Returns the current display scanout position from a CRTC and an > + * optional accurate ktime_get() timestamp of when the position was > + * measured. Note that this is a helper callback which is only used > + * if a driver uses drm_calc_vbltimestamp_from_scanoutpos() for the > + * @drm_driver.get_vblank_timestamp callback. > + * > + * Parameters: > + * > + * crtc: > + * The CRTC. > + * in_vblank_irq: > + * True when called from drm_crtc_handle_vblank(). Some drivers > + * need to apply some workarounds for gpu-specific vblank irq > + * quirks if the flag is set. > + * vpos: > + * Target location for current vertical scanout position. > + * hpos: > + * Target location for current horizontal scanout position. > + * stime: > + * Target location for timestamp taken immediately before > + * scanout position query. Can be NULL to skip timestamp. > + * etime: > + * Target location for timestamp taken immediately after > + * scanout position query. Can be NULL to skip timestamp. > + * mode: > + * Current display timings. > + * > + * Returns vpos as a positive number while in active scanout area. > + * Returns vpos as a negative number inside vblank, counting the number > + * of scanlines to go until end of vblank, e.g., -1 means "one scanline > + * until start of active scanout / end of vblank." > + * > + * Returns: > + * > + * True on success, false if a reliable scanout position counter could > + * not be read out. > + */ > + bool (*get_scanout_position)(struct drm_crtc *crtc, > + bool in_vblank_irq, int *vpos, int *hpos, > + ktime_t *stime, ktime_t *etime, > + const struct drm_display_mode *mode); > }; > > /** -- Jani Nikula, Intel Open Source Graphics Center _______________________________________________ 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=-6.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 DD467C33CA2 for ; Fri, 10 Jan 2020 10:24:22 +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 BE7E120721 for ; Fri, 10 Jan 2020 10:24:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BE7E120721 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1515A6E9B1; Fri, 10 Jan 2020 10:24:20 +0000 (UTC) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by gabe.freedesktop.org (Postfix) with ESMTPS id 311FC6E9AF; Fri, 10 Jan 2020 10:24:18 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Jan 2020 02:24:17 -0800 X-IronPort-AV: E=Sophos;i="5.69,416,1571727600"; d="scan'208";a="223700705" Received: from jnikula-mobl3.fi.intel.com (HELO localhost) ([10.237.66.161]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Jan 2020 02:24:09 -0800 From: Jani Nikula To: Thomas Zimmermann , airlied@linux.ie, daniel@ffwll.ch, alexander.deucher@amd.com, christian.koenig@amd.com, David1.Zhou@amd.com, maarten.lankhorst@linux.intel.com, patrik.r.jakobsson@gmail.com, robdclark@gmail.com, sean@poorly.run, benjamin.gaignard@linaro.org, vincent.abriou@st.com, yannick.fertre@st.com, philippe.cornu@st.com, mcoquelin.stm32@gmail.com, alexandre.torgue@st.com, eric@anholt.net, rodrigosiqueiramelo@gmail.com, hamohammed.sa@gmail.com, linux-graphics-maintainer@vmware.com, thellstrom@vmware.com, bskeggs@redhat.com, harry.wentland@amd.com, sunpeng.li@amd.com, joonas.lahtinen@linux.intel.com, rodrigo.vivi@intel.com In-Reply-To: <20200110092127.27847-2-tzimmermann@suse.de> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo References: <20200110092127.27847-1-tzimmermann@suse.de> <20200110092127.27847-2-tzimmermann@suse.de> Date: Fri, 10 Jan 2020 12:24:06 +0200 Message-ID: <87muavobi1.fsf@intel.com> MIME-Version: 1.0 Subject: Re: [Intel-gfx] [PATCH 01/23] drm: Add get_scanout_position() to struct drm_crtc_helper_funcs X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-msm@vger.kernel.org, intel-gfx@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, Thomas Zimmermann , nouveau@lists.freedesktop.org, freedreno@lists.freedesktop.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" On Fri, 10 Jan 2020, Thomas Zimmermann wrote: > The new callback get_scanout_position() reads the current location of > the scanout process. The operation is currentyl located in struct > drm_driver, but really belongs to the CRTC. Drivers will be converted > in separate patches. > > Signed-off-by: Thomas Zimmermann > --- > drivers/gpu/drm/drm_vblank.c | 24 ++++++++---- > include/drm/drm_drv.h | 7 +--- > include/drm/drm_modeset_helper_vtables.h | 47 ++++++++++++++++++++++++ > 3 files changed, 65 insertions(+), 13 deletions(-) > > diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c > index 1659b13b178c..c12f0b333e14 100644 > --- a/drivers/gpu/drm/drm_vblank.c > +++ b/drivers/gpu/drm/drm_vblank.c > @@ -30,6 +30,7 @@ > #include > #include > #include > +#include > #include > #include > > @@ -590,7 +591,7 @@ EXPORT_SYMBOL(drm_calc_timestamping_constants); > * Implements calculation of exact vblank timestamps from given drm_display_mode > * timings and current video scanout position of a CRTC. This can be directly > * used as the &drm_driver.get_vblank_timestamp implementation of a kms driver > - * if &drm_driver.get_scanout_position is implemented. > + * if &drm_crtc_helper_funcs.get_scanout_position is implemented. > * > * The current implementation only handles standard video modes. For double scan > * and interlaced modes the driver is supposed to adjust the hardware mode > @@ -632,8 +633,9 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev, > } > > /* Scanout position query not supported? Should not happen. */ > - if (!dev->driver->get_scanout_position) { > - DRM_ERROR("Called from driver w/o get_scanout_position()!?\n"); > + if (!dev->driver->get_scanout_position || > + !crtc->helper_private->get_scanout_position) { ITYM s/||/&&/ BR, Jani. > + DRM_ERROR("Called from CRTC w/o get_scanout_position()!?\n"); > return false; > } > > @@ -664,11 +666,17 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev, > * Get vertical and horizontal scanout position vpos, hpos, > * and bounding timestamps stime, etime, pre/post query. > */ > - vbl_status = dev->driver->get_scanout_position(dev, pipe, > - in_vblank_irq, > - &vpos, &hpos, > - &stime, &etime, > - mode); > + if (crtc->helper_private->get_scanout_position) { > + vbl_status = > + crtc->helper_private->get_scanout_position( > + crtc, in_vblank_irq, &vpos, &hpos, > + &stime, &etime, mode); > + } else { > + vbl_status = > + dev->driver->get_scanout_position( > + dev, pipe, in_vblank_irq, &vpos, > + &hpos, &stime, &etime, mode); > + } > > /* Return as no-op if scanout query unsupported or failed. */ > if (!vbl_status) { > diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h > index cf13470810a5..d0049e5786fc 100644 > --- a/include/drm/drm_drv.h > +++ b/include/drm/drm_drv.h > @@ -362,11 +362,8 @@ struct drm_driver { > * True on success, false if a reliable scanout position counter could > * not be read out. > * > - * FIXME: > - * > - * Since this is a helper to implement @get_vblank_timestamp, we should > - * move it to &struct drm_crtc_helper_funcs, like all the other > - * helper-internal hooks. > + * This is deprecated and should not be used by new drivers. > + * Use &drm_crtc_helper_funcs.get_scanout_position instead. > */ > bool (*get_scanout_position) (struct drm_device *dev, unsigned int pipe, > bool in_vblank_irq, int *vpos, int *hpos, > diff --git a/include/drm/drm_modeset_helper_vtables.h b/include/drm/drm_modeset_helper_vtables.h > index 5a87f1bd7a3f..e398512bfd5f 100644 > --- a/include/drm/drm_modeset_helper_vtables.h > +++ b/include/drm/drm_modeset_helper_vtables.h > @@ -450,6 +450,53 @@ struct drm_crtc_helper_funcs { > */ > void (*atomic_disable)(struct drm_crtc *crtc, > struct drm_crtc_state *old_crtc_state); > + > + /** > + * @get_scanout_position: > + * > + * Called by vblank timestamping code. > + * > + * Returns the current display scanout position from a CRTC and an > + * optional accurate ktime_get() timestamp of when the position was > + * measured. Note that this is a helper callback which is only used > + * if a driver uses drm_calc_vbltimestamp_from_scanoutpos() for the > + * @drm_driver.get_vblank_timestamp callback. > + * > + * Parameters: > + * > + * crtc: > + * The CRTC. > + * in_vblank_irq: > + * True when called from drm_crtc_handle_vblank(). Some drivers > + * need to apply some workarounds for gpu-specific vblank irq > + * quirks if the flag is set. > + * vpos: > + * Target location for current vertical scanout position. > + * hpos: > + * Target location for current horizontal scanout position. > + * stime: > + * Target location for timestamp taken immediately before > + * scanout position query. Can be NULL to skip timestamp. > + * etime: > + * Target location for timestamp taken immediately after > + * scanout position query. Can be NULL to skip timestamp. > + * mode: > + * Current display timings. > + * > + * Returns vpos as a positive number while in active scanout area. > + * Returns vpos as a negative number inside vblank, counting the number > + * of scanlines to go until end of vblank, e.g., -1 means "one scanline > + * until start of active scanout / end of vblank." > + * > + * Returns: > + * > + * True on success, false if a reliable scanout position counter could > + * not be read out. > + */ > + bool (*get_scanout_position)(struct drm_crtc *crtc, > + bool in_vblank_irq, int *vpos, int *hpos, > + ktime_t *stime, ktime_t *etime, > + const struct drm_display_mode *mode); > }; > > /** -- Jani Nikula, Intel Open Source Graphics Center _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx 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=-6.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 A374FC33CA2 for ; Fri, 10 Jan 2020 10:24:20 +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 81E0520721 for ; Fri, 10 Jan 2020 10:24:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 81E0520721 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=amd-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E367A6E9B0; Fri, 10 Jan 2020 10:24:19 +0000 (UTC) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by gabe.freedesktop.org (Postfix) with ESMTPS id 311FC6E9AF; Fri, 10 Jan 2020 10:24:18 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Jan 2020 02:24:17 -0800 X-IronPort-AV: E=Sophos;i="5.69,416,1571727600"; d="scan'208";a="223700705" Received: from jnikula-mobl3.fi.intel.com (HELO localhost) ([10.237.66.161]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Jan 2020 02:24:09 -0800 From: Jani Nikula To: Thomas Zimmermann , airlied@linux.ie, daniel@ffwll.ch, alexander.deucher@amd.com, christian.koenig@amd.com, David1.Zhou@amd.com, maarten.lankhorst@linux.intel.com, patrik.r.jakobsson@gmail.com, robdclark@gmail.com, sean@poorly.run, benjamin.gaignard@linaro.org, vincent.abriou@st.com, yannick.fertre@st.com, philippe.cornu@st.com, mcoquelin.stm32@gmail.com, alexandre.torgue@st.com, eric@anholt.net, rodrigosiqueiramelo@gmail.com, hamohammed.sa@gmail.com, linux-graphics-maintainer@vmware.com, thellstrom@vmware.com, bskeggs@redhat.com, harry.wentland@amd.com, sunpeng.li@amd.com, joonas.lahtinen@linux.intel.com, rodrigo.vivi@intel.com Subject: Re: [PATCH 01/23] drm: Add get_scanout_position() to struct drm_crtc_helper_funcs In-Reply-To: <20200110092127.27847-2-tzimmermann@suse.de> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo References: <20200110092127.27847-1-tzimmermann@suse.de> <20200110092127.27847-2-tzimmermann@suse.de> Date: Fri, 10 Jan 2020 12:24:06 +0200 Message-ID: <87muavobi1.fsf@intel.com> MIME-Version: 1.0 X-BeenThere: amd-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion list for AMD gfx List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-msm@vger.kernel.org, intel-gfx@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, Thomas Zimmermann , nouveau@lists.freedesktop.org, freedreno@lists.freedesktop.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: amd-gfx-bounces@lists.freedesktop.org Sender: "amd-gfx" On Fri, 10 Jan 2020, Thomas Zimmermann wrote: > The new callback get_scanout_position() reads the current location of > the scanout process. The operation is currentyl located in struct > drm_driver, but really belongs to the CRTC. Drivers will be converted > in separate patches. > > Signed-off-by: Thomas Zimmermann > --- > drivers/gpu/drm/drm_vblank.c | 24 ++++++++---- > include/drm/drm_drv.h | 7 +--- > include/drm/drm_modeset_helper_vtables.h | 47 ++++++++++++++++++++++++ > 3 files changed, 65 insertions(+), 13 deletions(-) > > diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c > index 1659b13b178c..c12f0b333e14 100644 > --- a/drivers/gpu/drm/drm_vblank.c > +++ b/drivers/gpu/drm/drm_vblank.c > @@ -30,6 +30,7 @@ > #include > #include > #include > +#include > #include > #include > > @@ -590,7 +591,7 @@ EXPORT_SYMBOL(drm_calc_timestamping_constants); > * Implements calculation of exact vblank timestamps from given drm_display_mode > * timings and current video scanout position of a CRTC. This can be directly > * used as the &drm_driver.get_vblank_timestamp implementation of a kms driver > - * if &drm_driver.get_scanout_position is implemented. > + * if &drm_crtc_helper_funcs.get_scanout_position is implemented. > * > * The current implementation only handles standard video modes. For double scan > * and interlaced modes the driver is supposed to adjust the hardware mode > @@ -632,8 +633,9 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev, > } > > /* Scanout position query not supported? Should not happen. */ > - if (!dev->driver->get_scanout_position) { > - DRM_ERROR("Called from driver w/o get_scanout_position()!?\n"); > + if (!dev->driver->get_scanout_position || > + !crtc->helper_private->get_scanout_position) { ITYM s/||/&&/ BR, Jani. > + DRM_ERROR("Called from CRTC w/o get_scanout_position()!?\n"); > return false; > } > > @@ -664,11 +666,17 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev, > * Get vertical and horizontal scanout position vpos, hpos, > * and bounding timestamps stime, etime, pre/post query. > */ > - vbl_status = dev->driver->get_scanout_position(dev, pipe, > - in_vblank_irq, > - &vpos, &hpos, > - &stime, &etime, > - mode); > + if (crtc->helper_private->get_scanout_position) { > + vbl_status = > + crtc->helper_private->get_scanout_position( > + crtc, in_vblank_irq, &vpos, &hpos, > + &stime, &etime, mode); > + } else { > + vbl_status = > + dev->driver->get_scanout_position( > + dev, pipe, in_vblank_irq, &vpos, > + &hpos, &stime, &etime, mode); > + } > > /* Return as no-op if scanout query unsupported or failed. */ > if (!vbl_status) { > diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h > index cf13470810a5..d0049e5786fc 100644 > --- a/include/drm/drm_drv.h > +++ b/include/drm/drm_drv.h > @@ -362,11 +362,8 @@ struct drm_driver { > * True on success, false if a reliable scanout position counter could > * not be read out. > * > - * FIXME: > - * > - * Since this is a helper to implement @get_vblank_timestamp, we should > - * move it to &struct drm_crtc_helper_funcs, like all the other > - * helper-internal hooks. > + * This is deprecated and should not be used by new drivers. > + * Use &drm_crtc_helper_funcs.get_scanout_position instead. > */ > bool (*get_scanout_position) (struct drm_device *dev, unsigned int pipe, > bool in_vblank_irq, int *vpos, int *hpos, > diff --git a/include/drm/drm_modeset_helper_vtables.h b/include/drm/drm_modeset_helper_vtables.h > index 5a87f1bd7a3f..e398512bfd5f 100644 > --- a/include/drm/drm_modeset_helper_vtables.h > +++ b/include/drm/drm_modeset_helper_vtables.h > @@ -450,6 +450,53 @@ struct drm_crtc_helper_funcs { > */ > void (*atomic_disable)(struct drm_crtc *crtc, > struct drm_crtc_state *old_crtc_state); > + > + /** > + * @get_scanout_position: > + * > + * Called by vblank timestamping code. > + * > + * Returns the current display scanout position from a CRTC and an > + * optional accurate ktime_get() timestamp of when the position was > + * measured. Note that this is a helper callback which is only used > + * if a driver uses drm_calc_vbltimestamp_from_scanoutpos() for the > + * @drm_driver.get_vblank_timestamp callback. > + * > + * Parameters: > + * > + * crtc: > + * The CRTC. > + * in_vblank_irq: > + * True when called from drm_crtc_handle_vblank(). Some drivers > + * need to apply some workarounds for gpu-specific vblank irq > + * quirks if the flag is set. > + * vpos: > + * Target location for current vertical scanout position. > + * hpos: > + * Target location for current horizontal scanout position. > + * stime: > + * Target location for timestamp taken immediately before > + * scanout position query. Can be NULL to skip timestamp. > + * etime: > + * Target location for timestamp taken immediately after > + * scanout position query. Can be NULL to skip timestamp. > + * mode: > + * Current display timings. > + * > + * Returns vpos as a positive number while in active scanout area. > + * Returns vpos as a negative number inside vblank, counting the number > + * of scanlines to go until end of vblank, e.g., -1 means "one scanline > + * until start of active scanout / end of vblank." > + * > + * Returns: > + * > + * True on success, false if a reliable scanout position counter could > + * not be read out. > + */ > + bool (*get_scanout_position)(struct drm_crtc *crtc, > + bool in_vblank_irq, int *vpos, int *hpos, > + ktime_t *stime, ktime_t *etime, > + const struct drm_display_mode *mode); > }; > > /** -- Jani Nikula, Intel Open Source Graphics Center _______________________________________________ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx