[PATCH v3 8/9] vnc: initialize gst during argument processing

Dietmar Maurer posted 9 patches 8 months ago
Maintainers: Paolo Bonzini <pbonzini@redhat.com>, "Marc-André Lureau" <marcandre.lureau@redhat.com>, "Daniel P. Berrangé" <berrange@redhat.com>, "Philippe Mathieu-Daudé" <philmd@linaro.org>
There is a newer version of this series
[PATCH v3 8/9] vnc: initialize gst during argument processing
Posted by Dietmar Maurer 8 months ago
So that we can set --gst- options on the qemu command line.

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
---
 system/vl.c | 8 ++++++++
 ui/vnc.c    | 4 ----
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/system/vl.c b/system/vl.c
index ec93988a03..c7fff02da2 100644
--- a/system/vl.c
+++ b/system/vl.c
@@ -140,6 +140,10 @@
 #include "qemu/guest-random.h"
 #include "qemu/keyval.h"
 
+#ifdef CONFIG_GSTREAMER
+#include <gst/gst.h>
+#endif
+
 #define MAX_VIRTIO_CONSOLES 1
 
 typedef struct BlockdevOptionsQueueEntry {
@@ -2848,6 +2852,10 @@ void qemu_init(int argc, char **argv)
     bool userconfig = true;
     FILE *vmstate_dump_file = NULL;
 
+#ifdef CONFIG_GSTREAMER
+    gst_init(&argc, &argv);
+#endif
+
     qemu_add_opts(&qemu_drive_opts);
     qemu_add_drive_opts(&qemu_legacy_drive_opts);
     qemu_add_drive_opts(&qemu_common_drive_opts);
diff --git a/ui/vnc.c b/ui/vnc.c
index 6db03a1550..8f6287e2e6 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -4350,10 +4350,6 @@ int vnc_init_func(void *opaque, QemuOpts *opts, Error **errp)
     Error *local_err = NULL;
     char *id = (char *)qemu_opts_id(opts);
 
-#ifdef CONFIG_GSTREAMER
-    gst_init(NULL, NULL);
-#endif
-
     assert(id);
     vnc_display_init(id, &local_err);
     if (local_err) {
-- 
2.39.5
Re: [PATCH v3 8/9] vnc: initialize gst during argument processing
Posted by Daniel P. Berrangé 7 months, 4 weeks ago
On Fri, Apr 18, 2025 at 01:29:52PM +0200, Dietmar Maurer wrote:
> So that we can set --gst- options on the qemu command line.

I don't think this is desirable. It exposes a bunch of arbitrary
command line arguments that QEMU has no visibility or control
over. This will complicate our long term work / goal of moving all
QEMU configuration to QMP.

CC Markus for a 2nd opinion as our command line modelling / QMP
expert.

> 
> Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
> ---
>  system/vl.c | 8 ++++++++
>  ui/vnc.c    | 4 ----
>  2 files changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/system/vl.c b/system/vl.c
> index ec93988a03..c7fff02da2 100644
> --- a/system/vl.c
> +++ b/system/vl.c
> @@ -140,6 +140,10 @@
>  #include "qemu/guest-random.h"
>  #include "qemu/keyval.h"
>  
> +#ifdef CONFIG_GSTREAMER
> +#include <gst/gst.h>
> +#endif
> +
>  #define MAX_VIRTIO_CONSOLES 1
>  
>  typedef struct BlockdevOptionsQueueEntry {
> @@ -2848,6 +2852,10 @@ void qemu_init(int argc, char **argv)
>      bool userconfig = true;
>      FILE *vmstate_dump_file = NULL;
>  
> +#ifdef CONFIG_GSTREAMER
> +    gst_init(&argc, &argv);
> +#endif
> +
>      qemu_add_opts(&qemu_drive_opts);
>      qemu_add_drive_opts(&qemu_legacy_drive_opts);
>      qemu_add_drive_opts(&qemu_common_drive_opts);
> diff --git a/ui/vnc.c b/ui/vnc.c
> index 6db03a1550..8f6287e2e6 100644
> --- a/ui/vnc.c
> +++ b/ui/vnc.c
> @@ -4350,10 +4350,6 @@ int vnc_init_func(void *opaque, QemuOpts *opts, Error **errp)
>      Error *local_err = NULL;
>      char *id = (char *)qemu_opts_id(opts);
>  
> -#ifdef CONFIG_GSTREAMER
> -    gst_init(NULL, NULL);
> -#endif
> -
>      assert(id);
>      vnc_display_init(id, &local_err);
>      if (local_err) {
> -- 
> 2.39.5
> 
> 

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
Re: [PATCH v3 8/9] vnc: initialize gst during argument processing
Posted by Marc-André Lureau 8 months ago
Hi

On Fri, Apr 18, 2025 at 3:30 PM Dietmar Maurer <dietmar@proxmox.com> wrote:
>
> So that we can set --gst- options on the qemu command line.
>
> Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>

Nice, could you move that up in the patch series? As a second patch
after linking gst seems fitting.

> ---
>  system/vl.c | 8 ++++++++
>  ui/vnc.c    | 4 ----
>  2 files changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/system/vl.c b/system/vl.c
> index ec93988a03..c7fff02da2 100644
> --- a/system/vl.c
> +++ b/system/vl.c
> @@ -140,6 +140,10 @@
>  #include "qemu/guest-random.h"
>  #include "qemu/keyval.h"
>
> +#ifdef CONFIG_GSTREAMER
> +#include <gst/gst.h>
> +#endif
> +
>  #define MAX_VIRTIO_CONSOLES 1
>
>  typedef struct BlockdevOptionsQueueEntry {
> @@ -2848,6 +2852,10 @@ void qemu_init(int argc, char **argv)
>      bool userconfig = true;
>      FILE *vmstate_dump_file = NULL;
>
> +#ifdef CONFIG_GSTREAMER
> +    gst_init(&argc, &argv);
> +#endif
> +
>      qemu_add_opts(&qemu_drive_opts);
>      qemu_add_drive_opts(&qemu_legacy_drive_opts);
>      qemu_add_drive_opts(&qemu_common_drive_opts);
> diff --git a/ui/vnc.c b/ui/vnc.c
> index 6db03a1550..8f6287e2e6 100644
> --- a/ui/vnc.c
> +++ b/ui/vnc.c
> @@ -4350,10 +4350,6 @@ int vnc_init_func(void *opaque, QemuOpts *opts, Error **errp)
>      Error *local_err = NULL;
>      char *id = (char *)qemu_opts_id(opts);
>
> -#ifdef CONFIG_GSTREAMER
> -    gst_init(NULL, NULL);
> -#endif
> -
>      assert(id);
>      vnc_display_init(id, &local_err);
>      if (local_err) {
> --
> 2.39.5
>