Skip to content

Commit 3705217

Browse files
Dillon Varonealexdeucher
authored andcommitted
drm/amd/display: Backup and restore plane configuration only on update
[WHY&HOW] When backing up and restoring plane states for minimal transition cases, only configuration should be backed up and restored. Information only relevant to the object/allocation (like refcount) should be excluded. Also move this interface to dc_plane.h. Reviewed-by: Aurabindo Pillai <[email protected]> Signed-off-by: Dillon Varone <[email protected]> Signed-off-by: Ray Wu <[email protected]> Tested-by: Daniel Wheeler <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 0a5c060 commit 3705217

File tree

3 files changed

+20
-5
lines changed

3 files changed

+20
-5
lines changed

drivers/gpu/drm/amd/display/dc/core/dc.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#include "resource.h"
3737
#include "dc_state.h"
3838
#include "dc_state_priv.h"
39+
#include "dc_plane.h"
3940
#include "dc_plane_priv.h"
4041
#include "dc_stream_priv.h"
4142

@@ -3320,7 +3321,7 @@ static void backup_planes_and_stream_state(
33203321
return;
33213322

33223323
for (i = 0; i < status->plane_count; i++) {
3323-
scratch->plane_states[i] = *status->plane_states[i];
3324+
dc_plane_copy_config(&scratch->plane_states[i], status->plane_states[i]);
33243325
}
33253326
scratch->stream_state = *stream;
33263327
}
@@ -3336,10 +3337,7 @@ static void restore_planes_and_stream_state(
33363337
return;
33373338

33383339
for (i = 0; i < status->plane_count; i++) {
3339-
/* refcount will always be valid, restore everything else */
3340-
struct kref refcount = status->plane_states[i]->refcount;
3341-
*status->plane_states[i] = scratch->plane_states[i];
3342-
status->plane_states[i]->refcount = refcount;
3340+
dc_plane_copy_config(status->plane_states[i], &scratch->plane_states[i]);
33433341
}
33443342
*stream = scratch->stream_state;
33453343
}

drivers/gpu/drm/amd/display/dc/core/dc_surface.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,3 +294,17 @@ void dc_plane_force_dcc_and_tiling_disable(struct dc_plane_state *plane_state,
294294
dc->hwss.clear_surface_dcc_and_tiling(pipe_ctx, plane_state, clear_tiling);
295295
}
296296
}
297+
298+
void dc_plane_copy_config(struct dc_plane_state *dst, const struct dc_plane_state *src)
299+
{
300+
struct kref temp_refcount;
301+
302+
/* backup persistent info */
303+
memcpy(&temp_refcount, &dst->refcount, sizeof(struct kref));
304+
305+
/* copy all configuration information */
306+
memcpy(dst, src, sizeof(struct dc_plane_state));
307+
308+
/* restore persistent info */
309+
memcpy(&dst->refcount, &temp_refcount, sizeof(struct kref));
310+
}

drivers/gpu/drm/amd/display/dc/dc_plane.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,7 @@ void dc_plane_state_release(struct dc_plane_state *plane_state);
3737
void dc_plane_force_dcc_and_tiling_disable(struct dc_plane_state *plane_state,
3838
bool clear_tiling);
3939

40+
41+
void dc_plane_copy_config(struct dc_plane_state *dst, const struct dc_plane_state *src);
42+
4043
#endif /* _DC_PLANE_H_ */

0 commit comments

Comments
 (0)