Commit dfc05323 authored by Linus Torvalds's avatar Linus Torvalds

v2.4.7.6 -> v2.4.7.7

  - me: sane and nice VM balancing
  - Jeff Hartmann: upgrade DRM to XF86 4.1.x, drop support for 4.0.x
parent 52683c56
VERSION = 2 VERSION = 2
PATCHLEVEL = 4 PATCHLEVEL = 4
SUBLEVEL = 8 SUBLEVEL = 8
EXTRAVERSION =-pre5 EXTRAVERSION =-pre7
KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
......
...@@ -2,14 +2,14 @@ ...@@ -2,14 +2,14 @@
# drm device configuration # drm device configuration
# #
# This driver provides support for the # This driver provides support for the
# Direct Rendering Infrastructure (DRI) in XFree86 4.x. # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
# #
bool 'Direct Rendering Manager (XFree86 DRI support)' CONFIG_DRM bool 'Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)' CONFIG_DRM
if [ "$CONFIG_DRM" != "n" ]; then if [ "$CONFIG_DRM" != "n" ]; then
tristate ' 3dfx Banshee/Voodoo3+' CONFIG_DRM_TDFX tristate ' 3dfx Banshee/Voodoo3+' CONFIG_DRM_TDFX
tristate ' 3dlabs GMX 2000' CONFIG_DRM_GAMMA tristate ' 3dlabs GMX 2000' CONFIG_DRM_GAMMA
dep_tristate ' ATI Rage 128' CONFIG_DRM_R128 $CONFIG_AGP tristate ' ATI Rage 128' CONFIG_DRM_R128
dep_tristate ' ATI Radeon' CONFIG_DRM_RADEON $CONFIG_AGP dep_tristate ' ATI Radeon' CONFIG_DRM_RADEON $CONFIG_AGP
dep_tristate ' Intel I810' CONFIG_DRM_I810 $CONFIG_AGP dep_tristate ' Intel I810' CONFIG_DRM_I810 $CONFIG_AGP
dep_tristate ' Matrox g200/g400' CONFIG_DRM_MGA $CONFIG_AGP dep_tristate ' Matrox g200/g400' CONFIG_DRM_MGA $CONFIG_AGP
......
# #
# Makefile for the drm device driver. This driver provides support for # Makefile for the drm device driver. This driver provides support for the
# the Direct Rendering Infrastructure (DRI) in XFree86 4.x. # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
#
O_TARGET := drm.o O_TARGET := drm.o
export-objs := gamma_drv.o tdfx_drv.o r128_drv.o mga_drv.o i810_drv.o \
ffb_drv.o
list-multi := gamma.o tdfx.o r128.o mga.o i810.o ffb.o
export-objs := gamma_drv.o tdfx_drv.o r128_drv.o ffb_drv.o mga_drv.o \
i810_drv.o
# lib-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.
#
# NOTE: lib-objs will be eliminated in future versions, thereby
# eliminating the need to compile the .o files into every module, but
# for now we still need them.
#
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
ifeq ($(CONFIG_AGP),y)
lib-objs += agpsupport.o
else
ifeq ($(CONFIG_AGP),m)
lib-objs += agpsupport.o
endif
endif
list-multi := gamma.o tdfx.o r128.o ffb.o mga.o i810.o
gamma-objs := gamma_drv.o gamma_dma.o gamma-objs := gamma_drv.o gamma_dma.o
tdfx-objs := tdfx_drv.o tdfx_context.o tdfx-objs := tdfx_drv.o
r128-objs := r128_drv.o r128_cce.o r128_context.o r128_bufs.o r128_state.o r128-objs := r128_drv.o r128_cce.o r128_state.o
mga-objs := mga_drv.o mga_dma.o mga_state.o mga_warp.o
i810-objs := i810_drv.o i810_dma.o
radeon-objs := radeon_drv.o radeon_cp.o radeon_state.o
ffb-objs := ffb_drv.o ffb_context.o ffb-objs := ffb_drv.o ffb_context.o
mga-objs := mga_drv.o mga_dma.o mga_context.o mga_bufs.o mga_state.o
i810-objs := i810_drv.o i810_dma.o i810_context.o i810_bufs.o
radeon-objs := radeon_drv.o radeon_cp.o radeon_context.o radeon_bufs.o radeon_state.o
obj-$(CONFIG_DRM_GAMMA) += gamma.o obj-$(CONFIG_DRM_GAMMA) += gamma.o
obj-$(CONFIG_DRM_TDFX) += tdfx.o obj-$(CONFIG_DRM_TDFX) += tdfx.o
obj-$(CONFIG_DRM_R128) += r128.o obj-$(CONFIG_DRM_R128) += r128.o
obj-$(CONFIG_DRM_RADEON)+= radeon.o obj-$(CONFIG_DRM_RADEON)+= radeon.o
obj-$(CONFIG_DRM_FFB) += ffb.o
obj-$(CONFIG_DRM_MGA) += mga.o obj-$(CONFIG_DRM_MGA) += mga.o
obj-$(CONFIG_DRM_I810) += i810.o obj-$(CONFIG_DRM_I810) += i810.o
obj-$(CONFIG_DRM_FFB) += ffb.o
# When linking into the kernel, link the library just once.
# If making modules, we include the library into each module
lib-objs-mod := $(patsubst %.o,%-mod.o,$(lib-objs))
ifdef MAKING_MODULES
lib = drmlib-mod.a
else
obj-y += drmlib.a
endif
include $(TOPDIR)/Rules.make include $(TOPDIR)/Rules.make
$(patsubst %.o,%.c,$(lib-objs-mod)):
@ln -sf $(subst -mod,,$@) $@
drmlib-mod.a: $(lib-objs-mod)
rm -f $@
$(AR) $(EXTRA_ARFLAGS) rcs $@ $(lib-objs-mod)
drmlib.a: $(lib-objs)
rm -f $@
$(AR) $(EXTRA_ARFLAGS) rcs $@ $(lib-objs)
gamma.o: $(gamma-objs) $(lib) gamma.o: $(gamma-objs) $(lib)
$(LD) -r -o $@ $(gamma-objs) $(lib) $(LD) -r -o $@ $(gamma-objs) $(lib)
......
/* ati_pcigart.h -- ATI PCI GART support -*- linux-c -*-
* Created: Wed Dec 13 21:52:19 2000 by gareth@valinux.com
*
* Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
* Authors:
* Gareth Hughes <gareth@valinux.com>
*/
#define __NO_VERSION__
#include "drmP.h"
#if PAGE_SIZE == 8192
# define ATI_PCIGART_TABLE_ORDER 2
# define ATI_PCIGART_TABLE_PAGES (1 << 2)
#elif PAGE_SIZE == 4096
# define ATI_PCIGART_TABLE_ORDER 3
# define ATI_PCIGART_TABLE_PAGES (1 << 3)
#elif
# error - PAGE_SIZE not 8K or 4K
#endif
# define ATI_MAX_PCIGART_PAGES 8192 /* 32 MB aperture, 4K pages */
# define ATI_PCIGART_PAGE_SIZE 4096 /* PCI GART page size */
static unsigned long DRM(ati_alloc_pcigart_table)( void )
{
unsigned long address;
struct page *page;
int i;
DRM_DEBUG( "%s\n", __FUNCTION__ );
address = __get_free_pages( GFP_KERNEL, ATI_PCIGART_TABLE_ORDER );
if ( address == 0UL ) {
return 0;
}
page = virt_to_page( address );
for ( i = 0 ; i <= ATI_PCIGART_TABLE_PAGES ; i++, page++ ) {
atomic_inc( &page->count );
SetPageReserved( page );
}
DRM_DEBUG( "%s: returning 0x%08lx\n", __FUNCTION__, address );
return address;
}
static void DRM(ati_free_pcigart_table)( unsigned long address )
{
struct page *page;
int i;
DRM_DEBUG( "%s\n", __FUNCTION__ );
if ( !address ) return;
page = virt_to_page( address );
for ( i = 0 ; i <= ATI_PCIGART_TABLE_PAGES ; i++, page++ ) {
atomic_dec( &page->count );
ClearPageReserved( page );
}
free_pages( address, ATI_PCIGART_TABLE_ORDER );
}
unsigned long DRM(ati_pcigart_init)( drm_device_t *dev )
{
drm_sg_mem_t *entry = dev->sg;
unsigned long address;
unsigned long pages;
u32 *pci_gart, page_base;
int i, j;
if ( !entry ) {
DRM_ERROR( "no scatter/gather memory!\n" );
return 0;
}
address = DRM(ati_alloc_pcigart_table)();
if ( !address ) {
DRM_ERROR( "cannot allocate PCI GART page!\n" );
return 0;
}
pci_gart = (u32 *)address;
pages = ( entry->pages <= ATI_MAX_PCIGART_PAGES )
? entry->pages : ATI_MAX_PCIGART_PAGES;
memset( pci_gart, 0, ATI_MAX_PCIGART_PAGES * sizeof(u32) );
for ( i = 0 ; i < pages ; i++ ) {
page_base = virt_to_bus( entry->pagelist[i]->virtual );
for (j = 0; j < (PAGE_SIZE / ATI_PCIGART_PAGE_SIZE); j++) {
*pci_gart++ = cpu_to_le32( page_base );
page_base += ATI_PCIGART_PAGE_SIZE;
}
}
#if __i386__
asm volatile ( "wbinvd" ::: "memory" );
#else
mb();
#endif
return address;
}
int DRM(ati_pcigart_cleanup)( unsigned long address )
{
if ( address ) {
DRM(ati_free_pcigart_table)( address );
}
return 0;
}
This diff is collapsed.
...@@ -19,10 +19,10 @@ ...@@ -19,10 +19,10 @@
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* DEALINGS IN THE SOFTWARE. * OTHER DEALINGS IN THE SOFTWARE.
* *
* Authors: * Authors:
* Rickard E. (Rik) Faith <faith@valinux.com> * Rickard E. (Rik) Faith <faith@valinux.com>
...@@ -35,8 +35,8 @@ ...@@ -35,8 +35,8 @@
#ifndef _DRM_H_ #ifndef _DRM_H_
#define _DRM_H_ #define _DRM_H_
#include <linux/config.h>
#if defined(__linux__) #if defined(__linux__)
#include <linux/config.h>
#include <asm/ioctl.h> /* For _IO* macros */ #include <asm/ioctl.h> /* For _IO* macros */
#define DRM_IOCTL_NR(n) _IOC_NR(n) #define DRM_IOCTL_NR(n) _IOC_NR(n)
#elif defined(__FreeBSD__) #elif defined(__FreeBSD__)
...@@ -44,6 +44,14 @@ ...@@ -44,6 +44,14 @@
#define DRM_IOCTL_NR(n) ((n) & 0xff) #define DRM_IOCTL_NR(n) ((n) & 0xff)
#endif #endif
#define XFREE86_VERSION(major,minor,patch,snap) \
((major << 16) | (minor << 8) | patch)
#ifndef CONFIG_XFREE86_VERSION
#define CONFIG_XFREE86_VERSION XFREE86_VERSION(4,1,0,0)
#endif
#if CONFIG_XFREE86_VERSION < XFREE86_VERSION(4,1,0,0)
#define DRM_PROC_DEVICES "/proc/devices" #define DRM_PROC_DEVICES "/proc/devices"
#define DRM_PROC_MISC "/proc/misc" #define DRM_PROC_MISC "/proc/misc"
#define DRM_PROC_DRM "/proc/drm" #define DRM_PROC_DRM "/proc/drm"
...@@ -51,8 +59,12 @@ ...@@ -51,8 +59,12 @@
#define DRM_DEV_MODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP) #define DRM_DEV_MODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP)
#define DRM_DEV_UID 0 #define DRM_DEV_UID 0
#define DRM_DEV_GID 0 #define DRM_DEV_GID 0
#endif
#if CONFIG_XFREE86_VERSION >= XFREE86_VERSION(4,1,0,0)
#define DRM_MAJOR 226
#define DRM_MAX_MINOR 15
#endif
#define DRM_NAME "drm" /* Name in kernel, /dev, and /proc */ #define DRM_NAME "drm" /* Name in kernel, /dev, and /proc */
#define DRM_MIN_ORDER 5 /* At least 2^5 bytes = 32 bytes */ #define DRM_MIN_ORDER 5 /* At least 2^5 bytes = 32 bytes */
#define DRM_MAX_ORDER 22 /* Up to 2^22 bytes = 4MB */ #define DRM_MAX_ORDER 22 /* Up to 2^22 bytes = 4MB */
...@@ -79,6 +91,14 @@ typedef struct drm_clip_rect { ...@@ -79,6 +91,14 @@ typedef struct drm_clip_rect {
unsigned short y2; unsigned short y2;
} drm_clip_rect_t; } drm_clip_rect_t;
typedef struct drm_tex_region {
unsigned char next;
unsigned char prev;
unsigned char in_use;
unsigned char padding;
unsigned int age;
} drm_tex_region_t;
/* Seperate include files for the i810/mga/r128 specific structures */ /* Seperate include files for the i810/mga/r128 specific structures */
#include "mga_drm.h" #include "mga_drm.h"
#include "i810_drm.h" #include "i810_drm.h"
...@@ -128,7 +148,8 @@ typedef enum drm_map_type { ...@@ -128,7 +148,8 @@ typedef enum drm_map_type {
_DRM_FRAME_BUFFER = 0, /* WC (no caching), no core dump */ _DRM_FRAME_BUFFER = 0, /* WC (no caching), no core dump */
_DRM_REGISTERS = 1, /* no caching, no core dump */ _DRM_REGISTERS = 1, /* no caching, no core dump */
_DRM_SHM = 2, /* shared, cached */ _DRM_SHM = 2, /* shared, cached */
_DRM_AGP = 3 /* AGP/GART */ _DRM_AGP = 3, /* AGP/GART */
_DRM_SCATTER_GATHER = 4 /* Scatter/gather memory for PCI DMA */
} drm_map_type_t; } drm_map_type_t;
typedef enum drm_map_flags { typedef enum drm_map_flags {
...@@ -137,9 +158,15 @@ typedef enum drm_map_flags { ...@@ -137,9 +158,15 @@ typedef enum drm_map_flags {
_DRM_LOCKED = 0x04, /* shared, cached, locked */ _DRM_LOCKED = 0x04, /* shared, cached, locked */
_DRM_KERNEL = 0x08, /* kernel requires access */ _DRM_KERNEL = 0x08, /* kernel requires access */
_DRM_WRITE_COMBINING = 0x10, /* use write-combining if available */ _DRM_WRITE_COMBINING = 0x10, /* use write-combining if available */
_DRM_CONTAINS_LOCK = 0x20 /* SHM page that contains lock */ _DRM_CONTAINS_LOCK = 0x20, /* SHM page that contains lock */
_DRM_REMOVABLE = 0x40 /* Removable mapping */
} drm_map_flags_t; } drm_map_flags_t;
typedef struct drm_ctx_priv_map {
unsigned int ctx_id; /* Context requesting private mapping */
void *handle; /* Handle of map */
} drm_ctx_priv_map_t;
typedef struct drm_map { typedef struct drm_map {
unsigned long offset; /* Requested physical address (0 for SAREA)*/ unsigned long offset; /* Requested physical address (0 for SAREA)*/
unsigned long size; /* Requested physical size (bytes) */ unsigned long size; /* Requested physical size (bytes) */
...@@ -151,6 +178,44 @@ typedef struct drm_map { ...@@ -151,6 +178,44 @@ typedef struct drm_map {
/* Private data */ /* Private data */
} drm_map_t; } drm_map_t;
typedef struct drm_client {
int idx; /* Which client desired? */
int auth; /* Is client authenticated? */
unsigned long pid; /* Process id */
unsigned long uid; /* User id */
unsigned long magic; /* Magic */
unsigned long iocs; /* Ioctl count */
} drm_client_t;
typedef enum {
_DRM_STAT_LOCK,
_DRM_STAT_OPENS,
_DRM_STAT_CLOSES,
_DRM_STAT_IOCTLS,
_DRM_STAT_LOCKS,
_DRM_STAT_UNLOCKS,
_DRM_STAT_VALUE, /* Generic value */
_DRM_STAT_BYTE, /* Generic byte counter (1024bytes/K) */
_DRM_STAT_COUNT, /* Generic non-byte counter (1000/k) */
_DRM_STAT_IRQ, /* IRQ */
_DRM_STAT_PRIMARY, /* Primary DMA bytes */
_DRM_STAT_SECONDARY, /* Secondary DMA bytes */
_DRM_STAT_DMA, /* DMA */
_DRM_STAT_SPECIAL, /* Special DMA (e.g., priority or polled) */
_DRM_STAT_MISSED /* Missed DMA opportunity */
/* Add to the *END* of the list */
} drm_stat_type_t;
typedef struct drm_stats {
unsigned long count;
struct {
unsigned long value;
drm_stat_type_t type;
} data[15];
} drm_stats_t;
typedef enum drm_lock_flags { typedef enum drm_lock_flags {
_DRM_LOCK_READY = 0x01, /* Wait until hardware is ready for DMA */ _DRM_LOCK_READY = 0x01, /* Wait until hardware is ready for DMA */
_DRM_LOCK_QUIESCENT = 0x02, /* Wait until hardware quiescent */ _DRM_LOCK_QUIESCENT = 0x02, /* Wait until hardware quiescent */
...@@ -193,7 +258,8 @@ typedef struct drm_buf_desc { ...@@ -193,7 +258,8 @@ typedef struct drm_buf_desc {
int high_mark; /* High water mark */ int high_mark; /* High water mark */
enum { enum {
_DRM_PAGE_ALIGN = 0x01, /* Align on page boundaries for DMA */ _DRM_PAGE_ALIGN = 0x01, /* Align on page boundaries for DMA */
_DRM_AGP_BUFFER = 0x02 /* Buffer is in agp space */ _DRM_AGP_BUFFER = 0x02, /* Buffer is in agp space */
_DRM_SG_BUFFER = 0x04 /* Scatter/gather memory buffer */
} flags; } flags;
unsigned long agp_start; /* Start address of where the agp buffers unsigned long agp_start; /* Start address of where the agp buffers
* are in the agp aperture */ * are in the agp aperture */
...@@ -299,6 +365,11 @@ typedef struct drm_agp_info { ...@@ -299,6 +365,11 @@ typedef struct drm_agp_info {
unsigned short id_device; unsigned short id_device;
} drm_agp_info_t; } drm_agp_info_t;
typedef struct drm_scatter_gather {
unsigned long size; /* In bytes -- will round to page boundary */
unsigned long handle; /* Used for mapping / unmapping */
} drm_scatter_gather_t;
#define DRM_IOCTL_BASE 'd' #define DRM_IOCTL_BASE 'd'
#define DRM_IO(nr) _IO(DRM_IOCTL_BASE,nr) #define DRM_IO(nr) _IO(DRM_IOCTL_BASE,nr)
#define DRM_IOR(nr,size) _IOR(DRM_IOCTL_BASE,nr,size) #define DRM_IOR(nr,size) _IOR(DRM_IOCTL_BASE,nr,size)
...@@ -310,6 +381,9 @@ typedef struct drm_agp_info { ...@@ -310,6 +381,9 @@ typedef struct drm_agp_info {
#define DRM_IOCTL_GET_UNIQUE DRM_IOWR(0x01, drm_unique_t) #define DRM_IOCTL_GET_UNIQUE DRM_IOWR(0x01, drm_unique_t)
#define DRM_IOCTL_GET_MAGIC DRM_IOR( 0x02, drm_auth_t) #define DRM_IOCTL_GET_MAGIC DRM_IOR( 0x02, drm_auth_t)
#define DRM_IOCTL_IRQ_BUSID DRM_IOWR(0x03, drm_irq_busid_t) #define DRM_IOCTL_IRQ_BUSID DRM_IOWR(0x03, drm_irq_busid_t)
#define DRM_IOCTL_GET_MAP DRM_IOWR(0x04, drm_map_t)
#define DRM_IOCTL_GET_CLIENT DRM_IOWR(0x05, drm_client_t)
#define DRM_IOCTL_GET_STATS DRM_IOR( 0x06, drm_stats_t)
#define DRM_IOCTL_SET_UNIQUE DRM_IOW( 0x10, drm_unique_t) #define DRM_IOCTL_SET_UNIQUE DRM_IOW( 0x10, drm_unique_t)
#define DRM_IOCTL_AUTH_MAGIC DRM_IOW( 0x11, drm_auth_t) #define DRM_IOCTL_AUTH_MAGIC DRM_IOW( 0x11, drm_auth_t)
...@@ -323,6 +397,11 @@ typedef struct drm_agp_info { ...@@ -323,6 +397,11 @@ typedef struct drm_agp_info {
#define DRM_IOCTL_MAP_BUFS DRM_IOWR(0x19, drm_buf_map_t) #define DRM_IOCTL_MAP_BUFS DRM_IOWR(0x19, drm_buf_map_t)
#define DRM_IOCTL_FREE_BUFS DRM_IOW( 0x1a, drm_buf_free_t) #define DRM_IOCTL_FREE_BUFS DRM_IOW( 0x1a, drm_buf_free_t)
#define DRM_IOCTL_RM_MAP DRM_IOW( 0x1b, drm_map_t)
#define DRM_IOCTL_SET_SAREA_CTX DRM_IOW( 0x1c, drm_ctx_priv_map_t)
#define DRM_IOCTL_GET_SAREA_CTX DRM_IOWR(0x1d, drm_ctx_priv_map_t)
#define DRM_IOCTL_ADD_CTX DRM_IOWR(0x20, drm_ctx_t) #define DRM_IOCTL_ADD_CTX DRM_IOWR(0x20, drm_ctx_t)
#define DRM_IOCTL_RM_CTX DRM_IOWR(0x21, drm_ctx_t) #define DRM_IOCTL_RM_CTX DRM_IOWR(0x21, drm_ctx_t)
#define DRM_IOCTL_MOD_CTX DRM_IOW( 0x22, drm_ctx_t) #define DRM_IOCTL_MOD_CTX DRM_IOW( 0x22, drm_ctx_t)
...@@ -346,17 +425,21 @@ typedef struct drm_agp_info { ...@@ -346,17 +425,21 @@ typedef struct drm_agp_info {
#define DRM_IOCTL_AGP_BIND DRM_IOW( 0x36, drm_agp_binding_t) #define DRM_IOCTL_AGP_BIND DRM_IOW( 0x36, drm_agp_binding_t)
#define DRM_IOCTL_AGP_UNBIND DRM_IOW( 0x37, drm_agp_binding_t) #define DRM_IOCTL_AGP_UNBIND DRM_IOW( 0x37, drm_agp_binding_t)
/* Mga specific ioctls */ #define DRM_IOCTL_SG_ALLOC DRM_IOW( 0x38, drm_scatter_gather_t)
#define DRM_IOCTL_SG_FREE DRM_IOW( 0x39, drm_scatter_gather_t)
/* MGA specific ioctls */
#define DRM_IOCTL_MGA_INIT DRM_IOW( 0x40, drm_mga_init_t) #define DRM_IOCTL_MGA_INIT DRM_IOW( 0x40, drm_mga_init_t)
#define DRM_IOCTL_MGA_SWAP DRM_IOW( 0x41, drm_mga_swap_t) #define DRM_IOCTL_MGA_FLUSH DRM_IOW( 0x41, drm_lock_t)
#define DRM_IOCTL_MGA_CLEAR DRM_IOW( 0x42, drm_mga_clear_t) #define DRM_IOCTL_MGA_RESET DRM_IO( 0x42)
#define DRM_IOCTL_MGA_ILOAD DRM_IOW( 0x43, drm_mga_iload_t) #define DRM_IOCTL_MGA_SWAP DRM_IO( 0x43)
#define DRM_IOCTL_MGA_VERTEX DRM_IOW( 0x44, drm_mga_vertex_t) #define DRM_IOCTL_MGA_CLEAR DRM_IOW( 0x44, drm_mga_clear_t)
#define DRM_IOCTL_MGA_FLUSH DRM_IOW( 0x45, drm_lock_t ) #define DRM_IOCTL_MGA_VERTEX DRM_IOW( 0x45, drm_mga_vertex_t)
#define DRM_IOCTL_MGA_INDICES DRM_IOW( 0x46, drm_mga_indices_t) #define DRM_IOCTL_MGA_INDICES DRM_IOW( 0x46, drm_mga_indices_t)
#define DRM_IOCTL_MGA_BLIT DRM_IOW( 0x47, drm_mga_blit_t) #define DRM_IOCTL_MGA_ILOAD DRM_IOW( 0x47, drm_mga_iload_t)
#define DRM_IOCTL_MGA_BLIT DRM_IOW( 0x48, drm_mga_blit_t)
/* I810 specific ioctls */ /* i810 specific ioctls */
#define DRM_IOCTL_I810_INIT DRM_IOW( 0x40, drm_i810_init_t) #define DRM_IOCTL_I810_INIT DRM_IOW( 0x40, drm_i810_init_t)
#define DRM_IOCTL_I810_VERTEX DRM_IOW( 0x41, drm_i810_vertex_t) #define DRM_IOCTL_I810_VERTEX DRM_IOW( 0x41, drm_i810_vertex_t)
#define DRM_IOCTL_I810_CLEAR DRM_IOW( 0x42, drm_i810_clear_t) #define DRM_IOCTL_I810_CLEAR DRM_IOW( 0x42, drm_i810_clear_t)
...@@ -381,7 +464,8 @@ typedef struct drm_agp_info { ...@@ -381,7 +464,8 @@ typedef struct drm_agp_info {
#define DRM_IOCTL_R128_BLIT DRM_IOW( 0x4b, drm_r128_blit_t) #define DRM_IOCTL_R128_BLIT DRM_IOW( 0x4b, drm_r128_blit_t)
#define DRM_IOCTL_R128_DEPTH DRM_IOW( 0x4c, drm_r128_depth_t) #define DRM_IOCTL_R128_DEPTH DRM_IOW( 0x4c, drm_r128_depth_t)
#define DRM_IOCTL_R128_STIPPLE DRM_IOW( 0x4d, drm_r128_stipple_t) #define DRM_IOCTL_R128_STIPPLE DRM_IOW( 0x4d, drm_r128_stipple_t)
#define DRM_IOCTL_R128_PACKET DRM_IOWR(0x4e, drm_r128_packet_t) #define DRM_IOCTL_R128_INDIRECT DRM_IOWR(0x4f, drm_r128_indirect_t)
#define DRM_IOCTL_R128_FULLSCREEN DRM_IOW( 0x50, drm_r128_fullscreen_t)
/* Radeon specific ioctls */ /* Radeon specific ioctls */
#define DRM_IOCTL_RADEON_CP_INIT DRM_IOW( 0x40, drm_radeon_init_t) #define DRM_IOCTL_RADEON_CP_INIT DRM_IOW( 0x40, drm_radeon_init_t)
...@@ -395,9 +479,9 @@ typedef struct drm_agp_info { ...@@ -395,9 +479,9 @@ typedef struct drm_agp_info {
#define DRM_IOCTL_RADEON_CLEAR DRM_IOW( 0x48, drm_radeon_clear_t) #define DRM_IOCTL_RADEON_CLEAR DRM_IOW( 0x48, drm_radeon_clear_t)
#define DRM_IOCTL_RADEON_VERTEX DRM_IOW( 0x49, drm_radeon_vertex_t) #define DRM_IOCTL_RADEON_VERTEX DRM_IOW( 0x49, drm_radeon_vertex_t)
#define DRM_IOCTL_RADEON_INDICES DRM_IOW( 0x4a, drm_radeon_indices_t) #define DRM_IOCTL_RADEON_INDICES DRM_IOW( 0x4a, drm_radeon_indices_t)
#define DRM_IOCTL_RADEON_BLIT DRM_IOW( 0x4b, drm_radeon_blit_t)
#define DRM_IOCTL_RADEON_STIPPLE DRM_IOW( 0x4c, drm_radeon_stipple_t) #define DRM_IOCTL_RADEON_STIPPLE DRM_IOW( 0x4c, drm_radeon_stipple_t)
#define DRM_IOCTL_RADEON_INDIRECT DRM_IOWR(0x4d, drm_radeon_indirect_t) #define DRM_IOCTL_RADEON_INDIRECT DRM_IOWR(0x4d, drm_radeon_indirect_t)
#define DRM_IOCTL_RADEON_TEXTURE DRM_IOWR(0x4e, drm_radeon_texture_t)
#ifdef CONFIG_DRM_SIS #ifdef CONFIG_DRM_SIS
/* SiS specific ioctls */ /* SiS specific ioctls */
......
This diff is collapsed.
/* auth.c -- IOCTLs for authentication -*- linux-c -*- /* drm_auth.h -- IOCTLs for authentication -*- linux-c -*-
* Created: Tue Feb 2 08:37:54 1999 by faith@precisioninsight.com * Created: Tue Feb 2 08:37:54 1999 by faith@valinux.com
* *
* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
* Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
...@@ -19,29 +19,29 @@ ...@@ -19,29 +19,29 @@
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* DEALINGS IN THE SOFTWARE. * OTHER DEALINGS IN THE SOFTWARE.
* *
* Authors: * Authors:
* Rickard E. (Rik) Faith <faith@valinux.com> * Rickard E. (Rik) Faith <faith@valinux.com>
* * Gareth Hughes <gareth@valinux.com>
*/ */
#define __NO_VERSION__ #define __NO_VERSION__
#include "drmP.h" #include "drmP.h"
static int drm_hash_magic(drm_magic_t magic) static int DRM(hash_magic)(drm_magic_t magic)
{ {
return magic & (DRM_HASH_SIZE-1); return magic & (DRM_HASH_SIZE-1);
} }
static drm_file_t *drm_find_file(drm_device_t *dev, drm_magic_t magic) static drm_file_t *DRM(find_file)(drm_device_t *dev, drm_magic_t magic)
{ {
drm_file_t *retval = NULL; drm_file_t *retval = NULL;
drm_magic_entry_t *pt; drm_magic_entry_t *pt;
int hash = drm_hash_magic(magic); int hash = DRM(hash_magic)(magic);
down(&dev->struct_sem); down(&dev->struct_sem);
for (pt = dev->magiclist[hash].head; pt; pt = pt->next) { for (pt = dev->magiclist[hash].head; pt; pt = pt->next) {
...@@ -54,15 +54,15 @@ static drm_file_t *drm_find_file(drm_device_t *dev, drm_magic_t magic) ...@@ -54,15 +54,15 @@ static drm_file_t *drm_find_file(drm_device_t *dev, drm_magic_t magic)
return retval; return retval;
} }
int drm_add_magic(drm_device_t *dev, drm_file_t *priv, drm_magic_t magic) int DRM(add_magic)(drm_device_t *dev, drm_file_t *priv, drm_magic_t magic)
{ {
int hash; int hash;
drm_magic_entry_t *entry; drm_magic_entry_t *entry;
DRM_DEBUG("%d\n", magic); DRM_DEBUG("%d\n", magic);
hash = drm_hash_magic(magic); hash = DRM(hash_magic)(magic);
entry = drm_alloc(sizeof(*entry), DRM_MEM_MAGIC); entry = DRM(alloc)(sizeof(*entry), DRM_MEM_MAGIC);
if (!entry) return -ENOMEM; if (!entry) return -ENOMEM;
entry->magic = magic; entry->magic = magic;
entry->priv = priv; entry->priv = priv;
...@@ -81,14 +81,14 @@ int drm_add_magic(drm_device_t *dev, drm_file_t *priv, drm_magic_t magic) ...@@ -81,14 +81,14 @@ int drm_add_magic(drm_device_t *dev, drm_file_t *priv, drm_magic_t magic)
return 0; return 0;
} }
int drm_remove_magic(drm_device_t *dev, drm_magic_t magic) int DRM(remove_magic)(drm_device_t *dev, drm_magic_t magic)
{ {
drm_magic_entry_t *prev = NULL; drm_magic_entry_t *prev = NULL;
drm_magic_entry_t *pt; drm_magic_entry_t *pt;
int hash; int hash;
DRM_DEBUG("%d\n", magic); DRM_DEBUG("%d\n", magic);
hash = drm_hash_magic(magic); hash = DRM(hash_magic)(magic);
down(&dev->struct_sem); down(&dev->struct_sem);
for (pt = dev->magiclist[hash].head; pt; prev = pt, pt = pt->next) { for (pt = dev->magiclist[hash].head; pt; prev = pt, pt = pt->next) {
...@@ -108,13 +108,13 @@ int drm_remove_magic(drm_device_t *dev, drm_magic_t magic) ...@@ -108,13 +108,13 @@ int drm_remove_magic(drm_device_t *dev, drm_magic_t magic)
} }
up(&dev->struct_sem); up(&dev->struct_sem);
drm_free(pt, sizeof(*pt), DRM_MEM_MAGIC); DRM(free)(pt, sizeof(*pt), DRM_MEM_MAGIC);
return -EINVAL; return -EINVAL;
} }
int drm_getmagic(struct inode *inode, struct file *filp, unsigned int cmd, int DRM(getmagic)(struct inode *inode, struct file *filp,
unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
static drm_magic_t sequence = 0; static drm_magic_t sequence = 0;
static spinlock_t lock = SPIN_LOCK_UNLOCKED; static spinlock_t lock = SPIN_LOCK_UNLOCKED;
...@@ -131,9 +131,9 @@ int drm_getmagic(struct inode *inode, struct file *filp, unsigned int cmd, ...@@ -131,9 +131,9 @@ int drm_getmagic(struct inode *inode, struct file *filp, unsigned int cmd,
if (!sequence) ++sequence; /* reserve 0 */ if (!sequence) ++sequence; /* reserve 0 */
auth.magic = sequence++; auth.magic = sequence++;
spin_unlock(&lock); spin_unlock(&lock);
} while (drm_find_file(dev, auth.magic)); } while (DRM(find_file)(dev, auth.magic));
priv->magic = auth.magic; priv->magic = auth.magic;
drm_add_magic(dev, priv, auth.magic); DRM(add_magic)(dev, priv, auth.magic);
} }
DRM_DEBUG("%u\n", auth.magic); DRM_DEBUG("%u\n", auth.magic);
...@@ -142,8 +142,8 @@ int drm_getmagic(struct inode *inode, struct file *filp, unsigned int cmd, ...@@ -142,8 +142,8 @@ int drm_getmagic(struct inode *inode, struct file *filp, unsigned int cmd,
return 0; return 0;
} }
int drm_authmagic(struct inode *inode, struct file *filp, unsigned int cmd, int DRM(authmagic)(struct inode *inode, struct file *filp,
unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->dev;
...@@ -153,9 +153,9 @@ int drm_authmagic(struct inode *inode, struct file *filp, unsigned int cmd, ...@@ -153,9 +153,9 @@ int drm_authmagic(struct inode *inode, struct file *filp, unsigned int cmd,
if (copy_from_user(&auth, (drm_auth_t *)arg, sizeof(auth))) if (copy_from_user(&auth, (drm_auth_t *)arg, sizeof(auth)))
return -EFAULT; return -EFAULT;
DRM_DEBUG("%u\n", auth.magic); DRM_DEBUG("%u\n", auth.magic);
if ((file = drm_find_file(dev, auth.magic))) { if ((file = DRM(find_file)(dev, auth.magic))) {
file->authenticated = 1; file->authenticated = 1;
drm_remove_magic(dev, auth.magic); DRM(remove_magic)(dev, auth.magic);
return 0; return 0;
} }
return -EINVAL; return -EINVAL;
......
This diff is collapsed.
/* drawable.c -- IOCTLs for drawables -*- linux-c -*- /* drm_drawable.h -- IOCTLs for drawables -*- linux-c -*-
* Created: Tue Feb 2 08:37:54 1999 by faith@precisioninsight.com * Created: Tue Feb 2 08:37:54 1999 by faith@valinux.com
* *
* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
* Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
...@@ -19,21 +19,21 @@ ...@@ -19,21 +19,21 @@
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* DEALINGS IN THE SOFTWARE. * OTHER DEALINGS IN THE SOFTWARE.
* *
* Authors: * Authors:
* Rickard E. (Rik) Faith <faith@valinux.com> * Rickard E. (Rik) Faith <faith@valinux.com>
* * Gareth Hughes <gareth@valinux.com>
*/ */
#define __NO_VERSION__ #define __NO_VERSION__
#include "drmP.h" #include "drmP.h"
int drm_adddraw(struct inode *inode, struct file *filp, unsigned int cmd, int DRM(adddraw)(struct inode *inode, struct file *filp,
unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_draw_t draw; drm_draw_t draw;
...@@ -44,8 +44,8 @@ int drm_adddraw(struct inode *inode, struct file *filp, unsigned int cmd, ...@@ -44,8 +44,8 @@ int drm_adddraw(struct inode *inode, struct file *filp, unsigned int cmd,
return 0; return 0;
} }
int drm_rmdraw(struct inode *inode, struct file *filp, unsigned int cmd, int DRM(rmdraw)(struct inode *inode, struct file *filp,
unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
return 0; /* NOOP */ return 0; /* NOOP */
} }
This diff is collapsed.
/* fops.c -- File operations for DRM -*- linux-c -*- /* drm_fops.h -- File operations for DRM -*- linux-c -*-
* Created: Mon Jan 4 08:58:31 1999 by faith@precisioninsight.com * Created: Mon Jan 4 08:58:31 1999 by faith@valinux.com
* *
* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
* Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
...@@ -19,15 +19,15 @@ ...@@ -19,15 +19,15 @@
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* DEALINGS IN THE SOFTWARE. * OTHER DEALINGS IN THE SOFTWARE.
* *
* Authors: * Authors:
* Rickard E. (Rik) Faith <faith@valinux.com> * Rickard E. (Rik) Faith <faith@valinux.com>
* Daryll Strauss <daryll@valinux.com> * Daryll Strauss <daryll@valinux.com>
* * Gareth Hughes <gareth@valinux.com>
*/ */
#define __NO_VERSION__ #define __NO_VERSION__
...@@ -36,21 +36,20 @@ ...@@ -36,21 +36,20 @@
/* drm_open is called whenever a process opens /dev/drm. */ /* drm_open is called whenever a process opens /dev/drm. */
int drm_open_helper(struct inode *inode, struct file *filp, drm_device_t *dev) int DRM(open_helper)(struct inode *inode, struct file *filp, drm_device_t *dev)
{ {
kdev_t minor = MINOR(inode->i_rdev); kdev_t minor = MINOR(inode->i_rdev);
drm_file_t *priv; drm_file_t *priv;
if (filp->f_flags & O_EXCL) return -EBUSY; /* No exclusive opens */ if (filp->f_flags & O_EXCL) return -EBUSY; /* No exclusive opens */
if (!drm_cpu_valid()) return -EINVAL; if (!DRM(cpu_valid)()) return -EINVAL;
DRM_DEBUG("pid = %d, minor = %d\n", current->pid, minor); DRM_DEBUG("pid = %d, minor = %d\n", current->pid, minor);
priv = drm_alloc(sizeof(*priv), DRM_MEM_FILES); priv = DRM(alloc)(sizeof(*priv), DRM_MEM_FILES);
if(priv == NULL) if(!priv) return -ENOMEM;
return -ENOMEM;
memset(priv, 0, sizeof(*priv));
memset(priv, 0, sizeof(*priv));
filp->private_data = priv; filp->private_data = priv;
priv->uid = current->euid; priv->uid = current->euid;
priv->pid = current->pid; priv->pid = current->pid;
...@@ -73,62 +72,35 @@ int drm_open_helper(struct inode *inode, struct file *filp, drm_device_t *dev) ...@@ -73,62 +72,35 @@ int drm_open_helper(struct inode *inode, struct file *filp, drm_device_t *dev)
} }
up(&dev->struct_sem); up(&dev->struct_sem);
return 0; #ifdef __alpha__
} /*
* Default the hose
int drm_flush(struct file *filp) */
{ if (!dev->hose) {
drm_file_t *priv = filp->private_data; struct pci_dev *pci_dev;
drm_device_t *dev = priv->dev; pci_dev = pci_find_class(PCI_CLASS_DISPLAY_VGA << 8, NULL);
if (pci_dev) dev->hose = pci_dev->sysdata;
if (!dev->hose) {
struct pci_bus *b = pci_bus_b(pci_root_buses.next);
if (b) dev->hose = b->sysdata;
}
}
#endif
DRM_DEBUG("pid = %d, device = 0x%x, open_count = %d\n",
current->pid, dev->device, dev->open_count);
return 0; return 0;
} }
/* drm_release is called whenever a process closes /dev/drm*. Linux calls int DRM(flush)(struct file *filp)
this only if any mappings have been closed. */
int drm_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 = 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);
if (dev->lock.hw_lock
&& _DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)
&& dev->lock.pid == current->pid) {
DRM_ERROR("Process %d dead, freeing lock for context %d\n",
current->pid,
_DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock));
drm_lock_free(dev,
&dev->lock.hw_lock->lock,
_DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock));
/* FIXME: may require heavy-handed reset of
hardware at this point, possibly
processed via a callback to the X
server. */
}
drm_reclaim_buffers(dev, priv->pid);
drm_fasync(-1, filp, 0);
down(&dev->struct_sem);
if (priv->prev) priv->prev->next = priv->next;
else dev->file_first = priv->next;
if (priv->next) priv->next->prev = priv->prev;
else dev->file_last = priv->prev;
up(&dev->struct_sem);
drm_free(priv, sizeof(*priv), DRM_MEM_FILES);
return 0; return 0;
} }
int drm_fasync(int fd, struct file *filp, int on) int DRM(fasync)(int fd, struct file *filp, int on)
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->dev;
...@@ -145,7 +117,7 @@ int drm_fasync(int fd, struct file *filp, int on) ...@@ -145,7 +117,7 @@ int drm_fasync(int fd, struct file *filp, int on)
the circular buffer), is based on Alessandro Rubini's LINUX DEVICE the circular buffer), is based on Alessandro Rubini's LINUX DEVICE
DRIVERS (Cambridge: O'Reilly, 1998), pages 111-113. */ DRIVERS (Cambridge: O'Reilly, 1998), pages 111-113. */
ssize_t drm_read(struct file *filp, char *buf, size_t count, loff_t *off) ssize_t DRM(read)(struct file *filp, char *buf, size_t count, loff_t *off)
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->dev;
...@@ -190,7 +162,7 @@ ssize_t drm_read(struct file *filp, char *buf, size_t count, loff_t *off) ...@@ -190,7 +162,7 @@ ssize_t drm_read(struct file *filp, char *buf, size_t count, loff_t *off)
return DRM_MIN(avail, count);; return DRM_MIN(avail, count);;
} }
int drm_write_string(drm_device_t *dev, const char *s) int DRM(write_string)(drm_device_t *dev, const char *s)
{ {
int left = (dev->buf_rp + DRM_BSZ - dev->buf_wp) % DRM_BSZ; int left = (dev->buf_rp + DRM_BSZ - dev->buf_wp) % DRM_BSZ;
int send = strlen(s); int send = strlen(s);
...@@ -242,7 +214,7 @@ int drm_write_string(drm_device_t *dev, const char *s) ...@@ -242,7 +214,7 @@ int drm_write_string(drm_device_t *dev, const char *s)
return 0; return 0;
} }
unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait) unsigned int DRM(poll)(struct file *filp, struct poll_table_struct *wait)
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->dev;
......
/* init.c -- Setup/Cleanup for DRM -*- linux-c -*- /* drm_init.h -- Setup/Cleanup for DRM -*- linux-c -*-
* Created: Mon Jan 4 08:58:31 1999 by faith@precisioninsight.com * Created: Mon Jan 4 08:58:31 1999 by faith@valinux.com
* *
* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
* Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
...@@ -19,25 +19,29 @@ ...@@ -19,25 +19,29 @@
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* DEALINGS IN THE SOFTWARE. * OTHER DEALINGS IN THE SOFTWARE.
* *
* Authors: * Authors:
* Rickard E. (Rik) Faith <faith@valinux.com> * Rickard E. (Rik) Faith <faith@valinux.com>
* * Gareth Hughes <gareth@valinux.com>
*/ */
#define __NO_VERSION__ #define __NO_VERSION__
#include "drmP.h" #include "drmP.h"
int drm_flags = 0; #if 0
int DRM(flags) = DRM_FLAG_DEBUG;
#else
int DRM(flags) = 0;
#endif
/* drm_parse_option parses a single option. See description for /* drm_parse_option parses a single option. See description for
drm_parse_options for details. */ * drm_parse_options for details.
*/
static void drm_parse_option(char *s) static void DRM(parse_option)(char *s)
{ {
char *c, *r; char *c, *r;
...@@ -47,12 +51,12 @@ static void drm_parse_option(char *s) ...@@ -47,12 +51,12 @@ static void drm_parse_option(char *s)
if (*c) r = c + 1; else r = NULL; /* remember remainder */ if (*c) r = c + 1; else r = NULL; /* remember remainder */
*c = '\0'; /* terminate */ *c = '\0'; /* terminate */
if (!strcmp(s, "noctx")) { if (!strcmp(s, "noctx")) {
drm_flags |= DRM_FLAG_NOCTX; DRM(flags) |= DRM_FLAG_NOCTX;
DRM_INFO("Server-mediated context switching OFF\n"); DRM_INFO("Server-mediated context switching OFF\n");
return; return;
} }
if (!strcmp(s, "debug")) { if (!strcmp(s, "debug")) {
drm_flags |= DRM_FLAG_DEBUG; DRM(flags) |= DRM_FLAG_DEBUG;
DRM_INFO("Debug messages ON\n"); DRM_INFO("Debug messages ON\n");
return; return;
} }
...@@ -60,18 +64,18 @@ static void drm_parse_option(char *s) ...@@ -60,18 +64,18 @@ static void drm_parse_option(char *s)
return; return;
} }
/* drm_parse_options parse the insmod "drm=" options, or the command-line /* drm_parse_options parse the insmod "drm_opts=" options, or the command-line
* options passed to the kernel via LILO. The grammar of the format is as * options passed to the kernel via LILO. The grammar of the format is as
* follows: * follows:
* *
* drm ::= 'drm=' option_list * drm ::= 'drm_opts=' option_list
* option_list ::= option [ ';' option_list ] * option_list ::= option [ ';' option_list ]
* option ::= 'device:' major * option ::= 'device:' major
* | 'debug' * | 'debug'
* | 'noctx' * | 'noctx'
* major ::= INTEGER * major ::= INTEGER
* *
* Note that 's' contains option_list without the 'drm=' part. * Note that 's' contains option_list without the 'drm_opts=' part.
* *
* device=major,minor specifies the device number used for /dev/drm * device=major,minor specifies the device number used for /dev/drm
* if major == 0 then the misc device is used * if major == 0 then the misc device is used
...@@ -82,7 +86,7 @@ static void drm_parse_option(char *s) ...@@ -82,7 +86,7 @@ static void drm_parse_option(char *s)
* *
*/ */
void drm_parse_options(char *s) void DRM(parse_options)(char *s)
{ {
char *h, *t, *n; char *h, *t, *n;
...@@ -93,20 +97,19 @@ void drm_parse_options(char *s) ...@@ -93,20 +97,19 @@ void drm_parse_options(char *s)
for (; *t && *t != ';'; t++); /* find ; or \0 */ for (; *t && *t != ';'; t++); /* find ; or \0 */
if (*t) n = t + 1; else n = NULL; /* remember next */ if (*t) n = t + 1; else n = NULL; /* remember next */
*t = '\0'; /* terminate */ *t = '\0'; /* terminate */
drm_parse_option(h); /* parse */ DRM(parse_option)(h); /* parse */
} }
} }
/* drm_cpu_valid returns non-zero if the DRI will run on this CPU, and 0 /* drm_cpu_valid returns non-zero if the DRI will run on this CPU, and 0
* otherwise. */ * otherwise.
*/
int drm_cpu_valid(void) int DRM(cpu_valid)(void)
{ {
#if defined(__i386__) #if defined(__i386__)
if (boot_cpu_data.x86 == 3) return 0; /* No cmpxchg on a 386 */ if (boot_cpu_data.x86 == 3) return 0; /* No cmpxchg on a 386 */
#endif #endif
#if defined(__sparc__) && !defined(__sparc_v9__) #if defined(__sparc__) && !defined(__sparc_v9__)
if (1)
return 0; /* No cmpxchg before v9 sparc. */ return 0; /* No cmpxchg before v9 sparc. */
#endif #endif
return 1; return 1;
......
This diff is collapsed.
This diff is collapsed.
/* ffb.h -- ffb DRM template customization -*- linux-c -*-
*/
#ifndef __FFB_H__
#define __FFB_H__
/* This remains constant for all DRM template files.
*/
#define DRM(x) ffb_##x
/* General customization:
*/
#define __HAVE_KERNEL_CTX_SWITCH 1
#define __HAVE_RELEASE 1
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -32,27 +32,74 @@ ...@@ -32,27 +32,74 @@
#ifndef _GAMMA_DRV_H_ #ifndef _GAMMA_DRV_H_
#define _GAMMA_DRV_H_ #define _GAMMA_DRV_H_
/* gamma_drv.c */
extern int gamma_version(struct inode *inode, struct file *filp, typedef struct drm_gamma_private {
unsigned int cmd, unsigned long arg); drm_map_t *buffers;
extern int gamma_open(struct inode *inode, struct file *filp); drm_map_t *mmio0;
extern int gamma_release(struct inode *inode, struct file *filp); drm_map_t *mmio1;
extern int gamma_ioctl(struct inode *inode, struct file *filp, drm_map_t *mmio2;
unsigned int cmd, unsigned long arg); drm_map_t *mmio3;
extern int gamma_lock(struct inode *inode, struct file *filp, } drm_gamma_private_t;
unsigned int cmd, unsigned long arg);
extern int gamma_unlock(struct inode *inode, struct file *filp, #define LOCK_TEST_WITH_RETURN( dev ) \
unsigned int cmd, unsigned long arg); do { \
if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || \
dev->lock.pid != current->pid ) { \
DRM_ERROR( "%s called without lock held\n", \
__FUNCTION__ ); \
return -EINVAL; \
} \
} while (0)
extern void gamma_dma_ready(drm_device_t *dev);
extern void gamma_dma_quiescent_single(drm_device_t *dev);
extern void gamma_dma_quiescent_dual(drm_device_t *dev);
/* gamma_dma.c */ /* gamma_dma.c */
extern int gamma_dma_schedule(drm_device_t *dev, int locked); extern int gamma_dma_schedule(drm_device_t *dev, int locked);
extern int gamma_dma(struct inode *inode, struct file *filp, extern int gamma_dma(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg); unsigned int cmd, unsigned long arg);
extern int gamma_irq_install(drm_device_t *dev, int irq);
extern int gamma_irq_uninstall(drm_device_t *dev);
extern int gamma_control(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
extern int gamma_find_devices(void); extern int gamma_find_devices(void);
extern int gamma_found(void); extern int gamma_found(void);
#define GAMMA_OFF(reg) \
((reg < 0x1000) \
? reg \
: ((reg < 0x10000) \
? (reg - 0x1000) \
: ((reg < 0x11000) \
? (reg - 0x10000) \
: (reg - 0x11000))))
#define GAMMA_BASE(reg) ((unsigned long) \
((reg < 0x1000) ? dev_priv->mmio0->handle : \
((reg < 0x10000) ? dev_priv->mmio1->handle : \
((reg < 0x11000) ? dev_priv->mmio2->handle : \
dev_priv->mmio3->handle))))
#define GAMMA_ADDR(reg) (GAMMA_BASE(reg) + GAMMA_OFF(reg))
#define GAMMA_DEREF(reg) *(__volatile__ int *)GAMMA_ADDR(reg)
#define GAMMA_READ(reg) GAMMA_DEREF(reg)
#define GAMMA_WRITE(reg,val) do { GAMMA_DEREF(reg) = val; } while (0)
#define GAMMA_BROADCASTMASK 0x9378
#define GAMMA_COMMANDINTENABLE 0x0c48
#define GAMMA_DMAADDRESS 0x0028
#define GAMMA_DMACOUNT 0x0030
#define GAMMA_FILTERMODE 0x8c00
#define GAMMA_GCOMMANDINTFLAGS 0x0c50
#define GAMMA_GCOMMANDMODE 0x0c40
#define GAMMA_GCOMMANDSTATUS 0x0c60
#define GAMMA_GDELAYTIMER 0x0c38
#define GAMMA_GDMACONTROL 0x0060
#define GAMMA_GINTENABLE 0x0808
#define GAMMA_GINTFLAGS 0x0810
#define GAMMA_INFIFOSPACE 0x0018
#define GAMMA_OUTFIFOWORDS 0x0020
#define GAMMA_OUTPUTFIFO 0x2000
#define GAMMA_SYNC 0x8c40
#define GAMMA_SYNC_TAG 0x0188
#endif #endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -98,8 +98,13 @@ typedef struct _drm_i810_init { ...@@ -98,8 +98,13 @@ typedef struct _drm_i810_init {
I810_INIT_DMA = 0x01, I810_INIT_DMA = 0x01,
I810_CLEANUP_DMA = 0x02 I810_CLEANUP_DMA = 0x02
} func; } func;
#if CONFIG_XFREE86_VERSION < XFREE86_VERSION(4,1,0,0)
int ring_map_idx; int ring_map_idx;
int buffer_map_idx; int buffer_map_idx;
#else
unsigned int mmio_offset;
unsigned int buffers_offset;
#endif
int sarea_priv_offset; int sarea_priv_offset;
unsigned int ring_start; unsigned int ring_start;
unsigned int ring_end; unsigned int ring_end;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -125,10 +125,6 @@ extern int total_inactive_shortage(void); ...@@ -125,10 +125,6 @@ extern int total_inactive_shortage(void);
extern void wakeup_kswapd(void); extern void wakeup_kswapd(void);
extern int try_to_free_pages(unsigned int gfp_mask); extern int try_to_free_pages(unsigned int gfp_mask);
extern unsigned int zone_free_shortage(zone_t *zone);
extern unsigned int zone_inactive_shortage(zone_t *zone);
extern unsigned int zone_inactive_plenty(zone_t *zone);
/* linux/mm/page_io.c */ /* linux/mm/page_io.c */
extern void rw_swap_page(int, struct page *); extern void rw_swap_page(int, struct page *);
extern void rw_swap_page_nolock(int, swp_entry_t, char *); extern void rw_swap_page_nolock(int, swp_entry_t, char *);
......
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment