Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp1122250rdb; Sat, 7 Oct 2023 13:01:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF7+eaweXTZbo56IklTzDcEwlWXquKhH8KQuXHFjMTAZnGEBEmJXxj9zSIXdlLGuCilkxIz X-Received: by 2002:a05:6a20:a11b:b0:16b:7fcb:4257 with SMTP id q27-20020a056a20a11b00b0016b7fcb4257mr5948377pzk.4.1696708874124; Sat, 07 Oct 2023 13:01:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696708874; cv=none; d=google.com; s=arc-20160816; b=HV1vQCpAyUws8+NI0RTaa8lvUtCD0KS/mekmgui2C6m3Gd2+VTTkNcx/s6cxtlzO/9 3HINmVGXRe8RkEsNO9eVxGxupIjVHgQ2klQXNY9PZHiobLmqxLXBP6QxUK5oueBAsPZy QpZrHxuiqZwrYFEKEZ04FtoFaD6TKvSEI15AQqwgfuY/rNPO0hKTl+PmoRqJZTPfKpNr 4RKM0iMoXdRiIHnnb84uWdKukeQlxauLJemuL0kgQly34hcZdvTTMPzhzMk/IlSikxYj wW9vpRRl5mxuACXFPAQVo2jAQKkEv94Pyd6Bkp66RF5e3EmHc62P/3kITovQANEIwJht bSFA== 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=TTozlHeJdc/fPDW0YDaQjKOIu+isQJnJsQ00cDeG/NY=; fh=GNzlhRgtjP+3N7WoIgoUvYLm71c4ccsH8v4zu3+c5fc=; b=YhpobP5+/TdaMYGPCHzATGer/LkgX+VZx73ATjyluq/HNaqFTPEDJ8ceRRqQdg0apT UpoW2pzYdEkQZ79y71x7MfwYIHiYmKsObXKmDxMlM1eaPT+YaQuvL18nbZIY96I3HBfX OPneOmNdzE191eTjeG9SMkb4wGOze0jt+ghFNQ8KMc1Y3MS4nbl6Jb2oT4r7HHncjWER oFmgV+l6fGOLspZXHWVXW/xauKc8H+G/RZ+gHZSfvasJCX/R7QJvsPzldEJ5kOJqT1/t vd1vNHP/GisVfyOO9iTy7mtQevyri85g1BDOIqPft4XIEqYLDhUgFxbFJtNWK+RoX9nS xOZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=liqlmvSZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id e6-20020a170902cf4600b001c88e81a54asi4133584plg.325.2023.10.07.13.01.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Oct 2023 13:01:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=liqlmvSZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id A3EB2807C84F; Sat, 7 Oct 2023 13:00:18 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344112AbjJGTtq (ORCPT + 99 others); Sat, 7 Oct 2023 15:49:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344079AbjJGTtq (ORCPT ); Sat, 7 Oct 2023 15:49:46 -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 525DDBA for ; Sat, 7 Oct 2023 12:49:44 -0700 (PDT) Received: from workpc.. (109-252-153-31.dynamic.spd-mgts.ru [109.252.153.31]) (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 7400F66072BB; Sat, 7 Oct 2023 20:49:41 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1696708182; bh=jxn4oc/yI6t62r9mg5ChscM72pMr3cCvBu3CCP7Cs/g=; h=From:To:Cc:Subject:Date:From; b=liqlmvSZT4yO6UtBzTcdCt/d6abZsK75MrkAEpI+A9MbqIPxv5WBFmvQh7Cbms9Ip TYs9H636XezCKy0ebIHYapixbk57d02cwRdRKyDEY0zl6XwOhKAvGs5sbaFWvDSBnQ xSLtyBxKlgVoq0t/Z7hB/o3fUOy840AngfP3X+ZNL1daTAfcVwcv5Sx+kyXOOaQo8f 8QZRE517bHDxxejGN/p7h3P18xybpXr+LPLwW/UBi9uXyFKSLw77G3Zd0i/2BPfTi4 bWRZ+KQQ9xKsWvgF7LF9PsTP2FYoRlp1FHlCvLVS4ij58LEKoNELAXP3eBbxFZuVcW f08VvYRj2I8iA== From: Dmitry Osipenko To: David Airlie , Gerd Hoffmann , Gurchetan Singh , Chia-I Wu , Rob Clark , Pierre-Eric Pelloux-Prayer Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, kernel@collabora.com, virtualization@lists.linux-foundation.org Subject: [RFC PATCH v1 0/1] Support passing VirtIO-GPU fences to host for waiting Date: Sat, 7 Oct 2023 22:47:46 +0300 Message-ID: <20231007194747.788934-1-dmitry.osipenko@collabora.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=2.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Sat, 07 Oct 2023 13:00:18 -0700 (PDT) X-Spam-Level: ** Today's VirtIO-GPU driver always has to wait for in-fences on the guest side, creating bottleneck for workloads that produce lots of job submissions or require lower submission latency. This bottleneck is caused by a need to do extra round trips between host and guest for the fence signalling. The solution is to move fence signalling and waiting entierly to the host side, where it can be done more efficiently, without holding the guest side. The proposed patch introduces new "fence passing" VirtIO-GPU protocol feature, which extends VIRTIO_GPU_CMD_SUBMIT_3D with array of in-fence IDs that are passed from guest to host along with the 3D commands. Host then takes the in-fence IDs and passes them to virglrender, where the fence IDs are resolved into sync file fences and handled (waited) by a corresponding virglrender context. The patch is RFC because we want to do more testing with crosvm and CrOS first, support fence-passing for Venus and virtio-wl. The new virglrender experimental fence-passing API already has been merged [1] and crosvm support began to pick it up [2]. Qemu patch is available at [3]. Fence passing was tested using WIP amdgpu and intel native contexts, where it proved to be useful by increasing FPS up to 3x times. [1] https://gitlab.freedesktop.org/virgl/virglrenderer/-/merge_requests/1138 [2] https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4679609 [3] https://gitlab.freedesktop.org/digetx/qemu/-/commits/native-context-iris Dmitry Osipenko (1): drm/virtio: Support fence-passing feature drivers/gpu/drm/virtio/virtgpu_drv.c | 1 + drivers/gpu/drm/virtio/virtgpu_drv.h | 11 ++- drivers/gpu/drm/virtio/virtgpu_fence.c | 15 +++- drivers/gpu/drm/virtio/virtgpu_ioctl.c | 11 ++- drivers/gpu/drm/virtio/virtgpu_kms.c | 8 +- drivers/gpu/drm/virtio/virtgpu_submit.c | 99 ++++++++++++++++++++++++- drivers/gpu/drm/virtio/virtgpu_vq.c | 7 +- include/uapi/drm/virtgpu_drm.h | 3 + include/uapi/linux/virtio_gpu.h | 11 ++- 9 files changed, 152 insertions(+), 14 deletions(-) -- 2.41.0