コード例 #1
0
static void dce110_stream_encoder_set_mst_bandwidth(
	struct stream_encoder *enc,
	struct fixed31_32 avg_time_slots_per_mtp)
{
	struct dce110_stream_encoder *enc110 = DCE110STRENC_FROM_STRENC(enc);
	uint32_t x = dal_fixed31_32_floor(
		avg_time_slots_per_mtp);
	uint32_t y = dal_fixed31_32_ceil(
		dal_fixed31_32_shl(
			dal_fixed31_32_sub_int(
				avg_time_slots_per_mtp,
				x),
			26));

	{
		REG_SET_2(DP_MSE_RATE_CNTL, 0,
			DP_MSE_RATE_X, x,
			DP_MSE_RATE_Y, y);
	}

	/* wait for update to be completed on the link */
	/* i.e. DP_MSE_RATE_UPDATE_PENDING field (read only) */
	/* is reset to 0 (not pending) */
	REG_WAIT(DP_MSE_RATE_UPDATE, DP_MSE_RATE_UPDATE_PENDING,
			0,
			10, DP_MST_UPDATE_MAX_RETRY);
}
コード例 #2
0
uint16_t fixed_point_to_int_frac(
	struct fixed31_32 arg,
	uint8_t integer_bits,
	uint8_t fractional_bits)
{
	int32_t numerator;
	int32_t divisor = 1 << fractional_bits;

	uint16_t result;

	uint16_t d = (uint16_t)dal_fixed31_32_floor(
		dal_fixed31_32_abs(
			arg));

	if (d <= (uint16_t)(1 << integer_bits) - (1 / (uint16_t)divisor))
		numerator = (uint16_t)dal_fixed31_32_floor(
			dal_fixed31_32_mul_int(
				arg,
				divisor));
	else {
		numerator = dal_fixed31_32_floor(
			dal_fixed31_32_sub(
				dal_fixed31_32_from_int(
					1LL << integer_bits),
				dal_fixed31_32_recip(
					dal_fixed31_32_from_int(
						divisor))));
	}

	if (numerator >= 0)
		result = (uint16_t)numerator;
	else
		result = (uint16_t)(
		(1 << (integer_bits + fractional_bits + 1)) + numerator);

	if ((result != 0) && dal_fixed31_32_lt(
		arg, dal_fixed31_32_zero))
		result |= 1 << (integer_bits + fractional_bits);

	return result;
}
コード例 #3
0
enum ds_return dal_grph_colors_group_get_color_gamut(
	struct grph_colors_group *grph_colors_adj,
	struct display_path *disp_path,
	const struct ds_gamut_reference_data *ref,
	struct ds_get_gamut_data *data)
{
	enum ds_return ret;
	uint32_t display_index;
	struct adj_container *adj_container = NULL;
	struct adjustment_info *temperature_src = NULL;
	const struct display_characteristics *disp_char = NULL;
	struct color_characteristic color_charact = {{0 } };
	struct gamut_data gamut_data;
	enum adjustment_id adj_id;
	struct fixed31_32 result;

	if (!disp_path)
		return DS_ERROR;
	display_index = dal_display_path_get_display_index(
				disp_path);

	adj_container = dal_ds_dispatch_get_adj_container_for_path(
			grph_colors_adj->ds, display_index);
	if (!adj_container)
		return DS_ERROR;

	if (!dal_hw_sequencer_is_support_custom_gamut_adj(
			grph_colors_adj->hws,
			disp_path,
			HW_GRAPHIC_SURFACE))
		return DS_ERROR;

	dal_memset(&gamut_data, 0, sizeof(gamut_data));
	if (!dal_ds_translate_gamut_reference(
			ref, &adj_id))
		return DS_ERROR;

	if (adj_id == ADJ_ID_GAMUT_DESTINATION) {
		temperature_src = dal_adj_info_set_get_adj_info(
				&adj_container->adj_info_set,
				ADJ_ID_TEMPERATURE_SOURCE);
		if (temperature_src != NULL &&
			temperature_src->adj_data.ranged.cur ==
					COLOR_TEMPERATURE_SOURCE_EDID) {

			disp_char = dal_adj_container_get_disp_character(
							adj_container);
			if (!disp_char)
				return DS_ERROR;
			if (!dal_gamut_space_convert_edid_format_color_charact(
					disp_char->color_characteristics,
					&color_charact))
				return DS_ERROR;
			gamut_data.option.bits.CUSTOM_GAMUT_SPACE = 1;
			gamut_data.option.bits.CUSTOM_WHITE_POINT = 1;

			result = dal_fixed31_32_mul(
					dal_fixed31_32_from_int(
							(int64_t)GAMUT_DIVIDER),
					color_charact.red_x);
			gamut_data.gamut.custom.red_x =
					dal_fixed31_32_floor(result);

			result = dal_fixed31_32_mul(
					dal_fixed31_32_from_int(
							(int64_t)GAMUT_DIVIDER),
					color_charact.red_y);
			gamut_data.gamut.custom.red_y =
					dal_fixed31_32_floor(result);

			result = dal_fixed31_32_mul(
					dal_fixed31_32_from_int(
							(int64_t)GAMUT_DIVIDER),
					color_charact.blue_x);
			gamut_data.gamut.custom.blue_x =
					dal_fixed31_32_floor(result);

			result = dal_fixed31_32_mul(
					dal_fixed31_32_from_int(
							(int64_t)GAMUT_DIVIDER),
					color_charact.blue_y);
			gamut_data.gamut.custom.blue_y =
					dal_fixed31_32_floor(result);

			result = dal_fixed31_32_mul(
					dal_fixed31_32_from_int(
							(int64_t)GAMUT_DIVIDER),
					color_charact.green_x);
			gamut_data.gamut.custom.green_x =
					dal_fixed31_32_floor(result);

			result = dal_fixed31_32_mul(
					dal_fixed31_32_from_int(
							(int64_t)GAMUT_DIVIDER),
					color_charact.green_y);
			gamut_data.gamut.custom.green_y =
					dal_fixed31_32_floor(result);

			result = dal_fixed31_32_mul(
					dal_fixed31_32_from_int(
							(int64_t)GAMUT_DIVIDER),
					color_charact.white_x);
			gamut_data.white_point.custom.white_x =
					dal_fixed31_32_floor(result);

			result = dal_fixed31_32_mul(
					dal_fixed31_32_from_int(
							(int64_t)GAMUT_DIVIDER),
					color_charact.white_y);
			gamut_data.white_point.custom.white_y =
					dal_fixed31_32_floor(result);

			ret = DS_SUCCESS;
		}
	}
	if (ret != DS_SUCCESS)
		if (!dal_adj_container_get_gamut(
				adj_container,
				adj_id,
				&gamut_data))
			return DS_ERROR;
	if (!dal_ds_translate_internal_gamut_to_external_parameter(
			&gamut_data,
			&data->gamut))
		return DS_ERROR;
	return ret;
}
コード例 #4
0
void dce80_stream_encoder_set_mst_bandwidth(
	struct stream_encoder *enc,
	struct fixed31_32 avg_time_slots_per_mtp)
{
	struct dce110_stream_encoder *enc110 = DCE110STRENC_FROM_STRENC(enc);
	struct dc_context *ctx = enc110->base.ctx;
	uint32_t addr;
	uint32_t field;
	uint32_t value;
	uint32_t retries = 0;
	uint32_t x = dal_fixed31_32_floor(
		avg_time_slots_per_mtp);
	uint32_t y = dal_fixed31_32_ceil(
		dal_fixed31_32_shl(
			dal_fixed31_32_sub_int(
				avg_time_slots_per_mtp,
				x),
			26));

	{
		addr = LINK_REG(DP_MSE_RATE_CNTL);
		value = dm_read_reg(ctx, addr);

		set_reg_field_value(
			value,
			x,
			DP_MSE_RATE_CNTL,
			DP_MSE_RATE_X);

		set_reg_field_value(
			value,
			y,
			DP_MSE_RATE_CNTL,
			DP_MSE_RATE_Y);

		dm_write_reg(ctx, addr, value);
	}

	/* wait for update to be completed on the link */
	/* i.e. DP_MSE_RATE_UPDATE_PENDING field (read only) */
	/* is reset to 0 (not pending) */
	{
		addr = LINK_REG(DP_MSE_RATE_UPDATE);

		do {
			value = dm_read_reg(ctx, addr);

			field = get_reg_field_value(
					value,
					DP_MSE_RATE_UPDATE,
					DP_MSE_RATE_UPDATE_PENDING);

			if (!(field &
			DP_MSE_RATE_UPDATE__DP_MSE_RATE_UPDATE_PENDING_MASK))
				break;

			udelay(10);

			++retries;
		} while (retries < DP_MST_UPDATE_MAX_RETRY);
	}
}