diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2020-09-15 14:25:05 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2020-09-15 14:25:05 +0100 |
commit | de39a045bd8d2b49e4f3d07976622c29d58e0bac (patch) | |
tree | 231d716865f302c58722a120478fa4948083d95c | |
parent | 6c938efc27c2c9c9b02d574d0522a83dc06c72c8 (diff) | |
parent | 7b0de5b7969e695d6235525654a8a28a0d82a0e0 (diff) | |
download | qemu-de39a045bd8d2b49e4f3d07976622c29d58e0bac.zip qemu-de39a045bd8d2b49e4f3d07976622c29d58e0bac.tar.gz qemu-de39a045bd8d2b49e4f3d07976622c29d58e0bac.tar.bz2 |
Merge remote-tracking branch 'remotes/kraxel/tags/vga-20200915-pull-request' into staging
vga: fix qxl modular build.
vga: add support for virtio-gpu modular builds.
# gpg: Signature made Tue 15 Sep 2020 14:08:53 BST
# gpg: using RSA key 4CB6D8EED3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" [full]
# gpg: aka "Gerd Hoffmann <gerd@kraxel.org>" [full]
# gpg: aka "Gerd Hoffmann (private) <kraxel@gmail.com>" [full]
# Primary key fingerprint: A032 8CFF B93A 17A7 9901 FE7D 4CB6 D8EE D3E8 7138
* remotes/kraxel/tags/vga-20200915-pull-request:
virtio-gpu: build modular
virtio-gpu: make virtio_gpu_ops static
object_initialize: try module load
meson: remove duplicate qxl sources
meson: fix module config
meson: fix qxl dependencies
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r-- | hw/display/meson.build | 27 | ||||
-rw-r--r-- | hw/display/virtio-gpu-base.c | 3 | ||||
-rw-r--r-- | hw/display/virtio-vga.c | 16 | ||||
-rw-r--r-- | include/hw/virtio/virtio-gpu.h | 3 | ||||
-rw-r--r-- | meson.build | 2 | ||||
-rw-r--r-- | qom/object.c | 6 | ||||
-rw-r--r-- | util/module.c | 2 |
7 files changed, 28 insertions, 31 deletions
diff --git a/hw/display/meson.build b/hw/display/meson.build index 78adaf9..0d5ddec 100644 --- a/hw/display/meson.build +++ b/hw/display/meson.build @@ -41,12 +41,11 @@ specific_ss.add(when: 'CONFIG_VGA', if_true: files('vga.c')) if config_all_devices.has_key('CONFIG_QXL') qxl_ss = ss.source_set() - qxl_ss.add(when: 'CONFIG_QXL', if_true: files('qxl.c', 'qxl-logger.c', 'qxl-render.c')) + qxl_ss.add(when: 'CONFIG_QXL', if_true: [files('qxl.c', 'qxl-logger.c', 'qxl-render.c'), + pixman, spice]) hw_display_modules += {'qxl': qxl_ss} endif -softmmu_ss.add(when: 'CONFIG_QXL', if_true: files('qxl.c', 'qxl-logger.c', 'qxl-render.c')) - softmmu_ss.add(when: 'CONFIG_DPCD', if_true: files('dpcd.c')) softmmu_ss.add(when: 'CONFIG_XLNX_ZYNQMP_ARM', if_true: files('xlnx_dp.c')) @@ -60,24 +59,14 @@ if config_all_devices.has_key('CONFIG_VIRTIO_GPU') virtio_gpu_ss.add(when: 'CONFIG_VIRTIO_GPU', if_true: [files('virtio-gpu-base.c', 'virtio-gpu.c', 'virtio-gpu-3d.c'), pixman, virgl]) virtio_gpu_ss.add(when: 'CONFIG_VHOST_USER_GPU', if_true: files('vhost-user-gpu.c')) - virtio_gpu_ss.add(when: ['CONFIG_VIRTIO_GPU', 'CONFIG_VIRTIO_PCI'], if_true: files('virtio-gpu-pci.c')) - virtio_gpu_ss.add(when: ['CONFIG_VHOST_USER_GPU', 'CONFIG_VIRTIO_PCI'], if_true: files('vhost-user-gpu-pci.c')) - virtio_gpu_ss.add(when: 'CONFIG_VIRTIO_VGA', if_true: files('virtio-vga.c')) - virtio_gpu_ss.add(when: 'CONFIG_VHOST_USER_VGA', if_true: files('vhost-user-vga.c')) - - # FIXME: this was attempted in the Makefile build system; it was then reverted - # as it would try to load all devices when the module is loaded, even if - # config_devices for this target only has some of them. Since virtio-gpu-pci - # and virtio-vga both instantiate a virtio-gpu-device, fixing it probably does - # not even require a dependency system, just splitting the module in three - # for CONFIG_VIRTIO_GPU/CONFIG_VHOST_USER_GPU, CONFIG_VIRTIO_PCI and - # CONFIG_VIRTIO_VGA/CONFIG_VHOST_USER_VGA. - # Sourcesets are a dime a dozen, so keep it and just disable module builds. - - #hw_display_modules += {'virtio-gpu': virtio_gpu_ss} - softmmu_ss.add_all(virtio_gpu_ss) + hw_display_modules += {'virtio-gpu': virtio_gpu_ss} endif +softmmu_ss.add(when: ['CONFIG_VIRTIO_GPU', 'CONFIG_VIRTIO_PCI'], if_true: files('virtio-gpu-pci.c')) +softmmu_ss.add(when: ['CONFIG_VHOST_USER_GPU', 'CONFIG_VIRTIO_PCI'], if_true: files('vhost-user-gpu-pci.c')) +softmmu_ss.add(when: 'CONFIG_VIRTIO_VGA', if_true: files('virtio-vga.c')) +softmmu_ss.add(when: 'CONFIG_VHOST_USER_VGA', if_true: files('vhost-user-vga.c')) + specific_ss.add(when: [x11, opengl, 'CONFIG_MILKYMIST_TMU2'], if_true: files('milkymist-tmu2.c')) specific_ss.add(when: 'CONFIG_OMAP', if_true: files('omap_lcdc.c')) diff --git a/hw/display/virtio-gpu-base.c b/hw/display/virtio-gpu-base.c index 7961308..aeb8723 100644 --- a/hw/display/virtio-gpu-base.c +++ b/hw/display/virtio-gpu-base.c @@ -112,7 +112,7 @@ virtio_gpu_gl_block(void *opaque, bool block) } } -const GraphicHwOps virtio_gpu_ops = { +static const GraphicHwOps virtio_gpu_ops = { .invalidate = virtio_gpu_invalidate_display, .gfx_update = virtio_gpu_update_display, .text_update = virtio_gpu_text_update, @@ -162,6 +162,7 @@ virtio_gpu_base_device_realize(DeviceState *qdev, g->req_state[0].width = g->conf.xres; g->req_state[0].height = g->conf.yres; + g->hw_ops = &virtio_gpu_ops; for (i = 0; i < g->conf.max_outputs; i++) { g->scanout[i].con = graphic_console_init(DEVICE(g), i, &virtio_gpu_ops, g); diff --git a/hw/display/virtio-vga.c b/hw/display/virtio-vga.c index 573e7d5..f9410a0 100644 --- a/hw/display/virtio-vga.c +++ b/hw/display/virtio-vga.c @@ -13,7 +13,7 @@ static void virtio_vga_base_invalidate_display(void *opaque) VirtIOGPUBase *g = vvga->vgpu; if (g->enable) { - virtio_gpu_ops.invalidate(g); + g->hw_ops->invalidate(g); } else { vvga->vga.hw_ops->invalidate(&vvga->vga); } @@ -25,7 +25,7 @@ static void virtio_vga_base_update_display(void *opaque) VirtIOGPUBase *g = vvga->vgpu; if (g->enable) { - virtio_gpu_ops.gfx_update(g); + g->hw_ops->gfx_update(g); } else { vvga->vga.hw_ops->gfx_update(&vvga->vga); } @@ -37,8 +37,8 @@ static void virtio_vga_base_text_update(void *opaque, console_ch_t *chardata) VirtIOGPUBase *g = vvga->vgpu; if (g->enable) { - if (virtio_gpu_ops.text_update) { - virtio_gpu_ops.text_update(g, chardata); + if (g->hw_ops->text_update) { + g->hw_ops->text_update(g, chardata); } } else { if (vvga->vga.hw_ops->text_update) { @@ -52,8 +52,8 @@ static int virtio_vga_base_ui_info(void *opaque, uint32_t idx, QemuUIInfo *info) VirtIOVGABase *vvga = opaque; VirtIOGPUBase *g = vvga->vgpu; - if (virtio_gpu_ops.ui_info) { - return virtio_gpu_ops.ui_info(g, idx, info); + if (g->hw_ops->ui_info) { + return g->hw_ops->ui_info(g, idx, info); } return -1; } @@ -63,8 +63,8 @@ static void virtio_vga_base_gl_block(void *opaque, bool block) VirtIOVGABase *vvga = opaque; VirtIOGPUBase *g = vvga->vgpu; - if (virtio_gpu_ops.gl_block) { - virtio_gpu_ops.gl_block(g, block); + if (g->hw_ops->gl_block) { + g->hw_ops->gl_block(g, block); } } diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h index f334b78..6b45b47 100644 --- a/include/hw/virtio/virtio-gpu.h +++ b/include/hw/virtio/virtio-gpu.h @@ -106,6 +106,7 @@ struct VirtIOGPUBase { struct virtio_gpu_base_conf conf; struct virtio_gpu_config virtio_config; + const GraphicHwOps *hw_ops; bool use_virgl_renderer; int renderer_blocked; @@ -171,8 +172,6 @@ struct VhostUserGPU { bool backend_blocked; }; -extern const GraphicHwOps virtio_gpu_ops; - #define VIRTIO_GPU_FILL_CMD(out) do { \ size_t s; \ s = iov_to_buf(cmd->elem.out_sg, cmd->elem.out_num, 0, \ diff --git a/meson.build b/meson.build index 690723b..bba766b 100644 --- a/meson.build +++ b/meson.build @@ -913,7 +913,7 @@ softmmu_mods = [] foreach d, list : modules foreach m, module_ss : list if enable_modules and targetos != 'windows' - module_ss = module_ss.apply(config_host, strict: false) + module_ss = module_ss.apply(config_all, strict: false) sl = static_library(d + '-' + m, [genh, module_ss.sources()], dependencies: [modulecommon, module_ss.dependencies()], pic: true) if d == 'block' diff --git a/qom/object.c b/qom/object.c index b1822a2..387efb2 100644 --- a/qom/object.c +++ b/qom/object.c @@ -518,6 +518,12 @@ void object_initialize(void *data, size_t size, const char *typename) { TypeImpl *type = type_get_by_name(typename); +#ifdef CONFIG_MODULES + if (!type) { + module_load_qom_one(typename); + type = type_get_by_name(typename); + } +#endif if (!type) { error_report("missing object type '%s'", typename); abort(); diff --git a/util/module.c b/util/module.c index 6e63006..34772e7 100644 --- a/util/module.c +++ b/util/module.c @@ -265,6 +265,8 @@ static struct { { "usb-redir", "hw-", "usb-redirect" }, { "qxl-vga", "hw-", "display-qxl" }, { "qxl", "hw-", "display-qxl" }, + { "virtio-gpu-device", "hw-", "display-virtio-gpu" }, + { "vhost-user-gpu", "hw-", "display-virtio-gpu" }, { "chardev-braille", "chardev-", "baum" }, }; |