From patchwork Fri Nov 16 10:18:13 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Inki Dae X-Patchwork-Id: 1754121 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork2.kernel.org (Postfix) with ESMTP id 81C4FDF288 for ; Fri, 16 Nov 2012 10:18:39 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 61B8FE5CC4 for ; Fri, 16 Nov 2012 02:18:39 -0800 (PST) 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 396D84369D for ; Fri, 16 Nov 2012 02:18:16 -0800 (PST) Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MDK00D3GSLQJN70@mailout2.samsung.com> for dri-devel@lists.freedesktop.org; Fri, 16 Nov 2012 19:18:14 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [203.254.230.42]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id B4.2A.12699.6E216A05; Fri, 16 Nov 2012 19:18:14 +0900 (KST) X-AuditID: cbfee61b-b7f616d00000319b-57-50a612e61078 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 64.2A.12699.6E216A05; Fri, 16 Nov 2012 19:18:14 +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 <0MDK00GHFSME2R70@mmp2.samsung.com> for dri-devel@lists.freedesktop.org; Fri, 16 Nov 2012 19:18:14 +0900 (KST) From: Inki Dae To: airlied@linux.ie, dri-devel@lists.freedesktop.org Subject: [PATCH v2] drm/exynos: make sure that overlay data are updated Date: Fri, 16 Nov 2012 19:18:13 +0900 Message-id: <1353061093-2444-1-git-send-email-inki.dae@samsung.com> X-Mailer: git-send-email 1.7.4.1 In-reply-to: <1352964150-31675-1-git-send-email-inki.dae@samsung.com> References: <1352964150-31675-1-git-send-email-inki.dae@samsung.com> DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrNLMWRmVeSWpSXmKPExsVy+t8zLd1nQssCDBZOVra48vU9mwOjx/3u 40wBjFFcNimpOZllqUX6dglcGXP2fGIvuKxU0fJ1P0sD43LZLkYODgkBE4mfnzm7GDmBTDGJ C/fWs4HYQgLLGCWObg2HiJtIXH9wjrWLkQsoPp1RYvmMg1DOeiaJYzduMYFUsQmoSkxccR+s W0TAVKJj0lIWEJtZoFBiYc9TMFtYwF3i06cVYPUsQPVTZjxiBLF5BZwlHvXMYoXYpiCx4N5b sDmcAq4S76+8Z4e4yEXi+/EGVoheAYlvkw+xQDwgK7HpADPIPRIC19kk1r47xw4xR1Li4Iob LBMYhRcwMqxiFE0tSC4oTkrPNdIrTswtLs1L10vOz93ECAlB6R2MqxosDjEKcDAq8fAK3V4a IMSaWFZcmXuIUYKDWUmEt4p1WYAQb0piZVVqUX58UWlOavEhRh+gSyYyS4km5wPjI68k3tDY wNjQ0NLQzNTS1ACHsJI4b7NHSoCQQHpiSWp2ampBahHMOCYOTqkGxp6Iy5khmx28xV5c3Zp3 wbD4g9JMi1t35N+1xB84yrFqsjVDuFPaWc6FpQtLH5uFKahU+nyeP3FWhduUV30G3+2NVsx+ 69csmu7NLDBnesjZkEnLmpSMjX0eae3oUVKKfq0XOt3BVOFANCPnX5fzN1UkDCel8vZ1GZ75 KPxfjSl7QuUzN+VrSizFGYmGWsxFxYkA7YrmpW4CAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFuphkeLIzCtJLcpLzFFi42I5/e+xoO4zoWUBBq+2SVpc+fqezYHR4373 caYAxqgGRpuM1MSU1CKF1Lzk/JTMvHRbJe/geOd4UzMDQ11DSwtzJYW8xNxUWyUXnwBdt8wc oLFKCmWJOaVAoYDE4mIlfTtME0JD3HQtYBojdH1DguB6jAzQQMI6xow5ez6xF1xWqmj5up+l gXG5bBcjJ4eEgInE9QfnWCFsMYkL99azdTFycQgJTGeUWD7jICuEs55J4tiNW0wgVWwCqhIT V9xnA7FFBEwlOiYtZQGxmQUKJRb2PAWzhQXcJT59WgFWzwJUP2XGI0YQm1fAWeJRzyyobQoS C+69BZvDKeAq8f7Ke3YQW0jAReL78QbWCYy8CxgZVjGKphYkFxQnpeca6RUn5haX5qXrJefn bmIEB/kz6R2MqxosDjEKcDAq8fAK3V4aIMSaWFZcmXuIUYKDWUmEt4p1WYAQb0piZVVqUX58 UWlOavEhRh+gqyYyS4km5wMjMK8k3tDYxMzI0sjM2MTc2BiHsJI4b7NHSoCQQHpiSWp2ampB ahHMOCYOTqkGRk5rvxCd+CSp6MtPtuyJUOp99rLfaKevzP9l0clf3/u8fMciFsGqkDKrJP61 4DG/A1OEzPPubIzbuOeQ31Kv6Eudn/yFpq/0XPDjr9pD7y+uC+PD7okcndShs+w/y79Gnzc6 jwWWGp1a+mWmi3Da592SvdN/BE758fRN4BIpDd7/2ybp6c89LaLEUpyRaKjFXFScCADseeZi nwIAAA== X-CFilter-Loop: Reflected Cc: kyungmin.park@samsung.com, sw0312.kim@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 Changelog v2: fix a little bit performance issue to previous patch. - When drm framebuffer is destroyed, make sure that overlay data are updated to real hardwrae for all encoders instead of waiting for vblank every page flip request. For this, it adds a new function, exynos_drm_encoder_complete_scanout function. Changelog v1: This patch removes wait_for_vblank call from exynos_drm_encoder_plane_disable function and move it to exynos_drm_encoder_plane_commit function. Disabling dma channel to each plane doens't need vblank signal to update data to real hardware. But updating overlay data to real hardware does need vblank signal. Signed-off-by: Inki Dae Signed-off-by: Kyungmin Park --- drivers/gpu/drm/exynos/exynos_drm_encoder.c | 43 ++++++++++++++++++++------ drivers/gpu/drm/exynos/exynos_drm_encoder.h | 1 + drivers/gpu/drm/exynos/exynos_drm_fb.c | 4 ++ 3 files changed, 38 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_encoder.c b/drivers/gpu/drm/exynos/exynos_drm_encoder.c index 607231a..d9afb11 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_encoder.c +++ b/drivers/gpu/drm/exynos/exynos_drm_encoder.c @@ -234,6 +234,39 @@ static void exynos_drm_encoder_commit(struct drm_encoder *encoder) exynos_encoder->dpms = DRM_MODE_DPMS_ON; } +void exynos_drm_encoder_complete_scanout(struct drm_framebuffer *fb) +{ + struct exynos_drm_encoder *exynos_encoder; + struct exynos_drm_overlay_ops *overlay_ops; + struct exynos_drm_manager *manager; + struct drm_device *dev = fb->dev; + struct drm_encoder *encoder; + + /* + * make sure that overlay data are updated to real hardware + * for all encoders. + */ + list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) { + exynos_encoder = to_exynos_encoder(encoder); + + /* if exynos was disabled, just ignor it. */ + if (exynos_encoder->dpms > DRM_MODE_DPMS_ON) + continue; + + manager = exynos_encoder->manager; + overlay_ops = manager->overlay_ops; + + /* + * wait for vblank interrupt + * - this makes sure that overlay data are updated to + * real hardware. + */ + if (overlay_ops->wait_for_vblank) + overlay_ops->wait_for_vblank(manager->dev); + } +} + + static void exynos_drm_encoder_disable(struct drm_encoder *encoder) { struct drm_plane *plane; @@ -505,14 +538,4 @@ void exynos_drm_encoder_plane_disable(struct drm_encoder *encoder, void *data) if (overlay_ops && overlay_ops->disable) overlay_ops->disable(manager->dev, zpos); - - /* - * wait for vblank interrupt - * - this makes sure that hardware overlay is disabled to avoid - * for the dma accesses to memory after gem buffer was released - * because the setting for disabling the overlay will be updated - * at vsync. - */ - if (overlay_ops->wait_for_vblank) - overlay_ops->wait_for_vblank(manager->dev); } diff --git a/drivers/gpu/drm/exynos/exynos_drm_encoder.h b/drivers/gpu/drm/exynos/exynos_drm_encoder.h index 6470d9d..88bb25a 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_encoder.h +++ b/drivers/gpu/drm/exynos/exynos_drm_encoder.h @@ -46,5 +46,6 @@ void exynos_drm_encoder_plane_mode_set(struct drm_encoder *encoder, void *data); void exynos_drm_encoder_plane_commit(struct drm_encoder *encoder, void *data); void exynos_drm_encoder_plane_enable(struct drm_encoder *encoder, void *data); void exynos_drm_encoder_plane_disable(struct drm_encoder *encoder, void *data); +void exynos_drm_encoder_complete_scanout(struct drm_framebuffer *fb); #endif diff --git a/drivers/gpu/drm/exynos/exynos_drm_fb.c b/drivers/gpu/drm/exynos/exynos_drm_fb.c index 7ed5507..dbce93c 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fb.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fb.c @@ -36,6 +36,7 @@ #include "exynos_drm_fb.h" #include "exynos_drm_gem.h" #include "exynos_drm_iommu.h" +#include "exynos_drm_encoder.h" #define to_exynos_fb(x) container_of(x, struct exynos_drm_fb, fb) @@ -89,6 +90,9 @@ static void exynos_drm_fb_destroy(struct drm_framebuffer *fb) DRM_DEBUG_KMS("%s\n", __FILE__); + /* make sure that overlay data are updated before relesing fb. */ + exynos_drm_encoder_complete_scanout(fb); + drm_framebuffer_cleanup(fb); for (i = 0; i < ARRAY_SIZE(exynos_fb->exynos_gem_obj); i++) {