Re: [spice-server v2 3/9] qxl: Move red_drawable_unref/red_drawable_new

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

 



> 
> RedDrawable really is a RedDrawCmd which is parsed by red-parse-qxl.h
> This commit moves them close to the other functions creating/unref'ing
> QXL commands parsed by red-parse-qxl.h
> 

Does not seem a great reason to have different APIs from red-parse-qxl,
this and next patch seems to mix parsing with allocation, is not clear
why for some structure is separate and for some other bound.
Maybe we should join all (even surface and messages)?

> Signed-off-by: Christophe Fergeau <cfergeau@xxxxxxxxxx>
> ---
>  server/red-parse-qxl.c | 21 +++++++++++++++++++++
>  server/red-parse-qxl.h |  2 ++
>  server/red-worker.c    | 20 --------------------
>  3 files changed, 23 insertions(+), 20 deletions(-)
> 
> diff --git a/server/red-parse-qxl.c b/server/red-parse-qxl.c
> index 4a45c0f76..245235082 100644
> --- a/server/red-parse-qxl.c
> +++ b/server/red-parse-qxl.c
> @@ -26,6 +26,7 @@
>  #include "red-common.h"
>  #include "red-qxl.h"
>  #include "memslot.h"
> +#include "red-qxl.h"

duplicate

>  #include "red-parse-qxl.h"
>  
>  /* Max size in bytes for any data field used in a QXL command.
> @@ -1480,3 +1481,23 @@ void red_put_cursor_cmd(RedCursorCmd *red)
>          red_qxl_release_resource(red->qxl, red->release_info_ext);
>      }
>  }
> +
> +void red_drawable_unref(RedDrawable *red_drawable)
> +{
> +    if (--red_drawable->refs) {
> +        return;
> +    }
> +    red_qxl_release_resource(red_drawable->qxl,
> red_drawable->release_info_ext);
> +    red_put_drawable(red_drawable);
> +    g_free(red_drawable);
> +}
> +
> +RedDrawable *red_drawable_new(QXLInstance *qxl)
> +{
> +    RedDrawable * red = g_new0(RedDrawable, 1);
> +
> +    red->refs = 1;
> +    red->qxl = qxl;
> +
> +    return red;
> +}
> diff --git a/server/red-parse-qxl.h b/server/red-parse-qxl.h
> index a33f36adb..0b507b93a 100644
> --- a/server/red-parse-qxl.h
> +++ b/server/red-parse-qxl.h
> @@ -64,6 +64,8 @@ static inline RedDrawable *red_drawable_ref(RedDrawable
> *drawable)
>      drawable->refs++;
>      return drawable;
>  }
> +RedDrawable *red_drawable_new(QXLInstance *qxl);
> +void red_drawable_unref(RedDrawable *red_drawable);
>  

duplicate (unref)

>  void red_drawable_unref(RedDrawable *red_drawable);
>  

here

> diff --git a/server/red-worker.c b/server/red-worker.c
> index eb927f3e0..8f806e8e3 100644
> --- a/server/red-worker.c
> +++ b/server/red-worker.c
> @@ -99,16 +99,6 @@ static int display_is_connected(RedWorker *worker)
>          red_channel_is_connected(RED_CHANNEL(worker->display_channel));
>  }
>  
> -void red_drawable_unref(RedDrawable *red_drawable)
> -{
> -    if (--red_drawable->refs) {
> -        return;
> -    }
> -    red_qxl_release_resource(red_drawable->qxl,
> red_drawable->release_info_ext);
> -    red_put_drawable(red_drawable);
> -    g_free(red_drawable);
> -}
> -
>  static gboolean red_process_cursor_cmd(RedWorker *worker, const
>  QXLCommandExt *ext)
>  {
>      RedCursorCmd *cursor_cmd;
> @@ -165,16 +155,6 @@ static int red_process_cursor(RedWorker *worker, int
> *ring_is_empty)
>      return n;
>  }
>  
> -static RedDrawable *red_drawable_new(QXLInstance *qxl)
> -{
> -    RedDrawable * red = g_new0(RedDrawable, 1);
> -
> -    red->refs = 1;
> -    red->qxl = qxl;
> -
> -    return red;
> -}
> -
>  static gboolean red_process_surface_cmd(RedWorker *worker, QXLCommandExt
>  *ext, gboolean loadvm)
>  {
>      RedSurfaceCmd surface_cmd;

Frediano
_______________________________________________
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]