Commit af697933 authored by Mahesh Kumar's avatar Mahesh Kumar Committed by Rodrigo Vivi

drm/vkms/crc: Implement verify_crc_source callback

This patch implements "verify_crc_source" callback function for
Virtual KMS drm driver.

Changes Since V1:
- update values_cnt in verify_crc_source
Changes Since V2:
- don't return early from set_crc_source to keep behavior same (Haneen)

Cc: Haneen Mohammed <hamohammed.sa@gmail.com>
Signed-off-by: default avatarMahesh Kumar <mahesh1.kumar@intel.com>
Reviewed-by: default avatarHaneen Mohammed <hamohammed.sa@gmail.com>
Reviewed-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180821083858.26275-2-mahesh1.kumar@intel.com
parent 7e7b68ef
...@@ -70,6 +70,37 @@ void vkms_crc_work_handle(struct work_struct *work) ...@@ -70,6 +70,37 @@ void vkms_crc_work_handle(struct work_struct *work)
drm_crtc_add_crc_entry(crtc, true, crtc_state->n_frame, &crc32); drm_crtc_add_crc_entry(crtc, true, crtc_state->n_frame, &crc32);
} }
static int vkms_crc_parse_source(const char *src_name, bool *enabled)
{
int ret = 0;
if (!src_name) {
*enabled = false;
} else if (strcmp(src_name, "auto") == 0) {
*enabled = true;
} else {
*enabled = false;
ret = -EINVAL;
}
return ret;
}
int vkms_verify_crc_source(struct drm_crtc *crtc, const char *src_name,
size_t *values_cnt)
{
bool enabled;
if (vkms_crc_parse_source(src_name, &enabled) < 0) {
DRM_DEBUG_DRIVER("unknown source %s\n", src_name);
return -EINVAL;
}
*values_cnt = 1;
return 0;
}
int vkms_set_crc_source(struct drm_crtc *crtc, const char *src_name, int vkms_set_crc_source(struct drm_crtc *crtc, const char *src_name,
size_t *values_cnt) size_t *values_cnt)
{ {
...@@ -78,10 +109,7 @@ int vkms_set_crc_source(struct drm_crtc *crtc, const char *src_name, ...@@ -78,10 +109,7 @@ int vkms_set_crc_source(struct drm_crtc *crtc, const char *src_name,
unsigned long flags; unsigned long flags;
int ret = 0; int ret = 0;
if (src_name && strcmp(src_name, "auto") == 0) ret = vkms_crc_parse_source(src_name, &enabled);
enabled = true;
else if (src_name)
ret = -EINVAL;
*values_cnt = 1; *values_cnt = 1;
......
...@@ -140,6 +140,7 @@ static const struct drm_crtc_funcs vkms_crtc_funcs = { ...@@ -140,6 +140,7 @@ static const struct drm_crtc_funcs vkms_crtc_funcs = {
.enable_vblank = vkms_enable_vblank, .enable_vblank = vkms_enable_vblank,
.disable_vblank = vkms_disable_vblank, .disable_vblank = vkms_disable_vblank,
.set_crc_source = vkms_set_crc_source, .set_crc_source = vkms_set_crc_source,
.verify_crc_source = vkms_verify_crc_source,
}; };
static void vkms_crtc_atomic_enable(struct drm_crtc *crtc, static void vkms_crtc_atomic_enable(struct drm_crtc *crtc,
......
...@@ -125,6 +125,8 @@ void vkms_gem_vunmap(struct drm_gem_object *obj); ...@@ -125,6 +125,8 @@ void vkms_gem_vunmap(struct drm_gem_object *obj);
/* CRC Support */ /* CRC Support */
int vkms_set_crc_source(struct drm_crtc *crtc, const char *src_name, int vkms_set_crc_source(struct drm_crtc *crtc, const char *src_name,
size_t *values_cnt); size_t *values_cnt);
int vkms_verify_crc_source(struct drm_crtc *crtc, const char *source_name,
size_t *values_cnt);
void vkms_crc_work_handle(struct work_struct *work); void vkms_crc_work_handle(struct work_struct *work);
#endif /* _VKMS_DRV_H_ */ #endif /* _VKMS_DRV_H_ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment