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

Commit 8de07db6 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 80202085 0d812bf1
Loading
Loading
Loading
Loading
+4 −1
Original line number Original line 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
 * 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
 * it under the terms of the GNU General Public License version 2 and
@@ -1613,6 +1613,7 @@ void *msm_vidc_open(int core_id, int session_type)
	mutex_init(&inst->bufq[CAPTURE_PORT].lock);
	mutex_init(&inst->bufq[CAPTURE_PORT].lock);
	mutex_init(&inst->bufq[OUTPUT_PORT].lock);
	mutex_init(&inst->bufq[OUTPUT_PORT].lock);
	mutex_init(&inst->lock);
	mutex_init(&inst->lock);
	mutex_init(&inst->flush_lock);


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


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


	msm_vidc_debugfs_deinit_inst(inst);
	msm_vidc_debugfs_deinit_inst(inst);


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


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


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


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


@@ -5117,6 +5119,7 @@ int msm_comm_flush(struct msm_vidc_inst *inst, u32 flags)
		return 0;
		return 0;
	}
	}


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


@@ -5170,6 +5173,7 @@ int msm_comm_flush(struct msm_vidc_inst *inst, u32 flags)
		rc = call_hfi_op(hdev, session_flush, inst->session,
		rc = call_hfi_op(hdev, session_flush, inst->session,
			HAL_FLUSH_OUTPUT);
			HAL_FLUSH_OUTPUT);
	}
	}
	mutex_unlock(&inst->flush_lock);
	if (rc) {
	if (rc) {
		dprintk(VIDC_ERR,
		dprintk(VIDC_ERR,
			"Sending flush to firmware failed, flush out all buffers\n");
			"Sending flush to firmware failed, flush out all buffers\n");
@@ -6582,6 +6586,7 @@ void handle_release_buffer_reference(struct msm_vidc_inst *inst,
	bool found = false;
	bool found = false;
	int i = 0;
	int i = 0;


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


int msm_comm_unmap_vidc_buffer(struct msm_vidc_inst *inst,
int msm_comm_unmap_vidc_buffer(struct msm_vidc_inst *inst,
+2 −2
Original line number Original line 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
 * 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
 * it under the terms of the GNU General Public License version 2 and
@@ -363,7 +363,7 @@ struct msm_vidc_core {


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