From patchwork Sun Jul 27 21:41:44 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 4631591 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id B40699F36A for ; Sun, 27 Jul 2014 21:42:24 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D478520127 for ; Sun, 27 Jul 2014 21:42:23 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id E901720120 for ; Sun, 27 Jul 2014 21:42:22 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 126C56E3A5; Sun, 27 Jul 2014 14:42:22 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wg0-f49.google.com (mail-wg0-f49.google.com [74.125.82.49]) by gabe.freedesktop.org (Postfix) with ESMTP id D7B226E374 for ; Sun, 27 Jul 2014 14:42:04 -0700 (PDT) Received: by mail-wg0-f49.google.com with SMTP id k14so6493290wgh.32 for ; Sun, 27 Jul 2014 14:42:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=wXp7sVVjHZL6mj0NF0UhsQ53I/xtv9p5BjOh3R3BnTg=; b=XDvWrgZUfIREjrc2K7AkWaK+s7jy5zyIciSdFv3l41lAPfsmX/b7pAR4Um6DQHgPuY 2BL94DilJwG4BPtpgim1l1ZjN8xXBdpdhsIfkCVI1YgWXUoFMo1sEvigJm6JLWBxHlwY KvOqrGH2JmMoi1tI8e4eWKQZFcRHO3xNaPCPI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=wXp7sVVjHZL6mj0NF0UhsQ53I/xtv9p5BjOh3R3BnTg=; b=VtfC+H7GN1w1qLMF7XLKeuctFJnJ7HxB7WdgmcYghdOGa6IQJAqOgDSwp0rzn3zR05 gehLLg8Df+NrBzu1NX2PiRIabDgsJDIvwPP8VBHjfCU9thPghUqKzL8CQ/KXcftVUqkX 82fDX7w2iJw5akONw+CE848gQrEUfbyivB8QvpB2bHWmei5VXwRotMQu2iNhMCRLknB6 Zm43Ft4qoa0iSDM++VYaBvrXl/UeoHZIm+m79sRLn7ln9WsDKPXNCR4iPpfkbdhSEKia BeFN5OEEtqV/ocqm2ygv8X6zbeS9e2jhNwz1S5wfkN3p+tCA36qEChwWbDkgw2ryuSyw uXMw== X-Gm-Message-State: ALoCoQlAZXUBWaZV8z4JcuNuh8nbSfBZbnjKwTtBGmuDUqUoBly5iK+qpBO6XNL7LnMoeeVLrp7e X-Received: by 10.194.200.229 with SMTP id jv5mr41907451wjc.90.1406497324054; Sun, 27 Jul 2014 14:42:04 -0700 (PDT) Received: from phenom.ffwll.local (84-73-67-144.dclient.hispeed.ch. [84.73.67.144]) by mx.google.com with ESMTPSA id di7sm44343171wjb.34.2014.07.27.14.42.02 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 27 Jul 2014 14:42:03 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH 15/19] drm/plane-helper: Add async mode to prepare_fb Date: Sun, 27 Jul 2014 23:41:44 +0200 Message-Id: <1406497308-30733-16-git-send-email-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.0.1 In-Reply-To: <1406497308-30733-1-git-send-email-daniel.vetter@ffwll.ch> References: <1406497308-30733-1-git-send-email-daniel.vetter@ffwll.ch> Cc: Daniel Vetter X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.15 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.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,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 Currently all helpers use ->prepare_fb for synchronous state updates, so we need the driver callback to wait for any outstanding rendering. But with async commit we really only want to reserve the framebuffer, but not stall for rendering. That should be done in the asynchronous worker. So add a boolean for this. Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_atomic_helper.c | 12 +++++++++--- drivers/gpu/drm/drm_crtc_helper.c | 2 +- drivers/gpu/drm/drm_plane_helper.c | 4 ++-- include/drm/drm_atomic_helper.h | 3 ++- include/drm/drm_plane_helper.h | 3 ++- 5 files changed, 16 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index 1b13394cf020..9f7c45b91fe2 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -673,7 +673,7 @@ int drm_atomic_helper_commit(struct drm_device *dev, if (async) return -EBUSY; - ret = drm_atomic_helper_prepare_planes(dev, state); + ret = drm_atomic_helper_prepare_planes(dev, state, false); if (ret) return ret; @@ -719,16 +719,22 @@ EXPORT_SYMBOL(drm_atomic_helper_commit); * drm_atomic_helper_prepare_planes - prepare plane resources after commit * @dev: DRM device * @state: atomic state object with old state structures + * @async: asynchronous commit * * This function prepares plane state, specifically framebuffers, for the new * configuration. If any failure is encountered this function will call * ->cleanup_fb on any already successfully prepared framebuffer. * + * If @async is true the driver callbacks should not wait for outstanding + * render, but instead ensure that the asynchronous commit work item is stalled + * sufficiently long. + * * Returns: * 0 on success, negative error code on failure. */ int drm_atomic_helper_prepare_planes(struct drm_device *dev, - struct drm_atomic_state *state) + struct drm_atomic_state *state, + bool async) { int nplanes = dev->mode_config.num_total_plane; int ret, i; @@ -746,7 +752,7 @@ int drm_atomic_helper_prepare_planes(struct drm_device *dev, fb = state->plane_states[i]->fb; if (fb && funcs->prepare_fb) { - ret = funcs->prepare_fb(plane, fb); + ret = funcs->prepare_fb(plane, fb, async); if (ret) goto fail; } diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c index 7e838104e72e..1382842782f3 100644 --- a/drivers/gpu/drm/drm_crtc_helper.c +++ b/drivers/gpu/drm/drm_crtc_helper.c @@ -993,7 +993,7 @@ int drm_helper_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y, } if (plane_funcs->prepare_fb) { - ret = plane_funcs->prepare_fb(plane, plane_state->fb); + ret = plane_funcs->prepare_fb(plane, plane_state->fb, false); if (ret) goto fail; } diff --git a/drivers/gpu/drm/drm_plane_helper.c b/drivers/gpu/drm/drm_plane_helper.c index 7befbf017afe..6903f50012c5 100644 --- a/drivers/gpu/drm/drm_plane_helper.c +++ b/drivers/gpu/drm/drm_plane_helper.c @@ -435,7 +435,7 @@ int drm_plane_helper_update(struct drm_plane *plane, struct drm_crtc *crtc, } if (plane_funcs->prepare_fb) { - ret = plane_funcs->prepare_fb(plane, fb); + ret = plane_funcs->prepare_fb(plane, fb, false); if (ret) goto fail; } @@ -514,7 +514,7 @@ int drm_plane_helper_disable(struct drm_plane *plane) } if (plane_funcs->prepare_fb) { - ret = plane_funcs->prepare_fb(plane, fb); + ret = plane_funcs->prepare_fb(plane, fb, false); if (ret) goto fail; } diff --git a/include/drm/drm_atomic_helper.h b/include/drm/drm_atomic_helper.h index 8cd6fe7a48e5..0f48e0ffb614 100644 --- a/include/drm/drm_atomic_helper.h +++ b/include/drm/drm_atomic_helper.h @@ -40,7 +40,8 @@ void drm_atomic_helper_commit_post_planes(struct drm_device *dev, struct drm_atomic_state *old_state); int drm_atomic_helper_prepare_planes(struct drm_device *dev, - struct drm_atomic_state *state); + struct drm_atomic_state *state, + bool async); void drm_atomic_helper_commit_planes(struct drm_device *dev, struct drm_atomic_state *state); void drm_atomic_helper_cleanup_planes(struct drm_device *dev, diff --git a/include/drm/drm_plane_helper.h b/include/drm/drm_plane_helper.h index a6f3a8ed3394..48543149055b 100644 --- a/include/drm/drm_plane_helper.h +++ b/include/drm/drm_plane_helper.h @@ -49,7 +49,8 @@ */ struct drm_plane_helper_funcs { int (*prepare_fb)(struct drm_plane *plane, - struct drm_framebuffer *fb); + struct drm_framebuffer *fb, + bool async); void (*cleanup_fb)(struct drm_plane *plane, struct drm_framebuffer *fb);