summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/display/dc/core/dc_surface.c
diff options
context:
space:
mode:
authorAndrey Grodzovsky <Andrey.Grodzovsky@amd.com>2016-12-20 18:01:30 -0500
committerAlex Deucher <alexander.deucher@amd.com>2017-09-26 17:07:18 -0400
commitdb96c69ee78845c4f4cadea9fd282fb265253874 (patch)
tree06637057fe8f077a33dee51acda6a7deece24262 /drivers/gpu/drm/amd/display/dc/core/dc_surface.c
parent8c737fcc24b01ef36da5f78aace70d444485abf9 (diff)
downloadop-kernel-dev-db96c69ee78845c4f4cadea9fd282fb265253874.zip
op-kernel-dev-db96c69ee78845c4f4cadea9fd282fb265253874.tar.gz
drm/amd/display: Add refcount debug assert
Signed-off-by: Andrey Grodzovsky <Andrey.Grodzovsky@amd.com> Signed-off-by: Jordan Lazare <Jordan.Lazare@amd.com> Signed-off-by: Tony Cheng <tony.cheng@amd.com> Reviewed-by: Andrey Grodzovsky <Andrey.Grodzovsky@amd.com> Reviewed-by: Jordan Lazare <Jordan.Lazare@amd.com> Acked-by: Harry Wentland <Harry.Wentland@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/display/dc/core/dc_surface.c')
-rw-r--r--drivers/gpu/drm/amd/display/dc/core/dc_surface.c14
1 files changed, 11 insertions, 3 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 cf8fb9a..6b4c75a 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_surface.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_surface.c
@@ -105,7 +105,7 @@ struct dc_surface *dc_create_surface(const struct dc *dc)
if (false == construct(core_dc->ctx, surface))
goto construct_fail;
- dc_surface_retain(&surface->protected.public);
+ ++surface->ref_count;
return &surface->protected.public;
@@ -162,6 +162,7 @@ void dc_surface_retain(const struct dc_surface *dc_surface)
{
struct surface *surface = DC_SURFACE_TO_SURFACE(dc_surface);
+ ASSERT(surface->ref_count > 0);
++surface->ref_count;
}
@@ -169,6 +170,7 @@ void dc_surface_release(const struct dc_surface *dc_surface)
{
struct surface *surface = DC_SURFACE_TO_SURFACE(dc_surface);
+ ASSERT(surface->ref_count > 0);
--surface->ref_count;
if (surface->ref_count == 0) {
@@ -181,12 +183,15 @@ void dc_gamma_retain(const struct dc_gamma *dc_gamma)
{
struct gamma *gamma = DC_GAMMA_TO_GAMMA(dc_gamma);
+ ASSERT(gamma->ref_count > 0);
++gamma->ref_count;
}
void dc_gamma_release(const struct dc_gamma *dc_gamma)
{
struct gamma *gamma = DC_GAMMA_TO_GAMMA(dc_gamma);
+
+ ASSERT(gamma->ref_count > 0);
--gamma->ref_count;
if (gamma->ref_count == 0)
@@ -200,7 +205,7 @@ struct dc_gamma *dc_create_gamma()
if (gamma == NULL)
goto alloc_fail;
- dc_gamma_retain(&gamma->protected.public);
+ ++gamma->ref_count;
return &gamma->protected.public;
@@ -212,12 +217,15 @@ void dc_transfer_func_retain(const struct dc_transfer_func *dc_tf)
{
struct transfer_func *tf = DC_TRANSFER_FUNC_TO_TRANSFER_FUNC(dc_tf);
+ ASSERT(tf->ref_count > 0);
++tf->ref_count;
}
void dc_transfer_func_release(const struct dc_transfer_func *dc_tf)
{
struct transfer_func *tf = DC_TRANSFER_FUNC_TO_TRANSFER_FUNC(dc_tf);
+
+ ASSERT(tf->ref_count > 0);
--tf->ref_count;
if (tf->ref_count == 0)
@@ -231,7 +239,7 @@ struct dc_transfer_func *dc_create_transfer_func()
if (tf == NULL)
goto alloc_fail;
- dc_transfer_func_retain(&tf->protected.public);
+ ++tf->ref_count;
return &tf->protected.public;
OpenPOWER on IntegriCloud