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

Commit c6407c02 authored by Maheshwar Ajja's avatar Maheshwar Ajja
Browse files

msm: vidc: Simplify buffer map and unmap sequence



Video driver will map the buffer twice in ETB/FTB. First map will
call iommu_map and following maps will just increment the refcount.
First unmap will happen in EBD/FBD and second unmap will happen if
READONLY flag is not present in EBD/FBD. If READONLY flag is not
present in EBD/FBD then video hardware will send RBR event
(Release Buffer Reference) to driver where second unmap will happen.
Though video driver calls iommu_unmap for second unmap the buffer
is not actually unmapped in iommu driver as video buffers are mapped
using late unmap feature. The buffer will get unmapped in iommu driver
when it is freed.

Change-Id: Ic0043ef97146e3b1081f2fc0fc3da715396be1a0
Signed-off-by: default avatarMaheshwar Ajja <majja@codeaurora.org>
parent d0d63841
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
@@ -10,9 +10,6 @@
 * GNU General Public License for more details.
 *
 */
#include <linux/errno.h>
#include <linux/log2.h>
#include <linux/hash.h>
#include "hfi_packetization.h"
#include "msm_vidc_debug.h"

@@ -868,8 +865,6 @@ int create_pkt_cmd_session_ftb(struct hfi_cmd_session_fill_buffer_packet *pkt,
		output_frame->device_addr, output_frame->timestamp,
		output_frame->alloc_len, output_frame->filled_len,
		output_frame->offset);
	dprintk(VIDC_DBG, "### Q OUTPUT BUFFER ###: %d, %d, %d\n",
			pkt->alloc_len, pkt->filled_len, pkt->offset);

	return rc;
}
+4 −7
Original line number Diff line number Diff line
@@ -1329,10 +1329,8 @@ static int hfi_process_session_etb_done(u32 device_id,
		pkt->ubwc_cr_stats.complexity_number;
	data_done.input_done.offset = pkt->offset;
	data_done.input_done.filled_len = pkt->filled_len;
	data_done.input_done.packet_buffer =
		(ion_phys_addr_t)pkt->packet_buffer;
	data_done.input_done.extra_data_buffer =
		(ion_phys_addr_t)pkt->extra_data_buffer;
	data_done.input_done.packet_buffer = pkt->packet_buffer;
	data_done.input_done.extra_data_buffer = pkt->extra_data_buffer;
	data_done.input_done.status =
		hfi_map_err_status(pkt->error_type);
	hfi_picture_type = (struct hfi_picture_type *)&pkt->rgData[0];
@@ -1413,10 +1411,9 @@ static int hfi_process_session_ftb_done(
		data_done.output_done.alloc_len1 = pkt->alloc_len;
		data_done.output_done.filled_len1 = pkt->filled_len;
		data_done.output_done.picture_type = pkt->picture_type;
		data_done.output_done.packet_buffer1 =
			(ion_phys_addr_t)pkt->packet_buffer;
		data_done.output_done.packet_buffer1 = pkt->packet_buffer;
		data_done.output_done.extra_data_buffer =
			(ion_phys_addr_t)pkt->extra_data_buffer;
			pkt->extra_data_buffer;
		data_done.output_done.buffer_type = HAL_BUFFER_OUTPUT;
	} else /* if (is_decoder) */ {
		struct hfi_msg_session_fbd_uncompressed_plane0_packet *pkt =
+362 −209

File changed.

Preview size limit exceeded, changes collapsed.

+124 −734

File changed.

Preview size limit exceeded, changes collapsed.

+14 −14
Original line number Diff line number Diff line
@@ -190,7 +190,7 @@ int msm_comm_vote_bus(struct msm_vidc_core *core)

static inline int get_pending_bufs_fw(struct msm_vidc_inst *inst)
{
	int fw_out_qsize = 0, buffers_in_driver = 0;
	int fw_out_qsize = 0;

	/*
	 * DCVS always operates on Uncompressed buffers.
@@ -203,11 +203,9 @@ static inline int get_pending_bufs_fw(struct msm_vidc_inst *inst)
			fw_out_qsize = inst->count.ftb - inst->count.fbd;
		else
			fw_out_qsize = inst->count.etb - inst->count.ebd;

		buffers_in_driver = inst->buffers_held_in_driver;
	}

	return fw_out_qsize + buffers_in_driver;
	return fw_out_qsize;
}

static int msm_dcvs_scale_clocks(struct msm_vidc_inst *inst)
@@ -266,7 +264,7 @@ static int msm_dcvs_scale_clocks(struct msm_vidc_inst *inst)
}

static void msm_vidc_update_freq_entry(struct msm_vidc_inst *inst,
	unsigned long freq, ion_phys_addr_t device_addr)
	unsigned long freq, u32 device_addr)
{
	struct vidc_freq_data *temp, *next;
	bool found = false;
@@ -292,7 +290,7 @@ static void msm_vidc_update_freq_entry(struct msm_vidc_inst *inst,
// TODO this needs to be removed later and use queued_list

void msm_vidc_clear_freq_entry(struct msm_vidc_inst *inst,
	ion_phys_addr_t device_addr)
	u32 device_addr)
{
	struct vidc_freq_data *temp, *next;

@@ -515,10 +513,10 @@ int msm_vidc_update_operating_rate(struct msm_vidc_inst *inst)

int msm_comm_scale_clocks(struct msm_vidc_inst *inst)
{
	struct vb2_buf_entry *temp, *next;
	struct msm_vidc_buffer *temp, *next;
	unsigned long freq = 0;
	u32 filled_len = 0;
	ion_phys_addr_t device_addr = 0;
	u32 device_addr = 0;

	if (!inst || !inst->core) {
		dprintk(VIDC_ERR, "%s Invalid args: Inst = %pK\n",
@@ -526,15 +524,17 @@ int msm_comm_scale_clocks(struct msm_vidc_inst *inst)
		return -EINVAL;
	}

	mutex_lock(&inst->pendingq.lock);
	list_for_each_entry_safe(temp, next, &inst->pendingq.list, list) {
		if (temp->vb->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) {
	mutex_lock(&inst->registeredbufs.lock);
	list_for_each_entry_safe(temp, next, &inst->registeredbufs.list, list) {
		if (temp->vvb.vb2_buf.type ==
				V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE &&
				temp->deferred) {
			filled_len = max(filled_len,
				temp->vb->planes[0].bytesused);
			device_addr = temp->vb->planes[0].m.userptr;
				temp->vvb.vb2_buf.planes[0].bytesused);
			device_addr = temp->smem[0].device_addr;
		}
	}
	mutex_unlock(&inst->pendingq.lock);
	mutex_unlock(&inst->registeredbufs.lock);

	if (!filled_len || !device_addr) {
		dprintk(VIDC_PROF, "No Change in frequency\n");
Loading