Skip to contentSkip to conversation

DC Patches Dec 22, 2016

PATCH New Harry Wentland 1 participant 15 messages Dec 23, 2016 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover DC Patches Dec 22, 2016

* Some gamma correction rework and fixes
* Some crash fixes
* Fix licensing header in color module

Andrey Grodzovsky (2):
drm/amd/display: Add refcount debug assert
drm/amd/display: Pass adev to fill_plane_attr

Anthony Koo (1):
drm/amd/display: Reset gamma to NULL after release

Aric Cyr (1):
drm/amd/display: Implement gamma correction using input LUT

Dmytro Laktyushkin (1):
drm/amd/display: minor clock source refactor

Harry Wentland (1):
drm/amd/display: Fix licensing header

Leon Elazar (1):
drm/amd/display: Add dcc param to surface

Tony Cheng (2):
drm/amd/display: add pitch to cursor attributes
drm/amd/display: track cursor width in ipp

Yongqiang Sun (5):
drm/amd/display: don't crash if stream is NULL when trying to share
clocks
drm/amd/display: reset transfer_func to NULL on release drm/amd/display: Fixed crash
drm/amd/display: Fixed split update bug. drm/amd/display: Fixed crash caused by unnecessary clock source in
split pipe.

 .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.c    |  36 ++-
 drivers/gpu/drm/amd/display/dc/calcs/gamma_calcs.c |  29 +-
 drivers/gpu/drm/amd/display/dc/core/dc.c           |  28 +-
 drivers/gpu/drm/amd/display/dc/core/dc_resource.c  |  15 +-
 drivers/gpu/drm/amd/display/dc/core/dc_sink.c      |   5 +-
 drivers/gpu/drm/amd/display/dc/core/dc_stream.c    |   9 +-
 drivers/gpu/drm/amd/display/dc/core/dc_surface.c   |  28 +-
 drivers/gpu/drm/amd/display/dc/core/dc_target.c    |   4 +-
 drivers/gpu/drm/amd/display/dc/dc.h                |  41 +--
 drivers/gpu/drm/amd/display/dc/dc_hw_types.h       |  11 +
 .../gpu/drm/amd/display/dc/dce/dce_clock_source.c  |  68 +++--
 .../gpu/drm/amd/display/dc/dce/dce_clock_source.h  |   9 +-
 drivers/gpu/drm/amd/display/dc/dce/dce_opp.c       |   2 -
 drivers/gpu/drm/amd/display/dc/dce/dce_opp.h       |   4 -
 .../amd/display/dc/dce110/dce110_hw_sequencer.c    |  21 +-
 drivers/gpu/drm/amd/display/dc/dce110/dce110_ipp.c |   1 +
 drivers/gpu/drm/amd/display/dc/dce110/dce110_ipp.h |  11 +-
 .../drm/amd/display/dc/dce110/dce110_ipp_gamma.c   | 304 ++++++---------------
 .../amd/display/dc/dce110/dce110_opp_regamma_v.c   |   1 -
 .../gpu/drm/amd/display/dc/dce110/dce110_opp_v.c   |   2 -
 .../gpu/drm/amd/display/dc/dce110/dce110_opp_v.h   |   4 -
 drivers/gpu/drm/amd/display/dc/dce80/dce80_ipp.c   |   1 +
 drivers/gpu/drm/amd/display/dc/dce80/dce80_ipp.h   |   2 -
 .../gpu/drm/amd/display/dc/dce80/dce80_ipp_gamma.c |   5 -
 drivers/gpu/drm/amd/display/dc/inc/gamma_types.h   |  38 ---
 drivers/gpu/drm/amd/display/dc/inc/hw/ipp.h        |   8 +-
 drivers/gpu/drm/amd/display/dc/inc/hw/opp.h        |   1 -
 drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h  |   2 -
 drivers/gpu/drm/amd/display/dc/inc/resource.h      |   2 +-
 drivers/gpu/drm/amd/display/modules/color/color.c  |  10 +-
 .../drm/amd/display/modules/color/color_helper.c   |  31 ++-
 .../drm/amd/display/modules/color/color_helper.h   |  30 +-
 32 files changed, 304 insertions(+), 459 deletions(-)
 delete mode 100644 drivers/gpu/drm/amd/display/dc/inc/gamma_types.h
Signature · 6 lines
2.9.3

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 20161223155806.12043-1-harry.wentland-5C7GfCeVMHo@public.gmane.org

#2 lore raw

PATCH 1/14 drm/amd/display: add pitch to cursor attributes

From: Tony Cheng <[email protected]>

Change-Id Ic9a3c7d606b6e48967da59746ca3ec4c217565af
---
 drivers/gpu/drm/amd/display/dc/dc_hw_types.h | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/display/dc/dc_hw_types.h +1 -0
index bd603374a3c9..499f6b2a31f8 100644
@@ -407,6 +407,7 @@ union dc_cursor_attribute_flags {
 
 struct dc_cursor_attributes {
 	PHYSICAL_ADDRESS_LOC address;
+	uint32_t pitch;
 
 	/* Width and height should correspond to cursor surface width x heigh */
 	uint32_t width;
Signature · 6 lines
2.9.3

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#3 lore raw

PATCH 2/14 drm/amd/display: minor clock source refactor

In reply to a message not in the archive

From: Dmytro Laktyushkin <[email protected]>

This should make it easier to share code with newer ASICs

Change-Id I615c5774257125383439bd27060eab9db205cc95
---
 .../gpu/drm/amd/display/dc/dce/dce_clock_source.c  | 68 +++++++++++-----------
 .../gpu/drm/amd/display/dc/dce/dce_clock_source.h  |  9 ++-
 2 files changed, 40 insertions(+), 37 deletions(-)
drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c +33 -35
index 3d1c32122d69..a38172bdcb5e 100644
@@ -465,7 +465,6 @@ static uint32_t dce110_get_pix_clk_dividers_helper (
 		struct pll_settings *pll_settings,
 		struct pixel_clk_params *pix_clk_params)
 {
-	uint32_t value = 0;
 	uint32_t field = 0;
 	uint32_t pll_calc_error = MAX_PLL_CALC_ERROR;
 
@@ -473,7 +472,6 @@ static uint32_t dce110_get_pix_clk_dividers_helper (
 	* HW Dce80 spec:
 	* 00 - PCIE_REFCLK, 01 - XTALIN,    02 - GENERICA,    03 - GENERICB
 	* 04 - HSYNCA,      05 - GENLK_CLK, 06 - PCIE_REFCLK, 07 - DVOCLK0 */
-	value = REG_READ(PLL_CNTL);
 	REG_GET(PLL_CNTL, PLL_REF_DIV_SRC, &field);
 	pll_settings->use_external_clk = (field > 1);
 
@@ -807,51 +805,30 @@ static void dce112_program_pixel_clk_resync(
 }
 
 static bool dce110_program_pix_clk(
-		struct clock_source *clk_src,
+		struct clock_source *clock_source,
 		struct pixel_clk_params *pix_clk_params,
 		struct pll_settings *pll_settings)
 {
-	struct dce110_clk_src *dce110_clk_src = TO_DCE110_CLK_SRC(clk_src);
+	struct dce110_clk_src *clk_src = TO_DCE110_CLK_SRC(clock_source);
 	struct bp_pixel_clock_parameters bp_pc_params = {0};
 
 	/* First disable SS
 	 * ATOMBIOS will enable by default SS on PLL for DP,
 	 * do not disable it here
 	 */
-	if (clk_src->id != CLOCK_SOURCE_ID_EXTERNAL &&
+	if (clock_source->id != CLOCK_SOURCE_ID_EXTERNAL &&
 			!dc_is_dp_signal(pix_clk_params->signal_type) &&
-			clk_src->ctx->dce_version <= DCE_VERSION_11_0)
-		disable_spread_spectrum(dce110_clk_src);
+			clock_source->ctx->dce_version <= DCE_VERSION_11_0)
+		disable_spread_spectrum(clk_src);
 
 	/*ATOMBIOS expects pixel rate adjusted by deep color ratio)*/
 	bp_pc_params.controller_id = pix_clk_params->controller_id;
-	bp_pc_params.pll_id = clk_src->id;
+	bp_pc_params.pll_id = clock_source->id;
 	bp_pc_params.target_pixel_clock = pll_settings->actual_pix_clk;
 	bp_pc_params.encoder_object_id = pix_clk_params->encoder_object_id;
 	bp_pc_params.signal_type = pix_clk_params->signal_type;
 
-	switch (clk_src->ctx->dce_version) {
-	case DCE_VERSION_11_2:
-		if (clk_src->id != CLOCK_SOURCE_ID_DP_DTO) {
-			bp_pc_params.flags.SET_GENLOCK_REF_DIV_SRC =
-							pll_settings->use_external_clk;
-			bp_pc_params.flags.SET_XTALIN_REF_SRC =
-							!pll_settings->use_external_clk;
-			if (pix_clk_params->flags.SUPPORT_YCBCR420) {
-				bp_pc_params.target_pixel_clock = pll_settings->actual_pix_clk / 2;
-				bp_pc_params.flags.SUPPORT_YUV_420 = 1;
-			}
-		}
-		if (dce110_clk_src->bios->funcs->set_pixel_clock(
-				dce110_clk_src->bios, &bp_pc_params) != BP_RESULT_OK)
-			return false;
-		/* Resync deep color DTO */
-		if (clk_src->id != CLOCK_SOURCE_ID_DP_DTO)
-			dce112_program_pixel_clk_resync(dce110_clk_src,
-						pix_clk_params->signal_type,
-						pix_clk_params->color_depth,
-						pix_clk_params->flags.SUPPORT_YCBCR420);
-		break;
+	switch (clock_source->ctx->dce_version) {
 	case DCE_VERSION_8_0:
 	case DCE_VERSION_10_0:
 	case DCE_VERSION_11_0:
@@ -864,28 +841,49 @@ static bool dce110_program_pix_clk(
 		bp_pc_params.flags.SET_EXTERNAL_REF_DIV_SRC =
 						pll_settings->use_external_clk;
 
-		if (dce110_clk_src->bios->funcs->set_pixel_clock(
-				dce110_clk_src->bios, &bp_pc_params) != BP_RESULT_OK)
+		if (clk_src->bios->funcs->set_pixel_clock(
+				clk_src->bios, &bp_pc_params) != BP_RESULT_OK)
 			return false;
 		/* Enable SS
 		 * ATOMBIOS will enable by default SS for DP on PLL ( DP ID clock),
 		 * based on HW display PLL team, SS control settings should be programmed
 		 * during PLL Reset, but they do not have effect
 		 * until SS_EN is asserted.*/
-		if (clk_src->id != CLOCK_SOURCE_ID_EXTERNAL
+		if (clock_source->id != CLOCK_SOURCE_ID_EXTERNAL
 			&& pix_clk_params->flags.ENABLE_SS && !dc_is_dp_signal(
 							pix_clk_params->signal_type)) {
 
-			if (!enable_spread_spectrum(dce110_clk_src,
+			if (!enable_spread_spectrum(clk_src,
 							pix_clk_params->signal_type,
 							pll_settings))
 				return false;
 			/* Resync deep color DTO */
-			dce110_program_pixel_clk_resync(dce110_clk_src,
+			dce110_program_pixel_clk_resync(clk_src,
 						pix_clk_params->signal_type,
 						pix_clk_params->color_depth);
 		}
 		break;
+	case DCE_VERSION_11_2:
+		if (clock_source->id != CLOCK_SOURCE_ID_DP_DTO) {
+			bp_pc_params.flags.SET_GENLOCK_REF_DIV_SRC =
+							pll_settings->use_external_clk;
+			bp_pc_params.flags.SET_XTALIN_REF_SRC =
+							!pll_settings->use_external_clk;
+			if (pix_clk_params->flags.SUPPORT_YCBCR420) {
+				bp_pc_params.target_pixel_clock = pll_settings->actual_pix_clk / 2;
+				bp_pc_params.flags.SUPPORT_YUV_420 = 1;
+			}
+		}
+		if (clk_src->bios->funcs->set_pixel_clock(
+				clk_src->bios, &bp_pc_params) != BP_RESULT_OK)
+			return false;
+		/* Resync deep color DTO */
+		if (clock_source->id != CLOCK_SOURCE_ID_DP_DTO)
+			dce112_program_pixel_clk_resync(clk_src,
+						pix_clk_params->signal_type,
+						pix_clk_params->color_depth,
+						pix_clk_params->flags.SUPPORT_YCBCR420);
+		break;
 	default:
 		break;
 	}
drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.h +7 -2
index 067e4ac0e67a..8ee00712ef8e 100644
@@ -41,6 +41,7 @@
 #define CS_COMMON_REG_LIST_DCE_112(id) \
 		SRI(PIXCLK_RESYNC_CNTL, PHYPLL, id)
 
+
 #define CS_SF(reg_name, field_name, post_fix)\
 	.field_name = reg_name ## __ ## field_name ## post_fix
 
@@ -48,11 +49,11 @@
 	CS_SF(PLL_CNTL, PLL_REF_DIV_SRC, mask_sh),\
 	CS_SF(PIXCLK1_RESYNC_CNTL, DCCG_DEEP_COLOR_CNTL1, mask_sh),\
 	CS_SF(PLL_POST_DIV, PLL_POST_DIV_PIXCLK, mask_sh),\
-	CS_SF(PLL_REF_DIV, PLL_REF_DIV, mask_sh),\
+	CS_SF(PLL_REF_DIV, PLL_REF_DIV, mask_sh)
 
 #define CS_COMMON_MASK_SH_LIST_DCE_112(mask_sh)\
 	CS_SF(PHYPLLA_PIXCLK_RESYNC_CNTL, PHYPLLA_DCCG_DEEP_COLOR_CNTL, mask_sh),\
-	CS_SF(PHYPLLA_PIXCLK_RESYNC_CNTL, PHYPLLA_PIXCLK_DOUBLE_RATE_ENABLE, mask_sh),\
+	CS_SF(PHYPLLA_PIXCLK_RESYNC_CNTL, PHYPLLA_PIXCLK_DOUBLE_RATE_ENABLE, mask_sh)
 
 #define CS_REG_FIELD_LIST(type) \
 	type PLL_REF_DIV_SRC; \
@@ -61,6 +62,7 @@
 	type PHYPLLA_PIXCLK_DOUBLE_RATE_ENABLE; \
 	type PLL_POST_DIV_PIXCLK; \
 	type PLL_REF_DIV; \
+	type DP_DTO0_ENABLE;
 
 struct dce110_clk_src_shift {
 	CS_REG_FIELD_LIST(uint8_t)
@@ -74,6 +76,9 @@ 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;
 };
 
 struct dce110_clk_src {
Signature · 6 lines
2.9.3

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#4 lore raw

PATCH 3/14 drm/amd/display: Add dcc param to surface

In reply to a message not in the archive

From: Leon Elazar <[email protected]>

Change-Id Ib8a0db5f2833602bb2c6a3480e81a63956b8c4ea
---
 drivers/gpu/drm/amd/display/dc/dc.h | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/display/dc/dc.h +1 -0
index f1707b48e40f..05fcb0663ff0 100644
@@ -275,6 +275,7 @@ struct dc_surface {
 struct dc_plane_info {
 	union plane_size plane_size;
 	union dc_tiling_info tiling_info;
+	struct dc_plane_dcc_param dcc;
 	enum surface_pixel_format format;
 	enum dc_rotation_angle rotation;
 	bool horizontal_mirror;
Signature · 6 lines
2.9.3

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#5 lore raw

PATCH 4/14 drm/amd/display: track cursor width in ipp

In reply to a message not in the archive

From: Tony Cheng <[email protected]>

Change-Id Ia3ced1b3ecbb8e4443c10808a7f1e088882d4f3f
---
 drivers/gpu/drm/amd/display/dc/inc/hw/ipp.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/inc/hw/ipp.h +3 -1
index 81de97568d11..e9ed167c9e41 100644
@@ -35,8 +35,10 @@
 /* IPP RELATED */
 struct input_pixel_processor {
 	struct  dc_context *ctx;
-	uint32_t inst;
+	unsigned int inst;
 	const struct ipp_funcs *funcs;
+
+	unsigned int cusor_width;
 };
 
 enum ipp_prescale_mode {
Signature · 6 lines
2.9.3

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#6 lore raw

PATCH 5/14 drm/amd/display: Reset gamma to NULL after release

In reply to a message not in the archive

From: Anthony Koo <[email protected]>

Change-Id I1542e96e23c2b2b943c09d2099d2fd5426cb0868
---
 drivers/gpu/drm/amd/display/modules/color/color.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/modules/color/color.c +3 -1
index 938867282d04..6d1b20f6bf98 100644
@@ -1748,8 +1748,10 @@ 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)
+			if (core_color->state[i].gamma) {
 				dc_gamma_release(core_color->state[i].gamma);
+				core_color->state[i].gamma = NULL;
+			}
 
 			/* To remove this sink, shift everything after down */
 			for (j = i; j < core_color->num_sinks - 1; j++) {
Signature · 6 lines
2.9.3

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#7 lore raw

PATCH 6/14 drm/amd/display: Implement gamma correction using input LUT

In reply to a message not in the archive

From: Aric Cyr <[email protected]>

The dc_gamma in dc_surface will be programmed to the input LUT if provided. If dc_gamma is not provided in dc_surface regamma may be used to emulate gamma.

Some refactor and cleanup included as well.

Change-Id I6bd82a4528befd009a136775cb9953ee67488c3f
---
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.c    |  25 +-
 drivers/gpu/drm/amd/display/dc/calcs/gamma_calcs.c |  29 +-
 drivers/gpu/drm/amd/display/dc/core/dc_surface.c   |   6 +-
 drivers/gpu/drm/amd/display/dc/dc.h                |  40 +--
 drivers/gpu/drm/amd/display/dc/dc_hw_types.h       |  10 +
 drivers/gpu/drm/amd/display/dc/dce/dce_opp.c       |   2 -
 drivers/gpu/drm/amd/display/dc/dce/dce_opp.h       |   4 -
 .../amd/display/dc/dce110/dce110_hw_sequencer.c    |  17 +-
 drivers/gpu/drm/amd/display/dc/dce110/dce110_ipp.c |   1 +
 drivers/gpu/drm/amd/display/dc/dce110/dce110_ipp.h |  11 +-
 .../drm/amd/display/dc/dce110/dce110_ipp_gamma.c   | 304 ++++++---------------
 .../amd/display/dc/dce110/dce110_opp_regamma_v.c   |   1 -
 .../gpu/drm/amd/display/dc/dce110/dce110_opp_v.c   |   2 -
 .../gpu/drm/amd/display/dc/dce110/dce110_opp_v.h   |   4 -
 drivers/gpu/drm/amd/display/dc/dce80/dce80_ipp.c   |   1 +
 drivers/gpu/drm/amd/display/dc/dce80/dce80_ipp.h   |   2 -
 .../gpu/drm/amd/display/dc/dce80/dce80_ipp_gamma.c |   5 -
 drivers/gpu/drm/amd/display/dc/inc/gamma_types.h   |  38 ---
 drivers/gpu/drm/amd/display/dc/inc/hw/ipp.h        |   4 +
 drivers/gpu/drm/amd/display/dc/inc/hw/opp.h        |   1 -
 drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h  |   2 -
 drivers/gpu/drm/amd/display/modules/color/color.c  |   6 +-
 22 files changed, 144 insertions(+), 371 deletions(-)
 delete mode 100644 drivers/gpu/drm/amd/display/dc/inc/gamma_types.h
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c +12 -13
index 9d7d44274e99..6a2548e8082b 100644
@@ -515,32 +515,25 @@ static void fill_gamma_from_crtc(
 	uint16_t *red, *green, *blue;
 	int end = (crtc->gamma_size > NUM_OF_RAW_GAMMA_RAMP_RGB_256) ?
 			NUM_OF_RAW_GAMMA_RAMP_RGB_256 : crtc->gamma_size;
-	struct amdgpu_device *adev = crtc->dev->dev_private;
 
 	red = crtc->gamma_store;
 	green = red + crtc->gamma_size;
 	blue = green + crtc->gamma_size;
 
-	gamma = dc_create_gamma(adev->dm.dc);
+	gamma = dc_create_gamma();
 
 	if (gamma == NULL)
 		return;
 
 	for (i = 0; i < end; i++) {
-		gamma->gamma_ramp_rgb256x3x16.red[i] =
-				(unsigned short) red[i];
-		gamma->gamma_ramp_rgb256x3x16.green[i] =
-				(unsigned short) green[i];
-		gamma->gamma_ramp_rgb256x3x16.blue[i] =
-				(unsigned short) blue[i];
+		gamma->red[i] = (unsigned short) red[i];
+		gamma->green[i] = (unsigned short) green[i];
+		gamma->blue[i] = (unsigned short) blue[i];
 	}
 
-	gamma->type = GAMMA_RAMP_RBG256X3X16;
-	gamma->size = sizeof(gamma->gamma_ramp_rgb256x3x16);
-
 	dc_surface->gamma_correction = gamma;
 
-	input_tf = dc_create_transfer_func(adev->dm.dc);
+	input_tf = dc_create_transfer_func();
 
 	if (input_tf == NULL)
 		return;
@@ -838,6 +831,12 @@ static void fill_stream_properties_from_drm_display_mode(
 
 	stream->output_color_space = get_output_color_space(timing_out);
 
+	{
+		struct dc_transfer_func *tf = dc_create_transfer_func();
+		tf->type = TF_TYPE_PREDEFINED;
+		tf->tf = TRANSFER_FUNCTION_SRGB;
+		stream->out_transfer_func = tf;
+	}
 }
 
 static void fill_audio_info(
@@ -3211,7 +3210,7 @@ static bool is_dp_capable_without_timing_msa(
 	    dc_read_dpcd(dc, amdgpu_connector->dc_link->link_index,
 			 DP_DOWN_STREAM_PORT_COUNT,
 			 &dpcd_data, sizeof(dpcd_data)) )
-		capable = dpcd_data & DP_MSA_TIMING_PAR_IGNORED? true:false;
+		capable = (dpcd_data & DP_MSA_TIMING_PAR_IGNORED) ? true:false;
 
 	return capable;
 }
drivers/gpu/drm/amd/display/dc/calcs/gamma_calcs.c +11 -18
index f33135b53a80..ca2234e4b7d2 100644
@@ -573,7 +573,7 @@ static bool find_software_points(
 	uint32_t *index_right,
 	enum hw_point_position *pos)
 {
-	const uint32_t max_number = RGB_256X3X16 + 3;
+	const uint32_t max_number = INPUT_LUT_ENTRIES + 3;
 
 	struct fixed31_32 left, right;
 
@@ -686,12 +686,12 @@ static bool build_custom_gamma_mapping_coefficients_worker(
 			return false;
 		}
 
-		if (index_left >= RGB_256X3X16 + 3) {
+		if (index_left >= INPUT_LUT_ENTRIES + 3) {
 			BREAK_TO_DEBUGGER();
 			return false;
 		}
 
-		if (index_right >= RGB_256X3X16 + 3) {
+		if (index_right >= INPUT_LUT_ENTRIES + 3) {
 			BREAK_TO_DEBUGGER();
 			return false;
 		}
@@ -958,20 +958,13 @@ static bool scale_gamma(struct pwl_float_data *pwl_rgb,
 		const struct core_gamma *ramp,
 		struct dividers dividers)
 {
-	const struct dc_gamma_ramp_rgb256x3x16 *gamma;
+	const struct dc_gamma *gamma = &ramp->public;
 	const uint16_t max_driver = 0xFFFF;
 	const uint16_t max_os = 0xFF00;
 	uint16_t scaler = max_os;
-	uint32_t i;
+	uint32_t i = 0;
 	struct pwl_float_data *rgb = pwl_rgb;
-	struct pwl_float_data *rgb_last = rgb + RGB_256X3X16 - 1;
-
-	if (ramp->public.type == GAMMA_RAMP_RBG256X3X16)
-		gamma = &ramp->public.gamma_ramp_rgb256x3x16;
-	else
-		return false; /* invalid option */
-
-	i = 0;
+	struct pwl_float_data *rgb_last = rgb + INPUT_LUT_ENTRIES - 1;
 
 	do {
 		if ((gamma->red[i] > max_os) ||
@@ -981,7 +974,7 @@ static bool scale_gamma(struct pwl_float_data *pwl_rgb,
 			break;
 		}
 		++i;
-	} while (i != RGB_256X3X16);
+	} while (i != INPUT_LUT_ENTRIES);
 
 	i = 0;
 
@@ -995,7 +988,7 @@ static bool scale_gamma(struct pwl_float_data *pwl_rgb,
 
 		++rgb;
 		++i;
-	} while (i != RGB_256X3X16);
+	} while (i != INPUT_LUT_ENTRIES);
 
 	rgb->r = dal_fixed31_32_mul(rgb_last->r,
 			dividers.divider1);
@@ -1110,7 +1103,7 @@ static bool calculate_interpolated_hardware_curve(
 		return false;
 
 	coeff = coeff128;
-	max_entries += RGB_256X3X16;
+	max_entries += INPUT_LUT_ENTRIES;
 
 	/* TODO: float point case */
 
@@ -1440,13 +1433,13 @@ bool calculate_regamma_params(struct pwl_params *params,
 	coordinates_x = dm_alloc(sizeof(*coordinates_x)*(256 + 3));
 	if (!coordinates_x)
 		goto coordinates_x_alloc_fail;
-	rgb_user = dm_alloc(sizeof(*rgb_user) * (FLOAT_GAMMA_RAMP_MAX + 3));
+	rgb_user = dm_alloc(sizeof(*rgb_user) * (TRANSFER_FUNC_POINTS + 3));
 	if (!rgb_user)
 		goto rgb_user_alloc_fail;
 	rgb_regamma = dm_alloc(sizeof(*rgb_regamma) * (256 + 3));
 	if (!rgb_regamma)
 		goto rgb_regamma_alloc_fail;
-	rgb_oem = dm_alloc(sizeof(*rgb_oem) * (FLOAT_GAMMA_RAMP_MAX + 3));
+	rgb_oem = dm_alloc(sizeof(*rgb_oem) * (TRANSFER_FUNC_POINTS + 3));
 	if (!rgb_oem)
 		goto rgb_oem_alloc_fail;
 	axix_x_256 = dm_alloc(sizeof(*axix_x_256) * (256 + 3));
drivers/gpu/drm/amd/display/dc/core/dc_surface.c +2 -4
index 1ca40a212008..3ec1f363e43e 100644
@@ -189,9 +189,8 @@ void dc_gamma_release(const struct dc_gamma *dc_gamma)
 		dm_free(gamma);
 }
 
-struct dc_gamma *dc_create_gamma(const struct dc *dc)
+struct dc_gamma *dc_create_gamma()
 {
-	struct core_dc *core_dc = DC_TO_CORE(dc);
 	struct gamma *gamma = dm_alloc(sizeof(*gamma));
 
 	if (gamma == NULL)
@@ -221,9 +220,8 @@ void dc_transfer_func_release(const struct dc_transfer_func *dc_tf)
 		dm_free(tf);
 }
 
-struct dc_transfer_func *dc_create_transfer_func(const struct dc *dc)
+struct dc_transfer_func *dc_create_transfer_func()
 {
-	struct core_dc *core_dc = DC_TO_CORE(dc);
 	struct transfer_func *tf = dm_alloc(sizeof(*tf));
 
 	if (tf == NULL)
drivers/gpu/drm/amd/display/dc/dc.h +2 -38
index 05fcb0663ff0..0ee6f41b6047 100644
@@ -183,43 +183,9 @@ void dc_destroy(struct dc **dc);
  ******************************************************************************/
 
 enum {
-	RGB_256X3X16 = 256,
-	FLOAT_GAMMA_RAMP_MAX = 1025,
 	TRANSFER_FUNC_POINTS = 1025
 };
 
-enum dc_gamma_ramp_type {
-	GAMMA_RAMP_RBG256X3X16,
-	GAMMA_RAMP_FLOAT,
-};
-
-struct float_rgb {
-	struct fixed32_32 red;
-	struct fixed32_32 green;
-	struct fixed32_32 blue;
-};
-
-struct dc_gamma_ramp_float {
-	struct float_rgb scale;
-	struct float_rgb offset;
-	struct float_rgb gamma_curve[FLOAT_GAMMA_RAMP_MAX];
-};
-
-struct dc_gamma_ramp_rgb256x3x16 {
-	uint16_t red[RGB_256X3X16];
-	uint16_t green[RGB_256X3X16];
-	uint16_t blue[RGB_256X3X16];
-};
-
-struct dc_gamma {
-	enum dc_gamma_ramp_type type;
-	union {
-		struct dc_gamma_ramp_rgb256x3x16 gamma_ramp_rgb256x3x16;
-		struct dc_gamma_ramp_float gamma_ramp_float;
-	};
-	uint32_t size;
-};
-
 enum dc_transfer_func_type {
 	TF_TYPE_PREDEFINED,
 	TF_TYPE_DISTRIBUTED_POINTS,
@@ -266,9 +232,7 @@ struct dc_surface {
 	bool horizontal_mirror;
 	enum plane_stereo_format stereo_format;
 
-	/* TO BE REMOVED AFTER BELOW TRANSFER FUNCTIONS IMPLEMENTED */
 	const struct dc_gamma *gamma_correction;
-
 	const struct dc_transfer_func *in_transfer_func;
 };
 
@@ -332,11 +296,11 @@ 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);
-struct dc_gamma *dc_create_gamma(const struct dc *dc);
+struct dc_gamma *dc_create_gamma(void);
 
 void dc_transfer_func_retain(const struct dc_transfer_func *dc_tf);
 void dc_transfer_func_release(const struct dc_transfer_func *dc_tf);
-struct dc_transfer_func *dc_create_transfer_func(const struct dc *dc);
+struct dc_transfer_func *dc_create_transfer_func(void);
 
 /*
  * This structure holds a surface address.  There could be multiple addresses
drivers/gpu/drm/amd/display/dc/dc_hw_types.h +10 -0
index 499f6b2a31f8..00958bdbb417 100644
@@ -370,6 +370,16 @@ struct dc_cursor_mi_param {
 
 /* IPP related types */
 
+enum {
+	INPUT_LUT_ENTRIES = 256
+};
+
+struct dc_gamma {
+	uint16_t red[INPUT_LUT_ENTRIES];
+	uint16_t green[INPUT_LUT_ENTRIES];
+	uint16_t blue[INPUT_LUT_ENTRIES];
+};
+
 /* Used by both ipp amd opp functions*/
 /* TODO: to be consolidated with enum color_space */
 
drivers/gpu/drm/amd/display/dc/dce/dce_opp.c +0 -2
index 653f93dd281f..46b128708c7e 100644
@@ -28,8 +28,6 @@
 
 #include "dce_opp.h"
 
-#include "gamma_types.h"
-
 #include "reg_helper.h"
 
 #define REG(reg)\
drivers/gpu/drm/amd/display/dc/dce/dce_opp.h +0 -4
index 1c01a83ecc50..f2828f044b96 100644
@@ -29,10 +29,6 @@
 #include "opp.h"
 #include "core_types.h"
 
-#include "gamma_types.h" /* decprecated */
-
-struct gamma_parameters;
-
 #define FROM_DCE11_OPP(opp)\
 	container_of(opp, struct dce110_opp, base)
 
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +12 -5
index 2f790753b559..e4cef9da5de1 100644
@@ -228,10 +228,11 @@ static void build_prescale_params(struct ipp_prescale_params *prescale_params,
 		break;
 	default:
 		ASSERT(false);
+		break;
 	}
 }
 
-static bool dce110_set_degamma(
+static bool dce110_set_input_transfer_func(
 	struct pipe_ctx *pipe_ctx,
 	const struct core_surface *surface)
 {
@@ -249,6 +250,9 @@ static bool dce110_set_degamma(
 	build_prescale_params(&prescale_params, surface);
 	ipp->funcs->ipp_program_prescale(ipp, &prescale_params);
 
+	if (surface->public.gamma_correction)
+	    ipp->funcs->ipp_program_input_lut(ipp, surface->public.gamma_correction);
+
 	if (tf == NULL) {
 		/* Default case if no input transfer function specified */
 		ipp->funcs->ipp_set_degamma(ipp,
@@ -272,6 +276,7 @@ static bool dce110_set_degamma(
 			break;
 		default:
 			result = false;
+			break;
 		}
 	} else {
 		/*TF_TYPE_DISTRIBUTED_POINTS - Not supported in DCE 11*/
@@ -303,8 +308,11 @@ static bool dce110_set_output_transfer_func(
 
 	opp->funcs->opp_power_on_regamma_lut(opp, true);
 
-	if (ramp && calculate_regamma_params(
-				regamma_params, ramp, surface, stream)) {
+	if (stream->public.out_transfer_func &&
+	    stream->public.out_transfer_func->type == TF_TYPE_PREDEFINED &&
+	    stream->public.out_transfer_func->tf == TRANSFER_FUNCTION_SRGB) {
+		opp->funcs->opp_set_regamma_mode(opp, OPP_REGAMMA_SRGB);
+	} else if (ramp && calculate_regamma_params(regamma_params, ramp, surface, stream)) {
 		opp->funcs->opp_program_regamma_pwl(opp, regamma_params);
 		opp->funcs->opp_set_regamma_mode(opp, OPP_REGAMMA_USER);
 	} else {
@@ -1318,7 +1326,6 @@ enum dc_status dce110_apply_ctx_to_hw(
 			* instead of per pipe.
 			*/
 			struct audio_output audio_output;
-			struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[i];
 
 			build_audio_output(pipe_ctx, &audio_output);
 
@@ -1945,7 +1952,7 @@ static const struct hw_sequencer_funcs dce110_funcs = {
 	.set_plane_config = set_plane_config,
 	.update_plane_addr = update_plane_addr,
 	.update_pending_status = dce110_update_pending_status,
-	.set_input_transfer_func = dce110_set_degamma,
+	.set_input_transfer_func = dce110_set_input_transfer_func,
 	.set_output_transfer_func = dce110_set_output_transfer_func,
 	.power_down = dce110_power_down,
 	.enable_accelerated_mode = dce110_enable_accelerated_mode,
drivers/gpu/drm/amd/display/dc/dce110/dce110_ipp.c +1 -0
index dd69f6060bb9..86fa7657a756 100644
@@ -35,6 +35,7 @@ static const struct ipp_funcs funcs = {
 		.ipp_cursor_set_attributes = dce110_ipp_cursor_set_attributes,
 		.ipp_cursor_set_position = dce110_ipp_cursor_set_position,
 		.ipp_program_prescale = dce110_ipp_program_prescale,
+		.ipp_program_input_lut = dce110_ipp_program_input_lut,
 		.ipp_set_degamma = dce110_ipp_set_degamma,
 };
 
drivers/gpu/drm/amd/display/dc/dce110/dce110_ipp.h +4 -7
index 56fe3274407c..a374ef2c9d0b 100644
@@ -28,9 +28,6 @@
 
 #include "ipp.h"
 
-struct gamma_parameters;
-struct dev_c_lut;
-
 #define TO_DCE110_IPP(input_pixel_processor)\
 	container_of(input_pixel_processor, struct dce110_ipp, base)
 
@@ -69,9 +66,9 @@ bool dce110_ipp_set_degamma(
 void dce110_ipp_program_prescale(
 	struct input_pixel_processor *ipp,
 	struct ipp_prescale_params *params);
-/*
- * Helper functions to be resused in other ASICs
- */
-void dce110_helper_select_lut(struct dce110_ipp *ipp110);
+
+void dce110_ipp_program_input_lut(
+	struct input_pixel_processor *ipp,
+	const struct dc_gamma *gamma);
 
 #endif /*__DC_IPP_DCE110_H__*/
drivers/gpu/drm/amd/display/dc/dce110/dce110_ipp_gamma.c +82 -222

342 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dce110/dce110_opp_regamma_v.c +0 -1
index 81fcbc52e4ab..8164aa6bcb00 100644
@@ -30,7 +30,6 @@
 #include "dce/dce_11_0_sh_mask.h"
 
 #include "dce/dce_opp.h"
-#include "gamma_types.h"
 
 static void power_on_lut(struct output_pixel_processor *opp,
 	bool power_on, bool inputgamma, bool regamma)
drivers/gpu/drm/amd/display/dc/dce110/dce110_opp_v.c +0 -2
index dfd63a71d214..0a9b384303d0 100644
@@ -32,8 +32,6 @@
 #include "dce/dce_opp.h"
 #include "dce110_opp_v.h"
 
-#include "gamma_types.h"
-
 /*****************************************/
 /* Constructor, Destructor               */
 /*****************************************/
drivers/gpu/drm/amd/display/dc/dce110/dce110_opp_v.h +0 -4
index dcdbf86fccc1..ac5937786ce3 100644
@@ -29,10 +29,6 @@
 #include "opp.h"
 #include "core_types.h"
 
-#include "gamma_types.h" /* decprecated */
-
-struct gamma_parameters;
-
 bool dce110_opp_v_construct(struct dce110_opp *opp110,
 	struct dc_context *ctx);
 
drivers/gpu/drm/amd/display/dc/dce80/dce80_ipp.c +1 -0
index 86826c229d39..c195acb6e1a6 100644
@@ -37,6 +37,7 @@ static const struct ipp_funcs funcs = {
 		.ipp_cursor_set_attributes = dce110_ipp_cursor_set_attributes,
 		.ipp_cursor_set_position = dce110_ipp_cursor_set_position,
 		.ipp_program_prescale = dce110_ipp_program_prescale,
+		.ipp_program_input_lut = dce110_ipp_program_input_lut,
 		.ipp_set_degamma = dce110_ipp_set_degamma,
 };
 
drivers/gpu/drm/amd/display/dc/dce80/dce80_ipp.h +0 -2
index d350138e5feb..06e8598d395f 100644
@@ -33,8 +33,6 @@
 
 struct dce110_ipp;
 struct dce110_ipp_reg_offsets;
-struct gamma_parameters;
-struct dev_c_lut;
 
 bool dce80_ipp_construct(
 	struct dce110_ipp *ipp,
drivers/gpu/drm/amd/display/dc/dce80/dce80_ipp_gamma.c +0 -5
index eacb14e40d52..760168df5290 100644
@@ -34,15 +34,10 @@
 
 #include "dce80_ipp.h"
 #include "dce110/dce110_ipp.h"
-#include "gamma_types.h"
 
 #define DCP_REG(reg)\
 	(reg + ipp80->offsets.dcp_offset)
 
-enum {
-	MAX_INPUT_LUT_ENTRY = 256
-};
-
 /*PROTOTYPE DECLARATIONS*/
 
 static void set_legacy_input_gamma_mode(
drivers/gpu/drm/amd/display/dc/inc/gamma_types.h deleted +0 -38
deleted file mode 100644
index 7948d2cc0715..000000000000
@@ -1,38 +0,0 @@
-/*
- * Copyright 2012-15 Advanced Micro Devices, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors: AMD
- *
- */
-#ifndef GAMMA_TYPES_H_
-
-#define GAMMA_TYPES_H_
-
-#include "dc_types.h"
-
-/* TODO: Used in IPP and OPP */
-
-struct dev_c_lut16 {
-	uint16_t red;
-	uint16_t green;
-	uint16_t blue;
-};
-#endif
drivers/gpu/drm/amd/display/dc/inc/hw/ipp.h +4 -0
index e9ed167c9e41..0457bc7a44d4 100644
@@ -110,6 +110,10 @@ struct ipp_funcs {
 			struct input_pixel_processor *ipp,
 			struct ipp_prescale_params *params);
 
+	void (*ipp_program_input_lut)(
+			struct input_pixel_processor *ipp,
+			const struct dc_gamma *gamma);
+
 	/*** DEGAMMA RELATED ***/
 	bool (*ipp_set_degamma)(
 		struct input_pixel_processor *ipp,
drivers/gpu/drm/amd/display/dc/inc/hw/opp.h +0 -1
index e615997be20e..a1f31a4410a3 100644
@@ -30,7 +30,6 @@
 #include "transform.h"
 
 struct fixed31_32;
-struct gamma_parameters;
 
 /* TODO: Need cleanup */
 enum clamping_range {
drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h +0 -2
index 0e803ca83bb9..895c446cebf9 100644
@@ -28,8 +28,6 @@
 #include "core_types.h"
 #include "timing_generator.h"
 
-struct gamma_parameters;
-
 enum pipe_gating_control {
 	PIPE_GATING_CONTROL_DISABLE = 0,
 	PIPE_GATING_CONTROL_ENABLE,
drivers/gpu/drm/amd/display/modules/color/color.c +3 -3
index 6d1b20f6bf98..5c578aecf21c 100644
@@ -2433,7 +2433,7 @@ bool mod_color_set_input_gamma_correction(struct mod_color *mod_color,
 
 		if (surface != NULL) {
 			struct dc_transfer_func *input_tf =
-					dc_create_transfer_func(core_color->dc);
+					dc_create_transfer_func();
 			struct dc_surface_update updates = {0};
 
 			if (input_tf != NULL) {
@@ -2724,7 +2724,7 @@ bool mod_color_update_gamut_info(struct mod_color *mod_color,
 		/* 3. ---- SET DEGAMMA ---- */
 		struct dc_transfer_func *input_tf = NULL;
 
-		input_tf = dc_create_transfer_func(core_color->dc);
+		input_tf = dc_create_transfer_func();
 
 		if (input_tf != NULL) {
 			input_tf->type = TF_TYPE_PREDEFINED;
@@ -2747,7 +2747,7 @@ bool mod_color_update_gamut_info(struct mod_color *mod_color,
 		/* 4. ---- SET REGAMMA ---- */
 		struct dc_transfer_func *output_tf = NULL;
 
-		output_tf = dc_create_transfer_func(core_color->dc);
+		output_tf = dc_create_transfer_func();
 
 		if (output_tf != NULL) {
 			output_tf->type = TF_TYPE_PREDEFINED;
Signature · 6 lines
2.9.3

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#8 lore raw

PATCH 7/14 drm/amd/display: don't crash if stream is NULL when trying to share clocks

In reply to a message not in the archive

From: Yongqiang Sun <[email protected]>

Change-Id I490ec0a8edc46c677d93ebcced7e9d2653999481
---
 drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +5 -0
index 343114b2680f..eac597d0c790 100644
@@ -288,6 +288,11 @@ static bool is_sharable_clk_src(
 	if (pipe_with_clk_src->clock_source == NULL)
 		return false;
 
+	if (pipe_with_clk_src->stream == NULL) {
+		ASSERT(0);
+		return false;
+	}
+
 	if (pipe_with_clk_src->stream->signal == SIGNAL_TYPE_VIRTUAL)
 		return false;
 
Signature · 6 lines
2.9.3

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#9 lore raw

PATCH 8/14 drm/amd/display: reset transfer_func to NULL on release

In reply to a message not in the archive

From: Yongqiang Sun <[email protected]>

Change-Id I9a5c699fd9b17c15ea2903d6a1b13c47209f8311
---
 drivers/gpu/drm/amd/display/dc/core/dc_stream.c  | 4 +++-
 drivers/gpu/drm/amd/display/dc/core/dc_surface.c | 8 ++++++--
 2 files changed, 9 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_stream.c +3 -1
index 237436e22720..84e3fbbe23ac 100644
@@ -89,9 +89,11 @@ static bool construct(struct core_stream *stream,
 static void destruct(struct core_stream *stream)
 {
 	dc_sink_release(&stream->sink->public);
-	if (stream->public.out_transfer_func != NULL)
+	if (stream->public.out_transfer_func != NULL) {
 		dc_transfer_func_release(
 				stream->public.out_transfer_func);
+		stream->public.out_transfer_func = NULL;
+	}
 }
 
 void dc_stream_retain(const struct dc_stream *dc_stream)
drivers/gpu/drm/amd/display/dc/core/dc_surface.c +6 -2
index 3ec1f363e43e..cf8fb9a8ce8e 100644
@@ -71,11 +71,15 @@ static bool construct(struct dc_context *ctx, struct surface *surface)
 
 static void destruct(struct surface *surface)
 {
-	if (surface->protected.public.gamma_correction != NULL)
+	if (surface->protected.public.gamma_correction != NULL) {
 		dc_gamma_release(surface->protected.public.gamma_correction);
-	if (surface->protected.public.in_transfer_func != NULL)
+		surface->protected.public.gamma_correction = NULL;
+	}
+	if (surface->protected.public.in_transfer_func != NULL) {
 		dc_transfer_func_release(
 				surface->protected.public.in_transfer_func);
+		surface->protected.public.in_transfer_func = NULL;
+	}
 }
 
 /*******************************************************************************
Signature · 6 lines
2.9.3

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#10 lore raw

PATCH 9/14 drm/amd/display: Fixed crash

In reply to a message not in the archive

From: Yongqiang Sun <[email protected]>

Change-Id I921091f888efd1acd2a6d6421cf149326ebe8c17
---
 drivers/gpu/drm/amd/display/dc/core/dc.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +5 -9
index 891075e39ecf..e6010abc9e0d 100644
@@ -167,24 +167,20 @@ static bool stream_adjust_vmin_vmax(struct dc *dc,
 	struct core_stream *core_stream = DC_STREAM_TO_CORE(stream[0]);
 	int i = 0;
 	bool ret = false;
-	struct pipe_ctx *pipes;
-	unsigned int underlay_idx = core_dc->res_pool->underlay_pipe_index;
 
 	for (i = 0; i < MAX_PIPES; i++) {
-		if (core_dc->current_context->res_ctx.pipe_ctx[i].stream == core_stream
-				&& i != underlay_idx) {
+		struct pipe_ctx *pipe = &core_dc->current_context->res_ctx.pipe_ctx[i];
 
-			pipes = &core_dc->current_context->res_ctx.pipe_ctx[i];
-			core_dc->hwss.set_drr(&pipes, 1, vmin, vmax);
+		if (pipe->stream == core_stream && pipe->stream_enc) {
+			core_dc->hwss.set_drr(&pipe, 1, vmin, vmax);
 
 			/* build and update the info frame */
-			resource_build_info_frame(pipes);
-			core_dc->hwss.update_info_frame(pipes);
+			resource_build_info_frame(pipe);
+			core_dc->hwss.update_info_frame(pipe);
 
 			ret = true;
 		}
 	}
-
 	return ret;
 }
 
Signature · 6 lines
2.9.3

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#11 lore raw

PATCH 10/14 drm/amd/display: Fix licensing header

In reply to a message not in the archive
Change-Id I571f298c0b4c01f1df8ebaf020daac3ea8e2974c
---
 .../drm/amd/display/modules/color/color_helper.c   | 31 +++++++++++++++-------
 .../drm/amd/display/modules/color/color_helper.h   | 30 ++++++++++++++-------
 2 files changed, 42 insertions(+), 19 deletions(-)
drivers/gpu/drm/amd/display/modules/color/color_helper.c +21 -10
index c47d2962c6d4..ff6779cdd623 100644
@@ -1,15 +1,26 @@
-
-/**
- *  @file
- *  @date Copyright (c) 2008 Advanced Micro Devices, Inc. (unpublished)
+/*
+ * Copyright 2016 Advanced Micro Devices, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
  *
- *  @brief Helper functions for color gamut calculation
+ * Authors: AMD
  *
- *  @internal
- *  All rights reserved.  This notice is intended as a precaution against
- *  inadvertent publication and does not imply publication or any waiver
- *  of confidentiality.  The year included in the foregoing notice is the
- *  year of creation of the work.
  */
 
 #include "dm_services.h"
drivers/gpu/drm/amd/display/modules/color/color_helper.h +21 -9
index b7a7ca4debd7..76575c1dc043 100644
@@ -1,14 +1,26 @@
-/**
- *  @file
- *  @date Copyright (c) 2008 Advanced Micro Devices, Inc. (unpublished)
+/*
+ * Copyright 2016 Advanced Micro Devices, Inc.
  *
- *  @brief Helper functions for color gamut calculation
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors: AMD
  *
- *  @internal
- *  All rights reserved.  This notice is intended as a precaution against
- *  inadvertent publication and does not imply publication or any waiver
- *  of confidentiality.  The year included in the foregoing notice is the
- *  year of creation of the work.
  */
 
 #ifndef COLOR_MOD_COLOR_HELPER_H_
Signature · 6 lines
2.9.3

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#12 lore raw

PATCH 11/14 drm/amd/display: Fixed split update bug.

In reply to a message not in the archive

From: Yongqiang Sun <[email protected]>

Change-Id I03970c775b188fabb05ee042e0b4482d4db209df
---
 drivers/gpu/drm/amd/display/dc/core/dc.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +12 -2
index e6010abc9e0d..5e60640df61b 100644
@@ -1333,6 +1333,7 @@ void dc_update_surfaces_for_target(struct dc *dc, struct dc_surface_update *upda
 	bool is_new_pipe_surface[MAX_PIPES];
 	const struct dc_surface *new_surfaces[MAX_SURFACES] = { 0 };
 	bool need_apply_clk_constraints = false;
+	bool can_skip_context_building = true;
 
 	update_surface_trace(dc, updates, surface_count);
 
@@ -1355,17 +1356,26 @@ void dc_update_surfaces_for_target(struct dc *dc, struct dc_surface_update *upda
 
 	for (i = 0 ; i < surface_count; i++) {
 		struct core_surface *surface = DC_SURFACE_TO_CORE(updates[i].surface);
+		bool existing_surface = false;
 
 		new_surfaces[i] = updates[i].surface;
+
 		for (j = 0; j < context->res_ctx.pool->pipe_count; j++) {
 			struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[j];
 
-			if (surface == pipe_ctx->surface)
+			if (surface == pipe_ctx->surface) {
+				existing_surface = true;
 				is_new_pipe_surface[j] = false;
+			}
 		}
+
+		if (updates[i].plane_info ||
+			updates[i].scaling_info ||
+			!existing_surface)
+			can_skip_context_building = false;
 	}
 
-	if (dc_target) {
+	if (!can_skip_context_building && dc_target) {
 		struct core_target *target = DC_TARGET_TO_CORE(dc_target);
 
 		if (core_dc->current_context->target_count == 0)
Signature · 6 lines
2.9.3

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#13 lore raw

PATCH 12/14 drm/amd/display: Fixed crash caused by unnecessary clock source in split pipe.

In reply to a message not in the archive

From: Yongqiang Sun <[email protected]>

Change-Id Ic802ab470632b8577f80ad17c08a59dd654f93d4
---
 drivers/gpu/drm/amd/display/dc/core/dc_resource.c    | 20 ++++++++++----------
 .../drm/amd/display/dc/dce110/dce110_hw_sequencer.c  |  4 ++--
 drivers/gpu/drm/amd/display/dc/inc/resource.h        |  2 +-
 3 files changed, 13 insertions(+), 13 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +10 -10
index eac597d0c790..386b3cc14fbe 100644
@@ -211,27 +211,28 @@ bool resource_construct(
 
 void resource_unreference_clock_source(
 		struct resource_context *res_ctx,
-		struct clock_source *clock_source)
+		struct clock_source **clock_source)
 {
 	int i;
 	for (i = 0; i < res_ctx->pool->clk_src_count; i++) {
-		if (res_ctx->pool->clock_sources[i] != clock_source)
+		if (res_ctx->pool->clock_sources[i] != *clock_source)
 			continue;
 
 		res_ctx->clock_source_ref_count[i]--;
 
 		if (res_ctx->clock_source_ref_count[i] == 0)
-			clock_source->funcs->cs_power_down(clock_source);
+			(*clock_source)->funcs->cs_power_down(*clock_source);
 
 		break;
 	}
 
-	if (res_ctx->pool->dp_clock_source == clock_source) {
+	if (res_ctx->pool->dp_clock_source == *clock_source) {
 		res_ctx->dp_clock_source_ref_count--;
 
 		if (res_ctx->dp_clock_source_ref_count == 0)
-			clock_source->funcs->cs_power_down(clock_source);
+			(*clock_source)->funcs->cs_power_down(*clock_source);
 	}
+	*clock_source = NULL;
 }
 
 void resource_reference_clock_source(
@@ -288,11 +289,6 @@ static bool is_sharable_clk_src(
 	if (pipe_with_clk_src->clock_source == NULL)
 		return false;
 
-	if (pipe_with_clk_src->stream == NULL) {
-		ASSERT(0);
-		return false;
-	}
-
 	if (pipe_with_clk_src->stream->signal == SIGNAL_TYPE_VIRTUAL)
 		return false;
 
@@ -1148,6 +1144,10 @@ enum dc_status resource_map_pool_resources(
 				pipe_ctx->stream = stream;
 				copy_pipe_ctx(old_pipe_ctx, pipe_ctx);
 
+				/* Split pipe resource, do not acquire back end */
+				if (!pipe_ctx->stream_enc)
+					continue;
+
 				set_stream_engine_in_use(
 					&context->res_ctx,
 					pipe_ctx->stream_enc);
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +2 -2
index e4cef9da5de1..6a7cb3e9294a 100644
@@ -1028,7 +1028,7 @@ static void switch_dp_clock_sources(
 			if (clk_src &&
 				clk_src != pipe_ctx->clock_source) {
 				resource_unreference_clock_source(
-					res_ctx, pipe_ctx->clock_source);
+					res_ctx, &pipe_ctx->clock_source);
 				pipe_ctx->clock_source = clk_src;
 				resource_reference_clock_source(res_ctx, clk_src);
 
@@ -1056,7 +1056,7 @@ static void reset_single_pipe_hw_ctx(
 	pipe_ctx->mi->funcs->free_mem_input(
 				pipe_ctx->mi, context->target_count);
 	resource_unreference_clock_source(
-			&context->res_ctx, pipe_ctx->clock_source);
+			&context->res_ctx, &pipe_ctx->clock_source);
 
 	dc->hwss.power_down_front_end((struct core_dc *)dc, pipe_ctx);
 
drivers/gpu/drm/amd/display/dc/inc/resource.h +1 -1
index 8dd676de6b07..adf297ec33b6 100644
@@ -94,7 +94,7 @@ void resource_build_info_frame(struct pipe_ctx *pipe_ctx);
 
 void resource_unreference_clock_source(
 		struct resource_context *res_ctx,
-		struct clock_source *clock_source);
+		struct clock_source **clock_source);
 
 void resource_reference_clock_source(
 		struct resource_context *res_ctx,
Signature · 6 lines
2.9.3

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#14 lore raw

PATCH 13/14 drm/amd/display: Add refcount debug assert

In reply to a message not in the archive

From: Andrey Grodzovsky <[email protected]>

---
 drivers/gpu/drm/amd/display/dc/core/dc_sink.c    |  5 +++--
 drivers/gpu/drm/amd/display/dc/core/dc_stream.c  |  5 ++++-
 drivers/gpu/drm/amd/display/dc/core/dc_surface.c | 14 +++++++++++---
 drivers/gpu/drm/amd/display/dc/core/dc_target.c  |  4 +++-
 4 files changed, 21 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_sink.c +3 -2
index 67ae799b6f4f..9dff0bfd5b23 100644
@@ -71,6 +71,7 @@ void dc_sink_retain(const struct dc_sink *dc_sink)
 {
 	struct sink *sink = DC_SINK_TO_SINK(dc_sink);
 
+	ASSERT(sink->ref_count > 0);
 	++sink->ref_count;
 }
 
@@ -78,6 +79,7 @@ void dc_sink_release(const struct dc_sink *dc_sink)
 {
 	struct sink *sink = DC_SINK_TO_SINK(dc_sink);
 
+	ASSERT(sink->ref_count > 0);
 	--sink->ref_count;
 
 	if (sink->ref_count == 0) {
@@ -96,8 +98,7 @@ struct dc_sink *dc_sink_create(const struct dc_sink_init_data *init_params)
 	if (false == construct(sink, init_params))
 		goto construct_fail;
 
-	/* TODO should we move this outside to where the assignment actually happens? */
-	dc_sink_retain(&sink->protected.public);
+	++sink->ref_count;
 
 	return &sink->protected.public;
 
drivers/gpu/drm/amd/display/dc/core/dc_stream.c +4 -1
index 84e3fbbe23ac..39a6124aa85f 100644
@@ -99,6 +99,8 @@ static void destruct(struct core_stream *stream)
 void dc_stream_retain(const struct dc_stream *dc_stream)
 {
 	struct stream *stream = DC_STREAM_TO_STREAM(dc_stream);
+
+	ASSERT(stream->ref_count > 0);
 	stream->ref_count++;
 }
 
@@ -108,6 +110,7 @@ void dc_stream_release(const struct dc_stream *public)
 	struct core_stream *protected = DC_STREAM_TO_CORE(public);
 
 	if (public != NULL) {
+		ASSERT(stream->ref_count > 0);
 		stream->ref_count--;
 
 		if (stream->ref_count == 0) {
@@ -134,7 +137,7 @@ struct dc_stream *dc_create_stream_for_sink(
 	if (false == construct(&stream->protected, dc_sink))
 			goto construct_fail;
 
-	dc_stream_retain(&stream->protected.public);
+	stream->ref_count++;
 
 	return &stream->protected.public;
 
drivers/gpu/drm/amd/display/dc/core/dc_surface.c +11 -3
index cf8fb9a8ce8e..6b4c75a78fe8 100644
@@ -105,7 +105,7 @@ struct dc_surface *dc_create_surface(const struct dc *dc)
 	if (false == construct(core_dc->ctx, surface))
 		goto construct_fail;
 
-	dc_surface_retain(&surface->protected.public);
+	++surface->ref_count;
 
 	return &surface->protected.public;
 
@@ -162,6 +162,7 @@ void dc_surface_retain(const struct dc_surface *dc_surface)
 {
 	struct surface *surface = DC_SURFACE_TO_SURFACE(dc_surface);
 
+	ASSERT(surface->ref_count > 0);
 	++surface->ref_count;
 }
 
@@ -169,6 +170,7 @@ void dc_surface_release(const struct dc_surface *dc_surface)
 {
 	struct surface *surface = DC_SURFACE_TO_SURFACE(dc_surface);
 
+	ASSERT(surface->ref_count > 0);
 	--surface->ref_count;
 
 	if (surface->ref_count == 0) {
@@ -181,12 +183,15 @@ void dc_gamma_retain(const struct dc_gamma *dc_gamma)
 {
 	struct gamma *gamma = DC_GAMMA_TO_GAMMA(dc_gamma);
 
+	ASSERT(gamma->ref_count > 0);
 	++gamma->ref_count;
 }
 
 void dc_gamma_release(const struct dc_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)
@@ -200,7 +205,7 @@ struct dc_gamma *dc_create_gamma()
 	if (gamma == NULL)
 		goto alloc_fail;
 
-	dc_gamma_retain(&gamma->protected.public);
+	++gamma->ref_count;
 
 	return &gamma->protected.public;
 
@@ -212,12 +217,15 @@ void dc_transfer_func_retain(const struct dc_transfer_func *dc_tf)
 {
 	struct transfer_func *tf = DC_TRANSFER_FUNC_TO_TRANSFER_FUNC(dc_tf);
 
+	ASSERT(tf->ref_count > 0);
 	++tf->ref_count;
 }
 
 void dc_transfer_func_release(const struct dc_transfer_func *dc_tf)
 {
 	struct transfer_func *tf = DC_TRANSFER_FUNC_TO_TRANSFER_FUNC(dc_tf);
+
+	ASSERT(tf->ref_count > 0);
 	--tf->ref_count;
 
 	if (tf->ref_count == 0)
@@ -231,7 +239,7 @@ struct dc_transfer_func *dc_create_transfer_func()
 	if (tf == NULL)
 		goto alloc_fail;
 
-	dc_transfer_func_retain(&tf->protected.public);
+	++tf->ref_count;
 
 	return &tf->protected.public;
 
drivers/gpu/drm/amd/display/dc/core/dc_target.c +3 -1
index 2531df74871a..d4ecf2da26d2 100644
@@ -71,6 +71,7 @@ void dc_target_retain(const struct dc_target *dc_target)
 {
 	struct target *target = DC_TARGET_TO_TARGET(dc_target);
 
+	ASSERT(target->ref_count > 0);
 	target->ref_count++;
 }
 
@@ -81,6 +82,7 @@ void dc_target_release(const struct dc_target *dc_target)
 
 	ASSERT(target->ref_count > 0);
 	target->ref_count--;
+
 	if (target->ref_count == 0) {
 		destruct(protected);
 		dm_free(target);
@@ -120,7 +122,7 @@ struct dc_target *dc_create_target_for_streams(
 
 	construct(&target->protected, stream->ctx, dc_streams, stream_count);
 
-	dc_target_retain(&target->protected.public);
+	target->ref_count++;
 
 	return &target->protected.public;
 
Signature · 6 lines
2.9.3

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#15 lore raw

PATCH 14/14 drm/amd/display: Pass adev to fill_plane_attr

In reply to a message not in the archive

From: Andrey Grodzovsky <[email protected]>

Change-Id I9e23df476423f216ac52727a288913ccb9c2ce94
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c +10 -1
index 6a2548e8082b..fd03e4f7231b 100644
@@ -413,6 +413,7 @@ static bool get_fb_info(
 	return true;
 }
 static void fill_plane_attributes_from_fb(
+	struct amdgpu_device *adev,
 	struct dc_surface *surface,
 	const struct amdgpu_framebuffer *amdgpu_fb, bool addReq)
 {
@@ -455,6 +456,7 @@ static void fill_plane_attributes_from_fb(
 
 	memset(&surface->tiling_info, 0, sizeof(surface->tiling_info));
 
+	/* Fill GFX8 params */
 	if (AMDGPU_TILING_GET(tiling_flags, ARRAY_MODE) == DC_ARRAY_2D_TILED_THIN1)
 	{
 		unsigned bankw, bankh, mtaspect, tile_split, num_banks;
@@ -545,6 +547,7 @@ static void fill_gamma_from_crtc(
 }
 
 static void fill_plane_attributes(
+			struct amdgpu_device *adev,
 			struct dc_surface *surface,
 			struct drm_plane_state *state, bool addrReq)
 {
@@ -554,6 +557,7 @@ static void fill_plane_attributes(
 
 	fill_rects_from_plane_state(state, surface);
 	fill_plane_attributes_from_fb(
+		crtc->dev->dev_private,
 		surface,
 		amdgpu_fb,
 		addrReq);
@@ -668,7 +672,11 @@ static void dm_dc_surface_commit(
 	}
 
 	/* Surface programming */
-	fill_plane_attributes(dc_surface, crtc->primary->state, true);
+	fill_plane_attributes(
+			crtc->dev->dev_private,
+			dc_surface,
+			crtc->primary->state,
+			true);
 	if (crtc->mode.private_flags &
 		AMDGPU_CRTC_MODE_PRIVATE_FLAGS_GAMMASET) {
 		/* reset trigger of gamma */
@@ -3167,6 +3175,7 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,
 
 				surface = dc_create_surface(dc);
 				fill_plane_attributes(
+					crtc->dev->dev_private,
 					surface,
 					plane_state,
 					false);
Signature · 6 lines
2.9.3

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx