diff options
author | Michel Daenzer <michel@daenzer.net> | 2003-08-15 10:31:54 +0000 |
---|---|---|
committer | Michel Daenzer <michel@daenzer.net> | 2003-08-15 10:31:54 +0000 |
commit | 9d7b01ebbe71ff6ca3ea421d5bff64f403b592ba (patch) | |
tree | 8f5d66868305facceb7d0ecdde93c5569c8b5a53 | |
parent | a073ff7dc73dc98e81e2ae26e8c500ea7141084b (diff) |
Merge from 2.6 kernel (Linus Torvalds)
-rw-r--r-- | linux-core/Kconfig | 19 | ||||
-rw-r--r-- | linux-core/drm_agpsupport.c | 64 | ||||
-rw-r--r-- | linux-core/drm_dma.c | 2 | ||||
-rw-r--r-- | linux-core/drm_drv.c | 2 | ||||
-rw-r--r-- | linux-core/drm_vm.c | 2 | ||||
-rw-r--r-- | linux/Kconfig | 19 | ||||
-rw-r--r-- | linux/drm_agpsupport.h | 64 | ||||
-rw-r--r-- | linux/drm_dma.h | 2 | ||||
-rw-r--r-- | linux/drm_drv.h | 2 | ||||
-rw-r--r-- | linux/drm_vm.h | 2 |
10 files changed, 112 insertions, 66 deletions
diff --git a/linux-core/Kconfig b/linux-core/Kconfig index 994371de..d0358e95 100644 --- a/linux-core/Kconfig +++ b/linux-core/Kconfig @@ -24,10 +24,10 @@ config DRM_TDFX 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_RADEON 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_I810 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 @@ config DRM_MGA 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 --git a/linux-core/drm_agpsupport.c b/linux-core/drm_agpsupport.c index a8f6197b..0f281b57 100644 --- a/linux-core/drm_agpsupport.c +++ b/linux-core/drm_agpsupport.c @@ -110,7 +110,8 @@ int DRM(agp_acquire)(struct inode *inode, struct file *filp, 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 +148,8 @@ int DRM(agp_release)(struct inode *inode, struct file *filp, */ void DRM(agp_do_release)(void) { - if (drm_agp->release) drm_agp->release(); + if (drm_agp->release) + drm_agp->release(); } /** @@ -205,7 +207,8 @@ int DRM(agp_alloc)(struct inode *inode, struct file *filp, 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 +230,12 @@ int DRM(agp_alloc)(struct inode *inode, struct file *filp, 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 +262,8 @@ static drm_agp_mem_t *DRM(agp_lookup_entry)(drm_device_t *dev, 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 +289,14 @@ int DRM(agp_unbind)(struct inode *inode, struct file *filp, 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 +332,11 @@ int DRM(agp_bind)(struct inode *inode, struct file *filp, 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 +365,23 @@ int DRM(agp_free)(struct inode *inode, struct file *filp, 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 +418,6 @@ drm_agp_head_t *DRM(agp_init)(void) 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 +436,16 @@ void DRM(agp_uninit)(void) /** 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 +453,16 @@ int DRM(agp_free_memory)(DRM_AGP_MEM *handle) /** 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 --git a/linux-core/drm_dma.c b/linux-core/drm_dma.c index 8e0ec95e..aef84d4e 100644 --- a/linux-core/drm_dma.c +++ b/linux-core/drm_dma.c @@ -239,7 +239,7 @@ int DRM(irq_install)( drm_device_t *dev, int irq ) 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 --git a/linux-core/drm_drv.c b/linux-core/drm_drv.c index 5f3eebe3..d62156b3 100644 --- a/linux-core/drm_drv.c +++ b/linux-core/drm_drv.c @@ -344,7 +344,6 @@ static int DRM(setup)( drm_device_t *dev ) 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 @@ static int __init drm_init( void ) 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 --git a/linux-core/drm_vm.c b/linux-core/drm_vm.c index c1dfb377..29cad56d 100644 --- a/linux-core/drm_vm.c +++ b/linux-core/drm_vm.c @@ -510,7 +510,7 @@ int DRM(mmap)(struct file *filp, struct vm_area_struct *vma) 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 --git a/linux/Kconfig b/linux/Kconfig index 994371de..d0358e95 100644 --- a/linux/Kconfig +++ b/linux/Kconfig @@ -24,10 +24,10 @@ config DRM_TDFX 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_RADEON 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_I810 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 @@ config DRM_MGA 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 --git a/linux/drm_agpsupport.h b/linux/drm_agpsupport.h index a8f6197b..0f281b57 100644 --- a/linux/drm_agpsupport.h +++ b/linux/drm_agpsupport.h @@ -110,7 +110,8 @@ int DRM(agp_acquire)(struct inode *inode, struct file *filp, 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 +148,8 @@ int DRM(agp_release)(struct inode *inode, struct file *filp, */ void DRM(agp_do_release)(void) { - if (drm_agp->release) drm_agp->release(); + if (drm_agp->release) + drm_agp->release(); } /** @@ -205,7 +207,8 @@ int DRM(agp_alloc)(struct inode *inode, struct file *filp, 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 +230,12 @@ int DRM(agp_alloc)(struct inode *inode, struct file *filp, 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 +262,8 @@ static drm_agp_mem_t *DRM(agp_lookup_entry)(drm_device_t *dev, 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 +289,14 @@ int DRM(agp_unbind)(struct inode *inode, struct file *filp, 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 +332,11 @@ int DRM(agp_bind)(struct inode *inode, struct file *filp, 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 +365,23 @@ int DRM(agp_free)(struct inode *inode, struct file *filp, 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 +418,6 @@ drm_agp_head_t *DRM(agp_init)(void) 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 +436,16 @@ void DRM(agp_uninit)(void) /** 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 +453,16 @@ int DRM(agp_free_memory)(DRM_AGP_MEM *handle) /** 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 --git a/linux/drm_dma.h b/linux/drm_dma.h index 8e0ec95e..aef84d4e 100644 --- a/linux/drm_dma.h +++ b/linux/drm_dma.h @@ -239,7 +239,7 @@ int DRM(irq_install)( drm_device_t *dev, int irq ) 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 --git a/linux/drm_drv.h b/linux/drm_drv.h index 5f3eebe3..d62156b3 100644 --- a/linux/drm_drv.h +++ b/linux/drm_drv.h @@ -344,7 +344,6 @@ static int DRM(setup)( drm_device_t *dev ) 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 @@ static int __init drm_init( void ) 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 --git a/linux/drm_vm.h b/linux/drm_vm.h index c1dfb377..29cad56d 100644 --- a/linux/drm_vm.h +++ b/linux/drm_vm.h @@ -510,7 +510,7 @@ int DRM(mmap)(struct file *filp, struct vm_area_struct *vma) 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 |