From patchwork Wed Sep 19 02:21:17 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Inki Dae X-Patchwork-Id: 1475641 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork1.kernel.org (Postfix) with ESMTP id A5D9A400EC for ; Wed, 19 Sep 2012 02:21:32 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8F8049F664 for ; Tue, 18 Sep 2012 19:21:32 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) by gabe.freedesktop.org (Postfix) with ESMTP id 33C569EF9D for ; Tue, 18 Sep 2012 19:21:20 -0700 (PDT) Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MAK004IMRV3BM60@mailout2.samsung.com> for dri-devel@lists.freedesktop.org; Wed, 19 Sep 2012 11:21:18 +0900 (KST) X-AuditID: cbfee61a-b7f726d000000ec7-1f-50592c1e1cf3 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 0C.02.03783.E1C29505; Wed, 19 Sep 2012 11:21:18 +0900 (KST) Received: from daeinki-desktop.10.32.193.11 ([10.90.51.53]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MAK0093MRVI1190@mmp2.samsung.com> for dri-devel@lists.freedesktop.org; Wed, 19 Sep 2012 11:21:18 +0900 (KST) From: Inki Dae To: airlied@linux.ie, dri-devel@lists.freedesktop.org Subject: [PATCH] drm/exynos: support drm_wait_vblank feature for VIDI Date: Wed, 19 Sep 2012 11:21:17 +0900 Message-id: <1348021277-4268-1-git-send-email-inki.dae@samsung.com> X-Mailer: git-send-email 1.7.4.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrFJMWRmVeSWpSXmKPExsVy+t9jQV05ncgAg5dPJS2ufH3P5sDocb/7 OFMAYxSXTUpqTmZZapG+XQJXRveeJ+wF/4UrlrdvZ2pg3CjQxcjJISFgItH2biIzhC0mceHe erYuRi4OIYHpjBIdfV2sEM56Jon9a/4xglSxCahKTFxxnw3EFhEwleiYtJQFxGYWKJRY2PMU zBYWcJW49vYpUDMHBwtQ/ZvbBiBhXgFniYYzu5kglilILLj3lm0CI/cCRoZVjKKpBckFxUnp uYZ6xYm5xaV56XrJ+bmbGME+fCa1g3Flg8UhRgEORiUe3g1HIgKEWBPLiitzDzFKcDArifC6 /wUK8aYkVlalFuXHF5XmpBYfYpTmYFES5xX+FBggJJCeWJKanZpakFoEk2Xi4JRqYNS/cDnG V1b3Xf9LGe1dAVdP3kiUaPh6ylU/Y96tXX/bPJIWTvybta9mSXZtVAZXydITTNUxW16e3G0j dibO4v8RvwUzDUKZhYOXOPybLv39x4bgDpapc7t4f9z657ZFfkno3QV3N09g6Y26sCRl1T/2 NBuj1TO5izQ+Hnuu/Y+JNcGi2K5cxU6JpTgj0VCLuag4EQCP7DMP3QEAAA== Cc: kyungmin.park@samsung.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org 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 Signed-off-by: Kyungmin Park --- drivers/gpu/drm/exynos/exynos_drm_vidi.c | 22 +++++++++++++++++++++- include/drm/exynos_drm.h | 10 ++++++++++ 2 files changed, 31 insertions(+), 1 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_vidi.c b/drivers/gpu/drm/exynos/exynos_drm_vidi.c index c95f7de..54b4415 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_vidi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_vidi.c @@ -56,6 +56,7 @@ struct vidi_context { unsigned int connected; bool vblank_on; bool suspended; + bool direct_vblank; struct work_struct work; struct mutex lock; }; @@ -224,6 +225,15 @@ static int vidi_enable_vblank(struct device *dev) if (!test_and_set_bit(0, &ctx->irq_flags)) ctx->vblank_on = true; + ctx->direct_vblank = true; + + /* + * in case of page flip request, vidi_finish_pageflip function + * will not be called because direct_vblank is true and then + * that function will be called by overlay_ops->commit callback + */ + schedule_work(&ctx->work); + return 0; } @@ -425,7 +435,17 @@ static void vidi_fake_vblank_handler(struct work_struct *work) /* refresh rate is about 50Hz. */ usleep_range(16000, 20000); - drm_handle_vblank(subdrv->drm_dev, manager->pipe); + mutex_lock(&ctx->lock); + + if (ctx->direct_vblank) { + drm_handle_vblank(subdrv->drm_dev, manager->pipe); + ctx->direct_vblank = false; + mutex_unlock(&ctx->lock); + return; + } + + mutex_unlock(&ctx->lock); + vidi_finish_pageflip(subdrv->drm_dev, manager->pipe); } diff --git a/include/drm/exynos_drm.h b/include/drm/exynos_drm.h index c20b001..10f91ea 100644 --- a/include/drm/exynos_drm.h +++ b/include/drm/exynos_drm.h @@ -107,6 +107,16 @@ struct drm_exynos_vidi_connection { uint64_t edid; }; +/* Indicate Exynos specific vblank flags */ +enum e_drm_exynos_vblank { + /* + * this flags is used for Virtual Display module + * to use DRM_IOCTL_WAIT_VBLANK feature. for this, + * user should set this flag to vblwait->request.type + */ + _DRM_VBLANK_EXYNOS_VIDI = 2, +}; + /* memory type definitions. */ enum e_drm_exynos_gem_mem_type { /* Physically Continuous memory and used as default. */