Commit b29fc866 authored by Harry Wentland's avatar Harry Wentland Committed by Alex Deucher

drm/amd/display: Add correct retain/release

Needed by objs in dm_atomic_state
Signed-off-by: default avatarHarry Wentland <harry.wentland@amd.com>
Reviewed-by: default avatarTony Cheng <Tony.Cheng@amd.com>
Acked-by: default avatarHarry Wentland <Harry.Wentland@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent a6818a32
......@@ -658,9 +658,19 @@ void dm_atomic_state_clear(struct drm_atomic_state *s)
static void dm_atomic_state_free(struct drm_atomic_state *state)
{
struct dm_atomic_state *dm_state = to_dm_atomic_state(state);
int i, j;
drm_atomic_state_default_release(state);
for (i = 0; i < dm_state->set_count; i++) {
for (j = 0; j < dm_state->set[i].surface_count; j++) {
dc_surface_release(dm_state->set[i].surfaces[j]);
}
}
for (i = 0; i < dm_state->set_count; i++)
dc_stream_release(dm_state->set[i].stream);
kfree(dm_state);
}
......
......@@ -2874,11 +2874,15 @@ static uint32_t update_in_val_sets_stream(
}
val_sets[i].stream = new_stream;
dc_stream_retain(new_stream);
crtcs[i] = crtc;
if (i == set_count) {
/* nothing found. add new one to the end */
return set_count + 1;
} else {
/* update. relase old stream */
dc_stream_release(old_stream);
}
return set_count;
......@@ -2900,6 +2904,7 @@ static uint32_t remove_from_val_sets(
return set_count;
}
dc_stream_release(stream);
set_count--;
for (; i < set_count; i++) {
......@@ -3004,6 +3009,7 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,
struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc);
if (acrtc->stream) {
dc_stream_retain(acrtc->stream);
dm_state->set[dm_state->set_count].stream = acrtc->stream;
crtc_set[dm_state->set_count] = crtc;
++dm_state->set_count;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment