direct rendering freeze

garrone pgarrone at
Wed Dec 10 22:56:07 PST 2008

 I am getting freezes in direct rendering. Sometimes glxgears works,
but eventually the freeze occurs at program exit, or upon xrandr operation.
The freeze occurs
because the kernel function drm_lock continually returns -EINTR
because the hardware lock variable master->lock.hw_lock is NULL, 
and the function drmIoctl (in user space drm) continually invokes the ioctl 
while it returns -EINTR.

Delving further, the problem appears to be caused by the ioctl 
DRM_IOCTL_ADD_MAP, type _DRM_SHM, in kernel code drm/drm_bufs.c. 
This ioctl normally allocates the hardware lock
that drm_lock locks. However when it fails it does so by finding
an existing map, (ie drm_find_matching_map returns true)
and returns without setting a hardware lock variable,
in the first "return 0" after the "case _DRM_SHM" statement.
The variable dev->primary->master->lock.hw_lock,
set in the third-last line, is left NULL, and causes the drm_lock
call to fail later.

	case _DRM_SHM:
		list = drm_find_matching_map(dev, map);
		if (list != NULL) {
			if(list->map->size != map->size) {
				DRM_DEBUG("Matching maps of type %d with "
					  "mismatched sizes, (%ld vs %ld)\n",
					  map->type, map->size, list->map->size);
				list->map->size = map->size;

			drm_free(map, sizeof(*map), DRM_MEM_MAPS);
			*maplist = list;
			return 0;         
		map->handle = vmalloc_user(map->size);
		DRM_DEBUG("%lu %d %p\n",
			  map->size, drm_order(map->size), map->handle);
		if (!map->handle) {
			drm_free(map, sizeof(*map), DRM_MEM_MAPS);
			return -ENOMEM;
		map->offset = (unsigned long)map->handle;
		if (map->flags & _DRM_CONTAINS_LOCK) {
			/* Prevent a 2nd X Server from creating a 2nd lock */
			if (dev->primary->master->lock.hw_lock != NULL) {
				drm_free(map, sizeof(*map), DRM_MEM_MAPS);
				return -EBUSY;
			dev->sigdata.lock = dev->primary->master->lock.hw_lock = map->handle;	/* Pointer to lock */

I am also getting a prior mtrr failure upon device closure,
for pci region 2, size 256 Meg.
I have documented this in bugzilla bug #18967

The equipment is intel GM45 (pci id 8086:2a42).
If anyone can suggest what the root cause of the problem is
likely to be, would be grateful.
Thanks in advance,

More information about the xorg mailing list