Re: [Spice-devel] oVirt support in aSPICE stalled due to broken network file I/O
Hey Iordan, On Mon, Sep 09, 2013 at 03:08:58PM -0400, i iordanov wrote: > I've been looking at adding oVirt support to aSPICE, and at the moment I'm > completely stuck because of some glib functionality not working on Android. > The library govirt uses glib's convenient support for network file I/O (for > fetching certificates, VMs, etc.), but because of gio's reliance on gvfsd, > network file I/O does not operate on Android. > > I've reported the bug to GNOME here: > https://bugzilla.gnome.org/show_bug.cgi?id=707796 > > but this will take a very long time to be fixed if it gets fixed at all. > > In the meanwhile, (Christophe), do you think it's feasible to work around > this issue by augmenting govirt with some alternate methods of reading > files from the oVirt proxy (i.e. outside glib, download the file to a > temporary location and open it as a local file, etc.)? To get the oVirt CA certificate, you don't have to use the ovirt_proxy_fetch_ca_certificate* functions, you can fetch it from your application using the API that is more convenient to you and then set the OvirtProxy::ca-cert property. This property is a GByteArray. Regarding the rest of the interaction with oVirt, this is done through the REST API using librest/libsoup, I'm not sure they need gvfsd to work as expected. Hope that helps, Christophe pgpKHAQZkvWB2.pgp Description: PGP signature ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel
Re: [Spice-devel] [PATCH common 1/3] quic: compile with constant bpp, to help compiler
A more detailed commit log would be nice here as well to detail what you mean by 'help compiler' Thanks, Christophe On Sun, Sep 08, 2013 at 09:07:48PM +0200, Marc-André Lureau wrote: > From: Marc-André Lureau > > --- > common/quic_family_tmpl.c | 4 ++-- > common/quic_rgb_tmpl.c| 6 +++--- > common/quic_tmpl.c| 16 > 3 files changed, 13 insertions(+), 13 deletions(-) > > diff --git a/common/quic_family_tmpl.c b/common/quic_family_tmpl.c > index cca2c05..287ff6d 100644 > --- a/common/quic_family_tmpl.c > +++ b/common/quic_family_tmpl.c > @@ -74,13 +74,13 @@ static unsigned int FNAME(golomb_decoding)(const unsigned > int l, const unsigned > > /* update the bucket using just encoded curval */ > static void FNAME(update_model)(CommonState *state, s_bucket * const bucket, > -const BYTE curval, unsigned int bpp) > +const BYTE curval) > { > +const unsigned int bpp = BPC; > COUNTER * const pcounters = bucket->pcounters; > unsigned int i; > unsigned int bestcode; > unsigned int bestcodelen; > -//unsigned int bpp = encoder->bpp; > > /* update counters, find minimum */ > > diff --git a/common/quic_rgb_tmpl.c b/common/quic_rgb_tmpl.c > index 37c908c..19cc348 100644 > --- a/common/quic_rgb_tmpl.c > +++ b/common/quic_rgb_tmpl.c > @@ -178,11 +178,11 @@ > > #define UPDATE_MODEL(index) >\ > update_model(&encoder->rgb_state, find_bucket(channel_r, > correlate_row_r[index - 1]), \ > -correlate_row_r[index], bpc); >\ > +correlate_row_r[index]); > \ > update_model(&encoder->rgb_state, find_bucket(channel_g, > correlate_row_g[index - 1]), \ > -correlate_row_g[index], bpc); >\ > +correlate_row_g[index]); > \ > update_model(&encoder->rgb_state, find_bucket(channel_b, > correlate_row_b[index - 1]), \ > -correlate_row_b[index], bpc); > +correlate_row_b[index]); > > > #ifdef RLE_PRED_1 > diff --git a/common/quic_tmpl.c b/common/quic_tmpl.c > index b625daf..75f2ff0 100644 > --- a/common/quic_tmpl.c > +++ b/common/quic_tmpl.c > @@ -173,7 +173,7 @@ static void FNAME(compress_row0_seg)(Encoder *encoder, > Channel *channel, int i, > } else { > channel->state.waitcnt = (tabrand(&channel->state.tabrand_seed) > & waitmask); > update_model(&channel->state, find_bucket(channel, > decorelate_drow[-1]), > - decorelate_drow[i], bpc); > + decorelate_drow[i]); > } > stopidx = ++i + channel->state.waitcnt; > } else { > @@ -191,7 +191,7 @@ static void FNAME(compress_row0_seg)(Encoder *encoder, > Channel *channel, int i, > } > > update_model(&channel->state, find_bucket(channel, > decorelate_drow[stopidx - 1]), > - decorelate_drow[stopidx], bpc); > + decorelate_drow[stopidx]); > stopidx = i + (tabrand(&channel->state.tabrand_seed) & waitmask); > } > > @@ -272,7 +272,7 @@ static void FNAME(compress_row_seg)(Encoder *encoder, > Channel *channel, int i, > } else { > channel->state.waitcnt = (tabrand(&channel->state.tabrand_seed) > & waitmask); > update_model(&channel->state, find_bucket(channel, > decorelate_drow[-1]), > - decorelate_drow[0], bpc); > + decorelate_drow[0]); > } > stopidx = ++i + channel->state.waitcnt; > } else { > @@ -295,7 +295,7 @@ static void FNAME(compress_row_seg)(Encoder *encoder, > Channel *channel, int i, > } > > update_model(&channel->state, find_bucket(channel, > decorelate_drow[stopidx - 1]), > - decorelate_drow[stopidx], bpc); > + decorelate_drow[stopidx]); > stopidx = i + (tabrand(&channel->state.tabrand_seed) & waitmask); > } > > @@ -406,7 +406,7 @@ static void FNAME(uncompress_row0_seg)(Encoder *encoder, > Channel *channel, int i > } else { > channel->state.waitcnt = (tabrand(&channel->state.tabrand_seed) > & waitmask); > update_model(&channel->state, find_bucket(channel, > correlate_row[-1]), > - correlate_row[0], bpc); > + correlate_row[0]); > } > stopidx = ++i + channel->state.waitcnt; > } else { > @@ -426,7 +426,7 @@ static void FNAME(uncompress_row0_seg)(Encoder *encoder, > Channel *channel, int i > decode_eatbits(encoder, codewordlen); > } > > -update_model(&channel->
Re: [Spice-devel] [PATCH common 2/3] quic: precompile golomb codes
A more detailed commit log would be nice (why do we want to do that?). I assume by 'precompile' you really mean 'precompute' ? Christophe On Sun, Sep 08, 2013 at 09:07:49PM +0200, Marc-André Lureau wrote: > From: Marc-André Lureau > > --- > common/quic.c | 25 - > common/quic_family_tmpl.c | 22 +- > 2 files changed, 33 insertions(+), 14 deletions(-) > > diff --git a/common/quic.c b/common/quic.c > index 3e7c802..c9c3624 100644 > --- a/common/quic.c > +++ b/common/quic.c > @@ -75,6 +75,9 @@ typedef struct QuicFamily { > unsigned int notGRsuffixlen[MAXNUMCODES];/* indexed by code number, > contains suffix > length of the not-GR > codeword */ > > +unsigned int golomb_code_len[256][MAXNUMCODES]; > +unsigned int golomb_code[256][MAXNUMCODES]; > + > /* array for translating distribution U to L for depths up to 8 bpp, > initialized by decorelateinit() */ > BYTE xlatU2L[256]; > @@ -360,9 +363,22 @@ static void corelate_init(QuicFamily *family, int bpc) > } > } > > +static void golomb_coding_slow(QuicFamily *family, const BYTE n, const > unsigned int l, > + unsigned int * const codeword, > + unsigned int * const codewordlen) > +{ > +if (n < family->nGRcodewords[l]) { > +(*codeword) = bitat[l] | (n & bppmask[l]); > +(*codewordlen) = (n >> l) + l + 1; > +} else { > +(*codeword) = n - family->nGRcodewords[l]; > +(*codewordlen) = family->notGRcwlen[l]; > +} > +} > + > static void family_init(QuicFamily *family, int bpc, int limit) > { > -int l; > +int l, b; > > for (l = 0; l < bpc; l++) { /* fill arrays indexed by code number */ > int altprefixlen, altcodewords; > @@ -378,6 +394,13 @@ static void family_init(QuicFamily *family, int bpc, int > limit) > family->notGRcwlen[l] = altprefixlen + ceil_log_2(altcodewords); > family->notGRprefixmask[l] = bppmask[32 - altprefixlen]; /* needed > for decoding only */ > family->notGRsuffixlen[l] = ceil_log_2(altcodewords); /* needed for > decoding only */ > + > +for (b = 0; b < 256; b++) { > +unsigned int code, len; > +golomb_coding_slow(family, b, l, &code, &len); > +family->golomb_code[b][l] = code; > +family->golomb_code_len[b][l] = len; > +} > } > > decorelate_init(family, bpc); > diff --git a/common/quic_family_tmpl.c b/common/quic_family_tmpl.c > index 287ff6d..12ef62f 100644 > --- a/common/quic_family_tmpl.c > +++ b/common/quic_family_tmpl.c > @@ -34,26 +34,21 @@ > #define BPC 5 > #endif > > +static inline unsigned int FNAME(golomb_code)(const BYTE n, const unsigned > int l) > +{ > +return VNAME(family).golomb_code[n][l]; > +} > > -static unsigned int FNAME(golomb_code_len)(const BYTE n, const unsigned int > l) > +static inline unsigned int FNAME(golomb_code_len)(const BYTE n, const > unsigned int l) > { > -if (n < VNAME(family).nGRcodewords[l]) { > -return (n >> l) + 1 + l; > -} else { > -return VNAME(family).notGRcwlen[l]; > -} > +return VNAME(family).golomb_code_len[n][l]; > } > > static void FNAME(golomb_coding)(const BYTE n, const unsigned int l, > unsigned int * const codeword, > unsigned int * const codewordlen) > { > -if (n < VNAME(family).nGRcodewords[l]) { > -(*codeword) = bitat[l] | (n & bppmask[l]); > -(*codewordlen) = (n >> l) + l + 1; > -} else { > -(*codeword) = n - VNAME(family).nGRcodewords[l]; > -(*codewordlen) = VNAME(family).notGRcwlen[l]; > -} > +*codeword = FNAME(golomb_code)(n, l); > +*codewordlen = FNAME(golomb_code_len)(n, l); > } > > static unsigned int FNAME(golomb_decoding)(const unsigned int l, const > unsigned int bits, > @@ -76,6 +71,7 @@ static unsigned int FNAME(golomb_decoding)(const unsigned > int l, const unsigned > static void FNAME(update_model)(CommonState *state, s_bucket * const bucket, > const BYTE curval) > { > +spice_static_assert(BPC >= 1); > const unsigned int bpp = BPC; > COUNTER * const pcounters = bucket->pcounters; > unsigned int i; > -- > 1.8.3.1 > > ___ > Spice-devel mailing list > Spice-devel@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/spice-devel pgpW682QmseFy.pgp Description: PGP signature ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel
Re: [Spice-devel] [PATCH spice-gtk 09/10] gtk: use slices for frequently allocated objects
On Sun, Sep 08, 2013 at 08:59:32PM +0200, Marc-André Lureau wrote: > From: Marc-André Lureau > > --- > gtk/channel-display.c | 4 ++-- > gtk/spice-channel.c | 8 > spice-common | 2 +- > 3 files changed, 7 insertions(+), 7 deletions(-) > > diff --git a/gtk/channel-display.c b/gtk/channel-display.c > index a69f14f..8629eee 100644 > --- a/gtk/channel-display.c > +++ b/gtk/channel-display.c > @@ -657,7 +657,7 @@ static void destroy_surface(gpointer data) > display_surface *surface = data; > > destroy_canvas(surface); > -free(surface); > +g_slice_free(display_surface, surface); > } > > static void spice_display_channel_init(SpiceDisplayChannel *channel) > @@ -1687,7 +1687,7 @@ static void display_handle_surface_create(SpiceChannel > *channel, SpiceMsgIn *in) > { > SpiceDisplayChannelPrivate *c = SPICE_DISPLAY_CHANNEL(channel)->priv; > SpiceMsgSurfaceCreate *create = spice_msg_in_parsed(in); > -display_surface *surface = spice_new0(display_surface, 1); > +display_surface *surface = g_slice_new0(display_surface); > > surface->surface_id = create->surface_id; > surface->format = create->format; > diff --git a/gtk/spice-channel.c b/gtk/spice-channel.c > index 9fb3b0c..4b80029 100644 > --- a/gtk/spice-channel.c > +++ b/gtk/spice-channel.c > @@ -462,7 +462,7 @@ SpiceMsgIn *spice_msg_in_new(SpiceChannel *channel) > > g_return_val_if_fail(channel != NULL, NULL); > > -in = spice_new0(SpiceMsgIn, 1); > +in = g_slice_new0(SpiceMsgIn); > in->refcount = 1; > in->channel = channel; > > @@ -510,7 +510,7 @@ void spice_msg_in_unref(SpiceMsgIn *in) > } else { > free(in->data); > } > -free(in); > +g_slice_free(SpiceMsgIn, in); > } > > G_GNUC_INTERNAL > @@ -615,7 +615,7 @@ SpiceMsgOut *spice_msg_out_new(SpiceChannel *channel, int > type) > > g_return_val_if_fail(c != NULL, NULL); > > -out = spice_new0(SpiceMsgOut, 1); > +out = g_slice_new0(SpiceMsgOut); > out->refcount = 1; > out->channel = channel; > out->ro_check = msg_check_read_only(c->channel_type, type); > @@ -651,7 +651,7 @@ void spice_msg_out_unref(SpiceMsgOut *out) > if (out->refcount > 0) > return; > spice_marshaller_destroy(out->marshaller); > -free(out); > +g_slice_free(SpiceMsgOut, out); > } > > /* system context */ > diff --git a/spice-common b/spice-common > index 7aef065..ab6fb3c 16 > --- a/spice-common > +++ b/spice-common > @@ -1 +1 @@ > -Subproject commit 7aef06577e47965bbe93e0a054857a562d2fde5a > +Subproject commit ab6fb3c176b090cffedeb53d9b03f8399bd51ace Does this submodule update belong to this commit? Christophe pgp2gm_7V6PHf.pgp Description: PGP signature ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel
Re: [Spice-devel] [PATCH spice-gtk 03/10] display: replace ring with hashtable
On Mon, Sep 09, 2013 at 11:04:51AM +0300, Uri Lublin wrote: > On 09/09/2013 10:58 AM, Uri Lublin wrote: > >Hi Marc-Andre, > > > >See my comment below. > > > >On 09/08/2013 09:59 PM, Marc-André Lureau wrote: > >>diff --git a/gtk/channel-display.c b/gtk/channel-display.c > >>index eab1742..7a66558 100644 > >>--- a/gtk/channel-display.c > >>+++ b/gtk/channel-display.c > >> > >>@@ -705,7 +706,7 @@ static void > >>spice_display_channel_init(SpiceDisplayChannel *channel) > >>c = channel->priv = SPICE_DISPLAY_CHANNEL_GET_PRIVATE(channel); > >> -ring_init(&c->surfaces); > >>+c->surfaces = g_hash_table_new(NULL, NULL); > >> c->image_cache.ops = &image_cache_ops; > >> c->palette_cache.ops = &palette_cache_ops; > >> c->image_surfaces.ops = &image_surfaces_ops; > >>@@ -740,7 +741,8 @@ static int create_canvas(SpiceChannel > >>*channel, display_surface *surface) > >> } > >>emit_main_context(channel, > >>SPICE_DISPLAY_PRIMARY_DESTROY); > >>-ring_remove(&primary->link); > >>+ > >>+g_hash_table_remove(c->surfaces, 0); > > > >Use primary->surface_id (instead of 0) as key: > >g_hash_table_remove(c->surfaces, GINT_TO_POINTER(primary->surface_id)) > > > > I see you are doing it in a following patch, so disregard. For what it's worth, I'd have a slight preference for using GINT_TO_POINTER(0) rather than 0 here. Christophe pgpgEVLp1LghI.pgp Description: PGP signature ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel
Re: [Spice-devel] [PATCH xf86-video-qxl] fix a bunch of warnings - unused variables, lables, code
s/lables/labels in the subject, looks good otherwise, ack. Christophe On Sun, Sep 08, 2013 at 02:54:21PM +0300, Alon Levy wrote: > Signed-off-by: Alon Levy > --- > src/qxl_kms.c | 27 --- > src/qxl_surface.c | 7 +-- > 2 files changed, 1 insertion(+), 33 deletions(-) > > diff --git a/src/qxl_kms.c b/src/qxl_kms.c > index b091a12..32859cc 100644 > --- a/src/qxl_kms.c > +++ b/src/qxl_kms.c > @@ -83,7 +83,6 @@ static Bool qxl_open_drm_master(ScrnInfoPtr pScrn) > return FALSE; > } > > - out: > qxl->drmmode.fd = qxl->drm_fd; > return TRUE; > } > @@ -181,7 +180,6 @@ qxl_create_screen_resources_kms(ScreenPtr pScreen) > Bool ret; > PixmapPtr pPixmap; > qxl_surface_t *surf; > -inti; > > pScreen->CreateScreenResources = qxl->create_screen_resources; > ret = pScreen->CreateScreenResources (pScreen); > @@ -257,7 +255,6 @@ Bool qxl_screen_init_kms(SCREEN_INIT_ARGS_DECL) > ScrnInfoPtrpScrn = xf86ScreenToScrn (pScreen); > qxl_screen_t * qxl = pScrn->driverPrivate; > VisualPtr visual; > -uint64_t n_surf; > > miClearVisualTypes (); > if (!miSetVisualTypes (pScrn->depth, miGetDefaultVisualMask > (pScrn->depth), > @@ -369,7 +366,6 @@ static struct qxl_bo *qxl_bo_alloc(qxl_screen_t *qxl, > return NULL; // an invalid handle > } > > - out: > bo->name = name; > bo->size = size; > bo->type = QXL_BO_DATA; > @@ -383,8 +379,6 @@ static struct qxl_bo *qxl_cmd_alloc(qxl_screen_t *qxl, > unsigned long size, const char *name) > { > struct qxl_kms_bo *bo; > -struct drm_qxl_alloc alloc; > -int ret; > > bo = calloc(1, sizeof(struct qxl_kms_bo)); > if (!bo) > @@ -500,27 +494,6 @@ static void qxl_bo_output_bo_reloc(qxl_screen_t *qxl, > uint32_t dst_offset, > qxl->cmds.n_relocs++; > } > > -static void qxl_bo_output_cmd_reloc(qxl_screen_t *qxl, QXLCommand *command, > - struct qxl_bo *_src_bo) > -{ > -struct qxl_kms_bo *src_bo = (struct qxl_kms_bo *)_src_bo; > -struct drm_qxl_reloc *r = &qxl->cmds.relocs[qxl->cmds.n_relocs]; > - > -if (qxl->cmds.n_reloc_bos >= MAX_RELOCS || qxl->cmds.n_relocs >= > MAX_RELOCS) > - assert(0); > - > -qxl->cmds.reloc_bo[qxl->cmds.n_reloc_bos] = _src_bo; > -qxl->cmds.n_reloc_bos++; > -src_bo->refcnt++; > -/* fix the kernel names */ > -r->reloc_type = QXL_RELOC_TYPE_BO; > -r->dst_handle = 0; > -r->src_handle = src_bo->handle; > -r->dst_offset = 0; > -r->src_offset = 0; > -qxl->cmds.n_relocs++; > -} > - > static void qxl_bo_write_command(qxl_screen_t *qxl, uint32_t cmd_type, > struct qxl_bo *_bo) > { > struct qxl_kms_bo *bo = (struct qxl_kms_bo *)_bo; > diff --git a/src/qxl_surface.c b/src/qxl_surface.c > index 5e6737a..685d09f 100644 > --- a/src/qxl_surface.c > +++ b/src/qxl_surface.c > @@ -471,10 +471,8 @@ image_from_surface_internal(qxl_screen_t *qxl, > return image_bo; > } > > -struct qxl_bo *image_from_surface(qxl_screen_t *qxl, qxl_surface_t *dest) > +static struct qxl_bo *image_from_surface(qxl_screen_t *qxl, qxl_surface_t > *dest) > { > -struct QXLImage *image_bo; > - > if (!dest->image_bo) >dest->image_bo = image_from_surface_internal(qxl, dest); > > @@ -520,7 +518,6 @@ qxl_surface_copy (qxl_surface_t *dest, > else > { > struct qxl_bo *image_bo; > - struct QXLImage *image; > > dest->u.copy_src->ref_count++; > > @@ -590,8 +587,6 @@ image_from_picture (qxl_screen_t *qxl, > qxl_surface_t *surface, > int *force_opaque) > { > -struct qxl_bo *image_bo; > - > if (picture->format == PICT_x8r8g8b8) > *force_opaque = TRUE; > else > -- > 1.8.3.1 > > ___ > Spice-devel mailing list > Spice-devel@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/spice-devel pgpZITuF23o56.pgp Description: PGP signature ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel
Re: [Spice-devel] [PATCH spice-gtk] Fix _FORTIFY_SOURCE redefine error
On Sun, Sep 08, 2013 at 04:55:25PM +0300, Uri Lublin wrote: > On 09/06/2013 10:59 PM, Dunrong Huang wrote: > >If the _FORTIFY_SOURCE has been already defined, we shouldn't redefine > >it, or it will raise a build error as below: > > > >In file included from spice-audio.c:36:0: > >../config.h:12:0: error: "_FORTIFY_SOURCE" redefined [-Werror] > >spice-audio.c:1:0: note: this is the location of the previous definition > > > >Suggested-by: Christophe Fergeau > >Signed-off-by: Dunrong Huang > >--- > > m4/spice-compile-warnings.m4 | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > >diff --git a/m4/spice-compile-warnings.m4 b/m4/spice-compile-warnings.m4 > >index 31fc0fc..533bac6 100644 > >--- a/m4/spice-compile-warnings.m4 > >+++ b/m4/spice-compile-warnings.m4 > >@@ -104,7 +104,7 @@ AC_DEFUN([SPICE_COMPILE_WARNINGS],[ > > # Use improved glibc headers > > AH_VERBATIM([FORTIFY_SOURCE], > > [/* Enable compile-time and run-time bounds-checking, and some > > warnings. */ > >- #if defined __OPTIMIZE__ && __OPTIMIZE__ > >+ #if !defined _FORTIFY_SOURCE && defined __OPTIMIZE__ && __OPTIMIZE__ > > # define _FORTIFY_SOURCE 2 > > #endif > > ]) > > Ack. Pushed that one as well Christophe pgpzWviwSpdOt.pgp Description: PGP signature ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel
Re: [Spice-devel] [PATCH spice-server] Fix _FORTIFY_SOURCE redefine error
On Sun, Sep 08, 2013 at 04:54:56PM +0300, Uri Lublin wrote: > On 09/06/2013 10:57 PM, Dunrong Huang wrote: > >If the _FORTIFY_SOURCE has been already defined, we shouldn't redefine > >it, or it will raise a build error as below: > > > >In file included from agent-msg-filter.c:21:0: > >../config.h:17:0: error: "_FORTIFY_SOURCE" redefined [-Werror] > >agent-msg-filter.c:1:0: note: this is the location of the previous definition > > > >Suggested-by: Christophe Fergeau > >Signed-off-by: Dunrong Huang > >--- > > m4/spice-compile-warnings.m4 | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > >diff --git a/m4/spice-compile-warnings.m4 b/m4/spice-compile-warnings.m4 > >index 959971a..31f2a9c 100644 > >--- a/m4/spice-compile-warnings.m4 > >+++ b/m4/spice-compile-warnings.m4 > >@@ -113,7 +113,7 @@ AC_DEFUN([SPICE_COMPILE_WARNINGS],[ > > # Use improved glibc headers > > AH_VERBATIM([FORTIFY_SOURCE], > > [/* Enable compile-time and run-time bounds-checking, and some > > warnings. */ > >-#if __OPTIMIZE__ > >+#if !defined _FORTIFY_SOURCE && defined __OPTIMIZE__ && __OPTIMIZE__ > > # define _FORTIFY_SOURCE 2 > > #endif > > ]) > > Ack. I've pushed it now, I was not sure whether you had push access Dunron. Christophe pgp5_nIHShWSM.pgp Description: PGP signature ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel
[Spice-devel] [spice-gtk] implement new keyval protocol
Signed-off-by: Dietmar Maurer --- gtk/channel-inputs.c| 33 - gtk/channel-inputs.h|6 +++--- gtk/spice-widget-priv.h |1 + gtk/spice-widget.c | 24 ++-- 4 files changed, 46 insertions(+), 18 deletions(-) diff --git a/gtk/channel-inputs.c b/gtk/channel-inputs.c index ee86dc2..ce9173a 100644 --- a/gtk/channel-inputs.c +++ b/gtk/channel-inputs.c @@ -464,6 +464,23 @@ void spice_inputs_button_release(SpiceInputsChannel *channel, gint button, spice_msg_out_send(msg); } +static void spice_inputs_key_keyval(SpiceInputsChannel *channel, guint keyval, int flags) +{ +g_return_if_fail(channel != NULL); + +if (spice_channel_test_capability(SPICE_CHANNEL(channel), SPICE_INPUTS_CAP_KEY_KEYVAL)) { +SpiceMsgcKeyKeyval keyval_msg; +SpiceMsgOut *msg; + +keyval_msg.keyval = keyval; +keyval_msg.flags = flags; + +msg = spice_msg_out_new(SPICE_CHANNEL(channel), SPICE_MSGC_INPUTS_KEY_KEYVAL); +msg->marshallers->msgc_inputs_key_keyval(msg->marshaller, &keyval_msg); +spice_msg_out_send(msg); +} +} + /** * spice_inputs_key_press: * @channel: @@ -471,7 +488,7 @@ void spice_inputs_button_release(SpiceInputsChannel *channel, gint button, * * Press a key. **/ -void spice_inputs_key_press(SpiceInputsChannel *channel, guint scancode) +void spice_inputs_key_press(SpiceInputsChannel *channel, guint scancode, guint keyval) { SpiceMsgcKeyDown down; SpiceMsgOut *msg; @@ -487,6 +504,8 @@ void spice_inputs_key_press(SpiceInputsChannel *channel, guint scancode) msg = spice_msg_out_new(SPICE_CHANNEL(channel), SPICE_MSGC_INPUTS_KEY_DOWN); msg->marshallers->msgc_inputs_key_down(msg->marshaller, &down); spice_msg_out_send(msg); + +spice_inputs_key_keyval(channel, keyval, 1); } /** @@ -496,7 +515,7 @@ void spice_inputs_key_press(SpiceInputsChannel *channel, guint scancode) * * Release a key. **/ -void spice_inputs_key_release(SpiceInputsChannel *channel, guint scancode) +void spice_inputs_key_release(SpiceInputsChannel *channel, guint scancode, guint keyval) { SpiceMsgcKeyUp up; SpiceMsgOut *msg; @@ -512,6 +531,8 @@ void spice_inputs_key_release(SpiceInputsChannel *channel, guint scancode) msg = spice_msg_out_new(SPICE_CHANNEL(channel), SPICE_MSGC_INPUTS_KEY_UP); msg->marshallers->msgc_inputs_key_up(msg->marshaller, &up); spice_msg_out_send(msg); + +spice_inputs_key_keyval(channel, keyval, 2); } /** @@ -523,7 +544,7 @@ void spice_inputs_key_release(SpiceInputsChannel *channel, guint scancode) * * Since: 0.13 **/ -void spice_inputs_key_press_and_release(SpiceInputsChannel *input_channel, guint scancode) +void spice_inputs_key_press_and_release(SpiceInputsChannel *input_channel, guint scancode, guint keyval) { SpiceChannel *channel = SPICE_CHANNEL(input_channel); @@ -555,11 +576,13 @@ void spice_inputs_key_press_and_release(SpiceInputsChannel *input_channel, guint buf[3] = code >> 8; } spice_msg_out_send(msg); +spice_inputs_key_keyval(input_channel, keyval, 3); } else { CHANNEL_DEBUG(channel, "The server doesn't support atomic press and release"); -spice_inputs_key_press(input_channel, scancode); -spice_inputs_key_release(input_channel, scancode); +spice_inputs_key_press(input_channel, scancode, keyval); +spice_inputs_key_release(input_channel, scancode, keyval); } + } /* main or coroutine context */ diff --git a/gtk/channel-inputs.h b/gtk/channel-inputs.h index 3179a76..1a6bbc1 100644 --- a/gtk/channel-inputs.h +++ b/gtk/channel-inputs.h @@ -79,10 +79,10 @@ void spice_inputs_button_press(SpiceInputsChannel *channel, gint button, gint button_state); void spice_inputs_button_release(SpiceInputsChannel *channel, gint button, gint button_state); -void spice_inputs_key_press(SpiceInputsChannel *channel, guint scancode); -void spice_inputs_key_release(SpiceInputsChannel *channel, guint scancode); +void spice_inputs_key_press(SpiceInputsChannel *channel, guint scancode, guint keyval); +void spice_inputs_key_release(SpiceInputsChannel *channel, guint scancode, guint keyval); void spice_inputs_set_key_locks(SpiceInputsChannel *channel, guint locks); -void spice_inputs_key_press_and_release(SpiceInputsChannel *channel, guint scancode); +void spice_inputs_key_press_and_release(SpiceInputsChannel *channel, guint scancode, guint keyval); G_END_DECLS diff --git a/gtk/spice-widget-priv.h b/gtk/spice-widget-priv.h index 597ce10..6eb1c11 100644 --- a/gtk/spice-widget-priv.h +++ b/gtk/spice-widget-priv.h @@ -108,6 +108,7 @@ struct _SpiceDisplayPrivate { size_t keycode_maplen; uint32_tkey_state[512 / 32]; int key_delayed_scancode; +uint32_tkey_dela
Re: [Spice-devel] [PATCH spice-gtk 10/10] gtk: simplify spice_channel_recv_msg
Looks good. see comment bellow. On 09/08/2013 02:59 PM, Marc-André Lureau wrote: From: Marc-André Lureau Use of coroutines allow to simplify spice_channel_recv_msg(), it doesn't need to keep current reading state, it can rely on the coroutine stack for that. --- gtk/channel-base.c | 1 + gtk/spice-channel-priv.h | 3 +-- gtk/spice-channel.c | 50 +++- 3 files changed, 17 insertions(+), 37 deletions(-) diff --git a/gtk/channel-base.c b/gtk/channel-base.c index dff3024..6bfce3d 100644 --- a/gtk/channel-base.c +++ b/gtk/channel-base.c @@ -187,5 +187,6 @@ void spice_channel_handle_migrate(SpiceChannel *channel, SpiceMsgIn *in) spice_marshaller_add(out->marshaller, data->data, spice_header_get_msg_size(data->header, c->use_mini_header)); spice_msg_out_send_internal(out); +/* FIXME: who unref in? */ Nice catch. Can't the migrate_data msg be unref-ed here? after spice_msg_out_send_internal completes sending it to the dest, nobody uses it. } } diff --git a/gtk/spice-channel-priv.h b/gtk/spice-channel-priv.h index 9e70ff2..53830a8 100644 --- a/gtk/spice-channel-priv.h +++ b/gtk/spice-channel-priv.h @@ -59,7 +59,7 @@ struct _SpiceMsgIn { SpiceChannel *channel; uint8_t header[MAX_SPICE_DATA_HEADER_SIZE]; uint8_t *data; -int hpos,dpos; +int dpos; uint8_t *parsed; size_tpsize; message_destructor_t pfree; @@ -122,7 +122,6 @@ struct _SpiceChannelPrivate { SpiceLinkReply* peer_msg; int peer_pos; -SpiceMsgIn *msg_in; int message_ack_window; int message_ack_count; diff --git a/gtk/spice-channel.c b/gtk/spice-channel.c index 4b80029..00e544b 100644 --- a/gtk/spice-channel.c +++ b/gtk/spice-channel.c @@ -1770,43 +1770,26 @@ void spice_channel_recv_msg(SpiceChannel *channel, { SpiceChannelPrivate *c = channel->priv; SpiceMsgIn *in; -int header_size; int msg_size; int msg_type; int sub_list_offset = 0; -int rc; -if (!c->msg_in) { -c->msg_in = spice_msg_in_new(channel); -} -in = c->msg_in; -header_size = spice_header_get_header_size(c->use_mini_header); +in = spice_msg_in_new(channel); /* receive message */ -if (in->hpos < header_size) { -rc = spice_channel_read(channel, in->header + in->hpos, -header_size - in->hpos); -if (rc < 0) { -g_critical("recv hdr: %s", strerror(errno)); -return; -} -in->hpos += rc; -if (in->hpos < header_size) -return; -in->data = spice_malloc(spice_header_get_msg_size(in->header, c->use_mini_header)); -} +spice_channel_read(channel, in->header, + spice_header_get_header_size(c->use_mini_header)); +if (c->has_error) +goto end; + msg_size = spice_header_get_msg_size(in->header, c->use_mini_header); -if (in->dpos < msg_size) { -rc = spice_channel_read(channel, in->data + in->dpos, -msg_size - in->dpos); -if (rc < 0) { -g_critical("recv msg: %s", strerror(errno)); -return; -} -in->dpos += rc; -if (in->dpos < msg_size) -return; -} +/* FIXME: do not allow others to take ref on in, and use realloc here? + * this would avoid malloc/free on each message? + */ +in->data = spice_malloc(msg_size); +spice_channel_read(channel, in->data, msg_size); +if (c->has_error) +goto end; msg_type = spice_header_get_msg_type(in->header, c->use_mini_header); sub_list_offset = spice_header_get_msg_sub_list(in->header, c->use_mini_header); @@ -1829,7 +1812,7 @@ void spice_channel_recv_msg(SpiceChannel *channel, if (sub_in->parsed == NULL) { g_critical("failed to parse sub-message: %s type %d", c->name, spice_header_get_msg_type(sub_in->header, c->use_mini_header)); -return; +goto end; } msg_handler(channel, sub_in, data); spice_msg_in_unref(sub_in); @@ -1851,7 +1834,7 @@ void spice_channel_recv_msg(SpiceChannel *channel, } /* parse message */ -in->parsed = c->parser(in->data, in->data + in->dpos, msg_type, +in->parsed = c->parser(in->data, in->data + msg_size, msg_type, c->peer_hdr.minor_version, &in->psize, &in->pfree); if (in->parsed == NULL) { g_critical("failed to parse message: %s type %d", @@ -1860,7 +1843,6 @@ void spice_channel_recv_msg(SpiceChannel *channel, } /* process message */ -c->msg_in = NU
Re: [Spice-devel] [PATCH spice-gtk 05/10] display: keep a reference to the primary surface
ack On 09/08/2013 02:59 PM, Marc-André Lureau wrote: Avoid hard-coding surface 0 as being primary, although in practice it always is so far. Also a lot of lookups are primary, so add a shortcut for this special case (~30% apparently), it shows some small lookup speedup. before: real 0m5.008s user 0m3.253s sys 0m2.015s after: real0m4.930s user0m3.133s sys 0m2.027s --- gtk/channel-display.c | 28 +++- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/gtk/channel-display.c b/gtk/channel-display.c index 979ce7b..03ae535 100644 --- a/gtk/channel-display.c +++ b/gtk/channel-display.c @@ -67,6 +67,7 @@ struct _SpiceDisplayChannelPrivate { GHashTable *surfaces; +display_surface *primary; display_cache *images; display_cache *palettes; SpiceImageCache image_cache; @@ -180,13 +181,11 @@ static void spice_display_get_property(GObject*object, switch (prop_id) { case PROP_WIDTH: { -display_surface *surface = find_surface(c, 0); -g_value_set_uint(value, surface ? surface->width : 0); +g_value_set_uint(value, c->primary ? c->primary->width : 0); break; } case PROP_HEIGHT: { -display_surface *surface = find_surface(c, 0); -g_value_set_uint(value, surface ? surface->height : 0); +g_value_set_uint(value, c->primary ? c->primary->height : 0); break; } case PROP_MONITORS: { @@ -739,18 +738,16 @@ static int create_canvas(SpiceChannel *channel, display_surface *surface) SpiceDisplayChannelPrivate *c = SPICE_DISPLAY_CHANNEL(channel)->priv; if (surface->primary) { -display_surface *primary = find_surface(c, 0); - -if (primary) { -if (primary->width == surface->width && -primary->height == surface->height) { +if (c->primary) { +if (c->primary->width == surface->width && +c->primary->height == surface->height) { CHANNEL_DEBUG(channel, "Reusing existing primary surface"); return 0; } emit_main_context(channel, SPICE_DISPLAY_PRIMARY_DESTROY); -g_hash_table_remove(c->surfaces, 0); +g_hash_table_remove(c->surfaces, GINT_TO_POINTER(c->primary->surface_id)); } CHANNEL_DEBUG(channel, "Create primary canvas"); @@ -803,6 +800,8 @@ static int create_canvas(SpiceChannel *channel, display_surface *surface) g_hash_table_insert(c->surfaces, GINT_TO_POINTER(surface->surface_id), surface); if (surface->primary) { +g_warn_if_fail(c->primary == NULL); +c->primary = surface; emit_main_context(channel, SPICE_DISPLAY_PRIMARY_CREATE, surface->format, surface->width, surface->height, surface->stride, surface->shmid, surface->data); @@ -847,6 +846,9 @@ static void destroy_canvas(display_surface *surface) static display_surface *find_surface(SpiceDisplayChannelPrivate *c, guint32 surface_id) { +if (c->primary && c->primary->surface_id == surface_id) +return c->primary; + return g_hash_table_lookup(c->surfaces, GINT_TO_POINTER(surface_id)); } @@ -944,10 +946,9 @@ static void display_handle_mode(SpiceChannel *channel, SpiceMsgIn *in) static void display_handle_mark(SpiceChannel *channel, SpiceMsgIn *in) { SpiceDisplayChannelPrivate *c = SPICE_DISPLAY_CHANNEL(channel)->priv; -display_surface *surface = find_surface(c, 0); CHANNEL_DEBUG(channel, "%s", __FUNCTION__); -g_return_if_fail(surface != NULL); +g_return_if_fail(c->primary != NULL); #ifdef EXTRA_CHECKS g_warn_if_fail(c->mark == FALSE); #endif @@ -960,7 +961,7 @@ static void display_handle_mark(SpiceChannel *channel, SpiceMsgIn *in) static void display_handle_reset(SpiceChannel *channel, SpiceMsgIn *in) { SpiceDisplayChannelPrivate *c = SPICE_DISPLAY_CHANNEL(channel)->priv; -display_surface *surface = find_surface(c, 0); +display_surface *surface = c->primary; CHANNEL_DEBUG(channel, "%s: TODO detach_from_screen", __FUNCTION__); @@ -1784,6 +1785,7 @@ static void display_handle_surface_destroy(SpiceChannel *channel, SpiceMsgIn *in if (id != 0 && c->mark_false_event_id == 0) { c->mark_false_event_id = g_timeout_add_seconds(1, display_mark_false, channel); } +c->primary = NULL; emit_main_context(channel, SPICE_DISPLAY_PRIMARY_DESTROY); } ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel
Re: [Spice-devel] [PATCH spice-gtk 07/10] channel: do not reenter the mainloop at every iteration
Hi, I think that iterate_write & iterate_read should be symmetrical: in the same way iterate_write handles all outgoing messages, iterate_read should flush all incoming messages (i.e., the loop in spice_channel_iterate can be moved to iterate_read). But I'll ack it even if you don't change it :) Cheers, Yonit. On 09/08/2013 02:59 PM, Marc-André Lureau wrote: From: Marc-André Lureau The current coroutine channel_iterate() creates a GSource for the socket reenters the mainloop waiting for IO condition. This is really heavy usage of mainloop showing up in system time and user space profiling (10% of CPU time spent in mainloop overhead). Instead flush all pending input messages before switching context and reentering main loop. --- gtk/spice-channel.c | 35 +-- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/gtk/spice-channel.c b/gtk/spice-channel.c index 778a90b..9fb3b0c 100644 --- a/gtk/spice-channel.c +++ b/gtk/spice-channel.c @@ -2107,35 +2107,34 @@ static gboolean spice_channel_iterate(SpiceChannel *channel) SpiceChannelPrivate *c = channel->priv; GIOCondition ret; -do { -if (c->state == SPICE_CHANNEL_STATE_MIGRATING && -!g_coroutine_condition_wait(&c->coroutine, wait_migration, channel)) -CHANNEL_DEBUG(channel, "migration wait cancelled"); +if (c->state == SPICE_CHANNEL_STATE_MIGRATING && +!g_coroutine_condition_wait(&c->coroutine, wait_migration, channel)) +CHANNEL_DEBUG(channel, "migration wait cancelled"); -if (c->has_error) { -CHANNEL_DEBUG(channel, "channel has error, breaking loop"); -return FALSE; -} - -SPICE_CHANNEL_GET_CLASS(channel)->iterate_write(channel); +if (c->has_error) { +CHANNEL_DEBUG(channel, "channel has error, breaking loop"); +return FALSE; +} -ret = g_coroutine_socket_wait(&c->coroutine, c->sock, -c->state != SPICE_CHANNEL_STATE_MIGRATING ? G_IO_IN : 0); +/* flush any pending write */ +SPICE_CHANNEL_GET_CLASS(channel)->iterate_write(channel); +/* go back to main loop, wait for an event or incoming data */ +ret = g_coroutine_socket_wait(&c->coroutine, c->sock, G_IO_IN); -#ifdef WIN32 -/* FIXME: windows gsocket is buggy, it doesn't return correct condition... */ -ret = g_socket_condition_check(c->sock, G_IO_IN); -#endif -} while (ret == 0); /* ret == 0 means no IO condition, but woken up */ +/* treat all incoming data (block on message completion) */ +while (!c->has_error && (ret & G_IO_IN)) { +if (c->state == SPICE_CHANNEL_STATE_MIGRATING) +break; -if (ret & G_IO_IN) { do SPICE_CHANNEL_GET_CLASS(channel)->iterate_read(channel); #if HAVE_SASL +/* flush the sasl buffer too */ while (c->sasl_decoded != NULL); #else while (FALSE); #endif +ret = g_socket_condition_check(c->sock, G_IO_IN | G_IO_ERR | G_IO_HUP); } if (c->state > SPICE_CHANNEL_STATE_CONNECTING && ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel
Re: [Spice-devel] [PATCH spice-gtk 06/10] util: avoid calling getenv for every SPICE_DEBUG
ack On 09/08/2013 02:59 PM, Marc-André Lureau wrote: From: Marc-André Lureau That doesn't seem to really improve performance so much, but that' s what we should do probably. --- gtk/spice-util.c | 13 ++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/gtk/spice-util.c b/gtk/spice-util.c index e02fc4d..4372f28 100644 --- a/gtk/spice-util.c +++ b/gtk/spice-util.c @@ -39,7 +39,7 @@ * Various functions for debugging and informational purposes. */ -static gboolean debugFlag = FALSE; +static GOnce debug_once = G_ONCE_INIT; /** * spice_util_set_debug: @@ -61,12 +61,19 @@ void spice_util_set_debug(gboolean enabled) } } #endif -debugFlag = enabled; +debug_once.retval = GINT_TO_POINTER(enabled); +} + +static gpointer getenv_debug(gpointer data) +{ +return GINT_TO_POINTER(g_getenv("SPICE_DEBUG") != NULL); } gboolean spice_util_get_debug(void) { -return debugFlag || g_getenv("SPICE_DEBUG") != NULL; +g_once(&debug_once, getenv_debug, NULL); + +return GPOINTER_TO_INT(debug_once.retval); } /** ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel
Re: [Spice-devel] [PATCH spice-gtk 04/10] display: make the hashtable to destroy the surface
ack On 09/08/2013 02:59 PM, Marc-André Lureau wrote: Improve a bit the code by using hashtable ownership. --- gtk/channel-display.c | 16 +--- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/gtk/channel-display.c b/gtk/channel-display.c index 7a66558..979ce7b 100644 --- a/gtk/channel-display.c +++ b/gtk/channel-display.c @@ -700,13 +700,21 @@ static void spice_display_channel_reset_capabilities(SpiceChannel *channel) } } +static void destroy_surface(gpointer data) +{ +display_surface *surface = data; + +destroy_canvas(surface); +free(surface); +} + static void spice_display_channel_init(SpiceDisplayChannel *channel) { SpiceDisplayChannelPrivate *c; c = channel->priv = SPICE_DISPLAY_CHANNEL_GET_PRIVATE(channel); -c->surfaces = g_hash_table_new(NULL, NULL); +c->surfaces = g_hash_table_new_full(NULL, NULL, NULL, destroy_surface); c->image_cache.ops = &image_cache_ops; c->palette_cache.ops = &palette_cache_ops; c->image_surfaces.ops = &image_surfaces_ops; @@ -743,8 +751,6 @@ static int create_canvas(SpiceChannel *channel, display_surface *surface) emit_main_context(channel, SPICE_DISPLAY_PRIMARY_DESTROY); g_hash_table_remove(c->surfaces, 0); -destroy_canvas(primary); -free(primary); } CHANNEL_DEBUG(channel, "Create primary canvas"); @@ -859,8 +865,6 @@ static void clear_surfaces(SpiceChannel *channel, gboolean keep_primary) } g_hash_table_iter_remove(&iter); -destroy_canvas(surface); -free(surface); } } @@ -1784,8 +1788,6 @@ static void display_handle_surface_destroy(SpiceChannel *channel, SpiceMsgIn *in } g_hash_table_remove(c->surfaces, GINT_TO_POINTER(surface->surface_id)); -destroy_canvas(surface); -free(surface); } #define CLAMP_CHECK(x, low, high) (((x) > (high)) ? TRUE : (((x) < (low)) ? TRUE : FALSE)) ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel
Re: [Spice-devel] [PATCH spice-gtk 02/10] Add SPICE_DISABLE_CHANNELS
ack. Notice that basically handle_msg of all the channels does the same, expect it uses different msg handlers. It would have been cleaner to use one handle_msg routine, and different msg handlers. Then, instead of checking disable_channel_msg for each msg, we could just set the msg_handlers to NULL (except for the base types). You don't have to do it for this series. Your call. On 09/08/2013 02:59 PM, Marc-André Lureau wrote: Allow to disable selectively channels, mainly used for testing, ex: SPICE_DISABLE_CHANNELS=display spicy-stats -p 12345 --- gtk/channel-display.c| 4 ++-- gtk/spice-channel-priv.h | 2 ++ gtk/spice-channel.c | 14 -- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/gtk/channel-display.c b/gtk/channel-display.c index 704d5a7..eab1742 100644 --- a/gtk/channel-display.c +++ b/gtk/channel-display.c @@ -1889,9 +1889,9 @@ static void spice_display_handle_msg(SpiceChannel *channel, SpiceMsgIn *msg) parent_class = SPICE_CHANNEL_CLASS(spice_display_channel_parent_class); -if (display_handlers[type] != NULL) +if (display_handlers[type] != NULL) { display_handlers[type](channel, msg); -else if (parent_class->handle_msg) +} else if (parent_class->handle_msg) parent_class->handle_msg(channel, msg); else g_return_if_reached(); diff --git a/gtk/spice-channel-priv.h b/gtk/spice-channel-priv.h index be061c5..9e70ff2 100644 --- a/gtk/spice-channel-priv.h +++ b/gtk/spice-channel-priv.h @@ -134,6 +134,8 @@ struct _SpiceChannelPrivate { gsize total_read_bytes; uint64_tlast_message_serial; GSList *flushing; + +gbooleandisable_channel_msg; }; SpiceMsgIn *spice_msg_in_new(SpiceChannel *channel); diff --git a/gtk/spice-channel.c b/gtk/spice-channel.c index 093b292..778a90b 100644 --- a/gtk/spice-channel.c +++ b/gtk/spice-channel.c @@ -126,6 +126,10 @@ static void spice_channel_constructed(GObject *gobject) desc ? desc : "unknown", c->channel_type, c->channel_id); CHANNEL_DEBUG(channel, "%s", __FUNCTION__); +const char *disabled = g_getenv("SPICE_DISABLE_CHANNELS"); +if (disabled && strstr(disabled, desc)) +c->disable_channel_msg = TRUE; + c->connection_id = spice_session_get_connection_id(c->session); spice_session_channel_new(c->session, channel); @@ -2075,10 +2079,13 @@ static void spice_channel_iterate_write(SpiceChannel *channel) static void spice_channel_iterate_read(SpiceChannel *channel) { SpiceChannelPrivate *c = channel->priv; +handler_msg_in handler; + g_return_if_fail(c->state != SPICE_CHANNEL_STATE_MIGRATING); -spice_channel_recv_msg(channel, -(handler_msg_in)SPICE_CHANNEL_GET_CLASS(channel)->handle_msg, NULL); +handler = (handler_msg_in) (c->disable_channel_msg ? +spice_channel_handle_msg : SPICE_CHANNEL_GET_CLASS(channel)->handle_msg); +spice_channel_recv_msg(channel, handler, NULL); } static gboolean wait_migration(gpointer data) @@ -2777,6 +2784,9 @@ static void spice_channel_handle_msg(SpiceChannel *channel, SpiceMsgIn *msg) { int type = spice_msg_in_type(msg); +if (type > SPICE_N_ELEMENTS(base_handlers) && channel->priv->disable_channel_msg) +return; + g_return_if_fail(type < SPICE_N_ELEMENTS(base_handlers)); g_return_if_fail(base_handlers[type] != NULL); ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel
Re: [Spice-devel] [PATCH spice-gtk 01/10] display: use bitfields for surface flags
On 09/08/2013 02:59 PM, Marc-André Lureau wrote: Checking by value make the flag fields useless.Uunfortunately, when adding more flags, the server will have to ensure it can safely send it, by checking some of new client caps. Good catch. Can you also add a comment about this to spice-protcol SpiceSurfaceFlags, in case someone adds a flag that doesn't require new caps? (i.e., if one adds a flag, but it is not mandatory that the client will handle it, however, an old client, wouldn't identify SPICE_SURFACE_FLAGS_PRIMARY). --- gtk/channel-display.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gtk/channel-display.c b/gtk/channel-display.c index 75fa8c2..704d5a7 100644 --- a/gtk/channel-display.c +++ b/gtk/channel-display.c @@ -1741,7 +1741,8 @@ static void display_handle_surface_create(SpiceChannel *channel, SpiceMsgIn *in) surface->stride = create->width * 4; surface->size = surface->height * surface->stride; -if (create->flags == SPICE_SURFACE_FLAGS_PRIMARY) { +if (create->flags & SPICE_SURFACE_FLAGS_PRIMARY) { +SPICE_DEBUG("primary flags: %d", create->flags); surface->primary = true; create_canvas(channel, surface); if (c->mark_false_event_id != 0) { ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel
Re: [Spice-devel] [PATCH spice-gtk 09/10] gtk: use slices for frequently allocated objects
ack, but what happens when g_slice_new fails? the spice_new and other spice malloc functions handle mallocs that fail and abort in such cases. On 09/08/2013 02:59 PM, Marc-André Lureau wrote: From: Marc-André Lureau --- gtk/channel-display.c | 4 ++-- gtk/spice-channel.c | 8 spice-common | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/gtk/channel-display.c b/gtk/channel-display.c index a69f14f..8629eee 100644 --- a/gtk/channel-display.c +++ b/gtk/channel-display.c @@ -657,7 +657,7 @@ static void destroy_surface(gpointer data) display_surface *surface = data; destroy_canvas(surface); -free(surface); +g_slice_free(display_surface, surface); } static void spice_display_channel_init(SpiceDisplayChannel *channel) @@ -1687,7 +1687,7 @@ static void display_handle_surface_create(SpiceChannel *channel, SpiceMsgIn *in) { SpiceDisplayChannelPrivate *c = SPICE_DISPLAY_CHANNEL(channel)->priv; SpiceMsgSurfaceCreate *create = spice_msg_in_parsed(in); -display_surface *surface = spice_new0(display_surface, 1); +display_surface *surface = g_slice_new0(display_surface); surface->surface_id = create->surface_id; surface->format = create->format; diff --git a/gtk/spice-channel.c b/gtk/spice-channel.c index 9fb3b0c..4b80029 100644 --- a/gtk/spice-channel.c +++ b/gtk/spice-channel.c @@ -462,7 +462,7 @@ SpiceMsgIn *spice_msg_in_new(SpiceChannel *channel) g_return_val_if_fail(channel != NULL, NULL); -in = spice_new0(SpiceMsgIn, 1); +in = g_slice_new0(SpiceMsgIn); in->refcount = 1; in->channel = channel; @@ -510,7 +510,7 @@ void spice_msg_in_unref(SpiceMsgIn *in) } else { free(in->data); } -free(in); +g_slice_free(SpiceMsgIn, in); } G_GNUC_INTERNAL @@ -615,7 +615,7 @@ SpiceMsgOut *spice_msg_out_new(SpiceChannel *channel, int type) g_return_val_if_fail(c != NULL, NULL); -out = spice_new0(SpiceMsgOut, 1); +out = g_slice_new0(SpiceMsgOut); out->refcount = 1; out->channel = channel; out->ro_check = msg_check_read_only(c->channel_type, type); @@ -651,7 +651,7 @@ void spice_msg_out_unref(SpiceMsgOut *out) if (out->refcount > 0) return; spice_marshaller_destroy(out->marshaller); -free(out); +g_slice_free(SpiceMsgOut, out); } /* system context */ diff --git a/spice-common b/spice-common index 7aef065..ab6fb3c 16 --- a/spice-common +++ b/spice-common @@ -1 +1 @@ -Subproject commit 7aef06577e47965bbe93e0a054857a562d2fde5a +Subproject commit ab6fb3c176b090cffedeb53d9b03f8399bd51ace ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel
Re: [Spice-devel] [PATCH spice-gtk 08/10] gtk: use GHashTable in display_cache
Hi, In general it looks good, but I have several comments: (1) the palette cache shouldn't be shared among the display channels. I.e., there should be one instance per channel, and not one instance in spice-session. (2) I think you changed the ref_count logic of cache item. Now each cache value is referenced by the cache only once. While multiple insertions and deletions from the cache shouldn't occur, I believe that the previous ref counting may be the reason that even though the palette cache was shared by the channels (while it shouldn't have been), deleting palettes with ref_count > 1, didn't cause errors. (3) hash function: the unique id can serve as the hash key, so you can just use the identity function instead of g_int64_hash Best, Yonit. On 09/08/2013 02:59 PM, Marc-André Lureau wrote: From: Marc-André Lureau The cache code isn't very quick, it shows up in profilers. Using GHashTable allows to simplify the code while making it faster. --- gtk/channel-cursor.c | 56 +++ gtk/channel-display.c | 93 +++--- gtk/spice-channel-cache.h | 111 +- gtk/spice-session-priv.h | 4 +- gtk/spice-session.c | 58 +++- spice-common | 2 +- 6 files changed, 103 insertions(+), 221 deletions(-) diff --git a/gtk/channel-cursor.c b/gtk/channel-cursor.c index e4a996b..eb53843 100644 --- a/gtk/channel-cursor.c +++ b/gtk/channel-cursor.c @@ -51,7 +51,7 @@ struct display_cursor { }; struct _SpiceCursorChannelPrivate { -display_cache cursors; +display_cache *cursors; gbooleaninit_done; }; @@ -67,7 +67,6 @@ enum { static guint signals[SPICE_CURSOR_LAST_SIGNAL]; static void spice_cursor_handle_msg(SpiceChannel *channel, SpiceMsgIn *msg); -static void delete_cursor_all(SpiceChannel *channel); static display_cursor * display_cursor_ref(display_cursor *cursor); static void display_cursor_unref(display_cursor *cursor); @@ -81,12 +80,14 @@ static void spice_cursor_channel_init(SpiceCursorChannel *channel) c = channel->priv = SPICE_CURSOR_CHANNEL_GET_PRIVATE(channel); -cache_init(&c->cursors, "cursor"); +c->cursors = cache_new((GDestroyNotify)display_cursor_unref); } static void spice_cursor_channel_finalize(GObject *obj) { -delete_cursor_all(SPICE_CHANNEL(obj)); +SpiceCursorChannelPrivate *c = SPICE_CURSOR_CHANNEL_GET_PRIVATE(obj); + +g_clear_pointer(&c->cursors, cache_unref); if (G_OBJECT_CLASS(spice_cursor_channel_parent_class)->finalize) G_OBJECT_CLASS(spice_cursor_channel_parent_class)->finalize(obj); @@ -97,7 +98,7 @@ static void spice_cursor_channel_reset(SpiceChannel *channel, gboolean migrating { SpiceCursorChannelPrivate *c = SPICE_CURSOR_CHANNEL(channel)->priv; -delete_cursor_all(channel); +cache_clear(c->cursors); c->init_done = FALSE; SPICE_CHANNEL_CLASS(spice_cursor_channel_parent_class)->channel_reset(channel, migrating); @@ -359,7 +360,6 @@ static display_cursor *set_cursor(SpiceChannel *channel, SpiceCursor *scursor) { SpiceCursorChannelPrivate *c = SPICE_CURSOR_CHANNEL(channel)->priv; SpiceCursorHeader *hdr = &scursor->header; -display_cache_item *item; display_cursor *cursor; size_t size; gint i, pix_mask, pix; @@ -378,9 +378,9 @@ static display_cursor *set_cursor(SpiceChannel *channel, SpiceCursor *scursor) hdr->width, hdr->height); if (scursor->flags & SPICE_CURSOR_FLAGS_FROM_CACHE) { -item = cache_find(&c->cursors, hdr->unique); -g_return_val_if_fail(item != NULL, NULL); -return display_cursor_ref(item->ptr); +cursor = cache_find(c->cursors, hdr->unique); +g_return_val_if_fail(cursor != NULL, NULL); +return display_cursor_ref(cursor); } g_return_val_if_fail(scursor->data_size != 0, NULL); @@ -453,36 +453,12 @@ static display_cursor *set_cursor(SpiceChannel *channel, SpiceCursor *scursor) cache_add: if (cursor && (scursor->flags & SPICE_CURSOR_FLAGS_CACHE_ME)) { -display_cursor_ref(cursor); -item = cache_add(&c->cursors, hdr->unique); -item->ptr = cursor; +cache_add(c->cursors, hdr->unique, display_cursor_ref(cursor)); } return cursor; } -static void delete_cursor_one(SpiceChannel *channel, display_cache_item *item) -{ -SpiceCursorChannelPrivate *c = SPICE_CURSOR_CHANNEL(channel)->priv; - -display_cursor_unref((display_cursor*)item->ptr); -cache_del(&c->cursors, item); -} - -static void delete_cursor_all(SpiceChannel *channel) -{ -SpiceCursorChannelPrivate *c = SPICE_CURSOR_CHANNEL(channel)->priv; -display_cache_item *item; - -for (;;) { -item = cache_get_lru(&c->cursors); -if (item == NULL) { -return; -} -delete_cursor_one(cha
[Spice-devel] oVirt support in aSPICE stalled due to broken network file I/O
Hey guys, I've been looking at adding oVirt support to aSPICE, and at the moment I'm completely stuck because of some glib functionality not working on Android. The library govirt uses glib's convenient support for network file I/O (for fetching certificates, VMs, etc.), but because of gio's reliance on gvfsd, network file I/O does not operate on Android. I've reported the bug to GNOME here: https://bugzilla.gnome.org/show_bug.cgi?id=707796 but this will take a very long time to be fixed if it gets fixed at all. In the meanwhile, (Christophe), do you think it's feasible to work around this issue by augmenting govirt with some alternate methods of reading files from the oVirt proxy (i.e. outside glib, download the file to a temporary location and open it as a local file, etc.)? Many thanks! iordan -- The conscious mind has only one thread of execution. ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel
Re: [Spice-devel] Use spice to show individual X clients like xpra does?
Hi - Original Message - > Hi, > > I've played around a bit with xpra[1]. Xpra (AFAIK) starts an X server with a > dummy video driver (or xvfb?) on the remote machine and a client xpra process > on the local machine shows remote application windows just like they would > run > locally. > > [1] http://xpra.org > > Xpra also forwards sound, clipboard and microfon. So it seems to me that > there > is some overlap with spice. > > It would be cool, if I could use spice in the same way, to see virtual > machine > X clients integrated in my local desktop just like local applications. Is > this > on your roadmap? It would be really nice to have, but nobody is working on this afaik. The current spice project is more designed toward driver level, rather than application level. You'd need to have a per-window drawing context in order to be able to display the seamless apps correctly. On Windows, it would probably need user-space gdi (&directx) hooks (somehow a bit like wine). Older methods just clip the remote windows with help of the window manager, however this is quite limited (see seamlessrdp or virtualbox seamless mode etc). I haven't looked at xpra, it would be interesting to see if and how they manage this per-window context. Perhaps it is possible to extend Xspice similarly? but I suppose it is rather done at higher level (application or X server frontend). ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel
Re: [Spice-devel] [PATCH qxl-win] Revert "miniport: halve QXL_IO_UPDATE_IRQ calls"
> This reverts commit 49feefa95d3595f04355c4aed53ec5bf26551046. > The patch causes the display to get stuck. Till we understand exactly > why, I'm reverting it. ACK. > --- > xddm/miniport/qxl.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/xddm/miniport/qxl.c b/xddm/miniport/qxl.c > index ce37f07..f5d6b48 100644 > --- a/xddm/miniport/qxl.c > +++ b/xddm/miniport/qxl.c > @@ -1321,6 +1321,7 @@ BOOLEAN Interrupt(PVOID dev_extension) > return FALSE; > } > dev_ext->ram_header->int_mask = 0; > +VideoPortWritePortUchar((PUCHAR)dev_ext->io_base + QXL_IO_UPDATE_IRQ, > 0); > > if (!VideoPortQueueDpc(dev_extension, InterruptCallback, NULL)) { > VideoPortLogError(dev_extension, NULL, E_UNEXPECTED, > QXLERR_INT_DELIVERY); > -- > 1.8.1.4 > > ___ > Spice-devel mailing list > Spice-devel@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/spice-devel > ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel
Re: [Spice-devel] Use spice to show individual X clients like xpra does?
> > Hi > > - Original Message - > > Hi, > > > > I've played around a bit with xpra[1]. Xpra (AFAIK) starts an X server with > > a > > dummy video driver (or xvfb?) on the remote machine and a client xpra > > process > > on the local machine shows remote application windows just like they would > > run > > locally. > > > > [1] http://xpra.org > > > > Xpra also forwards sound, clipboard and microfon. So it seems to me that > > there > > is some overlap with spice. > > > > It would be cool, if I could use spice in the same way, to see virtual > > machine > > X clients integrated in my local desktop just like local applications. Is > > this > > on your roadmap? > > It would be really nice to have, but nobody is working on this afaik. > > The current spice project is more designed toward driver level, rather than > application level. You'd need to have a per-window drawing context in order > to be able to display the seamless apps correctly. On Windows, it would > probably need user-space gdi (&directx) hooks (somehow a bit like wine). > Older methods just clip the remote windows with help of the window manager, > however this is quite limited (see seamlessrdp or virtualbox seamless mode > etc). I haven't looked at xpra, it would be interesting to see if and how > they manage this per-window context. Perhaps it is possible to extend Xspice > similarly? but I suppose it is rather done at higher level (application or X > server frontend). See http://xpra.org/trac/browser/xpra/trunk/src/README I have to confess I used it some time in the past and completely forgot about it, thanks for bringing it up! It is of course X specific, it uses Xvfb and becomes a compositing manager on top of it, and instead of compositing forwards the images to the remote X server, and also acts as a window manager deferring all app requests to the remote window manager on the client X. I haven't looked at the protocol, or copy paste support, or audio, which at this point Xspice supports. It should be easy to use the compositing manager + window manager bits (not sure about language). And teach the client of course to implement them too. Any takers? > ___ > Spice-devel mailing list > Spice-devel@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/spice-devel > ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel
[Spice-devel] [PATCH qxl-win] Revert "miniport: halve QXL_IO_UPDATE_IRQ calls"
This reverts commit 49feefa95d3595f04355c4aed53ec5bf26551046. The patch causes the display to get stuck. Till we understand exactly why, I'm reverting it. --- xddm/miniport/qxl.c | 1 + 1 file changed, 1 insertion(+) diff --git a/xddm/miniport/qxl.c b/xddm/miniport/qxl.c index ce37f07..f5d6b48 100644 --- a/xddm/miniport/qxl.c +++ b/xddm/miniport/qxl.c @@ -1321,6 +1321,7 @@ BOOLEAN Interrupt(PVOID dev_extension) return FALSE; } dev_ext->ram_header->int_mask = 0; +VideoPortWritePortUchar((PUCHAR)dev_ext->io_base + QXL_IO_UPDATE_IRQ, 0); if (!VideoPortQueueDpc(dev_extension, InterruptCallback, NULL)) { VideoPortLogError(dev_extension, NULL, E_UNEXPECTED, QXLERR_INT_DELIVERY); -- 1.8.1.4 ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel
Re: [Spice-devel] [PATCH spice-gtk 03/10] display: replace ring with hashtable
On 09/09/2013 10:58 AM, Uri Lublin wrote: Hi Marc-Andre, See my comment below. On 09/08/2013 09:59 PM, Marc-André Lureau wrote: diff --git a/gtk/channel-display.c b/gtk/channel-display.c index eab1742..7a66558 100644 --- a/gtk/channel-display.c +++ b/gtk/channel-display.c @@ -705,7 +706,7 @@ static void spice_display_channel_init(SpiceDisplayChannel *channel) c = channel->priv = SPICE_DISPLAY_CHANNEL_GET_PRIVATE(channel); -ring_init(&c->surfaces); +c->surfaces = g_hash_table_new(NULL, NULL); c->image_cache.ops = &image_cache_ops; c->palette_cache.ops = &palette_cache_ops; c->image_surfaces.ops = &image_surfaces_ops; @@ -740,7 +741,8 @@ static int create_canvas(SpiceChannel *channel, display_surface *surface) } emit_main_context(channel, SPICE_DISPLAY_PRIMARY_DESTROY); -ring_remove(&primary->link); + +g_hash_table_remove(c->surfaces, 0); Use primary->surface_id (instead of 0) as key: g_hash_table_remove(c->surfaces, GINT_TO_POINTER(primary->surface_id)) I see you are doing it in a following patch, so disregard. Thanks, Uri. ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel
Re: [Spice-devel] [PATCH spice-gtk 03/10] display: replace ring with hashtable
Hi Marc-Andre, See my comment below. On 09/08/2013 09:59 PM, Marc-André Lureau wrote: diff --git a/gtk/channel-display.c b/gtk/channel-display.c index eab1742..7a66558 100644 --- a/gtk/channel-display.c +++ b/gtk/channel-display.c @@ -705,7 +706,7 @@ static void spice_display_channel_init(SpiceDisplayChannel *channel) c = channel->priv = SPICE_DISPLAY_CHANNEL_GET_PRIVATE(channel); -ring_init(&c->surfaces); +c->surfaces = g_hash_table_new(NULL, NULL); c->image_cache.ops = &image_cache_ops; c->palette_cache.ops = &palette_cache_ops; c->image_surfaces.ops = &image_surfaces_ops; @@ -740,7 +741,8 @@ static int create_canvas(SpiceChannel *channel, display_surface *surface) } emit_main_context(channel, SPICE_DISPLAY_PRIMARY_DESTROY); -ring_remove(&primary->link); + +g_hash_table_remove(c->surfaces, 0); Use primary->surface_id (instead of 0) as key: g_hash_table_remove(c->surfaces, GINT_TO_POINTER(primary->surface_id)) Thanks, Uri. destroy_canvas(primary); free(primary); } @@ -792,7 +794,7 @@ static int create_canvas(SpiceChannel *channel, display_surface *surface) surface->zlib_decoder); g_return_val_if_fail(surface->canvas != NULL, 0); -ring_add(&c->surfaces, &surface->link); +g_hash_table_insert(c->surfaces, GINT_TO_POINTER(surface->surface_id), surface); if (surface->primary) { emit_main_context(channel, SPICE_DISPLAY_PRIMARY_CREATE, @@ -1792,7 +1783,7 @@ static void display_handle_surface_destroy(SpiceChannel *channel, SpiceMsgIn *in emit_main_context(channel, SPICE_DISPLAY_PRIMARY_DESTROY); } -ring_remove(&surface->link); +g_hash_table_remove(c->surfaces, GINT_TO_POINTER(surface->surface_id)); destroy_canvas(surface); free(surface); } ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel
Re: [Spice-devel] [PATCH common 1/3] quic: compile with constant bpp, to help compiler
Looks good, ACK series (with the change you mentioned yourself already) On 09/08/2013 09:07 PM, Marc-André Lureau wrote: From: Marc-André Lureau --- common/quic_family_tmpl.c | 4 ++-- common/quic_rgb_tmpl.c| 6 +++--- common/quic_tmpl.c| 16 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/common/quic_family_tmpl.c b/common/quic_family_tmpl.c index cca2c05..287ff6d 100644 --- a/common/quic_family_tmpl.c +++ b/common/quic_family_tmpl.c @@ -74,13 +74,13 @@ static unsigned int FNAME(golomb_decoding)(const unsigned int l, const unsigned /* update the bucket using just encoded curval */ static void FNAME(update_model)(CommonState *state, s_bucket * const bucket, -const BYTE curval, unsigned int bpp) +const BYTE curval) { +const unsigned int bpp = BPC; COUNTER * const pcounters = bucket->pcounters; unsigned int i; unsigned int bestcode; unsigned int bestcodelen; -//unsigned int bpp = encoder->bpp; /* update counters, find minimum */ diff --git a/common/quic_rgb_tmpl.c b/common/quic_rgb_tmpl.c index 37c908c..19cc348 100644 --- a/common/quic_rgb_tmpl.c +++ b/common/quic_rgb_tmpl.c @@ -178,11 +178,11 @@ #define UPDATE_MODEL(index) \ update_model(&encoder->rgb_state, find_bucket(channel_r, correlate_row_r[index - 1]), \ -correlate_row_r[index], bpc); \ +correlate_row_r[index]); \ update_model(&encoder->rgb_state, find_bucket(channel_g, correlate_row_g[index - 1]), \ -correlate_row_g[index], bpc); \ +correlate_row_g[index]); \ update_model(&encoder->rgb_state, find_bucket(channel_b, correlate_row_b[index - 1]), \ -correlate_row_b[index], bpc); +correlate_row_b[index]); #ifdef RLE_PRED_1 diff --git a/common/quic_tmpl.c b/common/quic_tmpl.c index b625daf..75f2ff0 100644 --- a/common/quic_tmpl.c +++ b/common/quic_tmpl.c @@ -173,7 +173,7 @@ static void FNAME(compress_row0_seg)(Encoder *encoder, Channel *channel, int i, } else { channel->state.waitcnt = (tabrand(&channel->state.tabrand_seed) & waitmask); update_model(&channel->state, find_bucket(channel, decorelate_drow[-1]), - decorelate_drow[i], bpc); + decorelate_drow[i]); } stopidx = ++i + channel->state.waitcnt; } else { @@ -191,7 +191,7 @@ static void FNAME(compress_row0_seg)(Encoder *encoder, Channel *channel, int i, } update_model(&channel->state, find_bucket(channel, decorelate_drow[stopidx - 1]), - decorelate_drow[stopidx], bpc); + decorelate_drow[stopidx]); stopidx = i + (tabrand(&channel->state.tabrand_seed) & waitmask); } @@ -272,7 +272,7 @@ static void FNAME(compress_row_seg)(Encoder *encoder, Channel *channel, int i, } else { channel->state.waitcnt = (tabrand(&channel->state.tabrand_seed) & waitmask); update_model(&channel->state, find_bucket(channel, decorelate_drow[-1]), - decorelate_drow[0], bpc); + decorelate_drow[0]); } stopidx = ++i + channel->state.waitcnt; } else { @@ -295,7 +295,7 @@ static void FNAME(compress_row_seg)(Encoder *encoder, Channel *channel, int i, } update_model(&channel->state, find_bucket(channel, decorelate_drow[stopidx - 1]), - decorelate_drow[stopidx], bpc); + decorelate_drow[stopidx]); stopidx = i + (tabrand(&channel->state.tabrand_seed) & waitmask); } @@ -406,7 +406,7 @@ static void FNAME(uncompress_row0_seg)(Encoder *encoder, Channel *channel, int i } else { channel->state.waitcnt = (tabrand(&channel->state.tabrand_seed) & waitmask); update_model(&channel->state, find_bucket(channel, correlate_row[-1]), - correlate_row[0], bpc); + correlate_row[0]); } stopidx = ++i + channel->state.waitcnt; } else { @@ -426,7 +426,7 @@ static void FNAME(uncompress_row0_seg)(Encoder *encoder, Channel *channel, int i decode_eatbits(encoder, codewordlen); } -update_model(&channel->state, pbucket, correlate_row[stopidx], bpc); +update_model(&channel->state, pbucket, correlate_row[stopidx]); stopidx = i + (tabrand(&channel->state.tabrand_seed) & waitmask); } @@ -511,7 +511,7 @@ static void FNAME(uncompress_row_seg)(Encoder *encod