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

Commit 2dc3a8f9 authored by Arun Menon's avatar Arun Menon Committed by Matt Wagantall
Browse files

msm: vidc: Handle bitdepth event change



Venus firmware will raise an insufficient event
and bitdepth information whenever it detects a
bitdepth change. Video driver will inturn raise an
event and inform the new bitdepth to v4l2 client.

Change-Id: Ia089dededb81b782e38c59ed9bb8063b04657af1
Signed-off-by: default avatarArun Menon <avmenon@codeaurora.org>
parent b6cf9c1b
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -97,6 +97,16 @@ struct hal_session *hfi_process_get_session(
	return found_session ? session : NULL;
}

static enum msm_vidc_pixel_depth get_hal_pixel_depth(u32 hfi_bit_depth)
{
	switch (hfi_bit_depth) {
	case HFI_BITDEPTH_8: return MSM_VIDC_BIT_DEPTH_8;
	case HFI_BITDEPTH_10: return MSM_VIDC_BIT_DEPTH_10;
	}
	dprintk(VIDC_ERR, "Unsupported bit depth\n");
	return MSM_VIDC_BIT_DEPTH_UNSUPPORTED;
}

static void hfi_process_sess_evt_seq_changed(
		msm_vidc_callback callback, u32 device_id,
		struct hal_session *session,
@@ -107,6 +117,7 @@ static void hfi_process_sess_evt_seq_changed(
	int num_properties_changed;
	struct hfi_frame_size *frame_sz;
	struct hfi_profile_level *profile_level;
	struct hfi_bit_depth *pixel_depth;
	u8 *data_ptr;
	int prop_id;

@@ -160,6 +171,16 @@ static void hfi_process_sess_evt_seq_changed(
				data_ptr +=
					sizeof(struct hfi_profile_level);
				break;
			case HFI_PROPERTY_PARAM_VDEC_PIXEL_BITDEPTH:
				data_ptr = data_ptr + sizeof(u32);
				pixel_depth = (struct hfi_bit_depth *) data_ptr;
				event_notify.bit_depth =
					get_hal_pixel_depth(
						pixel_depth->bit_depth);
				dprintk(VIDC_DBG, "bitdepth: %d\n",
					pixel_depth->bit_depth);
				data_ptr += sizeof(struct hfi_bit_depth);
				break;
			default:
				dprintk(VIDC_ERR,
						"%s cmd: %#x not supported\n",
+1 −0
Original line number Diff line number Diff line
@@ -1209,6 +1209,7 @@ void *msm_vidc_open(int core_id, int session_type)
	inst->state = MSM_VIDC_CORE_UNINIT_DONE;
	inst->core = core;
	inst->map_output_buffer = false;
	inst->bit_depth = MSM_VIDC_BIT_DEPTH_8;

	for (i = SESSION_MSG_INDEX(SESSION_MSG_START);
		i <= SESSION_MSG_INDEX(SESSION_MSG_END); i++) {
+19 −3
Original line number Diff line number Diff line
@@ -46,6 +46,8 @@
		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 IS_SESSION_CMD_VALID(cmd) (((cmd) >= SESSION_MSG_START) && \
		((cmd) <= SESSION_MSG_END))
@@ -673,7 +675,9 @@ static void handle_event_change(enum command_response cmd, void *data)
	struct msm_vidc_inst *inst;
	struct msm_vidc_cb_event *event_notify;
	int event = V4L2_EVENT_SEQ_CHANGED_INSUFFICIENT;
	struct v4l2_event seq_changed_event = {0};
	int rc = 0;
	bool bit_depth_changed = false;
	if (response) {
		inst = (struct msm_vidc_inst *)response->session_id;
		event_notify = (struct msm_vidc_cb_event *) response->data;
@@ -761,10 +765,20 @@ static void handle_event_change(enum 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;
			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;
				dprintk(VIDC_DBG,
					"V4L2_EVENT_SEQ_BITDEPTH_CHANGED_INSUFFICIENT\n");
			} else {
				dprintk(VIDC_DBG,
					"V4L2_EVENT_SEQ_CHANGED_INSUFFICIENT\n");
			}
			inst->in_reconfig = true;
		} else {
			dprintk(VIDC_DBG,
@@ -790,7 +804,9 @@ static void handle_event_change(enum command_response cmd, void *data)
			msm_dcvs_init_load(inst);
		rc = msm_vidc_check_session_supported(inst);
		if (!rc) {
			msm_vidc_queue_v4l2_event(inst, event);
			seq_changed_event.type = event;
			v4l2_event_queue_fh(&inst->event_handler,
				&seq_changed_event);
		} else if (rc == -ENOTSUPP) {
			msm_vidc_queue_v4l2_event(inst,
				V4L2_EVENT_MSM_VIDC_HW_UNSUPPORTED);
+1 −0
Original line number Diff line number Diff line
@@ -298,6 +298,7 @@ struct msm_vidc_inst {
	atomic_t seq_hdr_reqs;
	struct v4l2_ctrl **ctrls;
	bool dcvs_mode;
	enum msm_vidc_pixel_depth bit_depth;
};

extern struct msm_vidc_drv *vidc_driver;
+1 −0
Original line number Diff line number Diff line
@@ -1178,6 +1178,7 @@ struct msm_vidc_cb_event {
	enum vidc_status status;
	u32 height;
	u32 width;
	enum msm_vidc_pixel_depth bit_depth;
	u32 hal_event_type;
	ion_phys_addr_t packet_buffer;
	ion_phys_addr_t extra_data_buffer;
Loading