> Date: Tue, 13 Nov 2012 12:30:29 +0100 > From: Martin Pieuchot <mpieuc...@nolizard.org> > > While experimenting with the agp(4) interface I found that if you > release the interface (AGPIOC_RELEASE) before closing its file > descriptor you'll end up with allocated but unbinded memory blocks.
That behaviour is documented in agp(4). So if we change it, we should change the documentation as well. That said, the documentation also says that the AGPIOC_RELEASE ioctl doesn't unbind any allocated memory. And that doesn't seem to be true. > This behavior is due to the fact that the agp_release_helper() function > doesn't free the memory associated to each block and this is incoherent > with what it says it does: > > /* > * Clear out the aperture and free any > * outstanding memory blocks. > */ > ... > > So the diff below correct this by freeing all the memory block when > releasing the interface, this is what happens currently if you close > the file descriptor without releasing the interface. I;m not sure this is right. I think the idea here is that an application could release control to hand things over to drm, and later reacquire control. The comment in xenocara/xserver/hw/xfree86/os-support/bsd/bsd_agp.c:xf86ReleaseGART() suggests that this behaviour is desired.