Skip to content

Commit 291257c

Browse files
committed
drm/exynos: support drm_wait_vblank feature for VIDI
this patch adds drm_wait_vblank support to Virtual Display module so user can use DRM_IOCT_WAIT_VBLANK ioctl with this patch. for this, you should set _DRM_VBLANK_EXYNOS_VIDI flags to vblwait->request.type Signed-off-by: Inki Dae <inki.dae@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
1 parent 32aeab1 commit 291257c

2 files changed

Lines changed: 31 additions & 1 deletion

File tree

‎drivers/gpu/drm/exynos/exynos_drm_vidi.c‎

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ struct vidi_context {
5656
unsigned int connected;
5757
bool vblank_on;
5858
bool suspended;
59+
bool direct_vblank;
5960
struct work_struct work;
6061
struct mutex lock;
6162
};
@@ -224,6 +225,15 @@ static int vidi_enable_vblank(struct device *dev)
224225
if (!test_and_set_bit(0, &ctx->irq_flags))
225226
ctx->vblank_on = true;
226227

228+
ctx->direct_vblank = true;
229+
230+
/*
231+
* in case of page flip request, vidi_finish_pageflip function
232+
* will not be called because direct_vblank is true and then
233+
* that function will be called by overlay_ops->commit callback
234+
*/
235+
schedule_work(&ctx->work);
236+
227237
return 0;
228238
}
229239

@@ -425,7 +435,17 @@ static void vidi_fake_vblank_handler(struct work_struct *work)
425435
/* refresh rate is about 50Hz. */
426436
usleep_range(16000, 20000);
427437

428-
drm_handle_vblank(subdrv->drm_dev, manager->pipe);
438+
mutex_lock(&ctx->lock);
439+
440+
if (ctx->direct_vblank) {
441+
drm_handle_vblank(subdrv->drm_dev, manager->pipe);
442+
ctx->direct_vblank = false;
443+
mutex_unlock(&ctx->lock);
444+
return;
445+
}
446+
447+
mutex_unlock(&ctx->lock);
448+
429449
vidi_finish_pageflip(subdrv->drm_dev, manager->pipe);
430450
}
431451

‎include/drm/exynos_drm.h‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,16 @@ struct drm_exynos_vidi_connection {
107107
uint64_t edid;
108108
};
109109

110+
/* Indicate Exynos specific vblank flags */
111+
enum e_drm_exynos_vblank {
112+
/*
113+
* this flags is used for Virtual Display module
114+
* to use DRM_IOCTL_WAIT_VBLANK feature. for this,
115+
* user should set this flag to vblwait->request.type
116+
*/
117+
_DRM_VBLANK_EXYNOS_VIDI = 2,
118+
};
119+
110120
/* memory type definitions. */
111121
enum e_drm_exynos_gem_mem_type {
112122
/* Physically Continuous memory and used as default. */

0 commit comments

Comments
 (0)