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

Commit df08f93f authored by Arun Menon's avatar Arun Menon Committed by Gerrit - the friendly Code Review server
Browse files

msm: vidc: Do not hold FTB in driver while flush is in progress



There is no real need for the video driver to hold an output
buffer while flush is in progress. This change fixes an issue
where driver ends up queuing a held output buffer to firmware,
just after flush done. So firmware never returns the output
buffer and client ends up waiting indefinitely for the buffer.

Change-Id: I20f76b64535ca8665fa214746582f13a0acc3c5d
Signed-off-by: default avatarArun Menon <avmenon@codeaurora.org>
parent 357160d5
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
/* Copyright (c) 2012-2015, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -814,8 +814,15 @@ int msm_vidc_qbuf(void *instance, struct v4l2_buffer *b)
	}

	rc = map_and_register_buf(inst, b);
	if (rc == -EEXIST)
	if (rc == -EEXIST) {
		if (atomic_read(&inst->in_flush) &&
			is_dynamic_output_buffer_mode(b, inst)) {
			dprintk(VIDC_ERR,
				"Flush in progress, do not hold any buffers in driver\n");
			msm_comm_flush_dynamic_buffers(inst);
		}
		return 0;
	}
	if (rc)
		return rc;

+7 −2
Original line number Diff line number Diff line
/* Copyright (c) 2012-2015, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -1441,7 +1441,8 @@ static void handle_session_flush(enum hal_command_response cmd, void *data)
			}
		}
	}

	atomic_dec(&inst->in_flush);
	dprintk(VIDC_DBG, "Notify flush complete to client\n");
	msm_vidc_queue_v4l2_event(inst, V4L2_EVENT_MSM_VIDC_FLUSH_DONE);
	put_inst(inst);
}
@@ -4422,6 +4423,8 @@ int msm_comm_flush(struct msm_vidc_inst *inst, u32 flags)
			"FLUSH BUG: Pending q not empty! It should be empty\n");
		}
		mutex_unlock(&inst->pendingq.lock);
		atomic_inc(&inst->in_flush);
		dprintk(VIDC_DBG, "Send flush Output to firmware\n");
		rc = call_hfi_op(hdev, session_flush, inst->session,
				HAL_FLUSH_OUTPUT);
	} else {
@@ -4458,6 +4461,8 @@ int msm_comm_flush(struct msm_vidc_inst *inst, u32 flags)
		/*Do not send flush in case of session_error */
		if (!(inst->state == MSM_VIDC_CORE_INVALID &&
			  core->state != VIDC_CORE_INVALID))
			atomic_inc(&inst->in_flush);
			dprintk(VIDC_DBG, "Send flush all to firmware\n");
			rc = call_hfi_op(hdev, session_flush, inst->session,
				HAL_FLUSH_ALL);
	}
+2 −1
Original line number Diff line number Diff line
/* Copyright (c) 2012-2015, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -48,6 +48,7 @@ void msm_comm_scale_clocks_and_bus(struct msm_vidc_inst *inst);
int msm_comm_scale_clocks(struct msm_vidc_core *core);
int msm_comm_scale_clocks_load(struct msm_vidc_core *core,
		int num_mbs_per_sec, enum load_calc_quirks quirks);
void msm_comm_flush_dynamic_buffers(struct msm_vidc_inst *inst);
int msm_comm_flush(struct msm_vidc_inst *inst, u32 flags);
int msm_comm_release_scratch_buffers(struct msm_vidc_inst *inst,
					bool check_for_reuse);
+2 −1
Original line number Diff line number Diff line
/* Copyright (c) 2012-2015, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -287,6 +287,7 @@ struct msm_vidc_inst {
	struct kref kref;
	unsigned long instant_bitrate;
	u32 buffers_held_in_driver;
	atomic_t in_flush;
};

extern struct msm_vidc_drv *vidc_driver;