summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/i965/brw_context.c116
-rw-r--r--src/mesa/drivers/dri/i965/intel_context.h10
2 files changed, 43 insertions, 83 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
index 63f3a1fb91b..a283f5be66b 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -548,21 +548,42 @@ brwCreateContext(gl_api api,
return false;
}
- brw_process_driconf_options(brw);
+ /* Initialize the software rasterizer and helper modules.
+ *
+ * As of GL 3.1 core, the gen4+ driver doesn't need the swrast context for
+ * software fallbacks (which we have to support on legacy GL to do weird
+ * glDrawPixels(), glBitmap(), and other functions).
+ */
+ if (api != API_OPENGL_CORE && api != API_OPENGLES2) {
+ _swrast_CreateContext(ctx);
+ }
- if (!intelInitContext( brw, api, major_version, minor_version,
- mesaVis, driContextPriv,
- sharedContextPrivate, &functions,
- dri_ctx_error)) {
- intelDestroyContext(driContextPriv);
- return false;
+ _vbo_CreateContext(ctx);
+ if (ctx->swrast_context) {
+ _tnl_CreateContext(ctx);
+ TNL_CONTEXT(ctx)->Driver.RunPipeline = _tnl_run_pipeline;
+ _swsetup_CreateContext(ctx);
+
+ /* Configure swrast to match hardware characteristics: */
+ _swrast_allow_pixel_fog(ctx, false);
+ _swrast_allow_vertex_fog(ctx, true);
}
+ _mesa_meta_init(ctx);
+
+ brw_process_driconf_options(brw);
+ brw_process_intel_debug_variable(brw);
brw_initialize_context_constants(brw);
/* Reinitialize the context point state. It depends on ctx->Const values. */
_mesa_init_point(ctx);
+ intelInitExtensions(ctx);
+
+ intel_batchbuffer_init(brw);
+
+ intel_fbo_init(brw);
+
if (brw->gen >= 6) {
/* Create a new hardware context. Using a hardware context means that
* our GPU state will be saved/restored on context switch, allowing us
@@ -582,11 +603,6 @@ brwCreateContext(gl_api api,
brw_init_surface_formats(brw);
- /* Initialize swrast, tnl driver tables: */
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- if (tnl)
- tnl->Driver.RunPipeline = _tnl_run_pipeline;
-
ctx->DriverFlags.NewTransformFeedback = BRW_NEW_TRANSFORM_FEEDBACK;
ctx->DriverFlags.NewRasterizerDiscard = BRW_NEW_RASTERIZER_DISCARD;
ctx->DriverFlags.NewUniformBuffer = BRW_NEW_UNIFORM_BUFFER;
@@ -607,6 +623,21 @@ brwCreateContext(gl_api api,
brw->urb.max_vs_entries = devinfo->urb.max_vs_entries;
brw->urb.max_gs_entries = devinfo->urb.max_gs_entries;
+ /* Estimate the size of the mappable aperture into the GTT. There's an
+ * ioctl to get the whole GTT size, but not one to get the mappable subset.
+ * It turns out it's basically always 256MB, though some ancient hardware
+ * was smaller.
+ */
+ uint32_t gtt_size = 256 * 1024 * 1024;
+
+ /* We don't want to map two objects such that a memcpy between them would
+ * just fault one mapping in and then the other over and over forever. So
+ * we would need to divide the GTT size by 2. Additionally, some GTT is
+ * taken up by things like the framebuffer and the ringbuffer and such, so
+ * be more conservative.
+ */
+ brw->max_gtt_map_object_size = gtt_size / 4;
+
if (brw->gen == 6)
brw->urb.gen6_gs_previously_active = false;
@@ -650,67 +681,6 @@ brwCreateContext(gl_api api,
return true;
}
-bool
-intelInitContext(struct brw_context *brw,
- int api,
- unsigned major_version,
- unsigned minor_version,
- const struct gl_config * mesaVis,
- __DRIcontext * driContextPriv,
- void *sharedContextPrivate,
- struct dd_function_table *functions,
- unsigned *dri_ctx_error)
-{
- struct gl_context *ctx = &brw->ctx;
-
- /* Estimate the size of the mappable aperture into the GTT. There's an
- * ioctl to get the whole GTT size, but not one to get the mappable subset.
- * It turns out it's basically always 256MB, though some ancient hardware
- * was smaller.
- */
- uint32_t gtt_size = 256 * 1024 * 1024;
-
- /* We don't want to map two objects such that a memcpy between them would
- * just fault one mapping in and then the other over and over forever. So
- * we would need to divide the GTT size by 2. Additionally, some GTT is
- * taken up by things like the framebuffer and the ringbuffer and such, so
- * be more conservative.
- */
- brw->max_gtt_map_object_size = gtt_size / 4;
-
- /* Initialize the software rasterizer and helper modules.
- *
- * As of GL 3.1 core, the gen4+ driver doesn't need the swrast context for
- * software fallbacks (which we have to support on legacy GL to do weird
- * glDrawPixels(), glBitmap(), and other functions).
- */
- if (api != API_OPENGL_CORE && api != API_OPENGLES2) {
- _swrast_CreateContext(ctx);
- }
-
- _vbo_CreateContext(ctx);
- if (ctx->swrast_context) {
- _tnl_CreateContext(ctx);
- _swsetup_CreateContext(ctx);
-
- /* Configure swrast to match hardware characteristics: */
- _swrast_allow_pixel_fog(ctx, false);
- _swrast_allow_vertex_fog(ctx, true);
- }
-
- _mesa_meta_init(ctx);
-
- intelInitExtensions(ctx);
-
- brw_process_intel_debug_variable(brw);
-
- intel_batchbuffer_init(brw);
-
- intel_fbo_init(brw);
-
- return true;
-}
-
void
intelDestroyContext(__DRIcontext * driContextPriv)
{
diff --git a/src/mesa/drivers/dri/i965/intel_context.h b/src/mesa/drivers/dri/i965/intel_context.h
index 9ec8c6336e3..78564624569 100644
--- a/src/mesa/drivers/dri/i965/intel_context.h
+++ b/src/mesa/drivers/dri/i965/intel_context.h
@@ -164,16 +164,6 @@ static INLINE void * __memcpy(void * to, const void * from, size_t n)
* intel_context.c:
*/
-extern bool intelInitContext(struct brw_context *brw,
- int api,
- unsigned major_version,
- unsigned minor_version,
- const struct gl_config * mesaVis,
- __DRIcontext * driContextPriv,
- void *sharedContextPrivate,
- struct dd_function_table *functions,
- unsigned *dri_ctx_error);
-
extern void intelFinish(struct gl_context * ctx);
extern void intelInitDriverFunctions(struct dd_function_table *functions);