[Spice-devel] [PATCH 7/8] Store surfaces_used in a bit-array

Alexander Larsson alexl at redhat.com
Mon Aug 23 01:35:00 PDT 2010


On Sun, 2010-08-22 at 15:56 +0300, Yonit Halperin wrote:
> On 08/20/2010 09:54 PM, alexl at redhat.com wrote:
> > From: Alexander Larsson<alexl at redhat.com>
> >
> > This is smaller than a byte array, and allows us to skip full
> > blocks of 32 ids in one check.
> > ---
> 
> Hi,
> why not use a linked list, for free surfaces, in a static 
> UINT32[n_surfaces] array? Any reason besides space, which is 4k?

In fact, the best way to do this would probably be to chain the free
surfaces together into a linked list using e.g. SurfaceInfo->pdev which
are unused for free surface_infos. This way we use no extra memory.

> shouldn't it be ~(0x80000000 >> (surface_id % 32))?

> > +        if (used_mask == 0xffffffff) {
> shouldn't it be used_mask != 0xffffffff?

Yeah, Good catches.

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Alexander Larsson                                            Red Hat, Inc 
       alexl at redhat.com            alexander.larsson at gmail.com 
He's a notorious sweet-toothed cat burglar moving from town to town, helping 
folk in trouble. She's a supernatural tempestuous doctor married to the Mob. 
They fight crime! 



More information about the Spice-devel mailing list