Skip to contentSkip to conversation

DC Patches Dec 14, 2016

PATCH New Harry Wentland 1 participant 8 messages Dec 14, 2016 1 message not in the archive

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

cover DC Patches Dec 14, 2016

* Bunch of bug fixes
* First step for change on how gamma is programmed

Amy Zhang (1):
drm/amd/display: Fix Gamma Adjustment

Andrew Wong (2):
drm/amd/display: Change locking of registers when flipping frames. drm/amd/display: Retrieve windowed fullscreen state

Anthony Koo (1):
drm/amd/display: Add in/out transfer functions to DC

Vitaly Prosyak (1):
drm/amd/display: re gamma programming

Yongqiang Sun (1):
drm/amd/display: Moved swizzle parameter translation to dc.

Zeyu Fan (1):
drm/amd/display: Fix HDMI scaling corruption issue.

 drivers/gpu/drm/amd/display/dc/basics/conversion.c |  9 +++
 drivers/gpu/drm/amd/display/dc/basics/conversion.h |  2 +
 drivers/gpu/drm/amd/display/dc/core/dc.c           | 62 +++++++++++++++-----
 drivers/gpu/drm/amd/display/dc/core/dc_surface.c   | 67 ++++++++++++++++------
 drivers/gpu/drm/amd/display/dc/dc.h                | 41 ++++++++++++-
 drivers/gpu/drm/amd/display/dc/dc_helper.c         | 14 +++++
 drivers/gpu/drm/amd/display/dc/dce/dce_hwseq.c     | 11 +---
 drivers/gpu/drm/amd/display/dc/dce/dce_mem_input.c | 11 +---
 drivers/gpu/drm/amd/display/dc/dce/dce_transform.c |  5 ++
 drivers/gpu/drm/amd/display/dc/dce/dce_transform.h |  8 ++-
 .../amd/display/dc/dce110/dce110_hw_sequencer.c    | 36 ++++--------
 .../drm/amd/display/dc/dce110/dce110_mem_input.c   | 17 +++++-
 drivers/gpu/drm/amd/display/dc/inc/core_types.h    |  5 ++
 drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h  |  7 +--
 drivers/gpu/drm/amd/display/dc/inc/reg_helper.h    | 13 +++++
 .../drm/amd/display/modules/freesync/freesync.c    |  3 +
 16 files changed, 225 insertions(+), 86 deletions(-)
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): 20161214223548.9717-1-harry.wentland-5C7GfCeVMHo@public.gmane.org

#2 lore raw

PATCH 1/7 drm/amd/display: Fix Gamma Adjustment

From: Amy Zhang <[email protected]>

- Gamma correction is not properly copied to the surface after refactor
- Make sure gamma correction is copied with correct retain

Change-Id I26ab634e270e73b77683b63dc448044d2c825285
---
 drivers/gpu/drm/amd/display/dc/core/dc.c         | 14 ++++++++++++--
 drivers/gpu/drm/amd/display/dc/core/dc_surface.c |  3 ++-
 drivers/gpu/drm/amd/display/dc/dc.h              |  1 +
 3 files changed, 15 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +12 -2
index de99d71f9042..41df500817ad 100644
@@ -1302,8 +1302,8 @@ bool dc_commit_surfaces_to_target(
 
 	for (i = 0; i < new_surface_count; i++) {
 		updates[i].surface = new_surfaces[i];
-		updates[i].gamma = (struct dc_gamma *)new_surfaces[i]->gamma_correction;
-
+		updates[i].gamma =
+			(struct dc_gamma *)new_surfaces[i]->gamma_correction;
 		flip_addr[i].address = new_surfaces[i]->address;
 		flip_addr[i].flip_immediate = new_surfaces[i]->flip_immediate;
 		plane_info[i].color_space = new_surfaces[i]->color_space;
@@ -1444,6 +1444,16 @@ void dc_update_surfaces_for_target(struct dc *dc, struct dc_surface_update *upda
 					pipe_ctx->scl_data.recout.width -= 2;
 				}
 			}
+
+			if (updates[i].gamma) {
+				if (surface->public.gamma_correction != NULL)
+					dc_gamma_release(surface->public.
+							gamma_correction);
+
+				dc_gamma_retain(updates[i].gamma);
+				surface->public.gamma_correction =
+							updates[i].gamma;
+			}
 		}
 	}
 
drivers/gpu/drm/amd/display/dc/core/dc_surface.c +2 -1
index 045005e90eed..813c37e3ea8f 100644
@@ -64,7 +64,8 @@ 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);
 }
 
 /*******************************************************************************
drivers/gpu/drm/amd/display/dc/dc.h +1 -0
index 454485b97852..d9e2ed1ee5c0 100644
@@ -312,6 +312,7 @@ const struct dc_surface_status *dc_surface_get_status(
 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);
 struct dc_gamma *dc_create_gamma(const struct dc *dc);
 
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/7 drm/amd/display: Change locking of registers when flipping frames.

In reply to a message not in the archive

From: Andrew Wong <[email protected]>

- Introduce GRPH_UPDATE_LOCK around programming surface flip.
- Remove the now unused graphic surface lock.
- Add macros to get and set four registers
- both immediate and H Retrace should not be enabled at the same time

Change-Id Id5e54253f3e104730386e1aea551c2835282fbeb
---
 drivers/gpu/drm/amd/display/dc/core/dc.c                |  9 +--------
 drivers/gpu/drm/amd/display/dc/dc_helper.c              | 14 ++++++++++++++
 drivers/gpu/drm/amd/display/dc/dce/dce_hwseq.c          | 11 +++--------
 .../gpu/drm/amd/display/dc/dce110/dce110_mem_input.c    | 17 +++++++++++++++--
 drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h       |  3 +--
 drivers/gpu/drm/amd/display/dc/inc/reg_helper.h         | 13 +++++++++++++
 6 files changed, 47 insertions(+), 20 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +1 -8
index 41df500817ad..75b6e404d016 100644
@@ -1468,11 +1468,6 @@ void dc_update_surfaces_for_target(struct dc *dc, struct dc_surface_update *upda
 				continue;
 
 			if (updates[i].flip_addr) {
-				core_dc->hwss.pipe_control_lock(
-							core_dc->hwseq,
-							pipe_ctx->pipe_idx,
-							PIPE_LOCK_CONTROL_SURFACE,
-							true);
 				core_dc->hwss.update_plane_addr(core_dc, pipe_ctx);
 			}
 
@@ -1485,7 +1480,6 @@ void dc_update_surfaces_for_target(struct dc *dc, struct dc_surface_update *upda
 					core_dc->hwss.pipe_control_lock(
 							core_dc->hwseq,
 							pipe_ctx->pipe_idx,
-							PIPE_LOCK_CONTROL_SURFACE |
 							PIPE_LOCK_CONTROL_GRAPHICS |
 							PIPE_LOCK_CONTROL_SCL |
 							PIPE_LOCK_CONTROL_BLENDER |
@@ -1515,8 +1509,7 @@ void dc_update_surfaces_for_target(struct dc *dc, struct dc_surface_update *upda
 							pipe_ctx->pipe_idx,
 							PIPE_LOCK_CONTROL_GRAPHICS |
 							PIPE_LOCK_CONTROL_SCL |
-							PIPE_LOCK_CONTROL_BLENDER |
-							PIPE_LOCK_CONTROL_SURFACE,
+							PIPE_LOCK_CONTROL_BLENDER,
 							false);
 				}
 				break;
drivers/gpu/drm/amd/display/dc/dc_helper.c +14 -0
index c5ff7b6d733d..a950dd53bca4 100644
@@ -65,6 +65,20 @@ uint32_t generic_reg_get3(const struct dc_context *ctx, uint32_t addr,
 	return reg_val;
 }
 
+uint32_t generic_reg_get4(const struct dc_context *ctx, uint32_t addr,
+		uint8_t shift1, uint32_t mask1, uint32_t *field_value1,
+		uint8_t shift2, uint32_t mask2, uint32_t *field_value2,
+		uint8_t shift3, uint32_t mask3, uint32_t *field_value3,
+		uint8_t shift4, uint32_t mask4, uint32_t *field_value4)
+{
+	uint32_t reg_val = dm_read_reg(ctx, addr);
+	*field_value1 = get_reg_field_value_ex(reg_val, mask1, shift1);
+	*field_value2 = get_reg_field_value_ex(reg_val, mask2, shift2);
+	*field_value3 = get_reg_field_value_ex(reg_val, mask3, shift3);
+	*field_value4 = get_reg_field_value_ex(reg_val, mask4, shift4);
+	return reg_val;
+}
+
 uint32_t generic_reg_get5(const struct dc_context *ctx, uint32_t addr,
 		uint8_t shift1, uint32_t mask1, uint32_t *field_value1,
 		uint8_t shift2, uint32_t mask2, uint32_t *field_value2,
drivers/gpu/drm/amd/display/dc/dce/dce_hwseq.c +3 -8
index dd1cf5e6e949..cd9a371ae237 100644
@@ -49,12 +49,11 @@ void dce_pipe_control_lock(struct dce_hwseq *hws,
 		bool lock)
 {
 	uint32_t lock_val = lock ? 1 : 0;
-	uint32_t dcp_grph, scl, dcp_grph_surf, blnd, update_lock_mode;
+	uint32_t dcp_grph, scl, blnd, update_lock_mode;
 
-	uint32_t val = REG_GET_5(BLND_V_UPDATE_LOCK[blnd_inst],
+	uint32_t val = REG_GET_4(BLND_V_UPDATE_LOCK[blnd_inst],
 			BLND_DCP_GRPH_V_UPDATE_LOCK, &dcp_grph,
 			BLND_SCL_V_UPDATE_LOCK, &scl,
-			BLND_DCP_GRPH_SURF_V_UPDATE_LOCK, &dcp_grph_surf,
 			BLND_BLND_V_UPDATE_LOCK, &blnd,
 			BLND_V_UPDATE_LOCK_MODE, &update_lock_mode);
 
@@ -64,19 +63,15 @@ void dce_pipe_control_lock(struct dce_hwseq *hws,
 	if (control_mask & PIPE_LOCK_CONTROL_SCL)
 		scl = lock_val;
 
-	if (control_mask & PIPE_LOCK_CONTROL_SURFACE)
-		dcp_grph_surf = lock_val;
-
 	if (control_mask & PIPE_LOCK_CONTROL_BLENDER)
 		blnd = lock_val;
 
 	if (control_mask & PIPE_LOCK_CONTROL_MODE)
 		update_lock_mode = lock_val;
 
-	REG_SET_5(BLND_V_UPDATE_LOCK[blnd_inst], val,
+	REG_SET_4(BLND_V_UPDATE_LOCK[blnd_inst], val,
 			BLND_DCP_GRPH_V_UPDATE_LOCK, dcp_grph,
 			BLND_SCL_V_UPDATE_LOCK, scl,
-			BLND_DCP_GRPH_SURF_V_UPDATE_LOCK, dcp_grph_surf,
 			BLND_BLND_V_UPDATE_LOCK, blnd,
 			BLND_V_UPDATE_LOCK_MODE, update_lock_mode);
 
drivers/gpu/drm/amd/display/dc/dce110/dce110_mem_input.c +15 -2
index af9d682f8943..a20feaedfca4 100644
@@ -113,16 +113,25 @@ bool dce110_mem_input_program_surface_flip_and_addr(
 	struct dce110_mem_input *mem_input110 = TO_DCE110_MEM_INPUT(mem_input);
 
 	uint32_t value = 0;
+	uint32_t value_old = 0;
+	uint32_t lock_value = 0;
+
+	lock_value = dm_read_reg(mem_input110->base.ctx, DCP_REG(mmGRPH_UPDATE));
+	set_reg_field_value(lock_value, 1, GRPH_UPDATE, GRPH_UPDATE_LOCK);
+	dm_write_reg(mem_input110->base.ctx, DCP_REG(mmGRPH_UPDATE), lock_value);
 
 	value = dm_read_reg(mem_input110->base.ctx, DCP_REG(mmGRPH_FLIP_CONTROL));
+	value_old = value;
 	if (flip_immediate) {
-		set_reg_field_value(value, 1, GRPH_FLIP_CONTROL, GRPH_SURFACE_UPDATE_IMMEDIATE_EN);
+		set_reg_field_value(value, 0, GRPH_FLIP_CONTROL, GRPH_SURFACE_UPDATE_IMMEDIATE_EN);
 		set_reg_field_value(value, 1, GRPH_FLIP_CONTROL, GRPH_SURFACE_UPDATE_H_RETRACE_EN);
 	} else {
 		set_reg_field_value(value, 0, GRPH_FLIP_CONTROL, GRPH_SURFACE_UPDATE_IMMEDIATE_EN);
 		set_reg_field_value(value, 0, GRPH_FLIP_CONTROL, GRPH_SURFACE_UPDATE_H_RETRACE_EN);
 	}
-	dm_write_reg(mem_input110->base.ctx, DCP_REG(mmGRPH_FLIP_CONTROL), value);
+	if (value != value_old) {
+		dm_write_reg(mem_input110->base.ctx, DCP_REG(mmGRPH_FLIP_CONTROL), value);
+	}
 
 	switch (address->type) {
 	case PLN_ADDR_TYPE_GRAPHICS:
@@ -147,6 +156,10 @@ bool dce110_mem_input_program_surface_flip_and_addr(
 	if (flip_immediate)
 		mem_input->current_address = *address;
 
+	lock_value = dm_read_reg(mem_input110->base.ctx, DCP_REG(mmGRPH_UPDATE));
+	set_reg_field_value(lock_value, 0, GRPH_UPDATE, GRPH_UPDATE_LOCK);
+	dm_write_reg(mem_input110->base.ctx, DCP_REG(mmGRPH_UPDATE), lock_value);
+
 	return true;
 }
 
drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h +1 -2
index 50d499cc01a4..fcaf2c71e4eb 100644
@@ -40,8 +40,7 @@ enum pipe_lock_control {
 	PIPE_LOCK_CONTROL_GRAPHICS = 1 << 0,
 	PIPE_LOCK_CONTROL_BLENDER = 1 << 1,
 	PIPE_LOCK_CONTROL_SCL = 1 << 2,
-	PIPE_LOCK_CONTROL_SURFACE = 1 << 3,
-	PIPE_LOCK_CONTROL_MODE = 1 << 4
+	PIPE_LOCK_CONTROL_MODE = 1 << 3
 };
 
 struct dce_hwseq;
drivers/gpu/drm/amd/display/dc/inc/reg_helper.h +13 -0
index dbc8424f7b69..a07817472089 100644
@@ -143,6 +143,13 @@
 				FN(reg_name, f2), v2, \
 				FN(reg_name, f3), v3)
 
+#define REG_GET_4(reg_name, f1, v1, f2, v2, f3, v3, f4, v4)	\
+		generic_reg_get4(CTX, REG(reg_name), \
+				FN(reg_name, f1), v1, \
+				FN(reg_name, f2), v2, \
+				FN(reg_name, f3), v3, \
+				FN(reg_name, f4), v4)
+
 #define REG_GET_5(reg_name, f1, v1, f2, v2, f3, v3, f4, v4, f5, v5)	\
 		generic_reg_get5(CTX, REG(reg_name), \
 				FN(reg_name, f1), v1, \
@@ -280,6 +287,12 @@ uint32_t generic_reg_get3(const struct dc_context *ctx, uint32_t addr,
 		uint8_t shift2, uint32_t mask2, uint32_t *field_value2,
 		uint8_t shift3, uint32_t mask3, uint32_t *field_value3);
 
+uint32_t generic_reg_get4(const struct dc_context *ctx, uint32_t addr,
+		uint8_t shift1, uint32_t mask1, uint32_t *field_value1,
+		uint8_t shift2, uint32_t mask2, uint32_t *field_value2,
+		uint8_t shift3, uint32_t mask3, uint32_t *field_value3,
+		uint8_t shift4, uint32_t mask4, uint32_t *field_value4);
+
 uint32_t generic_reg_get5(const struct dc_context *ctx, uint32_t addr,
 		uint8_t shift1, uint32_t mask1, uint32_t *field_value1,
 		uint8_t shift2, uint32_t mask2, uint32_t *field_value2,
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/7 drm/amd/display: Retrieve windowed fullscreen state

In reply to a message not in the archive

From: Andrew Wong <[email protected]>

- Retrieve windowed fullscreen state when getting freesync params.

Change-Id Idde76f5c216016b24abc51e654a59ce473960be8
---
 drivers/gpu/drm/amd/display/modules/freesync/freesync.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/display/modules/freesync/freesync.c +3 -0
index 8892e8bec7c3..6f4d169f4e4e 100644
@@ -784,6 +784,9 @@ bool mod_freesync_get_state(struct mod_freesync *mod_freesync,
 	freesync_params->update_duration_in_ns =
 		core_freesync->map[index].state.time.update_duration_in_ns;
 
+	freesync_params->windowed_fullscreen =
+			core_freesync->map[index].state.windowed_fullscreen;
+
 	return true;
 }
 
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/7 drm/amd/display: Fix HDMI scaling corruption issue.

In reply to a message not in the archive

From: Zeyu Fan <[email protected]>

Change-Id Ifbb1d4d5ef34688df12c1055eb3ec222b46cd969
---
 drivers/gpu/drm/amd/display/dc/dce/dce_transform.c | 5 +++++
 drivers/gpu/drm/amd/display/dc/dce/dce_transform.h | 8 +++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dce/dce_transform.c +5 -0
index bbf4d97cb980..50a6a25561b4 100644
@@ -83,6 +83,8 @@ static bool setup_scaling_configuration(
 	struct dce_transform *xfm_dce,
 	const struct scaler_data *data)
 {
+	REG_SET(SCL_BYPASS_CONTROL, 0, SCL_BYPASS_MODE, 0);
+
 	if (data->taps.h_taps + data->taps.v_taps <= 2) {
 		/* Set bypass */
 		REG_UPDATE_2(SCL_MODE, SCL_MODE, 0, SCL_PSCL_EN, 0);
@@ -285,6 +287,9 @@ static void dce_transform_set_scaler(
 			LB_MEMORY_CONFIG, 0,
 			LB_MEMORY_SIZE, xfm_dce->lb_memory_size);
 
+	/* Clear SCL_F_SHARP_CONTROL value to 0 */
+	REG_WRITE(SCL_F_SHARP_CONTROL, 0);
+
 	/* 1. Program overscan */
 	program_overscan(xfm_dce, data);
 
drivers/gpu/drm/amd/display/dc/dce/dce_transform.h +7 -1
index 897645e2889f..b2cf9bfb0094 100644
@@ -53,6 +53,7 @@
 	SRI(SCL_MODE, SCL, id), \
 	SRI(SCL_TAP_CONTROL, SCL, id), \
 	SRI(SCL_CONTROL, SCL, id), \
+	SRI(SCL_BYPASS_CONTROL, SCL, id), \
 	SRI(EXT_OVERSCAN_LEFT_RIGHT, SCL, id), \
 	SRI(EXT_OVERSCAN_TOP_BOTTOM, SCL, id), \
 	SRI(SCL_VERT_FILTER_CONTROL, SCL, id), \
@@ -67,7 +68,8 @@
 	SRI(SCL_VERT_FILTER_INIT, SCL, id), \
 	SRI(SCL_AUTOMATIC_MODE_CONTROL, SCL, id), \
 	SRI(LB_MEMORY_CTRL, LB, id), \
-	SRI(SCL_UPDATE, SCL, id)
+	SRI(SCL_UPDATE, SCL, id), \
+	SRI(SCL_F_SHARP_CONTROL, SCL, id)
 
 #define XFM_COMMON_REG_LIST_DCE100(id) \
 	XFM_COMMON_REG_LIST_DCE_BASE(id), \
@@ -116,6 +118,7 @@
 	XFM_SF(SCL_TAP_CONTROL, SCL_H_NUM_OF_TAPS, mask_sh), \
 	XFM_SF(SCL_TAP_CONTROL, SCL_V_NUM_OF_TAPS, mask_sh), \
 	XFM_SF(SCL_CONTROL, SCL_BOUNDARY_MODE, mask_sh), \
+	XFM_SF(SCL_BYPASS_CONTROL, SCL_BYPASS_MODE, mask_sh), \
 	XFM_SF(EXT_OVERSCAN_LEFT_RIGHT, EXT_OVERSCAN_LEFT, mask_sh), \
 	XFM_SF(EXT_OVERSCAN_LEFT_RIGHT, EXT_OVERSCAN_RIGHT, mask_sh), \
 	XFM_SF(EXT_OVERSCAN_TOP_BOTTOM, EXT_OVERSCAN_TOP, mask_sh), \
@@ -181,6 +184,7 @@
 	type GAMUT_REMAP_C34; \
 	type GRPH_GAMUT_REMAP_MODE; \
 	type SCL_MODE; \
+	type SCL_BYPASS_MODE; \
 	type SCL_PSCL_EN; \
 	type SCL_H_NUM_OF_TAPS; \
 	type SCL_V_NUM_OF_TAPS; \
@@ -241,6 +245,7 @@ struct dce_transform_registers {
 	uint32_t SCL_MODE;
 	uint32_t SCL_TAP_CONTROL;
 	uint32_t SCL_CONTROL;
+	uint32_t SCL_BYPASS_CONTROL;
 	uint32_t EXT_OVERSCAN_LEFT_RIGHT;
 	uint32_t EXT_OVERSCAN_TOP_BOTTOM;
 	uint32_t SCL_VERT_FILTER_CONTROL;
@@ -258,6 +263,7 @@ struct dce_transform_registers {
 	uint32_t SCL_AUTOMATIC_MODE_CONTROL;
 	uint32_t LB_MEMORY_CTRL;
 	uint32_t SCL_UPDATE;
+	uint32_t SCL_F_SHARP_CONTROL;
 };
 
 struct init_int_and_frac {
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/7 drm/amd/display: re gamma programming

In reply to a message not in the archive

From: Vitaly Prosyak <[email protected]>

Fix gamma update logic to avoid crash

Change-Id I24a742a25c523f4dc931f5fa3e50d67cac4aa564
---
 drivers/gpu/drm/amd/display/dc/core/dc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +2 -1
index 75b6e404d016..9a35e3bb8283 100644
@@ -1445,7 +1445,8 @@ void dc_update_surfaces_for_target(struct dc *dc, struct dc_surface_update *upda
 				}
 			}
 
-			if (updates[i].gamma) {
+			if (updates[i].gamma && updates[i].gamma !=
+				surface->public.gamma_correction) {
 				if (surface->public.gamma_correction != NULL)
 					dc_gamma_release(surface->public.
 							gamma_correction);
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/7 drm/amd/display: Moved swizzle parameter translation to dc.

In reply to a message not in the archive

From: Yongqiang Sun <[email protected]>

Change-Id I20ff413ea632082c302f531be0adba75a249ceaf
---
 drivers/gpu/drm/amd/display/dc/basics/conversion.c |  9 +++++++++
 drivers/gpu/drm/amd/display/dc/basics/conversion.h |  2 ++
 drivers/gpu/drm/amd/display/dc/dce/dce_mem_input.c | 11 +----------
 3 files changed, 12 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/display/dc/basics/conversion.c +9 -0
index ebe14e17cc2e..5682fea2080d 100644
@@ -221,3 +221,12 @@ void calculate_adjustments_y_only(
 		adjustments->brightness);
 }
 
+unsigned int log_2(unsigned int num)
+{
+	unsigned int result = 0;
+
+	while ((num >>= 1) != 0)
+		result++;
+
+	return result;
+}
drivers/gpu/drm/amd/display/dc/basics/conversion.h +2 -0
index 18cbe41e80ff..b7fe431a7952 100644
@@ -48,4 +48,6 @@ void calculate_adjustments_y_only(
 	const struct dc_csc_adjustments *adjustments,
 	struct fixed31_32 *matrix);
 
+unsigned int log_2(unsigned int num);
+
 #endif
drivers/gpu/drm/amd/display/dc/dce/dce_mem_input.c +1 -10
index fd8a49afbec6..e9005e0048e6 100644
@@ -25,6 +25,7 @@
 
 #include "mem_input.h"
 #include "reg_helper.h"
+#include "basics/conversion.h"
 
 #define CTX \
 	mi->ctx
@@ -129,16 +130,6 @@ static bool is_vert_scan(enum dc_rotation_angle rotation)
 	}
 }
 
-static unsigned int log_2(unsigned int num)
-{
-	unsigned int result = 0;
-
-	while ((num >>= 1) != 0)
-		result++;
-
-	return result;
-}
-
 void dce_mem_input_program_pte_vm(struct mem_input *mi,
 		enum surface_pixel_format format,
 		union dc_tiling_info *tiling_info,
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/7 drm/amd/display: Add in/out transfer functions to DC

In reply to a message not in the archive

From: Anthony Koo <[email protected]>

Refactor part 1 of degamma/regamma programming.

End goal is to have source and output transfer function in which dc can use to decide how to program the degamma and regamma HW.

Gamma will be explicitly applied through
dc_update_surfaces_for_target.

Color module should build the logical curve with all adjustments applied and pass enough information for dc to program HW PWL.

Change-Id If6cfcdd0df0425e3b01d909edf21f196cdd8b8d1
---
 drivers/gpu/drm/amd/display/dc/core/dc.c           | 38 +++++++++++--
 drivers/gpu/drm/amd/display/dc/core/dc_surface.c   | 64 ++++++++++++++++------
 drivers/gpu/drm/amd/display/dc/dc.h                | 40 +++++++++++++-
 .../amd/display/dc/dce110/dce110_hw_sequencer.c    | 36 ++++--------
 drivers/gpu/drm/amd/display/dc/inc/core_types.h    |  5 ++
 drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h  |  4 +-
 6 files changed, 135 insertions(+), 52 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +34 -4
index 9a35e3bb8283..f20701a507da 100644
@@ -1455,6 +1455,34 @@ void dc_update_surfaces_for_target(struct dc *dc, struct dc_surface_update *upda
 				surface->public.gamma_correction =
 							updates[i].gamma;
 			}
+
+			if (updates[i].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.
+							in_transfer_func);
+
+				dc_transfer_func_retain(
+						updates[i].in_transfer_func);
+				surface->public.in_transfer_func =
+						updates[i].in_transfer_func;
+			}
+
+			if (updates[i].out_transfer_func &&
+					updates[i].out_transfer_func !=
+					surface->public.out_transfer_func) {
+				if (surface->public.out_transfer_func != NULL)
+					dc_transfer_func_release(
+							surface->public.
+							out_transfer_func);
+
+				dc_transfer_func_retain(
+						updates[i].out_transfer_func);
+				surface->public.out_transfer_func =
+						updates[i].out_transfer_func;
+			}
 		}
 	}
 
@@ -1474,7 +1502,6 @@ void dc_update_surfaces_for_target(struct dc *dc, struct dc_surface_update *upda
 
 			if (updates[i].plane_info || updates[i].scaling_info
 					|| is_new_pipe_surface[j]) {
-
 				apply_ctx = true;
 
 				if (!pipe_ctx->tg->funcs->is_blanked(pipe_ctx->tg)) {
@@ -1489,9 +1516,12 @@ void dc_update_surfaces_for_target(struct dc *dc, struct dc_surface_update *upda
 				}
 			}
 
-			if (updates[i].gamma)
-				core_dc->hwss.prepare_pipe_for_context(
-						core_dc, pipe_ctx, context);
+			if (is_new_pipe_surface[j] ||
+					updates[i].gamma ||
+					updates[i].in_transfer_func ||
+					updates[i].out_transfer_func)
+				core_dc->hwss.set_gamma_correction(
+						pipe_ctx, pipe_ctx->surface);
 		}
 		if (apply_ctx) {
 			core_dc->hwss.apply_ctx_for_surface(core_dc, surface, context);
drivers/gpu/drm/amd/display/dc/core/dc_surface.c +46 -18

106 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dc.h +39 -1
index d9e2ed1ee5c0..4cb194831504 100644
@@ -201,7 +201,8 @@ bool dc_init_dchub(struct dc *dc, struct dchub_init_data *dh_data);
 
 enum {
 	RGB_256X3X16 = 256,
-	FLOAT_GAMMA_RAMP_MAX = 1025
+	FLOAT_GAMMA_RAMP_MAX = 1025,
+	TRANSFER_FUNC_POINTS = 1025
 };
 
 enum dc_gamma_ramp_type {
@@ -236,6 +237,31 @@ struct dc_gamma {
 	uint32_t size;
 };
 
+enum dc_transfer_func_type {
+	TF_TYPE_PREDEFINED,
+	TF_TYPE_DISTRIBUTED_POINTS,
+};
+
+struct dc_transfer_func_distributed_points {
+	uint16_t red[TRANSFER_FUNC_POINTS];
+	uint16_t green[TRANSFER_FUNC_POINTS];
+	uint16_t blue[TRANSFER_FUNC_POINTS];
+	uint16_t end_exponent;
+	uint16_t x_point_at_y1;
+};
+
+enum dc_transfer_func_predefined {
+	TRANSFER_FUNCTION_SRGB,
+	TRANSFER_FUNCTION_BT709,
+	TRANSFER_FUNCTION_LINEAR,
+};
+
+struct dc_transfer_func {
+	enum dc_transfer_func_type type;
+	enum dc_transfer_func_predefined tf;
+	struct dc_transfer_func_distributed_points tf_pts;
+};
+
 struct dc_surface {
 	bool visible;
 	bool flip_immediate;
@@ -256,7 +282,11 @@ 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;
+	const struct dc_transfer_func *out_transfer_func;
 };
 
 struct dc_plane_info {
@@ -287,8 +317,12 @@ struct dc_surface_update {
 	/* following updates require alloc/sleep/spin that is not isr safe,
 	 * null means no updates
 	 */
+	/* gamma TO BE REMOVED */
 	struct dc_gamma *gamma;
 
+	struct dc_transfer_func *in_transfer_func;
+	struct dc_transfer_func *out_transfer_func;
+
 
 };
 /*
@@ -316,6 +350,10 @@ 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);
 
+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);
+
 /*
  * This structure holds a surface address.  There could be multiple addresses
  * in cases such as Stereo 3D, Planar YUV, etc.  Other per-flip attributes such
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +10 -26
index 99937facf645..f6984e9ed169 100644
@@ -231,16 +231,20 @@ static void build_prescale_params(struct ipp_prescale_params *prescale_params,
 	}
 }
 
-static bool set_gamma_ramp(
-	struct input_pixel_processor *ipp,
-	struct output_pixel_processor *opp,
-	const struct core_gamma *ramp,
+static bool dce110_set_gamma_correction(
+	struct pipe_ctx *pipe_ctx,
 	const struct core_surface *surface)
 {
+	struct input_pixel_processor *ipp = pipe_ctx->ipp;
+	struct output_pixel_processor *opp = pipe_ctx->opp;
+	const struct core_gamma *ramp = NULL;
 	struct ipp_prescale_params prescale_params = { 0 };
 	struct pwl_params *regamma_params;
 	bool result = false;
 
+	if (surface->public.gamma_correction)
+		ramp = DC_GAMMA_TO_CORE(surface->public.gamma_correction);
+
 	regamma_params = dm_alloc(sizeof(struct pwl_params));
 	if (regamma_params == NULL)
 		goto regamma_alloc_fail;
@@ -1842,33 +1846,13 @@ static void dce110_program_front_end_for_pipe(
 			pipe_ctx->scl_data.recout.y);
 }
 
-
-
-static void dce110_prepare_pipe_for_surface_commit(
-		struct core_dc *dc,
-		struct pipe_ctx *pipe_ctx,
-		struct validate_context *context) {
-	struct core_gamma *gamma = NULL;
-
-	dc->hwss.increase_watermarks_for_pipe(dc, pipe_ctx, context);
-
-	if (pipe_ctx->surface->public.gamma_correction)
-		gamma = DC_GAMMA_TO_CORE(
-			pipe_ctx->surface->public.gamma_correction);
-
-	dc->hwss.set_gamma_correction(
-			pipe_ctx->ipp,
-			pipe_ctx->opp,
-			gamma, pipe_ctx->surface);
-}
-
 static void dce110_prepare_pipe_for_context(
 		struct core_dc *dc,
 		struct pipe_ctx *pipe_ctx,
 		struct validate_context *context)
 {
 	dce110_power_on_pipe_if_needed(dc, pipe_ctx, context);
-	dce110_prepare_pipe_for_surface_commit(dc, pipe_ctx, context);
+	dc->hwss.increase_watermarks_for_pipe(dc, pipe_ctx, context);
 }
 
 static void dce110_apply_ctx_for_surface(
@@ -1920,7 +1904,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_gamma_correction = set_gamma_ramp,
+	.set_gamma_correction = dce110_set_gamma_correction,
 	.power_down = dce110_power_down,
 	.enable_accelerated_mode = dce110_enable_accelerated_mode,
 	.enable_timing_synchronization = dce110_enable_timing_synchronization,
drivers/gpu/drm/amd/display/dc/inc/core_types.h +5 -0
index 3cf9bfb6decd..a67d6756095d 100644
@@ -66,6 +66,11 @@ struct core_gamma {
 	struct dc_context *ctx;
 };
 
+struct core_transfer_func {
+	struct dc_transfer_func public;
+	struct dc_context *ctx;
+};
+
 void enable_surface_flip_reporting(struct dc_surface *dc_surface,
 		uint32_t controller_id);
 
drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h +1 -3
index fcaf2c71e4eb..89a08342a51f 100644
@@ -78,9 +78,7 @@ struct hw_sequencer_funcs {
 			struct pipe_ctx *pipe_ctx);
 
 	bool (*set_gamma_correction)(
-				struct input_pixel_processor *ipp,
-				struct output_pixel_processor *opp,
-				const struct core_gamma *ramp,
+				struct pipe_ctx *pipe_ctx,
 				const struct core_surface *surface);
 
 	void (*power_down)(struct core_dc *dc);
Signature · 6 lines
2.9.3

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