aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/2461-amdgpu-dc-use-kref-for-dc_plane_state.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/2461-amdgpu-dc-use-kref-for-dc_plane_state.patch')
-rw-r--r--meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/2461-amdgpu-dc-use-kref-for-dc_plane_state.patch70
1 files changed, 70 insertions, 0 deletions
diff --git a/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/2461-amdgpu-dc-use-kref-for-dc_plane_state.patch b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/2461-amdgpu-dc-use-kref-for-dc_plane_state.patch
new file mode 100644
index 00000000..26346812
--- /dev/null
+++ b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/2461-amdgpu-dc-use-kref-for-dc_plane_state.patch
@@ -0,0 +1,70 @@
+From 9ae049162e974b059ae8d4e01bef889b02be9336 Mon Sep 17 00:00:00 2001
+From: Dave Airlie <airlied@redhat.com>
+Date: Tue, 3 Oct 2017 12:38:59 +1000
+Subject: [PATCH 2461/4131] amdgpu/dc: use kref for dc_plane_state.
+
+Signed-off-by: Dave Airlie <airlied@redhat.com>
+---
+ drivers/gpu/drm/amd/display/dc/core/dc_surface.c | 20 ++++++++++----------
+ drivers/gpu/drm/amd/display/dc/dc.h | 2 +-
+ 2 files changed, 11 insertions(+), 11 deletions(-)
+
+diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_surface.c b/drivers/gpu/drm/amd/display/dc/core/dc_surface.c
+index 0950075..d43783a 100644
+--- a/drivers/gpu/drm/amd/display/dc/core/dc_surface.c
++++ b/drivers/gpu/drm/amd/display/dc/core/dc_surface.c
+@@ -71,8 +71,8 @@ struct dc_plane_state *dc_create_plane_state(struct dc *dc)
+ if (NULL == plane_state)
+ return NULL;
+
++ kref_init(&plane_state->refcount);
+ construct(core_dc->ctx, plane_state);
+- atomic_inc(&plane_state->ref_count);
+
+ return plane_state;
+ }
+@@ -112,19 +112,19 @@ const struct dc_plane_status *dc_plane_get_status(
+
+ void dc_plane_state_retain(struct dc_plane_state *plane_state)
+ {
+- ASSERT(atomic_read(&plane_state->ref_count) > 0);
+- atomic_inc(&plane_state->ref_count);
++ kref_get(&plane_state->refcount);
+ }
+
+-void dc_plane_state_release(struct dc_plane_state *plane_state)
++static void dc_plane_state_free(struct kref *kref)
+ {
+- ASSERT(atomic_read(&plane_state->ref_count) > 0);
+- atomic_dec(&plane_state->ref_count);
++ struct dc_plane_state *plane_state = container_of(kref, struct dc_plane_state, refcount);
++ destruct(plane_state);
++ kfree(plane_state);
++}
+
+- if (atomic_read(&plane_state->ref_count) == 0) {
+- destruct(plane_state);
+- kfree(plane_state);
+- }
++void dc_plane_state_release(struct dc_plane_state *plane_state)
++{
++ kref_put(&plane_state->refcount, dc_plane_state_free);
+ }
+
+ void dc_gamma_retain(struct dc_gamma *gamma)
+diff --git a/drivers/gpu/drm/amd/display/dc/dc.h b/drivers/gpu/drm/amd/display/dc/dc.h
+index d04a155..857f4d5 100644
+--- a/drivers/gpu/drm/amd/display/dc/dc.h
++++ b/drivers/gpu/drm/amd/display/dc/dc.h
+@@ -381,7 +381,7 @@ struct dc_plane_state {
+
+ /* private to dc_surface.c */
+ enum dc_irq_source irq_source;
+- atomic_t ref_count;
++ struct kref refcount;
+ };
+
+ struct dc_plane_info {
+--
+2.7.4
+