Hi,
On Thu, Oct 28, 2010 at 01:23:41PM +0300, Rami Ylimäki wrote:
> +/**
> + * Override the default function that calculates resource size. For
> + * example, video driver knows better how to calculate pixmap memory
> + * usage and can therefore wrap or override size calculation for
> + * RT_PIXMAP.
> + *
> + * @param[in] type Resource type used in size calculations.
> + *
> + * @param[in] sizeFunc Function to calculate the size of a single
> + * resource.
> + */
> +void
> +SetResourceTypeSizeFunc(RESTYPE type, SizeType sizeFunc)
> +{
> + resourceTypes[type & TypeMask].sizeFunc = sizeFunc;
> +}So, I guess the intention here would be to call SetResourceTypeSizeFunc(RT_PIXMAP, my_driver_how_big_is_the_pixmap); ? In that case, it falls apart in the multi-screen case (yeah, I know, it barely works). dixFreePixmap and FreeWindowResources get around this by calling the corresponding ScreenRec hook: would the intention be to add one to make the sizing work correctly for multiple drivers, or? Other than that, looks good to me, but one thing to bear in mind if we keep on extending resource usage would be to add a size argument to AddResource(), as well as a new ResourceSizeChanged(), rather than having to call back for every resource. The callbacks will work fine for the pixmap/window/etc case as drivers already have all the relevant size information, but we might end up with resource types in the future where you'd need a great deal of unnecessary bookkeeping just for these callbacks. Cheers, Daniel
signature.asc
Description: Digital signature
_______________________________________________ [email protected]: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
