~ubuntu-branches/ubuntu/natty/mesa/natty-proposed

« back to all changes in this revision

Viewing changes to src/mesa/drivers/dri/r300/compiler/radeon_dataflow.c

  • Committer: Bazaar Package Importer
  • Author(s): Robert Hooker, Robert Hooker, Christopher James Halse Rogers
  • Date: 2010-09-14 08:55:40 UTC
  • mfrom: (1.2.28 upstream)
  • Revision ID: james.westby@ubuntu.com-20100914085540-m4fpl0hdjlfd4jgz
Tags: 7.9~git20100909-0ubuntu1
[ Robert Hooker ]
* New upstream git snapshot up to commit 94118fe2d4b1e5 (LP: #631413)
* New features include ATI HD5xxx series support in r600, and a vastly
  improved glsl compiler.
* Remove pre-generated .pc's, use the ones generated at build time
  instead.
* Remove all references to mesa-utils now that its no longer shipped
  with the mesa source.
* Disable the experimental ARB_fragment_shader option by default on
  i915, it exposes incomplete functionality that breaks KDE compositing
  among other things. It can be enabled via driconf still. (LP: #628930).

[ Christopher James Halse Rogers ]
* debian/patches/04_osmesa_version.diff:
  - Refresh for new upstream
* Bugs fixed in this release:
  - Fixes severe rendering corruption in Unity on radeon (LP: #628727,
    LP: #596292, LP: #599741, LP: #630315, LP: #613694, LP: #599741).
  - Also fixes rendering in gnome-shell (LP: #578619).
  - Flickering in OpenGL apps on radeon (LP: #626943, LP: #610541).
  - Provides preliminary support for new intel chips (LP: #601052).
* debian/rules:
  - Update configure flags to match upstream reshuffling.
  - Explicitly remove gallium DRI drivers that we don't want to ship.
* Update debian/gbp.conf for this Maverick-specific packaging
* libegl1-mesa-dri-x11,kms: There are no longer separate kms or x11 drivers
  for EGL, libegl1-mesa-drivers now contains a single driver that provides
  both backends.

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
#include "radeon_program.h"
31
31
 
32
32
 
33
 
static void reads_normal(struct rc_instruction * fullinst, rc_read_write_fn cb, void * userdata)
 
33
static void reads_normal(struct rc_instruction * fullinst, rc_read_write_chan_fn cb, void * userdata)
34
34
{
35
35
        struct rc_sub_instruction * inst = &fullinst->U.I;
36
36
        const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->Opcode);
46
46
 
47
47
                refmask &= RC_MASK_XYZW;
48
48
 
49
 
                for(unsigned int chan = 0; chan < 4; ++chan) {
50
 
                        if (GET_BIT(refmask, chan)) {
51
 
                                cb(userdata, fullinst, inst->SrcReg[src].File, inst->SrcReg[src].Index, chan);
52
 
                        }
53
 
                }
 
49
                if (refmask)
 
50
                        cb(userdata, fullinst, inst->SrcReg[src].File, inst->SrcReg[src].Index, refmask);
54
51
 
55
52
                if (refmask && inst->SrcReg[src].RelAddr)
56
53
                        cb(userdata, fullinst, RC_FILE_ADDRESS, 0, RC_MASK_X);
57
54
        }
58
55
}
59
56
 
60
 
static void reads_pair(struct rc_instruction * fullinst,  rc_read_write_fn cb, void * userdata)
 
57
static void reads_pair(struct rc_instruction * fullinst,  rc_read_write_mask_fn cb, void * userdata)
61
58
{
62
59
        struct rc_pair_instruction * inst = &fullinst->U.P;
63
60
        unsigned int refmasks[3] = { 0, 0, 0 };
84
81
        }
85
82
 
86
83
        for(unsigned int src = 0; src < 3; ++src) {
87
 
                if (inst->RGB.Src[src].Used) {
88
 
                        for(unsigned int chan = 0; chan < 3; ++chan) {
89
 
                                if (GET_BIT(refmasks[src], chan))
90
 
                                        cb(userdata, fullinst, inst->RGB.Src[src].File, inst->RGB.Src[src].Index, chan);
91
 
                        }
92
 
                }
 
84
                if (inst->RGB.Src[src].Used && (refmasks[src] & RC_MASK_XYZ))
 
85
                        cb(userdata, fullinst, inst->RGB.Src[src].File, inst->RGB.Src[src].Index,
 
86
                           refmasks[src] & RC_MASK_XYZ);
93
87
 
94
 
                if (inst->Alpha.Src[src].Used) {
95
 
                        if (GET_BIT(refmasks[src], 3))
96
 
                                cb(userdata, fullinst, inst->Alpha.Src[src].File, inst->Alpha.Src[src].Index, 3);
97
 
                }
 
88
                if (inst->Alpha.Src[src].Used && (refmasks[src] & RC_MASK_W))
 
89
                        cb(userdata, fullinst, inst->Alpha.Src[src].File, inst->Alpha.Src[src].Index, RC_MASK_W);
98
90
        }
99
91
}
100
92
 
101
93
/**
102
 
 * Calls a callback function for all sourced register channels.
 
94
 * Calls a callback function for all register reads.
103
95
 *
104
 
 * This is conservative, i.e. channels may be called multiple times,
105
 
 * and the writemask of the instruction is not taken into account.
 
96
 * This is conservative, i.e. if the same register is referenced multiple times,
 
97
 * the callback may also be called multiple times.
 
98
 * Also, the writemask of the instruction is not taken into account.
106
99
 */
107
 
void rc_for_all_reads(struct rc_instruction * inst, rc_read_write_fn cb, void * userdata)
 
100
void rc_for_all_reads_mask(struct rc_instruction * inst, rc_read_write_mask_fn cb, void * userdata)
108
101
{
109
102
        if (inst->Type == RC_INSTRUCTION_NORMAL) {
110
103
                reads_normal(inst, cb, userdata);
115
108
 
116
109
 
117
110
 
118
 
static void writes_normal(struct rc_instruction * fullinst, rc_read_write_fn cb, void * userdata)
 
111
static void writes_normal(struct rc_instruction * fullinst, rc_read_write_mask_fn cb, void * userdata)
119
112
{
120
113
        struct rc_sub_instruction * inst = &fullinst->U.I;
121
114
        const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->Opcode);
122
115
 
123
 
        if (opcode->HasDstReg) {
124
 
                for(unsigned int chan = 0; chan < 4; ++chan) {
125
 
                        if (GET_BIT(inst->DstReg.WriteMask, chan))
126
 
                                cb(userdata, fullinst, inst->DstReg.File, inst->DstReg.Index, chan);
127
 
                }
128
 
        }
 
116
        if (opcode->HasDstReg && inst->DstReg.WriteMask)
 
117
                cb(userdata, fullinst, inst->DstReg.File, inst->DstReg.Index, inst->DstReg.WriteMask);
129
118
 
130
119
        if (inst->WriteALUResult)
131
 
                cb(userdata, fullinst, RC_FILE_SPECIAL, RC_SPECIAL_ALU_RESULT, 0);
 
120
                cb(userdata, fullinst, RC_FILE_SPECIAL, RC_SPECIAL_ALU_RESULT, RC_MASK_X);
132
121
}
133
122
 
134
 
static void writes_pair(struct rc_instruction * fullinst, rc_read_write_fn cb, void * userdata)
 
123
static void writes_pair(struct rc_instruction * fullinst, rc_read_write_mask_fn cb, void * userdata)
135
124
{
136
125
        struct rc_pair_instruction * inst = &fullinst->U.P;
137
126
 
138
 
        for(unsigned int chan = 0; chan < 3; ++chan) {
139
 
                if (GET_BIT(inst->RGB.WriteMask, chan))
140
 
                        cb(userdata, fullinst, RC_FILE_TEMPORARY, inst->RGB.DestIndex, chan);
141
 
        }
 
127
        if (inst->RGB.WriteMask)
 
128
                cb(userdata, fullinst, RC_FILE_TEMPORARY, inst->RGB.DestIndex, inst->RGB.WriteMask);
142
129
 
143
130
        if (inst->Alpha.WriteMask)
144
 
                cb(userdata, fullinst, RC_FILE_TEMPORARY, inst->Alpha.DestIndex, 3);
 
131
                cb(userdata, fullinst, RC_FILE_TEMPORARY, inst->Alpha.DestIndex, RC_MASK_W);
145
132
 
146
133
        if (inst->WriteALUResult)
147
 
                cb(userdata, fullinst, RC_FILE_SPECIAL, RC_SPECIAL_ALU_RESULT, 0);
 
134
                cb(userdata, fullinst, RC_FILE_SPECIAL, RC_SPECIAL_ALU_RESULT, RC_MASK_X);
148
135
}
149
136
 
150
137
/**
151
 
 * Calls a callback function for all written register channels.
 
138
 * Calls a callback function for all register writes in the instruction,
 
139
 * reporting writemasks to the callback function.
152
140
 *
153
141
 * \warning Does not report output registers for paired instructions!
154
142
 */
155
 
void rc_for_all_writes(struct rc_instruction * inst, rc_read_write_fn cb, void * userdata)
 
143
void rc_for_all_writes_mask(struct rc_instruction * inst, rc_read_write_mask_fn cb, void * userdata)
156
144
{
157
145
        if (inst->Type == RC_INSTRUCTION_NORMAL) {
158
146
                writes_normal(inst, cb, userdata);
160
148
                writes_pair(inst, cb, userdata);
161
149
        }
162
150
}
 
151
 
 
152
 
 
153
struct mask_to_chan_data {
 
154
        void * UserData;
 
155
        rc_read_write_chan_fn Fn;
 
156
};
 
157
 
 
158
static void mask_to_chan_cb(void * data, struct rc_instruction * inst,
 
159
                rc_register_file file, unsigned int index, unsigned int mask)
 
160
{
 
161
        struct mask_to_chan_data * d = data;
 
162
        for(unsigned int chan = 0; chan < 4; ++chan) {
 
163
                if (GET_BIT(mask, chan))
 
164
                        d->Fn(d->UserData, inst, file, index, chan);
 
165
        }
 
166
}
 
167
 
 
168
/**
 
169
 * Calls a callback function for all sourced register channels.
 
170
 *
 
171
 * This is conservative, i.e. channels may be called multiple times,
 
172
 * and the writemask of the instruction is not taken into account.
 
173
 */
 
174
void rc_for_all_reads_chan(struct rc_instruction * inst, rc_read_write_chan_fn cb, void * userdata)
 
175
{
 
176
        struct mask_to_chan_data d;
 
177
        d.UserData = userdata;
 
178
        d.Fn = cb;
 
179
        rc_for_all_reads_mask(inst, &mask_to_chan_cb, &d);
 
180
}
 
181
 
 
182
/**
 
183
 * Calls a callback function for all written register channels.
 
184
 *
 
185
 * \warning Does not report output registers for paired instructions!
 
186
 */
 
187
void rc_for_all_writes_chan(struct rc_instruction * inst, rc_read_write_chan_fn cb, void * userdata)
 
188
{
 
189
        struct mask_to_chan_data d;
 
190
        d.UserData = userdata;
 
191
        d.Fn = cb;
 
192
        rc_for_all_writes_mask(inst, &mask_to_chan_cb, &d);
 
193
}
 
194
 
 
195
static void remap_normal_instruction(struct rc_instruction * fullinst,
 
196
                rc_remap_register_fn cb, void * userdata)
 
197
{
 
198
        struct rc_sub_instruction * inst = &fullinst->U.I;
 
199
        const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->Opcode);
 
200
 
 
201
        if (opcode->HasDstReg) {
 
202
                rc_register_file file = inst->DstReg.File;
 
203
                unsigned int index = inst->DstReg.Index;
 
204
 
 
205
                cb(userdata, fullinst, &file, &index);
 
206
 
 
207
                inst->DstReg.File = file;
 
208
                inst->DstReg.Index = index;
 
209
        }
 
210
 
 
211
        for(unsigned int src = 0; src < opcode->NumSrcRegs; ++src) {
 
212
                rc_register_file file = inst->SrcReg[src].File;
 
213
                unsigned int index = inst->SrcReg[src].Index;
 
214
 
 
215
                cb(userdata, fullinst, &file, &index);
 
216
 
 
217
                inst->SrcReg[src].File = file;
 
218
                inst->SrcReg[src].Index = index;
 
219
        }
 
220
}
 
221
 
 
222
static void remap_pair_instruction(struct rc_instruction * fullinst,
 
223
                rc_remap_register_fn cb, void * userdata)
 
224
{
 
225
        struct rc_pair_instruction * inst = &fullinst->U.P;
 
226
 
 
227
        if (inst->RGB.WriteMask) {
 
228
                rc_register_file file = RC_FILE_TEMPORARY;
 
229
                unsigned int index = inst->RGB.DestIndex;
 
230
 
 
231
                cb(userdata, fullinst, &file, &index);
 
232
 
 
233
                inst->RGB.DestIndex = index;
 
234
        }
 
235
 
 
236
        if (inst->Alpha.WriteMask) {
 
237
                rc_register_file file = RC_FILE_TEMPORARY;
 
238
                unsigned int index = inst->Alpha.DestIndex;
 
239
 
 
240
                cb(userdata, fullinst, &file, &index);
 
241
 
 
242
                inst->Alpha.DestIndex = index;
 
243
        }
 
244
 
 
245
        for(unsigned int src = 0; src < 3; ++src) {
 
246
                if (inst->RGB.Src[src].Used) {
 
247
                        rc_register_file file = inst->RGB.Src[src].File;
 
248
                        unsigned int index = inst->RGB.Src[src].Index;
 
249
 
 
250
                        cb(userdata, fullinst, &file, &index);
 
251
 
 
252
                        inst->RGB.Src[src].File = file;
 
253
                        inst->RGB.Src[src].Index = index;
 
254
                }
 
255
 
 
256
                if (inst->Alpha.Src[src].Used) {
 
257
                        rc_register_file file = inst->Alpha.Src[src].File;
 
258
                        unsigned int index = inst->Alpha.Src[src].Index;
 
259
 
 
260
                        cb(userdata, fullinst, &file, &index);
 
261
 
 
262
                        inst->Alpha.Src[src].File = file;
 
263
                        inst->Alpha.Src[src].Index = index;
 
264
                }
 
265
        }
 
266
}
 
267
 
 
268
 
 
269
/**
 
270
 * Remap all register accesses according to the given function.
 
271
 * That is, call the function \p cb for each referenced register (both read and written)
 
272
 * and update the given instruction \p inst accordingly
 
273
 * if it modifies its \ref pfile and \ref pindex contents.
 
274
 */
 
275
void rc_remap_registers(struct rc_instruction * inst, rc_remap_register_fn cb, void * userdata)
 
276
{
 
277
        if (inst->Type == RC_INSTRUCTION_NORMAL)
 
278
                remap_normal_instruction(inst, cb, userdata);
 
279
        else
 
280
                remap_pair_instruction(inst, cb, userdata);
 
281
}