From patchwork Wed Mar 23 18:47:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gustavo Padovan X-Patchwork-Id: 8653161 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.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 74EB39F38C for ; Wed, 23 Mar 2016 18:47:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9818A20165 for ; Wed, 23 Mar 2016 18:47:56 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 620B7203B7 for ; Wed, 23 Mar 2016 18:47:55 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E27CE6E901; Wed, 23 Mar 2016 18:47:52 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-yw0-f178.google.com (mail-yw0-f178.google.com [209.85.161.178]) by gabe.freedesktop.org (Postfix) with ESMTPS id 136A06E901 for ; Wed, 23 Mar 2016 18:47:51 +0000 (UTC) Received: by mail-yw0-f178.google.com with SMTP id h65so31194685ywe.0 for ; Wed, 23 Mar 2016 11:47:51 -0700 (PDT) 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=foiZ03aX2gqsnchrgrVosFoCJ8yaGe9hlcA6BFv/AdE=; b=mG41iEkcu7FegKopLpblcxXSNKUqsrshUHig2S450CsadrtZ2hERgr+dViDofaRgzZ ZKaX7ov+zpqQFjNO0KufBqYPVgw3387g6Xqm7AK8mDq1SaxKZbYwqA3ey7MCw741apqg lUGd2/Zzs/dwuuYTDUvNG3n9r9zYy832bjL/W4fcnHV9tuB8JRJ5JEj/xQ+lD5AkrS36 VzgfdMSaSZF80P/62oUjuUrhdNeCw9gFYmBoMD38fFmSAjGba9Zer7yU8KZef0MCXrTT 6e7/3C7yli6Tse7twhA6HNtAYPqPQbTx8nK6Iy988ugZrzRfUF5FlDrMHBrCE7ATF9dQ MsYg== X-Gm-Message-State: AD7BkJJElcbVJFiKBnt7Kbmq4pxfI9I0eYhxd88QMXzuHtVw3WcJDR7jt+jErDSnjg72Ng== X-Received: by 10.37.231.146 with SMTP id e140mr2291918ybh.57.1458758869310; Wed, 23 Mar 2016 11:47:49 -0700 (PDT) Received: from jade.localdomain ([201.82.24.203]) by smtp.gmail.com with ESMTPSA id y138sm2146629ywa.28.2016.03.23.11.47.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Mar 2016 11:47:48 -0700 (PDT) From: Gustavo Padovan To: dri-devel@lists.freedesktop.org Subject: [RFC 6/6] drm/fence: support fence_collection on atomic commit Date: Wed, 23 Mar 2016 15:47:27 -0300 Message-Id: <1458758847-21170-7-git-send-email-gustavo@padovan.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1458758847-21170-1-git-send-email-gustavo@padovan.org> References: <1458758847-21170-1-git-send-email-gustavo@padovan.org> Cc: Daniel Stone , Daniel Vetter , =?UTF-8?q?Arve=20Hj=C3=B8nnev=C3=A5g?= , linux-kernel@vger.kernel.org, Riley Andrews , Gustavo Padovan , John Harrison 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: Gustavo Padovan Let atomic_commit() wait on a collection of fences before proceed with the scanout. Signed-off-by: Gustavo Padovan --- drivers/gpu/drm/drm_atomic.c | 9 +++++++++ drivers/gpu/drm/drm_atomic_helper.c | 9 +++++---- include/drm/drm_crtc.h | 2 +- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c index 8bc364c..28a65d1 100644 --- a/drivers/gpu/drm/drm_atomic.c +++ b/drivers/gpu/drm/drm_atomic.c @@ -29,6 +29,7 @@ #include #include #include +#include /** * drm_atomic_state_default_release - @@ -795,6 +796,14 @@ static int drm_atomic_plane_check(struct drm_plane *plane, return -EINVAL; } +#ifdef CONFIG_SYNC_FILE + if (state->fence_fd >= 0) { + state->fences = sync_file_fences_get(state->fence_fd); + if (!state->fences) + return -EINVAL; + } +#endif + return 0; } diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index 4f91f84..a6e34b6 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -977,14 +977,12 @@ static void wait_for_fences(struct drm_device *dev, int i; for_each_plane_in_state(state, plane, plane_state, i) { - if (!plane->state->fence) + if (!plane->state->fences) continue; WARN_ON(!plane->state->fb); - fence_wait(plane->state->fence, false); - fence_put(plane->state->fence); - plane->state->fence = NULL; + fence_collection_wait(plane->state->fences); } } @@ -2654,6 +2652,9 @@ void __drm_atomic_helper_plane_destroy_state(struct drm_plane *plane, { if (state->fb) drm_framebuffer_unreference(state->fb); + + if (state->fences) + fence_collection_put(state->fences); } EXPORT_SYMBOL(__drm_atomic_helper_plane_destroy_state); diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index a8f6ec0..c221c28 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h @@ -1257,7 +1257,7 @@ struct drm_plane_state { struct drm_crtc *crtc; /* do not write directly, use drm_atomic_set_crtc_for_plane() */ struct drm_framebuffer *fb; /* do not write directly, use drm_atomic_set_fb_for_plane() */ - struct fence *fence; + struct fence_collection *fences; int fence_fd; /* Signed dest location allows it to be partially off screen */