From patchwork Mon Jun 21 19:24:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kasireddy, Vivek" X-Patchwork-Id: 12335573 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D0F5FC4743C for ; Mon, 21 Jun 2021 19:39:09 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 535806102A for ; Mon, 21 Jun 2021 19:39:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 535806102A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:49944 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lvPlE-00019d-Ad for qemu-devel@archiver.kernel.org; Mon, 21 Jun 2021 15:39:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39794) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lvPjf-0006xI-57 for qemu-devel@nongnu.org; Mon, 21 Jun 2021 15:37:31 -0400 Received: from mga02.intel.com ([134.134.136.20]:17368) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lvPjd-00081y-3N for qemu-devel@nongnu.org; Mon, 21 Jun 2021 15:37:30 -0400 IronPort-SDR: 2544dnsvXusKzcvVy+tWVd87cBOQcm2MKHKb7v5Qw4jqW+rgMAdYPjMLqoxODWdSKjUrRbLfAx OHor5IfHYhwA== X-IronPort-AV: E=McAfee;i="6200,9189,10022"; a="194056711" X-IronPort-AV: E=Sophos;i="5.83,289,1616482800"; d="scan'208";a="194056711" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Jun 2021 12:37:16 -0700 IronPort-SDR: 61dZK9TEpasX4xs5kWqa2xqfwk1KRUsPJLTgyZHEL+SXF+lMb9kKa5J/2ECn/ZO/G0dh2Qq+fj ZEW+7cste1mQ== X-IronPort-AV: E=Sophos;i="5.83,289,1616482800"; d="scan'208";a="473524006" Received: from vkasired-desk2.fm.intel.com ([10.105.128.127]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Jun 2021 12:37:15 -0700 From: Vivek Kasireddy To: qemu-devel@nongnu.org Subject: [PATCH v3 0/5] virtio-gpu: Add a default synchronization mechanism for blobs Date: Mon, 21 Jun 2021 12:24:20 -0700 Message-Id: <20210621192425.1188442-1-vivek.kasireddy@intel.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Received-SPF: pass client-ip=134.134.136.20; envelope-from=vivek.kasireddy@intel.com; helo=mga02.intel.com X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dongwon Kim , Tina Zhang , Vivek Kasireddy , Gerd Hoffmann Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" When the Guest and Host are using Blob resources, there is a chance that they may use the underlying storage associated with a Blob at the same time leading to glitches such as flickering or tearing. To prevent these from happening, the Host needs to ensure that it waits until its Blit is completed by the Host GPU before letting the Guest reuse the Blob. This should be the default behavior regardless of the type of Guest that is using Blob resources but would be particularly useful for Guests that are using frontbuffer rendering such as Linux with X or Windows 10, etc. The way it works is the Guest includes a fence as part of resource_flush and waits for it to be signalled. The Host will queue a repaint request and signal the fence after it completes waiting on the sync object associated with the Blit. v2: - Added more description in the cover letter - Removed the wait from resource_flush and included it in a gl_flushed() callback v3: - Instead of explicitly waiting on the sync object and stalling the thread, add the relevant fence fd to Qemu's main loop and wait for it to be signalled. (suggested by Gerd Hoffmann) Cc: Gerd Hoffmann Cc: Dongwon Kim Cc: Tina Zhang Vivek Kasireddy (5): ui/gtk: Create a common release_dmabuf helper ui/egl: Add egl helpers to help with synchronization ui: Create sync objects and fences only for blobs ui/gtk-egl: Wait for the draw signal for dmabuf blobs virtio-gpu: Add gl_flushed callback hw/display/virtio-gpu-udmabuf.c | 1 + hw/display/virtio-gpu.c | 32 ++++++++++++++++++++++-- include/ui/console.h | 3 +++ include/ui/egl-helpers.h | 3 +++ include/ui/gtk.h | 5 ++-- ui/egl-helpers.c | 26 ++++++++++++++++++++ ui/gtk-egl.c | 43 +++++++++++++++++++++++++++------ ui/gtk-gl-area.c | 20 +++++++++++++++ ui/gtk.c | 26 ++++++++++++++++++-- 9 files changed, 145 insertions(+), 14 deletions(-)