Module Name:    src
Committed By:   mrg
Date:           Wed Mar  3 03:48:40 UTC 2010

Modified Files:
        src/sys/external/bsd/drm/dist/bsd-core: radeon_drv.c

Log Message:
make suspend/resume actually work:
- we have to DRM_LOCK()/DRM_UNLOCK(), thus s/rad_dev/dev/ in a variable name
- only call into radeon_cp_{stop,resume}() if the device is active

with this my nforce4 dual core amd system is able to suspend/resume with both
X and drm active.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/external/bsd/drm/dist/bsd-core/radeon_drv.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/drm/dist/bsd-core/radeon_drv.c
diff -u src/sys/external/bsd/drm/dist/bsd-core/radeon_drv.c:1.8 src/sys/external/bsd/drm/dist/bsd-core/radeon_drv.c:1.9
--- src/sys/external/bsd/drm/dist/bsd-core/radeon_drv.c:1.8	Wed Feb 24 22:38:09 2010
+++ src/sys/external/bsd/drm/dist/bsd-core/radeon_drv.c	Wed Mar  3 03:48:39 2010
@@ -137,24 +137,33 @@
 static bool
 radeondrm_suspend(device_t self, const pmf_qual_t *qual)
 {
-	struct drm_device *rad_dev = device_private(self);
+	struct drm_device *dev = device_private(self);
 	drm_radeon_cp_stop_t stop_args;
+	bool rv = true;
 
 	stop_args.flush = stop_args.idle = 0;
-	if (radeon_cp_stop(rad_dev, &stop_args, rad_dev->lock.file_priv) != 0)
-		return false;
+	DRM_LOCK();
+	if (drm_find_file_by_proc(dev, curlwp->l_proc) &&
+	    radeon_cp_stop(dev, &stop_args, dev->lock.file_priv) != 0)
+		rv = false;
+	DRM_UNLOCK();
 
-	return true;
+	return rv;
 }
 
 static bool
 radeondrm_resume(device_t self, const pmf_qual_t *qual)
 {
-	struct drm_device *rad_dev = device_private(self);
-	if (radeon_cp_resume(rad_dev, NULL, NULL) != 0)
-		return false;
+	struct drm_device *dev = device_private(self);
+	bool rv = true;
+
+	DRM_LOCK();
+	if (drm_find_file_by_proc(dev, curlwp->l_proc) &&
+	    radeon_cp_resume(dev, NULL, NULL) != 0)
+		rv =  false;
+	DRM_UNLOCK();
 	
-	return true;
+	return rv;
 }
 
 static int

Reply via email to