On Wed, 2004-12-08 at 02:54 +0100, Stephane Marchesin wrote:
> 
> The small attached patch adds a new drm ioctl to do surface 
> allocation/deallocation on the radeon.

[...]

> Any comments ? I'ts untested, but that's my first ioctl, so I wanted 
> feedback (both on the idea and the implementation) before I build 
> anything upon it.

I think it's a good start but still missing some details.


> +     // allocate the surface
> +     for(i=0;i<8;i++)
> +             if (!(dev_priv->surfaces&(1<<i)))
> +                     break;
> +
> +     if (i>=8)
> +             return DRM_ERR(ENOMEM);
> +     else
> +             dev_priv->surfaces&=(1<<i);
> +     
> +     if ( DRM_COPY_TO_USER( &alloc.surface, &i, 
> +                            sizeof(int) ) ) {
> +             DRM_ERROR( "copy_to_user\n" );
> +             return DRM_ERR(EFAULT);

IMHO it should also manage the ranges (prevent overlapping, ...) and
parameters of the surfaces.


> +     DRM_COPY_FROM_USER_IOCTL( memfree, (drm_radeon_mem_free_t __user *)data,
> +                               sizeof(memfree) );
> +
> +     dev_priv->surfaces&= (~(1<<memfree.surface));

It should definitely ensure that only the owner can free a surface
though. It would also need to free a client's surfaces if it dies, etc.


-- 
Earthling Michel DÃnzer      |     Debian (powerpc), X and DRI developer
Libre software enthusiast    |   http://svcs.affero.net/rm.php?r=daenzer


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
--
_______________________________________________
Dri-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dri-devel

Reply via email to