From 4b09e7a388d9a7217d262218c80c75e3f3652f06 Mon Sep 17 00:00:00 2001 From: Rudolf Cornelissen Date: Sat, 29 May 2004 17:32:00 +0000 Subject: [PATCH] fixed NM2070 hardcursor trouble: programming panel modelines git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7672 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../accelerants/neomagic/SetDisplayMode.c | 2 + .../accelerants/neomagic/engine/nm_crtc.c | 186 ++++++++++++++++++ .../accelerants/neomagic/engine/nm_general.c | 2 +- .../accelerants/neomagic/engine/nm_proto.h | 1 + 4 files changed, 190 insertions(+), 1 deletion(-) diff --git a/src/add-ons/accelerants/neomagic/SetDisplayMode.c b/src/add-ons/accelerants/neomagic/SetDisplayMode.c index 046d73e2bf..8887add929 100644 --- a/src/add-ons/accelerants/neomagic/SetDisplayMode.c +++ b/src/add-ons/accelerants/neomagic/SetDisplayMode.c @@ -128,6 +128,8 @@ status_t SET_DISPLAY_MODE(display_mode *mode_to_set) /* always setup centering so a KB BIOS switch to flatpanel will go OK... */ nm_crtc_center(target, crt_only); + /* program panel modeline if needed */ + if (!crt_only) nm_crtc_prg_panel(); } /* update driver's mode store */ diff --git a/src/add-ons/accelerants/neomagic/engine/nm_crtc.c b/src/add-ons/accelerants/neomagic/engine/nm_crtc.c index 6e3bf942d4..e40dfd2d79 100644 --- a/src/add-ons/accelerants/neomagic/engine/nm_crtc.c +++ b/src/add-ons/accelerants/neomagic/engine/nm_crtc.c @@ -615,6 +615,192 @@ status_t nm_crtc_center(display_mode target, bool crt_only) return B_OK; } +/* program panel modeline if needed */ +status_t nm_crtc_prg_panel() +{ +status_t stat = B_ERROR; + + /* only NM2070 requires this apparantly (because it's BIOS doesn't do it OK) */ + if (si->ps.card_type > NM2070) return B_OK; + + switch(si->ps.panel_width) + { + case 640: + /* 640x480 panels are only used on NM2070 */ + ISACRTCW(PANEL_0x40, 0x5f); + ISACRTCW(PANEL_0x41, 0x50); + ISACRTCW(PANEL_0x42, 0x02); + ISACRTCW(PANEL_0x43, 0x55); + ISACRTCW(PANEL_0x44, 0x81); + ISACRTCW(PANEL_0x45, 0x0b); + ISACRTCW(PANEL_0x46, 0x2e); + ISACRTCW(PANEL_0x47, 0xea); + ISACRTCW(PANEL_0x48, 0x0c); + ISACRTCW(PANEL_0x49, 0xe7); + ISACRTCW(PANEL_0x4a, 0x04); + ISACRTCW(PANEL_0x4b, 0x2d); + ISACRTCW(PANEL_0x4c, 0x28); + ISACRTCW(PANEL_0x4d, 0x90); + ISACRTCW(PANEL_0x4e, 0x2b); + ISACRTCW(PANEL_0x4f, 0xa0); + stat = B_OK; + break; + case 800: + switch(si->ps.panel_height) + { + case 600: + /* 800x600 panels are used on all cards... */ + ISACRTCW(PANEL_0x40, 0x7f); + ISACRTCW(PANEL_0x41, 0x63); + ISACRTCW(PANEL_0x42, 0x02); + ISACRTCW(PANEL_0x43, 0x6c); + ISACRTCW(PANEL_0x44, 0x1c); + ISACRTCW(PANEL_0x45, 0x72); + ISACRTCW(PANEL_0x46, 0xe0); + ISACRTCW(PANEL_0x47, 0x58); + ISACRTCW(PANEL_0x48, 0x0c); + ISACRTCW(PANEL_0x49, 0x57); + ISACRTCW(PANEL_0x4a, 0x73); + ISACRTCW(PANEL_0x4b, 0x3d); + ISACRTCW(PANEL_0x4c, 0x31); + ISACRTCW(PANEL_0x4d, 0x01); + ISACRTCW(PANEL_0x4e, 0x36); + ISACRTCW(PANEL_0x4f, 0x1e); + if (si->ps.card_type > NM2070) + { + ISACRTCW(PANEL_0x50, 0x6b); + ISACRTCW(PANEL_0x51, 0x4f); + ISACRTCW(PANEL_0x52, 0x0e); + ISACRTCW(PANEL_0x53, 0x58); + ISACRTCW(PANEL_0x54, 0x88); + ISACRTCW(PANEL_0x55, 0x33); + ISACRTCW(PANEL_0x56, 0x27); + ISACRTCW(PANEL_0x57, 0x16); + ISACRTCW(PANEL_0x58, 0x2c); + ISACRTCW(PANEL_0x59, 0x94); + } + stat = B_OK; + break; + case 480: + /* ...while 800x480 widescreen panels are not used on NM2070. */ + ISACRTCW(PANEL_0x40, 0x7f); + ISACRTCW(PANEL_0x41, 0x63); + ISACRTCW(PANEL_0x42, 0x02); + ISACRTCW(PANEL_0x43, 0x6b); + ISACRTCW(PANEL_0x44, 0x1b); + ISACRTCW(PANEL_0x45, 0x72); + ISACRTCW(PANEL_0x46, 0xe0); + ISACRTCW(PANEL_0x47, 0x1c); + ISACRTCW(PANEL_0x48, 0x00); + ISACRTCW(PANEL_0x49, 0x57); + ISACRTCW(PANEL_0x4a, 0x73); + ISACRTCW(PANEL_0x4b, 0x3e); + ISACRTCW(PANEL_0x4c, 0x31); + ISACRTCW(PANEL_0x4d, 0x01); + ISACRTCW(PANEL_0x4e, 0x36); + ISACRTCW(PANEL_0x4f, 0x1e); + ISACRTCW(PANEL_0x50, 0x6b); + ISACRTCW(PANEL_0x51, 0x4f); + ISACRTCW(PANEL_0x52, 0x0e); + ISACRTCW(PANEL_0x53, 0x57); + ISACRTCW(PANEL_0x54, 0x87); + ISACRTCW(PANEL_0x55, 0x33); + ISACRTCW(PANEL_0x56, 0x27); + ISACRTCW(PANEL_0x57, 0x16); + ISACRTCW(PANEL_0x58, 0x2c); + ISACRTCW(PANEL_0x59, 0x94); + stat = B_OK; + break; + } + break; + case 1024: + switch(si->ps.panel_height) + { + case 768: + /* 1024x768 panels are only used on later cards + * (NM2097 and later ?) */ + ISACRTCW(PANEL_0x40, 0xa3); + ISACRTCW(PANEL_0x41, 0x7f); + ISACRTCW(PANEL_0x42, 0x06); + ISACRTCW(PANEL_0x43, 0x85); + ISACRTCW(PANEL_0x44, 0x96); + ISACRTCW(PANEL_0x45, 0x24); + ISACRTCW(PANEL_0x46, 0xe5); + ISACRTCW(PANEL_0x47, 0x02); + ISACRTCW(PANEL_0x48, 0x08); + ISACRTCW(PANEL_0x49, 0xff); + ISACRTCW(PANEL_0x4a, 0x25); + ISACRTCW(PANEL_0x4b, 0x4f); + ISACRTCW(PANEL_0x4c, 0x40); + ISACRTCW(PANEL_0x4d, 0x00); + ISACRTCW(PANEL_0x4e, 0x44); + ISACRTCW(PANEL_0x4f, 0x0c); + ISACRTCW(PANEL_0x50, 0x7a); + ISACRTCW(PANEL_0x51, 0x56); + ISACRTCW(PANEL_0x52, 0x00); + ISACRTCW(PANEL_0x53, 0x5d); + ISACRTCW(PANEL_0x54, 0x0e); + ISACRTCW(PANEL_0x55, 0x3b); + ISACRTCW(PANEL_0x56, 0x2b); + ISACRTCW(PANEL_0x57, 0x00); + ISACRTCW(PANEL_0x58, 0x2f); + ISACRTCW(PANEL_0x59, 0x18); + ISACRTCW(PANEL_0x60, 0x88); + ISACRTCW(PANEL_0x61, 0x63); + ISACRTCW(PANEL_0x62, 0x0b); + ISACRTCW(PANEL_0x63, 0x69); + ISACRTCW(PANEL_0x64, 0x1a); + stat = B_OK; + break; + case 480: + /* 1024x480 widescreen panels are only used on later cards + * (NM2097 and later ?) */ + ISACRTCW(PANEL_0x40, 0xa3); + ISACRTCW(PANEL_0x41, 0x7f); + ISACRTCW(PANEL_0x42, 0x1b); + ISACRTCW(PANEL_0x43, 0x89); + ISACRTCW(PANEL_0x44, 0x16); + ISACRTCW(PANEL_0x45, 0x0b); + ISACRTCW(PANEL_0x46, 0x2c); + ISACRTCW(PANEL_0x47, 0xe8); + ISACRTCW(PANEL_0x48, 0x0c); + ISACRTCW(PANEL_0x49, 0xe7); + ISACRTCW(PANEL_0x4a, 0x09); + ISACRTCW(PANEL_0x4b, 0x4f); + ISACRTCW(PANEL_0x4c, 0x40); + ISACRTCW(PANEL_0x4d, 0x00); + ISACRTCW(PANEL_0x4e, 0x44); + ISACRTCW(PANEL_0x4f, 0x0c); + ISACRTCW(PANEL_0x50, 0x7a); + ISACRTCW(PANEL_0x51, 0x56); + ISACRTCW(PANEL_0x52, 0x00); + ISACRTCW(PANEL_0x53, 0x5d); + ISACRTCW(PANEL_0x54, 0x0e); + ISACRTCW(PANEL_0x55, 0x3b); + ISACRTCW(PANEL_0x56, 0x2a); + ISACRTCW(PANEL_0x57, 0x00); + ISACRTCW(PANEL_0x58, 0x2f); + ISACRTCW(PANEL_0x59, 0x18); + ISACRTCW(PANEL_0x60, 0x88); + ISACRTCW(PANEL_0x61, 0x63); + ISACRTCW(PANEL_0x62, 0x0b); + ISACRTCW(PANEL_0x63, 0x69); + ISACRTCW(PANEL_0x64, 0x1a); + stat = B_OK; + break; + } + break; + case 1280: + /* no info available */ + break; + } + + if (stat != B_OK) + LOG(2,("CRTC: unable to program panel: unknown modeline needed.\n")); + + return stat; +} + status_t nm_crtc_cursor_init() { int i; diff --git a/src/add-ons/accelerants/neomagic/engine/nm_general.c b/src/add-ons/accelerants/neomagic/engine/nm_general.c index e3f6ef9bc0..8b681de4b7 100644 --- a/src/add-ons/accelerants/neomagic/engine/nm_general.c +++ b/src/add-ons/accelerants/neomagic/engine/nm_general.c @@ -47,7 +47,7 @@ status_t nm_general_powerup() { status_t status; - LOG(1,("POWERUP: Neomagic (open)BeOS Accelerant 0.06-13 running.\n")); + LOG(1,("POWERUP: Neomagic (open)BeOS Accelerant 0.06-14 running.\n")); /* detect card type and power it up */ switch(CFGR(DEVID)) diff --git a/src/add-ons/accelerants/neomagic/engine/nm_proto.h b/src/add-ons/accelerants/neomagic/engine/nm_proto.h index 775dbd924a..4526a1387c 100644 --- a/src/add-ons/accelerants/neomagic/engine/nm_proto.h +++ b/src/add-ons/accelerants/neomagic/engine/nm_proto.h @@ -42,6 +42,7 @@ status_t nm_crtc_depth(int mode); status_t nm_crtc_set_display_start(uint32 startadd,uint8 bpp); status_t nm_crtc_set_display_pitch(void); status_t nm_crtc_center(display_mode target, bool crt_only); +status_t nm_crtc_prg_panel(void); status_t nm_crtc_dpms(bool, bool, bool); status_t nm_crtc_dpms_fetch(bool*, bool*, bool*);