Multi-head fix for tdfxfb driver (again)
PATCH 1/1 Multi-head fix for tdfxfb driver (again)
Bloody web mail. I'll try that again . . .
Hi All
This patch (against 2.6.0-test9) corrects a bug in the tdfxfb driver with regard to multi-head set-ups. The driver was stomping all over its default fb_fix_screeninfo struct (the global, tdfx_fix) when initializing a card - which could potentially causes problems when the time comes to set up the next card. This fix makes it copy tdfx_fix first and modify only that copy.
Cheers,
Rich
drivers/video/tdfxfb.c renamed from drivers/video/tdfxfb.c.orig +21 -17
@@ -1152,6 +1152,8 @@ {struct tdfx_par *default_par;struct fb_info *info; +struct fb_fix_screeninfo *fix; +int size, err;if ((err =pci_enable_device (pdev))) {
@@ -1168,28 +1170,30 @@memset (info,0 , size); default_par = (struct tdfx_par *) (info +1 ); + info->fix = tdfx_fix; + fix = &info->fix;/* Configure the default fb_fix_screeninfo first */ switch (pdev->device) {case PCI_DEVICE_ID_3DFX_BANSHEE : -strcat (tdfx_fix.id," Banshee" ); +strcat (fix->id," Banshee" ); default_par->max_pixclock =BANSHEE_MAX_PIXCLOCK ;break ;case PCI_DEVICE_ID_3DFX_VOODOO3 : -strcat (tdfx_fix.id," Voodoo3" ); +strcat (fix->id," Voodoo3" ); default_par->max_pixclock =VOODOO3_MAX_PIXCLOCK ;break ;case PCI_DEVICE_ID_3DFX_VOODOO5 : -strcat (tdfx_fix.id," Voodoo5" ); +strcat (fix->id," Voodoo5" ); default_par->max_pixclock =VOODOO5_MAX_PIXCLOCK ;break ; } - tdfx_fix.mmio_start =pci_resource_start (pdev,0 ); - tdfx_fix.mmio_len =pci_resource_len (pdev,0 ); - default_par->regbase_virt =ioremap_nocache (tdfx_fix.mmio_start, tdfx_fix.mmio_len); + fix->mmio_start =pci_resource_start (pdev,0 ); + fix->mmio_len =pci_resource_len (pdev,0 ); + default_par->regbase_virt =ioremap_nocache (fix->mmio_start, fix->mmio_len);if (!default_par->regbase_virt) { -printk ("fb: Can't remap %s register area.\n" , tdfx_fix.id); +printk ("fb: Can't remap %s register area.\n" , fix->id); goto out_err; }
@@ -1199,9 +1203,9 @@ goto out_err; } - tdfx_fix.smem_start =pci_resource_start (pdev,1 ); -if (!(tdfx_fix.smem_len =do_lfb_size (default_par, pdev->device))) { -printk ("fb: Can't count %s memory.\n" , tdfx_fix.id); + fix->smem_start =pci_resource_start (pdev,1 ); +if (!(fix->smem_len =do_lfb_size (default_par, pdev->device))) { +printk ("fb: Can't count %s memory.\n" , fix->id);release_mem_region (pci_resource_start (pdev,0 ),pci_resource_len (pdev,0 )); goto out_err;
@@ -1215,10 +1219,10 @@ goto out_err; } - info->screen_base =ioremap_nocache (tdfx_fix.smem_start, - tdfx_fix.smem_len); + info->screen_base =ioremap_nocache (fix->smem_start, + fix->smem_len);if (!info->screen_base) { -printk ("fb: Can't remap %s framebuffer.\n" , tdfx_fix.id); +printk ("fb: Can't remap %s framebuffer.\n" , fix->id);release_mem_region (pci_resource_start (pdev,1 ),pci_resource_len (pdev,1 )); release_mem_region(pci_resource_start(pdev, 0),
@@ -1238,13 +1242,13 @@ goto out_err; } -printk ("fb: %s memory = %dK\n" , tdfx_fix.id, tdfx_fix.smem_len >>10 ); +printk ("fb: %s memory = %dK\n" , fix->id, fix->smem_len >>10 ); - tdfx_fix.ypanstep = nopan ?0 :1 ; - tdfx_fix.ywrapstep = nowrap ?0 :1 ; + fix->ypanstep = nopan ?0 :1 ; + fix->ywrapstep = nowrap ?0 :1 ; info->fbops = &tdfxfb_ops; - info->fix = tdfx_fix; +/* info->fix = tdfx_fix; */ info->par = default_par; info->pseudo_palette = (void *)(default_par +1 ); info->flags =FBINFO_FLAG_DEFAULT ;