[Spice-devel] [PATCH spice-server 1/2] red-qxl: Remove surface_create field

Jonathon Jongsma jjongsma at redhat.com
Tue Oct 17 20:17:09 UTC 2017


Acked-by: Jonathon Jongsma <jjongsma at redhat.com>


On Tue, 2017-10-17 at 11:14 +0100, Frediano Ziglio wrote:
> This field was used just to store a value and retrieve again
> while we can just pass it instead.
> 
> Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> ---
>  server/red-qxl.c    | 10 ++--------
>  server/red-worker.c |  2 +-
>  server/red-worker.h |  2 +-
>  3 files changed, 4 insertions(+), 10 deletions(-)
> 
> diff --git a/server/red-qxl.c b/server/red-qxl.c
> index 336bb2e68..e386ba629 100644
> --- a/server/red-qxl.c
> +++ b/server/red-qxl.c
> @@ -50,7 +50,6 @@ struct QXLState {
>      int x_res;
>      int y_res;
>      int use_hardware_cursor;
> -    QXLDevSurfaceCreate surface_create;
>      unsigned int max_monitors;
>      RedsState *reds;
>      RedWorker *worker;
> @@ -346,17 +345,14 @@ static void
> qxl_worker_destroy_primary_surface(QXLWorker *qxl_worker, uint32_t s
>  }
>  
>  /* used by RedWorker */
> -void red_qxl_create_primary_surface_complete(QXLState *qxl_state)
> +void red_qxl_create_primary_surface_complete(QXLState *qxl_state,
> const QXLDevSurfaceCreate *surface)
>  {
> -    QXLDevSurfaceCreate *surface = &qxl_state->surface_create;
> -
>      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;
>  
>      reds_update_client_mouse_allowed(qxl_state->reds);
> -    memset(&qxl_state->surface_create, 0,
> sizeof(QXLDevSurfaceCreate));
>  }
>  
>  static void
> @@ -366,7 +362,6 @@ red_qxl_create_primary_surface_async(QXLState
> *qxl_state, uint32_t surface_id,
>      RedWorkerMessageCreatePrimarySurfaceAsync payload;
>      RedWorkerMessage message =
> RED_WORKER_MESSAGE_CREATE_PRIMARY_SURFACE_ASYNC;
>  
> -    qxl_state->surface_create = *surface;
>      payload.base.cookie = cookie;
>      payload.surface_id = surface_id;
>      payload.surface = *surface;
> @@ -379,13 +374,12 @@ red_qxl_create_primary_surface_sync(QXLState
> *qxl_state, uint32_t surface_id,
>  {
>      RedWorkerMessageCreatePrimarySurface payload = {0,};
>  
> -    qxl_state->surface_create = *surface;
>      payload.surface_id = surface_id;
>      payload.surface = *surface;
>      dispatcher_send_message(qxl_state->dispatcher,
>                              RED_WORKER_MESSAGE_CREATE_PRIMARY_SURFAC
> E,
>                              &payload);
> -    red_qxl_create_primary_surface_complete(qxl_state);
> +    red_qxl_create_primary_surface_complete(qxl_state, surface);
>  }
>  
>  static void
> diff --git a/server/red-worker.c b/server/red-worker.c
> index 466a3474b..fa57235d9 100644
> --- a/server/red-worker.c
> +++ b/server/red-worker.c
> @@ -707,7 +707,7 @@ static void
> handle_dev_create_primary_surface_async(void *opaque, void *payload)
>      RedWorker *worker = opaque;
>  
>      dev_create_primary_surface(worker, msg->surface_id, msg-
> >surface);
> -    red_qxl_create_primary_surface_complete(worker->qxl->st);
> +    red_qxl_create_primary_surface_complete(worker->qxl->st, &msg-
> >surface);
>      red_qxl_async_complete(worker->qxl, msg->base.cookie);
>  }
>  
> diff --git a/server/red-worker.h b/server/red-worker.h
> index f29840c4e..d8a34b339 100644
> --- a/server/red-worker.h
> +++ b/server/red-worker.h
> @@ -38,7 +38,7 @@ void red_worker_free(RedWorker *worker);
>  
>  struct Dispatcher *red_qxl_get_dispatcher(QXLInstance *qxl);
>  void red_qxl_destroy_primary_surface_complete(QXLState *qxl_state);
> -void red_qxl_create_primary_surface_complete(QXLState *qxl_state);
> +void red_qxl_create_primary_surface_complete(QXLState *qxl_state,
> const QXLDevSurfaceCreate* surface);
>  
>  typedef uint32_t RedWorkerMessage;
>  


More information about the Spice-devel mailing list