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

Commit 75dbd449 authored by Praneeth Paladugu's avatar Praneeth Paladugu
Browse files

msm: vidc: Enabling DPB-OPB split for NV12 color format



Video firmware will send a HFI_PIC_STRUCT field in sequence changed
event, which indicates whether the clip is interlaced or progressive.
If the color format is NV12 and the clip is interlaced, DPB mode
would be combined NV12 while the DPB mode is split i.e. DPB is in
UBWC and OPB is in NV12. Also combining the pic struct change and
bit depth change into a single event to the userspace.

CRs-fixed: 1004998
Change-Id: Ife71e31622a53d0ea4cc418d434998e710352e10
Signed-off-by: default avatarPraneeth Paladugu <ppaladug@codeaurora.org>
parent 22c4c57b
Loading
Loading
Loading
Loading
+13 −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
@@ -108,6 +108,7 @@ static int hfi_process_sess_evt_seq_changed(u32 device_id,
	struct hfi_frame_size *frame_sz;
	struct hfi_profile_level *profile_level;
	struct hfi_bit_depth *pixel_depth;
	struct hfi_pic_struct *pic_struct;
	u8 *data_ptr;
	int prop_id;
	enum msm_vidc_pixel_depth luma_bit_depth, chroma_bit_depth;
@@ -193,6 +194,17 @@ static int hfi_process_sess_evt_seq_changed(u32 device_id,
					chroma_bit_depth);
				data_ptr += sizeof(struct hfi_bit_depth);
				break;
			case HFI_PROPERTY_PARAM_VDEC_PIC_STRUCT:
				data_ptr = data_ptr + sizeof(u32);
				pic_struct = (struct hfi_pic_struct *) data_ptr;
				event_notify.pic_struct =
					pic_struct->progressive_only;
				dprintk(VIDC_DBG,
					"Progressive only flag: %d\n",
						pic_struct->progressive_only);
				data_ptr +=
					sizeof(struct hfi_pic_struct);
				break;
			default:
				dprintk(VIDC_ERR,
					"%s cmd: %#x not supported\n",
+1 −0
Original line number Diff line number Diff line
@@ -1176,6 +1176,7 @@ void *msm_vidc_open(int core_id, int session_type)
	inst->core = core;
	inst->bit_depth = MSM_VIDC_BIT_DEPTH_8;
	inst->instant_bitrate = 0;
	inst->pic_struct = MSM_VIDC_PIC_STRUCT_PROGRESSIVE;

	for (i = SESSION_MSG_INDEX(SESSION_MSG_START);
		i <= SESSION_MSG_INDEX(SESSION_MSG_END); i++) {
+37 −16
Original line number Diff line number Diff line
@@ -44,8 +44,6 @@
		V4L2_EVENT_MSM_VIDC_PORT_SETTINGS_CHANGED_INSUFFICIENT
#define V4L2_EVENT_RELEASE_BUFFER_REFERENCE \
		V4L2_EVENT_MSM_VIDC_RELEASE_BUFFER_REFERENCE
#define V4L2_EVENT_SEQ_BITDEPTH_CHANGED_INSUFFICIENT \
		V4L2_EVENT_MSM_VIDC_PORT_SETTINGS_BITDEPTH_CHANGED_INSUFFICIENT

#define MAX_SUPPORTED_INSTANCES 16

@@ -1023,8 +1021,8 @@ static void handle_event_change(enum hal_command_response cmd, void *data)
	int event = V4L2_EVENT_SEQ_CHANGED_INSUFFICIENT;
	struct v4l2_event seq_changed_event = {0};
	int rc = 0;
	bool bit_depth_changed = false;
	struct hfi_device *hdev;
	u32 *ptr = NULL;

	if (!event_notify) {
		dprintk(VIDC_WARN, "Got an empty event from hfi\n");
@@ -1144,23 +1142,46 @@ static void handle_event_change(enum hal_command_response cmd, void *data)
		break;
	}

	if (event == V4L2_EVENT_SEQ_CHANGED_INSUFFICIENT) {
		dprintk(VIDC_DBG, "V4L2_EVENT_SEQ_CHANGED_INSUFFICIENT\n");
		inst->reconfig_height = event_notify->height;
		inst->reconfig_width = event_notify->width;
	/* Bit depth and pic struct changed event are combined into a single
	 * event (insufficient event) for the userspace. Currently bitdepth
	 * changes is only for HEVC and interlaced support is for all
	 * codecs except HEVC
	 * event data is now as follows:
	 * u32 *ptr = seq_changed_event.u.data;
	 * ptr[0] = height
	 * ptr[1] = width
	 * ptr[2] = flag to indicate bit depth or/and pic struct changed
	 * ptr[3] = bit depth
	 * ptr[4] = pic struct (progressive or interlaced)
	 */

	ptr = (u32 *)seq_changed_event.u.data;
	ptr[2] = 0x0;
	ptr[3] = inst->bit_depth;
	ptr[4] = inst->pic_struct;

	if (inst->bit_depth != event_notify->bit_depth) {
		inst->bit_depth = event_notify->bit_depth;
			bit_depth_changed = true;
			seq_changed_event.u.data[0] = inst->bit_depth;
			event = V4L2_EVENT_SEQ_BITDEPTH_CHANGED_INSUFFICIENT;
		ptr[2] |= V4L2_EVENT_BITDEPTH_FLAG;
		ptr[3] = inst->bit_depth;
		event = V4L2_EVENT_SEQ_CHANGED_INSUFFICIENT;
		dprintk(VIDC_DBG,
					"V4L2_EVENT_SEQ_BITDEPTH_CHANGED_INSUFFICIENT\n");
		} else {
			"V4L2_EVENT_SEQ_CHANGED_INSUFFICIENT due to bit-depth change\n");
	}

	if (inst->pic_struct != event_notify->pic_struct) {
		inst->pic_struct = event_notify->pic_struct;
		event = V4L2_EVENT_SEQ_CHANGED_INSUFFICIENT;
		ptr[2] |= V4L2_EVENT_PICSTRUCT_FLAG;
		ptr[4] = inst->pic_struct;
		dprintk(VIDC_DBG,
					"V4L2_EVENT_SEQ_CHANGED_INSUFFICIENT\n");
			"V4L2_EVENT_SEQ_CHANGED_INSUFFICIENT due to pic-struct change\n");
	}

	if (event == V4L2_EVENT_SEQ_CHANGED_INSUFFICIENT) {
		dprintk(VIDC_DBG, "V4L2_EVENT_SEQ_CHANGED_INSUFFICIENT\n");
		inst->reconfig_height = event_notify->height;
		inst->reconfig_width = event_notify->width;
		inst->in_reconfig = true;
	} else {
		dprintk(VIDC_DBG, "V4L2_EVENT_SEQ_CHANGED_SUFFICIENT\n");
+1 −0
Original line number Diff line number Diff line
@@ -290,6 +290,7 @@ struct msm_vidc_inst {
	unsigned long instant_bitrate;
	u32 buffers_held_in_driver;
	atomic_t in_flush;
	u32 pic_struct;
};

extern struct msm_vidc_drv *vidc_driver;
+1 −0
Original line number Diff line number Diff line
@@ -1338,6 +1338,7 @@ struct msm_vidc_cb_event {
	u32 hal_event_type;
	ion_phys_addr_t packet_buffer;
	ion_phys_addr_t extra_data_buffer;
	u32 pic_struct;
};

struct msm_vidc_cb_data_done {
Loading