This after typedef discussions. This version moved Drawable into a separate file. Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx> --- server/Makefile.am | 1 + server/dcc-encoders.c | 2 +- server/dcc-encoders.h | 1 + server/dcc.h | 8 ++++-- server/display-channel.h | 39 ++-------------------------- server/drawable.h | 67 ++++++++++++++++++++++++++++++++++++++++++++++++ server/image-cache.h | 4 +-- server/stream.h | 29 +++++++++++---------- 8 files changed, 94 insertions(+), 57 deletions(-) create mode 100644 server/drawable.h diff --git a/server/Makefile.am b/server/Makefile.am index 5a5c7e8..1cdc802 100644 --- a/server/Makefile.am +++ b/server/Makefile.am @@ -111,6 +111,7 @@ libserver_la_SOURCES = \ red-worker.h \ display-channel.c \ display-channel.h \ + drawable.h \ cursor-channel.c \ cursor-channel.h \ red-pipe-item.c \ diff --git a/server/dcc-encoders.c b/server/dcc-encoders.c index 65f5a17..febf269 100644 --- a/server/dcc-encoders.c +++ b/server/dcc-encoders.c @@ -21,7 +21,7 @@ #include <glib.h> -#include "dcc-encoders.h" +#include "dcc.h" #include "display-channel.h" #define ZLIB_DEFAULT_COMPRESSION_LEVEL 3 diff --git a/server/dcc-encoders.h b/server/dcc-encoders.h index 84f9f93..0a7e748 100644 --- a/server/dcc-encoders.h +++ b/server/dcc-encoders.h @@ -31,6 +31,7 @@ #include "lz4-encoder.h" #endif #include "zlib-encoder.h" +#include "drawable.h" typedef struct RedCompressBuf RedCompressBuf; typedef struct GlzDrawableInstanceItem GlzDrawableInstanceItem; diff --git a/server/dcc.h b/server/dcc.h index a11d25a..8cf4414 100644 --- a/server/dcc.h +++ b/server/dcc.h @@ -21,9 +21,13 @@ #include "red-worker.h" #include "pixmap-cache.h" #include "cache-item.h" -#include "dcc-encoders.h" #include "stream.h" #include "display-limits.h" +#include "drawable.h" + +typedef struct DisplayChannelClient DisplayChannelClient; + +#include "dcc-encoders.h" #define PALETTE_CACHE_HASH_SHIFT 8 #define PALETTE_CACHE_HASH_SIZE (1 << PALETTE_CACHE_HASH_SHIFT) @@ -156,7 +160,7 @@ typedef struct RedDrawablePipeItem { DisplayChannelClient *dcc; } RedDrawablePipeItem; -DisplayChannelClient* dcc_new (DisplayChannel *display, +DisplayChannelClient* dcc_new (struct DisplayChannel *display, RedClient *client, RedsStream *stream, int mig_target, diff --git a/server/display-channel.h b/server/display-channel.h index 4eb78c5..a186019 100644 --- a/server/display-channel.h +++ b/server/display-channel.h @@ -22,6 +22,7 @@ #include <common/rect.h> #include <common/sw_canvas.h> +#include "drawable.h" #include "red-worker.h" #include "reds-stream.h" #include "cache-item.h" @@ -46,43 +47,7 @@ #include "dcc.h" #include "display-limits.h" - -typedef struct DependItem { - Drawable *drawable; - RingItem ring_item; -} DependItem; - -struct Drawable { - uint8_t refs; - RingItem surface_list_link; - RingItem list_link; - DrawItem tree_item; - Ring pipes; - RedPipeItem *pipe_item_rest; - uint32_t size_pipe_item_rest; - RedDrawable *red_drawable; - - Ring glz_ring; - - red_time_t creation_time; - red_time_t first_frame_time; - int frames_count; - int gradual_frames_count; - int last_gradual_frame; - Stream *stream; - Stream *sized_stream; - int streamable; - BitmapGradualType copy_bitmap_graduality; - DependItem depend_items[3]; - - int surface_id; - int surface_deps[3]; - - uint32_t process_commands_generation; - DisplayChannel *display; -}; - -void drawable_unref (Drawable *drawable); +typedef struct DisplayChannel DisplayChannel; #define LINK_TO_DPI(ptr) SPICE_CONTAINEROF((ptr), RedDrawablePipeItem, base) #define DRAWABLE_FOREACH_DPI_SAFE(drawable, link, next, dpi) \ diff --git a/server/drawable.h b/server/drawable.h new file mode 100644 index 0000000..a9da312 --- /dev/null +++ b/server/drawable.h @@ -0,0 +1,67 @@ +/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +/* + Copyright (C) 2009-2015 Red Hat, Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, see <http://www.gnu.org/licenses/>. +*/ +#ifndef DRAWABLE_H_ +#define DRAWABLE_H_ + +#include "red-pipe-item.h" +#include "red-parse-qxl.h" +#include "tree.h" + +struct Stream; +struct DisplayChannel; + +typedef struct Drawable Drawable; + +typedef struct DependItem { + Drawable *drawable; + RingItem ring_item; +} DependItem; + +struct Drawable { + uint8_t refs; + RingItem surface_list_link; + RingItem list_link; + DrawItem tree_item; + Ring pipes; + RedPipeItem *pipe_item_rest; + uint32_t size_pipe_item_rest; + RedDrawable *red_drawable; + + Ring glz_ring; + + red_time_t creation_time; + red_time_t first_frame_time; + int frames_count; + int gradual_frames_count; + int last_gradual_frame; + struct Stream *stream; + struct Stream *sized_stream; + int streamable; + BitmapGradualType copy_bitmap_graduality; + DependItem depend_items[3]; + + int surface_id; + int surface_deps[3]; + + uint32_t process_commands_generation; + struct DisplayChannel *display; +}; + +void drawable_unref (Drawable *drawable); + +#endif /* DRAWABLE_H_ */ diff --git a/server/image-cache.h b/server/image-cache.h index 38a318e..b576308 100644 --- a/server/image-cache.h +++ b/server/image-cache.h @@ -23,9 +23,7 @@ #include <common/canvas_base.h> #include <common/ring.h> -/* FIXME: move back to display-channel.h (once structs are private) */ -typedef struct Drawable Drawable; -typedef struct DisplayChannelClient DisplayChannelClient; +#include "drawable.h" typedef struct ImageCacheItem { RingItem lru_link; diff --git a/server/stream.h b/server/stream.h index 715f920..3cc689a 100644 --- a/server/stream.h +++ b/server/stream.h @@ -25,6 +25,7 @@ #include "video-encoder.h" #include "red-channel.h" #include "image-cache.h" +#include "drawable.h" #define RED_STREAM_DETACTION_MAX_DELTA (NSEC_PER_SEC / 5) #define RED_STREAM_CONTINUS_MAX_DELTA NSEC_PER_SEC @@ -42,8 +43,8 @@ #define RED_STREAM_DEFAULT_LOW_START_BIT_RATE (2.5 * 1024 * 1024) // 2.5Mbps #define MAX_FPS 30 -/* move back to display_channel once struct private */ -typedef struct DisplayChannel DisplayChannel; +struct DisplayChannel; +struct DisplayChannelClient; typedef struct Stream Stream; @@ -85,7 +86,7 @@ typedef struct StreamAgent { Stream *stream; uint64_t last_send_time; VideoEncoder *video_encoder; - DisplayChannelClient *dcc; + struct DisplayChannelClient *dcc; int frames; int drops; @@ -139,28 +140,28 @@ struct Stream { uint32_t input_fps; }; -void display_channel_init_streams (DisplayChannel *display); -void stream_stop (DisplayChannel *display, +void display_channel_init_streams (struct DisplayChannel *display); +void stream_stop (struct DisplayChannel *display, Stream *stream); -void stream_unref (DisplayChannel *display, +void stream_unref (struct DisplayChannel *display, Stream *stream); -void stream_trace_update (DisplayChannel *display, +void stream_trace_update (struct DisplayChannel *display, Drawable *drawable); -void stream_maintenance (DisplayChannel *display, +void stream_maintenance (struct DisplayChannel *display, Drawable *candidate, Drawable *prev); -void stream_timeout (DisplayChannel *display); -void stream_detach_and_stop (DisplayChannel *display); -void stream_trace_add_drawable (DisplayChannel *display, +void stream_timeout (struct DisplayChannel *display); +void stream_detach_and_stop (struct DisplayChannel *display); +void stream_trace_add_drawable (struct DisplayChannel *display, Drawable *item); -void stream_detach_behind (DisplayChannel *display, +void stream_detach_behind (struct DisplayChannel *display, QRegion *region, Drawable *drawable); -void stream_agent_unref (DisplayChannel *display, +void stream_agent_unref (struct DisplayChannel *display, StreamAgent *agent); void stream_agent_stop (StreamAgent *agent); -void detach_stream(DisplayChannel *display, Stream *stream, int detach_sized); +void detach_stream(struct DisplayChannel *display, Stream *stream, int detach_sized); #endif /* STREAM_H */ -- 2.7.4 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel