|
From: Jindrich M. <mak...@km...> - 2001-11-01 11:45:39
|
Hi all,
I changed the register setup in riva_tbl.h to MSB bit order so the ugly order-reversing
routine in accel.c is not needed anymore.
In fbdev.c, I changed the cursor handling stuff to use only a 50Hz timer, instead of 100Hz.
Best regards,
--
Jindrich Makovicka
8<--snip
diff -urN ../vanilla/linux/drivers/video/riva/accel.c linux/drivers/video/riva/accel.c
--- ../vanilla/linux/drivers/video/riva/accel.c Mon Oct 15 22:47:13 2001
+++ linux/drivers/video/riva/accel.c Tue Oct 30 22:20:13 2001
@@ -86,34 +86,6 @@
bottom_width, right_start, bgx);
}
-static u8 byte_rev[256] = {
- 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0,
- 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8, 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8,
- 0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4, 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4,
- 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec, 0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc,
- 0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2, 0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2,
- 0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea, 0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa,
- 0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6, 0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6,
- 0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee, 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe,
- 0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1, 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1,
- 0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9, 0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9,
- 0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5, 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5,
- 0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed, 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd,
- 0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3, 0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3,
- 0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb, 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb,
- 0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7, 0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7,
- 0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef, 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff,
-};
-
-static inline void fbcon_reverse_order(u32 *l)
-{
- u8 *a = (u8 *)l;
- *a++ = byte_rev[*a];
-/* *a++ = byte_rev[*a];
- *a++ = byte_rev[*a];*/
- *a = byte_rev[*a];
-}
-
static void fbcon_riva_writechr(struct vc_data *conp, struct display *p,
int c, int fgx, int bgx, int yy, int xx)
{
@@ -153,7 +125,6 @@
cdat2 = *cdat++;
else
cdat2 = *((u16*)cdat)++;
- fbcon_reverse_order(&cdat2);
d[j] = cdat2;
}
}
diff -urN ../vanilla/linux/drivers/video/riva/fbdev.c linux/drivers/video/riva/fbdev.c
--- ../vanilla/linux/drivers/video/riva/fbdev.c Sun Oct 21 19:14:38 2001
+++ linux/drivers/video/riva/fbdev.c Thu Nov 1 08:39:01 2001
@@ -91,8 +91,8 @@
#define Set8Bits(value) ((value)&0xff)
/* HW cursor parameters */
-#define DEFAULT_CURSOR_BLINK_RATE (40)
-#define CURSOR_HIDE_DELAY (20)
+#define DEFAULT_CURSOR_BLINK_RATE (20)
+#define CURSOR_HIDE_DELAY (10)
#define CURSOR_SHOW_DELAY (3)
#define CURSOR_COLOR 0x7fff
@@ -230,7 +230,7 @@
int enable;
int on;
int vbl_cnt;
- int last_move_delay;
+ int last_slice_moves, prev_slice_moves;
int blink_rate;
struct {
u16 x, y;
@@ -407,26 +407,28 @@
static void riva_cursor_timer_handler(unsigned long dev_addr)
{
struct rivafb_info *rinfo = (struct rivafb_info *)dev_addr;
+ struct riva_cursor *c;
if (!rinfo->cursor) return;
+ c = rinfo->cursor;
- if (!rinfo->cursor->enable) goto out;
+ if (!c->enable) goto out;
- if (rinfo->cursor->last_move_delay < 1000)
- rinfo->cursor->last_move_delay++;
+ c->prev_slice_moves = c->last_slice_moves;
+ c->last_slice_moves = 0;
- if (rinfo->cursor->vbl_cnt && --rinfo->cursor->vbl_cnt == 0) {
- rinfo->cursor->on ^= 1;
- if (rinfo->cursor->on)
- *(rinfo->riva.CURSORPOS) = (rinfo->cursor->pos.x & 0xFFFF)
- | (rinfo->cursor->pos.y << 16);
- rinfo->riva.ShowHideCursor(&rinfo->riva, rinfo->cursor->on);
+ if (c->vbl_cnt && --c->vbl_cnt == 0) {
+ c->on ^= 1;
+ if (c->on)
+ *(rinfo->riva.CURSORPOS) = (c->pos.x & 0xFFFF)
+ | (c->pos.y << 16);
+ rinfo->riva.ShowHideCursor(&rinfo->riva, c->on);
if (!noblink)
- rinfo->cursor->vbl_cnt = rinfo->cursor->blink_rate;
+ c->vbl_cnt = c->blink_rate;
}
out:
- rinfo->cursor->timer->expires = jiffies + (HZ / 100);
- add_timer(rinfo->cursor->timer);
+ c->timer->expires = jiffies + (HZ / 50);
+ add_timer(c->timer);
}
/**
@@ -460,7 +462,7 @@
cursor->blink_rate = DEFAULT_CURSOR_BLINK_RATE;
init_timer(cursor->timer);
- cursor->timer->expires = jiffies + (HZ / 100);
+ cursor->timer->expires = jiffies + (HZ / 50);
cursor->timer->data = (unsigned long)rinfo;
cursor->timer->function = riva_cursor_timer_handler;
add_timer(cursor->timer);
@@ -616,7 +618,7 @@
break;
case CM_DRAW:
case CM_MOVE:
- if (c->last_move_delay <= 1) { /* rapid cursor movement */
+ if (c->last_slice_moves > 2 || c->prev_slice_moves > 2) { /* rapid cursor movement */
c->vbl_cnt = CURSOR_SHOW_DELAY;
} else {
*(rinfo->riva.CURSORPOS) = (x & 0xFFFF) | (y << 16);
@@ -624,7 +626,7 @@
if (!noblink) c->vbl_cnt = CURSOR_HIDE_DELAY;
c->on = 1;
}
- c->last_move_delay = 0;
+ c->last_slice_moves++;
c->enable = 1;
break;
}
diff -urN ../vanilla/linux/drivers/video/riva/riva_tbl.h linux/drivers/video/riva/riva_tbl.h
--- ../vanilla/linux/drivers/video/riva/riva_tbl.h Tue Feb 13 22:15:05 2001
+++ linux/drivers/video/riva/riva_tbl.h Wed Oct 31 13:13:38 2001
@@ -48,6 +48,9 @@
/*
* RIVA Fixed Functionality Init Tables.
*/
+
+/* Bit order changed to MSB. -- JM */
+
static unsigned RivaTablePMC[][2] =
{
{0x00000050, 0x00000000},
@@ -216,37 +219,37 @@
{
/* 0xXXXXX3XX For MSB mono format */
/* 0xXXXXX2XX For LSB mono format */
- {0x00000D04, 0x10110203},
- {0x00000D08, 0x10110203},
- {0x00000D0C, 0x1011020B},
- {0x00000D10, 0x10118203},
- {0x00000D14, 0x10110203},
- {0x00000D18, 0x10110203},
- {0x00000D1C, 0x10419208}
+ {0x00000D04, 0x10110303},
+ {0x00000D08, 0x10110303},
+ {0x00000D0C, 0x1011030B},
+ {0x00000D10, 0x10118303},
+ {0x00000D14, 0x10110303},
+ {0x00000D18, 0x10110303},
+ {0x00000D1C, 0x10419308}
};
static unsigned nv3TablePRAMIN_15BPP[][2] =
{
/* 0xXXXXX2XX For MSB mono format */
/* 0xXXXXX3XX For LSB mono format */
- {0x00000D04, 0x10110200},
- {0x00000D08, 0x10110200},
- {0x00000D0C, 0x10110208},
- {0x00000D10, 0x10118200},
- {0x00000D14, 0x10110200},
- {0x00000D18, 0x10110200},
- {0x00000D1C, 0x10419208}
+ {0x00000D04, 0x10110300},
+ {0x00000D08, 0x10110300},
+ {0x00000D0C, 0x10110308},
+ {0x00000D10, 0x10118300},
+ {0x00000D14, 0x10110300},
+ {0x00000D18, 0x10110300},
+ {0x00000D1C, 0x10419308}
};
static unsigned nv3TablePRAMIN_32BPP[][2] =
{
/* 0xXXXXX3XX For MSB mono format */
/* 0xXXXXX2XX For LSB mono format */
- {0x00000D04, 0x10110201},
- {0x00000D08, 0x10110201},
- {0x00000D0C, 0x10110209},
- {0x00000D10, 0x10118201},
- {0x00000D14, 0x10110201},
- {0x00000D18, 0x10110201},
- {0x00000D1C, 0x10419208}
+ {0x00000D04, 0x10110301},
+ {0x00000D08, 0x10110301},
+ {0x00000D0C, 0x10110309},
+ {0x00000D10, 0x10118301},
+ {0x00000D14, 0x10110301},
+ {0x00000D18, 0x10110301},
+ {0x00000D1C, 0x10419308}
};
static unsigned nv4TableFIFO[][2] =
{
@@ -443,14 +446,14 @@
{
/* 0xXXXXXX01 For MSB mono format */
/* 0xXXXXXX02 For LSB mono format */
- {0x00000509, 0x00000302},
- {0x0000050D, 0x00000302},
- {0x00000511, 0x00000202},
- {0x00000515, 0x00000302},
- {0x00000519, 0x00000302},
- {0x0000051D, 0x00000302},
- {0x0000052D, 0x00000302},
- {0x0000052E, 0x00000302},
+ {0x00000509, 0x00000301},
+ {0x0000050D, 0x00000301},
+ {0x00000511, 0x00000201},
+ {0x00000515, 0x00000301},
+ {0x00000519, 0x00000301},
+ {0x0000051D, 0x00000301},
+ {0x0000052D, 0x00000301},
+ {0x0000052E, 0x00000301},
{0x00000535, 0x00000000},
{0x00000539, 0x00000000}
};
@@ -458,46 +461,46 @@
{
/* 0xXXXXXX01 For MSB mono format */
/* 0xXXXXXX02 For LSB mono format */
- {0x00000509, 0x00000902},
- {0x0000050D, 0x00000902},
- {0x00000511, 0x00000802},
- {0x00000515, 0x00000902},
- {0x00000519, 0x00000902},
- {0x0000051D, 0x00000902},
- {0x0000052D, 0x00000902},
- {0x0000052E, 0x00000902},
- {0x00000535, 0x00000702},
- {0x00000539, 0x00000702}
+ {0x00000509, 0x00000901},
+ {0x0000050D, 0x00000901},
+ {0x00000511, 0x00000801},
+ {0x00000515, 0x00000901},
+ {0x00000519, 0x00000901},
+ {0x0000051D, 0x00000901},
+ {0x0000052D, 0x00000901},
+ {0x0000052E, 0x00000901},
+ {0x00000535, 0x00000701},
+ {0x00000539, 0x00000701}
};
static unsigned nv4TablePRAMIN_16BPP[][2] =
{
/* 0xXXXXXX01 For MSB mono format */
/* 0xXXXXXX02 For LSB mono format */
- {0x00000509, 0x00000C02},
- {0x0000050D, 0x00000C02},
- {0x00000511, 0x00000B02},
- {0x00000515, 0x00000C02},
- {0x00000519, 0x00000C02},
- {0x0000051D, 0x00000C02},
- {0x0000052D, 0x00000C02},
- {0x0000052E, 0x00000C02},
- {0x00000535, 0x00000702},
- {0x00000539, 0x00000702}
+ {0x00000509, 0x00000C01},
+ {0x0000050D, 0x00000C01},
+ {0x00000511, 0x00000B01},
+ {0x00000515, 0x00000C01},
+ {0x00000519, 0x00000C01},
+ {0x0000051D, 0x00000C01},
+ {0x0000052D, 0x00000C01},
+ {0x0000052E, 0x00000C01},
+ {0x00000535, 0x00000701},
+ {0x00000539, 0x00000701}
};
static unsigned nv4TablePRAMIN_32BPP[][2] =
{
/* 0xXXXXXX01 For MSB mono format */
/* 0xXXXXXX02 For LSB mono format */
- {0x00000509, 0x00000E02},
- {0x0000050D, 0x00000E02},
- {0x00000511, 0x00000D02},
- {0x00000515, 0x00000E02},
- {0x00000519, 0x00000E02},
- {0x0000051D, 0x00000E02},
- {0x0000052D, 0x00000E02},
- {0x0000052E, 0x00000E02},
- {0x00000535, 0x00000E02},
- {0x00000539, 0x00000E02}
+ {0x00000509, 0x00000E01},
+ {0x0000050D, 0x00000E01},
+ {0x00000511, 0x00000D01},
+ {0x00000515, 0x00000E01},
+ {0x00000519, 0x00000E01},
+ {0x0000051D, 0x00000E01},
+ {0x0000052D, 0x00000E01},
+ {0x0000052E, 0x00000E01},
+ {0x00000535, 0x00000E01},
+ {0x00000539, 0x00000E01}
};
static unsigned nv10TableFIFO[][2] =
{
@@ -888,14 +891,14 @@
{
/* 0xXXXXXX01 For MSB mono format */
/* 0xXXXXXX02 For LSB mono format */
- {0x00000509, 0x00000302},
- {0x0000050D, 0x00000302},
- {0x00000511, 0x00000202},
- {0x00000515, 0x00000302},
- {0x00000519, 0x00000302},
- {0x0000051D, 0x00000302},
- {0x0000052D, 0x00000302},
- {0x0000052E, 0x00000302},
+ {0x00000509, 0x00000301},
+ {0x0000050D, 0x00000301},
+ {0x00000511, 0x00000201},
+ {0x00000515, 0x00000301},
+ {0x00000519, 0x00000301},
+ {0x0000051D, 0x00000301},
+ {0x0000052D, 0x00000301},
+ {0x0000052E, 0x00000301},
{0x00000535, 0x00000000},
{0x00000539, 0x00000000},
{0x0000053D, 0x00000000}
@@ -904,48 +907,48 @@
{
/* 0xXXXXXX01 For MSB mono format */
/* 0xXXXXXX02 For LSB mono format */
- {0x00000509, 0x00000902},
- {0x0000050D, 0x00000902},
- {0x00000511, 0x00000802},
- {0x00000515, 0x00000902},
- {0x00000519, 0x00000902},
- {0x0000051D, 0x00000902},
- {0x0000052D, 0x00000902},
- {0x0000052E, 0x00000902},
- {0x00000535, 0x00000902},
- {0x00000539, 0x00000902},
- {0x0000053D, 0x00000902}
+ {0x00000509, 0x00000901},
+ {0x0000050D, 0x00000901},
+ {0x00000511, 0x00000801},
+ {0x00000515, 0x00000901},
+ {0x00000519, 0x00000901},
+ {0x0000051D, 0x00000901},
+ {0x0000052D, 0x00000901},
+ {0x0000052E, 0x00000901},
+ {0x00000535, 0x00000901},
+ {0x00000539, 0x00000901},
+ {0x0000053D, 0x00000901}
};
static unsigned nv10TablePRAMIN_16BPP[][2] =
{
/* 0xXXXXXX01 For MSB mono format */
/* 0xXXXXXX02 For LSB mono format */
- {0x00000509, 0x00000C02},
- {0x0000050D, 0x00000C02},
- {0x00000511, 0x00000B02},
- {0x00000515, 0x00000C02},
- {0x00000519, 0x00000C02},
- {0x0000051D, 0x00000C02},
- {0x0000052D, 0x00000C02},
- {0x0000052E, 0x00000C02},
- {0x00000535, 0x00000C02},
- {0x00000539, 0x00000C02},
- {0x0000053D, 0x00000C02}
+ {0x00000509, 0x00000C01},
+ {0x0000050D, 0x00000C01},
+ {0x00000511, 0x00000B01},
+ {0x00000515, 0x00000C01},
+ {0x00000519, 0x00000C01},
+ {0x0000051D, 0x00000C01},
+ {0x0000052D, 0x00000C01},
+ {0x0000052E, 0x00000C01},
+ {0x00000535, 0x00000C01},
+ {0x00000539, 0x00000C01},
+ {0x0000053D, 0x00000C01}
};
static unsigned nv10TablePRAMIN_32BPP[][2] =
{
/* 0xXXXXXX01 For MSB mono format */
/* 0xXXXXXX02 For LSB mono format */
- {0x00000509, 0x00000E02},
- {0x0000050D, 0x00000E02},
- {0x00000511, 0x00000D02},
- {0x00000515, 0x00000E02},
- {0x00000519, 0x00000E02},
- {0x0000051D, 0x00000E02},
- {0x0000052D, 0x00000E02},
- {0x0000052E, 0x00000E02},
- {0x00000535, 0x00000E02},
- {0x00000539, 0x00000E02},
- {0x0000053D, 0x00000E02}
+ {0x00000509, 0x00000E01},
+ {0x0000050D, 0x00000E01},
+ {0x00000511, 0x00000D01},
+ {0x00000515, 0x00000E01},
+ {0x00000519, 0x00000E01},
+ {0x0000051D, 0x00000E01},
+ {0x0000052D, 0x00000E01},
+ {0x0000052E, 0x00000E01},
+ {0x00000535, 0x00000E01},
+ {0x00000539, 0x00000E01},
+ {0x0000053D, 0x00000E01}
};
8<--snip
|