summaryrefslogtreecommitdiff
path: root/libdrm/xf86drm.c
AgeCommit message (Collapse)Author
2006-02-20Formatting cleanup, dead code removal. Remove N() namespacing macro,Adam Jackson
useless. Remove SIGIO handling functions as they're server-only and properly belong in libdri.
2005-12-31Initialize sv.drm_dd_minor to "don't care" along with dd_major, to appeaseEric Anholt
valgrind.
2005-11-30Resync from Xorg head: conditional include of xorg-config.hAdam Jackson
2005-11-30Resync from Xorg head (Bug #3815, GNU/kFreeBSD hack)Adam Jackson
2005-11-29Remove redundant #ifdef stanzaAdam Jackson
2005-11-29Error checking for drmStrdup (Tilman Sauerbeck)Adam Jackson
2005-11-29fixup xf86drm.c for new headersDave Airlie
2005-10-20Remove bogus Xlib dependency.Adam Jackson
2005-04-04mirror changes made in main tree.. just happened to be doing this myselfDave Airlie
2004-08-11Bug #979: Don't include <sys/sysmacros.h> on linux, it occasionally emitsAdam Jackson
makedev() as a function call that elfloader can't resolve. Originally Gentoo Bug #41962, reported by Ryan Breen, fix feedback from Ryan Lortie.
2004-07-07Make drm/libdrm/xf86drm.c matchJon Smirl
xc/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c so that it matches the prototypes in xf86drm.h XFree86 bug: Reported by: Submitted by: Reviewed by: Obtained from:
2003-10-23- Introduce a new ioctl, DRM_IOCTL_SET_VERSION. This ioctl allows theEric Anholt
server or client to notify the DRM that it expects a certain version of the device dependent or device independent interface. If the major doesn't match or minor is too large, EINVAL is returned. A major of -1 means that the requestor doesn't care about that portion of the interface. The ioctl returns the actual versions in the same struct. - Introduce DRM DI interface version 1.1. If the server requests version 1.1, then the DRM sets the unique itself according to the busid of the device it probed, which may then be accessed as normal using getunique. - Request version 1.1 in libdrm's drmOpenByBusID, allowing the X Server to request based on a BusID. Introduce a wrapper for DRM_IOCTL_SET_VERSION and bump libdrm minor version. - Pass the busid in DRIScreenInit if libdrm can handle both a busid and name. This allows drmOpenByBusID to be used to find the DRM instead of just the driver name, which allows us in the future to tie a DRM more strongly to the device it probed to. Introduce a function DRICreatePCIBusID which creates a busid in the form pci:oooo:bb:dd.f similar to linux's pci_name() function. This matches the format used by the DRM in version 1.1. libdrm knows how to match both this format and the old PCI:b:d:f format. - Use the new DRICreatePCIBusID function in the *_dri.c to request the new, more exact busid format.
2003-09-24post merge fixAlan Hourihane
2003-09-12linux drm fixesAlan Hourihane
2003-05-27Merged DRM documentation.Jose Fonseca
2003-04-23deal correctly with read() from the DRM failingMichel Daenzer
2003-03-25linux merge for drmAlan Hourihane
2003-02-21Merge from bsd-4-0-0-branch.Eric Anholt
2003-02-02don't inflate relative vblank sequence numbers on repeated calls (e.g. whenMichel Daenzer
interrupted by a signal)
2002-11-25added missing return fd (Alexander Stohr)Brian Paul
2002-10-22final part of XFree86 4.2.99.2 mergeAlan Hourihane
2002-09-25common ioctl to wait for vertical blank IRQsMichel Daenzer
2002-08-08Try to open the /dev/dri/cardX device once, then only if it fails check theEric Anholt
device number and recreate it if necessary. Fixes xf86drm.c to allow linux binaries to be used for emulation on FreeBSD.
2002-07-05merged bsd-3-0-0-branchAlan Hourihane
2002-04-09Merged drmcommand-0-0-1Jens Owen
2002-01-27First pass merge of XFree86 4.2.0 import.David Dawes
2001-08-25- Remove the rest of the unneeded client-side libraries.David Dawes
- Use installed libraries that are not built here. - Don't build/install client-library related file and headers.
2001-08-22First part of XFree86 4.1.99.1 merge.David Dawes
2001-07-30Merge the multihead-1-0-0 branch into the trunk, with the exception of theDavid Dawes
glide header files. The changes include: - Brian Paul's changes to the tdfx client-side 3D driver to make it dlopen() the correct glide library (Voodoo3 or Voodoo5). This allows both types of the glide library to co-exist, and allows Voodoo3/Voodoo5 cards to be mixed in multi-head configs. - DRM kernel driver changes to allow a driver to set up multiple instances (minor numbers), one for each card present that the driver supports. This is currently implemented and tested only for the tdfx DRM driver. - Add some missing missing <stdarg.h> includes. - Some log message cleanups. - Change the 2D tdfx driver to access VGA legacy registers via their PCI I/O space access points rather than their legacy addresses, and fix some problems with the way the VGA-related bits are initialised. Status: - With these changes, multi-head direct rendering works with multiple Voodoo3 and/or Voodoo5 cards. This has been tested with two PCI Voodoo3 cards and an AGP Voodoo5 card, and all permutations of those. Caveats: - Xinerama is not supported. If Xinerama is enabled, then direct rendering gets disabled. - The text mode on secondary screens will show junk after the X server exits. - On some hardware, starting the X server on multiple 3dfx cards will result in a hard lockup. One workaround is to enable APIC support in a uni-processor kernel, or use an SMP kernel.
2001-07-20Remove module name hacks because we aren't going to implement this anymoreJeff Hartmann
because of Linus' comments
2001-07-18Add module version name at a lower layer of the code, allows things to beJeff Hartmann
more flexible and allow older module versions to still work. Might not be final code if we move over to DRI kernel module version, but will be if we use XFree86 version. + Only build tdfx.o instead of tdfx-4_1_0.o since tdfx.o has never changed its API.
2001-06-14First pass of 4.1.0 merge.David Dawes
2001-05-14finish struct stat type cleanup Fix a build dependencies for the tdfx drmDavid Dawes
module
2001-05-04add some commented enclosures around the BUS_BASE calls for AlphaAlan Hourihane
platforms.
2001-05-01Initial merge for XFree86 4.0.99.3 importDavid Dawes
2001-04-30- PCIGART patches for Alpha from CompaqKevin E Martin
2001-04-18put back BUS_BASEDavid Dawes
2001-04-09First pass of XFree86 4.0.99.2 merge.David Dawes
2001-04-05Merged ati-pcigart-1-0-0Kevin E Martin
2001-03-30- Move xf86ConfigDRI declaration from xf86Priv.h to xf86.h.David Dawes
- Don't include xf86Priv.h in the drm module. - Fix 'struct stat' in loader libc wrapping to avoid unnecessary XFree86LOADER #ifdefs in code that uses it. - Make drmOpenMinor() static.
2001-03-14Merged sarea-1-0-0Kevin E Martin
2001-02-28Implement drmOpen* without /proc dependence (Fallback to /proc is includedRik Faith
for backward compatibility.) Move statistic-gathering drm* calls from dristat.c to xf86drm.c
2001-02-15Merge mga-1-0-0-branch into trunk.Gareth Hughes
2000-11-08merge with 4.0.1dDavid Dawes
2000-09-24commit xfree86 4.0.1d-pre updateAlan Hourihane
2000-09-07Merged tdfx-2-1-branchAlan Hourihane
2000-08-16first part of 4.0.1b mergeDavid Dawes
2000-07-11Merge XFree86 4.0.1Alan Hourihane
2000-06-08Merged glxmisc-3-0-0Brian Paul
2000-05-18Merged ati-4-0-1Kevin E Martin
s="hl kwb">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 */ /* KW: Actually it's illegal to change either for * backwards-compatibility reasons. */ 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; 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_SCATTER_GATHER = 4 /* Scatter/gather memory for PCI DMA */ } 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_REMOVABLE = 0x40 /* Removable mapping */ } drm_map_flags_t; typedef struct drm_ctx_priv_map { unsigned int ctx_id; /* Context requesting private mapping */ void *handle; /* Handle of map */ } drm_ctx_priv_map_t; typedef struct drm_map { 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 */ _DRM_SG_BUFFER = 0x04 /* Scatter/gather memory buffer */ } 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 enum { _DRM_VBLANK_ABSOLUTE = 0x0, /* Wait for specific vblank sequence number */ _DRM_VBLANK_RELATIVE = 0x1, /* Wait for given number of vblanks */ _DRM_VBLANK_SIGNAL = 0x40000000 /* Send signal instead of blocking */ } drm_vblank_seq_type_t; #define _DRM_VBLANK_FLAGS_MASK _DRM_VBLANK_SIGNAL struct drm_wait_vblank_request { drm_vblank_seq_type_t type; unsigned int sequence; unsigned long signal; }; struct drm_wait_vblank_reply { drm_vblank_seq_type_t type; unsigned int sequence; long tval_sec; long tval_usec; }; typedef union drm_wait_vblank { struct drm_wait_vblank_request request; struct drm_wait_vblank_reply reply; } drm_wait_vblank_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 */ typedef struct drm_agp_binding { unsigned long handle; /* From drm_agp_buffer */ unsigned long offset; /* In bytes -- will round to page boundary */ } drm_agp_binding_t; typedef struct drm_agp_info { int agp_version_major; int agp_version_minor; unsigned long mode; unsigned long aperture_base; /* physical address */ unsigned long aperture_size; /* bytes */ unsigned long memory_allowed; /* bytes */ unsigned long memory_used; /* PCI information */ unsigned short id_vendor; unsigned short id_device; } drm_agp_info_t; typedef struct drm_scatter_gather { unsigned long size; /* In bytes -- will round to page boundary */ unsigned long handle; /* Used for mapping / unmapping */ } drm_scatter_gather_t; #define DRM_IOCTL_BASE 'd' #define DRM_IO(nr) _IO(DRM_IOCTL_BASE,nr) #define DRM_IOR(nr,type) _IOR(DRM_IOCTL_BASE,nr,type) #define DRM_IOW(nr,type) _IOW(DRM_IOCTL_BASE,nr,type) #define DRM_IOWR(nr,type) _IOWR(DRM_IOCTL_BASE,nr,type) #define DRM_IOCTL_VERSION DRM_IOWR(0x00, drm_version_t) #define DRM_IOCTL_GET_UNIQUE DRM_IOWR(0x01, drm_unique_t) #define DRM_IOCTL_GET_MAGIC DRM_IOR( 0x02, drm_auth_t) #define DRM_IOCTL_IRQ_BUSID DRM_IOWR(0x03, drm_irq_busid_t) #define DRM_IOCTL_GET_MAP DRM_IOWR(0x04, drm_map_t) #define DRM_IOCTL_GET_CLIENT DRM_IOWR(0x05, drm_client_t) #define DRM_IOCTL_GET_STATS DRM_IOR( 0x06, drm_stats_t) #define DRM_IOCTL_SET_UNIQUE DRM_IOW( 0x10, drm_unique_t) #define DRM_IOCTL_AUTH_MAGIC DRM_IOW( 0x11, drm_auth_t) #define DRM_IOCTL_BLOCK DRM_IOWR(0x12, drm_block_t) #define DRM_IOCTL_UNBLOCK DRM_IOWR(0x13, drm_block_t) #define DRM_IOCTL_CONTROL DRM_IOW( 0x14, drm_control_t) #define DRM_IOCTL_ADD_MAP DRM_IOWR(0x15, drm_map_t) #define DRM_IOCTL_ADD_BUFS DRM_IOWR(0x16, drm_buf_desc_t) #define DRM_IOCTL_MARK_BUFS DRM_IOW( 0x17, drm_buf_desc_t) #define DRM_IOCTL_INFO_BUFS DRM_IOWR(0x18, drm_buf_info_t) #define DRM_IOCTL_MAP_BUFS DRM_IOWR(0x19, drm_buf_map_t) #define DRM_IOCTL_FREE_BUFS DRM_IOW( 0x1a, drm_buf_free_t) #define DRM_IOCTL_RM_MAP DRM_IOW( 0x1b, drm_map_t) #define DRM_IOCTL_SET_SAREA_CTX DRM_IOW( 0x1c, drm_ctx_priv_map_t) #define DRM_IOCTL_GET_SAREA_CTX DRM_IOWR(0x1d, drm_ctx_priv_map_t) #define DRM_IOCTL_ADD_CTX DRM_IOWR(0x20, drm_ctx_t) #define DRM_IOCTL_RM_CTX DRM_IOWR(0x21, drm_ctx_t) #define DRM_IOCTL_MOD_CTX DRM_IOW( 0x22, drm_ctx_t) #define DRM_IOCTL_GET_CTX DRM_IOWR(0x23, drm_ctx_t) #define DRM_IOCTL_SWITCH_CTX DRM_IOW( 0x24, drm_ctx_t) #define DRM_IOCTL_NEW_CTX DRM_IOW( 0x25, drm_ctx_t) #define DRM_IOCTL_RES_CTX DRM_IOWR(0x26, drm_ctx_res_t) #define DRM_IOCTL_ADD_DRAW DRM_IOWR(0x27, drm_draw_t) #define DRM_IOCTL_RM_DRAW DRM_IOWR(0x28, drm_draw_t) #define DRM_IOCTL_DMA DRM_IOWR(0x29, drm_dma_t) #define DRM_IOCTL_LOCK DRM_IOW( 0x2a, drm_lock_t) #define DRM_IOCTL_UNLOCK DRM_IOW( 0x2b, drm_lock_t) #define DRM_IOCTL_FINISH DRM_IOW( 0x2c, drm_lock_t) #define DRM_IOCTL_AGP_ACQUIRE DRM_IO( 0x30) #define DRM_IOCTL_AGP_RELEASE DRM_IO( 0x31) #define DRM_IOCTL_AGP_ENABLE DRM_IOW( 0x32, drm_agp_mode_t) #define DRM_IOCTL_AGP_INFO DRM_IOR( 0x33, drm_agp_info_t) #define DRM_IOCTL_AGP_ALLOC DRM_IOWR(0x34, drm_agp_buffer_t) #define DRM_IOCTL_AGP_FREE DRM_IOW( 0x35, drm_agp_buffer_t) #define DRM_IOCTL_AGP_BIND DRM_IOW( 0x36, drm_agp_binding_t) #define DRM_IOCTL_AGP_UNBIND DRM_IOW( 0x37, drm_agp_binding_t) #define DRM_IOCTL_SG_ALLOC DRM_IOW( 0x38, drm_scatter_gather_t) #define DRM_IOCTL_SG_FREE DRM_IOW( 0x39, drm_scatter_gather_t) #define DRM_IOCTL_WAIT_VBLANK DRM_IOWR(0x3a, drm_wait_vblank_t) /* Device specfic ioctls should only be in their respective headers * The device specific ioctl range is 0x40 to 0x79. */ #define DRM_COMMAND_BASE 0x40 #endif