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

Commit ef7da227 authored by Maheshwar Ajja's avatar Maheshwar Ajja
Browse files

msm: vidc: Amend video scaling support check condition



Currently video driver returns error to the client if video
hardware does not support video scaling, but video driver is
not expected to return error when client has not requested for
video scaling. Amend the check condition to return error only
when client requested for video scaling and video hardware
does not support scaling.

Change-Id: I37d574f6e9886e34846d0347a672f1eafec40930
Signed-off-by: default avatarMaheshwar Ajja <majja@codeaurora.org>
parent c0439e6a
Loading
Loading
Loading
Loading
+24 −12
Original line number Diff line number Diff line
@@ -4047,18 +4047,6 @@ int msm_vidc_check_scaling_supported(struct msm_vidc_inst *inst)
	u32 x_min, x_max, y_min, y_max;
	u32 input_height, input_width, output_height, output_width;

	if (!inst->capability.scale_x.min || !inst->capability.scale_x.max ||
		!inst->capability.scale_y.min ||
		!inst->capability.scale_y.max) {
		dprintk(VIDC_ERR, "%s : Invalid scaling ratios\n",
				__func__);
		return -ENOTSUPP;
	}
	x_min = (1<<16)/inst->capability.scale_x.min;
	y_min = (1<<16)/inst->capability.scale_y.min;
	x_max = inst->capability.scale_x.max >> 16;
	y_max = inst->capability.scale_y.max >> 16;

	input_height = inst->prop.height[OUTPUT_PORT];
	input_width = inst->prop.width[OUTPUT_PORT];
	output_height = inst->prop.height[CAPTURE_PORT];
@@ -4073,6 +4061,30 @@ int msm_vidc_check_scaling_supported(struct msm_vidc_inst *inst)
		return -ENOTSUPP;
	}

	if (!inst->capability.scale_x.min ||
		!inst->capability.scale_x.max ||
		!inst->capability.scale_y.min ||
		!inst->capability.scale_y.max) {

		if ((input_width * input_height) !=
			(output_width * output_height)) {
			dprintk(VIDC_ERR,
				"%s: scaling is not supported (%dx%d != %dx%d)\n",
				__func__, input_width, input_height,
				output_width, output_height);
			return -ENOTSUPP;
		} else {
			dprintk(VIDC_DBG, "%s: supported WxH = %dx%d\n",
				__func__, input_width, input_height);
			return 0;
		}
	}

	x_min = (1<<16)/inst->capability.scale_x.min;
	y_min = (1<<16)/inst->capability.scale_y.min;
	x_max = inst->capability.scale_x.max >> 16;
	y_max = inst->capability.scale_y.max >> 16;

	if (input_height > output_height) {
		if (input_height/output_height > x_min) {
			dprintk(VIDC_ERR,