[Mesa-dev] [PATCH] r600g: fix sampler/ubo indexing on cayman
Glenn Kennard
glenn.kennard at gmail.com
Thu Jul 9 01:48:53 PDT 2015
On Thu, 09 Jul 2015 07:37:59 +0200, Dave Airlie <airlied at gmail.com> wrote:
> From: Dave Airlie <airlied at redhat.com>
>
> Cayman needs a different method to upload the CF IDX0/1
>
> This fixes 31 piglits when ARB_gpu_shader5 is forced on
> with cayman.
>
> Signed-off-by: Dave Airlie <airlied at redhat.com>
> ---
> src/gallium/drivers/r600/eg_asm.c | 17 +++++++++++------
> src/gallium/drivers/r600/eg_sq.h | 11 +++++++++++
> 2 files changed, 22 insertions(+), 6 deletions(-)
>
> diff --git a/src/gallium/drivers/r600/eg_asm.c
> b/src/gallium/drivers/r600/eg_asm.c
> index d04921e..c32d317 100644
> --- a/src/gallium/drivers/r600/eg_asm.c
> +++ b/src/gallium/drivers/r600/eg_asm.c
> @@ -161,6 +161,9 @@ int egcm_load_index_reg(struct r600_bytecode *bc,
> unsigned id, bool inside_alu_c
> alu.op = ALU_OP1_MOVA_INT;
> alu.src[0].sel = bc->index_reg[id];
> alu.src[0].chan = 0;
> + if (bc->chip_class == CAYMAN)
> + alu.dst.sel = id == 0 ? CM_V_SQ_MOVA_DST_CF_IDX0 :
> CM_V_SQ_MOVA_DST_CF_IDX1;
> +
> alu.last = 1;
> r = r600_bytecode_add_alu(bc, &alu);
> if (r)
> @@ -168,12 +171,14 @@ int egcm_load_index_reg(struct r600_bytecode *bc,
> unsigned id, bool inside_alu_c
> bc->ar_loaded = 0; /* clobbered */
Could split ar_loaded into 3 bits for AR/IDX0/IDX1 for cayman, however I
think it would be better to teach SB to handle sampler/ubo indexing and
keep things simple here.
> - memset(&alu, 0, sizeof(alu));
> - alu.op = id == 0 ? ALU_OP0_SET_CF_IDX0 : ALU_OP0_SET_CF_IDX1;
> - alu.last = 1;
> - r = r600_bytecode_add_alu(bc, &alu);
> - if (r)
> - return r;
> + if (bc->chip_class == EVERGREEN) {
> + memset(&alu, 0, sizeof(alu));
> + alu.op = id == 0 ? ALU_OP0_SET_CF_IDX0 : ALU_OP0_SET_CF_IDX1;
> + alu.last = 1;
> + r = r600_bytecode_add_alu(bc, &alu);
> + if (r)
> + return r;
> + }
> /* Must split ALU group as index only applies to following group */
> if (inside_alu_clause) {
> diff --git a/src/gallium/drivers/r600/eg_sq.h
> b/src/gallium/drivers/r600/eg_sq.h
> index b534872..10caa07 100644
> --- a/src/gallium/drivers/r600/eg_sq.h
> +++ b/src/gallium/drivers/r600/eg_sq.h
> @@ -521,4 +521,15 @@
> #define V_SQ_REL_ABSOLUTE 0
> #define V_SQ_REL_RELATIVE 1
> +
> +/* CAYMAN has special encoding for MOVA_INT destination */
> +#define CM_V_SQ_MOVA_DST_AR_X 0
> +#define CM_V_SQ_MOVA_DST_CF_PC 1
> +#define CM_V_SQ_MOVA_DST_CF_IDX0 2
> +#define CM_V_SQ_MOVA_DST_CF_IDX1 3
> +#define CM_V_SQ_MOVA_DST_CF_CLAUSE_GLOBAL_7_0 4
> +#define CM_V_SQ_MOVA_DST_CF_CLAUSE_GLOBAL_15_8 5
> +#define CM_V_SQ_MOVA_DST_CF_CLAUSE_GLOBAL_23_16 6
> +#define CM_V_SQ_MOVA_DST_CF_CLAUSE_GLOBAL_31_24 7
Can't think of any useful cases for the cayman specific ALU global
register. Drop these four?
> +
> #endif
Reviewed-by: Glenn Kennard <glenn.kennard at gmail.com>
More information about the mesa-dev
mailing list