VIA cursor works (almost) perfectly now, added support for vertical virtual workspaces, so setting framebuffer startadress now (expl. pixelpanning yet).

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13650 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Rudolf Cornelissen
2005-07-12 19:55:11 +00:00
parent bc5804fdb6
commit 5a2735230d
4 changed files with 63 additions and 112 deletions
+1 -2
View File
@@ -154,8 +154,7 @@ status_t INIT_ACCELERANT(int the_fd) {
*/ */
pointer_reservation = 0; pointer_reservation = 0;
/* VIA hardcursor needs 4kB space */ /* VIA hardcursor needs 4kB space */
//rud: shutoff until adress of FB is programmed! <<<<<<<<<< if (si->settings.hardcursor) pointer_reservation = 4096;
// if (si->settings.hardcursor) pointer_reservation = 4096;
si->fbc.frame_buffer = (void *)((char *)si->framebuffer+pointer_reservation); si->fbc.frame_buffer = (void *)((char *)si->framebuffer+pointer_reservation);
si->fbc.frame_buffer_dma = (void *)((char *)si->framebuffer_pci+pointer_reservation); si->fbc.frame_buffer_dma = (void *)((char *)si->framebuffer_pci+pointer_reservation);
+5 -5
View File
@@ -6,7 +6,7 @@
Other authors: Other authors:
Mark Watson, Mark Watson,
Apsed, Apsed,
Rudolf Cornelissen 11/2002-4/2004 Rudolf Cornelissen 11/2002-7/2005
*/ */
#define MODULE_BIT 0x00200000 #define MODULE_BIT 0x00200000
@@ -294,7 +294,7 @@ status = B_OK;
// head1_set_display_pitch(); // head1_set_display_pitch();
/* tell the card what memory to display */ /* tell the card what memory to display */
// head1_set_display_start(startadd,colour_depth1); head1_set_display_start(startadd,colour_depth1);
/* set the timing */ /* set the timing */
// head1_set_timing(target); // head1_set_timing(target);
@@ -396,14 +396,14 @@ status_t MOVE_DISPLAY(uint16 h_display_start, uint16 v_display_start) {
{ {
case DUALHEAD_ON: case DUALHEAD_ON:
case DUALHEAD_SWITCH: case DUALHEAD_SWITCH:
// head1_set_display_start(startadd,colour_depth); head1_set_display_start(startadd,colour_depth);
// head2_set_display_start(startadd_right,colour_depth); // head2_set_display_start(startadd_right,colour_depth);
break; break;
case DUALHEAD_OFF: case DUALHEAD_OFF:
// head1_set_display_start(startadd,colour_depth); head1_set_display_start(startadd,colour_depth);
break; break;
case DUALHEAD_CLONE: case DUALHEAD_CLONE:
// head1_set_display_start(startadd,colour_depth); head1_set_display_start(startadd,colour_depth);
// head2_set_display_start(startadd,colour_depth); // head2_set_display_start(startadd,colour_depth);
break; break;
} }
+55 -103
View File
@@ -599,7 +599,7 @@ status_t eng_crtc_set_display_pitch()
status_t eng_crtc_set_display_start(uint32 startadd,uint8 bpp) status_t eng_crtc_set_display_start(uint32 startadd,uint8 bpp)
{ {
uint8 temp; // uint8 temp;
uint32 timeout = 0; uint32 timeout = 0;
LOG(4,("CRTC: setting card RAM to be displayed bpp %d\n", bpp)); LOG(4,("CRTC: setting card RAM to be displayed bpp %d\n", bpp));
@@ -610,47 +610,42 @@ status_t eng_crtc_set_display_start(uint32 startadd,uint8 bpp)
/* we might have no retraces during setmode! */ /* we might have no retraces during setmode! */
/* wait 25mS max. for retrace to occur (refresh > 40Hz) */ /* wait 25mS max. for retrace to occur (refresh > 40Hz) */
while (((ENG_REG32(RG32_RASTER) & 0x000007ff) < si->dm.timing.v_display) && // while (((ENG_REG32(RG32_RASTER) & 0x000007ff) < si->dm.timing.v_display) &&
(timeout < (25000/10))) // (timeout < (25000/10)))
if (0)
{ {
/* don't snooze much longer or retrace might get missed! */ /* don't snooze much longer or retrace might get missed! */
snooze(10); snooze(10);
timeout++; timeout++;
} }
/* enable access to primary head */ /*
set_crtc_owner(0); linux:
vgaHWGetIOBase(hwp);
vgaIOBase = hwp->IOBase; //3d0 (rud)
vgaCRIndex = vgaIOBase + 4;
if (si->ps.card_arch == NV04A) define VGAOUT16(addr, val) MMIO_OUT16(pVia->MapBase+0x8000, addr, val)
{
/* upto 32Mb RAM adressing: must be used this way on pre-NV10! */
/* set standard registers */ Base = Base >> 1;
/* (NVidia: startadress in 32bit words (b2 - b17) */ VGAOUT16(vgaCRIndex, (Base & 0x00ff00) | 0x0c);
CRTCW(FBSTADDL, ((startadd & 0x000003fc) >> 2)); VGAOUT16(vgaCRIndex, ((Base & 0x00ff) << 8) | 0x0d);
CRTCW(FBSTADDH, ((startadd & 0x0003fc00) >> 10)); VGAOUT16(vgaCRIndex, ((Base & 0xff0000) >> 8) | 0x34);
*/
/* VIA: upto 32Mb RAM can be adressed */
/* set extended registers */ /* set standard registers */
/* NV4 extended bits: (b18-22) */ /* (VIA: startadress in 16bit words (b1 - b16) */
temp = (CRTCR(REPAINT0) & 0xe0); CRTCW(FBSTADDL, ((startadd & 0x000001fe) >> 1));
CRTCW(REPAINT0, (temp | ((startadd & 0x007c0000) >> 18))); CRTCW(FBSTADDH, ((startadd & 0x0001fe00) >> 9));
/* NV4 extended bits: (b23-24) */ /* set extended bits: (b17-24) */
temp = (CRTCR(HEB) & 0x9f); CRTCW(FBSTADDE, ((startadd & 0x01fe0000) >> 17));
CRTCW(HEB, (temp | ((startadd & 0x01800000) >> 18)));
}
else
{
/* upto 4Gb RAM adressing: must be used on NV10 and later! */
/* NOTE:
* While this register also exists on pre-NV10 cards, it will
* wrap-around at 16Mb boundaries!! */
/* 30bit adress in 32bit words */ //fixme: findout if VIA supports pixelpanning...
ENG_REG32(RG32_NV10FBSTADD32) = (startadd & 0xfffffffc);
}
/* set NV4/NV10 byte adress: (b0 - 1) */ /* set NV4/NV10 byte adress: (b0 - 1) */
ATBW(HORPIXPAN, ((startadd & 0x00000003) << 1)); // ATBW(HORPIXPAN, ((startadd & 0x00000003) << 1));
return B_OK; return B_OK;
} }
@@ -662,46 +657,21 @@ status_t eng_crtc_cursor_init()
/* cursor bitmap will be stored at the start of the framebuffer */ /* cursor bitmap will be stored at the start of the framebuffer */
const uint32 curadd = 0; const uint32 curadd = 0;
/* set cursor bitmap adress ... */ /* background is white */
if (0)//(si->ps.card_arch == NV04A) || (si->ps.laptop)) CRTCDW(CURSOR_BG, 0xffffffff);
{ /* foreground is black */
/* must be used this way on pre-NV10 and on all 'Go' cards! */ CRTCDW(CURSOR_FG, 0x00000000);
/* cursorbitmap must start on 2Kbyte boundary: */
/* set adress bit11-16, and set 'no doublescan' (registerbit 1 = 0) */
CRTCW(CURCTL0, ((curadd & 0x0001f800) >> 9));
/* set adress bit17-23, and set graphics mode cursor(?) (registerbit 7 = 1) */
CRTCW(CURCTL1, (((curadd & 0x00fe0000) >> 17) | 0x80));
/* set adress bit24-31 */
CRTCW(CURCTL2, ((curadd & 0xff000000) >> 24));
}
else
{
/* upto 4Gb RAM adressing:
* can be used on NV10 and later (except for 'Go' cards)! */
/* NOTE:
* This register does not exist on pre-NV10 and 'Go' cards. */
/* cursorbitmap must still start on 2Kbyte boundary: */
//via
/* background is black */
CRTCDW(CURSOR_BG, 0x00000000);
/* foreground is white */
CRTCDW(CURSOR_FG, 0x00ffffff);
/* set cursor bitmap adress */ /* set cursor bitmap adress */
CRTCDW(CURSOR_MODE, (curadd & 0xfffffffc)); CRTCDW(CURSOR_MODE, (curadd & 0xfffffffc));
}
/* clear cursor (via cursor uses 4kb) */ /* clear cursor (via cursor uses 4kb max) */
fb = (uint32 *) si->framebuffer + curadd; fb = (uint32 *) si->framebuffer + curadd;
for (i=0;i<(4096/4);i++) for (i = 0; i < (4096/4); i += 2)
{ {
fb[i]=0; fb[i + 0] = 0x00000000;
fb[i + 1] = 0xffffffff;
} }
/* select 32x32 pixel, 16bit color cursorbitmap, no doublescan */
// ENG_REG32(RG32_CURCONF) = 0x02000100;
/* activate hardware cursor */ /* activate hardware cursor */
eng_crtc_cursor_show(); eng_crtc_cursor_show();
@@ -711,6 +681,8 @@ status_t eng_crtc_cursor_init()
status_t eng_crtc_cursor_show() status_t eng_crtc_cursor_show()
{ {
LOG(4,("CRTC: enabling cursor\n")); LOG(4,("CRTC: enabling cursor\n"));
/* b1 = 0 shows a 64x64 pixel map, b1 = 1 shows a 32x32 pixel map;
* b0 = 0 disables the cursor, b0 = 1 enables the cursor. */
CRTCDW(CURSOR_MODE, (CRTCDR(CURSOR_MODE) | 0x00000003)); CRTCDW(CURSOR_MODE, (CRTCDR(CURSOR_MODE) | 0x00000003));
return B_OK; return B_OK;
@@ -728,54 +700,34 @@ status_t eng_crtc_cursor_hide()
status_t eng_crtc_cursor_define(uint8* andMask,uint8* xorMask) status_t eng_crtc_cursor_define(uint8* andMask,uint8* xorMask)
{ {
int y; int y;
uint8 b,s; uint8 *cursor;
uint16 *cursor;
uint16 data;
/* get a pointer to the cursor */ /* get a pointer to the cursor */
cursor = (uint16*) si->framebuffer; cursor = (uint8*) si->framebuffer;
/* draw the cursor */ /* pixmap is 4 bytes per row, two rows form pixeldata for one pixel in height */
for (y = 0; y < 16; y++) for (y = 0; y < 16; y++)
{ {
b = 0x01; cursor[0 + (y * 8)] = *xorMask++;
/* preset transparant */ cursor[1 + (y * 8)] = *xorMask++;
data = 0x0000; cursor[4 + (y * 8)] = *andMask++;
for (s = 0; s < 15; s += 2) cursor[5 + (y * 8)] = *andMask++;
{
/* set white if requested */
if ((!(*andMask & b)) && (!(*xorMask & b))) data |= (0x0003 << s);
/* set black if requested */
if ((!(*andMask & b)) && (*xorMask & b)) data |= (0x0002 << s);
/* set invert if requested */
if ( (*andMask & b) && (*xorMask & b)) data |= (0x0001 << s);
b <<= 1;
}
/* place the 8 pixels in the bitmap */
cursor[0 + (y * 4)] = data;
xorMask++;
andMask++;
b = 0x01;
/* preset transparant */
data = 0x0000;
for (s = 0; s < 15; s += 2)
{
/* set white if requested */
if ((!(*andMask & b)) && (!(*xorMask & b))) data |= (0x0003 << s);
/* set black if requested */
if ((!(*andMask & b)) && (*xorMask & b)) data |= (0x0002 << s);
/* set invert if requested */
if ( (*andMask & b) && (*xorMask & b)) data |= (0x0001 << s);
b <<= 1;
}
/* place the 8 pixels in the bitmap */
cursor[1 + (y * 4)] = data;
xorMask++;
andMask++;
} }
return B_OK; return B_OK;
//
for (y = 0; y < 1; y++)//hele hoogte invert
{
cursor[0 + (y*4)] = 0xff;//linker helft invert
cursor[0 + (1*4)] = 0xff;//rechter helft invert
//invert = %11
//black = %00
// cursor[0 + (y * 4)] = *xorMask++;
// cursor[32 + (y * 4)] = *xorMask++;
// cursor[64 + (y * 4)] = *xorMask++;
// cursor[96 + (y * 4)] = *xorMask++;
}
} }
/* position the cursor */ /* position the cursor */
+2 -2
View File
@@ -1,7 +1,7 @@
/* Read initialisation information from card */ /* Read initialisation information from card */
/* some bits are hacks, where PINS is not known */ /* some bits are hacks, where PINS is not known */
/* Author: /* Author:
Rudolf Cornelissen 7/2003-10/2004 Rudolf Cornelissen 7/2003-7/2005
*/ */
#define MODULE_BIT 0x00002000 #define MODULE_BIT 0x00002000
@@ -2403,7 +2403,7 @@ static void setup_output_matrix()
si->ps.crtc2_prim = false; si->ps.crtc2_prim = false;
/* setup output devices and heads */ /* setup output devices and heads */
if (si->ps.secondary_head) if (0)//si->ps.secondary_head)
{ {
if (si->ps.card_type != NV11) if (si->ps.card_type != NV11)
{ {