diff options
author | Maarten Maathuis <madman2003@gmail.com> | 2010-05-09 08:49:52 -0400 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2010-05-28 02:06:17 -0400 |
commit | b334f2b3b68c35fd86a0cbc90ecee40e63ba2f37 (patch) | |
tree | 75ba9d0586e32904632e8964da4d1f04223dae1a /drivers/gpu | |
parent | 893887ed75cacbfe1a855c63659838e0261d17e8 (diff) |
drm/nouveau: allow cursor image and position to survive suspend
- This isn't triggered yet on a normal kernel, because it still does a VT
switch, but it seemed like a good idea to fix this now.
Tested-by: Maxim Levitsky <maximlevitsky@gmail.com>
Signed-off-by: Maarten Maathuis <madman2003@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_crtc.h | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_drv.c | 29 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nv04_cursor.c | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nv50_cursor.c | 1 |
4 files changed, 33 insertions, 0 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_crtc.h b/drivers/gpu/drm/nouveau/nouveau_crtc.h index 49fa7b2d257..cb1ce2a0916 100644 --- a/drivers/gpu/drm/nouveau/nouveau_crtc.h +++ b/drivers/gpu/drm/nouveau/nouveau_crtc.h | |||
@@ -40,6 +40,8 @@ struct nouveau_crtc { | |||
40 | int sharpness; | 40 | int sharpness; |
41 | int last_dpms; | 41 | int last_dpms; |
42 | 42 | ||
43 | int cursor_saved_x, cursor_saved_y; | ||
44 | |||
43 | struct { | 45 | struct { |
44 | int cpp; | 46 | int cpp; |
45 | bool blanked; | 47 | bool blanked; |
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.c b/drivers/gpu/drm/nouveau/nouveau_drv.c index c6079e36669..27377043229 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drv.c +++ b/drivers/gpu/drm/nouveau/nouveau_drv.c | |||
@@ -175,6 +175,13 @@ nouveau_pci_suspend(struct pci_dev *pdev, pm_message_t pm_state) | |||
175 | nouveau_bo_unpin(nouveau_fb->nvbo); | 175 | nouveau_bo_unpin(nouveau_fb->nvbo); |
176 | } | 176 | } |
177 | 177 | ||
178 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { | ||
179 | struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); | ||
180 | |||
181 | nouveau_bo_unmap(nv_crtc->cursor.nvbo); | ||
182 | nouveau_bo_unpin(nv_crtc->cursor.nvbo); | ||
183 | } | ||
184 | |||
178 | NV_INFO(dev, "Evicting buffers...\n"); | 185 | NV_INFO(dev, "Evicting buffers...\n"); |
179 | ttm_bo_evict_mm(&dev_priv->ttm.bdev, TTM_PL_VRAM); | 186 | ttm_bo_evict_mm(&dev_priv->ttm.bdev, TTM_PL_VRAM); |
180 | 187 | ||
@@ -314,12 +321,34 @@ nouveau_pci_resume(struct pci_dev *pdev) | |||
314 | nouveau_bo_pin(nouveau_fb->nvbo, TTM_PL_FLAG_VRAM); | 321 | nouveau_bo_pin(nouveau_fb->nvbo, TTM_PL_FLAG_VRAM); |
315 | } | 322 | } |
316 | 323 | ||
324 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { | ||
325 | struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); | ||
326 | int ret; | ||
327 | |||
328 | ret = nouveau_bo_pin(nv_crtc->cursor.nvbo, TTM_PL_FLAG_VRAM); | ||
329 | if (!ret) | ||
330 | ret = nouveau_bo_map(nv_crtc->cursor.nvbo); | ||
331 | if (ret) | ||
332 | NV_ERROR(dev, "Could not pin/map cursor.\n"); | ||
333 | } | ||
334 | |||
317 | if (dev_priv->card_type < NV_50) { | 335 | if (dev_priv->card_type < NV_50) { |
318 | nv04_display_restore(dev); | 336 | nv04_display_restore(dev); |
319 | NVLockVgaCrtcs(dev, false); | 337 | NVLockVgaCrtcs(dev, false); |
320 | } else | 338 | } else |
321 | nv50_display_init(dev); | 339 | nv50_display_init(dev); |
322 | 340 | ||
341 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { | ||
342 | struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); | ||
343 | |||
344 | nv_crtc->cursor.set_offset(nv_crtc, | ||
345 | nv_crtc->cursor.nvbo->bo.offset - | ||
346 | dev_priv->vm_vram_base); | ||
347 | |||
348 | nv_crtc->cursor.set_pos(nv_crtc, nv_crtc->cursor_saved_x, | ||
349 | nv_crtc->cursor_saved_y); | ||
350 | } | ||
351 | |||
323 | /* Force CLUT to get re-loaded during modeset */ | 352 | /* Force CLUT to get re-loaded during modeset */ |
324 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { | 353 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { |
325 | struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); | 354 | struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); |
diff --git a/drivers/gpu/drm/nouveau/nv04_cursor.c b/drivers/gpu/drm/nouveau/nv04_cursor.c index 89a91b9d8b2..aaf3de3bc81 100644 --- a/drivers/gpu/drm/nouveau/nv04_cursor.c +++ b/drivers/gpu/drm/nouveau/nv04_cursor.c | |||
@@ -20,6 +20,7 @@ nv04_cursor_hide(struct nouveau_crtc *nv_crtc, bool update) | |||
20 | static void | 20 | static void |
21 | nv04_cursor_set_pos(struct nouveau_crtc *nv_crtc, int x, int y) | 21 | nv04_cursor_set_pos(struct nouveau_crtc *nv_crtc, int x, int y) |
22 | { | 22 | { |
23 | nv_crtc->cursor_saved_x = x; nv_crtc->cursor_saved_y = y; | ||
23 | NVWriteRAMDAC(nv_crtc->base.dev, nv_crtc->index, | 24 | NVWriteRAMDAC(nv_crtc->base.dev, nv_crtc->index, |
24 | NV_PRAMDAC_CU_START_POS, | 25 | NV_PRAMDAC_CU_START_POS, |
25 | XLATE(y, 0, NV_PRAMDAC_CU_START_POS_Y) | | 26 | XLATE(y, 0, NV_PRAMDAC_CU_START_POS_Y) | |
diff --git a/drivers/gpu/drm/nouveau/nv50_cursor.c b/drivers/gpu/drm/nouveau/nv50_cursor.c index 753e723adb3..03ad7ab14f0 100644 --- a/drivers/gpu/drm/nouveau/nv50_cursor.c +++ b/drivers/gpu/drm/nouveau/nv50_cursor.c | |||
@@ -107,6 +107,7 @@ nv50_cursor_set_pos(struct nouveau_crtc *nv_crtc, int x, int y) | |||
107 | { | 107 | { |
108 | struct drm_device *dev = nv_crtc->base.dev; | 108 | struct drm_device *dev = nv_crtc->base.dev; |
109 | 109 | ||
110 | nv_crtc->cursor_saved_x = x; nv_crtc->cursor_saved_y = y; | ||
110 | nv_wr32(dev, NV50_PDISPLAY_CURSOR_USER_POS(nv_crtc->index), | 111 | nv_wr32(dev, NV50_PDISPLAY_CURSOR_USER_POS(nv_crtc->index), |
111 | ((y & 0xFFFF) << 16) | (x & 0xFFFF)); | 112 | ((y & 0xFFFF) << 16) | (x & 0xFFFF)); |
112 | /* Needed to make the cursor move. */ | 113 | /* Needed to make the cursor move. */ |