[Spice-devel] [PATCH spice-server 1/6] red-qxl: Unify red_qxl_use_client_monitors_config and red_qxl_client_monitors_config

Christophe Fergeau cfergeau at redhat.com
Thu Sep 7 14:47:50 UTC 2017


On Thu, Sep 07, 2017 at 12:40:21PM +0100, Frediano Ziglio wrote:
> These 2 functions were doing the same stuff, calling
> client_monitors_config callback in QXLInterface.
> The only difference was that red_qxl_use_client_monitors_config
> used a NULL value.
> Added the check for proper version, QXLInstance before 3.3
> did not have this callback.

Having separate methods to check if client monitors config is supported,
and to do the actual call to the appropriate callback makes sense to me
(ie current code does not seem too bad)
However, in this case the only caller of
red_qxl_use_client_monitors_config is reds_use_client_monitors_config,
so  this is not going to make a big difference.

Acked-by: Christophe Fergeau <cfergeau at redhat.com>

> 
> Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> ---
>  server/red-qxl.c | 10 ++--------
>  server/red-qxl.h |  1 -
>  server/reds.c    |  2 +-
>  3 files changed, 3 insertions(+), 10 deletions(-)
> 
> diff --git a/server/red-qxl.c b/server/red-qxl.c
> index b556428d2..54d642ad9 100644
> --- a/server/red-qxl.c
> +++ b/server/red-qxl.c
> @@ -195,17 +195,11 @@ static void red_qxl_update_area(QXLState *qxl_state, uint32_t surface_id,
>                              &payload);
>  }
>  
> -gboolean red_qxl_use_client_monitors_config(QXLInstance *qxl)
> -{
> -    return (red_qxl_check_qxl_version(qxl, 3, 3) &&
> -        qxl_get_interface(qxl)->client_monitors_config &&
> -        qxl_get_interface(qxl)->client_monitors_config(qxl, NULL));
> -}
> -
>  gboolean red_qxl_client_monitors_config(QXLInstance *qxl,
>                                          VDAgentMonitorsConfig *monitors_config)
>  {
> -    return (qxl_get_interface(qxl)->client_monitors_config &&
> +    return (red_qxl_check_qxl_version(qxl, 3, 3) &&
> +        qxl_get_interface(qxl)->client_monitors_config &&
>          qxl_get_interface(qxl)->client_monitors_config(qxl, monitors_config));
>  }
>  
> diff --git a/server/red-qxl.h b/server/red-qxl.h
> index f925f065b..5d57780a9 100644
> --- a/server/red-qxl.h
> +++ b/server/red-qxl.h
> @@ -37,7 +37,6 @@ void red_qxl_start(QXLInstance *qxl);
>  uint32_t red_qxl_get_ram_size(QXLInstance *qxl);
>  void red_qxl_async_complete(QXLInstance *qxl, AsyncCommand *async_command);
>  struct Dispatcher *red_qxl_get_dispatcher(QXLInstance *qxl);
> -gboolean red_qxl_use_client_monitors_config(QXLInstance *qxl);
>  gboolean red_qxl_client_monitors_config(QXLInstance *qxl, VDAgentMonitorsConfig *monitors_config);
>  gboolean red_qxl_get_primary_active(QXLInstance *qxl);
>  gboolean red_qxl_get_allow_client_mouse(QXLInstance *qxl, gint *x_res, gint *y_res);
> diff --git a/server/reds.c b/server/reds.c
> index b6ecc6c69..24ec2bdde 100644
> --- a/server/reds.c
> +++ b/server/reds.c
> @@ -4401,7 +4401,7 @@ static gboolean reds_use_client_monitors_config(RedsState *reds)
>      }
>  
>      FOREACH_QXL_INSTANCE(reds, qxl) {
> -        if (!red_qxl_use_client_monitors_config(qxl))
> +        if (!red_qxl_client_monitors_config(qxl, NULL))
>              return FALSE;
>      }
>      return TRUE;
> -- 
> 2.13.5
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel


More information about the Spice-devel mailing list