diff mbox series

[3/3] drm/vkms: add crc sources list

Message ID 20190613121802.2193-3-oleg.vasilev@intel.com (mailing list archive)
State New, archived
Headers show
Series [1/3] drm: add debug print to update_vblank_count | expand

Commit Message

Oleg Vasilev June 13, 2019, 12:18 p.m. UTC
Other drivers are able to list crc sources when accessing
/sys/kernel/debug/dri/.../crtc-0/crc/control

Even though VKMS now supports only 'auto' mode, it is more consistent to
have the list available to the userspace.

Signed-off-by: Oleg Vasilev <oleg.vasilev@intel.com>
---
 drivers/gpu/drm/vkms/vkms_crc.c  | 9 +++++++++
 drivers/gpu/drm/vkms/vkms_crtc.c | 1 +
 drivers/gpu/drm/vkms/vkms_drv.h  | 2 ++
 3 files changed, 12 insertions(+)

Comments

Rodrigo Siqueira June 18, 2019, 2:14 a.m. UTC | #1
On 06/13, Oleg Vasilev wrote:
> Other drivers are able to list crc sources when accessing
> /sys/kernel/debug/dri/.../crtc-0/crc/control
> 
> Even though VKMS now supports only 'auto' mode, it is more consistent to
> have the list available to the userspace.
> 
> Signed-off-by: Oleg Vasilev <oleg.vasilev@intel.com>
> ---
>  drivers/gpu/drm/vkms/vkms_crc.c  | 9 +++++++++
>  drivers/gpu/drm/vkms/vkms_crtc.c | 1 +
>  drivers/gpu/drm/vkms/vkms_drv.h  | 2 ++
>  3 files changed, 12 insertions(+)
> 
> diff --git a/drivers/gpu/drm/vkms/vkms_crc.c b/drivers/gpu/drm/vkms/vkms_crc.c
> index bc717a8888b5..819313ef80b6 100644
> --- a/drivers/gpu/drm/vkms/vkms_crc.c
> +++ b/drivers/gpu/drm/vkms/vkms_crc.c
> @@ -220,6 +220,15 @@ void vkms_crc_work_handle(struct work_struct *work)
>  	spin_unlock_irqrestore(&out->state_lock, flags);
>  }
>  
> +static const char * const pipe_crc_sources[] = {"auto"};
> +
> +const char *const *vkms_get_crc_sources(struct drm_crtc *crtc,
> +					size_t *count)
> +{
> +	*count = ARRAY_SIZE(pipe_crc_sources);
> +	return pipe_crc_sources;
> +}
> +
>  static int vkms_crc_parse_source(const char *src_name, bool *enabled)
>  {
>  	int ret = 0;
> diff --git a/drivers/gpu/drm/vkms/vkms_crtc.c b/drivers/gpu/drm/vkms/vkms_crtc.c
> index 1bbe099b7db8..4d11292bc6f3 100644
> --- a/drivers/gpu/drm/vkms/vkms_crtc.c
> +++ b/drivers/gpu/drm/vkms/vkms_crtc.c
> @@ -147,6 +147,7 @@ static const struct drm_crtc_funcs vkms_crtc_funcs = {
>  	.atomic_destroy_state   = vkms_atomic_crtc_destroy_state,
>  	.enable_vblank		= vkms_enable_vblank,
>  	.disable_vblank		= vkms_disable_vblank,
> +	.get_crc_sources	= vkms_get_crc_sources,
>  	.set_crc_source		= vkms_set_crc_source,
>  	.verify_crc_source	= vkms_verify_crc_source,
>  };
> diff --git a/drivers/gpu/drm/vkms/vkms_drv.h b/drivers/gpu/drm/vkms/vkms_drv.h
> index 81f1cfbeb936..891f2d63d74f 100644
> --- a/drivers/gpu/drm/vkms/vkms_drv.h
> +++ b/drivers/gpu/drm/vkms/vkms_drv.h
> @@ -136,6 +136,8 @@ int vkms_gem_vmap(struct drm_gem_object *obj);
>  void vkms_gem_vunmap(struct drm_gem_object *obj);
>  
>  /* CRC Support */
> +const char *const *vkms_get_crc_sources(struct drm_crtc *crtc,
> +					size_t *count);

LGTM

Reviewed-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>

>  int vkms_set_crc_source(struct drm_crtc *crtc, const char *src_name);
>  int vkms_verify_crc_source(struct drm_crtc *crtc, const char *source_name,
>  			   size_t *values_cnt);
> -- 
> 2.21.0
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
Rodrigo Siqueira June 19, 2019, 2:10 a.m. UTC | #2
On 06/13, Oleg Vasilev wrote:
> Other drivers are able to list crc sources when accessing
> /sys/kernel/debug/dri/.../crtc-0/crc/control
> 
> Even though VKMS now supports only 'auto' mode, it is more consistent to
> have the list available to the userspace.
> 
> Signed-off-by: Oleg Vasilev <oleg.vasilev@intel.com>
> ---
>  drivers/gpu/drm/vkms/vkms_crc.c  | 9 +++++++++
>  drivers/gpu/drm/vkms/vkms_crtc.c | 1 +
>  drivers/gpu/drm/vkms/vkms_drv.h  | 2 ++
>  3 files changed, 12 insertions(+)
> 
> diff --git a/drivers/gpu/drm/vkms/vkms_crc.c b/drivers/gpu/drm/vkms/vkms_crc.c
> index bc717a8888b5..819313ef80b6 100644
> --- a/drivers/gpu/drm/vkms/vkms_crc.c
> +++ b/drivers/gpu/drm/vkms/vkms_crc.c
> @@ -220,6 +220,15 @@ void vkms_crc_work_handle(struct work_struct *work)
>  	spin_unlock_irqrestore(&out->state_lock, flags);
>  }
>  
> +static const char * const pipe_crc_sources[] = {"auto"};
> +
> +const char *const *vkms_get_crc_sources(struct drm_crtc *crtc,
> +					size_t *count)
> +{
> +	*count = ARRAY_SIZE(pipe_crc_sources);
> +	return pipe_crc_sources;
> +}
> +
>  static int vkms_crc_parse_source(const char *src_name, bool *enabled)
>  {
>  	int ret = 0;
> diff --git a/drivers/gpu/drm/vkms/vkms_crtc.c b/drivers/gpu/drm/vkms/vkms_crtc.c
> index 1bbe099b7db8..4d11292bc6f3 100644
> --- a/drivers/gpu/drm/vkms/vkms_crtc.c
> +++ b/drivers/gpu/drm/vkms/vkms_crtc.c
> @@ -147,6 +147,7 @@ static const struct drm_crtc_funcs vkms_crtc_funcs = {
>  	.atomic_destroy_state   = vkms_atomic_crtc_destroy_state,
>  	.enable_vblank		= vkms_enable_vblank,
>  	.disable_vblank		= vkms_disable_vblank,
> +	.get_crc_sources	= vkms_get_crc_sources,
>  	.set_crc_source		= vkms_set_crc_source,
>  	.verify_crc_source	= vkms_verify_crc_source,
>  };
> diff --git a/drivers/gpu/drm/vkms/vkms_drv.h b/drivers/gpu/drm/vkms/vkms_drv.h
> index 81f1cfbeb936..891f2d63d74f 100644
> --- a/drivers/gpu/drm/vkms/vkms_drv.h
> +++ b/drivers/gpu/drm/vkms/vkms_drv.h
> @@ -136,6 +136,8 @@ int vkms_gem_vmap(struct drm_gem_object *obj);
>  void vkms_gem_vunmap(struct drm_gem_object *obj);
>  
>  /* CRC Support */
> +const char *const *vkms_get_crc_sources(struct drm_crtc *crtc,
> +					size_t *count);
>  int vkms_set_crc_source(struct drm_crtc *crtc, const char *src_name);
>  int vkms_verify_crc_source(struct drm_crtc *crtc, const char *source_name,
>  			   size_t *values_cnt);
> -- 
> 2.21.0
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

Applied to drm-misc-next.

Thanks
diff mbox series

Patch

diff --git a/drivers/gpu/drm/vkms/vkms_crc.c b/drivers/gpu/drm/vkms/vkms_crc.c
index bc717a8888b5..819313ef80b6 100644
--- a/drivers/gpu/drm/vkms/vkms_crc.c
+++ b/drivers/gpu/drm/vkms/vkms_crc.c
@@ -220,6 +220,15 @@  void vkms_crc_work_handle(struct work_struct *work)
 	spin_unlock_irqrestore(&out->state_lock, flags);
 }
 
+static const char * const pipe_crc_sources[] = {"auto"};
+
+const char *const *vkms_get_crc_sources(struct drm_crtc *crtc,
+					size_t *count)
+{
+	*count = ARRAY_SIZE(pipe_crc_sources);
+	return pipe_crc_sources;
+}
+
 static int vkms_crc_parse_source(const char *src_name, bool *enabled)
 {
 	int ret = 0;
diff --git a/drivers/gpu/drm/vkms/vkms_crtc.c b/drivers/gpu/drm/vkms/vkms_crtc.c
index 1bbe099b7db8..4d11292bc6f3 100644
--- a/drivers/gpu/drm/vkms/vkms_crtc.c
+++ b/drivers/gpu/drm/vkms/vkms_crtc.c
@@ -147,6 +147,7 @@  static const struct drm_crtc_funcs vkms_crtc_funcs = {
 	.atomic_destroy_state   = vkms_atomic_crtc_destroy_state,
 	.enable_vblank		= vkms_enable_vblank,
 	.disable_vblank		= vkms_disable_vblank,
+	.get_crc_sources	= vkms_get_crc_sources,
 	.set_crc_source		= vkms_set_crc_source,
 	.verify_crc_source	= vkms_verify_crc_source,
 };
diff --git a/drivers/gpu/drm/vkms/vkms_drv.h b/drivers/gpu/drm/vkms/vkms_drv.h
index 81f1cfbeb936..891f2d63d74f 100644
--- a/drivers/gpu/drm/vkms/vkms_drv.h
+++ b/drivers/gpu/drm/vkms/vkms_drv.h
@@ -136,6 +136,8 @@  int vkms_gem_vmap(struct drm_gem_object *obj);
 void vkms_gem_vunmap(struct drm_gem_object *obj);
 
 /* CRC Support */
+const char *const *vkms_get_crc_sources(struct drm_crtc *crtc,
+					size_t *count);
 int vkms_set_crc_source(struct drm_crtc *crtc, const char *src_name);
 int vkms_verify_crc_source(struct drm_crtc *crtc, const char *source_name,
 			   size_t *values_cnt);