Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp21274rwl; Thu, 23 Mar 2023 12:07:10 -0700 (PDT) X-Google-Smtp-Source: AK7set/nXSGvgTJGyuWmRNZVhqS2xo1sGjuy854jfRsn1c5L3depjIU2RFIzPoCtcfD0iK/p7Ua3 X-Received: by 2002:a05:6a20:66a9:b0:d9:43a5:8cd0 with SMTP id o41-20020a056a2066a900b000d943a58cd0mr575047pzh.14.1679598429814; Thu, 23 Mar 2023 12:07:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679598429; cv=none; d=google.com; s=arc-20160816; b=bEtBMDq/13xcPLGlwn6OHCxCTrfxJMIyJq5zQhSh7cnVE3mmIE6JUZIKMqE4+eyQFA Gp/Can9nyVHZzMOmv/o6wNTyOVYSq6yJeWYpz1wxNeha4aHN5yeRc9BCDI8FIP8LNeb8 Ey2XS+M+SEuBVTykOw+rrOmeKpH1OYH3aYZezqdgqtDjscy6rghT2oi+CU8AkiI0tCXe I9KNRlIQ0BZu4DnHNnZwVrDgkV8GsQCg0OFAq7bgjyjsogybg8cTS6jbyFUJZjDr2MPQ gbTCg3ZibO6Mze3sx+PaqZLSoWNd9FLbnQrxZhWajIyl1RQGIV4ZkL9Z1HRlcXKPDxe3 /bXg== 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=PHjBHnR3giXrfAEGTuUJ05nyf1oGyPkYQPHOU2syhfU=; b=i9rrYQhSf6Mm+oElkWwLo9mtFOfEkGBnzIvIdqH3OLDZTd+aZRWubqyzCL2CPKW3mc zbVIOgqp/Qu0FqD/52vgi9zk/eIn1gLEJsbP3+KRA6axvwjQa35p7shpebbn+2jjhwZx P3dQRVYoZ+weP8Yoe5pRHByOaJbr9mHkgRf3vn7yT2I8KrRqiiLi8BlE9jdm3Mv0sCBH e4EnNNhDDol+msIZy8YkyjqvS9OBKCLxLT/oiSN2i0xumpBvdfMiDkgP8ymHJ21Fnfm3 htHjQUGHNgq5v8mbWUsr+Njs12cKhDNjwpqEagc5ny18eSr6eHdhd3xg/Lp66dN/BHYh SmgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b="g5j/ChdZ"; 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 q16-20020a056a00151000b00624ac1abef6si3693850pfu.218.2023.03.23.12.06.57; Thu, 23 Mar 2023 12:07:09 -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="g5j/ChdZ"; 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 S231564AbjCWTFc (ORCPT + 99 others); Thu, 23 Mar 2023 15:05:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231464AbjCWTFb (ORCPT ); Thu, 23 Mar 2023 15:05:31 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 95DCD274AD for ; Thu, 23 Mar 2023 12:05:30 -0700 (PDT) Received: from workpc.. (109-252-120-116.nat.spd-mgts.ru [109.252.120.116]) (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 E618266030F3; Thu, 23 Mar 2023 19:05:27 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1679598329; bh=v8fPAAWWA6nbbxEf6OAFnarDXLLTXBINSP3vQpWeNuk=; h=From:To:Cc:Subject:Date:From; b=g5j/ChdZVl1HDfltRbYV/8/JzRgonxczfUHHn+4ZhVbIjA3wkohoCi1LXIKXIusqN maJrRXkLlY3dMNEoLGN7XDugT/mqghWhSgAi7DohPxVERWYh3Xrn+QoOmHcr5Ub6rg ivAuq5eABaYQ/oMNlnhL2gewOyEjfx3BvQqr3ZfKwJL2opyrFf9plu2EE4lg4lSZZa UEjZxiE5eYycfPdy3hOpga7ZN7SjBIWjfy9Wa0P9bMLH/rnz5mf3LR2lcWl0iUuj23 L6AHfmEpgVHHqztCqPkmA15ILDt0vu0PXgrB5zd8VNtxsFCN3WBby6Yh7E0PJmDcmd cgijwFKW9VBSA== 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 v3 0/2] Add sync object UAPI support to VirtIO-GPU driver Date: Thu, 23 Mar 2023 22:03:38 +0300 Message-Id: <20230323190340.950875-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: X-Mailing-List: linux-kernel@vger.kernel.org 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: 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 (2): drm/virtio: Refactor job submission code path 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 | 513 ++++++++++++++++++++++++ include/uapi/drm/virtgpu_drm.h | 16 +- 6 files changed, 535 insertions(+), 185 deletions(-) create mode 100644 drivers/gpu/drm/virtio/virtgpu_submit.c -- 2.39.2