|
@@ -86,6 +86,148 @@
|
|
* general bitmasking mechanism.
|
|
* general bitmasking mechanism.
|
|
*/
|
|
*/
|
|
|
|
|
|
|
|
+#define STD_MI_OPCODE_MASK 0xFF800000
|
|
|
|
+#define STD_3D_OPCODE_MASK 0xFFFF0000
|
|
|
|
+#define STD_2D_OPCODE_MASK 0xFFC00000
|
|
|
|
+#define STD_MFX_OPCODE_MASK 0xFFFF0000
|
|
|
|
+
|
|
|
|
+#define CMD(op, opm, f, lm, fl, ...) \
|
|
|
|
+ { \
|
|
|
|
+ .flags = (fl) | ((f) ? CMD_DESC_FIXED : 0), \
|
|
|
|
+ .cmd = { (op), (opm) }, \
|
|
|
|
+ .length = { (lm) }, \
|
|
|
|
+ __VA_ARGS__ \
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+/* Convenience macros to compress the tables */
|
|
|
|
+#define SMI STD_MI_OPCODE_MASK
|
|
|
|
+#define S3D STD_3D_OPCODE_MASK
|
|
|
|
+#define S2D STD_2D_OPCODE_MASK
|
|
|
|
+#define SMFX STD_MFX_OPCODE_MASK
|
|
|
|
+#define F true
|
|
|
|
+#define S CMD_DESC_SKIP
|
|
|
|
+#define R CMD_DESC_REJECT
|
|
|
|
+#define W CMD_DESC_REGISTER
|
|
|
|
+#define B CMD_DESC_BITMASK
|
|
|
|
+#define M CMD_DESC_MASTER
|
|
|
|
+
|
|
|
|
+/* Command Mask Fixed Len Action
|
|
|
|
+ ---------------------------------------------------------- */
|
|
|
|
+static const struct drm_i915_cmd_descriptor common_cmds[] = {
|
|
|
|
+ CMD( MI_NOOP, SMI, F, 1, S ),
|
|
|
|
+ CMD( MI_USER_INTERRUPT, SMI, F, 1, S ),
|
|
|
|
+ CMD( MI_WAIT_FOR_EVENT, SMI, F, 1, S ),
|
|
|
|
+ CMD( MI_ARB_CHECK, SMI, F, 1, S ),
|
|
|
|
+ CMD( MI_REPORT_HEAD, SMI, F, 1, S ),
|
|
|
|
+ CMD( MI_SUSPEND_FLUSH, SMI, F, 1, S ),
|
|
|
|
+ CMD( MI_SEMAPHORE_MBOX, SMI, !F, 0xFF, S ),
|
|
|
|
+ CMD( MI_STORE_DWORD_INDEX, SMI, !F, 0xFF, S ),
|
|
|
|
+ CMD( MI_LOAD_REGISTER_IMM(1), SMI, !F, 0xFF, S ),
|
|
|
|
+ CMD( MI_STORE_REGISTER_MEM(1), SMI, !F, 0xFF, S ),
|
|
|
|
+ CMD( MI_LOAD_REGISTER_MEM, SMI, !F, 0xFF, S ),
|
|
|
|
+ CMD( MI_BATCH_BUFFER_START, SMI, !F, 0xFF, S ),
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+static const struct drm_i915_cmd_descriptor render_cmds[] = {
|
|
|
|
+ CMD( MI_FLUSH, SMI, F, 1, S ),
|
|
|
|
+ CMD( MI_ARB_ON_OFF, SMI, F, 1, S ),
|
|
|
|
+ CMD( MI_PREDICATE, SMI, F, 1, S ),
|
|
|
|
+ CMD( MI_TOPOLOGY_FILTER, SMI, F, 1, S ),
|
|
|
|
+ CMD( MI_DISPLAY_FLIP, SMI, !F, 0xFF, S ),
|
|
|
|
+ CMD( MI_SET_CONTEXT, SMI, !F, 0xFF, S ),
|
|
|
|
+ CMD( MI_URB_CLEAR, SMI, !F, 0xFF, S ),
|
|
|
|
+ CMD( MI_UPDATE_GTT, SMI, !F, 0xFF, S ),
|
|
|
|
+ CMD( MI_CLFLUSH, SMI, !F, 0x3FF, S ),
|
|
|
|
+ CMD( MI_CONDITIONAL_BATCH_BUFFER_END, SMI, !F, 0xFF, S ),
|
|
|
|
+ CMD( GFX_OP_3DSTATE_VF_STATISTICS, S3D, F, 1, S ),
|
|
|
|
+ CMD( PIPELINE_SELECT, S3D, F, 1, S ),
|
|
|
|
+ CMD( GPGPU_OBJECT, S3D, !F, 0xFF, S ),
|
|
|
|
+ CMD( GPGPU_WALKER, S3D, !F, 0xFF, S ),
|
|
|
|
+ CMD( GFX_OP_3DSTATE_SO_DECL_LIST, S3D, !F, 0x1FF, S ),
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+static const struct drm_i915_cmd_descriptor hsw_render_cmds[] = {
|
|
|
|
+ CMD( MI_SET_PREDICATE, SMI, F, 1, S ),
|
|
|
|
+ CMD( MI_RS_CONTROL, SMI, F, 1, S ),
|
|
|
|
+ CMD( MI_URB_ATOMIC_ALLOC, SMI, F, 1, S ),
|
|
|
|
+ CMD( MI_RS_CONTEXT, SMI, F, 1, S ),
|
|
|
|
+ CMD( MI_LOAD_REGISTER_REG, SMI, !F, 0xFF, S ),
|
|
|
|
+ CMD( MI_RS_STORE_DATA_IMM, SMI, !F, 0xFF, S ),
|
|
|
|
+ CMD( MI_LOAD_URB_MEM, SMI, !F, 0xFF, S ),
|
|
|
|
+ CMD( MI_STORE_URB_MEM, SMI, !F, 0xFF, S ),
|
|
|
|
+ CMD( GFX_OP_3DSTATE_DX9_CONSTANTF_VS, S3D, !F, 0x7FF, S ),
|
|
|
|
+ CMD( GFX_OP_3DSTATE_DX9_CONSTANTF_PS, S3D, !F, 0x7FF, S ),
|
|
|
|
+
|
|
|
|
+ CMD( GFX_OP_3DSTATE_BINDING_TABLE_EDIT_VS, S3D, !F, 0x1FF, S ),
|
|
|
|
+ CMD( GFX_OP_3DSTATE_BINDING_TABLE_EDIT_GS, S3D, !F, 0x1FF, S ),
|
|
|
|
+ CMD( GFX_OP_3DSTATE_BINDING_TABLE_EDIT_HS, S3D, !F, 0x1FF, S ),
|
|
|
|
+ CMD( GFX_OP_3DSTATE_BINDING_TABLE_EDIT_DS, S3D, !F, 0x1FF, S ),
|
|
|
|
+ CMD( GFX_OP_3DSTATE_BINDING_TABLE_EDIT_PS, S3D, !F, 0x1FF, S ),
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+static const struct drm_i915_cmd_descriptor video_cmds[] = {
|
|
|
|
+ CMD( MI_ARB_ON_OFF, SMI, F, 1, S ),
|
|
|
|
+ CMD( MI_STORE_DWORD_IMM, SMI, !F, 0xFF, S ),
|
|
|
|
+ CMD( MI_CONDITIONAL_BATCH_BUFFER_END, SMI, !F, 0xFF, S ),
|
|
|
|
+ /*
|
|
|
|
+ * MFX_WAIT doesn't fit the way we handle length for most commands.
|
|
|
|
+ * It has a length field but it uses a non-standard length bias.
|
|
|
|
+ * It is always 1 dword though, so just treat it as fixed length.
|
|
|
|
+ */
|
|
|
|
+ CMD( MFX_WAIT, SMFX, F, 1, S ),
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+static const struct drm_i915_cmd_descriptor vecs_cmds[] = {
|
|
|
|
+ CMD( MI_ARB_ON_OFF, SMI, F, 1, S ),
|
|
|
|
+ CMD( MI_STORE_DWORD_IMM, SMI, !F, 0xFF, S ),
|
|
|
|
+ CMD( MI_CONDITIONAL_BATCH_BUFFER_END, SMI, !F, 0xFF, S ),
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+static const struct drm_i915_cmd_descriptor blt_cmds[] = {
|
|
|
|
+ CMD( MI_DISPLAY_FLIP, SMI, !F, 0xFF, S ),
|
|
|
|
+ CMD( MI_STORE_DWORD_IMM, SMI, !F, 0x3FF, S ),
|
|
|
|
+ CMD( COLOR_BLT, S2D, !F, 0x3F, S ),
|
|
|
|
+ CMD( SRC_COPY_BLT, S2D, !F, 0x3F, S ),
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+#undef CMD
|
|
|
|
+#undef SMI
|
|
|
|
+#undef S3D
|
|
|
|
+#undef S2D
|
|
|
|
+#undef SMFX
|
|
|
|
+#undef F
|
|
|
|
+#undef S
|
|
|
|
+#undef R
|
|
|
|
+#undef W
|
|
|
|
+#undef B
|
|
|
|
+#undef M
|
|
|
|
+
|
|
|
|
+static const struct drm_i915_cmd_table gen7_render_cmds[] = {
|
|
|
|
+ { common_cmds, ARRAY_SIZE(common_cmds) },
|
|
|
|
+ { render_cmds, ARRAY_SIZE(render_cmds) },
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+static const struct drm_i915_cmd_table hsw_render_ring_cmds[] = {
|
|
|
|
+ { common_cmds, ARRAY_SIZE(common_cmds) },
|
|
|
|
+ { render_cmds, ARRAY_SIZE(render_cmds) },
|
|
|
|
+ { hsw_render_cmds, ARRAY_SIZE(hsw_render_cmds) },
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+static const struct drm_i915_cmd_table gen7_video_cmds[] = {
|
|
|
|
+ { common_cmds, ARRAY_SIZE(common_cmds) },
|
|
|
|
+ { video_cmds, ARRAY_SIZE(video_cmds) },
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+static const struct drm_i915_cmd_table hsw_vebox_cmds[] = {
|
|
|
|
+ { common_cmds, ARRAY_SIZE(common_cmds) },
|
|
|
|
+ { vecs_cmds, ARRAY_SIZE(vecs_cmds) },
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+static const struct drm_i915_cmd_table gen7_blt_cmds[] = {
|
|
|
|
+ { common_cmds, ARRAY_SIZE(common_cmds) },
|
|
|
|
+ { blt_cmds, ARRAY_SIZE(blt_cmds) },
|
|
|
|
+};
|
|
|
|
+
|
|
static u32 gen7_render_get_cmd_length_mask(u32 cmd_header)
|
|
static u32 gen7_render_get_cmd_length_mask(u32 cmd_header)
|
|
{
|
|
{
|
|
u32 client = (cmd_header & INSTR_CLIENT_MASK) >> INSTR_CLIENT_SHIFT;
|
|
u32 client = (cmd_header & INSTR_CLIENT_MASK) >> INSTR_CLIENT_SHIFT;
|
|
@@ -200,15 +342,30 @@ void i915_cmd_parser_init_ring(struct intel_ring_buffer *ring)
|
|
|
|
|
|
switch (ring->id) {
|
|
switch (ring->id) {
|
|
case RCS:
|
|
case RCS:
|
|
|
|
+ if (IS_HASWELL(ring->dev)) {
|
|
|
|
+ ring->cmd_tables = hsw_render_ring_cmds;
|
|
|
|
+ ring->cmd_table_count =
|
|
|
|
+ ARRAY_SIZE(hsw_render_ring_cmds);
|
|
|
|
+ } else {
|
|
|
|
+ ring->cmd_tables = gen7_render_cmds;
|
|
|
|
+ ring->cmd_table_count = ARRAY_SIZE(gen7_render_cmds);
|
|
|
|
+ }
|
|
|
|
+
|
|
ring->get_cmd_length_mask = gen7_render_get_cmd_length_mask;
|
|
ring->get_cmd_length_mask = gen7_render_get_cmd_length_mask;
|
|
break;
|
|
break;
|
|
case VCS:
|
|
case VCS:
|
|
|
|
+ ring->cmd_tables = gen7_video_cmds;
|
|
|
|
+ ring->cmd_table_count = ARRAY_SIZE(gen7_video_cmds);
|
|
ring->get_cmd_length_mask = gen7_bsd_get_cmd_length_mask;
|
|
ring->get_cmd_length_mask = gen7_bsd_get_cmd_length_mask;
|
|
break;
|
|
break;
|
|
case BCS:
|
|
case BCS:
|
|
|
|
+ ring->cmd_tables = gen7_blt_cmds;
|
|
|
|
+ ring->cmd_table_count = ARRAY_SIZE(gen7_blt_cmds);
|
|
ring->get_cmd_length_mask = gen7_blt_get_cmd_length_mask;
|
|
ring->get_cmd_length_mask = gen7_blt_get_cmd_length_mask;
|
|
break;
|
|
break;
|
|
case VECS:
|
|
case VECS:
|
|
|
|
+ ring->cmd_tables = hsw_vebox_cmds;
|
|
|
|
+ ring->cmd_table_count = ARRAY_SIZE(hsw_vebox_cmds);
|
|
/* VECS can use the same length_mask function as VCS */
|
|
/* VECS can use the same length_mask function as VCS */
|
|
ring->get_cmd_length_mask = gen7_bsd_get_cmd_length_mask;
|
|
ring->get_cmd_length_mask = gen7_bsd_get_cmd_length_mask;
|
|
break;
|
|
break;
|