]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
drm/vc4: Add a debugfs entry to disable/enable the load tracker
authorPaul Kocialkowski <paul.kocialkowski@bootlin.com>
Wed, 20 Feb 2019 15:51:24 +0000 (16:51 +0100)
committerMaxime Ripard <maxime.ripard@bootlin.com>
Wed, 6 Mar 2019 13:48:07 +0000 (14:48 +0100)
In order to test whether the load tracker is working as expected, we
need the ability to compare the commit result with the underrun
indication. With the load tracker always enabled, commits that are
expected to trigger an underrun are always rejected, so userspace
cannot get the actual underrun indication from the hardware.

Add a debugfs entry to disable/enable the load tracker, so that a DRM
commit expected to trigger an underrun can go through with the load
tracker disabled. The underrun indication is then available to
userspace and can be checked against the commit result with the load
tracker enabled.

Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190220155124.25022-4-paul.kocialkowski@bootlin.com
drivers/gpu/drm/vc4/vc4_debugfs.c
drivers/gpu/drm/vc4/vc4_drv.h
drivers/gpu/drm/vc4/vc4_kms.c

index 64021bcba0412940ea4b8e9bc85bf3d025ab12ab..59cdad89f844b2b049f625410abd93bfdb136381 100644 (file)
@@ -36,6 +36,15 @@ static const struct drm_info_list vc4_debugfs_list[] = {
 int
 vc4_debugfs_init(struct drm_minor *minor)
 {
+       struct vc4_dev *vc4 = to_vc4_dev(minor->dev);
+       struct dentry *dentry;
+
+       dentry = debugfs_create_bool("hvs_load_tracker", S_IRUGO | S_IWUSR,
+                                    minor->debugfs_root,
+                                    &vc4->load_tracker_enabled);
+       if (!dentry)
+               return -ENOMEM;
+
        return drm_debugfs_create_files(vc4_debugfs_list, VC4_DEBUGFS_ENTRIES,
                                        minor->debugfs_root, minor);
 }
index bbab084911f32f4ab6dc98f89e3722d3aeddc367..7a3c093e74436c0d446c6ed3228951ed942f4520 100644 (file)
@@ -195,6 +195,9 @@ struct vc4_dev {
 
        int power_refcount;
 
+       /* Set to true when the load tracker is active. */
+       bool load_tracker_enabled;
+
        /* Mutex controlling the power refcount. */
        struct mutex power_lock;
 
index 6e20604573de6121d577d0d09d8dd975199d412f..5160cad25fcea928930d0b4a7221960e5e70b6d8 100644 (file)
@@ -439,6 +439,10 @@ static int vc4_load_tracker_atomic_check(struct drm_atomic_state *state)
                }
        }
 
+       /* Don't check the load when the tracker is disabled. */
+       if (!vc4->load_tracker_enabled)
+               return 0;
+
        /* The absolute limit is 2Gbyte/sec, but let's take a margin to let
         * the system work when other blocks are accessing the memory.
         */
@@ -511,6 +515,11 @@ int vc4_kms_load(struct drm_device *dev)
        struct vc4_load_tracker_state *load_state;
        int ret;
 
+       /* Start with the load tracker enabled. Can be disabled through the
+        * debugfs load_tracker file.
+        */
+       vc4->load_tracker_enabled = true;
+
        sema_init(&vc4->async_modeset, 1);
 
        /* Set support for vblank irq fast disable, before drm_vblank_init() */