This patch adds support for the fields that are currently configurable in the function qemu_edid_generate.
Signed-off-by: Roland Clobus <[email protected]> --- hw/display/virtio-gpu-base.c | 41 +++++++++++++++++++++++++++++++-- qapi/virtio.json | 44 ++++++++++++++++++++++++++++++------ 2 files changed, 76 insertions(+), 9 deletions(-) diff --git a/hw/display/virtio-gpu-base.c b/hw/display/virtio-gpu-base.c index a68b184829..5391189add 100644 --- a/hw/display/virtio-gpu-base.c +++ b/hw/display/virtio-gpu-base.c @@ -69,9 +69,39 @@ virtio_gpu_base_generate_edid(VirtIOGPUBase *g, int scanout, for (output_idx = 0, node = g->conf.outputs; output_idx <= scanout && node; output_idx++, node = node->next) { - if (output_idx == scanout && node->value && node->value->name) { + if (output_idx != scanout || !node->value) { + continue; + } + + if (node->value->vendor) { + info.vendor = node->value->vendor; + } + if (node->value->name) { info.name = node->value->name; - break; + } + if (node->value->serial) { + info.serial = node->value->serial; + } + if (node->value->has_widthmm) { + info.width_mm = node->value->widthmm; + } + if (node->value->has_heightmm) { + info.height_mm = node->value->heightmm; + } + if (node->value->has_xres) { + info.prefx = node->value->xres; + } + if (node->value->has_yres) { + info.prefy = node->value->yres; + } + if (node->value->has_xmax) { + info.maxx = node->value->xmax; + } + if (node->value->has_ymax) { + info.maxy = node->value->ymax; + } + if (node->value->has_refreshrate) { + info.refresh_rate = node->value->refreshrate; } } @@ -237,6 +267,10 @@ virtio_gpu_base_device_realize(DeviceState *qdev, for (output_idx = 0, node = g->conf.outputs; node && output_idx < g->conf.max_outputs; output_idx++, node = node->next) { + if (node->value->has_widthmm && node->value->has_heightmm) { + g->req_state[output_idx].width_mm = node->value->widthmm; + g->req_state[output_idx].height_mm = node->value->heightmm; + } if (node->value->has_xres != node->value->has_yres) { error_setg(errp, "must set both outputs[%zd].xres and outputs[%zd].yres", @@ -248,6 +282,9 @@ virtio_gpu_base_device_realize(DeviceState *qdev, g->req_state[output_idx].width = node->value->xres; g->req_state[output_idx].height = node->value->yres; } + if (node->value->has_refreshrate) { + g->req_state[output_idx].refresh_rate = node->value->refreshrate; + } } g->hw_ops = &virtio_gpu_ops; diff --git a/qapi/virtio.json b/qapi/virtio.json index 1fc4e38a44..e1cd5864fe 100644 --- a/qapi/virtio.json +++ b/qapi/virtio.json @@ -952,24 +952,54 @@ ## # @VirtIOGPUOutput: # -# Describes configuration of a VirtIO GPU output. If both @xres and -# @yres are set, they take precedence over root virtio-gpu resolution -# configuration and enable the corresponding output. If none of @xres -# and @yres are set, root virtio-gpu resolution configuration takes -# precedence and only the first output is enabled. Only setting one -# of @xres or @yres is an error. +# Describes configuration of a VirtIO GPU output. Matches the fields +# of struct @qemu_edid_info. +# If both @xres and @yres are set, they take precedence over root +# virtio-gpu resolution configuration and enable the corresponding +# output. If none of @xres and @yres are set, root +# virtio-gpu resolution configuration takes precedence and only the +# first output is enabled. Only setting one of @xres or @yres is +# an error. +# +# @vendor: a 3 letter code for the vendor (since xx.x TODO) # # @name: the name of the output # +# @serial: the serial number (since xx.x TODO) +# must be numerical +# +# @widthmm: width of the display in mm (since xx.x TODO) +# If @widthmm is set, @heightmm must be set too +# +# @heightmm: height of the display in mm (since xx.x TODO) +# If @heightmm is set, @widthmm must be set too +# # @xres: horizontal resolution of the output in pixels (since 11.0) # # @yres: vertical resolution of the output in pixels (since 11.0) # +# @xmax: maximum horizontal resolution of the output in pixels +# (since xx.x TODO) +# +# @ymax: maximum vertical resolution of the output in pixels +# (since xx.x TODO) +# +# @refreshrate: refreshrate in mHz (since xx.x TODO) +# # Since: 10.1 ## { 'struct': 'VirtIOGPUOutput', - 'data': { 'name': 'str', '*xres': 'uint16', '*yres': 'uint16' } } + 'data': { '*vendor': 'str', + 'name': 'str', + '*serial': 'str', + '*widthmm': 'uint16', + '*heightmm': 'uint16', + '*xres': 'uint32', + '*yres': 'uint32', + '*xmax': 'uint32', + '*ymax': 'uint32', + '*refreshrate': 'uint32' } } ## # @DummyVirtioForceArrays: -- 2.53.0
