1/*
2 * Permission is hereby granted, free of charge, to any person obtaining a
3 * copy of this software and associated documentation files (the "Software"),
4 * to deal in the Software without restriction, including without limitation
5 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
6 * and/or sell copies of the Software, and to permit persons to whom the
7 * Software is furnished to do so, subject to the following conditions:
8 *
--- 8 unchanged lines hidden (view full) ---
17 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
18 * OTHER DEALINGS IN THE SOFTWARE.
19 *
20 * Authors: Rafa�� Mi��ecki <zajec5@gmail.com>
21 * Alex Deucher <alexdeucher@gmail.com>
22 */
23
24#include <sys/cdefs.h>
25__FBSDID("$FreeBSD: head/sys/dev/drm2/radeon/radeon_pm.c 259016 2013-12-05 22:38:53Z ray $");
26
27#include <dev/drm2/drmP.h>
28#include "radeon.h"
29#include "avivod.h"
30#include "atom.h"
31
32#define RADEON_IDLE_LOOP_MS 100
33#define RADEON_RECLOCK_DELAY_MS 200
--- 209 unchanged lines hidden (view full) ---
243{
244 int i, r;
245
246 /* no need to take locks, etc. if nothing's going to change */
247 if ((rdev->pm.requested_clock_mode_index == rdev->pm.current_clock_mode_index) &&
248 (rdev->pm.requested_power_state_index == rdev->pm.current_power_state_index))
249 return;
250
251 //DRM_LOCK(rdev->ddev); XXX Recursion, already locked in drm_attach/drm_load -- dumbbell@
252 sx_xlock(&rdev->pm.mclk_lock);
253 sx_xlock(&rdev->ring_lock);
254
255 /* wait for the rings to drain */
256 for (i = 0; i < RADEON_NUM_RINGS; i++) {
257 struct radeon_ring *ring = &rdev->ring[i];
258 if (!ring->ready) {
259 continue;
260 }
261 r = radeon_fence_wait_empty_locked(rdev, i);
262 if (r) {
263 /* needs a GPU reset dont reset here */
264 sx_xunlock(&rdev->ring_lock);
265 sx_xunlock(&rdev->pm.mclk_lock);
266 //DRM_UNLOCK(rdev->ddev); XXX Recursion, already locked in drm_attach/drm_load -- dumbbell@
267 return;
268 }
269 }
270
271 radeon_unmap_vram_bos(rdev);
272
273 if (rdev->irq.installed) {
274 for (i = 0; i < rdev->num_crtc; i++) {
--- 19 unchanged lines hidden (view full) ---
294 radeon_update_bandwidth_info(rdev);
295 if (rdev->pm.active_crtc_count)
296 radeon_bandwidth_update(rdev);
297
298 rdev->pm.dynpm_planned_action = DYNPM_ACTION_NONE;
299
300 sx_xunlock(&rdev->ring_lock);
301 sx_xunlock(&rdev->pm.mclk_lock);
302 //DRM_UNLOCK(rdev->ddev); XXX Recursion, already locked in drm_attach/drm_load -- dumbbell@
303}
304
305static void radeon_pm_print_states(struct radeon_device *rdev)
306{
307 int i, j;
308 struct radeon_power_state *power_state;
309 struct radeon_pm_clock_info *clock_info;
310
--- 608 unchanged lines hidden ---
2 * Permission is hereby granted, free of charge, to any person obtaining a
3 * copy of this software and associated documentation files (the "Software"),
4 * to deal in the Software without restriction, including without limitation
5 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
6 * and/or sell copies of the Software, and to permit persons to whom the
7 * Software is furnished to do so, subject to the following conditions:
8 *
--- 8 unchanged lines hidden (view full) ---
17 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
18 * OTHER DEALINGS IN THE SOFTWARE.
19 *
20 * Authors: Rafa�� Mi��ecki <zajec5@gmail.com>
21 * Alex Deucher <alexdeucher@gmail.com>
22 */
23
24#include <sys/cdefs.h>
25__FBSDID("$FreeBSD: head/sys/dev/drm2/radeon/radeon_pm.c 259016 2013-12-05 22:38:53Z ray $");
26
27#include <dev/drm2/drmP.h>
28#include "radeon.h"
29#include "avivod.h"
30#include "atom.h"
31
32#define RADEON_IDLE_LOOP_MS 100
33#define RADEON_RECLOCK_DELAY_MS 200
--- 209 unchanged lines hidden (view full) ---
243{
244 int i, r;
245
246 /* no need to take locks, etc. if nothing's going to change */
247 if ((rdev->pm.requested_clock_mode_index == rdev->pm.current_clock_mode_index) &&
248 (rdev->pm.requested_power_state_index == rdev->pm.current_power_state_index))
249 return;
250
251 //DRM_LOCK(rdev->ddev); XXX Recursion, already locked in drm_attach/drm_load -- dumbbell@
252 sx_xlock(&rdev->pm.mclk_lock);
253 sx_xlock(&rdev->ring_lock);
254
255 /* wait for the rings to drain */
256 for (i = 0; i < RADEON_NUM_RINGS; i++) {
257 struct radeon_ring *ring = &rdev->ring[i];
258 if (!ring->ready) {
259 continue;
260 }
261 r = radeon_fence_wait_empty_locked(rdev, i);
262 if (r) {
263 /* needs a GPU reset dont reset here */
264 sx_xunlock(&rdev->ring_lock);
265 sx_xunlock(&rdev->pm.mclk_lock);
266 //DRM_UNLOCK(rdev->ddev); XXX Recursion, already locked in drm_attach/drm_load -- dumbbell@
267 return;
268 }
269 }
270
271 radeon_unmap_vram_bos(rdev);
272
273 if (rdev->irq.installed) {
274 for (i = 0; i < rdev->num_crtc; i++) {
--- 19 unchanged lines hidden (view full) ---
294 radeon_update_bandwidth_info(rdev);
295 if (rdev->pm.active_crtc_count)
296 radeon_bandwidth_update(rdev);
297
298 rdev->pm.dynpm_planned_action = DYNPM_ACTION_NONE;
299
300 sx_xunlock(&rdev->ring_lock);
301 sx_xunlock(&rdev->pm.mclk_lock);
302 //DRM_UNLOCK(rdev->ddev); XXX Recursion, already locked in drm_attach/drm_load -- dumbbell@
303}
304
305static void radeon_pm_print_states(struct radeon_device *rdev)
306{
307 int i, j;
308 struct radeon_power_state *power_state;
309 struct radeon_pm_clock_info *clock_info;
310
--- 608 unchanged lines hidden ---