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

Commit 41c79ab8 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: Add interface to send crop info"

parents 5727dc38 72fa67bf
Loading
Loading
Loading
Loading
+37 −0
Original line number Diff line number Diff line
@@ -110,6 +110,8 @@ static int hfi_process_sess_evt_seq_changed(u32 device_id,
	struct hfi_profile_level *profile_level;
	struct hfi_bit_depth *pixel_depth;
	struct hfi_pic_struct *pic_struct;
	struct hfi_buffer_requirements *buf_req;
	struct hfi_index_extradata_input_crop_payload *crop_info;
	u32 entropy_mode = 0;
	u8 *data_ptr;
	int prop_id;
@@ -231,6 +233,41 @@ static int hfi_process_sess_evt_seq_changed(u32 device_id,
				data_ptr +=
					sizeof(u32);
				break;
			case HFI_PROPERTY_CONFIG_BUFFER_REQUIREMENTS:
				data_ptr = data_ptr + sizeof(u32);
				buf_req =
					(struct hfi_buffer_requirements *)
						data_ptr;
				event_notify.capture_buf_count =
					buf_req->buffer_count_min;
				dprintk(VIDC_DBG,
					"Capture Count : 0x%x\n",
						event_notify.capture_buf_count);
				data_ptr +=
					sizeof(struct hfi_buffer_requirements);
				break;
			case HFI_INDEX_EXTRADATA_INPUT_CROP:
				data_ptr = data_ptr + sizeof(u32);
				crop_info = (struct
				hfi_index_extradata_input_crop_payload *)
						data_ptr;
				event_notify.crop_data.left = crop_info->left;
				event_notify.crop_data.top = crop_info->top;
				event_notify.crop_data.width = crop_info->width;
				event_notify.crop_data.height =
					crop_info->height;
				dprintk(VIDC_DBG,
					"CROP info : Left = %d Top = %d\n",
						crop_info->left,
						crop_info->top);
				dprintk(VIDC_DBG,
					"CROP info : Width = %d Height = %d\n",
						crop_info->width,
						crop_info->height);
				data_ptr +=
					sizeof(struct
					hfi_index_extradata_input_crop_payload);
				break;
			default:
				dprintk(VIDC_ERR,
					"%s cmd: %#x not supported\n",
+9 −0
Original line number Diff line number Diff line
@@ -225,6 +225,14 @@ static int msm_v4l2_g_parm(struct file *file, void *fh,
	return 0;
}

static int msm_v4l2_g_crop(struct file *file, void *fh,
			struct v4l2_crop *a)
{
	struct msm_vidc_inst *vidc_inst = get_vidc_inst(file, fh);

	return msm_vidc_g_crop(vidc_inst, a);
}

static int msm_v4l2_enum_framesizes(struct file *file, void *fh,
				struct v4l2_frmsizeenum *fsize)
{
@@ -265,6 +273,7 @@ static const struct v4l2_ioctl_ops msm_v4l2_ioctl_ops = {
	.vidioc_encoder_cmd = msm_v4l2_encoder_cmd,
	.vidioc_s_parm = msm_v4l2_s_parm,
	.vidioc_g_parm = msm_v4l2_g_parm,
	.vidioc_g_crop = msm_v4l2_g_crop,
	.vidioc_enum_framesizes = msm_v4l2_enum_framesizes,
};

+23 −0
Original line number Diff line number Diff line
@@ -265,6 +265,29 @@ int msm_vidc_s_ctrl(void *instance, struct v4l2_control *control)
}
EXPORT_SYMBOL(msm_vidc_s_ctrl);

int msm_vidc_g_crop(void *instance, struct v4l2_crop *crop)
{
	struct msm_vidc_inst *inst = instance;

	if (!inst || !crop)
		return -EINVAL;

	if (inst->session_type == MSM_VIDC_ENCODER) {
		dprintk(VIDC_ERR,
			"Session = %pK : Encoder Crop is not implemented yet\n",
				inst);
		return -EPERM;
	}

	crop->c.left = inst->prop.crop_info.left;
	crop->c.top = inst->prop.crop_info.top;
	crop->c.width = inst->prop.crop_info.width;
	crop->c.height = inst->prop.crop_info.height;

	return 0;
}
EXPORT_SYMBOL(msm_vidc_g_crop);

int msm_vidc_g_ctrl(void *instance, struct v4l2_control *control)
{
	struct msm_vidc_inst *inst = instance;
+19 −0
Original line number Diff line number Diff line
@@ -1554,6 +1554,14 @@ static void handle_event_change(enum hal_command_response cmd, void *data)
	inst->entropy_mode = event_notify->entropy_mode;
	inst->profile = event_notify->profile;
	inst->level = event_notify->level;
	inst->prop.crop_info.left =
		event_notify->crop_data.left;
	inst->prop.crop_info.top =
		event_notify->crop_data.top;
	inst->prop.crop_info.height =
		event_notify->crop_data.height;
	inst->prop.crop_info.width =
		event_notify->crop_data.width;

	ptr = (u32 *)seq_changed_event.u.data;
	ptr[0] = event_notify->height;
@@ -1561,6 +1569,10 @@ static void handle_event_change(enum hal_command_response cmd, void *data)
	ptr[2] = event_notify->bit_depth;
	ptr[3] = event_notify->pic_struct;
	ptr[4] = event_notify->colour_space;
	ptr[5] = event_notify->crop_data.top;
	ptr[6] = event_notify->crop_data.left;
	ptr[7] = event_notify->crop_data.height;
	ptr[8] = event_notify->crop_data.width;

	dprintk(VIDC_DBG,
		"Event payload: height = %d width = %d\n",
@@ -1571,6 +1583,13 @@ static void handle_event_change(enum hal_command_response cmd, void *data)
		event_notify->bit_depth, event_notify->pic_struct,
			event_notify->colour_space);

	dprintk(VIDC_DBG,
		"Event payload: CROP top = %d left = %d Height = %d Width = %d\n",
			event_notify->crop_data.top,
			event_notify->crop_data.left,
			event_notify->crop_data.height,
			event_notify->crop_data.width);

	mutex_lock(&inst->lock);
	inst->in_reconfig = true;
	inst->reconfig_height = event_notify->height;
+8 −0
Original line number Diff line number Diff line
@@ -175,9 +175,17 @@ struct msm_video_device {
	struct video_device vdev;
};

struct session_crop {
	u32 left;
	u32 top;
	u32 width;
	u32 height;
};

struct session_prop {
	u32 width[MAX_PORT_NUM];
	u32 height[MAX_PORT_NUM];
	struct session_crop crop_info;
	u32 fps;
	u32 bitrate;
};
Loading