]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
drm/crc-debugfs: Add notes about CRC<->commit interactions
authorBrian Starkey <brian.starkey@arm.com>
Tue, 6 Aug 2019 12:46:22 +0000 (13:46 +0100)
committerAyan kumar halder <ayan.halder@arm.com>
Tue, 6 Aug 2019 17:27:53 +0000 (18:27 +0100)
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>
Signed-off-by: Ayan Kumar Halder <ayan.halder@arm.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link:- https://patchwork.freedesktop.org/patch/321974/

drivers/gpu/drm/drm_debugfs_crc.c
include/drm/drm_crtc.h

index 6604ed223160800e8d586c691086f43b57522df0..be1b7ba92ffe1e5e041c4d794edc0c0972da5ae4 100644 (file)
  * 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)
index 128d8b21062199543402a68f53223c75b3788aa5..7d14c11bdc0add94b32ff6062907f40d63df2981 100644 (file)
@@ -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:
         *