From: Frieder Ferlemann <frieder.ferlemann@web.de>
To: "dri-devel@lists.freedesktop.org" <dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH 1/3] r600: add span support for 2D tiling
Date: Fri, 28 May 2010 01:01:24 +0200 [thread overview]
Message-ID: <4BFEF9C4.2050608@web.de> (raw)
In-Reply-To: <AANLkTikcjp3YRvLFwjUHx0JOT87WCx1bUJAEalLjV1BN@mail.gmail.com>
Hi,
Am 28.05.2010 00:04, schrieb Conn Clark:
> On Thu, May 27, 2010 at 8:51 AM, Brian Paul <brianp@vmware.com> wrote:
>
> This code could be written with a faster algorithm requiring just 13 operations
>
> + pixel_number |= ((x >> 0) & 1) << 0; // pn[0] = x[0]
> + pixel_number |= ((y >> 0) & 1) << 1; // pn[1] = y[0]
> + pixel_number |= ((x >> 1) & 1) << 2; // pn[2] = x[1]
> + pixel_number |= ((y >> 1) & 1) << 3; // pn[3] = y[1]
> + pixel_number |= ((x >> 2) & 1) << 4; // pn[4] = x[2]
> + pixel_number |= ((y >> 2) & 1) << 5; // pn[5] = y[2]
>
> /* suitable for all 16 bit or greater processors that can do an
> unsigned 16 bit or greater multiply */
> /* tested and verified */
>
> pixel_number = ((((x & 0x07) * 0x1111 & 0x8421) * 0x1249 >> 9) & 0x55 ) |
> ((((y & 0x07) * 0x1111 & 0x8421) * 0x1249
>>> 8) & 0xAA );
>
> Note if it is known that x and y are less than or equal to 7 it can be
> done in 11 operations.
Cool. How does it compare to:
const unsigned char /*int*/ spread_bits[8] = {
0x00, /* 0b000 to 0b00000 */
0x01, /* 0b001 to 0b00001 */
0x04, /* 0b010 to 0b00100 */
0x05, /* 0b011 to 0b00101 */
0x10, /* 0b100 to 0b10000 */
0x11, /* 0b101 to 0b10001 */
0x14, /* 0b110 to 0b10100 */
0x15, /* 0b111 to 0b10101 */
};
pixel_number |= spread_bits[x & 0x07];
pixel_number |= spread_bits[y & 0x07] << 1;
Greetings,
Frieder
next prev parent reply other threads:[~2010-05-27 23:01 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-25 23:12 [PATCH 0/3] Add r6xx/r7xx tiling support to mesa Alex Deucher
2010-05-25 23:12 ` [PATCH 1/3] r600: add span support for 2D tiling Alex Deucher
2010-05-25 23:12 ` [PATCH 2/3] r600: add new relocs for tiling support Alex Deucher
2010-05-25 23:12 ` [PATCH 3/3] r600: add support for getting the tiling config via drm ioctl Alex Deucher
2010-05-27 14:55 ` [PATCH 1/3] r600: add span support for 2D tiling Matt Turner
2010-05-27 15:20 ` Alex Deucher
2010-05-27 15:37 ` Alan Cox
2010-05-27 15:51 ` Brian Paul
2010-05-27 22:04 ` Conn Clark
2010-05-27 22:36 ` Alan Cox
2010-05-27 23:01 ` Frieder Ferlemann [this message]
2010-05-27 23:34 ` Conn Clark
2010-05-27 23:52 ` Alan Cox
2010-05-27 23:47 ` Alex Deucher
2010-05-28 0:10 ` Matt Turner
-- strict thread matches above, loose matches on Subject: below --
2010-05-27 7:54 Frieder Ferlemann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4BFEF9C4.2050608@web.de \
--to=frieder.ferlemann@web.de \
--cc=dri-devel@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.