added pixelprecise panning for all colordepths

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7692 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Rudolf Cornelissen
2004-05-31 11:33:14 +00:00
parent bb6583ad28
commit 4642295154
4 changed files with 34 additions and 29 deletions
+4 -16
View File
@@ -3,7 +3,7 @@
This file may be used under the terms of the Be Sample Code License. This file may be used under the terms of the Be Sample Code License.
Other authors: Other authors:
Rudolf Cornelissen 4/2003-6/2003 Rudolf Cornelissen 4/2003-5/2004
*/ */
#define MODULE_BIT 0x20000000 #define MODULE_BIT 0x20000000
@@ -54,21 +54,9 @@ void MOVE_CURSOR(uint16 x, uint16 y)
si->cursor.x = x; si->cursor.x = x;
si->cursor.y = y; si->cursor.y = y;
switch(si->dm.space) /* setting up minimum amount to scroll not needed:
{ * Neomagic cards can always do pixelprecise panning */
case B_CMAP8: h_adjust = 0x00;
h_adjust = 0x03;
break;
case B_RGB15_LITTLE:case B_RGB16_LITTLE:
h_adjust = 0x01;
break;
case B_RGB32_LITTLE:
h_adjust = 0x00;
break;
default:
h_adjust = 0x03;
break;
}
/* if internal panel is active correct visible screensize! */ /* if internal panel is active correct visible screensize! */
if (nm_general_output_read() & 0x02) if (nm_general_output_read() & 0x02)
@@ -170,20 +170,21 @@ status_t MOVE_DISPLAY(uint16 h_display_start, uint16 v_display_start)
LOG(4,("MOVE_DISPLAY: h %d, v %d\n", h_display_start, v_display_start)); LOG(4,("MOVE_DISPLAY: h %d, v %d\n", h_display_start, v_display_start));
/* reset lower bits, don't return an error! */ /* Neomagic cards support pixelprecise panning in all modes:
* No stepping granularity needed! */
/* determine bits used for the colordepth */
switch(si->dm.space) switch(si->dm.space)
{ {
case B_CMAP8: case B_CMAP8:
colour_depth=8; colour_depth=8;
h_display_start &= ~0x03;
break; break;
case B_RGB15_LITTLE: case B_RGB16_LITTLE: case B_RGB15_LITTLE:
case B_RGB16_LITTLE:
colour_depth=16; colour_depth=16;
h_display_start &= ~0x01;
break; break;
case B_RGB24_LITTLE: case B_RGB24_LITTLE:
colour_depth=24; colour_depth=24;
h_display_start &= ~0x03;
break; break;
default: default:
return B_ERROR; return B_ERROR;
@@ -481,12 +481,10 @@ status_t nm_crtc_set_display_start(uint32 startadd,uint8 bpp)
timeout++; timeout++;
} }
/* the neomagic framebuffer startadress is given in 32bit words */
startadd >>= 2;
/* set standard VGA registers */ /* set standard VGA registers */
ISACRTCW(FBSTADDH, ((startadd & 0x00FF00) >> 8)); /* (startadress in 32bit words (b2 - b17) */
ISACRTCW(FBSTADDL, (startadd & 0x0000FF)); ISACRTCW(FBSTADDH, ((startadd & 0x03fc00) >> 10));
ISACRTCW(FBSTADDL, ((startadd & 0x0003fc) >> 2));
/* set NM extended register */ /* set NM extended register */
//fixme: NM2380 _must_ have one more bit (has >4Mb RAM)!! //fixme: NM2380 _must_ have one more bit (has >4Mb RAM)!!
@@ -496,9 +494,27 @@ status_t nm_crtc_set_display_start(uint32 startadd,uint8 bpp)
/* we need to wait a bit or the card will mess-up it's register values.. (NM2160) */ /* we need to wait a bit or the card will mess-up it's register values.. (NM2160) */
snooze(10); snooze(10);
if (si->ps.card_type < NM2200) if (si->ps.card_type < NM2200)
ISAGRPHW(FBSTADDE,(((startadd >> 16) & 0x07) | (val & 0xf8))); /* extended bits: (b18-20) */
ISAGRPHW(FBSTADDE,(((startadd >> 18) & 0x07) | (val & 0xf8)));
else else
ISAGRPHW(FBSTADDE,(((startadd >> 16) & 0x0f) | (val & 0xf0))); /* extended bits: (b18-21) */
ISAGRPHW(FBSTADDE,(((startadd >> 18) & 0x0f) | (val & 0xf0)));
/* set byte adress: (b0 - 1):
* Neomagic cards work with _pixel_ offset here. */
switch(bpp)
{
case 8:
ISAATBW(HORPIXPAN, (startadd & 0x00000003));
break;
case 15:
case 16:
ISAATBW(HORPIXPAN, ((startadd & 0x00000002) >> 1));
break;
case 24:
ISAATBW(HORPIXPAN, ((4 - (startadd & 0x00000003)) & 0x03));
break;
}
return B_OK; return B_OK;
} }
@@ -47,7 +47,7 @@ status_t nm_general_powerup()
{ {
status_t status; status_t status;
LOG(1,("POWERUP: Neomagic (open)BeOS Accelerant 0.06-14 running.\n")); LOG(1,("POWERUP: Neomagic (open)BeOS Accelerant 0.06-15 running.\n"));
/* detect card type and power it up */ /* detect card type and power it up */
switch(CFGR(DEVID)) switch(CFGR(DEVID))