drm/i915: Add register whitelist for DRM master
authorBrad Volkin <bradley.d.volkin@intel.com>
Tue, 18 Feb 2014 18:15:51 +0000 (10:15 -0800)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Tue, 1 Apr 2014 20:58:11 +0000 (22:58 +0200)
These are used to implement scanline waits in the X server.

v2: Use #defines instead of magic numbers

Signed-off-by: Brad Volkin <bradley.d.volkin@intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/i915_cmd_parser.c
drivers/gpu/drm/i915/i915_reg.h

index 7249b512571d4e6acaaa3d82348897d5c9cd749c..0182c7cee32af0dffaa786f5c5eb8559cacdcaed 100644 (file)
@@ -281,6 +281,19 @@ static const u32 gen7_blt_regs[] = {
        BCS_SWCTRL,
 };
 
+static const u32 ivb_master_regs[] = {
+       FORCEWAKE_MT,
+       DERRMR,
+       GEN7_PIPE_DE_LOAD_SL(PIPE_A),
+       GEN7_PIPE_DE_LOAD_SL(PIPE_B),
+       GEN7_PIPE_DE_LOAD_SL(PIPE_C),
+};
+
+static const u32 hsw_master_regs[] = {
+       FORCEWAKE_MT,
+       DERRMR,
+};
+
 #undef REG64
 
 static u32 gen7_render_get_cmd_length_mask(u32 cmd_header)
@@ -409,6 +422,14 @@ void i915_cmd_parser_init_ring(struct intel_ring_buffer *ring)
                ring->reg_table = gen7_render_regs;
                ring->reg_count = ARRAY_SIZE(gen7_render_regs);
 
+               if (IS_HASWELL(ring->dev)) {
+                       ring->master_reg_table = hsw_master_regs;
+                       ring->master_reg_count = ARRAY_SIZE(hsw_master_regs);
+               } else {
+                       ring->master_reg_table = ivb_master_regs;
+                       ring->master_reg_count = ARRAY_SIZE(ivb_master_regs);
+               }
+
                ring->get_cmd_length_mask = gen7_render_get_cmd_length_mask;
                break;
        case VCS:
@@ -428,6 +449,14 @@ void i915_cmd_parser_init_ring(struct intel_ring_buffer *ring)
                ring->reg_table = gen7_blt_regs;
                ring->reg_count = ARRAY_SIZE(gen7_blt_regs);
 
+               if (IS_HASWELL(ring->dev)) {
+                       ring->master_reg_table = hsw_master_regs;
+                       ring->master_reg_count = ARRAY_SIZE(hsw_master_regs);
+               } else {
+                       ring->master_reg_table = ivb_master_regs;
+                       ring->master_reg_count = ARRAY_SIZE(ivb_master_regs);
+               }
+
                ring->get_cmd_length_mask = gen7_blt_get_cmd_length_mask;
                break;
        case VECS:
index 6247843914c87d6d71c5bfd47879aba9e62508b0..d90171bd14dc5f13d6e9c54c30e4a20c64a548a3 100644 (file)
 /* There are the 4 64-bit counter registers, one for each stream output */
 #define GEN7_SO_NUM_PRIMS_WRITTEN(n) (0x5200 + (n) * 8)
 
+#define _GEN7_PIPEA_DE_LOAD_SL 0x70068
+#define _GEN7_PIPEB_DE_LOAD_SL 0x71068
+#define GEN7_PIPE_DE_LOAD_SL(pipe) _PIPE(pipe, \
+                                        _GEN7_PIPEA_DE_LOAD_SL, \
+                                        _GEN7_PIPEB_DE_LOAD_SL)
+
 /*
  * Reset registers
  */