Message ID | 20230409123957.29553-1-dmitry.osipenko@collabora.com |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1350981vqo; Sun, 9 Apr 2023 05:41:42 -0700 (PDT) X-Google-Smtp-Source: AKy350ZBDww6X+2m1Mv+DrtZsxP35sKC33FkxeQohoaAhiFOdJ5p212BuMMIVCQVDk2Yph8Ue3xR X-Received: by 2002:a05:6402:1a43:b0:504:8c15:a132 with SMTP id bf3-20020a0564021a4300b005048c15a132mr2966728edb.7.1681044102577; Sun, 09 Apr 2023 05:41:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681044102; cv=none; d=google.com; s=arc-20160816; b=wQ7aP6aJddDtzYxgDsrG398wrbT+WCXPYKi/c82yaWmeecqu3JvIOX6RlluxqD3QUS zkbXPYhyIJheFb+DzQnlj4+BQVF5YqhSyc47KUWGOrgwkliYFqbFgQWrqAdPizC1V33+ BbHniQFAEXtPS7mK0rDWKL+6bHmJIMttt7d2g30GSionV/bxJYevxeRD/OMRR60cDQB7 UX8Ifl/DPBYQpcUuX1SOcJws9y2HQQgYNF6guOS2684QaFZnxJBMc7S1R6dqAgPLFu+a AT96Kd3aq+TOr9V+nXvfda2bBOq0KFaF7hEiQL480ex0ZIy87Hx+wUgxORerlqcTxLWS y3Tw== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=fXJgHBH9mfF3ZrOytNxPK3FfJifrkpQSc7IEoxSHjP4=; b=hNYUIKJeSQVF5RnIxY/QORKMXp/rGzA1BuMbvBzzc2YRH3vnXMEoW2rmmH2vwMSjI6 xpX6StDESfQ10aCClb5XFChWQP3xo65fyda65dGNsCQT3DzeqDxhOUMn3tv4VRpkAK4u fBhURh5QrLNL93Y0+97oA2FSb8mtllKdoAgO8zzZArNnKqMr4JgIhr9AXCSwv2+83Z5Q n1HkDoYf68zxEykD6g7W5KOxnO4I1mesm52JukjEL5rSdpfblMeCgiywIhqYNDFuF1rn V0nChSqMDfaz9fEoJj8wMGpTnKMJmO55Wk9mMuMa/eNf9qnuXLTRn5PqDuD1KZocX83x mAdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=DcOzSPwD; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e9-20020a50ec89000000b004c5248cbebfsi7060160edr.101.2023.04.09.05.41.18; Sun, 09 Apr 2023 05:41:42 -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=DcOzSPwD; 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 S229535AbjDIMko (ORCPT <rfc822;yuanzuo1009@gmail.com> + 99 others); Sun, 9 Apr 2023 08:40:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229445AbjDIMkn (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sun, 9 Apr 2023 08:40:43 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6113D3C2B for <linux-kernel@vger.kernel.org>; Sun, 9 Apr 2023 05:40:41 -0700 (PDT) Received: from workpc.. (109-252-119-170.nat.spd-mgts.ru [109.252.119.170]) (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 EB7D066020BC; Sun, 9 Apr 2023 13:40:38 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1681044039; bh=bPrSkwuEqRmI1vpmXrQbCoxtf7GIDRJuWjcQetr4Ejo=; h=From:To:Cc:Subject:Date:From; b=DcOzSPwDRjPPSx1bIPWUZVUzmeVK3QIQS2tNITDWtR8fM1mOqn7BX9qLB0FInPYaX 4Tg2GQFL0a1CGQfxnh4SkIyWaarmdWRFPjS9T4q4N/dTr37aQvHhYV4qxDpzTtbjob 184tBIIuTrlC3bu3PoN9hWGTRWEYIQKplT1exevA1AUJkqaPDlitMh9+/XXJA0RGDB uEn2lJzW/dtHwdzvvacewM5hFlU0X1kDsYbEAsTDotNP2deH7FFEK7Uo3XIO3kUL0C eYO0CYrHoopc716vVzG6zZEC6vdi1Qh2x4HXNN/3sMuM1Tks6Vg1wTQ4LiUmrER5rX mJ6CDw6TNa3ng== From: Dmitry Osipenko <dmitry.osipenko@collabora.com> To: David Airlie <airlied@redhat.com>, Gerd Hoffmann <kraxel@redhat.com>, Gurchetan Singh <gurchetansingh@chromium.org>, Chia-I Wu <olvaffe@gmail.com>, Daniel Vetter <daniel@ffwll.ch>, Rob Clark <robdclark@gmail.com>, =?utf-8?b?TWFyZWsgT2zFocOhaw==?= <maraeo@gmail.com>, Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>, Emil Velikov <emil.velikov@collabora.com> Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, kernel@collabora.com, virtualization@lists.linux-foundation.org Subject: [PATCH v5 0/3] Add sync object UAPI support to VirtIO-GPU driver Date: Sun, 9 Apr 2023 15:39:54 +0300 Message-Id: <20230409123957.29553-1-dmitry.osipenko@collabora.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762702500603240637?= X-GMAIL-MSGID: =?utf-8?q?1762702500603240637?= |
Series |
Add sync object UAPI support to VirtIO-GPU driver
|
|
Message
Dmitry Osipenko
April 9, 2023, 12:39 p.m. UTC
We have multiple Vulkan context types that are awaiting for the addition of the sync object DRM UAPI support to the VirtIO-GPU kernel driver: 1. Venus context 2. Native contexts (virtio-freedreno, virtio-intel, virtio-amdgpu) Mesa core supports DRM sync object UAPI, providing Vulkan drivers with a generic fencing implementation that we want to utilize. This patch adds initial sync objects support. It creates fundament for a further fencing improvements. Later on we will want to extend the VirtIO-GPU fencing API with passing fence IDs to host for waiting, it will be a new additional VirtIO-GPU IOCTL and more. Today we have several VirtIO-GPU context drivers in works that require VirtIO-GPU to support sync objects UAPI. The patch is heavily inspired by the sync object UAPI implementation of the MSM driver. Changelog: v5: - Factored out dma-fence unwrap API usage into separate patch as was suggested by Emil Velikov. - Improved and documented the job submission reorderings as was requested by Emil Velikov. Sync file FD is now installed after job is submitted to virtio to further optimize reorderings. - Added comment for the kvalloc, as was requested by Emil Velikov. - The num_in/out_syncobjs now is set only after completed parsing of pre/post deps, as was requested by Emil Velikov. v4: - Added r-b from Rob Clark to the "refactoring" patch. - Replaced for/while(ptr && itr) with if (ptr), like was suggested by Rob Clark. - Dropped NOWARN and NORETRY GFP flags and switched syncobj patch to use kvmalloc. - Removed unused variables from syncobj patch that were borrowed by accident from another (upcoming) patch after one of git rebases. v3: - Switched to use dma_fence_unwrap_for_each(), like was suggested by Rob Clark. - Fixed missing dma_fence_put() in error code path that was spotted by Rob Clark. - Removed obsoleted comment to virtio_gpu_execbuffer_ioctl(), like was suggested by Rob Clark. v2: - Fixed chain-fence context matching by making use of dma_fence_chain_contained(). - Fixed potential uninitialized var usage in error code patch of parse_post_deps(). MSM driver had a similar issue that is fixed already in upstream. - Added new patch that refactors job submission code path. I found that it was very difficult to add a new/upcoming host-waits feature because of how variables are passed around the code, the virtgpu_ioctl.c also was growing to unmanageable size. Dmitry Osipenko (3): drm/virtio: Refactor and optimize job submission code path drm/virtio: Wait for each dma-fence of in-fence array individually drm/virtio: Support sync objects drivers/gpu/drm/virtio/Makefile | 2 +- drivers/gpu/drm/virtio/virtgpu_drv.c | 3 +- drivers/gpu/drm/virtio/virtgpu_drv.h | 4 + drivers/gpu/drm/virtio/virtgpu_ioctl.c | 182 -------- drivers/gpu/drm/virtio/virtgpu_submit.c | 525 ++++++++++++++++++++++++ include/uapi/drm/virtgpu_drm.h | 16 +- 6 files changed, 547 insertions(+), 185 deletions(-) create mode 100644 drivers/gpu/drm/virtio/virtgpu_submit.c