From patchwork Fri Jan 22 12:23:47 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 8089701 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 3346FBEEE5 for ; Fri, 22 Jan 2016 12:29:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 92FA0203AA for ; Fri, 22 Jan 2016 12:29:38 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D861B20272 for ; Fri, 22 Jan 2016 12:29:37 +0000 (UTC) Received: from localhost ([::1]:53045 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aMaqP-0001OR-5X for patchwork-qemu-devel@patchwork.kernel.org; Fri, 22 Jan 2016 07:29:37 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56491) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aMakx-00018p-9K for qemu-devel@nongnu.org; Fri, 22 Jan 2016 07:24:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aMakv-0001gM-9A for qemu-devel@nongnu.org; Fri, 22 Jan 2016 07:23:59 -0500 Received: from mx1.redhat.com ([209.132.183.28]:36244) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aMakv-0001g6-3q for qemu-devel@nongnu.org; Fri, 22 Jan 2016 07:23:57 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id C4C8D49DAF; Fri, 22 Jan 2016 12:23:56 +0000 (UTC) Received: from nilsson.home.kraxel.org (ovpn-116-19.ams2.redhat.com [10.36.116.19]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u0MCNtgY000861; Fri, 22 Jan 2016 07:23:56 -0500 Received: by nilsson.home.kraxel.org (Postfix, from userid 500) id BA3F680B78; Fri, 22 Jan 2016 13:23:50 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 22 Jan 2016 13:23:47 +0100 Message-Id: <1453465427-6961-7-git-send-email-kraxel@redhat.com> In-Reply-To: <1453465427-6961-1-git-send-email-kraxel@redhat.com> References: <1453465427-6961-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann , "Michael S. Tsirkin" Subject: [Qemu-devel] [PATCH v2 6/6] virtio-gpu: block any rendering until client (ui) is done X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Wire up gl_block callback, so ui code can request to stop virtio-gpu rendering. Signed-off-by: Gerd Hoffmann --- hw/display/virtio-gpu-3d.c | 5 +++++ hw/display/virtio-gpu.c | 11 +++++++++++ hw/display/virtio-vga.c | 10 ++++++++++ include/hw/virtio/virtio-gpu.h | 1 + 4 files changed, 27 insertions(+) diff --git a/hw/display/virtio-gpu-3d.c b/hw/display/virtio-gpu-3d.c index d6487f7..8906316 100644 --- a/hw/display/virtio-gpu-3d.c +++ b/hw/display/virtio-gpu-3d.c @@ -382,6 +382,11 @@ void virtio_gpu_virgl_process_cmd(VirtIOGPU *g, { VIRTIO_GPU_FILL_CMD(cmd->cmd_hdr); + cmd->waiting = g->renderer_blocked; + if (cmd->waiting) { + return; + } + virgl_renderer_force_ctx_0(); switch (cmd->cmd_hdr.type) { case VIRTIO_GPU_CMD_CTX_CREATE: diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c index e341d6e..ce02194 100644 --- a/hw/display/virtio-gpu.c +++ b/hw/display/virtio-gpu.c @@ -896,11 +896,22 @@ static int virtio_gpu_ui_info(void *opaque, uint32_t idx, QemuUIInfo *info) return 0; } +static void virtio_gpu_gl_block(void *opaque, bool block) +{ + VirtIOGPU *g = opaque; + + g->renderer_blocked = block; + if (!block) { + virtio_gpu_process_cmdq(g); + } +} + const GraphicHwOps virtio_gpu_ops = { .invalidate = virtio_gpu_invalidate_display, .gfx_update = virtio_gpu_update_display, .text_update = virtio_gpu_text_update, .ui_info = virtio_gpu_ui_info, + .gl_block = virtio_gpu_gl_block, }; static void virtio_gpu_device_realize(DeviceState *qdev, Error **errp) diff --git a/hw/display/virtio-vga.c b/hw/display/virtio-vga.c index f7e539f..255d419 100644 --- a/hw/display/virtio-vga.c +++ b/hw/display/virtio-vga.c @@ -65,11 +65,21 @@ static int virtio_vga_ui_info(void *opaque, uint32_t idx, QemuUIInfo *info) return -1; } +static void virtio_vga_gl_block(void *opaque, bool block) +{ + VirtIOVGA *vvga = opaque; + + if (virtio_gpu_ops.gl_block) { + virtio_gpu_ops.gl_block(&vvga->vdev, block); + } +} + static const GraphicHwOps virtio_vga_ops = { .invalidate = virtio_vga_invalidate_display, .gfx_update = virtio_vga_update_display, .text_update = virtio_vga_text_update, .ui_info = virtio_vga_ui_info, + .gl_block = virtio_vga_gl_block, }; /* VGA device wrapper around PCI device around virtio GPU */ diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h index f6cae0b..13b0ab0 100644 --- a/include/hw/virtio/virtio-gpu.h +++ b/include/hw/virtio/virtio-gpu.h @@ -107,6 +107,7 @@ typedef struct VirtIOGPU { bool use_virgl_renderer; bool renderer_inited; + bool renderer_blocked; QEMUTimer *fence_poll; QEMUTimer *print_stats;