diff options
Diffstat (limited to 'meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/2459-amdgpu-dc-convert-dc_transfer-to-use-a-kref.patch')
-rw-r--r-- | meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/2459-amdgpu-dc-convert-dc_transfer-to-use-a-kref.patch | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/2459-amdgpu-dc-convert-dc_transfer-to-use-a-kref.patch b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/2459-amdgpu-dc-convert-dc_transfer-to-use-a-kref.patch new file mode 100644 index 00000000..34f1227f --- /dev/null +++ b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/2459-amdgpu-dc-convert-dc_transfer-to-use-a-kref.patch @@ -0,0 +1,86 @@ +From ca0ef74bec3258805058eb7ea2e8c99b7ecc905a Mon Sep 17 00:00:00 2001 +From: Dave Airlie <airlied@redhat.com> +Date: Tue, 3 Oct 2017 12:38:57 +1000 +Subject: [PATCH 2459/4131] amdgpu/dc: convert dc_transfer to use a kref. + +Rolling your own atomic ref counts is frowned upon. + +Signed-off-by: Dave Airlie <airlied@redhat.com> +--- + drivers/gpu/drm/amd/display/dc/core/dc_surface.c | 17 +++++++++-------- + drivers/gpu/drm/amd/display/dc/dc.h | 2 +- + drivers/gpu/drm/amd/display/dc/os_types.h | 2 ++ + 3 files changed, 12 insertions(+), 9 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 ff07105..c2168df 100644 +--- a/drivers/gpu/drm/amd/display/dc/core/dc_surface.c ++++ b/drivers/gpu/drm/amd/display/dc/core/dc_surface.c +@@ -161,17 +161,18 @@ struct dc_gamma *dc_create_gamma() + + void dc_transfer_func_retain(struct dc_transfer_func *tf) + { +- ASSERT(atomic_read(&tf->ref_count) > 0); +- atomic_inc(&tf->ref_count); ++ kref_get(&tf->refcount); + } + +-void dc_transfer_func_release(struct dc_transfer_func *tf) ++static void dc_transfer_func_free(struct kref *kref) + { +- ASSERT(atomic_read(&tf->ref_count) > 0); +- atomic_dec(&tf->ref_count); ++ struct dc_transfer_func *tf = container_of(kref, struct dc_transfer_func, refcount); ++ kfree(tf); ++} + +- if (atomic_read(&tf->ref_count) == 0) +- kfree(tf); ++void dc_transfer_func_release(struct dc_transfer_func *tf) ++{ ++ kref_put(&tf->refcount, dc_transfer_func_free); + } + + struct dc_transfer_func *dc_create_transfer_func() +@@ -181,7 +182,7 @@ struct dc_transfer_func *dc_create_transfer_func() + if (tf == NULL) + goto alloc_fail; + +- atomic_inc(&tf->ref_count); ++ kref_init(&tf->refcount); + + return tf; + +diff --git a/drivers/gpu/drm/amd/display/dc/dc.h b/drivers/gpu/drm/amd/display/dc/dc.h +index 5b6fe4d..d04a155 100644 +--- a/drivers/gpu/drm/amd/display/dc/dc.h ++++ b/drivers/gpu/drm/amd/display/dc/dc.h +@@ -330,11 +330,11 @@ enum dc_transfer_func_predefined { + }; + + struct dc_transfer_func { ++ struct kref refcount; + struct dc_transfer_func_distributed_points tf_pts; + enum dc_transfer_func_type type; + enum dc_transfer_func_predefined tf; + struct dc_context *ctx; +- atomic_t ref_count; + }; + + /* +diff --git a/drivers/gpu/drm/amd/display/dc/os_types.h b/drivers/gpu/drm/amd/display/dc/os_types.h +index 27ed2a6..e0cd527 100644 +--- a/drivers/gpu/drm/amd/display/dc/os_types.h ++++ b/drivers/gpu/drm/amd/display/dc/os_types.h +@@ -32,6 +32,8 @@ + #include <linux/types.h> + #include <drm/drmP.h> + ++#include <linux/kref.h> ++ + #include "cgs_linux.h" + + #if defined(__BIG_ENDIAN) && !defined(BIGENDIAN_CPU) +-- +2.7.4 + |