summaryrefslogtreecommitdiff
AgeCommit message (Expand)Author
2005-02-10add support for texture micro tiling on radeon/r200. Add support for r100Roland Scheidegger
2005-02-10Stephane's port of Eric's race fixKeith Whitwell
2005-02-08fix incorrect PCI id for ATI radeonRoland Scheidegger
2005-02-08Close a race which could allow for privilege escalation by users with DRIEric Anholt
2005-02-07Invalid bound check of driver defined ioctls in drm_ioctlDave Airlie
2005-02-07Cast user data to correct type in radeon_surface_free's copyin.Roland Scheidegger
2005-02-07change DRIVER_ to CORE_ makes things look nicer, also change it so theDave Airlie
2005-02-07fix agp detection on linuxDave Airlie
2005-02-07Restore a debugging message to DRM_DEBUG instead of DRM_ERROR.Eric Anholt
2005-02-07Remove some annoying trailing whitespace.Eric Anholt
2005-02-05- Implement drm_initmap, and extend it with the resource number to helpEric Anholt
2005-02-03Via driver: Add missing drm_poll function to via driver in core.Thomas Hellstrom
2005-02-03Declare r128_do_cleanup_pageflip static since it's only used here and itsEric Anholt
2005-02-03Cast user data to correct type in radeon_surface_free's copyin.Eric Anholt
2005-02-01momentary revert. libdrm build may be broken now, but no one uses it yet...Adam Jackson
2005-02-01cleanup patch from Adrian Bunk <bunk@stusta.de>Dave Airlie
2005-02-01make functions static in i915, remove unused functionsDave Airlie
2005-02-01update i830 similiar to the kernel, add staticsDave Airlie
2005-02-01make more functions static in i810 and fix pageflip cleanupDave Airlie
2005-01-30Final pass of libdrm.so work:Adam Jackson
2005-01-29fix radeon drvDave Airlie
2005-01-27Fixed multiple devices DMA bug. Fixed PCI path FIRE command detectionThomas Hellstrom
2005-01-27fix incorrect PCI id for ATI radeonDave Airlie
2005-01-26(Stephane Marchesin,me) Add radeon framebuffer tiling support to radeonRoland Scheidegger
2005-01-26replace magic number with macro constant RADEON_ZBLOCK16Roland Scheidegger
2005-01-24use libdrm after it was updatedDave Airlie
2005-01-24hopefully fix drm_core setversion ioctl... pointed out by Eric on ircDave Airlie
2005-01-22Add drm.h to the install target.Adam Jackson
2005-01-20Removed one bogus Savage3D PCI ID. Corrected another one. RestoredFelix Kuehling
2005-01-20Add a Savage3D PCI IDAdam Jackson
2005-01-20Corrected some confusion of vb_stride and vtx_sizeFelix Kuehling
2005-01-19Fix cut & paste problemAlan Hourihane
2005-01-19Fix a cut & paste problemAlan Hourihane
2005-01-17Some code commenting concerning the FIFO & DMA engine.Jose Fonseca
2005-01-17Add detection of whether the device is AGP by walking the capabilitiesEric Anholt
2005-01-17Add xf86drm.h to the install target.Adam Jackson
2005-01-16Shared libdrm work:Adam Jackson
2005-01-16remove duplicate drm_sysfs.oDave Airlie
2005-01-16This table is in radeon_drv.h along with the version number so remove itDave Airlie
2005-01-16The patch makes drmAddBufs/drmMapBufs can handle buffers in video memoryDave Airlie
2005-01-16Fixed a bug that prevented the driver from ever emitting triangle strips orFelix Kuehling
2005-01-15Setup MTRRs for frame buffer and aperture manually on Savage3D andFelix Kuehling
2005-01-13due to backways compat crap for IRQ_HANDLED etc.. this wouldn't build onDave Airlie
2005-01-12Use virt_to_page instead of vmalloc_to_page in drm_do_vm_shm_nopage forFelix Kuehling
2005-01-11Import Thomas' changes upto 2.4.3 to shared. Small tweak to install target.Keith Whitwell
2005-01-11import Thomas' shared-core via changes up to 2.4.1Keith Whitwell
2005-01-10Only try to find the agp_buffer_map if dma_type is AGP. This is all that'sFelix Kuehling
2005-01-09Improved workaround for Savage3D DMA lockup to emit NOPs only before theFelix Kuehling
2005-01-09Adjust 4 level page check for <= 2.6.10Jon Smirl
2005-01-08Fixed off-by-one error in savage_bci_wait_fifo_shadow.Felix Kuehling
n372'>372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458
/* drm.h -- Header for Direct Rendering Manager -*- linux-c -*-
 * Created: Mon Jan  4 10:05:05 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.
 *
 * Authors:
 *    Rickard E. (Rik) Faith <faith@valinux.com>
 *
 * Acknowledgements:
 * Dec 1999, Richard Henderson <rth@twiddle.net>, move to generic cmpxchg.
 *
 */

#ifndef _DRM_H_
#define _DRM_H_

#include <linux/config.h>
#if defined(__linux__)
#include <asm/ioctl.h>		/* For _IO* macros */
#define DRM_IOCTL_NR(n)	     _IOC_NR(n)
#elif defined(__FreeBSD__)
#include <sys/ioccom.h>
#define DRM_IOCTL_NR(n)	     ((n) & 0xff)
#endif

#define DRM_MAJOR       226
#define DRM_MAX_MINOR   15
#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_LOCK_HELD	0x80000000 /* Hardware lock is held		    */
#define _DRM_LOCK_CONT	0x40000000 /* Hardware lock is contended	    */
#define _DRM_LOCK_IS_HELD(lock)	   ((lock) & _DRM_LOCK_HELD)
#define _DRM_LOCK_IS_CONT(lock)	   ((lock) & _DRM_LOCK_CONT)
#define _DRM_LOCKING_CONTEXT(lock) ((lock) & ~(_DRM_LOCK_HELD|_DRM_LOCK_CONT))

typedef unsigned long drm_handle_t;
typedef unsigned int  drm_context_t;
typedef unsigned int  drm_drawable_t;
typedef unsigned int  drm_magic_t;

/* Warning: If you change this structure, make sure you change
 * XF86DRIClipRectRec in the server as well */

typedef struct drm_clip_rect {
	unsigned short	x1;
	unsigned short	y1;
	unsigned short	x2;
	unsigned short	y2;
} drm_clip_rect_t;

typedef struct drm_tex_region {
	unsigned char	next;
	unsigned char	prev;
	unsigned char	in_use;
	unsigned char	padding;
	unsigned int	age;
} drm_tex_region_t;

/* Seperate include files for the i810/mga/r128 specific structures */
#include "mga_drm.h"
#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			    */
	int    version_minor;	  /* Minor version			    */
	int    version_patchlevel;/* Patch level			    */
	size_t name_len;	  /* Length of name buffer		    */
	char   *name;		  /* Name of driver			    */
	size_t date_len;	  /* Length of date buffer		    */
	char   *date;		  /* User-space buffer to hold date	    */
	size_t desc_len;	  /* Length of desc buffer		    */
	char   *desc;		  /* User-space buffer to hold desc	    */
} drm_version_t;

typedef struct drm_unique {
	size_t unique_len;	  /* Length of unique			    */
	char   *unique;		  /* Unique name for driver instantiation   */
} drm_unique_t;

typedef struct drm_list {
	int		 count;	  /* Length of user-space structures	    */
	drm_version_t	 *version;
} drm_list_t;

typedef struct drm_block {
	int		 unused;
} drm_block_t;

typedef struct drm_control {
	enum {
		DRM_ADD_COMMAND,
		DRM_RM_COMMAND,
		DRM_INST_HANDLER,
		DRM_UNINST_HANDLER
	}		 func;
	int		 irq;
} drm_control_t;

typedef enum drm_map_type {
	_DRM_FRAME_BUFFER = 0,	  /* WC (no caching), no core dump	    */
	_DRM_REGISTERS	  = 1,	  /* no caching, no core dump		    */
	_DRM_SHM	  = 2,	  /* shared, cached			    */
	_DRM_AGP          = 3	  /* AGP/GART                               */
} drm_map_type_t;

typedef enum drm_map_flags {
	_DRM_RESTRICTED	     = 0x01, /* Cannot be mapped to user-virtual    */
	_DRM_READ_ONLY	     = 0x02,
	_DRM_LOCKED	     = 0x04, /* shared, cached, locked		    */
	_DRM_KERNEL	     = 0x08, /* kernel requires access		    */
	_DRM_WRITE_COMBINING = 0x10, /* use write-combining if available    */
	_DRM_CONTAINS_LOCK   = 0x20  /* SHM page that contains lock	    */
} drm_map_flags_t;

typedef struct drm_map {
	unsigned long	offset;	 /* Requested physical address (0 for SAREA)*/
	unsigned long	size;	 /* Requested physical size (bytes)	    */
	drm_map_type_t	type;	 /* Type of memory to map		    */
	drm_map_flags_t flags;	 /* Flags				    */
	void		*handle; /* User-space: "Handle" to pass to mmap    */
				 /* Kernel-space: kernel-virtual address    */
	int		mtrr;	 /* MTRR slot used			    */
				 /* Private data			    */
} drm_map_t;

typedef struct drm_client {
	int		idx;	/* Which client desired?                    */
	int		auth;	/* Is client authenticated?                 */
	unsigned long	pid;	/* Process id                               */
	unsigned long	uid;	/* User id                                  */
	unsigned long	magic;	/* Magic                                    */
	unsigned long	iocs;	/* Ioctl count                              */
} drm_client_t;

typedef enum {
	_DRM_STAT_LOCK,
	_DRM_STAT_OPENS,
	_DRM_STAT_CLOSES,
	_DRM_STAT_IOCTLS,
	_DRM_STAT_LOCKS,
	_DRM_STAT_UNLOCKS,
	_DRM_STAT_VALUE,	/* Generic value                      */
	_DRM_STAT_BYTE,		/* Generic byte counter (1024bytes/K) */
	_DRM_STAT_COUNT,	/* Generic non-byte counter (1000/k)  */

	_DRM_STAT_IRQ,		/* IRQ */
	_DRM_STAT_PRIMARY,	/* Primary DMA bytes */
	_DRM_STAT_SECONDARY,	/* Secondary DMA bytes */
	_DRM_STAT_DMA,		/* DMA */
	_DRM_STAT_SPECIAL,	/* Special DMA (e.g., priority or polled) */
	_DRM_STAT_MISSED	/* Missed DMA opportunity */

				/* Add to the *END* of the list */
} drm_stat_type_t;

typedef struct drm_stats {
	unsigned long count;
	struct {
		unsigned long   value;
		drm_stat_type_t type;
	} data[15];
} drm_stats_t;

typedef enum drm_lock_flags {
	_DRM_LOCK_READY	     = 0x01, /* Wait until hardware is ready for DMA */
	_DRM_LOCK_QUIESCENT  = 0x02, /* Wait until hardware quiescent	     */
	_DRM_LOCK_FLUSH	     = 0x04, /* Flush this context's DMA queue first */
	_DRM_LOCK_FLUSH_ALL  = 0x08, /* Flush all DMA queues first	     */
				/* These *HALT* flags aren't supported yet
				   -- they will be used to support the
				   full-screen DGA-like mode. */
	_DRM_HALT_ALL_QUEUES = 0x10, /* Halt all current and future queues   */
	_DRM_HALT_CUR_QUEUES = 0x20  /* Halt all current queues		     */
} drm_lock_flags_t;

typedef struct drm_lock {
	int		 context;
	drm_lock_flags_t flags;
} drm_lock_t;

typedef enum drm_dma_flags {	      /* These values *MUST* match xf86drm.h */
				      /* Flags for DMA buffer dispatch	     */
	_DRM_DMA_BLOCK	      = 0x01, /* Block until buffer dispatched.
					 Note, the buffer may not yet have
					 been processed by the hardware --
					 getting a hardware lock with the
					 hardware quiescent will ensure
					 that the buffer has been
					 processed.			     */
	_DRM_DMA_WHILE_LOCKED = 0x02, /* Dispatch while lock held	     */
	_DRM_DMA_PRIORITY     = 0x04, /* High priority dispatch		     */

				      /* Flags for DMA buffer request	     */
	_DRM_DMA_WAIT	      = 0x10, /* Wait for free buffers		     */
	_DRM_DMA_SMALLER_OK   = 0x20, /* Smaller-than-requested buffers ok   */
	_DRM_DMA_LARGER_OK    = 0x40  /* Larger-than-requested buffers ok    */
} drm_dma_flags_t;

typedef struct drm_buf_desc {
	int	      count;	 /* Number of buffers of this size	     */
	int	      size;	 /* Size in bytes			     */
	int	      low_mark;	 /* Low water mark			     */
	int	      high_mark; /* High water mark			     */
	enum {
		_DRM_PAGE_ALIGN = 0x01, /* Align on page boundaries for DMA  */
		_DRM_AGP_BUFFER = 0x02  /* Buffer is in agp space            */
	}	      flags;
	unsigned long agp_start; /* Start address of where the agp buffers
				  * are in the agp aperture */
} drm_buf_desc_t;

typedef struct drm_buf_info {
	int	       count;	/* Entries in list			     */
	drm_buf_desc_t *list;
} drm_buf_info_t;

typedef struct drm_buf_free {
	int	       count;
	int	       *list;
} drm_buf_free_t;

typedef struct drm_buf_pub {
	int		  idx;	       /* Index into master buflist	     */
	int		  total;       /* Buffer size			     */
	int		  used;	       /* Amount of buffer in use (for DMA)  */
	void		  *address;    /* Address of buffer		     */
} drm_buf_pub_t;

typedef struct drm_buf_map {
	int	      count;	/* Length of buflist			    */
	void	      *virtual;	/* Mmaped area in user-virtual		    */
	drm_buf_pub_t *list;	/* Buffer information			    */
} drm_buf_map_t;

typedef struct drm_dma {
				/* Indices here refer to the offset into
				   buflist in drm_buf_get_t.  */
	int		context;	  /* Context handle		    */
	int		send_count;	  /* Number of buffers to send	    */
	int		*send_indices;	  /* List of handles to buffers	    */
	int		*send_sizes;	  /* Lengths of data to send	    */
	drm_dma_flags_t flags;		  /* Flags			    */
	int		request_count;	  /* Number of buffers requested    */
	int		request_size;	  /* Desired size for buffers	    */
	int		*request_indices; /* Buffer information		    */
	int		*request_sizes;
	int		granted_count;	  /* Number of buffers granted	    */
} drm_dma_t;

typedef enum {
	_DRM_CONTEXT_PRESERVED = 0x01,
	_DRM_CONTEXT_2DONLY    = 0x02
} drm_ctx_flags_t;

typedef struct drm_ctx {
	drm_context_t	handle;
	drm_ctx_flags_t flags;
} drm_ctx_t;

typedef struct drm_ctx_res {
	int		count;
	drm_ctx_t	*contexts;
} drm_ctx_res_t;

typedef struct drm_draw {
	drm_drawable_t	handle;
} drm_draw_t;

typedef struct drm_auth {
	drm_magic_t	magic;
} drm_auth_t;

typedef struct drm_irq_busid {
	int irq;
	int busnum;
	int devnum;
	int funcnum;
} drm_irq_busid_t;

typedef struct drm_agp_mode {
	unsigned long mode;
} drm_agp_mode_t;

				/* For drm_agp_alloc -- allocated a buffer */
typedef struct drm_agp_buffer {
	unsigned long size;	/* In bytes -- will round to page boundary */
	unsigned long handle;	/* Used for BIND/UNBIND ioctls */
	unsigned long type;     /* Type of memory to allocate  */
        unsigned long physical; /* Physical used by i810       */
} drm_agp_buffer_t;

				/* For drm_agp_bind */