The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/dev/drm/radeon_drm.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /* radeon_drm.h -- Public header for the radeon driver -*- linux-c -*-
    2  *
    3  * Copyright 2000 Precision Insight, Inc., Cedar Park, Texas.
    4  * Copyright 2000 VA Linux Systems, Inc., Fremont, California.
    5  * All rights reserved.
    6  *
    7  * Permission is hereby granted, free of charge, to any person obtaining a
    8  * copy of this software and associated documentation files (the "Software"),
    9  * to deal in the Software without restriction, including without limitation
   10  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
   11  * and/or sell copies of the Software, and to permit persons to whom the
   12  * Software is furnished to do so, subject to the following conditions:
   13  *
   14  * The above copyright notice and this permission notice (including the next
   15  * paragraph) shall be included in all copies or substantial portions of the
   16  * Software.
   17  *
   18  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   19  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   20  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
   21  * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
   22  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
   23  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
   24  * DEALINGS IN THE SOFTWARE.
   25  *
   26  * Authors:
   27  *    Kevin E. Martin <martin@valinux.com>
   28  *    Gareth Hughes <gareth@valinux.com>
   29  *
   30  * $FreeBSD: releng/5.0/sys/dev/drm/radeon_drm.h 95746 2002-04-29 18:18:42Z anholt $
   31  */
   32 
   33 #ifndef __RADEON_DRM_H__
   34 #define __RADEON_DRM_H__
   35 
   36 /* WARNING: If you change any of these defines, make sure to change the
   37  * defines in the X server file (radeon_sarea.h)
   38  */
   39 #ifndef __RADEON_SAREA_DEFINES__
   40 #define __RADEON_SAREA_DEFINES__
   41 
   42 /* What needs to be changed for the current vertex buffer?
   43  */
   44 #define RADEON_UPLOAD_CONTEXT           0x00000001
   45 #define RADEON_UPLOAD_VERTFMT           0x00000002
   46 #define RADEON_UPLOAD_LINE              0x00000004
   47 #define RADEON_UPLOAD_BUMPMAP           0x00000008
   48 #define RADEON_UPLOAD_MASKS             0x00000010
   49 #define RADEON_UPLOAD_VIEWPORT          0x00000020
   50 #define RADEON_UPLOAD_SETUP             0x00000040
   51 #define RADEON_UPLOAD_TCL               0x00000080
   52 #define RADEON_UPLOAD_MISC              0x00000100
   53 #define RADEON_UPLOAD_TEX0              0x00000200
   54 #define RADEON_UPLOAD_TEX1              0x00000400
   55 #define RADEON_UPLOAD_TEX2              0x00000800
   56 #define RADEON_UPLOAD_TEX0IMAGES        0x00001000
   57 #define RADEON_UPLOAD_TEX1IMAGES        0x00002000
   58 #define RADEON_UPLOAD_TEX2IMAGES        0x00004000
   59 #define RADEON_UPLOAD_CLIPRECTS         0x00008000 /* handled client-side */
   60 #define RADEON_REQUIRE_QUIESCENCE       0x00010000
   61 #define RADEON_UPLOAD_ALL               0x0001ffff
   62 
   63 #define RADEON_FRONT                    0x1
   64 #define RADEON_BACK                     0x2
   65 #define RADEON_DEPTH                    0x4
   66 
   67 /* Primitive types
   68  */
   69 #define RADEON_POINTS                   0x1
   70 #define RADEON_LINES                    0x2
   71 #define RADEON_LINE_STRIP               0x3
   72 #define RADEON_TRIANGLES                0x4
   73 #define RADEON_TRIANGLE_FAN             0x5
   74 #define RADEON_TRIANGLE_STRIP           0x6
   75 
   76 /* Vertex/indirect buffer size
   77  */
   78 #define RADEON_BUFFER_SIZE              65536
   79 
   80 /* Byte offsets for indirect buffer data
   81  */
   82 #define RADEON_INDEX_PRIM_OFFSET        20
   83 #define RADEON_HOSTDATA_BLIT_OFFSET     32
   84 
   85 #define RADEON_SCRATCH_REG_OFFSET       32
   86 
   87 /* Keep these small for testing
   88  */
   89 #define RADEON_NR_SAREA_CLIPRECTS       12
   90 
   91 /* There are 2 heaps (local/AGP).  Each region within a heap is a
   92  * minimum of 64k, and there are at most 64 of them per heap.
   93  */
   94 #define RADEON_LOCAL_TEX_HEAP           0
   95 #define RADEON_AGP_TEX_HEAP             1
   96 #define RADEON_NR_TEX_HEAPS             2
   97 #define RADEON_NR_TEX_REGIONS           64
   98 #define RADEON_LOG_TEX_GRANULARITY      16
   99 
  100 #define RADEON_MAX_TEXTURE_LEVELS       11
  101 #define RADEON_MAX_TEXTURE_UNITS        3
  102 
  103 #endif /* __RADEON_SAREA_DEFINES__ */
  104 
  105 typedef struct {
  106         unsigned int red;
  107         unsigned int green;
  108         unsigned int blue;
  109         unsigned int alpha;
  110 } radeon_color_regs_t;
  111 
  112 typedef struct {
  113         /* Context state */
  114         unsigned int pp_misc;                           /* 0x1c14 */
  115         unsigned int pp_fog_color;
  116         unsigned int re_solid_color;
  117         unsigned int rb3d_blendcntl;
  118         unsigned int rb3d_depthoffset;
  119         unsigned int rb3d_depthpitch;
  120         unsigned int rb3d_zstencilcntl;
  121 
  122         unsigned int pp_cntl;                           /* 0x1c38 */
  123         unsigned int rb3d_cntl;
  124         unsigned int rb3d_coloroffset;
  125         unsigned int re_width_height;
  126         unsigned int rb3d_colorpitch;
  127         unsigned int se_cntl;
  128 
  129         /* Vertex format state */
  130         unsigned int se_coord_fmt;                      /* 0x1c50 */
  131 
  132         /* Line state */
  133         unsigned int re_line_pattern;                   /* 0x1cd0 */
  134         unsigned int re_line_state;
  135 
  136         unsigned int se_line_width;                     /* 0x1db8 */
  137 
  138         /* Bumpmap state */
  139         unsigned int pp_lum_matrix;                     /* 0x1d00 */
  140 
  141         unsigned int pp_rot_matrix_0;                   /* 0x1d58 */
  142         unsigned int pp_rot_matrix_1;
  143 
  144         /* Mask state */
  145         unsigned int rb3d_stencilrefmask;               /* 0x1d7c */
  146         unsigned int rb3d_ropcntl;
  147         unsigned int rb3d_planemask;
  148 
  149         /* Viewport state */
  150         unsigned int se_vport_xscale;                   /* 0x1d98 */
  151         unsigned int se_vport_xoffset;
  152         unsigned int se_vport_yscale;
  153         unsigned int se_vport_yoffset;
  154         unsigned int se_vport_zscale;
  155         unsigned int se_vport_zoffset;
  156 
  157         /* Setup state */
  158         unsigned int se_cntl_status;                    /* 0x2140 */
  159 
  160 #ifdef TCL_ENABLE
  161         /* TCL state */
  162         radeon_color_regs_t se_tcl_material_emmissive;  /* 0x2210 */
  163         radeon_color_regs_t se_tcl_material_ambient;
  164         radeon_color_regs_t se_tcl_material_diffuse;
  165         radeon_color_regs_t se_tcl_material_specular;
  166         unsigned int se_tcl_shininess;
  167         unsigned int se_tcl_output_vtx_fmt;
  168         unsigned int se_tcl_output_vtx_sel;
  169         unsigned int se_tcl_matrix_select_0;
  170         unsigned int se_tcl_matrix_select_1;
  171         unsigned int se_tcl_ucp_vert_blend_ctl;
  172         unsigned int se_tcl_texture_proc_ctl;
  173         unsigned int se_tcl_light_model_ctl;
  174         unsigned int se_tcl_per_light_ctl[4];
  175 #endif
  176 
  177         /* Misc state */
  178         unsigned int re_top_left;                       /* 0x26c0 */
  179         unsigned int re_misc;
  180 } drm_radeon_context_regs_t;
  181 
  182 /* Setup registers for each texture unit
  183  */
  184 typedef struct {
  185         unsigned int pp_txfilter;
  186         unsigned int pp_txformat;
  187         unsigned int pp_txoffset;
  188         unsigned int pp_txcblend;
  189         unsigned int pp_txablend;
  190         unsigned int pp_tfactor;
  191 
  192         unsigned int pp_border_color;
  193 
  194 #ifdef CUBIC_ENABLE
  195         unsigned int pp_cubic_faces;
  196         unsigned int pp_cubic_offset[5];
  197 #endif
  198 } drm_radeon_texture_regs_t;
  199 
  200 typedef struct {
  201         unsigned char next, prev;
  202         unsigned char in_use;
  203         int age;
  204 } drm_radeon_tex_region_t;
  205 
  206 typedef struct {
  207         /* The channel for communication of state information to the kernel
  208          * on firing a vertex buffer.
  209          */
  210         drm_radeon_context_regs_t context_state;
  211         drm_radeon_texture_regs_t tex_state[RADEON_MAX_TEXTURE_UNITS];
  212         unsigned int dirty;
  213         unsigned int vertsize;
  214         unsigned int vc_format;
  215 
  216         /* The current cliprects, or a subset thereof.
  217          */
  218         drm_clip_rect_t boxes[RADEON_NR_SAREA_CLIPRECTS];
  219         unsigned int nbox;
  220 
  221         /* Counters for client-side throttling of rendering clients.
  222          */
  223         unsigned int last_frame;
  224         unsigned int last_dispatch;
  225         unsigned int last_clear;
  226 
  227         drm_radeon_tex_region_t tex_list[RADEON_NR_TEX_HEAPS][RADEON_NR_TEX_REGIONS+1];
  228         int tex_age[RADEON_NR_TEX_HEAPS];
  229         int ctx_owner;
  230 } drm_radeon_sarea_t;
  231 
  232 
  233 /* WARNING: If you change any of these defines, make sure to change the
  234  * defines in the Xserver file (xf86drmRadeon.h)
  235  */
  236 
  237 /* Radeon specific ioctls */
  238 #define DRM_IOCTL_RADEON_CP_INIT        DRM_IOW( 0x40, drm_radeon_init_t)
  239 #define DRM_IOCTL_RADEON_CP_START       DRM_IO(  0x41)
  240 #define DRM_IOCTL_RADEON_CP_STOP        DRM_IOW( 0x42, drm_radeon_cp_stop_t)
  241 #define DRM_IOCTL_RADEON_CP_RESET       DRM_IO(  0x43)
  242 #define DRM_IOCTL_RADEON_CP_IDLE        DRM_IO(  0x44)
  243 #define DRM_IOCTL_RADEON_RESET          DRM_IO(  0x45)
  244 #define DRM_IOCTL_RADEON_FULLSCREEN     DRM_IOW( 0x46, drm_radeon_fullscreen_t)
  245 #define DRM_IOCTL_RADEON_SWAP           DRM_IO(  0x47)
  246 #define DRM_IOCTL_RADEON_CLEAR          DRM_IOW( 0x48, drm_radeon_clear_t)
  247 #define DRM_IOCTL_RADEON_VERTEX         DRM_IOW( 0x49, drm_radeon_vertex_t)
  248 #define DRM_IOCTL_RADEON_INDICES        DRM_IOW( 0x4a, drm_radeon_indices_t)
  249 #define DRM_IOCTL_RADEON_STIPPLE        DRM_IOW( 0x4c, drm_radeon_stipple_t)
  250 #define DRM_IOCTL_RADEON_INDIRECT       DRM_IOWR(0x4d, drm_radeon_indirect_t)
  251 #define DRM_IOCTL_RADEON_TEXTURE        DRM_IOWR(0x4e, drm_radeon_texture_t)
  252 
  253 typedef struct drm_radeon_init {
  254         enum {
  255                 RADEON_INIT_CP    = 0x01,
  256                 RADEON_CLEANUP_CP = 0x02
  257         } func;
  258         unsigned long sarea_priv_offset;
  259         int is_pci;
  260         int cp_mode;
  261         int agp_size;
  262         int ring_size;
  263         int usec_timeout;
  264 
  265         unsigned int fb_bpp;
  266         unsigned int front_offset, front_pitch;
  267         unsigned int back_offset, back_pitch;
  268         unsigned int depth_bpp;
  269         unsigned int depth_offset, depth_pitch;
  270 
  271         unsigned long fb_offset;
  272         unsigned long mmio_offset;
  273         unsigned long ring_offset;
  274         unsigned long ring_rptr_offset;
  275         unsigned long buffers_offset;
  276         unsigned long agp_textures_offset;
  277 } drm_radeon_init_t;
  278 
  279 typedef struct drm_radeon_cp_stop {
  280         int flush;
  281         int idle;
  282 } drm_radeon_cp_stop_t;
  283 
  284 typedef struct drm_radeon_fullscreen {
  285         enum {
  286                 RADEON_INIT_FULLSCREEN    = 0x01,
  287                 RADEON_CLEANUP_FULLSCREEN = 0x02
  288         } func;
  289 } drm_radeon_fullscreen_t;
  290 
  291 #define CLEAR_X1        0
  292 #define CLEAR_Y1        1
  293 #define CLEAR_X2        2
  294 #define CLEAR_Y2        3
  295 #define CLEAR_DEPTH     4
  296 
  297 typedef union drm_radeon_clear_rect {
  298         float f[5];
  299         unsigned int ui[5];
  300 } drm_radeon_clear_rect_t;
  301 
  302 typedef struct drm_radeon_clear {
  303         unsigned int flags;
  304         unsigned int clear_color;
  305         unsigned int clear_depth;
  306         unsigned int color_mask;
  307         unsigned int depth_mask;
  308         drm_radeon_clear_rect_t *depth_boxes;
  309 } drm_radeon_clear_t;
  310 
  311 typedef struct drm_radeon_vertex {
  312         int prim;
  313         int idx;                        /* Index of vertex buffer */
  314         int count;                      /* Number of vertices in buffer */
  315         int discard;                    /* Client finished with buffer? */
  316 } drm_radeon_vertex_t;
  317 
  318 typedef struct drm_radeon_indices {
  319         int prim;
  320         int idx;
  321         int start;
  322         int end;
  323         int discard;                    /* Client finished with buffer? */
  324 } drm_radeon_indices_t;
  325 
  326 typedef struct drm_radeon_tex_image {
  327         unsigned int x, y;              /* Blit coordinates */
  328         unsigned int width, height;
  329         const void *data;
  330 } drm_radeon_tex_image_t;
  331 
  332 typedef struct drm_radeon_texture {
  333         int offset;
  334         int pitch;
  335         int format;
  336         int width;                      /* Texture image coordinates */
  337         int height;
  338         drm_radeon_tex_image_t *image;
  339 } drm_radeon_texture_t;
  340 
  341 typedef struct drm_radeon_stipple {
  342         unsigned int *mask;
  343 } drm_radeon_stipple_t;
  344 
  345 typedef struct drm_radeon_indirect {
  346         int idx;
  347         int start;
  348         int end;
  349         int discard;
  350 } drm_radeon_indirect_t;
  351 
  352 #endif

Cache object: 8f11e6e4602865cb148e8e5d4e015084


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.