RedDrawable really is a RedDrawCmd which is parsed by red-parse-qxl.h Moreover, red_drawable_ref() is already defined inline in red-parse-qxl.h, and red_drawable_unref() is declared there too even if its code is still in red-worker.c This commit moves them close to the other functions creating/unref'ing QXL commands parsed by red-parse-qxl.h. Signed-off-by: Christophe Fergeau <cfergeau@xxxxxxxxxx> --- server/red-parse-qxl.c | 26 ++++++++++++++++++++++++++ server/red-parse-qxl.h | 12 ++++-------- server/red-worker.c | 20 -------------------- 3 files changed, 30 insertions(+), 28 deletions(-) diff --git a/server/red-parse-qxl.c b/server/red-parse-qxl.c index 4a45c0f76..341d050d1 100644 --- a/server/red-parse-qxl.c +++ b/server/red-parse-qxl.c @@ -1480,3 +1480,29 @@ void red_put_cursor_cmd(RedCursorCmd *red) red_qxl_release_resource(red->qxl, red->release_info_ext); } } + +RedDrawable *red_drawable_ref(RedDrawable *drawable) +{ + drawable->refs++; + return drawable; +} + +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..3b815a860 100644 --- a/server/red-parse-qxl.h +++ b/server/red-parse-qxl.h @@ -59,14 +59,6 @@ typedef struct RedDrawable { } u; } RedDrawable; -static inline RedDrawable *red_drawable_ref(RedDrawable *drawable) -{ - drawable->refs++; - return drawable; -} - -void red_drawable_unref(RedDrawable *red_drawable); - typedef struct RedUpdateCmd { QXLReleaseInfoExt release_info_ext; SpiceRect area; @@ -118,6 +110,10 @@ typedef struct RedCursorCmd { void red_get_rect_ptr(SpiceRect *red, const QXLRect *qxl); +RedDrawable *red_drawable_new(QXLInstance *qxl); +RedDrawable *red_drawable_ref(RedDrawable *drawable); +void red_drawable_unref(RedDrawable *red_drawable); + bool red_get_drawable(RedMemSlotInfo *slots, int group_id, RedDrawable *red, QXLPHYSICAL addr, uint32_t flags); void red_put_drawable(RedDrawable *red); 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; -- 2.14.3 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel