[PATCH 1/4] dix: Provide means to report exact sizes of resources.
Daniel Stone
daniel at fooishbar.org
Wed Nov 3 10:48:22 PDT 2010
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.x.org/archives/xorg-devel/attachments/20101104/4b27dc6c/attachment.pgp>
More information about the xorg-devel
mailing list