On 17 May 2013 10:17, Kenneth Graunke <kenn...@whitecape.org> wrote: > Hardware contexts are necessary to reasonably support OpenGL 3.2. > In particular, we currently maintain software counters for transform > feedback buffer offsets and counters, which relies on knowing the number > of primitives generated. Geometry shaders violate that assumption. > > At the time of writing, Debian has moved to Kernel 3.8, which means most > people probably have a newer kernel by now. It's also worth noting that > this patch won't land until Mesa 10 which is currently targeted for > September. By that point, even more people will have a newer kernel. > > This patch leaves the code for flagging BRW_NEW_CONTEXT on new > batchbuffers if hw_ctx == NULL since that still occurs pre-Gen6. >
There's a slight change here that I'd like to see documented more clearly in the commit message: Previously, Mesa would *try* to allocate a hardware context regardless of intel->gen. That would always fail for gen<6 (since the kernel doesn't support hardware contexts prior to gen6), and would sometimes fail and sometimes succeed on gen6+, depending on kernel version. Now, Mesa doesn't even try to allocate a hardware context if gen<6. With that changed, this is: Reviewed-by: Paul Berry <stereotype...@gmail.com> > > Cc: Eric Anholt <e...@anholt.net> > Cc: Paul Berry <stereotype...@gmail.com> > Signed-off-by: Kenneth Graunke <kenn...@whitecape.org> > --- > src/mesa/drivers/dri/i965/brw_context.c | 18 +++++++++++++++++- > 1 file changed, 17 insertions(+), 1 deletion(-) > > diff --git a/src/mesa/drivers/dri/i965/brw_context.c > b/src/mesa/drivers/dri/i965/brw_context.c > index 69b7e4d..2f5fedb 100644 > --- a/src/mesa/drivers/dri/i965/brw_context.c > +++ b/src/mesa/drivers/dri/i965/brw_context.c > @@ -143,6 +143,23 @@ brwCreateContext(int api, > return false; > } > > + if (intel->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 > + * to assume that the GPU is in the same state we left it in. > + * > + * This is required for transform feedback buffer offsets, query > objects, > + * and also allows us to reduce how much state we have to emit. > + */ > + intel->hw_ctx = drm_intel_gem_context_create(intel->bufmgr); > + > + if (!intel->hw_ctx) { > + fprintf(stderr, "Gen6+ requires Kernel 3.6 or later.\n"); > + ralloc_free(brw); > + return false; > + } > + } > + > brw_init_surface_formats(brw); > > /* Initialize swrast, tnl driver tables: */ > @@ -374,7 +391,6 @@ brwCreateContext(int api, > > brw->prim_restart.in_progress = false; > brw->prim_restart.enable_cut_index = false; > - intel->hw_ctx = drm_intel_gem_context_create(intel->bufmgr); > > brw_init_state( brw ); > > -- > 1.8.2.3 > >
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev