summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/ilo/shader
diff options
context:
space:
mode:
authorChia-I Wu <[email protected]>2014-09-12 10:55:58 +0800
committerChia-I Wu <[email protected]>2014-09-12 16:58:30 +0800
commit56d2ebb019f38d727a41f8f4a8ebd4f1aeee19e0 (patch)
tree44e84ab2aa0481e9f75a924ed2803bd7326f8064 /src/gallium/drivers/ilo/shader
parentea5de3e0bd82c52130633b1f01b5e0ed226b3b76 (diff)
ilo: use an accessor for dev->gen
It should enable us to do specialized builds by making the accessor return a constant.
Diffstat (limited to 'src/gallium/drivers/ilo/shader')
-rw-r--r--src/gallium/drivers/ilo/shader/ilo_shader_fs.c8
-rw-r--r--src/gallium/drivers/ilo/shader/ilo_shader_vs.c16
-rw-r--r--src/gallium/drivers/ilo/shader/toy_compiler_disasm.c27
-rw-r--r--src/gallium/drivers/ilo/shader/toy_helpers.h8
-rw-r--r--src/gallium/drivers/ilo/shader/toy_legalize.c17
5 files changed, 39 insertions, 37 deletions
diff --git a/src/gallium/drivers/ilo/shader/ilo_shader_fs.c b/src/gallium/drivers/ilo/shader/ilo_shader_fs.c
index c5bdf753b0b..5d27dded8bf 100644
--- a/src/gallium/drivers/ilo/shader/ilo_shader_fs.c
+++ b/src/gallium/drivers/ilo/shader/ilo_shader_fs.c
@@ -494,7 +494,7 @@ fs_lower_opcode_tgsi_direct(struct fs_compile_context *fcc,
fs_lower_opcode_tgsi_in(fcc, inst->dst, dim, idx);
break;
case TOY_OPCODE_TGSI_CONST:
- if (tc->dev->gen >= ILO_GEN(7))
+ if (ilo_dev_gen(tc->dev) >= ILO_GEN(7))
fs_lower_opcode_tgsi_const_gen7(fcc, inst->dst, dim, inst->src[1]);
else
fs_lower_opcode_tgsi_const_gen6(fcc, inst->dst, dim, inst->src[1]);
@@ -801,7 +801,7 @@ fs_prepare_tgsi_sampling(struct toy_compiler *tc, const struct toy_inst *inst,
msg_type = GEN7_MSG_SAMPLER_SAMPLE_D_C;
ref_or_si = coords[ref_pos];
- if (tc->dev->gen < ILO_GEN(7.5))
+ if (ilo_dev_gen(tc->dev) < ILO_GEN(7.5))
tc_fail(tc, "TXD with shadow sampler not supported");
}
else {
@@ -1064,7 +1064,7 @@ fs_prepare_tgsi_sampling(struct toy_compiler *tc, const struct toy_inst *inst,
}
/* set up sampler parameters */
- if (tc->dev->gen >= ILO_GEN(7)) {
+ if (ilo_dev_gen(tc->dev) >= ILO_GEN(7)) {
msg_len = fs_add_sampler_params_gen7(tc, msg_type, base_mrf, param_size,
coords, num_coords, bias_or_lod, ref_or_si, ddx, ddy, num_derivs);
}
@@ -1849,7 +1849,7 @@ fs_setup(struct fs_compile_context *fcc,
fcc->num_grf_per_vrf =
(fcc->dispatch_mode == GEN6_WM_DW5_16_PIXEL_DISPATCH) ? 2 : 1;
- if (fcc->tc.dev->gen >= ILO_GEN(7)) {
+ if (ilo_dev_gen(fcc->tc.dev) >= ILO_GEN(7)) {
fcc->last_free_grf -= 15;
fcc->first_free_mrf = fcc->last_free_grf + 1;
fcc->last_free_mrf = fcc->first_free_mrf + 14;
diff --git a/src/gallium/drivers/ilo/shader/ilo_shader_vs.c b/src/gallium/drivers/ilo/shader/ilo_shader_vs.c
index 838a29e8d4b..7abdf70a453 100644
--- a/src/gallium/drivers/ilo/shader/ilo_shader_vs.c
+++ b/src/gallium/drivers/ilo/shader/ilo_shader_vs.c
@@ -244,7 +244,7 @@ vs_lower_opcode_tgsi_direct(struct vs_compile_context *vcc,
vs_lower_opcode_tgsi_in(vcc, inst->dst, dim, idx);
break;
case TOY_OPCODE_TGSI_CONST:
- if (tc->dev->gen >= ILO_GEN(7))
+ if (ilo_dev_gen(tc->dev) >= ILO_GEN(7))
vs_lower_opcode_tgsi_const_gen7(vcc, inst->dst, dim, inst->src[1]);
else
vs_lower_opcode_tgsi_const_gen6(vcc, inst->dst, dim, inst->src[1]);
@@ -298,7 +298,7 @@ vs_lower_opcode_tgsi_indirect(struct vs_compile_context *vcc,
indirect_idx = tsrc_from(tmp);
}
- if (tc->dev->gen >= ILO_GEN(7))
+ if (ilo_dev_gen(tc->dev) >= ILO_GEN(7))
vs_lower_opcode_tgsi_const_gen7(vcc, inst->dst, dim, indirect_idx);
else
vs_lower_opcode_tgsi_const_gen6(vcc, inst->dst, dim, indirect_idx);
@@ -363,7 +363,7 @@ vs_add_sampler_params(struct toy_compiler *tc, int msg_type, int base_mrf,
assert(num_coords <= 3);
tc_MOV(tc, tdst_writemask(tdst_d(m[0]), coords_writemask), coords);
tc_MOV(tc, tdst_writemask(tdst_d(m[0]), TOY_WRITEMASK_W), bias_or_lod);
- if (tc->dev->gen >= ILO_GEN(7)) {
+ if (ilo_dev_gen(tc->dev) >= ILO_GEN(7)) {
num_params = 4;
}
else {
@@ -417,7 +417,7 @@ vs_prepare_tgsi_sampling(struct toy_compiler *tc, const struct toy_inst *inst,
msg_type = GEN7_MSG_SAMPLER_SAMPLE_D_C;
ref_or_si = tsrc_swizzle1(coords, ref_pos);
- if (tc->dev->gen < ILO_GEN(7.5))
+ if (ilo_dev_gen(tc->dev) < ILO_GEN(7.5))
tc_fail(tc, "TXD with shadow sampler not supported");
}
else {
@@ -917,7 +917,7 @@ vs_write_vue(struct vs_compile_context *vcc)
inst = tc_MOV(tc, header, r0);
inst->mask_ctrl = GEN6_MASKCTRL_NOMASK;
- if (tc->dev->gen >= ILO_GEN(7)) {
+ if (ilo_dev_gen(tc->dev) >= ILO_GEN(7)) {
inst = tc_OR(tc, tdst_offset(header, 0, 5),
tsrc_rect(tsrc_offset(r0, 0, 5), TOY_RECT_010),
tsrc_rect(tsrc_imm_ud(0xff00), TOY_RECT_010));
@@ -955,7 +955,7 @@ vs_write_vue(struct vs_compile_context *vcc)
eot = false;
}
- if (tc->dev->gen >= ILO_GEN(7)) {
+ if (ilo_dev_gen(tc->dev) >= ILO_GEN(7)) {
/* do not forget about the header */
msg_len = 1 + num_attrs;
}
@@ -1273,7 +1273,7 @@ vs_setup(struct vs_compile_context *vcc,
vcc->num_grf_per_vrf = 1;
- if (vcc->tc.dev->gen >= ILO_GEN(7)) {
+ if (ilo_dev_gen(vcc->tc.dev) >= ILO_GEN(7)) {
vcc->last_free_grf -= 15;
vcc->first_free_mrf = vcc->last_free_grf + 1;
vcc->last_free_mrf = vcc->first_free_mrf + 14;
@@ -1299,7 +1299,7 @@ ilo_shader_compile_vs(const struct ilo_shader_state *state,
if (!vs_setup(&vcc, state, variant))
return NULL;
- if (vcc.tc.dev->gen >= ILO_GEN(7)) {
+ if (ilo_dev_gen(vcc.tc.dev) >= ILO_GEN(7)) {
need_gs = false;
}
else {
diff --git a/src/gallium/drivers/ilo/shader/toy_compiler_disasm.c b/src/gallium/drivers/ilo/shader/toy_compiler_disasm.c
index 751fccbf11b..fffa8bfdc03 100644
--- a/src/gallium/drivers/ilo/shader/toy_compiler_disasm.c
+++ b/src/gallium/drivers/ilo/shader/toy_compiler_disasm.c
@@ -188,7 +188,7 @@ disasm_inst_decode_dw0_gen6(struct disasm_inst *inst, uint32_t dw0)
switch (inst->opcode) {
case GEN6_OPCODE_IF:
inst->has_jip = true;
- inst->has_uip = (inst->dev->gen >= ILO_GEN(7));
+ inst->has_uip = (ilo_dev_gen(inst->dev) >= ILO_GEN(7));
break;
case GEN6_OPCODE_BREAK:
case GEN6_OPCODE_CONT:
@@ -244,7 +244,8 @@ disasm_inst_decode_dw0_gen6(struct disasm_inst *inst, uint32_t dw0)
static bool
disasm_inst_jip_in_dw1_high_gen6(const struct disasm_inst *inst)
{
- return (inst->dev->gen == ILO_GEN(6) && inst->has_jip && !inst->has_uip);
+ return (ilo_dev_gen(inst->dev) == ILO_GEN(6) &&
+ inst->has_jip && !inst->has_uip);
}
static void
@@ -257,7 +258,7 @@ disasm_inst_decode_dw1_gen6(struct disasm_inst *inst, uint32_t dw1)
inst->src1.base.file = GEN_EXTRACT(dw1, GEN6_INST_SRC1_FILE);
inst->src1.base.type = GEN_EXTRACT(dw1, GEN6_INST_SRC1_TYPE);
- if (inst->dev->gen >= ILO_GEN(7))
+ if (ilo_dev_gen(inst->dev) >= ILO_GEN(7))
inst->nib_ctrl = (bool) (dw1 & GEN7_INST_NIBCTRL);
if (disasm_inst_jip_in_dw1_high_gen6(inst)) {
@@ -303,7 +304,7 @@ disasm_inst_decode_dw2_dw3_gen6(struct disasm_inst *inst,
{
int count, i;
- if (inst->dev->gen >= ILO_GEN(7))
+ if (ilo_dev_gen(inst->dev) >= ILO_GEN(7))
inst->flag_reg = GEN_EXTRACT(dw2, GEN7_INST_FLAG_REG);
inst->flag_subreg = GEN_EXTRACT(dw2, GEN6_INST_FLAG_SUBREG);
@@ -381,7 +382,7 @@ disasm_inst_decode_3src_dw1_gen6(struct disasm_inst *inst, uint32_t dw1)
inst->flag_subreg = GEN_EXTRACT(dw1, GEN6_3SRC_FLAG_SUBREG);
- if (inst->dev->gen >= ILO_GEN(7)) {
+ if (ilo_dev_gen(inst->dev) >= ILO_GEN(7)) {
inst->nib_ctrl = (bool) (dw1 & GEN7_3SRC_NIBCTRL);
inst->flag_reg = GEN_EXTRACT(dw1, GEN7_3SRC_FLAG_REG);
@@ -1162,7 +1163,7 @@ disasm_printer_add_mdesc_sampler(struct disasm_printer *printer,
{
int op, simd;
- if (inst->dev->gen >= ILO_GEN(7)) {
+ if (ilo_dev_gen(inst->dev) >= ILO_GEN(7)) {
op = GEN_EXTRACT(mdesc, GEN7_MSG_SAMPLER_OP);
simd = GEN_EXTRACT(mdesc, GEN7_MSG_SAMPLER_SIMD);
} {
@@ -1185,7 +1186,7 @@ disasm_printer_add_mdesc_urb(struct disasm_printer *printer,
int offset;
bool interleaved, complete, allocate, used;
- if (inst->dev->gen >= ILO_GEN(7)) {
+ if (ilo_dev_gen(inst->dev) >= ILO_GEN(7)) {
switch (GEN_EXTRACT(mdesc, GEN7_MSG_URB_OP)) {
case GEN7_MSG_URB_WRITE_HWORD: op = "write HWord"; break;
case GEN7_MSG_URB_WRITE_OWORD: op = "write OWord"; break;
@@ -1229,9 +1230,9 @@ disasm_printer_add_mdesc_dp_sampler(struct disasm_printer *printer,
const struct disasm_inst *inst,
uint32_t mdesc)
{
- const int op = (inst->dev->gen >= ILO_GEN(7)) ?
+ const int op = (ilo_dev_gen(inst->dev) >= ILO_GEN(7)) ?
GEN_EXTRACT(mdesc, GEN7_MSG_DP_OP) : GEN_EXTRACT(mdesc, GEN6_MSG_DP_OP);
- const bool write_commit = (inst->dev->gen == ILO_GEN(6)) ?
+ const bool write_commit = (ilo_dev_gen(inst->dev) == ILO_GEN(6)) ?
(mdesc & GEN6_MSG_DP_SEND_WRITE_COMMIT) : 0;
disasm_printer_add(printer, " (%d, %d, %d, %d)",
@@ -1245,12 +1246,12 @@ disasm_printer_add_mdesc_dp_rc(struct disasm_printer *printer,
const struct disasm_inst *inst,
uint32_t mdesc)
{
- const int op = (inst->dev->gen >= ILO_GEN(7)) ?
+ const int op = (ilo_dev_gen(inst->dev) >= ILO_GEN(7)) ?
GEN_EXTRACT(mdesc, GEN7_MSG_DP_OP) : GEN_EXTRACT(mdesc, GEN6_MSG_DP_OP);
const char *str;
bool is_rt_write;
- if (inst->dev->gen >= ILO_GEN(7.5)) {
+ if (ilo_dev_gen(inst->dev) >= ILO_GEN(7.5)) {
switch (op) {
case GEN75_MSG_DP_RC_MEDIA_BLOCK_READ: str = "media block read"; break;
case GEN75_MSG_DP_RC_MEMORY_FENCE: str = "memory fence"; break;
@@ -1260,7 +1261,7 @@ disasm_printer_add_mdesc_dp_rc(struct disasm_printer *printer,
}
is_rt_write = (op == GEN75_MSG_DP_RC_RT_WRITE);
- } else if (inst->dev->gen >= ILO_GEN(7)) {
+ } else if (ilo_dev_gen(inst->dev) >= ILO_GEN(7)) {
switch (op) {
case GEN7_MSG_DP_RC_MEDIA_BLOCK_READ: str = "media block read"; break;
case GEN7_MSG_DP_RC_TYPED_SURFACE_READ: str = "typed surface read"; break;
@@ -1311,7 +1312,7 @@ disasm_printer_add_mdesc_dp_rc(struct disasm_printer *printer,
disasm_printer_add(printer, " %s%s%s%s", str,
(mdesc & GEN6_MSG_DP_SLOTGRP_HI) ? " Hi" : "",
(mdesc & GEN6_MSG_DP_RT_LAST) ? " LastRT" : "",
- (inst->dev->gen == ILO_GEN(6) &&
+ (ilo_dev_gen(inst->dev) == ILO_GEN(6) &&
(mdesc & GEN6_MSG_DP_SEND_WRITE_COMMIT)) ? " WriteCommit" : "");
}
diff --git a/src/gallium/drivers/ilo/shader/toy_helpers.h b/src/gallium/drivers/ilo/shader/toy_helpers.h
index 2e96ef8ef38..ec6acadf579 100644
--- a/src/gallium/drivers/ilo/shader/toy_helpers.h
+++ b/src/gallium/drivers/ilo/shader/toy_helpers.h
@@ -168,7 +168,7 @@ tsrc_imm_mdesc_sampler(const struct toy_compiler *tc,
assert(sampler_index < 16);
assert(binding_table_index < 256);
- if (tc->dev->gen >= ILO_GEN(7)) {
+ if (ilo_dev_gen(tc->dev) >= ILO_GEN(7)) {
ctrl = simd_mode << 17 |
message_type << 12 |
sampler_index << 8 |
@@ -198,7 +198,7 @@ tsrc_imm_mdesc_data_port(const struct toy_compiler *tc,
{
uint32_t ctrl;
- if (tc->dev->gen >= ILO_GEN(7)) {
+ if (ilo_dev_gen(tc->dev) >= ILO_GEN(7)) {
assert(!send_write_commit_message);
assert((message_specific_control & 0x3f00) == message_specific_control);
@@ -235,7 +235,7 @@ tsrc_imm_mdesc_data_port_scratch(const struct toy_compiler *tc,
const bool header_present = true;
uint32_t ctrl;
- assert(tc->dev->gen >= ILO_GEN(7));
+ assert(ilo_dev_gen(tc->dev) >= ILO_GEN(7));
assert(num_registers == 1 || num_registers == 2 || num_registers == 4);
ctrl = 1 << 18 |
@@ -264,7 +264,7 @@ tsrc_imm_mdesc_urb(const struct toy_compiler *tc,
const bool header_present = true;
uint32_t ctrl;
- if (tc->dev->gen >= ILO_GEN(7)) {
+ if (ilo_dev_gen(tc->dev) >= ILO_GEN(7)) {
const bool per_slot_offset = false;
ctrl = per_slot_offset << 16 |
diff --git a/src/gallium/drivers/ilo/shader/toy_legalize.c b/src/gallium/drivers/ilo/shader/toy_legalize.c
index 6530c4b6947..b949d355a03 100644
--- a/src/gallium/drivers/ilo/shader/toy_legalize.c
+++ b/src/gallium/drivers/ilo/shader/toy_legalize.c
@@ -335,7 +335,7 @@ patch_while_jip(struct toy_compiler *tc, struct toy_inst *inst)
dist--;
}
- if (tc->dev->gen >= ILO_GEN(7))
+ if (ilo_dev_gen(tc->dev) >= ILO_GEN(7))
inst->src[1] = tsrc_imm_w(dist * 2);
else
inst->dst = tdst_imm_w(dist * 2);
@@ -375,7 +375,7 @@ patch_if_else_jip(struct toy_compiler *tc, struct toy_inst *inst)
/* the following instruction */
jip = (dist + 1) * 2;
- if (tc->dev->gen == ILO_GEN(6)) {
+ if (ilo_dev_gen(tc->dev) == ILO_GEN(6)) {
uip = jip;
break;
}
@@ -388,7 +388,7 @@ patch_if_else_jip(struct toy_compiler *tc, struct toy_inst *inst)
dist++;
}
- if (tc->dev->gen >= ILO_GEN(7)) {
+ if (ilo_dev_gen(tc->dev) >= ILO_GEN(7)) {
/* what should the type be? */
inst->dst.type = TOY_TYPE_D;
inst->src[0].type = TOY_TYPE_D;
@@ -433,7 +433,7 @@ patch_endif_jip(struct toy_compiler *tc, struct toy_inst *inst)
if (!found)
dist = 1;
- if (tc->dev->gen >= ILO_GEN(7))
+ if (ilo_dev_gen(tc->dev) >= ILO_GEN(7))
inst->src[1] = tsrc_imm_w(dist * 2);
else
inst->dst = tdst_imm_w(dist * 2);
@@ -485,7 +485,8 @@ patch_break_continue_jip(struct toy_compiler *tc, struct toy_inst *inst)
}
else {
/* the following instruction */
- if (tc->dev->gen == ILO_GEN(6) && inst->opcode == GEN6_OPCODE_BREAK)
+ if (ilo_dev_gen(tc->dev) == ILO_GEN(6) &&
+ inst->opcode == GEN6_OPCODE_BREAK)
dist++;
uip = dist * 2;
@@ -546,7 +547,7 @@ toy_compiler_legalize_for_asm(struct toy_compiler *tc)
*
* "INT DIV function does not support SIMD16."
*/
- if (tc->dev->gen < ILO_GEN(7) ||
+ if (ilo_dev_gen(tc->dev) < ILO_GEN(7) ||
inst->cond_modifier == GEN6_MATH_INT_DIV_QUOTIENT ||
inst->cond_modifier == GEN6_MATH_INT_DIV_REMAINDER) {
struct toy_inst *inst2;
@@ -566,7 +567,7 @@ toy_compiler_legalize_for_asm(struct toy_compiler *tc)
}
break;
case GEN6_OPCODE_IF:
- if (tc->dev->gen >= ILO_GEN(7) &&
+ if (ilo_dev_gen(tc->dev) >= ILO_GEN(7) &&
inst->cond_modifier != GEN6_COND_NONE) {
struct toy_inst *inst2;
@@ -590,7 +591,7 @@ toy_compiler_legalize_for_asm(struct toy_compiler *tc)
}
/* MRF to GRF */
- if (tc->dev->gen >= ILO_GEN(7)) {
+ if (ilo_dev_gen(tc->dev) >= ILO_GEN(7)) {
for (i = 0; i < Elements(inst->src); i++) {
if (inst->src[i].file != TOY_FILE_MRF)
continue;