Re: [PATCH] Simplify set_surface_release_info

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

 



On Tue, Aug 25, 2015 at 11:35:56AM +0100, Frediano Ziglio wrote:
> ---
>  server/red_worker.c | 19 +++++--------------
>  1 file changed, 5 insertions(+), 14 deletions(-)
> 
> diff --git a/server/red_worker.c b/server/red_worker.c
> index 7966f91..1512709 100644
> --- a/server/red_worker.c
> +++ b/server/red_worker.c
> @@ -1772,20 +1772,11 @@ static inline void red_destroy_surface(RedWorker *worker, uint32_t surface_id)
>      }
>  }
>  
> -static inline void set_surface_release_info(RedWorker *worker, uint32_t surface_id, int is_create,
> +static inline void set_surface_release_info(QXLReleaseInfoExt *release_info_ext,
>                                              QXLReleaseInfo *release_info, uint32_t group_id)
>  {
> -    RedSurface *surface;
> -
> -    surface = &worker->surfaces[surface_id];
> -
> -    if (is_create) {
> -        surface->create.info = release_info;
> -        surface->create.group_id = group_id;
> -    } else {
> -        surface->destroy.info = release_info;
> -        surface->destroy.group_id = group_id;
> -    }
> +    release_info_ext->info = release_info;
> +    release_info_ext->group_id = group_id;
>  }
>  
>  static RedDrawable *ref_red_drawable(RedDrawable *drawable)
> @@ -4302,12 +4293,12 @@ static inline void red_process_surface(RedWorker *worker, RedSurfaceCmd *surface
>                             reloaded_surface,
>                             // reloaded surfaces will be sent on demand
>                             !reloaded_surface);
> -        set_surface_release_info(worker, surface_id, 1, surface->release_info, group_id);
> +        set_surface_release_info(&red_surface->create, surface->release_info, group_id);
>          break;
>      }
>      case QXL_SURFACE_CMD_DESTROY:
>          spice_warn_if(!red_surface->context.canvas);
> -        set_surface_release_info(worker, surface_id, 0, surface->release_info, group_id);
> +        set_surface_release_info(&red_surface->destroy, surface->release_info, group_id);
>          red_handle_depends_on_target_surface(worker, surface_id);
>          /* note that red_handle_depends_on_target_surface must be called before red_current_clear.
>             otherwise "current" will hold items that other drawables may depend on, and then

A bit torn on this one, as in general I prefer to have helpers acting on
higher level objects and hide how they work internally rather than
exposing this to the caller. In this case, why not, ACK.

Christophe

Attachment: pgpy5iblVBPRy.pgp
Description: PGP signature

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://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]