Exemplo n.º 1
0
u32 ddl_encode_start(u32 *ddl_handle, void *client_data)
{
	struct ddl_client_context *ddl =
		(struct ddl_client_context *) ddl_handle;
	struct ddl_context *ddl_context;
	struct ddl_encoder_data *encoder;
	void *ptr;
	u32 status = VCD_S_SUCCESS;

	DDL_MSG_HIGH("ddl_encode_start");
#ifdef DDL_PROFILE
	if (first_time < 2) {
		ddl_reset_time_variables(1);
		first_time++;
	 }
	ddl_get_core_start_time(1);
#endif
	ddl_context = ddl_get_context();
	if (!DDL_IS_INITIALIZED(ddl_context)) {
		DDL_MSG_ERROR("ddl_enc_start:Not_inited");
		return VCD_ERR_ILLEGAL_OP;
	}
	if (DDL_IS_BUSY(ddl_context)) {
		DDL_MSG_ERROR("ddl_enc_start:Ddl_busy");
		return VCD_ERR_BUSY;
	}
	if (!ddl || ddl->decoding) {
		DDL_MSG_ERROR("ddl_enc_start:Bad_handle");
		return VCD_ERR_BAD_HANDLE;
	}
	if (!DDLCLIENT_STATE_IS(ddl, DDL_CLIENT_OPEN)) {
		DDL_MSG_ERROR("ddl_enc_start:Not_opened");
		return VCD_ERR_ILLEGAL_OP;
	}
	if (!ddl_encoder_ready_to_start(ddl)) {
		DDL_MSG_ERROR("ddl_enc_start:Err_param_settings");
		return VCD_ERR_ILLEGAL_OP;
	}
	encoder = &ddl->codec_data.encoder;
	status = ddl_allocate_enc_hw_buffers(ddl);
	if (status)
		return status;
#ifdef DDL_BUF_LOG
	ddl_list_buffers(ddl);
#endif

	ptr = ddl_pmem_alloc(&encoder->seq_header,
		DDL_ENC_SEQHEADER_SIZE, DDL_LINEAR_BUFFER_ALIGN_BYTES);
	if (!ptr) {
		ddl_free_enc_hw_buffers(ddl);
		DDL_MSG_ERROR("ddl_enc_start:Seq_hdr_alloc_failed");
		return VCD_ERR_ALLOC_FAIL;
	}
	if (!ddl_take_command_channel(ddl_context, ddl, client_data))
		return VCD_ERR_BUSY;
	ddl_vidc_channel_set(ddl);
	return status;
}
Exemplo n.º 2
0
u32 ddl_encode_start(u32 *ddl_handle, void *client_data)
{
	struct ddl_client_context *ddl =
		(struct ddl_client_context *) ddl_handle;
	struct ddl_context *ddl_context;
	struct ddl_encoder_data *encoder;
	void *ptr;
	u32 status = VCD_S_SUCCESS;
	DDL_MSG_HIGH("ddl_encode_start");
	if (first_time < 2) {
		ddl_reset_core_time_variables(ENC_OP_TIME);
		first_time++;
	 }
	ddl_set_core_start_time(__func__, ENC_OP_TIME);
	ddl_context = ddl_get_context();
	if (!DDL_IS_INITIALIZED(ddl_context)) {
		DDL_MSG_ERROR("ddl_enc_start:Not_inited");
		return VCD_ERR_ILLEGAL_OP;
	}
	if (DDL_IS_BUSY(ddl_context)) {
		DDL_MSG_ERROR("ddl_enc_start:Ddl_busy");
		return VCD_ERR_BUSY;
	}
	if (!ddl || ddl->decoding) {
		DDL_MSG_ERROR("ddl_enc_start:Bad_handle");
		return VCD_ERR_BAD_HANDLE;
	}
	if (!DDLCLIENT_STATE_IS(ddl, DDL_CLIENT_OPEN)) {
		DDL_MSG_ERROR("ddl_enc_start:Not_opened");
		return VCD_ERR_ILLEGAL_OP;
	}
	if (!ddl_encoder_ready_to_start(ddl)) {
		DDL_MSG_ERROR("ddl_enc_start:Err_param_settings");
		return VCD_ERR_ILLEGAL_OP;
	}
	encoder = &ddl->codec_data.encoder;
	if (DDL_IS_LTR_ENABLED(encoder)) {
		DDL_MSG_HIGH("LTR enabled, mode %u count %u",
			(u32)encoder->ltr_control.ltrmode.ltr_mode,
			(u32)encoder->ltr_control.ltr_count);
		status = ddl_allocate_ltr_list(&encoder->ltr_control);
		if (status) {
			DDL_MSG_ERROR("%s: allocate ltr list failed",
				__func__);
			return status;
		} else {
			ddl_clear_ltr_list(&encoder->ltr_control, false);
		}
		encoder->num_references_for_p_frame = 2;
		encoder->ltr_control.callback_reqd = false;
		encoder->ltr_control.curr_ltr_id = (u32)DDL_LTR_FRAME_START_ID;
		DDL_MSG_HIGH("num_ref_for_p_frames %u, curr_ltr_id = %u",
			(u32)encoder->num_references_for_p_frame,
			(u32)encoder->ltr_control.curr_ltr_id);
	}
	status = ddl_allocate_enc_hw_buffers(ddl);
	if (status)
		return status;
#ifdef DDL_BUF_LOG
	ddl_list_buffers(ddl);
#endif
	encoder->seq_header.mem_type = DDL_MM_MEM;
	ptr = ddl_pmem_alloc(&encoder->seq_header,
		DDL_ENC_SEQHEADER_SIZE, DDL_LINEAR_BUFFER_ALIGN_BYTES);
	if (!ptr) {
		ddl_free_enc_hw_buffers(ddl);
		DDL_MSG_ERROR("ddl_enc_start:Seq_hdr_alloc_failed");
		return VCD_ERR_ALLOC_FAIL;
	}
	msm_ion_do_cache_op(ddl_context->video_ion_client,
				encoder->seq_header.alloc_handle,
				encoder->seq_header.virtual_base_addr,
				encoder->seq_header.buffer_size,
				ION_IOC_CLEAN_INV_CACHES);
	if (encoder->slice_delivery_info.enable) {
		DDL_MSG_LOW("%s: slice mode allocate memory for struct\n",
					__func__);
		ptr = ddl_pmem_alloc(&encoder->batch_frame.slice_batch_in,
				DDL_ENC_SLICE_BATCH_INPSTRUCT_SIZE,
				DDL_LINEAR_BUFFER_ALIGN_BYTES);
		if (ptr) {
			ptr = ddl_pmem_alloc(
				&encoder->batch_frame.slice_batch_out,
				DDL_ENC_SLICE_BATCH_OUTSTRUCT_SIZE,
				DDL_LINEAR_BUFFER_ALIGN_BYTES);
		}
		if (!ptr) {
			ddl_pmem_free(&encoder->batch_frame.slice_batch_in);
			ddl_pmem_free(&encoder->batch_frame.slice_batch_out);
			ddl_free_enc_hw_buffers(ddl);
			ddl_pmem_free(&encoder->seq_header);
			DDL_MSG_ERROR("ddlEncStart:SeqHdrAllocFailed");
			return VCD_ERR_ALLOC_FAIL;
		}
	}
	if (!ddl_take_command_channel(ddl_context, ddl, client_data))
		return VCD_ERR_BUSY;
	ddl_vidc_channel_set(ddl);
	return status;
}
Exemplo n.º 3
0
u32 ddl_encode_start(u32 *ddl_handle, void *client_data)
{
	struct ddl_client_context *ddl =
		(struct ddl_client_context *) ddl_handle;
	struct ddl_context *ddl_context;
	struct ddl_encoder_data *encoder;
	void *ptr;
	u32 status = VCD_S_SUCCESS;
	DDL_MSG_HIGH("ddl_encode_start");
	if (vidc_msg_timing) {
		if (first_time < 2) {
			ddl_reset_core_time_variables(ENC_OP_TIME);
			first_time++;
		 }
		ddl_set_core_start_time(__func__, ENC_OP_TIME);
	}
	ddl_context = ddl_get_context();
	if (!DDL_IS_INITIALIZED(ddl_context)) {
		DDL_MSG_ERROR("ddl_enc_start:Not_inited");
		return VCD_ERR_ILLEGAL_OP;
	}
	if (DDL_IS_BUSY(ddl_context)) {
		DDL_MSG_ERROR("ddl_enc_start:Ddl_busy");
		return VCD_ERR_BUSY;
	}
	if (!ddl || ddl->decoding) {
		DDL_MSG_ERROR("ddl_enc_start:Bad_handle");
		return VCD_ERR_BAD_HANDLE;
	}
	if (!DDLCLIENT_STATE_IS(ddl, DDL_CLIENT_OPEN)) {
		DDL_MSG_ERROR("ddl_enc_start:Not_opened");
		return VCD_ERR_ILLEGAL_OP;
	}
	if (!ddl_encoder_ready_to_start(ddl)) {
		DDL_MSG_ERROR("ddl_enc_start:Err_param_settings");
		return VCD_ERR_ILLEGAL_OP;
	}
	encoder = &ddl->codec_data.encoder;
	status = ddl_allocate_enc_hw_buffers(ddl);
	if (status)
		return status;
#ifdef DDL_BUF_LOG
	ddl_list_buffers(ddl);
#endif
#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
	encoder->seq_header.mem_type = DDL_MM_MEM;
#endif
	ptr = ddl_pmem_alloc(&encoder->seq_header,
		DDL_ENC_SEQHEADER_SIZE, DDL_LINEAR_BUFFER_ALIGN_BYTES);
	if (!ptr) {
		ddl_free_enc_hw_buffers(ddl);
		DDL_MSG_ERROR("ddl_enc_start:Seq_hdr_alloc_failed");
		return VCD_ERR_ALLOC_FAIL;
	}
	if (encoder->slice_delivery_info.enable) {
		DDL_MSG_LOW("%s: slice mode allocate memory for struct\n",
					__func__);
		ptr = ddl_pmem_alloc(&encoder->batch_frame.slice_batch_in,
				DDL_ENC_SLICE_BATCH_INPSTRUCT_SIZE,
				DDL_LINEAR_BUFFER_ALIGN_BYTES);
		if (ptr) {
			ptr = ddl_pmem_alloc(
				&encoder->batch_frame.slice_batch_out,
				DDL_ENC_SLICE_BATCH_OUTSTRUCT_SIZE,
				DDL_LINEAR_BUFFER_ALIGN_BYTES);
		}
		if (!ptr) {
			ddl_pmem_free(&encoder->batch_frame.slice_batch_in);
			ddl_pmem_free(&encoder->batch_frame.slice_batch_out);
			ddl_free_enc_hw_buffers(ddl);
			ddl_pmem_free(&encoder->seq_header);
			DDL_MSG_ERROR("ddlEncStart:SeqHdrAllocFailed");
			return VCD_ERR_ALLOC_FAIL;
		}
	}
	if (!ddl_take_command_channel(ddl_context, ddl, client_data))
		return VCD_ERR_BUSY;
	ddl_vidc_channel_set(ddl);
	return status;
}
u32 ddl_encode_start(u32 *ddl_handle, void *client_data)
{
	struct ddl_client_context *ddl =
		(struct ddl_client_context *) ddl_handle;
	struct ddl_context *ddl_context;
	struct ddl_encoder_data *encoder;
	void *ptr;
	u32 status = VCD_S_SUCCESS;
	DDL_MSG_HIGH("ddl_encode_start");
	if (vidc_msg_timing) {
		if (first_time < 2) {
			ddl_reset_core_time_variables(ENC_OP_TIME);
			first_time++;
		 }
		ddl_set_core_start_time(__func__, ENC_OP_TIME);
	}
	ddl_context = ddl_get_context();
	if (!DDL_IS_INITIALIZED(ddl_context)) {
		DDL_MSG_ERROR("ddl_enc_start:Not_inited");
		return VCD_ERR_ILLEGAL_OP;
	}
	if (DDL_IS_BUSY(ddl_context)) {
		DDL_MSG_ERROR("ddl_enc_start:Ddl_busy");
		return VCD_ERR_BUSY;
	}
	if (!ddl || ddl->decoding) {
		DDL_MSG_ERROR("ddl_enc_start:Bad_handle");
		return VCD_ERR_BAD_HANDLE;
	}
	if (!DDLCLIENT_STATE_IS(ddl, DDL_CLIENT_OPEN)) {
		DDL_MSG_ERROR("ddl_enc_start:Not_opened");
		return VCD_ERR_ILLEGAL_OP;
	}
	if (!ddl_encoder_ready_to_start(ddl)) {
		DDL_MSG_ERROR("ddl_enc_start:Err_param_settings");
		return VCD_ERR_ILLEGAL_OP;
	}
	encoder = &ddl->codec_data.encoder;
	status = ddl_allocate_enc_hw_buffers(ddl);
	if (status)
		return status;
#ifdef DDL_BUF_LOG
	ddl_list_buffers(ddl);
#endif
	if ((encoder->codec.codec == VCD_CODEC_MPEG4 &&
		!encoder->short_header.short_header) ||
		encoder->codec.codec == VCD_CODEC_H264) {
		ptr = ddl_pmem_alloc(&encoder->seq_header,
			DDL_ENC_SEQHEADER_SIZE, DDL_LINEAR_BUFFER_ALIGN_BYTES);
		if (!ptr) {
			ddl_free_enc_hw_buffers(ddl);
			DDL_MSG_ERROR("ddl_enc_start:Seq_hdr_alloc_failed");
			return VCD_ERR_ALLOC_FAIL;
		}
	} else {
		encoder->seq_header.buffer_size = 0;
		encoder->seq_header.virtual_base_addr = 0;
		encoder->seq_header.align_physical_addr = 0;
		encoder->seq_header.align_virtual_addr = 0;
	}
	if (!ddl_take_command_channel(ddl_context, ddl, client_data))
		return VCD_ERR_BUSY;
	ddl_vidc_channel_set(ddl);
	return status;
}