132b578d3Smrg/* mach64_common.h -- common header definitions for Rage Pro 2D/3D/DRM suite
232b578d3Smrg * Created: Sun Dec 03 11:34:16 2000 by gareth@valinux.com
332b578d3Smrg *
432b578d3Smrg * Copyright 2000 Gareth Hughes
532b578d3Smrg * All Rights Reserved.
632b578d3Smrg *
732b578d3Smrg * Permission is hereby granted, free of charge, to any person obtaining a
832b578d3Smrg * copy of this software and associated documentation files (the "Software"),
932b578d3Smrg * to deal in the Software without restriction, including without limitation
1032b578d3Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense,
1132b578d3Smrg * and/or sell copies of the Software, and to permit persons to whom the
1232b578d3Smrg * Software is furnished to do so, subject to the following conditions:
1332b578d3Smrg *
1432b578d3Smrg * The above copyright notice and this permission notice (including the next
1532b578d3Smrg * paragraph) shall be included in all copies or substantial portions of the
1632b578d3Smrg * Software.
1732b578d3Smrg *
1832b578d3Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1932b578d3Smrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2032b578d3Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
2132b578d3Smrg * GARETH HUGHES BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
2232b578d3Smrg * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
2332b578d3Smrg * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2432b578d3Smrg *
2532b578d3Smrg * Author:
2632b578d3Smrg *	Gareth Hughes <gareth@valinux.com>
2732b578d3Smrg *      Leif Delgass <ldelgass@retinalburn.net>
2832b578d3Smrg */
2932b578d3Smrg
3032b578d3Smrg#ifndef __MACH64_COMMON_H__
3132b578d3Smrg#define __MACH64_COMMON_H__ 1
3232b578d3Smrg
3332b578d3Smrg/* WARNING: If you change any of these defines, make sure to change
3432b578d3Smrg * the kernel include file as well (mach64_drm.h)
3532b578d3Smrg */
3632b578d3Smrg
3732b578d3Smrg/* Driver specific DRM command indices
3832b578d3Smrg * NOTE: these are not OS specific, but they are driver specific
3932b578d3Smrg */
4032b578d3Smrg#define DRM_MACH64_INIT           0x00
4132b578d3Smrg#define DRM_MACH64_IDLE           0x01
4232b578d3Smrg#define DRM_MACH64_RESET          0x02
4332b578d3Smrg#define DRM_MACH64_SWAP           0x03
4432b578d3Smrg#define DRM_MACH64_CLEAR          0x04
4532b578d3Smrg#define DRM_MACH64_VERTEX         0x05
4632b578d3Smrg#define DRM_MACH64_BLIT           0x06
4732b578d3Smrg#define DRM_MACH64_FLUSH          0x07
4832b578d3Smrg#define DRM_MACH64_GETPARAM       0x08
4932b578d3Smrg
5032b578d3Smrg/* Buffer flags for clears
5132b578d3Smrg */
5232b578d3Smrg#define MACH64_FRONT	          0x1
5332b578d3Smrg#define MACH64_BACK	          0x2
5432b578d3Smrg#define MACH64_DEPTH	          0x4
5532b578d3Smrg
5632b578d3Smrg/* Primitive types for vertex buffers
5732b578d3Smrg */
5832b578d3Smrg#define MACH64_PRIM_POINTS		0x00000000
5932b578d3Smrg#define MACH64_PRIM_LINES		0x00000001
6032b578d3Smrg#define MACH64_PRIM_LINE_LOOP		0x00000002
6132b578d3Smrg#define MACH64_PRIM_LINE_STRIP		0x00000003
6232b578d3Smrg#define MACH64_PRIM_TRIANGLES		0x00000004
6332b578d3Smrg#define MACH64_PRIM_TRIANGLE_STRIP	0x00000005
6432b578d3Smrg#define MACH64_PRIM_TRIANGLE_FAN	0x00000006
6532b578d3Smrg#define MACH64_PRIM_QUADS		0x00000007
6632b578d3Smrg#define MACH64_PRIM_QUAD_STRIP		0x00000008
6732b578d3Smrg#define MACH64_PRIM_POLYGON		0x00000009
6832b578d3Smrg
6932b578d3Smrg
7032b578d3Smrgtypedef enum _drmMach64DMAMode {
7132b578d3Smrg   MACH64_MODE_DMA_ASYNC,
7232b578d3Smrg   MACH64_MODE_DMA_SYNC,
7332b578d3Smrg   MACH64_MODE_MMIO
7432b578d3Smrg} drmMach64DMAMode;
7532b578d3Smrg
7632b578d3Smrgtypedef struct {
7732b578d3Smrg   enum {
7832b578d3Smrg      DRM_MACH64_INIT_DMA    = 0x01,
7932b578d3Smrg      DRM_MACH64_CLEANUP_DMA = 0x02
8032b578d3Smrg   } func;
8132b578d3Smrg   unsigned long sarea_priv_offset;
8232b578d3Smrg   int is_pci;
8332b578d3Smrg   drmMach64DMAMode dma_mode;
8432b578d3Smrg
8532b578d3Smrg   unsigned int fb_bpp;
8632b578d3Smrg   unsigned int front_offset, front_pitch;
8732b578d3Smrg   unsigned int back_offset, back_pitch;
8832b578d3Smrg
8932b578d3Smrg   unsigned int depth_bpp;
9032b578d3Smrg   unsigned int depth_offset, depth_pitch;
9132b578d3Smrg
9232b578d3Smrg   unsigned long fb_offset;
9332b578d3Smrg   unsigned long mmio_offset;
9432b578d3Smrg   unsigned long ring_offset;
9532b578d3Smrg   unsigned long buffers_offset;
9632b578d3Smrg   unsigned long agp_textures_offset;
9732b578d3Smrg} drmMach64Init;
9832b578d3Smrg
9932b578d3Smrgtypedef struct {
10032b578d3Smrg   unsigned int flags;
10132b578d3Smrg   int x, y, w, h;
10232b578d3Smrg   unsigned int clear_color;
10332b578d3Smrg   unsigned int clear_depth;
10432b578d3Smrg} drmMach64Clear;
10532b578d3Smrg
10632b578d3Smrgtypedef struct {
10732b578d3Smrg   int prim;
10832b578d3Smrg   void *buf;			/* Address of vertex buffer */
10932b578d3Smrg   unsigned long used;		/* Number of bytes in buffer */
11032b578d3Smrg   int discard;			/* Client finished with buffer? */
11132b578d3Smrg} drmMach64Vertex;
11232b578d3Smrg
11332b578d3Smrgtypedef struct {
11432b578d3Smrg   void *buf;
11532b578d3Smrg   int pitch;
11632b578d3Smrg   int offset;
11732b578d3Smrg   int format;
11832b578d3Smrg   unsigned short x, y;
11932b578d3Smrg   unsigned short width, height;
12032b578d3Smrg} drmMach64Blit;
12132b578d3Smrg
12232b578d3Smrgtypedef struct {
12332b578d3Smrg   int param;
12432b578d3Smrg   int *value;
12532b578d3Smrg} drmMach64GetParam;
12632b578d3Smrg
12732b578d3Smrg#define MACH64_PARAM_FRAMES_QUEUED 1
12832b578d3Smrg#define MACH64_PARAM_IRQ_NR       2
12932b578d3Smrg
13032b578d3Smrg#endif /* __MACH64_COMMON_H__ */
131