diff mbox series

[v5,04/19] vl: move display early init before default devices

Message ID 20231023113047.2572137-5-marcandre.lureau@redhat.com
State New
Headers show
Series Make Pixman an optional dependency | expand

Commit Message

Marc-André Lureau Oct. 23, 2023, 11:30 a.m. UTC
From: Marc-André Lureau <marcandre.lureau@redhat.com>

The next commit needs to have the display registered itself before
creating the default VCs.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 system/vl.c | 41 +++++++++++++++++++++++------------------
 1 file changed, 23 insertions(+), 18 deletions(-)

Comments

Thomas Huth Oct. 25, 2023, 9:56 a.m. UTC | #1
On 23/10/2023 13.30, marcandre.lureau@redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
> 
> The next commit needs to have the display registered itself before
> creating the default VCs.
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>   system/vl.c | 41 +++++++++++++++++++++++------------------
>   1 file changed, 23 insertions(+), 18 deletions(-)
> 
> diff --git a/system/vl.c b/system/vl.c
> index 92d29bf521..2cecb3d884 100644
> --- a/system/vl.c
> +++ b/system/vl.c
> @@ -1349,6 +1349,28 @@ static void qemu_disable_default_devices(void)
>       }
>   }
>   
> +static void qemu_early_display_init(void)
> +{
> +#if defined(CONFIG_VNC)
> +    if (!QTAILQ_EMPTY(&(qemu_find_opts("vnc")->head))) {
> +        display_remote++;
> +    }
> +#endif
> +    if (dpy.type == DISPLAY_TYPE_DEFAULT && !display_remote) {
> +        if (!qemu_display_find_default(&dpy)) {
> +            dpy.type = DISPLAY_TYPE_NONE;
> +#if defined(CONFIG_VNC)
> +            vnc_parse("localhost:0,to=99,id=default");
> +#endif
> +        }
> +    }
> +    if (dpy.type == DISPLAY_TYPE_DEFAULT) {
> +        dpy.type = DISPLAY_TYPE_NONE;
> +    }
> +
> +    qemu_display_early_init(&dpy);
> +}

So we now have qemu_early_display_init() and qemu_display_early_init() ... ? 
That's very confusing, could you maybe come up with a different name for the 
new function?

  Thomas
Marc-André Lureau Oct. 25, 2023, 1:26 p.m. UTC | #2
Hi

On Wed, Oct 25, 2023 at 1:56 PM Thomas Huth <thuth@redhat.com> wrote:
>
> On 23/10/2023 13.30, marcandre.lureau@redhat.com wrote:
> > From: Marc-André Lureau <marcandre.lureau@redhat.com>
> >
> > The next commit needs to have the display registered itself before
> > creating the default VCs.
> >
> > Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> > ---
> >   system/vl.c | 41 +++++++++++++++++++++++------------------
> >   1 file changed, 23 insertions(+), 18 deletions(-)
> >
> > diff --git a/system/vl.c b/system/vl.c
> > index 92d29bf521..2cecb3d884 100644
> > --- a/system/vl.c
> > +++ b/system/vl.c
> > @@ -1349,6 +1349,28 @@ static void qemu_disable_default_devices(void)
> >       }
> >   }
> >
> > +static void qemu_early_display_init(void)
> > +{
> > +#if defined(CONFIG_VNC)
> > +    if (!QTAILQ_EMPTY(&(qemu_find_opts("vnc")->head))) {
> > +        display_remote++;
> > +    }
> > +#endif
> > +    if (dpy.type == DISPLAY_TYPE_DEFAULT && !display_remote) {
> > +        if (!qemu_display_find_default(&dpy)) {
> > +            dpy.type = DISPLAY_TYPE_NONE;
> > +#if defined(CONFIG_VNC)
> > +            vnc_parse("localhost:0,to=99,id=default");
> > +#endif
> > +        }
> > +    }
> > +    if (dpy.type == DISPLAY_TYPE_DEFAULT) {
> > +        dpy.type = DISPLAY_TYPE_NONE;
> > +    }
> > +
> > +    qemu_display_early_init(&dpy);
> > +}
>
> So we now have qemu_early_display_init() and qemu_display_early_init() ... ?
> That's very confusing, could you maybe come up with a different name for the
> new function?

Ok, what about qemu_setup_display() ? I'll also simplify a bit the logic there.
Thomas Huth Oct. 25, 2023, 1:38 p.m. UTC | #3
On 25/10/2023 15.26, Marc-André Lureau wrote:
> Hi
> 
> On Wed, Oct 25, 2023 at 1:56 PM Thomas Huth <thuth@redhat.com> wrote:
>>
>> On 23/10/2023 13.30, marcandre.lureau@redhat.com wrote:
>>> From: Marc-André Lureau <marcandre.lureau@redhat.com>
>>>
>>> The next commit needs to have the display registered itself before
>>> creating the default VCs.
>>>
>>> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
>>> ---
>>>    system/vl.c | 41 +++++++++++++++++++++++------------------
>>>    1 file changed, 23 insertions(+), 18 deletions(-)
>>>
>>> diff --git a/system/vl.c b/system/vl.c
>>> index 92d29bf521..2cecb3d884 100644
>>> --- a/system/vl.c
>>> +++ b/system/vl.c
>>> @@ -1349,6 +1349,28 @@ static void qemu_disable_default_devices(void)
>>>        }
>>>    }
>>>
>>> +static void qemu_early_display_init(void)
>>> +{
>>> +#if defined(CONFIG_VNC)
>>> +    if (!QTAILQ_EMPTY(&(qemu_find_opts("vnc")->head))) {
>>> +        display_remote++;
>>> +    }
>>> +#endif
>>> +    if (dpy.type == DISPLAY_TYPE_DEFAULT && !display_remote) {
>>> +        if (!qemu_display_find_default(&dpy)) {
>>> +            dpy.type = DISPLAY_TYPE_NONE;
>>> +#if defined(CONFIG_VNC)
>>> +            vnc_parse("localhost:0,to=99,id=default");
>>> +#endif
>>> +        }
>>> +    }
>>> +    if (dpy.type == DISPLAY_TYPE_DEFAULT) {
>>> +        dpy.type = DISPLAY_TYPE_NONE;
>>> +    }
>>> +
>>> +    qemu_display_early_init(&dpy);
>>> +}
>>
>> So we now have qemu_early_display_init() and qemu_display_early_init() ... ?
>> That's very confusing, could you maybe come up with a different name for the
>> new function?
> 
> Ok, what about qemu_setup_display() ? I'll also simplify a bit the logic there.

Fine for me.

  Thomas
diff mbox series

Patch

diff --git a/system/vl.c b/system/vl.c
index 92d29bf521..2cecb3d884 100644
--- a/system/vl.c
+++ b/system/vl.c
@@ -1349,6 +1349,28 @@  static void qemu_disable_default_devices(void)
     }
 }
 
+static void qemu_early_display_init(void)
+{
+#if defined(CONFIG_VNC)
+    if (!QTAILQ_EMPTY(&(qemu_find_opts("vnc")->head))) {
+        display_remote++;
+    }
+#endif
+    if (dpy.type == DISPLAY_TYPE_DEFAULT && !display_remote) {
+        if (!qemu_display_find_default(&dpy)) {
+            dpy.type = DISPLAY_TYPE_NONE;
+#if defined(CONFIG_VNC)
+            vnc_parse("localhost:0,to=99,id=default");
+#endif
+        }
+    }
+    if (dpy.type == DISPLAY_TYPE_DEFAULT) {
+        dpy.type = DISPLAY_TYPE_NONE;
+    }
+
+    qemu_display_early_init(&dpy);
+}
+
 static void qemu_create_default_devices(void)
 {
     MachineClass *machine_class = MACHINE_GET_CLASS(current_machine);
@@ -1398,23 +1420,6 @@  static void qemu_create_default_devices(void)
 #endif
     }
 
-#if defined(CONFIG_VNC)
-    if (!QTAILQ_EMPTY(&(qemu_find_opts("vnc")->head))) {
-        display_remote++;
-    }
-#endif
-    if (dpy.type == DISPLAY_TYPE_DEFAULT && !display_remote) {
-        if (!qemu_display_find_default(&dpy)) {
-            dpy.type = DISPLAY_TYPE_NONE;
-#if defined(CONFIG_VNC)
-            vnc_parse("localhost:0,to=99,id=default");
-#endif
-        }
-    }
-    if (dpy.type == DISPLAY_TYPE_DEFAULT) {
-        dpy.type = DISPLAY_TYPE_NONE;
-    }
-
     /* If no default VGA is requested, the default is "none".  */
     if (default_vga) {
         vga_model = get_default_vga_model(machine_class);
@@ -1939,7 +1944,6 @@  static void qemu_create_early_backends(void)
                      "ignoring option");
     }
 
-    qemu_display_early_init(&dpy);
     qemu_console_early_init();
 
     if (dpy.has_gl && dpy.gl != DISPLAYGL_MODE_OFF && display_opengl == 0) {
@@ -3670,6 +3674,7 @@  void qemu_init(int argc, char **argv)
     suspend_mux_open();
 
     qemu_disable_default_devices();
+    qemu_early_display_init();
     qemu_create_default_devices();
     qemu_create_early_backends();