Commit Graph

1524 Commits

Author SHA1 Message Date
Frediano Ziglio
253d2cef40 stat: use a better design for statistic functions
make sure code compile with statistics enabled or disabled.
Dummy (empty) structures and functions are used instead of preprocessor.
Also fix a problem as stat_compress_init did not initialize clock
field.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2015-12-09 17:02:48 +00:00
Frediano Ziglio
4173663ea1 stat: fix portability problem in stat_time_t declaration
Assure stat_time_t is 64 bit on all architectures.
long is not 64 bit on 32 bit systems so use uint64_t intead.
Also avoid 32 bit overflows for such architectures.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2015-12-09 17:02:41 +00:00
Marc-André Lureau
c0f4de5c86 display: replace some dubious asserts
Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
Acked-by: Uri Lublin <uril@redhat.com>
2015-12-09 11:42:00 +00:00
Francois Gouget
9956270358 server: Use g_get_monotonic_time() to get the time in microseconds
Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2015-12-08 15:08:44 -06:00
Francois Gouget
c8d5120ff0 server: Define the MJPEG encoder warmup time in nanoseconds
Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2015-12-08 15:08:44 -06:00
Francois Gouget
4ce4c4a525 server: Simplify the MJPEG encoder's maximum framerate estimation
Note that if frame_size == bytes_per_sec == 0 this now returns
MJPEG_MAX_FPS but this should not happen anyway.

Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
2015-12-08 16:22:41 +01:00
Francois Gouget
9b42aafe31 server: Rename SUPPORT_AUTOMATED_TESTS to HAVE_AUTOMATED_TESTS
This improves consistency with spice-deps.m4 which names its
AM_CONDITIONAL() variables HAVE_XXX.

Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
2015-12-08 15:39:11 +01:00
Alon Levy
6e6126e024 server: multiple clients works ok if we limit the pipe to the slowest client
Signed-off-by: Alon Levy <alon@pobox.com>
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2015-12-04 15:43:56 +00:00
Frediano Ziglio
ed1ef89ca8 pass proper type to SPICE_CONTAINEROF
In some case the member specified to SPICE_CONTAINEROF was not
exactly the same type of the pointer passed.
This can cause issues if structure changes so use proper member.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2015-12-04 13:33:54 +00:00
Frediano Ziglio
89fda203bc worker: improve validation for update command
If surface_id is not valid we should still release resource allocated
by red_get_update_cmd and from the guest.
This to reduce leaks in case of a race or another error in the guest
driver.
Also not issue a warning on invalid surface number to avoid filling
log space unconditionally.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2015-12-04 12:02:36 +00:00
Jonathon Jongsma
0410c6f165 remove glz_encoder_config.h
Move all code from glz_encoder_config.h into other files.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2015-12-04 11:57:18 +00:00
Alon Levy
aef334e6e8 tests: test_display_base: use a faster wakeup time to easily test multiple client blocking
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2015-12-04 11:46:27 +00:00
Frediano Ziglio
525cd67be7 server: rename files
Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2015-12-03 23:54:32 +00:00
Frediano Ziglio
1ea55284d9 memslot: change some spice_assert to spice_return_if_fail
Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2015-12-03 23:51:18 +00:00
Frediano Ziglio
1873c7d497 display: misc style and rename changes
- remove some red_ prefix;
- move red_drawable->self_bitmap check outside handle_self_bitmap;
- move update check outside red_get_area (renamed surface_read_bits);
- rename depend_on_surface_id argument to surface_id;
- rename success variable to add_to_pipe.

Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2015-12-03 23:51:18 +00:00
Frediano Ziglio
1940972ca9 worker: move red_process_draw to display-channel.c
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2015-12-03 23:51:18 +00:00
Frediano Ziglio
dfaf83235f display: make get_drawable symmetric to display_channel_drawable_unref
Make possible to safely call display_channel_drawable_unref straight
after calling get_drawable.

Problem was function definitions and dependency.

display_channel_drawable_try_new is supposed to return an uninitialized
pointer (or NULL on failure) to a Drawable structure.

(display_channel_)get_drawable is supposed to return an initialized
pointer (or NULL) to a Drawable structure.

(display_channel_)add_drawable is supposed to add the Drawable to the
list/tree of drawing to draw.

Now, with these definitions after get_drawable the Drawable state (if
pointer is not NULL) should be consistent and we should be able to call
display_channel_drawable_unref.

In the current code this was not true as for instance surface_id was
copied to Drawable but the reference counter of the surface was not
incremented leading possible unref call to decrement the counter and
free the surface. This can happen if any call between get_drawable and
unref does not increment the reference in a consistent way. This
basically means that every present or future code in the path between
get_drawable and unref have to know this unconsistency and handle it.
This is a maintaining problem as people need to know these details when
editing existing code (actually this is display_channel_add_drawable
code).
This basically create a dependency between get_drawable and
add_drawable.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2015-12-03 23:51:18 +00:00
Francois Gouget
43d6c5b9ee server: Reuse red_get_monotonic_time() in the MJPEG video encoder
Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2015-12-03 15:35:06 +00:00
Frediano Ziglio
89707f3b4d stat: fix stat_info_t initialization
For compression statistics clock field was not initialized but used
computing statistics.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2015-12-03 10:56:03 +00:00
Marc-André Lureau
ef8c431d9b worker: rename process_commands process_display
Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2015-12-03 10:48:42 +00:00
Frediano Ziglio
bf1e139875 dcc: reduce statement wrapping
Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2015-12-03 10:41:46 +00:00
Frediano Ziglio
f31536802a worker: change red_worker_new_channel result to CommonChannel*
Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2015-12-03 10:41:46 +00:00
Frediano Ziglio
7280460b78 memslot: prefix memslot functions with memslot_
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2015-12-03 10:41:46 +00:00
Frediano Ziglio
768dfa2139 worker: do not use dynamic memory for RedSurfaceCmd
Allocation on stack is sufficient and code is more similar to
QXL_CMD_MESSAGE and QXL_CMD_UPDATE cases.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2015-12-03 10:41:46 +00:00
Frediano Ziglio
c1ecbaf7b1 display: move more logic in display_channel_get_drawable()
Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2015-12-03 10:41:46 +00:00
Frediano Ziglio
c26e6de0ee worker: move get_drawable to display-channel.c
Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2015-12-03 10:41:46 +00:00
Marc-André Lureau
13a3560b88 smartcard: include libcacard.h if possible
Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
2015-12-02 17:48:49 +01:00
Yonit Halperin
1ea34e6d43 red_worker: make dcc_clear_surface_drawables_from_pipe declaration consistent with definition
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2015-12-02 12:52:10 +00:00
Marc-André Lureau
1c9aea02c6 worker: merge handle_new_display_channel
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2015-12-02 12:47:25 +00:00
Marc-André Lureau
5161132ec7 display: rename detach_streams_behind
Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2015-12-02 12:44:46 +00:00
Marc-André Lureau
4980850dd2 display: add update_compression() method
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2015-12-02 12:34:47 +00:00
Marc-André Lureau
47b023866f worker: move red_process_surface
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2015-12-02 12:29:34 +00:00
Marc-André Lureau
d793473e5e server: cleanups
Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2015-11-27 11:49:56 +00:00
Marc-André Lureau
5c93b2b4d2 worker: remove some unnecessary inline
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2015-11-27 11:47:10 +00:00
Marc-André Lureau
203b3cdebf worker: move dcc_send & marshallers to dcc-send.c
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2015-11-27 11:41:51 +00:00
Marc-André Lureau
7258e5a688 worker: move red_pipes_remove_drawable
Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2015-11-26 15:37:47 +00:00
Marc-André Lureau
4ca383b261 worker: move current_remove*
Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2015-11-26 15:27:24 +00:00
Marc-André Lureau
d9b17bbebb worker: move more stream functions
Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2015-11-26 15:19:03 +00:00
Marc-André Lureau
c26a825451 display: remove some public declarations
Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2015-11-26 15:12:22 +00:00
Marc-André Lureau
721c03394b server: move LZ_IMAGE_TYPE_* enum to dcc
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2015-11-26 14:59:51 +00:00
Marc-André Lureau
f6e5cbdf32 display: Simplify display_channel_create_surface
Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2015-11-26 13:50:30 +00:00
Marc-André Lureau
82fa233fa6 server: rename _tmpl files
Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2015-11-26 13:33:36 +00:00
Marc-André Lureau
19f92e9eb8 display: reuse code in display_channel_draw_until
Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2015-11-26 13:26:49 +00:00
Marc-André Lureau
180b9f27df worker: use spice_return_if_fail() instead of spice_assert() in release_item
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2015-11-26 13:25:42 +00:00
Marc-André Lureau
7ae663ad69 worker: changed some spice_assert in display_channel_draw_till
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2015-11-26 13:17:38 +00:00
Marc-André Lureau
7d38c28a0a display: Remove extra parameters from create_canvas_for_surface
Get them from the surface

Acked-by: Pavel Grunt <pgrunt@redhat.com>
2015-11-25 14:14:50 +00:00
Marc-André Lureau
4e35645fb0 worker: move display_channel_create_surface
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2015-11-25 14:14:50 +00:00
Marc-André Lureau
fd9c97a833 worker: move display_channel_update
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2015-11-25 14:14:50 +00:00
Marc-André Lureau
0ebb539f48 worker: move destroy_surface() familly
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2015-11-25 14:14:50 +00:00
Marc-André Lureau
9c828e8553 worker: move display_channel_new
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2015-11-25 14:14:36 +00:00