radeon/uvd: use more sane defaults for bitstream buffer size

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
radeon/uvd: move more logic into the common files

Move the code back into the common UVD files since we now
have base structures for R600 and radeonsi.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
mesa: Disallow TransformFeedbackVaryings when active.

Fixes a subcase of Piglit's new ARB_transform_feedback2 api-errors test.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
mesa: Track the vertex program active at BeginTransformFeedback() time.

The next few patches will use this for API error checking.

All of the drivers appear to CALLOC_STRUCT transform feedback objects,
so this should be properly NULL initialized on creation.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
mesa: Reject ResumeTransformFeedback if the wrong program is bound.

This is actually a pretty important error condition: otherwise, you
could set up transform feedback with one program, and resume it with
a program that generates a completely different set of outputs.

Fixes a subcase of Piglit's new ARB_transform_feedback2 api-errors test.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
mesa: Disallow relinking if a program is used by an active XFB object.

Paused transform feedback objects may refer to a program other than the
current program.  If any active objects refer to a program, LinkProgram
must reject the request to relink.

The code to detect this is ugly since _mesa_HashWalk is awkward to use,
but unfortunately we can't use hash_table_foreach since there's no way
to get at the underlying struct hash_table (and even then, we'd need to
handle locking somehow).

Fixes the last subcase of Piglit's new ARB_transform_feedback2
api-errors test.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
radeon: don't emit VGT_STRMOUT_BUFFER_BASE on SI

The register doesn't exist on SI.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
radeon: don't emit streamout state if there are no streamout buffers

This could happen if set_stream_output_targets is called twice
in a row without a draw call in between.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
radeonsi: integrate shared streamout state

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
radeonsi: initialize the first CS like any other

So that the "init" state is always emitted first and not later in draw_vbo.

This fixes streamout where the "init" state, which disables streamout,
was emitted in draw_vbo after streamout was enabled.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
radeonsi: handle rasterizer_discard and set GS_OUT_PRIM_TYPE

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
radeonsi: bind streamout buffers to VGT and the vertex shader

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
radeonsi: implement streamout flush properly

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
radeonsi: fix streamout queries

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
radeonsi: implement glDrawTransformFeedback functionality

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
radeonsi: implement streamout shader support

The shader is responsible for writing to streamout buffers using
the TBUFFER_STORE_FORMAT_* instructions.

The locations of some input SGPRs and VGPRs are assigned dynamically, because
the input SGPRs controlling streamout are not declared if they are not needed,
decreasing the indices of all following inputs.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
radeonsi: enable streamout AKA transform feedback for SI

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
gallium: comment that INSTANCEID doesn't include start_instance

Reviewed-by: Christian König <christian.koenig@amd.com>
radeonsi: fix gl_InstanceID with non-zero start_instance

start_instance doesn't affect gl_InstanceID.

There's no piglit test, but it's kinda obvious the code was wrong.

Reviewed-by: Christian König <christian.koenig@amd.com>
radeonsi: fix and enable transform feedback for CIK

The CP_STRMOUT_CNTL register was moved again.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>