Commit Graph

1395 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
Nahum Shalman
c3eae62872 cleanup x11 library detection for building client
Consolidate two separate chunks of library hunting that depend on the
same check.

Check if we're actually building the client before looking for
client only libraries.

Hide some of the final output if we're not building the client.
2012-05-04 14:51:11 +02: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
Yonit Halperin
892462658b Update the spice-common submodule
We need some rect/region getters methods that were added
2012-05-03 12:30:47 +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
91210c671f Ensure __STDC_FORMAT_MACROS is always defined first
The client/common.h file defines __STDC_FORMAT_MACROS before
including inttypes.h so that the PRI* macros get defined in
C++. This is ignoring the possibility that other global
includes may have already pulled in inttypes.h

We need __STDC_FORMAT_MACROS to be defined before any header
files are included. Putting it in config.h satisfies this,
since config.h is always the first header
2012-04-26 18:46:52 +01:00
Daniel P. Berrange
5e15aa74c6 Disable -Waggregate-return if building with SLIRP
The API design of SLIRP means that it is not practical to use
the -Waggregate-return warning flag. Disable this flag in the
(unlikely) scenario where SLIRP is actually requested at build
time
2012-04-26 18:46:52 +01:00
Alon Levy
c6bf062810 bump spice-common with SpiceClips fix 2012-04-26 20:04:46 +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
6d7d9bc12d Fix printf format specifiers for i686 hosts
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-04-25 11:00:01 +01:00
Daniel P. Berrange
3bbc53521e Add missing struct field initializers
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-04-25 10:51:37 +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
f056a53b99 Add a few more syntax-check exemptions
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-04-25 09:49:32 +01:00
Daniel P. Berrange
8646341983 Add recent new committers to AUTHORS file / mailmap
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-04-25 09:49:29 +01:00
Daniel P. Berrange
d986fb466b Enable many more compiler warnings
* m4/manywarnings.m4m, m4/warnings.m4: Import GNULIB warnings
  modules
* m4/spice-compile-warnings.m4: Define SPICE_COMPILE_WARNINGS
* configure.ac: Replace compile warning check with a call to
  SPICE_COMPILE_WARNINGS
* client/Makefile.am: Use WARN_CXXFLAGS instead of WARN_CFLAGS

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-04-25 09:49:25 +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
e1633c65cc Fix broken -I../common to be -I../spice-common in client
* Makefile.am: s/common/spice-common/

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-04-25 09:42:15 +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