mirror of
https://gitlab.freedesktop.org/mesa/drm.git
synced 2025-12-24 13:40:13 +01:00
commit Eric Anholt's fixes for FreeBSD.
This commit is contained in:
parent
882a1595d4
commit
b18c1eb06f
32 changed files with 1007 additions and 203 deletions
280
bsd-core/drm_agpsupport.c
Normal file
280
bsd-core/drm_agpsupport.c
Normal file
|
|
@ -0,0 +1,280 @@
|
|||
/* drm_agpsupport.h -- DRM support for AGP/GART backend -*- linux-c -*-
|
||||
* Created: Mon Dec 13 09:56:45 1999 by faith@precisioninsight.com
|
||||
*
|
||||
* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
|
||||
* 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
|
||||
* 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,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Author:
|
||||
* Rickard E. (Rik) Faith <faith@valinux.com>
|
||||
* Gareth Hughes <gareth@valinux.com>
|
||||
*/
|
||||
|
||||
#include "drmP.h"
|
||||
|
||||
int DRM(agp_info)(dev_t kdev, u_long cmd, caddr_t data,
|
||||
int flags, struct proc *p)
|
||||
{
|
||||
drm_device_t *dev = kdev->si_drv1;
|
||||
struct agp_info *kern;
|
||||
drm_agp_info_t info;
|
||||
|
||||
if (!dev->agp || !dev->agp->acquired) return EINVAL;
|
||||
|
||||
kern = &dev->agp->info;
|
||||
agp_get_info(dev->agp->agpdev, kern);
|
||||
info.agp_version_major = 1;
|
||||
info.agp_version_minor = 0;
|
||||
info.mode = kern->ai_mode;
|
||||
info.aperture_base = kern->ai_aperture_base;
|
||||
info.aperture_size = kern->ai_aperture_size;
|
||||
info.memory_allowed = kern->ai_memory_allowed;
|
||||
info.memory_used = kern->ai_memory_used;
|
||||
info.id_vendor = kern->ai_devid & 0xffff;
|
||||
info.id_device = kern->ai_devid >> 16;
|
||||
|
||||
*(drm_agp_info_t *) data = info;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int DRM(agp_acquire)(dev_t kdev, u_long cmd, caddr_t data,
|
||||
int flags, struct proc *p)
|
||||
{
|
||||
drm_device_t *dev = kdev->si_drv1;
|
||||
int retcode;
|
||||
|
||||
if (!dev->agp || dev->agp->acquired) return EINVAL;
|
||||
retcode = agp_acquire(dev->agp->agpdev);
|
||||
if (retcode) return retcode;
|
||||
dev->agp->acquired = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int DRM(agp_release)(dev_t kdev, u_long cmd, caddr_t data,
|
||||
int flags, struct proc *p)
|
||||
{
|
||||
drm_device_t *dev = kdev->si_drv1;
|
||||
|
||||
if (!dev->agp || !dev->agp->acquired)
|
||||
return EINVAL;
|
||||
agp_release(dev->agp->agpdev);
|
||||
dev->agp->acquired = 0;
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
int DRM(agp_enable)(dev_t kdev, u_long cmd, caddr_t data,
|
||||
int flags, struct proc *p)
|
||||
{
|
||||
drm_device_t *dev = kdev->si_drv1;
|
||||
drm_agp_mode_t mode;
|
||||
|
||||
if (!dev->agp || !dev->agp->acquired) return EINVAL;
|
||||
|
||||
mode = *(drm_agp_mode_t *) data;
|
||||
|
||||
dev->agp->mode = mode.mode;
|
||||
agp_enable(dev->agp->agpdev, mode.mode);
|
||||
dev->agp->base = dev->agp->info.ai_aperture_base;
|
||||
dev->agp->enabled = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int DRM(agp_alloc)(dev_t kdev, u_long cmd, caddr_t data,
|
||||
int flags, struct proc *p)
|
||||
{
|
||||
drm_device_t *dev = kdev->si_drv1;
|
||||
drm_agp_buffer_t request;
|
||||
drm_agp_mem_t *entry;
|
||||
void *handle;
|
||||
unsigned long pages;
|
||||
u_int32_t type;
|
||||
struct agp_memory_info info;
|
||||
|
||||
if (!dev->agp || !dev->agp->acquired) return EINVAL;
|
||||
|
||||
request = *(drm_agp_buffer_t *) data;
|
||||
|
||||
if (!(entry = DRM(alloc)(sizeof(*entry), DRM_MEM_AGPLISTS)))
|
||||
return ENOMEM;
|
||||
|
||||
bzero(entry, sizeof(*entry));
|
||||
|
||||
pages = (request.size + PAGE_SIZE - 1) / PAGE_SIZE;
|
||||
type = (u_int32_t) request.type;
|
||||
|
||||
if (!(handle = DRM(alloc_agp)(pages, type))) {
|
||||
DRM(free)(entry, sizeof(*entry), DRM_MEM_AGPLISTS);
|
||||
return ENOMEM;
|
||||
}
|
||||
|
||||
entry->handle = handle;
|
||||
entry->bound = 0;
|
||||
entry->pages = pages;
|
||||
entry->prev = NULL;
|
||||
entry->next = dev->agp->memory;
|
||||
if (dev->agp->memory) dev->agp->memory->prev = entry;
|
||||
dev->agp->memory = entry;
|
||||
|
||||
agp_memory_info(dev->agp->agpdev, entry->handle, &info);
|
||||
|
||||
request.handle = (unsigned long) entry->handle;
|
||||
request.physical = info.ami_physical;
|
||||
|
||||
*(drm_agp_buffer_t *) data = request;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static drm_agp_mem_t * DRM(agp_lookup_entry)(drm_device_t *dev, void *handle)
|
||||
{
|
||||
drm_agp_mem_t *entry;
|
||||
|
||||
for (entry = dev->agp->memory; entry; entry = entry->next) {
|
||||
if (entry->handle == handle) return entry;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int DRM(agp_unbind)(dev_t kdev, u_long cmd, caddr_t data,
|
||||
int flags, struct proc *p)
|
||||
{
|
||||
drm_device_t *dev = kdev->si_drv1;
|
||||
drm_agp_binding_t request;
|
||||
drm_agp_mem_t *entry;
|
||||
|
||||
if (!dev->agp || !dev->agp->acquired) return EINVAL;
|
||||
request = *(drm_agp_binding_t *) data;
|
||||
if (!(entry = DRM(agp_lookup_entry)(dev, (void *) request.handle)))
|
||||
return EINVAL;
|
||||
if (!entry->bound) return EINVAL;
|
||||
return DRM(unbind_agp)(entry->handle);
|
||||
}
|
||||
|
||||
int DRM(agp_bind)(dev_t kdev, u_long cmd, caddr_t data,
|
||||
int flags, struct proc *p)
|
||||
{
|
||||
drm_device_t *dev = kdev->si_drv1;
|
||||
drm_agp_binding_t request;
|
||||
drm_agp_mem_t *entry;
|
||||
int retcode;
|
||||
int page;
|
||||
|
||||
DRM_DEBUG("agp_bind, page_size=%x\n", PAGE_SIZE);
|
||||
if (!dev->agp || !dev->agp->acquired)
|
||||
return EINVAL;
|
||||
request = *(drm_agp_binding_t *) data;
|
||||
|
||||
DRM_DEBUG("agp_bind:lookup\n");
|
||||
if (!(entry = DRM(agp_lookup_entry)(dev, (void *) request.handle)))
|
||||
return EINVAL;
|
||||
|
||||
DRM_DEBUG("agp_bind:page\n");
|
||||
if (entry->bound) return EINVAL;
|
||||
page = (request.offset + PAGE_SIZE - 1) / PAGE_SIZE;
|
||||
|
||||
DRM_DEBUG("agp_bind:bind it\n");
|
||||
if ((retcode = DRM(bind_agp)(entry->handle, page)))
|
||||
return retcode;
|
||||
|
||||
DRM_DEBUG("agp_bind:bound\n");
|
||||
entry->bound = dev->agp->base + (page << PAGE_SHIFT);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int DRM(agp_free)(dev_t kdev, u_long cmd, caddr_t data,
|
||||
int flags, struct proc *p)
|
||||
{
|
||||
drm_device_t *dev = kdev->si_drv1;
|
||||
drm_agp_buffer_t request;
|
||||
drm_agp_mem_t *entry;
|
||||
|
||||
if (!dev->agp || !dev->agp->acquired) return EINVAL;
|
||||
request = *(drm_agp_buffer_t *) data;
|
||||
if (!(entry = DRM(agp_lookup_entry)(dev, (void*) request.handle)))
|
||||
return EINVAL;
|
||||
if (entry->bound) DRM(unbind_agp)(entry->handle);
|
||||
|
||||
if (entry->prev) entry->prev->next = entry->next;
|
||||
else dev->agp->memory = entry->next;
|
||||
if (entry->next) entry->next->prev = entry->prev;
|
||||
DRM(free_agp)(entry->handle, entry->pages);
|
||||
DRM(free)(entry, sizeof(*entry), DRM_MEM_AGPLISTS);
|
||||
return 0;
|
||||
}
|
||||
|
||||
drm_agp_head_t *DRM(agp_init)(void)
|
||||
{
|
||||
device_t agpdev;
|
||||
drm_agp_head_t *head = NULL;
|
||||
int agp_available = 1;
|
||||
|
||||
agpdev = agp_find_device();
|
||||
if (!agpdev)
|
||||
agp_available = 0;
|
||||
|
||||
DRM_DEBUG("agp_available = %d\n", agp_available);
|
||||
|
||||
if (agp_available) {
|
||||
if (!(head = DRM(alloc)(sizeof(*head), DRM_MEM_AGPLISTS)))
|
||||
return NULL;
|
||||
bzero((void *)head, sizeof(*head));
|
||||
head->agpdev = agpdev;
|
||||
agp_get_info(agpdev, &head->info);
|
||||
head->memory = NULL;
|
||||
#if 0 /* bogus */
|
||||
switch (head->agp_info.chipset) {
|
||||
case INTEL_GENERIC: head->chipset = "Intel"; break;
|
||||
case INTEL_LX: head->chipset = "Intel 440LX"; break;
|
||||
case INTEL_BX: head->chipset = "Intel 440BX"; break;
|
||||
case INTEL_GX: head->chipset = "Intel 440GX"; break;
|
||||
case INTEL_I810: head->chipset = "Intel i810"; break;
|
||||
case VIA_GENERIC: head->chipset = "VIA"; break;
|
||||
case VIA_VP3: head->chipset = "VIA VP3"; break;
|
||||
case VIA_MVP3: head->chipset = "VIA MVP3"; break;
|
||||
case VIA_APOLLO_PRO: head->chipset = "VIA Apollo Pro"; break;
|
||||
case SIS_GENERIC: head->chipset = "SiS"; break;
|
||||
case AMD_GENERIC: head->chipset = "AMD"; break;
|
||||
case AMD_IRONGATE: head->chipset = "AMD Irongate"; break;
|
||||
case ALI_GENERIC: head->chipset = "ALi"; break;
|
||||
case ALI_M1541: head->chipset = "ALi M1541"; break;
|
||||
default:
|
||||
}
|
||||
#endif
|
||||
DRM_INFO("AGP at 0x%08x %dMB\n",
|
||||
head->info.ai_aperture_base,
|
||||
head->info.ai_aperture_size >> 20);
|
||||
}
|
||||
return head;
|
||||
}
|
||||
|
||||
void DRM(agp_uninit)(void)
|
||||
{
|
||||
|
||||
/* FIXME: What goes here */
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -13,7 +13,9 @@
|
|||
#include <sys/filio.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/select.h>
|
||||
#if __FreeBSD_version >= 500000
|
||||
#include <sys/selinfo.h>
|
||||
#endif
|
||||
#include <sys/bus.h>
|
||||
#if __FreeBSD_version >= 400005
|
||||
#include <sys/taskqueue.h>
|
||||
|
|
@ -48,8 +50,21 @@
|
|||
#define DRM_OS_SPINUNLOCK(u) simple_unlock(u);
|
||||
#endif
|
||||
#define DRM_OS_IOCTL dev_t kdev, u_long cmd, caddr_t data, int flags, struct proc *p
|
||||
#define DRM_OS_DEVICE drm_file_t *priv; \
|
||||
drm_device_t *dev = kdev->si_drv1
|
||||
#define DRM_OS_DEVICE drm_device_t *dev = kdev->si_drv1
|
||||
|
||||
#define DRM_OS_PRIV \
|
||||
drm_file_t *priv = (drm_file_t *) DRM(find_file_by_proc)(dev, p); \
|
||||
if (!priv) { \
|
||||
DRM_DEBUG("can't find authenticator\n"); \
|
||||
return EINVAL; \
|
||||
}
|
||||
|
||||
#define DRM_OS_DELAY( delay ) \
|
||||
do { \
|
||||
static int never; \
|
||||
tsleep(&never, PZERO|PCATCH, "drmdelay", delay ); \
|
||||
} while (0)
|
||||
|
||||
#define DRM_OS_RETURN(v) return v;
|
||||
#define DRM_OS_CURRENTPID p->p_pid
|
||||
#define DRM_OS_KRNTOUSR(arg1, arg2, arg3) \
|
||||
|
|
@ -61,10 +76,14 @@
|
|||
#define DRM_OS_COPYFROMUSR(arg1, arg2, arg3) \
|
||||
copyin(arg2, arg1, arg3)
|
||||
|
||||
#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
|
||||
|
||||
typedef unsigned long atomic_t;
|
||||
typedef u_int32_t cycles_t;
|
||||
typedef u_int32_t spinlock_t;
|
||||
typedef u_int32_t u32;
|
||||
typedef u_int16_t u16;
|
||||
typedef u_int8_t u8;
|
||||
#define atomic_set(p, v) (*(p) = (v))
|
||||
#define atomic_read(p) (*(p))
|
||||
#define atomic_inc(p) atomic_add_long(p, 1)
|
||||
|
|
@ -174,7 +193,7 @@ find_first_zero_bit(volatile unsigned long *p, int max)
|
|||
|
||||
#define DRM_PROC_LIMIT (PAGE_SIZE-80)
|
||||
|
||||
#if __FreeBSD_version >= 500000
|
||||
#if (__FreeBSD_version >= 500000) || ((__FreeBSD_version < 500000) && (__FreeBSD_version >= 410002))
|
||||
#define DRM_SYSCTL_HANDLER_ARGS (SYSCTL_HANDLER_ARGS)
|
||||
#else
|
||||
#define DRM_SYSCTL_HANDLER_ARGS SYSCTL_HANDLER_ARGS
|
||||
|
|
@ -263,7 +282,7 @@ extern d_ioctl_t DRM(mapbufs);
|
|||
#endif
|
||||
|
||||
/* Memory management support (drm_memory.h) */
|
||||
extern int DRM(mem_info)DRM_SYSCTL_HANDLER_ARGS;
|
||||
extern int DRM(mem_info) DRM_SYSCTL_HANDLER_ARGS;
|
||||
|
||||
/* DMA support (drm_dma.h) */
|
||||
#if __HAVE_DMA_IRQ
|
||||
|
|
|
|||
|
|
@ -1,11 +1,10 @@
|
|||
# $FreeBSD$
|
||||
|
||||
KMOD = mga
|
||||
SRCS = mga_drv.c mga_context.c mga_state.c mga_bufs.c mga_dma.c
|
||||
SRCS += device_if.h bus_if.h pci_if.h
|
||||
CFLAGS += ${DEBUG_FLAGS} -I..
|
||||
KERN = /usr/src/sys
|
||||
KMODDEPS = drm
|
||||
KMOD= mga
|
||||
NOMAN= YES
|
||||
SRCS= mga_drv.c mga_state.c mga_warp.c mga_dma.c
|
||||
SRCS+= device_if.h bus_if.h pci_if.h opt_drm_linux.h
|
||||
CFLAGS+= ${DEBUG_FLAGS} -I. -I.. -DSMP -DAPIC_IO
|
||||
|
||||
@:
|
||||
ln -sf /sys @
|
||||
|
|
@ -13,4 +12,14 @@ KMODDEPS = drm
|
|||
machine:
|
||||
ln -sf /sys/i386/include machine
|
||||
|
||||
.if ${MACHINE_ARCH} == "i386"
|
||||
# This line enables linux ioctl handling by default
|
||||
# comment out if you don't want it
|
||||
TDFX_OPTS= "\#define DRM_LINUX" 1
|
||||
.endif
|
||||
|
||||
opt_drm_linux.h:
|
||||
touch opt_drm_linux.h
|
||||
echo $(TDFX_OPTS) >> opt_drm_linux.h
|
||||
|
||||
.include <bsd.kmod.mk>
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
# $FreeBSD$
|
||||
|
||||
KMOD = tdfx
|
||||
SRCS = tdfx_drv.c
|
||||
SRCS += device_if.h bus_if.h pci_if.h
|
||||
CFLAGS += ${DEBUG_FLAGS} -I. -I..
|
||||
KMODDEPS = drm
|
||||
KMOD= tdfx
|
||||
NOMAN= YES
|
||||
SRCS= tdfx_drv.c
|
||||
SRCS+= device_if.h bus_if.h pci_if.h opt_drm_linux.h
|
||||
CFLAGS+= ${DEBUG_FLAGS} -I. -I.. -DSMP -DAPIC_IO
|
||||
|
||||
@:
|
||||
ln -sf /sys @
|
||||
|
|
@ -12,4 +12,14 @@ KMODDEPS = drm
|
|||
machine:
|
||||
ln -sf /sys/i386/include machine
|
||||
|
||||
.if ${MACHINE_ARCH} == "i386"
|
||||
# This line enables linux ioctl handling by default
|
||||
# comment out if you don't want it
|
||||
TDFX_OPTS= "\#define DRM_LINUX" 1
|
||||
.endif
|
||||
|
||||
opt_drm_linux.h:
|
||||
touch opt_drm_linux.h
|
||||
echo $(TDFX_OPTS) >> opt_drm_linux.h
|
||||
|
||||
.include <bsd.kmod.mk>
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@ LinkFileList(i810inc, $(LINUXDRM)/i810.h $(LINUXDRM)/i810_dma.c $(LINUXDRM)/i810
|
|||
LinkFileList(sisinc, $(LINUXDRM)/sis_context.c $(LINUXDRM)/sis_drv.c $(LINUXDRM)/sis_drv.h $(LINUXDRM)/sis_ds.h $(LINUXDRM)/sis_ds.c $(LINUXDRM)/sis_mm.c, sis, .)
|
||||
|
||||
LinkSourceFile(ati_pcigart.h,$(XF86OSSRC)/linux/drm/kernel)
|
||||
LinkSourceFile(drm_agpsupport.h,$(XF86OSSRC)/linux/drm/kernel)
|
||||
LinkSourceFile(drm_auth.h,$(XF86OSSRC)/linux/drm/kernel)
|
||||
LinkSourceFile(drm_bufs.h,$(XF86OSSRC)/linux/drm/kernel)
|
||||
LinkSourceFile(drm_context.h,$(XF86OSSRC)/linux/drm/kernel)
|
||||
|
|
|
|||
280
bsd/drm_agpsupport.h
Normal file
280
bsd/drm_agpsupport.h
Normal file
|
|
@ -0,0 +1,280 @@
|
|||
/* drm_agpsupport.h -- DRM support for AGP/GART backend -*- linux-c -*-
|
||||
* Created: Mon Dec 13 09:56:45 1999 by faith@precisioninsight.com
|
||||
*
|
||||
* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
|
||||
* 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
|
||||
* 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,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Author:
|
||||
* Rickard E. (Rik) Faith <faith@valinux.com>
|
||||
* Gareth Hughes <gareth@valinux.com>
|
||||
*/
|
||||
|
||||
#include "drmP.h"
|
||||
|
||||
int DRM(agp_info)(dev_t kdev, u_long cmd, caddr_t data,
|
||||
int flags, struct proc *p)
|
||||
{
|
||||
drm_device_t *dev = kdev->si_drv1;
|
||||
struct agp_info *kern;
|
||||
drm_agp_info_t info;
|
||||
|
||||
if (!dev->agp || !dev->agp->acquired) return EINVAL;
|
||||
|
||||
kern = &dev->agp->info;
|
||||
agp_get_info(dev->agp->agpdev, kern);
|
||||
info.agp_version_major = 1;
|
||||
info.agp_version_minor = 0;
|
||||
info.mode = kern->ai_mode;
|
||||
info.aperture_base = kern->ai_aperture_base;
|
||||
info.aperture_size = kern->ai_aperture_size;
|
||||
info.memory_allowed = kern->ai_memory_allowed;
|
||||
info.memory_used = kern->ai_memory_used;
|
||||
info.id_vendor = kern->ai_devid & 0xffff;
|
||||
info.id_device = kern->ai_devid >> 16;
|
||||
|
||||
*(drm_agp_info_t *) data = info;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int DRM(agp_acquire)(dev_t kdev, u_long cmd, caddr_t data,
|
||||
int flags, struct proc *p)
|
||||
{
|
||||
drm_device_t *dev = kdev->si_drv1;
|
||||
int retcode;
|
||||
|
||||
if (!dev->agp || dev->agp->acquired) return EINVAL;
|
||||
retcode = agp_acquire(dev->agp->agpdev);
|
||||
if (retcode) return retcode;
|
||||
dev->agp->acquired = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int DRM(agp_release)(dev_t kdev, u_long cmd, caddr_t data,
|
||||
int flags, struct proc *p)
|
||||
{
|
||||
drm_device_t *dev = kdev->si_drv1;
|
||||
|
||||
if (!dev->agp || !dev->agp->acquired)
|
||||
return EINVAL;
|
||||
agp_release(dev->agp->agpdev);
|
||||
dev->agp->acquired = 0;
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
int DRM(agp_enable)(dev_t kdev, u_long cmd, caddr_t data,
|
||||
int flags, struct proc *p)
|
||||
{
|
||||
drm_device_t *dev = kdev->si_drv1;
|
||||
drm_agp_mode_t mode;
|
||||
|
||||
if (!dev->agp || !dev->agp->acquired) return EINVAL;
|
||||
|
||||
mode = *(drm_agp_mode_t *) data;
|
||||
|
||||
dev->agp->mode = mode.mode;
|
||||
agp_enable(dev->agp->agpdev, mode.mode);
|
||||
dev->agp->base = dev->agp->info.ai_aperture_base;
|
||||
dev->agp->enabled = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int DRM(agp_alloc)(dev_t kdev, u_long cmd, caddr_t data,
|
||||
int flags, struct proc *p)
|
||||
{
|
||||
drm_device_t *dev = kdev->si_drv1;
|
||||
drm_agp_buffer_t request;
|
||||
drm_agp_mem_t *entry;
|
||||
void *handle;
|
||||
unsigned long pages;
|
||||
u_int32_t type;
|
||||
struct agp_memory_info info;
|
||||
|
||||
if (!dev->agp || !dev->agp->acquired) return EINVAL;
|
||||
|
||||
request = *(drm_agp_buffer_t *) data;
|
||||
|
||||
if (!(entry = DRM(alloc)(sizeof(*entry), DRM_MEM_AGPLISTS)))
|
||||
return ENOMEM;
|
||||
|
||||
bzero(entry, sizeof(*entry));
|
||||
|
||||
pages = (request.size + PAGE_SIZE - 1) / PAGE_SIZE;
|
||||
type = (u_int32_t) request.type;
|
||||
|
||||
if (!(handle = DRM(alloc_agp)(pages, type))) {
|
||||
DRM(free)(entry, sizeof(*entry), DRM_MEM_AGPLISTS);
|
||||
return ENOMEM;
|
||||
}
|
||||
|
||||
entry->handle = handle;
|
||||
entry->bound = 0;
|
||||
entry->pages = pages;
|
||||
entry->prev = NULL;
|
||||
entry->next = dev->agp->memory;
|
||||
if (dev->agp->memory) dev->agp->memory->prev = entry;
|
||||
dev->agp->memory = entry;
|
||||
|
||||
agp_memory_info(dev->agp->agpdev, entry->handle, &info);
|
||||
|
||||
request.handle = (unsigned long) entry->handle;
|
||||
request.physical = info.ami_physical;
|
||||
|
||||
*(drm_agp_buffer_t *) data = request;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static drm_agp_mem_t * DRM(agp_lookup_entry)(drm_device_t *dev, void *handle)
|
||||
{
|
||||
drm_agp_mem_t *entry;
|
||||
|
||||
for (entry = dev->agp->memory; entry; entry = entry->next) {
|
||||
if (entry->handle == handle) return entry;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int DRM(agp_unbind)(dev_t kdev, u_long cmd, caddr_t data,
|
||||
int flags, struct proc *p)
|
||||
{
|
||||
drm_device_t *dev = kdev->si_drv1;
|
||||
drm_agp_binding_t request;
|
||||
drm_agp_mem_t *entry;
|
||||
|
||||
if (!dev->agp || !dev->agp->acquired) return EINVAL;
|
||||
request = *(drm_agp_binding_t *) data;
|
||||
if (!(entry = DRM(agp_lookup_entry)(dev, (void *) request.handle)))
|
||||
return EINVAL;
|
||||
if (!entry->bound) return EINVAL;
|
||||
return DRM(unbind_agp)(entry->handle);
|
||||
}
|
||||
|
||||
int DRM(agp_bind)(dev_t kdev, u_long cmd, caddr_t data,
|
||||
int flags, struct proc *p)
|
||||
{
|
||||
drm_device_t *dev = kdev->si_drv1;
|
||||
drm_agp_binding_t request;
|
||||
drm_agp_mem_t *entry;
|
||||
int retcode;
|
||||
int page;
|
||||
|
||||
DRM_DEBUG("agp_bind, page_size=%x\n", PAGE_SIZE);
|
||||
if (!dev->agp || !dev->agp->acquired)
|
||||
return EINVAL;
|
||||
request = *(drm_agp_binding_t *) data;
|
||||
|
||||
DRM_DEBUG("agp_bind:lookup\n");
|
||||
if (!(entry = DRM(agp_lookup_entry)(dev, (void *) request.handle)))
|
||||
return EINVAL;
|
||||
|
||||
DRM_DEBUG("agp_bind:page\n");
|
||||
if (entry->bound) return EINVAL;
|
||||
page = (request.offset + PAGE_SIZE - 1) / PAGE_SIZE;
|
||||
|
||||
DRM_DEBUG("agp_bind:bind it\n");
|
||||
if ((retcode = DRM(bind_agp)(entry->handle, page)))
|
||||
return retcode;
|
||||
|
||||
DRM_DEBUG("agp_bind:bound\n");
|
||||
entry->bound = dev->agp->base + (page << PAGE_SHIFT);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int DRM(agp_free)(dev_t kdev, u_long cmd, caddr_t data,
|
||||
int flags, struct proc *p)
|
||||
{
|
||||
drm_device_t *dev = kdev->si_drv1;
|
||||
drm_agp_buffer_t request;
|
||||
drm_agp_mem_t *entry;
|
||||
|
||||
if (!dev->agp || !dev->agp->acquired) return EINVAL;
|
||||
request = *(drm_agp_buffer_t *) data;
|
||||
if (!(entry = DRM(agp_lookup_entry)(dev, (void*) request.handle)))
|
||||
return EINVAL;
|
||||
if (entry->bound) DRM(unbind_agp)(entry->handle);
|
||||
|
||||
if (entry->prev) entry->prev->next = entry->next;
|
||||
else dev->agp->memory = entry->next;
|
||||
if (entry->next) entry->next->prev = entry->prev;
|
||||
DRM(free_agp)(entry->handle, entry->pages);
|
||||
DRM(free)(entry, sizeof(*entry), DRM_MEM_AGPLISTS);
|
||||
return 0;
|
||||
}
|
||||
|
||||
drm_agp_head_t *DRM(agp_init)(void)
|
||||
{
|
||||
device_t agpdev;
|
||||
drm_agp_head_t *head = NULL;
|
||||
int agp_available = 1;
|
||||
|
||||
agpdev = agp_find_device();
|
||||
if (!agpdev)
|
||||
agp_available = 0;
|
||||
|
||||
DRM_DEBUG("agp_available = %d\n", agp_available);
|
||||
|
||||
if (agp_available) {
|
||||
if (!(head = DRM(alloc)(sizeof(*head), DRM_MEM_AGPLISTS)))
|
||||
return NULL;
|
||||
bzero((void *)head, sizeof(*head));
|
||||
head->agpdev = agpdev;
|
||||
agp_get_info(agpdev, &head->info);
|
||||
head->memory = NULL;
|
||||
#if 0 /* bogus */
|
||||
switch (head->agp_info.chipset) {
|
||||
case INTEL_GENERIC: head->chipset = "Intel"; break;
|
||||
case INTEL_LX: head->chipset = "Intel 440LX"; break;
|
||||
case INTEL_BX: head->chipset = "Intel 440BX"; break;
|
||||
case INTEL_GX: head->chipset = "Intel 440GX"; break;
|
||||
case INTEL_I810: head->chipset = "Intel i810"; break;
|
||||
case VIA_GENERIC: head->chipset = "VIA"; break;
|
||||
case VIA_VP3: head->chipset = "VIA VP3"; break;
|
||||
case VIA_MVP3: head->chipset = "VIA MVP3"; break;
|
||||
case VIA_APOLLO_PRO: head->chipset = "VIA Apollo Pro"; break;
|
||||
case SIS_GENERIC: head->chipset = "SiS"; break;
|
||||
case AMD_GENERIC: head->chipset = "AMD"; break;
|
||||
case AMD_IRONGATE: head->chipset = "AMD Irongate"; break;
|
||||
case ALI_GENERIC: head->chipset = "ALi"; break;
|
||||
case ALI_M1541: head->chipset = "ALi M1541"; break;
|
||||
default:
|
||||
}
|
||||
#endif
|
||||
DRM_INFO("AGP at 0x%08x %dMB\n",
|
||||
head->info.ai_aperture_base,
|
||||
head->info.ai_aperture_size >> 20);
|
||||
}
|
||||
return head;
|
||||
}
|
||||
|
||||
void DRM(agp_uninit)(void)
|
||||
{
|
||||
|
||||
/* FIXME: What goes here */
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -13,7 +13,9 @@
|
|||
#include <sys/filio.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/select.h>
|
||||
#if __FreeBSD_version >= 500000
|
||||
#include <sys/selinfo.h>
|
||||
#endif
|
||||
#include <sys/bus.h>
|
||||
#if __FreeBSD_version >= 400005
|
||||
#include <sys/taskqueue.h>
|
||||
|
|
@ -48,8 +50,21 @@
|
|||
#define DRM_OS_SPINUNLOCK(u) simple_unlock(u);
|
||||
#endif
|
||||
#define DRM_OS_IOCTL dev_t kdev, u_long cmd, caddr_t data, int flags, struct proc *p
|
||||
#define DRM_OS_DEVICE drm_file_t *priv; \
|
||||
drm_device_t *dev = kdev->si_drv1
|
||||
#define DRM_OS_DEVICE drm_device_t *dev = kdev->si_drv1
|
||||
|
||||
#define DRM_OS_PRIV \
|
||||
drm_file_t *priv = (drm_file_t *) DRM(find_file_by_proc)(dev, p); \
|
||||
if (!priv) { \
|
||||
DRM_DEBUG("can't find authenticator\n"); \
|
||||
return EINVAL; \
|
||||
}
|
||||
|
||||
#define DRM_OS_DELAY( delay ) \
|
||||
do { \
|
||||
static int never; \
|
||||
tsleep(&never, PZERO|PCATCH, "drmdelay", delay ); \
|
||||
} while (0)
|
||||
|
||||
#define DRM_OS_RETURN(v) return v;
|
||||
#define DRM_OS_CURRENTPID p->p_pid
|
||||
#define DRM_OS_KRNTOUSR(arg1, arg2, arg3) \
|
||||
|
|
@ -61,10 +76,14 @@
|
|||
#define DRM_OS_COPYFROMUSR(arg1, arg2, arg3) \
|
||||
copyin(arg2, arg1, arg3)
|
||||
|
||||
#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
|
||||
|
||||
typedef unsigned long atomic_t;
|
||||
typedef u_int32_t cycles_t;
|
||||
typedef u_int32_t spinlock_t;
|
||||
typedef u_int32_t u32;
|
||||
typedef u_int16_t u16;
|
||||
typedef u_int8_t u8;
|
||||
#define atomic_set(p, v) (*(p) = (v))
|
||||
#define atomic_read(p) (*(p))
|
||||
#define atomic_inc(p) atomic_add_long(p, 1)
|
||||
|
|
@ -174,7 +193,7 @@ find_first_zero_bit(volatile unsigned long *p, int max)
|
|||
|
||||
#define DRM_PROC_LIMIT (PAGE_SIZE-80)
|
||||
|
||||
#if __FreeBSD_version >= 500000
|
||||
#if (__FreeBSD_version >= 500000) || ((__FreeBSD_version < 500000) && (__FreeBSD_version >= 410002))
|
||||
#define DRM_SYSCTL_HANDLER_ARGS (SYSCTL_HANDLER_ARGS)
|
||||
#else
|
||||
#define DRM_SYSCTL_HANDLER_ARGS SYSCTL_HANDLER_ARGS
|
||||
|
|
@ -263,7 +282,7 @@ extern d_ioctl_t DRM(mapbufs);
|
|||
#endif
|
||||
|
||||
/* Memory management support (drm_memory.h) */
|
||||
extern int DRM(mem_info)DRM_SYSCTL_HANDLER_ARGS;
|
||||
extern int DRM(mem_info) DRM_SYSCTL_HANDLER_ARGS;
|
||||
|
||||
/* DMA support (drm_dma.h) */
|
||||
#if __HAVE_DMA_IRQ
|
||||
|
|
|
|||
|
|
@ -1,11 +1,10 @@
|
|||
# $FreeBSD$
|
||||
|
||||
KMOD = mga
|
||||
SRCS = mga_drv.c mga_context.c mga_state.c mga_bufs.c mga_dma.c
|
||||
SRCS += device_if.h bus_if.h pci_if.h
|
||||
CFLAGS += ${DEBUG_FLAGS} -I..
|
||||
KERN = /usr/src/sys
|
||||
KMODDEPS = drm
|
||||
KMOD= mga
|
||||
NOMAN= YES
|
||||
SRCS= mga_drv.c mga_state.c mga_warp.c mga_dma.c
|
||||
SRCS+= device_if.h bus_if.h pci_if.h opt_drm_linux.h
|
||||
CFLAGS+= ${DEBUG_FLAGS} -I. -I.. -DSMP -DAPIC_IO
|
||||
|
||||
@:
|
||||
ln -sf /sys @
|
||||
|
|
@ -13,4 +12,14 @@ KMODDEPS = drm
|
|||
machine:
|
||||
ln -sf /sys/i386/include machine
|
||||
|
||||
.if ${MACHINE_ARCH} == "i386"
|
||||
# This line enables linux ioctl handling by default
|
||||
# comment out if you don't want it
|
||||
TDFX_OPTS= "\#define DRM_LINUX" 1
|
||||
.endif
|
||||
|
||||
opt_drm_linux.h:
|
||||
touch opt_drm_linux.h
|
||||
echo $(TDFX_OPTS) >> opt_drm_linux.h
|
||||
|
||||
.include <bsd.kmod.mk>
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
# $FreeBSD$
|
||||
|
||||
KMOD = tdfx
|
||||
SRCS = tdfx_drv.c
|
||||
SRCS += device_if.h bus_if.h pci_if.h
|
||||
CFLAGS += ${DEBUG_FLAGS} -I. -I..
|
||||
KMODDEPS = drm
|
||||
KMOD= tdfx
|
||||
NOMAN= YES
|
||||
SRCS= tdfx_drv.c
|
||||
SRCS+= device_if.h bus_if.h pci_if.h opt_drm_linux.h
|
||||
CFLAGS+= ${DEBUG_FLAGS} -I. -I.. -DSMP -DAPIC_IO
|
||||
|
||||
@:
|
||||
ln -sf /sys @
|
||||
|
|
@ -12,4 +12,14 @@ KMODDEPS = drm
|
|||
machine:
|
||||
ln -sf /sys/i386/include machine
|
||||
|
||||
.if ${MACHINE_ARCH} == "i386"
|
||||
# This line enables linux ioctl handling by default
|
||||
# comment out if you don't want it
|
||||
TDFX_OPTS= "\#define DRM_LINUX" 1
|
||||
.endif
|
||||
|
||||
opt_drm_linux.h:
|
||||
touch opt_drm_linux.h
|
||||
echo $(TDFX_OPTS) >> opt_drm_linux.h
|
||||
|
||||
.include <bsd.kmod.mk>
|
||||
|
|
|
|||
|
|
@ -122,12 +122,12 @@ int DRM(getmagic)(DRM_OS_IOCTL)
|
|||
#ifdef __linux__
|
||||
static spinlock_t lock = SPIN_LOCK_UNLOCKED;
|
||||
#endif
|
||||
DRM_OS_DEVICE;
|
||||
#ifdef __FreeBSD__
|
||||
static struct simplelock lock;
|
||||
|
||||
priv = (drm_file_t *) DRM(find_file_by_proc)(dev, p);
|
||||
#endif
|
||||
DRM_OS_DEVICE;
|
||||
DRM_OS_PRIV;
|
||||
|
||||
|
||||
/* Find unique magic */
|
||||
if (priv->magic) {
|
||||
|
|
|
|||
|
|
@ -676,7 +676,7 @@ static int DRM(init)( device_t nbdev )
|
|||
DRM(stub_unregister)(DRM(minor));
|
||||
#endif
|
||||
#ifdef __FreeBSD__
|
||||
DRM(sysctl_cleanup)();
|
||||
DRM(sysctl_cleanup)( dev );
|
||||
destroy_dev(dev->devnode);
|
||||
#endif
|
||||
DRM(takedown)( dev );
|
||||
|
|
@ -1069,14 +1069,7 @@ int DRM(ioctl)( DRM_OS_IOCTL )
|
|||
d_ioctl_t *func;
|
||||
#endif
|
||||
int nr = DRM_IOCTL_NR(cmd);
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
priv = DRM(find_file_by_proc)(dev, p);
|
||||
if (!priv) {
|
||||
DRM_DEBUG("can't find authenticator\n");
|
||||
return EINVAL;
|
||||
}
|
||||
#endif
|
||||
DRM_OS_PRIV;
|
||||
|
||||
atomic_inc( &dev->ioctl_count );
|
||||
atomic_inc( &dev->counts[_DRM_STAT_IOCTLS] );
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ int DRM(open_helper)(dev_t kdev, int flags, int fmt, struct proc *p,
|
|||
#endif
|
||||
#ifdef __FreeBSD__
|
||||
/* FIXME: linux mallocs and bzeros here */
|
||||
priv = (drm_file_t *) DRM(find_find_by_proc)(dev, p);
|
||||
priv = (drm_file_t *) DRM(find_file_by_proc)(dev, p);
|
||||
if (priv) {
|
||||
priv->refs++;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -46,7 +46,11 @@ int DRM(unblock)( DRM_OS_IOCTL )
|
|||
|
||||
int DRM(lock_take)(__volatile__ unsigned int *lock, unsigned int context)
|
||||
{
|
||||
unsigned int old, new, prev;
|
||||
unsigned int old, new;
|
||||
#ifdef __linux__
|
||||
unsigned int prev;
|
||||
#endif
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
char failed;
|
||||
#endif
|
||||
|
|
@ -84,7 +88,10 @@ int DRM(lock_take)(__volatile__ unsigned int *lock, unsigned int context)
|
|||
int DRM(lock_transfer)(drm_device_t *dev,
|
||||
__volatile__ unsigned int *lock, unsigned int context)
|
||||
{
|
||||
unsigned int old, new, prev;
|
||||
unsigned int old, new;
|
||||
#ifdef __linux__
|
||||
unsigned int prev;
|
||||
#endif
|
||||
#ifdef __FreeBSD__
|
||||
char failed;
|
||||
#endif
|
||||
|
|
@ -107,7 +114,10 @@ int DRM(lock_transfer)(drm_device_t *dev,
|
|||
int DRM(lock_free)(drm_device_t *dev,
|
||||
__volatile__ unsigned int *lock, unsigned int context)
|
||||
{
|
||||
unsigned int old, new, prev;
|
||||
unsigned int old, new;
|
||||
#ifdef __linux__
|
||||
unsigned int prev;
|
||||
#endif
|
||||
pid_t pid = dev->lock.pid;
|
||||
#ifdef __FreeBSD__
|
||||
char failed;
|
||||
|
|
@ -280,7 +290,10 @@ int DRM(finish)( DRM_OS_IOCTL )
|
|||
int DRM(notifier)(void *priv)
|
||||
{
|
||||
drm_sigdata_t *s = (drm_sigdata_t *)priv;
|
||||
unsigned int old, new, prev;
|
||||
unsigned int old, new;
|
||||
#ifdef __linux__
|
||||
unsigned int prev;
|
||||
#endif
|
||||
#ifdef __FreeBSD__
|
||||
char failed;
|
||||
#endif
|
||||
|
|
@ -305,3 +318,4 @@ int DRM(notifier)(void *priv)
|
|||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -168,8 +168,9 @@ static int DRM(_mem_info)(char *buf, char **start, off_t offset,
|
|||
return len - offset;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
static int DRM(_mem_info)SYSCTL_HANDLER_ARGS
|
||||
static int DRM(_mem_info) DRM_SYSCTL_HANDLER_ARGS
|
||||
{
|
||||
drm_mem_stats_t *pt;
|
||||
char buf[128];
|
||||
|
|
@ -207,7 +208,7 @@ int DRM(mem_info)(char *buf, char **start, off_t offset,
|
|||
int len, int *eof, void *data)
|
||||
#endif
|
||||
#ifdef __FreeBSD__
|
||||
int DRM(mem_info)SYSCTL_HANDLER_ARGS
|
||||
int DRM(mem_info) DRM_SYSCTL_HANDLER_ARGS
|
||||
#endif
|
||||
{
|
||||
int ret;
|
||||
|
|
@ -309,13 +310,13 @@ unsigned long DRM(alloc_pages)(int order, int area)
|
|||
{
|
||||
#ifdef __linux__
|
||||
unsigned long address;
|
||||
unsigned long addr;
|
||||
unsigned int sz;
|
||||
#endif
|
||||
#ifdef __FreeBSD__
|
||||
vm_offset_t address;
|
||||
#endif
|
||||
unsigned long bytes = PAGE_SIZE << order;
|
||||
unsigned long addr;
|
||||
unsigned int sz;
|
||||
|
||||
#ifdef __linux__
|
||||
DRM_OS_SPINLOCK(&DRM(mem_lock));
|
||||
|
|
|
|||
|
|
@ -266,6 +266,7 @@ do { \
|
|||
#define DRM_OS_IOCTL struct inode *inode, struct file *filp, unsigned int cmd, unsigned long data
|
||||
#define DRM_OS_DEVICE drm_file_t *priv = filp->private_data; \
|
||||
drm_device_t *dev = priv->dev
|
||||
#define DRM_OS_PRIV
|
||||
#define DRM_OS_RETURN(v) return -v;
|
||||
#define DRM_OS_CURRENTPID current->pid
|
||||
#define DRM_OS_KRNTOUSR(arg1, arg2, arg3) \
|
||||
|
|
|
|||
|
|
@ -29,7 +29,16 @@
|
|||
* Gareth Hughes <gareth@valinux.com>
|
||||
*/
|
||||
|
||||
#ifdef __linux__
|
||||
#include <linux/config.h>
|
||||
#endif
|
||||
#ifdef __FreeBSD__
|
||||
#include <sys/types.h>
|
||||
#include <sys/bus.h>
|
||||
#include <pci/pcivar.h>
|
||||
#include <opt_drm_linux.h>
|
||||
#endif
|
||||
|
||||
#include "mga.h"
|
||||
#include "drmP.h"
|
||||
#include "mga_drv.h"
|
||||
|
|
@ -44,6 +53,30 @@
|
|||
#define DRIVER_MINOR 0
|
||||
#define DRIVER_PATCHLEVEL 2
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
static int mga_probe(device_t dev)
|
||||
{
|
||||
const char *s = 0;
|
||||
|
||||
switch (pci_get_devid(dev)) {
|
||||
case 0x0525102b:
|
||||
s = "Matrox MGA G400 AGP graphics accelerator";
|
||||
break;
|
||||
|
||||
case 0x0521102b:
|
||||
s = "Matrox MGA G200 AGP graphics accelerator";
|
||||
break;
|
||||
}
|
||||
|
||||
if (s) {
|
||||
device_set_desc(dev, s);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return ENXIO;
|
||||
}
|
||||
#endif
|
||||
|
||||
#define DRIVER_IOCTLS \
|
||||
[DRM_IOCTL_NR(DRM_IOCTL_DMA)] = { mga_dma_buffers, 1, 0 }, \
|
||||
[DRM_IOCTL_NR(DRM_IOCTL_MGA_INIT)] = { mga_dma_init, 1, 1 }, \
|
||||
|
|
@ -75,6 +108,15 @@
|
|||
#include "drm_ioctl.h"
|
||||
#include "drm_lock.h"
|
||||
#include "drm_memory.h"
|
||||
#ifdef __linux__
|
||||
#include "drm_proc.h"
|
||||
#include "drm_vm.h"
|
||||
#include "drm_stub.h"
|
||||
#endif
|
||||
#ifdef __FreeBSD__
|
||||
#include "drm_sysctl.h"
|
||||
#endif
|
||||
#include "drm_vm.h"
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
DRIVER_MODULE(mga, pci, mga_driver, mga_devclass, 0, 0);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@
|
|||
#include <sys/types.h>
|
||||
#include <sys/bus.h>
|
||||
#include <pci/pcivar.h>
|
||||
/* #include <opt_drm_linux.h> */
|
||||
#include <opt_drm_linux.h>
|
||||
#endif
|
||||
|
||||
#include "tdfx.h"
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@
|
|||
#define DRM_NAME "drm" /* Name in kernel, /dev, and /proc */
|
||||
#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_RAM_PERCENT 10 /* How much system ram can we lock? */
|
||||
#define DRM_RAM_PERCENT 50 /* How much system ram can we lock? */
|
||||
|
||||
#define _DRM_LOCK_HELD 0x80000000 /* Hardware lock is held */
|
||||
#define _DRM_LOCK_CONT 0x40000000 /* Hardware lock is contended */
|
||||
|
|
@ -86,9 +86,7 @@ typedef struct drm_tex_region {
|
|||
#include "i810_drm.h"
|
||||
#include "r128_drm.h"
|
||||
#include "radeon_drm.h"
|
||||
#ifdef CONFIG_DRM_SIS
|
||||
#include "sis_drm.h"
|
||||
#endif
|
||||
|
||||
typedef struct drm_version {
|
||||
int version_major; /* Major version */
|
||||
|
|
@ -465,7 +463,6 @@ typedef struct drm_scatter_gather {
|
|||
#define DRM_IOCTL_RADEON_STIPPLE DRM_IOW( 0x4c, drm_radeon_stipple_t)
|
||||
#define DRM_IOCTL_RADEON_INDIRECT DRM_IOWR(0x4d, drm_radeon_indirect_t)
|
||||
|
||||
#ifdef CONFIG_DRM_SIS
|
||||
/* SiS specific ioctls */
|
||||
#define SIS_IOCTL_FB_ALLOC DRM_IOWR(0x44, drm_sis_mem_t)
|
||||
#define SIS_IOCTL_FB_FREE DRM_IOW( 0x45, drm_sis_mem_t)
|
||||
|
|
@ -475,6 +472,5 @@ typedef struct drm_scatter_gather {
|
|||
#define SIS_IOCTL_FLIP DRM_IOW( 0x48, drm_sis_flip_t)
|
||||
#define SIS_IOCTL_FLIP_INIT DRM_IO( 0x49)
|
||||
#define SIS_IOCTL_FLIP_FINAL DRM_IO( 0x50)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -122,12 +122,12 @@ int DRM(getmagic)(DRM_OS_IOCTL)
|
|||
#ifdef __linux__
|
||||
static spinlock_t lock = SPIN_LOCK_UNLOCKED;
|
||||
#endif
|
||||
DRM_OS_DEVICE;
|
||||
#ifdef __FreeBSD__
|
||||
static struct simplelock lock;
|
||||
|
||||
priv = (drm_file_t *) DRM(find_file_by_proc)(dev, p);
|
||||
#endif
|
||||
DRM_OS_DEVICE;
|
||||
DRM_OS_PRIV;
|
||||
|
||||
|
||||
/* Find unique magic */
|
||||
if (priv->magic) {
|
||||
|
|
|
|||
|
|
@ -676,7 +676,7 @@ static int DRM(init)( device_t nbdev )
|
|||
DRM(stub_unregister)(DRM(minor));
|
||||
#endif
|
||||
#ifdef __FreeBSD__
|
||||
DRM(sysctl_cleanup)();
|
||||
DRM(sysctl_cleanup)( dev );
|
||||
destroy_dev(dev->devnode);
|
||||
#endif
|
||||
DRM(takedown)( dev );
|
||||
|
|
@ -1069,14 +1069,7 @@ int DRM(ioctl)( DRM_OS_IOCTL )
|
|||
d_ioctl_t *func;
|
||||
#endif
|
||||
int nr = DRM_IOCTL_NR(cmd);
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
priv = DRM(find_file_by_proc)(dev, p);
|
||||
if (!priv) {
|
||||
DRM_DEBUG("can't find authenticator\n");
|
||||
return EINVAL;
|
||||
}
|
||||
#endif
|
||||
DRM_OS_PRIV;
|
||||
|
||||
atomic_inc( &dev->ioctl_count );
|
||||
atomic_inc( &dev->counts[_DRM_STAT_IOCTLS] );
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ int DRM(open_helper)(dev_t kdev, int flags, int fmt, struct proc *p,
|
|||
#endif
|
||||
#ifdef __FreeBSD__
|
||||
/* FIXME: linux mallocs and bzeros here */
|
||||
priv = (drm_file_t *) DRM(find_find_by_proc)(dev, p);
|
||||
priv = (drm_file_t *) DRM(find_file_by_proc)(dev, p);
|
||||
if (priv) {
|
||||
priv->refs++;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -46,7 +46,11 @@ int DRM(unblock)( DRM_OS_IOCTL )
|
|||
|
||||
int DRM(lock_take)(__volatile__ unsigned int *lock, unsigned int context)
|
||||
{
|
||||
unsigned int old, new, prev;
|
||||
unsigned int old, new;
|
||||
#ifdef __linux__
|
||||
unsigned int prev;
|
||||
#endif
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
char failed;
|
||||
#endif
|
||||
|
|
@ -84,7 +88,10 @@ int DRM(lock_take)(__volatile__ unsigned int *lock, unsigned int context)
|
|||
int DRM(lock_transfer)(drm_device_t *dev,
|
||||
__volatile__ unsigned int *lock, unsigned int context)
|
||||
{
|
||||
unsigned int old, new, prev;
|
||||
unsigned int old, new;
|
||||
#ifdef __linux__
|
||||
unsigned int prev;
|
||||
#endif
|
||||
#ifdef __FreeBSD__
|
||||
char failed;
|
||||
#endif
|
||||
|
|
@ -107,7 +114,10 @@ int DRM(lock_transfer)(drm_device_t *dev,
|
|||
int DRM(lock_free)(drm_device_t *dev,
|
||||
__volatile__ unsigned int *lock, unsigned int context)
|
||||
{
|
||||
unsigned int old, new, prev;
|
||||
unsigned int old, new;
|
||||
#ifdef __linux__
|
||||
unsigned int prev;
|
||||
#endif
|
||||
pid_t pid = dev->lock.pid;
|
||||
#ifdef __FreeBSD__
|
||||
char failed;
|
||||
|
|
@ -280,7 +290,10 @@ int DRM(finish)( DRM_OS_IOCTL )
|
|||
int DRM(notifier)(void *priv)
|
||||
{
|
||||
drm_sigdata_t *s = (drm_sigdata_t *)priv;
|
||||
unsigned int old, new, prev;
|
||||
unsigned int old, new;
|
||||
#ifdef __linux__
|
||||
unsigned int prev;
|
||||
#endif
|
||||
#ifdef __FreeBSD__
|
||||
char failed;
|
||||
#endif
|
||||
|
|
@ -305,3 +318,4 @@ int DRM(notifier)(void *priv)
|
|||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -168,8 +168,9 @@ static int DRM(_mem_info)(char *buf, char **start, off_t offset,
|
|||
return len - offset;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
static int DRM(_mem_info)SYSCTL_HANDLER_ARGS
|
||||
static int DRM(_mem_info) DRM_SYSCTL_HANDLER_ARGS
|
||||
{
|
||||
drm_mem_stats_t *pt;
|
||||
char buf[128];
|
||||
|
|
@ -207,7 +208,7 @@ int DRM(mem_info)(char *buf, char **start, off_t offset,
|
|||
int len, int *eof, void *data)
|
||||
#endif
|
||||
#ifdef __FreeBSD__
|
||||
int DRM(mem_info)SYSCTL_HANDLER_ARGS
|
||||
int DRM(mem_info) DRM_SYSCTL_HANDLER_ARGS
|
||||
#endif
|
||||
{
|
||||
int ret;
|
||||
|
|
@ -309,13 +310,13 @@ unsigned long DRM(alloc_pages)(int order, int area)
|
|||
{
|
||||
#ifdef __linux__
|
||||
unsigned long address;
|
||||
unsigned long addr;
|
||||
unsigned int sz;
|
||||
#endif
|
||||
#ifdef __FreeBSD__
|
||||
vm_offset_t address;
|
||||
#endif
|
||||
unsigned long bytes = PAGE_SIZE << order;
|
||||
unsigned long addr;
|
||||
unsigned int sz;
|
||||
|
||||
#ifdef __linux__
|
||||
DRM_OS_SPINLOCK(&DRM(mem_lock));
|
||||
|
|
|
|||
|
|
@ -266,6 +266,7 @@ do { \
|
|||
#define DRM_OS_IOCTL struct inode *inode, struct file *filp, unsigned int cmd, unsigned long data
|
||||
#define DRM_OS_DEVICE drm_file_t *priv = filp->private_data; \
|
||||
drm_device_t *dev = priv->dev
|
||||
#define DRM_OS_PRIV
|
||||
#define DRM_OS_RETURN(v) return -v;
|
||||
#define DRM_OS_CURRENTPID current->pid
|
||||
#define DRM_OS_KRNTOUSR(arg1, arg2, arg3) \
|
||||
|
|
|
|||
109
linux/mga_dma.c
109
linux/mga_dma.c
|
|
@ -38,8 +38,10 @@
|
|||
#include "drmP.h"
|
||||
#include "mga_drv.h"
|
||||
|
||||
#ifdef __linux__
|
||||
#include <linux/interrupt.h> /* For task queue support */
|
||||
#include <linux/delay.h>
|
||||
#endif
|
||||
|
||||
#define MGA_DEFAULT_USEC_TIMEOUT 10000
|
||||
#define MGA_FREELIST_DEBUG 0
|
||||
|
|
@ -61,7 +63,7 @@ int mga_do_wait_for_idle( drm_mga_private_t *dev_priv )
|
|||
MGA_WRITE8( MGA_CRTC_INDEX, 0 );
|
||||
return 0;
|
||||
}
|
||||
udelay( 1 );
|
||||
DRM_OS_DELAY( 1 );
|
||||
}
|
||||
|
||||
#if MGA_DMA_DEBUG
|
||||
|
|
@ -80,7 +82,7 @@ int mga_do_dma_idle( drm_mga_private_t *dev_priv )
|
|||
for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) {
|
||||
status = MGA_READ( MGA_STATUS ) & MGA_DMA_IDLE_MASK;
|
||||
if ( status == MGA_ENDPRDMASTS ) return 0;
|
||||
udelay( 1 );
|
||||
DRM_OS_DELAY( 1 );
|
||||
}
|
||||
|
||||
#if MGA_DMA_DEBUG
|
||||
|
|
@ -121,7 +123,7 @@ int mga_do_engine_reset( drm_mga_private_t *dev_priv )
|
|||
* How about we clean up after ourselves?
|
||||
*/
|
||||
MGA_WRITE( MGA_RST, MGA_SOFTRESET );
|
||||
udelay( 15 ); /* Wait at least 10 usecs */
|
||||
DRM_OS_DELAY( 15 ); /* Wait at least 10 usecs */
|
||||
MGA_WRITE( MGA_RST, 0 );
|
||||
|
||||
/* Initialize the registers that get clobbered by the soft
|
||||
|
|
@ -451,7 +453,12 @@ int mga_freelist_put( drm_device_t *dev, drm_buf_t *buf )
|
|||
static int mga_do_init_dma( drm_device_t *dev, drm_mga_init_t *init )
|
||||
{
|
||||
drm_mga_private_t *dev_priv;
|
||||
#ifdef __linux__
|
||||
struct list_head *list;
|
||||
#endif
|
||||
#if defined( __FreeBSD__ )
|
||||
drm_map_list_entry_t *listentry;
|
||||
#endif
|
||||
int ret;
|
||||
DRM_DEBUG( "%s\n", __FUNCTION__ );
|
||||
|
||||
|
|
@ -488,6 +495,7 @@ static int mga_do_init_dma( drm_device_t *dev, drm_mga_init_t *init )
|
|||
dev_priv->texture_offset = init->texture_offset[0];
|
||||
dev_priv->texture_size = init->texture_size[0];
|
||||
|
||||
#ifdef __linux__
|
||||
list_for_each( list, &dev->maplist->head ) {
|
||||
drm_map_list_t *entry = (drm_map_list_t *)list;
|
||||
if ( entry->map &&
|
||||
|
|
@ -497,6 +505,19 @@ static int mga_do_init_dma( drm_device_t *dev, drm_mga_init_t *init )
|
|||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if defined( __FreeBSD__ )
|
||||
TAILQ_FOREACH(listentry, dev->maplist, link) {
|
||||
drm_map_t *map = listentry->map;
|
||||
if (map->type == _DRM_SHM &&
|
||||
map->flags & _DRM_CONTAINS_LOCK) {
|
||||
dev_priv->sarea = map;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#else
|
||||
#error
|
||||
#endif
|
||||
|
||||
DRM_FIND_MAP( dev_priv->fb, init->fb_offset );
|
||||
DRM_FIND_MAP( dev_priv->mmio, init->mmio_offset );
|
||||
|
|
@ -557,7 +578,8 @@ static int mga_do_init_dma( drm_device_t *dev, drm_mga_init_t *init )
|
|||
|
||||
dev_priv->prim.high_mark = 256 * DMA_BLOCK_SIZE;
|
||||
|
||||
spin_lock_init( &dev_priv->prim.list_lock );
|
||||
/* FIXME: This lock is unused */
|
||||
/* spin_lock_init( &dev_priv->prim.list_lock ); */
|
||||
|
||||
dev_priv->prim.status[0] = dev_priv->primary->offset;
|
||||
dev_priv->prim.status[1] = 0;
|
||||
|
|
@ -598,15 +620,12 @@ int mga_do_cleanup_dma( drm_device_t *dev )
|
|||
return 0;
|
||||
}
|
||||
|
||||
int mga_dma_init( struct inode *inode, struct file *filp,
|
||||
unsigned int cmd, unsigned long arg )
|
||||
int mga_dma_init( DRM_OS_IOCTL )
|
||||
{
|
||||
drm_file_t *priv = filp->private_data;
|
||||
drm_device_t *dev = priv->dev;
|
||||
DRM_OS_DEVICE;
|
||||
drm_mga_init_t init;
|
||||
|
||||
if ( copy_from_user( &init, (drm_mga_init_t *)arg, sizeof(init) ) )
|
||||
return -EFAULT;
|
||||
DRM_OS_KRNFROMUSR( init, (drm_mga_init_t *) data, sizeof(init) );
|
||||
|
||||
switch ( init.func ) {
|
||||
case MGA_INIT_DMA:
|
||||
|
|
@ -615,7 +634,7 @@ int mga_dma_init( struct inode *inode, struct file *filp,
|
|||
return mga_do_cleanup_dma( dev );
|
||||
}
|
||||
|
||||
return -EINVAL;
|
||||
DRM_OS_RETURN( EINVAL );
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -623,18 +642,15 @@ int mga_dma_init( struct inode *inode, struct file *filp,
|
|||
* Primary DMA stream management
|
||||
*/
|
||||
|
||||
int mga_dma_flush( struct inode *inode, struct file *filp,
|
||||
unsigned int cmd, unsigned long arg )
|
||||
int mga_dma_flush( DRM_OS_IOCTL )
|
||||
{
|
||||
drm_file_t *priv = filp->private_data;
|
||||
drm_device_t *dev = priv->dev;
|
||||
DRM_OS_DEVICE;
|
||||
drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private;
|
||||
drm_lock_t lock;
|
||||
|
||||
LOCK_TEST_WITH_RETURN( dev );
|
||||
|
||||
if ( copy_from_user( &lock, (drm_lock_t *)arg, sizeof(lock) ) )
|
||||
return -EFAULT;
|
||||
DRM_OS_KRNFROMUSR( lock, (drm_lock_t *) data, sizeof(lock) );
|
||||
|
||||
DRM_DEBUG( "%s: %s%s%s\n",
|
||||
__FUNCTION__,
|
||||
|
|
@ -662,11 +678,9 @@ int mga_dma_flush( struct inode *inode, struct file *filp,
|
|||
}
|
||||
}
|
||||
|
||||
int mga_dma_reset( struct inode *inode, struct file *filp,
|
||||
unsigned int cmd, unsigned long arg )
|
||||
int mga_dma_reset( DRM_OS_IOCTL )
|
||||
{
|
||||
drm_file_t *priv = filp->private_data;
|
||||
drm_device_t *dev = priv->dev;
|
||||
DRM_OS_DEVICE;
|
||||
drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private;
|
||||
|
||||
LOCK_TEST_WITH_RETURN( dev );
|
||||
|
|
@ -679,6 +693,7 @@ int mga_dma_reset( struct inode *inode, struct file *filp,
|
|||
* DMA buffer management
|
||||
*/
|
||||
|
||||
#if 0
|
||||
static int mga_dma_get_buffers( drm_device_t *dev, drm_dma_t *d )
|
||||
{
|
||||
drm_buf_t *buf;
|
||||
|
|
@ -686,51 +701,52 @@ static int mga_dma_get_buffers( drm_device_t *dev, drm_dma_t *d )
|
|||
|
||||
for ( i = d->granted_count ; i < d->request_count ; i++ ) {
|
||||
buf = mga_freelist_get( dev );
|
||||
if ( !buf ) return -EAGAIN;
|
||||
if ( !buf )
|
||||
DRM_OS_RETURN( EAGAIN );
|
||||
|
||||
buf->pid = current->pid;
|
||||
|
||||
if ( copy_to_user( &d->request_indices[i],
|
||||
if ( DRM_OS_COPYTOUSR( &d->request_indices[i],
|
||||
&buf->idx, sizeof(buf->idx) ) )
|
||||
return -EFAULT;
|
||||
if ( copy_to_user( &d->request_sizes[i],
|
||||
DRM_OS_RETURN( EFAULT );
|
||||
if ( DRM_OS_COPYTOUSR( &d->request_sizes[i],
|
||||
&buf->total, sizeof(buf->total) ) )
|
||||
return -EFAULT;
|
||||
DRM_OS_RETURN( EFAULT );
|
||||
|
||||
d->granted_count++;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif /* 0 */
|
||||
|
||||
int mga_dma_buffers( struct inode *inode, struct file *filp,
|
||||
unsigned int cmd, unsigned long arg )
|
||||
int mga_dma_buffers( DRM_OS_IOCTL )
|
||||
{
|
||||
drm_file_t *priv = filp->private_data;
|
||||
drm_device_t *dev = priv->dev;
|
||||
DRM_OS_DEVICE;
|
||||
drm_device_dma_t *dma = dev->dma;
|
||||
drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private;
|
||||
drm_dma_t d;
|
||||
drm_buf_t *buf;
|
||||
int i;
|
||||
int ret = 0;
|
||||
|
||||
LOCK_TEST_WITH_RETURN( dev );
|
||||
|
||||
if ( copy_from_user( &d, (drm_dma_t *)arg, sizeof(d) ) )
|
||||
return -EFAULT;
|
||||
DRM_OS_KRNFROMUSR( d, (drm_dma_t *) data, sizeof(d) );
|
||||
|
||||
/* Please don't send us buffers.
|
||||
*/
|
||||
if ( d.send_count != 0 ) {
|
||||
DRM_ERROR( "Process %d trying to send %d buffers via drmDMA\n",
|
||||
current->pid, d.send_count );
|
||||
return -EINVAL;
|
||||
DRM_OS_CURRENTPID, d.send_count );
|
||||
DRM_OS_RETURN( EINVAL );
|
||||
}
|
||||
|
||||
/* We'll send you buffers.
|
||||
*/
|
||||
if ( d.request_count < 0 || d.request_count > dma->buf_count ) {
|
||||
DRM_ERROR( "Process %d trying to get %d buffers (of %d max)\n",
|
||||
current->pid, d.request_count, dma->buf_count );
|
||||
return -EINVAL;
|
||||
DRM_OS_CURRENTPID, d.request_count, dma->buf_count );
|
||||
DRM_OS_RETURN( EINVAL );
|
||||
}
|
||||
|
||||
WRAP_TEST_WITH_RETURN( dev_priv );
|
||||
|
|
@ -738,11 +754,26 @@ int mga_dma_buffers( struct inode *inode, struct file *filp,
|
|||
d.granted_count = 0;
|
||||
|
||||
if ( d.request_count ) {
|
||||
ret = mga_dma_get_buffers( dev, &d );
|
||||
for ( i = d.granted_count ; i < d.request_count ; i++ ) {
|
||||
buf = mga_freelist_get( dev );
|
||||
if ( !buf )
|
||||
DRM_OS_RETURN( EAGAIN );
|
||||
|
||||
buf->pid = DRM_OS_CURRENTPID;
|
||||
|
||||
if ( DRM_OS_COPYTOUSR( &d.request_indices[i],
|
||||
&buf->idx, sizeof(buf->idx) ) )
|
||||
DRM_OS_RETURN( EFAULT );
|
||||
if ( DRM_OS_COPYTOUSR( &d.request_sizes[i],
|
||||
&buf->total, sizeof(buf->total) ) )
|
||||
DRM_OS_RETURN( EFAULT );
|
||||
|
||||
d.granted_count++;
|
||||
}
|
||||
ret = 0;
|
||||
}
|
||||
|
||||
if ( copy_to_user( (drm_dma_t *)arg, &d, sizeof(d) ) )
|
||||
return -EFAULT;
|
||||
DRM_OS_KRNTOUSR( data, &d, sizeof(d) );
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,16 @@
|
|||
* Gareth Hughes <gareth@valinux.com>
|
||||
*/
|
||||
|
||||
#ifdef __linux__
|
||||
#include <linux/config.h>
|
||||
#endif
|
||||
#ifdef __FreeBSD__
|
||||
#include <sys/types.h>
|
||||
#include <sys/bus.h>
|
||||
#include <pci/pcivar.h>
|
||||
#include <opt_drm_linux.h>
|
||||
#endif
|
||||
|
||||
#include "mga.h"
|
||||
#include "drmP.h"
|
||||
#include "mga_drv.h"
|
||||
|
|
@ -44,6 +53,30 @@
|
|||
#define DRIVER_MINOR 0
|
||||
#define DRIVER_PATCHLEVEL 2
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
static int mga_probe(device_t dev)
|
||||
{
|
||||
const char *s = 0;
|
||||
|
||||
switch (pci_get_devid(dev)) {
|
||||
case 0x0525102b:
|
||||
s = "Matrox MGA G400 AGP graphics accelerator";
|
||||
break;
|
||||
|
||||
case 0x0521102b:
|
||||
s = "Matrox MGA G200 AGP graphics accelerator";
|
||||
break;
|
||||
}
|
||||
|
||||
if (s) {
|
||||
device_set_desc(dev, s);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return ENXIO;
|
||||
}
|
||||
#endif
|
||||
|
||||
#define DRIVER_IOCTLS \
|
||||
[DRM_IOCTL_NR(DRM_IOCTL_DMA)] = { mga_dma_buffers, 1, 0 }, \
|
||||
[DRM_IOCTL_NR(DRM_IOCTL_MGA_INIT)] = { mga_dma_init, 1, 1 }, \
|
||||
|
|
@ -75,6 +108,15 @@
|
|||
#include "drm_ioctl.h"
|
||||
#include "drm_lock.h"
|
||||
#include "drm_memory.h"
|
||||
#ifdef __linux__
|
||||
#include "drm_proc.h"
|
||||
#include "drm_vm.h"
|
||||
#include "drm_stub.h"
|
||||
#endif
|
||||
#ifdef __FreeBSD__
|
||||
#include "drm_sysctl.h"
|
||||
#endif
|
||||
#include "drm_vm.h"
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
DRIVER_MODULE(mga, pci, mga_driver, mga_devclass, 0, 0);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -31,6 +31,12 @@
|
|||
#ifndef __MGA_DRV_H__
|
||||
#define __MGA_DRV_H__
|
||||
|
||||
#ifndef u8
|
||||
#define u8 u_int8_t
|
||||
#define u16 u_int16_t
|
||||
#define u32 u_int32_t
|
||||
#endif
|
||||
|
||||
typedef struct drm_mga_primary_buffer {
|
||||
u8 *start;
|
||||
u8 *end;
|
||||
|
|
@ -103,14 +109,10 @@ typedef struct drm_mga_private {
|
|||
} drm_mga_private_t;
|
||||
|
||||
/* mga_dma.c */
|
||||
extern int mga_dma_init( struct inode *inode, struct file *filp,
|
||||
unsigned int cmd, unsigned long arg );
|
||||
extern int mga_dma_flush( struct inode *inode, struct file *filp,
|
||||
unsigned int cmd, unsigned long arg );
|
||||
extern int mga_dma_reset( struct inode *inode, struct file *filp,
|
||||
unsigned int cmd, unsigned long arg );
|
||||
extern int mga_dma_buffers( struct inode *inode, struct file *filp,
|
||||
unsigned int cmd, unsigned long arg );
|
||||
extern int mga_dma_init( DRM_OS_IOCTL );
|
||||
extern int mga_dma_flush( DRM_OS_IOCTL );
|
||||
extern int mga_dma_reset( DRM_OS_IOCTL );
|
||||
extern int mga_dma_buffers( DRM_OS_IOCTL );
|
||||
|
||||
extern int mga_do_wait_for_idle( drm_mga_private_t *dev_priv );
|
||||
extern int mga_do_dma_idle( drm_mga_private_t *dev_priv );
|
||||
|
|
@ -125,24 +127,30 @@ extern void mga_do_dma_wrap_end( drm_mga_private_t *dev_priv );
|
|||
extern int mga_freelist_put( drm_device_t *dev, drm_buf_t *buf );
|
||||
|
||||
/* mga_state.c */
|
||||
extern int mga_dma_clear( struct inode *inode, struct file *filp,
|
||||
unsigned int cmd, unsigned long arg );
|
||||
extern int mga_dma_swap( struct inode *inode, struct file *filp,
|
||||
unsigned int cmd, unsigned long arg );
|
||||
extern int mga_dma_vertex( struct inode *inode, struct file *filp,
|
||||
unsigned int cmd, unsigned long arg );
|
||||
extern int mga_dma_indices( struct inode *inode, struct file *filp,
|
||||
unsigned int cmd, unsigned long arg );
|
||||
extern int mga_dma_iload( struct inode *inode, struct file *filp,
|
||||
unsigned int cmd, unsigned long arg );
|
||||
extern int mga_dma_blit( struct inode *inode, struct file *filp,
|
||||
unsigned int cmd, unsigned long arg );
|
||||
extern int mga_dma_clear( DRM_OS_IOCTL );
|
||||
extern int mga_dma_swap( DRM_OS_IOCTL );
|
||||
extern int mga_dma_vertex( DRM_OS_IOCTL );
|
||||
extern int mga_dma_indices( DRM_OS_IOCTL );
|
||||
extern int mga_dma_iload( DRM_OS_IOCTL );
|
||||
extern int mga_dma_blit( DRM_OS_IOCTL );
|
||||
|
||||
/* mga_warp.c */
|
||||
extern int mga_warp_install_microcode( drm_device_t *dev );
|
||||
extern int mga_warp_init( drm_device_t *dev );
|
||||
|
||||
#ifdef __linux__
|
||||
#define mga_flush_write_combine() mb()
|
||||
#endif
|
||||
#if defined( __FreeBSD__ )
|
||||
#define mga_flush_write_combine() \
|
||||
int xchangeDummy; \
|
||||
DRM_DEBUG("%s\n", __FUNCTION__); \
|
||||
__asm__ volatile(" push %%eax ; xchg %%eax, %0 ; pop %%eax" : : "m" (xchangeDummy)); \
|
||||
__asm__ volatile(" push %%eax ; push %%ebx ; push %%ecx ; push %%edx ;" \
|
||||
" movl $0,%%eax ; cpuid ; pop %%edx ; pop %%ecx ; pop %%ebx ;" \
|
||||
" pop %%eax" : /* no outputs */ : /* no inputs */ ); \
|
||||
} while (0);
|
||||
#endif
|
||||
|
||||
|
||||
#define MGA_BASE( reg ) ((u32)(dev_priv->mmio->handle))
|
||||
|
|
@ -181,15 +189,28 @@ do { \
|
|||
} \
|
||||
} while (0)
|
||||
|
||||
#ifdef __linux__
|
||||
#define LOCK_TEST_WITH_RETURN( dev ) \
|
||||
do { \
|
||||
if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || \
|
||||
dev->lock.pid != current->pid ) { \
|
||||
DRM_ERROR( "%s called without lock held\n", \
|
||||
DRM_ERROR( "%s called without lock held\n", \
|
||||
__FUNCTION__ ); \
|
||||
return -EINVAL; \
|
||||
DRM_OS_RETURN( EINVAL ); \
|
||||
} \
|
||||
} while (0)
|
||||
#endif
|
||||
#ifdef __FreeBSD__
|
||||
#define LOCK_TEST_WITH_RETURN( dev ) \
|
||||
do { \
|
||||
if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || \
|
||||
dev->lock.pid != p->p_pid ) { \
|
||||
DRM_ERROR( "%s called without lock held\n", \
|
||||
__FUNCTION__ ); \
|
||||
DRM_OS_RETURN( EINVAL ); \
|
||||
} \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
#define WRAP_TEST_WITH_RETURN( dev_priv ) \
|
||||
do { \
|
||||
|
|
@ -200,7 +221,7 @@ do { \
|
|||
dev_priv->prim.high_mark ) { \
|
||||
if ( MGA_DMA_DEBUG ) \
|
||||
DRM_INFO( __FUNCTION__": wrap...\n" ); \
|
||||
return -EBUSY; \
|
||||
DRM_OS_RETURN( EBUSY); \
|
||||
} \
|
||||
} \
|
||||
} while (0)
|
||||
|
|
@ -211,7 +232,7 @@ do { \
|
|||
if ( mga_do_wait_for_idle( dev_priv ) < 0 ) { \
|
||||
if ( MGA_DMA_DEBUG ) \
|
||||
DRM_INFO( __FUNCTION__": wrap...\n" ); \
|
||||
return -EBUSY; \
|
||||
DRM_OS_RETURN( EBUSY); \
|
||||
} \
|
||||
mga_do_dma_wrap_end( dev_priv ); \
|
||||
} \
|
||||
|
|
|
|||
|
|
@ -412,7 +412,7 @@ static int mga_verify_context( drm_mga_private_t *dev_priv )
|
|||
ctx->dstorg, dev_priv->front_offset,
|
||||
dev_priv->back_offset );
|
||||
ctx->dstorg = 0;
|
||||
return -EINVAL;
|
||||
DRM_OS_RETURN( EINVAL );
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
@ -432,7 +432,7 @@ static int mga_verify_tex( drm_mga_private_t *dev_priv, int unit )
|
|||
DRM_ERROR( "*** bad TEXORG: 0x%x, unit %d\n",
|
||||
tex->texorg, unit );
|
||||
tex->texorg = 0;
|
||||
return -EINVAL;
|
||||
DRM_OS_RETURN( EINVAL );
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
@ -474,13 +474,13 @@ static int mga_verify_iload( drm_mga_private_t *dev_priv,
|
|||
dstorg + length > (dev_priv->texture_offset +
|
||||
dev_priv->texture_size) ) {
|
||||
DRM_ERROR( "*** bad iload DSTORG: 0x%x\n", dstorg );
|
||||
return -EINVAL;
|
||||
DRM_OS_RETURN( EINVAL );
|
||||
}
|
||||
|
||||
if ( length & MGA_ILOAD_MASK ) {
|
||||
DRM_ERROR( "*** bad iload length: 0x%x\n",
|
||||
length & MGA_ILOAD_MASK );
|
||||
return -EINVAL;
|
||||
DRM_OS_RETURN( EINVAL );
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
@ -493,7 +493,7 @@ static int mga_verify_blit( drm_mga_private_t *dev_priv,
|
|||
(dstorg & 0x3) == (MGA_SRCACC_PCI | MGA_SRCMAP_SYSMEM) ) {
|
||||
DRM_ERROR( "*** bad blit: src=0x%x dst=0x%x\n",
|
||||
srcorg, dstorg );
|
||||
return -EINVAL;
|
||||
DRM_OS_RETURN( EINVAL );
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -873,19 +873,16 @@ static void mga_dma_dispatch_blit( drm_device_t *dev,
|
|||
*
|
||||
*/
|
||||
|
||||
int mga_dma_clear( struct inode *inode, struct file *filp,
|
||||
unsigned int cmd, unsigned long arg )
|
||||
int mga_dma_clear( DRM_OS_IOCTL )
|
||||
{
|
||||
drm_file_t *priv = filp->private_data;
|
||||
drm_device_t *dev = priv->dev;
|
||||
DRM_OS_DEVICE;
|
||||
drm_mga_private_t *dev_priv = dev->dev_private;
|
||||
drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
|
||||
drm_mga_clear_t clear;
|
||||
|
||||
LOCK_TEST_WITH_RETURN( dev );
|
||||
|
||||
if ( copy_from_user( &clear, (drm_mga_clear_t *) arg, sizeof(clear) ) )
|
||||
return -EFAULT;
|
||||
DRM_OS_KRNFROMUSR( clear, (drm_mga_clear_t *) data, sizeof(clear) );
|
||||
|
||||
if ( sarea_priv->nbox > MGA_NR_SAREA_CLIPRECTS )
|
||||
sarea_priv->nbox = MGA_NR_SAREA_CLIPRECTS;
|
||||
|
|
@ -901,11 +898,9 @@ int mga_dma_clear( struct inode *inode, struct file *filp,
|
|||
return 0;
|
||||
}
|
||||
|
||||
int mga_dma_swap( struct inode *inode, struct file *filp,
|
||||
unsigned int cmd, unsigned long arg )
|
||||
int mga_dma_swap( DRM_OS_IOCTL )
|
||||
{
|
||||
drm_file_t *priv = filp->private_data;
|
||||
drm_device_t *dev = priv->dev;
|
||||
DRM_OS_DEVICE;
|
||||
drm_mga_private_t *dev_priv = dev->dev_private;
|
||||
drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
|
||||
|
||||
|
|
@ -925,11 +920,9 @@ int mga_dma_swap( struct inode *inode, struct file *filp,
|
|||
return 0;
|
||||
}
|
||||
|
||||
int mga_dma_vertex( struct inode *inode, struct file *filp,
|
||||
unsigned int cmd, unsigned long arg )
|
||||
int mga_dma_vertex( DRM_OS_IOCTL )
|
||||
{
|
||||
drm_file_t *priv = filp->private_data;
|
||||
drm_device_t *dev = priv->dev;
|
||||
DRM_OS_DEVICE;
|
||||
drm_mga_private_t *dev_priv = dev->dev_private;
|
||||
drm_device_dma_t *dma = dev->dma;
|
||||
drm_buf_t *buf;
|
||||
|
|
@ -938,10 +931,7 @@ int mga_dma_vertex( struct inode *inode, struct file *filp,
|
|||
|
||||
LOCK_TEST_WITH_RETURN( dev );
|
||||
|
||||
if ( copy_from_user( &vertex,
|
||||
(drm_mga_vertex_t *)arg,
|
||||
sizeof(vertex) ) )
|
||||
return -EFAULT;
|
||||
DRM_OS_KRNFROMUSR( vertex, (drm_mga_vertex_t *) data, sizeof(vertex) );
|
||||
|
||||
buf = dma->buflist[vertex.idx];
|
||||
buf_priv = buf->dev_private;
|
||||
|
|
@ -956,7 +946,7 @@ int mga_dma_vertex( struct inode *inode, struct file *filp,
|
|||
buf_priv->dispatched = 0;
|
||||
mga_freelist_put( dev, buf );
|
||||
}
|
||||
return -EINVAL;
|
||||
DRM_OS_RETURN( EINVAL );
|
||||
}
|
||||
|
||||
WRAP_TEST_WITH_RETURN( dev_priv );
|
||||
|
|
@ -966,11 +956,9 @@ int mga_dma_vertex( struct inode *inode, struct file *filp,
|
|||
return 0;
|
||||
}
|
||||
|
||||
int mga_dma_indices( struct inode *inode, struct file *filp,
|
||||
unsigned int cmd, unsigned long arg )
|
||||
int mga_dma_indices( DRM_OS_IOCTL )
|
||||
{
|
||||
drm_file_t *priv = filp->private_data;
|
||||
drm_device_t *dev = priv->dev;
|
||||
DRM_OS_DEVICE;
|
||||
drm_mga_private_t *dev_priv = dev->dev_private;
|
||||
drm_device_dma_t *dma = dev->dma;
|
||||
drm_buf_t *buf;
|
||||
|
|
@ -979,10 +967,7 @@ int mga_dma_indices( struct inode *inode, struct file *filp,
|
|||
|
||||
LOCK_TEST_WITH_RETURN( dev );
|
||||
|
||||
if ( copy_from_user( &indices,
|
||||
(drm_mga_indices_t *)arg,
|
||||
sizeof(indices) ) )
|
||||
return -EFAULT;
|
||||
DRM_OS_KRNFROMUSR( indices, (drm_mga_indices_t *) data, sizeof(indices) );
|
||||
|
||||
buf = dma->buflist[indices.idx];
|
||||
buf_priv = buf->dev_private;
|
||||
|
|
@ -996,7 +981,7 @@ int mga_dma_indices( struct inode *inode, struct file *filp,
|
|||
buf_priv->dispatched = 0;
|
||||
mga_freelist_put( dev, buf );
|
||||
}
|
||||
return -EINVAL;
|
||||
DRM_OS_RETURN( EINVAL );
|
||||
}
|
||||
|
||||
WRAP_TEST_WITH_RETURN( dev_priv );
|
||||
|
|
@ -1006,11 +991,9 @@ int mga_dma_indices( struct inode *inode, struct file *filp,
|
|||
return 0;
|
||||
}
|
||||
|
||||
int mga_dma_iload( struct inode *inode, struct file *filp,
|
||||
unsigned int cmd, unsigned long arg )
|
||||
int mga_dma_iload( DRM_OS_IOCTL )
|
||||
{
|
||||
drm_file_t *priv = filp->private_data;
|
||||
drm_device_t *dev = priv->dev;
|
||||
DRM_OS_DEVICE;
|
||||
drm_device_dma_t *dma = dev->dma;
|
||||
drm_mga_private_t *dev_priv = dev->dev_private;
|
||||
drm_buf_t *buf;
|
||||
|
|
@ -1020,14 +1003,13 @@ int mga_dma_iload( struct inode *inode, struct file *filp,
|
|||
|
||||
LOCK_TEST_WITH_RETURN( dev );
|
||||
|
||||
if ( copy_from_user( &iload, (drm_mga_iload_t *)arg, sizeof(iload) ) )
|
||||
return -EFAULT;
|
||||
DRM_OS_KRNFROMUSR( iload, (drm_mga_iload_t *) data, sizeof(iload) );
|
||||
|
||||
#if 0
|
||||
if ( mga_do_wait_for_idle( dev_priv ) < 0 ) {
|
||||
if ( MGA_DMA_DEBUG )
|
||||
DRM_INFO( __FUNCTION__": -EBUSY\n" );
|
||||
return -EBUSY;
|
||||
DRM_OS_RETURN( EBUSY );
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -1036,7 +1018,7 @@ int mga_dma_iload( struct inode *inode, struct file *filp,
|
|||
|
||||
if ( mga_verify_iload( dev_priv, iload.dstorg, iload.length ) ) {
|
||||
mga_freelist_put( dev, buf );
|
||||
return -EINVAL;
|
||||
DRM_OS_RETURN( EINVAL );
|
||||
}
|
||||
|
||||
WRAP_TEST_WITH_RETURN( dev_priv );
|
||||
|
|
@ -1050,11 +1032,9 @@ int mga_dma_iload( struct inode *inode, struct file *filp,
|
|||
return 0;
|
||||
}
|
||||
|
||||
int mga_dma_blit( struct inode *inode, struct file *filp,
|
||||
unsigned int cmd, unsigned long arg )
|
||||
int mga_dma_blit( DRM_OS_IOCTL )
|
||||
{
|
||||
drm_file_t *priv = filp->private_data;
|
||||
drm_device_t *dev = priv->dev;
|
||||
DRM_OS_DEVICE;
|
||||
drm_mga_private_t *dev_priv = dev->dev_private;
|
||||
drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
|
||||
drm_mga_blit_t blit;
|
||||
|
|
@ -1062,14 +1042,13 @@ int mga_dma_blit( struct inode *inode, struct file *filp,
|
|||
|
||||
LOCK_TEST_WITH_RETURN( dev );
|
||||
|
||||
if ( copy_from_user( &blit, (drm_mga_blit_t *)arg, sizeof(blit) ) )
|
||||
return -EFAULT;
|
||||
DRM_OS_KRNFROMUSR( blit, (drm_mga_blit_t *) data, sizeof(blit) );
|
||||
|
||||
if ( sarea_priv->nbox > MGA_NR_SAREA_CLIPRECTS )
|
||||
sarea_priv->nbox = MGA_NR_SAREA_CLIPRECTS;
|
||||
|
||||
if ( mga_verify_blit( dev_priv, blit.srcorg, blit.dstorg ) )
|
||||
return -EINVAL;
|
||||
DRM_OS_RETURN( EINVAL );
|
||||
|
||||
WRAP_TEST_WITH_RETURN( dev_priv );
|
||||
|
||||
|
|
|
|||
48
linux/sis.h
Normal file
48
linux/sis.h
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
/* sis_drv.h -- Private header for sis driver -*- linux-c -*-
|
||||
*
|
||||
* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
/* $XFree86$ */
|
||||
|
||||
#ifndef __SIS_H__
|
||||
#define __SIS_H__
|
||||
|
||||
/* This remains constant for all DRM template files.
|
||||
*/
|
||||
#define DRM(x) sis_##x
|
||||
|
||||
/* General customization:
|
||||
*/
|
||||
#define __HAVE_AGP 1
|
||||
#define __MUST_HAVE_AGP 1
|
||||
#define __HAVE_MTRR 1
|
||||
#define __HAVE_CTX_BITMAP 1
|
||||
|
||||
/* Buffer customization:
|
||||
*/
|
||||
#define DRIVER_AGP_BUFFERS_MAP( dev ) \
|
||||
((drm_sis_private_t *)((dev)->dev_private))->buffers
|
||||
|
||||
#endif
|
||||
|
|
@ -38,7 +38,7 @@
|
|||
#include <sys/types.h>
|
||||
#include <sys/bus.h>
|
||||
#include <pci/pcivar.h>
|
||||
/* #include <opt_drm_linux.h> */
|
||||
#include <opt_drm_linux.h>
|
||||
#endif
|
||||
|
||||
#include "tdfx.h"
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@
|
|||
#define DRM_NAME "drm" /* Name in kernel, /dev, and /proc */
|
||||
#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_RAM_PERCENT 10 /* How much system ram can we lock? */
|
||||
#define DRM_RAM_PERCENT 50 /* How much system ram can we lock? */
|
||||
|
||||
#define _DRM_LOCK_HELD 0x80000000 /* Hardware lock is held */
|
||||
#define _DRM_LOCK_CONT 0x40000000 /* Hardware lock is contended */
|
||||
|
|
@ -86,9 +86,7 @@ typedef struct drm_tex_region {
|
|||
#include "i810_drm.h"
|
||||
#include "r128_drm.h"
|
||||
#include "radeon_drm.h"
|
||||
#ifdef CONFIG_DRM_SIS
|
||||
#include "sis_drm.h"
|
||||
#endif
|
||||
|
||||
typedef struct drm_version {
|
||||
int version_major; /* Major version */
|
||||
|
|
@ -465,7 +463,6 @@ typedef struct drm_scatter_gather {
|
|||
#define DRM_IOCTL_RADEON_STIPPLE DRM_IOW( 0x4c, drm_radeon_stipple_t)
|
||||
#define DRM_IOCTL_RADEON_INDIRECT DRM_IOWR(0x4d, drm_radeon_indirect_t)
|
||||
|
||||
#ifdef CONFIG_DRM_SIS
|
||||
/* SiS specific ioctls */
|
||||
#define SIS_IOCTL_FB_ALLOC DRM_IOWR(0x44, drm_sis_mem_t)
|
||||
#define SIS_IOCTL_FB_FREE DRM_IOW( 0x45, drm_sis_mem_t)
|
||||
|
|
@ -475,6 +472,5 @@ typedef struct drm_scatter_gather {
|
|||
#define SIS_IOCTL_FLIP DRM_IOW( 0x48, drm_sis_flip_t)
|
||||
#define SIS_IOCTL_FLIP_INIT DRM_IO( 0x49)
|
||||
#define SIS_IOCTL_FLIP_FINAL DRM_IO( 0x50)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@
|
|||
#define DRM_NAME "drm" /* Name in kernel, /dev, and /proc */
|
||||
#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_RAM_PERCENT 10 /* How much system ram can we lock? */
|
||||
#define DRM_RAM_PERCENT 50 /* How much system ram can we lock? */
|
||||
|
||||
#define _DRM_LOCK_HELD 0x80000000 /* Hardware lock is held */
|
||||
#define _DRM_LOCK_CONT 0x40000000 /* Hardware lock is contended */
|
||||
|
|
@ -86,9 +86,7 @@ typedef struct drm_tex_region {
|
|||
#include "i810_drm.h"
|
||||
#include "r128_drm.h"
|
||||
#include "radeon_drm.h"
|
||||
#ifdef CONFIG_DRM_SIS
|
||||
#include "sis_drm.h"
|
||||
#endif
|
||||
|
||||
typedef struct drm_version {
|
||||
int version_major; /* Major version */
|
||||
|
|
@ -465,7 +463,6 @@ typedef struct drm_scatter_gather {
|
|||
#define DRM_IOCTL_RADEON_STIPPLE DRM_IOW( 0x4c, drm_radeon_stipple_t)
|
||||
#define DRM_IOCTL_RADEON_INDIRECT DRM_IOWR(0x4d, drm_radeon_indirect_t)
|
||||
|
||||
#ifdef CONFIG_DRM_SIS
|
||||
/* SiS specific ioctls */
|
||||
#define SIS_IOCTL_FB_ALLOC DRM_IOWR(0x44, drm_sis_mem_t)
|
||||
#define SIS_IOCTL_FB_FREE DRM_IOW( 0x45, drm_sis_mem_t)
|
||||
|
|
@ -475,6 +472,5 @@ typedef struct drm_scatter_gather {
|
|||
#define SIS_IOCTL_FLIP DRM_IOW( 0x48, drm_sis_flip_t)
|
||||
#define SIS_IOCTL_FLIP_INIT DRM_IO( 0x49)
|
||||
#define SIS_IOCTL_FLIP_FINAL DRM_IO( 0x50)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue