[PATCH 1/4] dix: Provide means to report exact sizes of resources.

Rami Ylimäki rami.ylimaki at vincit.fi
Thu Oct 28 08:05:30 PDT 2010


  On 10/28/2010 04:48 PM, Alan Coopersmith wrote:
>> +/**
>> + * Get the function used to calculate resource size. Extensions and
>> + * drivers need to be able to determine the current size calculation
>> + * function if they want to wrap or override it.
>> + *
>> + * @param[in] type     Resource type used in size calculations.
>> + *
>> + * @return Function to calculate the size of a single
>> + *                     resource.
>> + */
>> +SizeType
>> +GetResourceTypeSizeFunc(RESTYPE type)
>> +{
>> +    return resourceTypes[type&  TypeMask].sizeFunc;
>> +}
> Should this add dixPrivatesSize(type) to the result or should the callers
> like Xresource be doing that?
>

The original intention was that Xresource wouldn't do that automatically 
and the functions returned by that getter would calculate the size as 
well as they can. The resourceSize field of ResourceSizeRec should be 
filled with the amount of memory that is freed when the resource doesn't 
exist anymore.

It's probably best to add sizeof(PixmapRec) and 
dixPrivatesSize(PIXMAP_PRIVATE) to the result in GetPixmapBytes to get 
better estimate for the size and also to make GetPixmapBytes an example 
for other size calculation functions. I can do that in v2 of the patch 
if this change seems sensible to you.

-- Rami



More information about the xorg-devel mailing list