[Mesa-dev] new i965g pipe driver for Intel GEN6 (and later)

Jose Fonseca jfonseca at vmware.com
Wed Apr 17 01:31:06 PDT 2013



----- Original Message -----
> On Wed, Apr 17, 2013 at 8:09 AM, Marek Olšák <maraeo at gmail.com> wrote:
> > On Tue, Apr 16, 2013 at 9:58 PM, Chia-I Wu <olvaffe at gmail.com> wrote:
> >>
> >> On Wed, Apr 17, 2013 at 12:58 AM, Matt Turner <mattst88 at gmail.com> wrote:
> >>>
> >>> I think everything Marek said was correct. If you could extend Gallium
> >>> to consume GLSL IR it might actually be an interesting project.
> >>
> >> Yes, it is.  I do want to make pipe drivers be able to express the
> >> preferred IR and make the mesa state tracker generate it.  I had LLVM IR
> >> in mind, but GLSL IR could be a much less intrusive choice.  I will check
> >> that out.
> >
> > Actually, there is even a better option. You don't have to fork the
> > compiler, you can add source files from src/mesa/drivers/dri/i965 to
> > your gallium driver. We have done this before. r300g did not have its
> > own compiler for a couple of *years*. The compiler lived in r300c in
> > src/mesa/drivers/dri/r300/compiler and it was more or less a separate
> > library (it did not depend on gl_context). If r300g was enabled, the
> > build system also compiled files in the r300 compiler directory and
> > the linker included them in the .so file. r300g also used (and still
> > uses) the register allocator from src/mesa/program, which is also used
> > by i965.
> One thing I want to do next in i965g is to make shader compilation and
> complied shaders opaque for the rest of the driver.  That would make
> the code cleaner, and make it easy to switch to different compilers.
> It seems the compiler in i965 makes some use of brw_context, but that
> is mainly to get hardware capabilities.  It should be possible to make
> it more library-like or to fork it for i965g.
> 
> How hard would it be to make GLSL IR an alternative IR for pipe
> drivers?  On the driver side, it seems I only need to add
> PIPE_SHADER_IR_GLSL for the preferred IR and change the type of tokens
> to void *.  On the st/mesa side, could I simply skip GLSL-to-TGSI
> pass?  Maybe also disable API_OPENGL_COMPAT?

Fully replacing TGSI would also imply providing an alternative to src/gallium/auxiliary/util/u_simple_shaders.h , for clears and blits.  One can easily imagining one day these helpers taking an additional PIPE_SHADER_IR_* parameter. I think this would be the ideal.

In the short term, you could workaround that need either by keeping enough TGSI support just for those cases, or maybe by tweaking the mesa state tracker to use the src/mesa/drivers/common/meta.c for clears.  Brian can give a better assessment, but my understanding is that meta module doesn't have as tight control over the driver interface as the mesa gallium state tracker has, so bugs due to non-default/tampered state tend to creep up now and then.

Jose


More information about the mesa-dev mailing list