~ubuntu-branches/ubuntu/quantal/mesa/quantal

« back to all changes in this revision

Viewing changes to src/mesa/drivers/dri/i965/brw_context.c

  • Committer: Package Import Robot
  • Author(s): Timo Aaltonen
  • Date: 2012-08-23 15:37:30 UTC
  • mfrom: (1.7.6)
  • Revision ID: package-import@ubuntu.com-20120823153730-c499sefj7btu4386
Tags: 9.0~git20120821.c1114c61-0ubuntu1
* Merge from unreleased debian git.
  - Includes support for ATI Trinity PCI IDs (LP: #1009089)
* rules, control, libgl1-mesa-swx11*: Remove swx11 support.
* Refresh patches:
  - drop 115_llvm_dynamic_linking.diff,
    117_nullptr_check_in_query_version.patch, and
    118_glsl_initialize_samplers.patch, all upstream
  - disable 116_use_shared_galliumcore.diff until it's reviewed and
    reworked to apply
* not-installed, libegl1-mesa-drivers-install.linux.in: Updated to
  match the single-pass build.
* libgl1-mesa-dri.*install.in: Drop libglsl.so, it's included in
  libdricore.so now.
* rules: Don't disable GLU on the common flags, we need to build it
  on the dri target.
* libglu*install.in: Fix the source file paths to match the build target.
  Drop the static lib from -dev since only shared libs get built.
* libgl1-mesa-dev.install.in: Fix the source file paths to match the
  build target.
* libgl1-mesa-dri.install.linux.in: Don't try to install libgallium.so,
  which isn't built yet.
* rules: Enable llvmpipe on armhf to see if it works or not.
* rules: Remove bin/install-sh on clean, and don't create a symlink for
  it.
* control: Add Pre-Depends on dpkg-dev due to the binaries using xz
  compression.

Show diffs side-by-side

added added

removed removed

Lines of Context:
75
75
brwCreateContext(int api,
76
76
                 const struct gl_config *mesaVis,
77
77
                 __DRIcontext *driContextPriv,
 
78
                 unsigned major_version,
 
79
                 unsigned minor_version,
 
80
                 unsigned *error,
78
81
                 void *sharedContextPrivate)
79
82
{
80
83
   __DRIscreen *sPriv = driContextPriv->driScreenPriv;
81
84
   struct intel_screen *screen = sPriv->driverPrivate;
82
85
   struct dd_function_table functions;
 
86
   unsigned i;
 
87
 
 
88
   /* Filter against the requested API and version.
 
89
    */
 
90
   switch (api) {
 
91
   case API_OPENGL: {
 
92
#ifdef TEXTURE_FLOAT_ENABLED
 
93
      const unsigned max_version =
 
94
         (screen->gen == 6 ||
 
95
          (screen->gen == 7 && screen->kernel_has_gen7_sol_reset))
 
96
         ? 30 : 21;
 
97
#else
 
98
      const unsigned max_version = 21;
 
99
#endif
 
100
      const unsigned req_version = major_version * 10 + minor_version;
 
101
 
 
102
      if (req_version > max_version) {
 
103
         *error = __DRI_CTX_ERROR_BAD_VERSION;
 
104
         return false;
 
105
      }
 
106
      break;
 
107
   }
 
108
   case API_OPENGLES:
 
109
   case API_OPENGLES2:
 
110
      break;
 
111
   default:
 
112
      *error = __DRI_CTX_ERROR_BAD_API;
 
113
      return false;
 
114
   }
 
115
 
83
116
   struct brw_context *brw = rzalloc(NULL, struct brw_context);
84
 
   struct intel_context *intel = &brw->intel;
85
 
   struct gl_context *ctx = &intel->ctx;
86
 
   unsigned i;
87
 
 
88
117
   if (!brw) {
89
118
      printf("%s: failed to alloc context\n", __FUNCTION__);
 
119
      *error = __DRI_CTX_ERROR_NO_MEMORY;
90
120
      return false;
91
121
   }
92
122
 
93
123
   brwInitDriverFunctions(screen, &functions);
94
124
 
 
125
   struct intel_context *intel = &brw->intel;
 
126
   struct gl_context *ctx = &intel->ctx;
 
127
 
95
128
   if (!intelInitContext( intel, api, mesaVis, driContextPriv,
96
129
                          sharedContextPrivate, &functions )) {
97
130
      printf("%s: failed to init intel context\n", __FUNCTION__);
98
131
      FREE(brw);
 
132
      *error = __DRI_CTX_ERROR_NO_MEMORY;
99
133
      return false;
100
134
   }
101
135
 
108
142
 
109
143
   TNL_CONTEXT(ctx)->Driver.RunPipeline = _tnl_run_pipeline;
110
144
 
 
145
   ctx->Const.MaxDualSourceDrawBuffers = 1;
111
146
   ctx->Const.MaxDrawBuffers = BRW_MAX_DRAW_BUFFERS;
112
147
   ctx->Const.MaxTextureImageUnits = BRW_MAX_TEX_UNIT;
113
148
   ctx->Const.MaxTextureCoordUnits = 8; /* Mesa limit */
137
172
    * So we need to override the Mesa default (which is based only on software
138
173
    * limits).
139
174
    */
140
 
   ctx->Const.MaxTransformFeedbackSeparateAttribs = BRW_MAX_SOL_BUFFERS;
 
175
   ctx->Const.MaxTransformFeedbackBuffers = BRW_MAX_SOL_BUFFERS;
141
176
 
142
177
   /* On Gen6, in the worst case, we use up one binding table entry per
143
178
    * transform feedback component (see comments above the definition of
153
188
   ctx->Const.MaxTransformFeedbackSeparateComponents =
154
189
      BRW_MAX_SOL_BINDINGS / BRW_MAX_SOL_BUFFERS;
155
190
 
156
 
   /* Claim to support 4 multisamples, even though we don't.  This is a
157
 
    * requirement for GL 3.0 that we missed until the last minute.  Go ahead and
158
 
    * claim the limit, so that usage of the 4 multisample-based API that is
159
 
    * guaranteed in 3.0 succeeds, even though we only rasterize a single sample.
160
 
    */
161
 
   if (intel->gen >= 6)
 
191
   if (intel->gen == 6)
162
192
      ctx->Const.MaxSamples = 4;
 
193
   else if (intel->gen >= 7)
 
194
      ctx->Const.MaxSamples = 8;
163
195
 
164
196
   /* if conformance mode is set, swrast can handle any size AA point */
165
197
   ctx->Const.MaxPointSizeAA = 255.0;
247
279
         brw->urb.max_vs_entries = 512;
248
280
         brw->urb.max_gs_entries = 192;
249
281
      } else if (intel->gt == 2) {
250
 
         brw->max_wm_threads = 86;
 
282
         brw->max_wm_threads = 172;
251
283
         brw->max_vs_threads = 128;
252
284
         brw->max_gs_threads = 128;
253
285
         brw->urb.size = 256;
258
290
      }
259
291
   } else if (intel->gen == 6) {
260
292
      if (intel->gt == 2) {
261
 
         /* This could possibly be 80, but is supposed to require
262
 
          * disabling of WIZ hashing (bit 6 of GT_MODE, 0x20d0) and a
263
 
          * GPU reset to change.
264
 
          */
265
 
         brw->max_wm_threads = 40;
 
293
         brw->max_wm_threads = 80;
266
294
         brw->max_vs_threads = 60;
267
295
         brw->max_gs_threads = 60;
268
296
         brw->urb.size = 64;            /* volume 5c.5 section 5.1 */
273
301
         brw->max_vs_threads = 24;
274
302
         brw->max_gs_threads = 21; /* conservative; 24 if rendering disabled */
275
303
         brw->urb.size = 32;            /* volume 5c.5 section 5.1 */
276
 
         brw->urb.max_vs_entries = 128; /* volume 2a (see 3DSTATE_URB) */
 
304
         brw->urb.max_vs_entries = 256; /* volume 2a (see 3DSTATE_URB) */
277
305
         brw->urb.max_gs_entries = 256;
278
306
      }
279
307
      brw->urb.gen6_gs_previously_active = false;
295
323
      brw->has_negative_rhw_bug = true;
296
324
   }
297
325
 
 
326
   if (intel->gen <= 7) {
 
327
      brw->needs_unlit_centroid_workaround = true;
 
328
   }
 
329
 
 
330
   brw->prim_restart.in_progress = false;
 
331
   brw->prim_restart.enable_cut_index = false;
 
332
   intel->hw_ctx = drm_intel_gem_context_create(intel->bufmgr);
 
333
 
298
334
   brw_init_state( brw );
299
335
 
300
336
   brw->curbe.last_buf = calloc(1, 4096);