On 2017-10-16 06:51 PM, andrey wrote: > > > On 2017-10-16 04:31 PM, Harry Wentland wrote: >> This function likes to blow 1024 stack size when something is >> added to the addr struct. For now just dynamically allocate. >> >> Signed-off-by: Harry Wentland <harry.wentland at amd.com> >> Reviewed-by: Tony Cheng <Tony.Cheng at amd.com> >> Acked-by: Harry Wentland <Harry.Wentland at amd.com> >> --- >> Â drivers/gpu/drm/amd/display/dc/core/dc.c | 19 +++++++++++++------ >> Â 1 file changed, 13 insertions(+), 6 deletions(-) >> >> diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c >> index ff6bd384aece..7a0593d4ca62 100644 >> --- a/drivers/gpu/drm/amd/display/dc/core/dc.c >> +++ b/drivers/gpu/drm/amd/display/dc/core/dc.c >> @@ -926,9 +926,9 @@ bool dc_commit_planes_to_stream( >> Â Â Â Â Â Â Â Â Â struct dc_state *state) >> Â { >> Â Â Â Â Â struct dc_surface_update updates[MAX_SURFACES]; > > Why this one is left on the stack then ? This one is just tracking a bunch of pointers to more flip_addr, plane_info, and scaling_info structs, so it's quite small. This whole function is quite ugly and eventually needs to go anyways, along with that whole dc_surface_update struct. Harry > > Thanks, > Andrey > >> -Â Â Â struct dc_flip_addrs flip_addr[MAX_SURFACES]; >> -Â Â Â struct dc_plane_info plane_info[MAX_SURFACES]; >> -Â Â Â struct dc_scaling_info scaling_info[MAX_SURFACES]; >> +Â Â Â struct dc_flip_addrs *flip_addr; >> +Â Â Â struct dc_plane_info *plane_info; >> +Â Â Â struct dc_scaling_info *scaling_info; >> Â Â Â Â Â int i; >> Â Â Â Â Â struct dc_stream_update *stream_update = >> Â Â Â Â Â Â Â Â Â Â Â Â Â kzalloc(sizeof(struct dc_stream_update), GFP_KERNEL); >> @@ -938,10 +938,14 @@ bool dc_commit_planes_to_stream( >> Â Â Â Â Â Â Â Â Â return false; >> Â Â Â Â Â } >> Â +Â Â Â flip_addr = kcalloc(MAX_SURFACES, sizeof(struct dc_flip_addrs), >> +Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â GFP_KERNEL); >> +Â Â Â plane_info = kcalloc(MAX_SURFACES, sizeof(struct dc_plane_info), >> +Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â GFP_KERNEL); >> +Â Â Â scaling_info = kcalloc(MAX_SURFACES, sizeof(struct dc_scaling_info), >> +Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â GFP_KERNEL); >> + >> Â Â Â Â Â memset(updates, 0, sizeof(updates)); >> -Â Â Â memset(flip_addr, 0, sizeof(flip_addr)); >> -Â Â Â memset(plane_info, 0, sizeof(plane_info)); >> -Â Â Â memset(scaling_info, 0, sizeof(scaling_info)); >> Â Â Â Â Â Â stream_update->src = dc_stream->src; >> Â Â Â Â Â stream_update->dst = dc_stream->dst; >> @@ -980,6 +984,9 @@ bool dc_commit_planes_to_stream( >> Â Â Â Â Â Â Â Â Â Â Â Â Â new_plane_count, >> Â Â Â Â Â Â Â Â Â Â Â Â Â dc_stream, stream_update, plane_states, state); >> Â +Â Â Â kfree(flip_addr); >> +Â Â Â kfree(plane_info); >> +Â Â Â kfree(scaling_info); >> Â Â Â Â Â kfree(stream_update); >> Â Â Â Â Â return true; >> Â } >