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

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. drm_map_t *sarea_map;
  54. drm_map_t *buffer_map;
  55. drm_map_t *mmio_map;
  56. drm_i810_sarea_t *sarea_priv;
  57.     drm_i810_ring_buffer_t ring;
  58.        unsigned long hw_status_page;
  59.     unsigned long counter;
  60.     dma_addr_t dma_status_page;
  61.     atomic_t flush_done;
  62.     wait_queue_head_t flush_queue; /* Processes waiting until flush    */
  63. drm_buf_t *mmap_buffer;
  64. u32 front_di1, back_di1, zi1;
  65. int back_offset;
  66. int depth_offset;
  67. int overlay_offset;
  68. int overlay_physical;
  69. int w, h;
  70. int pitch;
  71. } drm_i810_private_t;
  72. /* i810_dma.c */
  73. extern int  i810_dma_schedule(drm_device_t *dev, int locked);
  74. extern int  i810_getbuf(struct inode *inode, struct file *filp,
  75. unsigned int cmd, unsigned long arg);
  76. extern int  i810_dma_init(struct inode *inode, struct file *filp,
  77.   unsigned int cmd, unsigned long arg);
  78. extern int  i810_flush_ioctl(struct inode *inode, struct file *filp,
  79.      unsigned int cmd, unsigned long arg);
  80. extern void i810_reclaim_buffers(drm_device_t *dev, pid_t pid);
  81. extern int  i810_getage(struct inode *inode, struct file *filp,
  82. unsigned int cmd, unsigned long arg);
  83. extern int i810_mmap_buffers(struct file *filp, struct vm_area_struct *vma);
  84. extern int i810_copybuf(struct inode *inode, struct file *filp,
  85. unsigned int cmd, unsigned long arg);
  86. extern int i810_docopy(struct inode *inode, struct file *filp,
  87.        unsigned int cmd, unsigned long arg);
  88. extern int i810_rstatus(struct inode *inode, struct file *filp,
  89. unsigned int cmd, unsigned long arg);
  90. extern int i810_ov0_info(struct inode *inode, struct file *filp,
  91. unsigned int cmd, unsigned long arg);
  92. extern int i810_fstatus(struct inode *inode, struct file *filp,
  93. unsigned int cmd, unsigned long arg);
  94. extern int i810_ov0_flip(struct inode *inode, struct file *filp,
  95. unsigned int cmd, unsigned long arg);
  96. extern int i810_dma_mc(struct inode *inode, struct file *filp,
  97. unsigned int cmd, unsigned long arg);
  98. extern void i810_dma_quiescent(drm_device_t *dev);
  99. #define I810_VERBOSE 0
  100. int i810_dma_vertex(struct inode *inode, struct file *filp,
  101.     unsigned int cmd, unsigned long arg);
  102. int i810_swap_bufs(struct inode *inode, struct file *filp,
  103.    unsigned int cmd, unsigned long arg);
  104. int i810_clear_bufs(struct inode *inode, struct file *filp,
  105.     unsigned int cmd, unsigned long arg);
  106. #define I810_BASE(reg) ((unsigned long) 
  107. dev_priv->mmio_map->handle)
  108. #define I810_ADDR(reg) (I810_BASE(reg) + reg)
  109. #define I810_DEREF(reg) *(__volatile__ int *)I810_ADDR(reg)
  110. #define I810_READ(reg) I810_DEREF(reg)
  111. #define I810_WRITE(reg,val)  do { I810_DEREF(reg) = val; } while (0)
  112. #define I810_DEREF16(reg) *(__volatile__ u16 *)I810_ADDR(reg)
  113. #define I810_READ16(reg) I810_DEREF16(reg)
  114. #define I810_WRITE16(reg,val) do { I810_DEREF16(reg) = val; } while (0)
  115. #define GFX_OP_USER_INTERRUPT  ((0<<29)|(2<<23))
  116. #define GFX_OP_BREAKPOINT_INTERRUPT ((0<<29)|(1<<23))
  117. #define CMD_REPORT_HEAD (7<<23)
  118. #define CMD_STORE_DWORD_IDX ((0x21<<23) | 0x1)
  119. #define CMD_OP_BATCH_BUFFER  ((0x0<<29)|(0x30<<23)|0x1)
  120. #define INST_PARSER_CLIENT   0x00000000
  121. #define INST_OP_FLUSH        0x02000000
  122. #define INST_FLUSH_MAP_CACHE 0x00000001
  123. #define BB1_START_ADDR_MASK   (~0x7)
  124. #define BB1_PROTECTED         (1<<0)
  125. #define BB1_UNPROTECTED       (0<<0)
  126. #define BB2_END_ADDR_MASK     (~0x7)
  127. #define I810REG_HWSTAM 0x02098
  128. #define I810REG_INT_IDENTITY_R 0x020a4
  129. #define I810REG_INT_MASK_R  0x020a8
  130. #define I810REG_INT_ENABLE_R 0x020a0
  131. #define LP_RING      0x2030
  132. #define HP_RING      0x2040
  133. #define RING_TAIL       0x00
  134. #define TAIL_ADDR 0x000FFFF8
  135. #define RING_HEAD       0x04
  136. #define HEAD_WRAP_COUNT      0xFFE00000
  137. #define HEAD_WRAP_ONE        0x00200000
  138. #define HEAD_ADDR            0x001FFFFC
  139. #define RING_START      0x08
  140. #define START_ADDR           0x00FFFFF8
  141. #define RING_LEN        0x0C
  142. #define RING_NR_PAGES        0x000FF000
  143. #define RING_REPORT_MASK     0x00000006
  144. #define RING_REPORT_64K      0x00000002
  145. #define RING_REPORT_128K     0x00000004
  146. #define RING_NO_REPORT       0x00000000
  147. #define RING_VALID_MASK      0x00000001
  148. #define RING_VALID           0x00000001
  149. #define RING_INVALID         0x00000000
  150. #define GFX_OP_SCISSOR         ((0x3<<29)|(0x1c<<24)|(0x10<<19))
  151. #define SC_UPDATE_SCISSOR       (0x1<<1)
  152. #define SC_ENABLE_MASK          (0x1<<0)
  153. #define SC_ENABLE               (0x1<<0)
  154. #define GFX_OP_SCISSOR_INFO    ((0x3<<29)|(0x1d<<24)|(0x81<<16)|(0x1))
  155. #define SCI_YMIN_MASK      (0xffff<<16)
  156. #define SCI_XMIN_MASK      (0xffff<<0)
  157. #define SCI_YMAX_MASK      (0xffff<<16)
  158. #define SCI_XMAX_MASK      (0xffff<<0)
  159. #define GFX_OP_COLOR_FACTOR      ((0x3<<29)|(0x1d<<24)|(0x1<<16)|0x0)
  160. #define GFX_OP_STIPPLE           ((0x3<<29)|(0x1d<<24)|(0x83<<16))
  161. #define GFX_OP_MAP_INFO          ((0x3<<29)|(0x1d<<24)|0x2)
  162. #define GFX_OP_DESTBUFFER_VARS   ((0x3<<29)|(0x1d<<24)|(0x85<<16)|0x0)
  163. #define GFX_OP_DRAWRECT_INFO     ((0x3<<29)|(0x1d<<24)|(0x80<<16)|(0x3))
  164. #define GFX_OP_PRIMITIVE         ((0x3<<29)|(0x1f<<24))
  165. #define CMD_OP_Z_BUFFER_INFO     ((0x0<<29)|(0x16<<23))
  166. #define CMD_OP_DESTBUFFER_INFO   ((0x0<<29)|(0x15<<23))
  167. #define BR00_BITBLT_CLIENT   0x40000000
  168. #define BR00_OP_COLOR_BLT    0x10000000
  169. #define BR00_OP_SRC_COPY_BLT 0x10C00000
  170. #define BR13_SOLID_PATTERN   0x80000000
  171. #endif