Add tracking of the bits acknowledged by the guest Signed-off-by: Maxim Davydov <maxim.davy...@virtuozzo.com> --- hw/display/vhost-user-gpu.c | 3 ++- hw/display/virtio-gpu.c | 8 +++++--- include/hw/virtio/virtio-gpu.h | 10 +++++----- 3 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/hw/display/vhost-user-gpu.c b/hw/display/vhost-user-gpu.c index 49df56c..8248a70 100644 --- a/hw/display/vhost-user-gpu.c +++ b/hw/display/vhost-user-gpu.c @@ -566,7 +566,8 @@ vhost_user_gpu_device_realize(DeviceState *qdev, Error **errp) } static Property vhost_user_gpu_properties[] = { - VIRTIO_GPU_BASE_PROPERTIES(VhostUserGPU, parent_obj.conf), + VIRTIO_GPU_BASE_PROPERTIES(VhostUserGPU, parent_obj.conf, + parent_obj.parent_obj.guest_features), DEFINE_PROP_END_OF_LIST(), }; diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c index 990e71f..a1c52ac 100644 --- a/hw/display/virtio-gpu.c +++ b/hw/display/virtio-gpu.c @@ -1387,11 +1387,13 @@ static const VMStateDescription vmstate_virtio_gpu = { }; static Property virtio_gpu_properties[] = { - VIRTIO_GPU_BASE_PROPERTIES(VirtIOGPU, parent_obj.conf), + VIRTIO_GPU_BASE_PROPERTIES(VirtIOGPU, parent_obj.conf, + parent_obj.parent_obj.guest_features), DEFINE_PROP_SIZE("max_hostmem", VirtIOGPU, conf_max_hostmem, 256 * MiB), - DEFINE_PROP_BIT("blob", VirtIOGPU, parent_obj.conf.flags, - VIRTIO_GPU_FLAG_BLOB_ENABLED, false), + DEFINE_VIRTIO_FEATURE_BIT("blob", VirtIOGPU, parent_obj.conf.flags, + parent_obj.parent_obj.guest_features, + VIRTIO_GPU_FLAG_BLOB_ENABLED, false), DEFINE_PROP_END_OF_LIST(), }; diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h index 24c6628..948ef69 100644 --- a/include/hw/virtio/virtio-gpu.h +++ b/include/hw/virtio/virtio-gpu.h @@ -143,11 +143,11 @@ struct VirtIOGPUBaseClass { void (*gl_flushed)(VirtIOGPUBase *g); }; -#define VIRTIO_GPU_BASE_PROPERTIES(_state, _conf) \ - DEFINE_PROP_UINT32("max_outputs", _state, _conf.max_outputs, 1), \ - DEFINE_PROP_BIT("edid", _state, _conf.flags, \ - VIRTIO_GPU_FLAG_EDID_ENABLED, true), \ - DEFINE_PROP_UINT32("xres", _state, _conf.xres, 1024), \ +#define VIRTIO_GPU_BASE_PROPERTIES(_state, _conf, _guest_field) \ + DEFINE_PROP_UINT32("max_outputs", _state, _conf.max_outputs, 1), \ + DEFINE_VIRTIO_FEATURE_BIT("edid", _state, _conf.flags, _guest_field, \ + VIRTIO_GPU_FLAG_EDID_ENABLED, true), \ + DEFINE_PROP_UINT32("xres", _state, _conf.xres, 1024), \ DEFINE_PROP_UINT32("yres", _state, _conf.yres, 768) typedef struct VGPUDMABuf { -- 1.8.3.1