amdgpu/dc: use kref for dc_plane_state.
Signed-off-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Harry Wentland <harry.wentland@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
5c58ab0bd6
commit
4d090f0fae
@ -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);
|
||||
}
|
||||
|
||||
static void dc_plane_state_free(struct kref *kref)
|
||||
{
|
||||
struct dc_plane_state *plane_state = container_of(kref, struct dc_plane_state, refcount);
|
||||
destruct(plane_state);
|
||||
kfree(plane_state);
|
||||
}
|
||||
|
||||
void dc_plane_state_release(struct dc_plane_state *plane_state)
|
||||
{
|
||||
ASSERT(atomic_read(&plane_state->ref_count) > 0);
|
||||
atomic_dec(&plane_state->ref_count);
|
||||
|
||||
if (atomic_read(&plane_state->ref_count) == 0) {
|
||||
destruct(plane_state);
|
||||
kfree(plane_state);
|
||||
}
|
||||
kref_put(&plane_state->refcount, dc_plane_state_free);
|
||||
}
|
||||
|
||||
void dc_gamma_retain(struct dc_gamma *gamma)
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user