aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/0533-drm-amd-display-Add-global-lock-function.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/0533-drm-amd-display-Add-global-lock-function.patch')
-rw-r--r--meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/0533-drm-amd-display-Add-global-lock-function.patch109
1 files changed, 109 insertions, 0 deletions
diff --git a/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/0533-drm-amd-display-Add-global-lock-function.patch b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/0533-drm-amd-display-Add-global-lock-function.patch
new file mode 100644
index 00000000..dd410ead
--- /dev/null
+++ b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/0533-drm-amd-display-Add-global-lock-function.patch
@@ -0,0 +1,109 @@
+From f2f4c8b629c3d2fd798ca2c93d673fe64748c4a3 Mon Sep 17 00:00:00 2001
+From: Andrey Grodzovsky <Andrey.Grodzovsky@amd.com>
+Date: Tue, 20 Jun 2017 10:42:33 -0400
+Subject: [PATCH 0533/4131] drm/amd/display: Add global lock function.
+
+Signed-off-by: Andrey Grodzovsky <Andrey.Grodzovsky@amd.com>
+Reviewed-by: Harry Wentland <Harry.Wentland@amd.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+---
+ .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.c | 66 ++++++++++++++++------
+ 1 file changed, 49 insertions(+), 17 deletions(-)
+
+diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c
+index 7a050aa..e88911f 100644
+--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c
++++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c
+@@ -3040,6 +3040,49 @@ static enum surface_update_type amdgpu_dm_check_surfaces_update_type(
+ return update_type;
+ }
+
++/*`
++ * Grabs all modesetting locks to serialize against any blocking commits,
++ * Waits for completion of all non blocking commits.
++ */
++static void aquire_global_lock(
++ struct drm_device *dev,
++ struct drm_atomic_state *state)
++{
++ struct drm_crtc *crtc;
++ struct drm_crtc_commit *commit;
++ long ret;
++
++ /* Adding all modeset locks to aquire_ctx will
++ * ensure that when the framework release it the
++ * extra locks we are locking here will get released to
++ */
++ drm_modeset_lock_all_ctx(dev, state->acquire_ctx);
++
++ list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
++ spin_lock(&crtc->commit_lock);
++ commit = list_first_entry_or_null(&crtc->commit_list,
++ struct drm_crtc_commit, commit_entry);
++ if (commit)
++ drm_crtc_commit_get(commit);
++ spin_unlock(&crtc->commit_lock);
++
++ if (!commit)
++ continue;
++
++ /* Make sure all pending HW programming completed and
++ * page flips done
++ */
++ ret = wait_for_completion_timeout(&commit->hw_done,
++ 10*HZ);
++ ret = wait_for_completion_timeout(&commit->flip_done,
++ 10*HZ);
++ if (ret == 0)
++ DRM_ERROR("[CRTC:%d:%s] hw_done timed out\n",
++ crtc->base.id, crtc->name);
++ drm_crtc_commit_put(commit);
++ }
++}
++
+ int amdgpu_dm_atomic_check(struct drm_device *dev,
+ struct drm_atomic_state *state)
+ {
+@@ -3296,7 +3339,7 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,
+ dc,
+ set[i].surfaces,
+ set[i].surface_count,
+- set[i].stream) > UPDATE_TYPE_MED) {
++ set[i].stream) > UPDATE_TYPE_FAST) {
+ wait_for_prev_commits = true;
+ break;
+ }
+@@ -3310,25 +3353,14 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,
+ * For full updates case when
+ * removing/adding/updateding streams on once CRTC while flipping
+ * on another CRTC,
+- * Adding all current active CRTC's states to the atomic commit in
+- * amdgpu_dm_atomic_check will guarantee that any such full update commit
++ * acquiring global lock will guarantee that any such full
++ * update commit
+ * will wait for completion of any outstanding flip using DRMs
+ * synchronization events.
+ */
+- if (wait_for_prev_commits) {
+- list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
+- struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc);
+- struct drm_crtc_state *crtc_state;
+-
+- if (acrtc->stream) {
+- crtc_state = drm_atomic_get_crtc_state(state, crtc);
+- if (IS_ERR(crtc_state)) {
+- ret = PTR_ERR(crtc_state);
+- break;
+- }
+- }
+- }
+- }
++ if (wait_for_prev_commits)
++ aquire_global_lock(dev, state);
++
+ }
+
+ if (context) {
+--
+2.7.4
+