okay I'm happy to apply the i810 portion and will do so soon, someone else
want to look after the other pieces or should I do them also?
Dave.
On Thu, 14 Aug 2003, Linus Torvalds wrote:
>
> Ok,
> I just did another kernel merge to pick up the i810 compatibility bits,
> and decided it is time to try to merge back some of the stuff that has
> accumulated in the standard kernel and that makes it more painful than
> necessary to examine the diffs for differences.
>
> This is mostly whitespace changes (some of it new from Dave Jones, some of
> it quite old), and some other minor things: moving some counter and lock
> initializations slightly earlier to where the data structure they are in
> are allocated and initialized, so that interrupts can't even by mistake
> see them partially done.
>
> It also removes the printk() for the AGP version, since that is actually
> done by the AGP layer anyway.
>
> I'd appreciate it if all (or even most) of this could find itself back
> into the DRI CVS tree, to make it easier to read the code and merge it
> (some of the whitespace fixes are literally broken whitespace in the DRI
> tree - comments that end up being in strange columns etc).
>
> Apart from moving some initializations around and the aforementioned
> printk removal, this should not actually affect semantics at all.
>
> Oh, and the thing will apply with a few offsets, since I edited the patch
> to remove stuff that you don't want at this point. My tree doesn't contain
> all of the 2.4.x compatibility crud etc.
>
> You can apply (or not apply) everything independently, so feel free to
> cherry-pick the patches. I did edit out anything that looked even remotely
> like it could cause discussion (ie this does _not_ contain the
> "cpu_relax()" stuff that I have in my tree, for example).
>
> Thanks,
>
> Linus
> -----
> diff -u --recursive /home/torvalds/dri-kernel/Kconfig ./Kconfig
> --- /home/torvalds/dri-kernel/Kconfig 2003-04-22 14:30:23.000000000 -0700
> +++ ./Kconfig 2003-08-14 13:05:45.137737925 -0700
> @@ -24,10 +24,10 @@
>
> config DRM_GAMMA
> tristate "3dlabs GMX 2000"
> - depends on DRM && n
> + depends on DRM
> help
> - This is the old gamma driver, disabled for now unless somebody
> - tells me it actually might work.
> + This is the old gamma driver, please tell me if it might actually
> + work.
>
> config DRM_R128
> tristate "ATI Rage 128"
> @@ -49,7 +49,7 @@
>
> config DRM_I810
> tristate "Intel I810"
> - depends on DRM && AGP
> + depends on DRM && AGP && AGP_INTEL
> help
> Choose this option if you have an Intel I810 graphics card. If M is
> selected, the module will be called i810. AGP support is required
> @@ -57,7 +57,7 @@
>
> config DRM_I830
> tristate "Intel 830M, 845G, 852GM, 855GM, 865G"
> - depends on DRM && AGP
> + depends on DRM && AGP && AGP_INTEL
> help
> Choose this option if you have a system that has Intel 830M, 845G,
> 852GM, 855GM or 865G integrated graphics. If M is selected, the
> @@ -72,3 +72,12 @@
> Choose this option if you have a Matrox G200, G400 or G450 graphics
> card. If M is selected, the module will be called mga. AGP
> support is required for this driver to work.
> +
> +config DRM_SIS
> + tristate "SiS video cards"
> + depends on DRM && AGP && FB_SIS
> + help
> + Choose this option if you have a SiS 630 or compatibel video
> + chipset. If M is selected the module will be called sis. AGP
> + and SiS FB support is required for this driver to work.
> +
> diff -u --recursive /home/torvalds/dri-kernel/drm_agpsupport.h ./drm_agpsupport.h
> --- /home/torvalds/dri-kernel/drm_agpsupport.h 2003-07-25 20:04:22.000000000
> -0700
> +++ ./drm_agpsupport.h 2003-08-14 13:05:45.361704630 -0700
> @@ -106,7 +105,8 @@
> if ( dev->agp->cant_use_aperture )
> return -EINVAL;
> #endif
> - if ((retcode = drm_agp->acquire())) return retcode;
> + if ((retcode = drm_agp->acquire()))
> + return retcode;
> dev->agp->acquired = 1;
> return 0;
> }
> @@ -147,7 +143,8 @@
> */
> void DRM(agp_do_release)(void)
> {
> - if (drm_agp->release) drm_agp->release();
> + if (drm_agp->release)
> + drm_agp->release();
> }
>
> /**
> @@ -201,7 +198,8 @@
> unsigned long pages;
> u32 type;
>
> - if (!dev->agp || !dev->agp->acquired) return -EINVAL;
> + if (!dev->agp || !dev->agp->acquired)
> + return -EINVAL;
> if (copy_from_user(&request, (drm_agp_buffer_t *)arg, sizeof(request)))
> return -EFAULT;
> if (!(entry = DRM(alloc)(sizeof(*entry), DRM_MEM_AGPLISTS)))
> @@ -227,11 +225,12 @@
> entry->pages = pages;
> entry->prev = NULL;
> entry->next = dev->agp->memory;
> - if (dev->agp->memory) dev->agp->memory->prev = entry;
> + if (dev->agp->memory)
> + dev->agp->memory->prev = entry;
> dev->agp->memory = entry;
>
> request.handle = entry->handle;
> - request.physical = memory->physical;
> + request.physical = memory->physical;
>
> if (copy_to_user((drm_agp_buffer_t *)arg, &request, sizeof(request))) {
> dev->agp->memory = entry->next;
> @@ -258,7 +257,8 @@
> drm_agp_mem_t *entry;
>
> for (entry = dev->agp->memory; entry; entry = entry->next) {
> - if (entry->handle == handle) return entry;
> + if (entry->handle == handle)
> + return entry;
> }
> return NULL;
> }
> @@ -284,12 +284,14 @@
> drm_agp_mem_t *entry;
> int ret;
>
> - if (!dev->agp || !dev->agp->acquired) return -EINVAL;
> + if (!dev->agp || !dev->agp->acquired)
> + return -EINVAL;
> if (copy_from_user(&request, (drm_agp_binding_t *)arg, sizeof(request)))
> return -EFAULT;
> if (!(entry = DRM(agp_lookup_entry)(dev, request.handle)))
> return -EINVAL;
> - if (!entry->bound) return -EINVAL;
> + if (!entry->bound)
> + return -EINVAL;
> ret = DRM(unbind_agp)(entry->memory);
> if (ret == 0)
> entry->bound = 0;
> @@ -325,9 +327,11 @@
> return -EFAULT;
> if (!(entry = DRM(agp_lookup_entry)(dev, request.handle)))
> return -EINVAL;
> - if (entry->bound) return -EINVAL;
> + if (entry->bound)
> + return -EINVAL;
> page = (request.offset + PAGE_SIZE - 1) / PAGE_SIZE;
> - if ((retcode = DRM(bind_agp)(entry->memory, page))) return retcode;
> + if ((retcode = DRM(bind_agp)(entry->memory, page)))
> + return retcode;
> entry->bound = dev->agp->base + (page << PAGE_SHIFT);
> DRM_DEBUG("base = 0x%lx entry->bound = 0x%lx\n",
> dev->agp->base, entry->bound);
> @@ -356,16 +360,23 @@
> drm_agp_buffer_t request;
> drm_agp_mem_t *entry;
>
> - if (!dev->agp || !dev->agp->acquired) return -EINVAL;
> + if (!dev->agp || !dev->agp->acquired)
> + return -EINVAL;
> if (copy_from_user(&request, (drm_agp_buffer_t *)arg, sizeof(request)))
> return -EFAULT;
> if (!(entry = DRM(agp_lookup_entry)(dev, request.handle)))
> return -EINVAL;
> - if (entry->bound) DRM(unbind_agp)(entry->memory);
> + if (entry->bound)
> + DRM(unbind_agp)(entry->memory);
> +
> + if (entry->prev)
> + entry->prev->next = entry->next;
> + else
> + dev->agp->memory = entry->next;
> +
> + if (entry->next)
> + entry->next->prev = entry->prev;
>
> - if (entry->prev) entry->prev->next = entry->next;
> - else dev->agp->memory = entry->next;
> - if (entry->next) entry->next->prev = entry->prev;
> DRM(free_agp)(entry->memory, entry->pages);
> DRM(free)(entry, sizeof(*entry), DRM_MEM_AGPLISTS);
> return 0;
> @@ -402,12 +413,6 @@
> head->cant_use_aperture = head->agp_info.cant_use_aperture;
> head->page_mask = head->agp_info.page_mask;
> #endif
> -
> - DRM_INFO("AGP %d.%d aperture @ 0x%08lx %ZuMB\n",
> - head->agp_info.version.major,
> - head->agp_info.version.minor,
> - head->agp_info.aper_base,
> - head->agp_info.aper_size);
> }
> return head;
> }
> @@ -426,14 +431,16 @@
> /** Calls drm_agp->allocate_memory() */
> DRM_AGP_MEM *DRM(agp_allocate_memory)(size_t pages, u32 type)
> {
> - if (!drm_agp->allocate_memory) return NULL;
> + if (!drm_agp->allocate_memory)
> + return NULL;
> return drm_agp->allocate_memory(pages, type);
> }
>
> /** Calls drm_agp->free_memory() */
> int DRM(agp_free_memory)(DRM_AGP_MEM *handle)
> {
> - if (!handle || !drm_agp->free_memory) return 0;
> + if (!handle || !drm_agp->free_memory)
> + return 0;
> drm_agp->free_memory(handle);
> return 1;
> }
> @@ -441,14 +448,16 @@
> /** Calls drm_agp->bind_memory() */
> int DRM(agp_bind_memory)(DRM_AGP_MEM *handle, off_t start)
> {
> - if (!handle || !drm_agp->bind_memory) return -EINVAL;
> + if (!handle || !drm_agp->bind_memory)
> + return -EINVAL;
> return drm_agp->bind_memory(handle, start);
> }
>
> /** Calls drm_agp->unbind_memory() */
> int DRM(agp_unbind_memory)(DRM_AGP_MEM *handle)
> {
> - if (!handle || !drm_agp->unbind_memory) return -EINVAL;
> + if (!handle || !drm_agp->unbind_memory)
> + return -EINVAL;
> return drm_agp->unbind_memory(handle);
> }
>
> diff -u --recursive /home/torvalds/dri-kernel/drm_dma.h ./drm_dma.h
> --- /home/torvalds/dri-kernel/drm_dma.h 2003-06-02 11:13:17.000000000 -0700
> +++ ./drm_dma.h 2003-08-14 13:05:45.142737181 -0700
> @@ -239,7 +238,7 @@
>
> down( &dev->struct_sem );
>
> - /* Driver must have been initialized */
> + /* Driver must have been initialized */
> if ( !dev->dev_private ) {
> up( &dev->struct_sem );
> return -EINVAL;
> diff -u --recursive /home/torvalds/dri-kernel/drm_drv.h ./drm_drv.h
> --- /home/torvalds/dri-kernel/drm_drv.h 2003-08-06 20:04:30.000000000 -0700
> +++ ./drm_drv.h 2003-08-14 13:05:45.142737181 -0700
> @@ -344,7 +344,6 @@
> dev->last_context = 0;
> dev->last_switch = 0;
> dev->last_checked = 0;
> - init_timer( &dev->timer );
> init_waitqueue_head( &dev->context_wait );
>
> dev->ctx_start = 0;
> @@ -624,6 +623,7 @@
> dev = &(DRM(device)[i]);
> memset( (void *)dev, 0, sizeof(*dev) );
> dev->count_lock = SPIN_LOCK_UNLOCKED;
> + init_timer( &dev->timer );
> sema_init( &dev->struct_sem, 1 );
>
> if ((DRM(minor)[i] = DRM(stub_register)(DRIVER_NAME, &DRM(fops),dev))
> < 0)
> diff -u --recursive /home/torvalds/dri-kernel/drm_vm.h ./drm_vm.h
> --- /home/torvalds/dri-kernel/drm_vm.h 2003-06-02 11:13:18.000000000 -0700
> +++ ./drm_vm.h 2003-08-14 13:05:45.143737033 -0700
> @@ -510,7 +509,7 @@
> if (map->size != vma->vm_end - vma->vm_start) return -EINVAL;
>
> if (!capable(CAP_SYS_ADMIN) && (map->flags & _DRM_READ_ONLY)) {
> - vma->vm_flags &= (VM_READ | VM_MAYREAD);
> + vma->vm_flags &= ~(VM_WRITE | VM_MAYWRITE);
> #if defined(__i386__) || defined(__x86_64__)
> pgprot_val(vma->vm_page_prot) &= ~_PAGE_RW;
> #else
> diff -u --recursive /home/torvalds/dri-kernel/i810_dma.c ./i810_dma.c
> --- /home/torvalds/dri-kernel/i810_dma.c 2003-08-13 20:04:10.000000000 -0700
> +++ ./i810_dma.c 2003-08-14 13:05:45.146736587 -0700
> @@ -62,7 +55,7 @@
> {
> drm_device_dma_t *dma = dev->dma;
> drm_i810_private_t *dev_priv = dev->dev_private;
> - u32 *temp = (u32 *)dev_priv->hw_status_page;
> + u32 *temp = dev_priv->hw_status_page;
> int i;
>
> DRM_DEBUG( "hw_status: Interrupt Status : %x\n", temp[0]);
> @@ -465,7 +458,7 @@
> {
>
> /* Get v1.1 init data */
> - if(copy_from_user(init, (drm_i810_pre12_init_t *)arg,
> + if (copy_from_user(init, (drm_i810_pre12_init_t *)arg,
> sizeof(drm_i810_pre12_init_t))) {
> return -EFAULT;
> }
> @@ -503,9 +496,8 @@
> int retcode = 0;
>
> /* Get only the init func */
> - if (copy_from_user(&init, (void *)arg, sizeof(drm_i810_init_func_t))) {
> + if (copy_from_user(&init, (void *)arg, sizeof(drm_i810_init_func_t)))
> return -EFAULT;
> - }
>
> switch(init.func) {
> case I810_INIT_DMA:
> @@ -515,30 +507,34 @@
> * It will someday go away.
> */
> retcode = i810_dma_init_compat(&init, arg);
> - if(retcode) {
> + if (retcode)
> return retcode;
> - }
> +
> dev_priv = DRM(alloc)(sizeof(drm_i810_private_t),
> DRM_MEM_DRIVER);
> - if(dev_priv == NULL) return -ENOMEM;
> + if (dev_priv == NULL)
> + return -ENOMEM;
> retcode = i810_dma_initialize(dev, dev_priv, &init);
> - break;
> + break;
> +
> default:
> case I810_INIT_DMA_1_4:
> DRM_INFO("Using v1.4 init.\n");
> - if(copy_from_user(&init, (drm_i810_init_t *)arg,
> + if (copy_from_user(&init, (drm_i810_init_t *)arg,
> sizeof(drm_i810_init_t))) {
> return -EFAULT;
> }
> dev_priv = DRM(alloc)(sizeof(drm_i810_private_t),
> DRM_MEM_DRIVER);
> - if(dev_priv == NULL) return -ENOMEM;
> + if (dev_priv == NULL)
> + return -ENOMEM;
> retcode = i810_dma_initialize(dev, dev_priv, &init);
> - break;
> + break;
> +
> case I810_CLEANUP_DMA:
> DRM_INFO("DMA Cleanup\n");
> retcode = i810_dma_cleanup(dev);
> - break;
> + break;
> }
>
> return retcode;
> @@ -1052,7 +1048,7 @@
> drm_device_t *dev = priv->dev;
> drm_device_dma_t *dma = dev->dma;
> drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private;
> - u32 *hw_status = (u32 *)dev_priv->hw_status_page;
> + u32 *hw_status = dev_priv->hw_status_page;
> drm_i810_sarea_t *sarea_priv = (drm_i810_sarea_t *)
> dev_priv->sarea_priv;
> drm_i810_vertex_t vertex;
> @@ -1133,7 +1129,7 @@
> drm_file_t *priv = filp->private_data;
> drm_device_t *dev = priv->dev;
> drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private;
> - u32 *hw_status = (u32 *)dev_priv->hw_status_page;
> + u32 *hw_status = dev_priv->hw_status_page;
> drm_i810_sarea_t *sarea_priv = (drm_i810_sarea_t *)
> dev_priv->sarea_priv;
>
> @@ -1149,7 +1145,7 @@
> int retcode = 0;
> drm_i810_dma_t d;
> drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private;
> - u32 *hw_status = (u32 *)dev_priv->hw_status_page;
> + u32 *hw_status = dev_priv->hw_status_page;
> drm_i810_sarea_t *sarea_priv = (drm_i810_sarea_t *)
> dev_priv->sarea_priv;
>
> @@ -1261,7 +1257,7 @@
> drm_device_t *dev = priv->dev;
> drm_device_dma_t *dma = dev->dma;
> drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private;
> - u32 *hw_status = (u32 *)dev_priv->hw_status_page;
> + u32 *hw_status = dev_priv->hw_status_page;
> drm_i810_sarea_t *sarea_priv = (drm_i810_sarea_t *)
> dev_priv->sarea_priv;
> drm_i810_mc_t mc;
> diff -u --recursive /home/torvalds/dri-kernel/i830_irq.c ./i830_irq.c
> --- /home/torvalds/dri-kernel/i830_irq.c 2003-07-29 20:05:12.000000000 -0700
> +++ ./i830_irq.c 2003-08-14 13:05:45.148736290 -0700
> @@ -186,6 +185,9 @@
> I830_WRITE16( I830REG_HWSTAM, 0xffff );
> I830_WRITE16( I830REG_INT_MASK_R, 0x0 );
> I830_WRITE16( I830REG_INT_ENABLE_R, 0x0 );
> + atomic_set(&dev_priv->irq_received, 0);
> + atomic_set(&dev_priv->irq_emitted, 0);
> + init_waitqueue_head(&dev_priv->irq_queue);
> }
>
> void DRM(driver_irq_postinstall)( drm_device_t *dev ) {
> @@ -193,9 +195,6 @@
> (drm_i830_private_t *)dev->dev_private;
>
> I830_WRITE16( I830REG_INT_ENABLE_R, 0x2 );
> - atomic_set(&dev_priv->irq_received, 0);
> - atomic_set(&dev_priv->irq_emitted, 0);
> - init_waitqueue_head(&dev_priv->irq_queue);
> }
>
> void DRM(driver_irq_uninstall)( drm_device_t *dev ) {
>
>
>
> -------------------------------------------------------
> This SF.Net email sponsored by: Free pre-built ASP.NET sites including
> Data Reports, E-commerce, Portals, and Forums are available now.
> Download today and enter to win an XBOX or Visual Studio .NET.
> http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
> _______________________________________________
> Dri-devel mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/dri-devel
>
--
David Airlie, Software Engineer
http://www.skynet.ie/~airlied / [EMAIL PROTECTED]
pam_smb / Linux DECstation / Linux VAX / ILUG person
-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
Dri-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dri-devel