Re: [Mesa-dev] [PATCH] intel: Avoid divide by zero for very small linear blits

2012-02-03 Thread Eric Anholt
On Thu, 2 Feb 2012 16:50:32 -0700, "Ian Romanick" wrote: > From: Ian Romanick > > If size is small (such as 1), > >pitch = ROUND_DOWN_TO(MIN2(size, (1 << 15) - 1), 4); > > makes pitch = 0. Then > >height = size / pitch; > > causes a division-by-zero exception. If pitch is zero, se

[Mesa-dev] [PATCH] intel: Avoid divide by zero for very small linear blits

2012-02-02 Thread Ian Romanick
From: Ian Romanick If size is small (such as 1), pitch = ROUND_DOWN_TO(MIN2(size, (1 << 15) - 1), 4); makes pitch = 0. Then height = size / pitch; causes a division-by-zero exception. If pitch is zero, set height to 1 and avoid the division. This fixes piglit's bin/getteximage-format