From f2ef38a49bc1cfde241b41a158f4b85c5fa0c0d1 Mon Sep 17 00:00:00 2001 From: Rudolf Cornelissen Date: Tue, 2 Nov 2004 13:56:02 +0000 Subject: [PATCH] fixed GET_TIMING_CONSTRAINTS and GET_ACCELERANT_DEVICE_INFO accelerant hooks to return valid data, updated CRTC modeline validity checks for one more variable. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9737 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../accelerants/neomagic/GetDeviceInfo.c | 65 +++++++++++-------- .../neomagic/GetTimingConstraints.c | 37 ++++++----- .../accelerants/neomagic/engine/nm_crtc.c | 10 ++- .../accelerants/neomagic/engine/nm_general.c | 8 +-- 4 files changed, 70 insertions(+), 50 deletions(-) diff --git a/src/add-ons/accelerants/neomagic/GetDeviceInfo.c b/src/add-ons/accelerants/neomagic/GetDeviceInfo.c index 52f3756dcf..31dd29734d 100644 --- a/src/add-ons/accelerants/neomagic/GetDeviceInfo.c +++ b/src/add-ons/accelerants/neomagic/GetDeviceInfo.c @@ -1,6 +1,6 @@ /* - Authors: - Rudolf Cornelissen 4/2003- + Author: + Rudolf Cornelissen 11/2004 */ #define MODULE_BIT 0x04000000 @@ -10,35 +10,48 @@ /* Get some info about the device */ status_t GET_ACCELERANT_DEVICE_INFO(accelerant_device_info * adi) { - /*no info on version is provided, so presumably this is for my info*/ - LOG(4,("DEVICE_INFO: version 0x%08x\n", adi->version)); - + LOG(4,("GET_ACCELERANT_DEVICE_INFO: returning info\n")); + + /* no info on version is provided, so presumably this is for my info */ + adi->version = 1; + + sprintf(adi->name, "Neomagic chipset"); switch (si->ps.card_type) { - case 0x01: - sprintf(adi->name,"Neomagic Plain"); + case NM2070: + sprintf(adi->chipset, "MagicGraph NM2070"); break; - case 0x02: - sprintf(adi->name,"Neomagic MAX"); + case NM2090: + sprintf(adi->chipset, "MagicGraph NM2090"); + break; + case NM2093: + sprintf(adi->chipset, "MagicGraph NM2093"); + break; + case NM2097: + sprintf(adi->chipset, "MagicGraph NM2097"); + break; + case NM2160: + sprintf(adi->chipset, "MagicGraph NM2160"); + break; + case NM2200: + sprintf(adi->chipset, "MagicMedia NM2200"); + break; + case NM2230: + sprintf(adi->chipset, "MagicMedia NM2230"); + break; + case NM2360: + sprintf(adi->chipset, "MagicMedia NM2360"); + break; + case NM2380: + sprintf(adi->chipset, "MagicMedia NM2380"); + break; + default: + sprintf(adi->chipset, "unknown"); break; } - - sprintf(adi->chipset,"Neomagic"); - - sprintf(adi->serial_no,"01134"); /*FIXME*/ - - adi->memory=si->ps.memory_size * 1024; - - adi->dac_speed=si->ps.max_dac1_clock; - - // apsed, TODO ?? GET_ACCELERANT_DEVICE_INFO never called and kind of cards - LOG(2,("GET_ACCELERANT_DEVICE_INFO %20s 0x%08x %d\n", "version", adi->version, adi->version)); - LOG(2,("GET_ACCELERANT_DEVICE_INFO %20s %s\n", "name", adi->name)); - LOG(2,("GET_ACCELERANT_DEVICE_INFO %20s %s\n", "chipset", adi->chipset)); - LOG(2,("GET_ACCELERANT_DEVICE_INFO %20s %s\n", "serial_no", adi->serial_no)); - LOG(2,("GET_ACCELERANT_DEVICE_INFO %20s 0x%08x %d\n", "memory", adi->memory, adi->memory)); - LOG(2,("GET_ACCELERANT_DEVICE_INFO %20s %d\n", "dac_speed", adi->dac_speed)); - + sprintf(adi->serial_no, "unknown"); + adi->memory = (si->ps.memory_size * 1024); + adi->dac_speed = si->ps.max_dac1_clock; return B_OK; } diff --git a/src/add-ons/accelerants/neomagic/GetTimingConstraints.c b/src/add-ons/accelerants/neomagic/GetTimingConstraints.c index 29751b96c8..bda20eb133 100644 --- a/src/add-ons/accelerants/neomagic/GetTimingConstraints.c +++ b/src/add-ons/accelerants/neomagic/GetTimingConstraints.c @@ -1,7 +1,6 @@ /* - Authors: - Mark Watson - 21/6/00, - Apsed + Author: + Rudolf Cornelissen 11/2004 */ #define MODULE_BIT 0x01000000 @@ -11,20 +10,24 @@ /* Used to help generate mode lines */ status_t GET_TIMING_CONSTRAINTS(display_timing_constraints * dtc) { - // apsed, TODO, is that following card capabilities ?? - LOG(4, ("GET_TIMING_CONSTRAINTS\n")); - - dtc->h_res=8; - dtc->h_sync_min=8; - dtc->h_sync_max=248; - dtc->h_blank_min=8; - dtc->h_blank_max=504; - - dtc->v_res=1; - dtc->v_sync_min=1; - dtc->v_sync_max=15; - dtc->v_blank_min=1; - dtc->v_blank_max=255; + LOG(4, ("GET_TIMING_CONSTRAINTS: returning info\n")); + + /* specs are identical for all Neomagic cards */ + dtc->h_res = 8; + dtc->h_sync_min = 8; + dtc->h_sync_max = 248; + /* Note: + * h_blank info is used to determine the max. diff. between h_total and h_display! */ + dtc->h_blank_min = 8; + dtc->h_blank_max = 504; + + dtc->v_res = 1; + dtc->v_sync_min = 1; + dtc->v_sync_max = 15; + /* Note: + * v_blank info is used to determine the max. diff. between v_total and v_display! */ + dtc->v_blank_min = 1; + dtc->v_blank_max = 255; return B_OK; } diff --git a/src/add-ons/accelerants/neomagic/engine/nm_crtc.c b/src/add-ons/accelerants/neomagic/engine/nm_crtc.c index da311e0083..4b33b235b8 100644 --- a/src/add-ons/accelerants/neomagic/engine/nm_crtc.c +++ b/src/add-ons/accelerants/neomagic/engine/nm_crtc.c @@ -1,6 +1,6 @@ /* CTRC functionality */ /* Author: - Rudolf Cornelissen 4/2003-6/2004 + Rudolf Cornelissen 4/2003-11/2004 */ #define MODULE_BIT 0x00040000 @@ -8,8 +8,6 @@ #include "nm_std.h" /* Adjust passed parameters to a valid mode line */ -//fixme: the order of the sync edges should also be checked, -//just like the sync signal's min. pulse length... status_t nm_crtc_validate_timing( uint16 *hd_e,uint16 *hs_s,uint16 *hs_e,uint16 *ht, uint16 *vd_e,uint16 *vs_s,uint16 *vs_e,uint16 *vt @@ -36,6 +34,9 @@ status_t nm_crtc_validate_timing( /* if hor. total does not leave room for a sensible sync pulse, increase it! */ if (*ht < (*hd_e + 80)) *ht = (*hd_e + 80); + /* if hor. total does not adhere to max. blanking pulse width, decrease it! */ + if (*ht > (*hd_e + 0x1f8)) *ht = (*hd_e + 0x1f8); + /* make sure sync pulse is not during display */ if (*hs_e > (*ht - 8)) *hs_e = (*ht - 8); if (*hs_s < (*hd_e + 8)) *hs_s = (*hd_e + 8); @@ -68,6 +69,9 @@ status_t nm_crtc_validate_timing( /*if vertical total does not leave room for a sync pulse, increase it!*/ if (*vt < (*vd_e + 3)) *vt = (*vd_e + 3); + /* if vert. total does not adhere to max. blanking pulse width, decrease it! */ + if (*vt > (*vd_e + 0xff)) *vt = (*vd_e + 0xff); + /* make sure sync pulse is not during display */ if (*vs_e > (*vt - 1)) *vs_e = (*vt - 1); if (*vs_s < (*vd_e + 1)) *vs_s = (*vd_e + 1); diff --git a/src/add-ons/accelerants/neomagic/engine/nm_general.c b/src/add-ons/accelerants/neomagic/engine/nm_general.c index af28523ac8..fff1de8d0f 100644 --- a/src/add-ons/accelerants/neomagic/engine/nm_general.c +++ b/src/add-ons/accelerants/neomagic/engine/nm_general.c @@ -32,11 +32,11 @@ static void nm_dump_configuration_space (void) DUMP_CFG (NM_INDEX, 0); DUMP_CFG (NM_DATA, 0); DUMP_CFG (SUBSYSIDW, 0); - DUMP_CFG (OPTION2, G100); + DUMP_CFG (OPTION2, 0); DUMP_CFG (OPTION3, 0); DUMP_CFG (OPTION4, 0); - DUMP_CFG (PM_IDENT, G100); - DUMP_CFG (PM_CSR, G100); + DUMP_CFG (PM_IDENT, 0); + DUMP_CFG (PM_CSR, 0); DUMP_CFG (AGP_IDENT, 0); DUMP_CFG (AGP_STS, 0); DUMP_CFG (AGP_CMD, 0); @@ -47,7 +47,7 @@ status_t nm_general_powerup() { status_t status; - LOG(1,("POWERUP: Neomagic (open)BeOS Accelerant 0.09 running.\n")); + LOG(1,("POWERUP: Neomagic (open)BeOS Accelerant 0.10 running.\n")); /* detect card type and power it up */ switch(CFGR(DEVID))