void brw_clip_emit_vue(struct brw_clip_compile *c,
struct brw_indirect vert,
- bool allocate,
- bool eot,
+ unsigned flags,
GLuint header);
void brw_clip_kill_thread(struct brw_clip_compile *c);
brw_clip_interp_vertex(c, newvtx0, vtx0, vtx1, c->reg.t0, false);
brw_clip_interp_vertex(c, newvtx1, vtx1, vtx0, c->reg.t1, false);
- brw_clip_emit_vue(c, newvtx0, 1, 0,
+ brw_clip_emit_vue(c, newvtx0, BRW_URB_WRITE_ALLOCATE_COMPLETE,
(_3DPRIM_LINESTRIP << URB_WRITE_PRIM_TYPE_SHIFT)
| URB_WRITE_PRIM_START);
- brw_clip_emit_vue(c, newvtx1, 0, 1,
+ brw_clip_emit_vue(c, newvtx1, BRW_URB_WRITE_EOT_COMPLETE,
(_3DPRIM_LINESTRIP << URB_WRITE_PRIM_TYPE_SHIFT)
| URB_WRITE_PRIM_END);
}
brw_MOV(p, get_addr_reg(vptr), brw_address(c->reg.inlist));
brw_MOV(p, get_addr_reg(v0), deref_1uw(vptr, 0));
- brw_clip_emit_vue(c, v0, 1, 0,
+ brw_clip_emit_vue(c, v0, BRW_URB_WRITE_ALLOCATE_COMPLETE,
((_3DPRIM_TRIFAN << URB_WRITE_PRIM_TYPE_SHIFT)
| URB_WRITE_PRIM_START));
brw_DO(p, BRW_EXECUTE_1);
{
- brw_clip_emit_vue(c, v0, 1, 0,
+ brw_clip_emit_vue(c, v0, BRW_URB_WRITE_ALLOCATE_COMPLETE,
(_3DPRIM_TRIFAN << URB_WRITE_PRIM_TYPE_SHIFT));
brw_ADD(p, get_addr_reg(vptr), get_addr_reg(vptr), brw_imm_uw(2));
}
brw_WHILE(p);
- brw_clip_emit_vue(c, v0, 0, 1,
+ brw_clip_emit_vue(c, v0, BRW_URB_WRITE_EOT_COMPLETE,
((_3DPRIM_TRIFAN << URB_WRITE_PRIM_TYPE_SHIFT)
| URB_WRITE_PRIM_END));
}
brw_imm_f(0));
brw_IF(p, BRW_EXECUTE_1);
{
- brw_clip_emit_vue(c, v0, 1, 0,
+ brw_clip_emit_vue(c, v0, BRW_URB_WRITE_ALLOCATE_COMPLETE,
(_3DPRIM_LINESTRIP << URB_WRITE_PRIM_TYPE_SHIFT)
| URB_WRITE_PRIM_START);
- brw_clip_emit_vue(c, v1, 1, 0,
+ brw_clip_emit_vue(c, v1, BRW_URB_WRITE_ALLOCATE_COMPLETE,
(_3DPRIM_LINESTRIP << URB_WRITE_PRIM_TYPE_SHIFT)
| URB_WRITE_PRIM_END);
}
if (do_offset)
apply_one_offset(c, v0);
- brw_clip_emit_vue(c, v0, 1, 0,
+ brw_clip_emit_vue(c, v0, BRW_URB_WRITE_ALLOCATE_COMPLETE,
(_3DPRIM_POINTLIST << URB_WRITE_PRIM_TYPE_SHIFT)
| URB_WRITE_PRIM_START | URB_WRITE_PRIM_END);
}
void brw_clip_emit_vue(struct brw_clip_compile *c,
struct brw_indirect vert,
- bool allocate,
- bool eot,
+ unsigned flags,
GLuint header)
{
struct brw_compile *p = &c->func;
+ bool allocate = flags & BRW_URB_WRITE_ALLOCATE;
brw_clip_ff_sync(c);
- assert(!(allocate && eot));
+ /* Any URB entry that is allocated must subsequently be used or discarded,
+ * so it doesn't make sense to mark EOT and ALLOCATE at the same time.
+ */
+ assert(!(allocate && (flags & BRW_URB_WRITE_EOT)));
/* Copy the vertex from vertn into m1..mN+1:
*/
allocate ? c->reg.R0 : retype(brw_null_reg(), BRW_REGISTER_TYPE_UD),
0,
c->reg.R0,
- allocate,
- 1, /* used */
+ flags,
c->nr_regs + 1, /* msg length */
allocate ? 1 : 0, /* response_length */
- eot, /* eot */
- 1, /* writes_complete */
0, /* urb offset */
BRW_URB_SWIZZLE_NONE);
}
retype(brw_null_reg(), BRW_REGISTER_TYPE_UD),
0,
c->reg.R0,
- 0, /* allocate */
- 0, /* used */
+ BRW_URB_WRITE_UNUSED | BRW_URB_WRITE_EOT_COMPLETE,
1, /* msg len */
0, /* response len */
- 1, /* eot */
- 1, /* writes complete */
0,
BRW_URB_SWIZZLE_NONE);
}
GLuint end_of_thread,
GLuint send_commit_msg);
+enum brw_urb_write_flags {
+ /**
+ * Causes a new URB entry to be allocated, and its address stored in the
+ * destination register (gen < 7).
+ */
+ BRW_URB_WRITE_ALLOCATE = 0x1,
+
+ /**
+ * Causes the current URB entry to be deallocated (gen < 7).
+ */
+ BRW_URB_WRITE_UNUSED = 0x2,
+
+ /**
+ * Causes the thread to terminate.
+ */
+ BRW_URB_WRITE_EOT = 0x4,
+
+ /**
+ * Indicates that the given URB entry is complete, and may be sent further
+ * down the 3D pipeline (gen < 7).
+ */
+ BRW_URB_WRITE_COMPLETE = 0x8,
+
+ /**
+ * Convenient combination of flags: end the thread while simultaneously
+ * marking the given URB entry as complete.
+ */
+ BRW_URB_WRITE_EOT_COMPLETE = BRW_URB_WRITE_EOT | BRW_URB_WRITE_COMPLETE,
+
+ /**
+ * Convenient combination of flags: mark the given URB entry as complete
+ * and simultaneously allocate a new one.
+ */
+ BRW_URB_WRITE_ALLOCATE_COMPLETE =
+ BRW_URB_WRITE_ALLOCATE | BRW_URB_WRITE_COMPLETE,
+};
+
void brw_urb_WRITE(struct brw_compile *p,
struct brw_reg dest,
GLuint msg_reg_nr,
struct brw_reg src0,
- bool allocate,
- bool used,
+ unsigned flags,
GLuint msg_length,
GLuint response_length,
- bool eot,
- bool writes_complete,
GLuint offset,
GLuint swizzle);
static void brw_set_urb_message( struct brw_compile *p,
struct brw_instruction *insn,
- bool allocate,
- bool used,
+ unsigned flags,
GLuint msg_length,
GLuint response_length,
- bool end_of_thread,
- bool complete,
GLuint offset,
GLuint swizzle_control )
{
struct brw_context *brw = p->brw;
brw_set_message_descriptor(p, insn, BRW_SFID_URB,
- msg_length, response_length, true, end_of_thread);
+ msg_length, response_length, true,
+ flags & BRW_URB_WRITE_EOT);
if (brw->gen == 7) {
insn->bits3.urb_gen7.opcode = 0; /* URB_WRITE_HWORD */
insn->bits3.urb_gen7.offset = offset;
insn->bits3.urb_gen7.swizzle_control = swizzle_control;
/* per_slot_offset = 0 makes it ignore offsets in message header */
insn->bits3.urb_gen7.per_slot_offset = 0;
- insn->bits3.urb_gen7.complete = complete;
+ insn->bits3.urb_gen7.complete = flags & BRW_URB_WRITE_COMPLETE ? 1 : 0;
} else if (brw->gen >= 5) {
insn->bits3.urb_gen5.opcode = 0; /* URB_WRITE */
insn->bits3.urb_gen5.offset = offset;
insn->bits3.urb_gen5.swizzle_control = swizzle_control;
- insn->bits3.urb_gen5.allocate = allocate;
- insn->bits3.urb_gen5.used = used; /* ? */
- insn->bits3.urb_gen5.complete = complete;
+ insn->bits3.urb_gen5.allocate = flags & BRW_URB_WRITE_ALLOCATE ? 1 : 0;
+ insn->bits3.urb_gen5.used = flags & BRW_URB_WRITE_UNUSED ? 0 : 1;
+ insn->bits3.urb_gen5.complete = flags & BRW_URB_WRITE_COMPLETE ? 1 : 0;
} else {
insn->bits3.urb.opcode = 0; /* ? */
insn->bits3.urb.offset = offset;
insn->bits3.urb.swizzle_control = swizzle_control;
- insn->bits3.urb.allocate = allocate;
- insn->bits3.urb.used = used; /* ? */
- insn->bits3.urb.complete = complete;
+ insn->bits3.urb.allocate = flags & BRW_URB_WRITE_ALLOCATE ? 1 : 0;
+ insn->bits3.urb.used = flags & BRW_URB_WRITE_UNUSED ? 0 : 1;
+ insn->bits3.urb.complete = flags & BRW_URB_WRITE_COMPLETE ? 1 : 0;
}
}
struct brw_reg dest,
GLuint msg_reg_nr,
struct brw_reg src0,
- bool allocate,
- bool used,
+ unsigned flags,
GLuint msg_length,
GLuint response_length,
- bool eot,
- bool writes_complete,
GLuint offset,
GLuint swizzle)
{
brw_set_urb_message(p,
insn,
- allocate,
- used,
+ flags,
msg_length,
response_length,
- eot,
- writes_complete,
offset,
swizzle);
}
: retype(brw_null_reg(), BRW_REGISTER_TYPE_UD),
0,
c->reg.header,
- allocate,
- 1, /* used */
+ allocate ? BRW_URB_WRITE_ALLOCATE_COMPLETE
+ : BRW_URB_WRITE_EOT_COMPLETE,
c->nr_regs + 1, /* msg length */
allocate ? 1 : 0, /* response length */
- allocate ? 0 : 1, /* eot */
- 1, /* writes_complete */
0, /* urb offset */
BRW_URB_SWIZZLE_NONE);
brw_null_reg(),
0,
brw_vec8_grf(0, 0), /* r0, will be copied to m0 */
- 0, /* allocate */
- 1, /* used */
+ last ? BRW_URB_WRITE_EOT_COMPLETE : 0,
4, /* msg len */
0, /* response len */
- last, /* eot */
- last, /* writes complete */
i*4, /* offset */
BRW_URB_SWIZZLE_TRANSPOSE); /* XXX: Swizzle control "SF to windower" */
}
brw_null_reg(),
0,
brw_vec8_grf(0, 0),
- 0, /* allocate */
- 1, /* used */
+ last ? BRW_URB_WRITE_EOT_COMPLETE : 0,
4, /* msg len */
0, /* response len */
- last, /* eot */
- last, /* writes complete */
i*4, /* urb destination offset */
BRW_URB_SWIZZLE_TRANSPOSE);
}
brw_null_reg(),
0,
brw_vec8_grf(0, 0),
- 0, /* allocate */
- 1, /* used */
+ last ? BRW_URB_WRITE_EOT_COMPLETE : 0,
4, /* msg len */
0, /* response len */
- last, /* eot */
- last, /* writes complete */
i*4, /* urb destination offset */
BRW_URB_SWIZZLE_TRANSPOSE);
}
brw_null_reg(),
0,
brw_vec8_grf(0, 0),
- 0, /* allocate */
- 1, /* used */
+ last ? BRW_URB_WRITE_EOT_COMPLETE : 0,
4, /* msg len */
0, /* response len */
- last, /* eot */
- last, /* writes complete */
i*4, /* urb destination offset */
BRW_URB_SWIZZLE_TRANSPOSE);
}
int target; /**< MRT target. */
bool shadow_compare;
- bool eot;
+ unsigned urb_write_flags;
bool header_present;
int mlen; /**< SEND message length */
int base_mrf; /**< First MRF in the SEND message, if mlen is nonzero. */
brw_null_reg(), /* dest */
inst->base_mrf, /* starting mrf reg nr */
brw_vec8_grf(0, 0), /* src */
- false, /* allocate */
- true, /* used */
+ inst->urb_write_flags,
inst->mlen,
0, /* response len */
- inst->eot, /* eot */
- inst->eot, /* writes complete */
inst->offset, /* urb destination offset */
BRW_URB_SWIZZLE_INTERLEAVE);
}
}
vec4_instruction *inst = emit(VS_OPCODE_URB_WRITE);
- inst->eot = complete;
+ inst->urb_write_flags = complete ? BRW_URB_WRITE_EOT_COMPLETE : 0;
return inst;
}