Discussion:
BitBlt for big Endian
Nitin Mahajan
2003-09-10 03:44:35 UTC
Permalink
HI!

I have written the following BIt BLT function for the Little endian byte
sex.
But same is not working for theBig endian after doing some changes.Iam
using C&T 69030 card.

Can any one please tell how to convert it so that the same function
works for both little and big endian.
The commented statements were for Little endian.


regards,

Nitin Mahajan
mail:***@soc-soft.com
Ph:51101667. Mobile : 9886099925
======================================
The Lord gave us two ends -- one to sit on and the other to think with.
Success depends on which one we use the most.
Tim Roberts
2003-09-10 16:29:53 UTC
Permalink
HI!
I have written the following BIt BLT function for the Little endian byte sex.
But same is not working for theBig endian after doing some changes.Iam using
C&T 69030 card.
Can any one please tell how to convert it so that the same function works for
both little and big endian.
The commented statements were for Little endian.
The commented statements have exactly the same effect as the statements they
replace. All you've done is replace shifts with multiplications and divisions.
Endianness does not matter in arithmetic.

The tricky part will be in moveDWORDS. If the image in memory has a different
endianness from the frame buffer, you will have to swap every DWORD as you
write it. You can't just do this:
*puiDest = *puiSrc;
You have to swap the bytes, something like this:
tmp = *puiSrc;
*puiDest = (tmp & 0xff) << 24 |
((tmp & 0xff00) << 8) |
((tmp & 0xff0000) >> 8) |
((tmp & 0xff000000) >> 24);

Some graphcs chips have both a little-endian and big-endian view of their frame
buffers. You might check the C&T 69030 docs to see if it does.

--
- Tim Roberts, ***@probo.com
Providenza & Boekelheide, Inc.
Gazelle Jean-Laurent
2003-09-19 16:32:08 UTC
Permalink
Hi,

I'm trying to build/run Xfree for a 69030 card on a PowerPC platform.
Looks like you're trying to do the same thing.

Are all these values set to MSBFirst for you also ?
X_BYTE_ORDER
BITMAP_BIT_ORDER
IMAGE_BYTE_ORDER

I do still have the following byteswapping issues (is it your case also ?):
16bpp => Red & Blue inversion.
24bpp => R->B G->R B->G

regards,
Jean-Laurent

On Wed, 10 Sep 2003 09:14:35 +0530
"Nitin Mahajan" <***@soc-soft.com> wrote:

R> HI!
R>
R> I have written the following BIt BLT function for the Little endian byte
R> sex.
R> But same is not working for theBig endian after doing some changes.Iam
R> using C&T 69030 card.
R>
R> Can any one please tell how to convert it so that the same function
R> works for both little and big endian.
R> The commented statements were for Little endian.
R>
R>
R> regards,
R>
R> Nitin Mahajan
R> mail:***@soc-soft.com
R> Ph:51101667. Mobile : 9886099925
R> ======================================
R> The Lord gave us two ends -- one to sit on and the other to think with.
R> Success depends on which one we use the most.
R>
R>
--
------------------------------------------------------------
Jean-Laurent GAZELLE 150, rue M. Berthelot
Phone: +33 (0)4 98 16 34 66 Z.I. Toulon Est BP244
Fax : +33 (0)4 98 16 34 01 83078 TOULON Cedex9
e-mail : ***@thalescomputers.fr
Thales Computers FRANCE
_____________ http://www.thalescomputers.com _______________
Loading...