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

« back to all changes in this revision

Viewing changes to src/gallium/drivers/nv50/nv50_context.h

  • 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:
16
16
#include "nouveau/nouveau_winsys.h"
17
17
#include "nouveau/nouveau_gldefs.h"
18
18
#include "nouveau/nouveau_stateobj.h"
19
 
#include "nouveau/nouveau_context.h"
 
19
#include "nv50_reg.h"
20
20
 
21
21
#include "nv50_screen.h"
22
22
#include "nv50_program.h"
23
23
 
24
24
#define NOUVEAU_ERR(fmt, args...) \
25
 
        fprintf(stderr, "%s:%d -  "fmt, __func__, __LINE__, ##args);
 
25
        fprintf(stderr, "%s:%d -  "fmt, __FUNCTION__, __LINE__, ##args);
26
26
#define NOUVEAU_MSG(fmt, args...) \
27
27
        fprintf(stderr, "nouveau: "fmt, ##args);
28
28
 
51
51
#define NV50_NEW_SAMPLER        (1 << 15)
52
52
#define NV50_NEW_TEXTURE        (1 << 16)
53
53
#define NV50_NEW_STENCIL_REF    (1 << 17)
 
54
#define NV50_NEW_CLIP           (1 << 18)
54
55
 
55
56
struct nv50_blend_stateobj {
56
57
        struct pipe_blend_state pipe;
72
73
        unsigned tsc[8];
73
74
};
74
75
 
 
76
struct nv50_sampler_view {
 
77
        struct pipe_sampler_view pipe;
 
78
        uint32_t tic[8];
 
79
};
 
80
 
 
81
struct nv50_vtxelt_stateobj {
 
82
        struct pipe_vertex_element pipe[16];
 
83
        unsigned num_elements;
 
84
        uint32_t hw[16];
 
85
};
 
86
 
 
87
static INLINE struct nv50_sampler_view *
 
88
nv50_sampler_view(struct pipe_sampler_view *view)
 
89
{
 
90
        return (struct nv50_sampler_view *)view;
 
91
}
 
92
 
75
93
static INLINE unsigned
76
94
get_tile_height(uint32_t tile_mode)
77
95
{
84
102
        return 1 << (tile_mode >> 4);
85
103
}
86
104
 
87
 
struct nv50_miptree_level {
88
 
        int *image_offset;
89
 
        unsigned pitch;
90
 
        unsigned tile_mode;
91
 
};
92
 
 
93
 
struct nv50_miptree {
94
 
        struct nouveau_miptree base;
95
 
 
96
 
        struct nv50_miptree_level level[PIPE_MAX_TEXTURE_LEVELS];
97
 
        int image_nr;
98
 
        int total_size;
99
 
};
100
 
 
101
 
static INLINE struct nv50_miptree *
102
 
nv50_miptree(struct pipe_texture *pt)
103
 
{
104
 
        return (struct nv50_miptree *)pt;
105
 
}
106
105
 
107
106
struct nv50_surface {
108
107
        struct pipe_surface base;
115
114
}
116
115
 
117
116
struct nv50_state {
118
 
        unsigned dirty;
 
117
        struct nouveau_stateobj *hw[64];
 
118
        uint64_t hw_dirty;
119
119
 
120
 
        struct nouveau_stateobj *fb;
121
 
        struct nouveau_stateobj *blend;
122
 
        struct nouveau_stateobj *blend_colour;
123
 
        struct nouveau_stateobj *zsa;
124
 
        struct nouveau_stateobj *stencil_ref;
125
 
        struct nouveau_stateobj *rast;
126
 
        struct nouveau_stateobj *stipple;
127
 
        struct nouveau_stateobj *scissor;
128
 
        unsigned scissor_enabled;
129
 
        struct nouveau_stateobj *viewport;
130
 
        struct nouveau_stateobj *tsc_upload;
131
 
        struct nouveau_stateobj *tic_upload;
132
 
        unsigned miptree_nr[PIPE_SHADER_TYPES];
133
 
        struct nouveau_stateobj *vertprog;
134
 
        struct nouveau_stateobj *fragprog;
135
 
        struct nouveau_stateobj *geomprog;
136
 
        struct nouveau_stateobj *fp_linkage;
137
 
        struct nouveau_stateobj *gp_linkage;
138
 
        struct nouveau_stateobj *vtxfmt;
 
120
        unsigned sampler_view_nr[3];
139
121
        struct nouveau_stateobj *vtxbuf;
140
122
        struct nouveau_stateobj *vtxattr;
141
 
        struct nouveau_stateobj *instbuf;
142
123
        unsigned vtxelt_nr;
143
124
};
144
125
 
161
142
        struct pipe_scissor_state scissor;
162
143
        struct pipe_viewport_state viewport;
163
144
        struct pipe_framebuffer_state framebuffer;
 
145
        struct pipe_clip_state clip;
164
146
        struct nv50_program *vertprog;
165
147
        struct nv50_program *fragprog;
166
148
        struct nv50_program *geomprog;
167
 
        struct pipe_buffer *constbuf[PIPE_SHADER_TYPES];
 
149
        struct pipe_resource *constbuf[PIPE_SHADER_TYPES];
168
150
        struct pipe_vertex_buffer vtxbuf[PIPE_MAX_ATTRIBS];
169
151
        unsigned vtxbuf_nr;
170
 
        struct pipe_vertex_element vtxelt[PIPE_MAX_ATTRIBS];
171
 
        unsigned vtxelt_nr;
172
 
        struct nv50_sampler_stateobj *sampler[PIPE_SHADER_TYPES][PIPE_MAX_SAMPLERS];
173
 
        unsigned sampler_nr[PIPE_SHADER_TYPES];
174
 
        struct nv50_miptree *miptree[PIPE_SHADER_TYPES][PIPE_MAX_SAMPLERS];
175
 
        unsigned miptree_nr[PIPE_SHADER_TYPES];
 
152
        struct pipe_index_buffer idxbuf;
 
153
        struct nv50_vtxelt_stateobj *vtxelt;
 
154
        struct nv50_sampler_stateobj *sampler[3][PIPE_MAX_SAMPLERS];
 
155
        unsigned sampler_nr[3];
 
156
        struct pipe_sampler_view *sampler_views[3][PIPE_MAX_SAMPLERS];
 
157
        unsigned sampler_view_nr[3];
176
158
 
177
 
        uint16_t vbo_fifo;
 
159
        unsigned vbo_fifo;
178
160
};
179
161
 
180
162
static INLINE struct nv50_context *
186
168
extern void nv50_init_surface_functions(struct nv50_context *nv50);
187
169
extern void nv50_init_state_functions(struct nv50_context *nv50);
188
170
extern void nv50_init_query_functions(struct nv50_context *nv50);
 
171
extern void nv50_init_transfer_functions(struct nv50_context *nv50);
189
172
 
190
173
extern void nv50_screen_init_miptree_functions(struct pipe_screen *pscreen);
191
174
 
198
181
extern struct draw_stage *nv50_draw_render_stage(struct nv50_context *nv50);
199
182
 
200
183
/* nv50_vbo.c */
201
 
extern void nv50_draw_arrays(struct pipe_context *, unsigned mode,
202
 
                                unsigned start, unsigned count);
203
 
extern void nv50_draw_arrays_instanced(struct pipe_context *, unsigned mode,
204
 
                                        unsigned start, unsigned count,
205
 
                                        unsigned startInstance,
206
 
                                        unsigned instanceCount);
207
 
extern void nv50_draw_elements(struct pipe_context *pipe,
208
 
                                  struct pipe_buffer *indexBuffer,
209
 
                                  unsigned indexSize,
210
 
                                  unsigned mode, unsigned start,
211
 
                                  unsigned count);
212
 
extern void nv50_draw_elements_instanced(struct pipe_context *pipe,
213
 
                                         struct pipe_buffer *indexBuffer,
214
 
                                         unsigned indexSize,
215
 
                                         unsigned mode, unsigned start,
216
 
                                         unsigned count,
217
 
                                         unsigned startInstance,
218
 
                                         unsigned instanceCount);
219
 
extern void nv50_vbo_validate(struct nv50_context *nv50);
 
184
extern void nv50_draw_vbo(struct pipe_context *pipe,
 
185
                          const struct pipe_draw_info *info);
 
186
extern void nv50_vtxelt_construct(struct nv50_vtxelt_stateobj *cso);
 
187
extern struct nouveau_stateobj *nv50_vbo_validate(struct nv50_context *nv50);
 
188
 
 
189
/* nv50_push.c */
 
190
extern void
 
191
nv50_push_elements_instanced(struct pipe_context *, struct pipe_resource *,
 
192
                             unsigned idxsize, int idxbias,
 
193
                             unsigned mode, unsigned start,
 
194
                             unsigned count, unsigned i_start,
 
195
                             unsigned i_count);
220
196
 
221
197
/* nv50_clear.c */
222
198
extern void nv50_clear(struct pipe_context *pipe, unsigned buffers,
223
199
                       const float *rgba, double depth, unsigned stencil);
224
200
 
225
201
/* nv50_program.c */
226
 
extern void nv50_vertprog_validate(struct nv50_context *nv50);
227
 
extern void nv50_fragprog_validate(struct nv50_context *nv50);
228
 
extern void nv50_geomprog_validate(struct nv50_context *nv50);
229
 
extern void nv50_fp_linkage_validate(struct nv50_context *nv50);
230
 
extern void nv50_gp_linkage_validate(struct nv50_context *nv50);
 
202
extern struct nouveau_stateobj *
 
203
nv50_vertprog_validate(struct nv50_context *nv50);
 
204
extern struct nouveau_stateobj *
 
205
nv50_fragprog_validate(struct nv50_context *nv50);
 
206
extern struct nouveau_stateobj *
 
207
nv50_geomprog_validate(struct nv50_context *nv50);
 
208
extern struct nouveau_stateobj *
 
209
nv50_fp_linkage_validate(struct nv50_context *nv50);
 
210
extern struct nouveau_stateobj *
 
211
nv50_gp_linkage_validate(struct nv50_context *nv50);
231
212
extern void nv50_program_destroy(struct nv50_context *nv50,
232
213
                                 struct nv50_program *p);
233
214
 
234
215
/* nv50_state_validate.c */
235
 
extern boolean nv50_state_validate(struct nv50_context *nv50);
236
 
extern void nv50_state_flush_notify(struct nouveau_channel *chan);
 
216
extern boolean nv50_state_validate(struct nv50_context *nv50, unsigned dwords);
237
217
 
238
218
extern void nv50_so_init_sifc(struct nv50_context *nv50,
239
219
                              struct nouveau_stateobj *so,
241
221
                              unsigned offset, unsigned size);
242
222
 
243
223
/* nv50_tex.c */
244
 
extern void nv50_tex_validate(struct nv50_context *);
 
224
extern boolean nv50_tex_construct(struct nv50_sampler_view *view);
 
225
extern void nv50_tex_relocs(struct nv50_context *);
 
226
extern struct nouveau_stateobj *nv50_tex_validate(struct nv50_context *);
245
227
 
246
 
/* nv50_transfer.c */
247
 
extern void
248
 
nv50_upload_sifc(struct nv50_context *nv50,
249
 
                 struct nouveau_bo *bo, unsigned dst_offset, unsigned reloc,
250
 
                 unsigned dst_format, int dst_w, int dst_h, int dst_pitch,
251
 
                 void *src, unsigned src_format, int src_pitch,
252
 
                 int x, int y, int w, int h, int cpp);
253
228
 
254
229
/* nv50_context.c */
255
230
struct pipe_context *
256
231
nv50_create(struct pipe_screen *pscreen, void *priv);
257
232
 
 
233
static INLINE unsigned
 
234
nv50_prim(unsigned mode)
 
235
{
 
236
        switch (mode) {
 
237
        case PIPE_PRIM_POINTS: return NV50TCL_VERTEX_BEGIN_POINTS;
 
238
        case PIPE_PRIM_LINES: return NV50TCL_VERTEX_BEGIN_LINES;
 
239
        case PIPE_PRIM_LINE_LOOP: return NV50TCL_VERTEX_BEGIN_LINE_LOOP;
 
240
        case PIPE_PRIM_LINE_STRIP: return NV50TCL_VERTEX_BEGIN_LINE_STRIP;
 
241
        case PIPE_PRIM_TRIANGLES: return NV50TCL_VERTEX_BEGIN_TRIANGLES;
 
242
        case PIPE_PRIM_TRIANGLE_STRIP:
 
243
                return NV50TCL_VERTEX_BEGIN_TRIANGLE_STRIP;
 
244
        case PIPE_PRIM_TRIANGLE_FAN: return NV50TCL_VERTEX_BEGIN_TRIANGLE_FAN;
 
245
        case PIPE_PRIM_QUADS: return NV50TCL_VERTEX_BEGIN_QUADS;
 
246
        case PIPE_PRIM_QUAD_STRIP: return NV50TCL_VERTEX_BEGIN_QUAD_STRIP;
 
247
        case PIPE_PRIM_POLYGON: return NV50TCL_VERTEX_BEGIN_POLYGON;
 
248
        case PIPE_PRIM_LINES_ADJACENCY:
 
249
                return NV50TCL_VERTEX_BEGIN_LINES_ADJACENCY;
 
250
        case PIPE_PRIM_LINE_STRIP_ADJACENCY:
 
251
                return NV50TCL_VERTEX_BEGIN_LINE_STRIP_ADJACENCY;
 
252
        case PIPE_PRIM_TRIANGLES_ADJACENCY:
 
253
                return NV50TCL_VERTEX_BEGIN_TRIANGLES_ADJACENCY;
 
254
        case PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY:
 
255
                return NV50TCL_VERTEX_BEGIN_TRIANGLE_STRIP_ADJACENCY;
 
256
        default:
 
257
                break;
 
258
        }
 
259
 
 
260
        NOUVEAU_ERR("invalid primitive type %d\n", mode);
 
261
        return NV50TCL_VERTEX_BEGIN_POINTS;
 
262
}
 
263
 
258
264
#endif