drm/amd/display: Add correct retain/release

Needed by objs in dm_atomic_state

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
Harry Wentland 2017-03-03 14:50:00 -05:00 committed by Alex Deucher
parent a6818a3231
commit b29fc8661d
2 changed files with 16 additions and 0 deletions

View file

@ -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);
}

View file

@ -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;