qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL 0/1] Vga 20180227 patches
@ 2018-02-27  7:30 Gerd Hoffmann
  2018-02-27  7:31 ` [Qemu-devel] [PULL 1/1] virtio-gpu-3d: add support for second capability set (v4) Gerd Hoffmann
  2018-02-27 15:44 ` [Qemu-devel] [PULL 0/1] Vga 20180227 patches Peter Maydell
  0 siblings, 2 replies; 3+ messages in thread
From: Gerd Hoffmann @ 2018-02-27  7:30 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann

The following changes since commit 0a773d55ac76c5aa89ed9187a3bc5af8c5c2a6d0:

  maintainers: Add myself as a OpenBSD maintainer (2018-02-23 12:05:07 +0000)

are available in the git repository at:

  git://git.kraxel.org/qemu tags/vga-20180227-pull-request

for you to fetch changes up to 5643cc94ac1cbc23e1ba6b16b6a88e1ce7b3f6a9:

  virtio-gpu-3d: add support for second capability set (v4) (2018-02-26 13:41:34 +0100)

----------------------------------------------------------------
virtio-gpu: add support for second capability set

----------------------------------------------------------------

Dave Airlie (1):
  virtio-gpu-3d: add support for second capability set (v4)

 include/hw/virtio/virtio-gpu.h              |  2 +-
 include/standard-headers/linux/virtio_gpu.h |  1 +
 hw/display/virtio-gpu-3d.c                  | 15 +++++++++++++++
 hw/display/virtio-gpu.c                     |  7 ++++++-
 4 files changed, 23 insertions(+), 2 deletions(-)

-- 
2.9.3

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Qemu-devel] [PULL 1/1] virtio-gpu-3d: add support for second capability set (v4)
  2018-02-27  7:30 [Qemu-devel] [PULL 0/1] Vga 20180227 patches Gerd Hoffmann
@ 2018-02-27  7:31 ` Gerd Hoffmann
  2018-02-27 15:44 ` [Qemu-devel] [PULL 0/1] Vga 20180227 patches Peter Maydell
  1 sibling, 0 replies; 3+ messages in thread
From: Gerd Hoffmann @ 2018-02-27  7:31 UTC (permalink / raw)
  To: qemu-devel; +Cc: Dave Airlie, Gerd Hoffmann, Michael S. Tsirkin

From: Dave Airlie <airlied@redhat.com>

Due to a kernel bug we can never increase the size of capability
set 1, so introduce a new capability set in parallel, old userspace
will continue to use the old set, new userspace will start using
the new one when it detects a fixed kernel.

v2: don't use a define from virglrenderer, just probe it.
v3: fix compilation when virglrenderer disabled
v4: fix style warning, just use ?: op instead.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Message-id: 20180223023814.24459-1-airlied@gmail.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 include/hw/virtio/virtio-gpu.h              |  2 +-
 include/standard-headers/linux/virtio_gpu.h |  1 +
 hw/display/virtio-gpu-3d.c                  | 15 +++++++++++++++
 hw/display/virtio-gpu.c                     |  7 ++++++-
 4 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h
index 83f474ffc3..22ac3c2d0e 100644
--- a/include/hw/virtio/virtio-gpu.h
+++ b/include/hw/virtio/virtio-gpu.h
@@ -171,5 +171,5 @@ void virtio_gpu_virgl_fence_poll(VirtIOGPU *g);
 void virtio_gpu_virgl_reset(VirtIOGPU *g);
 void virtio_gpu_gl_block(void *opaque, bool block);
 int virtio_gpu_virgl_init(VirtIOGPU *g);
-
+int virtio_gpu_virgl_get_num_capsets(VirtIOGPU *g);
 #endif
diff --git a/include/standard-headers/linux/virtio_gpu.h b/include/standard-headers/linux/virtio_gpu.h
index c1c8f0751d..52a830dcf8 100644
--- a/include/standard-headers/linux/virtio_gpu.h
+++ b/include/standard-headers/linux/virtio_gpu.h
@@ -260,6 +260,7 @@ struct virtio_gpu_cmd_submit {
 };
 
 #define VIRTIO_GPU_CAPSET_VIRGL 1
+#define VIRTIO_GPU_CAPSET_VIRGL2 2
 
 /* VIRTIO_GPU_CMD_GET_CAPSET_INFO */
 struct virtio_gpu_get_capset_info {
diff --git a/hw/display/virtio-gpu-3d.c b/hw/display/virtio-gpu-3d.c
index 7db84efe89..3558f38fe8 100644
--- a/hw/display/virtio-gpu-3d.c
+++ b/hw/display/virtio-gpu-3d.c
@@ -362,6 +362,11 @@ static void virgl_cmd_get_capset_info(VirtIOGPU *g,
         virgl_renderer_get_cap_set(resp.capset_id,
                                    &resp.capset_max_version,
                                    &resp.capset_max_size);
+    } else if (info.capset_index == 1) {
+        resp.capset_id = VIRTIO_GPU_CAPSET_VIRGL2;
+        virgl_renderer_get_cap_set(resp.capset_id,
+                                   &resp.capset_max_version,
+                                   &resp.capset_max_size);
     } else {
         resp.capset_max_version = 0;
         resp.capset_max_size = 0;
@@ -635,4 +640,14 @@ int virtio_gpu_virgl_init(VirtIOGPU *g)
     return 0;
 }
 
+int virtio_gpu_virgl_get_num_capsets(VirtIOGPU *g)
+{
+    uint32_t capset2_max_ver, capset2_max_size;
+    virgl_renderer_get_cap_set(VIRTIO_GPU_CAPSET_VIRGL2,
+                              &capset2_max_ver,
+                              &capset2_max_size);
+
+    return capset2_max_ver ? 2 : 1;
+}
+
 #endif /* CONFIG_VIRGL */
diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
index 6658f6c6a6..2dd3c3481a 100644
--- a/hw/display/virtio-gpu.c
+++ b/hw/display/virtio-gpu.c
@@ -1215,7 +1215,12 @@ static void virtio_gpu_device_realize(DeviceState *qdev, Error **errp)
         /* use larger control queue in 3d mode */
         g->ctrl_vq   = virtio_add_queue(vdev, 256, virtio_gpu_handle_ctrl_cb);
         g->cursor_vq = virtio_add_queue(vdev, 16, virtio_gpu_handle_cursor_cb);
-        g->virtio_config.num_capsets = 1;
+
+#if defined(CONFIG_VIRGL)
+        g->virtio_config.num_capsets = virtio_gpu_virgl_get_num_capsets(g);
+#else
+        g->virtio_config.num_capsets = 0;
+#endif
     } else {
         g->ctrl_vq   = virtio_add_queue(vdev, 64, virtio_gpu_handle_ctrl_cb);
         g->cursor_vq = virtio_add_queue(vdev, 16, virtio_gpu_handle_cursor_cb);
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PULL 0/1] Vga 20180227 patches
  2018-02-27  7:30 [Qemu-devel] [PULL 0/1] Vga 20180227 patches Gerd Hoffmann
  2018-02-27  7:31 ` [Qemu-devel] [PULL 1/1] virtio-gpu-3d: add support for second capability set (v4) Gerd Hoffmann
@ 2018-02-27 15:44 ` Peter Maydell
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Maydell @ 2018-02-27 15:44 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: QEMU Developers

On 27 February 2018 at 07:30, Gerd Hoffmann <kraxel@redhat.com> wrote:
> The following changes since commit 0a773d55ac76c5aa89ed9187a3bc5af8c5c2a6d0:
>
>   maintainers: Add myself as a OpenBSD maintainer (2018-02-23 12:05:07 +0000)
>
> are available in the git repository at:
>
>   git://git.kraxel.org/qemu tags/vga-20180227-pull-request
>
> for you to fetch changes up to 5643cc94ac1cbc23e1ba6b16b6a88e1ce7b3f6a9:
>
>   virtio-gpu-3d: add support for second capability set (v4) (2018-02-26 13:41:34 +0100)
>
> ----------------------------------------------------------------
> virtio-gpu: add support for second capability set
>
> ----------------------------------------------------------------
>

Applied, thanks.

-- PMM

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-02-27 15:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-27  7:30 [Qemu-devel] [PULL 0/1] Vga 20180227 patches Gerd Hoffmann
2018-02-27  7:31 ` [Qemu-devel] [PULL 1/1] virtio-gpu-3d: add support for second capability set (v4) Gerd Hoffmann
2018-02-27 15:44 ` [Qemu-devel] [PULL 0/1] Vga 20180227 patches Peter Maydell

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).