Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2de3f778 authored by Chinmay Sawarkar's avatar Chinmay Sawarkar
Browse files

msm: vidc: Driver cleanup



Remove unused legacy properties.

CRs-Fixed: 2008588
Change-Id: I90c87fecb7a7e2d55635d9f24eca1d3512679ef1
Signed-off-by: default avatarChinmay Sawarkar <chinmays@codeaurora.org>
parent 007118cb
Loading
Loading
Loading
Loading
+95 −574
Original line number Diff line number Diff line
@@ -177,30 +177,12 @@ enum hal_video_codec vidc_get_hal_codec(u32 hfi_codec)
	case HFI_VIDEO_CODEC_H264:
		hal_codec = HAL_VIDEO_CODEC_H264;
		break;
	case HFI_VIDEO_CODEC_H263:
		hal_codec = HAL_VIDEO_CODEC_H263;
		break;
	case HFI_VIDEO_CODEC_MPEG1:
		hal_codec = HAL_VIDEO_CODEC_MPEG1;
		break;
	case HFI_VIDEO_CODEC_MPEG2:
		hal_codec = HAL_VIDEO_CODEC_MPEG2;
		break;
	case HFI_VIDEO_CODEC_MPEG4:
		hal_codec = HAL_VIDEO_CODEC_MPEG4;
		break;
	case HFI_VIDEO_CODEC_DIVX_311:
		hal_codec = HAL_VIDEO_CODEC_DIVX_311;
		break;
	case HFI_VIDEO_CODEC_DIVX:
		hal_codec = HAL_VIDEO_CODEC_DIVX;
		break;
	case HFI_VIDEO_CODEC_VC1:
		hal_codec = HAL_VIDEO_CODEC_VC1;
		break;
	case HFI_VIDEO_CODEC_SPARK:
		hal_codec = HAL_VIDEO_CODEC_SPARK;
		break;
	case HFI_VIDEO_CODEC_VP8:
		hal_codec = HAL_VIDEO_CODEC_VP8;
		break;
@@ -255,30 +237,12 @@ u32 vidc_get_hfi_codec(enum hal_video_codec hal_codec)
	case HAL_VIDEO_CODEC_H264:
		hfi_codec = HFI_VIDEO_CODEC_H264;
		break;
	case HAL_VIDEO_CODEC_H263:
		hfi_codec = HFI_VIDEO_CODEC_H263;
		break;
	case HAL_VIDEO_CODEC_MPEG1:
		hfi_codec = HFI_VIDEO_CODEC_MPEG1;
		break;
	case HAL_VIDEO_CODEC_MPEG2:
		hfi_codec = HFI_VIDEO_CODEC_MPEG2;
		break;
	case HAL_VIDEO_CODEC_MPEG4:
		hfi_codec = HFI_VIDEO_CODEC_MPEG4;
		break;
	case HAL_VIDEO_CODEC_DIVX_311:
		hfi_codec = HFI_VIDEO_CODEC_DIVX_311;
		break;
	case HAL_VIDEO_CODEC_DIVX:
		hfi_codec = HFI_VIDEO_CODEC_DIVX;
		break;
	case HAL_VIDEO_CODEC_VC1:
		hfi_codec = HFI_VIDEO_CODEC_VC1;
		break;
	case HAL_VIDEO_CODEC_SPARK:
		hfi_codec = HFI_VIDEO_CODEC_SPARK;
		break;
	case HAL_VIDEO_CODEC_VP8:
		hfi_codec = HFI_VIDEO_CODEC_VP8;
		break;
@@ -503,35 +467,6 @@ int create_pkt_cmd_session_cmd(struct vidc_hal_session_cmd_pkt *pkt,
{
	int rc = 0;

	if (!pkt)
		return -EINVAL;

	/*
	 * Legacy packetization should skip sending any 3xx specific session
	 * cmds. Add 3xx specific packetization to the switch case below.
	 */
	switch (pkt_type) {
	case HFI_CMD_SESSION_CONTINUE:
		dprintk(VIDC_INFO,
			"%s - skip sending %x for legacy hfi\n",
			__func__, pkt_type);
		return -EPERM;
	default:
		break;
	}

	pkt->size = sizeof(struct vidc_hal_session_cmd_pkt);
	pkt->packet_type = pkt_type;
	pkt->session_id = hash32_ptr(session);

	return rc;
}

int create_3x_pkt_cmd_session_cmd(struct vidc_hal_session_cmd_pkt *pkt,
			int pkt_type, struct hal_session *session)
{
	int rc = 0;

	if (!pkt)
		return -EINVAL;

@@ -727,29 +662,6 @@ static int get_hfi_extradata_id(enum hal_extradata_id index)
	return ret;
}

static u32 get_hfi_buf_mode(enum buffer_mode_type hal_buf_mode)
{
	u32 buf_mode;

	switch (hal_buf_mode) {
	case HAL_BUFFER_MODE_STATIC:
		buf_mode = HFI_BUFFER_MODE_STATIC;
		break;
	case HAL_BUFFER_MODE_RING:
		buf_mode = HFI_BUFFER_MODE_RING;
		break;
	case HAL_BUFFER_MODE_DYNAMIC:
		buf_mode = HFI_BUFFER_MODE_DYNAMIC;
		break;
	default:
		dprintk(VIDC_ERR, "Invalid buffer mode: %#x\n",
				hal_buf_mode);
		buf_mode = 0;
		break;
	}
	return buf_mode;
}

static u32 get_hfi_ltr_mode(enum ltr_mode ltr_mode_type)
{
	u32 ltrmode;
@@ -977,44 +889,6 @@ int create_pkt_cmd_session_ftb(struct hfi_cmd_session_fill_buffer_packet *pkt,
	return rc;
}

int create_pkt_cmd_session_parse_seq_header(
		struct hfi_cmd_session_parse_sequence_header_packet *pkt,
		struct hal_session *session, struct vidc_seq_hdr *seq_hdr)
{
	int rc = 0;

	if (!pkt || !session || !seq_hdr)
		return -EINVAL;

	pkt->size = sizeof(struct hfi_cmd_session_parse_sequence_header_packet);
	pkt->packet_type = HFI_CMD_SESSION_PARSE_SEQUENCE_HEADER;
	pkt->session_id = hash32_ptr(session);
	pkt->header_len = seq_hdr->seq_hdr_len;
	if (!seq_hdr->seq_hdr)
		return -EINVAL;
	pkt->packet_buffer = (u32)seq_hdr->seq_hdr;
	return rc;
}

int create_pkt_cmd_session_get_seq_hdr(
		struct hfi_cmd_session_get_sequence_header_packet *pkt,
		struct hal_session *session, struct vidc_seq_hdr *seq_hdr)
{
	int rc = 0;

	if (!pkt || !session || !seq_hdr)
		return -EINVAL;

	pkt->size = sizeof(struct hfi_cmd_session_get_sequence_header_packet);
	pkt->packet_type = HFI_CMD_SESSION_GET_SEQUENCE_HEADER;
	pkt->session_id = hash32_ptr(session);
	pkt->buffer_len = seq_hdr->seq_hdr_len;
	if (!seq_hdr->seq_hdr)
		return -EINVAL;
	pkt->packet_buffer = (u32)seq_hdr->seq_hdr;
	return rc;
}

int create_pkt_cmd_session_get_buf_req(
		struct hfi_cmd_session_get_property_packet *pkt,
		struct hal_session *session)
@@ -1076,6 +950,9 @@ int create_pkt_cmd_session_get_property(
	pkt->session_id = hash32_ptr(session);
	pkt->num_properties = 1;
	switch (ptype) {
	case HAL_CONFIG_VDEC_ENTROPY:
		pkt->rg_property_data[0] = HFI_PROPERTY_CONFIG_VDEC_ENTROPY;
		break;
	case HAL_PARAM_PROFILE_LEVEL_CURRENT:
		pkt->rg_property_data[0] =
			HFI_PROPERTY_PARAM_PROFILE_LEVEL_CURRENT;
@@ -1089,31 +966,6 @@ int create_pkt_cmd_session_get_property(
	return rc;
}

int create_3x_pkt_cmd_session_get_property(
		struct hfi_cmd_session_get_property_packet *pkt,
		struct hal_session *session, enum hal_property ptype)
{
	int rc = 0;

	if (!pkt || !session) {
		dprintk(VIDC_ERR, "%s Invalid parameters\n", __func__);
		return -EINVAL;
	}
	pkt->size = sizeof(struct hfi_cmd_session_get_property_packet);
	pkt->packet_type = HFI_CMD_SESSION_GET_PROPERTY;
	pkt->session_id = hash32_ptr(session);
	pkt->num_properties = 1;
	switch (ptype) {
	case HAL_CONFIG_VDEC_ENTROPY:
		pkt->rg_property_data[0] = HFI_PROPERTY_CONFIG_VDEC_ENTROPY;
		break;
	default:
		rc = create_pkt_cmd_session_get_property(pkt,
				session, ptype);
	}
	return rc;
}

int create_pkt_cmd_session_set_property(
		struct hfi_cmd_session_set_property_packet *pkt,
		struct hal_session *session,
@@ -1314,48 +1166,9 @@ int create_pkt_cmd_session_set_property(
		else
			return -EINVAL;
		hfi->enable = prop->enable;
		hfi->width = prop->width;
		hfi->height = prop->height;
		pkt->size += sizeof(u32) + sizeof(struct hfi_multi_stream);
		break;
	}
	case HAL_PARAM_VDEC_DISPLAY_PICTURE_BUFFER_COUNT:
	{
		struct hfi_display_picture_buffer_count *hfi;
		struct hal_display_picture_buffer_count *prop =
			(struct hal_display_picture_buffer_count *) pdata;
		pkt->rg_property_data[0] =
			HFI_PROPERTY_PARAM_VDEC_DISPLAY_PICTURE_BUFFER_COUNT;
		hfi = (struct hfi_display_picture_buffer_count *)
			&pkt->rg_property_data[1];
		hfi->count = prop->count;
		hfi->enable = prop->enable;
		pkt->size += sizeof(u32) +
			sizeof(struct hfi_display_picture_buffer_count);
		break;
	}
	case HAL_PARAM_DIVX_FORMAT:
	{
		int *data = pdata;

		pkt->rg_property_data[0] = HFI_PROPERTY_PARAM_DIVX_FORMAT;
		switch (*data) {
		case HAL_DIVX_FORMAT_4:
			pkt->rg_property_data[1] = HFI_DIVX_FORMAT_4;
			break;
		case HAL_DIVX_FORMAT_5:
			pkt->rg_property_data[1] = HFI_DIVX_FORMAT_5;
			break;
		case HAL_DIVX_FORMAT_6:
			pkt->rg_property_data[1] = HFI_DIVX_FORMAT_6;
			break;
		default:
			dprintk(VIDC_ERR, "Invalid divx format: %#x\n", *data);
			break;
		}
		pkt->size += sizeof(u32) * 2;
		break;
	}
	case HAL_CONFIG_VDEC_MB_ERROR_MAP_REPORTING:
	{
		create_pkt_enable(pkt->rg_property_data,
@@ -1364,14 +1177,6 @@ int create_pkt_cmd_session_set_property(
		pkt->size += sizeof(u32) * 2;
		break;
	}
	case HAL_PARAM_VDEC_CONTINUE_DATA_TRANSFER:
	{
		create_pkt_enable(pkt->rg_property_data,
			HFI_PROPERTY_PARAM_VDEC_CONTINUE_DATA_TRANSFER,
			((struct hal_enable *)pdata)->enable);
		pkt->size += sizeof(u32) * 2;
		break;
	}
	case HAL_PARAM_VDEC_SYNC_FRAME_DECODE:
	{
		create_pkt_enable(pkt->rg_property_data,
@@ -1409,19 +1214,6 @@ int create_pkt_cmd_session_set_property(
		pkt->size += sizeof(u32) + sizeof(struct hfi_bitrate);
		break;
	}
	case HAL_CONFIG_VENC_MAX_BITRATE:
	{
		struct hfi_bitrate *hfi;

		pkt->rg_property_data[0] =
			HFI_PROPERTY_CONFIG_VENC_MAX_BITRATE;
		hfi = (struct hfi_bitrate *) &pkt->rg_property_data[1];
		hfi->bit_rate = ((struct hal_bitrate *)pdata)->bit_rate;
		hfi->layer_id = ((struct hal_bitrate *)pdata)->layer_id;

		pkt->size += sizeof(u32) + sizeof(struct hfi_bitrate);
		break;
	}
	case HAL_PARAM_PROFILE_LEVEL_CURRENT:
	{
		struct hfi_profile_level *hfi;
@@ -1510,32 +1302,6 @@ int create_pkt_cmd_session_set_property(
		pkt->size += sizeof(u32) * 2;
		break;
	}
	case HAL_PARAM_VENC_MPEG4_TIME_RESOLUTION:
	{
		struct hfi_mpeg4_time_resolution *hfi;

		pkt->rg_property_data[0] =
			HFI_PROPERTY_PARAM_VENC_MPEG4_TIME_RESOLUTION;
		hfi = (struct hfi_mpeg4_time_resolution *)
			&pkt->rg_property_data[1];
		hfi->time_increment_resolution =
			((struct hal_mpeg4_time_resolution *)pdata)->
					time_increment_resolution;
		pkt->size += sizeof(u32) * 2;
		break;
	}
	case HAL_PARAM_VENC_MPEG4_HEADER_EXTENSION:
	{
		struct hfi_mpeg4_header_extension *hfi;

		pkt->rg_property_data[0] =
			HFI_PROPERTY_PARAM_VENC_MPEG4_HEADER_EXTENSION;
		hfi = (struct hfi_mpeg4_header_extension *)
			&pkt->rg_property_data[1];
		hfi->header_extension = (u32)(unsigned long) pdata;
		pkt->size += sizeof(u32) * 2;
		break;
	}
	case HAL_PARAM_VENC_H264_DEBLOCK_CONTROL:
	{
		struct hfi_h264_db_control *hfi;
@@ -1565,26 +1331,11 @@ int create_pkt_cmd_session_set_property(
			sizeof(struct hfi_h264_db_control);
		break;
	}
	case HAL_PARAM_VENC_SESSION_QP:
	{
		struct hfi_quantization *hfi;
		struct hal_quantization *hal_quant =
			(struct hal_quantization *) pdata;
		pkt->rg_property_data[0] =
			HFI_PROPERTY_PARAM_VENC_SESSION_QP;
		hfi = (struct hfi_quantization *) &pkt->rg_property_data[1];
		hfi->qp_i = hal_quant->qpi;
		hfi->qp_p = hal_quant->qpp;
		hfi->qp_b = hal_quant->qpb;
		hfi->layer_id = hal_quant->layer_id;
		pkt->size += sizeof(u32) + sizeof(struct hfi_quantization);
		break;
	}
	case HAL_PARAM_VENC_SESSION_QP_RANGE:
	{
		struct hfi_quantization_range *hfi;
		struct hfi_quantization_range *hal_range =
			(struct hfi_quantization_range *) pdata;
		struct hal_quantization_range *hal_range =
			(struct hal_quantization_range *) pdata;
		u32 min_qp, max_qp;

		pkt->rg_property_data[0] =
@@ -1610,9 +1361,10 @@ int create_pkt_cmd_session_set_property(
		 * 0xiippbb, where ii = qp range for I-frames,
		 * pp = qp range for P-frames, etc.
		 */
		hfi->min_qp = min_qp | min_qp << 8 | min_qp << 16;
		hfi->max_qp = max_qp | max_qp << 8 | max_qp << 16;
		hfi->layer_id = hal_range->layer_id;
		hfi->min_qp.qp_packed = min_qp | min_qp << 8 | min_qp << 16;
		hfi->min_qp.layer_id = hal_range->layer_id;
		hfi->max_qp.qp_packed = max_qp | max_qp << 8 | max_qp << 16;
		hfi->max_qp.layer_id = hal_range->layer_id;

		pkt->size += sizeof(u32) +
			sizeof(struct hfi_quantization_range);
@@ -1621,47 +1373,23 @@ int create_pkt_cmd_session_set_property(
	case HAL_PARAM_VENC_SESSION_QP_RANGE_PACKED:
	{
		struct hfi_quantization_range *hfi;
		struct hfi_quantization_range *hal_range =
			(struct hfi_quantization_range *) pdata;
		struct hal_quantization_range *hal_range =
			(struct hal_quantization_range *) pdata;

		pkt->rg_property_data[0] =
			HFI_PROPERTY_PARAM_VENC_SESSION_QP_RANGE;
		hfi = (struct hfi_quantization_range *)
				&pkt->rg_property_data[1];

		hfi->min_qp = hal_range->min_qp;
		hfi->max_qp = hal_range->max_qp;
		hfi->layer_id = hal_range->layer_id;
		hfi->min_qp.qp_packed = hal_range->min_qp;
		hfi->min_qp.layer_id = hal_range->layer_id;
		hfi->max_qp.qp_packed = hal_range->max_qp;
		hfi->max_qp.layer_id = hal_range->layer_id;

		pkt->size += sizeof(u32) +
			sizeof(struct hfi_quantization_range);
		break;
	}
	case HAL_PARAM_VENC_SEARCH_RANGE:
	{
		struct hfi_vc1e_perf_cfg_type *hfi;
		struct hal_vc1e_perf_cfg_type *hal_mv_searchrange =
			(struct hal_vc1e_perf_cfg_type *) pdata;
		pkt->rg_property_data[0] =
			HFI_PROPERTY_PARAM_VENC_VC1_PERF_CFG;
		hfi = (struct hfi_vc1e_perf_cfg_type *)
				&pkt->rg_property_data[1];
		hfi->search_range_x_subsampled[0] =
			hal_mv_searchrange->i_frame.x_subsampled;
		hfi->search_range_x_subsampled[1] =
			hal_mv_searchrange->p_frame.x_subsampled;
		hfi->search_range_x_subsampled[2] =
			hal_mv_searchrange->b_frame.x_subsampled;
		hfi->search_range_y_subsampled[0] =
			hal_mv_searchrange->i_frame.y_subsampled;
		hfi->search_range_y_subsampled[1] =
			hal_mv_searchrange->p_frame.y_subsampled;
		hfi->search_range_y_subsampled[2] =
			hal_mv_searchrange->b_frame.y_subsampled;
		pkt->size += sizeof(u32) +
			sizeof(struct hfi_vc1e_perf_cfg_type);
		break;
	}
	case HAL_PARAM_VENC_MAX_NUM_B_FRAMES:
	{
		struct hfi_max_num_b_frames *hfi;
@@ -1763,21 +1491,26 @@ int create_pkt_cmd_session_set_property(
		pkt->rg_property_data[0] =
			HFI_PROPERTY_PARAM_VENC_INTRA_REFRESH;
		hfi = (struct hfi_intra_refresh *) &pkt->rg_property_data[1];
		hfi->mbs = 0;
		switch (prop->mode) {
		case HAL_INTRA_REFRESH_NONE:
			hfi->mode = HFI_INTRA_REFRESH_NONE;
			break;
		case HAL_INTRA_REFRESH_ADAPTIVE:
			hfi->mode = HFI_INTRA_REFRESH_ADAPTIVE;
			hfi->mbs = prop->air_mbs;
			break;
		case HAL_INTRA_REFRESH_CYCLIC:
			hfi->mode = HFI_INTRA_REFRESH_CYCLIC;
			hfi->mbs = prop->cir_mbs;
			break;
		case HAL_INTRA_REFRESH_CYCLIC_ADAPTIVE:
			hfi->mode = HFI_INTRA_REFRESH_CYCLIC_ADAPTIVE;
			hfi->mbs = prop->air_mbs;
			break;
		case HAL_INTRA_REFRESH_RANDOM:
			hfi->mode = HFI_INTRA_REFRESH_RANDOM;
			hfi->mbs = prop->air_mbs;
			break;
		default:
			dprintk(VIDC_ERR,
@@ -1785,9 +1518,6 @@ int create_pkt_cmd_session_set_property(
					prop->mode);
			break;
		}
		hfi->air_mbs = prop->air_mbs;
		hfi->air_ref = prop->air_ref;
		hfi->cir_mbs = prop->cir_mbs;
		pkt->size += sizeof(u32) + sizeof(struct hfi_intra_refresh);
		break;
	}
@@ -1804,9 +1534,6 @@ int create_pkt_cmd_session_set_property(
		case HAL_MULTI_SLICE_OFF:
			hfi->multi_slice = HFI_MULTI_SLICE_OFF;
			break;
		case HAL_MULTI_SLICE_GOB:
			hfi->multi_slice = HFI_MULTI_SLICE_GOB;
			break;
		case HAL_MULTI_SLICE_BY_MB_COUNT:
			hfi->multi_slice = HFI_MULTI_SLICE_BY_MB_COUNT;
			break;
@@ -1889,38 +1616,6 @@ int create_pkt_cmd_session_set_property(
		pkt->size += sizeof(u32) + sizeof(struct hfi_enable);
		break;
	}
	case HAL_PARAM_BUFFER_ALLOC_MODE:
	{
		u32 buffer_type;
		u32 buffer_mode;
		struct hfi_buffer_alloc_mode *hfi;
		struct hal_buffer_alloc_mode *alloc_info = pdata;

		pkt->rg_property_data[0] =
			HFI_PROPERTY_PARAM_BUFFER_ALLOC_MODE;
		hfi = (struct hfi_buffer_alloc_mode *)
			&pkt->rg_property_data[1];
		buffer_type = get_hfi_buffer(alloc_info->buffer_type);
		if (buffer_type)
			hfi->buffer_type = buffer_type;
		else
			return -EINVAL;
		buffer_mode = get_hfi_buf_mode(alloc_info->buffer_mode);
		if (buffer_mode)
			hfi->buffer_mode = buffer_mode;
		else
			return -EINVAL;
		pkt->size += sizeof(u32) + sizeof(struct hfi_buffer_alloc_mode);
		break;
	}
	case HAL_PARAM_VDEC_FRAME_ASSEMBLY:
	{
		create_pkt_enable(pkt->rg_property_data,
				HFI_PROPERTY_PARAM_VDEC_FRAME_ASSEMBLY,
				((struct hal_enable *)pdata)->enable);
		pkt->size += sizeof(u32) + sizeof(struct hfi_enable);
		break;
	}
	case HAL_PARAM_VENC_H264_VUI_BITSTREAM_RESTRC:
	{
		create_pkt_enable(pkt->rg_property_data,
@@ -1937,18 +1632,6 @@ int create_pkt_cmd_session_set_property(
		pkt->size += sizeof(u32) + sizeof(struct hfi_enable);
		break;
	}
	case HAL_PARAM_VDEC_SCS_THRESHOLD:
	{
		struct hfi_scs_threshold *hfi;

		pkt->rg_property_data[0] =
			HFI_PROPERTY_PARAM_VDEC_SCS_THRESHOLD;
		hfi = (struct hfi_scs_threshold *) &pkt->rg_property_data[1];
		hfi->threshold_value =
			((struct hal_scs_threshold *) pdata)->threshold_value;
		pkt->size += sizeof(u32) + sizeof(struct hfi_scs_threshold);
		break;
	}
	case HAL_PARAM_MVC_BUFFER_LAYOUT:
	{
		struct hfi_mvc_buffer_layout_descp_type *hfi;
@@ -2028,23 +1711,6 @@ int create_pkt_cmd_session_set_property(
		pkt->size += sizeof(u32) + sizeof(struct hfi_enable);
		break;
	}
	case HAL_PARAM_VENC_ENABLE_INITIAL_QP:
	{
		struct hfi_initial_quantization *hfi;
		struct hal_initial_quantization *quant = pdata;

		pkt->rg_property_data[0] =
			HFI_PROPERTY_PARAM_VENC_INITIAL_QP;
		hfi = (struct hfi_initial_quantization *)
			&pkt->rg_property_data[1];
		hfi->init_qp_enable = quant->init_qp_enable;
		hfi->qp_i = quant->qpi;
		hfi->qp_p = quant->qpp;
		hfi->qp_b = quant->qpb;
		pkt->size += sizeof(u32) +
			sizeof(struct hfi_initial_quantization);
		break;
	}
	case HAL_PARAM_VPE_COLOR_SPACE_CONVERSION:
	{
		struct hfi_vpe_color_space_conversion *hfi = NULL;
@@ -2107,14 +1773,6 @@ int create_pkt_cmd_session_set_property(
		pkt->size += sizeof(u32) * 2;
		break;
	}
	case HAL_PARAM_VDEC_NON_SECURE_OUTPUT2:
	{
		create_pkt_enable(pkt->rg_property_data,
				HFI_PROPERTY_PARAM_VDEC_NONCP_OUTPUT2,
				((struct hal_enable *)pdata)->enable);
		pkt->size += sizeof(u32) + sizeof(struct hfi_enable);
		break;
	}
	case HAL_PARAM_VENC_HIER_P_HYBRID_MODE:
	{
		pkt->rg_property_data[0] =
@@ -2135,14 +1793,6 @@ int create_pkt_cmd_session_set_property(
		pkt->size += sizeof(u32) * 2;
		break;
	}
	case HAL_CONFIG_VENC_FRAME_QP:
	{
		pkt->rg_property_data[0] =
			HFI_PROPERTY_CONFIG_VENC_FRAME_QP;
		pkt->rg_property_data[1] = *(u32 *)pdata;
		pkt->size += sizeof(u32) * 2;
		break;
	}
	case HAL_CONFIG_VENC_BASELAYER_PRIORITYID:
	{
		pkt->rg_property_data[0] =
@@ -2174,14 +1824,6 @@ int create_pkt_cmd_session_set_property(
		pkt->size += sizeof(u32) + sizeof(struct hfi_enable);
		break;
	}
	case HAL_PARAM_VENC_CONSTRAINED_INTRA_PRED:
	{
		create_pkt_enable(pkt->rg_property_data,
			HFI_PROPERTY_PARAM_VENC_CONSTRAINED_INTRA_PRED,
			((struct hal_enable *)pdata)->enable);
		pkt->size += sizeof(u32) + sizeof(struct hfi_enable);
		break;
	}
	case HAL_PARAM_VENC_H264_TRANSFORM_8x8:
	{
		create_pkt_enable(pkt->rg_property_data,
@@ -2237,6 +1879,78 @@ int create_pkt_cmd_session_set_property(
		pkt->size += sizeof(u32) + sizeof(struct hfi_iframe_size);
		break;
	}
	case HAL_PARAM_BUFFER_SIZE_MINIMUM:
	{
		struct hfi_buffer_size_minimum *hfi;
		struct hal_buffer_size_minimum *prop =
			(struct hal_buffer_size_minimum *) pdata;
		u32 buffer_type;

		pkt->rg_property_data[0] =
			HFI_PROPERTY_PARAM_BUFFER_SIZE_MINIMUM;

		hfi = (struct hfi_buffer_size_minimum *)
			&pkt->rg_property_data[1];
		hfi->buffer_size = prop->buffer_size;

		buffer_type = get_hfi_buffer(prop->buffer_type);
		if (buffer_type)
			hfi->buffer_type = buffer_type;
		else
			return -EINVAL;

		pkt->size += sizeof(u32) + sizeof(struct
			hfi_buffer_size_minimum);
		break;
	}
	case HAL_PARAM_SYNC_BASED_INTERRUPT:
	{
		create_pkt_enable(pkt->rg_property_data,
			HFI_PROPERTY_PARAM_SYNC_BASED_INTERRUPT,
			((struct hal_enable *)pdata)->enable);
		pkt->size += sizeof(u32) + sizeof(struct hfi_enable);
		break;
	}
	case HAL_PARAM_VENC_VQZIP_SEI:
	{
		create_pkt_enable(pkt->rg_property_data,
			HFI_PROPERTY_PARAM_VENC_VQZIP_SEI_TYPE,
			((struct hal_enable *)pdata)->enable);
		pkt->size += sizeof(u32) + sizeof(struct hfi_enable);
		break;
	}

	case HAL_PARAM_VENC_LOW_LATENCY:
	{
		struct hfi_enable *hfi;

		pkt->rg_property_data[0] =
			HFI_PROPERTY_PARAM_VENC_LOW_LATENCY_MODE;
		hfi = (struct hfi_enable *) &pkt->rg_property_data[1];
		hfi->enable = ((struct hal_enable *) pdata)->enable;
		pkt->size += sizeof(u32) * 2;
		break;
	}
	case HAL_CONFIG_VENC_BLUR_RESOLUTION:
	{
		struct hfi_frame_size *hfi;
		struct hal_frame_size *prop = (struct hal_frame_size *) pdata;
		u32 buffer_type;

		pkt->rg_property_data[0] =
			HFI_PROPERTY_CONFIG_VENC_BLUR_FRAME_SIZE;
		hfi = (struct hfi_frame_size *) &pkt->rg_property_data[1];
		buffer_type = get_hfi_buffer(prop->buffer_type);
		if (buffer_type)
			hfi->buffer_type = buffer_type;
		else
			return -EINVAL;

		hfi->height = prop->height;
		hfi->width = prop->width;
		pkt->size += sizeof(u32) + sizeof(struct hfi_frame_size);
		break;
	}
	/* FOLLOWING PROPERTIES ARE NOT IMPLEMENTED IN CORE YET */
	case HAL_CONFIG_BUFFER_REQUIREMENTS:
	case HAL_CONFIG_PRIORITY:
@@ -2262,7 +1976,6 @@ int create_pkt_cmd_session_set_property(
	case HAL_CONFIG_VDEC_MULTI_STREAM:
	case HAL_PARAM_VENC_MULTI_SLICE_INFO:
	case HAL_CONFIG_VENC_TIMESTAMP_SCALE:
	case HAL_PARAM_BUFFER_SIZE_MINIMUM:
	default:
		dprintk(VIDC_ERR, "DEFAULT: Calling %#x\n", ptype);
		rc = -ENOTSUPP;
@@ -2319,176 +2032,6 @@ int create_pkt_cmd_sys_image_version(
	return 0;
}

static int create_3x_pkt_cmd_session_set_property(
		struct hfi_cmd_session_set_property_packet *pkt,
		struct hal_session *session,
		enum hal_property ptype, void *pdata)
{
	int rc = 0;

	if (!pkt || !session || !pdata)
		return -EINVAL;

	pkt->size = sizeof(struct hfi_cmd_session_set_property_packet);
	pkt->packet_type = HFI_CMD_SESSION_SET_PROPERTY;
	pkt->session_id = hash32_ptr(session);
	pkt->num_properties = 1;

	/*
	 * Any session set property which is different in 3XX packetization
	 * should be added as a new case below. All unchanged session set
	 * properties will be handled in the default case.
	 */
	switch (ptype) {
	case HAL_PARAM_VDEC_MULTI_STREAM:
	{
		u32 buffer_type;
		struct hfi_3x_multi_stream *hfi;
		struct hal_multi_stream *prop =
			(struct hal_multi_stream *) pdata;
		pkt->rg_property_data[0] =
			HFI_PROPERTY_PARAM_VDEC_MULTI_STREAM;
		hfi = (struct hfi_3x_multi_stream *) &pkt->rg_property_data[1];

		buffer_type = get_hfi_buffer(prop->buffer_type);
		if (buffer_type)
			hfi->buffer_type = buffer_type;
		else
			return -EINVAL;
		hfi->enable = prop->enable;
		pkt->size += sizeof(u32) + sizeof(struct hfi_3x_multi_stream);
		break;
	}
	case HAL_PARAM_VENC_INTRA_REFRESH:
	{
		struct hfi_3x_intra_refresh *hfi;
		struct hal_intra_refresh *prop =
			(struct hal_intra_refresh *) pdata;
		pkt->rg_property_data[0] =
			HFI_PROPERTY_PARAM_VENC_INTRA_REFRESH;
		hfi = (struct hfi_3x_intra_refresh *) &pkt->rg_property_data[1];
		hfi->mbs = 0;
		switch (prop->mode) {
		case HAL_INTRA_REFRESH_NONE:
			hfi->mode = HFI_INTRA_REFRESH_NONE;
			break;
		case HAL_INTRA_REFRESH_ADAPTIVE:
			hfi->mode = HFI_INTRA_REFRESH_ADAPTIVE;
			hfi->mbs = prop->air_mbs;
			break;
		case HAL_INTRA_REFRESH_CYCLIC:
			hfi->mode = HFI_INTRA_REFRESH_CYCLIC;
			hfi->mbs = prop->cir_mbs;
			break;
		case HAL_INTRA_REFRESH_CYCLIC_ADAPTIVE:
			hfi->mode = HFI_INTRA_REFRESH_CYCLIC_ADAPTIVE;
			hfi->mbs = prop->air_mbs;
			break;
		case HAL_INTRA_REFRESH_RANDOM:
			hfi->mode = HFI_INTRA_REFRESH_RANDOM;
			hfi->mbs = prop->air_mbs;
			break;
		default:
			dprintk(VIDC_ERR,
				"Invalid intra refresh setting: %d\n",
				prop->mode);
			break;
		}
		pkt->size += sizeof(u32) + sizeof(struct hfi_3x_intra_refresh);
		break;
	}
	case HAL_PARAM_SYNC_BASED_INTERRUPT:
	{
		create_pkt_enable(pkt->rg_property_data,
				HFI_PROPERTY_PARAM_SYNC_BASED_INTERRUPT,
				((struct hal_enable *)pdata)->enable);
		pkt->size += sizeof(u32) + sizeof(struct hfi_enable);
		break;
	}
	case HAL_PARAM_VENC_VQZIP_SEI:
	{
		create_pkt_enable(pkt->rg_property_data,
				HFI_PROPERTY_PARAM_VENC_VQZIP_SEI_TYPE,
				((struct hal_enable *)pdata)->enable);
		pkt->size += sizeof(u32) + sizeof(struct hfi_enable);
		break;
	}
	/* Deprecated param on Venus 3xx */
	case HAL_PARAM_VDEC_CONTINUE_DATA_TRANSFER:
	{
		rc = -ENOTSUPP;
		break;
	}
	case HAL_PARAM_BUFFER_SIZE_MINIMUM:
	{
		struct hfi_buffer_size_minimum *hfi;
		struct hal_buffer_size_minimum *prop =
			(struct hal_buffer_size_minimum *) pdata;
		u32 buffer_type;

		pkt->rg_property_data[0] =
			HFI_PROPERTY_PARAM_BUFFER_SIZE_MINIMUM;

		hfi = (struct hfi_buffer_size_minimum *)
			&pkt->rg_property_data[1];
		hfi->buffer_size = prop->buffer_size;

		buffer_type = get_hfi_buffer(prop->buffer_type);
		if (buffer_type)
			hfi->buffer_type = buffer_type;
		else
			return -EINVAL;

		pkt->size += sizeof(u32) + sizeof(struct
				hfi_buffer_count_actual);
		break;
	}
	case HAL_PARAM_VENC_H264_PIC_ORDER_CNT:
	{
		pkt->rg_property_data[0] =
			HFI_PROPERTY_PARAM_VENC_H264_PICORDER_CNT_TYPE;
		pkt->rg_property_data[1] = *(u32 *)pdata;
		pkt->size += sizeof(u32) * 2;
		break;
	}
	case HAL_PARAM_VENC_LOW_LATENCY:
	{
		struct hfi_enable *hfi;

		pkt->rg_property_data[0] =
			HFI_PROPERTY_PARAM_VENC_LOW_LATENCY_MODE;
		hfi = (struct hfi_enable *) &pkt->rg_property_data[1];
		hfi->enable = ((struct hal_enable *) pdata)->enable;
		pkt->size += sizeof(u32) * 2;
		break;
	}
	case HAL_CONFIG_VENC_BLUR_RESOLUTION:
	{
		struct hfi_frame_size *hfi;
		struct hal_frame_size *prop = (struct hal_frame_size *) pdata;
		u32 buffer_type;

		pkt->rg_property_data[0] =
			HFI_PROPERTY_CONFIG_VENC_BLUR_FRAME_SIZE;
		hfi = (struct hfi_frame_size *) &pkt->rg_property_data[1];
		buffer_type = get_hfi_buffer(prop->buffer_type);
		if (buffer_type)
			hfi->buffer_type = buffer_type;
		else
			return -EINVAL;

		hfi->height = prop->height;
		hfi->width = prop->width;
		pkt->size += sizeof(u32) + sizeof(struct hfi_frame_size);
		break;
	}
	default:
		rc = create_pkt_cmd_session_set_property(pkt,
				session, ptype, pdata);
	}
	return rc;
}

int create_pkt_cmd_session_sync_process(
		struct hfi_cmd_session_sync_process_packet *pkt,
		struct hal_session *session)
@@ -2524,44 +2067,22 @@ static struct hfi_packetization_ops hfi_default = {
	.session_etb_decoder = create_pkt_cmd_session_etb_decoder,
	.session_etb_encoder = create_pkt_cmd_session_etb_encoder,
	.session_ftb = create_pkt_cmd_session_ftb,
	.session_parse_seq_header = create_pkt_cmd_session_parse_seq_header,
	.session_get_seq_hdr = create_pkt_cmd_session_get_seq_hdr,
	.session_get_buf_req = create_pkt_cmd_session_get_buf_req,
	.session_flush = create_pkt_cmd_session_flush,
	.session_get_property = create_pkt_cmd_session_get_property,
	.session_set_property = create_pkt_cmd_session_set_property,
};

struct hfi_packetization_ops *get_venus_3x_ops(void)
{
	static struct hfi_packetization_ops hfi_venus_3x;

	hfi_venus_3x = hfi_default;

	/* Override new HFI functions for HFI_PACKETIZATION_3XX here. */
	hfi_venus_3x.session_set_property =
		create_3x_pkt_cmd_session_set_property;
	hfi_venus_3x.session_get_property =
		create_3x_pkt_cmd_session_get_property;
	hfi_venus_3x.session_cmd = create_3x_pkt_cmd_session_cmd;
	hfi_venus_3x.session_sync_process = create_pkt_cmd_session_sync_process;

	return &hfi_venus_3x;
}

struct hfi_packetization_ops *hfi_get_pkt_ops_handle(
			enum hfi_packetization_type type)
{
	dprintk(VIDC_DBG, "%s selected\n",
		type == HFI_PACKETIZATION_LEGACY ? "legacy packetization" :
		type == HFI_PACKETIZATION_3XX ? "3xx packetization" :
		"Unknown hfi");
		type == HFI_PACKETIZATION_4XX ?
		"4xx packetization" : "Unknown hfi");

	switch (type) {
	case HFI_PACKETIZATION_LEGACY:
	case HFI_PACKETIZATION_4XX:
		return &hfi_default;
	case HFI_PACKETIZATION_3XX:
		return get_venus_3x_ops();
	}

	return NULL;
+1 −8

File changed.

Preview size limit exceeded, changes collapsed.

+0 −143

File changed.

Preview size limit exceeded, changes collapsed.

+1 −16

File changed.

Preview size limit exceeded, changes collapsed.

+1 −20
Original line number Diff line number Diff line
@@ -2275,23 +2275,6 @@ static int try_set_ctrl(struct msm_vidc_inst *inst, struct v4l2_ctrl *ctrl)
		(inst->fmts[CAPTURE_PORT].fourcc == V4L2_PIX_FMT_H264) ||
		(inst->fmts[CAPTURE_PORT].fourcc == V4L2_PIX_FMT_HEVC);

		if (is_cont_intra_supported) {
			if (ctrl->val != HAL_INTRA_REFRESH_NONE)
				enable.enable = true;
			else
				enable.enable = false;

			rc = call_hfi_op(hdev, session_set_property,
				(void *)inst->session,
				HAL_PARAM_VENC_CONSTRAINED_INTRA_PRED, &enable);
			if (rc) {
				dprintk(VIDC_ERR,
					"Failed to set constrained intra\n");
				rc = -EINVAL;
				break;
			}
		}

		property_id = HAL_PARAM_VENC_INTRA_REFRESH;

		intra_refresh.mode = ctrl->val;
@@ -2870,11 +2853,9 @@ int msm_venc_inst_init(struct msm_vidc_inst *inst)
	inst->capability.height.max = DEFAULT_HEIGHT;
	inst->capability.width.min = MIN_SUPPORTED_WIDTH;
	inst->capability.width.max = DEFAULT_WIDTH;
	inst->capability.alloc_mode_in = HAL_BUFFER_MODE_STATIC;
	inst->capability.alloc_mode_out = HAL_BUFFER_MODE_STATIC;
	inst->capability.secure_output2_threshold.min = 0;
	inst->capability.secure_output2_threshold.max = 0;
	inst->buffer_mode_set[OUTPUT_PORT] = HAL_BUFFER_MODE_STATIC;
	inst->buffer_mode_set[OUTPUT_PORT] = HAL_BUFFER_MODE_DYNAMIC;
	inst->buffer_mode_set[CAPTURE_PORT] = HAL_BUFFER_MODE_STATIC;
	inst->prop.fps = DEFAULT_FPS;
	inst->capability.pixelprocess_capabilities = 0;
Loading