[PATCH 1/2] drm/vkms: Rework vkms_vblank_simulate
From: Gabriela Bittencourt
Date: Wed Apr 08 2020 - 02:05:48 EST
Add support for Virtual Vblank on VKMS. Rework part of
'vkms_vblank_simulate' for schedule a compose worker outside.
Signed-off-by: Gabriela Bittencourt <gabrielabittencourt00@xxxxxxxxx>
---
drivers/gpu/drm/vkms/vkms_crtc.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/vkms/vkms_crtc.c b/drivers/gpu/drm/vkms/vkms_crtc.c
index ac85e17428f8..a72769b81efe 100644
--- a/drivers/gpu/drm/vkms/vkms_crtc.c
+++ b/drivers/gpu/drm/vkms/vkms_crtc.c
@@ -7,6 +7,12 @@
#include "vkms_drv.h"
+static bool vkms_queue_compose_worker(struct vkms_output *output,
+ struct vkms_crtc_state *state)
+{
+ return queue_work(output->composer_workq, &state->composer_work);
+}
+
static enum hrtimer_restart vkms_vblank_simulate(struct hrtimer *timer)
{
struct vkms_output *output = container_of(timer, struct vkms_output,
@@ -22,12 +28,12 @@ static enum hrtimer_restart vkms_vblank_simulate(struct hrtimer *timer)
spin_lock(&output->lock);
ret = drm_crtc_handle_vblank(crtc);
- if (!ret)
- DRM_ERROR("vkms failure on handling vblank");
-
state = output->composer_state;
spin_unlock(&output->lock);
+ if (!ret)
+ DRM_ERROR("vkms failure on handling vblank");
+
if (state && output->composer_enabled) {
u64 frame = drm_crtc_accurate_vblank_count(crtc);
@@ -44,7 +50,7 @@ static enum hrtimer_restart vkms_vblank_simulate(struct hrtimer *timer)
state->crc_pending = true;
spin_unlock(&output->composer_lock);
- ret = queue_work(output->composer_workq, &state->composer_work);
+ ret = vkms_queue_compose_worker(output, state);
if (!ret)
DRM_DEBUG_DRIVER("Composer worker already queued\n");
}
--
2.25.1