summaryrefslogtreecommitdiff
path: root/sys/dev/pci
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>2003-01-05 02:05:59 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>2003-01-05 02:05:59 +0000
commit7866fe8450fd247b9204b1a928cde7f744bb8861 (patch)
tree88ee0394d7780dfcce670bf6ce9279ae9768ce99 /sys/dev/pci
parent35eb04d8442f225f79f63b881426d9c3a1b68245 (diff)
proper endianess handling in 16 and 32 bit video modes, 24 bit is not supported by the card
Diffstat (limited to 'sys/dev/pci')
-rw-r--r--sys/dev/pci/bktr/bktr_core.c29
1 files changed, 19 insertions, 10 deletions
diff --git a/sys/dev/pci/bktr/bktr_core.c b/sys/dev/pci/bktr/bktr_core.c
index cbe8e87cb27..f9daede0692 100644
--- a/sys/dev/pci/bktr/bktr_core.c
+++ b/sys/dev/pci/bktr/bktr_core.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bktr_core.c,v 1.6 2003/01/05 01:24:53 mickey Exp $ */
+/* $OpenBSD: bktr_core.c,v 1.7 2003/01/05 02:05:58 mickey Exp $ */
/* $FreeBSD: src/sys/dev/bktr/bktr_core.c,v 1.114 2000/10/31 13:09:56 roger Exp $ */
/*
@@ -3799,19 +3799,28 @@ static u_int pixfmt_swap_flags( int pixfmt )
{
const struct meteor_pixfmt *pf = &pixfmt_table[ pixfmt ].public;
u_int swapf = 0;
+ int swap_bytes, swap_shorts;
+
+#if BYTE_ORDER == LITTLE_ENDIAN
+ swap_bytes = pf->swap_bytes;
+ swap_shorts = pf->swap_shorts;
+#else
+ swap_bytes = !pf->swap_bytes;
+ swap_shorts = !pf->swap_shorts;
+#endif
switch ( pf->Bpp ) {
- case 2 : swapf = ( pf->swap_bytes ? 0 : BSWAP );
- break;
+ case 2:
+ swapf = swap_bytes ? 0 : BSWAP;
+ break;
- case 3 : /* no swaps supported for 3bpp - makes no sense w/ bt848 */
- break;
+ case 3: /* no swaps supported for 3bpp - makes no sense w/ bt848 */
+ break;
- case 4 : if ( pf->swap_bytes )
- swapf = pf->swap_shorts ? 0 : WSWAP;
- else
- swapf = pf->swap_shorts ? BSWAP : (BSWAP | WSWAP);
- break;
+ case 4:
+ swapf = swap_bytes ? 0 : BSWAP;
+ swapf |= swap_shorts ? 0 : WSWAP;
+ break;
}
return swapf;
}