提交 4c92c92d 编写于 作者: A Andrey Grodzovsky 提交者: Alex Deucher

drm/amd/display: Get rid of get_dm_commit_action

Use drm_atomic_crtc_needs_modeset instead.
Signed-off-by: NAndrey Grodzovsky <Andrey.Grodzovsky@amd.com>
Reviewed-by: NHarry Wentland <Harry.Wentland@amd.com>
Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
上级 afdbd4cc
...@@ -2164,57 +2164,23 @@ int amdgpu_dm_encoder_init( ...@@ -2164,57 +2164,23 @@ int amdgpu_dm_encoder_init(
return res; return res;
} }
enum dm_commit_action { static bool modeset_required(struct drm_crtc_state *crtc_state)
DM_COMMIT_ACTION_NOTHING,
DM_COMMIT_ACTION_RESET,
DM_COMMIT_ACTION_DPMS_ON,
DM_COMMIT_ACTION_DPMS_OFF,
DM_COMMIT_ACTION_SET
};
static enum dm_commit_action get_dm_commit_action(struct drm_crtc_state *state)
{ {
/* mode changed means either actually mode changed or enabled changed */ if (!drm_atomic_crtc_needs_modeset(crtc_state))
/* active changed means dpms changed */ return false;
DRM_DEBUG_KMS("crtc_state_flags: enable:%d, active:%d, planes_changed:%d, mode_changed:%d,active_changed:%d,connectors_changed:%d\n",
state->enable,
state->active,
state->planes_changed,
state->mode_changed,
state->active_changed,
state->connectors_changed);
if (state->mode_changed) {
/* if it is got disabled - call reset mode */
if (!state->enable)
return DM_COMMIT_ACTION_RESET;
if (state->active) if (!crtc_state->enable)
return DM_COMMIT_ACTION_SET; return false;
else
return DM_COMMIT_ACTION_RESET;
} else {
/* ! mode_changed */
/* if it is remain disable - skip it */ return crtc_state->active;
if (!state->enable) }
return DM_COMMIT_ACTION_NOTHING;
if (state->active && state->connectors_changed) static bool modereset_required(struct drm_crtc_state *crtc_state)
return DM_COMMIT_ACTION_SET; {
if (!drm_atomic_crtc_needs_modeset(crtc_state))
return false;
if (state->active_changed) { return !crtc_state->enable || !crtc_state->active;
if (state->active) {
return DM_COMMIT_ACTION_DPMS_ON;
} else {
return DM_COMMIT_ACTION_DPMS_OFF;
}
} else {
/* ! active_changed */
return DM_COMMIT_ACTION_NOTHING;
}
}
} }
static void manage_dm_interrupts( static void manage_dm_interrupts(
...@@ -2467,12 +2433,10 @@ void amdgpu_dm_atomic_commit_tail( ...@@ -2467,12 +2433,10 @@ void amdgpu_dm_atomic_commit_tail(
struct drm_connector_state *old_conn_state; struct drm_connector_state *old_conn_state;
drm_atomic_helper_update_legacy_modeset_state(dev, state); drm_atomic_helper_update_legacy_modeset_state(dev, state);
/* update changed items */ /* update changed items */
for_each_crtc_in_state(state, crtc, old_crtc_state, i) { for_each_crtc_in_state(state, crtc, old_crtc_state, i) {
struct amdgpu_crtc *acrtc; struct amdgpu_crtc *acrtc;
struct amdgpu_connector *aconnector = NULL; struct amdgpu_connector *aconnector = NULL;
enum dm_commit_action action;
struct drm_crtc_state *new_state = crtc->state; struct drm_crtc_state *new_state = crtc->state;
acrtc = to_amdgpu_crtc(crtc); acrtc = to_amdgpu_crtc(crtc);
...@@ -2483,15 +2447,23 @@ void amdgpu_dm_atomic_commit_tail( ...@@ -2483,15 +2447,23 @@ void amdgpu_dm_atomic_commit_tail(
crtc, crtc,
false); false);
DRM_DEBUG_KMS(
"amdgpu_crtc id:%d crtc_state_flags: enable:%d, active:%d, "
"planes_changed:%d, mode_changed:%d,active_changed:%d,"
"connectors_changed:%d\n",
acrtc->crtc_id,
new_state->enable,
new_state->active,
new_state->planes_changed,
new_state->mode_changed,
new_state->active_changed,
new_state->connectors_changed);
/* handles headless hotplug case, updating new_state and /* handles headless hotplug case, updating new_state and
* aconnector as needed * aconnector as needed
*/ */
action = get_dm_commit_action(new_state); if (modeset_required(new_state)) {
switch (action) {
case DM_COMMIT_ACTION_DPMS_ON:
case DM_COMMIT_ACTION_SET: {
struct dm_connector_state *dm_state = NULL; struct dm_connector_state *dm_state = NULL;
new_stream = NULL; new_stream = NULL;
...@@ -2541,21 +2513,13 @@ void amdgpu_dm_atomic_commit_tail( ...@@ -2541,21 +2513,13 @@ void amdgpu_dm_atomic_commit_tail(
acrtc->enabled = true; acrtc->enabled = true;
acrtc->hw_mode = crtc->state->mode; acrtc->hw_mode = crtc->state->mode;
crtc->hwmode = crtc->state->mode; crtc->hwmode = crtc->state->mode;
} else if (modereset_required(new_state)) {
break;
}
case DM_COMMIT_ACTION_DPMS_OFF:
case DM_COMMIT_ACTION_RESET:
DRM_INFO("Atomic commit: RESET. crtc id %d:[%p]\n", acrtc->crtc_id, acrtc); DRM_INFO("Atomic commit: RESET. crtc id %d:[%p]\n", acrtc->crtc_id, acrtc);
/* i.e. reset mode */ /* i.e. reset mode */
if (acrtc->stream) if (acrtc->stream)
remove_stream(adev, acrtc); remove_stream(adev, acrtc);
break; }
/*TODO retire */
case DM_COMMIT_ACTION_NOTHING:
continue;
} /* switch() */
} /* for_each_crtc_in_state() */ } /* for_each_crtc_in_state() */
/* Handle scaling and undersacn changes*/ /* Handle scaling and undersacn changes*/
...@@ -2569,8 +2533,7 @@ void amdgpu_dm_atomic_commit_tail( ...@@ -2569,8 +2533,7 @@ void amdgpu_dm_atomic_commit_tail(
const struct dc_stream_status *status = NULL; const struct dc_stream_status *status = NULL;
/* Skip any modesets/resets */ /* Skip any modesets/resets */
if (!acrtc || if (!acrtc || drm_atomic_crtc_needs_modeset(acrtc->base.state))
get_dm_commit_action(acrtc->base.state) != DM_COMMIT_ACTION_NOTHING)
continue; continue;
/* Skip any thing not scale or underscan chnages */ /* Skip any thing not scale or underscan chnages */
...@@ -2966,17 +2929,25 @@ int amdgpu_dm_atomic_check(struct drm_device *dev, ...@@ -2966,17 +2929,25 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,
for_each_crtc_in_state(state, crtc, crtc_state, i) { for_each_crtc_in_state(state, crtc, crtc_state, i) {
struct amdgpu_crtc *acrtc = NULL; struct amdgpu_crtc *acrtc = NULL;
struct amdgpu_connector *aconnector = NULL; struct amdgpu_connector *aconnector = NULL;
enum dm_commit_action action;
acrtc = to_amdgpu_crtc(crtc); acrtc = to_amdgpu_crtc(crtc);
aconnector = amdgpu_dm_find_first_crct_matching_connector(state, crtc, true); aconnector = amdgpu_dm_find_first_crct_matching_connector(state, crtc, true);
action = get_dm_commit_action(crtc_state); DRM_DEBUG_KMS(
"amdgpu_crtc id:%d crtc_state_flags: enable:%d, active:%d, "
"planes_changed:%d, mode_changed:%d,active_changed:%d,"
"connectors_changed:%d\n",
acrtc->crtc_id,
crtc_state->enable,
crtc_state->active,
crtc_state->planes_changed,
crtc_state->mode_changed,
crtc_state->active_changed,
crtc_state->connectors_changed);
if (modeset_required(crtc_state)) {
switch (action) {
case DM_COMMIT_ACTION_DPMS_ON:
case DM_COMMIT_ACTION_SET: {
struct dc_stream *new_stream = NULL; struct dc_stream *new_stream = NULL;
struct drm_connector_state *conn_state = NULL; struct drm_connector_state *conn_state = NULL;
struct dm_connector_state *dm_state = NULL; struct dm_connector_state *dm_state = NULL;
...@@ -3014,11 +2985,9 @@ int amdgpu_dm_atomic_check(struct drm_device *dev, ...@@ -3014,11 +2985,9 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,
new_stream_count++; new_stream_count++;
need_to_validate = true; need_to_validate = true;
wait_for_prev_commits = true; wait_for_prev_commits = true;
break;
}
case DM_COMMIT_ACTION_DPMS_OFF: } else if (modereset_required(crtc_state)) {
case DM_COMMIT_ACTION_RESET:
/* i.e. reset mode */ /* i.e. reset mode */
if (acrtc->stream) { if (acrtc->stream) {
set_count = remove_from_val_sets( set_count = remove_from_val_sets(
...@@ -3027,11 +2996,6 @@ int amdgpu_dm_atomic_check(struct drm_device *dev, ...@@ -3027,11 +2996,6 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,
acrtc->stream); acrtc->stream);
wait_for_prev_commits = true; wait_for_prev_commits = true;
} }
break;
/*TODO retire */
case DM_COMMIT_ACTION_NOTHING:
continue;
} }
/* /*
...@@ -3059,8 +3023,7 @@ int amdgpu_dm_atomic_check(struct drm_device *dev, ...@@ -3059,8 +3023,7 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,
struct dc_stream *new_stream; struct dc_stream *new_stream;
/* Skip any modesets/resets */ /* Skip any modesets/resets */
if (!acrtc || if (!acrtc || drm_atomic_crtc_needs_modeset(acrtc->base.state))
get_dm_commit_action(acrtc->base.state) != DM_COMMIT_ACTION_NOTHING)
continue; continue;
/* Skip any thing not scale or underscan chnages */ /* Skip any thing not scale or underscan chnages */
...@@ -3098,7 +3061,6 @@ int amdgpu_dm_atomic_check(struct drm_device *dev, ...@@ -3098,7 +3061,6 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,
struct drm_framebuffer *fb = plane_state->fb; struct drm_framebuffer *fb = plane_state->fb;
struct drm_connector *connector; struct drm_connector *connector;
struct dm_connector_state *dm_state = NULL; struct dm_connector_state *dm_state = NULL;
enum dm_commit_action action;
struct drm_crtc_state *crtc_state; struct drm_crtc_state *crtc_state;
bool pflip_needed; bool pflip_needed;
...@@ -3107,7 +3069,6 @@ int amdgpu_dm_atomic_check(struct drm_device *dev, ...@@ -3107,7 +3069,6 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,
!crtc->state->planes_changed || !crtc->state->active) !crtc->state->planes_changed || !crtc->state->active)
continue; continue;
action = get_dm_commit_action(crtc->state);
crtc_state = drm_atomic_get_crtc_state(state, crtc); crtc_state = drm_atomic_get_crtc_state(state, crtc);
pflip_needed = !state->allow_modeset; pflip_needed = !state->allow_modeset;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册