[Spice-devel] [spice-server 3/3] dcc: Add debug log when setting compression

Christophe Fergeau cfergeau at redhat.com
Fri Oct 5 07:56:04 UTC 2018


On Thu, Oct 04, 2018 at 01:46:21PM -0400, Frediano Ziglio wrote:
> > diff --git a/server/utils.h b/server/utils.h
> > index 5cb0eb0ee..52b7f5b3e 100644
> > --- a/server/utils.h
> > +++ b/server/utils.h
> > @@ -21,6 +21,7 @@
> >  
> >  #include <stdint.h>
> >  #include <glib.h>
> > +#include <glib-object.h>
> >  
> >  #define SPICE_GNUC_VISIBLE __attribute__ ((visibility ("default")))
> >  
> > @@ -55,5 +56,7 @@ int rgb32_data_has_alpha(int width, int height, size_t
> > stride,
> >  
> >  const char *red_channel_type_to_str(int type);
> >  int red_channel_name_to_type(const char *name);
> > +int spice_util_genum_get_value(GType enum_type, const char *nick, gint
> > default_value);
> > +const char *spice_util_genum_get_nick(GType enum_type, gint value);
> >  
> >  #endif /* UTILS_H_ */
> 
> If you follow the same role of 1/3 these new functions should be
> in dcc.c.

Haha that's a fair point :) In this case, this is a (generic) helper I
hope we'll use in more places.

> I don't understand why you need to have this in the log.
> Are you writing a test?

It's related to https://bugzilla.redhat.com/show_bug.cgi?id=1460191
where it was not clear which type of compression was being used when the
client is used with --spice-preferred-compression

> Would %d format not be enough? Would save 46 lines. Also
> would support cases where the enumeration is not in the list.

From that bug (but client side):
(virt-viewer:10238): GSpice-DEBUG: channel-display.c:526 display-2:0:
changing preferred compression to 7

Isn't it better to show 'lz4' rather than 7? :) A similar thing was done
for 'display' actually, it shows the channel name rather than just '2'
(or whatever int value it has).

So yes, this adds more lines, but imo it's worth it, it's a one time
cost to get human readable enum names in more places.

Christophe

> 
> Frediano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20181005/53c502f8/attachment-0001.sig>


More information about the Spice-devel mailing list