From patchwork Thu Aug 9 11:37:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Christian_K=C3=B6nig?= X-Patchwork-Id: 10561211 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E546414E2 for ; Thu, 9 Aug 2018 11:37:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D336B2A896 for ; Thu, 9 Aug 2018 11:37:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C5E232AD4E; Thu, 9 Aug 2018 11:37:45 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,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 6CF212A896 for ; Thu, 9 Aug 2018 11:37:45 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9577F6E71E; Thu, 9 Aug 2018 11:37:25 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by gabe.freedesktop.org (Postfix) with ESMTPS id EA13C6E6E7; Thu, 9 Aug 2018 11:37:22 +0000 (UTC) Received: by mail-wr1-x442.google.com with SMTP id u12-v6so4861262wrr.4; Thu, 09 Aug 2018 04:37:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/BK950xKcFPGgMPYzGeYrxcfpau3n5qwMvDaPv8845c=; b=fZeKRlV3/pBy64ZSVILE2HBmtZMfxbpONP6a3dn+58PSaXn697mAyc3pQZpyxNOGcY y71Xjy1RWKE3RAcznuniUcbC9hgrh84T/9tf7by0/R/cyODI+zhzkwQZ8FMm5V1/8vX4 /2HFb+0XeGHghha7OU0a8ZVXSvd+LWQEkSplwmqa6n/OAAsvH5UQmxTx6snFZkF9ZPMZ tiuwF+Gcp7k2vP7BkDbmm1NL2NgwQqwOzZz+NqjndiKJzhq075PPxYdhmLESTNDmdXdy iUTbzrHe3w6NRvYLLYiz1uAPo59B7PaCZ34trWOoUUr5YvwpH+zVgbkB7dW0GvbcF+He KEOw== X-Gm-Message-State: AOUpUlH0yS50G4Ews4pA0+Iz2zvODUrS9WjZC54yg92+oVkBvbq7SaWZ T631Yjru/0aRT0YucCpUtXIFLMPF X-Google-Smtp-Source: AA+uWPwK4Jh7qnIzFDvnWLHla7tzzZ/UlO9uDbx8xTxAMyeMIp7dXu000lSuxw7vFrkSRBlldf0ERQ== X-Received: by 2002:adf:9bc9:: with SMTP id e9-v6mr1289473wrc.240.1533814640460; Thu, 09 Aug 2018 04:37:20 -0700 (PDT) Received: from baker.fritz.box ([2a02:908:1257:4460:3d33:c568:5cf9:1c03]) by smtp.gmail.com with ESMTPSA id v5-v6sm4734842wru.60.2018.08.09.04.37.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Aug 2018 04:37:19 -0700 (PDT) From: " =?utf-8?q?Christian_K=C3=B6nig?= " X-Google-Original-From: =?utf-8?q?Christian_K=C3=B6nig?= To: intel-gfx@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Date: Thu, 9 Aug 2018 13:37:12 +0200 Message-Id: <20180809113713.48024-6-christian.koenig@amd.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180809113713.48024-1-christian.koenig@amd.com> References: <20180809113713.48024-1-christian.koenig@amd.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH 5/6] drm/i915: wait for write fences before pflip X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP Wait for all write operations before page flipping. Signed-off-by: Christian König --- drivers/gpu/drm/i915/intel_display.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 2c16c3a3cdea..154dc86062a3 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -48,6 +48,7 @@ #include #include #include +#include /* Primary plane formats for gen <= 3 */ static const uint32_t i8xx_primary_formats[] = { @@ -13022,7 +13023,8 @@ intel_prepare_plane_fb(struct drm_plane *plane, intel_fb_obj_flush(obj, ORIGIN_DIRTYFB); if (!new_state->fence) { /* implicit fencing */ - struct dma_fence *fence; + struct dma_fence *fence, **fences; + unsigned count; ret = i915_sw_fence_await_reservation(&intel_state->commit_ready, obj->resv, NULL, @@ -13031,7 +13033,29 @@ intel_prepare_plane_fb(struct drm_plane *plane, if (ret < 0) return ret; - fence = reservation_object_get_excl_rcu(obj->resv); + ret = reservation_object_get_fences_rcu(obj->resv, true, NULL, + &count, &fences); + if (ret) + return ret; + + if (count == 0) { + fence = NULL; + } else if (count == 1) { + fence = fences[0]; + kfree(fences); + } else { + uint64_t context = dma_fence_context_alloc(1); + struct dma_fence_array *array; + + array = dma_fence_array_create(count, fences, context, + 1, false); + if (!array) { + kfree(fences); + return -ENOMEM; + } + fence = &array->base; + } + if (fence) { add_rps_boost_after_vblank(new_state->crtc, fence); dma_fence_put(fence);