3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/os-specific/linux/amdgpu-pro/patches/0009-Fix-vblank-calls.patch
2016-11-13 12:44:28 -04:00

136 lines
4 KiB
Diff

From 9da98ec93816277a2d4e93d3205da044bace08bc Mon Sep 17 00:00:00 2001
From: "Luke A. Guest" <laguest@archeia.com>
Date: Sun, 25 Sep 2016 16:49:09 +0100
Subject: [PATCH 09/14] Fix vblank calls
---
amd/amdgpu/amdgpu_display.c | 8 ++++++++
amd/amdgpu/dce_v10_0.c | 8 ++++++++
amd/amdgpu/dce_v11_0.c | 8 ++++++++
amd/amdgpu/dce_v8_0.c | 8 ++++++++
amd/dal/amdgpu_dm/amdgpu_dm.c | 4 ++++
5 files changed, 36 insertions(+)
diff --git a/amd/amdgpu/amdgpu_display.c b/amd/amdgpu/amdgpu_display.c
index 862611c..267c65f 100644
--- a/amd/amdgpu/amdgpu_display.c
+++ b/amd/amdgpu/amdgpu_display.c
@@ -268,7 +268,11 @@ int amdgpu_crtc_page_flip(struct drm_crtc *crtc,
work->base = base;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)
+ r = drm_crtc_vblank_get(crtc);
+#else
r = drm_vblank_get(crtc->dev, amdgpu_crtc->crtc_id);
+#endif
if (r) {
DRM_ERROR("failed to get vblank before flip\n");
goto pflip_cleanup;
@@ -296,7 +300,11 @@ int amdgpu_crtc_page_flip(struct drm_crtc *crtc,
return 0;
vblank_cleanup:
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)
+ drm_crtc_vblank_put(&amdgpu_crtc->base);
+#else
drm_vblank_put(crtc->dev, amdgpu_crtc->crtc_id);
+#endif
pflip_cleanup:
if (unlikely(amdgpu_bo_reserve(new_rbo, false) != 0)) {
diff --git a/amd/amdgpu/dce_v10_0.c b/amd/amdgpu/dce_v10_0.c
index 0fd1e4f..5f0044c 100644
--- a/amd/amdgpu/dce_v10_0.c
+++ b/amd/amdgpu/dce_v10_0.c
@@ -3372,11 +3372,19 @@ static int dce_v10_0_pageflip_irq(struct amdgpu_device *adev,
/* wakeup usersapce */
if (works->event)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)
+ drm_crtc_send_vblank_event(&amdgpu_crtc->base, works->event);
+#else
drm_send_vblank_event(adev->ddev, crtc_id, works->event);
+#endif
spin_unlock_irqrestore(&adev->ddev->event_lock, flags);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)
+ drm_crtc_vblank_put(&amdgpu_crtc->base);
+#else
drm_vblank_put(adev->ddev, amdgpu_crtc->crtc_id);
+#endif
schedule_work(&works->unpin_work);
return 0;
diff --git a/amd/amdgpu/dce_v11_0.c b/amd/amdgpu/dce_v11_0.c
index a85eb5f..8edc670 100644
--- a/amd/amdgpu/dce_v11_0.c
+++ b/amd/amdgpu/dce_v11_0.c
@@ -3432,11 +3432,19 @@ static int dce_v11_0_pageflip_irq(struct amdgpu_device *adev,
/* wakeup usersapce */
if(works->event)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)
+ drm_crtc_send_vblank_event(&amdgpu_crtc->base, works->event);
+#else
drm_send_vblank_event(adev->ddev, crtc_id, works->event);
+#endif
spin_unlock_irqrestore(&adev->ddev->event_lock, flags);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)
+ drm_crtc_vblank_put(&amdgpu_crtc->base);
+#else
drm_vblank_put(adev->ddev, amdgpu_crtc->crtc_id);
+#endif
schedule_work(&works->unpin_work);
return 0;
diff --git a/amd/amdgpu/dce_v8_0.c b/amd/amdgpu/dce_v8_0.c
index 308f5e4..57e8014 100644
--- a/amd/amdgpu/dce_v8_0.c
+++ b/amd/amdgpu/dce_v8_0.c
@@ -3323,11 +3323,19 @@ static int dce_v8_0_pageflip_irq(struct amdgpu_device *adev,
/* wakeup usersapce */
if (works->event)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)
+ drm_crtc_send_vblank_event(&amdgpu_crtc->base, works->event);
+#else
drm_send_vblank_event(adev->ddev, crtc_id, works->event);
+#endif
spin_unlock_irqrestore(&adev->ddev->event_lock, flags);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)
+ drm_crtc_vblank_put(&amdgpu_crtc->base);
+#else
drm_vblank_put(adev->ddev, amdgpu_crtc->crtc_id);
+#endif
schedule_work(&works->unpin_work);
return 0;
diff --git a/amd/dal/amdgpu_dm/amdgpu_dm.c b/amd/dal/amdgpu_dm/amdgpu_dm.c
index 30865ec..f49999b 100644
--- a/amd/dal/amdgpu_dm/amdgpu_dm.c
+++ b/amd/dal/amdgpu_dm/amdgpu_dm.c
@@ -196,10 +196,14 @@ static void dm_pflip_high_irq(void *interrupt_params)
/* wakeup usersapce */
if(works->event)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)
+ drm_crtc_send_vblank_event(&amdgpu_crtc->base, works->event);
+#else
drm_send_vblank_event(
adev->ddev,
amdgpu_crtc->crtc_id,
works->event);
+#endif
spin_unlock_irqrestore(&adev->ddev->event_lock, flags);
--
2.10.1