qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 07/27] ui: make gl_block use a counter


From: Marc-André Lureau
Subject: Re: [PATCH 07/27] ui: make gl_block use a counter
Date: Fri, 12 Mar 2021 15:21:57 +0400



On Fri, Mar 12, 2021 at 2:12 PM Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
On 3/12/21 11:00 AM, marcandre.lureau@redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
>
> Track multiple callers blocking requests.
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>  ui/console.c | 17 +++++++++++++----
>  1 file changed, 13 insertions(+), 4 deletions(-)
>
> diff --git a/ui/console.c b/ui/console.c
> index 53eba2019e..fedb9d8b13 100644
> --- a/ui/console.c
> +++ b/ui/console.c
> @@ -128,7 +128,7 @@ struct QemuConsole {
>      DisplaySurface *surface;
>      int dcls;
>      DisplayChangeListener *gl;
> -    bool gl_block;
> +    int gl_block;
>      int window_id;

>      /* Graphic console state.  */
> @@ -288,10 +288,19 @@ void graphic_hw_gl_block(QemuConsole *con, bool block)
>  {
>      assert(con != NULL);

> -    con->gl_block = block;
> -    if (con->hw_ops->gl_block) {
> -        con->hw_ops->gl_block(con->hw, block);
> +    if (block) {
> +        con->gl_block++;
> +    } else {
> +        con->gl_block--;
> +    }
> +    assert(con->gl_block >= 0);
> +    if (!con->hw_ops->gl_block) {
> +        return;
> +    }
> +    if ((block && con->gl_block != 1) || (!block && con->gl_block != 0)) {

Dubious condition check... Could you rewrite it KISS for review?

Well, I have no good idea :) Break in two if-return blocks?


> +        return;
>      }
> +    con->hw_ops->gl_block(con->hw, block);
>  }

>  void graphic_hw_gl_flushed(QemuConsole *con)
>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]