Commit Graph

45 Commits

Author SHA1 Message Date
Christophe Fergeau
a653044011 Rename red_channel_pipe_item_init to pipe_item_init
The RedChannel argument is not used by pipe_item_init. Removing it
will make code simpler in places where we don't have a RedChannel
directly available.
This is acting on a PipeItem object so correct name is pipe_item_init.

Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-03-10 11:36:52 +00:00
Marc-André Lureau
acd53b97fb Fix dcc_start() regression
Commit e9ed125d introduced a dead-lock regression by taking twice the
same lock recursively. The previous code checked if a dmabuf was set
without taking the lock, for queuing scanout messages. Since the message
is being processed later on, it make sense to queue and delay until it
is sent to check if there is a scanout.

backtrace:
 #0  red_qxl_get_gl_scanout (qxl_state=0x5555582373c0) at red-qxl.c:828
 #1  0x00007fffec1ae654 in marshall_gl_scanout (rcc=0x7fffda6a7010,
 #m=0x7fff44025e60, item=0x7fff440958a0) at dcc-send.c:2310
 #2  0x00007fffec1aec7b in dcc_send_item (dcc=0x7fffda6a7010,
 #pipe_item=0x7fff440958a0) at dcc-send.c:2441
 #3  0x00007fffec1730f6 in send_item (rcc=0x7fffda6a7010,
 #item=0x7fff440958a0) at display-channel.c:1963
 #4  0x00007fffec1504c3 in
 #red_channel_client_send_item (rcc=0x7fffda6a7010, item=0x7fff440958a0)
 #at red-channel.c:578
 #5  0x00007fffec152d98 in red_channel_client_push (rcc=0x7fffda6a7010)
 #at red-channel.c:1365
 #6  0x00007fffec1a387e in dcc_push_monitors_config (dcc=0x7fffda6a7010)
 #at dcc.c:563
 #7  0x00007fffec1a3489 in dcc_start (dcc=0x7fffda6a7010) at dcc.c:475

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-03-08 15:24:56 +00:00
Frediano Ziglio
e9ed125dbd use QXLState instead of RedDispatcher
Considering that:
- QXLState is the state of QXLInstance implementation;
- RedDispatcher is the implementation of QXL;
- qif (QXLInterface*) field can be computed really easy from QXLInstance;
- most of its state is private.
Make all structure private and use QXLState instead of RedDispatcher.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-03-04 15:47:45 +00:00
Jonathon Jongsma
3644783e24 CommonChannel -> CommonGraphicsChannel
Rename this struct to make it clear that it's only the base class for
graphics channels (e.g. display and cursor), not all channels.

Also renamed CommonChannelClient to CommonGraphicsChannelClient.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-02-17 12:58:40 +00:00
Pavel Grunt
af3aa4b1f4 compress-stat: Add not compressed image to statistics
To see how many images and data could not be compressed.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-17 08:51:16 +00:00
Pavel Grunt
1948566ce8 dcc: Move COMPRESS_DEBUG to compression functions
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-17 08:51:13 +00:00
Pavel Grunt
f401eb07f9 dcc: Rewrite dcc_image_compress
Rules are now:

Compression type:
  off      -> uncompressed
  quic     -> jpeg if possible else quic else off
  lz       -> lz if possible else off
  glz      -> glz if possible else lz else off
  auto_lz  -> lz if possible else jpeg else quic else off
  auto_glz -> glz if possible else lz else jpeg else quic else off
  lz4      -> lz4 if possible else lz else off

jpeg is used only when jpeg-wan-compression allows it

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-17 08:50:43 +00:00
Frediano Ziglio
0ebd3b0d04 dcc: move id from CommonChannelClient to DisplayChannelClient
Was not used by CursorChannelClient but only by DisplayChannelClient.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-02-16 13:07:08 +00:00
Frediano Ziglio
3108fb37e3 Revert "dcc: remove not necessary volatile specifications"
This reverts commit efe5a0c501.

Due to a problem in the compiler this causes compile to fail.

Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-02-15 16:09:49 +00:00
Christophe Fergeau
4049481882 Remove RedGlzDrawable::group_id
It's unused.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-15 12:29:13 +00:00
Christophe Fergeau
9500c32a30 Remove Drawable::group_id
We can now directly get it from RedDrawable.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-15 12:29:10 +00:00
Frediano Ziglio
efe5a0c501 dcc: remove not necessary volatile specifications
These automatic variable are used just inside the function.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-02-12 06:17:32 +00:00
Frediano Ziglio
fbdea0fa79 CommonChannel: hold a reference to QXLInstance instead of RedWorker
CommonChannel does not need to know about RedWorker.
This reduce a bit dependencies between objects.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-02-11 23:51:46 +00:00
Frediano Ziglio
d56745df19 dcc: remove group_id from compression functions
The parameter was not used.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-02-11 23:51:45 +00:00
Frediano Ziglio
448700bfb4 channel: rename misleading functions
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-02-11 23:51:42 +00:00
Marc-André Lureau
8777864311 Handle GL_DRAW_DONE
When a client is done with drawing and sends
SPICE_MSGC_DISPLAY_GL_DRAW_DONE, or when it ends, update the number of
async counts.

Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
[reduce critical message to a warning; do not reset gl_draw_ongoing
 - Frediano Ziglio]
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-09 14:01:30 +00:00
Marc-André Lureau
381dc93ec0 Handle GL_DRAW messages
Create an async, and marshall the GL_DRAW message. Count number of
clients, and wait until gl_draw_async_count is 0 to complete the async.
The count is going to be updated in the following patch when the client
is done with the draw.

Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
[removed unused sent field; move gl_draw_async_count to DisplayChannel
 - Frediano Ziglio]
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-09 14:01:25 +00:00
Marc-André Lureau
5881b40ebd Send current GL scanout to new client
Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
2016-02-09 14:01:20 +00:00
Marc-André Lureau
7a06efde1c Handle GL_SCANOUT messages
Go through dispatcher and marshall scanout message. Since the marshaller
and the QXL state are manipulated from different threads, add a mutex to
protect the current scanout.

Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
2016-02-09 14:01:17 +00:00
Pavel Grunt
0bfad8a37f dcc: make dcc_compress_image_*() private
Reviewed-by: Victor Toso <victortoso@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-01-20 16:05:02 +00:00
Pavel Grunt
faa907e3c6 dcc_compress_image: Handle NULL drawable
It will be used in the following commit.
The GLZ compression cannot be used when the drawable is NULL.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-01-20 16:04:55 +00:00
Christophe Fergeau
400a5d13cf Remove compress_buf_new
This commit reworks a bit the management of RedCompressBuf so that
compress_buf_new/compress_buf_free become unneeded.
Since d25d6ca0 and the introduction of encoder_data_reset,
compress_buf_free is already unused outside of dcc-encoders.c and could
be static. This in turn makes compress_buf_new a bit odd as the matching
destructor is never used in dcc.c.
This commit introduces an encoder_data_init() method which is hiding
the initialization of the EncoderData structure from the dcc.c code,
allowing to get rid of compress_buf_new() calls from dcc.c code.

It also uses this as an opportunity to stop using GSlice for
RedCompressBuf.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-01-14 16:39:30 +00:00
Frediano Ziglio
1b6af4779a dcc: avoid to report errors triggered by client
Client can always send report even if a stream is not available.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-01-11 14:45:02 +00:00
Frediano Ziglio
d25d6ca0f2 dcc: write and use a new encoder_data_reset function to clean buffers
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-01-08 16:25:37 +00:00
Frediano Ziglio
bd8c74d7a4 dcc: free glz buffer after zlib compression
For zlib+glz compression image if first compressed with glz then the
resulting buffer is compressed again with zlib then the buffer from
zlib is returned to the caller.
However the temporary glz buffer was not freed resulting in a memory
leak.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-01-08 16:25:25 +00:00
Lukas Venhoda
6c4f11191c dcc: Don't disconnect channel, when compression is not supported
Don't disconnect the display channel, when unsupported compression is
requested from the client. Not changing the compression is enough.

https://bugs.freedesktop.org/show_bug.cgi?id=92821
Acked-by: Victor Toso <victortoso@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2015-12-17 12:29:52 +01:00
Francois Gouget
cbc4e07682 server: Rename DISPLAY_CLIENT_TIMEOUT and de-duplicate it
Given that it is used for both cursor and display, COMMON_CLIENT_TIMEOUT
seems more appropriate. Also define it only in red-worker.h.

Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2015-12-14 10:53:40 +00:00
Francois Gouget
65b60250d0 server: Rename red_get_monotonic_time() to spice_get_monotonic_time_ns()
This is a generic function not tied to the red_xxx functionality and the
new name clarifies that it returns the time in nanoseconds (unlike
g_get_monotonic_time()).

Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2015-12-11 12:43:26 +00:00
Frediano Ziglio
b12187b332 channel: rename red_channel_(client_)waits_* functions
Make clear that these funcion are just checking a condition.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2015-12-10 17:22:59 +00:00
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
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
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
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
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
Marc-André Lureau
742e3666ab worker: move dcc_release_item
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2015-11-24 09:03:39 +00:00
Marc-André Lureau
5bd0fd9fe4 worker: move dcc_handle_migrate_data
Acked-by: Fabiano Fidêncio <fabiano@fidencio.org>
2015-11-24 09:03:07 +00:00
Marc-André Lureau
6df1558523 worker: move dcc_add_drawable*
Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2015-11-24 08:56:33 +00:00
Marc-André Lureau
1549f751b8 worker: move dcc_handle_message
Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2015-11-24 08:55:59 +00:00
Marc-André Lureau
029b4beb73 worker: move dcc_add_surface_area_image
Author:    Marc-André Lureau <marcandre.lureau@gmail.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2015-11-23 13:50:44 +00:00
Pavel Grunt
2c2e26579f dcc: Fix unused display_channel variable
Avoid problem when compiling with lz4 and without COMPRESS_STAT

dcc.c: In function 'dcc_compress_image_lz4':
dcc.c:657:21: error: unused variable 'display_channel' [-Werror=unused-variable]
     DisplayChannel *display_channel = DCC_TO_DC(dcc);

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2015-11-20 11:26:12 +00:00
Marc-André Lureau
8ef5be6cd9 worker: move dcc_pixmap_cache_add
Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2015-11-20 10:20:38 +00:00
Frediano Ziglio
422d67dde4 worker: move compress to dcc_compress_image()
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-11-20 09:49:49 +00:00
Marc-André Lureau
0e224d04fb worker: move dcc_start()
Author:    Marc-André Lureau <marcandre.lureau@gmail.com>
Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2015-11-19 12:43:33 +00:00
Marc-André Lureau
85920bb2e9 worker: start a DisplayChannelClient unit
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-19 12:43:02 +00:00