fixed NM2200 and later cards overlay bug, fixed kernel driver not always putting away the PCI busmanager. Note that overlay may still not work OK, but we are now one step closer to finding the solution!

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8513 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Rudolf Cornelissen
2004-07-29 18:55:54 +00:00
parent 37a348ee2c
commit e49a28cd50
3 changed files with 26 additions and 9 deletions
@@ -1,5 +1,5 @@
/* NeoMagic Back End Scaler functions */ /* 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 #define MODULE_BIT 0x00000200
@@ -453,6 +453,9 @@ status_t nm_configure_bes
if (si->ps.card_type >= NM2097) 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 */ /* PCI card */
LOG(4,("Overlay: accelerant is programming BES\n")); LOG(4,("Overlay: accelerant is programming BES\n"));
/* unlock card overlay sequencer registers (b5 = 1) */ /* unlock card overlay sequencer registers (b5 = 1) */
@@ -485,6 +488,8 @@ status_t nm_configure_bes
} }
else 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 */ /* 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? 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! //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) */ /* setup brightness to be 'neutral' (two's complement number) */
PCIGRPHW(BRIGHTNESS, 0x00); 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.) */ /* (we don't program the pitch for inputbuffer #2 as it's unused.) */
PCIGRPHW(BUF1PITCHL, (ob->width & 0xff)); PCIGRPHW(BUF1PITCHL, (buf_pitch & 0xff));
PCIGRPHW(BUF1PITCHH, ((ob->width >> 8) & 0xff)); PCIGRPHW(BUF1PITCHH, ((buf_pitch >> 8) & 0xff));
} }
else else
{ {
@@ -6,7 +6,8 @@
<p><h2>Changes done for each driverversion:</h2></p> <p><h2>Changes done for each driverversion:</h2></p>
<p><h1>head 0.08 (Rudolf)</h1></p> <p><h1>head 0.08 (Rudolf)</h1></p>
<ul> <ul>
<li>Added full 2D acceleration for all remaining cards that did not have that yet with this driver (still largely untested). <li>Added full 2D acceleration for all remaining cards that did not have that yet with this driver (still largely untested);
<li>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!
</ul> </ul>
<p><h1>nm_driver 0.06 (Rudolf)</h1></p> <p><h1>nm_driver 0.06 (Rudolf)</h1></p>
<ul> <ul>
@@ -5,7 +5,7 @@
Other authors: Other authors:
Mark Watson; Mark Watson;
Apsed; Apsed;
Rudolf Cornelissen 5/2002-6/2004. Rudolf Cornelissen 5/2002-7/2004.
*/ */
/* standard kernel driver stuff */ /* standard kernel driver stuff */
@@ -182,7 +182,10 @@ init_hardware(void) {
/* choke if we can't find the ISA bus */ /* choke if we can't find the ISA bus */
if (get_module(B_ISA_MODULE_NAME, (module_info **)&isa_bus) != B_OK) if (get_module(B_ISA_MODULE_NAME, (module_info **)&isa_bus) != B_OK)
{
put_module(B_PCI_MODULE_NAME);
return B_ERROR; return B_ERROR;
}
/* while there are more pci devices */ /* while there are more pci devices */
while ((*pci_bus->get_nth_pci_info)(pci_index, &pcii) == B_NO_ERROR) { 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 */ /* get a handle for the isa bus */
if (get_module(B_ISA_MODULE_NAME, (module_info **)&isa_bus) != B_OK) if (get_module(B_ISA_MODULE_NAME, (module_info **)&isa_bus) != B_OK)
{
put_module(B_PCI_MODULE_NAME);
return B_ERROR; return B_ERROR;
}
/* driver private data */ /* driver private data */
pd = (DeviceData *)calloc(1, sizeof(DeviceData)); pd = (DeviceData *)calloc(1, sizeof(DeviceData));
@@ -911,6 +917,9 @@ void drv_program_bes_ISA(nm_bes_data *bes)
{ {
uint8 temp; uint8 temp;
/* helper: some cards use pixels to define buffer pitch, others use bytes */
uint16 buf_pitch = bes->ob_width;
/* ISA card */ /* ISA card */
/* unlock card overlay sequencer registers (b5 = 1) */ /* unlock card overlay sequencer registers (b5 = 1) */
temp = (KISAGRPHR(GENLOCK) | 0x20); temp = (KISAGRPHR(GENLOCK) | 0x20);
@@ -945,6 +954,8 @@ void drv_program_bes_ISA(nm_bes_data *bes)
} }
else 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 */ /* 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? 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! //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) */ /* setup brightness to be 'neutral' (two's complement number) */
KISAGRPHW(BRIGHTNESS, 0x00); 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.) */ /* (we don't program the pitch for inputbuffer #2 as it's unused.) */
KISAGRPHW(BUF1PITCHL, (bes->ob_width & 0xff)); KISAGRPHW(BUF1PITCHL, (buf_pitch & 0xff));
KISAGRPHW(BUF1PITCHH, ((bes->ob_width >> 8) & 0xff)); KISAGRPHW(BUF1PITCHH, ((buf_pitch >> 8) & 0xff));
} }