[PATCH 089/120] drm/amd/display: Move audio to stream_res

Harry Wentland harry.wentland at amd.com
Wed Aug 9 15:02:15 UTC 2017


find -name Makefile -o -name Kconfig -o -name "*.c" -o -name "*.h" \
-o -name "*.cpp" -o -name "*.hpp" | \
xargs sed -i 's/pipes->audio/pipes->stream_res\.audio/g'

find -name Makefile -o -name Kconfig -o -name "*.c" -o -name "*.h" \
-o -name "*.cpp" -o -name "*.hpp" | \
xargs sed -i
's/pipe_with_clk_src->audio/pipe_with_clk_src->stream_res\.audio/g'

find -name Makefile -o -name Kconfig -o -name "*.c" -o -name "*.h" \
-o -name "*.cpp" -o -name "*.hpp" | \
xargs sed -i 's/ctx->audio->/ctx->stream_res\.audio->/g'

find -name Makefile -o -name Kconfig -o -name "*.c" -o -name "*.h" \
-o -name "*.cpp" -o -name "*.hpp" | \
xargs sed -i 's/pipe->audio/pipe->stream_res\.audio/g'

find -name Makefile -o -name Kconfig -o -name "*.c" -o -name "*.h" \
-o -name "*.cpp" -o -name "*.hpp" | \
xargs sed -i 's/pipe_ctx->audio/pipe_ctx->stream_res\.audio/g'

find -name Makefile -o -name Kconfig -o -name "*.c" -o -name "*.h" \
-o -name "*.cpp" -o -name "*.hpp" | \
xargs sed -i \
's/pipe_ctx\[pipe_offset\]\.audio/pipe_ctx\[pipe_offset\]\.stream_res\.audio/g'

find -name Makefile -o -name Kconfig -o -name "*.c" -o -name "*.h" \
-o -name "*.cpp" -o -name "*.hpp" | \
xargs sed -i \
's/grouped_pipes\[i\]->audio/grouped_pipes\[i\]->stream_^Cs\.audio/g'

find -name Makefile -o -name Kconfig -o -name "*.c" -o -name "*.h" \
-o -name "*.cpp" -o -name "*.hpp" | \
xargs sed -i \
's/grouped_pipes\[0\]->audio/grouped_pipes\[0\]->stream_res\.audio/g'

find -name Makefile -o -name Kconfig -o -name "*.c" -o -name "*.h" \
-o -name "*.cpp" -o -name "*.hpp" | \
xargs sed -i \
's/grouped_pipes\[1\]->audio/grouped_pipes\[1\]->stream_res\.audio/g'

find -name Makefile -o -name Kconfig -o -name "*.c" -o -name "*.h" \
-o -name "*.cpp" -o -name "*.hpp" | \
xargs sed -i \
's/pipe_ctx\[i\]->audio/pipe_ctx\[i\]->stream_res\.audio/g'

find -name Makefile -o -name Kconfig -o -name "*.c" -o -name "*.h" \
-o -name "*.cpp" -o -name "*.hpp" | \
xargs sed -i \
's/pipe_ctx_old->audio/pipe_ctx_old->stream_res\.audio/g'

find -name Makefile -o -name Kconfig -o -name "*.c" -o -name "*.h" \
-o -name "*.cpp" -o -name "*.hpp" | \
xargs sed -i \
's/pipe_set\[j\]->audio/pipe_set\[j\]->stream_res\.audio/g'

find -name Makefile -o -name Kconfig -o -name "*.c" -o -name "*.h" \
-o -name "*.cpp" -o -name "*.hpp" | \
xargs sed -i \
's/pipe_ctx\[i\]\.audio/pipe_ctx\[i\]\.stream_res\.audio/g'

find -name Makefile -o -name Kconfig -o -name "*.c" -o -name "*.h" \
-o -name "*.cpp" -o -name "*.hpp" | \
xargs sed -i \
's/pipes\[i\]\.audio/pipes\[i\]\.stream_res\.audio/g'

Change-Id: Id1d6c2964a58bbfc051b4ba57bbb6660fad5240d
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_link.c      |  4 +--
 drivers/gpu/drm/amd/display/dc/core/dc_resource.c  | 12 ++++----
 .../amd/display/dc/dce110/dce110_hw_sequencer.c    | 32 +++++++++++-----------
 drivers/gpu/drm/amd/display/dc/inc/core_types.h    |  3 +-
 4 files changed, 25 insertions(+), 26 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link.c b/drivers/gpu/drm/amd/display/dc/core/dc_link.c
index 6a3d2ad97d5d..9665fc127fe2 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_link.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_link.c
@@ -1305,9 +1305,9 @@ static enum dc_status enable_link(struct pipe_ctx *pipe_ctx)
 		break;
 	}
 
-	if (pipe_ctx->audio && status == DC_OK) {
+	if (pipe_ctx->stream_res.audio && status == DC_OK) {
 		/* notify audio driver for audio modes of monitor */
-		pipe_ctx->audio->funcs->az_enable(pipe_ctx->audio);
+		pipe_ctx->stream_res.audio->funcs->az_enable(pipe_ctx->stream_res.audio);
 
 		/* un-mute audio */
 		/* TODO: audio should be per stream rather than per link */
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
index 31a3535fc2de..8bfaca7524b3 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
@@ -1097,7 +1097,7 @@ bool resource_attach_surfaces_to_context(
 			free_pipe->stream_res.tg = tail_pipe->stream_res.tg;
 			free_pipe->stream_res.opp = tail_pipe->stream_res.opp;
 			free_pipe->stream_res.stream_enc = tail_pipe->stream_res.stream_enc;
-			free_pipe->audio = tail_pipe->audio;
+			free_pipe->stream_res.audio = tail_pipe->stream_res.audio;
 			free_pipe->clock_source = tail_pipe->clock_source;
 			free_pipe->top_pipe = tail_pipe;
 			tail_pipe->bottom_pipe = free_pipe;
@@ -1481,7 +1481,7 @@ enum dc_status resource_map_pool_resources(
 				pipe_ctx->clock_source);
 
 			set_audio_in_use(&context->res_ctx, pool,
-					pipe_ctx->audio);
+					pipe_ctx->stream_res.audio);
 		}
 	}
 
@@ -1518,7 +1518,7 @@ enum dc_status resource_map_pool_resources(
 		if (!stream->sink->converter_disable_audio &&
 			dc_is_audio_capable_signal(pipe_ctx->stream->signal) &&
 			stream->audio_info.mode_count) {
-			pipe_ctx->audio = find_first_free_audio(
+			pipe_ctx->stream_res.audio = find_first_free_audio(
 				&context->res_ctx, pool);
 
 			/*
@@ -1526,10 +1526,10 @@ enum dc_status resource_map_pool_resources(
 			 * There are asics which has number of audio
 			 * resources less then number of pipes
 			 */
-			if (pipe_ctx->audio)
+			if (pipe_ctx->stream_res.audio)
 				set_audio_in_use(
 					&context->res_ctx, pool,
-					pipe_ctx->audio);
+					pipe_ctx->stream_res.audio);
 		}
 
 		context->stream_status[i].primary_otg_inst = pipe_ctx->stream_res.tg->inst;
@@ -2375,7 +2375,7 @@ bool pipe_need_reprogram(
 	if (pipe_ctx_old->stream->signal != pipe_ctx->stream->signal)
 		return true;
 
-	if (pipe_ctx_old->audio != pipe_ctx->audio)
+	if (pipe_ctx_old->stream_res.audio != pipe_ctx->stream_res.audio)
 		return true;
 
 	if (pipe_ctx_old->clock_source != pipe_ctx->clock_source
diff --git a/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c b/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c
index 48d151039fe8..ef5d496656e5 100644
--- a/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c
+++ b/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c
@@ -729,7 +729,7 @@ void dce110_enable_stream(struct pipe_ctx *pipe_ctx)
 	tg->funcs->set_early_control(tg, early_control);
 
 	/* enable audio only within mode set */
-	if (pipe_ctx->audio != NULL) {
+	if (pipe_ctx->stream_res.audio != NULL) {
 		if (dc_is_dp_signal(pipe_ctx->stream->signal))
 			pipe_ctx->stream_res.stream_enc->funcs->dp_audio_enable(pipe_ctx->stream_res.stream_enc);
 	}
@@ -748,8 +748,8 @@ void dce110_disable_stream(struct pipe_ctx *pipe_ctx)
 	struct dc_stream_state *stream = pipe_ctx->stream;
 	struct dc_link *link = stream->sink->link;
 
-	if (pipe_ctx->audio) {
-		pipe_ctx->audio->funcs->az_disable(pipe_ctx->audio);
+	if (pipe_ctx->stream_res.audio) {
+		pipe_ctx->stream_res.audio->funcs->az_disable(pipe_ctx->stream_res.audio);
 
 		if (dc_is_dp_signal(pipe_ctx->stream->signal))
 			pipe_ctx->stream_res.stream_enc->funcs->dp_audio_disable(
@@ -758,7 +758,7 @@ void dce110_disable_stream(struct pipe_ctx *pipe_ctx)
 			pipe_ctx->stream_res.stream_enc->funcs->hdmi_audio_disable(
 					pipe_ctx->stream_res.stream_enc);
 
-		pipe_ctx->audio = NULL;
+		pipe_ctx->stream_res.audio = NULL;
 
 		/* TODO: notify audio driver for if audio modes list changed
 		 * add audio mode list change flag */
@@ -1094,7 +1094,7 @@ static enum dc_status apply_single_controller_ctx_to_hw(
 			pipe_ctx->stream_res.stream_enc,
 			&stream->timing,
 			stream->phy_pix_clk,
-			pipe_ctx->audio != NULL);
+			pipe_ctx->stream_res.audio != NULL);
 
 	if (dc_is_dvi_signal(pipe_ctx->stream->signal))
 		pipe_ctx->stream_res.stream_enc->funcs->dvi_set_stream_attribute(
@@ -1792,13 +1792,13 @@ enum dc_status dce110_apply_ctx_to_hw(
 		if (pipe_ctx->stream->signal != SIGNAL_TYPE_HDMI_TYPE_A)
 			continue;
 
-		if (pipe_ctx->audio != NULL) {
+		if (pipe_ctx->stream_res.audio != NULL) {
 			struct audio_output audio_output;
 
 			build_audio_output(pipe_ctx, &audio_output);
 
-			pipe_ctx->audio->funcs->wall_dto_setup(
-				pipe_ctx->audio,
+			pipe_ctx->stream_res.audio->funcs->wall_dto_setup(
+				pipe_ctx->stream_res.audio,
 				pipe_ctx->stream->signal,
 				&audio_output.crtc_info,
 				&audio_output.pll_info);
@@ -1820,13 +1820,13 @@ enum dc_status dce110_apply_ctx_to_hw(
 			if (!dc_is_dp_signal(pipe_ctx->stream->signal))
 				continue;
 
-			if (pipe_ctx->audio != NULL) {
+			if (pipe_ctx->stream_res.audio != NULL) {
 				struct audio_output audio_output;
 
 				build_audio_output(pipe_ctx, &audio_output);
 
-				pipe_ctx->audio->funcs->wall_dto_setup(
-					pipe_ctx->audio,
+				pipe_ctx->stream_res.audio->funcs->wall_dto_setup(
+					pipe_ctx->stream_res.audio,
 					pipe_ctx->stream->signal,
 					&audio_output.crtc_info,
 					&audio_output.pll_info);
@@ -1853,7 +1853,7 @@ enum dc_status dce110_apply_ctx_to_hw(
 		if (pipe_ctx->top_pipe)
 			continue;
 
-		if (context->res_ctx.pipe_ctx[i].audio != NULL) {
+		if (context->res_ctx.pipe_ctx[i].stream_res.audio != NULL) {
 
 			struct audio_output audio_output;
 
@@ -1862,17 +1862,17 @@ enum dc_status dce110_apply_ctx_to_hw(
 			if (dc_is_dp_signal(pipe_ctx->stream->signal))
 				pipe_ctx->stream_res.stream_enc->funcs->dp_audio_setup(
 						pipe_ctx->stream_res.stream_enc,
-						pipe_ctx->audio->inst,
+						pipe_ctx->stream_res.audio->inst,
 						&pipe_ctx->stream->audio_info);
 			else
 				pipe_ctx->stream_res.stream_enc->funcs->hdmi_audio_setup(
 						pipe_ctx->stream_res.stream_enc,
-						pipe_ctx->audio->inst,
+						pipe_ctx->stream_res.audio->inst,
 						&pipe_ctx->stream->audio_info,
 						&audio_output.crtc_info);
 
-			pipe_ctx->audio->funcs->az_configure(
-					pipe_ctx->audio,
+			pipe_ctx->stream_res.audio->funcs->az_configure(
+					pipe_ctx->stream_res.audio,
 					pipe_ctx->stream->signal,
 					&audio_output.crtc_info,
 					&pipe_ctx->stream->audio_info);
diff --git a/drivers/gpu/drm/amd/display/dc/inc/core_types.h b/drivers/gpu/drm/amd/display/dc/inc/core_types.h
index 4d35c6d120a7..6f09653ac2cb 100644
--- a/drivers/gpu/drm/amd/display/dc/inc/core_types.h
+++ b/drivers/gpu/drm/amd/display/dc/inc/core_types.h
@@ -156,6 +156,7 @@ struct stream_resource {
 	struct output_pixel_processor *opp;
 	struct timing_generator *tg;
 	struct stream_encoder *stream_enc;
+	struct audio *audio;
 };
 
 struct plane_resource {
@@ -176,8 +177,6 @@ struct pipe_ctx {
 	struct display_clock *dis_clk;
 	struct clock_source *clock_source;
 
-	struct audio *audio;
-
 	struct pixel_clk_params pix_clk_params;
 	struct pll_settings pll_settings;
 
-- 
2.11.0



More information about the amd-gfx mailing list