Sync with Linux 2.4.0-test6-pre2
parent
bcad118182
commit
f3ae6786f8
|
@ -2,39 +2,38 @@
|
||||||
# Makefile for the drm device driver. This driver provides support for
|
# Makefile for the drm device driver. This driver provides support for
|
||||||
# the Direct Rendering Infrastructure (DRI) in XFree86 4.x.
|
# the Direct Rendering Infrastructure (DRI) in XFree86 4.x.
|
||||||
#
|
#
|
||||||
# Note! Dependencies are done automagically by 'make dep', which also
|
|
||||||
# removes any old dependencies. DON'T put your own dependencies here
|
|
||||||
# unless it's something special (ie not a .c file).
|
|
||||||
#
|
|
||||||
# Note 2! The CFLAGS definitions are now inherited from the
|
|
||||||
# parent makes..
|
|
||||||
#
|
|
||||||
|
|
||||||
O_OBJS :=
|
|
||||||
OX_OBJS :=
|
|
||||||
M_OBJS :=
|
|
||||||
MX_OBJS :=
|
|
||||||
|
|
||||||
# Object file lists.
|
|
||||||
|
|
||||||
obj-y :=
|
|
||||||
obj-m :=
|
|
||||||
obj-n :=
|
|
||||||
obj- :=
|
|
||||||
|
|
||||||
SUB_DIRS :=
|
|
||||||
MOD_SUB_DIRS := $(SUB_DIRS)
|
|
||||||
ALL_SUB_DIRS := $(SUB_DIRS)
|
|
||||||
|
|
||||||
|
# drm.o is a fake target -- it is never built
|
||||||
|
# The real targets are in the module-list
|
||||||
O_TARGET := drm.o
|
O_TARGET := drm.o
|
||||||
module-list := gamma.o tdfx.o r128.o ffb.o mga.o i810.o
|
module-list := gamma.o tdfx.o r128.o ffb.o mga.o i810.o
|
||||||
export-objs := $(patsubst %.o,%_drv.o,$(module-list))
|
export-objs := $(patsubst %.o,%_drv.o,$(module-list))
|
||||||
|
|
||||||
|
# libs-objs are included in every module so that radical changes to the
|
||||||
|
# architecture of the DRM support library can be made at a later time.
|
||||||
|
#
|
||||||
|
# The downside is that each module is larger, and a system that uses
|
||||||
|
# more than one module (i.e., a dual-head system) will use more memory
|
||||||
|
# (but a system that uses exactly one module will use the same amount of
|
||||||
|
# memory).
|
||||||
|
#
|
||||||
|
# The upside is that if the DRM support library ever becomes insufficient
|
||||||
|
# for new families of cards, a new library can be implemented for those new
|
||||||
|
# cards without impacting the drivers for the old cards. This is significant,
|
||||||
|
# because testing architectural changes to old cards may be impossible, and
|
||||||
|
# may delay the implementation of a better architecture. We've traded slight
|
||||||
|
# memory waste (in the dual-head case) for greatly improved long-term
|
||||||
|
# maintainability.
|
||||||
|
#
|
||||||
lib-objs := init.o memory.o proc.o auth.o context.o drawable.o bufs.o
|
lib-objs := init.o memory.o proc.o auth.o context.o drawable.o bufs.o
|
||||||
lib-objs += lists.o lock.o ioctl.o fops.o vm.o dma.o ctxbitmap.o
|
lib-objs += lists.o lock.o ioctl.o fops.o vm.o dma.o ctxbitmap.o
|
||||||
|
|
||||||
ifneq ($(CONFIG_AGP),)
|
ifeq ($(CONFIG_AGP),y)
|
||||||
lib-objs += agpsupport.o
|
lib-objs += agpsupport.o
|
||||||
|
else
|
||||||
|
ifeq ($(CONFIG_AGP),m)
|
||||||
|
lib-objs += agpsupport.o
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
gamma-objs := $(lib-objs) gamma_drv.o gamma_dma.o
|
gamma-objs := $(lib-objs) gamma_drv.o gamma_dma.o
|
||||||
|
@ -71,19 +70,19 @@ MIX_OBJS := $(sort $(filter $(export-objs), $(int-m)))
|
||||||
include $(TOPDIR)/Rules.make
|
include $(TOPDIR)/Rules.make
|
||||||
|
|
||||||
gamma.o: $(gamma-objs)
|
gamma.o: $(gamma-objs)
|
||||||
$(LD) $(LD_RFLAG) -r -o $@ $(gamma-objs)
|
$(LD) -r -o $@ $(gamma-objs)
|
||||||
|
|
||||||
tdfx.o: $(tdfx-objs)
|
tdfx.o: $(tdfx-objs)
|
||||||
$(LD) $(LD_RFLAG) -r -o $@ $(tdfx-objs)
|
$(LD) -r -o $@ $(tdfx-objs)
|
||||||
|
|
||||||
mga.o: $(mga-objs)
|
mga.o: $(mga-objs)
|
||||||
$(LD) $(LD_RFLAG) -r -o $@ $(mga-objs)
|
$(LD) -r -o $@ $(mga-objs)
|
||||||
|
|
||||||
i810.o: $(i810-objs)
|
i810.o: $(i810-objs)
|
||||||
$(LD) $(LD_RFLAG) -r -o $@ $(i810-objs)
|
$(LD) -r -o $@ $(i810-objs)
|
||||||
|
|
||||||
r128.o: $(r128-objs)
|
r128.o: $(r128-objs)
|
||||||
$(LD) $(LD_RFLAG) -r -o $@ $(r128-objs)
|
$(LD) -r -o $@ $(r128-objs)
|
||||||
|
|
||||||
ffb.o: $(ffb-objs)
|
ffb.o: $(ffb-objs)
|
||||||
$(LD) $(LD_RFLAG) -r -o $@ $(ffb-objs)
|
$(LD) -r -o $@ $(ffb-objs)
|
||||||
|
|
|
@ -44,6 +44,8 @@
|
||||||
#include <linux/pci.h>
|
#include <linux/pci.h>
|
||||||
#include <linux/wrapper.h>
|
#include <linux/wrapper.h>
|
||||||
#include <linux/version.h>
|
#include <linux/version.h>
|
||||||
|
#include <linux/sched.h>
|
||||||
|
#include <linux/smp_lock.h> /* For (un)lock_kernel */
|
||||||
#include <asm/io.h>
|
#include <asm/io.h>
|
||||||
#include <asm/mman.h>
|
#include <asm/mman.h>
|
||||||
#include <asm/uaccess.h>
|
#include <asm/uaccess.h>
|
||||||
|
@ -51,9 +53,6 @@
|
||||||
#include <asm/mtrr.h>
|
#include <asm/mtrr.h>
|
||||||
#endif
|
#endif
|
||||||
#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE)
|
#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE)
|
||||||
#define DRM_AGP
|
|
||||||
#endif
|
|
||||||
#ifdef DRM_AGP
|
|
||||||
#include <linux/types.h>
|
#include <linux/types.h>
|
||||||
#include <linux/agp_backend.h>
|
#include <linux/agp_backend.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -410,7 +409,7 @@ typedef struct drm_device_dma {
|
||||||
wait_queue_head_t waiting; /* Processes waiting on free bufs */
|
wait_queue_head_t waiting; /* Processes waiting on free bufs */
|
||||||
} drm_device_dma_t;
|
} drm_device_dma_t;
|
||||||
|
|
||||||
#ifdef DRM_AGP
|
#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE)
|
||||||
typedef struct drm_agp_mem {
|
typedef struct drm_agp_mem {
|
||||||
unsigned long handle;
|
unsigned long handle;
|
||||||
agp_memory *memory;
|
agp_memory *memory;
|
||||||
|
@ -499,9 +498,9 @@ typedef struct drm_device {
|
||||||
|
|
||||||
/* Context support */
|
/* Context support */
|
||||||
int irq; /* Interrupt used by board */
|
int irq; /* Interrupt used by board */
|
||||||
__volatile__ int context_flag; /* Context swapping flag */
|
__volatile__ long context_flag; /* Context swapping flag */
|
||||||
__volatile__ int interrupt_flag;/* Interruption handler flag */
|
__volatile__ long interrupt_flag; /* Interruption handler flag */
|
||||||
__volatile__ int dma_flag; /* DMA dispatch flag */
|
__volatile__ long dma_flag; /* DMA dispatch flag */
|
||||||
struct timer_list timer; /* Timer for delaying ctx switch */
|
struct timer_list timer; /* Timer for delaying ctx switch */
|
||||||
wait_queue_head_t context_wait; /* Processes waiting on ctx switch */
|
wait_queue_head_t context_wait; /* Processes waiting on ctx switch */
|
||||||
int last_checked; /* Last context checked for DMA */
|
int last_checked; /* Last context checked for DMA */
|
||||||
|
@ -524,7 +523,7 @@ typedef struct drm_device {
|
||||||
wait_queue_head_t buf_readers; /* Processes waiting to read */
|
wait_queue_head_t buf_readers; /* Processes waiting to read */
|
||||||
wait_queue_head_t buf_writers; /* Processes waiting to ctx switch */
|
wait_queue_head_t buf_writers; /* Processes waiting to ctx switch */
|
||||||
|
|
||||||
#ifdef DRM_AGP
|
#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE)
|
||||||
drm_agp_head_t *agp;
|
drm_agp_head_t *agp;
|
||||||
#endif
|
#endif
|
||||||
unsigned long *ctx_bitmap;
|
unsigned long *ctx_bitmap;
|
||||||
|
@ -601,7 +600,7 @@ extern void drm_free_pages(unsigned long address, int order,
|
||||||
extern void *drm_ioremap(unsigned long offset, unsigned long size);
|
extern void *drm_ioremap(unsigned long offset, unsigned long size);
|
||||||
extern void drm_ioremapfree(void *pt, unsigned long size);
|
extern void drm_ioremapfree(void *pt, unsigned long size);
|
||||||
|
|
||||||
#ifdef DRM_AGP
|
#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE)
|
||||||
extern agp_memory *drm_alloc_agp(int pages, u32 type);
|
extern agp_memory *drm_alloc_agp(int pages, u32 type);
|
||||||
extern int drm_free_agp(agp_memory *handle, int pages);
|
extern int drm_free_agp(agp_memory *handle, int pages);
|
||||||
extern int drm_bind_agp(agp_memory *handle, unsigned int start);
|
extern int drm_bind_agp(agp_memory *handle, unsigned int start);
|
||||||
|
@ -644,7 +643,6 @@ extern void drm_free_buffer(drm_device_t *dev, drm_buf_t *buf);
|
||||||
extern void drm_reclaim_buffers(drm_device_t *dev, pid_t pid);
|
extern void drm_reclaim_buffers(drm_device_t *dev, pid_t pid);
|
||||||
extern int drm_context_switch(drm_device_t *dev, int old, int new);
|
extern int drm_context_switch(drm_device_t *dev, int old, int new);
|
||||||
extern int drm_context_switch_complete(drm_device_t *dev, int new);
|
extern int drm_context_switch_complete(drm_device_t *dev, int new);
|
||||||
extern void drm_wakeup(drm_device_t *dev, drm_buf_t *buf);
|
|
||||||
extern void drm_clear_next_buffer(drm_device_t *dev);
|
extern void drm_clear_next_buffer(drm_device_t *dev);
|
||||||
extern int drm_select_queue(drm_device_t *dev,
|
extern int drm_select_queue(drm_device_t *dev,
|
||||||
void (*wrapper)(unsigned long));
|
void (*wrapper)(unsigned long));
|
||||||
|
@ -725,7 +723,7 @@ extern void drm_ctxbitmap_cleanup(drm_device_t *dev);
|
||||||
extern int drm_ctxbitmap_next(drm_device_t *dev);
|
extern int drm_ctxbitmap_next(drm_device_t *dev);
|
||||||
extern void drm_ctxbitmap_free(drm_device_t *dev, int ctx_handle);
|
extern void drm_ctxbitmap_free(drm_device_t *dev, int ctx_handle);
|
||||||
|
|
||||||
#ifdef DRM_AGP
|
#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE)
|
||||||
/* AGP/GART support (agpsupport.c) */
|
/* AGP/GART support (agpsupport.c) */
|
||||||
extern drm_agp_head_t *drm_agp_init(void);
|
extern drm_agp_head_t *drm_agp_init(void);
|
||||||
extern void drm_agp_uninit(void);
|
extern void drm_agp_uninit(void);
|
||||||
|
|
|
@ -33,7 +33,6 @@
|
||||||
#define __NO_VERSION__
|
#define __NO_VERSION__
|
||||||
#include "drmP.h"
|
#include "drmP.h"
|
||||||
#include "i810_drv.h"
|
#include "i810_drv.h"
|
||||||
|
|
||||||
#include <linux/interrupt.h> /* For task queue support */
|
#include <linux/interrupt.h> /* For task queue support */
|
||||||
|
|
||||||
/* in case we don't have a 2.3.99-pre6 kernel or later: */
|
/* in case we don't have a 2.3.99-pre6 kernel or later: */
|
||||||
|
@ -157,15 +156,22 @@ static struct file_operations i810_buffer_fops = {
|
||||||
int i810_mmap_buffers(struct file *filp, struct vm_area_struct *vma)
|
int i810_mmap_buffers(struct file *filp, struct vm_area_struct *vma)
|
||||||
{
|
{
|
||||||
drm_file_t *priv = filp->private_data;
|
drm_file_t *priv = filp->private_data;
|
||||||
drm_device_t *dev = priv->dev;
|
drm_device_t *dev;
|
||||||
drm_i810_private_t *dev_priv = dev->dev_private;
|
drm_i810_private_t *dev_priv;
|
||||||
drm_buf_t *buf = dev_priv->mmap_buffer;
|
drm_buf_t *buf;
|
||||||
drm_i810_buf_priv_t *buf_priv = buf->dev_private;
|
drm_i810_buf_priv_t *buf_priv;
|
||||||
|
|
||||||
|
lock_kernel();
|
||||||
|
dev = priv->dev;
|
||||||
|
dev_priv = dev->dev_private;
|
||||||
|
buf = dev_priv->mmap_buffer;
|
||||||
|
buf_priv = buf->dev_private;
|
||||||
|
|
||||||
vma->vm_flags |= (VM_IO | VM_DONTCOPY);
|
vma->vm_flags |= (VM_IO | VM_DONTCOPY);
|
||||||
vma->vm_file = filp;
|
vma->vm_file = filp;
|
||||||
|
|
||||||
buf_priv->currently_mapped = I810_BUF_MAPPED;
|
buf_priv->currently_mapped = I810_BUF_MAPPED;
|
||||||
|
unlock_kernel();
|
||||||
|
|
||||||
if (remap_page_range(vma->vm_start,
|
if (remap_page_range(vma->vm_start,
|
||||||
VM_OFFSET(vma),
|
VM_OFFSET(vma),
|
||||||
|
|
|
@ -30,16 +30,9 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <linux/config.h>
|
#include <linux/config.h>
|
||||||
#ifndef EXPORT_SYMTAB
|
|
||||||
#define EXPORT_SYMTAB
|
|
||||||
#endif
|
|
||||||
#include "drmP.h"
|
#include "drmP.h"
|
||||||
#include "i810_drv.h"
|
#include "i810_drv.h"
|
||||||
|
|
||||||
|
|
||||||
EXPORT_SYMBOL(i810_init);
|
|
||||||
EXPORT_SYMBOL(i810_cleanup);
|
|
||||||
|
|
||||||
#define I810_NAME "i810"
|
#define I810_NAME "i810"
|
||||||
#define I810_DESC "Intel I810"
|
#define I810_DESC "Intel I810"
|
||||||
#define I810_DATE "20000719"
|
#define I810_DATE "20000719"
|
||||||
|
@ -132,9 +125,6 @@ MODULE_AUTHOR("VA Linux Systems, Inc.");
|
||||||
MODULE_DESCRIPTION("Intel I810");
|
MODULE_DESCRIPTION("Intel I810");
|
||||||
MODULE_PARM(i810, "s");
|
MODULE_PARM(i810, "s");
|
||||||
|
|
||||||
module_init(i810_init);
|
|
||||||
module_exit(i810_cleanup);
|
|
||||||
|
|
||||||
#ifndef MODULE
|
#ifndef MODULE
|
||||||
/* i810_options is called by the kernel to parse command-line options
|
/* i810_options is called by the kernel to parse command-line options
|
||||||
* passed via the boot-loader (e.g., LILO). It calls the insmod option
|
* passed via the boot-loader (e.g., LILO). It calls the insmod option
|
||||||
|
@ -348,7 +338,7 @@ static int i810_takedown(drm_device_t *dev)
|
||||||
/* i810_init is called via init_module at module load time, or via
|
/* i810_init is called via init_module at module load time, or via
|
||||||
* linux/init/main.c (this is not currently supported). */
|
* linux/init/main.c (this is not currently supported). */
|
||||||
|
|
||||||
int i810_init(void)
|
static int i810_init(void)
|
||||||
{
|
{
|
||||||
int retcode;
|
int retcode;
|
||||||
drm_device_t *dev = &i810_device;
|
drm_device_t *dev = &i810_device;
|
||||||
|
@ -407,7 +397,7 @@ int i810_init(void)
|
||||||
|
|
||||||
/* i810_cleanup is called via cleanup_module at module unload time. */
|
/* i810_cleanup is called via cleanup_module at module unload time. */
|
||||||
|
|
||||||
void i810_cleanup(void)
|
static void i810_cleanup(void)
|
||||||
{
|
{
|
||||||
drm_device_t *dev = &i810_device;
|
drm_device_t *dev = &i810_device;
|
||||||
|
|
||||||
|
@ -428,6 +418,10 @@ void i810_cleanup(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
module_init(i810_init);
|
||||||
|
module_exit(i810_cleanup);
|
||||||
|
|
||||||
|
|
||||||
int i810_version(struct inode *inode, struct file *filp, unsigned int cmd,
|
int i810_version(struct inode *inode, struct file *filp, unsigned int cmd,
|
||||||
unsigned long arg)
|
unsigned long arg)
|
||||||
{
|
{
|
||||||
|
@ -469,7 +463,9 @@ int i810_open(struct inode *inode, struct file *filp)
|
||||||
|
|
||||||
DRM_DEBUG("open_count = %d\n", dev->open_count);
|
DRM_DEBUG("open_count = %d\n", dev->open_count);
|
||||||
if (!(retcode = drm_open_helper(inode, filp, dev))) {
|
if (!(retcode = drm_open_helper(inode, filp, dev))) {
|
||||||
MOD_INC_USE_COUNT;
|
#if LINUX_VERSION_CODE < 0x020333
|
||||||
|
MOD_INC_USE_COUNT; /* Needed before Linux 2.3.51 */
|
||||||
|
#endif
|
||||||
atomic_inc(&dev->total_open);
|
atomic_inc(&dev->total_open);
|
||||||
spin_lock(&dev->count_lock);
|
spin_lock(&dev->count_lock);
|
||||||
if (!dev->open_count++) {
|
if (!dev->open_count++) {
|
||||||
|
@ -484,9 +480,11 @@ int i810_open(struct inode *inode, struct file *filp)
|
||||||
int i810_release(struct inode *inode, struct file *filp)
|
int i810_release(struct inode *inode, struct file *filp)
|
||||||
{
|
{
|
||||||
drm_file_t *priv = filp->private_data;
|
drm_file_t *priv = filp->private_data;
|
||||||
drm_device_t *dev = priv->dev;
|
drm_device_t *dev;
|
||||||
int retcode = 0;
|
int retcode = 0;
|
||||||
|
|
||||||
|
lock_kernel();
|
||||||
|
dev = priv->dev;
|
||||||
DRM_DEBUG("pid = %d, device = 0x%x, open_count = %d\n",
|
DRM_DEBUG("pid = %d, device = 0x%x, open_count = %d\n",
|
||||||
current->pid, dev->device, dev->open_count);
|
current->pid, dev->device, dev->open_count);
|
||||||
|
|
||||||
|
@ -548,7 +546,9 @@ int i810_release(struct inode *inode, struct file *filp)
|
||||||
up(&dev->struct_sem);
|
up(&dev->struct_sem);
|
||||||
|
|
||||||
drm_free(priv, sizeof(*priv), DRM_MEM_FILES);
|
drm_free(priv, sizeof(*priv), DRM_MEM_FILES);
|
||||||
MOD_DEC_USE_COUNT;
|
#if LINUX_VERSION_CODE < 0x020333
|
||||||
|
MOD_DEC_USE_COUNT; /* Needed before Linux 2.3.51 */
|
||||||
|
#endif
|
||||||
atomic_inc(&dev->total_close);
|
atomic_inc(&dev->total_close);
|
||||||
spin_lock(&dev->count_lock);
|
spin_lock(&dev->count_lock);
|
||||||
if (!--dev->open_count) {
|
if (!--dev->open_count) {
|
||||||
|
@ -557,12 +557,15 @@ int i810_release(struct inode *inode, struct file *filp)
|
||||||
atomic_read(&dev->ioctl_count),
|
atomic_read(&dev->ioctl_count),
|
||||||
dev->blocked);
|
dev->blocked);
|
||||||
spin_unlock(&dev->count_lock);
|
spin_unlock(&dev->count_lock);
|
||||||
|
unlock_kernel();
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
}
|
}
|
||||||
spin_unlock(&dev->count_lock);
|
spin_unlock(&dev->count_lock);
|
||||||
|
unlock_kernel();
|
||||||
return i810_takedown(dev);
|
return i810_takedown(dev);
|
||||||
}
|
}
|
||||||
spin_unlock(&dev->count_lock);
|
spin_unlock(&dev->count_lock);
|
||||||
|
unlock_kernel();
|
||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -77,8 +77,6 @@ typedef struct drm_i810_private {
|
||||||
} drm_i810_private_t;
|
} drm_i810_private_t;
|
||||||
|
|
||||||
/* i810_drv.c */
|
/* i810_drv.c */
|
||||||
extern int i810_init(void);
|
|
||||||
extern void i810_cleanup(void);
|
|
||||||
extern int i810_version(struct inode *inode, struct file *filp,
|
extern int i810_version(struct inode *inode, struct file *filp,
|
||||||
unsigned int cmd, unsigned long arg);
|
unsigned int cmd, unsigned long arg);
|
||||||
extern int i810_open(struct inode *inode, struct file *filp);
|
extern int i810_open(struct inode *inode, struct file *filp);
|
||||||
|
|
|
@ -31,13 +31,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <linux/config.h>
|
#include <linux/config.h>
|
||||||
#ifndef EXPORT_SYMTAB
|
|
||||||
#define EXPORT_SYMTAB
|
|
||||||
#endif
|
|
||||||
#include "drmP.h"
|
#include "drmP.h"
|
||||||
#include "mga_drv.h"
|
#include "mga_drv.h"
|
||||||
EXPORT_SYMBOL(mga_init);
|
|
||||||
EXPORT_SYMBOL(mga_cleanup);
|
|
||||||
|
|
||||||
#define MGA_NAME "mga"
|
#define MGA_NAME "mga"
|
||||||
#define MGA_DESC "Matrox g200/g400"
|
#define MGA_DESC "Matrox g200/g400"
|
||||||
|
@ -131,9 +126,6 @@ MODULE_AUTHOR("VA Linux Systems, Inc.");
|
||||||
MODULE_DESCRIPTION("Matrox g200/g400");
|
MODULE_DESCRIPTION("Matrox g200/g400");
|
||||||
MODULE_PARM(mga, "s");
|
MODULE_PARM(mga, "s");
|
||||||
|
|
||||||
module_init(mga_init);
|
|
||||||
module_exit(mga_cleanup);
|
|
||||||
|
|
||||||
#ifndef MODULE
|
#ifndef MODULE
|
||||||
/* mga_options is called by the kernel to parse command-line options passed
|
/* mga_options is called by the kernel to parse command-line options passed
|
||||||
* via the boot-loader (e.g., LILO). It calls the insmod option routine,
|
* via the boot-loader (e.g., LILO). It calls the insmod option routine,
|
||||||
|
@ -345,7 +337,7 @@ static int mga_takedown(drm_device_t *dev)
|
||||||
/* mga_init is called via init_module at module load time, or via
|
/* mga_init is called via init_module at module load time, or via
|
||||||
* linux/init/main.c (this is not currently supported). */
|
* linux/init/main.c (this is not currently supported). */
|
||||||
|
|
||||||
int mga_init(void)
|
static int mga_init(void)
|
||||||
{
|
{
|
||||||
int retcode;
|
int retcode;
|
||||||
drm_device_t *dev = &mga_device;
|
drm_device_t *dev = &mga_device;
|
||||||
|
@ -410,7 +402,7 @@ int mga_init(void)
|
||||||
|
|
||||||
/* mga_cleanup is called via cleanup_module at module unload time. */
|
/* mga_cleanup is called via cleanup_module at module unload time. */
|
||||||
|
|
||||||
void mga_cleanup(void)
|
static void mga_cleanup(void)
|
||||||
{
|
{
|
||||||
drm_device_t *dev = &mga_device;
|
drm_device_t *dev = &mga_device;
|
||||||
|
|
||||||
|
@ -442,6 +434,10 @@ void mga_cleanup(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
module_init(mga_init);
|
||||||
|
module_exit(mga_cleanup);
|
||||||
|
|
||||||
|
|
||||||
int mga_version(struct inode *inode, struct file *filp, unsigned int cmd,
|
int mga_version(struct inode *inode, struct file *filp, unsigned int cmd,
|
||||||
unsigned long arg)
|
unsigned long arg)
|
||||||
{
|
{
|
||||||
|
@ -483,7 +479,9 @@ int mga_open(struct inode *inode, struct file *filp)
|
||||||
|
|
||||||
DRM_DEBUG("open_count = %d\n", dev->open_count);
|
DRM_DEBUG("open_count = %d\n", dev->open_count);
|
||||||
if (!(retcode = drm_open_helper(inode, filp, dev))) {
|
if (!(retcode = drm_open_helper(inode, filp, dev))) {
|
||||||
MOD_INC_USE_COUNT;
|
#if LINUX_VERSION_CODE < 0x020333
|
||||||
|
MOD_INC_USE_COUNT; /* Needed before Linux 2.3.51 */
|
||||||
|
#endif
|
||||||
atomic_inc(&dev->total_open);
|
atomic_inc(&dev->total_open);
|
||||||
spin_lock(&dev->count_lock);
|
spin_lock(&dev->count_lock);
|
||||||
if (!dev->open_count++) {
|
if (!dev->open_count++) {
|
||||||
|
@ -498,9 +496,11 @@ int mga_open(struct inode *inode, struct file *filp)
|
||||||
int mga_release(struct inode *inode, struct file *filp)
|
int mga_release(struct inode *inode, struct file *filp)
|
||||||
{
|
{
|
||||||
drm_file_t *priv = filp->private_data;
|
drm_file_t *priv = filp->private_data;
|
||||||
drm_device_t *dev = priv->dev;
|
drm_device_t *dev;
|
||||||
int retcode = 0;
|
int retcode = 0;
|
||||||
|
|
||||||
|
lock_kernel();
|
||||||
|
dev = priv->dev;
|
||||||
DRM_DEBUG("pid = %d, device = 0x%x, open_count = %d\n",
|
DRM_DEBUG("pid = %d, device = 0x%x, open_count = %d\n",
|
||||||
current->pid, dev->device, dev->open_count);
|
current->pid, dev->device, dev->open_count);
|
||||||
|
|
||||||
|
@ -562,7 +562,9 @@ int mga_release(struct inode *inode, struct file *filp)
|
||||||
up(&dev->struct_sem);
|
up(&dev->struct_sem);
|
||||||
|
|
||||||
drm_free(priv, sizeof(*priv), DRM_MEM_FILES);
|
drm_free(priv, sizeof(*priv), DRM_MEM_FILES);
|
||||||
MOD_DEC_USE_COUNT;
|
#if LINUX_VERSION_CODE < 0x020333
|
||||||
|
MOD_DEC_USE_COUNT; /* Needed before Linux 2.3.51 */
|
||||||
|
#endif
|
||||||
atomic_inc(&dev->total_close);
|
atomic_inc(&dev->total_close);
|
||||||
spin_lock(&dev->count_lock);
|
spin_lock(&dev->count_lock);
|
||||||
if (!--dev->open_count) {
|
if (!--dev->open_count) {
|
||||||
|
@ -571,12 +573,15 @@ int mga_release(struct inode *inode, struct file *filp)
|
||||||
atomic_read(&dev->ioctl_count),
|
atomic_read(&dev->ioctl_count),
|
||||||
dev->blocked);
|
dev->blocked);
|
||||||
spin_unlock(&dev->count_lock);
|
spin_unlock(&dev->count_lock);
|
||||||
|
unlock_kernel();
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
}
|
}
|
||||||
spin_unlock(&dev->count_lock);
|
spin_unlock(&dev->count_lock);
|
||||||
|
unlock_kernel();
|
||||||
return mga_takedown(dev);
|
return mga_takedown(dev);
|
||||||
}
|
}
|
||||||
spin_unlock(&dev->count_lock);
|
spin_unlock(&dev->count_lock);
|
||||||
|
unlock_kernel();
|
||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,13 +30,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <linux/config.h>
|
#include <linux/config.h>
|
||||||
#ifndef EXPORT_SYMTAB
|
|
||||||
#define EXPORT_SYMTAB
|
|
||||||
#endif
|
|
||||||
#include "drmP.h"
|
#include "drmP.h"
|
||||||
#include "r128_drv.h"
|
#include "r128_drv.h"
|
||||||
EXPORT_SYMBOL(r128_init);
|
|
||||||
EXPORT_SYMBOL(r128_cleanup);
|
|
||||||
|
|
||||||
#define R128_NAME "r128"
|
#define R128_NAME "r128"
|
||||||
#define R128_DESC "ATI Rage 128"
|
#define R128_DESC "ATI Rage 128"
|
||||||
|
@ -99,7 +94,7 @@ static drm_ioctl_desc_t r128_ioctls[] = {
|
||||||
[DRM_IOCTL_NR(DRM_IOCTL_UNLOCK)] = { r128_unlock, 1, 0 },
|
[DRM_IOCTL_NR(DRM_IOCTL_UNLOCK)] = { r128_unlock, 1, 0 },
|
||||||
[DRM_IOCTL_NR(DRM_IOCTL_FINISH)] = { drm_finish, 1, 0 },
|
[DRM_IOCTL_NR(DRM_IOCTL_FINISH)] = { drm_finish, 1, 0 },
|
||||||
|
|
||||||
#ifdef DRM_AGP
|
#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE)
|
||||||
[DRM_IOCTL_NR(DRM_IOCTL_AGP_ACQUIRE)] = { drm_agp_acquire, 1, 1 },
|
[DRM_IOCTL_NR(DRM_IOCTL_AGP_ACQUIRE)] = { drm_agp_acquire, 1, 1 },
|
||||||
[DRM_IOCTL_NR(DRM_IOCTL_AGP_RELEASE)] = { drm_agp_release, 1, 1 },
|
[DRM_IOCTL_NR(DRM_IOCTL_AGP_RELEASE)] = { drm_agp_release, 1, 1 },
|
||||||
[DRM_IOCTL_NR(DRM_IOCTL_AGP_ENABLE)] = { drm_agp_enable, 1, 1 },
|
[DRM_IOCTL_NR(DRM_IOCTL_AGP_ENABLE)] = { drm_agp_enable, 1, 1 },
|
||||||
|
@ -127,9 +122,6 @@ MODULE_AUTHOR("VA Linux Systems, Inc.");
|
||||||
MODULE_DESCRIPTION("r128");
|
MODULE_DESCRIPTION("r128");
|
||||||
MODULE_PARM(r128, "s");
|
MODULE_PARM(r128, "s");
|
||||||
|
|
||||||
module_init(r128_init);
|
|
||||||
module_exit(r128_cleanup);
|
|
||||||
|
|
||||||
#ifndef MODULE
|
#ifndef MODULE
|
||||||
/* r128_options is called by the kernel to parse command-line options
|
/* r128_options is called by the kernel to parse command-line options
|
||||||
* passed via the boot-loader (e.g., LILO). It calls the insmod option
|
* passed via the boot-loader (e.g., LILO). It calls the insmod option
|
||||||
|
@ -244,7 +236,7 @@ static int r128_takedown(drm_device_t *dev)
|
||||||
dev->magiclist[i].head = dev->magiclist[i].tail = NULL;
|
dev->magiclist[i].head = dev->magiclist[i].tail = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DRM_AGP
|
#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE)
|
||||||
/* Clear AGP information */
|
/* Clear AGP information */
|
||||||
if (dev->agp) {
|
if (dev->agp) {
|
||||||
drm_agp_mem_t *entry;
|
drm_agp_mem_t *entry;
|
||||||
|
@ -331,7 +323,7 @@ static int r128_takedown(drm_device_t *dev)
|
||||||
/* r128_init is called via init_module at module load time, or via
|
/* r128_init is called via init_module at module load time, or via
|
||||||
* linux/init/main.c (this is not currently supported). */
|
* linux/init/main.c (this is not currently supported). */
|
||||||
|
|
||||||
int r128_init(void)
|
static int r128_init(void)
|
||||||
{
|
{
|
||||||
int retcode;
|
int retcode;
|
||||||
drm_device_t *dev = &r128_device;
|
drm_device_t *dev = &r128_device;
|
||||||
|
@ -356,7 +348,7 @@ int r128_init(void)
|
||||||
drm_mem_init();
|
drm_mem_init();
|
||||||
drm_proc_init(dev);
|
drm_proc_init(dev);
|
||||||
|
|
||||||
#ifdef DRM_AGP
|
#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE)
|
||||||
dev->agp = drm_agp_init();
|
dev->agp = drm_agp_init();
|
||||||
if (dev->agp == NULL) {
|
if (dev->agp == NULL) {
|
||||||
DRM_ERROR("Cannot initialize agpgart module.\n");
|
DRM_ERROR("Cannot initialize agpgart module.\n");
|
||||||
|
@ -395,7 +387,7 @@ int r128_init(void)
|
||||||
|
|
||||||
/* r128_cleanup is called via cleanup_module at module unload time. */
|
/* r128_cleanup is called via cleanup_module at module unload time. */
|
||||||
|
|
||||||
void r128_cleanup(void)
|
static void r128_cleanup(void)
|
||||||
{
|
{
|
||||||
drm_device_t *dev = &r128_device;
|
drm_device_t *dev = &r128_device;
|
||||||
|
|
||||||
|
@ -409,7 +401,7 @@ void r128_cleanup(void)
|
||||||
}
|
}
|
||||||
drm_ctxbitmap_cleanup(dev);
|
drm_ctxbitmap_cleanup(dev);
|
||||||
r128_takedown(dev);
|
r128_takedown(dev);
|
||||||
#ifdef DRM_AGP
|
#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE)
|
||||||
if (dev->agp) {
|
if (dev->agp) {
|
||||||
drm_agp_uninit();
|
drm_agp_uninit();
|
||||||
drm_free(dev->agp, sizeof(*dev->agp), DRM_MEM_AGPLISTS);
|
drm_free(dev->agp, sizeof(*dev->agp), DRM_MEM_AGPLISTS);
|
||||||
|
@ -418,6 +410,10 @@ void r128_cleanup(void)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
module_init(r128_init);
|
||||||
|
module_exit(r128_cleanup);
|
||||||
|
|
||||||
|
|
||||||
int r128_version(struct inode *inode, struct file *filp, unsigned int cmd,
|
int r128_version(struct inode *inode, struct file *filp, unsigned int cmd,
|
||||||
unsigned long arg)
|
unsigned long arg)
|
||||||
{
|
{
|
||||||
|
@ -459,7 +455,9 @@ int r128_open(struct inode *inode, struct file *filp)
|
||||||
|
|
||||||
DRM_DEBUG("open_count = %d\n", dev->open_count);
|
DRM_DEBUG("open_count = %d\n", dev->open_count);
|
||||||
if (!(retcode = drm_open_helper(inode, filp, dev))) {
|
if (!(retcode = drm_open_helper(inode, filp, dev))) {
|
||||||
MOD_INC_USE_COUNT;
|
#if LINUX_VERSION_CODE < 0x020333
|
||||||
|
MOD_INC_USE_COUNT; /* Needed before Linux 2.3.51 */
|
||||||
|
#endif
|
||||||
atomic_inc(&dev->total_open);
|
atomic_inc(&dev->total_open);
|
||||||
spin_lock(&dev->count_lock);
|
spin_lock(&dev->count_lock);
|
||||||
if (!dev->open_count++) {
|
if (!dev->open_count++) {
|
||||||
|
@ -468,18 +466,23 @@ int r128_open(struct inode *inode, struct file *filp)
|
||||||
}
|
}
|
||||||
spin_unlock(&dev->count_lock);
|
spin_unlock(&dev->count_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
int r128_release(struct inode *inode, struct file *filp)
|
int r128_release(struct inode *inode, struct file *filp)
|
||||||
{
|
{
|
||||||
drm_file_t *priv = filp->private_data;
|
drm_file_t *priv = filp->private_data;
|
||||||
drm_device_t *dev = priv->dev;
|
drm_device_t *dev;
|
||||||
int retcode = 0;
|
int retcode = 0;
|
||||||
|
|
||||||
|
lock_kernel();
|
||||||
|
dev = priv->dev;
|
||||||
DRM_DEBUG("open_count = %d\n", dev->open_count);
|
DRM_DEBUG("open_count = %d\n", dev->open_count);
|
||||||
if (!(retcode = drm_release(inode, filp))) {
|
if (!(retcode = drm_release(inode, filp))) {
|
||||||
MOD_DEC_USE_COUNT;
|
#if LINUX_VERSION_CODE < 0x020333
|
||||||
|
MOD_DEC_USE_COUNT; /* Needed before Linux 2.3.51 */
|
||||||
|
#endif
|
||||||
atomic_inc(&dev->total_close);
|
atomic_inc(&dev->total_close);
|
||||||
spin_lock(&dev->count_lock);
|
spin_lock(&dev->count_lock);
|
||||||
if (!--dev->open_count) {
|
if (!--dev->open_count) {
|
||||||
|
@ -488,13 +491,17 @@ int r128_release(struct inode *inode, struct file *filp)
|
||||||
atomic_read(&dev->ioctl_count),
|
atomic_read(&dev->ioctl_count),
|
||||||
dev->blocked);
|
dev->blocked);
|
||||||
spin_unlock(&dev->count_lock);
|
spin_unlock(&dev->count_lock);
|
||||||
|
unlock_kernel();
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
}
|
}
|
||||||
spin_unlock(&dev->count_lock);
|
spin_unlock(&dev->count_lock);
|
||||||
|
unlock_kernel();
|
||||||
return r128_takedown(dev);
|
return r128_takedown(dev);
|
||||||
}
|
}
|
||||||
spin_unlock(&dev->count_lock);
|
spin_unlock(&dev->count_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unlock_kernel();
|
||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,13 +31,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <linux/config.h>
|
#include <linux/config.h>
|
||||||
#ifndef EXPORT_SYMTAB
|
|
||||||
#define EXPORT_SYMTAB
|
|
||||||
#endif
|
|
||||||
#include "drmP.h"
|
#include "drmP.h"
|
||||||
#include "tdfx_drv.h"
|
#include "tdfx_drv.h"
|
||||||
EXPORT_SYMBOL(tdfx_init);
|
|
||||||
EXPORT_SYMBOL(tdfx_cleanup);
|
|
||||||
|
|
||||||
#define TDFX_NAME "tdfx"
|
#define TDFX_NAME "tdfx"
|
||||||
#define TDFX_DESC "3dfx Banshee/Voodoo3+"
|
#define TDFX_DESC "3dfx Banshee/Voodoo3+"
|
||||||
|
@ -94,7 +89,7 @@ static drm_ioctl_desc_t tdfx_ioctls[] = {
|
||||||
[DRM_IOCTL_NR(DRM_IOCTL_LOCK)] = { tdfx_lock, 1, 0 },
|
[DRM_IOCTL_NR(DRM_IOCTL_LOCK)] = { tdfx_lock, 1, 0 },
|
||||||
[DRM_IOCTL_NR(DRM_IOCTL_UNLOCK)] = { tdfx_unlock, 1, 0 },
|
[DRM_IOCTL_NR(DRM_IOCTL_UNLOCK)] = { tdfx_unlock, 1, 0 },
|
||||||
[DRM_IOCTL_NR(DRM_IOCTL_FINISH)] = { drm_finish, 1, 0 },
|
[DRM_IOCTL_NR(DRM_IOCTL_FINISH)] = { drm_finish, 1, 0 },
|
||||||
#ifdef DRM_AGP
|
#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE)
|
||||||
[DRM_IOCTL_NR(DRM_IOCTL_AGP_ACQUIRE)] = {drm_agp_acquire, 1, 1},
|
[DRM_IOCTL_NR(DRM_IOCTL_AGP_ACQUIRE)] = {drm_agp_acquire, 1, 1},
|
||||||
[DRM_IOCTL_NR(DRM_IOCTL_AGP_RELEASE)] = {drm_agp_release, 1, 1},
|
[DRM_IOCTL_NR(DRM_IOCTL_AGP_RELEASE)] = {drm_agp_release, 1, 1},
|
||||||
[DRM_IOCTL_NR(DRM_IOCTL_AGP_ENABLE)] = {drm_agp_enable, 1, 1},
|
[DRM_IOCTL_NR(DRM_IOCTL_AGP_ENABLE)] = {drm_agp_enable, 1, 1},
|
||||||
|
@ -115,9 +110,6 @@ MODULE_AUTHOR("VA Linux Systems, Inc.");
|
||||||
MODULE_DESCRIPTION("tdfx");
|
MODULE_DESCRIPTION("tdfx");
|
||||||
MODULE_PARM(tdfx, "s");
|
MODULE_PARM(tdfx, "s");
|
||||||
|
|
||||||
module_init(tdfx_init);
|
|
||||||
module_exit(tdfx_cleanup);
|
|
||||||
|
|
||||||
#ifndef MODULE
|
#ifndef MODULE
|
||||||
/* tdfx_options is called by the kernel to parse command-line options
|
/* tdfx_options is called by the kernel to parse command-line options
|
||||||
* passed via the boot-loader (e.g., LILO). It calls the insmod option
|
* passed via the boot-loader (e.g., LILO). It calls the insmod option
|
||||||
|
@ -230,7 +222,7 @@ static int tdfx_takedown(drm_device_t *dev)
|
||||||
}
|
}
|
||||||
dev->magiclist[i].head = dev->magiclist[i].tail = NULL;
|
dev->magiclist[i].head = dev->magiclist[i].tail = NULL;
|
||||||
}
|
}
|
||||||
#ifdef DRM_AGP
|
#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE)
|
||||||
/* Clear AGP information */
|
/* Clear AGP information */
|
||||||
if (dev->agp) {
|
if (dev->agp) {
|
||||||
drm_agp_mem_t *temp;
|
drm_agp_mem_t *temp;
|
||||||
|
@ -306,7 +298,7 @@ static int tdfx_takedown(drm_device_t *dev)
|
||||||
/* tdfx_init is called via init_module at module load time, or via
|
/* tdfx_init is called via init_module at module load time, or via
|
||||||
* linux/init/main.c (this is not currently supported). */
|
* linux/init/main.c (this is not currently supported). */
|
||||||
|
|
||||||
int tdfx_init(void)
|
static int tdfx_init(void)
|
||||||
{
|
{
|
||||||
int retcode;
|
int retcode;
|
||||||
drm_device_t *dev = &tdfx_device;
|
drm_device_t *dev = &tdfx_device;
|
||||||
|
@ -330,7 +322,7 @@ int tdfx_init(void)
|
||||||
|
|
||||||
drm_mem_init();
|
drm_mem_init();
|
||||||
drm_proc_init(dev);
|
drm_proc_init(dev);
|
||||||
#ifdef DRM_AGP
|
#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE)
|
||||||
dev->agp = drm_agp_init();
|
dev->agp = drm_agp_init();
|
||||||
#endif
|
#endif
|
||||||
if((retcode = drm_ctxbitmap_init(dev))) {
|
if((retcode = drm_ctxbitmap_init(dev))) {
|
||||||
|
@ -354,7 +346,7 @@ int tdfx_init(void)
|
||||||
|
|
||||||
/* tdfx_cleanup is called via cleanup_module at module unload time. */
|
/* tdfx_cleanup is called via cleanup_module at module unload time. */
|
||||||
|
|
||||||
void tdfx_cleanup(void)
|
static void tdfx_cleanup(void)
|
||||||
{
|
{
|
||||||
drm_device_t *dev = &tdfx_device;
|
drm_device_t *dev = &tdfx_device;
|
||||||
|
|
||||||
|
@ -368,7 +360,7 @@ void tdfx_cleanup(void)
|
||||||
}
|
}
|
||||||
drm_ctxbitmap_cleanup(dev);
|
drm_ctxbitmap_cleanup(dev);
|
||||||
tdfx_takedown(dev);
|
tdfx_takedown(dev);
|
||||||
#ifdef DRM_AGP
|
#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE)
|
||||||
if (dev->agp) {
|
if (dev->agp) {
|
||||||
drm_agp_uninit();
|
drm_agp_uninit();
|
||||||
drm_free(dev->agp, sizeof(*dev->agp), DRM_MEM_AGPLISTS);
|
drm_free(dev->agp, sizeof(*dev->agp), DRM_MEM_AGPLISTS);
|
||||||
|
@ -377,6 +369,10 @@ void tdfx_cleanup(void)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
module_init(tdfx_init);
|
||||||
|
module_exit(tdfx_cleanup);
|
||||||
|
|
||||||
|
|
||||||
int tdfx_version(struct inode *inode, struct file *filp, unsigned int cmd,
|
int tdfx_version(struct inode *inode, struct file *filp, unsigned int cmd,
|
||||||
unsigned long arg)
|
unsigned long arg)
|
||||||
{
|
{
|
||||||
|
@ -418,7 +414,9 @@ int tdfx_open(struct inode *inode, struct file *filp)
|
||||||
|
|
||||||
DRM_DEBUG("open_count = %d\n", dev->open_count);
|
DRM_DEBUG("open_count = %d\n", dev->open_count);
|
||||||
if (!(retcode = drm_open_helper(inode, filp, dev))) {
|
if (!(retcode = drm_open_helper(inode, filp, dev))) {
|
||||||
MOD_INC_USE_COUNT;
|
#if LINUX_VERSION_CODE < 0x020333
|
||||||
|
MOD_INC_USE_COUNT; /* Needed before Linux 2.3.51 */
|
||||||
|
#endif
|
||||||
atomic_inc(&dev->total_open);
|
atomic_inc(&dev->total_open);
|
||||||
spin_lock(&dev->count_lock);
|
spin_lock(&dev->count_lock);
|
||||||
if (!dev->open_count++) {
|
if (!dev->open_count++) {
|
||||||
|
@ -433,12 +431,17 @@ int tdfx_open(struct inode *inode, struct file *filp)
|
||||||
int tdfx_release(struct inode *inode, struct file *filp)
|
int tdfx_release(struct inode *inode, struct file *filp)
|
||||||
{
|
{
|
||||||
drm_file_t *priv = filp->private_data;
|
drm_file_t *priv = filp->private_data;
|
||||||
drm_device_t *dev = priv->dev;
|
drm_device_t *dev;
|
||||||
int retcode = 0;
|
int retcode = 0;
|
||||||
|
|
||||||
|
lock_kernel();
|
||||||
|
dev = priv->dev;
|
||||||
|
|
||||||
DRM_DEBUG("open_count = %d\n", dev->open_count);
|
DRM_DEBUG("open_count = %d\n", dev->open_count);
|
||||||
if (!(retcode = drm_release(inode, filp))) {
|
if (!(retcode = drm_release(inode, filp))) {
|
||||||
MOD_DEC_USE_COUNT;
|
#if LINUX_VERSION_CODE < 0x020333
|
||||||
|
MOD_DEC_USE_COUNT; /* Needed before Linux 2.3.51 */
|
||||||
|
#endif
|
||||||
atomic_inc(&dev->total_close);
|
atomic_inc(&dev->total_close);
|
||||||
spin_lock(&dev->count_lock);
|
spin_lock(&dev->count_lock);
|
||||||
if (!--dev->open_count) {
|
if (!--dev->open_count) {
|
||||||
|
@ -447,13 +450,17 @@ int tdfx_release(struct inode *inode, struct file *filp)
|
||||||
atomic_read(&dev->ioctl_count),
|
atomic_read(&dev->ioctl_count),
|
||||||
dev->blocked);
|
dev->blocked);
|
||||||
spin_unlock(&dev->count_lock);
|
spin_unlock(&dev->count_lock);
|
||||||
|
unlock_kernel();
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
}
|
}
|
||||||
spin_unlock(&dev->count_lock);
|
spin_unlock(&dev->count_lock);
|
||||||
|
unlock_kernel();
|
||||||
return tdfx_takedown(dev);
|
return tdfx_takedown(dev);
|
||||||
}
|
}
|
||||||
spin_unlock(&dev->count_lock);
|
spin_unlock(&dev->count_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unlock_kernel();
|
||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,39 +2,38 @@
|
||||||
# Makefile for the drm device driver. This driver provides support for
|
# Makefile for the drm device driver. This driver provides support for
|
||||||
# the Direct Rendering Infrastructure (DRI) in XFree86 4.x.
|
# the Direct Rendering Infrastructure (DRI) in XFree86 4.x.
|
||||||
#
|
#
|
||||||
# Note! Dependencies are done automagically by 'make dep', which also
|
|
||||||
# removes any old dependencies. DON'T put your own dependencies here
|
|
||||||
# unless it's something special (ie not a .c file).
|
|
||||||
#
|
|
||||||
# Note 2! The CFLAGS definitions are now inherited from the
|
|
||||||
# parent makes..
|
|
||||||
#
|
|
||||||
|
|
||||||
O_OBJS :=
|
|
||||||
OX_OBJS :=
|
|
||||||
M_OBJS :=
|
|
||||||
MX_OBJS :=
|
|
||||||
|
|
||||||
# Object file lists.
|
|
||||||
|
|
||||||
obj-y :=
|
|
||||||
obj-m :=
|
|
||||||
obj-n :=
|
|
||||||
obj- :=
|
|
||||||
|
|
||||||
SUB_DIRS :=
|
|
||||||
MOD_SUB_DIRS := $(SUB_DIRS)
|
|
||||||
ALL_SUB_DIRS := $(SUB_DIRS)
|
|
||||||
|
|
||||||
|
# drm.o is a fake target -- it is never built
|
||||||
|
# The real targets are in the module-list
|
||||||
O_TARGET := drm.o
|
O_TARGET := drm.o
|
||||||
module-list := gamma.o tdfx.o r128.o ffb.o mga.o i810.o
|
module-list := gamma.o tdfx.o r128.o ffb.o mga.o i810.o
|
||||||
export-objs := $(patsubst %.o,%_drv.o,$(module-list))
|
export-objs := $(patsubst %.o,%_drv.o,$(module-list))
|
||||||
|
|
||||||
|
# libs-objs are included in every module so that radical changes to the
|
||||||
|
# architecture of the DRM support library can be made at a later time.
|
||||||
|
#
|
||||||
|
# The downside is that each module is larger, and a system that uses
|
||||||
|
# more than one module (i.e., a dual-head system) will use more memory
|
||||||
|
# (but a system that uses exactly one module will use the same amount of
|
||||||
|
# memory).
|
||||||
|
#
|
||||||
|
# The upside is that if the DRM support library ever becomes insufficient
|
||||||
|
# for new families of cards, a new library can be implemented for those new
|
||||||
|
# cards without impacting the drivers for the old cards. This is significant,
|
||||||
|
# because testing architectural changes to old cards may be impossible, and
|
||||||
|
# may delay the implementation of a better architecture. We've traded slight
|
||||||
|
# memory waste (in the dual-head case) for greatly improved long-term
|
||||||
|
# maintainability.
|
||||||
|
#
|
||||||
lib-objs := init.o memory.o proc.o auth.o context.o drawable.o bufs.o
|
lib-objs := init.o memory.o proc.o auth.o context.o drawable.o bufs.o
|
||||||
lib-objs += lists.o lock.o ioctl.o fops.o vm.o dma.o ctxbitmap.o
|
lib-objs += lists.o lock.o ioctl.o fops.o vm.o dma.o ctxbitmap.o
|
||||||
|
|
||||||
ifneq ($(CONFIG_AGP),)
|
ifeq ($(CONFIG_AGP),y)
|
||||||
lib-objs += agpsupport.o
|
lib-objs += agpsupport.o
|
||||||
|
else
|
||||||
|
ifeq ($(CONFIG_AGP),m)
|
||||||
|
lib-objs += agpsupport.o
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
gamma-objs := $(lib-objs) gamma_drv.o gamma_dma.o
|
gamma-objs := $(lib-objs) gamma_drv.o gamma_dma.o
|
||||||
|
@ -71,19 +70,19 @@ MIX_OBJS := $(sort $(filter $(export-objs), $(int-m)))
|
||||||
include $(TOPDIR)/Rules.make
|
include $(TOPDIR)/Rules.make
|
||||||
|
|
||||||
gamma.o: $(gamma-objs)
|
gamma.o: $(gamma-objs)
|
||||||
$(LD) $(LD_RFLAG) -r -o $@ $(gamma-objs)
|
$(LD) -r -o $@ $(gamma-objs)
|
||||||
|
|
||||||
tdfx.o: $(tdfx-objs)
|
tdfx.o: $(tdfx-objs)
|
||||||
$(LD) $(LD_RFLAG) -r -o $@ $(tdfx-objs)
|
$(LD) -r -o $@ $(tdfx-objs)
|
||||||
|
|
||||||
mga.o: $(mga-objs)
|
mga.o: $(mga-objs)
|
||||||
$(LD) $(LD_RFLAG) -r -o $@ $(mga-objs)
|
$(LD) -r -o $@ $(mga-objs)
|
||||||
|
|
||||||
i810.o: $(i810-objs)
|
i810.o: $(i810-objs)
|
||||||
$(LD) $(LD_RFLAG) -r -o $@ $(i810-objs)
|
$(LD) -r -o $@ $(i810-objs)
|
||||||
|
|
||||||
r128.o: $(r128-objs)
|
r128.o: $(r128-objs)
|
||||||
$(LD) $(LD_RFLAG) -r -o $@ $(r128-objs)
|
$(LD) -r -o $@ $(r128-objs)
|
||||||
|
|
||||||
ffb.o: $(ffb-objs)
|
ffb.o: $(ffb-objs)
|
||||||
$(LD) $(LD_RFLAG) -r -o $@ $(ffb-objs)
|
$(LD) -r -o $@ $(ffb-objs)
|
||||||
|
|
|
@ -71,8 +71,9 @@ INC= /usr/include
|
||||||
|
|
||||||
CFLAGS= -O2 $(WARNINGS)
|
CFLAGS= -O2 $(WARNINGS)
|
||||||
WARNINGS= -Wall -Wwrite-strings -Wpointer-arith -Wcast-align \
|
WARNINGS= -Wall -Wwrite-strings -Wpointer-arith -Wcast-align \
|
||||||
-Wstrict-prototypes -Wshadow -Wnested-externs \
|
-Wstrict-prototypes -Wnested-externs \
|
||||||
-Winline -Wpointer-arith
|
-Wpointer-arith
|
||||||
|
# -Wshadow -Winline -- make output too noisy
|
||||||
MODCFLAGS= $(CFLAGS) -D__KERNEL__ -DMODULE -fomit-frame-pointer
|
MODCFLAGS= $(CFLAGS) -D__KERNEL__ -DMODULE -fomit-frame-pointer
|
||||||
PRGCFLAGS= $(CFLAGS) -g -ansi -pedantic -DPOSIX_C_SOURCE=199309L \
|
PRGCFLAGS= $(CFLAGS) -g -ansi -pedantic -DPOSIX_C_SOURCE=199309L \
|
||||||
-D_POSIX_SOURCE -D_XOPEN_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE \
|
-D_POSIX_SOURCE -D_XOPEN_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE \
|
||||||
|
@ -128,7 +129,7 @@ AGP := $(shell gcc -E -nostdinc -I$(TREE) picker.c 2>/dev/null \
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(AGP),1)
|
ifeq ($(AGP),1)
|
||||||
MODCFLAGS += -DDRM_AGP
|
MODCFLAGS += -DCONFIG_AGP -DCONFIG_AGP_MODULE
|
||||||
DRMOBJS += agpsupport.o
|
DRMOBJS += agpsupport.o
|
||||||
MODS += mga.o i810.o
|
MODS += mga.o i810.o
|
||||||
|
|
||||||
|
@ -164,19 +165,29 @@ libdrm.a: $(DRMOBJS)
|
||||||
-$(RM) -f $@
|
-$(RM) -f $@
|
||||||
$(AR) rcs $@ $(DRMOBJS)
|
$(AR) rcs $@ $(DRMOBJS)
|
||||||
|
|
||||||
|
gamma_drv.o: gamma_drv.c
|
||||||
|
$(CC) $(MODCFLAGS) -DEXPORT_SYMTAB -I$(TREE) -c $< -o $@
|
||||||
gamma.o: $(GAMMAOBJS) $(LIBS)
|
gamma.o: $(GAMMAOBJS) $(LIBS)
|
||||||
$(LD) -r $^ -o $@
|
$(LD) -r $^ -o $@
|
||||||
|
|
||||||
|
tdfx_drv.o: tdfx_drv.c
|
||||||
|
$(CC) $(MODCFLAGS) -DEXPORT_SYMTAB -I$(TREE) -c $< -o $@
|
||||||
tdfx.o: $(TDFXOBJS) $(LIBS)
|
tdfx.o: $(TDFXOBJS) $(LIBS)
|
||||||
$(LD) -r $^ -o $@
|
$(LD) -r $^ -o $@
|
||||||
|
|
||||||
|
r128_drv.o: r128_drv.c
|
||||||
|
$(CC) $(MODCFLAGS) -DEXPORT_SYMTAB -I$(TREE) -c $< -o $@
|
||||||
r128.o: $(R128OBJS) $(LIBS)
|
r128.o: $(R128OBJS) $(LIBS)
|
||||||
$(LD) -r $^ -o $@
|
$(LD) -r $^ -o $@
|
||||||
|
|
||||||
ifeq ($(AGP),1)
|
ifeq ($(AGP),1)
|
||||||
|
mga_drv.o: mga_drv.c
|
||||||
|
$(CC) $(MODCFLAGS) -DEXPORT_SYMTAB -I$(TREE) -c $< -o $@
|
||||||
mga.o: $(MGAOBJS) $(LIBS)
|
mga.o: $(MGAOBJS) $(LIBS)
|
||||||
$(LD) -r $^ -o $@
|
$(LD) -r $^ -o $@
|
||||||
|
|
||||||
|
i810_drv.o: i810_drv.c
|
||||||
|
$(CC) $(MODCFLAGS) -DEXPORT_SYMTAB -I$(TREE) -c $< -o $@
|
||||||
i810.o: $(I810OBJS) $(LIBS)
|
i810.o: $(I810OBJS) $(LIBS)
|
||||||
$(LD) -r $^ -o $@
|
$(LD) -r $^ -o $@
|
||||||
endif
|
endif
|
||||||
|
@ -200,7 +211,6 @@ ChangeLog:
|
||||||
%.po: %.c
|
%.po: %.c
|
||||||
$(CC) $(PRGCFLAGS) -DDRM_USE_MALLOC -c $< -o $@
|
$(CC) $(PRGCFLAGS) -DDRM_USE_MALLOC -c $< -o $@
|
||||||
|
|
||||||
|
|
||||||
$(DRMOBJS): $(DRMHEADERS)
|
$(DRMOBJS): $(DRMHEADERS)
|
||||||
$(GAMMAOBJS): $(GAMMAHEADERS)
|
$(GAMMAOBJS): $(GAMMAHEADERS)
|
||||||
$(TDFXOBJS): $(TDFXHEADERS)
|
$(TDFXOBJS): $(TDFXHEADERS)
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
|
|
||||||
#define __NO_VERSION__
|
#define __NO_VERSION__
|
||||||
#include "drmP.h"
|
#include "drmP.h"
|
||||||
|
#include <linux/module.h>
|
||||||
|
|
||||||
drm_agp_func_t drm_agp = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL };
|
drm_agp_func_t drm_agp = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL };
|
||||||
|
|
||||||
|
|
|
@ -106,7 +106,7 @@ int drm_addmap(struct inode *inode, struct file *filp, unsigned int cmd,
|
||||||
dev->lock.hw_lock = map->handle; /* Pointer to lock */
|
dev->lock.hw_lock = map->handle; /* Pointer to lock */
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#ifdef DRM_AGP
|
#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE)
|
||||||
case _DRM_AGP:
|
case _DRM_AGP:
|
||||||
map->offset = map->offset + dev->agp->base;
|
map->offset = map->offset + dev->agp->base;
|
||||||
break;
|
break;
|
||||||
|
|
20
linux/drmP.h
20
linux/drmP.h
|
@ -44,6 +44,8 @@
|
||||||
#include <linux/pci.h>
|
#include <linux/pci.h>
|
||||||
#include <linux/wrapper.h>
|
#include <linux/wrapper.h>
|
||||||
#include <linux/version.h>
|
#include <linux/version.h>
|
||||||
|
#include <linux/sched.h>
|
||||||
|
#include <linux/smp_lock.h> /* For (un)lock_kernel */
|
||||||
#include <asm/io.h>
|
#include <asm/io.h>
|
||||||
#include <asm/mman.h>
|
#include <asm/mman.h>
|
||||||
#include <asm/uaccess.h>
|
#include <asm/uaccess.h>
|
||||||
|
@ -51,9 +53,6 @@
|
||||||
#include <asm/mtrr.h>
|
#include <asm/mtrr.h>
|
||||||
#endif
|
#endif
|
||||||
#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE)
|
#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE)
|
||||||
#define DRM_AGP
|
|
||||||
#endif
|
|
||||||
#ifdef DRM_AGP
|
|
||||||
#include <linux/types.h>
|
#include <linux/types.h>
|
||||||
#include <linux/agp_backend.h>
|
#include <linux/agp_backend.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -410,7 +409,7 @@ typedef struct drm_device_dma {
|
||||||
wait_queue_head_t waiting; /* Processes waiting on free bufs */
|
wait_queue_head_t waiting; /* Processes waiting on free bufs */
|
||||||
} drm_device_dma_t;
|
} drm_device_dma_t;
|
||||||
|
|
||||||
#ifdef DRM_AGP
|
#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE)
|
||||||
typedef struct drm_agp_mem {
|
typedef struct drm_agp_mem {
|
||||||
unsigned long handle;
|
unsigned long handle;
|
||||||
agp_memory *memory;
|
agp_memory *memory;
|
||||||
|
@ -499,9 +498,9 @@ typedef struct drm_device {
|
||||||
|
|
||||||
/* Context support */
|
/* Context support */
|
||||||
int irq; /* Interrupt used by board */
|
int irq; /* Interrupt used by board */
|
||||||
__volatile__ int context_flag; /* Context swapping flag */
|
__volatile__ long context_flag; /* Context swapping flag */
|
||||||
__volatile__ int interrupt_flag;/* Interruption handler flag */
|
__volatile__ long interrupt_flag; /* Interruption handler flag */
|
||||||
__volatile__ int dma_flag; /* DMA dispatch flag */
|
__volatile__ long dma_flag; /* DMA dispatch flag */
|
||||||
struct timer_list timer; /* Timer for delaying ctx switch */
|
struct timer_list timer; /* Timer for delaying ctx switch */
|
||||||
wait_queue_head_t context_wait; /* Processes waiting on ctx switch */
|
wait_queue_head_t context_wait; /* Processes waiting on ctx switch */
|
||||||
int last_checked; /* Last context checked for DMA */
|
int last_checked; /* Last context checked for DMA */
|
||||||
|
@ -524,7 +523,7 @@ typedef struct drm_device {
|
||||||
wait_queue_head_t buf_readers; /* Processes waiting to read */
|
wait_queue_head_t buf_readers; /* Processes waiting to read */
|
||||||
wait_queue_head_t buf_writers; /* Processes waiting to ctx switch */
|
wait_queue_head_t buf_writers; /* Processes waiting to ctx switch */
|
||||||
|
|
||||||
#ifdef DRM_AGP
|
#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE)
|
||||||
drm_agp_head_t *agp;
|
drm_agp_head_t *agp;
|
||||||
#endif
|
#endif
|
||||||
unsigned long *ctx_bitmap;
|
unsigned long *ctx_bitmap;
|
||||||
|
@ -601,7 +600,7 @@ extern void drm_free_pages(unsigned long address, int order,
|
||||||
extern void *drm_ioremap(unsigned long offset, unsigned long size);
|
extern void *drm_ioremap(unsigned long offset, unsigned long size);
|
||||||
extern void drm_ioremapfree(void *pt, unsigned long size);
|
extern void drm_ioremapfree(void *pt, unsigned long size);
|
||||||
|
|
||||||
#ifdef DRM_AGP
|
#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE)
|
||||||
extern agp_memory *drm_alloc_agp(int pages, u32 type);
|
extern agp_memory *drm_alloc_agp(int pages, u32 type);
|
||||||
extern int drm_free_agp(agp_memory *handle, int pages);
|
extern int drm_free_agp(agp_memory *handle, int pages);
|
||||||
extern int drm_bind_agp(agp_memory *handle, unsigned int start);
|
extern int drm_bind_agp(agp_memory *handle, unsigned int start);
|
||||||
|
@ -644,7 +643,6 @@ extern void drm_free_buffer(drm_device_t *dev, drm_buf_t *buf);
|
||||||
extern void drm_reclaim_buffers(drm_device_t *dev, pid_t pid);
|
extern void drm_reclaim_buffers(drm_device_t *dev, pid_t pid);
|
||||||
extern int drm_context_switch(drm_device_t *dev, int old, int new);
|
extern int drm_context_switch(drm_device_t *dev, int old, int new);
|
||||||
extern int drm_context_switch_complete(drm_device_t *dev, int new);
|
extern int drm_context_switch_complete(drm_device_t *dev, int new);
|
||||||
extern void drm_wakeup(drm_device_t *dev, drm_buf_t *buf);
|
|
||||||
extern void drm_clear_next_buffer(drm_device_t *dev);
|
extern void drm_clear_next_buffer(drm_device_t *dev);
|
||||||
extern int drm_select_queue(drm_device_t *dev,
|
extern int drm_select_queue(drm_device_t *dev,
|
||||||
void (*wrapper)(unsigned long));
|
void (*wrapper)(unsigned long));
|
||||||
|
@ -725,7 +723,7 @@ extern void drm_ctxbitmap_cleanup(drm_device_t *dev);
|
||||||
extern int drm_ctxbitmap_next(drm_device_t *dev);
|
extern int drm_ctxbitmap_next(drm_device_t *dev);
|
||||||
extern void drm_ctxbitmap_free(drm_device_t *dev, int ctx_handle);
|
extern void drm_ctxbitmap_free(drm_device_t *dev, int ctx_handle);
|
||||||
|
|
||||||
#ifdef DRM_AGP
|
#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE)
|
||||||
/* AGP/GART support (agpsupport.c) */
|
/* AGP/GART support (agpsupport.c) */
|
||||||
extern drm_agp_head_t *drm_agp_init(void);
|
extern drm_agp_head_t *drm_agp_init(void);
|
||||||
extern void drm_agp_uninit(void);
|
extern void drm_agp_uninit(void);
|
||||||
|
|
|
@ -30,15 +30,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <linux/config.h>
|
#include <linux/config.h>
|
||||||
#ifndef EXPORT_SYMTAB
|
|
||||||
#define EXPORT_SYMTAB
|
|
||||||
#endif
|
|
||||||
#include "drmP.h"
|
#include "drmP.h"
|
||||||
#include "gamma_drv.h"
|
#include "gamma_drv.h"
|
||||||
#include <linux/pci.h>
|
|
||||||
#include <linux/smp_lock.h> /* For (un)lock_kernel */
|
|
||||||
EXPORT_SYMBOL(gamma_init);
|
|
||||||
EXPORT_SYMBOL(gamma_cleanup);
|
|
||||||
|
|
||||||
#ifndef PCI_DEVICE_ID_3DLABS_GAMMA
|
#ifndef PCI_DEVICE_ID_3DLABS_GAMMA
|
||||||
#define PCI_DEVICE_ID_3DLABS_GAMMA 0x0008
|
#define PCI_DEVICE_ID_3DLABS_GAMMA 0x0008
|
||||||
|
@ -122,10 +115,6 @@ MODULE_PARM(gamma, "s");
|
||||||
MODULE_PARM(devices, "i");
|
MODULE_PARM(devices, "i");
|
||||||
MODULE_PARM_DESC(devices,
|
MODULE_PARM_DESC(devices,
|
||||||
"devices=x, where x is the number of MX chips on card\n");
|
"devices=x, where x is the number of MX chips on card\n");
|
||||||
|
|
||||||
module_init(gamma_init);
|
|
||||||
module_exit(gamma_cleanup);
|
|
||||||
|
|
||||||
#ifndef MODULE
|
#ifndef MODULE
|
||||||
/* gamma_options is called by the kernel to parse command-line options
|
/* gamma_options is called by the kernel to parse command-line options
|
||||||
* passed via the boot-loader (e.g., LILO). It calls the insmod option
|
* passed via the boot-loader (e.g., LILO). It calls the insmod option
|
||||||
|
@ -350,7 +339,7 @@ int gamma_find_devices(void)
|
||||||
/* gamma_init is called via init_module at module load time, or via
|
/* gamma_init is called via init_module at module load time, or via
|
||||||
* linux/init/main.c (this is not currently supported). */
|
* linux/init/main.c (this is not currently supported). */
|
||||||
|
|
||||||
int gamma_init(void)
|
static int gamma_init(void)
|
||||||
{
|
{
|
||||||
int retcode;
|
int retcode;
|
||||||
drm_device_t *dev = &gamma_device;
|
drm_device_t *dev = &gamma_device;
|
||||||
|
@ -391,7 +380,7 @@ int gamma_init(void)
|
||||||
|
|
||||||
/* gamma_cleanup is called via cleanup_module at module unload time. */
|
/* gamma_cleanup is called via cleanup_module at module unload time. */
|
||||||
|
|
||||||
void gamma_cleanup(void)
|
static void gamma_cleanup(void)
|
||||||
{
|
{
|
||||||
drm_device_t *dev = &gamma_device;
|
drm_device_t *dev = &gamma_device;
|
||||||
|
|
||||||
|
@ -406,6 +395,10 @@ void gamma_cleanup(void)
|
||||||
gamma_takedown(dev);
|
gamma_takedown(dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
module_init(gamma_init);
|
||||||
|
module_exit(gamma_cleanup);
|
||||||
|
|
||||||
|
|
||||||
int gamma_version(struct inode *inode, struct file *filp, unsigned int cmd,
|
int gamma_version(struct inode *inode, struct file *filp, unsigned int cmd,
|
||||||
unsigned long arg)
|
unsigned long arg)
|
||||||
{
|
{
|
||||||
|
@ -447,7 +440,9 @@ int gamma_open(struct inode *inode, struct file *filp)
|
||||||
|
|
||||||
DRM_DEBUG("open_count = %d\n", dev->open_count);
|
DRM_DEBUG("open_count = %d\n", dev->open_count);
|
||||||
if (!(retcode = drm_open_helper(inode, filp, dev))) {
|
if (!(retcode = drm_open_helper(inode, filp, dev))) {
|
||||||
MOD_INC_USE_COUNT;
|
#if LINUX_VERSION_CODE < 0x020333
|
||||||
|
MOD_INC_USE_COUNT; /* Needed before Linux 2.3.51 */
|
||||||
|
#endif
|
||||||
atomic_inc(&dev->total_open);
|
atomic_inc(&dev->total_open);
|
||||||
spin_lock(&dev->count_lock);
|
spin_lock(&dev->count_lock);
|
||||||
if (!dev->open_count++) {
|
if (!dev->open_count++) {
|
||||||
|
@ -462,13 +457,17 @@ int gamma_open(struct inode *inode, struct file *filp)
|
||||||
int gamma_release(struct inode *inode, struct file *filp)
|
int gamma_release(struct inode *inode, struct file *filp)
|
||||||
{
|
{
|
||||||
drm_file_t *priv = filp->private_data;
|
drm_file_t *priv = filp->private_data;
|
||||||
drm_device_t *dev = priv->dev;
|
drm_device_t *dev;
|
||||||
int retcode = 0;
|
int retcode = 0;
|
||||||
|
|
||||||
DRM_DEBUG("open_count = %d\n", dev->open_count);
|
|
||||||
lock_kernel();
|
lock_kernel();
|
||||||
|
dev = priv->dev;
|
||||||
|
|
||||||
|
DRM_DEBUG("open_count = %d\n", dev->open_count);
|
||||||
if (!(retcode = drm_release(inode, filp))) {
|
if (!(retcode = drm_release(inode, filp))) {
|
||||||
MOD_DEC_USE_COUNT;
|
#if LINUX_VERSION_CODE < 0x020333
|
||||||
|
MOD_DEC_USE_COUNT; /* Needed before Linux 2.3.51 */
|
||||||
|
#endif
|
||||||
atomic_inc(&dev->total_close);
|
atomic_inc(&dev->total_close);
|
||||||
spin_lock(&dev->count_lock);
|
spin_lock(&dev->count_lock);
|
||||||
if (!--dev->open_count) {
|
if (!--dev->open_count) {
|
||||||
|
@ -481,9 +480,8 @@ int gamma_release(struct inode *inode, struct file *filp)
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
}
|
}
|
||||||
spin_unlock(&dev->count_lock);
|
spin_unlock(&dev->count_lock);
|
||||||
retcode = gamma_takedown(dev);
|
|
||||||
unlock_kernel();
|
unlock_kernel();
|
||||||
return retcode;
|
return gamma_takedown(dev);
|
||||||
}
|
}
|
||||||
spin_unlock(&dev->count_lock);
|
spin_unlock(&dev->count_lock);
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,8 +33,6 @@
|
||||||
#define _GAMMA_DRV_H_
|
#define _GAMMA_DRV_H_
|
||||||
|
|
||||||
/* gamma_drv.c */
|
/* gamma_drv.c */
|
||||||
extern int gamma_init(void);
|
|
||||||
extern void gamma_cleanup(void);
|
|
||||||
extern int gamma_version(struct inode *inode, struct file *filp,
|
extern int gamma_version(struct inode *inode, struct file *filp,
|
||||||
unsigned int cmd, unsigned long arg);
|
unsigned int cmd, unsigned long arg);
|
||||||
extern int gamma_open(struct inode *inode, struct file *filp);
|
extern int gamma_open(struct inode *inode, struct file *filp);
|
||||||
|
|
|
@ -29,8 +29,6 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <linux/sched.h>
|
|
||||||
|
|
||||||
#define __NO_VERSION__
|
#define __NO_VERSION__
|
||||||
#include "drmP.h"
|
#include "drmP.h"
|
||||||
#include "i810_drv.h"
|
#include "i810_drv.h"
|
||||||
|
|
|
@ -33,7 +33,6 @@
|
||||||
#define __NO_VERSION__
|
#define __NO_VERSION__
|
||||||
#include "drmP.h"
|
#include "drmP.h"
|
||||||
#include "i810_drv.h"
|
#include "i810_drv.h"
|
||||||
|
|
||||||
#include <linux/interrupt.h> /* For task queue support */
|
#include <linux/interrupt.h> /* For task queue support */
|
||||||
|
|
||||||
/* in case we don't have a 2.3.99-pre6 kernel or later: */
|
/* in case we don't have a 2.3.99-pre6 kernel or later: */
|
||||||
|
@ -157,15 +156,22 @@ static struct file_operations i810_buffer_fops = {
|
||||||
int i810_mmap_buffers(struct file *filp, struct vm_area_struct *vma)
|
int i810_mmap_buffers(struct file *filp, struct vm_area_struct *vma)
|
||||||
{
|
{
|
||||||
drm_file_t *priv = filp->private_data;
|
drm_file_t *priv = filp->private_data;
|
||||||
drm_device_t *dev = priv->dev;
|
drm_device_t *dev;
|
||||||
drm_i810_private_t *dev_priv = dev->dev_private;
|
drm_i810_private_t *dev_priv;
|
||||||
drm_buf_t *buf = dev_priv->mmap_buffer;
|
drm_buf_t *buf;
|
||||||
drm_i810_buf_priv_t *buf_priv = buf->dev_private;
|
drm_i810_buf_priv_t *buf_priv;
|
||||||
|
|
||||||
|
lock_kernel();
|
||||||
|
dev = priv->dev;
|
||||||
|
dev_priv = dev->dev_private;
|
||||||
|
buf = dev_priv->mmap_buffer;
|
||||||
|
buf_priv = buf->dev_private;
|
||||||
|
|
||||||
vma->vm_flags |= (VM_IO | VM_DONTCOPY);
|
vma->vm_flags |= (VM_IO | VM_DONTCOPY);
|
||||||
vma->vm_file = filp;
|
vma->vm_file = filp;
|
||||||
|
|
||||||
buf_priv->currently_mapped = I810_BUF_MAPPED;
|
buf_priv->currently_mapped = I810_BUF_MAPPED;
|
||||||
|
unlock_kernel();
|
||||||
|
|
||||||
if (remap_page_range(vma->vm_start,
|
if (remap_page_range(vma->vm_start,
|
||||||
VM_OFFSET(vma),
|
VM_OFFSET(vma),
|
||||||
|
|
|
@ -30,16 +30,9 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <linux/config.h>
|
#include <linux/config.h>
|
||||||
#ifndef EXPORT_SYMTAB
|
|
||||||
#define EXPORT_SYMTAB
|
|
||||||
#endif
|
|
||||||
#include "drmP.h"
|
#include "drmP.h"
|
||||||
#include "i810_drv.h"
|
#include "i810_drv.h"
|
||||||
|
|
||||||
|
|
||||||
EXPORT_SYMBOL(i810_init);
|
|
||||||
EXPORT_SYMBOL(i810_cleanup);
|
|
||||||
|
|
||||||
#define I810_NAME "i810"
|
#define I810_NAME "i810"
|
||||||
#define I810_DESC "Intel I810"
|
#define I810_DESC "Intel I810"
|
||||||
#define I810_DATE "20000719"
|
#define I810_DATE "20000719"
|
||||||
|
@ -132,9 +125,6 @@ MODULE_AUTHOR("VA Linux Systems, Inc.");
|
||||||
MODULE_DESCRIPTION("Intel I810");
|
MODULE_DESCRIPTION("Intel I810");
|
||||||
MODULE_PARM(i810, "s");
|
MODULE_PARM(i810, "s");
|
||||||
|
|
||||||
module_init(i810_init);
|
|
||||||
module_exit(i810_cleanup);
|
|
||||||
|
|
||||||
#ifndef MODULE
|
#ifndef MODULE
|
||||||
/* i810_options is called by the kernel to parse command-line options
|
/* i810_options is called by the kernel to parse command-line options
|
||||||
* passed via the boot-loader (e.g., LILO). It calls the insmod option
|
* passed via the boot-loader (e.g., LILO). It calls the insmod option
|
||||||
|
@ -348,7 +338,7 @@ static int i810_takedown(drm_device_t *dev)
|
||||||
/* i810_init is called via init_module at module load time, or via
|
/* i810_init is called via init_module at module load time, or via
|
||||||
* linux/init/main.c (this is not currently supported). */
|
* linux/init/main.c (this is not currently supported). */
|
||||||
|
|
||||||
int i810_init(void)
|
static int i810_init(void)
|
||||||
{
|
{
|
||||||
int retcode;
|
int retcode;
|
||||||
drm_device_t *dev = &i810_device;
|
drm_device_t *dev = &i810_device;
|
||||||
|
@ -407,7 +397,7 @@ int i810_init(void)
|
||||||
|
|
||||||
/* i810_cleanup is called via cleanup_module at module unload time. */
|
/* i810_cleanup is called via cleanup_module at module unload time. */
|
||||||
|
|
||||||
void i810_cleanup(void)
|
static void i810_cleanup(void)
|
||||||
{
|
{
|
||||||
drm_device_t *dev = &i810_device;
|
drm_device_t *dev = &i810_device;
|
||||||
|
|
||||||
|
@ -428,6 +418,10 @@ void i810_cleanup(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
module_init(i810_init);
|
||||||
|
module_exit(i810_cleanup);
|
||||||
|
|
||||||
|
|
||||||
int i810_version(struct inode *inode, struct file *filp, unsigned int cmd,
|
int i810_version(struct inode *inode, struct file *filp, unsigned int cmd,
|
||||||
unsigned long arg)
|
unsigned long arg)
|
||||||
{
|
{
|
||||||
|
@ -469,7 +463,9 @@ int i810_open(struct inode *inode, struct file *filp)
|
||||||
|
|
||||||
DRM_DEBUG("open_count = %d\n", dev->open_count);
|
DRM_DEBUG("open_count = %d\n", dev->open_count);
|
||||||
if (!(retcode = drm_open_helper(inode, filp, dev))) {
|
if (!(retcode = drm_open_helper(inode, filp, dev))) {
|
||||||
MOD_INC_USE_COUNT;
|
#if LINUX_VERSION_CODE < 0x020333
|
||||||
|
MOD_INC_USE_COUNT; /* Needed before Linux 2.3.51 */
|
||||||
|
#endif
|
||||||
atomic_inc(&dev->total_open);
|
atomic_inc(&dev->total_open);
|
||||||
spin_lock(&dev->count_lock);
|
spin_lock(&dev->count_lock);
|
||||||
if (!dev->open_count++) {
|
if (!dev->open_count++) {
|
||||||
|
@ -484,9 +480,11 @@ int i810_open(struct inode *inode, struct file *filp)
|
||||||
int i810_release(struct inode *inode, struct file *filp)
|
int i810_release(struct inode *inode, struct file *filp)
|
||||||
{
|
{
|
||||||
drm_file_t *priv = filp->private_data;
|
drm_file_t *priv = filp->private_data;
|
||||||
drm_device_t *dev = priv->dev;
|
drm_device_t *dev;
|
||||||
int retcode = 0;
|
int retcode = 0;
|
||||||
|
|
||||||
|
lock_kernel();
|
||||||
|
dev = priv->dev;
|
||||||
DRM_DEBUG("pid = %d, device = 0x%x, open_count = %d\n",
|
DRM_DEBUG("pid = %d, device = 0x%x, open_count = %d\n",
|
||||||
current->pid, dev->device, dev->open_count);
|
current->pid, dev->device, dev->open_count);
|
||||||
|
|
||||||
|
@ -548,7 +546,9 @@ int i810_release(struct inode *inode, struct file *filp)
|
||||||
up(&dev->struct_sem);
|
up(&dev->struct_sem);
|
||||||
|
|
||||||
drm_free(priv, sizeof(*priv), DRM_MEM_FILES);
|
drm_free(priv, sizeof(*priv), DRM_MEM_FILES);
|
||||||
MOD_DEC_USE_COUNT;
|
#if LINUX_VERSION_CODE < 0x020333
|
||||||
|
MOD_DEC_USE_COUNT; /* Needed before Linux 2.3.51 */
|
||||||
|
#endif
|
||||||
atomic_inc(&dev->total_close);
|
atomic_inc(&dev->total_close);
|
||||||
spin_lock(&dev->count_lock);
|
spin_lock(&dev->count_lock);
|
||||||
if (!--dev->open_count) {
|
if (!--dev->open_count) {
|
||||||
|
@ -557,12 +557,15 @@ int i810_release(struct inode *inode, struct file *filp)
|
||||||
atomic_read(&dev->ioctl_count),
|
atomic_read(&dev->ioctl_count),
|
||||||
dev->blocked);
|
dev->blocked);
|
||||||
spin_unlock(&dev->count_lock);
|
spin_unlock(&dev->count_lock);
|
||||||
|
unlock_kernel();
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
}
|
}
|
||||||
spin_unlock(&dev->count_lock);
|
spin_unlock(&dev->count_lock);
|
||||||
|
unlock_kernel();
|
||||||
return i810_takedown(dev);
|
return i810_takedown(dev);
|
||||||
}
|
}
|
||||||
spin_unlock(&dev->count_lock);
|
spin_unlock(&dev->count_lock);
|
||||||
|
unlock_kernel();
|
||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -77,8 +77,6 @@ typedef struct drm_i810_private {
|
||||||
} drm_i810_private_t;
|
} drm_i810_private_t;
|
||||||
|
|
||||||
/* i810_drv.c */
|
/* i810_drv.c */
|
||||||
extern int i810_init(void);
|
|
||||||
extern void i810_cleanup(void);
|
|
||||||
extern int i810_version(struct inode *inode, struct file *filp,
|
extern int i810_version(struct inode *inode, struct file *filp,
|
||||||
unsigned int cmd, unsigned long arg);
|
unsigned int cmd, unsigned long arg);
|
||||||
extern int i810_open(struct inode *inode, struct file *filp);
|
extern int i810_open(struct inode *inode, struct file *filp);
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define __NO_VERSION__
|
#define __NO_VERSION__
|
||||||
|
#include <linux/config.h>
|
||||||
#include "drmP.h"
|
#include "drmP.h"
|
||||||
|
|
||||||
typedef struct drm_mem_stats {
|
typedef struct drm_mem_stats {
|
||||||
|
@ -330,7 +331,7 @@ void drm_ioremapfree(void *pt, unsigned long size)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DRM_AGP
|
#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE)
|
||||||
agp_memory *drm_alloc_agp(int pages, u32 type)
|
agp_memory *drm_alloc_agp(int pages, u32 type)
|
||||||
{
|
{
|
||||||
agp_memory *handle;
|
agp_memory *handle;
|
||||||
|
|
|
@ -29,8 +29,6 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <linux/sched.h>
|
|
||||||
|
|
||||||
#define __NO_VERSION__
|
#define __NO_VERSION__
|
||||||
#include "drmP.h"
|
#include "drmP.h"
|
||||||
#include "mga_drv.h"
|
#include "mga_drv.h"
|
||||||
|
|
|
@ -31,13 +31,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <linux/config.h>
|
#include <linux/config.h>
|
||||||
#ifndef EXPORT_SYMTAB
|
|
||||||
#define EXPORT_SYMTAB
|
|
||||||
#endif
|
|
||||||
#include "drmP.h"
|
#include "drmP.h"
|
||||||
#include "mga_drv.h"
|
#include "mga_drv.h"
|
||||||
EXPORT_SYMBOL(mga_init);
|
|
||||||
EXPORT_SYMBOL(mga_cleanup);
|
|
||||||
|
|
||||||
#define MGA_NAME "mga"
|
#define MGA_NAME "mga"
|
||||||
#define MGA_DESC "Matrox g200/g400"
|
#define MGA_DESC "Matrox g200/g400"
|
||||||
|
@ -131,9 +126,6 @@ MODULE_AUTHOR("VA Linux Systems, Inc.");
|
||||||
MODULE_DESCRIPTION("Matrox g200/g400");
|
MODULE_DESCRIPTION("Matrox g200/g400");
|
||||||
MODULE_PARM(mga, "s");
|
MODULE_PARM(mga, "s");
|
||||||
|
|
||||||
module_init(mga_init);
|
|
||||||
module_exit(mga_cleanup);
|
|
||||||
|
|
||||||
#ifndef MODULE
|
#ifndef MODULE
|
||||||
/* mga_options is called by the kernel to parse command-line options passed
|
/* mga_options is called by the kernel to parse command-line options passed
|
||||||
* via the boot-loader (e.g., LILO). It calls the insmod option routine,
|
* via the boot-loader (e.g., LILO). It calls the insmod option routine,
|
||||||
|
@ -345,7 +337,7 @@ static int mga_takedown(drm_device_t *dev)
|
||||||
/* mga_init is called via init_module at module load time, or via
|
/* mga_init is called via init_module at module load time, or via
|
||||||
* linux/init/main.c (this is not currently supported). */
|
* linux/init/main.c (this is not currently supported). */
|
||||||
|
|
||||||
int mga_init(void)
|
static int mga_init(void)
|
||||||
{
|
{
|
||||||
int retcode;
|
int retcode;
|
||||||
drm_device_t *dev = &mga_device;
|
drm_device_t *dev = &mga_device;
|
||||||
|
@ -410,7 +402,7 @@ int mga_init(void)
|
||||||
|
|
||||||
/* mga_cleanup is called via cleanup_module at module unload time. */
|
/* mga_cleanup is called via cleanup_module at module unload time. */
|
||||||
|
|
||||||
void mga_cleanup(void)
|
static void mga_cleanup(void)
|
||||||
{
|
{
|
||||||
drm_device_t *dev = &mga_device;
|
drm_device_t *dev = &mga_device;
|
||||||
|
|
||||||
|
@ -442,6 +434,10 @@ void mga_cleanup(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
module_init(mga_init);
|
||||||
|
module_exit(mga_cleanup);
|
||||||
|
|
||||||
|
|
||||||
int mga_version(struct inode *inode, struct file *filp, unsigned int cmd,
|
int mga_version(struct inode *inode, struct file *filp, unsigned int cmd,
|
||||||
unsigned long arg)
|
unsigned long arg)
|
||||||
{
|
{
|
||||||
|
@ -483,7 +479,9 @@ int mga_open(struct inode *inode, struct file *filp)
|
||||||
|
|
||||||
DRM_DEBUG("open_count = %d\n", dev->open_count);
|
DRM_DEBUG("open_count = %d\n", dev->open_count);
|
||||||
if (!(retcode = drm_open_helper(inode, filp, dev))) {
|
if (!(retcode = drm_open_helper(inode, filp, dev))) {
|
||||||
MOD_INC_USE_COUNT;
|
#if LINUX_VERSION_CODE < 0x020333
|
||||||
|
MOD_INC_USE_COUNT; /* Needed before Linux 2.3.51 */
|
||||||
|
#endif
|
||||||
atomic_inc(&dev->total_open);
|
atomic_inc(&dev->total_open);
|
||||||
spin_lock(&dev->count_lock);
|
spin_lock(&dev->count_lock);
|
||||||
if (!dev->open_count++) {
|
if (!dev->open_count++) {
|
||||||
|
@ -498,9 +496,11 @@ int mga_open(struct inode *inode, struct file *filp)
|
||||||
int mga_release(struct inode *inode, struct file *filp)
|
int mga_release(struct inode *inode, struct file *filp)
|
||||||
{
|
{
|
||||||
drm_file_t *priv = filp->private_data;
|
drm_file_t *priv = filp->private_data;
|
||||||
drm_device_t *dev = priv->dev;
|
drm_device_t *dev;
|
||||||
int retcode = 0;
|
int retcode = 0;
|
||||||
|
|
||||||
|
lock_kernel();
|
||||||
|
dev = priv->dev;
|
||||||
DRM_DEBUG("pid = %d, device = 0x%x, open_count = %d\n",
|
DRM_DEBUG("pid = %d, device = 0x%x, open_count = %d\n",
|
||||||
current->pid, dev->device, dev->open_count);
|
current->pid, dev->device, dev->open_count);
|
||||||
|
|
||||||
|
@ -562,7 +562,9 @@ int mga_release(struct inode *inode, struct file *filp)
|
||||||
up(&dev->struct_sem);
|
up(&dev->struct_sem);
|
||||||
|
|
||||||
drm_free(priv, sizeof(*priv), DRM_MEM_FILES);
|
drm_free(priv, sizeof(*priv), DRM_MEM_FILES);
|
||||||
MOD_DEC_USE_COUNT;
|
#if LINUX_VERSION_CODE < 0x020333
|
||||||
|
MOD_DEC_USE_COUNT; /* Needed before Linux 2.3.51 */
|
||||||
|
#endif
|
||||||
atomic_inc(&dev->total_close);
|
atomic_inc(&dev->total_close);
|
||||||
spin_lock(&dev->count_lock);
|
spin_lock(&dev->count_lock);
|
||||||
if (!--dev->open_count) {
|
if (!--dev->open_count) {
|
||||||
|
@ -571,12 +573,15 @@ int mga_release(struct inode *inode, struct file *filp)
|
||||||
atomic_read(&dev->ioctl_count),
|
atomic_read(&dev->ioctl_count),
|
||||||
dev->blocked);
|
dev->blocked);
|
||||||
spin_unlock(&dev->count_lock);
|
spin_unlock(&dev->count_lock);
|
||||||
|
unlock_kernel();
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
}
|
}
|
||||||
spin_unlock(&dev->count_lock);
|
spin_unlock(&dev->count_lock);
|
||||||
|
unlock_kernel();
|
||||||
return mga_takedown(dev);
|
return mga_takedown(dev);
|
||||||
}
|
}
|
||||||
spin_unlock(&dev->count_lock);
|
spin_unlock(&dev->count_lock);
|
||||||
|
unlock_kernel();
|
||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -102,8 +102,6 @@ typedef struct _drm_mga_private {
|
||||||
} drm_mga_private_t;
|
} drm_mga_private_t;
|
||||||
|
|
||||||
/* mga_drv.c */
|
/* mga_drv.c */
|
||||||
extern int mga_init(void);
|
|
||||||
extern void mga_cleanup(void);
|
|
||||||
extern int mga_version(struct inode *inode, struct file *filp,
|
extern int mga_version(struct inode *inode, struct file *filp,
|
||||||
unsigned int cmd, unsigned long arg);
|
unsigned int cmd, unsigned long arg);
|
||||||
extern int mga_open(struct inode *inode, struct file *filp);
|
extern int mga_open(struct inode *inode, struct file *filp);
|
||||||
|
|
|
@ -521,9 +521,9 @@ static int _drm_histo_info(char *buf, char **start, off_t offset, int len,
|
||||||
} else {
|
} else {
|
||||||
DRM_PROC_PRINT("lock none\n");
|
DRM_PROC_PRINT("lock none\n");
|
||||||
}
|
}
|
||||||
DRM_PROC_PRINT("context_flag 0x%08x\n", dev->context_flag);
|
DRM_PROC_PRINT("context_flag 0x%08lx\n", dev->context_flag);
|
||||||
DRM_PROC_PRINT("interrupt_flag 0x%08x\n", dev->interrupt_flag);
|
DRM_PROC_PRINT("interrupt_flag 0x%08lx\n", dev->interrupt_flag);
|
||||||
DRM_PROC_PRINT("dma_flag 0x%08x\n", dev->dma_flag);
|
DRM_PROC_PRINT("dma_flag 0x%08lx\n", dev->dma_flag);
|
||||||
|
|
||||||
DRM_PROC_PRINT("queue_count %10d\n", dev->queue_count);
|
DRM_PROC_PRINT("queue_count %10d\n", dev->queue_count);
|
||||||
DRM_PROC_PRINT("last_context %10d\n", dev->last_context);
|
DRM_PROC_PRINT("last_context %10d\n", dev->last_context);
|
||||||
|
|
|
@ -31,12 +31,13 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define __NO_VERSION__
|
#define __NO_VERSION__
|
||||||
|
#include <linux/config.h>
|
||||||
#include "drmP.h"
|
#include "drmP.h"
|
||||||
#include "r128_drv.h"
|
#include "r128_drv.h"
|
||||||
#include "linux/un.h"
|
#include "linux/un.h"
|
||||||
|
|
||||||
|
|
||||||
#ifdef DRM_AGP
|
#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE)
|
||||||
int r128_addbufs_agp(struct inode *inode, struct file *filp, unsigned int cmd,
|
int r128_addbufs_agp(struct inode *inode, struct file *filp, unsigned int cmd,
|
||||||
unsigned long arg)
|
unsigned long arg)
|
||||||
{
|
{
|
||||||
|
@ -199,7 +200,7 @@ int r128_addbufs(struct inode *inode, struct file *filp, unsigned int cmd,
|
||||||
sizeof(request),
|
sizeof(request),
|
||||||
-EFAULT);
|
-EFAULT);
|
||||||
|
|
||||||
#ifdef DRM_AGP
|
#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE)
|
||||||
if (request.flags & _DRM_AGP_BUFFER)
|
if (request.flags & _DRM_AGP_BUFFER)
|
||||||
return r128_addbufs_agp(inode, filp, cmd, arg);
|
return r128_addbufs_agp(inode, filp, cmd, arg);
|
||||||
else
|
else
|
||||||
|
|
|
@ -28,8 +28,6 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <linux/sched.h>
|
|
||||||
|
|
||||||
#define __NO_VERSION__
|
#define __NO_VERSION__
|
||||||
#include "drmP.h"
|
#include "drmP.h"
|
||||||
#include "r128_drv.h"
|
#include "r128_drv.h"
|
||||||
|
@ -38,10 +36,6 @@ extern drm_ctx_t r128_res_ctx;
|
||||||
|
|
||||||
static int r128_alloc_queue(drm_device_t *dev)
|
static int r128_alloc_queue(drm_device_t *dev)
|
||||||
{
|
{
|
||||||
#if 0
|
|
||||||
static int context = 0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return drm_ctxbitmap_next(dev);
|
return drm_ctxbitmap_next(dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,13 +30,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <linux/config.h>
|
#include <linux/config.h>
|
||||||
#ifndef EXPORT_SYMTAB
|
|
||||||
#define EXPORT_SYMTAB
|
|
||||||
#endif
|
|
||||||
#include "drmP.h"
|
#include "drmP.h"
|
||||||
#include "r128_drv.h"
|
#include "r128_drv.h"
|
||||||
EXPORT_SYMBOL(r128_init);
|
|
||||||
EXPORT_SYMBOL(r128_cleanup);
|
|
||||||
|
|
||||||
#define R128_NAME "r128"
|
#define R128_NAME "r128"
|
||||||
#define R128_DESC "ATI Rage 128"
|
#define R128_DESC "ATI Rage 128"
|
||||||
|
@ -99,7 +94,7 @@ static drm_ioctl_desc_t r128_ioctls[] = {
|
||||||
[DRM_IOCTL_NR(DRM_IOCTL_UNLOCK)] = { r128_unlock, 1, 0 },
|
[DRM_IOCTL_NR(DRM_IOCTL_UNLOCK)] = { r128_unlock, 1, 0 },
|
||||||
[DRM_IOCTL_NR(DRM_IOCTL_FINISH)] = { drm_finish, 1, 0 },
|
[DRM_IOCTL_NR(DRM_IOCTL_FINISH)] = { drm_finish, 1, 0 },
|
||||||
|
|
||||||
#ifdef DRM_AGP
|
#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE)
|
||||||
[DRM_IOCTL_NR(DRM_IOCTL_AGP_ACQUIRE)] = { drm_agp_acquire, 1, 1 },
|
[DRM_IOCTL_NR(DRM_IOCTL_AGP_ACQUIRE)] = { drm_agp_acquire, 1, 1 },
|
||||||
[DRM_IOCTL_NR(DRM_IOCTL_AGP_RELEASE)] = { drm_agp_release, 1, 1 },
|
[DRM_IOCTL_NR(DRM_IOCTL_AGP_RELEASE)] = { drm_agp_release, 1, 1 },
|
||||||
[DRM_IOCTL_NR(DRM_IOCTL_AGP_ENABLE)] = { drm_agp_enable, 1, 1 },
|
[DRM_IOCTL_NR(DRM_IOCTL_AGP_ENABLE)] = { drm_agp_enable, 1, 1 },
|
||||||
|
@ -127,9 +122,6 @@ MODULE_AUTHOR("VA Linux Systems, Inc.");
|
||||||
MODULE_DESCRIPTION("r128");
|
MODULE_DESCRIPTION("r128");
|
||||||
MODULE_PARM(r128, "s");
|
MODULE_PARM(r128, "s");
|
||||||
|
|
||||||
module_init(r128_init);
|
|
||||||
module_exit(r128_cleanup);
|
|
||||||
|
|
||||||
#ifndef MODULE
|
#ifndef MODULE
|
||||||
/* r128_options is called by the kernel to parse command-line options
|
/* r128_options is called by the kernel to parse command-line options
|
||||||
* passed via the boot-loader (e.g., LILO). It calls the insmod option
|
* passed via the boot-loader (e.g., LILO). It calls the insmod option
|
||||||
|
@ -244,7 +236,7 @@ static int r128_takedown(drm_device_t *dev)
|
||||||
dev->magiclist[i].head = dev->magiclist[i].tail = NULL;
|
dev->magiclist[i].head = dev->magiclist[i].tail = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DRM_AGP
|
#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE)
|
||||||
/* Clear AGP information */
|
/* Clear AGP information */
|
||||||
if (dev->agp) {
|
if (dev->agp) {
|
||||||
drm_agp_mem_t *entry;
|
drm_agp_mem_t *entry;
|
||||||
|
@ -331,7 +323,7 @@ static int r128_takedown(drm_device_t *dev)
|
||||||
/* r128_init is called via init_module at module load time, or via
|
/* r128_init is called via init_module at module load time, or via
|
||||||
* linux/init/main.c (this is not currently supported). */
|
* linux/init/main.c (this is not currently supported). */
|
||||||
|
|
||||||
int r128_init(void)
|
static int r128_init(void)
|
||||||
{
|
{
|
||||||
int retcode;
|
int retcode;
|
||||||
drm_device_t *dev = &r128_device;
|
drm_device_t *dev = &r128_device;
|
||||||
|
@ -356,7 +348,7 @@ int r128_init(void)
|
||||||
drm_mem_init();
|
drm_mem_init();
|
||||||
drm_proc_init(dev);
|
drm_proc_init(dev);
|
||||||
|
|
||||||
#ifdef DRM_AGP
|
#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE)
|
||||||
dev->agp = drm_agp_init();
|
dev->agp = drm_agp_init();
|
||||||
if (dev->agp == NULL) {
|
if (dev->agp == NULL) {
|
||||||
DRM_ERROR("Cannot initialize agpgart module.\n");
|
DRM_ERROR("Cannot initialize agpgart module.\n");
|
||||||
|
@ -395,7 +387,7 @@ int r128_init(void)
|
||||||
|
|
||||||
/* r128_cleanup is called via cleanup_module at module unload time. */
|
/* r128_cleanup is called via cleanup_module at module unload time. */
|
||||||
|
|
||||||
void r128_cleanup(void)
|
static void r128_cleanup(void)
|
||||||
{
|
{
|
||||||
drm_device_t *dev = &r128_device;
|
drm_device_t *dev = &r128_device;
|
||||||
|
|
||||||
|
@ -409,7 +401,7 @@ void r128_cleanup(void)
|
||||||
}
|
}
|
||||||
drm_ctxbitmap_cleanup(dev);
|
drm_ctxbitmap_cleanup(dev);
|
||||||
r128_takedown(dev);
|
r128_takedown(dev);
|
||||||
#ifdef DRM_AGP
|
#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE)
|
||||||
if (dev->agp) {
|
if (dev->agp) {
|
||||||
drm_agp_uninit();
|
drm_agp_uninit();
|
||||||
drm_free(dev->agp, sizeof(*dev->agp), DRM_MEM_AGPLISTS);
|
drm_free(dev->agp, sizeof(*dev->agp), DRM_MEM_AGPLISTS);
|
||||||
|
@ -418,6 +410,10 @@ void r128_cleanup(void)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
module_init(r128_init);
|
||||||
|
module_exit(r128_cleanup);
|
||||||
|
|
||||||
|
|
||||||
int r128_version(struct inode *inode, struct file *filp, unsigned int cmd,
|
int r128_version(struct inode *inode, struct file *filp, unsigned int cmd,
|
||||||
unsigned long arg)
|
unsigned long arg)
|
||||||
{
|
{
|
||||||
|
@ -459,7 +455,9 @@ int r128_open(struct inode *inode, struct file *filp)
|
||||||
|
|
||||||
DRM_DEBUG("open_count = %d\n", dev->open_count);
|
DRM_DEBUG("open_count = %d\n", dev->open_count);
|
||||||
if (!(retcode = drm_open_helper(inode, filp, dev))) {
|
if (!(retcode = drm_open_helper(inode, filp, dev))) {
|
||||||
MOD_INC_USE_COUNT;
|
#if LINUX_VERSION_CODE < 0x020333
|
||||||
|
MOD_INC_USE_COUNT; /* Needed before Linux 2.3.51 */
|
||||||
|
#endif
|
||||||
atomic_inc(&dev->total_open);
|
atomic_inc(&dev->total_open);
|
||||||
spin_lock(&dev->count_lock);
|
spin_lock(&dev->count_lock);
|
||||||
if (!dev->open_count++) {
|
if (!dev->open_count++) {
|
||||||
|
@ -468,18 +466,23 @@ int r128_open(struct inode *inode, struct file *filp)
|
||||||
}
|
}
|
||||||
spin_unlock(&dev->count_lock);
|
spin_unlock(&dev->count_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
int r128_release(struct inode *inode, struct file *filp)
|
int r128_release(struct inode *inode, struct file *filp)
|
||||||
{
|
{
|
||||||
drm_file_t *priv = filp->private_data;
|
drm_file_t *priv = filp->private_data;
|
||||||
drm_device_t *dev = priv->dev;
|
drm_device_t *dev;
|
||||||
int retcode = 0;
|
int retcode = 0;
|
||||||
|
|
||||||
|
lock_kernel();
|
||||||
|
dev = priv->dev;
|
||||||
DRM_DEBUG("open_count = %d\n", dev->open_count);
|
DRM_DEBUG("open_count = %d\n", dev->open_count);
|
||||||
if (!(retcode = drm_release(inode, filp))) {
|
if (!(retcode = drm_release(inode, filp))) {
|
||||||
MOD_DEC_USE_COUNT;
|
#if LINUX_VERSION_CODE < 0x020333
|
||||||
|
MOD_DEC_USE_COUNT; /* Needed before Linux 2.3.51 */
|
||||||
|
#endif
|
||||||
atomic_inc(&dev->total_close);
|
atomic_inc(&dev->total_close);
|
||||||
spin_lock(&dev->count_lock);
|
spin_lock(&dev->count_lock);
|
||||||
if (!--dev->open_count) {
|
if (!--dev->open_count) {
|
||||||
|
@ -488,13 +491,17 @@ int r128_release(struct inode *inode, struct file *filp)
|
||||||
atomic_read(&dev->ioctl_count),
|
atomic_read(&dev->ioctl_count),
|
||||||
dev->blocked);
|
dev->blocked);
|
||||||
spin_unlock(&dev->count_lock);
|
spin_unlock(&dev->count_lock);
|
||||||
|
unlock_kernel();
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
}
|
}
|
||||||
spin_unlock(&dev->count_lock);
|
spin_unlock(&dev->count_lock);
|
||||||
|
unlock_kernel();
|
||||||
return r128_takedown(dev);
|
return r128_takedown(dev);
|
||||||
}
|
}
|
||||||
spin_unlock(&dev->count_lock);
|
spin_unlock(&dev->count_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unlock_kernel();
|
||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -69,8 +69,6 @@ typedef struct drm_r128_buf_priv {
|
||||||
} drm_r128_buf_priv_t;
|
} drm_r128_buf_priv_t;
|
||||||
|
|
||||||
/* r128_drv.c */
|
/* r128_drv.c */
|
||||||
extern int r128_init(void);
|
|
||||||
extern void r128_cleanup(void);
|
|
||||||
extern int r128_version(struct inode *inode, struct file *filp,
|
extern int r128_version(struct inode *inode, struct file *filp,
|
||||||
unsigned int cmd, unsigned long arg);
|
unsigned int cmd, unsigned long arg);
|
||||||
extern int r128_open(struct inode *inode, struct file *filp);
|
extern int r128_open(struct inode *inode, struct file *filp);
|
||||||
|
|
|
@ -30,8 +30,6 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <linux/sched.h>
|
|
||||||
|
|
||||||
#define __NO_VERSION__
|
#define __NO_VERSION__
|
||||||
#include "drmP.h"
|
#include "drmP.h"
|
||||||
#include "tdfx_drv.h"
|
#include "tdfx_drv.h"
|
||||||
|
|
|
@ -31,13 +31,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <linux/config.h>
|
#include <linux/config.h>
|
||||||
#ifndef EXPORT_SYMTAB
|
|
||||||
#define EXPORT_SYMTAB
|
|
||||||
#endif
|
|
||||||
#include "drmP.h"
|
#include "drmP.h"
|
||||||
#include "tdfx_drv.h"
|
#include "tdfx_drv.h"
|
||||||
EXPORT_SYMBOL(tdfx_init);
|
|
||||||
EXPORT_SYMBOL(tdfx_cleanup);
|
|
||||||
|
|
||||||
#define TDFX_NAME "tdfx"
|
#define TDFX_NAME "tdfx"
|
||||||
#define TDFX_DESC "3dfx Banshee/Voodoo3+"
|
#define TDFX_DESC "3dfx Banshee/Voodoo3+"
|
||||||
|
@ -94,7 +89,7 @@ static drm_ioctl_desc_t tdfx_ioctls[] = {
|
||||||
[DRM_IOCTL_NR(DRM_IOCTL_LOCK)] = { tdfx_lock, 1, 0 },
|
[DRM_IOCTL_NR(DRM_IOCTL_LOCK)] = { tdfx_lock, 1, 0 },
|
||||||
[DRM_IOCTL_NR(DRM_IOCTL_UNLOCK)] = { tdfx_unlock, 1, 0 },
|
[DRM_IOCTL_NR(DRM_IOCTL_UNLOCK)] = { tdfx_unlock, 1, 0 },
|
||||||
[DRM_IOCTL_NR(DRM_IOCTL_FINISH)] = { drm_finish, 1, 0 },
|
[DRM_IOCTL_NR(DRM_IOCTL_FINISH)] = { drm_finish, 1, 0 },
|
||||||
#ifdef DRM_AGP
|
#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE)
|
||||||
[DRM_IOCTL_NR(DRM_IOCTL_AGP_ACQUIRE)] = {drm_agp_acquire, 1, 1},
|
[DRM_IOCTL_NR(DRM_IOCTL_AGP_ACQUIRE)] = {drm_agp_acquire, 1, 1},
|
||||||
[DRM_IOCTL_NR(DRM_IOCTL_AGP_RELEASE)] = {drm_agp_release, 1, 1},
|
[DRM_IOCTL_NR(DRM_IOCTL_AGP_RELEASE)] = {drm_agp_release, 1, 1},
|
||||||
[DRM_IOCTL_NR(DRM_IOCTL_AGP_ENABLE)] = {drm_agp_enable, 1, 1},
|
[DRM_IOCTL_NR(DRM_IOCTL_AGP_ENABLE)] = {drm_agp_enable, 1, 1},
|
||||||
|
@ -115,9 +110,6 @@ MODULE_AUTHOR("VA Linux Systems, Inc.");
|
||||||
MODULE_DESCRIPTION("tdfx");
|
MODULE_DESCRIPTION("tdfx");
|
||||||
MODULE_PARM(tdfx, "s");
|
MODULE_PARM(tdfx, "s");
|
||||||
|
|
||||||
module_init(tdfx_init);
|
|
||||||
module_exit(tdfx_cleanup);
|
|
||||||
|
|
||||||
#ifndef MODULE
|
#ifndef MODULE
|
||||||
/* tdfx_options is called by the kernel to parse command-line options
|
/* tdfx_options is called by the kernel to parse command-line options
|
||||||
* passed via the boot-loader (e.g., LILO). It calls the insmod option
|
* passed via the boot-loader (e.g., LILO). It calls the insmod option
|
||||||
|
@ -230,7 +222,7 @@ static int tdfx_takedown(drm_device_t *dev)
|
||||||
}
|
}
|
||||||
dev->magiclist[i].head = dev->magiclist[i].tail = NULL;
|
dev->magiclist[i].head = dev->magiclist[i].tail = NULL;
|
||||||
}
|
}
|
||||||
#ifdef DRM_AGP
|
#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE)
|
||||||
/* Clear AGP information */
|
/* Clear AGP information */
|
||||||
if (dev->agp) {
|
if (dev->agp) {
|
||||||
drm_agp_mem_t *temp;
|
drm_agp_mem_t *temp;
|
||||||
|
@ -306,7 +298,7 @@ static int tdfx_takedown(drm_device_t *dev)
|
||||||
/* tdfx_init is called via init_module at module load time, or via
|
/* tdfx_init is called via init_module at module load time, or via
|
||||||
* linux/init/main.c (this is not currently supported). */
|
* linux/init/main.c (this is not currently supported). */
|
||||||
|
|
||||||
int tdfx_init(void)
|
static int tdfx_init(void)
|
||||||
{
|
{
|
||||||
int retcode;
|
int retcode;
|
||||||
drm_device_t *dev = &tdfx_device;
|
drm_device_t *dev = &tdfx_device;
|
||||||
|
@ -330,7 +322,7 @@ int tdfx_init(void)
|
||||||
|
|
||||||
drm_mem_init();
|
drm_mem_init();
|
||||||
drm_proc_init(dev);
|
drm_proc_init(dev);
|
||||||
#ifdef DRM_AGP
|
#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE)
|
||||||
dev->agp = drm_agp_init();
|
dev->agp = drm_agp_init();
|
||||||
#endif
|
#endif
|
||||||
if((retcode = drm_ctxbitmap_init(dev))) {
|
if((retcode = drm_ctxbitmap_init(dev))) {
|
||||||
|
@ -354,7 +346,7 @@ int tdfx_init(void)
|
||||||
|
|
||||||
/* tdfx_cleanup is called via cleanup_module at module unload time. */
|
/* tdfx_cleanup is called via cleanup_module at module unload time. */
|
||||||
|
|
||||||
void tdfx_cleanup(void)
|
static void tdfx_cleanup(void)
|
||||||
{
|
{
|
||||||
drm_device_t *dev = &tdfx_device;
|
drm_device_t *dev = &tdfx_device;
|
||||||
|
|
||||||
|
@ -368,7 +360,7 @@ void tdfx_cleanup(void)
|
||||||
}
|
}
|
||||||
drm_ctxbitmap_cleanup(dev);
|
drm_ctxbitmap_cleanup(dev);
|
||||||
tdfx_takedown(dev);
|
tdfx_takedown(dev);
|
||||||
#ifdef DRM_AGP
|
#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE)
|
||||||
if (dev->agp) {
|
if (dev->agp) {
|
||||||
drm_agp_uninit();
|
drm_agp_uninit();
|
||||||
drm_free(dev->agp, sizeof(*dev->agp), DRM_MEM_AGPLISTS);
|
drm_free(dev->agp, sizeof(*dev->agp), DRM_MEM_AGPLISTS);
|
||||||
|
@ -377,6 +369,10 @@ void tdfx_cleanup(void)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
module_init(tdfx_init);
|
||||||
|
module_exit(tdfx_cleanup);
|
||||||
|
|
||||||
|
|
||||||
int tdfx_version(struct inode *inode, struct file *filp, unsigned int cmd,
|
int tdfx_version(struct inode *inode, struct file *filp, unsigned int cmd,
|
||||||
unsigned long arg)
|
unsigned long arg)
|
||||||
{
|
{
|
||||||
|
@ -418,7 +414,9 @@ int tdfx_open(struct inode *inode, struct file *filp)
|
||||||
|
|
||||||
DRM_DEBUG("open_count = %d\n", dev->open_count);
|
DRM_DEBUG("open_count = %d\n", dev->open_count);
|
||||||
if (!(retcode = drm_open_helper(inode, filp, dev))) {
|
if (!(retcode = drm_open_helper(inode, filp, dev))) {
|
||||||
MOD_INC_USE_COUNT;
|
#if LINUX_VERSION_CODE < 0x020333
|
||||||
|
MOD_INC_USE_COUNT; /* Needed before Linux 2.3.51 */
|
||||||
|
#endif
|
||||||
atomic_inc(&dev->total_open);
|
atomic_inc(&dev->total_open);
|
||||||
spin_lock(&dev->count_lock);
|
spin_lock(&dev->count_lock);
|
||||||
if (!dev->open_count++) {
|
if (!dev->open_count++) {
|
||||||
|
@ -433,12 +431,17 @@ int tdfx_open(struct inode *inode, struct file *filp)
|
||||||
int tdfx_release(struct inode *inode, struct file *filp)
|
int tdfx_release(struct inode *inode, struct file *filp)
|
||||||
{
|
{
|
||||||
drm_file_t *priv = filp->private_data;
|
drm_file_t *priv = filp->private_data;
|
||||||
drm_device_t *dev = priv->dev;
|
drm_device_t *dev;
|
||||||
int retcode = 0;
|
int retcode = 0;
|
||||||
|
|
||||||
|
lock_kernel();
|
||||||
|
dev = priv->dev;
|
||||||
|
|
||||||
DRM_DEBUG("open_count = %d\n", dev->open_count);
|
DRM_DEBUG("open_count = %d\n", dev->open_count);
|
||||||
if (!(retcode = drm_release(inode, filp))) {
|
if (!(retcode = drm_release(inode, filp))) {
|
||||||
MOD_DEC_USE_COUNT;
|
#if LINUX_VERSION_CODE < 0x020333
|
||||||
|
MOD_DEC_USE_COUNT; /* Needed before Linux 2.3.51 */
|
||||||
|
#endif
|
||||||
atomic_inc(&dev->total_close);
|
atomic_inc(&dev->total_close);
|
||||||
spin_lock(&dev->count_lock);
|
spin_lock(&dev->count_lock);
|
||||||
if (!--dev->open_count) {
|
if (!--dev->open_count) {
|
||||||
|
@ -447,13 +450,17 @@ int tdfx_release(struct inode *inode, struct file *filp)
|
||||||
atomic_read(&dev->ioctl_count),
|
atomic_read(&dev->ioctl_count),
|
||||||
dev->blocked);
|
dev->blocked);
|
||||||
spin_unlock(&dev->count_lock);
|
spin_unlock(&dev->count_lock);
|
||||||
|
unlock_kernel();
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
}
|
}
|
||||||
spin_unlock(&dev->count_lock);
|
spin_unlock(&dev->count_lock);
|
||||||
|
unlock_kernel();
|
||||||
return tdfx_takedown(dev);
|
return tdfx_takedown(dev);
|
||||||
}
|
}
|
||||||
spin_unlock(&dev->count_lock);
|
spin_unlock(&dev->count_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unlock_kernel();
|
||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,8 +34,6 @@
|
||||||
#define _TDFX_DRV_H_
|
#define _TDFX_DRV_H_
|
||||||
|
|
||||||
/* tdfx_drv.c */
|
/* tdfx_drv.c */
|
||||||
extern int tdfx_init(void);
|
|
||||||
extern void tdfx_cleanup(void);
|
|
||||||
extern int tdfx_version(struct inode *inode, struct file *filp,
|
extern int tdfx_version(struct inode *inode, struct file *filp,
|
||||||
unsigned int cmd, unsigned long arg);
|
unsigned int cmd, unsigned long arg);
|
||||||
extern int tdfx_open(struct inode *inode, struct file *filp);
|
extern int tdfx_open(struct inode *inode, struct file *filp);
|
||||||
|
|
23
linux/vm.c
23
linux/vm.c
|
@ -145,7 +145,11 @@ void drm_vm_open(struct vm_area_struct *vma)
|
||||||
DRM_DEBUG("0x%08lx,0x%08lx\n",
|
DRM_DEBUG("0x%08lx,0x%08lx\n",
|
||||||
vma->vm_start, vma->vm_end - vma->vm_start);
|
vma->vm_start, vma->vm_end - vma->vm_start);
|
||||||
atomic_inc(&dev->vma_count);
|
atomic_inc(&dev->vma_count);
|
||||||
MOD_INC_USE_COUNT;
|
#if LINUX_VERSION_CODE < 0x020333
|
||||||
|
/* The map can exist after the fd is closed. */
|
||||||
|
MOD_INC_USE_COUNT; /* Needed before Linux 2.3.51 */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if DRM_DEBUG_CODE
|
#if DRM_DEBUG_CODE
|
||||||
vma_entry = drm_alloc(sizeof(*vma_entry), DRM_MEM_VMAS);
|
vma_entry = drm_alloc(sizeof(*vma_entry), DRM_MEM_VMAS);
|
||||||
|
@ -170,7 +174,9 @@ void drm_vm_close(struct vm_area_struct *vma)
|
||||||
|
|
||||||
DRM_DEBUG("0x%08lx,0x%08lx\n",
|
DRM_DEBUG("0x%08lx,0x%08lx\n",
|
||||||
vma->vm_start, vma->vm_end - vma->vm_start);
|
vma->vm_start, vma->vm_end - vma->vm_start);
|
||||||
MOD_DEC_USE_COUNT;
|
#if LINUX_VERSION_CODE < 0x020333
|
||||||
|
MOD_DEC_USE_COUNT; /* Needed before Linux 2.3.51 */
|
||||||
|
#endif
|
||||||
atomic_dec(&dev->vma_count);
|
atomic_dec(&dev->vma_count);
|
||||||
|
|
||||||
#if DRM_DEBUG_CODE
|
#if DRM_DEBUG_CODE
|
||||||
|
@ -193,15 +199,22 @@ void drm_vm_close(struct vm_area_struct *vma)
|
||||||
int drm_mmap_dma(struct file *filp, struct vm_area_struct *vma)
|
int drm_mmap_dma(struct file *filp, struct vm_area_struct *vma)
|
||||||
{
|
{
|
||||||
drm_file_t *priv = filp->private_data;
|
drm_file_t *priv = filp->private_data;
|
||||||
drm_device_t *dev = priv->dev;
|
drm_device_t *dev;
|
||||||
drm_device_dma_t *dma = dev->dma;
|
drm_device_dma_t *dma;
|
||||||
unsigned long length = vma->vm_end - vma->vm_start;
|
unsigned long length = vma->vm_end - vma->vm_start;
|
||||||
|
|
||||||
|
lock_kernel();
|
||||||
|
dev = priv->dev;
|
||||||
|
dma = dev->dma;
|
||||||
DRM_DEBUG("start = 0x%lx, end = 0x%lx, offset = 0x%lx\n",
|
DRM_DEBUG("start = 0x%lx, end = 0x%lx, offset = 0x%lx\n",
|
||||||
vma->vm_start, vma->vm_end, VM_OFFSET(vma));
|
vma->vm_start, vma->vm_end, VM_OFFSET(vma));
|
||||||
|
|
||||||
/* Length must match exact page count */
|
/* Length must match exact page count */
|
||||||
if ((length >> PAGE_SHIFT) != dma->page_count) return -EINVAL;
|
if ((length >> PAGE_SHIFT) != dma->page_count) {
|
||||||
|
unlock_kernel();
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
unlock_kernel();
|
||||||
|
|
||||||
vma->vm_ops = &drm_vm_dma_ops;
|
vma->vm_ops = &drm_vm_dma_ops;
|
||||||
vma->vm_flags |= VM_LOCKED | VM_SHM; /* Don't swap */
|
vma->vm_flags |= VM_LOCKED | VM_SHM; /* Don't swap */
|
||||||
|
|
Loading…
Reference in New Issue