~ubuntu-branches/ubuntu/trusty/xserver-xorg-video-mach64-lts-xenial/trusty-proposed

« back to all changes in this revision

Viewing changes to src/mach64_sarea.h

  • Committer: Package Import Robot
  • Author(s): Timo Aaltonen
  • Date: 2016-05-03 14:02:37 UTC
  • Revision ID: package-import@ubuntu.com-20160503140237-y946gbjc7p6fg9fn
Tags: upstream-6.9.5
ImportĀ upstreamĀ versionĀ 6.9.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright 2000 Gareth Hughes
 
3
 * All Rights Reserved.
 
4
 *
 
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, sublicense,
 
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:
 
11
 *
 
12
 * The above copyright notice and this permission notice (including the next
 
13
 * paragraph) shall be included in all copies or substantial portions of the
 
14
 * Software.
 
15
 *
 
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 NONINFRINGEMENT.  IN NO EVENT SHALL
 
19
 * GARETH HUGHES BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
 
20
 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 
21
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
22
 */
 
23
 
 
24
/*
 
25
 * Authors:
 
26
 *   Gareth Hughes <gareth@valinux.com>
 
27
 *   Leif Delgass <ldelgass@retinalburn.net>
 
28
 */
 
29
 
 
30
#ifndef __MACH64_SAREA_H__
 
31
#define __MACH64_SAREA_H__ 1
 
32
 
 
33
#include <X11/Xmd.h>
 
34
 
 
35
/* WARNING: If you change any of these defines, make sure to change the
 
36
 * defines in the kernel file (mach64_drm.h)
 
37
 */
 
38
#ifndef __MACH64_SAREA_DEFINES__
 
39
#define __MACH64_SAREA_DEFINES__ 1
 
40
 
 
41
/* What needs to be changed for the current vertex buffer?
 
42
 * GH: We're going to be pedantic about this.  We want the card to do as
 
43
 * little as possible, so let's avoid having it fetch a whole bunch of
 
44
 * register values that don't change all that often, if at all.
 
45
 */
 
46
#define MACH64_UPLOAD_DST_OFF_PITCH     0x0001
 
47
#define MACH64_UPLOAD_Z_OFF_PITCH       0x0002
 
48
#define MACH64_UPLOAD_Z_ALPHA_CNTL      0x0004
 
49
#define MACH64_UPLOAD_SCALE_3D_CNTL     0x0008
 
50
#define MACH64_UPLOAD_DP_FOG_CLR        0x0010
 
51
#define MACH64_UPLOAD_DP_WRITE_MASK     0x0020
 
52
#define MACH64_UPLOAD_DP_PIX_WIDTH      0x0040
 
53
#define MACH64_UPLOAD_SETUP_CNTL        0x0080
 
54
#define MACH64_UPLOAD_MISC              0x0100
 
55
#define MACH64_UPLOAD_TEXTURE           0x0200
 
56
#define MACH64_UPLOAD_TEX0IMAGE         0x0400
 
57
#define MACH64_UPLOAD_TEX1IMAGE         0x0800
 
58
#define MACH64_UPLOAD_CLIPRECTS         0x1000 /* handled client-side */
 
59
#define MACH64_UPLOAD_CONTEXT           0x00ff
 
60
#define MACH64_UPLOAD_ALL               0x1fff
 
61
 
 
62
/* DMA buffer size
 
63
 */
 
64
#define MACH64_BUFFER_SIZE              16384
 
65
 
 
66
/* Max number of swaps allowed on the ring
 
67
 * before the client must wait
 
68
 */
 
69
#define MACH64_MAX_QUEUED_FRAMES        3
 
70
 
 
71
/* Byte offsets for host blit buffer data
 
72
 */
 
73
#define MACH64_HOSTDATA_BLIT_OFFSET     104
 
74
 
 
75
/* Keep these small for testing.
 
76
 */
 
77
#define MACH64_NR_SAREA_CLIPRECTS       8
 
78
 
 
79
 
 
80
#define MACH64_CARD_HEAP                0
 
81
#define MACH64_AGP_HEAP                 1
 
82
#define MACH64_NR_TEX_HEAPS             2
 
83
#define MACH64_NR_TEX_REGIONS           64
 
84
#define MACH64_LOG_TEX_GRANULARITY      16
 
85
 
 
86
#define MACH64_TEX_MAXLEVELS            1
 
87
 
 
88
#define MACH64_NR_CONTEXT_REGS          15
 
89
#define MACH64_NR_TEXTURE_REGS          4
 
90
 
 
91
#endif /* __MACH64_SAREA_DEFINES__ */
 
92
 
 
93
typedef struct {
 
94
   /* Context state */
 
95
   unsigned int dst_off_pitch;          /* 0x500 */
 
96
 
 
97
   unsigned int z_off_pitch;            /* 0x548 */ /* ****** */
 
98
   unsigned int z_cntl;                 /* 0x54c */
 
99
   unsigned int alpha_tst_cntl;         /* 0x550 */
 
100
 
 
101
   unsigned int scale_3d_cntl;          /* 0x5fc */
 
102
 
 
103
   unsigned int sc_left_right;          /* 0x6a8 */
 
104
   unsigned int sc_top_bottom;          /* 0x6b4 */
 
105
 
 
106
   unsigned int dp_fog_clr;             /* 0x6c4 */
 
107
   unsigned int dp_write_mask;          /* 0x6c8 */
 
108
   unsigned int dp_pix_width;           /* 0x6d0 */
 
109
   unsigned int dp_mix;                 /* 0x6d4 */ /* ****** */
 
110
   unsigned int dp_src;                 /* 0x6d8 */ /* ****** */
 
111
 
 
112
   unsigned int clr_cmp_cntl;           /* 0x708 */ /* ****** */
 
113
   unsigned int gui_traj_cntl;          /* 0x730 */ /* ****** */
 
114
 
 
115
   unsigned int setup_cntl;             /* 0x304 */
 
116
 
 
117
   /* Texture state */
 
118
   unsigned int tex_size_pitch;         /* 0x770 */
 
119
   unsigned int tex_cntl;               /* 0x774 */
 
120
   unsigned int secondary_tex_off;      /* 0x778 */
 
121
   unsigned int tex_offset;             /* 0x5c0 */
 
122
} mach64_context_regs_t;
 
123
 
 
124
typedef struct {
 
125
   /* The channel for communication of state information to the kernel
 
126
    * on firing a vertex buffer.
 
127
    */
 
128
   mach64_context_regs_t ContextState;
 
129
   unsigned int dirty;
 
130
   unsigned int vertsize;
 
131
 
 
132
#ifdef XF86DRI
 
133
   /* The current cliprects, or a subset thereof.
 
134
    */
 
135
   drm_clip_rect_t boxes[MACH64_NR_SAREA_CLIPRECTS];
 
136
   unsigned int nbox;
 
137
#endif
 
138
   /* Counter for throttling of rendering clients.
 
139
    */
 
140
   unsigned int frames_queued;
 
141
 
 
142
   /* Maintain an LRU of contiguous regions of texture space.  If you
 
143
    * think you own a region of texture memory, and it has an age
 
144
    * different to the one you set, then you are mistaken and it has
 
145
    * been stolen by another client.  If global texAge hasn't changed,
 
146
    * there is no need to walk the list.
 
147
    *
 
148
    * These regions can be used as a proxy for the fine-grained texture
 
149
    * information of other clients - by maintaining them in the same
 
150
    * lru which is used to age their own textures, clients have an
 
151
    * approximate lru for the whole of global texture space, and can
 
152
    * make informed decisions as to which areas to kick out.  There is
 
153
    * no need to choose whether to kick out your own texture or someone
 
154
    * else's - simply eject them all in LRU order.
 
155
    */
 
156
   drmTextureRegion texList[MACH64_NR_TEX_HEAPS][MACH64_NR_TEX_REGIONS+1];
 
157
   unsigned int texAge[MACH64_NR_TEX_HEAPS];
 
158
 
 
159
   int ctxOwner;     /* last context to upload state */
 
160
} ATISAREAPrivRec, *ATISAREAPrivPtr;
 
161
 
 
162
#endif /* __MACH64_SAREA_H__ */