[Spice-devel] [PATCH 14/18] worker: move spice_bitmap_get_line

Fabiano Fidêncio fabiano at fidencio.org
Fri Nov 20 08:52:15 PST 2015


On Fri, Nov 20, 2015 at 5:48 PM, Jonathon Jongsma <jjongsma at redhat.com> wrote:
>
>
> On Fri, 2015-11-20 at 11:38 -0500, Frediano Ziglio wrote:
>> >
>> > Perhaps "add spice_bitmap_get_line()" would be a better commit message.
>> > But why is this added? where is it going to be used? If it was really
>> > supposed to be moved ... moved from where?
>> >
>> > On Fri, Nov 20, 2015 at 12:17 PM, Frediano Ziglio <fziglio at redhat.com>
>> > wrote:
>> > > From: Marc-André Lureau <marcandre.lureau at gmail.com>
>> > >
>> > > ---
>> > >  server/spice_bitmap_utils.c | 27 +++++++++++++++++++++++++++
>> > >  server/spice_bitmap_utils.h |  3 +++
>> > >  2 files changed, 30 insertions(+)
>> > >
>> > > diff --git a/server/spice_bitmap_utils.c b/server/spice_bitmap_utils.c
>> > > index ae3fc8b..3b992a7 100644
>> > > --- a/server/spice_bitmap_utils.c
>> > > +++ b/server/spice_bitmap_utils.c
>> > > @@ -186,3 +186,30 @@ void dump_bitmap(SpiceBitmap *bitmap)
>> > >      }
>> > >      fclose(f);
>> > >  }
>> > > +
>> > > +uint8_t *spice_bitmap_get_line(const SpiceBitmap *image, size_t *offset,
>> > > +                               int *chunk_nr, int stride)
>> > > +{
>> > > +    SpiceChunks *chunks = image->data;
>> > > +    uint8_t *ret;
>> > > +    SpiceChunk *chunk;
>> > > +
>> > > +    chunk = &chunks->chunk[*chunk_nr];
>> > > +
>> > > +    if (*offset == chunk->len) {
>> > > +        if (*chunk_nr == chunks->num_chunks - 1) {
>> > > +            return NULL; /* Last chunk */
>> > > +        }
>> > > +        *offset = 0;
>> > > +        (*chunk_nr)++;
>> > > +        chunk = &chunks->chunk[*chunk_nr];
>> > > +    }
>> > > +
>> > > +    if (chunk->len - *offset < stride) {
>> > > +        spice_warning("bad chunk alignment");
>> > > +        return NULL;
>> > > +    }
>> > > +    ret = chunk->data + *offset;
>> > > +    *offset += stride;
>> > > +    return ret;
>> > > +}
>> > > diff --git a/server/spice_bitmap_utils.h b/server/spice_bitmap_utils.h
>> > > index 69860e5..9d3a5ae 100644
>> > > --- a/server/spice_bitmap_utils.h
>> > > +++ b/server/spice_bitmap_utils.h
>> > > @@ -5,4 +5,7 @@ void dump_bitmap(SpiceBitmap *bitmap);
>> > >
>> > >  int spice_bitmap_from_surface_type(uint32_t surface_format);
>> > >
>> > > +uint8_t *spice_bitmap_get_line(const SpiceBitmap *image, size_t *offset,
>> > > +                               int *chunk_nr, int stride);
>> > > +
>> > >  #endif
>> > > --
>> > > 2.4.3
>> > >
>> > > _______________________________________________
>> > > Spice-devel mailing list
>> > > Spice-devel at lists.freedesktop.org
>> > > http://lists.freedesktop.org/mailman/listinfo/spice-devel
>> >
>> > NACK for now ...
>> >
>> > --
>> > Fabiano Fidêncio
>> >
>>
>> Sometimes is useful so see how the patch was:
>> http://cgit.freedesktop.org/~fziglio/spice-server/commit/?h=refactory&id=19847
>> abdea71eb39d4ac3d717aff99f0e4103984
>>
>> Actually is quite different. I think the function was moved from an added
>> patch
>> so the rebase succeeded as the remove hunk was there!
>> Quite incredible but looks possible!
>>
>
>
> It looks like the functionw as previously called red_get_image_line but this
> function was moved in this commit:
>
> commit 3708bf9cf0315c2ab7299b5b93cc6d50fd8f1dae
> Author: Francois Gouget <fgouget at codeweavers.com>
> Date:   Wed Oct 14 17:31:01 2015 +0200
>
>     server: Move the MJPEG encoder functions to mjpeg_encoder.c
>
>     Note that this requires some adjustments to the encode_frame()
>     parameters to avoid red_worker-specific types.
>
>     Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
>
>
>
>
>> Frediano
>> _______________________________________________
>> Spice-devel mailing list
>> Spice-devel at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/spice-devel

Frediano, Jonathon,

Yeah, I will start looking into the original commit as well, my bad :-\
And seems that the patch can be dropped in the end.

-- 
Fabiano Fidêncio


More information about the Spice-devel mailing list