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 lists.gnu.org (lists.gnu.org [209.51.188.17]) (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 82379CF45D7 for ; Mon, 12 Jan 2026 22:54:50 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vfQo8-0007bJ-NS; Mon, 12 Jan 2026 17:54:44 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vfQo6-0007IZ-Hd for qemu-devel@nongnu.org; Mon, 12 Jan 2026 17:54:42 -0500 Received: from sender4-pp-f112.zoho.com ([136.143.188.112]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vfQo4-0003mC-M5 for qemu-devel@nongnu.org; Mon, 12 Jan 2026 17:54:42 -0500 ARC-Seal: i=1; a=rsa-sha256; t=1768258461; cv=none; d=zohomail.com; s=zohoarc; b=bvkjyfc0pNUfV+b5aDb8o2RBnQu6vbNTESTx70rlBBnkKO8VgGl8enfOrkm9g9okk4egmtj3onASug3lefAFVTrEGDht7oiIMiqwzrsqlzu8kXyKGBWf02sCGWUqfydXDvwZGSe+BJp2G1xYSKFlJxyuZJIDlqgxyHJHd4Gg518= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1768258461; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To; bh=K2MyguF3EcMpoAQUk7gVQkDIoReD4SLa0AXEms7dnCA=; b=TQniZ0ZhfmHEViqZFAybATKMe4ppW9FllFvKFE2gfFcodLgew7Imc4tkfD+xqZSjakAtEKiDfP09hsow20/Vh9unZCR7hprVm83/xdKe05ex49SdOlm5GdiZZoGKm5bXKRotjFp4zTUc+qFYcKxCI+53/vBBIZpTI1Ww+HGpmuM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=collabora.com; spf=pass smtp.mailfrom=dmitry.osipenko@collabora.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1768258461; s=zohomail; d=collabora.com; i=dmitry.osipenko@collabora.com; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Reply-To; bh=K2MyguF3EcMpoAQUk7gVQkDIoReD4SLa0AXEms7dnCA=; b=cbAuoO3VXOGQh2If9zOrRol9uzdWWhDPTX53fAetJ2BXHyNQ5+XdSJOw+oaaUhuw mK7uKXxTU310fD/RR5cwWIPJrGAfyeWF0cviWvreznDZ6asz2OSgBNZjA/tszcRmOTn VgY2OstnHtqBtzXCxFziUYsC44UoY8EyAN9JzEic= Received: by mx.zohomail.com with SMTPS id 1768258459834849.5669739060426; Mon, 12 Jan 2026 14:54:19 -0800 (PST) From: Dmitry Osipenko To: Akihiko Odaki , Huang Rui , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Pierre-Eric Pelloux-Prayer , "Michael S . Tsirkin" , Paolo Bonzini , Yiwei Zhang , Sergio Lopez Pascual Cc: Gert Wollny , qemu-devel@nongnu.org, Gurchetan Singh , Alyssa Ross , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Alex Deucher , Stefano Stabellini , =?UTF-8?q?Christian=20K=C3=B6nig?= , Xenia Ragiadakou , Honglei Huang , Julia Zhang , Chen Jiqian , Rob Clark , Robert Beckett Subject: [RFC PATCH v9 0/5] Support mapping virtio-gpu virgl hostmem blobs using MAP_FIXED API Date: Tue, 13 Jan 2026 01:52:41 +0300 Message-ID: <20260112225246.3526313-1-dmitry.osipenko@collabora.com> X-Mailer: git-send-email 2.52.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ZohoMailClient: External Received-SPF: pass client-ip=136.143.188.112; envelope-from=dmitry.osipenko@collabora.com; helo=sender4-pp-f112.zoho.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Virglrender got a new API that allows mapping host blobs at a given memory address using MAP_FIXED mmap flag [1]. Usage of this new API brings major performance and stability improvement for venus and drm native contexts, see commit message of the RFC patch for details. Sending early to collect review feeback and have patch prepared by the time new version of libvirglrenderer will be released with the stabilized API. [1] https://gitlab.freedesktop.org/virgl/virglrenderer/-/merge_requests/1374 Based-on: 20251116125641.2255794-1-dmitry.osipenko@collabora.com Changelog: v9: - Added patch converting finish_unmapping to mapping_state that was suggested by Akihiko Odaki to address MR unmapping problem that may arise on resetting virtio-gpu. - Changed virtio_gpu_virgl_reset() to return true/false. Suggested by Akihiko Odaki. - Made virtio_gpu_virgl_reset() and virtio_gpu_virgl_init() static. v8: - Added virtio_gpu_virgl_update_render_state() to virgl_resume_cmdq_bh(), making sure that GPU is reset once cmd execution is resumed after suspencion. Suggested by Akihiko Odaki. v7: - Changed virtio_gpu_virgl_reset() to keep virtio-gpu in reset state when reset fails and renamed cmd_suspended -> suspended argument of resource_unref(), as was suggested by Akihiko Odaki. v6: - Updated comment for virtio_gpu_virgl_reset(), removing part telling that reset at "runtime" is unexpected and removing excessive error message about a failed reset. Requested by Akihiko Odaki. v5: - Switched to use error_setg_errno() for qemu_ram_mmap() error handling, as was suggested Akihiko Odaki. - Added r-b from Alex Bennée to the first patch. - Moved hostmem mapping offset validation to upper function as was suggested by Alex Bennée. - Dropped all patches and changes that made funcs to return -1 since it was rejected by Alex Bennée. Refactoring can be done later on in a separate patchset. - Extended clarifying comment of virtio_gpu_virgl_reset(). v4: - Addressed v3 review comments from Akihiko Odaki. - Dropped patch making resource_unmap() error reported as a host failure instead of guest and added patch improving resource_map_blob() error reporting. - Re-added CONFIG_WIN32 checks. - Added clarifying comment to virtio_gpu_virgl_reset() RE unsupported context restoring. v3: - Addressed v2 review comments from Akihiko Odaki. - Droped check for CONFIG_WIN32. My current understanding that MAP_FIXED is supported by Cygwin. - Added new patches resetting virgl resources, validating hostmem offset and improving error-handlings. - Added r-b from Akihiko Odaki to the frist patch and t-b from Yiwei Zhang to the map_fixed patch. v2: - Addressed v1 review comments from Akihiko Odaki - Added patch that removes unnecessary memory_region_set_enabled(), suggested by Akihiko Odaki Dmitry Osipenko (5): virtio-gpu: Remove superfluous memory_region_set_enabled() virtio-gpu: Validate hostmem mapping offset virtio-gpu: Replace finish_unmapping with mapping_state virtio-gpu: Destroy virgl resources on virtio-gpu reset virtio-gpu: Support mapping hostmem blobs with map_fixed hw/display/trace-events | 2 +- hw/display/virtio-gpu-gl.c | 58 ++++++--- hw/display/virtio-gpu-virgl.c | 216 ++++++++++++++++++++++++++++----- include/hw/virtio/virtio-gpu.h | 9 +- 4 files changed, 235 insertions(+), 50 deletions(-) -- 2.52.0