virtio-gpu: add support for second capability set

-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJalQkXAAoJEEy22O7T6HE4bh0P/jCpdigURAAny02YuBXkf3Wr
 Zz4SHF3gRz1Eu8fu9Ps81J3F3ZmJ18PxoQk3IjhX1u86qhm9WVcGtahZj3U2kjZi
 M2Wrgm2QB74dyCy3dzJdBVti9yrw/9f/7pVhNhXCO+OvkCPdCtq6002ZE2gjVFf4
 J2x4YjvgGYBSi6VIDlJzwilXM0DofvkJ6C++y+k0g0w5Ldv7fAbjXx2lHmETxelT
 OyPPtAIIaMEnosiRZIG6SbxHsjq+Uj5TBY7mqbbs8ZC1EQ3BCXZsX0R/qhXrN3Pl
 YX/ncA14OSKZAoTZQAPqaxBBOiHCZgnw0E1SauKQ6EeTlsd0nxP9DaXZ4jFXU0PO
 ZRPI+tqjHF1yAFj7UEYowJ5+DioUbB4iGr24Iqy87Kn5xB2aQ9+k/53LhfiPuwt5
 C+VgiTLbVsalZ6vzO426w43TOBT9gsCBhKMRPjdFc3fwgyjUR7QhEU3ju5EhFhja
 ueLyAeFmsA8rUie0pPaiDLZNyldqDRPRsMqulHzP+k8u9ap9lCCoytaHwOz1NVkn
 LrJkDPWSS98+eM486Q8A6kgwOwGUhe4xnApec9Bodj7zexrsFaNgFs6cIZbfQbOc
 MSPRmHdI2hlXOBPHm9yoYfTGmT8r6wcBqf0m/g9v9tzVsCImIPPetQ92WhpZaNvS
 4AuTExBwqRrAnVLzk0E/
 =gESE
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/kraxel/tags/vga-20180227-pull-request' into staging

virtio-gpu: add support for second capability set

# gpg: Signature made Tue 27 Feb 2018 07:30:31 GMT
# gpg:                using RSA key 4CB6D8EED3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"
# Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138

* remotes/kraxel/tags/vga-20180227-pull-request:
  virtio-gpu-3d: add support for second capability set (v4)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2018-02-27 14:01:19 +00:00
commit 3ec7b5d819
4 changed files with 23 additions and 2 deletions

View File

@ -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 */

View File

@ -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);

View File

@ -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

View File

@ -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 {