[Spice-devel] [PATCH 31/35] replace worker load/save with loadvm_commands, allow keeping surface content

Alexander Larsson alexl at redhat.com
Mon May 17 02:54:17 PDT 2010


On Wed, 2010-05-12 at 13:32 +0200, Gerd Hoffmann wrote:
> -static void qxl_worker_stop(QXLWorker *qxl_worker)
> -{
> -    RedDispatcher *dispatcher = (RedDispatcher *)qxl_worker;
> -    RedWorkeMessage message = RED_WORKER_MESSAGE_STOP;
> +    RedWorkeMessage message = RED_WORKER_MESSAGE_LOADVM_COMMANDS;
>  
> +    red_printf("");

Eh?
 
>  static inline void red_create_surface(RedWorker *worker, uint32_t surface_id, uint32_t width,
>                                        uint32_t height, int32_t stride, uint32_t format,
> -                                      void *line_0)
> +                                      void *line_0, int data_is_valid)
>  {
>      uint32_t i;
>      RedSurface *surface = &worker->surfaces[surface_id];
> @@ -8039,7 +8040,8 @@ static inline void red_create_surface(RedWorker *worker, uint32_t surface_id, ui
>      surface->context.format = format;
>      surface->context.stride = stride;
>      surface->context.line_0 = line_0;
> -    memset(line_0 + (int32_t)(stride * (height - 1)), 0, height*abs(stride));
> +    if (!data_is_valid)
> +        memset(line_0 + (int32_t)(stride * (height - 1)), 0, height*abs(stride));

Missing brackets around block.

> @@ -9138,7 +9086,7 @@ static inline void handle_dev_create_primary_surface(RedWorker *worker)
>      }
>  
>      red_create_surface(worker, 0, surface.width, surface.height, surface.stride, surface.format,
> -                       line_0);
> +                       line_0, 1);

Maybe add a comment saying why we data_is_valid is needed for primary
surfaces.

> +    case RED_WORKER_MESSAGE_LOADVM_COMMANDS: {
> +        uint32_t count;
> +        QXLCommandExt ext;
> +        QXLCursorCmd *cursor_cmd;
> +        QXLSurfaceCmd *surface_cmd;
> +
> +        red_printf("loadvm_commands");
> +        receive_data(worker->channel, &count, sizeof(uint32_t));
> +        while (count > 0) {
> +            receive_data(worker->channel, &ext, sizeof(QXLCommandExt));
> +            switch (ext.cmd.type) {
> +            case QXL_CMD_CURSOR:
> +                cursor_cmd = (QXLCursorCmd *)get_virt(&worker->mem_slots,
> +                                                      ext.cmd.data,
> +                                                      sizeof(QXLCursorCmd),
> +                                                      ext.group_id);
> +                qxl_process_cursor(worker, cursor_cmd, ext.group_id);
> +                break;
> +            case QXL_CMD_SURFACE:
> +                surface_cmd = (QXLSurfaceCmd *)get_virt(&worker->mem_slots,
> +                                                        ext.cmd.data,
> +                                                        sizeof(QXLSurfaceCmd),
> +                                                        ext.group_id);
> +                red_process_surface(worker, surface_cmd, ext.group_id, 1);
> +                break;
> +            }

Maybe we want a default: here to catch any weird things happening with a
printf?


-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Alexander Larsson                                            Red Hat, Inc 
       alexl at redhat.com            alexander.larsson at gmail.com 
He's a leather-clad bohemian vagrant haunted by an iconic dead American 
confidante She's a hard-bitten junkie schoolgirl with someone else's memories. 
They fight crime! 



More information about the Spice-devel mailing list