summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2012-08-26 15:29:12 -0700
committerEric Anholt <eric@anholt.net>2012-08-28 11:43:04 -0700
commit67e9ae856355be532455c1cf1211d59b3a4c5992 (patch)
tree93ec803a9a79e7485d6a33a0f97ca810b01d22b9
parent993c52d0be5bdf0e30e64ab4c6e1347c5dcb8e3b (diff)
downloadexternal_mesa3d-67e9ae856355be532455c1cf1211d59b3a4c5992.zip
external_mesa3d-67e9ae856355be532455c1cf1211d59b3a4c5992.tar.gz
external_mesa3d-67e9ae856355be532455c1cf1211d59b3a4c5992.tar.bz2
i965: Disable the swrast context setup on GL 3.1 core.
I've reviewed the code, and the swrast callsites remaining are all in drawpixels/copypixels/bitmap/accum, or _swrast_BlitFramebuffer that shouldn't be hit. A piglit run with the context setup disabled on legacy GL and GLES2 showed regressions only in the copypixels and drawpixels tests. If the context type is forced, this reduces the shader_runner maximum heap size for glsl-algebraic-add-add-1.shader_test from 15,137,496b to 4,165,376b. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
-rw-r--r--src/mesa/drivers/dri/i965/brw_context.c4
-rw-r--r--src/mesa/drivers/dri/intel/intel_context.c39
-rw-r--r--src/mesa/drivers/dri/intel/intel_span.c6
3 files changed, 34 insertions, 15 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
index 7f8197d..f83f89f 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -140,7 +140,9 @@ brwCreateContext(int api,
/* Initialize swrast, tnl driver tables: */
intelInitSpanFuncs(ctx);
- TNL_CONTEXT(ctx)->Driver.RunPipeline = _tnl_run_pipeline;
+ TNLcontext *tnl = TNL_CONTEXT(ctx);
+ if (tnl)
+ tnl->Driver.RunPipeline = _tnl_run_pipeline;
ctx->Const.MaxDualSourceDrawBuffers = 1;
ctx->Const.MaxDrawBuffers = BRW_MAX_DRAW_BUFFERS;
diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c
index 233172f..25334da 100644
--- a/src/mesa/drivers/dri/intel/intel_context.c
+++ b/src/mesa/drivers/dri/intel/intel_context.c
@@ -500,7 +500,8 @@ intelInvalidateState(struct gl_context * ctx, GLuint new_state)
{
struct intel_context *intel = intel_context(ctx);
- _swrast_InvalidateState(ctx, new_state);
+ if (ctx->swrast_context)
+ _swrast_InvalidateState(ctx, new_state);
_vbo_InvalidateState(ctx, new_state);
intel->NewGLState |= new_state;
@@ -696,15 +697,25 @@ intelInitContext(struct intel_context *intel,
ctx->Const.MaxRenderbufferSize = 2048;
}
- /* Initialize the software rasterizer and helper modules. */
- _swrast_CreateContext(ctx);
+ /* 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 (intel->gen <= 3 || api != API_OPENGL_CORE) {
+ _swrast_CreateContext(ctx);
+ }
+
_vbo_CreateContext(ctx);
- _tnl_CreateContext(ctx);
- _swsetup_CreateContext(ctx);
-
- /* Configure swrast to match hardware characteristics: */
- _swrast_allow_pixel_fog(ctx, false);
- _swrast_allow_vertex_fog(ctx, true);
+ 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);
@@ -782,6 +793,7 @@ intelDestroyContext(__DRIcontext * driContextPriv)
{
struct intel_context *intel =
(struct intel_context *) driContextPriv->driverPrivate;
+ struct gl_context *ctx = &intel->ctx;
assert(intel); /* should never be null */
if (intel) {
@@ -797,11 +809,14 @@ intelDestroyContext(__DRIcontext * driContextPriv)
intel->vtbl.destroy(intel);
- _swsetup_DestroyContext(&intel->ctx);
- _tnl_DestroyContext(&intel->ctx);
+ if (ctx->swrast_context) {
+ _swsetup_DestroyContext(&intel->ctx);
+ _tnl_DestroyContext(&intel->ctx);
+ }
_vbo_DestroyContext(&intel->ctx);
- _swrast_DestroyContext(&intel->ctx);
+ if (ctx->swrast_context)
+ _swrast_DestroyContext(&intel->ctx);
intel->Fallback = 0x0; /* don't call _swrast_Flush later */
intel_batchbuffer_free(intel);
diff --git a/src/mesa/drivers/dri/intel/intel_span.c b/src/mesa/drivers/dri/intel/intel_span.c
index 475c01d..d7eaa41 100644
--- a/src/mesa/drivers/dri/intel/intel_span.c
+++ b/src/mesa/drivers/dri/intel/intel_span.c
@@ -169,8 +169,10 @@ void
intelInitSpanFuncs(struct gl_context * ctx)
{
struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx);
- swdd->SpanRenderStart = intelSpanRenderStart;
- swdd->SpanRenderFinish = intelSpanRenderFinish;
+ if (swdd) {
+ swdd->SpanRenderStart = intelSpanRenderStart;
+ swdd->SpanRenderFinish = intelSpanRenderFinish;
+ }
}
void