aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/intel_ringbuffer.c
diff options
context:
space:
mode:
authorLucas De Marchi <lucas.demarchi@intel.com>2018-12-12 13:10:43 -0500
committerRodrigo Vivi <rodrigo.vivi@intel.com>2018-12-12 19:52:10 -0500
commitcf819eff907ab49205ece97c96baeb909fd36f4d (patch)
treea72b69e1d0c1a188db876edccafcf04612133132 /drivers/gpu/drm/i915/intel_ringbuffer.c
parent006900087727f675e9367eb3c3e054912ddbffdd (diff)
drm/i915: replace IS_GEN<N> with IS_GEN(..., N)
Define IS_GEN() similarly to our IS_GEN_RANGE(). but use gen instead of gen_mask to do the comparison. Now callers can pass then gen as a parameter, so we don't require one macro for each gen. The following spatch was used to convert the users of these macros: @@ expression e; @@ ( - IS_GEN2(e) + IS_GEN(e, 2) | - IS_GEN3(e) + IS_GEN(e, 3) | - IS_GEN4(e) + IS_GEN(e, 4) | - IS_GEN5(e) + IS_GEN(e, 5) | - IS_GEN6(e) + IS_GEN(e, 6) | - IS_GEN7(e) + IS_GEN(e, 7) | - IS_GEN8(e) + IS_GEN(e, 8) | - IS_GEN9(e) + IS_GEN(e, 9) | - IS_GEN10(e) + IS_GEN(e, 10) | - IS_GEN11(e) + IS_GEN(e, 11) ) v2: use IS_GEN rather than GT_GEN and compare to info.gen rather than using the bitmask Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com> Reviewed-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20181212181044.15886-2-lucas.demarchi@intel.com
Diffstat (limited to 'drivers/gpu/drm/i915/intel_ringbuffer.c')
-rw-r--r--drivers/gpu/drm/i915/intel_ringbuffer.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
index 720c11e0acd1..fdeca2b877c9 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
@@ -133,7 +133,7 @@ gen4_render_ring_flush(struct i915_request *rq, u32 mode)
133 cmd = MI_FLUSH; 133 cmd = MI_FLUSH;
134 if (mode & EMIT_INVALIDATE) { 134 if (mode & EMIT_INVALIDATE) {
135 cmd |= MI_EXE_FLUSH; 135 cmd |= MI_EXE_FLUSH;
136 if (IS_G4X(rq->i915) || IS_GEN5(rq->i915)) 136 if (IS_G4X(rq->i915) || IS_GEN(rq->i915, 5))
137 cmd |= MI_INVALIDATE_ISP; 137 cmd |= MI_INVALIDATE_ISP;
138 } 138 }
139 139
@@ -401,7 +401,7 @@ static void intel_ring_setup_status_page(struct intel_engine_cs *engine)
401 /* The ring status page addresses are no longer next to the rest of 401 /* The ring status page addresses are no longer next to the rest of
402 * the ring registers as of gen7. 402 * the ring registers as of gen7.
403 */ 403 */
404 if (IS_GEN7(dev_priv)) { 404 if (IS_GEN(dev_priv, 7)) {
405 switch (engine->id) { 405 switch (engine->id) {
406 /* 406 /*
407 * No more rings exist on Gen7. Default case is only to shut up 407 * No more rings exist on Gen7. Default case is only to shut up
@@ -422,7 +422,7 @@ static void intel_ring_setup_status_page(struct intel_engine_cs *engine)
422 mmio = VEBOX_HWS_PGA_GEN7; 422 mmio = VEBOX_HWS_PGA_GEN7;
423 break; 423 break;
424 } 424 }
425 } else if (IS_GEN6(dev_priv)) { 425 } else if (IS_GEN(dev_priv, 6)) {
426 mmio = RING_HWS_PGA_GEN6(engine->mmio_base); 426 mmio = RING_HWS_PGA_GEN6(engine->mmio_base);
427 } else { 427 } else {
428 mmio = RING_HWS_PGA(engine->mmio_base); 428 mmio = RING_HWS_PGA(engine->mmio_base);
@@ -693,17 +693,17 @@ static int init_render_ring(struct intel_engine_cs *engine)
693 693
694 /* Required for the hardware to program scanline values for waiting */ 694 /* Required for the hardware to program scanline values for waiting */
695 /* WaEnableFlushTlbInvalidationMode:snb */ 695 /* WaEnableFlushTlbInvalidationMode:snb */
696 if (IS_GEN6(dev_priv)) 696 if (IS_GEN(dev_priv, 6))
697 I915_WRITE(GFX_MODE, 697 I915_WRITE(GFX_MODE,
698 _MASKED_BIT_ENABLE(GFX_TLB_INVALIDATE_EXPLICIT)); 698 _MASKED_BIT_ENABLE(GFX_TLB_INVALIDATE_EXPLICIT));
699 699
700 /* WaBCSVCSTlbInvalidationMode:ivb,vlv,hsw */ 700 /* WaBCSVCSTlbInvalidationMode:ivb,vlv,hsw */
701 if (IS_GEN7(dev_priv)) 701 if (IS_GEN(dev_priv, 7))
702 I915_WRITE(GFX_MODE_GEN7, 702 I915_WRITE(GFX_MODE_GEN7,
703 _MASKED_BIT_ENABLE(GFX_TLB_INVALIDATE_EXPLICIT) | 703 _MASKED_BIT_ENABLE(GFX_TLB_INVALIDATE_EXPLICIT) |
704 _MASKED_BIT_ENABLE(GFX_REPLAY_MODE)); 704 _MASKED_BIT_ENABLE(GFX_REPLAY_MODE));
705 705
706 if (IS_GEN6(dev_priv)) { 706 if (IS_GEN(dev_priv, 6)) {
707 /* From the Sandybridge PRM, volume 1 part 3, page 24: 707 /* From the Sandybridge PRM, volume 1 part 3, page 24:
708 * "If this bit is set, STCunit will have LRA as replacement 708 * "If this bit is set, STCunit will have LRA as replacement
709 * policy. [...] This bit must be reset. LRA replacement 709 * policy. [...] This bit must be reset. LRA replacement
@@ -1582,7 +1582,7 @@ static inline int mi_set_context(struct i915_request *rq, u32 flags)
1582 enum intel_engine_id id; 1582 enum intel_engine_id id;
1583 const int num_rings = 1583 const int num_rings =
1584 /* Use an extended w/a on gen7 if signalling from other rings */ 1584 /* Use an extended w/a on gen7 if signalling from other rings */
1585 (HAS_LEGACY_SEMAPHORES(i915) && IS_GEN7(i915)) ? 1585 (HAS_LEGACY_SEMAPHORES(i915) && IS_GEN(i915, 7)) ?
1586 INTEL_INFO(i915)->num_rings - 1 : 1586 INTEL_INFO(i915)->num_rings - 1 :
1587 0; 1587 0;
1588 bool force_restore = false; 1588 bool force_restore = false;
@@ -1597,7 +1597,7 @@ static inline int mi_set_context(struct i915_request *rq, u32 flags)
1597 flags |= MI_SAVE_EXT_STATE_EN | MI_RESTORE_EXT_STATE_EN; 1597 flags |= MI_SAVE_EXT_STATE_EN | MI_RESTORE_EXT_STATE_EN;
1598 1598
1599 len = 4; 1599 len = 4;
1600 if (IS_GEN7(i915)) 1600 if (IS_GEN(i915, 7))
1601 len += 2 + (num_rings ? 4*num_rings + 6 : 0); 1601 len += 2 + (num_rings ? 4*num_rings + 6 : 0);
1602 if (flags & MI_FORCE_RESTORE) { 1602 if (flags & MI_FORCE_RESTORE) {
1603 GEM_BUG_ON(flags & MI_RESTORE_INHIBIT); 1603 GEM_BUG_ON(flags & MI_RESTORE_INHIBIT);
@@ -1611,7 +1611,7 @@ static inline int mi_set_context(struct i915_request *rq, u32 flags)
1611 return PTR_ERR(cs); 1611 return PTR_ERR(cs);
1612 1612
1613 /* WaProgramMiArbOnOffAroundMiSetContext:ivb,vlv,hsw,bdw,chv */ 1613 /* WaProgramMiArbOnOffAroundMiSetContext:ivb,vlv,hsw,bdw,chv */
1614 if (IS_GEN7(i915)) { 1614 if (IS_GEN(i915, 7)) {
1615 *cs++ = MI_ARB_ON_OFF | MI_ARB_DISABLE; 1615 *cs++ = MI_ARB_ON_OFF | MI_ARB_DISABLE;
1616 if (num_rings) { 1616 if (num_rings) {
1617 struct intel_engine_cs *signaller; 1617 struct intel_engine_cs *signaller;
@@ -1658,7 +1658,7 @@ static inline int mi_set_context(struct i915_request *rq, u32 flags)
1658 */ 1658 */
1659 *cs++ = MI_NOOP; 1659 *cs++ = MI_NOOP;
1660 1660
1661 if (IS_GEN7(i915)) { 1661 if (IS_GEN(i915, 7)) {
1662 if (num_rings) { 1662 if (num_rings) {
1663 struct intel_engine_cs *signaller; 1663 struct intel_engine_cs *signaller;
1664 i915_reg_t last_reg = {}; /* keep gcc quiet */ 1664 i915_reg_t last_reg = {}; /* keep gcc quiet */
@@ -2283,9 +2283,9 @@ int intel_init_render_ring_buffer(struct intel_engine_cs *engine)
2283 if (INTEL_GEN(dev_priv) >= 6) { 2283 if (INTEL_GEN(dev_priv) >= 6) {
2284 engine->init_context = intel_rcs_ctx_init; 2284 engine->init_context = intel_rcs_ctx_init;
2285 engine->emit_flush = gen7_render_ring_flush; 2285 engine->emit_flush = gen7_render_ring_flush;
2286 if (IS_GEN6(dev_priv)) 2286 if (IS_GEN(dev_priv, 6))
2287 engine->emit_flush = gen6_render_ring_flush; 2287 engine->emit_flush = gen6_render_ring_flush;
2288 } else if (IS_GEN5(dev_priv)) { 2288 } else if (IS_GEN(dev_priv, 5)) {
2289 engine->emit_flush = gen4_render_ring_flush; 2289 engine->emit_flush = gen4_render_ring_flush;
2290 } else { 2290 } else {
2291 if (INTEL_GEN(dev_priv) < 4) 2291 if (INTEL_GEN(dev_priv) < 4)
@@ -2315,13 +2315,13 @@ int intel_init_bsd_ring_buffer(struct intel_engine_cs *engine)
2315 2315
2316 if (INTEL_GEN(dev_priv) >= 6) { 2316 if (INTEL_GEN(dev_priv) >= 6) {
2317 /* gen6 bsd needs a special wa for tail updates */ 2317 /* gen6 bsd needs a special wa for tail updates */
2318 if (IS_GEN6(dev_priv)) 2318 if (IS_GEN(dev_priv, 6))
2319 engine->set_default_submission = gen6_bsd_set_default_submission; 2319 engine->set_default_submission = gen6_bsd_set_default_submission;
2320 engine->emit_flush = gen6_bsd_ring_flush; 2320 engine->emit_flush = gen6_bsd_ring_flush;
2321 engine->irq_enable_mask = GT_BSD_USER_INTERRUPT; 2321 engine->irq_enable_mask = GT_BSD_USER_INTERRUPT;
2322 } else { 2322 } else {
2323 engine->emit_flush = bsd_ring_flush; 2323 engine->emit_flush = bsd_ring_flush;
2324 if (IS_GEN5(dev_priv)) 2324 if (IS_GEN(dev_priv, 5))
2325 engine->irq_enable_mask = ILK_BSD_USER_INTERRUPT; 2325 engine->irq_enable_mask = ILK_BSD_USER_INTERRUPT;
2326 else 2326 else
2327 engine->irq_enable_mask = I915_BSD_USER_INTERRUPT; 2327 engine->irq_enable_mask = I915_BSD_USER_INTERRUPT;