[Mesa-dev] [Mesa-stable] [PATCH] mesa: fix arithmetic error in _mesa_compute_compressed_pixelstore()

Francisco Jerez currojerez at riseup.net
Mon Dec 1 18:33:26 PST 2014


Eric Anholt <eric at anholt.net> writes:

> Matt Turner <mattst88 at gmail.com> writes:
>
>> On Mon, Dec 1, 2014 at 12:47 PM, Brian Paul <brianp at vmware.com> wrote:
>>> We need parenthesis around the expression which computes the number of
>>> blocks per row.
>>>
>>> Cc: "10.3 10.4" <mesa-stable at lists.freedesktop.org>
>>> ---
>>>  src/mesa/main/texstore.c | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c
>>> index f858cef..50aa1fd 100644
>>> --- a/src/mesa/main/texstore.c
>>> +++ b/src/mesa/main/texstore.c
>>> @@ -2231,7 +2231,7 @@ _mesa_compute_compressed_pixelstore(GLuint dims, mesa_format texFormat,
>>>
>>>        if (packing->RowLength) {
>>>           store->TotalBytesPerRow = packing->CompressedBlockSize *
>>> -            (packing->RowLength + bw - 1) / bw;
>>> +            ((packing->RowLength + bw - 1) / bw);
>>>        }
>>
>> Could we copy
>>
>> #define ALIGN_DIVUP(x, y) (((x) + (y) - 1) / (y))
>>
>> our of r600_pipe.h into src/util/macros.h and use that? Maybe that'd
>> be better as a coccinelle patch over the whole tree.
>
> The kernel calls this DIV_ROUND_UP, which I think reads better than
> ALIGN_DIVUP.  And I've wanted that macro a bunch of times.

We have one already in main/macros.h that does pretty much the same
thing, called CEILING().

> _______________________________________________
> mesa-stable mailing list
> mesa-stable at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-stable
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 212 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20141202/2804388e/attachment.sig>


More information about the mesa-dev mailing list