[PATCH 25/31] drm/amd/display: Move output transfer function to stream updates

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Amy Zhang <Amy.Zhang@xxxxxxx>

Change-Id: I110d0986279259a912c3b44545fbde52091b4690
Signed-off-by: Amy Zhang <Amy.Zhang at amd.com>
Reviewed-by: Anthony Koo <Anthony.Koo at amd.com>
Acked-by: Harry Wentland <Harry.Wentland at amd.com>
---
 drivers/gpu/drm/amd/display/dc/core/dc.c           | 46 ++++++++++++++--------
 drivers/gpu/drm/amd/display/dc/dc.h                | 14 +++----
 .../amd/display/dc/dce110/dce110_hw_sequencer.c    |  1 -
 .../drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c  |  4 +-
 drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h  |  1 -
 5 files changed, 37 insertions(+), 29 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c
index 3c2554381a25..1e6952bde25b 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc.c
@@ -201,11 +201,10 @@ static bool stream_get_crtc_position(struct dc *dc,
 	return ret;
 }
 
-static bool set_gamut_remap(struct dc *dc,
-			const struct dc_stream **stream, int num_streams)
+static bool set_gamut_remap(struct dc *dc, const struct dc_stream *stream)
 {
 	struct core_dc *core_dc = DC_TO_CORE(dc);
-	struct core_stream *core_stream = DC_STREAM_TO_CORE(stream[0]);
+	struct core_stream *core_stream = DC_STREAM_TO_CORE(stream);
 	int i = 0;
 	bool ret = false;
 	struct pipe_ctx *pipes;
@@ -1182,7 +1181,6 @@ static enum surface_update_type det_surface_update(
 		overall_type = type;
 
 	if (u->in_transfer_func ||
-		u->out_transfer_func ||
 		u->hdr_static_metadata) {
 		if (overall_type < UPDATE_TYPE_MED)
 			overall_type = UPDATE_TYPE_MED;
@@ -1279,8 +1277,28 @@ void dc_update_surfaces_and_stream(struct dc *dc,
 
 	/* update current stream with the new updates */
 	if (stream_update) {
-		stream->public.src = stream_update->src;
-		stream->public.dst = stream_update->dst;
+		if ((stream_update->src.height != 0) &&
+				(stream_update->src.width != 0))
+			stream->public.src = stream_update->src;
+
+		if ((stream_update->dst.height != 0) &&
+				(stream_update->dst.width != 0))
+			stream->public.dst = stream_update->dst;
+
+		if (stream_update->out_transfer_func &&
+				stream_update->out_transfer_func !=
+				dc_stream->out_transfer_func) {
+			if (stream_update->out_transfer_func->type !=
+					TF_TYPE_UNKNOWN) {
+				if (dc_stream->out_transfer_func != NULL)
+					dc_transfer_func_release
+					(dc_stream->out_transfer_func);
+				dc_transfer_func_retain(stream_update->
+					out_transfer_func);
+				stream->public.out_transfer_func =
+					stream_update->out_transfer_func;
+			}
+		}
 	}
 
 	/* save update parameters into surface */
@@ -1361,13 +1379,6 @@ void dc_update_surfaces_and_stream(struct dc *dc,
 					srf_updates[i].in_transfer_func;
 		}
 
-		if (srf_updates[i].out_transfer_func &&
-			srf_updates[i].out_transfer_func != dc_stream->out_transfer_func) {
-			if (dc_stream->out_transfer_func != NULL)
-				dc_transfer_func_release(dc_stream->out_transfer_func);
-			dc_transfer_func_retain(srf_updates[i].out_transfer_func);
-			stream->public.out_transfer_func = srf_updates[i].out_transfer_func;
-		}
 		if (srf_updates[i].hdr_static_metadata)
 			surface->public.hdr_static_ctx =
 				*(srf_updates[i].hdr_static_metadata);
@@ -1436,11 +1447,12 @@ void dc_update_surfaces_and_stream(struct dc *dc,
 						pipe_ctx, pipe_ctx->surface);
 
 			if (is_new_pipe_surface ||
-					srf_updates[i].out_transfer_func)
+				(stream_update != NULL &&
+					stream_update->out_transfer_func !=
+							NULL)) {
 				core_dc->hwss.set_output_transfer_func(
-						pipe_ctx,
-						pipe_ctx->surface,
-						pipe_ctx->stream);
+						pipe_ctx, pipe_ctx->stream);
+			}
 
 			if (srf_updates[i].hdr_static_metadata) {
 				resource_build_info_frame(pipe_ctx);
diff --git a/drivers/gpu/drm/amd/display/dc/dc.h b/drivers/gpu/drm/amd/display/dc/dc.h
index c7e503a91f45..7dd145b6e927 100644
--- a/drivers/gpu/drm/amd/display/dc/dc.h
+++ b/drivers/gpu/drm/amd/display/dc/dc.h
@@ -122,7 +122,7 @@ struct dc_stream_funcs {
 			const struct rect *dst);
 
 	bool (*set_gamut_remap)(struct dc *dc,
-			const struct dc_stream **stream, int num_streams);
+			const struct dc_stream *stream);
 
 	void (*set_static_screen_events)(struct dc *dc,
 			const struct dc_stream **stream,
@@ -265,7 +265,8 @@ struct dc_hdr_static_metadata {
 enum dc_transfer_func_type {
 	TF_TYPE_PREDEFINED,
 	TF_TYPE_DISTRIBUTED_POINTS,
-	TF_TYPE_BYPASS
+	TF_TYPE_BYPASS,
+	TF_TYPE_UNKNOWN
 };
 
 struct dc_transfer_func_distributed_points {
@@ -349,11 +350,8 @@ struct dc_surface_update {
 	 */
 	/* gamma TO BE REMOVED */
 	struct dc_gamma *gamma;
-	struct dc_hdr_static_metadata *hdr_static_metadata;
 	struct dc_transfer_func *in_transfer_func;
-	struct dc_transfer_func *out_transfer_func;
-
-
+	struct dc_hdr_static_metadata *hdr_static_metadata;
 };
 /*
  * This structure is filled in by dc_surface_get_status and contains
@@ -473,11 +471,9 @@ struct dc_stream {
 };
 
 struct dc_stream_update {
-
 	struct rect src;
-
 	struct rect dst;
-
+	struct dc_transfer_func *out_transfer_func;
 };
 
 
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 150c8a4e7b61..8a663003017c 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
@@ -631,7 +631,6 @@ static bool dce110_translate_regamma_to_hw_format(const struct dc_transfer_func
 
 static bool dce110_set_output_transfer_func(
 	struct pipe_ctx *pipe_ctx,
-	const struct core_surface *surface, /* Surface - To be removed */
 	const struct core_stream *stream)
 {
 	struct output_pixel_processor *opp = pipe_ctx->opp;
diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c
index f5638ad6e9fc..6cb3924225da 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c
@@ -1301,11 +1301,13 @@ static bool dcn10_translate_regamma_to_hw_format(const struct dc_transfer_func
 
 static bool dcn10_set_output_transfer_func(
 	struct pipe_ctx *pipe_ctx,
-	const struct core_surface *surface,
 	const struct core_stream *stream)
 {
 	struct output_pixel_processor *opp = pipe_ctx->opp;
 
+	if (opp == NULL)
+		return false;
+
 	opp->regamma_params.hw_points_num = GAMMA_HW_POINTS_NUM;
 
 	if (stream->public.out_transfer_func &&
diff --git a/drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h b/drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h
index afdb8605a30f..b53e1206dfb3 100644
--- a/drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h
+++ b/drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h
@@ -80,7 +80,6 @@ struct hw_sequencer_funcs {
 
 	bool (*set_output_transfer_func)(
 				struct pipe_ctx *pipe_ctx,
-				const struct core_surface *surface,
 				const struct core_stream *stream);
 
 	void (*power_down)(struct core_dc *dc);
-- 
2.11.0



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux