All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/10] DC Patches Dec 29, 2016
@ 2016-12-29 18:29 Harry Wentland
       [not found] ` <20161229182943.16087-1-harry.wentland-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 1 reply; 14+ messages in thread
From: Harry Wentland @ 2016-12-29 18:29 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Harry Wentland

* Some bug fixes
* Bunch of debug options to disable functionality during bringup

Andrew Wong (1):
  drm/amd/display: DAL3: HDR10 Infoframe encoding

Anthony Koo (1):
  drm/amd/display: Fix color module crash when hotplug monitors.

Harry Wentland (1):
  drm/amd/display: Don't use target before null check

Hersen Wu (2):
  drm/amd/display: Add missing function to fix crush for DP Test pattern
    4
  drm/amd/display: set HBR3 and TPS4 capable flags

Tony Cheng (4):
  drm/amd/display: Allow multiple instance of DTO regs
  drm/amd/display: debug opt disable hdmi deep color
  drm/amd/display: debug option to disable color module fucntionality
  drm/amd/display: enable option to disable HDR related updates.

Yongqiang Sun (1):
  drm/amd/display: Set gamma to NULL at release

 drivers/gpu/drm/amd/display/dc/core/dc.c           |  25 +-
 drivers/gpu/drm/amd/display/dc/core/dc_resource.c  | 115 ++++++-
 drivers/gpu/drm/amd/display/dc/core/dc_stream.c    |   1 -
 drivers/gpu/drm/amd/display/dc/core/dc_surface.c   |  11 +-
 drivers/gpu/drm/amd/display/dc/core/dc_target.c    |  10 +-
 drivers/gpu/drm/amd/display/dc/dc.h                |  27 +-
 .../gpu/drm/amd/display/dc/dce/dce_clock_source.h  |  10 +-
 .../gpu/drm/amd/display/dc/dce/dce_link_encoder.c  |  16 +
 .../drm/amd/display/dc/dce/dce_stream_encoder.c    |  20 +-
 .../gpu/drm/amd/display/dc/inc/hw/stream_encoder.h |   2 +
 .../drm/amd/display/include/hw_sequencer_types.h   |   3 +-
 drivers/gpu/drm/amd/display/modules/color/color.c  | 333 ++++++++++++---------
 .../gpu/drm/amd/display/modules/inc/mod_color.h    |  20 +-
 13 files changed, 403 insertions(+), 190 deletions(-)

-- 
2.9.3

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 01/10] drm/amd/display: Allow multiple instance of DTO regs
       [not found] ` <20161229182943.16087-1-harry.wentland-5C7GfCeVMHo@public.gmane.org>
@ 2016-12-29 18:29   ` Harry Wentland
  2016-12-29 18:29   ` [PATCH 02/10] drm/amd/display: DAL3: HDR10 Infoframe encoding Harry Wentland
                     ` (8 subsequent siblings)
  9 siblings, 0 replies; 14+ messages in thread
From: Harry Wentland @ 2016-12-29 18:29 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Tony Cheng

From: Tony Cheng <tony.cheng@amd.com>

Change-Id: I9b1aee0a58a25e91a5bc8cf60fa4b2bb25a1b4c4
Signed-off-by: Tony Cheng <tony.cheng@amd.com>
Reviewed-by: Jordan Lazare <Jordan.Lazare@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
---
 drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.h | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.h b/drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.h
index 8ee00712ef8e..28984c79fc46 100644
--- a/drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.h
+++ b/drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.h
@@ -76,9 +76,13 @@ struct dce110_clk_src_regs {
 	uint32_t RESYNC_CNTL;
 	uint32_t PIXCLK_RESYNC_CNTL;
 	uint32_t PLL_CNTL;
-	uint32_t PHASE;
-	uint32_t MODULO;
-	uint32_t PIXEL_RATE_CNTL;
+
+	/* below are for DTO.
+	 * todo: should probably use different struct to not waste space
+	 */
+	uint32_t PHASE[4];
+	uint32_t MODULO[4];
+	uint32_t PIXEL_RATE_CNTL[4];
 };
 
 struct dce110_clk_src {
-- 
2.9.3

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 02/10] drm/amd/display: DAL3: HDR10 Infoframe encoding
       [not found] ` <20161229182943.16087-1-harry.wentland-5C7GfCeVMHo@public.gmane.org>
  2016-12-29 18:29   ` [PATCH 01/10] drm/amd/display: Allow multiple instance of DTO regs Harry Wentland
@ 2016-12-29 18:29   ` Harry Wentland
       [not found]     ` <20161229182943.16087-3-harry.wentland-5C7GfCeVMHo@public.gmane.org>
  2016-12-29 18:29   ` [PATCH 03/10] drm/amd/display: debug opt disable hdmi deep color Harry Wentland
                     ` (7 subsequent siblings)
  9 siblings, 1 reply; 14+ messages in thread
From: Harry Wentland @ 2016-12-29 18:29 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Andrew Wong

From: Andrew Wong <andrew.wong1@amd.com>

- Add HDR metadata struct
- Add register programming calculations
- Added HDR metadata to surface and update_surface
- Add HDR info packet programming for DP port

Change-Id: I1a802c44b5486ada7141d0cff95917e0afbc4c59
Signed-off-by: Andrew Wong <andrew.wong1@amd.com>
Reviewed-by: Aric Cyr <Aric.Cyr@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
---
 drivers/gpu/drm/amd/display/dc/core/dc.c           |   7 ++
 drivers/gpu/drm/amd/display/dc/core/dc_resource.c  | 115 ++++++++++++++++++++-
 drivers/gpu/drm/amd/display/dc/core/dc_stream.c    |   1 -
 drivers/gpu/drm/amd/display/dc/core/dc_surface.c   |   2 +
 drivers/gpu/drm/amd/display/dc/dc.h                |  23 ++++-
 .../drm/amd/display/dc/dce/dce_stream_encoder.c    |  20 +++-
 .../gpu/drm/amd/display/dc/inc/hw/stream_encoder.h |   2 +
 .../drm/amd/display/include/hw_sequencer_types.h   |   3 +-
 drivers/gpu/drm/amd/display/modules/color/color.c  |  16 +--
 .../gpu/drm/amd/display/modules/inc/mod_color.h    |  20 +---
 10 files changed, 176 insertions(+), 33 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c
index 5e60640df61b..e368d660362f 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc.c
@@ -1489,6 +1489,9 @@ void dc_update_surfaces_for_target(struct dc *dc, struct dc_surface_update *upda
 				stream->public.out_transfer_func =
 						updates[i].out_transfer_func;
 			}
+			if (updates[i].hdr_static_metadata)
+				surface->public.hdr_static_ctx =
+					*(updates[i].hdr_static_metadata);
 		}
 	}
 
@@ -1522,6 +1525,10 @@ void dc_update_surfaces_for_target(struct dc *dc, struct dc_surface_update *upda
 				}
 			}
 
+			if (updates[i].hdr_static_metadata) {
+				resource_build_info_frame(pipe_ctx);
+				core_dc->hwss.update_info_frame(pipe_ctx);
+			}
 			if (is_new_pipe_surface[j] ||
 					updates[i].in_transfer_func)
 				core_dc->hwss.set_input_transfer_func(
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 386b3cc14fbe..2b08f5ae5e33 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
@@ -32,7 +32,6 @@
 #include "timing_generator.h"
 #include "transform.h"
 #include "set_mode_types.h"
-
 #include "virtual/virtual_stream_encoder.h"
 
 #include "dce80/dce80_resource.h"
@@ -1303,6 +1302,13 @@ static void translate_info_frame(const struct hw_info_frame *hw_info_frame,
 						&hw_info_frame->vsc_packet,
 						sizeof(struct hw_info_packet));
 	}
+
+	if (hw_info_frame->hdrsmd_packet.valid) {
+		memmove(
+						&encoder_info_frame->hdrsmd,
+						&hw_info_frame->hdrsmd_packet,
+						sizeof(struct hw_info_packet));
+	}
 }
 
 static void set_avi_info_frame(
@@ -1720,6 +1726,108 @@ static void set_spd_info_packet(struct core_stream *stream,
 	info_packet->valid = true;
 }
 
+static void set_hdr_static_info_packet(
+		struct core_surface *surface,
+		struct core_stream *stream,
+		struct hw_info_packet *info_packet)
+{
+	uint16_t i;
+	enum signal_type signal = stream->signal;
+
+	if (!surface)
+		return;
+
+	struct dc_hdr_static_metadata hdr_metadata =
+			surface->public.hdr_static_ctx;
+
+	if (dc_is_hdmi_signal(signal)) {
+		info_packet->valid = true;
+
+		info_packet->hb0 = 0x87;
+		info_packet->hb1 = 0x01;
+		info_packet->hb2 = 0x1A;
+		i = 1;
+	} else if (dc_is_dp_signal(signal)) {
+		info_packet->valid = true;
+
+		info_packet->hb0 = 0x00;
+		info_packet->hb1 = 0x87;
+		info_packet->hb2 = 0x1D;
+		info_packet->hb3 = (0x13 << 2);
+		i = 2;
+	}
+
+	uint32_t data;
+
+	data = hdr_metadata.is_hdr;
+	info_packet->sb[i++] = data ? 0x02 : 0x00;
+	info_packet->sb[i++] = 0x00;
+
+	data = hdr_metadata.chromaticity_green_x / 2;
+	info_packet->sb[i++] = data & 0xFF;
+	info_packet->sb[i++] = (data & 0xFF00) >> 8;
+
+	data = hdr_metadata.chromaticity_green_y / 2;
+	info_packet->sb[i++] = data & 0xFF;
+	info_packet->sb[i++] = (data & 0xFF00) >> 8;
+
+	data = hdr_metadata.chromaticity_blue_x / 2;
+	info_packet->sb[i++] = data & 0xFF;
+	info_packet->sb[i++] = (data & 0xFF00) >> 8;
+
+	data = hdr_metadata.chromaticity_blue_y / 2;
+	info_packet->sb[i++] = data & 0xFF;
+	info_packet->sb[i++] = (data & 0xFF00) >> 8;
+
+	data = hdr_metadata.chromaticity_red_x / 2;
+	info_packet->sb[i++] = data & 0xFF;
+	info_packet->sb[i++] = (data & 0xFF00) >> 8;
+
+	data = hdr_metadata.chromaticity_red_y / 2;
+	info_packet->sb[i++] = data & 0xFF;
+	info_packet->sb[i++] = (data & 0xFF00) >> 8;
+
+	data = hdr_metadata.chromaticity_white_point_x / 2;
+	info_packet->sb[i++] = data & 0xFF;
+	info_packet->sb[i++] = (data & 0xFF00) >> 8;
+
+	data = hdr_metadata.chromaticity_white_point_y / 2;
+	info_packet->sb[i++] = data & 0xFF;
+	info_packet->sb[i++] = (data & 0xFF00) >> 8;
+
+	data = hdr_metadata.max_luminance;
+	info_packet->sb[i++] = data & 0xFF;
+	info_packet->sb[i++] = (data & 0xFF00) >> 8;
+
+	data = hdr_metadata.min_luminance;
+	info_packet->sb[i++] = data & 0xFF;
+	info_packet->sb[i++] = (data & 0xFF00) >> 8;
+
+	data = hdr_metadata.maximum_content_light_level;
+	info_packet->sb[i++] = data & 0xFF;
+	info_packet->sb[i++] = (data & 0xFF00) >> 8;
+
+	data = hdr_metadata.maximum_frame_average_light_level;
+	info_packet->sb[i++] = data & 0xFF;
+	info_packet->sb[i++] = (data & 0xFF00) >> 8;
+
+	if (dc_is_hdmi_signal(signal)) {
+		uint32_t checksum = 0;
+
+		checksum += info_packet->hb0;
+		checksum += info_packet->hb1;
+		checksum += info_packet->hb2;
+
+		for (i = 1; i <= info_packet->hb2; i++)
+			checksum += info_packet->sb[i];
+
+		info_packet->sb[0] = 0x100 - checksum;
+	} else if (dc_is_dp_signal(signal)) {
+		info_packet->sb[0] = 0x01;
+		info_packet->sb[1] = 0x1A;
+	}
+}
+
 static void set_vsc_info_packet(struct core_stream *stream,
 		struct hw_info_packet *info_packet)
 {
@@ -1830,6 +1938,7 @@ void resource_build_info_frame(struct pipe_ctx *pipe_ctx)
 	info_frame.vendor_info_packet.valid = false;
 	info_frame.spd_packet.valid = false;
 	info_frame.vsc_packet.valid = false;
+	info_frame.hdrsmd_packet.valid = false;
 
 	signal = pipe_ctx->stream->signal;
 
@@ -1840,9 +1949,13 @@ void resource_build_info_frame(struct pipe_ctx *pipe_ctx)
 		set_vendor_info_packet(
 			pipe_ctx->stream, &info_frame.vendor_info_packet);
 		set_spd_info_packet(pipe_ctx->stream, &info_frame.spd_packet);
+		set_hdr_static_info_packet(pipe_ctx->surface,
+				pipe_ctx->stream, &info_frame.hdrsmd_packet);
 	} else if (dc_is_dp_signal(signal)) {
 		set_vsc_info_packet(pipe_ctx->stream, &info_frame.vsc_packet);
 		set_spd_info_packet(pipe_ctx->stream, &info_frame.spd_packet);
+		set_hdr_static_info_packet(pipe_ctx->surface,
+				pipe_ctx->stream, &info_frame.hdrsmd_packet);
 	}
 
 	translate_info_frame(&info_frame,
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_stream.c b/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
index 39a6124aa85f..cda67a78dbfd 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
@@ -82,7 +82,6 @@ static bool construct(struct core_stream *stream,
 	stream->public.timing.flags.LTE_340MCSC_SCRAMBLE = dc_sink_data->edid_caps.lte_340mcsc_scramble;
 
 	stream->status.link = &stream->sink->link->public;
-
 	return true;
 }
 
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_surface.c b/drivers/gpu/drm/amd/display/dc/core/dc_surface.c
index 6b4c75a78fe8..d962baa477f5 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_surface.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_surface.c
@@ -66,6 +66,8 @@ struct transfer_func {
 static bool construct(struct dc_context *ctx, struct surface *surface)
 {
 	surface->protected.ctx = ctx;
+	memset(&surface->protected.public.hdr_static_ctx,
+			0, sizeof(struct dc_hdr_static_metadata));
 	return true;
 }
 
diff --git a/drivers/gpu/drm/amd/display/dc/dc.h b/drivers/gpu/drm/amd/display/dc/dc.h
index 0ee6f41b6047..ef9a69759bd5 100644
--- a/drivers/gpu/drm/amd/display/dc/dc.h
+++ b/drivers/gpu/drm/amd/display/dc/dc.h
@@ -186,6 +186,25 @@ enum {
 	TRANSFER_FUNC_POINTS = 1025
 };
 
+struct dc_hdr_static_metadata {
+	bool is_hdr;
+
+	/* display chromaticities and white point in units of 0.00001 */
+	unsigned int chromaticity_green_x;
+	unsigned int chromaticity_green_y;
+	unsigned int chromaticity_blue_x;
+	unsigned int chromaticity_blue_y;
+	unsigned int chromaticity_red_x;
+	unsigned int chromaticity_red_y;
+	unsigned int chromaticity_white_point_x;
+	unsigned int chromaticity_white_point_y;
+
+	uint32_t min_luminance;
+	uint32_t max_luminance;
+	uint32_t maximum_content_light_level;
+	uint32_t maximum_frame_average_light_level;
+};
+
 enum dc_transfer_func_type {
 	TF_TYPE_PREDEFINED,
 	TF_TYPE_DISTRIBUTED_POINTS,
@@ -232,6 +251,8 @@ struct dc_surface {
 	bool horizontal_mirror;
 	enum plane_stereo_format stereo_format;
 
+	struct dc_hdr_static_metadata hdr_static_ctx;
+
 	const struct dc_gamma *gamma_correction;
 	const struct dc_transfer_func *in_transfer_func;
 };
@@ -267,7 +288,7 @@ 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;
 
diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_stream_encoder.c b/drivers/gpu/drm/amd/display/dc/dce/dce_stream_encoder.c
index b74a29b40a66..82133ab3224d 100644
--- a/drivers/gpu/drm/amd/display/dc/dce/dce_stream_encoder.c
+++ b/drivers/gpu/drm/amd/display/dc/dce/dce_stream_encoder.c
@@ -518,6 +518,7 @@ static void dce110_stream_encoder_update_hdmi_info_packets(
 		dce110_update_hdmi_info_packet(enc110, 0, &info_frame->vendor);
 		dce110_update_hdmi_info_packet(enc110, 1, &info_frame->gamut);
 		dce110_update_hdmi_info_packet(enc110, 2, &info_frame->spd);
+		dce110_update_hdmi_info_packet(enc110, 3, &info_frame->hdrsmd);
 	}
 
 }
@@ -554,16 +555,25 @@ static void dce110_stream_encoder_update_dp_info_packets(
 	struct dce110_stream_encoder *enc110 = DCE110STRENC_FROM_STRENC(enc);
 	uint32_t value = REG_READ(DP_SEC_CNTL);
 
-	if (info_frame->vsc.valid)
-		dce110_update_generic_info_packet(
+	dce110_update_generic_info_packet(
+				enc110,
+				0,  /* packetIndex */
+				&info_frame->vsc);
+	dce110_update_generic_info_packet(
+			enc110,
+			2,  /* packetIndex */
+			&info_frame->spd);
+	dce110_update_generic_info_packet(
 			enc110,
-			0,  /* packetIndex */
-			&info_frame->vsc);
+			3,  /* packetIndex */
+			&info_frame->hdrsmd);
 
 	/* enable/disable transmission of packet(s).
 	*  If enabled, packet transmission begins on the next frame
 	*/
-		REG_UPDATE(DP_SEC_CNTL, DP_SEC_GSP0_ENABLE, info_frame->vsc.valid);
+	REG_UPDATE(DP_SEC_CNTL, DP_SEC_GSP0_ENABLE, info_frame->vsc.valid);
+	REG_UPDATE(DP_SEC_CNTL, DP_SEC_GSP2_ENABLE, info_frame->spd.valid);
+	REG_UPDATE(DP_SEC_CNTL, DP_SEC_GSP3_ENABLE, info_frame->hdrsmd.valid);
 
 	/* This bit is the master enable bit.
 	* When enabling secondary stream engine,
diff --git a/drivers/gpu/drm/amd/display/dc/inc/hw/stream_encoder.h b/drivers/gpu/drm/amd/display/dc/inc/hw/stream_encoder.h
index 9caf2b365420..8b4a30459eeb 100644
--- a/drivers/gpu/drm/amd/display/dc/inc/hw/stream_encoder.h
+++ b/drivers/gpu/drm/amd/display/dc/inc/hw/stream_encoder.h
@@ -31,6 +31,8 @@ struct encoder_info_frame {
 	struct encoder_info_packet spd;
 	/* video stream configuration */
 	struct encoder_info_packet vsc;
+	/* HDR Static MetaData */
+	struct encoder_info_packet hdrsmd;
 };
 
 struct encoder_unblank_param {
diff --git a/drivers/gpu/drm/amd/display/include/hw_sequencer_types.h b/drivers/gpu/drm/amd/display/include/hw_sequencer_types.h
index 9a78097e70f3..6bbca1b4d736 100644
--- a/drivers/gpu/drm/amd/display/include/hw_sequencer_types.h
+++ b/drivers/gpu/drm/amd/display/include/hw_sequencer_types.h
@@ -88,7 +88,7 @@ struct hw_info_packet {
 	uint8_t hb1;
 	uint8_t hb2;
 	uint8_t hb3;
-	uint8_t sb[28];
+	uint8_t sb[32];
 };
 
 struct hw_info_frame {
@@ -100,6 +100,7 @@ struct hw_info_frame {
 	struct hw_info_packet spd_packet;
 	/* Video Stream Configuration */
 	struct hw_info_packet vsc_packet;
+	struct hw_info_packet hdrsmd_packet;
 };
 
 #endif
diff --git a/drivers/gpu/drm/amd/display/modules/color/color.c b/drivers/gpu/drm/amd/display/modules/color/color.c
index 5c578aecf21c..599d9f9aa7ca 100644
--- a/drivers/gpu/drm/amd/display/modules/color/color.c
+++ b/drivers/gpu/drm/amd/display/modules/color/color.c
@@ -74,7 +74,7 @@ struct color_state {
 	struct color_gamut_data destination_gamut;
 	enum color_transfer_func input_transfer_function;
 	enum color_transfer_func output_transfer_function;
-	struct color_mastering_info mastering_info;
+	struct dc_hdr_static_metadata mastering_info;
 };
 
 struct core_color {
@@ -1970,7 +1970,7 @@ bool mod_color_set_white_point(struct mod_color *mod_color,
 
 bool mod_color_set_mastering_info(struct mod_color *mod_color,
 		const struct dc_stream **streams, int num_streams,
-		struct color_mastering_info *mastering_info)
+		const struct dc_hdr_static_metadata *mastering_info)
 {
 	struct core_color *core_color = MOD_COLOR_TO_CORE(mod_color);
 	unsigned int stream_index, sink_index;
@@ -1980,14 +1980,14 @@ bool mod_color_set_mastering_info(struct mod_color *mod_color,
 				streams[stream_index]->sink);
 		memcpy(&core_color->state[sink_index].mastering_info,
 				mastering_info,
-				sizeof(struct color_mastering_info));
+				sizeof(struct dc_hdr_static_metadata));
 	}
 	return true;
 }
 
 bool mod_color_get_mastering_info(struct mod_color *mod_color,
 		const struct dc_sink *sink,
-		struct color_mastering_info *mastering_info)
+		struct dc_hdr_static_metadata *mastering_info)
 {
 	struct core_color *core_color =
 			MOD_COLOR_TO_CORE(mod_color);
@@ -1995,7 +1995,7 @@ bool mod_color_get_mastering_info(struct mod_color *mod_color,
 	unsigned int sink_index = sink_index_from_sink(core_color, sink);
 
 	memcpy(mastering_info, &core_color->state[sink_index].mastering_info,
-			sizeof(struct color_mastering_info));
+			sizeof(struct dc_hdr_static_metadata));
 
 	return true;
 }
@@ -2756,8 +2756,10 @@ bool mod_color_update_gamut_info(struct mod_color *mod_color,
 			else
 				output_tf->tf = TRANSFER_FUNCTION_SRGB;
 		}
+		/* 5. ---- POPULATE HDR METADATA ---- */
+		core_color->state[sink_index].mastering_info.is_hdr = is_hdr;
 
-		/* 5. ---- TODO: UPDATE INFOPACKETS ---- */
+		/* 6. ---- TODO: UPDATE INFOPACKETS ---- */
 
 		if (!mod_color_update_gamut_to_stream(
 				mod_color, streams, num_streams))
@@ -2769,6 +2771,8 @@ bool mod_color_update_gamut_info(struct mod_color *mod_color,
 		updates[0].gamma = core_color->state[sink_index].gamma;
 		updates[0].in_transfer_func = input_tf;
 		updates[0].out_transfer_func = output_tf;
+		updates[0].hdr_static_metadata =
+				&core_color->state[sink_index].mastering_info;
 
 		dc_update_surfaces_for_target(core_color->dc, updates, 1, NULL);
 
diff --git a/drivers/gpu/drm/amd/display/modules/inc/mod_color.h b/drivers/gpu/drm/amd/display/modules/inc/mod_color.h
index 670b87fb8bd2..70349a88916c 100644
--- a/drivers/gpu/drm/amd/display/modules/inc/mod_color.h
+++ b/drivers/gpu/drm/amd/display/modules/inc/mod_color.h
@@ -87,22 +87,6 @@ enum hdr_tf_support_flag {
 	smpte_st2084 = 0x04
 };
 
-struct color_mastering_info {
-	unsigned int chromaticity_green_x;
-	unsigned int chromaticity_green_y;
-	unsigned int chromaticity_blue_x;
-	unsigned int chromaticity_blue_y;
-	unsigned int chromaticity_red_x;
-	unsigned int chromaticity_red_y;
-	unsigned int chromaticity_white_point_x;
-	unsigned int chromaticity_white_point_y;
-
-	unsigned int min_luminance;
-	unsigned int max_luminance;
-	unsigned int maximum_content_light_level;
-	unsigned int maximum_frame_average_light_level;
-};
-
 struct mod_color {
 	int dummy;
 };
@@ -206,11 +190,11 @@ bool mod_color_get_user_enable(struct mod_color *mod_color,
 
 bool mod_color_set_mastering_info(struct mod_color *mod_color,
 		const struct dc_stream **streams, int num_streams,
-		struct color_mastering_info *mastering_info);
+		const struct dc_hdr_static_metadata *mastering_info);
 
 bool mod_color_get_mastering_info(struct mod_color *mod_color,
 		const struct dc_sink *sink,
-		struct color_mastering_info *mastering_info);
+		struct dc_hdr_static_metadata *mastering_info);
 
 bool mod_color_set_user_enable(struct mod_color *mod_color,
 		const struct dc_stream **streams, int num_streams,
-- 
2.9.3

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 03/10] drm/amd/display: debug opt disable hdmi deep color
       [not found] ` <20161229182943.16087-1-harry.wentland-5C7GfCeVMHo@public.gmane.org>
  2016-12-29 18:29   ` [PATCH 01/10] drm/amd/display: Allow multiple instance of DTO regs Harry Wentland
  2016-12-29 18:29   ` [PATCH 02/10] drm/amd/display: DAL3: HDR10 Infoframe encoding Harry Wentland
@ 2016-12-29 18:29   ` Harry Wentland
  2016-12-29 18:29   ` [PATCH 04/10] drm/amd/display: debug option to disable color module fucntionality Harry Wentland
                     ` (6 subsequent siblings)
  9 siblings, 0 replies; 14+ messages in thread
From: Harry Wentland @ 2016-12-29 18:29 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Tony Cheng

From: Tony Cheng <tony.cheng@amd.com>

Change-Id: I4eea27d2efd090253d8e2726d476371b3e8b2e60
Signed-off-by: Tony Cheng <tony.cheng@amd.com>
Reviewed-by: Yongqiang Sun <yongqiang.sun@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
---
 drivers/gpu/drm/amd/display/dc/dc.h                   | 1 +
 drivers/gpu/drm/amd/display/dc/dce/dce_link_encoder.c | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/amd/display/dc/dc.h b/drivers/gpu/drm/amd/display/dc/dc.h
index ef9a69759bd5..823a87224498 100644
--- a/drivers/gpu/drm/amd/display/dc/dc.h
+++ b/drivers/gpu/drm/amd/display/dc/dc.h
@@ -147,6 +147,7 @@ struct dc_debug {
 	bool disable_power_gate;
 	bool disable_clock_gate;
 	bool disable_dmcu;
+	bool disable_hdmi_deep_color;
 };
 
 struct dc {
diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_link_encoder.c b/drivers/gpu/drm/amd/display/dc/dce/dce_link_encoder.c
index a8a2290d47db..b439a9ee0228 100644
--- a/drivers/gpu/drm/amd/display/dc/dce/dce_link_encoder.c
+++ b/drivers/gpu/drm/amd/display/dc/dce/dce_link_encoder.c
@@ -993,6 +993,9 @@ bool dce110_link_encoder_construct(
 	enc110->base.features.max_deep_color = COLOR_DEPTH_121212;
 	enc110->base.features.max_hdmi_deep_color = COLOR_DEPTH_121212;
 
+	if (enc110->base.ctx->dc->debug.disable_hdmi_deep_color)
+		enc110->base.features.max_hdmi_deep_color = COLOR_DEPTH_888;
+
 	/* set the flag to indicate whether driver poll the I2C data pin
 	 * while doing the DP sink detect
 	 */
-- 
2.9.3

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 04/10] drm/amd/display: debug option to disable color module fucntionality
       [not found] ` <20161229182943.16087-1-harry.wentland-5C7GfCeVMHo@public.gmane.org>
                     ` (2 preceding siblings ...)
  2016-12-29 18:29   ` [PATCH 03/10] drm/amd/display: debug opt disable hdmi deep color Harry Wentland
@ 2016-12-29 18:29   ` Harry Wentland
  2016-12-29 18:29   ` [PATCH 05/10] drm/amd/display: Don't use target before null check Harry Wentland
                     ` (5 subsequent siblings)
  9 siblings, 0 replies; 14+ messages in thread
From: Harry Wentland @ 2016-12-29 18:29 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Tony Cheng

From: Tony Cheng <tony.cheng@amd.com>

Change-Id: I1793eeeff0e38d1b85cb64c0a1496dc5567cc526
Signed-off-by: Tony Cheng <tony.cheng@amd.com>
Reviewed-by: Yongqiang Sun <yongqiang.sun@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
---
 drivers/gpu/drm/amd/display/dc/core/dc.c | 13 +++++++------
 drivers/gpu/drm/amd/display/dc/dc.h      |  1 +
 2 files changed, 8 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 e368d660362f..aca13d1cd4bb 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc.c
@@ -1452,8 +1452,11 @@ void dc_update_surfaces_for_target(struct dc *dc, struct dc_surface_update *upda
 				}
 			}
 
-			if (updates[i].gamma && updates[i].gamma !=
-				surface->public.gamma_correction) {
+			if (dc->debug.disable_color_module)
+				continue;  /* skip below color updates */
+
+			if (updates[i].gamma &&
+				updates[i].gamma != surface->public.gamma_correction) {
 				if (surface->public.gamma_correction != NULL)
 					dc_gamma_release(surface->public.
 							gamma_correction);
@@ -1464,8 +1467,7 @@ void dc_update_surfaces_for_target(struct dc *dc, struct dc_surface_update *upda
 			}
 
 			if (updates[i].in_transfer_func &&
-					updates[i].in_transfer_func !=
-					surface->public.in_transfer_func) {
+				updates[i].in_transfer_func != surface->public.in_transfer_func) {
 				if (surface->public.in_transfer_func != NULL)
 					dc_transfer_func_release(
 							surface->public.
@@ -1478,8 +1480,7 @@ void dc_update_surfaces_for_target(struct dc *dc, struct dc_surface_update *upda
 			}
 
 			if (updates[i].out_transfer_func &&
-					updates[i].out_transfer_func !=
-					stream->public.out_transfer_func) {
+				updates[i].out_transfer_func != stream->public.out_transfer_func) {
 				if (stream->public.out_transfer_func != NULL)
 					dc_transfer_func_release(
 							stream->public.
diff --git a/drivers/gpu/drm/amd/display/dc/dc.h b/drivers/gpu/drm/amd/display/dc/dc.h
index 823a87224498..23f41b690c02 100644
--- a/drivers/gpu/drm/amd/display/dc/dc.h
+++ b/drivers/gpu/drm/amd/display/dc/dc.h
@@ -148,6 +148,7 @@ struct dc_debug {
 	bool disable_clock_gate;
 	bool disable_dmcu;
 	bool disable_hdmi_deep_color;
+	bool disable_color_module;
 };
 
 struct dc {
-- 
2.9.3

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 05/10] drm/amd/display: Don't use target before null check
       [not found] ` <20161229182943.16087-1-harry.wentland-5C7GfCeVMHo@public.gmane.org>
                     ` (3 preceding siblings ...)
  2016-12-29 18:29   ` [PATCH 04/10] drm/amd/display: debug option to disable color module fucntionality Harry Wentland
@ 2016-12-29 18:29   ` Harry Wentland
  2016-12-29 18:29   ` [PATCH 06/10] drm/amd/display: Add missing function to fix crush for DP Test pattern 4 Harry Wentland
                     ` (4 subsequent siblings)
  9 siblings, 0 replies; 14+ messages in thread
From: Harry Wentland @ 2016-12-29 18:29 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Harry Wentland

It might blow up.

Change-Id: If7ff505e8387477f0466ba1a0a19fe5967996ed1
Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
---
 drivers/gpu/drm/amd/display/dc/core/dc_target.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_target.c b/drivers/gpu/drm/amd/display/dc/core/dc_target.c
index d4ecf2da26d2..2d25b00b4bff 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_target.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_target.c
@@ -151,9 +151,9 @@ bool dc_target_set_cursor_attributes(
 	const struct dc_cursor_attributes *attributes)
 {
 	int i, j;
-	struct core_target *target = DC_TARGET_TO_CORE(dc_target);
-	struct core_dc *core_dc = DC_TO_CORE(target->ctx->dc);
-	struct resource_context *res_ctx = &core_dc->current_context->res_ctx;
+	struct core_target *target;
+	struct core_dc *core_dc;
+	struct resource_context *res_ctx;
 	bool ret = false;
 
 	if (NULL == dc_target) {
@@ -165,6 +165,10 @@ bool dc_target_set_cursor_attributes(
 			return false;
 	}
 
+	target = DC_TARGET_TO_CORE(dc_target);
+	core_dc = DC_TO_CORE(target->ctx->dc);
+	res_ctx = &core_dc->current_context->res_ctx;
+
 	for (i = 0; i < dc_target->stream_count; i++) {
 		const struct dc_stream *stream = dc_target->streams[i];
 
-- 
2.9.3

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 06/10] drm/amd/display: Add missing function to fix crush for DP Test pattern 4
       [not found] ` <20161229182943.16087-1-harry.wentland-5C7GfCeVMHo@public.gmane.org>
                     ` (4 preceding siblings ...)
  2016-12-29 18:29   ` [PATCH 05/10] drm/amd/display: Don't use target before null check Harry Wentland
@ 2016-12-29 18:29   ` Harry Wentland
  2016-12-29 18:29   ` [PATCH 07/10] drm/amd/display: Set gamma to NULL at release Harry Wentland
                     ` (3 subsequent siblings)
  9 siblings, 0 replies; 14+ messages in thread
From: Harry Wentland @ 2016-12-29 18:29 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Hersen Wu

From: Hersen Wu <hersenxs.wu@amd.com>

Change-Id: Iab93d455853f28eb3639f379ecf048dbc2b64b0e
Signed-off-by: Hersen Wu <hersenxs.wu@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
---
 drivers/gpu/drm/amd/display/dc/dce/dce_link_encoder.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_link_encoder.c b/drivers/gpu/drm/amd/display/dc/dce/dce_link_encoder.c
index b439a9ee0228..6481fb2028ee 100644
--- a/drivers/gpu/drm/amd/display/dc/dce/dce_link_encoder.c
+++ b/drivers/gpu/drm/amd/display/dc/dce/dce_link_encoder.c
@@ -1472,6 +1472,9 @@ void dce110_link_encoder_dp_set_phy_pattern(
 	case DP_TEST_PATTERN_TRAINING_PATTERN3:
 		dce110_link_encoder_set_dp_phy_pattern_training_pattern(enc, 2);
 		break;
+	case DP_TEST_PATTERN_TRAINING_PATTERN4:
+		dce110_link_encoder_set_dp_phy_pattern_training_pattern(enc, 3);
+		break;
 	case DP_TEST_PATTERN_D102:
 		set_dp_phy_pattern_d102(enc110);
 		break;
-- 
2.9.3

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 07/10] drm/amd/display: Set gamma to NULL at release
       [not found] ` <20161229182943.16087-1-harry.wentland-5C7GfCeVMHo@public.gmane.org>
                     ` (5 preceding siblings ...)
  2016-12-29 18:29   ` [PATCH 06/10] drm/amd/display: Add missing function to fix crush for DP Test pattern 4 Harry Wentland
@ 2016-12-29 18:29   ` Harry Wentland
  2016-12-29 18:29   ` [PATCH 08/10] drm/amd/display: set HBR3 and TPS4 capable flags Harry Wentland
                     ` (2 subsequent siblings)
  9 siblings, 0 replies; 14+ messages in thread
From: Harry Wentland @ 2016-12-29 18:29 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Yongqiang Sun

From: Yongqiang Sun <yongqiang.sun@amd.com>

Change-Id: Iff63270cf76bcd0cb8f76342df3d333425c89b85
Signed-off-by: Yongqiang Sun <yongqiang.sun@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
---
 drivers/gpu/drm/amd/display/dc/core/dc.c          | 2 +-
 drivers/gpu/drm/amd/display/dc/core/dc_surface.c  | 9 +++++----
 drivers/gpu/drm/amd/display/dc/dc.h               | 2 +-
 drivers/gpu/drm/amd/display/modules/color/color.c | 8 +++-----
 4 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c
index aca13d1cd4bb..12620df7056d 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc.c
@@ -1458,7 +1458,7 @@ void dc_update_surfaces_for_target(struct dc *dc, struct dc_surface_update *upda
 			if (updates[i].gamma &&
 				updates[i].gamma != surface->public.gamma_correction) {
 				if (surface->public.gamma_correction != NULL)
-					dc_gamma_release(surface->public.
+					dc_gamma_release(&surface->public.
 							gamma_correction);
 
 				dc_gamma_retain(updates[i].gamma);
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_surface.c b/drivers/gpu/drm/amd/display/dc/core/dc_surface.c
index d962baa477f5..d607972b830b 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_surface.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_surface.c
@@ -74,8 +74,7 @@ static bool construct(struct dc_context *ctx, struct surface *surface)
 static void destruct(struct surface *surface)
 {
 	if (surface->protected.public.gamma_correction != NULL) {
-		dc_gamma_release(surface->protected.public.gamma_correction);
-		surface->protected.public.gamma_correction = NULL;
+		dc_gamma_release(&surface->protected.public.gamma_correction);
 	}
 	if (surface->protected.public.in_transfer_func != NULL) {
 		dc_transfer_func_release(
@@ -189,15 +188,17 @@ void dc_gamma_retain(const struct dc_gamma *dc_gamma)
 	++gamma->ref_count;
 }
 
-void dc_gamma_release(const struct dc_gamma *dc_gamma)
+void dc_gamma_release(const struct dc_gamma **dc_gamma)
 {
-	struct gamma *gamma = DC_GAMMA_TO_GAMMA(dc_gamma);
+	struct gamma *gamma = DC_GAMMA_TO_GAMMA(*dc_gamma);
 
 	ASSERT(gamma->ref_count > 0);
 	--gamma->ref_count;
 
 	if (gamma->ref_count == 0)
 		dm_free(gamma);
+
+	*dc_gamma = NULL;
 }
 
 struct dc_gamma *dc_create_gamma()
diff --git a/drivers/gpu/drm/amd/display/dc/dc.h b/drivers/gpu/drm/amd/display/dc/dc.h
index 23f41b690c02..599f8b0894c2 100644
--- a/drivers/gpu/drm/amd/display/dc/dc.h
+++ b/drivers/gpu/drm/amd/display/dc/dc.h
@@ -318,7 +318,7 @@ void dc_surface_retain(const struct dc_surface *dc_surface);
 void dc_surface_release(const struct dc_surface *dc_surface);
 
 void dc_gamma_retain(const struct dc_gamma *dc_gamma);
-void dc_gamma_release(const struct dc_gamma *dc_gamma);
+void dc_gamma_release(const struct dc_gamma **dc_gamma);
 struct dc_gamma *dc_create_gamma(void);
 
 void dc_transfer_func_retain(const struct dc_transfer_func *dc_tf);
diff --git a/drivers/gpu/drm/amd/display/modules/color/color.c b/drivers/gpu/drm/amd/display/modules/color/color.c
index 599d9f9aa7ca..3611de90e1e9 100644
--- a/drivers/gpu/drm/amd/display/modules/color/color.c
+++ b/drivers/gpu/drm/amd/display/modules/color/color.c
@@ -1557,7 +1557,7 @@ void mod_color_destroy(struct mod_color *mod_color)
 
 		for (i = 0; i < core_color->num_sinks; i++)
 			if (core_color->state[i].gamma)
-				dc_gamma_release(core_color->state[i].gamma);
+				dc_gamma_release(&core_color->state[i].gamma);
 
 		dm_free(core_color->state);
 
@@ -1749,8 +1749,7 @@ bool mod_color_remove_sink(struct mod_color *mod_color,
 	for (i = 0; i < core_color->num_sinks; i++) {
 		if (core_color->caps[i].sink == sink) {
 			if (core_color->state[i].gamma) {
-				dc_gamma_release(core_color->state[i].gamma);
-				core_color->state[i].gamma = NULL;
+				dc_gamma_release(&core_color->state[i].gamma);
 			}
 
 			/* To remove this sink, shift everything after down */
@@ -2444,8 +2443,7 @@ bool mod_color_set_input_gamma_correction(struct mod_color *mod_color,
 			if (core_color->state[sink_index].gamma != gamma) {
 				if (core_color->state[sink_index].gamma)
 					dc_gamma_release(
-						core_color->state[sink_index].
-						gamma);
+						&core_color->state[sink_index].gamma);
 
 				dc_gamma_retain(gamma);
 				core_color->state[sink_index].gamma = gamma;
-- 
2.9.3

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 08/10] drm/amd/display: set HBR3 and TPS4 capable flags
       [not found] ` <20161229182943.16087-1-harry.wentland-5C7GfCeVMHo@public.gmane.org>
                     ` (6 preceding siblings ...)
  2016-12-29 18:29   ` [PATCH 07/10] drm/amd/display: Set gamma to NULL at release Harry Wentland
@ 2016-12-29 18:29   ` Harry Wentland
  2016-12-29 18:29   ` [PATCH 09/10] drm/amd/display: Fix color module crash when hotplug monitors Harry Wentland
  2016-12-29 18:29   ` [PATCH 10/10] drm/amd/display: enable option to disable HDR related updates Harry Wentland
  9 siblings, 0 replies; 14+ messages in thread
From: Harry Wentland @ 2016-12-29 18:29 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Hersen Wu

From: Hersen Wu <hersenxs.wu@amd.com>

Change-Id: Ibb7e6c05aca7fc1bd699238e16a82628286b25e0
Signed-off-by: Hersen Wu <hersenxs.wu@amd.com>
Reviewed-by: Zeyu Fan <Zeyu.Fan@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
---
 drivers/gpu/drm/amd/display/dc/dce/dce_link_encoder.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_link_encoder.c b/drivers/gpu/drm/amd/display/dc/dce/dce_link_encoder.c
index 6481fb2028ee..ea4778b6e6d8 100644
--- a/drivers/gpu/drm/amd/display/dc/dce/dce_link_encoder.c
+++ b/drivers/gpu/drm/amd/display/dc/dce/dce_link_encoder.c
@@ -1068,9 +1068,19 @@ bool dce110_link_encoder_construct(
 			&bp_cap_info))
 		enc110->base.features.flags.bits.IS_HBR2_CAPABLE =
 				bp_cap_info.DP_HBR2_CAP;
+		enc110->base.features.flags.bits.IS_HBR3_CAPABLE =
+				bp_cap_info.DP_HBR3_EN;
+
 	}
+
+	/* TODO: check PPLIB maxPhyClockInKHz <= 540000, if yes,
+	 * IS_HBR3_CAPABLE = 0.
+	 */
+
 	/* test pattern 3 support */
 	enc110->base.features.flags.bits.IS_TPS3_CAPABLE = true;
+	/* test pattern 4 support */
+	enc110->base.features.flags.bits.IS_TPS4_CAPABLE = true;
 
 	enc110->base.features.flags.bits.IS_Y_ONLY_CAPABLE = false;
 	/*
-- 
2.9.3

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 09/10] drm/amd/display: Fix color module crash when hotplug monitors.
       [not found] ` <20161229182943.16087-1-harry.wentland-5C7GfCeVMHo@public.gmane.org>
                     ` (7 preceding siblings ...)
  2016-12-29 18:29   ` [PATCH 08/10] drm/amd/display: set HBR3 and TPS4 capable flags Harry Wentland
@ 2016-12-29 18:29   ` Harry Wentland
  2016-12-29 18:29   ` [PATCH 10/10] drm/amd/display: enable option to disable HDR related updates Harry Wentland
  9 siblings, 0 replies; 14+ messages in thread
From: Harry Wentland @ 2016-12-29 18:29 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Anthony Koo

From: Anthony Koo <Anthony.Koo@amd.com>

Assume we have two monitors, and monitor 0 is unplugged.
This shifts the internal state of index 1 to index 0 by memcpy.
This means there are two copies of the gamma pointer previously
owned by state[1].

When hotplug occurs, this re-assigns the new display with state[1],
which has some garbage left over from before, including the
gamma pointer.

We should correctly clear unused states and re-initialize correctly.

Also, due to async nature of the hotplug and other events like commit,
we also need to safe guard against sink that has been removed.

Change-Id: I956782ed8d9b44d95e1905a131a0b9a257d35866
Signed-off-by: Anthony Koo <anthony.koo@amd.com>
Reviewed-by: Aric Cyr <Aric.Cyr@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
---
 drivers/gpu/drm/amd/display/modules/color/color.c | 309 ++++++++++++----------
 1 file changed, 175 insertions(+), 134 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/modules/color/color.c b/drivers/gpu/drm/amd/display/modules/color/color.c
index 3611de90e1e9..74298c8aad8d 100644
--- a/drivers/gpu/drm/amd/display/modules/color/color.c
+++ b/drivers/gpu/drm/amd/display/modules/color/color.c
@@ -643,10 +643,10 @@ static void initialize_fix_point_color_values(
 /* Given a specific dc_sink* this function finds its equivalent
  * on the dc_sink array and returns the corresponding index
  */
-static unsigned int sink_index_from_sink(struct core_color *core_color,
+static int sink_index_from_sink(struct core_color *core_color,
 		const struct dc_sink *sink)
 {
-	unsigned int index = 0;
+	int index = 0;
 
 	for (index = 0; index < core_color->num_sinks; index++)
 		if (core_color->caps[index].sink == sink)
@@ -654,7 +654,7 @@ static unsigned int sink_index_from_sink(struct core_color *core_color,
 
 	/* Could not find sink requested */
 	ASSERT(false);
-	return index;
+	return -1;
 }
 
 static void calculate_rgb_matrix_legacy(struct core_color *core_color,
@@ -1427,6 +1427,65 @@ static bool update_color_gamut_data(struct color_gamut_data *input_data,
 	return true;
 }
 
+void initialize_color_state(struct core_color *core_color, int index)
+{
+	core_color->state[index].user_enable_color_temperature = true;
+
+	core_color->state[index].custom_color_temperature = 6500;
+
+	core_color->state[index].contrast.current = 100;
+	core_color->state[index].contrast.min = 0;
+	core_color->state[index].contrast.max = 200;
+
+	core_color->state[index].saturation.current = 100;
+	core_color->state[index].saturation.min = 0;
+	core_color->state[index].saturation.max = 200;
+
+	core_color->state[index].brightness.current = 0;
+	core_color->state[index].brightness.min = -100;
+	core_color->state[index].brightness.max = 100;
+
+	core_color->state[index].hue.current = 0;
+	core_color->state[index].hue.min = -30;
+	core_color->state[index].hue.max = 30;
+
+	core_color->state[index].gamma = NULL;
+
+	core_color->state[index].preferred_quantization_range =
+		QUANTIZATION_RANGE_FULL;
+
+	core_color->state[index].source_gamut.color_space =
+		color_space_srgb;
+	core_color->state[index].source_gamut.white_point =
+		color_white_point_type_6500k_noon;
+	core_color->state[index].source_gamut.gamut.blueX = 1500;
+	core_color->state[index].source_gamut.gamut.blueY = 600;
+	core_color->state[index].source_gamut.gamut.greenX = 3000;
+	core_color->state[index].source_gamut.gamut.greenY = 6000;
+	core_color->state[index].source_gamut.gamut.redX = 6400;
+	core_color->state[index].source_gamut.gamut.redY = 3300;
+	core_color->state[index].source_gamut.gamut.whiteX = 3127;
+	core_color->state[index].source_gamut.gamut.whiteY = 3290;
+
+	core_color->state[index].destination_gamut.color_space =
+		color_space_srgb;
+	core_color->state[index].destination_gamut.white_point =
+		color_white_point_type_6500k_noon;
+	core_color->state[index].destination_gamut.gamut.blueX = 1500;
+	core_color->state[index].destination_gamut.gamut.blueY = 600;
+	core_color->state[index].destination_gamut.gamut.greenX = 3000;
+	core_color->state[index].destination_gamut.gamut.greenY = 6000;
+	core_color->state[index].destination_gamut.gamut.redX = 6400;
+	core_color->state[index].destination_gamut.gamut.redY = 3300;
+	core_color->state[index].destination_gamut.gamut.whiteX = 3127;
+	core_color->state[index].destination_gamut.gamut.whiteY = 3290;
+
+	core_color->state[index].input_transfer_function =
+				transfer_func_srgb;
+	core_color->state[index].output_transfer_function =
+				transfer_func_srgb;
+}
+
 struct mod_color *mod_color_create(struct dc *dc)
 {
 	int i = 0;
@@ -1452,54 +1511,7 @@ struct mod_color *mod_color_create(struct dc *dc)
 
 	/*hardcoded to sRGB with 6500 color temperature*/
 	for (i = 0; i < MOD_COLOR_MAX_CONCURRENT_SINKS; i++) {
-		core_color->state[i].source_gamut.color_space =
-				color_space_srgb;
-		core_color->state[i].source_gamut.white_point =
-				color_white_point_type_6500k_noon;
-		core_color->state[i].source_gamut.gamut.blueX = 1500;
-		core_color->state[i].source_gamut.gamut.blueY = 600;
-		core_color->state[i].source_gamut.gamut.greenX = 3000;
-		core_color->state[i].source_gamut.gamut.greenY = 6000;
-		core_color->state[i].source_gamut.gamut.redX = 6400;
-		core_color->state[i].source_gamut.gamut.redY = 3300;
-		core_color->state[i].source_gamut.gamut.whiteX = 3127;
-		core_color->state[i].source_gamut.gamut.whiteY = 3290;
-
-		core_color->state[i].destination_gamut.color_space =
-				color_space_srgb;
-		core_color->state[i].destination_gamut.white_point =
-				color_white_point_type_6500k_noon;
-		core_color->state[i].destination_gamut.gamut.blueX = 1500;
-		core_color->state[i].destination_gamut.gamut.blueY = 600;
-		core_color->state[i].destination_gamut.gamut.greenX = 3000;
-		core_color->state[i].destination_gamut.gamut.greenY = 6000;
-		core_color->state[i].destination_gamut.gamut.redX = 6400;
-		core_color->state[i].destination_gamut.gamut.redY = 3300;
-		core_color->state[i].destination_gamut.gamut.whiteX = 3127;
-		core_color->state[i].destination_gamut.gamut.whiteY = 3290;
-
-		core_color->state[i].input_transfer_function =
-						transfer_func_srgb;
-		core_color->state[i].output_transfer_function =
-						transfer_func_srgb;
-
-		core_color->state[i].custom_color_temperature = 6500;
-
-		core_color->state[i].contrast.current = 100;
-		core_color->state[i].contrast.min = 0;
-		core_color->state[i].contrast.max = 200;
-
-		core_color->state[i].saturation.current = 100;
-		core_color->state[i].saturation.min = 0;
-		core_color->state[i].saturation.max = 200;
-
-		core_color->state[i].brightness.current = 0;
-		core_color->state[i].brightness.min = -100;
-		core_color->state[i].brightness.max = 100;
-
-		core_color->state[i].hue.current = 0;
-		core_color->state[i].hue.min = -30;
-		core_color->state[i].hue.max = 30;
+		initialize_color_state(core_color, i);
 	}
 
 	if (core_color->state == NULL)
@@ -1589,8 +1601,8 @@ bool mod_color_add_sink(struct mod_color *mod_color, const struct dc_sink *sink,
 	if (core_color->num_sinks < MOD_COLOR_MAX_CONCURRENT_SINKS) {
 		dc_sink_retain(sink);
 		core_color->caps[core_color->num_sinks].sink = sink;
-		core_color->state[core_color->num_sinks].
-				user_enable_color_temperature = true;
+
+		initialize_color_state(core_color, core_color->num_sinks);
 
 		core_color->edid_caps[core_color->num_sinks].colorimetry_caps =
 				edid_caps->colorimetry_caps;
@@ -1601,7 +1613,6 @@ bool mod_color_add_sink(struct mod_color *mod_color, const struct dc_sink *sink,
 		flag.save_per_edid = true;
 		flag.save_per_link = false;
 
-
 		if (dm_read_persistent_data(core_dc->ctx, sink,
 						COLOR_REGISTRY_NAME,
 						"enablecolortempadj",
@@ -1610,9 +1621,6 @@ bool mod_color_add_sink(struct mod_color *mod_color, const struct dc_sink *sink,
 			core_color->state[core_color->num_sinks].
 				user_enable_color_temperature =
 						persistent_color_temp_enable;
-		else
-			core_color->state[core_color->num_sinks].
-				user_enable_color_temperature = true;
 
 		if (dm_read_persistent_data(core_dc->ctx, sink,
 						COLOR_REGISTRY_NAME,
@@ -1622,9 +1630,6 @@ bool mod_color_add_sink(struct mod_color *mod_color, const struct dc_sink *sink,
 			core_color->state[core_color->num_sinks].
 					custom_color_temperature
 					= persistent_custom_color_temp;
-		else
-			core_color->state[core_color->num_sinks].
-					custom_color_temperature = 6500;
 
 		if (dm_read_persistent_data(core_dc->ctx, sink,
 					COLOR_REGISTRY_NAME,
@@ -1635,23 +1640,6 @@ bool mod_color_add_sink(struct mod_color *mod_color, const struct dc_sink *sink,
 			memcpy(&core_color->state[core_color->num_sinks].
 				source_gamut.gamut, &persistent_source_gamut,
 				sizeof(struct color_space_coordinates));
-		} else {
-			core_color->state[core_color->num_sinks].
-					source_gamut.gamut.blueX = 1500;
-			core_color->state[core_color->num_sinks].
-					source_gamut.gamut.blueY = 600;
-			core_color->state[core_color->num_sinks].
-					source_gamut.gamut.greenX = 3000;
-			core_color->state[core_color->num_sinks].
-					source_gamut.gamut.greenY = 6000;
-			core_color->state[core_color->num_sinks].
-					source_gamut.gamut.redX = 6400;
-			core_color->state[core_color->num_sinks].
-					source_gamut.gamut.redY = 3300;
-			core_color->state[core_color->num_sinks].
-					source_gamut.gamut.whiteX = 3127;
-			core_color->state[core_color->num_sinks].
-					source_gamut.gamut.whiteY = 3290;
 		}
 
 		if (dm_read_persistent_data(core_dc->ctx, sink, COLOR_REGISTRY_NAME,
@@ -1663,23 +1651,6 @@ bool mod_color_add_sink(struct mod_color *mod_color, const struct dc_sink *sink,
 				destination_gamut.gamut,
 				&persistent_destination_gamut,
 				sizeof(struct color_space_coordinates));
-		} else {
-			core_color->state[core_color->num_sinks].
-					destination_gamut.gamut.blueX = 1500;
-			core_color->state[core_color->num_sinks].
-					destination_gamut.gamut.blueY = 600;
-			core_color->state[core_color->num_sinks].
-					destination_gamut.gamut.greenX = 3000;
-			core_color->state[core_color->num_sinks].
-					destination_gamut.gamut.greenY = 6000;
-			core_color->state[core_color->num_sinks].
-					destination_gamut.gamut.redX = 6400;
-			core_color->state[core_color->num_sinks].
-					destination_gamut.gamut.redY = 3300;
-			core_color->state[core_color->num_sinks].
-					destination_gamut.gamut.whiteX = 3127;
-			core_color->state[core_color->num_sinks].
-					destination_gamut.gamut.whiteY = 3290;
 		}
 
 		if (dm_read_persistent_data(core_dc->ctx, sink, COLOR_REGISTRY_NAME,
@@ -1688,9 +1659,6 @@ bool mod_color_add_sink(struct mod_color *mod_color, const struct dc_sink *sink,
 						sizeof(int), &flag))
 			core_color->state[core_color->num_sinks].
 				brightness.current = persistent_brightness;
-		else
-			core_color->state[core_color->num_sinks].
-				brightness.current = 0;
 
 		if (dm_read_persistent_data(core_dc->ctx, sink, COLOR_REGISTRY_NAME,
 						"contrast",
@@ -1698,9 +1666,6 @@ bool mod_color_add_sink(struct mod_color *mod_color, const struct dc_sink *sink,
 						sizeof(int), &flag))
 			core_color->state[core_color->num_sinks].
 				contrast.current = persistent_contrast;
-		else
-			core_color->state[core_color->num_sinks].
-				contrast.current = 100;
 
 		if (dm_read_persistent_data(core_dc->ctx, sink, COLOR_REGISTRY_NAME,
 						"hue",
@@ -1708,9 +1673,6 @@ bool mod_color_add_sink(struct mod_color *mod_color, const struct dc_sink *sink,
 						sizeof(int), &flag))
 			core_color->state[core_color->num_sinks].
 				hue.current = persistent_hue;
-		else
-			core_color->state[core_color->num_sinks].
-				hue.current = 0;
 
 		if (dm_read_persistent_data(core_dc->ctx, sink, COLOR_REGISTRY_NAME,
 						"saturation",
@@ -1718,9 +1680,6 @@ bool mod_color_add_sink(struct mod_color *mod_color, const struct dc_sink *sink,
 						sizeof(int), &flag))
 			core_color->state[core_color->num_sinks].
 				saturation.current = persistent_saturation;
-		else
-			core_color->state[core_color->num_sinks].
-				saturation.current = 100;
 
 		if (dm_read_persistent_data(core_dc->ctx, sink,
 						COLOR_REGISTRY_NAME,
@@ -1730,9 +1689,6 @@ bool mod_color_add_sink(struct mod_color *mod_color, const struct dc_sink *sink,
 			core_color->state[core_color->num_sinks].
 			preferred_quantization_range =
 					persistent_quantization_range;
-		else
-			core_color->state[core_color->num_sinks].
-			preferred_quantization_range = QUANTIZATION_RANGE_FULL;
 
 		core_color->num_sinks++;
 		return true;
@@ -1751,6 +1707,10 @@ bool mod_color_remove_sink(struct mod_color *mod_color,
 			if (core_color->state[i].gamma) {
 				dc_gamma_release(&core_color->state[i].gamma);
 			}
+			memset(&core_color->state[i], 0,
+					sizeof(struct color_state));
+			memset(&core_color->edid_caps[i], 0,
+					sizeof(struct color_edid_caps));
 
 			/* To remove this sink, shift everything after down */
 			for (j = i; j < core_color->num_sinks - 1; j++) {
@@ -1766,6 +1726,11 @@ bool mod_color_remove_sink(struct mod_color *mod_color,
 					sizeof(struct color_edid_caps));
 			}
 
+			memset(&core_color->state[core_color->num_sinks - 1], 0,
+				sizeof(struct color_state));
+			memset(&core_color->edid_caps[core_color->num_sinks - 1], 0,
+				sizeof(struct color_edid_caps));
+
 			core_color->num_sinks--;
 
 			dc_sink_release(sink);
@@ -1786,11 +1751,14 @@ bool mod_color_update_gamut_to_stream(struct mod_color *mod_color,
 	struct gamut_src_dst_matrix *matrix =
 			dm_alloc(sizeof(struct gamut_src_dst_matrix));
 
-	unsigned int stream_index, sink_index, j;
+	unsigned int stream_index, j;
+	int sink_index;
 
 	for (stream_index = 0; stream_index < num_streams; stream_index++) {
 		sink_index = sink_index_from_sink(core_color,
 				streams[stream_index]->sink);
+		if (sink_index == -1)
+			continue;
 
 		/* Write persistent data in registry*/
 		flag.save_per_edid = true;
@@ -1880,11 +1848,14 @@ bool mod_color_adjust_source_gamut(struct mod_color *mod_color,
 {
 	struct core_color *core_color = MOD_COLOR_TO_CORE(mod_color);
 
-	unsigned int stream_index, sink_index;
+	unsigned int stream_index;
+	int sink_index;
 
 	for (stream_index = 0; stream_index < num_streams; stream_index++) {
 		sink_index = sink_index_from_sink(core_color,
 				streams[stream_index]->sink);
+		if (sink_index == -1)
+			continue;
 
 		update_color_gamut_data(input_gamut_data,
 				&core_color->state[sink_index].source_gamut);
@@ -1903,11 +1874,14 @@ bool mod_color_adjust_source_gamut_and_tf(struct mod_color *mod_color,
 {
 	struct core_color *core_color = MOD_COLOR_TO_CORE(mod_color);
 
-	unsigned int stream_index, sink_index;
+	unsigned int stream_index;
+	int sink_index;
 
 	for (stream_index = 0; stream_index < num_streams; stream_index++) {
 		sink_index = sink_index_from_sink(core_color,
 				streams[stream_index]->sink);
+		if (sink_index == -1)
+			continue;
 		update_color_gamut_data(input_gamut_data,
 				&core_color->state[sink_index].source_gamut);
 		core_color->state[sink_index].input_transfer_function =
@@ -1926,11 +1900,14 @@ bool mod_color_adjust_destination_gamut(struct mod_color *mod_color,
 {
 	struct core_color *core_color = MOD_COLOR_TO_CORE(mod_color);
 
-	unsigned int stream_index, sink_index;
+	unsigned int stream_index;
+	int sink_index;
 
 	for (stream_index = 0; stream_index < num_streams; stream_index++) {
 		sink_index = sink_index_from_sink(core_color,
 				streams[stream_index]->sink);
+		if (sink_index == -1)
+			continue;
 
 		update_color_gamut_data(input_gamut_data,
 			&core_color->state[sink_index].destination_gamut);
@@ -1948,12 +1925,15 @@ bool mod_color_set_white_point(struct mod_color *mod_color,
 {
 	struct core_color *core_color = MOD_COLOR_TO_CORE(mod_color);
 
-	unsigned int stream_index, sink_index;
+	unsigned int stream_index;
+	int sink_index;
 
 	for (stream_index = 0; stream_index < num_streams;
 			stream_index++) {
 		sink_index = sink_index_from_sink(core_color,
 				streams[stream_index]->sink);
+		if (sink_index == -1)
+			continue;
 		core_color->state[sink_index].source_gamut.gamut.whiteX =
 				white_point->whiteX;
 		core_color->state[sink_index].source_gamut.gamut.whiteY =
@@ -1972,11 +1952,14 @@ bool mod_color_set_mastering_info(struct mod_color *mod_color,
 		const struct dc_hdr_static_metadata *mastering_info)
 {
 	struct core_color *core_color = MOD_COLOR_TO_CORE(mod_color);
-	unsigned int stream_index, sink_index;
+	unsigned int stream_index;
+	int sink_index;
 
 	for (stream_index = 0; stream_index < num_streams; stream_index++) {
 		sink_index = sink_index_from_sink(core_color,
 				streams[stream_index]->sink);
+		if (sink_index == -1)
+			continue;
 		memcpy(&core_color->state[sink_index].mastering_info,
 				mastering_info,
 				sizeof(struct dc_hdr_static_metadata));
@@ -1991,7 +1974,10 @@ bool mod_color_get_mastering_info(struct mod_color *mod_color,
 	struct core_color *core_color =
 			MOD_COLOR_TO_CORE(mod_color);
 
-	unsigned int sink_index = sink_index_from_sink(core_color, sink);
+	int sink_index = sink_index_from_sink(core_color, sink);
+
+	if (sink_index == -1)
+		return false;
 
 	memcpy(mastering_info, &core_color->state[sink_index].mastering_info,
 			sizeof(struct dc_hdr_static_metadata));
@@ -2007,11 +1993,14 @@ bool mod_color_set_user_enable(struct mod_color *mod_color,
 			MOD_COLOR_TO_CORE(mod_color);
 	struct core_dc *core_dc = DC_TO_CORE(core_color->dc);
 	struct persistent_data_flag flag;
-	unsigned int stream_index, sink_index;
+	unsigned int stream_index;
+	int sink_index;
 
 	for (stream_index = 0; stream_index < num_streams; stream_index++) {
 		sink_index = sink_index_from_sink(core_color,
 				streams[stream_index]->sink);
+		if (sink_index == -1)
+			continue;
 		core_color->state[sink_index].user_enable_color_temperature
 				= user_enable;
 
@@ -2037,7 +2026,10 @@ bool mod_color_get_user_enable(struct mod_color *mod_color,
 	struct core_color *core_color =
 			MOD_COLOR_TO_CORE(mod_color);
 
-	unsigned int sink_index = sink_index_from_sink(core_color, sink);
+	int sink_index = sink_index_from_sink(core_color, sink);
+
+	if (sink_index == -1)
+		return false;
 
 	*user_enable = core_color->state[sink_index].
 					user_enable_color_temperature;
@@ -2052,7 +2044,10 @@ bool mod_color_get_custom_color_temperature(struct mod_color *mod_color,
 	struct core_color *core_color =
 			MOD_COLOR_TO_CORE(mod_color);
 
-	unsigned int sink_index = sink_index_from_sink(core_color, sink);
+	int sink_index = sink_index_from_sink(core_color, sink);
+
+	if (sink_index == -1)
+		return false;
 
 	*color_temperature = core_color->state[sink_index].
 			custom_color_temperature;
@@ -2068,11 +2063,14 @@ bool mod_color_set_custom_color_temperature(struct mod_color *mod_color,
 			MOD_COLOR_TO_CORE(mod_color);
 	struct core_dc *core_dc = DC_TO_CORE(core_color->dc);
 	struct persistent_data_flag flag;
-	unsigned int stream_index, sink_index;
+	unsigned int stream_index;
+	int sink_index;
 
 	for (stream_index = 0; stream_index < num_streams; stream_index++) {
 		sink_index = sink_index_from_sink(core_color,
 				streams[stream_index]->sink);
+		if (sink_index == -1)
+			continue;
 		core_color->state[sink_index].custom_color_temperature
 				= color_temperature;
 
@@ -2098,7 +2096,10 @@ bool mod_color_get_color_saturation(struct mod_color *mod_color,
 	struct core_color *core_color =
 			MOD_COLOR_TO_CORE(mod_color);
 
-	unsigned int sink_index = sink_index_from_sink(core_color, sink);
+	int sink_index = sink_index_from_sink(core_color, sink);
+
+	if (sink_index == -1)
+		return false;
 
 	*color_saturation = core_color->state[sink_index].saturation;
 
@@ -2112,7 +2113,10 @@ bool mod_color_get_color_contrast(struct mod_color *mod_color,
 	struct core_color *core_color =
 			MOD_COLOR_TO_CORE(mod_color);
 
-	unsigned int sink_index = sink_index_from_sink(core_color, sink);
+	int sink_index = sink_index_from_sink(core_color, sink);
+
+	if (sink_index == -1)
+		return false;
 
 	*color_contrast = core_color->state[sink_index].contrast;
 
@@ -2126,7 +2130,10 @@ bool mod_color_get_color_brightness(struct mod_color *mod_color,
 	struct core_color *core_color =
 			MOD_COLOR_TO_CORE(mod_color);
 
-	unsigned int sink_index = sink_index_from_sink(core_color, sink);
+	int sink_index = sink_index_from_sink(core_color, sink);
+
+	if (sink_index == -1)
+		return false;
 
 	*color_brightness = core_color->state[sink_index].brightness;
 
@@ -2140,7 +2147,10 @@ bool mod_color_get_color_hue(struct mod_color *mod_color,
 	struct core_color *core_color =
 			MOD_COLOR_TO_CORE(mod_color);
 
-	unsigned int sink_index = sink_index_from_sink(core_color, sink);
+	int sink_index = sink_index_from_sink(core_color, sink);
+
+	if (sink_index == -1)
+		return false;
 
 	*color_hue = core_color->state[sink_index].hue;
 
@@ -2154,7 +2164,10 @@ bool mod_color_get_source_gamut(struct mod_color *mod_color,
 	struct core_color *core_color =
 			MOD_COLOR_TO_CORE(mod_color);
 
-	unsigned int sink_index = sink_index_from_sink(core_color, sink);
+	int sink_index = sink_index_from_sink(core_color, sink);
+
+	if (sink_index == -1)
+		return false;
 
 	*source_gamut = core_color->state[sink_index].source_gamut.gamut;
 
@@ -2169,11 +2182,14 @@ bool mod_color_notify_mode_change(struct mod_color *mod_color,
 	struct gamut_src_dst_matrix *matrix =
 			dm_alloc(sizeof(struct gamut_src_dst_matrix));
 
-	unsigned int stream_index, sink_index, j;
+	unsigned int stream_index, j;
+	int sink_index;
 
 	for (stream_index = 0; stream_index < num_streams; stream_index++) {
 		sink_index = sink_index_from_sink(core_color,
 				streams[stream_index]->sink);
+		if (sink_index == -1)
+			continue;
 
 		if (!build_gamut_remap_matrix
 			(core_color->state[sink_index].source_gamut.gamut,
@@ -2247,11 +2263,14 @@ bool mod_color_set_brightness(struct mod_color *mod_color,
 	struct core_color *core_color = MOD_COLOR_TO_CORE(mod_color);
 	struct core_dc *core_dc = DC_TO_CORE(core_color->dc);
 	struct persistent_data_flag flag;
-	unsigned int stream_index, sink_index;
+	unsigned int stream_index;
+	int sink_index;
 
 	for (stream_index = 0; stream_index < num_streams; stream_index++) {
 		sink_index = sink_index_from_sink(core_color,
 				streams[stream_index]->sink);
+		if (sink_index == -1)
+			continue;
 
 		struct core_stream *core_stream =
 						DC_STREAM_TO_CORE
@@ -2291,11 +2310,14 @@ bool mod_color_set_contrast(struct mod_color *mod_color,
 	struct core_color *core_color = MOD_COLOR_TO_CORE(mod_color);
 	struct core_dc *core_dc = DC_TO_CORE(core_color->dc);
 	struct persistent_data_flag flag;
-	unsigned int stream_index, sink_index;
+	unsigned int stream_index;
+	int sink_index;
 
 	for (stream_index = 0; stream_index < num_streams; stream_index++) {
 		sink_index = sink_index_from_sink(core_color,
 				streams[stream_index]->sink);
+		if (sink_index == -1)
+			continue;
 
 		struct core_stream *core_stream =
 						DC_STREAM_TO_CORE
@@ -2335,11 +2357,14 @@ bool mod_color_set_hue(struct mod_color *mod_color,
 	struct core_color *core_color = MOD_COLOR_TO_CORE(mod_color);
 	struct core_dc *core_dc = DC_TO_CORE(core_color->dc);
 	struct persistent_data_flag flag;
-	unsigned int stream_index, sink_index;
+	unsigned int stream_index;
+	int sink_index;
 
 	for (stream_index = 0; stream_index < num_streams; stream_index++) {
 		sink_index = sink_index_from_sink(core_color,
 				streams[stream_index]->sink);
+		if (sink_index == -1)
+			continue;
 
 		struct core_stream *core_stream =
 						DC_STREAM_TO_CORE
@@ -2378,11 +2403,14 @@ bool mod_color_set_saturation(struct mod_color *mod_color,
 	struct core_color *core_color = MOD_COLOR_TO_CORE(mod_color);
 	struct core_dc *core_dc = DC_TO_CORE(core_color->dc);
 	struct persistent_data_flag flag;
-	unsigned int stream_index, sink_index;
+	unsigned int stream_index;
+	int sink_index;
 
 	for (stream_index = 0; stream_index < num_streams; stream_index++) {
 		sink_index = sink_index_from_sink(core_color,
 				streams[stream_index]->sink);
+		if (sink_index == -1)
+			continue;
 
 		struct core_stream *core_stream =
 						DC_STREAM_TO_CORE
@@ -2420,11 +2448,14 @@ bool mod_color_set_input_gamma_correction(struct mod_color *mod_color,
 		struct dc_gamma *gamma)
 {
 	struct core_color *core_color = MOD_COLOR_TO_CORE(mod_color);
-	unsigned int stream_index, sink_index;
+	unsigned int stream_index;
+	int sink_index;
 
 	for (stream_index = 0; stream_index < num_streams; stream_index++) {
 		sink_index = sink_index_from_sink(core_color,
 				streams[stream_index]->sink);
+		if (sink_index == -1)
+			continue;
 
 		struct dc_surface *surface =
 				dc_stream_to_surface_from_pipe_ctx(core_color,
@@ -2471,9 +2502,12 @@ bool mod_color_persist_user_preferred_quantization_range(
 	struct core_color *core_color = MOD_COLOR_TO_CORE(mod_color);
 	struct core_dc *core_dc = DC_TO_CORE(core_color->dc);
 	struct persistent_data_flag flag;
-	unsigned int sink_index;
+	int sink_index;
 
 	sink_index = sink_index_from_sink(core_color, sink);
+	if (sink_index == -1)
+		return false;
+
 	if (core_color->state[sink_index].
 			preferred_quantization_range != quantization_range) {
 		core_color->state[sink_index].preferred_quantization_range =
@@ -2498,7 +2532,11 @@ bool mod_color_get_preferred_quantization_range(struct mod_color *mod_color,
 		enum dc_quantization_range *quantization_range)
 {
 	struct core_color *core_color = MOD_COLOR_TO_CORE(mod_color);
-	unsigned int sink_index = sink_index_from_sink(core_color, sink);
+	int sink_index = sink_index_from_sink(core_color, sink);
+
+	if (sink_index == -1)
+		return false;
+
 	enum dc_quantization_range user_preferred_quantization_range =
 			core_color->state[sink_index].
 				preferred_quantization_range;
@@ -2601,7 +2639,8 @@ bool mod_color_update_gamut_info(struct mod_color *mod_color,
 		const struct dc_stream **streams, int num_streams)
 {
 	struct core_color *core_color = MOD_COLOR_TO_CORE(mod_color);
-	unsigned int stream_index, sink_index;
+	unsigned int stream_index;
+	int sink_index;
 	bool should_defer = false;
 	bool is_hdr = false;
 	enum color_color_space source_color_space;
@@ -2612,6 +2651,8 @@ bool mod_color_update_gamut_info(struct mod_color *mod_color,
 	for (stream_index = 0; stream_index < num_streams; stream_index++) {
 		sink_index = sink_index_from_sink(core_color,
 				streams[stream_index]->sink);
+		if (sink_index == -1)
+			continue;
 		source_color_space =
 			core_color->state[sink_index].source_gamut.color_space;
 		input_transfer_function =
-- 
2.9.3

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 10/10] drm/amd/display: enable option to disable HDR related updates.
       [not found] ` <20161229182943.16087-1-harry.wentland-5C7GfCeVMHo@public.gmane.org>
                     ` (8 preceding siblings ...)
  2016-12-29 18:29   ` [PATCH 09/10] drm/amd/display: Fix color module crash when hotplug monitors Harry Wentland
@ 2016-12-29 18:29   ` Harry Wentland
  9 siblings, 0 replies; 14+ messages in thread
From: Harry Wentland @ 2016-12-29 18:29 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Tony Cheng

From: Tony Cheng <tony.cheng@amd.com>

Change-Id: Ie6e0a797be309a5a130b62d4425783d45b419a85
Signed-off-by: Tony Cheng <tony.cheng@amd.com>
Reviewed-by: Anthony Koo <Anthony.Koo@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
---
 drivers/gpu/drm/amd/display/dc/core/dc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c
index 12620df7056d..69819d834543 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc.c
@@ -1526,6 +1526,9 @@ void dc_update_surfaces_for_target(struct dc *dc, struct dc_surface_update *upda
 				}
 			}
 
+			if (dc->debug.disable_color_module)
+				continue;  /* skip below color updates */
+
 			if (updates[i].hdr_static_metadata) {
 				resource_build_info_frame(pipe_ctx);
 				core_dc->hwss.update_info_frame(pipe_ctx);
-- 
2.9.3

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: Is there any public git repo with DAL?
       [not found]     ` <20161229182943.16087-3-harry.wentland-5C7GfCeVMHo@public.gmane.org>
@ 2017-01-07 23:23       ` Yurii Kolesnykov
       [not found]         ` <7704ce2f-1666-dfe9-afdf-5b2845f5d460-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 14+ messages in thread
From: Yurii Kolesnykov @ 2017-01-07 23:23 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW


I have tried to search fo public DAL code git repo but found only 
mailing lists and kernel.org's patchwork.
It maybe useful to people to have git repo which they can clone, build 
and test this ongoing work.
It's very hard fo those unfimilar with linux git develpment and mailing 
list to apply from emails. Espessially where there is a lot of them and 
they are incremental by the way.
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Is there any public git repo with DAL?
       [not found]         ` <7704ce2f-1666-dfe9-afdf-5b2845f5d460-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2017-01-07 23:30           ` Andres Rodriguez
       [not found]             ` <260e1efe-69e0-680a-ae78-c6d14a1f7df9-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 14+ messages in thread
From: Andres Rodriguez @ 2017-01-07 23:30 UTC (permalink / raw)
  To: Yurii Kolesnykov, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

You can check out Alex's repo:

https://cgit.freedesktop.org/~agd5f/linux/log/?h=amd-staging-4.7

That should be the correct ref to clone I think.

Regards,
Andres

On 1/7/2017 6:23 PM, Yurii Kolesnykov wrote:
>
> I have tried to search fo public DAL code git repo but found only 
> mailing lists and kernel.org's patchwork.
> It maybe useful to people to have git repo which they can clone, build 
> and test this ongoing work.
> It's very hard fo those unfimilar with linux git develpment and 
> mailing list to apply from emails. Espessially where there is a lot of 
> them and they are incremental by the way.
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 14+ messages in thread

* RE: Is there any public git repo with DAL?
       [not found]             ` <260e1efe-69e0-680a-ae78-c6d14a1f7df9-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2017-01-09 13:43               ` Deucher, Alexander
  0 siblings, 0 replies; 14+ messages in thread
From: Deucher, Alexander @ 2017-01-09 13:43 UTC (permalink / raw)
  To: 'Andres Rodriguez', Yurii Kolesnykov,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org

> -----Original Message-----
> From: amd-gfx [mailto:amd-gfx-bounces@lists.freedesktop.org] On Behalf
> Of Andres Rodriguez
> Sent: Saturday, January 07, 2017 6:31 PM
> To: Yurii Kolesnykov; amd-gfx@lists.freedesktop.org
> Subject: Re: Is there any public git repo with DAL?
> 
> You can check out Alex's repo:
> 
> https://cgit.freedesktop.org/~agd5f/linux/log/?h=amd-staging-4.7
> 
> That should be the correct ref to clone I think.

Yes.  In addition to that, my amd-staging-drm-next tree includes all the dal code against drm-next.

Alex

> 
> Regards,
> Andres
> 
> On 1/7/2017 6:23 PM, Yurii Kolesnykov wrote:
> >
> > I have tried to search fo public DAL code git repo but found only
> > mailing lists and kernel.org's patchwork.
> > It maybe useful to people to have git repo which they can clone, build
> > and test this ongoing work.
> > It's very hard fo those unfimilar with linux git develpment and
> > mailing list to apply from emails. Espessially where there is a lot of
> > them and they are incremental by the way.
> > _______________________________________________
> > amd-gfx mailing list
> > amd-gfx@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/amd-gfx
> 
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2017-01-09 13:43 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-29 18:29 [PATCH 00/10] DC Patches Dec 29, 2016 Harry Wentland
     [not found] ` <20161229182943.16087-1-harry.wentland-5C7GfCeVMHo@public.gmane.org>
2016-12-29 18:29   ` [PATCH 01/10] drm/amd/display: Allow multiple instance of DTO regs Harry Wentland
2016-12-29 18:29   ` [PATCH 02/10] drm/amd/display: DAL3: HDR10 Infoframe encoding Harry Wentland
     [not found]     ` <20161229182943.16087-3-harry.wentland-5C7GfCeVMHo@public.gmane.org>
2017-01-07 23:23       ` Is there any public git repo with DAL? Yurii Kolesnykov
     [not found]         ` <7704ce2f-1666-dfe9-afdf-5b2845f5d460-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-01-07 23:30           ` Andres Rodriguez
     [not found]             ` <260e1efe-69e0-680a-ae78-c6d14a1f7df9-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-01-09 13:43               ` Deucher, Alexander
2016-12-29 18:29   ` [PATCH 03/10] drm/amd/display: debug opt disable hdmi deep color Harry Wentland
2016-12-29 18:29   ` [PATCH 04/10] drm/amd/display: debug option to disable color module fucntionality Harry Wentland
2016-12-29 18:29   ` [PATCH 05/10] drm/amd/display: Don't use target before null check Harry Wentland
2016-12-29 18:29   ` [PATCH 06/10] drm/amd/display: Add missing function to fix crush for DP Test pattern 4 Harry Wentland
2016-12-29 18:29   ` [PATCH 07/10] drm/amd/display: Set gamma to NULL at release Harry Wentland
2016-12-29 18:29   ` [PATCH 08/10] drm/amd/display: set HBR3 and TPS4 capable flags Harry Wentland
2016-12-29 18:29   ` [PATCH 09/10] drm/amd/display: Fix color module crash when hotplug monitors Harry Wentland
2016-12-29 18:29   ` [PATCH 10/10] drm/amd/display: enable option to disable HDR related updates Harry Wentland

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.