Skip to content

Commit

Permalink
drm/amd/display: Add writeback enable field (wb_enabled)
Browse files Browse the repository at this point in the history
[WHAT]
Add a new field to keep track whether a crtc is previously
writeback-enabled.

Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
  • Loading branch information
Alex Hung authored and Alex Deucher committed Oct 3, 2023
1 parent 5b89d2c commit f6893fc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,7 @@ struct amdgpu_crtc {
struct drm_pending_vblank_event *event;

bool wb_pending;
bool wb_enabled;
struct drm_writeback_connector *wb_conn;
};

Expand Down
8 changes: 8 additions & 0 deletions drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
Original file line number Diff line number Diff line change
Expand Up @@ -8732,9 +8732,13 @@ static void amdgpu_dm_commit_streams(struct drm_atomic_state *state,
if (acrtc)
old_crtc_state = drm_atomic_get_old_crtc_state(state, &acrtc->base);

if (!acrtc->wb_enabled)
continue;

dm_old_crtc_state = to_dm_crtc_state(old_crtc_state);

dm_clear_writeback(dm, dm_old_crtc_state);
acrtc->wb_enabled = false;
}

for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state,
Expand Down Expand Up @@ -9312,9 +9316,13 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state)
if (acrtc)
new_crtc_state = drm_atomic_get_new_crtc_state(state, &acrtc->base);

if (acrtc->wb_enabled)
continue;

dm_new_crtc_state = to_dm_crtc_state(new_crtc_state);

dm_set_writeback(dm, dm_new_crtc_state, connector, new_con_state);
acrtc->wb_enabled = true;
}

/* Update audio instances for each connector. */
Expand Down

0 comments on commit f6893fc

Please sign in to comment.