[Spice-devel] jpeg and jpeg_alpha in spice

Alon Levy alevy at redhat.com
Wed May 4 03:18:08 PDT 2011


On Wed, May 04, 2011 at 10:33:08AM +0800, Shuxiang Lim wrote:
> Hi,Alon!
>   Thanks,but now I decide to abandon such drudgery try of forcing use JPEG
> in spice-server because it's not a friendly reasonable way to spice. Now all
> that I can do currently is just attempting to fasten the image traffic
> between libspicec.so and Java UI,all the sins come from the android
> framework and Java for there is no way to access directly the image buffer
> in mem maintained by libspicec.so from Java. The only hope will be
> file-mem-mapping between C and Java, but that will never give me any
> surprise,I suppose.
>   Besides,another reason that enticed me to force use of JPEG is the
> common/quic.c in client is damned buggy of SIGBUS on android/ARM on some ops
> such as pointer typecasting.
>   That's common in my porting work,for example,in generated_demashaller.c,
> this
> *#define write_int8(ptr, val) *(int8_t *)(ptr) = val*
>   will cause SIGBUS on ARM, so I change it into
> *#define write_int8(ptr,v)  {int8_t val=v;memcpy(ptr,&val,sizeof(int8_t)); }
> *
>   then it's safe, but seems ugly and clumsy.
> So, is there any simple,elegant and safe way to do this?
>   Best regards.
> 

I don't see any simple other way really - I hope that memcpy doesn't have a lot of
overhead, but the only replacement would be for you to code a unaligned_int8_copy
yourself, since the structs that are being unmarshalled are unaligned on purpose (to
conserve some space).

I would suggest you profile after you have it running to see if this is worth a fix.

> 
> 
> 
> On Tue, May 3, 2011 at 11:40 PM, Alon Levy <alevy at redhat.com> wrote:
> 
> > On Tue, May 03, 2011 at 11:48:59AM +0800, Shuxiang Lim wrote:
> > > Hi,All!
> >
> > Hi Shuxiang,
> >
> >  AFAIK you can't avoid non jpeg images because most (all?) rendering
> > operations still happen
> >  on the client, so it can't or/xor/move with mask an 'almost' bitmap.
> >
> >  But the person who wrote this code should be back on the list next week,
> > so if you can
> >  wait until then you should get a better answer.
> >
> > Alon
> >
> > >    I've found a problem that when
> > > 1. using qxl,thus the image type will be SPICE_BITMAP_FMT_RGBA;
> > > 2. and forcing the use of red_jpeg_compress_image ('cause I want to get
> > only
> > > JPEG in client) in spice server
> > >    then SPICE_IMAGE_TYPE_JPEG_ALPHA will be produced,but this will cause
> > the
> > > color disorder in the dest image in client.
> > >    Normally,spice will use quic_compress or lz_compress for
> > > SPICE_BITMAP_FMT_RGBA, so SPICE_IMAGE_TYPE_JPEG_ALPHA will never be used,
> > Am
> > > I right? So why did we define SPICE_IMAGE_TYPE_JPEG_ALPHA? How can I
> > produce
> > > only NORMAL SPICE_IMAGE_TYPE_JPEG for SPICE_BITMAP_FMT_RGBA?
> > >   Best Regards.
> >
> > > _______________________________________________
> > > Spice-devel mailing list
> > > Spice-devel at lists.freedesktop.org
> > > http://lists.freedesktop.org/mailman/listinfo/spice-devel
> >
> >

> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel



More information about the Spice-devel mailing list