Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/bsd/drm/dist/bsd-core make suspend/resume actua...



details:   https://anonhg.NetBSD.org/src/rev/d1ab1b9041a0
branches:  trunk
changeset: 752670:d1ab1b9041a0
user:      mrg <mrg%NetBSD.org@localhost>
date:      Wed Mar 03 03:48:39 2010 +0000

description:
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.

diffstat:

 sys/external/bsd/drm/dist/bsd-core/radeon_drv.c |  25 +++++++++++++++++--------
 1 files changed, 17 insertions(+), 8 deletions(-)

diffs (45 lines):

diff -r 3e16a6fc43c3 -r d1ab1b9041a0 sys/external/bsd/drm/dist/bsd-core/radeon_drv.c
--- a/sys/external/bsd/drm/dist/bsd-core/radeon_drv.c   Wed Mar 03 02:09:51 2010 +0000
+++ b/sys/external/bsd/drm/dist/bsd-core/radeon_drv.c   Wed Mar 03 03:48:39 2010 +0000
@@ -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



Home | Main Index | Thread Index | Old Index