Re: [Mesa-dev] [PATCH 28/37] i965/gen6/gs: implement transform feedback support in gen6_gs_visitor

2014-09-19 Thread Iago Toral Quiroga
On vie, 2014-09-19 at 00:26 -0700, Jordan Justen wrote:
> On Thu, Sep 18, 2014 at 11:50 PM, Samuel Iglesias Gonsálvez
>  wrote:
> > On Thu, 2014-09-18 at 16:05 -0700, Jordan Justen wrote:
> >> On Thu, Aug 14, 2014 at 4:12 AM, Iago Toral Quiroga  
> >> wrote:
> >> > From: Samuel Iglesias Gonsalvez 
> >> >
> >> > +  this->xfb_output = src_reg(this,
> >> > + glsl_type::uint_type,
> >> > + linked_xfb_info->NumOutputs *
> >> > + c->gp->program.VerticesOut);
> >> > +  this->xfb_output_offset = src_reg(this, glsl_type::uint_type);
> >> > +  emit(MOV(dst_reg(this->xfb_output_offset), src_reg(0u)));
> >> > +  /* Create a virtual register to hold destination indices in SOL */
> >> > +  this->destination_indices = src_reg(this, glsl_type::uvec4_type);
> >> > +  /* Create a virtual register to hold temporal values in SOL */
> >> > +  this->sol_temp = src_reg(this, glsl_type::uvec4_type);
> >>
> >> What is the duration of liveness for sol_temp?
> >>
> >> Would it be better to generate a new temp in each function to help out
> >> register allocation?
> >>
> >
> > Yes, it is better. I have made this change: create a new temp virtual
> > register in every place it is needed (emit_thread_end(), xfb_write(),
> > xfb_program()).
> 
> Cool. Add Reviewed-by: Jordan Justen  for
> this patch, and:
>  i965/gen6/gs: Avoid buffering transform feedback varyings twice.
>  i965/gen6/gs: Fix binding table clash between TF surfaces and textures.
>  i965/gen6/gs: Enable transform feedback support in geometry shaders
>  i965/gen6/gs: upload ubo and pull constants surfaces.
>  i965/gen6/gs: Use a specific implementation of geometry shaders for gen6.
>  i965/gen6: enable GLSL 1.50 and OpenGL 3.2
> 
> That is the rest of the series, right?

Yes.

> Thank you both for all the great work on this series!

Great, thanks for taking the time to review all the patches! I'll push
them later today.

Iago

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 28/37] i965/gen6/gs: implement transform feedback support in gen6_gs_visitor

2014-09-19 Thread Jordan Justen
On Thu, Sep 18, 2014 at 11:50 PM, Samuel Iglesias Gonsálvez
 wrote:
> On Thu, 2014-09-18 at 16:05 -0700, Jordan Justen wrote:
>> On Thu, Aug 14, 2014 at 4:12 AM, Iago Toral Quiroga  
>> wrote:
>> > From: Samuel Iglesias Gonsalvez 
>> >
>> > +  this->xfb_output = src_reg(this,
>> > + glsl_type::uint_type,
>> > + linked_xfb_info->NumOutputs *
>> > + c->gp->program.VerticesOut);
>> > +  this->xfb_output_offset = src_reg(this, glsl_type::uint_type);
>> > +  emit(MOV(dst_reg(this->xfb_output_offset), src_reg(0u)));
>> > +  /* Create a virtual register to hold destination indices in SOL */
>> > +  this->destination_indices = src_reg(this, glsl_type::uvec4_type);
>> > +  /* Create a virtual register to hold temporal values in SOL */
>> > +  this->sol_temp = src_reg(this, glsl_type::uvec4_type);
>>
>> What is the duration of liveness for sol_temp?
>>
>> Would it be better to generate a new temp in each function to help out
>> register allocation?
>>
>
> Yes, it is better. I have made this change: create a new temp virtual
> register in every place it is needed (emit_thread_end(), xfb_write(),
> xfb_program()).

Cool. Add Reviewed-by: Jordan Justen  for
this patch, and:
 i965/gen6/gs: Avoid buffering transform feedback varyings twice.
 i965/gen6/gs: Fix binding table clash between TF surfaces and textures.
 i965/gen6/gs: Enable transform feedback support in geometry shaders
 i965/gen6/gs: upload ubo and pull constants surfaces.
 i965/gen6/gs: Use a specific implementation of geometry shaders for gen6.
 i965/gen6: enable GLSL 1.50 and OpenGL 3.2

That is the rest of the series, right?

Thank you both for all the great work on this series!

-Jordan
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 28/37] i965/gen6/gs: implement transform feedback support in gen6_gs_visitor

2014-09-18 Thread Samuel Iglesias Gonsálvez
On Thu, 2014-09-18 at 16:05 -0700, Jordan Justen wrote:
> On Thu, Aug 14, 2014 at 4:12 AM, Iago Toral Quiroga  wrote:
> > From: Samuel Iglesias Gonsalvez 
> >
> > This takes care of generating code required to handle transform feedback.
> > Notice that transform feedback isn't enabled yet, since that requires
> > additional setups in other parts of the code that will come in later 
> > patches.
> >
> > Signed-off-by: Samuel Iglesias Gonsalvez 
> > ---
> >  src/mesa/drivers/dri/i965/brw_context.h   | 113 ++
> >  src/mesa/drivers/dri/i965/gen6_gs_visitor.cpp | 309 
> > +-
> >  src/mesa/drivers/dri/i965/gen6_gs_visitor.h   |  14 ++
> >  3 files changed, 391 insertions(+), 45 deletions(-)
> >
> > diff --git a/src/mesa/drivers/dri/i965/brw_context.h 
> > b/src/mesa/drivers/dri/i965/brw_context.h
> > index 7439da1..3418b76 100644
> > --- a/src/mesa/drivers/dri/i965/brw_context.h
> > +++ b/src/mesa/drivers/dri/i965/brw_context.h
> > @@ -553,48 +553,6 @@ struct brw_vs_prog_data {
> > bool uses_vertexid;
> >  };
> >
> > -
> > -/* Note: brw_gs_prog_data_compare() must be updated when adding fields to
> > - * this struct!
> > - */
> > -struct brw_gs_prog_data
> > -{
> > -   struct brw_vec4_prog_data base;
> > -
> > -   /**
> > -* Size of an output vertex, measured in HWORDS (32 bytes).
> > -*/
> > -   unsigned output_vertex_size_hwords;
> > -
> > -   unsigned output_topology;
> > -
> > -   /**
> > -* Size of the control data (cut bits or StreamID bits), in hwords (32
> > -* bytes).  0 if there is no control data.
> > -*/
> > -   unsigned control_data_header_size_hwords;
> > -
> > -   /**
> > -* Format of the control data (either 
> > GEN7_GS_CONTROL_DATA_FORMAT_GSCTL_SID
> > -* if the control data is StreamID bits, or
> > -* GEN7_GS_CONTROL_DATA_FORMAT_GSCTL_CUT if the control data is cut 
> > bits).
> > -* Ignored if control_data_header_size is 0.
> > -*/
> > -   unsigned control_data_format;
> > -
> > -   bool include_primitive_id;
> > -
> > -   int invocations;
> > -
> > -   /**
> > -* Dispatch mode, can be any of:
> > -* GEN7_GS_DISPATCH_MODE_DUAL_OBJECT
> > -* GEN7_GS_DISPATCH_MODE_DUAL_INSTANCE
> > -* GEN7_GS_DISPATCH_MODE_SINGLE
> > -*/
> > -   int dispatch_mode;
> > -};
> > -
> >  /** Number of texture sampler units */
> >  #define BRW_MAX_TEX_UNIT 32
> >
> > @@ -641,6 +599,77 @@ struct brw_gs_prog_data
> >  #define SURF_INDEX_GEN6_SOL_BINDING(t) (t)
> >  #define BRW_MAX_GEN6_GS_SURFACES   
> > SURF_INDEX_GEN6_SOL_BINDING(BRW_MAX_SOL_BINDINGS)
> >
> > +/* Note: brw_gs_prog_data_compare() must be updated when adding fields to
> > + * this struct!
> > + */
> > +struct brw_gs_prog_data
> > +{
> > +   struct brw_vec4_prog_data base;
> > +
> > +   /**
> > +* Size of an output vertex, measured in HWORDS (32 bytes).
> > +*/
> > +   unsigned output_vertex_size_hwords;
> > +
> > +   unsigned output_topology;
> > +
> > +   /**
> > +* Size of the control data (cut bits or StreamID bits), in hwords (32
> > +* bytes).  0 if there is no control data.
> > +*/
> > +   unsigned control_data_header_size_hwords;
> > +
> > +   /**
> > +* Format of the control data (either 
> > GEN7_GS_CONTROL_DATA_FORMAT_GSCTL_SID
> > +* if the control data is StreamID bits, or
> > +* GEN7_GS_CONTROL_DATA_FORMAT_GSCTL_CUT if the control data is cut 
> > bits).
> > +* Ignored if control_data_header_size is 0.
> > +*/
> > +   unsigned control_data_format;
> > +
> > +   bool include_primitive_id;
> > +
> > +   int invocations;
> > +
> > +   /**
> > +* Dispatch mode, can be any of:
> > +* GEN7_GS_DISPATCH_MODE_DUAL_OBJECT
> > +* GEN7_GS_DISPATCH_MODE_DUAL_INSTANCE
> > +* GEN7_GS_DISPATCH_MODE_SINGLE
> > +*/
> > +   int dispatch_mode;
> > +
> > +   /**
> > +* Gen6 transform feedback enabled flag.
> > +*/
> > +   bool gen6_xfb_enabled;
> > +
> > +   /**
> > +* Gen6: Provoking vertex convention for odd-numbered triangles
> > +* in tristrips.
> > +*/
> > +   GLuint pv_first:1;
> > +
> > +   /**
> > +* Gen6: Number of varyings that are output to transform feedback.
> > +*/
> > +   GLuint num_transform_feedback_bindings:7; /* 0-BRW_MAX_SOL_BINDINGS */
> > +
> > +   /**
> > +* Gen6: Map from the index of a transform feedback binding table entry 
> > to the
> > +* gl_varying_slot that should be streamed out through that binding 
> > table
> > +* entry.
> > +*/
> > +   unsigned char transform_feedback_bindings[BRW_MAX_SOL_BINDINGS];
> > +
> > +   /**
> > +* Gen6: Map from the index of a transform feedback binding table entry 
> > to the
> > +* swizzles that should be used when streaming out data through that
> > +* binding table entry.
> > +*/
> > +   unsigned char transform_feedback_swizzles[BRW_MAX_SOL_BINDINGS];
> > +};
> > +
> >  /**
> >   * Stride in bytes between shader_time entries.
> >   *
> > diff --git a/src/mesa/drivers/dri/i96

Re: [Mesa-dev] [PATCH 28/37] i965/gen6/gs: implement transform feedback support in gen6_gs_visitor

2014-09-18 Thread Iago Toral Quiroga
On jue, 2014-09-18 at 16:05 -0700, Jordan Justen wrote:
> On Thu, Aug 14, 2014 at 4:12 AM, Iago Toral Quiroga  wrote:
> > From: Samuel Iglesias Gonsalvez 
> >
> > This takes care of generating code required to handle transform feedback.
> > Notice that transform feedback isn't enabled yet, since that requires
> > additional setups in other parts of the code that will come in later 
> > patches.
> >
> > Signed-off-by: Samuel Iglesias Gonsalvez 
> > ---
> >  src/mesa/drivers/dri/i965/brw_context.h   | 113 ++
> >  src/mesa/drivers/dri/i965/gen6_gs_visitor.cpp | 309 
> > +-
> >  src/mesa/drivers/dri/i965/gen6_gs_visitor.h   |  14 ++
> >  3 files changed, 391 insertions(+), 45 deletions(-)
> >
> > diff --git a/src/mesa/drivers/dri/i965/brw_context.h 
> > b/src/mesa/drivers/dri/i965/brw_context.h
> > index 7439da1..3418b76 100644
> > --- a/src/mesa/drivers/dri/i965/brw_context.h
> > +++ b/src/mesa/drivers/dri/i965/brw_context.h
> > @@ -553,48 +553,6 @@ struct brw_vs_prog_data {
> > bool uses_vertexid;
> >  };
> >
> > -
> > -/* Note: brw_gs_prog_data_compare() must be updated when adding fields to
> > - * this struct!
> > - */
> > -struct brw_gs_prog_data
> > -{
> > -   struct brw_vec4_prog_data base;
> > -
> > -   /**
> > -* Size of an output vertex, measured in HWORDS (32 bytes).
> > -*/
> > -   unsigned output_vertex_size_hwords;
> > -
> > -   unsigned output_topology;
> > -
> > -   /**
> > -* Size of the control data (cut bits or StreamID bits), in hwords (32
> > -* bytes).  0 if there is no control data.
> > -*/
> > -   unsigned control_data_header_size_hwords;
> > -
> > -   /**
> > -* Format of the control data (either 
> > GEN7_GS_CONTROL_DATA_FORMAT_GSCTL_SID
> > -* if the control data is StreamID bits, or
> > -* GEN7_GS_CONTROL_DATA_FORMAT_GSCTL_CUT if the control data is cut 
> > bits).
> > -* Ignored if control_data_header_size is 0.
> > -*/
> > -   unsigned control_data_format;
> > -
> > -   bool include_primitive_id;
> > -
> > -   int invocations;
> > -
> > -   /**
> > -* Dispatch mode, can be any of:
> > -* GEN7_GS_DISPATCH_MODE_DUAL_OBJECT
> > -* GEN7_GS_DISPATCH_MODE_DUAL_INSTANCE
> > -* GEN7_GS_DISPATCH_MODE_SINGLE
> > -*/
> > -   int dispatch_mode;
> > -};
> > -
> >  /** Number of texture sampler units */
> >  #define BRW_MAX_TEX_UNIT 32
> >
> > @@ -641,6 +599,77 @@ struct brw_gs_prog_data
> >  #define SURF_INDEX_GEN6_SOL_BINDING(t) (t)
> >  #define BRW_MAX_GEN6_GS_SURFACES   
> > SURF_INDEX_GEN6_SOL_BINDING(BRW_MAX_SOL_BINDINGS)
> >
> > +/* Note: brw_gs_prog_data_compare() must be updated when adding fields to
> > + * this struct!
> > + */
> > +struct brw_gs_prog_data
> > +{
> > +   struct brw_vec4_prog_data base;
> > +
> > +   /**
> > +* Size of an output vertex, measured in HWORDS (32 bytes).
> > +*/
> > +   unsigned output_vertex_size_hwords;
> > +
> > +   unsigned output_topology;
> > +
> > +   /**
> > +* Size of the control data (cut bits or StreamID bits), in hwords (32
> > +* bytes).  0 if there is no control data.
> > +*/
> > +   unsigned control_data_header_size_hwords;
> > +
> > +   /**
> > +* Format of the control data (either 
> > GEN7_GS_CONTROL_DATA_FORMAT_GSCTL_SID
> > +* if the control data is StreamID bits, or
> > +* GEN7_GS_CONTROL_DATA_FORMAT_GSCTL_CUT if the control data is cut 
> > bits).
> > +* Ignored if control_data_header_size is 0.
> > +*/
> > +   unsigned control_data_format;
> > +
> > +   bool include_primitive_id;
> > +
> > +   int invocations;
> > +
> > +   /**
> > +* Dispatch mode, can be any of:
> > +* GEN7_GS_DISPATCH_MODE_DUAL_OBJECT
> > +* GEN7_GS_DISPATCH_MODE_DUAL_INSTANCE
> > +* GEN7_GS_DISPATCH_MODE_SINGLE
> > +*/
> > +   int dispatch_mode;
> > +
> > +   /**
> > +* Gen6 transform feedback enabled flag.
> > +*/
> > +   bool gen6_xfb_enabled;
> > +
> > +   /**
> > +* Gen6: Provoking vertex convention for odd-numbered triangles
> > +* in tristrips.
> > +*/
> > +   GLuint pv_first:1;
> > +
> > +   /**
> > +* Gen6: Number of varyings that are output to transform feedback.
> > +*/
> > +   GLuint num_transform_feedback_bindings:7; /* 0-BRW_MAX_SOL_BINDINGS */
> > +
> > +   /**
> > +* Gen6: Map from the index of a transform feedback binding table entry 
> > to the
> > +* gl_varying_slot that should be streamed out through that binding 
> > table
> > +* entry.
> > +*/
> > +   unsigned char transform_feedback_bindings[BRW_MAX_SOL_BINDINGS];
> > +
> > +   /**
> > +* Gen6: Map from the index of a transform feedback binding table entry 
> > to the
> > +* swizzles that should be used when streaming out data through that
> > +* binding table entry.
> > +*/
> > +   unsigned char transform_feedback_swizzles[BRW_MAX_SOL_BINDINGS];
> > +};
> > +
> >  /**
> >   * Stride in bytes between shader_time entries.
> >   *
> > diff --git a/src/mesa/drivers/dri/i96

Re: [Mesa-dev] [PATCH 28/37] i965/gen6/gs: implement transform feedback support in gen6_gs_visitor

2014-09-18 Thread Jordan Justen
On Thu, Aug 14, 2014 at 4:12 AM, Iago Toral Quiroga  wrote:
> From: Samuel Iglesias Gonsalvez 
>
> This takes care of generating code required to handle transform feedback.
> Notice that transform feedback isn't enabled yet, since that requires
> additional setups in other parts of the code that will come in later patches.
>
> Signed-off-by: Samuel Iglesias Gonsalvez 
> ---
>  src/mesa/drivers/dri/i965/brw_context.h   | 113 ++
>  src/mesa/drivers/dri/i965/gen6_gs_visitor.cpp | 309 
> +-
>  src/mesa/drivers/dri/i965/gen6_gs_visitor.h   |  14 ++
>  3 files changed, 391 insertions(+), 45 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_context.h 
> b/src/mesa/drivers/dri/i965/brw_context.h
> index 7439da1..3418b76 100644
> --- a/src/mesa/drivers/dri/i965/brw_context.h
> +++ b/src/mesa/drivers/dri/i965/brw_context.h
> @@ -553,48 +553,6 @@ struct brw_vs_prog_data {
> bool uses_vertexid;
>  };
>
> -
> -/* Note: brw_gs_prog_data_compare() must be updated when adding fields to
> - * this struct!
> - */
> -struct brw_gs_prog_data
> -{
> -   struct brw_vec4_prog_data base;
> -
> -   /**
> -* Size of an output vertex, measured in HWORDS (32 bytes).
> -*/
> -   unsigned output_vertex_size_hwords;
> -
> -   unsigned output_topology;
> -
> -   /**
> -* Size of the control data (cut bits or StreamID bits), in hwords (32
> -* bytes).  0 if there is no control data.
> -*/
> -   unsigned control_data_header_size_hwords;
> -
> -   /**
> -* Format of the control data (either 
> GEN7_GS_CONTROL_DATA_FORMAT_GSCTL_SID
> -* if the control data is StreamID bits, or
> -* GEN7_GS_CONTROL_DATA_FORMAT_GSCTL_CUT if the control data is cut bits).
> -* Ignored if control_data_header_size is 0.
> -*/
> -   unsigned control_data_format;
> -
> -   bool include_primitive_id;
> -
> -   int invocations;
> -
> -   /**
> -* Dispatch mode, can be any of:
> -* GEN7_GS_DISPATCH_MODE_DUAL_OBJECT
> -* GEN7_GS_DISPATCH_MODE_DUAL_INSTANCE
> -* GEN7_GS_DISPATCH_MODE_SINGLE
> -*/
> -   int dispatch_mode;
> -};
> -
>  /** Number of texture sampler units */
>  #define BRW_MAX_TEX_UNIT 32
>
> @@ -641,6 +599,77 @@ struct brw_gs_prog_data
>  #define SURF_INDEX_GEN6_SOL_BINDING(t) (t)
>  #define BRW_MAX_GEN6_GS_SURFACES   
> SURF_INDEX_GEN6_SOL_BINDING(BRW_MAX_SOL_BINDINGS)
>
> +/* Note: brw_gs_prog_data_compare() must be updated when adding fields to
> + * this struct!
> + */
> +struct brw_gs_prog_data
> +{
> +   struct brw_vec4_prog_data base;
> +
> +   /**
> +* Size of an output vertex, measured in HWORDS (32 bytes).
> +*/
> +   unsigned output_vertex_size_hwords;
> +
> +   unsigned output_topology;
> +
> +   /**
> +* Size of the control data (cut bits or StreamID bits), in hwords (32
> +* bytes).  0 if there is no control data.
> +*/
> +   unsigned control_data_header_size_hwords;
> +
> +   /**
> +* Format of the control data (either 
> GEN7_GS_CONTROL_DATA_FORMAT_GSCTL_SID
> +* if the control data is StreamID bits, or
> +* GEN7_GS_CONTROL_DATA_FORMAT_GSCTL_CUT if the control data is cut bits).
> +* Ignored if control_data_header_size is 0.
> +*/
> +   unsigned control_data_format;
> +
> +   bool include_primitive_id;
> +
> +   int invocations;
> +
> +   /**
> +* Dispatch mode, can be any of:
> +* GEN7_GS_DISPATCH_MODE_DUAL_OBJECT
> +* GEN7_GS_DISPATCH_MODE_DUAL_INSTANCE
> +* GEN7_GS_DISPATCH_MODE_SINGLE
> +*/
> +   int dispatch_mode;
> +
> +   /**
> +* Gen6 transform feedback enabled flag.
> +*/
> +   bool gen6_xfb_enabled;
> +
> +   /**
> +* Gen6: Provoking vertex convention for odd-numbered triangles
> +* in tristrips.
> +*/
> +   GLuint pv_first:1;
> +
> +   /**
> +* Gen6: Number of varyings that are output to transform feedback.
> +*/
> +   GLuint num_transform_feedback_bindings:7; /* 0-BRW_MAX_SOL_BINDINGS */
> +
> +   /**
> +* Gen6: Map from the index of a transform feedback binding table entry 
> to the
> +* gl_varying_slot that should be streamed out through that binding table
> +* entry.
> +*/
> +   unsigned char transform_feedback_bindings[BRW_MAX_SOL_BINDINGS];
> +
> +   /**
> +* Gen6: Map from the index of a transform feedback binding table entry 
> to the
> +* swizzles that should be used when streaming out data through that
> +* binding table entry.
> +*/
> +   unsigned char transform_feedback_swizzles[BRW_MAX_SOL_BINDINGS];
> +};
> +
>  /**
>   * Stride in bytes between shader_time entries.
>   *
> diff --git a/src/mesa/drivers/dri/i965/gen6_gs_visitor.cpp 
> b/src/mesa/drivers/dri/i965/gen6_gs_visitor.cpp
> index c1cfe75..b8eaa58 100644
> --- a/src/mesa/drivers/dri/i965/gen6_gs_visitor.cpp
> +++ b/src/mesa/drivers/dri/i965/gen6_gs_visitor.cpp
> @@ -97,6 +97,45 @@ gen6_gs_visitor::emit_prolog()
> this->prim_count = src_reg(this, glsl_type::uint_type);
> emit(MOV(dst_reg(this->prim_count), 0u));
>
> +  

[Mesa-dev] [PATCH 28/37] i965/gen6/gs: implement transform feedback support in gen6_gs_visitor

2014-08-14 Thread Iago Toral Quiroga
From: Samuel Iglesias Gonsalvez 

This takes care of generating code required to handle transform feedback.
Notice that transform feedback isn't enabled yet, since that requires
additional setups in other parts of the code that will come in later patches.

Signed-off-by: Samuel Iglesias Gonsalvez 
---
 src/mesa/drivers/dri/i965/brw_context.h   | 113 ++
 src/mesa/drivers/dri/i965/gen6_gs_visitor.cpp | 309 +-
 src/mesa/drivers/dri/i965/gen6_gs_visitor.h   |  14 ++
 3 files changed, 391 insertions(+), 45 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_context.h 
b/src/mesa/drivers/dri/i965/brw_context.h
index 7439da1..3418b76 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -553,48 +553,6 @@ struct brw_vs_prog_data {
bool uses_vertexid;
 };
 
-
-/* Note: brw_gs_prog_data_compare() must be updated when adding fields to
- * this struct!
- */
-struct brw_gs_prog_data
-{
-   struct brw_vec4_prog_data base;
-
-   /**
-* Size of an output vertex, measured in HWORDS (32 bytes).
-*/
-   unsigned output_vertex_size_hwords;
-
-   unsigned output_topology;
-
-   /**
-* Size of the control data (cut bits or StreamID bits), in hwords (32
-* bytes).  0 if there is no control data.
-*/
-   unsigned control_data_header_size_hwords;
-
-   /**
-* Format of the control data (either GEN7_GS_CONTROL_DATA_FORMAT_GSCTL_SID
-* if the control data is StreamID bits, or
-* GEN7_GS_CONTROL_DATA_FORMAT_GSCTL_CUT if the control data is cut bits).
-* Ignored if control_data_header_size is 0.
-*/
-   unsigned control_data_format;
-
-   bool include_primitive_id;
-
-   int invocations;
-
-   /**
-* Dispatch mode, can be any of:
-* GEN7_GS_DISPATCH_MODE_DUAL_OBJECT
-* GEN7_GS_DISPATCH_MODE_DUAL_INSTANCE
-* GEN7_GS_DISPATCH_MODE_SINGLE
-*/
-   int dispatch_mode;
-};
-
 /** Number of texture sampler units */
 #define BRW_MAX_TEX_UNIT 32
 
@@ -641,6 +599,77 @@ struct brw_gs_prog_data
 #define SURF_INDEX_GEN6_SOL_BINDING(t) (t)
 #define BRW_MAX_GEN6_GS_SURFACES   
SURF_INDEX_GEN6_SOL_BINDING(BRW_MAX_SOL_BINDINGS)
 
+/* Note: brw_gs_prog_data_compare() must be updated when adding fields to
+ * this struct!
+ */
+struct brw_gs_prog_data
+{
+   struct brw_vec4_prog_data base;
+
+   /**
+* Size of an output vertex, measured in HWORDS (32 bytes).
+*/
+   unsigned output_vertex_size_hwords;
+
+   unsigned output_topology;
+
+   /**
+* Size of the control data (cut bits or StreamID bits), in hwords (32
+* bytes).  0 if there is no control data.
+*/
+   unsigned control_data_header_size_hwords;
+
+   /**
+* Format of the control data (either GEN7_GS_CONTROL_DATA_FORMAT_GSCTL_SID
+* if the control data is StreamID bits, or
+* GEN7_GS_CONTROL_DATA_FORMAT_GSCTL_CUT if the control data is cut bits).
+* Ignored if control_data_header_size is 0.
+*/
+   unsigned control_data_format;
+
+   bool include_primitive_id;
+
+   int invocations;
+
+   /**
+* Dispatch mode, can be any of:
+* GEN7_GS_DISPATCH_MODE_DUAL_OBJECT
+* GEN7_GS_DISPATCH_MODE_DUAL_INSTANCE
+* GEN7_GS_DISPATCH_MODE_SINGLE
+*/
+   int dispatch_mode;
+
+   /**
+* Gen6 transform feedback enabled flag.
+*/
+   bool gen6_xfb_enabled;
+
+   /**
+* Gen6: Provoking vertex convention for odd-numbered triangles
+* in tristrips.
+*/
+   GLuint pv_first:1;
+
+   /**
+* Gen6: Number of varyings that are output to transform feedback.
+*/
+   GLuint num_transform_feedback_bindings:7; /* 0-BRW_MAX_SOL_BINDINGS */
+
+   /**
+* Gen6: Map from the index of a transform feedback binding table entry to 
the
+* gl_varying_slot that should be streamed out through that binding table
+* entry.
+*/
+   unsigned char transform_feedback_bindings[BRW_MAX_SOL_BINDINGS];
+
+   /**
+* Gen6: Map from the index of a transform feedback binding table entry to 
the
+* swizzles that should be used when streaming out data through that
+* binding table entry.
+*/
+   unsigned char transform_feedback_swizzles[BRW_MAX_SOL_BINDINGS];
+};
+
 /**
  * Stride in bytes between shader_time entries.
  *
diff --git a/src/mesa/drivers/dri/i965/gen6_gs_visitor.cpp 
b/src/mesa/drivers/dri/i965/gen6_gs_visitor.cpp
index c1cfe75..b8eaa58 100644
--- a/src/mesa/drivers/dri/i965/gen6_gs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/gen6_gs_visitor.cpp
@@ -97,6 +97,45 @@ gen6_gs_visitor::emit_prolog()
this->prim_count = src_reg(this, glsl_type::uint_type);
emit(MOV(dst_reg(this->prim_count), 0u));
 
+   if (c->prog_data.gen6_xfb_enabled) {
+  const struct gl_transform_feedback_info *linked_xfb_info =
+ &this->shader_prog->LinkedTransformFeedback;
+
+  /* Gen6 geometry shaders are required to ask for Streamed Vertex Buffer
+   * Indices values via FF_SYNC message, when Transform Feedback is
+   * enabled.
+   *
+   * To achieve this we buf