From patchwork Sun Oct 2 17:01:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 9359899 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 41437600C8 for ; Mon, 3 Oct 2016 00:55:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4BA2828A45 for ; Mon, 3 Oct 2016 00:55:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3EECE28A59; Mon, 3 Oct 2016 00:55:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 39CCA28A45 for ; Mon, 3 Oct 2016 00:54:59 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0308F6E38B; Mon, 3 Oct 2016 00:54:52 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-out.m-online.net (mail-out.m-online.net [IPv6:2001:a60:0:28:0:1:25:1]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6013B6E1BB for ; Sun, 2 Oct 2016 17:01:34 +0000 (UTC) Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 3snBKR6tCjz3hkLl; Sun, 2 Oct 2016 19:01:31 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.68]) by mail.m-online.net (Postfix) with ESMTP id 3snBKR6Qj6zvdWw; Sun, 2 Oct 2016 19:01:31 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.68]) (amavisd-new, port 10024) with ESMTP id UqK37s3VMYtR; Sun, 2 Oct 2016 19:01:30 +0200 (CEST) X-Auth-Info: JXCDajePumX8g7XqmT6ihOv8XTE7RCKjSOUPA+Csj0E= Received: from chi.lan (unknown [195.140.253.167]) by mail.mnet-online.de (Postfix) with ESMTPA; Sun, 2 Oct 2016 19:01:30 +0200 (CEST) From: Marek Vasut To: dri-devel@lists.freedesktop.org Subject: [PATCH V3] drm: simple_kms_helper: Add prepare_fb and cleanup_fb hooks Date: Sun, 2 Oct 2016 19:01:24 +0200 Message-Id: <20161002170124.6099-1-marex@denx.de> X-Mailer: git-send-email 2.9.3 MIME-Version: 1.0 X-Mailman-Approved-At: Mon, 03 Oct 2016 00:54:51 +0000 Cc: Marek Vasut 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Add .prepare_fb and .cleanup_fb plane hooks into the drm_simple_kms. These can be used by drivers to call ie. the drm_fb_cma_setup_fence() helper. Signed-off-by: Marek Vasut Cc: Noralf Trønnes Cc: Daniel Vetter Cc: David Airlie --- V2: Fix the documentation style to play well with make htmldocs V3: Re-add the clause about finding more details in drm_plane_helper_funcs --- drivers/gpu/drm/drm_simple_kms_helper.c | 26 ++++++++++++++++++++++++++ include/drm/drm_simple_kms_helper.h | 20 ++++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/drivers/gpu/drm/drm_simple_kms_helper.c b/drivers/gpu/drm/drm_simple_kms_helper.c index 7b6d26e..7bae08c 100644 --- a/drivers/gpu/drm/drm_simple_kms_helper.c +++ b/drivers/gpu/drm/drm_simple_kms_helper.c @@ -125,7 +125,33 @@ static void drm_simple_kms_plane_atomic_update(struct drm_plane *plane, pipe->funcs->update(pipe, pstate); } +static int drm_simple_kms_plane_prepare_fb(struct drm_plane *plane, + struct drm_plane_state *state) +{ + struct drm_simple_display_pipe *pipe; + + pipe = container_of(plane, struct drm_simple_display_pipe, plane); + if (!pipe->funcs || !pipe->funcs->prepare_fb) + return 0; + + return pipe->funcs->prepare_fb(pipe, state); +} + +static void drm_simple_kms_plane_cleanup_fb(struct drm_plane *plane, + struct drm_plane_state *state) +{ + struct drm_simple_display_pipe *pipe; + + pipe = container_of(plane, struct drm_simple_display_pipe, plane); + if (!pipe->funcs || !pipe->funcs->cleanup_fb) + return; + + pipe->funcs->cleanup_fb(pipe, state); +} + static const struct drm_plane_helper_funcs drm_simple_kms_plane_helper_funcs = { + .prepare_fb = drm_simple_kms_plane_prepare_fb, + .cleanup_fb = drm_simple_kms_plane_cleanup_fb, .atomic_check = drm_simple_kms_plane_atomic_check, .atomic_update = drm_simple_kms_plane_atomic_update, }; diff --git a/include/drm/drm_simple_kms_helper.h b/include/drm/drm_simple_kms_helper.h index 5d112f7..01a8436 100644 --- a/include/drm/drm_simple_kms_helper.h +++ b/include/drm/drm_simple_kms_helper.h @@ -69,6 +69,26 @@ struct drm_simple_display_pipe_funcs { */ void (*update)(struct drm_simple_display_pipe *pipe, struct drm_plane_state *plane_state); + + /** + * @prepare_fb: + * + * Optional, called by struct &drm_plane_helper_funcs ->prepare_fb . + * Please read the documentation for the ->prepare_fb hook in + * struct &drm_plane_helper_funcs for more details. + */ + int (*prepare_fb)(struct drm_simple_display_pipe *pipe, + struct drm_plane_state *plane_state); + + /** + * @cleanup_fb: + * + * Optional, called by struct &drm_plane_helper_funcs ->cleanup_fb . + * Please read the documentation for the ->cleanup_fb hook in + * struct &drm_plane_helper_funcs for more details. + */ + void (*cleanup_fb)(struct drm_simple_display_pipe *pipe, + struct drm_plane_state *plane_state); }; /**