Commit Graph

74545 Commits

Author SHA1 Message Date
Dave Airlie 30d56d1c00 r600/shader: handle TES exports and streamout
when tessellation is enabled the TES shader is responsible
for handling streamout and exports.

This adds the streamout and export workarounds to TES,
and also makes sure TES sets up spi_sid.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2015-12-07 09:59:01 +10:00
Dave Airlie 2239f3eaff r600/shader: emit tessellation factors to GDS at end of TCS.
When we are finished the shader, we read back all the tess factors
from LDS and write them to special global memory storage using
GDS instructions.

This also handles adding NOP when GDS or ENDLOOP end the TCS.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2015-12-07 09:59:01 +10:00
Dave Airlie cfc2818e23 r600/shader: handle TCS output writing.
TCS outputs whenever they are written in the shader,
need to be written to LDS not temporaries, this handles
this case. It also fixes up the case where the output
is a relative addressed output, so we don't try to apply
the relative address at the wrong time.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2015-12-07 09:59:01 +10:00
Dave Airlie 892cc65fa3 r600/shader: handle VS shader writing to the LDS outputs. (v1.1)
This writes the VS shaders outputs to the LDS memory in
the correct places.

v1.1: use 24-bit
Signed-off-by: Dave Airlie <airlied@redhat.com>
2015-12-07 09:59:01 +10:00
Dave Airlie 8b2024196f r600/shader: handle fetching tcs/tes inputs and tcs outputs
This handles the logic for doing fetches from LDS for
TCS and TES. For TCS we need to fetch both inputs and outputs,
for TES only inputs need to be fetched.

v2: use 24-bit ops.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2015-12-07 09:59:01 +10:00
Dave Airlie 4477be2404 r600/shader: add get_lds_offset0 helper
This retrievs the offset into the LDS for a patch or
non-patch variable, it takes the RelPatch channel
and a temporary register.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2015-12-07 09:59:01 +10:00
Dave Airlie 2a9639e41f r600/shader: add function to get tess constants info
This function retrieves the tess input/output info
from the tess constant buffer that is bound to the shader.

This uses a vfetch to get the values into the shader.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2015-12-07 09:59:01 +10:00
Dave Airlie 0696ebc899 r600/shader: add utility functions to do single slot arithmatic
These utilities are to be used to do things like integer adds and
multiplies to be used in calculating the LDS offsets etc.

It handles CAYMAN MULLO differences as well.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2015-12-07 09:59:01 +10:00
Dave Airlie 09d25a9b37 r600/eg: workaround bug with tess shader and dynamic GPRs.
When using tessellation on eg/ni chipsets, we must disable
dynamic GPRs to workaround a hw bug where the GPU hangs
when too many things get queued.

This implements something like the r600 code to emit
the transition between static and dynamic GPRs, and to
statically allocate GPRs when tessellation is enabled.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2015-12-07 09:59:01 +10:00
Dave Airlie d87f54f225 r600/shader: move get_temp and last_instruction helpers up
These are required for tess to be used earlier.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2015-12-07 09:59:01 +10:00
Dave Airlie 7933ba4d9c r600: bind geometry shader ring to the correct place
When tess/gs are enabled, the geom shader ring needs
to bind to the tess eval not the vertex shader.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2015-12-07 09:59:00 +10:00
Dave Airlie e3ecc28e99 r600: create fixed function tess control shader fallback.
If we have no tess control shader, then we have to use a fallback
one that just writes the tessellation factors.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2015-12-07 09:59:00 +10:00
Dave Airlie 731ff3766f r600: create LDS info constants buffer and write LDS registers. (v2)
This creates a constant buffer with the information about
the layout of the LDS memory that is given to the vertex, tess
control and tess evaluation shaders.

This also programs the LDS size and the LS_HS_CONFIG registers,
on evergreen only.

v2: calculate lds hs num waves properly (Marek)
Emit the state only when something has changed (airlied).

Signed-off-by: Dave Airlie <airlied@redhat.com>
2015-12-07 09:59:00 +10:00
Dave Airlie 38b5ee4796 r600/eg: update shader stage emission/tf param for tess.
This update the setting of the shader stages register
when tess is enabled and add the setting of the VGT_TF_PARAM
register from the tess shader properties.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2015-12-07 09:59:00 +10:00
Dave Airlie 8874725c84 r600: hook TES/TCS shaders to the selection logic.
This hooks the TES/TCS bindings to the HW stages up.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2015-12-07 09:59:00 +10:00
Dave Airlie 79d88afd5c r600: workout bitmask for the used tcs inputs/outputs.
This is used later to setup the constants to be given
to the tessellation shaders.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2015-12-07 09:59:00 +10:00
Dave Airlie 839dae0dc0 r600: port over the get_lds_unique_index from radeonsi
On r600 this needs to subtract 9 due to texcoord interactions.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2015-12-07 09:59:00 +10:00
Dave Airlie 420afe06d1 r600: add set_tess_state callback.
This just stores the values in the context to be used later
when emitting the constant buffers.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2015-12-07 09:59:00 +10:00
Dave Airlie 7db24b740c r600/eg: init tess registers to defaults (v1.1)
This initialises the tess min/max using fglrx values,
and also initialises a number of other registers related
to tessellation.

v1.1: caicos doesn't have some registers.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2015-12-07 09:59:00 +10:00
Dave Airlie 25f96c1120 r600: hook up constants/samplers/sampler view for tessellation
This hooks the resources to the correct hw shaders when tess
is enabled.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2015-12-07 09:59:00 +10:00
Dave Airlie 9f86741863 r600: add create/bind/delete shader hooks for tessellation
This hooks up the gallium API for the tessellation shaders.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2015-12-07 09:59:00 +10:00
Dave Airlie 797012bb67 r600/sb: add LS/HS hw shader types.
This just adds printing for the hw shader types, and hooks it up.

Reviewed-by: Glenn Kennard <glenn.kennard@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2015-12-07 09:59:00 +10:00
Dave Airlie 382e2a2901 r600/blit: add tcs/tes shader saves.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2015-12-07 09:59:00 +10:00
Dave Airlie bdf7dadda8 r600: disable SB for now on tess related shaders.
Note we have to disable on vertex shaders when we are
operating in tes mode.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2015-12-07 09:59:00 +10:00
Dave Airlie 8849867b8a r600: update correct hw shaders depending on configuration.
This updates the tess hw shaders from the sw ones routing
things correctly.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2015-12-07 09:59:00 +10:00
Dave Airlie b1da110b71 r600: add shader key entries for tcs and tes.
with tessellation vs can now run on ls, and tes can
run on vs or es, tcs runs on hs.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2015-12-07 09:58:59 +10:00
Dave Airlie a131ac73e6 r600: add PATCHES to the pipe conversion.
This just converts the value to the hw value.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2015-12-07 09:58:59 +10:00
Dave Airlie 0b08a8ade6 r600: add functions to update ls/hs state.
This just adds the two functions, these will get hooked up
later in the shader code.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2015-12-07 09:58:59 +10:00
Glenn Kennard b2fa64b161 r600g/sb: Support LDS ops in SB bytecode I/O
This just adds the LDS ops to the SB bytecode reader/writers.

Signed-off-by: Glenn Kennard <glenn.kennard@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2015-12-07 09:58:59 +10:00
Dave Airlie 816bb30245 r600: add support for LDS instruction encoding.
These are used in tessellation shaders to read/write values
between VS/TCS/TES.

This splits the eg alu assembler out to handle these
instructions.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2015-12-07 09:58:59 +10:00
Dave Airlie fe4eb49df9 r600/sb: add support for GDS to the sb decoder/dump. (v1.1)
This just adds support to the decoder, not actual SB support.

v1.1: fixup GDS relative mode. (Glenn).

Reviewed-by: Glenn Kennard <glenn.kennard@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2015-12-07 09:58:59 +10:00
Dave Airlie 2b25d9ac7f r600: add support for GDS clause to the assembler.
This just adds enough for the tessellation shaders,
which require TF_WRITE to work.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2015-12-07 09:58:59 +10:00
Dave Airlie 4f83184eff r600: use macros for updating the various stages.
These macros will make things easier to see when tess
is added to the mix.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2015-12-07 09:58:59 +10:00
Dave Airlie 85131a5490 r600: add SET_NULL_SHADER macro.
This is used to set a hw shader to NULL.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2015-12-07 09:58:59 +10:00
Dave Airlie f395ed8d4c r600: move clip misc and streamout stream updates to a single place
This will be updated in a macro later.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2015-12-07 09:58:59 +10:00
Dave Airlie 8a0e21fc5a r600: move selecting shaders into earlier code.
select the ps/gs/vs in that order then process the results.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2015-12-07 09:58:59 +10:00
Dave Airlie 3a7232a9a9 r600: use a macro to remove common shader selection code.
This function is going to get a lot messier with tessellation
so I'm going to use some macros to try and clean some bits
of common code up.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2015-12-07 09:58:59 +10:00
Dave Airlie 19799a5928 r600: move to using hw stages array for hw stage atoms
This moves to using an array of hw stages for the atoms.

Note this drops the 23 from the vertex shader, this value
is calculated internally when shaders are bound, so not
required here.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2015-12-07 09:58:59 +10:00
Dave Airlie bb2b8778cb r600: make adjust_gprs use hw stages.
This changes the r600 specific GPR adjustment code
to use the stage defines, and arrays.

This is prep work for the tess changes later.

Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2015-12-07 09:58:59 +10:00
Dave Airlie d1b90839c0 r600: introduce HW shader stage defines
Add a list of defines for the HW stages.

We will use this for GPR calculations amongst other things.

Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2015-12-07 09:58:58 +10:00
Dave Airlie bd71f3e4fe r600: fix masks for two of the unused evergreen regs.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2015-12-07 09:58:58 +10:00
Edward O'Callaghan d108b69d2c gallium: Remove redundant NULL ptr checks
Signed-off-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
2015-12-06 17:10:23 +01:00
Edward O'Callaghan 13eb5f596b gallium/drivers: Sanitize NULL checks into canonical form
Use NULL tests of the form `if (ptr)' or `if (!ptr)'.
They do not depend on the definition of the symbol NULL.
Further, they provide the opportunity for the accidental
assignment, are clear and succinct.

Signed-off-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
2015-12-06 17:10:23 +01:00
Edward O'Callaghan 150c289f60 gallium/auxiliary: Sanitize NULL checks into canonical form
Use NULL tests of the form `if (ptr)' or `if (!ptr)'.
They do not depend on the definition of the symbol NULL.
Further, they provide the opportunity for the accidental
assignment, are clear and succinct.

Signed-off-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
2015-12-06 17:10:23 +01:00
Edward O'Callaghan 147fd00bb3 gallium/auxiliary: Trivial code style cleanup
Signed-off-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
2015-12-06 17:10:22 +01:00
Edward O'Callaghan 25b3d554c4 gallium/drivers: Trivial code-style cleanup
Signed-off-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
2015-12-06 17:10:22 +01:00
Edward O'Callaghan 34782eec31 gallium/auxiliary: Fix zero integer literal to pointer comparison
Signed-off-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
2015-12-06 17:10:02 +01:00
Edward O'Callaghan 3edae10601 winsys/amdgpu: Make use of ARRAY_SIZE macro
Signed-off-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
2015-12-06 17:09:54 +01:00
Edward O'Callaghan 82871081fc svga: Make use of ARRAY_SIZE macro
Signed-off-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
2015-12-06 17:09:52 +01:00
Edward O'Callaghan 70d2d3ef7f llvmpipe: Make use of ARRAY_SIZE macro
Signed-off-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
2015-12-06 17:09:47 +01:00