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

Commit 346e1e54 authored by Deepak Kushwah's avatar Deepak Kushwah Committed by Shivendra Kakrania
Browse files

msm: vidc: Add sanity check for resolutions



Venus HW supports only YUV420 encode\decode. Encode
session can't support odd dimensions in both height
and width but decoder can support same. Add a check
to prevent this setting to HW.

Change-Id: Idcddc493f7222ee18dbed7d39a0699c3124ded3f
Signed-off-by: default avatarDeepak Kushwah <dkushwah@codeaurora.org>
Signed-off-by: default avatarSalman Syed <ssalman@codeaurora.org>
parent ecf430ad
Loading
Loading
Loading
Loading
+18 −1
Original line number Diff line number Diff line
@@ -5177,7 +5177,7 @@ int msm_vidc_check_session_supported(struct msm_vidc_inst *inst)
	int rc = 0;
	struct hfi_device *hdev;
	struct msm_vidc_core *core;
	u32 output_height, output_width;
	u32 output_height, output_width, input_height, input_width;
	u32 rotation;

	if (!inst || !inst->core || !inst->core->device) {
@@ -5200,6 +5200,23 @@ int msm_vidc_check_session_supported(struct msm_vidc_inst *inst)
		return -ENOTSUPP;
	}

	output_height = inst->prop.height[CAPTURE_PORT];
	output_width = inst->prop.width[CAPTURE_PORT];
	input_height = inst->prop.height[OUTPUT_PORT];
	input_width = inst->prop.width[OUTPUT_PORT];

	if (inst->session_type == MSM_VIDC_ENCODER && (input_width % 2 != 0 ||
			input_height % 2 != 0 || output_width % 2 != 0 ||
			output_height % 2 != 0)) {
		dprintk(VIDC_ERR,
			"Height and Width should be even numbers for NV12\n");
		dprintk(VIDC_ERR,
			"Input WxH = (%u)x(%u), Output WxH = (%u)x(%u)\n",
			input_width, input_height,
			output_width, output_height);
		rc = -ENOTSUPP;
	}

	rotation =  msm_comm_g_ctrl_for_id(inst,
					V4L2_CID_ROTATE);