From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Marc-André Lureau" <marcandre.lureau@gmail.com>,
"Gerd Hoffmann" <kraxel@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>
Subject: [Qemu-devel] [PATCH 5/6] virtio-gpu: add support to enable/disable command processing
Date: Wed, 13 Jan 2016 13:02:27 +0100 [thread overview]
Message-ID: <1452686548-6291-6-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1452686548-6291-1-git-send-email-kraxel@redhat.com>
So we can stop rendering for a while in case we have to.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/display/virtio-gpu-3d.c | 3 ++-
hw/display/virtio-gpu.c | 5 ++++-
include/hw/virtio/virtio-gpu.h | 2 ++
3 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/hw/display/virtio-gpu-3d.c b/hw/display/virtio-gpu-3d.c
index d2af327..65926b1 100644
--- a/hw/display/virtio-gpu-3d.c
+++ b/hw/display/virtio-gpu-3d.c
@@ -553,7 +553,8 @@ static void virtio_gpu_fence_poll(void *opaque)
VirtIOGPU *g = opaque;
virgl_renderer_poll();
- if (g->inflight) {
+ virtio_cpu_process_cmdq(g);
+ if (!QTAILQ_EMPTY(&g->cmdq) || !QTAILQ_EMPTY(&g->fenceq)) {
timer_mod(g->fence_poll, qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL) + 10);
}
}
diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
index 4433c12..9087e63 100644
--- a/hw/display/virtio-gpu.c
+++ b/hw/display/virtio-gpu.c
@@ -754,7 +754,7 @@ static void virtio_gpu_handle_cursor_cb(VirtIODevice *vdev, VirtQueue *vq)
qemu_bh_schedule(g->cursor_bh);
}
-static void virtio_cpu_process_cmdq(VirtIOGPU *g)
+void virtio_cpu_process_cmdq(VirtIOGPU *g)
{
struct virtio_gpu_ctrl_command *cmd;
@@ -764,6 +764,9 @@ static void virtio_cpu_process_cmdq(VirtIOGPU *g)
/* process command */
VIRGL(g, virtio_gpu_virgl_process_cmd, virtio_gpu_simple_process_cmd,
g, cmd);
+ if (cmd->waiting) {
+ break;
+ }
QTAILQ_REMOVE(&g->cmdq, cmd, next);
if (virtio_gpu_stats_enabled(g->conf)) {
g->stats.requests++;
diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h
index f7e7a52..fdf0091 100644
--- a/include/hw/virtio/virtio-gpu.h
+++ b/include/hw/virtio/virtio-gpu.h
@@ -76,6 +76,7 @@ struct virtio_gpu_ctrl_command {
VirtQueue *vq;
struct virtio_gpu_ctrl_hdr cmd_hdr;
uint32_t error;
+ bool waiting;
bool finished;
QTAILQ_ENTRY(virtio_gpu_ctrl_command) next;
};
@@ -152,6 +153,7 @@ int virtio_gpu_create_mapping_iov(struct virtio_gpu_resource_attach_backing *ab,
struct virtio_gpu_ctrl_command *cmd,
struct iovec **iov);
void virtio_gpu_cleanup_mapping_iov(struct iovec *iov, uint32_t count);
+void virtio_cpu_process_cmdq(VirtIOGPU *g);
/* virtio-gpu-3d.c */
void virtio_gpu_virgl_process_cmd(VirtIOGPU *g,
--
1.8.3.1
next prev parent reply other threads:[~2016-01-13 12:02 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-13 12:02 [Qemu-devel] [PATCH 0/6] virtio-gpu: fixes and spice preparation Gerd Hoffmann
2016-01-13 12:02 ` [Qemu-devel] [PATCH 1/6] zap qemu_egl_has_ext in include/ui/egl-helpers.h Gerd Hoffmann
2016-01-13 13:07 ` Marc-André Lureau
2016-01-13 12:02 ` [Qemu-devel] [PATCH 2/6] console: block rendering until client is done Gerd Hoffmann
2016-01-13 13:08 ` Marc-André Lureau
2016-01-13 12:02 ` [Qemu-devel] [PATCH 3/6] virtio-gpu: fix memory leak in error path Gerd Hoffmann
2016-01-13 13:09 ` Marc-André Lureau
2016-01-13 12:02 ` [Qemu-devel] [PATCH 4/6] virtio-gpu: maintain command queue Gerd Hoffmann
2016-01-13 13:24 ` Marc-André Lureau
2016-01-13 12:02 ` Gerd Hoffmann [this message]
2016-01-13 13:25 ` [Qemu-devel] [PATCH 5/6] virtio-gpu: add support to enable/disable command processing Marc-André Lureau
2016-01-13 12:02 ` [Qemu-devel] [PATCH 6/6] virtio-gpu: block any rendering until client (ui) is done Gerd Hoffmann
2016-01-13 13:07 ` Marc-André Lureau
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1452686548-6291-6-git-send-email-kraxel@redhat.com \
--to=kraxel@redhat.com \
--cc=marcandre.lureau@gmail.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).