summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2015-10-16 09:39:14 +1000
committerDave Airlie <airlied@redhat.com>2015-10-16 09:39:14 +1000
commitaa1b36f2bb068e6d76b0bef2da286631bfa1bff1 (patch)
treec4acebfa46b13e556ec47fbbf3fa0697e50660cf /drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
parent99a91c94972d1d583beb4b4854f55984f7cc2dc8 (diff)
parent2fcef6ec87a044221fc3c2f16873f7c02b9ae991 (diff)
Merge branch 'drm-next-4.4' of git://people.freedesktop.org/~agd5f/linux into drm-next
This is the first radeon and amdgpu pull for drm-next. Highlights include: - Efficiency improvements to the CS checker for pre-SI asics - Cursor fixes ported from radeon to amdgpu - Enable GPU scheduler by default - Add a bunch of GPUVM debugging options - Add support for some new atombios opcodes - Misc cleanups and fixes * 'drm-next-4.4' of git://people.freedesktop.org/~agd5f/linux: (42 commits) drm/amdgpu: fix lockup when clean pending fences drm/amdgpu: add timer to fence to detect scheduler lockup drm/amdgpu: add VM CS mapping trace point drm/amdgpu: add option to clear VM page tables after every submit drm/amdgpu: add option to stop on VM fault drm/amdgpu: only print meaningful VM faults drm/amdgpu: also trace already allocated VMIDs drm/amdgpu: Drop unnecessary #include <linux/vga_switcheroo.h> drm/radeon: Drop unnecessary #include <linux/vga_switcheroo.h> drm/amdgpu: clean up pageflip interrupt handling drm/amdgpu: rework sdma structures drm/amdgpu: unpin cursor BOs on suspend and pin them again on resume drm/amdgpu/dce8: Fold set_cursor() into show_cursor() drm/amdgpu/dce8: Clean up reference counting and pinning of the cursor BOs drm/amdgpu/dce8: Move hotspot handling out of set_cursor drm/amdgpu/dce8: Re-show the cursor after a modeset (v2) drm/amdgpu/dce8: Use cursor_set2 hook for enabling / disabling the HW cursor drm/amdgpu/dce11: Fold set_cursor() into show_cursor() drm/amdgpu/dce11: Clean up reference counting and pinning of the cursor BOs drm/amdgpu/dce11: Move hotspot handling out of set_cursor ...
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_device.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_device.c33
1 files changed, 31 insertions, 2 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 6068d8207d10..901a460b2c55 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -1022,7 +1022,7 @@ static void amdgpu_check_arguments(struct amdgpu_device *adev)
* amdgpu_switcheroo_set_state - set switcheroo state
*
* @pdev: pci dev pointer
- * @state: vga switcheroo state
+ * @state: vga_switcheroo state
*
* Callback for the switcheroo driver. Suspends or resumes the
* the asics before or after it is powered up using ACPI methods.
@@ -1657,11 +1657,21 @@ int amdgpu_suspend_kms(struct drm_device *dev, bool suspend, bool fbcon)
}
drm_modeset_unlock_all(dev);
- /* unpin the front buffers */
+ /* unpin the front buffers and cursors */
list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
+ struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc);
struct amdgpu_framebuffer *rfb = to_amdgpu_framebuffer(crtc->primary->fb);
struct amdgpu_bo *robj;
+ if (amdgpu_crtc->cursor_bo) {
+ struct amdgpu_bo *aobj = gem_to_amdgpu_bo(amdgpu_crtc->cursor_bo);
+ r = amdgpu_bo_reserve(aobj, false);
+ if (r == 0) {
+ amdgpu_bo_unpin(aobj);
+ amdgpu_bo_unreserve(aobj);
+ }
+ }
+
if (rfb == NULL || rfb->obj == NULL) {
continue;
}
@@ -1713,6 +1723,7 @@ int amdgpu_resume_kms(struct drm_device *dev, bool resume, bool fbcon)
{
struct drm_connector *connector;
struct amdgpu_device *adev = dev->dev_private;
+ struct drm_crtc *crtc;
int r;
if (dev->switch_power_state == DRM_SWITCH_POWER_OFF)
@@ -1746,6 +1757,24 @@ int amdgpu_resume_kms(struct drm_device *dev, bool resume, bool fbcon)
if (r)
return r;
+ /* pin cursors */
+ list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
+ struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc);
+
+ if (amdgpu_crtc->cursor_bo) {
+ struct amdgpu_bo *aobj = gem_to_amdgpu_bo(amdgpu_crtc->cursor_bo);
+ r = amdgpu_bo_reserve(aobj, false);
+ if (r == 0) {
+ r = amdgpu_bo_pin(aobj,
+ AMDGPU_GEM_DOMAIN_VRAM,
+ &amdgpu_crtc->cursor_addr);
+ if (r != 0)
+ DRM_ERROR("Failed to pin cursor BO (%d)\n", r);
+ amdgpu_bo_unreserve(aobj);
+ }
+ }
+ }
+
/* blat the mode back in */
if (fbcon) {
drm_helper_resume_force_mode(dev);