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

Commit cbd3f594 authored by Chinmay Sawarkar's avatar Chinmay Sawarkar Committed by Gerrit - the friendly Code Review server
Browse files

msm: vidc: Remove compiler dependent code



Simplify the code by removing compiler dependent code.

CRs-Fixed: 2032170
Change-Id: I63729f20fee4ed1da13bb695a5cea29d63a31438
Signed-off-by: default avatarChinmay Sawarkar <chinmays@codeaurora.org>
parent fd8f40e6
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -18,9 +18,9 @@
#include "vidc_hfi.h"
#include "vidc_hfi_api.h"

#define call_hfi_pkt_op(q, op, args...)			\
#define call_hfi_pkt_op(q, op, ...)			\
	(((q) && (q)->pkt_ops && (q)->pkt_ops->op) ?	\
	((q)->pkt_ops->op(args)) : 0)
	((q)->pkt_ops->op(__VA_ARGS__)) : 0)

enum hfi_packetization_type {
	HFI_PACKETIZATION_4XX,
+40 −76
Original line number Diff line number Diff line
@@ -241,10 +241,8 @@ static int hfi_process_sess_evt_seq_changed(u32 device_id,
		} while (num_properties_changed > 0);
	}

	*info = (struct msm_vidc_cb_info) {
		.response_type =  HAL_SESSION_EVENT_CHANGE,
		.response.event = event_notify,
	};
	info->response_type = HAL_SESSION_EVENT_CHANGE;
	info->response.event = event_notify;

	return 0;
}
@@ -275,10 +273,8 @@ static int hfi_process_evt_release_buffer_ref(u32 device_id,
	event_notify.packet_buffer = data->packet_buffer;
	event_notify.extra_data_buffer = data->extra_data_buffer;

	*info = (struct msm_vidc_cb_info) {
		.response_type =  HAL_SESSION_EVENT_CHANGE,
		.response.event = event_notify,
	};
	info->response_type = HAL_SESSION_EVENT_CHANGE;
	info->response.event = event_notify;

	return 0;
}
@@ -289,10 +285,8 @@ static int hfi_process_sys_error(u32 device_id, struct msm_vidc_cb_info *info)

	cmd_done.device_id = device_id;

	*info = (struct msm_vidc_cb_info) {
		.response_type =  HAL_SYS_ERROR,
		.response.cmd = cmd_done,
	};
	info->response_type = HAL_SYS_ERROR;
	info->response.cmd = cmd_done;

	return 0;
}
@@ -315,17 +309,13 @@ static int hfi_process_session_error(u32 device_id,
	case HFI_ERR_SESSION_UPSCALE_NOT_SUPPORTED:
		cmd_done.status = VIDC_ERR_NONE;
		dprintk(VIDC_INFO, "Non Fatal: HFI_EVENT_SESSION_ERROR\n");
		*info = (struct msm_vidc_cb_info) {
			.response_type =  HAL_RESPONSE_UNUSED,
			.response.cmd = cmd_done,
		};
		info->response_type = HAL_RESPONSE_UNUSED;
		info->response.cmd = cmd_done;
		return 0;
	default:
		dprintk(VIDC_ERR, "HFI_EVENT_SESSION_ERROR\n");
		*info = (struct msm_vidc_cb_info) {
			.response_type =  HAL_SESSION_ERROR,
			.response.cmd = cmd_done,
		};
		info->response_type = HAL_SESSION_ERROR;
		info->response.cmd = cmd_done;
		return 0;
	}
}
@@ -403,10 +393,10 @@ static int hfi_process_sys_init_done(u32 device_id,
	cmd_done.session_id = NULL;
	cmd_done.status = (u32)status;
	cmd_done.size = sizeof(struct vidc_hal_sys_init_done);
	*info = (struct msm_vidc_cb_info) {
		.response_type =  HAL_SYS_INIT_DONE,
		.response.cmd = cmd_done,
	};

	info->response_type = HAL_SYS_INIT_DONE;
	info->response.cmd = cmd_done;

	return 0;
}

@@ -433,10 +423,8 @@ static int hfi_process_sys_rel_resource_done(u32 device_id,
	cmd_done.status = (u32) status;
	cmd_done.size = 0;

	*info = (struct msm_vidc_cb_info) {
		.response_type =  HAL_SYS_RELEASE_RESOURCE_DONE,
		.response.cmd = cmd_done,
	};
	info->response_type = HAL_SYS_RELEASE_RESOURCE_DONE;
	info->response.cmd = cmd_done;

	return 0;
}
@@ -1162,10 +1150,8 @@ static int hfi_process_session_prop_info(u32 device_id,
		cmd_done.data.property.buf_req = buff_req;
		cmd_done.size = sizeof(buff_req);

		*info = (struct msm_vidc_cb_info) {
			.response_type =  HAL_SESSION_PROPERTY_INFO,
			.response.cmd = cmd_done,
		};
		info->response_type = HAL_SESSION_PROPERTY_INFO;
		info->response.cmd = cmd_done;

		return 0;
	default:
@@ -1197,10 +1183,8 @@ static int hfi_process_session_init_done(u32 device_id,
	cmd_done.data.session_init_done = session_init_done;
	cmd_done.size = sizeof(struct vidc_hal_session_init_done);

	*info = (struct msm_vidc_cb_info) {
		.response_type =  HAL_SESSION_INIT_DONE,
		.response.cmd = cmd_done,
	};
	info->response_type = HAL_SESSION_INIT_DONE;
	info->response.cmd = cmd_done;

	return 0;
}
@@ -1227,10 +1211,8 @@ static int hfi_process_session_load_res_done(u32 device_id,
	cmd_done.status = hfi_map_err_status(pkt->error_type);
	cmd_done.size = 0;

	*info = (struct msm_vidc_cb_info) {
		.response_type =  HAL_SESSION_LOAD_RESOURCE_DONE,
		.response.cmd = cmd_done,
	};
	info->response_type = HAL_SESSION_LOAD_RESOURCE_DONE;
	info->response.cmd = cmd_done;

	return 0;
}
@@ -1272,10 +1254,8 @@ static int hfi_process_session_flush_done(u32 device_id,
		return -EINVAL;
	}

	*info = (struct msm_vidc_cb_info) {
		.response_type =  HAL_SESSION_FLUSH_DONE,
		.response.cmd = cmd_done,
	};
	info->response_type = HAL_SESSION_FLUSH_DONE;
	info->response.cmd = cmd_done;

	return 0;
}
@@ -1323,10 +1303,8 @@ static int hfi_process_session_etb_done(u32 device_id,
		(u32)pkt->packet_buffer, -1, -1,
		pkt->filled_len, pkt->offset);

	*info = (struct msm_vidc_cb_info) {
		.response_type =  HAL_SESSION_ETB_DONE,
		.response.data = data_done,
	};
	info->response_type = HAL_SESSION_ETB_DONE;
	info->response.data = data_done;

	return 0;
}
@@ -1450,10 +1428,8 @@ static int hfi_process_session_ftb_done(
		data_done.output_done.filled_len1,
		data_done.output_done.offset1);

	*info = (struct msm_vidc_cb_info) {
		.response_type =  HAL_SESSION_FTB_DONE,
		.response.data = data_done,
	};
	info->response_type = HAL_SESSION_FTB_DONE;
	info->response.data = data_done;

	return 0;
}
@@ -1479,10 +1455,8 @@ static int hfi_process_session_start_done(u32 device_id,
	cmd_done.status = hfi_map_err_status(pkt->error_type);
	cmd_done.size = 0;

	*info = (struct msm_vidc_cb_info) {
		.response_type =  HAL_SESSION_START_DONE,
		.response.cmd = cmd_done,
	};
	info->response_type = HAL_SESSION_START_DONE;
	info->response.cmd = cmd_done;
	return 0;
}

@@ -1507,10 +1481,8 @@ static int hfi_process_session_stop_done(u32 device_id,
	cmd_done.status = hfi_map_err_status(pkt->error_type);
	cmd_done.size = 0;

	*info = (struct msm_vidc_cb_info) {
		.response_type =  HAL_SESSION_STOP_DONE,
		.response.cmd = cmd_done,
	};
	info->response_type = HAL_SESSION_STOP_DONE;
	info->response.cmd = cmd_done;

	return 0;
}
@@ -1536,10 +1508,8 @@ static int hfi_process_session_rel_res_done(u32 device_id,
	cmd_done.status = hfi_map_err_status(pkt->error_type);
	cmd_done.size = 0;

	*info = (struct msm_vidc_cb_info) {
		.response_type =  HAL_SESSION_RELEASE_RESOURCE_DONE,
		.response.cmd = cmd_done,
	};
	info->response_type = HAL_SESSION_RELEASE_RESOURCE_DONE;
	info->response.cmd = cmd_done;

	return 0;
}
@@ -1571,10 +1541,8 @@ static int hfi_process_session_rel_buf_done(u32 device_id,
		dprintk(VIDC_ERR, "invalid payload in rel_buff_done\n");
	}

	*info = (struct msm_vidc_cb_info) {
		.response_type =  HAL_SESSION_RELEASE_BUFFER_DONE,
		.response.cmd = cmd_done,
	};
	info->response_type = HAL_SESSION_RELEASE_BUFFER_DONE;
	info->response.cmd = cmd_done;

	return 0;
}
@@ -1598,10 +1566,8 @@ static int hfi_process_session_end_done(u32 device_id,
	cmd_done.status = hfi_map_err_status(pkt->error_type);
	cmd_done.size = 0;

	*info = (struct msm_vidc_cb_info) {
		.response_type =  HAL_SESSION_END_DONE,
		.response.cmd = cmd_done,
	};
	info->response_type = HAL_SESSION_END_DONE;
	info->response.cmd = cmd_done;

	return 0;
}
@@ -1626,10 +1592,8 @@ static int hfi_process_session_abort_done(u32 device_id,
	cmd_done.status = hfi_map_err_status(pkt->error_type);
	cmd_done.size = 0;

	*info = (struct msm_vidc_cb_info) {
		.response_type =  HAL_SESSION_ABORT_DONE,
		.response.cmd = cmd_done,
	};
	info->response_type = HAL_SESSION_ABORT_DONE;
	info->response.cmd = cmd_done;

	return 0;
}
+5 −2
Original line number Diff line number Diff line
@@ -1093,7 +1093,7 @@ static int msm_venc_toggle_hier_p(struct msm_vidc_inst *inst, int layers)
	if (inst->fmts[CAPTURE_PORT].fourcc != V4L2_PIX_FMT_VP8)
		return 0;

	num_enh_layers = layers ? : 0;
	num_enh_layers = layers ? layers : 0;
	dprintk(VIDC_DBG, "%s Hier-P in firmware\n",
			num_enh_layers ? "Enable" : "Disable");

@@ -1297,7 +1297,10 @@ int msm_venc_s_ctrl(struct msm_vidc_inst *inst, struct v4l2_ctrl *ctrl)
	case V4L2_CID_MPEG_VIDEO_BITRATE_MODE:
	{
		int final_mode = 0;
		struct v4l2_ctrl update_ctrl = {.id = 0};
		struct v4l2_ctrl update_ctrl;

		update_ctrl.id = 0;
		update_ctrl.val = 0;

		/* V4L2_CID_MPEG_VIDEO_BITRATE_MODE and _RATE_CONTROL
		 * manipulate the same thing.  If one control's state
+11 −20
Original line number Diff line number Diff line
@@ -23,20 +23,9 @@
#include "msm_vidc_debug.h"
#include "msm_vidc_clocks.h"

#define IS_ALREADY_IN_STATE(__p, __d) ({\
	int __rc = (__p >= __d);\
	__rc; \
})

#define SUM_ARRAY(__arr, __start, __end) ({\
		int __index;\
		typeof((__arr)[0]) __sum = 0;\
		for (__index = (__start); __index <= (__end); __index++) {\
			if (__index >= 0 && __index < ARRAY_SIZE(__arr))\
				__sum += __arr[__index];\
		} \
		__sum;\
})
#define IS_ALREADY_IN_STATE(__p, __d) (\
	(__p >= __d)\
)

#define V4L2_EVENT_SEQ_CHANGED_SUFFICIENT \
		V4L2_EVENT_MSM_VIDC_PORT_SETTINGS_CHANGED_SUFFICIENT
@@ -129,7 +118,7 @@ int msm_comm_g_ctrl_for_id(struct msm_vidc_inst *inst, int id)
	};

	rc = msm_comm_g_ctrl(inst, &ctrl);
	return rc ?: ctrl.value;
	return rc ? rc : ctrl.value;
}

static struct v4l2_ctrl **get_super_cluster(struct msm_vidc_inst *inst,
@@ -874,11 +863,13 @@ static void handle_sys_init_done(enum hal_command_response cmd, void *data)

	/* This should come from sys_init_done */
	core->resources.max_inst_count =
		sys_init_msg->max_sessions_supported ? :
		sys_init_msg->max_sessions_supported ?
		sys_init_msg->max_sessions_supported :
		MAX_SUPPORTED_INSTANCES;

	core->resources.max_secure_inst_count =
		core->resources.max_secure_inst_count ? :
		core->resources.max_secure_inst_count ?
		core->resources.max_secure_inst_count :
		core->resources.max_inst_count;

	if (core->id == MSM_VIDC_CORE_VENUS &&
@@ -3850,17 +3841,17 @@ int msm_comm_qbuf(struct msm_vidc_inst *inst, struct vb2_buffer *vb)
	 * Don't queue if:
	 * 1) Hardware isn't ready (that's simple)
	 */
	defer = defer ?: inst->state != MSM_VIDC_START_DONE;
	defer = defer ? defer : (inst->state != MSM_VIDC_START_DONE);

	/*
	 * 2) The client explicitly tells us not to because it wants this
	 * buffer to be batched with future frames.  The batch size (on both
	 * capabilities) is completely determined by the client.
	 */
	defer = defer ?: vbuf && vbuf->flags & V4L2_MSM_BUF_FLAG_DEFER;
	defer = defer ? defer : (vbuf && vbuf->flags & V4L2_MSM_BUF_FLAG_DEFER);

	/* 3) If we're in batch mode, we must have full batches of both types */
	defer = defer ?: batch_mode && (!output_count || !capture_count);
	defer = defer ? defer:(batch_mode && (!output_count || !capture_count));

	if (defer) {
		dprintk(VIDC_DBG, "Deferring queue of %pK\n", vb);
+9 −11
Original line number Diff line number Diff line
@@ -20,17 +20,15 @@
#include <media/msm_vidc.h>
#include "msm_vidc_resources.h"

#define CONTAINS(__a, __sz, __t) ({\
	int __rc = __t >= __a && \
			__t < __a + __sz; \
	__rc; \
})

#define OVERLAPS(__t, __tsz, __a, __asz) ({\
	int __rc = __t <= __a && \
			__t + __tsz >= __a + __asz; \
	__rc; \
})
#define CONTAINS(__a, __sz, __t) (\
	(__t >= __a) && \
	(__t < __a + __sz) \
)

#define OVERLAPS(__t, __tsz, __a, __asz) (\
	(__t <= __a) && \
	(__t + __tsz >= __a + __asz) \
)

#define HAL_BUFFERFLAG_EOS              0x00000001
#define HAL_BUFFERFLAG_STARTTIME        0x00000002