lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sun, 20 Mar 2011 09:22:15 +0000
From:	Russell King - ARM Linux <linux@....linux.org.uk>
To:	Carl Vanderlip <carlv@...eaurora.org>
Cc:	David Brown <davidb@...eaurora.org>,
	Daniel Walker <dwalker@...o99.com>,
	Bryan Huntsman <bryanh@...eaurora.org>,
	Brian Swetland <swetland@...gle.com>,
	Dima Zavin <dima@...roid.com>,
	Rebecca Schultz Zavin <rebecca@...roid.com>,
	Colin Cross <ccross@...roid.com>, linux-fbdev@...r.kernel.org,
	linux-arm-kernel@...ts.infradead.org,
	linux-arm-msm@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 09/20] video: msm: Split out MDP2.2 HW specific code.

On Fri, Mar 18, 2011 at 02:57:03PM -0700, Carl Vanderlip wrote:
> +int mdp_ppp_cfg_edge_cond(struct mdp_blit_req *req, struct ppp_regs *regs)
> +{
> +	int32_t luma_interp[4];
> +	int32_t luma_repeat[4];
> +	int32_t chroma_interp[4];
> +	int32_t chroma_bound[4];
> +	int32_t chroma_repeat[4];
> +	uint32_t dst_w, dst_h;
> +
> +	memset(&luma_interp, 0, sizeof(int32_t) * 4);
> +	memset(&luma_repeat, 0, sizeof(int32_t) * 4);
> +	memset(&chroma_interp, 0, sizeof(int32_t) * 4);
> +	memset(&chroma_bound, 0, sizeof(int32_t) * 4);
> +	memset(&chroma_repeat, 0, sizeof(int32_t) * 4);
> +	regs->edge = 0;
> +
> +	if (req->flags & MDP_ROT_90) {
> +		dst_w = req->dst_rect.h;
> +		dst_h = req->dst_rect.w;
> +	} else {
> +		dst_w = req->dst_rect.w;
> +		dst_h = req->dst_rect.h;
> +	}
> +
> +	if (regs->op & (PPP_OP_SCALE_Y_ON | PPP_OP_SCALE_X_ON)) {
> +		get_edge_info(req->src_rect.h, req->src_rect.y, dst_h,
> +			      &luma_interp[IMG_TOP], &luma_interp[IMG_BOTTOM],
> +			      &luma_repeat[IMG_TOP], &luma_repeat[IMG_BOTTOM]);
> +		get_edge_info(req->src_rect.w, req->src_rect.x, dst_w,
> +			      &luma_interp[IMG_LEFT], &luma_interp[IMG_RIGHT],
> +			      &luma_repeat[IMG_LEFT], &luma_repeat[IMG_RIGHT]);
> +	} else {
> +		luma_interp[IMG_LEFT] = req->src_rect.x;
> +		luma_interp[IMG_RIGHT] = req->src_rect.x + req->src_rect.w - 1;
> +		luma_interp[IMG_TOP] = req->src_rect.y;
> +		luma_interp[IMG_BOTTOM] = req->src_rect.y + req->src_rect.h - 1;
> +		luma_repeat[IMG_LEFT] = 0;
> +		luma_repeat[IMG_TOP] = 0;
> +		luma_repeat[IMG_RIGHT] = 0;
> +		luma_repeat[IMG_BOTTOM] = 0;
> +	}
> +
> +	chroma_interp[IMG_LEFT] = luma_interp[IMG_LEFT];
> +	chroma_interp[IMG_RIGHT] = luma_interp[IMG_RIGHT];
> +	chroma_interp[IMG_TOP] = luma_interp[IMG_TOP];
> +	chroma_interp[IMG_BOTTOM] = luma_interp[IMG_BOTTOM];
> +
> +	chroma_bound[IMG_LEFT] = req->src_rect.x;
> +	chroma_bound[IMG_RIGHT] = req->src_rect.x + req->src_rect.w - 1;
> +	chroma_bound[IMG_TOP] = req->src_rect.y;
> +	chroma_bound[IMG_BOTTOM] = req->src_rect.y + req->src_rect.h - 1;
> +
> +	if (IS_YCRCB(req->src.format)) {
> +		chroma_interp[IMG_LEFT] = chroma_interp[IMG_LEFT] >> 1;
> +		chroma_interp[IMG_RIGHT] = (chroma_interp[IMG_RIGHT] + 1) >> 1;
> +
> +		chroma_bound[IMG_LEFT] = chroma_bound[IMG_LEFT] >> 1;
> +		chroma_bound[IMG_RIGHT] = chroma_bound[IMG_RIGHT] >> 1;
> +	}
> +
> +	if (req->src.format == MDP_Y_CBCR_H2V2 ||
> +	    req->src.format == MDP_Y_CRCB_H2V2) {
> +		chroma_interp[IMG_TOP] = (chroma_interp[IMG_TOP] - 1) >> 1;
> +		chroma_interp[IMG_BOTTOM] = (chroma_interp[IMG_BOTTOM] + 1)
> +					    >> 1;
> +		chroma_bound[IMG_TOP] = (chroma_bound[IMG_TOP] + 1) >> 1;
> +		chroma_bound[IMG_BOTTOM] = chroma_bound[IMG_BOTTOM] >> 1;
> +	}
> +
> +	chroma_repeat[IMG_LEFT] = chroma_bound[IMG_LEFT] -
> +				  chroma_interp[IMG_LEFT];
> +	chroma_repeat[IMG_RIGHT] = chroma_interp[IMG_RIGHT] -
> +				  chroma_bound[IMG_RIGHT];
> +	chroma_repeat[IMG_TOP] = chroma_bound[IMG_TOP] -
> +				  chroma_interp[IMG_TOP];
> +	chroma_repeat[IMG_BOTTOM] = chroma_interp[IMG_BOTTOM] -
> +				  chroma_bound[IMG_BOTTOM];
> +
> +	if (chroma_repeat[IMG_LEFT] < 0 || chroma_repeat[IMG_LEFT] > 3 ||
> +	    chroma_repeat[IMG_RIGHT] < 0 || chroma_repeat[IMG_RIGHT] > 3 ||
> +	    chroma_repeat[IMG_TOP] < 0 || chroma_repeat[IMG_TOP] > 3 ||
> +	    chroma_repeat[IMG_BOTTOM] < 0 || chroma_repeat[IMG_BOTTOM] > 3 ||
> +	    luma_repeat[IMG_LEFT] < 0 || luma_repeat[IMG_LEFT] > 3 ||
> +	    luma_repeat[IMG_RIGHT] < 0 || luma_repeat[IMG_RIGHT] > 3 ||
> +	    luma_repeat[IMG_TOP] < 0 || luma_repeat[IMG_TOP] > 3 ||
> +	    luma_repeat[IMG_BOTTOM] < 0 || luma_repeat[IMG_BOTTOM] > 3)
> +		return -1;

Lazy programming strikes again.  Public functions really should not
return things that look like errno codes, rather they should return
real errno codes.

Secondly, why is this stuff, which looks very driver like, under arch/arm
and not in drivers/ somewhere?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ