[Spice-devel] [PATCH spice-server 2/2] red-qxl: Rename primary_active to display_active

Marc-André Lureau marcandre.lureau at redhat.com
Tue Jun 13 09:16:39 UTC 2017


Hi

----- Original Message -----
> To avoid confusion use the more generic "display" instead of "primary".
> "primary" is used in the code widely to mean the primary surface.
> In the past (before 3D support) having a primary surface mean both
> the availability of something to render (that is the device was enabled
> and ready) and the presence of a canvas to draw on.
> As RedQxl is just interested in the state and size of the display
> use "display" as terminology.
> 

The state of primary_active was tight to 
red_qxl_{create,destroy}_primary_surface_complete()

You added it to spice_qxl_gl_scanout(), and it seems it is indeed used only to check display state in general.

It needs more careful review, but ack for the idea.


> Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> ---
>  server/red-qxl.c | 12 ++++++------
>  server/red-qxl.h |  2 +-
>  server/reds.c    |  2 +-
>  3 files changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/server/red-qxl.c b/server/red-qxl.c
> index 896bb76..4513732 100644
> --- a/server/red-qxl.c
> +++ b/server/red-qxl.c
> @@ -51,7 +51,7 @@ struct QXLState {
>      QXLInstance *qxl;
>      Dispatcher *dispatcher;
>      uint32_t pending;
> -    int primary_active;
> +    bool display_active;
>      int x_res;
>      int y_res;
>      int use_hardware_cursor;
> @@ -330,7 +330,7 @@ static void
> red_qxl_destroy_primary_surface_complete(QXLState *qxl_state)
>      qxl_state->x_res = 0;
>      qxl_state->y_res = 0;
>      qxl_state->use_hardware_cursor = FALSE;
> -    qxl_state->primary_active = FALSE;
> +    qxl_state->display_active = false;
>  
>      reds_update_client_mouse_allowed(qxl_state->reds);
>  }
> @@ -383,7 +383,7 @@ static void
> red_qxl_create_primary_surface_complete(QXLState *qxl_state)
>      qxl_state->x_res = surface->width;
>      qxl_state->y_res = surface->height;
>      qxl_state->use_hardware_cursor = surface->mouse_mode;
> -    qxl_state->primary_active = TRUE;
> +    qxl_state->display_active = true;
>  
>      reds_update_client_mouse_allowed(qxl_state->reds);
>      memset(&qxl_state->surface_create, 0, sizeof(QXLDevSurfaceCreate));
> @@ -887,7 +887,7 @@ void spice_qxl_gl_scanout(QXLInstance *qxl,
>      qxl_state->x_res = width;
>      qxl_state->y_res = height;
>      qxl_state->use_hardware_cursor = TRUE;
> -    qxl_state->primary_active = TRUE;
> +    qxl_state->display_active = true;
>  
>      reds_update_client_mouse_allowed(qxl_state->reds);
>  }
> @@ -1039,9 +1039,9 @@ void red_qxl_clear_pending(QXLState *qxl_state, int
> pending)
>      clear_bit(pending, &qxl_state->pending);
>  }
>  
> -gboolean red_qxl_get_primary_active(QXLInstance *qxl)
> +bool red_qxl_is_display_active(QXLInstance *qxl)
>  {
> -    return qxl->st->primary_active;
> +    return qxl->st->display_active;
>  }
>  
>  gboolean red_qxl_get_allow_client_mouse(QXLInstance *qxl, gint *x_res, gint
>  *y_res)
> diff --git a/server/red-qxl.h b/server/red-qxl.h
> index 93cc4d0..6dfee91 100644
> --- a/server/red-qxl.h
> +++ b/server/red-qxl.h
> @@ -39,7 +39,7 @@ 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);
> +bool red_qxl_is_display_active(QXLInstance *qxl);
>  gboolean red_qxl_get_allow_client_mouse(QXLInstance *qxl, gint *x_res, gint
>  *y_res);
>  SpiceMsgDisplayGlScanoutUnix *red_qxl_get_gl_scanout(QXLInstance *qxl);
>  void red_qxl_put_gl_scanout(QXLInstance *qxl, SpiceMsgDisplayGlScanoutUnix
>  *scanout);
> diff --git a/server/reds.c b/server/reds.c
> index 09b674d..39ddbcd 100644
> --- a/server/reds.c
> +++ b/server/reds.c
> @@ -4342,7 +4342,7 @@ void reds_update_client_mouse_allowed(RedsState *reds)
>  
>          allow_now = TRUE;
>          FOREACH_QXL_INSTANCE(reds, it, qxl) {
> -            if (red_qxl_get_primary_active(qxl)) {
> +            if (red_qxl_is_display_active(qxl)) {
>                  allow_now = red_qxl_get_allow_client_mouse(qxl, &x_res,
>                  &y_res);
>                  break;
>              }
> --
> 2.9.4
> 
> _______________________________________________
> 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