From patchwork Mon Nov 30 03:12:15 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hyungwon Hwang X-Patchwork-Id: 7720791 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 2558BBEEE1 for ; Mon, 30 Nov 2015 03:12:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6D4CD2061E for ; Mon, 30 Nov 2015 03:12:37 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 223FE2053B for ; Mon, 30 Nov 2015 03:12:36 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8886F6E0C4; Sun, 29 Nov 2015 19:12:32 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5FBD86E483 for ; Sun, 29 Nov 2015 19:12:31 -0800 (PST) Received: from epcpsbgr2.samsung.com (u142.gpu120.samsung.co.kr [203.254.230.142]) by mailout3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NYL00PCSY8SYP20@mailout3.samsung.com> for dri-devel@lists.freedesktop.org; Mon, 30 Nov 2015 12:12:28 +0900 (KST) Received: from epcpdlpp15 ( [172.20.52.115]) by epcpsbgr2.samsung.com (EPCPMTA) with SMTP id FE.F1.04972.C9EBB565; Mon, 30 Nov 2015 12:12:28 +0900 (KST) X-AuditID: cbfee68e-f793c6d00000136c-b2-565bbe9c6c3e Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1new.samsung.com (EPCPMTA) with SMTP id C2.20.13906.B9EBB565; Mon, 30 Nov 2015 12:12:28 +0900 (KST) Received: from localhost.localdomain ([10.252.82.145]) by mmp2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0NYL00MGBY8OW830@mmp2.samsung.com>; Mon, 30 Nov 2015 12:12:27 +0900 (KST) From: Hyungwon Hwang To: dri-devel@lists.freedesktop.org, emil.l.velikov@gmail.com, jy0922.shim@samsung.com, inki.dae@samsung.com, human.hwang@samsung.com, tjakobi@math.uni-bielefeld.de Subject: [PATCH v3 3/9] exynos/fimg2d: add g2d_config_event Date: Mon, 30 Nov 2015 12:12:15 +0900 Message-id: <1448853141-27791-4-git-send-email-human.hwang@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1448853141-27791-1-git-send-email-human.hwang@samsung.com> References: <1448853141-27791-1-git-send-email-human.hwang@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrKLMWRmVeSWpSXmKPExsWyRsSkWHfOvugwg2sz2SyufH3PZrHn6j0m i6Uz+lgtJt2fwGLx4t5FFou21R9YHdg8ds66y+5xv/s4k8e/Y+wefVtWMQawRHHZpKTmZJal FunbJXBlzF01g63gvGTFsfYJrA2MzaJdjJwcEgImEi2zFrNB2GISF+6tB7K5OIQEZjFKzN3+ gLmLkQOsqKlRDS5+dcFfVgjnB6PE1zlbwbrZBPQkFlz7wQ5iiwisYJSYs9QJxBYWsJbYsqSD EcRmEVCV6HjSxwxi8wq4S7Te2cYKsVlO4uSxyWA2p4CHxLqdb5hAbCGgmtk3FzOCLJMQaGaX +LfrFCvEIAGJb5MPsUBcJyux6QAzxBxJiYMrbrBMYBRawMiwilE0tSC5oDgpvchIrzgxt7g0 L10vOT93EyMwdE//e9a3g/HmAetDjAIcjEo8vBJm0WFCrIllxZW5hxhNgTZMZJYSTc4HRkhe SbyhsZmRhamJqbGRuaWZkjhvgtT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fXrslTTDyWW4oxEQy3mouJEAN0aV/mlAgAA DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Tobias Jakobi This enables us to pass command buffers to the kernel which trigger an event on the DRM fd upon completion. The final goal is to enable asynchronous operation of the G2D engine, similar to async page flips. Passing the event userdata pointer through the G2D context was chosen to not change the current API (e.g. by adding a userdata argument to each public functions). Signed-off-by: Tobias Jakobi --- Changes for v2: Add g2d_config_event() to Exynos symbol test. exynos/exynos-symbol-check | 1 + exynos/exynos_fimg2d.c | 28 ++++++++++++++++++++++++++-- exynos/exynos_fimg2d.h | 1 + 3 files changed, 28 insertions(+), 2 deletions(-) -- 1.9.1 diff --git a/exynos/exynos-symbol-check b/exynos/exynos-symbol-check index c3ddbe4..bb12315 100755 --- a/exynos/exynos-symbol-check +++ b/exynos/exynos-symbol-check @@ -27,6 +27,7 @@ g2d_blend g2d_copy g2d_copy_with_scale g2d_exec +g2d_config_event g2d_fini g2d_init g2d_scale_and_blend diff --git a/exynos/exynos_fimg2d.c b/exynos/exynos_fimg2d.c index e734144..b10620b 100644 --- a/exynos/exynos_fimg2d.c +++ b/exynos/exynos_fimg2d.c @@ -57,6 +57,7 @@ struct g2d_context { unsigned int cmd_nr; unsigned int cmd_buf_nr; unsigned int cmdlist_nr; + void *event_userdata; }; enum g2d_base_addr_reg { @@ -280,8 +281,15 @@ static int g2d_flush(struct g2d_context *ctx) cmdlist.cmd_buf = (uint64_t)(uintptr_t)&ctx->cmd_buf[0]; cmdlist.cmd_nr = ctx->cmd_nr; cmdlist.cmd_buf_nr = ctx->cmd_buf_nr; - cmdlist.event_type = G2D_EVENT_NOT; - cmdlist.user_data = 0; + + if (ctx->event_userdata) { + cmdlist.event_type = G2D_EVENT_NONSTOP; + cmdlist.user_data = (uint64_t)(uintptr_t)(ctx->event_userdata); + ctx->event_userdata = NULL; + } else { + cmdlist.event_type = G2D_EVENT_NOT; + cmdlist.user_data = 0; + } ctx->cmd_nr = 0; ctx->cmd_buf_nr = 0; @@ -336,6 +344,22 @@ void g2d_fini(struct g2d_context *ctx) } /** + * g2d_config_event - setup userdata configuration for a g2d event. + * The next invocation of a g2d call (e.g. g2d_solid_fill) is + * then going to flag the command buffer as 'nonstop'. + * Completion of the command buffer execution can then be + * determined by using drmHandleEvent on the DRM fd. + * The userdata is 'consumed' in the process. + * + * @ctx: a pointer to g2d_context structure. + * @userdata: a pointer to the user data + */ +void g2d_config_event(struct g2d_context *ctx, void *userdata) +{ + ctx->event_userdata = userdata; +} + +/** * g2d_exec - start the dma to process all commands summited by g2d_flush(). * * @ctx: a pointer to g2d_context structure. diff --git a/exynos/exynos_fimg2d.h b/exynos/exynos_fimg2d.h index 4aa1568..a2c22da 100644 --- a/exynos/exynos_fimg2d.h +++ b/exynos/exynos_fimg2d.h @@ -290,6 +290,7 @@ struct g2d_context; struct g2d_context *g2d_init(int fd); void g2d_fini(struct g2d_context *ctx); +void g2d_config_event(struct g2d_context *ctx, void *userdata); int g2d_exec(struct g2d_context *ctx); int g2d_solid_fill(struct g2d_context *ctx, struct g2d_image *img, unsigned int x, unsigned int y, unsigned int w,