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

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

Merge "msm: VPU: Add tunneling support for VPU video post-processing unit"

parents 0fe5d90f b24d66d8
Loading
Loading
Loading
Loading
+29 −3
Original line number Diff line number Diff line
config MSM_VPU
	tristate "Qualcomm VPU"
	tristate "MSM VPU"
	depends on VIDEO_V4L2
	---help---
		Enables VPU driver. This device allows for advanced video post
		processing using the v4l2 api
		This flag enables enables the MSM VPU driver.
		This device allows for advanced video post processing using the
		v4l2 api.
		In its original version (no tunneling features) buffers are
		received from HLOS and sent back to HLOS after VPU hardware
		processing.

config MSM_VPU_IN_VCAP
	bool "MSM VCAP/VPU Tunneling"
	depends on MSM_VPU && MSM_VCAP_V2 && ARCH_MPQ8092
	---help---
		This flag enables VCAP/VPU tunneling feature of VPU driver.
		If enabled, VPU driver interacts with video capture. Input
		buffers (already allocated) are received by VPU driver from
		VCAP driver. VPU driver then maps these 'input tunneling
		buffers' for VPU address space and send them to VPU firmware
		for video streaming.

config MSM_VPU_OUT_MDSS
	bool "MSM VPU/MDSS Tunneling"
	depends on MSM_VPU && FB_MSM_MDSS && ARCH_MPQ8092
	---help---
		This flag enables VPU/MDSS tunneling feature of VPU driver.
		If enabled, VPU driver interacts with display. Output buffers
		(already allocated) are received by VPU driver from user space.
		VPU driver then maps these 'output tunneling buffers' for both
		VPU and MDSS address spaces and send them to VPU firmware
		for video streaming.
+3 −0
Original line number Diff line number Diff line
@@ -11,3 +11,6 @@ obj-$(CONFIG_MSM_VPU) := \
		vpu_hfi.o \
		vpu_bus_clock.o \
		vpu_debug.o \

obj-$(CONFIG_MSM_VPU_IN_VCAP) += vpu_in_vcap.o
obj-$(CONFIG_MSM_VPU_OUT_MDSS) += vpu_out_mdss.o
+4 −3
Original line number Diff line number Diff line
@@ -1283,6 +1283,9 @@ static void vpu_buf_to_ipc_buf_info(struct vpu_buffer *vb, bool input,
		flag |= (vb->vb.num_planes - 1) <<
				BUFFER_PKT_FLAG_IN_PLANE_NUM_SHIFT;

		/* field information */
		flag |= translate_field_to_hfi(vb->vb.v4l2_buf.field);

		/* store EOS info if present */
		if (vb->vb.v4l2_buf.flags & V4L2_QCOM_BUF_FLAG_EOS) {
			pr_debug("in EOS buf #%d\n", vb->vb.v4l2_buf.index);
@@ -1397,6 +1400,7 @@ int vpu_hw_session_register_buffers(u32 sid, bool input,
	pbuf_info_ext = (struct _ipc_buffer_info_ext *) extra_info;
	vpu_buf_to_ipc_buf_info(&vb[0], input, pbuf_info_ext,
			&buffer_packet.buf_pkt_flag);

	/* actual size of the buffer infor (excluding non used addr) */
	extra_size = sizeof(struct vpu_ipc_buf_info) +
			pbuf_info_ext->buf_info.buf_addr_size;
@@ -1483,7 +1487,6 @@ int vpu_hw_session_empty_buffer(u32 sid, struct vpu_buffer *vb)
	int rc;
	struct vpu_ipc_cmd_session_buffers_packet buffer_packet;
	struct _ipc_buffer_info_ext buf_info_ext;
	u32 field_flag = 0;
	u32 extra_size;
	int cid = SID2CID(sid);

@@ -1517,8 +1520,6 @@ int vpu_hw_session_empty_buffer(u32 sid, struct vpu_buffer *vb)
	/* fill buffer_info, and the flag */
	vpu_buf_to_ipc_buf_info(vb, true, &buf_info_ext,
				&buffer_packet.buf_pkt_flag);
	field_flag = translate_field_to_hfi(vb->vb.v4l2_buf.field);
	buffer_packet.buf_pkt_flag |= field_flag;

	extra_size = sizeof(struct vpu_ipc_buf_info) +
				buf_info_ext.buf_info.buf_addr_size;
+45 −6
Original line number Diff line number Diff line
@@ -201,7 +201,8 @@ int configure_nr_buffers(struct vpu_dev_session *session,
			return 0; /* input resolution not configured yet */

		buf_size = get_bytesperline(in_fmt->width,
				vpu_format->plane[0].bitsperpixel, 0);
				vpu_format->plane[0].bitsperpixel, 0,
				in_fmt->pixelformat);
		buf_size *= in_fmt->height;

		for (i = 0; i < NUM_NR_BUFFERS; i++) {
@@ -992,17 +993,24 @@ static const struct vpu_format_desc vpu_port_formats[] = {
		.description = "YUYV422 Compressed",
		.fourcc = V4L2_PIX_FMT_YUYV10BWC,
		.num_planes = 1,
		.plane[0] = { .bitsperpixel = 10, .heightfactor = 1},
		.plane[0] = { .bitsperpixel = 21, .heightfactor = 1},
	},
};

#define PADDING 128
#define CEIL(x, y) (((x) + ((y)-1)) / (y))
u32 get_bytesperline(u32 width, u32 bitsperpixel, u32 input_bytesperline)
u32 get_bytesperline(u32 width, u32 bitsperpixel, u32 input_bytesperline,
		u32 pixelformat)
{
	u32 bytesperline = CEIL(width * bitsperpixel, 8);
	u32 padding_factor = CEIL(bytesperline, PADDING);
	u32 min_bytesperline = PADDING * padding_factor;
	u32 bytesperline, padding_factor, min_bytesperline;

	if (pixelformat == V4L2_PIX_FMT_YUYV10BWC)
		bytesperline = CEIL(width * 64, 24);
	else
		bytesperline = CEIL(width * bitsperpixel, 8);

	padding_factor = CEIL(bytesperline, PADDING);
	min_bytesperline = PADDING * padding_factor;

	if (!input_bytesperline) {
		return min_bytesperline;
@@ -1151,6 +1159,21 @@ static int __configure_input_port(struct vpu_dev_session *session)
		return ret;
	}

	if (session->port_info[INPUT_PORT].source
					!= VPU_INPUT_TYPE_HOST) {
		struct vpu_data_value in_source_ch;
		memset(&in_source_ch, 0, sizeof(in_source_ch));
		in_source_ch.value = translate_input_source_ch(
				session->port_info[INPUT_PORT].source);
		ret = vpu_hw_session_s_property(session->id,
				VPU_PROP_SESSION_SOURCE_CONFIG,
				&in_source_ch, sizeof(in_source_ch));
		if (ret) {
			pr_err("Failed to set port 0 source ch\n");
			return ret;
		}
	}

	return 0;
}

@@ -1167,6 +1190,22 @@ static int __configure_output_port(struct vpu_dev_session *session)
		return ret;
	}

	if (session->port_info[OUTPUT_PORT].destination
					!= VPU_OUTPUT_TYPE_HOST) {
		struct vpu_data_pkt out_dest_ch;
		memset(&out_dest_ch, 0, sizeof(out_dest_ch));
		out_dest_ch.payload[0] = translate_output_destination_ch(
				session->port_info[OUTPUT_PORT].destination);
		out_dest_ch.size = sizeof(out_dest_ch);
		ret = vpu_hw_session_s_property(session->id,
				VPU_PROP_SESSION_SINK_CONFIG,
				&out_dest_ch, sizeof(out_dest_ch));
		if (ret) {
			pr_err("Failed to set port 1 dest ch\n");
			return ret;
		}
	}

	return 0;
}

+2 −1
Original line number Diff line number Diff line
@@ -84,7 +84,8 @@ struct vpu_format_desc {

const struct vpu_format_desc *query_supported_formats(int index);

u32 get_bytesperline(u32 width, u32 bitsperpixel, u32 input_bytesperline);
u32 get_bytesperline(u32 width, u32 bitsperpixel, u32 input_bytesperline,
		u32 pixelformat);

static inline u32 get_sizeimage(u32 bytesperline, u32 height, u32 heightfactor)
{
Loading