Development vkms_config_debufs in vkms_drv.c for the long term plan of
making vkms configurable and have multiple different instances it's
useful to be able to get at the config of each instance in debugfs
Signed-off-by: Beatriz Martins de Carvalho <[email protected]>
---
drivers/gpu/drm/vkms/vkms_drv.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/drivers/gpu/drm/vkms/vkms_drv.c b/drivers/gpu/drm/vkms/vkms_drv.c
index 027ffe759440..c81fba6c72f0 100644
--- a/drivers/gpu/drm/vkms/vkms_drv.c
+++ b/drivers/gpu/drm/vkms/vkms_drv.c
@@ -28,6 +28,9 @@
#include "vkms_drv.h"
+#include <drm/drm_print.h>
+#include <drm/drm_debugfs.h>
+
#define DRIVER_NAME "vkms"
#define DRIVER_DESC "Virtual Kernel Mode Setting"
#define DRIVER_DATE "20180514"
@@ -86,12 +89,37 @@ static void vkms_atomic_commit_tail(struct drm_atomic_state *old_state)
drm_atomic_helper_cleanup_planes(dev, old_state);
}
+static int vkms_config_show(struct seq_file *m, void *data)
+{
+ struct drm_info_node *node = (struct drm_info_node *)m->private;
+ struct drm_device *dev = node->minor->dev;
+ struct vkms_device *vkmsdev = drm_device_to_vkms_device(dev);
+
+ seq_printf(m, "writeback=%d\n", vkmsdev->config->writeback);
+ seq_printf(m, "cursor=%d\n", vkmsdev->config->cursor);
+ seq_printf(m, "overlay=%d\n", vkmsdev->config->overlay);
+
+ return 0;
+}
+
+static const struct drm_info_list vkms_config_debugfs_list[] = {
+ { "vkms_config", vkms_config_show, 0 },
+};
+
+static void vkms_config_debugfs_init(struct drm_minor *minor)
+{
+ drm_debugfs_create_files(vkms_config_debugfs_list, ARRAY_SIZE(vkms_config_debugfs_list),
+ minor->debugfs_root, minor);
+}
+
static const struct drm_driver vkms_driver = {
.driver_features = DRIVER_MODESET | DRIVER_ATOMIC | DRIVER_GEM,
.release = vkms_release,
.fops = &vkms_driver_fops,
DRM_GEM_SHMEM_DRIVER_OPS,
+ .debugfs_init = vkms_config_debugfs_init,
+
.name = DRIVER_NAME,
.desc = DRIVER_DESC,
.date = DRIVER_DATE,
--
2.25.1
On 07/07, Beatriz Martins de Carvalho wrote:
> Development vkms_config_debufs in vkms_drv.c for the long term plan of
> making vkms configurable and have multiple different instances it's
> useful to be able to get at the config of each instance in debugfs
Hi Beatriz,
Thanks for your patch.
Changes lgtm.
However commit message needs small improvements. Besides typo, it would
be good to make the subject clearer in terms of its purpose (creating
a debugfs file to get/track vkms config data).
Please, address these minor things and add my r-b.
Reviewed-by: Melissa Wen <[email protected]>
>
> Signed-off-by: Beatriz Martins de Carvalho <[email protected]>
> ---
> drivers/gpu/drm/vkms/vkms_drv.c | 28 ++++++++++++++++++++++++++++
> 1 file changed, 28 insertions(+)
>
> diff --git a/drivers/gpu/drm/vkms/vkms_drv.c b/drivers/gpu/drm/vkms/vkms_drv.c
> index 027ffe759440..c81fba6c72f0 100644
> --- a/drivers/gpu/drm/vkms/vkms_drv.c
> +++ b/drivers/gpu/drm/vkms/vkms_drv.c
> @@ -28,6 +28,9 @@
>
> #include "vkms_drv.h"
>
> +#include <drm/drm_print.h>
> +#include <drm/drm_debugfs.h>
> +
> #define DRIVER_NAME "vkms"
> #define DRIVER_DESC "Virtual Kernel Mode Setting"
> #define DRIVER_DATE "20180514"
> @@ -86,12 +89,37 @@ static void vkms_atomic_commit_tail(struct drm_atomic_state *old_state)
> drm_atomic_helper_cleanup_planes(dev, old_state);
> }
>
> +static int vkms_config_show(struct seq_file *m, void *data)
> +{
> + struct drm_info_node *node = (struct drm_info_node *)m->private;
> + struct drm_device *dev = node->minor->dev;
> + struct vkms_device *vkmsdev = drm_device_to_vkms_device(dev);
> +
> + seq_printf(m, "writeback=%d\n", vkmsdev->config->writeback);
> + seq_printf(m, "cursor=%d\n", vkmsdev->config->cursor);
> + seq_printf(m, "overlay=%d\n", vkmsdev->config->overlay);
> +
> + return 0;
> +}
> +
> +static const struct drm_info_list vkms_config_debugfs_list[] = {
> + { "vkms_config", vkms_config_show, 0 },
> +};
> +
> +static void vkms_config_debugfs_init(struct drm_minor *minor)
> +{
> + drm_debugfs_create_files(vkms_config_debugfs_list, ARRAY_SIZE(vkms_config_debugfs_list),
> + minor->debugfs_root, minor);
> +}
> +
> static const struct drm_driver vkms_driver = {
> .driver_features = DRIVER_MODESET | DRIVER_ATOMIC | DRIVER_GEM,
> .release = vkms_release,
> .fops = &vkms_driver_fops,
> DRM_GEM_SHMEM_DRIVER_OPS,
>
> + .debugfs_init = vkms_config_debugfs_init,
> +
> .name = DRIVER_NAME,
> .desc = DRIVER_DESC,
> .date = DRIVER_DATE,
> --
> 2.25.1
>