2002-01-27 13:05:42 -07:00
|
|
|
/* drmP.h -- Private header for Direct Rendering Manager -*- linux-c -*-
|
2000-05-30 11:13:31 -06:00
|
|
|
* Created: Mon Jan 4 10:05:05 1999 by faith@precisioninsight.com
|
2005-04-15 21:02:52 -06:00
|
|
|
*/
|
|
|
|
/*-
|
2000-05-30 11:13:31 -06:00
|
|
|
* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
|
2002-01-27 13:05:42 -07:00
|
|
|
* Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
|
2000-05-30 11:13:31 -06:00
|
|
|
* 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:
|
2002-01-27 13:05:42 -07:00
|
|
|
*
|
2000-05-30 11:13:31 -06:00
|
|
|
* The above copyright notice and this permission notice (including the next
|
|
|
|
* paragraph) shall be included in all copies or substantial portions of the
|
|
|
|
* Software.
|
2002-01-27 13:05:42 -07:00
|
|
|
*
|
2000-05-30 11:13:31 -06:00
|
|
|
* 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
|
2002-01-27 13:05:42 -07:00
|
|
|
* VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
2000-05-30 11:13:31 -06:00
|
|
|
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
2002-01-27 13:05:42 -07:00
|
|
|
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
|
|
* OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
*
|
|
|
|
* Authors:
|
|
|
|
* Rickard E. (Rik) Faith <faith@valinux.com>
|
|
|
|
* Gareth Hughes <gareth@valinux.com>
|
2003-08-18 18:41:00 -06:00
|
|
|
*
|
2000-05-30 11:13:31 -06:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _DRM_P_H_
|
|
|
|
#define _DRM_P_H_
|
|
|
|
|
2002-01-27 13:05:42 -07:00
|
|
|
#if defined(_KERNEL) || defined(__KERNEL__)
|
2000-06-13 11:38:09 -06:00
|
|
|
|
2002-01-27 13:05:42 -07:00
|
|
|
typedef struct drm_device drm_device_t;
|
|
|
|
typedef struct drm_file drm_file_t;
|
2001-04-09 15:56:31 -06:00
|
|
|
|
2004-11-06 04:16:26 -07:00
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/queue.h>
|
|
|
|
#include <sys/malloc.h>
|
|
|
|
#include <sys/kernel.h>
|
|
|
|
#include <sys/module.h>
|
|
|
|
#include <sys/systm.h>
|
|
|
|
#include <sys/conf.h>
|
|
|
|
#include <sys/stat.h>
|
2007-05-15 14:35:33 -06:00
|
|
|
#if __FreeBSD_version >= 700000
|
|
|
|
#include <sys/priv.h>
|
|
|
|
#endif
|
2004-11-06 04:16:26 -07:00
|
|
|
#include <sys/proc.h>
|
|
|
|
#include <sys/lock.h>
|
|
|
|
#include <sys/fcntl.h>
|
|
|
|
#include <sys/uio.h>
|
|
|
|
#include <sys/filio.h>
|
|
|
|
#include <sys/sysctl.h>
|
|
|
|
#include <sys/bus.h>
|
|
|
|
#include <sys/signalvar.h>
|
|
|
|
#include <sys/poll.h>
|
2007-07-18 15:22:40 -06:00
|
|
|
#include <sys/tree.h>
|
|
|
|
#include <sys/taskqueue.h>
|
2004-11-06 04:16:26 -07:00
|
|
|
#include <vm/vm.h>
|
|
|
|
#include <vm/pmap.h>
|
|
|
|
#include <vm/vm_extern.h>
|
|
|
|
#include <vm/vm_map.h>
|
|
|
|
#include <vm/vm_param.h>
|
|
|
|
#include <machine/param.h>
|
|
|
|
#include <machine/pmap.h>
|
|
|
|
#include <machine/bus.h>
|
|
|
|
#include <machine/resource.h>
|
|
|
|
#include <machine/sysarch.h>
|
|
|
|
#include <sys/endian.h>
|
|
|
|
#include <sys/mman.h>
|
|
|
|
#if defined(__FreeBSD__)
|
|
|
|
#include <sys/rman.h>
|
|
|
|
#include <sys/memrange.h>
|
|
|
|
#include <pci/agpvar.h>
|
|
|
|
#include <sys/agpio.h>
|
|
|
|
#if __FreeBSD_version >= 500000
|
|
|
|
#include <sys/mutex.h>
|
|
|
|
#include <dev/pci/pcivar.h>
|
|
|
|
#include <sys/selinfo.h>
|
|
|
|
#else /* __FreeBSD_version >= 500000 */
|
|
|
|
#include <pci/pcivar.h>
|
|
|
|
#include <sys/select.h>
|
|
|
|
#endif /* __FreeBSD_version < 500000 */
|
|
|
|
#elif defined(__NetBSD__)
|
|
|
|
#include <machine/mtrr.h>
|
|
|
|
#include <sys/vnode.h>
|
|
|
|
#include <sys/select.h>
|
|
|
|
#include <sys/device.h>
|
|
|
|
#include <sys/resourcevar.h>
|
|
|
|
#include <sys/lkm.h>
|
|
|
|
#include <sys/agpio.h>
|
|
|
|
#include <sys/ttycom.h>
|
|
|
|
#include <uvm/uvm.h>
|
|
|
|
#include <dev/pci/pcireg.h>
|
|
|
|
#include <dev/pci/pcivar.h>
|
|
|
|
#include <dev/pci/agpvar.h>
|
|
|
|
#elif defined(__OpenBSD__)
|
|
|
|
#include <sys/lkm.h>
|
|
|
|
#include <uvm/uvm.h>
|
2002-07-05 02:31:11 -06:00
|
|
|
#endif
|
2004-11-06 04:16:26 -07:00
|
|
|
#include <sys/bus.h>
|
2000-06-13 11:38:09 -06:00
|
|
|
|
2002-01-27 13:05:42 -07:00
|
|
|
#include "drm.h"
|
2004-11-06 04:16:26 -07:00
|
|
|
#include "drm_linux_list.h"
|
|
|
|
#include "drm_atomic.h"
|
2007-11-14 12:28:34 -07:00
|
|
|
#include "drm_internal.h"
|
2004-11-06 04:16:26 -07:00
|
|
|
|
|
|
|
#ifdef __FreeBSD__
|
|
|
|
#include <opt_drm.h>
|
|
|
|
#ifdef DRM_DEBUG
|
|
|
|
#undef DRM_DEBUG
|
|
|
|
#define DRM_DEBUG_DEFAULT_ON 1
|
|
|
|
#endif /* DRM_DEBUG */
|
|
|
|
#endif
|
2000-05-30 11:13:31 -06:00
|
|
|
|
2004-11-06 04:16:26 -07:00
|
|
|
#if defined(DRM_LINUX) && DRM_LINUX && !defined(__amd64__)
|
|
|
|
#include <sys/file.h>
|
|
|
|
#include <sys/proc.h>
|
|
|
|
#include <machine/../linux/linux.h>
|
|
|
|
#include <machine/../linux/linux_proto.h>
|
|
|
|
#else
|
|
|
|
/* Either it was defined when it shouldn't be (FreeBSD amd64) or it isn't
|
|
|
|
* supported on this OS yet.
|
|
|
|
*/
|
|
|
|
#undef DRM_LINUX
|
|
|
|
#define DRM_LINUX 0
|
|
|
|
#endif
|
2000-05-30 11:13:31 -06:00
|
|
|
|
|
|
|
#define DRM_HASH_SIZE 16 /* Size of key hash table */
|
|
|
|
#define DRM_KERNEL_CONTEXT 0 /* Change drm_resctx if changed */
|
|
|
|
#define DRM_RESERVED_CONTEXTS 1 /* Change drm_resctx if changed */
|
|
|
|
|
2002-01-27 13:05:42 -07:00
|
|
|
#define DRM_MEM_DMA 0
|
|
|
|
#define DRM_MEM_SAREA 1
|
|
|
|
#define DRM_MEM_DRIVER 2
|
|
|
|
#define DRM_MEM_MAGIC 3
|
|
|
|
#define DRM_MEM_IOCTLS 4
|
|
|
|
#define DRM_MEM_MAPS 5
|
2003-03-29 11:22:28 -07:00
|
|
|
#define DRM_MEM_BUFS 6
|
|
|
|
#define DRM_MEM_SEGS 7
|
|
|
|
#define DRM_MEM_PAGES 8
|
|
|
|
#define DRM_MEM_FILES 9
|
|
|
|
#define DRM_MEM_QUEUES 10
|
|
|
|
#define DRM_MEM_CMDS 11
|
|
|
|
#define DRM_MEM_MAPPINGS 12
|
|
|
|
#define DRM_MEM_BUFLISTS 13
|
|
|
|
#define DRM_MEM_AGPLISTS 14
|
|
|
|
#define DRM_MEM_TOTALAGP 15
|
|
|
|
#define DRM_MEM_BOUNDAGP 16
|
|
|
|
#define DRM_MEM_CTXBITMAP 17
|
|
|
|
#define DRM_MEM_STUB 18
|
|
|
|
#define DRM_MEM_SGLISTS 19
|
2007-07-18 15:22:40 -06:00
|
|
|
#define DRM_MEM_DRAWABLE 20
|
2000-05-30 11:13:31 -06:00
|
|
|
|
|
|
|
#define DRM_MAX_CTXBITMAP (PAGE_SIZE * 8)
|
|
|
|
|
|
|
|
/* Internal types and structures */
|
|
|
|
#define DRM_ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
|
|
|
|
#define DRM_MIN(a,b) ((a)<(b)?(a):(b))
|
|
|
|
#define DRM_MAX(a,b) ((a)>(b)?(a):(b))
|
|
|
|
|
2003-11-05 01:13:52 -07:00
|
|
|
#define DRM_IF_VERSION(maj, min) (maj << 16 | min)
|
|
|
|
|
2004-11-06 04:16:26 -07:00
|
|
|
MALLOC_DECLARE(M_DRM);
|
|
|
|
|
|
|
|
#define __OS_HAS_AGP 1
|
|
|
|
|
|
|
|
#define DRM_DEV_MODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP)
|
|
|
|
#define DRM_DEV_UID 0
|
|
|
|
#define DRM_DEV_GID 0
|
|
|
|
|
|
|
|
#define wait_queue_head_t atomic_t
|
|
|
|
#define DRM_WAKEUP(w) wakeup((void *)w)
|
|
|
|
#define DRM_WAKEUP_INT(w) wakeup(w)
|
2006-09-07 00:26:50 -06:00
|
|
|
#define DRM_INIT_WAITQUEUE(queue) do {(void)(queue);} while (0)
|
2004-11-06 04:16:26 -07:00
|
|
|
|
|
|
|
#if defined(__FreeBSD__) && __FreeBSD_version < 502109
|
|
|
|
#define bus_alloc_resource_any(dev, type, rid, flags) \
|
|
|
|
bus_alloc_resource(dev, type, rid, 0ul, ~0ul, 1, flags)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(__FreeBSD__) && __FreeBSD_version >= 500000
|
|
|
|
#define DRM_CURPROC curthread
|
|
|
|
#define DRM_STRUCTPROC struct thread
|
|
|
|
#define DRM_SPINTYPE struct mtx
|
2007-07-18 15:22:40 -06:00
|
|
|
#define DRM_SPININIT(l,name) mtx_init(l, name, NULL, MTX_DEF)
|
|
|
|
#define DRM_SPINUNINIT(l) mtx_destroy(l)
|
2004-11-06 04:16:26 -07:00
|
|
|
#define DRM_SPINLOCK(l) mtx_lock(l)
|
2007-07-18 15:22:40 -06:00
|
|
|
#define DRM_SPINUNLOCK(u) mtx_unlock(u)
|
|
|
|
#define DRM_SPINLOCK_IRQSAVE(l, irqflags) do { \
|
|
|
|
mtx_lock(l); \
|
|
|
|
(void)irqflags; \
|
|
|
|
} while (0)
|
|
|
|
#define DRM_SPINUNLOCK_IRQRESTORE(u, irqflags) mtx_unlock(u)
|
2004-11-06 04:16:26 -07:00
|
|
|
#define DRM_SPINLOCK_ASSERT(l) mtx_assert(l, MA_OWNED)
|
|
|
|
#define DRM_CURRENTPID curthread->td_proc->p_pid
|
|
|
|
#define DRM_LOCK() mtx_lock(&dev->dev_lock)
|
|
|
|
#define DRM_UNLOCK() mtx_unlock(&dev->dev_lock)
|
|
|
|
#define DRM_SYSCTL_HANDLER_ARGS (SYSCTL_HANDLER_ARGS)
|
|
|
|
#else /* __FreeBSD__ && __FreeBSD_version >= 500000 */
|
|
|
|
#define DRM_CURPROC curproc
|
|
|
|
#define DRM_STRUCTPROC struct proc
|
|
|
|
#define DRM_SPINTYPE struct simplelock
|
|
|
|
#define DRM_SPININIT(l,name)
|
|
|
|
#define DRM_SPINUNINIT(l)
|
|
|
|
#define DRM_SPINLOCK(l)
|
|
|
|
#define DRM_SPINUNLOCK(u)
|
2004-11-06 21:11:15 -07:00
|
|
|
#define DRM_SPINLOCK_ASSERT(l)
|
2004-11-06 04:16:26 -07:00
|
|
|
#define DRM_CURRENTPID curproc->p_pid
|
|
|
|
#define DRM_LOCK()
|
|
|
|
#define DRM_UNLOCK()
|
|
|
|
#define DRM_SYSCTL_HANDLER_ARGS SYSCTL_HANDLER_ARGS
|
|
|
|
#define spldrm() spltty()
|
|
|
|
#endif /* __NetBSD__ || __OpenBSD__ */
|
|
|
|
|
|
|
|
#define DRM_IRQ_ARGS void *arg
|
|
|
|
typedef void irqreturn_t;
|
|
|
|
#define IRQ_HANDLED /* nothing */
|
|
|
|
#define IRQ_NONE /* nothing */
|
|
|
|
|
2005-06-28 20:54:19 -06:00
|
|
|
enum {
|
|
|
|
DRM_IS_NOT_AGP,
|
2006-04-18 00:08:17 -06:00
|
|
|
DRM_IS_AGP,
|
|
|
|
DRM_MIGHT_BE_AGP
|
2005-06-28 20:54:19 -06:00
|
|
|
};
|
|
|
|
#define DRM_AGP_MEM struct agp_memory_info
|
|
|
|
|
2004-11-06 04:16:26 -07:00
|
|
|
#if defined(__FreeBSD__)
|
2007-07-19 18:11:11 -06:00
|
|
|
#define drm_get_device_from_kdev(_kdev) (_kdev->si_drv1)
|
|
|
|
#elif defined(__NetBSD__)
|
|
|
|
#define drm_get_device_from_kdev(_kdev) device_lookup(&drm_cd, minor(_kdev))
|
|
|
|
#elif defined(__OpenBSD__)
|
|
|
|
#define drm_get_device_from_kdev(_kdev) device_lookup(&drm_cd, \
|
|
|
|
minor(_kdev)))->dv_cfdata->cf_driver->cd_devs[minor(_kdev)]
|
|
|
|
#endif
|
2004-11-06 04:16:26 -07:00
|
|
|
|
2007-07-19 18:11:11 -06:00
|
|
|
#if defined(__FreeBSD__)
|
2004-11-06 04:16:26 -07:00
|
|
|
#define PAGE_ALIGN(addr) round_page(addr)
|
2005-08-25 18:16:01 -06:00
|
|
|
/* DRM_SUSER returns true if the user is superuser */
|
2007-05-15 14:35:33 -06:00
|
|
|
#if __FreeBSD_version >= 700000
|
|
|
|
#define DRM_SUSER(p) (priv_check(p, PRIV_DRIVER) == 0)
|
|
|
|
#else
|
2005-08-25 18:16:01 -06:00
|
|
|
#define DRM_SUSER(p) (suser(p) == 0)
|
2007-05-15 14:35:33 -06:00
|
|
|
#endif
|
2004-11-06 04:16:26 -07:00
|
|
|
#define DRM_AGP_FIND_DEVICE() agp_find_device()
|
|
|
|
#define DRM_MTRR_WC MDF_WRITECOMBINE
|
|
|
|
#define jiffies ticks
|
|
|
|
|
|
|
|
#else /* __FreeBSD__ */
|
|
|
|
|
|
|
|
#define CDEV_MAJOR 34
|
|
|
|
#define PAGE_ALIGN(addr) (((addr) + PAGE_SIZE - 1) & PAGE_MASK)
|
2005-08-25 18:16:01 -06:00
|
|
|
/* DRM_SUSER returns true if the user is superuser */
|
|
|
|
#define DRM_SUSER(p) (suser(p->p_ucred, &p->p_acflag) == 0)
|
2004-11-06 04:16:26 -07:00
|
|
|
#define DRM_AGP_FIND_DEVICE() agp_find_device(0)
|
|
|
|
#define DRM_MTRR_WC MTRR_TYPE_WC
|
|
|
|
#define jiffies hardclock_ticks
|
|
|
|
|
|
|
|
typedef drm_device_t *device_t;
|
|
|
|
extern struct cfdriver drm_cd;
|
|
|
|
#endif /* !__FreeBSD__ */
|
|
|
|
|
2005-07-20 15:17:47 -06:00
|
|
|
/* Capabilities taken from src/sys/dev/pci/pcireg.h. */
|
|
|
|
#ifndef PCIY_AGP
|
|
|
|
#define PCIY_AGP 0x02
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef PCIY_EXPRESS
|
|
|
|
#define PCIY_EXPRESS 0x10
|
|
|
|
#endif
|
|
|
|
|
2004-11-06 04:16:26 -07:00
|
|
|
typedef unsigned long dma_addr_t;
|
2006-09-07 00:08:29 -06:00
|
|
|
typedef u_int64_t u64;
|
2004-11-06 04:16:26 -07:00
|
|
|
typedef u_int32_t u32;
|
|
|
|
typedef u_int16_t u16;
|
|
|
|
typedef u_int8_t u8;
|
|
|
|
|
|
|
|
/* DRM_READMEMORYBARRIER() prevents reordering of reads.
|
|
|
|
* DRM_WRITEMEMORYBARRIER() prevents reordering of writes.
|
|
|
|
* DRM_MEMORYBARRIER() prevents reordering of reads and writes.
|
|
|
|
*/
|
|
|
|
#if defined(__i386__)
|
|
|
|
#define DRM_READMEMORYBARRIER() __asm __volatile( \
|
|
|
|
"lock; addl $0,0(%%esp)" : : : "memory");
|
|
|
|
#define DRM_WRITEMEMORYBARRIER() __asm __volatile("" : : : "memory");
|
|
|
|
#define DRM_MEMORYBARRIER() __asm __volatile( \
|
|
|
|
"lock; addl $0,0(%%esp)" : : : "memory");
|
|
|
|
#elif defined(__alpha__)
|
|
|
|
#define DRM_READMEMORYBARRIER() alpha_mb();
|
|
|
|
#define DRM_WRITEMEMORYBARRIER() alpha_wmb();
|
|
|
|
#define DRM_MEMORYBARRIER() alpha_mb();
|
|
|
|
#elif defined(__amd64__)
|
|
|
|
#define DRM_READMEMORYBARRIER() __asm __volatile( \
|
|
|
|
"lock; addl $0,0(%%rsp)" : : : "memory");
|
|
|
|
#define DRM_WRITEMEMORYBARRIER() __asm __volatile("" : : : "memory");
|
|
|
|
#define DRM_MEMORYBARRIER() __asm __volatile( \
|
|
|
|
"lock; addl $0,0(%%rsp)" : : : "memory");
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __FreeBSD__
|
|
|
|
#define DRM_READ8(map, offset) \
|
|
|
|
*(volatile u_int8_t *) (((unsigned long)(map)->handle) + (offset))
|
|
|
|
#define DRM_READ16(map, offset) \
|
|
|
|
*(volatile u_int16_t *) (((unsigned long)(map)->handle) + (offset))
|
|
|
|
#define DRM_READ32(map, offset) \
|
|
|
|
*(volatile u_int32_t *)(((unsigned long)(map)->handle) + (offset))
|
|
|
|
#define DRM_WRITE8(map, offset, val) \
|
|
|
|
*(volatile u_int8_t *) (((unsigned long)(map)->handle) + (offset)) = val
|
|
|
|
#define DRM_WRITE16(map, offset, val) \
|
|
|
|
*(volatile u_int16_t *) (((unsigned long)(map)->handle) + (offset)) = val
|
|
|
|
#define DRM_WRITE32(map, offset, val) \
|
|
|
|
*(volatile u_int32_t *)(((unsigned long)(map)->handle) + (offset)) = val
|
|
|
|
|
|
|
|
#define DRM_VERIFYAREA_READ( uaddr, size ) \
|
2005-02-05 01:00:14 -07:00
|
|
|
(!useracc(__DECONST(caddr_t, uaddr), size, VM_PROT_READ))
|
2004-11-06 04:16:26 -07:00
|
|
|
|
|
|
|
#else /* __FreeBSD__ */
|
|
|
|
|
|
|
|
typedef vaddr_t vm_offset_t;
|
|
|
|
|
|
|
|
#define DRM_READ8(map, offset) \
|
2005-02-05 01:00:14 -07:00
|
|
|
bus_space_read_1( (map)->bst, (map)->bsh, (offset))
|
2004-11-06 04:16:26 -07:00
|
|
|
#define DRM_READ16(map, offset) \
|
2005-02-05 01:00:14 -07:00
|
|
|
bus_space_read_2( (map)->bst, (map)->bsh, (offset))
|
2004-11-06 04:16:26 -07:00
|
|
|
#define DRM_READ32(map, offset) \
|
2005-02-05 01:00:14 -07:00
|
|
|
bus_space_read_4( (map)->bst, (map)->bsh, (offset))
|
2004-11-06 04:16:26 -07:00
|
|
|
#define DRM_WRITE8(map, offset, val) \
|
2005-02-05 01:00:14 -07:00
|
|
|
bus_space_write_1((map)->bst, (map)->bsh, (offset), (val))
|
2004-11-06 04:16:26 -07:00
|
|
|
#define DRM_WRITE16(map, offset, val) \
|
2005-02-05 01:00:14 -07:00
|
|
|
bus_space_write_2((map)->bst, (map)->bsh, (offset), (val))
|
2004-11-06 04:16:26 -07:00
|
|
|
#define DRM_WRITE32(map, offset, val) \
|
2005-02-05 01:00:14 -07:00
|
|
|
bus_space_write_4((map)->bst, (map)->bsh, (offset), (val))
|
2004-11-06 04:16:26 -07:00
|
|
|
|
|
|
|
#define DRM_VERIFYAREA_READ( uaddr, size ) \
|
|
|
|
(!uvm_useracc((caddr_t)uaddr, size, VM_PROT_READ))
|
|
|
|
#endif /* !__FreeBSD__ */
|
|
|
|
|
|
|
|
#define DRM_COPY_TO_USER(user, kern, size) \
|
|
|
|
copyout(kern, user, size)
|
|
|
|
#define DRM_COPY_FROM_USER(kern, user, size) \
|
|
|
|
copyin(user, kern, size)
|
|
|
|
#define DRM_COPY_FROM_USER_UNCHECKED(arg1, arg2, arg3) \
|
|
|
|
copyin(arg2, arg1, arg3)
|
|
|
|
#define DRM_COPY_TO_USER_UNCHECKED(arg1, arg2, arg3) \
|
|
|
|
copyout(arg2, arg1, arg3)
|
2005-02-13 20:28:01 -07:00
|
|
|
#if __FreeBSD_version > 500000
|
|
|
|
#define DRM_GET_USER_UNCHECKED(val, uaddr) \
|
|
|
|
((val) = fuword32(uaddr), 0)
|
|
|
|
#else
|
|
|
|
#define DRM_GET_USER_UNCHECKED(val, uaddr) \
|
2004-11-06 04:16:26 -07:00
|
|
|
((val) = fuword(uaddr), 0)
|
2005-02-13 20:28:01 -07:00
|
|
|
#endif
|
2004-11-06 04:16:26 -07:00
|
|
|
|
|
|
|
#define cpu_to_le32(x) htole32(x)
|
|
|
|
#define le32_to_cpu(x) le32toh(x)
|
|
|
|
|
|
|
|
#define DRM_HZ hz
|
|
|
|
#define DRM_UDELAY(udelay) DELAY(udelay)
|
|
|
|
#define DRM_TIME_SLICE (hz/20) /* Time slice for GLXContexts */
|
|
|
|
|
2002-01-27 13:05:42 -07:00
|
|
|
#define DRM_GET_PRIV_SAREA(_dev, _ctx, _map) do { \
|
|
|
|
(_map) = (_dev)->context_sareas[_ctx]; \
|
|
|
|
} while(0)
|
|
|
|
|
2007-07-20 07:39:25 -06:00
|
|
|
#define LOCK_TEST_WITH_RETURN(dev, file_priv) \
|
2004-11-06 04:16:26 -07:00
|
|
|
do { \
|
|
|
|
if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock) || \
|
2007-07-20 07:39:25 -06:00
|
|
|
dev->lock.file_priv != file_priv) { \
|
2004-11-06 04:16:26 -07:00
|
|
|
DRM_ERROR("%s called without lock held\n", \
|
|
|
|
__FUNCTION__); \
|
|
|
|
return EINVAL; \
|
|
|
|
} \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
#if defined(__FreeBSD__) && __FreeBSD_version > 500000
|
2007-08-13 11:17:47 -06:00
|
|
|
/* Returns -errno to shared code */
|
2004-11-06 04:16:26 -07:00
|
|
|
#define DRM_WAIT_ON( ret, queue, timeout, condition ) \
|
|
|
|
for ( ret = 0 ; !ret && !(condition) ; ) { \
|
2004-11-06 21:11:15 -07:00
|
|
|
DRM_UNLOCK(); \
|
2004-11-06 04:16:26 -07:00
|
|
|
mtx_lock(&dev->irq_lock); \
|
|
|
|
if (!(condition)) \
|
2007-07-19 18:00:17 -06:00
|
|
|
ret = -msleep(&(queue), &dev->irq_lock, \
|
2004-11-06 04:16:26 -07:00
|
|
|
PZERO | PCATCH, "drmwtq", (timeout)); \
|
2004-11-06 21:11:15 -07:00
|
|
|
mtx_unlock(&dev->irq_lock); \
|
|
|
|
DRM_LOCK(); \
|
2004-11-06 04:16:26 -07:00
|
|
|
}
|
|
|
|
#else
|
2007-08-13 11:17:47 -06:00
|
|
|
/* Returns -errno to shared code */
|
2004-11-06 04:16:26 -07:00
|
|
|
#define DRM_WAIT_ON( ret, queue, timeout, condition ) \
|
|
|
|
for ( ret = 0 ; !ret && !(condition) ; ) { \
|
|
|
|
int s = spldrm(); \
|
|
|
|
if (!(condition)) \
|
2007-08-13 11:17:47 -06:00
|
|
|
ret = -tsleep( &(queue), PZERO | PCATCH, \
|
2004-11-06 04:16:26 -07:00
|
|
|
"drmwtq", (timeout) ); \
|
|
|
|
splx(s); \
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define DRM_ERROR(fmt, arg...) \
|
|
|
|
printf("error: [" DRM_NAME ":pid%d:%s] *ERROR* " fmt, \
|
|
|
|
DRM_CURRENTPID, __func__ , ## arg)
|
|
|
|
|
|
|
|
#define DRM_INFO(fmt, arg...) printf("info: [" DRM_NAME "] " fmt , ## arg)
|
|
|
|
|
|
|
|
#define DRM_DEBUG(fmt, arg...) do { \
|
2004-11-06 04:50:08 -07:00
|
|
|
if (drm_debug_flag) \
|
2004-11-06 04:16:26 -07:00
|
|
|
printf("[" DRM_NAME ":pid%d:%s] " fmt, DRM_CURRENTPID, \
|
|
|
|
__func__ , ## arg); \
|
|
|
|
} while (0)
|
2002-01-27 13:05:42 -07:00
|
|
|
|
2003-10-16 21:14:39 -06:00
|
|
|
typedef struct drm_pci_id_list
|
|
|
|
{
|
|
|
|
int vendor;
|
|
|
|
int device;
|
|
|
|
long driver_private;
|
|
|
|
char *name;
|
|
|
|
} drm_pci_id_list_t;
|
|
|
|
|
2005-09-11 23:35:51 -06:00
|
|
|
#define DRM_AUTH 0x1
|
|
|
|
#define DRM_MASTER 0x2
|
|
|
|
#define DRM_ROOT_ONLY 0x4
|
2000-05-30 11:13:31 -06:00
|
|
|
typedef struct drm_ioctl_desc {
|
2007-07-19 18:11:11 -06:00
|
|
|
unsigned long cmd;
|
|
|
|
int (*func)(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
2005-09-02 21:27:14 -06:00
|
|
|
int flags;
|
2000-05-30 11:13:31 -06:00
|
|
|
} drm_ioctl_desc_t;
|
2007-07-19 18:11:11 -06:00
|
|
|
/**
|
|
|
|
* Creates a driver or general drm_ioctl_desc array entry for the given
|
|
|
|
* ioctl, for use by drm_ioctl().
|
|
|
|
*/
|
|
|
|
#define DRM_IOCTL_DEF(ioctl, func, flags) \
|
|
|
|
[DRM_IOCTL_NR(ioctl)] = {ioctl, func, flags}
|
2000-05-30 11:13:31 -06:00
|
|
|
|
|
|
|
typedef struct drm_magic_entry {
|
|
|
|
drm_magic_t magic;
|
|
|
|
struct drm_file *priv;
|
|
|
|
struct drm_magic_entry *next;
|
|
|
|
} drm_magic_entry_t;
|
|
|
|
|
|
|
|
typedef struct drm_magic_head {
|
2002-01-27 13:05:42 -07:00
|
|
|
struct drm_magic_entry *head;
|
|
|
|
struct drm_magic_entry *tail;
|
2000-05-30 11:13:31 -06:00
|
|
|
} drm_magic_head_t;
|
|
|
|
|
|
|
|
typedef struct drm_buf {
|
|
|
|
int idx; /* Index into master buflist */
|
|
|
|
int total; /* Buffer size */
|
|
|
|
int order; /* log-base-2(total) */
|
|
|
|
int used; /* Amount of buffer in use (for DMA) */
|
|
|
|
unsigned long offset; /* Byte offset (used internally) */
|
|
|
|
void *address; /* Address of buffer */
|
|
|
|
unsigned long bus_address; /* Bus address of buffer */
|
|
|
|
struct drm_buf *next; /* Kernel-only: used for free list */
|
|
|
|
__volatile__ int pending; /* On hardware DMA queue */
|
2007-07-20 07:39:25 -06:00
|
|
|
struct drm_file *file_priv; /* Unique identifier of holding process */
|
2000-05-30 11:13:31 -06:00
|
|
|
int context; /* Kernel queue for this buffer */
|
|
|
|
enum {
|
|
|
|
DRM_LIST_NONE = 0,
|
|
|
|
DRM_LIST_FREE = 1,
|
|
|
|
DRM_LIST_WAIT = 2,
|
|
|
|
DRM_LIST_PEND = 3,
|
|
|
|
DRM_LIST_PRIO = 4,
|
|
|
|
DRM_LIST_RECLAIM = 5
|
|
|
|
} list; /* Which list we're on */
|
|
|
|
|
2002-01-27 13:05:42 -07:00
|
|
|
int dev_priv_size; /* Size of buffer private stoarge */
|
|
|
|
void *dev_private; /* Per-buffer private storage */
|
2000-05-30 11:13:31 -06:00
|
|
|
} drm_buf_t;
|
|
|
|
|
|
|
|
typedef struct drm_freelist {
|
|
|
|
int initialized; /* Freelist in use */
|
|
|
|
atomic_t count; /* Number of free buffers */
|
|
|
|
drm_buf_t *next; /* End pointer */
|
2002-01-27 13:05:42 -07:00
|
|
|
|
2000-05-30 11:13:31 -06:00
|
|
|
int low_mark; /* Low water mark */
|
|
|
|
int high_mark; /* High water mark */
|
|
|
|
} drm_freelist_t;
|
|
|
|
|
2005-04-25 23:19:11 -06:00
|
|
|
typedef struct drm_dma_handle {
|
|
|
|
void *vaddr;
|
|
|
|
bus_addr_t busaddr;
|
|
|
|
#if defined(__FreeBSD__)
|
|
|
|
bus_dma_tag_t tag;
|
|
|
|
bus_dmamap_t map;
|
|
|
|
#elif defined(__NetBSD__)
|
|
|
|
bus_dma_segment_t seg;
|
|
|
|
#endif
|
|
|
|
} drm_dma_handle_t;
|
|
|
|
|
2000-05-30 11:13:31 -06:00
|
|
|
typedef struct drm_buf_entry {
|
|
|
|
int buf_size;
|
|
|
|
int buf_count;
|
|
|
|
drm_buf_t *buflist;
|
|
|
|
int seg_count;
|
2005-04-25 23:19:11 -06:00
|
|
|
drm_dma_handle_t **seglist;
|
2000-05-30 11:13:31 -06:00
|
|
|
int page_order;
|
|
|
|
|
|
|
|
drm_freelist_t freelist;
|
|
|
|
} drm_buf_entry_t;
|
|
|
|
|
|
|
|
typedef TAILQ_HEAD(drm_file_list, drm_file) drm_file_list_t;
|
2002-01-27 13:05:42 -07:00
|
|
|
struct drm_file {
|
2000-05-30 11:13:31 -06:00
|
|
|
TAILQ_ENTRY(drm_file) link;
|
|
|
|
int authenticated;
|
2005-08-25 18:16:01 -06:00
|
|
|
int master;
|
2000-05-30 11:13:31 -06:00
|
|
|
int minor;
|
|
|
|
pid_t pid;
|
|
|
|
uid_t uid;
|
|
|
|
int refs;
|
|
|
|
drm_magic_t magic;
|
|
|
|
unsigned long ioctl_count;
|
2004-11-05 18:41:47 -07:00
|
|
|
void *driver_priv;
|
2002-01-27 13:05:42 -07:00
|
|
|
};
|
2000-05-30 11:13:31 -06:00
|
|
|
|
|
|
|
typedef struct drm_lock_data {
|
|
|
|
drm_hw_lock_t *hw_lock; /* Hardware lock */
|
2007-07-20 07:39:25 -06:00
|
|
|
struct drm_file *file_priv; /* Unique identifier of holding process (NULL is kernel)*/
|
2003-10-19 17:35:58 -06:00
|
|
|
int lock_queue; /* Queue of blocked processes */
|
2000-05-30 11:13:31 -06:00
|
|
|
unsigned long lock_time; /* Time of last lock in jiffies */
|
|
|
|
} drm_lock_data_t;
|
|
|
|
|
2003-10-19 17:35:58 -06:00
|
|
|
/* This structure, in the drm_device_t, is always initialized while the device
|
|
|
|
* is open. dev->dma_lock protects the incrementing of dev->buf_use, which
|
|
|
|
* when set marks that no further bufs may be allocated until device teardown
|
|
|
|
* occurs (when the last open of the device has closed). The high/low
|
|
|
|
* watermarks of bufs are only touched by the X Server, and thus not
|
|
|
|
* concurrently accessed, so no locking is needed.
|
|
|
|
*/
|
2000-05-30 11:13:31 -06:00
|
|
|
typedef struct drm_device_dma {
|
|
|
|
drm_buf_entry_t bufs[DRM_MAX_ORDER+1];
|
|
|
|
int buf_count;
|
|
|
|
drm_buf_t **buflist; /* Vector of pointers info bufs */
|
2002-01-27 13:05:42 -07:00
|
|
|
int seg_count;
|
2000-05-30 11:13:31 -06:00
|
|
|
int page_count;
|
2002-01-27 13:05:42 -07:00
|
|
|
unsigned long *pagelist;
|
2000-05-30 11:13:31 -06:00
|
|
|
unsigned long byte_count;
|
|
|
|
enum {
|
2002-01-27 13:05:42 -07:00
|
|
|
_DRM_DMA_USE_AGP = 0x01,
|
|
|
|
_DRM_DMA_USE_SG = 0x02
|
2000-05-30 11:13:31 -06:00
|
|
|
} flags;
|
|
|
|
} drm_device_dma_t;
|
|
|
|
|
|
|
|
typedef struct drm_agp_mem {
|
|
|
|
void *handle;
|
|
|
|
unsigned long bound; /* address */
|
|
|
|
int pages;
|
|
|
|
struct drm_agp_mem *prev;
|
|
|
|
struct drm_agp_mem *next;
|
|
|
|
} drm_agp_mem_t;
|
|
|
|
|
|
|
|
typedef struct drm_agp_head {
|
|
|
|
device_t agpdev;
|
|
|
|
struct agp_info info;
|
|
|
|
const char *chipset;
|
|
|
|
drm_agp_mem_t *memory;
|
|
|
|
unsigned long mode;
|
|
|
|
int enabled;
|
|
|
|
int acquired;
|
|
|
|
unsigned long base;
|
2003-12-16 01:57:08 -07:00
|
|
|
int mtrr;
|
2002-01-27 13:05:42 -07:00
|
|
|
int cant_use_aperture;
|
|
|
|
unsigned long page_mask;
|
2000-05-30 11:13:31 -06:00
|
|
|
} drm_agp_head_t;
|
|
|
|
|
2002-01-27 13:05:42 -07:00
|
|
|
typedef struct drm_sg_mem {
|
|
|
|
unsigned long handle;
|
2005-08-25 18:16:01 -06:00
|
|
|
void *virtual;
|
2002-01-27 13:05:42 -07:00
|
|
|
int pages;
|
2002-07-05 02:31:11 -06:00
|
|
|
dma_addr_t *busaddr;
|
2005-04-25 23:19:11 -06:00
|
|
|
drm_dma_handle_t *dmah; /* Handle to PCI memory for ATI PCIGART table */
|
2002-01-27 13:05:42 -07:00
|
|
|
} drm_sg_mem_t;
|
|
|
|
|
2005-02-05 01:00:14 -07:00
|
|
|
typedef TAILQ_HEAD(drm_map_list, drm_local_map) drm_map_list_t;
|
|
|
|
|
2003-02-21 16:23:09 -07:00
|
|
|
typedef struct drm_local_map {
|
|
|
|
unsigned long offset; /* Physical address (0 for SAREA)*/
|
|
|
|
unsigned long size; /* Physical size (bytes) */
|
|
|
|
drm_map_type_t type; /* Type of memory mapped */
|
|
|
|
drm_map_flags_t flags; /* Flags */
|
|
|
|
void *handle; /* User-space: "Handle" to pass to mmap */
|
|
|
|
/* Kernel-space: kernel-virtual address */
|
2003-12-16 01:57:08 -07:00
|
|
|
int mtrr; /* Boolean: MTRR used */
|
2003-02-21 16:23:09 -07:00
|
|
|
/* Private data */
|
2005-02-05 01:00:14 -07:00
|
|
|
int rid; /* PCI resource ID for bus_space */
|
|
|
|
struct resource *bsr;
|
|
|
|
bus_space_tag_t bst;
|
|
|
|
bus_space_handle_t bsh;
|
2005-04-25 23:19:11 -06:00
|
|
|
drm_dma_handle_t *dmah;
|
2005-02-05 01:00:14 -07:00
|
|
|
TAILQ_ENTRY(drm_local_map) link;
|
2003-02-21 16:23:09 -07:00
|
|
|
} drm_local_map_t;
|
|
|
|
|
2002-12-05 19:27:30 -07:00
|
|
|
TAILQ_HEAD(drm_vbl_sig_list, drm_vbl_sig);
|
|
|
|
typedef struct drm_vbl_sig {
|
|
|
|
TAILQ_ENTRY(drm_vbl_sig) link;
|
|
|
|
unsigned int sequence;
|
|
|
|
int signo;
|
|
|
|
int pid;
|
|
|
|
} drm_vbl_sig_t;
|
|
|
|
|
2005-11-07 19:38:01 -07:00
|
|
|
/* location of GART table */
|
|
|
|
#define DRM_ATI_GART_MAIN 1
|
|
|
|
#define DRM_ATI_GART_FB 2
|
|
|
|
|
2007-05-15 14:35:33 -06:00
|
|
|
#define DRM_ATI_GART_PCI 1
|
|
|
|
#define DRM_ATI_GART_PCIE 2
|
|
|
|
#define DRM_ATI_GART_IGP 3
|
|
|
|
|
2005-11-07 19:38:01 -07:00
|
|
|
typedef struct ati_pcigart_info {
|
|
|
|
int gart_table_location;
|
2007-05-15 14:35:33 -06:00
|
|
|
int gart_reg_if;
|
2005-11-07 19:38:01 -07:00
|
|
|
void *addr;
|
|
|
|
dma_addr_t bus_addr;
|
|
|
|
drm_local_map_t mapping;
|
2007-05-15 14:35:33 -06:00
|
|
|
int table_size;
|
2005-11-07 19:38:01 -07:00
|
|
|
} drm_ati_pcigart_info;
|
|
|
|
|
2005-08-04 21:50:23 -06:00
|
|
|
struct drm_driver_info {
|
|
|
|
int (*load)(struct drm_device *, unsigned long flags);
|
|
|
|
int (*firstopen)(struct drm_device *);
|
|
|
|
int (*open)(struct drm_device *, drm_file_t *);
|
2007-07-20 07:39:25 -06:00
|
|
|
void (*preclose)(struct drm_device *, struct drm_file *file_priv);
|
2005-08-04 21:50:23 -06:00
|
|
|
void (*postclose)(struct drm_device *, drm_file_t *);
|
|
|
|
void (*lastclose)(struct drm_device *);
|
|
|
|
int (*unload)(struct drm_device *);
|
2007-07-20 07:39:25 -06:00
|
|
|
void (*reclaim_buffers_locked)(struct drm_device *,
|
|
|
|
struct drm_file *file_priv);
|
2007-07-19 18:11:11 -06:00
|
|
|
int (*dma_ioctl)(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
2004-11-05 18:41:47 -07:00
|
|
|
void (*dma_ready)(struct drm_device *);
|
|
|
|
int (*dma_quiescent)(struct drm_device *);
|
|
|
|
int (*dma_flush_block_and_flush)(struct drm_device *, int context,
|
|
|
|
drm_lock_flags_t flags);
|
|
|
|
int (*dma_flush_unblock)(struct drm_device *, int context,
|
|
|
|
drm_lock_flags_t flags);
|
|
|
|
int (*context_ctor)(struct drm_device *dev, int context);
|
|
|
|
int (*context_dtor)(struct drm_device *dev, int context);
|
|
|
|
int (*kernel_context_switch)(struct drm_device *dev, int old,
|
|
|
|
int new);
|
|
|
|
int (*kernel_context_switch_unlock)(struct drm_device *dev);
|
|
|
|
void (*irq_preinstall)(drm_device_t *dev);
|
|
|
|
void (*irq_postinstall)(drm_device_t *dev);
|
|
|
|
void (*irq_uninstall)(drm_device_t *dev);
|
|
|
|
void (*irq_handler)(DRM_IRQ_ARGS);
|
|
|
|
int (*vblank_wait)(drm_device_t *dev, unsigned int *sequence);
|
|
|
|
|
2005-08-04 01:42:01 -06:00
|
|
|
drm_pci_id_list_t *id_entry; /* PCI ID, name, and chipset private */
|
|
|
|
|
2005-05-16 11:37:10 -06:00
|
|
|
/**
|
|
|
|
* Called by \c drm_device_is_agp. Typically used to determine if a
|
|
|
|
* card is really attached to AGP or not.
|
|
|
|
*
|
|
|
|
* \param dev DRM device handle
|
|
|
|
*
|
2005-05-27 17:42:11 -06:00
|
|
|
* \returns
|
|
|
|
* One of three values is returned depending on whether or not the
|
|
|
|
* card is absolutely \b not AGP (return of 0), absolutely \b is AGP
|
|
|
|
* (return of 1), or may or may not be AGP (return of 2).
|
2005-05-16 11:37:10 -06:00
|
|
|
*/
|
2005-08-04 21:50:23 -06:00
|
|
|
int (*device_is_agp) (struct drm_device * dev);
|
2005-05-16 11:37:10 -06:00
|
|
|
|
2005-08-04 21:50:23 -06:00
|
|
|
drm_ioctl_desc_t *ioctls;
|
|
|
|
int max_ioctl;
|
2005-05-16 11:37:10 -06:00
|
|
|
|
2005-08-04 21:50:23 -06:00
|
|
|
int buf_priv_size;
|
2004-11-05 18:41:47 -07:00
|
|
|
|
2005-08-04 21:50:23 -06:00
|
|
|
int major;
|
|
|
|
int minor;
|
|
|
|
int patchlevel;
|
|
|
|
const char *name; /* Simple driver name */
|
|
|
|
const char *desc; /* Longer driver name */
|
|
|
|
const char *date; /* Date of last major changes. */
|
2004-11-05 18:41:47 -07:00
|
|
|
|
|
|
|
unsigned use_agp :1;
|
|
|
|
unsigned require_agp :1;
|
|
|
|
unsigned use_sg :1;
|
|
|
|
unsigned use_dma :1;
|
|
|
|
unsigned use_pci_dma :1;
|
|
|
|
unsigned use_dma_queue :1;
|
|
|
|
unsigned use_irq :1;
|
|
|
|
unsigned use_vbl_irq :1;
|
|
|
|
unsigned use_mtrr :1;
|
2005-08-04 21:50:23 -06:00
|
|
|
};
|
|
|
|
|
2005-08-26 14:56:11 -06:00
|
|
|
/* Length for the array of resource pointers for drm_get_resource_*. */
|
|
|
|
#define DRM_MAX_PCI_RESOURCE 3
|
|
|
|
|
2005-08-04 21:50:23 -06:00
|
|
|
/**
|
|
|
|
* DRM device functions structure
|
|
|
|
*/
|
|
|
|
struct drm_device {
|
|
|
|
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
|
|
|
struct device device; /* softc is an extension of struct device */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
struct drm_driver_info driver;
|
|
|
|
drm_pci_id_list_t *id_entry; /* PCI ID, name, and chipset private */
|
2004-11-05 18:41:47 -07:00
|
|
|
|
2006-09-07 00:25:14 -06:00
|
|
|
u_int16_t pci_device; /* PCI device id */
|
|
|
|
u_int16_t pci_vendor; /* PCI vendor id */
|
|
|
|
|
2000-05-30 11:13:31 -06:00
|
|
|
char *unique; /* Unique identifier: e.g., busid */
|
|
|
|
int unique_len; /* Length of unique field */
|
2002-07-05 02:31:11 -06:00
|
|
|
#ifdef __FreeBSD__
|
2000-05-30 11:13:31 -06:00
|
|
|
device_t device; /* Device instance from newbus */
|
2002-07-05 02:31:11 -06:00
|
|
|
#endif
|
2004-07-05 18:23:42 -06:00
|
|
|
struct cdev *devnode; /* Device number for mknod */
|
2003-11-05 01:13:52 -07:00
|
|
|
int if_version; /* Highest interface version set */
|
2002-01-27 13:05:42 -07:00
|
|
|
|
2000-05-30 11:13:31 -06:00
|
|
|
int flags; /* Flags to open(2) */
|
|
|
|
|
|
|
|
/* Locks */
|
2003-10-19 17:35:58 -06:00
|
|
|
#if defined(__FreeBSD__) && __FreeBSD_version > 500000
|
|
|
|
struct mtx dma_lock; /* protects dev->dma */
|
2004-11-06 04:16:26 -07:00
|
|
|
struct mtx irq_lock; /* protects irq condition checks */
|
2003-10-19 17:35:58 -06:00
|
|
|
struct mtx dev_lock; /* protects everything else */
|
|
|
|
#endif
|
2007-07-18 15:22:40 -06:00
|
|
|
DRM_SPINTYPE drw_lock;
|
|
|
|
|
2000-05-30 11:13:31 -06:00
|
|
|
/* Usage Counters */
|
|
|
|
int open_count; /* Outstanding files open */
|
|
|
|
int buf_use; /* Buffers in use -- cannot alloc */
|
|
|
|
|
2002-01-27 13:05:42 -07:00
|
|
|
/* Performance counters */
|
|
|
|
unsigned long counters;
|
|
|
|
drm_stat_type_t types[15];
|
|
|
|
atomic_t counts[15];
|
2000-05-30 11:13:31 -06:00
|
|
|
|
|
|
|
/* Authentication */
|
|
|
|
drm_file_list_t files;
|
|
|
|
drm_magic_head_t magiclist[DRM_HASH_SIZE];
|
|
|
|
|
2003-10-19 17:35:58 -06:00
|
|
|
/* Linked list of mappable regions. Protected by dev_lock */
|
2005-02-05 01:00:14 -07:00
|
|
|
drm_map_list_t maplist;
|
2000-05-30 11:13:31 -06:00
|
|
|
|
2003-02-21 16:23:09 -07:00
|
|
|
drm_local_map_t **context_sareas;
|
2002-01-27 13:05:42 -07:00
|
|
|
int max_context;
|
|
|
|
|
2000-05-30 11:13:31 -06:00
|
|
|
drm_lock_data_t lock; /* Information on hardware lock */
|
|
|
|
|
|
|
|
/* DMA queues (contexts) */
|
|
|
|
drm_device_dma_t *dma; /* Optional pointer for DMA support */
|
|
|
|
|
|
|
|
/* Context support */
|
2002-01-27 13:05:42 -07:00
|
|
|
int irq; /* Interrupt used by board */
|
2003-11-05 01:13:52 -07:00
|
|
|
int irq_enabled; /* True if the irq handler is enabled */
|
2003-02-21 16:23:09 -07:00
|
|
|
#ifdef __FreeBSD__
|
2003-11-05 01:13:52 -07:00
|
|
|
int irqrid; /* Interrupt used by board */
|
2002-01-27 13:05:42 -07:00
|
|
|
struct resource *irqr; /* Resource for interrupt used by board */
|
2004-11-06 04:16:26 -07:00
|
|
|
#elif defined(__NetBSD__) || defined(__OpenBSD__)
|
2002-07-05 02:31:11 -06:00
|
|
|
struct pci_attach_args pa;
|
|
|
|
#endif
|
2000-05-30 11:13:31 -06:00
|
|
|
void *irqh; /* Handle from bus_setup_intr */
|
2003-11-05 01:13:52 -07:00
|
|
|
|
2005-08-26 14:56:11 -06:00
|
|
|
/* Storage of resource pointers for drm_get_resource_* */
|
|
|
|
struct resource *pcir[DRM_MAX_PCI_RESOURCE];
|
|
|
|
int pcirid[DRM_MAX_PCI_RESOURCE];
|
|
|
|
|
2003-11-05 01:13:52 -07:00
|
|
|
int pci_domain;
|
|
|
|
int pci_bus;
|
|
|
|
int pci_slot;
|
|
|
|
int pci_func;
|
|
|
|
|
2002-07-05 02:31:11 -06:00
|
|
|
atomic_t context_flag; /* Context swapping flag */
|
2000-05-30 11:13:31 -06:00
|
|
|
int last_context; /* Last current context */
|
2003-10-19 17:35:58 -06:00
|
|
|
int vbl_queue; /* vbl wait channel */
|
2002-09-26 01:45:07 -06:00
|
|
|
atomic_t vbl_received;
|
2007-07-16 02:53:06 -06:00
|
|
|
atomic_t vbl_received2;
|
2002-01-27 13:05:42 -07:00
|
|
|
|
2002-07-05 02:31:11 -06:00
|
|
|
#ifdef __FreeBSD__
|
2002-01-27 13:05:42 -07:00
|
|
|
struct sigio *buf_sigio; /* Processes waiting for SIGIO */
|
2002-07-05 02:31:11 -06:00
|
|
|
#elif defined(__NetBSD__)
|
|
|
|
pid_t buf_pgid;
|
|
|
|
#endif
|
2000-05-30 11:13:31 -06:00
|
|
|
|
|
|
|
/* Sysctl support */
|
|
|
|
struct drm_sysctl_info *sysctl;
|
|
|
|
|
|
|
|
drm_agp_head_t *agp;
|
2002-01-27 13:05:42 -07:00
|
|
|
drm_sg_mem_t *sg; /* Scatter gather memory */
|
2002-07-05 02:31:11 -06:00
|
|
|
atomic_t *ctx_bitmap;
|
2000-05-30 11:13:31 -06:00
|
|
|
void *dev_private;
|
2005-08-17 16:59:00 -06:00
|
|
|
unsigned int agp_buffer_token;
|
2004-08-17 07:10:05 -06:00
|
|
|
drm_local_map_t *agp_buffer_map;
|
2007-07-18 15:22:40 -06:00
|
|
|
|
|
|
|
struct unrhdr *drw_unrhdr;
|
|
|
|
/* RB tree of drawable infos */
|
|
|
|
RB_HEAD(drawable_tree, bsd_drm_drawable_info) drw_head;
|
|
|
|
|
|
|
|
struct task locked_task;
|
|
|
|
void (*locked_task_call)(drm_device_t *dev);
|
2002-01-27 13:05:42 -07:00
|
|
|
};
|
|
|
|
|
2004-11-06 04:50:08 -07:00
|
|
|
extern int drm_debug_flag;
|
2002-01-27 13:05:42 -07:00
|
|
|
|
2004-11-05 18:41:47 -07:00
|
|
|
/* Device setup support (drm_drv.c) */
|
|
|
|
#ifdef __FreeBSD__
|
|
|
|
int drm_probe(device_t nbdev, drm_pci_id_list_t *idlist);
|
|
|
|
int drm_attach(device_t nbdev, drm_pci_id_list_t *idlist);
|
|
|
|
int drm_detach(device_t nbdev);
|
2004-11-06 04:16:26 -07:00
|
|
|
d_ioctl_t drm_ioctl;
|
|
|
|
d_open_t drm_open;
|
|
|
|
d_close_t drm_close;
|
|
|
|
d_read_t drm_read;
|
|
|
|
d_poll_t drm_poll;
|
|
|
|
d_mmap_t drm_mmap;
|
|
|
|
#elif defined(__NetBSD__) || defined(__OpenBSD__)
|
2004-11-05 18:41:47 -07:00
|
|
|
int drm_probe(struct pci_attach_args *pa, drm_pci_id_list_t *idlist);
|
|
|
|
int drm_attach(struct pci_attach_args *pa, dev_t kdev, drm_pci_id_list_t *idlist);
|
2004-11-06 04:16:26 -07:00
|
|
|
dev_type_ioctl(drm_ioctl);
|
|
|
|
dev_type_open(drm_open);
|
|
|
|
dev_type_close(drm_close);
|
|
|
|
dev_type_read(drm_read);
|
|
|
|
dev_type_poll(drm_poll);
|
|
|
|
dev_type_mmap(drm_mmap);
|
2002-01-27 13:05:42 -07:00
|
|
|
#endif
|
2007-05-15 14:35:33 -06:00
|
|
|
extern drm_local_map_t *drm_getsarea(drm_device_t *dev);
|
2001-04-09 15:56:31 -06:00
|
|
|
|
2004-11-06 04:16:26 -07:00
|
|
|
/* File operations helpers (drm_fops.c) */
|
|
|
|
#ifdef __FreeBSD__
|
|
|
|
extern int drm_open_helper(struct cdev *kdev, int flags, int fmt,
|
|
|
|
DRM_STRUCTPROC *p, drm_device_t *dev);
|
|
|
|
extern drm_file_t *drm_find_file_by_proc(drm_device_t *dev,
|
|
|
|
DRM_STRUCTPROC *p);
|
|
|
|
#elif defined(__NetBSD__) || defined(__OpenBSD__)
|
|
|
|
extern int drm_open_helper(dev_t kdev, int flags, int fmt,
|
|
|
|
DRM_STRUCTPROC *p, drm_device_t *dev);
|
|
|
|
extern drm_file_t *drm_find_file_by_proc(drm_device_t *dev,
|
|
|
|
DRM_STRUCTPROC *p);
|
|
|
|
#endif /* __NetBSD__ || __OpenBSD__ */
|
|
|
|
|
2004-11-05 18:41:47 -07:00
|
|
|
/* Memory management support (drm_memory.c) */
|
|
|
|
void drm_mem_init(void);
|
|
|
|
void drm_mem_uninit(void);
|
|
|
|
void *drm_alloc(size_t size, int area);
|
|
|
|
void *drm_calloc(size_t nmemb, size_t size, int area);
|
|
|
|
void *drm_realloc(void *oldpt, size_t oldsize, size_t size,
|
|
|
|
int area);
|
|
|
|
void drm_free(void *pt, size_t size, int area);
|
|
|
|
void *drm_ioremap(drm_device_t *dev, drm_local_map_t *map);
|
|
|
|
void drm_ioremapfree(drm_local_map_t *map);
|
|
|
|
int drm_mtrr_add(unsigned long offset, size_t size, int flags);
|
2005-11-08 13:25:00 -07:00
|
|
|
int drm_mtrr_del(int handle, unsigned long offset, size_t size, int flags);
|
2004-11-05 18:41:47 -07:00
|
|
|
|
|
|
|
int drm_context_switch(drm_device_t *dev, int old, int new);
|
|
|
|
int drm_context_switch_complete(drm_device_t *dev, int new);
|
|
|
|
|
|
|
|
int drm_ctxbitmap_init(drm_device_t *dev);
|
|
|
|
void drm_ctxbitmap_cleanup(drm_device_t *dev);
|
|
|
|
void drm_ctxbitmap_free(drm_device_t *dev, int ctx_handle);
|
|
|
|
int drm_ctxbitmap_next(drm_device_t *dev);
|
|
|
|
|
|
|
|
/* Locking IOCTL support (drm_lock.c) */
|
|
|
|
int drm_lock_take(__volatile__ unsigned int *lock,
|
2002-01-27 13:05:42 -07:00
|
|
|
unsigned int context);
|
2004-11-05 18:41:47 -07:00
|
|
|
int drm_lock_transfer(drm_device_t *dev,
|
2002-01-27 13:05:42 -07:00
|
|
|
__volatile__ unsigned int *lock,
|
|
|
|
unsigned int context);
|
2004-11-05 18:41:47 -07:00
|
|
|
int drm_lock_free(drm_device_t *dev,
|
2002-01-27 13:05:42 -07:00
|
|
|
__volatile__ unsigned int *lock,
|
|
|
|
unsigned int context);
|
|
|
|
|
2004-11-05 18:41:47 -07:00
|
|
|
/* Buffer management support (drm_bufs.c) */
|
2005-02-05 01:00:14 -07:00
|
|
|
unsigned long drm_get_resource_start(drm_device_t *dev, unsigned int resource);
|
|
|
|
unsigned long drm_get_resource_len(drm_device_t *dev, unsigned int resource);
|
2005-06-28 20:54:19 -06:00
|
|
|
void drm_rmmap(drm_device_t *dev, drm_local_map_t *map);
|
2004-11-05 18:41:47 -07:00
|
|
|
int drm_order(unsigned long size);
|
2005-06-28 20:54:19 -06:00
|
|
|
int drm_addmap(drm_device_t * dev, unsigned long offset, unsigned long size,
|
|
|
|
drm_map_type_t type, drm_map_flags_t flags,
|
|
|
|
drm_local_map_t **map_ptr);
|
|
|
|
int drm_addbufs_pci(drm_device_t *dev, drm_buf_desc_t *request);
|
|
|
|
int drm_addbufs_sg(drm_device_t *dev, drm_buf_desc_t *request);
|
|
|
|
int drm_addbufs_agp(drm_device_t *dev, drm_buf_desc_t *request);
|
2004-11-05 18:41:47 -07:00
|
|
|
|
|
|
|
/* DMA support (drm_dma.c) */
|
|
|
|
int drm_dma_setup(drm_device_t *dev);
|
|
|
|
void drm_dma_takedown(drm_device_t *dev);
|
|
|
|
void drm_free_buffer(drm_device_t *dev, drm_buf_t *buf);
|
2007-07-20 07:39:25 -06:00
|
|
|
void drm_reclaim_buffers(drm_device_t *dev, struct drm_file *file_priv);
|
2005-11-08 13:25:00 -07:00
|
|
|
#define drm_core_reclaim_buffers drm_reclaim_buffers
|
2004-11-05 18:41:47 -07:00
|
|
|
|
|
|
|
/* IRQ support (drm_irq.c) */
|
|
|
|
int drm_irq_install(drm_device_t *dev);
|
|
|
|
int drm_irq_uninstall(drm_device_t *dev);
|
|
|
|
irqreturn_t drm_irq_handler(DRM_IRQ_ARGS);
|
|
|
|
void drm_driver_irq_preinstall(drm_device_t *dev);
|
|
|
|
void drm_driver_irq_postinstall(drm_device_t *dev);
|
|
|
|
void drm_driver_irq_uninstall(drm_device_t *dev);
|
|
|
|
int drm_vblank_wait(drm_device_t *dev, unsigned int *vbl_seq);
|
|
|
|
void drm_vbl_send_signals(drm_device_t *dev);
|
|
|
|
|
2005-07-20 15:17:47 -06:00
|
|
|
/* AGP/PCI Express/GART support (drm_agpsupport.c) */
|
2004-11-05 18:41:47 -07:00
|
|
|
int drm_device_is_agp(drm_device_t *dev);
|
2005-07-20 15:17:47 -06:00
|
|
|
int drm_device_is_pcie(drm_device_t *dev);
|
2004-11-05 18:41:47 -07:00
|
|
|
drm_agp_head_t *drm_agp_init(void);
|
2005-06-28 20:54:19 -06:00
|
|
|
int drm_agp_acquire(drm_device_t *dev);
|
Adds support for PCI cards to MGA DRM
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this
change, the client-side driver no longer needs to map the primary DMA
region or the MMIO region. Previously, end-of-frame waiting was done by
busy waiting in the client-side driver until one of the MMIO registers
(the current DMA pointer) matched a pointer to the end of primary DMA
space. By using interrupts, the busy waiting and the extra mappings are
removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This
allows the kernel to do whatever needs to be done to setup DMA buffers.
The entire process and the locations of the buffers are hidden from
user-mode.
Additionally, a get_param query was added to differentiate between G4x0
cards and G550 cards. A gap was left in the numbering sequence so that,
if needed, G450 cards could be distinguished from G400 cards. According
to Ville Syrjälä, the G4x0 cards and the G550 cards handle
anisotropic filtering differently. This seems the most compatible way
to let the client-side driver know which card it's own. Doing this very
small change now eliminates the need to bump the DRM minor version
twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
A number of ioctl handlers in linux-core were also modified so that they
could be called in-kernel. In these cases, the in-kernel callable
version kept the existing name (e.g., drm_agp_acquire) and the ioctl
handler added _ioctl to the name (e.g., drm_agp_acquire_ioctl).
This patch also replaces the drm_agp_do_release function with
drm_agp_release. drm_agp_release (drm_core_agp_release in the previous
patch) is very similar to drm_agp_do_release, and I saw no reason to
have both.
This commit *breaks the build* on BSD. Eric said that he would make the
required updates to the BSD side soon.
Xorg bug: 3259 Reviewed by: Eric Anholt
2005-06-14 16:34:11 -06:00
|
|
|
int drm_agp_release(drm_device_t *dev);
|
2005-06-28 20:54:19 -06:00
|
|
|
int drm_agp_info(drm_device_t * dev, drm_agp_info_t *info);
|
|
|
|
int drm_agp_enable(drm_device_t *dev, drm_agp_mode_t mode);
|
2004-11-06 04:16:26 -07:00
|
|
|
void *drm_agp_allocate_memory(size_t pages, u32 type);
|
|
|
|
int drm_agp_free_memory(void *handle);
|
|
|
|
int drm_agp_bind_memory(void *handle, off_t start);
|
|
|
|
int drm_agp_unbind_memory(void *handle);
|
2005-11-07 22:29:26 -07:00
|
|
|
int drm_agp_alloc(drm_device_t *dev, drm_agp_buffer_t *request);
|
|
|
|
int drm_agp_free(drm_device_t *dev, drm_agp_buffer_t *request);
|
|
|
|
int drm_agp_bind(drm_device_t *dev, drm_agp_binding_t *request);
|
|
|
|
int drm_agp_unbind(drm_device_t *dev, drm_agp_binding_t *request);
|
2004-11-05 18:41:47 -07:00
|
|
|
|
|
|
|
/* Scatter Gather Support (drm_scatter.c) */
|
|
|
|
void drm_sg_cleanup(drm_sg_mem_t *entry);
|
2007-07-10 18:33:12 -06:00
|
|
|
int drm_sg_alloc(drm_device_t * dev, drm_scatter_gather_t * request);
|
2004-11-05 18:41:47 -07:00
|
|
|
|
2004-11-06 04:16:26 -07:00
|
|
|
#ifdef __FreeBSD__
|
|
|
|
/* sysctl support (drm_sysctl.h) */
|
|
|
|
extern int drm_sysctl_init(drm_device_t *dev);
|
|
|
|
extern int drm_sysctl_cleanup(drm_device_t *dev);
|
|
|
|
#endif /* __FreeBSD__ */
|
|
|
|
|
2004-11-05 18:41:47 -07:00
|
|
|
/* ATI PCIGART support (ati_pcigart.c) */
|
2005-11-07 19:38:01 -07:00
|
|
|
int drm_ati_pcigart_init(drm_device_t *dev,
|
|
|
|
drm_ati_pcigart_info *gart_info);
|
|
|
|
int drm_ati_pcigart_cleanup(drm_device_t *dev,
|
|
|
|
drm_ati_pcigart_info *gart_info);
|
2004-11-05 18:41:47 -07:00
|
|
|
|
|
|
|
/* Locking IOCTL support (drm_drv.c) */
|
2007-07-19 18:11:11 -06:00
|
|
|
int drm_lock(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
|
|
|
int drm_unlock(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
|
|
|
int drm_version(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
|
|
|
int drm_setversion(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
2004-11-05 18:41:47 -07:00
|
|
|
|
|
|
|
/* Misc. IOCTL support (drm_ioctl.c) */
|
2007-07-19 18:11:11 -06:00
|
|
|
int drm_irq_by_busid(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
|
|
|
int drm_getunique(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
|
|
|
int drm_setunique(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
|
|
|
int drm_getmap(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
|
|
|
int drm_getclient(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
|
|
|
int drm_getstats(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
|
|
|
int drm_noop(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
2004-11-05 18:41:47 -07:00
|
|
|
|
|
|
|
/* Context IOCTL support (drm_context.c) */
|
2007-07-19 18:11:11 -06:00
|
|
|
int drm_resctx(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
|
|
|
int drm_addctx(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
|
|
|
int drm_modctx(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
|
|
|
int drm_getctx(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
|
|
|
int drm_switchctx(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
|
|
|
int drm_newctx(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
|
|
|
int drm_rmctx(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
|
|
|
int drm_setsareactx(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
|
|
|
int drm_getsareactx(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
2004-11-05 18:41:47 -07:00
|
|
|
|
|
|
|
/* Drawable IOCTL support (drm_drawable.c) */
|
2007-07-19 18:11:11 -06:00
|
|
|
int drm_adddraw(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
|
|
|
int drm_rmdraw(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
|
|
|
int drm_update_draw(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
2007-07-18 15:22:40 -06:00
|
|
|
struct drm_drawable_info *drm_get_drawable_info(drm_device_t *dev, int handle);
|
2004-11-05 18:41:47 -07:00
|
|
|
|
|
|
|
/* Authentication IOCTL support (drm_auth.c) */
|
2007-07-19 18:11:11 -06:00
|
|
|
int drm_getmagic(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
|
|
|
int drm_authmagic(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
2004-11-05 18:41:47 -07:00
|
|
|
|
|
|
|
/* Buffer management support (drm_bufs.c) */
|
2007-07-19 18:11:11 -06:00
|
|
|
int drm_addmap_ioctl(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
|
|
|
int drm_rmmap_ioctl(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
|
|
|
int drm_addbufs_ioctl(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
|
|
|
int drm_infobufs(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
|
|
|
int drm_markbufs(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
|
|
|
int drm_freebufs(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
|
|
|
int drm_mapbufs(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
2004-11-05 18:41:47 -07:00
|
|
|
|
2004-11-06 14:18:49 -07:00
|
|
|
/* DMA support (drm_dma.c) */
|
2007-07-19 18:11:11 -06:00
|
|
|
int drm_dma(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
2004-11-06 14:18:49 -07:00
|
|
|
|
2004-11-05 18:41:47 -07:00
|
|
|
/* IRQ support (drm_irq.c) */
|
2007-07-19 18:11:11 -06:00
|
|
|
int drm_control(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
|
|
|
int drm_wait_vblank(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
2007-07-19 07:46:13 -06:00
|
|
|
void drm_locked_tasklet(drm_device_t *dev,
|
|
|
|
void (*tasklet)(drm_device_t *dev));
|
2004-11-05 18:41:47 -07:00
|
|
|
|
|
|
|
/* AGP/GART support (drm_agpsupport.c) */
|
2007-07-19 18:11:11 -06:00
|
|
|
int drm_agp_acquire_ioctl(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
|
|
|
int drm_agp_release_ioctl(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
|
|
|
int drm_agp_enable_ioctl(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
|
|
|
int drm_agp_info_ioctl(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
|
|
|
int drm_agp_alloc_ioctl(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
|
|
|
int drm_agp_free_ioctl(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
|
|
|
int drm_agp_unbind_ioctl(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
|
|
|
int drm_agp_bind_ioctl(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
2004-11-05 18:41:47 -07:00
|
|
|
|
|
|
|
/* Scatter Gather Support (drm_scatter.c) */
|
2007-07-19 18:11:11 -06:00
|
|
|
int drm_sg_alloc_ioctl(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
|
|
|
int drm_sg_free(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
2004-11-05 18:41:47 -07:00
|
|
|
|
|
|
|
/* consistent PCI memory functions (drm_pci.c) */
|
2005-04-25 23:19:11 -06:00
|
|
|
drm_dma_handle_t *drm_pci_alloc(drm_device_t *dev, size_t size, size_t align,
|
|
|
|
dma_addr_t maxaddr);
|
|
|
|
void drm_pci_free(drm_device_t *dev, drm_dma_handle_t *dmah);
|
2003-03-28 20:38:47 -07:00
|
|
|
|
2004-08-17 07:10:05 -06:00
|
|
|
/* Inline replacements for DRM_IOREMAP macros */
|
|
|
|
static __inline__ void drm_core_ioremap(struct drm_local_map *map, struct drm_device *dev)
|
|
|
|
{
|
2004-11-05 18:41:47 -07:00
|
|
|
map->handle = drm_ioremap(dev, map);
|
2004-08-17 07:10:05 -06:00
|
|
|
}
|
|
|
|
static __inline__ void drm_core_ioremapfree(struct drm_local_map *map, struct drm_device *dev)
|
|
|
|
{
|
|
|
|
if ( map->handle && map->size )
|
2004-11-05 18:41:47 -07:00
|
|
|
drm_ioremapfree(map);
|
2004-08-17 07:10:05 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
static __inline__ struct drm_local_map *drm_core_findmap(struct drm_device *dev, unsigned long offset)
|
|
|
|
{
|
2005-02-05 01:00:14 -07:00
|
|
|
drm_local_map_t *map;
|
|
|
|
|
|
|
|
DRM_SPINLOCK_ASSERT(&dev->dev_lock);
|
|
|
|
TAILQ_FOREACH(map, &dev->maplist, link) {
|
|
|
|
if (map->offset == offset)
|
|
|
|
return map;
|
2004-08-17 07:10:05 -06:00
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static __inline__ void drm_core_dropmap(struct drm_map *map)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2002-01-27 13:05:42 -07:00
|
|
|
#endif /* __KERNEL__ */
|
2002-07-05 02:31:11 -06:00
|
|
|
#endif /* _DRM_P_H_ */
|