Re: [PATCH 06/19] display: Simplify display_channel_create_surface

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

 



On Wed, Nov 25, 2015 at 4:27 PM, Frediano Ziglio <fziglio@xxxxxxxxxx> wrote:
> From: Marc-André Lureau <marcandre.lureau@xxxxxxxxx>
>
> ---
>  server/display-channel.c | 32 +++++++++++++-------------------
>  1 file changed, 13 insertions(+), 19 deletions(-)
>
> diff --git a/server/display-channel.c b/server/display-channel.c
> index b8d5a81..4a533db 100644
> --- a/server/display-channel.c
> +++ b/server/display-channel.c
> @@ -1543,7 +1543,6 @@ void display_channel_create_surface(DisplayChannel *display, uint32_t surface_id
>                                      void *line_0, int data_is_valid, int send_client)
>  {
>      RedSurface *surface = &display->surfaces[surface_id];
> -    uint32_t i;
>
>      spice_warn_if(surface->context.canvas);
>
> @@ -1567,28 +1566,23 @@ void display_channel_create_surface(DisplayChannel *display, uint32_t surface_id
>      ring_init(&surface->depend_on_me);
>      region_init(&surface->draw_dirty_region);
>      surface->refs = 1;
> -    if (display->renderer != RED_RENDERER_INVALID) {
> -        surface->context.canvas = create_canvas_for_surface(display, surface, display->renderer);
> -        if (!surface->context.canvas) {
> -            spice_critical("drawing canvas creating failed - can`t create same type canvas");
> -        }
> -
> -        if (send_client)
> -            send_create_surface(display, surface_id, data_is_valid);
> -        return;
> -    }
>
> -    for (i = 0; i < display->num_renderers; i++) {
> -        surface->context.canvas = create_canvas_for_surface(display, surface, display->renderers[i]);
> -        if (surface->context.canvas) { //no need canvas check
> -            display->renderer = display->renderers[i];
> -            if (send_client)
> -                send_create_surface(display, surface_id, data_is_valid);
> -            return;
> +    if (display->renderer == RED_RENDERER_INVALID) {
> +        int i;
> +        for (i = 0; i < display->num_renderers; i++) {
> +            surface->context.canvas = create_canvas_for_surface(display, surface, display->renderers[i]);
> +            if (surface->context.canvas) {
> +                display->renderer = display->renderers[i];
> +                break;
> +            }
>          }
> +    } else {
> +        surface->context.canvas = create_canvas_for_surface(display, surface, display->renderer);
>      }
>
> -    spice_critical("unable to create drawing canvas");
> +    spice_return_if_fail(surface->context.canvas);
> +    if (send_client)
> +        send_create_surface(display, surface_id, data_is_valid);
>  }
>
>  static void on_disconnect(RedChannelClient *rcc)
> --
> 2.4.3
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel@xxxxxxxxxxxxxxxxxxxxx
> http://lists.freedesktop.org/mailman/listinfo/spice-devel

Acked-by: Fabiano Fidêncio <fidencio@xxxxxxxxxx>
_______________________________________________
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]