Commit Graph

740 Commits

Author SHA1 Message Date
Alon Levy
c6bb40947f server/red_worker/red_handle_self_bitmap: add red_drawable local, one extra whitespace line removed 2012-05-15 18:01:47 +03:00
Alon Levy
96bfcea965 server/red_worker: rename SpiceImage *self_bitmap to self_bitmap_image 2012-05-15 18:01:42 +03:00
Alon Levy
8f65b3fb36 Revert "server/red_worker: fix possible leak of self_bitmap"
This reverts commit 35dbf3ccc4.

accidentally pushed v1 of patches, reverting in preperation of pushing
v2.
2012-05-15 18:01:04 +03:00
Alon Levy
35dbf3ccc4 server/red_worker: fix possible leak of self_bitmap
After the previous patch moving self_bitmap freeing inside red_drawable
ref count, we have a possible self_bitmap leak:

red_process_commands
 red_get_drawable | red_drawable #1, red_drawable->self_bitmap == 1
  red_process_drawable | rd #2, d #1, d->self_bitmap != NULL
   release_drawable | rd #1, d# = 0, try to release self_bitmap, but
                        blocked by rd #1
  put_red_drawable | rd #0

This patch moves the call to release_drawable after the call to
put_red_drawable, thereby fixing the above situation.
2012-05-14 14:39:10 +03:00
Alon Levy
bab771c10d server/red_worker/red_process_commands: rename drawable to red_drawable (later add a local drawable) 2012-05-14 14:36:33 +03:00
Alon Levy
c8cefd4a8f server/red_worker: red_process_drawable: have single point of exit 2012-05-14 14:32:23 +03:00
Yonit Halperin
6935bd3d60 server/red_worker: don't release self_bitmap unless refcount is 0
RHBZ: 808936
2012-05-14 10:33:31 +03:00
Yonit Halperin
c211774422 server/mjpeg_encoder: fix wrong size assigned to dest_len
It should have been the allocated size and not the occupied one.
This led to a lot of unnecessary allocations and deallocations.
2012-05-10 14:06:59 +03:00
Yonit Halperin
fecc1e3d4d server/mjpeg_encoder: Fix memory leak for the inital output buffer given for each frame 2012-05-10 14:01:04 +03:00
Alon Levy
ce8e865cf1 server/reds: add "usbredir" to recognized channel names
RHBZ: 819484

Signed-off-by: Alon Levy <alevy@redhat.com>
2012-05-07 14:37:50 +03:00
Yonit Halperin
4c88034845 server/tests/test_display_streaming: include tests for clip and sized frames
CC: Alon Levy <alevy@redhat.com>
2012-05-03 13:09:54 +03:00
Yonit Halperin
c44726bd5f server/tests: use the correct dimensions in SIMPLE_UPDATE 2012-05-03 13:09:54 +03:00
Yonit Halperin
a267a4b315 server/tests: add SLEEP command to test_display_base 2012-05-03 13:09:53 +03:00
Yonit Halperin
bccf5bc35a server/tests: add clip to SIMPLE_DRAW_BITMAP 2012-05-03 13:09:53 +03:00
Alon Levy
3373cda434 server/tests/test_display_streaming: update to create sized frames 2012-05-03 13:09:52 +03:00
Alon Levy
8778b8eb2c server/tests: add SIMPLE_DRAW_SOLID and SIMPLE_DRAW_BITMAP 2012-05-03 13:09:51 +03:00
Alon Levy
76fd64ad96 server/tests: refactor Command 2012-05-03 13:09:51 +03:00
Alon Levy
703f32cda9 server/tests: add test_get_width/test_get_height 2012-05-03 13:09:50 +03:00
Alon Levy
2f02599e6a server/tests: refactor test_display_base 2012-05-03 13:09:50 +03:00
Yonit Halperin
8c9114f9f4 server/red_worker/video: don't override the clip in areas that belong only to sized frames 2012-05-03 13:09:49 +03:00
Yonit Halperin
318dce4abb server/red_worker.c/video: add support for frames of different sizes
rhbz #813826

When playing a youtube video on Windows guest, the driver sometimes(**) sends
images which contain the video frames, but also other parts of the
screen (e.g., the youtube process bar). In order to prevent glitches, we send these
images as part of the stream, using SPICE_MSG_DISPLAY_STREAM_DATA_SIZED.

(**) It happens regularly with the you tube html5 player. With flash,
it occurs when moving the cursor in the player area.
2012-05-03 13:07:01 +03:00
Yonit Halperin
0f1fb0ecc2 Update the spice-common submodule
spice-common changes: STREAM_DATA_SIZED message was added in order to support
video streams with frames that their size is different from the initial size
that the stream was created with.

This patch also includes server and client adjustments to the new
SpiceMsgDisplayStreamData.
2012-05-03 12:31:03 +03:00
Yonit Halperin
21b857f3ce server/red_worker/video: don't detach a drawable from a stream due to it being rendered.
The previous patch took care that streams will be upgraded by a surface
screenshot and not the last frame, if necessary. Thus, there is no
more a reason for detaching drawables from streams when they are
rendered. Moreover, detaching such drawables can cause glitches, in
case they are still in the pipe, and red_update_area is called
frequently and leads to stream frames rendering.
2012-05-03 12:31:02 +03:00
Yonit Halperin
81fe00b08a server/red_worker/video: upgrade stream by a screenshot instead of the last frame, if needed
Upgrading a stream: When the stream's visible region is bigger than the one of the last
frame, we will send an updated screenshot of the visible region, instead
of sending the last frame losslessly.
2012-05-03 12:30:59 +03:00
Yonit Halperin
80f0865b44 server/red_worker/video: maintain visible region and clip region for streams
Differentiate between the clipping of the video stream, and the region
that currently displays fragments of the video stream (henceforth,
vis_region). The latter equals or contains the former one. For example,
let c1 be the clip area at time t1, and c2 be the clip area at time t2,
where t1 < t2. If c1 contains c2, and at least part of c1/c2, hasn't been
covered by a non-video images, vis_region will contain c2, and also the part
of c1/c2 that still displays fragments of the video.
When we consider if a stream should be "upgraded" (1), due to its area
being used by a rendering operation, or due to stopping the video, we
should take into account the vis_region, and not the clip region (next
patch: not upgrade by the last frame, but rather by vis_region).
This fix will be more necessary when sized frames are introduced (see the
following patches). Then, the vis_region might be larger
than the last frame, and contain it, more frequently than before.

(1) "upgrading a stream" stands for sending its last frame losslessly. Or more
precisely, lossless resending of all the currently displayed lossy areas, that were
sent as part of the stream.
2012-05-03 12:30:55 +03:00
Yonit Halperin
3ccc9de184 server/red_worker: add get_stream_id 2012-05-03 12:30:54 +03:00
Jeremy White
8d3ebe31dd Force 64 bit multiplication on 32 bit systems; fixes a bug where the server times out the display channel freakily fast. 2012-04-27 11:29:31 +03:00
Daniel P. Berrange
ef78242e19 Add some more 'noreturn' annotations
Methods which longjump, unconditionally raise an
exception, or call _exit()  cannot return control
to the caller so should be annotated with 'noreturn'

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-04-25 11:31:14 +01:00
Daniel P. Berrange
49e2b2679f Fix typo in is_equal_brush
The 3 part of the conditional in the is_equal_brush method
compared the b1->u.color field to itself, instead of b2->u.color

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-04-25 11:31:14 +01:00
Daniel P. Berrange
e71cb83680 Ensure config.h is the first include in the file
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-04-25 09:49:34 +01:00
Daniel P. Berrange
39565707a9 Make some int->pointer casts explicit
Tell the compiler that was really do intend to cast from int
to pointer, to prevent warnings about implicit casts

* server/tests/test_display_base.c: Add explicit casts

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-04-25 09:49:25 +01:00
Daniel P. Berrange
7af613362a VSCMsgHeader.reader_id is unsigned, so don't check for >= 0
* server/smartcard.c: Fix assertion to not check for >= 0 on
  unsigned variable

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-04-25 09:42:15 +01:00
Daniel P. Berrange
84c7a95c22 Avoid jumping across variables declarations with initializers
If a 'goto' statement jumps across a variable declaration
which also has an initializer, the variable is in an undefined
state. Splitting the the declaration & initialization doesn't
change that, but the compiler can at least now detect use of
the unintialized variable

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-04-25 09:42:15 +01:00
Daniel P. Berrange
3be7df0980 Convert cases of () to (void)
* server/reds.c, server/smartcard.c: s/()/(void)

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-04-25 09:42:15 +01:00
Daniel P. Berrange
93d8ca8191 Remove 2 *MB* stack frame in red_worker_main
The red_worker_main method allocates a RedWorker struct instance
on the stack. This struct is a full 2 MB in size which is not
at all resonable to allocate on the stack.

* server/red_worker.c: Move RedWorker struct to the heap

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-04-25 09:42:15 +01:00
Daniel P. Berrange
eeb2b65a7d Mark some variables as volatile
When using setjmp/longjmp the state of local variables can be
undefined in certain scenarios:

[quote man(longjmp)]
       The values of automatic variables are unspecified  after  a
       call to longjmp() if they meet all the following criteria:

       ·  they are local to the function that made the correspond‐
          ing setjmp(3) call;

       ·  their values are changed between the calls to  setjmp(3)
          and longjmp(); and

       ·  they are not declared as volatile.
[/quote]

* server/red_worker.c: Mark some vars as volatile

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-04-25 09:42:15 +01:00
Daniel P. Berrange
456634a63e Mark functions which never return control
* client/red_channel.cpp:  AbortTrigger::on_event can't return
  given its current impl
* server/red_worker.c: red_worker_main can't return

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-04-25 09:42:15 +01:00
Daniel P. Berrange
6a8b7585e2 Fix multiple printf format problems
All printf var-args style methods should be annotation with
their format. All format strings must be const strings.

* client/application.cpp, client/cmd_line_parser.cpp,
  client/hot_keys.cpp: Avoid non-const format
* client/client_net_socket.cpp: Fix broken format specifier
* client/red_peer.cpp: Fix missing format specifier
* client/platform.h: Add SPICE_GNUC_PRINTF annotation to term_printf
* client/utils.h: Add SPICE_GNUC_PRINTF annotation to string_printf
* server/glz_encoder_config.h, server/red_worker.c: Add
  SPICE_GNUC_PRINTF annotation to warning callbacks

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-04-25 09:42:11 +01:00
Daniel P. Berrange
832a98800d Fix const-ness violations
* server/red_worker.c: Add missing const for return type
* server/reds.c: Static strings must be declared const

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-04-25 09:40:18 +01:00
Daniel P. Berrange
e139521928 Don't do arithmetic on void * type, use uint8_t instead
Arithmetic on void * types is non-portable & trivially avoided

* server/dispatcher.c: Use uint8_t for arithmetic

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-04-25 09:40:18 +01:00
Michael Tokarev
351fe52ca7 fix error-path return in snd_set_record_peer()
The error_{1,2} labels in this functions are backwards.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2012-04-18 11:30:14 +03:00
Alon Levy
2ec2dbc78a server: allow failure in getvirt
This patch changed getvirt to continue working even if spice_critical
doesn't abort (i.e. SPICE_ABORT_LEVEL != -1). This is in preparation to
make getvirt not abort at all. The reason is that getvirt is run on
guest provided memory, so a bad driver can crash the vm.
2012-04-05 18:28:49 +03:00
Alon Levy
5dd5b70223 server: export spice_server_is_server_mouse predicate
To be used by qemu query-spice / info spice commands.
2012-03-26 14:41:03 +02:00
Marc-André Lureau
b34fd7432d Use the spice-common logging functions
It will abort by default for critical level messages. That behaviour
can be tuned at runtime.
2012-03-25 19:00:00 +02:00
Marc-André Lureau
359fc1cb5d Use the spice-common submodule
This patch will replace the common/ directory with the spice-common
project. It is for now a simple project subdirectory shared with
spice-gtk, but the goal is to make it a proper library later on.

With this change, the spice-server build is broken. The following
commits fix the build, and have been seperated to ease the review.

v2
- moves all the generated marshallers to spice-common library
- don't attempt to fix windows VS build, which should somehow be
  splitted with spice-common (or built from tarball only to avoid
  generation tools/libs deps)
v3
- uses libspice-common-client
- fix a mutex.h inclusion reported by Alon
2012-03-25 18:59:10 +02:00
Marc-André Lureau
4df135c858 sasl: small refactoring, check memcheck != NULL 2012-03-23 13:10:54 +01:00
Marc-André Lureau
d4ba4ee690 Use spice_strdup() to avoid crashing on NULL
qemu can call spice_server_set_name(s, NULL) when the name is not
given. Let's not crash in this case
2012-03-23 13:10:54 +01:00
Alon Levy
a7d3f1de82 server/tests: add resolution changes tester 2012-03-22 11:18:37 +02:00
Alon Levy
a6f9797c79 server/tests/test_display_base: add Command
add parameters to the commands used for display tests.
2012-03-22 11:18:37 +02:00
Alon Levy
c36bf55971 server/tests/test_display_base: remove 64bit arch assumptions 2012-03-21 17:58:25 +02:00