Re: [PATCH spice-server v3] gl: fix client mouse mode

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

 



Acked-by: Christophe de Dinechin <dinechin@xxxxxxxxxx>

> On 4 Oct 2017, at 10:50, Frediano Ziglio <fziglio@xxxxxxxxxx> wrote:
> 
> Since 2.8, QEMU no longer creates QXL primary surfaces when using GL.
> This change broke client-side mouse mode, because Spice server relies on
> having a primary surface.
> 
> When GL is enabled, use GL scanout informations.
> Mouse mode is always client when GL surfaces are used.
> 
> This patch and most of the message are based on a patch from
> Marc-André Lureau, just moving responsibility from reds to RedQxl.
> 
> Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
> ---
> server/red-qxl.c | 31 +++++++++++++++++++++----------
> server/red-qxl.h |  3 +--
> server/reds.c    |  3 +--
> 3 files changed, 23 insertions(+), 14 deletions(-)
> 
> Changes since v2:
> - call reds_update_client_mouse_allowed from spice_qxl_gl_scanout;
> - fix some typos;
> - update a comment in code.
> 
> diff --git a/server/red-qxl.c b/server/red-qxl.c
> index 7dc13bbdc..336bb2e68 100644
> --- a/server/red-qxl.c
> +++ b/server/red-qxl.c
> @@ -841,6 +841,8 @@ void spice_qxl_gl_scanout(QXLInstance *qxl,
>     /* FIXME: find a way to coallesce all pending SCANOUTs */
>     dispatcher_send_message(qxl_state->dispatcher,
>                             RED_WORKER_MESSAGE_GL_SCANOUT, &payload);
> +
> +    reds_update_client_mouse_allowed(qxl_state->reds);
> }
> 
> SPICE_GNUC_VISIBLE
> @@ -964,20 +966,29 @@ 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_get_allow_client_mouse(QXLInstance *qxl, int *x_res, int *y_res, int *allow_now)
> {
> -    return qxl->st->primary_active;
> -}
> +    // try to get resolution when 3D enabled, since qemu did not create QXL primary surface
> +    SpiceMsgDisplayGlScanoutUnix *gl;
> +    if ((gl = red_qxl_get_gl_scanout(qxl))) {
> +        *x_res = gl->width;
> +        *y_res = gl->height;
> +        *allow_now = TRUE;
> +        red_qxl_put_gl_scanout(qxl, gl);
> +        return true;
> +    }
> +
> +    // check for 2D
> +    if (!qxl->st->primary_active) {
> +        return false;
> +    }
> 
> -gboolean red_qxl_get_allow_client_mouse(QXLInstance *qxl, gint *x_res, gint *y_res)
> -{
>     if (qxl->st->use_hardware_cursor) {
> -        if (x_res)
> -            *x_res = qxl->st->x_res;
> -        if (y_res)
> -            *y_res = qxl->st->y_res;
> +        *x_res = qxl->st->x_res;
> +        *y_res = qxl->st->y_res;
>     }
> -    return qxl->st->use_hardware_cursor;
> +    *allow_now = qxl->st->use_hardware_cursor;
> +    return true;
> }
> 
> void red_qxl_on_ic_change(QXLInstance *qxl, SpiceImageCompression ic)
> diff --git a/server/red-qxl.h b/server/red-qxl.h
> index 51ec14562..6014d32a1 100644
> --- a/server/red-qxl.h
> +++ b/server/red-qxl.h
> @@ -34,8 +34,7 @@ void red_qxl_stop(QXLInstance *qxl);
> void red_qxl_start(QXLInstance *qxl);
> uint32_t red_qxl_get_ram_size(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);
> +bool red_qxl_get_allow_client_mouse(QXLInstance *qxl, int *x_res, int *y_res, int *allow_now);
> SpiceMsgDisplayGlScanoutUnix *red_qxl_get_gl_scanout(QXLInstance *qxl);
> void red_qxl_put_gl_scanout(QXLInstance *qxl, SpiceMsgDisplayGlScanoutUnix *scanout);
> void red_qxl_gl_draw_async_complete(QXLInstance *qxl);
> diff --git a/server/reds.c b/server/reds.c
> index ddc933524..12c33570a 100644
> --- a/server/reds.c
> +++ b/server/reds.c
> @@ -4376,8 +4376,7 @@ void reds_update_client_mouse_allowed(RedsState *reds)
> 
>         allow_now = TRUE;
>         FOREACH_QXL_INSTANCE(reds, qxl) {
> -            if (red_qxl_get_primary_active(qxl)) {
> -                allow_now = red_qxl_get_allow_client_mouse(qxl, &x_res, &y_res);
> +            if (red_qxl_get_allow_client_mouse(qxl, &x_res, &y_res, &allow_now)) {
>                 break;
>             }
>         }
> -- 
> 2.13.6
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel@xxxxxxxxxxxxxxxxxxxxx
> https://lists.freedesktop.org/mailman/listinfo/spice-devel

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]