linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3] drm/crc-debugfs: Add notes about CRC<->commit interactions
@ 2019-08-06 12:46 Brian Starkey
  2019-08-07 13:01 ` Ayan Halder
  0 siblings, 1 reply; 2+ messages in thread
From: Brian Starkey @ 2019-08-06 12:46 UTC (permalink / raw)
  To: dri-devel, nd
  Cc: Liviu Dudau, james qian wang (Arm Technology China),
	LKML, ayan.halder, Daniel Vetter

CRC generation can be impacted by commits coming from userspace, and
enabling CRC generation may itself trigger a commit. Add notes about
this to the kerneldoc.

Changes since v1:
 - Clarified that anything that would disable CRCs counts as a full
   modeset, and so userspace needs to reconfigure after full modesets

Changes since v2:
 - Add these notes
 - Rebase onto drm-misc-next (trivial conflict in comment)

Signed-off-by: Brian Starkey <brian.starkey@arm.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/drm_debugfs_crc.c | 9 +++++++++
 include/drm/drm_crtc.h            | 4 ++++
 2 files changed, 13 insertions(+)

diff --git a/drivers/gpu/drm/drm_debugfs_crc.c b/drivers/gpu/drm/drm_debugfs_crc.c
index 6604ed223160..be1b7ba92ffe 100644
--- a/drivers/gpu/drm/drm_debugfs_crc.c
+++ b/drivers/gpu/drm/drm_debugfs_crc.c
@@ -69,6 +69,15 @@
  * implement &drm_crtc_funcs.set_crc_source and &drm_crtc_funcs.verify_crc_source.
  * The debugfs files are automatically set up if those vfuncs are set. CRC samples
  * need to be captured in the driver by calling drm_crtc_add_crc_entry().
+ * Depending on the driver and HW requirements, &drm_crtc_funcs.set_crc_source
+ * may result in a commit (even a full modeset).
+ *
+ * CRC results must be reliable across non-full-modeset atomic commits, so if a
+ * commit via DRM_IOCTL_MODE_ATOMIC would disable or otherwise interfere with
+ * CRC generation, then the driver must mark that commit as a full modeset
+ * (drm_atomic_crtc_needs_modeset() should return true). As a result, to ensure
+ * consistent results, generic userspace must re-setup CRC generation after a
+ * legacy SETCRTC or an atomic commit with DRM_MODE_ATOMIC_ALLOW_MODESET.
  */
 
 static int crc_control_show(struct seq_file *m, void *data)
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 128d8b210621..7d14c11bdc0a 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -756,6 +756,9 @@ struct drm_crtc_funcs {
 	 * provided from the configured source. Drivers must accept an "auto"
 	 * source name that will select a default source for this CRTC.
 	 *
+	 * This may trigger an atomic modeset commit if necessary, to enable CRC
+	 * generation.
+	 *
 	 * Note that "auto" can depend upon the current modeset configuration,
 	 * e.g. it could pick an encoder or output specific CRC sampling point.
 	 *
@@ -767,6 +770,7 @@ struct drm_crtc_funcs {
 	 * 0 on success or a negative error code on failure.
 	 */
 	int (*set_crc_source)(struct drm_crtc *crtc, const char *source);
+
 	/**
 	 * @verify_crc_source:
 	 *
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v3] drm/crc-debugfs: Add notes about CRC<->commit interactions
  2019-08-06 12:46 [PATCH v3] drm/crc-debugfs: Add notes about CRC<->commit interactions Brian Starkey
@ 2019-08-07 13:01 ` Ayan Halder
  0 siblings, 0 replies; 2+ messages in thread
From: Ayan Halder @ 2019-08-07 13:01 UTC (permalink / raw)
  To: Brian Starkey
  Cc: dri-devel, nd, james qian wang (Arm Technology China), Liviu Dudau, LKML

On Tue, Aug 06, 2019 at 01:46:22PM +0100, Brian Starkey wrote:
> CRC generation can be impacted by commits coming from userspace, and
> enabling CRC generation may itself trigger a commit. Add notes about
> this to the kerneldoc.
> 
> Changes since v1:
>  - Clarified that anything that would disable CRCs counts as a full
>    modeset, and so userspace needs to reconfigure after full modesets
> 
> Changes since v2:
>  - Add these notes
>  - Rebase onto drm-misc-next (trivial conflict in comment)
> 
> Signed-off-by: Brian Starkey <brian.starkey@arm.com>
> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> ---
>  drivers/gpu/drm/drm_debugfs_crc.c | 9 +++++++++
>  include/drm/drm_crtc.h            | 4 ++++
>  2 files changed, 13 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_debugfs_crc.c b/drivers/gpu/drm/drm_debugfs_crc.c
> index 6604ed223160..be1b7ba92ffe 100644
> --- a/drivers/gpu/drm/drm_debugfs_crc.c
> +++ b/drivers/gpu/drm/drm_debugfs_crc.c
> @@ -69,6 +69,15 @@
>   * implement &drm_crtc_funcs.set_crc_source and &drm_crtc_funcs.verify_crc_source.
>   * The debugfs files are automatically set up if those vfuncs are set. CRC samples
>   * need to be captured in the driver by calling drm_crtc_add_crc_entry().
> + * Depending on the driver and HW requirements, &drm_crtc_funcs.set_crc_source
> + * may result in a commit (even a full modeset).
> + *
> + * CRC results must be reliable across non-full-modeset atomic commits, so if a
> + * commit via DRM_IOCTL_MODE_ATOMIC would disable or otherwise interfere with
> + * CRC generation, then the driver must mark that commit as a full modeset
> + * (drm_atomic_crtc_needs_modeset() should return true). As a result, to ensure
> + * consistent results, generic userspace must re-setup CRC generation after a
> + * legacy SETCRTC or an atomic commit with DRM_MODE_ATOMIC_ALLOW_MODESET.
>   */
>  
>  static int crc_control_show(struct seq_file *m, void *data)
> diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
> index 128d8b210621..7d14c11bdc0a 100644
> --- a/include/drm/drm_crtc.h
> +++ b/include/drm/drm_crtc.h
> @@ -756,6 +756,9 @@ struct drm_crtc_funcs {
>  	 * provided from the configured source. Drivers must accept an "auto"
>  	 * source name that will select a default source for this CRTC.
>  	 *
> +	 * This may trigger an atomic modeset commit if necessary, to enable CRC
> +	 * generation.
> +	 *
>  	 * Note that "auto" can depend upon the current modeset configuration,
>  	 * e.g. it could pick an encoder or output specific CRC sampling point.
>  	 *
> @@ -767,6 +770,7 @@ struct drm_crtc_funcs {
>  	 * 0 on success or a negative error code on failure.
>  	 */
>  	int (*set_crc_source)(struct drm_crtc *crtc, const char *source);
> +
>  	/**
>  	 * @verify_crc_source:
>  	 *
> -- 
> 2.17.1
> 

Pushed to drm-misc-next.
Commit id :- 178e5f3a5bc1d67d1248a74c0abab41040abe7c4

-Ayan
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-08-07 13:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-06 12:46 [PATCH v3] drm/crc-debugfs: Add notes about CRC<->commit interactions Brian Starkey
2019-08-07 13:01 ` Ayan Halder

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).