From patchwork Wed Apr 6 07:51:24 2022 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: 12802667 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 76BC8C433F5 for ; Wed, 6 Apr 2022 07:52:02 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5C73A10F2DD; Wed, 6 Apr 2022 07:51:52 +0000 (UTC) Received: from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com [IPv6:2a00:1450:4864:20::62f]) by gabe.freedesktop.org (Postfix) with ESMTPS id D9DA210F2D8 for ; Wed, 6 Apr 2022 07:51:49 +0000 (UTC) Received: by mail-ej1-x62f.google.com with SMTP id a6so2618722ejk.0 for ; Wed, 06 Apr 2022 00:51:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references:reply-to :mime-version:content-transfer-encoding; bh=Q9J71JHfLi+jNvESRZI7/GeJZRTFH9JIsw/X6nmHqVg=; b=mjkQmZ+kYVo5DG7qCjJzpIzzWU1ZSLcSmO7HmEVkv0Te4t8WJqAmEBygzPMyK+dMwa 7jh3DTT/YXbLQ848CnQXG/X2oQZziRohGDOXea3n4GrXOv6SnAWJTu6rtmlP/7QuKeza keVIbt15cAfBkXP11NXSiNOIpofDRCE4+HbhmAt5lWZ5dv0HDdXGeuc4uG4dncYVZmxU wgq5NnrcCeh8heERDcKbSB9pZ230DAUpdfCVSOY7AEuf9OfeqqUVkX/mpL10Y5X1gndb vKYZ3xmc1hCZFRSIO97knE5w0MRz0nZXgCX9zPTZyfT3P2eFIfF8HpMHxiIGaUjqJmAG ZOXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:reply-to:mime-version:content-transfer-encoding; bh=Q9J71JHfLi+jNvESRZI7/GeJZRTFH9JIsw/X6nmHqVg=; b=Ac7MHRVfsJBQrKX3dB0nbIqlEpIRHiu01DKsppJWBCGQmUqv7dqZeKDWwZYoaSKyBJ Edbvv00gP9OC0Gq+YPWVHeMIsPaOTb981mRAS9zO+fiefosux3FsoUu9sg7nB2uwlf7P 5kWJRn95X8KANsNu1QF/VyYU4BvKDK7aj94cyxxDMHVw4nkuIBrowCc62XB+7A5beIT1 Pq3IRNR2u52TMtKUzYP4/G9jIqJA+0GpjhZdB5OOu7Q0xNiyYVvjVC/aGSs+heTgrrNC ea8mao/D8LzGdQyt+tbT4k9BpEOd+YPiB0JQ7p9pD5ez2QlPlh2dgNxobjMA7/LOcoUp YPXw== X-Gm-Message-State: AOAM5332L5URlSNOmYTOmr6NI7X8nmgCbJnS+XVHPYbMwns+q4bza/jk 9qTIoha2Ld1aIeKOGrZ+Xvg= X-Google-Smtp-Source: ABdhPJzzpWX0YjUIry/3gMKmj6LouW+H4HfoZAesD5IyKvRhvpkHUyiFd6ti3o0VtayI3jvlayIpxA== X-Received: by 2002:a17:907:168b:b0:6e7:f2a5:bb0f with SMTP id hc11-20020a170907168b00b006e7f2a5bb0fmr7087209ejc.162.1649231508447; Wed, 06 Apr 2022 00:51:48 -0700 (PDT) Received: from able.fritz.box (p57b0b9e1.dip0.t-ipconnect.de. [87.176.185.225]) by smtp.gmail.com with ESMTPSA id bs7-20020a056402304700b004197e5d2350sm7376386edb.54.2022.04.06.00.51.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 00:51:47 -0700 (PDT) From: " =?utf-8?q?Christian_K=C3=B6nig?= " X-Google-Original-From: =?utf-8?q?Christian_K=C3=B6nig?= To: daniel.vetter@ffwll.ch, dri-devel@lists.freedesktop.org Subject: [PATCH 08/16] drm/etnaviv: always wait for kernel fences Date: Wed, 6 Apr 2022 09:51:24 +0200 Message-Id: <20220406075132.3263-9-christian.koenig@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220406075132.3263-1-christian.koenig@amd.com> References: <20220406075132.3263-1-christian.koenig@amd.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: DMA-resv@freedesktop.org Cc: =?utf-8?q?Christian_K=C3=B6nig?= Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Even for explicit synchronization we should wait for kernel fences. Signed-off-by: Christian König --- drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c | 27 ++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c index 98bb5c9239de..3fedd29732d5 100644 --- a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c +++ b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c @@ -171,6 +171,26 @@ static int submit_lock_objects(struct etnaviv_gem_submit *submit, return ret; } +/* TODO: This should be moved into the GPU scheduler if others need it */ +static int submit_fence_kernel_sync(struct etnaviv_gem_submit *submit, + struct dma_resv *resv) +{ + struct dma_resv_iter cursor; + struct dma_fence *fence; + int ret; + + dma_resv_for_each_fence(&cursor, resv, DMA_RESV_USAGE_KERNEL, fence) { + /* Make sure to grab an additional ref on the added fence */ + dma_fence_get(fence); + ret = drm_sched_job_add_dependency(&submit->sched_job, fence); + if (ret) { + dma_fence_put(fence); + return ret; + } + } + return 0; +} + static int submit_fence_sync(struct etnaviv_gem_submit *submit) { int i, ret = 0; @@ -183,8 +203,11 @@ static int submit_fence_sync(struct etnaviv_gem_submit *submit) if (ret) return ret; - if (submit->flags & ETNA_SUBMIT_NO_IMPLICIT) - continue; + if (submit->flags & ETNA_SUBMIT_NO_IMPLICIT) { + ret = submit_fence_kernel_sync(submit, robj); + if (ret) + return ret; + } ret = drm_sched_job_add_implicit_dependencies(&submit->sched_job, &bo->obj->base,