Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp2753948rwe; Sun, 16 Apr 2023 04:55:56 -0700 (PDT) X-Google-Smtp-Source: AKy350by2JDK/CxU3FHICoF4ayv1iU136tzLa2kG2uKDyswmyxxY9YXQIqqviRu6aZrPYDcb3sUu X-Received: by 2002:a17:903:410b:b0:1a5:253f:ace0 with SMTP id r11-20020a170903410b00b001a5253face0mr8632523pld.37.1681646156721; Sun, 16 Apr 2023 04:55:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681646156; cv=none; d=google.com; s=arc-20160816; b=u9COQ5BKNbFdwh5lpIijdv9GaemfdfK4gI2jptNwJiv9ovg/npAmQoDhGJgfdQWoD8 b3M4AMQlb9+TY+D8iWoMXUKIw/El7VZWDshLglQvWX+WlUrKnQSPGHIvwXQozLS7WrVE AmX7+ABg9UbW2DXQJNuDuO66ZU1xBXOVzp8F6ZGYGAt9lPFztQpZLSKNKcfB2bJ4YQsX J+/QPy9jIwbKIm18a+qr6GYXjBGwMXqnVjXVW5GMO7L9gAY/lXkRQw5Hllzy7jE8duv2 6Nx2GEVMYH68dB03wXfs+XscjUOXFX+PsMzqZgeSjwEZoGIxsR7W520vyZl/pLLsS+G0 1OgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=/NLSEWrI1YayHmBS1y+SKekJNck6BO+w48S8RInuXF4=; b=qBZuKVUHT4RS2K0q2RrkfebMmYPfH31vCVDZHWkVrzkPzH88cPD9bdSGGsyGLXMwlQ CakPVYQ4qUJq25Nr+iOG86ewjOwEKi9wfGzhDLdzzYo8oBSw9terPn4jMeOSoKWWJs96 qj8zGs1goy/UabClcOG9FFLPO0dwQVeguBigOwW/dQO1oIykTTRiSyitLxnCv5XvUgdF O7cjhPKaeBoJ5Il/Dv88j4JLHSyDR+mjpRJfa21rXHIGoFkY2bwHTMpKCU2f8Pj+HebS hEvQNzFsC3JzoGtATtGCnuX0YJ3JaK3OvTMhfwWcqDMGFEyUPtS7II2gUda7zWi3Nma1 QnuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=oMxpQFyz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jh1-20020a170903328100b001a50ede507csi9247445plb.171.2023.04.16.04.55.43; Sun, 16 Apr 2023 04:55:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=oMxpQFyz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230137AbjDPLxc (ORCPT + 99 others); Sun, 16 Apr 2023 07:53:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229868AbjDPLxZ (ORCPT ); Sun, 16 Apr 2023 07:53:25 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 61CCE2108 for ; Sun, 16 Apr 2023 04:53:23 -0700 (PDT) Received: from workpc.. (unknown [IPv6:2a00:1370:817e:4eb4:c5e6:4b85:1e3f:55e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: dmitry.osipenko) by madras.collabora.co.uk (Postfix) with ESMTPSA id 2D3BB6603234; Sun, 16 Apr 2023 12:53:21 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1681646002; bh=fwT8AKV/EdqplpLFzWlWVv7m8/aj98/oTicpTA0Rbz4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oMxpQFyz3KOewQkhNGyNtbZlH8KUH+MUBOIxKxD+TX3NCNKuGqTaGGpbY1V1SiVa+ VFOLzIPfnQSzQWsYplt2PGzWPjkcsdgAYQ7JJCZrsUsvZf1irZ/HaWT1j0Q0GQv5/k 6YOEO396U+X7FUgs1XOmqanti7Ip5mUNdaIHEx0RDHYu0MNJGfPCxkZx14yv2riJsp pDIT2llV8OzMarEibdu5YJ+WfLKkAwJ9vMfQdFpU6GgKprQmdwUt7Lrs4tWr6s65pH wZkkdJdoYSIbvb+wZqio4n20Unw6Iu4Rfy69XwJitXR+fhRPGm2hv63lPkHa3M05Rl 7NLdXak1+ZKZQ== From: Dmitry Osipenko To: David Airlie , Gerd Hoffmann , Gurchetan Singh , Chia-I Wu , Daniel Vetter , Rob Clark , =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= , Pierre-Eric Pelloux-Prayer , Emil Velikov Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, kernel@collabora.com, virtualization@lists.linux-foundation.org Subject: [PATCH v6 2/3] drm/virtio: Wait for each dma-fence of in-fence array individually Date: Sun, 16 Apr 2023 14:52:36 +0300 Message-Id: <20230416115237.798604-3-dmitry.osipenko@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230416115237.798604-1-dmitry.osipenko@collabora.com> References: <20230416115237.798604-1-dmitry.osipenko@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use dma-fence-unwrap API for waiting each dma-fence of the in-fence array individually. Sync file's in-fence array always has a non-matching fence context ID, which doesn't allow to skip waiting of fences with a matching context ID in a case of a merged sync file fence. Suggested-by: Rob Clark Reviewed-by; Emil Velikov Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/virtio/virtgpu_submit.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_submit.c b/drivers/gpu/drm/virtio/virtgpu_submit.c index 84e7c4d9d8c7..cf3c04b16a7a 100644 --- a/drivers/gpu/drm/virtio/virtgpu_submit.c +++ b/drivers/gpu/drm/virtio/virtgpu_submit.c @@ -32,8 +32,8 @@ struct virtio_gpu_submit { void *buf; }; -static int virtio_gpu_dma_fence_wait(struct virtio_gpu_submit *submit, - struct dma_fence *in_fence) +static int virtio_gpu_do_fence_wait(struct virtio_gpu_submit *submit, + struct dma_fence *in_fence) { u32 context = submit->fence_ctx + submit->ring_idx; @@ -43,6 +43,22 @@ static int virtio_gpu_dma_fence_wait(struct virtio_gpu_submit *submit, return dma_fence_wait(in_fence, true); } +static int virtio_gpu_dma_fence_wait(struct virtio_gpu_submit *submit, + struct dma_fence *fence) +{ + struct dma_fence_unwrap itr; + struct dma_fence *f; + int err; + + dma_fence_unwrap_for_each(f, &itr, fence) { + err = virtio_gpu_do_fence_wait(submit, f); + if (err) + return err; + } + + return 0; +} + static int virtio_gpu_fence_event_create(struct drm_device *dev, struct drm_file *file, struct virtio_gpu_fence *fence, -- 2.39.2