Commit 89a1fc59 authored by Andrey Grodzovsky's avatar Andrey Grodzovsky Committed by Alex Deucher

drm/amd/display: Update atomic state hooks.

Reimplement atomic_state_alloc and atomic_state_clear to
release validate_ctx.
Signed-off-by: default avatarAndrey Grodzovsky <Andrey.Grodzovsky@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 e2c7bb12
...@@ -648,33 +648,29 @@ dm_atomic_state_alloc(struct drm_device *dev) ...@@ -648,33 +648,29 @@ dm_atomic_state_alloc(struct drm_device *dev)
return &state->base; return &state->base;
} }
void dm_atomic_state_clear(struct drm_atomic_state *s)
{
struct dm_atomic_state *state = to_dm_atomic_state(s);
drm_atomic_state_default_clear(&state->base);
}
static void dm_atomic_state_free(struct drm_atomic_state *state) void dm_atomic_state_clear(struct drm_atomic_state *state)
{ {
struct dm_atomic_state *dm_state = to_dm_atomic_state(state); struct dm_atomic_state *dm_state = to_dm_atomic_state(state);
int i, j; int i, j;
drm_atomic_state_default_release(state);
for (i = 0; i < dm_state->set_count; i++) { for (i = 0; i < dm_state->set_count; i++) {
for (j = 0; j < dm_state->set[i].surface_count; j++) { for (j = 0; j < dm_state->set[i].surface_count; j++) {
dc_surface_release(dm_state->set[i].surfaces[j]); dc_surface_release(dm_state->set[i].surfaces[j]);
dm_state->set[i].surfaces[j] = NULL;
} }
}
for (i = 0; i < dm_state->set_count; i++)
dc_stream_release(dm_state->set[i].stream); dc_stream_release(dm_state->set[i].stream);
dm_state->set[i].stream = NULL;
}
dm_state->set_count = 0;
kfree(dm_state); dc_resource_validate_ctx_destruct(dm_state->context);
} dm_free(dm_state->context);
dm_state->context = NULL;
drm_atomic_state_default_clear(state);
}
static const struct drm_mode_config_funcs amdgpu_dm_mode_funcs = { static const struct drm_mode_config_funcs amdgpu_dm_mode_funcs = {
.fb_create = amdgpu_user_framebuffer_create, .fb_create = amdgpu_user_framebuffer_create,
...@@ -683,7 +679,6 @@ static const struct drm_mode_config_funcs amdgpu_dm_mode_funcs = { ...@@ -683,7 +679,6 @@ static const struct drm_mode_config_funcs amdgpu_dm_mode_funcs = {
.atomic_commit = drm_atomic_helper_commit, .atomic_commit = drm_atomic_helper_commit,
.atomic_state_alloc = dm_atomic_state_alloc, .atomic_state_alloc = dm_atomic_state_alloc,
.atomic_state_clear = dm_atomic_state_clear, .atomic_state_clear = dm_atomic_state_clear,
.atomic_state_free = dm_atomic_state_free,
}; };
static struct drm_mode_config_helper_funcs amdgpu_dm_mode_config_helperfuncs = { static struct drm_mode_config_helper_funcs amdgpu_dm_mode_config_helperfuncs = {
......
...@@ -2695,6 +2695,7 @@ void amdgpu_dm_atomic_commit_tail( ...@@ -2695,6 +2695,7 @@ void amdgpu_dm_atomic_commit_tail(
/* DC is optimized not to do anything if 'streams' didn't change. */ /* DC is optimized not to do anything if 'streams' didn't change. */
WARN_ON(!dc_commit_context(dm->dc, dm_state->context)); WARN_ON(!dc_commit_context(dm->dc, dm_state->context));
list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc); struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc);
...@@ -3069,7 +3070,6 @@ int amdgpu_dm_atomic_check(struct drm_device *dev, ...@@ -3069,7 +3070,6 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,
__func__, acrtc->base.base.id); __func__, acrtc->base.base.id);
break; break;
} }
new_stream->priv = acrtc;
new_streams[new_stream_count] = new_stream; new_streams[new_stream_count] = new_stream;
dm_state->set_count = update_in_val_sets_stream( dm_state->set_count = update_in_val_sets_stream(
......
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