1 #ifndef _GAMMA_DRM_H_
2 #define _GAMMA_DRM_H_
3 
4 typedef struct _drm_gamma_tex_region {
5 	unsigned char next, prev; /* indices to form a circular LRU  */
6 	unsigned char in_use;	/* owned by a client, or free? */
7 	int age;		/* tracked by clients to update local LRU's */
8 } drm_gamma_tex_region_t;
9 
10 typedef struct {
11 	unsigned int	GDeltaMode;
12 	unsigned int	GDepthMode;
13 	unsigned int	GGeometryMode;
14 	unsigned int	GTransformMode;
15 } drm_gamma_context_regs_t;
16 
17 typedef struct _drm_gamma_sarea {
18    	drm_gamma_context_regs_t context_state;
19 
20 	unsigned int dirty;
21 
22 
23 	/* Maintain an LRU of contiguous regions of texture space.  If
24 	 * you think you own a region of texture memory, and it has an
25 	 * age different to the one you set, then you are mistaken and
26 	 * it has been stolen by another client.  If global texAge
27 	 * hasn't changed, there is no need to walk the list.
28 	 *
29 	 * These regions can be used as a proxy for the fine-grained
30 	 * texture information of other clients - by maintaining them
31 	 * in the same lru which is used to age their own textures,
32 	 * clients have an approximate lru for the whole of global
33 	 * texture space, and can make informed decisions as to which
34 	 * areas to kick out.  There is no need to choose whether to
35 	 * kick out your own texture or someone else's - simply eject
36 	 * them all in LRU order.
37 	 */
38 
39 #define GAMMA_NR_TEX_REGIONS 64
40 	drm_gamma_tex_region_t texList[GAMMA_NR_TEX_REGIONS+1];
41 				/* Last elt is sentinal */
42         int texAge;		/* last time texture was uploaded */
43         int last_enqueue;	/* last time a buffer was enqueued */
44 	int last_dispatch;	/* age of the most recently dispatched buffer */
45 	int last_quiescent;     /*  */
46 	int ctxOwner;		/* last context to upload state */
47 
48 	int vertex_prim;
49 } drm_gamma_sarea_t;
50 
51 /* WARNING: If you change any of these defines, make sure to wear a bullet
52  * proof vest because these are part of the stable kernel<->userspace ABI
53  */
54 
55 /* Gamma specific ioctls
56  * The device specific ioctl range is 0x40 to 0x79.
57  */
58 #define DRM_IOCTL_GAMMA_INIT		DRM_IOW( 0x40, drm_gamma_init_t)
59 #define DRM_IOCTL_GAMMA_COPY		DRM_IOW( 0x41, drm_gamma_copy_t)
60 
61 typedef struct drm_gamma_copy {
62 	unsigned int	DMAOutputAddress;
63 	unsigned int	DMAOutputCount;
64 	unsigned int	DMAReadGLINTSource;
65 	unsigned int	DMARectangleWriteAddress;
66 	unsigned int	DMARectangleWriteLinePitch;
67 	unsigned int	DMARectangleWrite;
68 	unsigned int	DMARectangleReadAddress;
69 	unsigned int	DMARectangleReadLinePitch;
70 	unsigned int	DMARectangleRead;
71 	unsigned int	DMARectangleReadTarget;
72 } drm_gamma_copy_t;
73 
74 typedef struct drm_gamma_init {
75    	enum {
76 	   	GAMMA_INIT_DMA    = 0x01,
77 	       	GAMMA_CLEANUP_DMA = 0x02
78 	} func;
79 
80    	int sarea_priv_offset;
81 	int pcimode;
82 	unsigned int mmio0;
83 	unsigned int mmio1;
84 	unsigned int mmio2;
85 	unsigned int mmio3;
86 	unsigned int buffers_offset;
87 } drm_gamma_init_t;
88 
89 #endif /* _GAMMA_DRM_H_ */
90