diff --git a/src/add-ons/accelerants/neomagic/engine/nm_bes.c b/src/add-ons/accelerants/neomagic/engine/nm_bes.c
index 49c2b0ba5b..f4f06cc67d 100644
--- a/src/add-ons/accelerants/neomagic/engine/nm_bes.c
+++ b/src/add-ons/accelerants/neomagic/engine/nm_bes.c
@@ -1,5 +1,5 @@
/* NeoMagic Back End Scaler functions */
-/* Written by Rudolf Cornelissen 05/2002-06/2004 */
+/* Written by Rudolf Cornelissen 05/2002-07/2004 */
#define MODULE_BIT 0x00000200
@@ -453,6 +453,9 @@ status_t nm_configure_bes
if (si->ps.card_type >= NM2097)
{
+ /* helper: some cards use pixels to define buffer pitch, others use bytes */
+ uint16 buf_pitch = ob->width;
+
/* PCI card */
LOG(4,("Overlay: accelerant is programming BES\n"));
/* unlock card overlay sequencer registers (b5 = 1) */
@@ -485,6 +488,8 @@ status_t nm_configure_bes
}
else
{
+ /* NM2200 and later cards use bytes to define buffer pitch */
+ buf_pitch <<= 1;
/* horizontal source end does not use subpixelprecision: granularity is 16 pixels */
//fixme? divide by 16 instead of 8 (if >= NM2200 owners report trouble then use 8!)
//fixme? check if overlaybuffer width should also have granularity of 16 now!
@@ -555,10 +560,10 @@ status_t nm_configure_bes
/* setup brightness to be 'neutral' (two's complement number) */
PCIGRPHW(BRIGHTNESS, 0x00);
- /* setup inputbuffer #1 pitch including slopspace (in pixels) */
+ /* setup inputbuffer #1 pitch including slopspace */
/* (we don't program the pitch for inputbuffer #2 as it's unused.) */
- PCIGRPHW(BUF1PITCHL, (ob->width & 0xff));
- PCIGRPHW(BUF1PITCHH, ((ob->width >> 8) & 0xff));
+ PCIGRPHW(BUF1PITCHL, (buf_pitch & 0xff));
+ PCIGRPHW(BUF1PITCHH, ((buf_pitch >> 8) & 0xff));
}
else
{
diff --git a/src/add-ons/kernel/drivers/graphics/neomagic/UPDATE.html b/src/add-ons/kernel/drivers/graphics/neomagic/UPDATE.html
index 83e75cece7..6469cad508 100644
--- a/src/add-ons/kernel/drivers/graphics/neomagic/UPDATE.html
+++ b/src/add-ons/kernel/drivers/graphics/neomagic/UPDATE.html
@@ -6,7 +6,8 @@
Changes done for each driverversion:
head 0.08 (Rudolf)
- - Added full 2D acceleration for all remaining cards that did not have that yet with this driver (still largely untested).
+
- Added full 2D acceleration for all remaining cards that did not have that yet with this driver (still largely untested);
+
- Fixed a long standing problem with MagicMedia (all NM2200 and later) cards with overlay: buffer width is programmed correctly now. Can't believe I didn't see that before!
nm_driver 0.06 (Rudolf)
diff --git a/src/add-ons/kernel/drivers/graphics/neomagic/driver.c b/src/add-ons/kernel/drivers/graphics/neomagic/driver.c
index 192f830c54..e479a3d977 100644
--- a/src/add-ons/kernel/drivers/graphics/neomagic/driver.c
+++ b/src/add-ons/kernel/drivers/graphics/neomagic/driver.c
@@ -5,7 +5,7 @@
Other authors:
Mark Watson;
Apsed;
- Rudolf Cornelissen 5/2002-6/2004.
+ Rudolf Cornelissen 5/2002-7/2004.
*/
/* standard kernel driver stuff */
@@ -182,7 +182,10 @@ init_hardware(void) {
/* choke if we can't find the ISA bus */
if (get_module(B_ISA_MODULE_NAME, (module_info **)&isa_bus) != B_OK)
+ {
+ put_module(B_PCI_MODULE_NAME);
return B_ERROR;
+ }
/* while there are more pci devices */
while ((*pci_bus->get_nth_pci_info)(pci_index, &pcii) == B_NO_ERROR) {
@@ -257,7 +260,10 @@ init_driver(void) {
/* get a handle for the isa bus */
if (get_module(B_ISA_MODULE_NAME, (module_info **)&isa_bus) != B_OK)
+ {
+ put_module(B_PCI_MODULE_NAME);
return B_ERROR;
+ }
/* driver private data */
pd = (DeviceData *)calloc(1, sizeof(DeviceData));
@@ -911,6 +917,9 @@ void drv_program_bes_ISA(nm_bes_data *bes)
{
uint8 temp;
+ /* helper: some cards use pixels to define buffer pitch, others use bytes */
+ uint16 buf_pitch = bes->ob_width;
+
/* ISA card */
/* unlock card overlay sequencer registers (b5 = 1) */
temp = (KISAGRPHR(GENLOCK) | 0x20);
@@ -945,6 +954,8 @@ void drv_program_bes_ISA(nm_bes_data *bes)
}
else
{
+ /* NM2200 and later cards use bytes to define buffer pitch */
+ buf_pitch <<= 1;
/* horizontal source end does not use subpixelprecision: granularity is 16 pixels */
//fixme? divide by 16 instead of 8 (if >= NM2200 owners report trouble then use 8!)
//fixme? check if overlaybuffer width should also have granularity of 16 now!
@@ -1015,8 +1026,8 @@ void drv_program_bes_ISA(nm_bes_data *bes)
/* setup brightness to be 'neutral' (two's complement number) */
KISAGRPHW(BRIGHTNESS, 0x00);
- /* setup inputbuffer #1 pitch including slopspace (in pixels) */
+ /* setup inputbuffer #1 pitch including slopspace */
/* (we don't program the pitch for inputbuffer #2 as it's unused.) */
- KISAGRPHW(BUF1PITCHL, (bes->ob_width & 0xff));
- KISAGRPHW(BUF1PITCHH, ((bes->ob_width >> 8) & 0xff));
+ KISAGRPHW(BUF1PITCHL, (buf_pitch & 0xff));
+ KISAGRPHW(BUF1PITCHH, ((buf_pitch >> 8) & 0xff));
}