2 * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
3 * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sub license,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice (including the
13 * next paragraph) shall be included in all copies or substantial portions
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
19 * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
27 /* WARNING: These defines must be the same as what the Xserver uses.
28 * if you change them, you must change the defines in the Xserver.
34 #define VIA_DMA_BUF_ORDER 12
35 #define VIA_DMA_BUF_SZ (1 << VIA_DMA_BUF_ORDER)
36 #define VIA_DMA_BUF_NR 256
37 #define VIA_NR_SAREA_CLIPRECTS 8
39 #define VIA_NR_TEX_REGIONS 64
40 #define VIA_LOG_MIN_TEX_REGION_SIZE 16
43 #define VIA_UPLOAD_TEX0IMAGE 0x1
44 #define VIA_UPLOAD_TEX1IMAGE 0x2
45 #define VIA_UPLOAD_CTX 0x4
46 #define VIA_UPLOAD_BUFFERS 0x8
47 #define VIA_UPLOAD_TEX0 0x10
48 #define VIA_UPLOAD_TEX1 0x20
49 #define VIA_UPLOAD_CLIPRECTS 0x40
50 /*#define VIA_UPLOAD_ALL 0xff*/
52 /* VIA specific ioctls */
53 #define DRM_IOCTL_VIA_ALLOCMEM DRM_IOWR(0x40, drm_via_mem_t)
54 #define DRM_IOCTL_VIA_FREEMEM DRM_IOW(0x41, drm_via_mem_t)
55 #define DRM_IOCTL_VIA_AGP_INIT DRM_IOWR(0x42, drm_via_agp_t)
56 #define DRM_IOCTL_VIA_FB_INIT DRM_IOWR(0x43, drm_via_fb_t)
57 #define DRM_IOCTL_VIA_MAP_INIT DRM_IOWR(0x44, drm_via_init_t)
58 #define DRM_IOCTL_VIA_FLUSH_AGP DRM_IOW(0x45, drm_via_flush_agp_t)
59 #define DRM_IOCTL_VIA_FLUSH_SYS DRM_IOW(0x46, drm_via_flush_sys_t)
61 #define VIA_TEX_SETUP_SIZE 8
66 #define VIA_STENCIL 0x8
87 typedef struct _drm_via_init
{
90 VIA_CLEANUP_MAP
= 0x02
92 unsigned long sarea_priv_offset
;
93 unsigned long fb_offset
;
94 unsigned long mmio_offset
;
95 unsigned long agpAddr
;
99 typedef struct _drm_via_tex_region
{
100 unsigned char next
, prev
;
103 } drm_via_tex_region_t
;
105 typedef struct _drm_via_sarea
{
108 drm_clip_rect_t boxes
[VIA_NR_SAREA_CLIPRECTS
];
109 drm_via_tex_region_t texList
[VIA_NR_TEX_REGIONS
+ 1];
115 typedef struct _drm_via_flush_agp
{
120 } drm_via_flush_agp_t
;
122 typedef struct _drm_via_flush_sys
{
127 } drm_via_flush_sys_t
;
130 int via_fb_init(struct inode
*inode
, struct file
*filp
, unsigned int cmd
,
132 int via_mem_alloc(struct inode
*inode
, struct file
*filp
, unsigned int cmd
,
134 int via_mem_free(struct inode
*inode
, struct file
*filp
, unsigned int cmd
,
136 int via_agp_init(struct inode
*inode
, struct file
*filp
, unsigned int cmd
,
138 int via_dma_alloc(struct inode
*inode
, struct file
*filp
, unsigned int cmd
,
140 int via_dma_free(struct inode
*inode
, struct file
*filp
, unsigned int cmd
,
142 int via_map_init(struct inode
*inode
, struct file
*filp
, unsigned int cmd
,
144 int via_flush_agp(struct inode
*inode
, struct file
*filp
, unsigned int cmd
,
146 int via_flush_sys(struct inode
*inode
, struct file
*filp
, unsigned int cmd
,
149 #endif /* _VIA_DRM_H_ */