Michel DÃnzer wrote:


+ // 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.

Ok, that was one of my doubts.
So if we go that route, it would manage the ranges, prevent overlapping, and also try to "spare" the surfaces by merging adjacent ones with similar properties.




+       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.

How do you "know" the owner ? I'm not sure the pid would be enough.

Stephane





-------------------------------------------------------
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