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

Commit 94316e92 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: Synchronize flush and release reference event"

parents deb78380 a44a4c42
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
/* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2018, 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
@@ -1612,6 +1612,7 @@ void *msm_vidc_open(int core_id, int session_type)
	mutex_init(&inst->bufq[CAPTURE_PORT].lock);
	mutex_init(&inst->bufq[OUTPUT_PORT].lock);
	mutex_init(&inst->lock);
	mutex_init(&inst->flush_lock);

	INIT_MSM_VIDC_LIST(&inst->scratchbufs);
	INIT_MSM_VIDC_LIST(&inst->freqs);
@@ -1714,6 +1715,7 @@ void *msm_vidc_open(int core_id, int session_type)
	mutex_destroy(&inst->bufq[CAPTURE_PORT].lock);
	mutex_destroy(&inst->bufq[OUTPUT_PORT].lock);
	mutex_destroy(&inst->lock);
	mutex_destroy(&inst->flush_lock);

	DEINIT_MSM_VIDC_LIST(&inst->scratchbufs);
	DEINIT_MSM_VIDC_LIST(&inst->persistbufs);
@@ -1843,6 +1845,7 @@ int msm_vidc_destroy(struct msm_vidc_inst *inst)
	mutex_destroy(&inst->bufq[CAPTURE_PORT].lock);
	mutex_destroy(&inst->bufq[OUTPUT_PORT].lock);
	mutex_destroy(&inst->lock);
	mutex_destroy(&inst->flush_lock);

	msm_vidc_debugfs_deinit_inst(inst);

+9 −0
Original line number Diff line number Diff line
@@ -2019,6 +2019,7 @@ static void handle_session_flush(enum hal_command_response cmd, void *data)
		return;
	}

	mutex_lock(&inst->flush_lock);
	if (msm_comm_get_stream_output_mode(inst) ==
			HAL_VIDEO_DECODER_SECONDARY) {

@@ -2061,6 +2062,7 @@ static void handle_session_flush(enum hal_command_response cmd, void *data)
	v4l2_event_queue_fh(&inst->event_handler, &flush_event);

exit:
	mutex_unlock(&inst->flush_lock);
	put_inst(inst);
}

@@ -4851,6 +4853,10 @@ int msm_comm_flush(struct msm_vidc_inst *inst, u32 flags)
		return 0;
	}

	mutex_lock(&inst->flush_lock);
	/* enable in flush */
	inst->in_flush = true;

	mutex_lock(&inst->registeredbufs.lock);
	list_for_each_entry_safe(mbuf, next, &inst->registeredbufs.list, list) {
		/* don't flush input buffers if input flush is not requested */
@@ -4904,6 +4910,7 @@ int msm_comm_flush(struct msm_vidc_inst *inst, u32 flags)
		rc = call_hfi_op(hdev, session_flush, inst->session,
			HAL_FLUSH_OUTPUT);
	}
	mutex_unlock(&inst->flush_lock);
	if (rc) {
		dprintk(VIDC_ERR,
			"Sending flush to firmware failed, flush out all buffers\n");
@@ -6244,6 +6251,7 @@ void handle_release_buffer_reference(struct msm_vidc_inst *inst,
	bool found = false;
	int i = 0;

	mutex_lock(&inst->flush_lock);
	mutex_lock(&inst->registeredbufs.lock);
	found = false;
	/* check if mbuf was not removed by any chance */
@@ -6324,6 +6332,7 @@ void handle_release_buffer_reference(struct msm_vidc_inst *inst,
			print_vidc_buffer(VIDC_ERR,
				"rbr qbuf failed", inst, mbuf);
	}
	mutex_unlock(&inst->flush_lock);
}

int msm_comm_unmap_vidc_buffer(struct msm_vidc_inst *inst,
+2 −2
Original line number Diff line number Diff line
/* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2018, 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
@@ -362,7 +362,7 @@ struct msm_vidc_core {

struct msm_vidc_inst {
	struct list_head list;
	struct mutex sync_lock, lock;
	struct mutex sync_lock, lock, flush_lock;
	struct msm_vidc_core *core;
	enum session_type session_type;
	void *session;