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

Commit 1f2e9105 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: vidc: Handle sufficient events from h/w as sufficient" into msm-4.9

parents 316d171d bb3fad0f
Loading
Loading
Loading
Loading
+3 −12
Original line number Original line Diff line number Diff line
@@ -1428,18 +1428,9 @@ static inline int start_streaming(struct msm_vidc_inst *inst)
	 * - v4l2 client issues CONTINUE to firmware to resume decoding of
	 * - v4l2 client issues CONTINUE to firmware to resume decoding of
	 *   submitted ETBs.
	 *   submitted ETBs.
	 */
	 */
	if (inst->in_reconfig) {
	rc = msm_comm_session_continue(inst);
		dprintk(VIDC_DBG, "send session_continue after reconfig\n");
	if (rc)
		rc = call_hfi_op(hdev, session_continue,
				(void *) inst->session);
		if (rc) {
			dprintk(VIDC_ERR,
				"%s - failed to send session_continue\n",
				__func__);
		goto fail_start;
		goto fail_start;
		}
	}
	inst->in_reconfig = false;


	msm_comm_scale_clocks_and_bus(inst);
	msm_comm_scale_clocks_and_bus(inst);


+70 −60
Original line number Original line Diff line number Diff line
@@ -1361,7 +1361,7 @@ static void handle_event_change(enum hal_command_response cmd, void *data)


	switch (event_notify->hal_event_type) {
	switch (event_notify->hal_event_type) {
	case HAL_EVENT_SEQ_CHANGED_SUFFICIENT_RESOURCES:
	case HAL_EVENT_SEQ_CHANGED_SUFFICIENT_RESOURCES:
		event = V4L2_EVENT_SEQ_CHANGED_INSUFFICIENT;
		event = V4L2_EVENT_SEQ_CHANGED_SUFFICIENT;
		break;
		break;
	case HAL_EVENT_SEQ_CHANGED_INSUFFICIENT_RESOURCES:
	case HAL_EVENT_SEQ_CHANGED_INSUFFICIENT_RESOURCES:
		event = V4L2_EVENT_SEQ_CHANGED_INSUFFICIENT;
		event = V4L2_EVENT_SEQ_CHANGED_INSUFFICIENT;
@@ -1441,10 +1441,9 @@ static void handle_event_change(enum hal_command_response cmd, void *data)
	* u32 *ptr = seq_changed_event.u.data;
	* u32 *ptr = seq_changed_event.u.data;
	* ptr[0] = height
	* ptr[0] = height
	* ptr[1] = width
	* ptr[1] = width
	 * ptr[2] = flag to indicate bit depth or/and pic struct changed
	* ptr[2] = bit depth
	 * ptr[3] = bit depth
	* ptr[3] = pic struct (progressive or interlaced)
	 * ptr[4] = pic struct (progressive or interlaced)
	* ptr[4] = colour space
	 * ptr[5] = colour space
	*/
	*/


	inst->entropy_mode = msm_comm_hal_to_v4l2(
	inst->entropy_mode = msm_comm_hal_to_v4l2(
@@ -1458,49 +1457,29 @@ static void handle_event_change(enum hal_command_response cmd, void *data)
			event_notify->level);
			event_notify->level);


	ptr = (u32 *)seq_changed_event.u.data;
	ptr = (u32 *)seq_changed_event.u.data;
	ptr[0] = event_notify->height;
	ptr[1] = event_notify->width;
	ptr[2] = event_notify->bit_depth;
	ptr[3] = event_notify->pic_struct;
	ptr[4] = event_notify->colour_space;


	if (ptr != NULL) {
		ptr[2] = 0x0;
		ptr[3] = inst->bit_depth;
		ptr[4] = inst->pic_struct;
		ptr[5] = inst->colour_space;

		if (inst->bit_depth != event_notify->bit_depth) {
			inst->bit_depth = event_notify->bit_depth;
			ptr[2] |= V4L2_EVENT_BITDEPTH_FLAG;
			ptr[3] = inst->bit_depth;
			event = V4L2_EVENT_SEQ_CHANGED_INSUFFICIENT;
			dprintk(VIDC_DBG,
				"V4L2_EVENT_SEQ_CHANGED_INSUFFICIENT due to bit-depth change\n");
		}

		if (inst->pic_struct != event_notify->pic_struct) {
			inst->pic_struct = event_notify->pic_struct;
			event = V4L2_EVENT_SEQ_CHANGED_INSUFFICIENT;
			ptr[2] |= V4L2_EVENT_PICSTRUCT_FLAG;
			ptr[4] = inst->pic_struct;
	dprintk(VIDC_DBG,
	dprintk(VIDC_DBG,
				"V4L2_EVENT_SEQ_CHANGED_INSUFFICIENT due to pic-struct change\n");
		"Event payload: height = %d width = %d\n",
		}
		event_notify->height, event_notify->width);


		if (inst->bit_depth == MSM_VIDC_BIT_DEPTH_10
				&& inst->colour_space !=
					event_notify->colour_space) {
			inst->colour_space = event_notify->colour_space;
			event = V4L2_EVENT_SEQ_CHANGED_INSUFFICIENT;
			ptr[2] |= V4L2_EVENT_COLOUR_SPACE_FLAG;
			ptr[5] = inst->colour_space;
	dprintk(VIDC_DBG,
	dprintk(VIDC_DBG,
				"V4L2_EVENT_SEQ_CHANGED_INSUFFICIENT due to colour space change\n");
		"Event payload: bit_depth = %d pic_struct = %d colour_space = %d\n",
		}
		event_notify->bit_depth, event_notify->pic_struct,
			event_notify->colour_space);


	}
	mutex_lock(&inst->lock);
	inst->in_reconfig = true;
	inst->reconfig_height = event_notify->height;
	inst->reconfig_width = event_notify->width;
	mutex_unlock(&inst->lock);


	if (event == V4L2_EVENT_SEQ_CHANGED_INSUFFICIENT) {
	if (event == V4L2_EVENT_SEQ_CHANGED_INSUFFICIENT) {
		dprintk(VIDC_DBG, "V4L2_EVENT_SEQ_CHANGED_INSUFFICIENT\n");
		dprintk(VIDC_DBG, "V4L2_EVENT_SEQ_CHANGED_INSUFFICIENT\n");
		inst->reconfig_height = event_notify->height;
		inst->reconfig_width = event_notify->width;
		inst->in_reconfig = true;
	} else {
	} else {
		dprintk(VIDC_DBG, "V4L2_EVENT_SEQ_CHANGED_SUFFICIENT\n");
		dprintk(VIDC_DBG, "V4L2_EVENT_SEQ_CHANGED_SUFFICIENT\n");
		dprintk(VIDC_DBG,
		dprintk(VIDC_DBG,
@@ -1514,13 +1493,6 @@ static void handle_event_change(enum hal_command_response cmd, void *data)
	rc = msm_vidc_check_session_supported(inst);
	rc = msm_vidc_check_session_supported(inst);
	if (!rc) {
	if (!rc) {
		seq_changed_event.type = event;
		seq_changed_event.type = event;
		if (event == V4L2_EVENT_SEQ_CHANGED_INSUFFICIENT) {
			u32 *ptr = NULL;

			ptr = (u32 *)seq_changed_event.u.data;
			ptr[0] = event_notify->height;
			ptr[1] = event_notify->width;
		}
		v4l2_event_queue_fh(&inst->event_handler, &seq_changed_event);
		v4l2_event_queue_fh(&inst->event_handler, &seq_changed_event);
	} else if (rc == -ENOTSUPP) {
	} else if (rc == -ENOTSUPP) {
		msm_vidc_queue_v4l2_event(inst,
		msm_vidc_queue_v4l2_event(inst,
@@ -3651,6 +3623,11 @@ int msm_vidc_comm_cmd(void *instance, union msm_v4l2_cmd *cmd)
		}
		}
		break;
		break;
	}
	}
	case V4L2_QCOM_CMD_SESSION_CONTINUE:
	{
		rc = msm_comm_session_continue(inst);
		break;
	}
	default:
	default:
		dprintk(VIDC_ERR, "Unknown Command %d\n", which_cmd);
		dprintk(VIDC_ERR, "Unknown Command %d\n", which_cmd);
		rc = -ENOTSUPP;
		rc = -ENOTSUPP;
@@ -5462,3 +5439,36 @@ static void msm_comm_print_debug_info(struct msm_vidc_inst *inst)
	}
	}
	mutex_unlock(&core->lock);
	mutex_unlock(&core->lock);
}
}

int msm_comm_session_continue(void *instance)
{
	struct msm_vidc_inst *inst = instance;
	int rc = 0;
	struct hfi_device *hdev;

	if (!inst || !inst->core || !inst->core->device)
		return -EINVAL;
	hdev = inst->core->device;
	mutex_lock(&inst->lock);
	if (inst->session_type == MSM_VIDC_DECODER && inst->in_reconfig) {
		dprintk(VIDC_DBG, "send session_continue\n");
		rc = call_hfi_op(hdev, session_continue,
						 (void *)inst->session);
		if (rc) {
			dprintk(VIDC_ERR,
					"failed to send session_continue\n");
			rc = -EINVAL;
			goto sess_continue_fail;
		}
		inst->in_reconfig = false;
	} else if (inst->session_type == MSM_VIDC_ENCODER) {
		dprintk(VIDC_DBG,
				"session_continue not supported for encoder");
	} else {
		dprintk(VIDC_ERR,
				"session_continue called in wrong state for decoder");
	}
sess_continue_fail:
	mutex_unlock(&inst->lock);
	return rc;
}
+1 −0
Original line number Original line Diff line number Diff line
@@ -97,4 +97,5 @@ bool msm_comm_turbo_session(struct msm_vidc_inst *inst);
void msm_comm_print_inst_info(struct msm_vidc_inst *inst);
void msm_comm_print_inst_info(struct msm_vidc_inst *inst);
int msm_comm_v4l2_to_hal(int id, int value);
int msm_comm_v4l2_to_hal(int id, int value);
int msm_comm_hal_to_v4l2(int id, int value);
int msm_comm_hal_to_v4l2(int id, int value);
int msm_comm_session_continue(void *instance);
#endif
#endif
+1 −1
Original line number Original line Diff line number Diff line
@@ -1890,7 +1890,7 @@ struct v4l2_encoder_cmd {
#define V4L2_DEC_CMD_RESUME      (3)
#define V4L2_DEC_CMD_RESUME      (3)
#define V4L2_QCOM_CMD_FLUSH      (4)
#define V4L2_QCOM_CMD_FLUSH      (4)
#define V4L2_DEC_QCOM_CMD_RECONFIG_HINT  (5)
#define V4L2_DEC_QCOM_CMD_RECONFIG_HINT  (5)

#define V4L2_QCOM_CMD_SESSION_CONTINUE (6)
/* Flags for V4L2_DEC_CMD_START */
/* Flags for V4L2_DEC_CMD_START */
#define V4L2_DEC_CMD_START_MUTE_AUDIO	(1 << 0)
#define V4L2_DEC_CMD_START_MUTE_AUDIO	(1 << 0)