i810_drv.h
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:8k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

  1. /* i810_drv.h -- Private header for the Matrox g200/g400 driver -*- linux-c -*-
  2.  * Created: Mon Dec 13 01:50:01 1999 by jhartmann@precisioninsight.com
  3.  *
  4.  * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
  5.  * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
  6.  * All rights reserved.
  7.  *
  8.  * Permission is hereby granted, free of charge, to any person obtaining a
  9.  * copy of this software and associated documentation files (the "Software"),
  10.  * to deal in the Software without restriction, including without limitation
  11.  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  12.  * and/or sell copies of the Software, and to permit persons to whom the
  13.  * Software is furnished to do so, subject to the following conditions:
  14.  * 
  15.  * The above copyright notice and this permission notice (including the next
  16.  * paragraph) shall be included in all copies or substantial portions of the
  17.  * Software.
  18.  * 
  19.  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  20.  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  21.  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
  22.  * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
  23.  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  24.  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  25.  * DEALINGS IN THE SOFTWARE.
  26.  *
  27.  * Authors: Rickard E. (Rik) Faith <faith@valinux.com>
  28.  *      Jeff Hartmann <jhartmann@valinux.com>
  29.  *
  30.  */
  31. #ifndef _I810_DRV_H_
  32. #define _I810_DRV_H_
  33. typedef struct drm_i810_buf_priv {
  34.     u32 *in_use;
  35.     int my_use_idx;
  36. int currently_mapped;
  37. void *virtual;
  38. void *kernel_virtual;
  39. int map_count;
  40.     struct vm_area_struct *vma;
  41. } drm_i810_buf_priv_t;
  42. typedef struct _drm_i810_ring_buffer{
  43. int tail_mask;
  44. unsigned long Start;
  45. unsigned long End;
  46. unsigned long Size;
  47. u8 *virtual_start;
  48. int head;
  49. int tail;
  50. int space;
  51. } drm_i810_ring_buffer_t;
  52. typedef struct drm_i810_private {
  53.     int ring_map_idx;
  54.     int buffer_map_idx;
  55.     drm_i810_ring_buffer_t ring;
  56. drm_i810_sarea_t *sarea_priv;
  57.        unsigned long hw_status_page;
  58.     unsigned long counter;
  59.     atomic_t flush_done;
  60.     wait_queue_head_t flush_queue; /* Processes waiting until flush    */
  61. drm_buf_t *mmap_buffer;
  62. u32 front_di1, back_di1, zi1;
  63. int back_offset;
  64. int depth_offset;
  65. int w, h;
  66. int pitch;
  67. } drm_i810_private_t;
  68. /* i810_drv.c */
  69. extern int  i810_version(struct inode *inode, struct file *filp,
  70.   unsigned int cmd, unsigned long arg);
  71. extern int  i810_open(struct inode *inode, struct file *filp);
  72. extern int  i810_release(struct inode *inode, struct file *filp);
  73. extern int  i810_ioctl(struct inode *inode, struct file *filp,
  74. unsigned int cmd, unsigned long arg);
  75. extern int  i810_unlock(struct inode *inode, struct file *filp,
  76.  unsigned int cmd, unsigned long arg);
  77. /* i810_dma.c */
  78. extern int  i810_dma_schedule(drm_device_t *dev, int locked);
  79. extern int  i810_getbuf(struct inode *inode, struct file *filp,
  80. unsigned int cmd, unsigned long arg);
  81. extern int  i810_irq_install(drm_device_t *dev, int irq);
  82. extern int  i810_irq_uninstall(drm_device_t *dev);
  83. extern int  i810_control(struct inode *inode, struct file *filp,
  84.   unsigned int cmd, unsigned long arg);
  85. extern int  i810_lock(struct inode *inode, struct file *filp,
  86.        unsigned int cmd, unsigned long arg);
  87. extern int  i810_dma_init(struct inode *inode, struct file *filp,
  88.   unsigned int cmd, unsigned long arg);
  89. extern int  i810_flush_ioctl(struct inode *inode, struct file *filp,
  90.      unsigned int cmd, unsigned long arg);
  91. extern void i810_reclaim_buffers(drm_device_t *dev, pid_t pid);
  92. extern int  i810_getage(struct inode *inode, struct file *filp, unsigned int cmd,
  93. unsigned long arg);
  94. extern int i810_mmap_buffers(struct file *filp, struct vm_area_struct *vma);
  95. extern int i810_copybuf(struct inode *inode, struct file *filp, 
  96. unsigned int cmd, unsigned long arg);
  97. extern int i810_docopy(struct inode *inode, struct file *filp, 
  98.        unsigned int cmd, unsigned long arg);
  99. /* i810_bufs.c */
  100. extern int  i810_addbufs(struct inode *inode, struct file *filp, 
  101. unsigned int cmd, unsigned long arg);
  102. extern int  i810_infobufs(struct inode *inode, struct file *filp, 
  103.  unsigned int cmd, unsigned long arg);
  104. extern int  i810_markbufs(struct inode *inode, struct file *filp,
  105.  unsigned int cmd, unsigned long arg);
  106. extern int  i810_freebufs(struct inode *inode, struct file *filp,
  107.  unsigned int cmd, unsigned long arg);
  108. extern int  i810_addmap(struct inode *inode, struct file *filp,
  109.        unsigned int cmd, unsigned long arg);
  110. /* i810_context.c */
  111. extern int  i810_resctx(struct inode *inode, struct file *filp,
  112.        unsigned int cmd, unsigned long arg);
  113. extern int  i810_addctx(struct inode *inode, struct file *filp,
  114.        unsigned int cmd, unsigned long arg);
  115. extern int  i810_modctx(struct inode *inode, struct file *filp,
  116.        unsigned int cmd, unsigned long arg);
  117. extern int  i810_getctx(struct inode *inode, struct file *filp,
  118.        unsigned int cmd, unsigned long arg);
  119. extern int  i810_switchctx(struct inode *inode, struct file *filp,
  120.   unsigned int cmd, unsigned long arg);
  121. extern int  i810_newctx(struct inode *inode, struct file *filp,
  122.        unsigned int cmd, unsigned long arg);
  123. extern int  i810_rmctx(struct inode *inode, struct file *filp,
  124.       unsigned int cmd, unsigned long arg);
  125. extern int  i810_context_switch(drm_device_t *dev, int old, int new);
  126. extern int  i810_context_switch_complete(drm_device_t *dev, int new);
  127. #define I810_VERBOSE 0
  128. int i810_dma_vertex(struct inode *inode, struct file *filp,
  129.     unsigned int cmd, unsigned long arg);
  130. int i810_swap_bufs(struct inode *inode, struct file *filp,
  131.    unsigned int cmd, unsigned long arg);
  132. int i810_clear_bufs(struct inode *inode, struct file *filp,
  133.     unsigned int cmd, unsigned long arg);
  134. #define GFX_OP_USER_INTERRUPT  ((0<<29)|(2<<23))
  135. #define GFX_OP_BREAKPOINT_INTERRUPT ((0<<29)|(1<<23))
  136. #define CMD_REPORT_HEAD (7<<23)
  137. #define CMD_STORE_DWORD_IDX ((0x21<<23) | 0x1)
  138. #define CMD_OP_BATCH_BUFFER  ((0x0<<29)|(0x30<<23)|0x1)
  139. #define INST_PARSER_CLIENT   0x00000000
  140. #define INST_OP_FLUSH        0x02000000
  141. #define INST_FLUSH_MAP_CACHE 0x00000001
  142. #define BB1_START_ADDR_MASK   (~0x7)
  143. #define BB1_PROTECTED         (1<<0)
  144. #define BB1_UNPROTECTED       (0<<0)
  145. #define BB2_END_ADDR_MASK     (~0x7)
  146. #define I810REG_HWSTAM 0x02098
  147. #define I810REG_INT_IDENTITY_R 0x020a4
  148. #define I810REG_INT_MASK_R  0x020a8
  149. #define I810REG_INT_ENABLE_R 0x020a0
  150. #define LP_RING      0x2030
  151. #define HP_RING      0x2040
  152. #define RING_TAIL       0x00
  153. #define TAIL_ADDR 0x000FFFF8
  154. #define RING_HEAD       0x04
  155. #define HEAD_WRAP_COUNT      0xFFE00000
  156. #define HEAD_WRAP_ONE        0x00200000
  157. #define HEAD_ADDR            0x001FFFFC
  158. #define RING_START      0x08
  159. #define START_ADDR           0x00FFFFF8
  160. #define RING_LEN        0x0C
  161. #define RING_NR_PAGES        0x000FF000 
  162. #define RING_REPORT_MASK     0x00000006
  163. #define RING_REPORT_64K      0x00000002
  164. #define RING_REPORT_128K     0x00000004
  165. #define RING_NO_REPORT       0x00000000
  166. #define RING_VALID_MASK      0x00000001
  167. #define RING_VALID           0x00000001
  168. #define RING_INVALID         0x00000000
  169. #define GFX_OP_SCISSOR         ((0x3<<29)|(0x1c<<24)|(0x10<<19))
  170. #define SC_UPDATE_SCISSOR       (0x1<<1)
  171. #define SC_ENABLE_MASK          (0x1<<0)
  172. #define SC_ENABLE               (0x1<<0)
  173. #define GFX_OP_SCISSOR_INFO    ((0x3<<29)|(0x1d<<24)|(0x81<<16)|(0x1))
  174. #define SCI_YMIN_MASK      (0xffff<<16)
  175. #define SCI_XMIN_MASK      (0xffff<<0)
  176. #define SCI_YMAX_MASK      (0xffff<<16)
  177. #define SCI_XMAX_MASK      (0xffff<<0)
  178. #define GFX_OP_COLOR_FACTOR      ((0x3<<29)|(0x1d<<24)|(0x1<<16)|0x0)
  179. #define GFX_OP_STIPPLE           ((0x3<<29)|(0x1d<<24)|(0x83<<16))
  180. #define GFX_OP_MAP_INFO          ((0x3<<29)|(0x1d<<24)|0x2)
  181. #define GFX_OP_DESTBUFFER_VARS   ((0x3<<29)|(0x1d<<24)|(0x85<<16)|0x0)
  182. #define GFX_OP_DRAWRECT_INFO     ((0x3<<29)|(0x1d<<24)|(0x80<<16)|(0x3))
  183. #define GFX_OP_PRIMITIVE         ((0x3<<29)|(0x1f<<24))
  184. #define CMD_OP_Z_BUFFER_INFO     ((0x0<<29)|(0x16<<23))
  185. #define CMD_OP_DESTBUFFER_INFO   ((0x0<<29)|(0x15<<23))
  186. #define BR00_BITBLT_CLIENT   0x40000000
  187. #define BR00_OP_COLOR_BLT    0x10000000
  188. #define BR00_OP_SRC_COPY_BLT 0x10C00000
  189. #define BR13_SOLID_PATTERN   0x80000000
  190. #endif