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

Commit 84bfeac2 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: Scale venus ddr and vmem bus bandwidth for TURBO mode"

parents 62b59169 57c036b4
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
#include "fixedpoint.h"
#include "msm_vidc_internal.h"
#include "msm_vidc_debug.h"
#include "vidc_hfi_api.h"

static bool debug;
module_param(debug, bool, 0644);
@@ -621,7 +622,11 @@ static unsigned long __calculate_encoder(struct vidc_bus_vote_data *d,
	original_compression_enabled = __ubwc(original_color_format);

	two_stage_encoding = false;
	low_power = d->low_power_mode;
	if (d->power_mode == VIDC_POWER_LOW)
		low_power = true;
	else
		low_power = false;

	b_frames_enabled = false;

	dpb_compression_factor = !dpb_compression_enabled ? FP_ONE :
@@ -970,10 +975,18 @@ static int __get_target_freq(struct devfreq *dev, unsigned long *freq,
	dev->profile->get_dev_status(dev->dev.parent, &stats);
	vidc_data = (struct msm_vidc_gov_data *)stats.private_data;

	for (c = 0; c < vidc_data->data_count; ++c) {
		if (vidc_data->data->power_mode == VIDC_POWER_TURBO) {
			*freq = INT_MAX;
			goto exit;
		}
	}

	for (c = 0; c < vidc_data->data_count; ++c)
		ab_kbps += __calculate(&vidc_data->data[c], gov->mode);

	*freq = ab_kbps;
exit:
	return 0;
}

+24 −0
Original line number Diff line number Diff line
@@ -1902,6 +1902,13 @@ static int try_set_ctrl(struct msm_vidc_inst *inst, struct v4l2_ctrl *ctrl)
		__temp; \
	})

	/*
	* Unlock the control prior to setting to the hardware. Otherwise
	* lower level code that attempts to do a get_ctrl() will end up
	* deadlocking.
	*/
	v4l2_ctrl_unlock(ctrl);

	switch (ctrl->id) {
	case V4L2_CID_MPEG_VIDC_VIDEO_IDR_PERIOD:
		if (inst->fmts[CAPTURE_PORT]->fourcc != V4L2_PIX_FMT_H264 &&
@@ -2702,6 +2709,21 @@ static int try_set_ctrl(struct msm_vidc_inst *inst, struct v4l2_ctrl *ctrl)
		property_id = HAL_CONFIG_VENC_PERF_MODE;
		venc_mode = ctrl->val;
		pdata = &venc_mode;
		switch (ctrl->val) {
		case V4L2_MPEG_VIDC_VIDEO_PERF_POWER_SAVE:
			inst->flags |= VIDC_LOW_POWER;
			break;
		case V4L2_MPEG_VIDC_VIDEO_PERF_MAX_QUALITY:
			inst->flags &= ~VIDC_LOW_POWER;
			break;
		default:
			dprintk(VIDC_ERR, "Power save mode %x not supported\n",
					ctrl->val);
			rc = -ENOTSUPP;
			property_id = 0;
			break;
		}

		msm_dcvs_enc_set_power_save_mode(inst,
			ctrl->val == V4L2_MPEG_VIDC_VIDEO_PERF_POWER_SAVE);
		break;
@@ -2732,6 +2754,8 @@ static int try_set_ctrl(struct msm_vidc_inst *inst, struct v4l2_ctrl *ctrl)
		rc = -ENOTSUPP;
		break;
	}

	v4l2_ctrl_lock(ctrl);
#undef TRY_GET_CTRL

	if (!rc && property_id) {
+12 −7
Original line number Diff line number Diff line
@@ -69,6 +69,11 @@ static inline bool is_thumbnail_session(struct msm_vidc_inst *inst)
	return !!(inst->flags & VIDC_THUMBNAIL);
}

static inline bool is_low_power_session(struct msm_vidc_inst *inst)
{
	return !!(inst->flags & VIDC_LOW_POWER);
}

int msm_comm_g_ctrl(struct msm_vidc_inst *inst, int id)
{
	int rc = 0;
@@ -285,7 +290,6 @@ static int msm_comm_vote_bus(struct msm_vidc_core *core)

	list_for_each_entry(inst, &core->instances, list) {
		int codec = 0, yuv = 0;
		bool low_power = false;

		codec = inst->session_type == MSM_VIDC_DECODER ?
			inst->fmts[OUTPUT_PORT]->fourcc :
@@ -295,16 +299,17 @@ static int msm_comm_vote_bus(struct msm_vidc_core *core)
			inst->fmts[CAPTURE_PORT]->fourcc :
			inst->fmts[OUTPUT_PORT]->fourcc;

		low_power = msm_comm_g_ctrl(inst,
				V4L2_CID_MPEG_VIDC_VIDEO_PERF_MODE) ==
			V4L2_MPEG_VIDC_VIDEO_PERF_POWER_SAVE;

		vote_data[i].domain = get_hal_domain(inst->session_type);
		vote_data[i].codec = get_hal_codec(codec);
		vote_data[i].width = inst->prop.width[CAPTURE_PORT];
		vote_data[i].height = inst->prop.height[CAPTURE_PORT];
		vote_data[i].fps = inst->prop.fps;
		vote_data[i].low_power_mode = low_power;
		if (is_turbo_session(inst))
			vote_data[i].power_mode = VIDC_POWER_TURBO;
		else if (is_low_power_session(inst))
			vote_data[i].power_mode = VIDC_POWER_LOW;
		else
			vote_data[i].power_mode = VIDC_POWER_NORMAL;

		/*
		 * TODO: support for OBP-DBP split mode hasn't been yet
+4 −3
Original line number Diff line number Diff line
@@ -222,9 +222,10 @@ struct msm_vidc_debug {
};

enum msm_vidc_modes {
	VIDC_SECURE = 1 << 0,
	VIDC_TURBO = 1 << 1,
	VIDC_THUMBNAIL = 1 << 2,
	VIDC_SECURE = BIT(0),
	VIDC_TURBO = BIT(1),
	VIDC_THUMBNAIL = BIT(2),
	VIDC_LOW_POWER = BIT(3),
};

struct msm_vidc_core_capability {
+7 −1
Original line number Diff line number Diff line
@@ -1355,13 +1355,19 @@ struct msm_vidc_gov_data {
	int imem_size;
};

enum msm_vidc_power_mode {
	VIDC_POWER_NORMAL = 0,
	VIDC_POWER_LOW,
	VIDC_POWER_TURBO
};

struct vidc_bus_vote_data {
	enum hal_domain domain;
	enum hal_video_codec codec;
	enum hal_uncompressed_format color_formats[2];
	int num_formats; /* 1 = DPB-OPB unified; 2 = split */
	int height, width, fps;
	bool low_power_mode;
	enum msm_vidc_power_mode power_mode;
};