public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915: Remove unused workaround bb code and unused struct members
@ 2018-01-10 12:24 Tvrtko Ursulin
  2018-01-10 12:43 ` ✓ Fi.CI.BAT: success for " Patchwork
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Tvrtko Ursulin @ 2018-01-10 12:24 UTC (permalink / raw)
  To: Intel-gfx

From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

After recent code changes this part of the code now looks over-engineered
and can be simplified, together with the corresponding struct members.

Also correct the comment describing the unit of workaround bb size.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
 drivers/gpu/drm/i915/intel_lrc.c        | 57 +++++++++------------------------
 drivers/gpu/drm/i915/intel_ringbuffer.h |  9 ++----
 2 files changed, 18 insertions(+), 48 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
index ff25f209d0a5..3ab1021d8518 100644
--- a/drivers/gpu/drm/i915/intel_lrc.c
+++ b/drivers/gpu/drm/i915/intel_lrc.c
@@ -1260,10 +1260,10 @@ gen8_emit_flush_coherentl3_wa(struct intel_engine_cs *engine, u32 *batch)
 }
 
 /*
- * Typically we only have one indirect_ctx and per_ctx batch buffer which are
- * initialized at the beginning and shared across all contexts but this field
- * helps us to have multiple batches at different offsets and select them based
- * on a criteria. At the moment this batch always start at the beginning of the page
+ * Typically we only have one indirect_ctx batch buffer which is initialized
+ * at the beginning and shared across all contexts but this field helps us
+ * to have multiple batches at different offsets and select them based on a
+ * criteria. At the moment this batch always start at the beginning of the page
  * and at this point we don't have multiple wa_ctx batch buffers.
  *
  * The number of WA applied are not known at the beginning; we use this field
@@ -1406,12 +1406,10 @@ typedef u32 *(*wa_bb_func_t)(struct intel_engine_cs *engine, u32 *batch);
 static int intel_init_workaround_bb(struct intel_engine_cs *engine)
 {
 	struct i915_ctx_workarounds *wa_ctx = &engine->wa_ctx;
-	struct i915_wa_ctx_bb *wa_bb[2] = { &wa_ctx->indirect_ctx,
-					    &wa_ctx->per_ctx };
-	wa_bb_func_t wa_bb_fn[2];
+	struct i915_wa_ctx_bb *wa_bb = &wa_ctx->indirect_ctx;
+	wa_bb_func_t wa_bb_fn;
 	struct page *page;
-	void *batch, *batch_ptr;
-	unsigned int i;
+	void *batch;
 	int ret;
 
 	if (WARN_ON(engine->id != RCS || !engine->scratch))
@@ -1421,12 +1419,10 @@ static int intel_init_workaround_bb(struct intel_engine_cs *engine)
 	case 10:
 		return 0;
 	case 9:
-		wa_bb_fn[0] = gen9_init_indirectctx_bb;
-		wa_bb_fn[1] = NULL;
+		wa_bb_fn = gen9_init_indirectctx_bb;
 		break;
 	case 8:
-		wa_bb_fn[0] = gen8_init_indirectctx_bb;
-		wa_bb_fn[1] = NULL;
+		wa_bb_fn = gen8_init_indirectctx_bb;
 		break;
 	default:
 		MISSING_CASE(INTEL_GEN(engine->i915));
@@ -1440,31 +1436,16 @@ static int intel_init_workaround_bb(struct intel_engine_cs *engine)
 	}
 
 	page = i915_gem_object_get_dirty_page(wa_ctx->vma->obj, 0);
-	batch = batch_ptr = kmap_atomic(page);
+	batch = kmap_atomic(page);
 
-	/*
-	 * Emit the two workaround batch buffers, recording the offset from the
-	 * start of the workaround batch buffer object for each and their
-	 * respective sizes.
-	 */
-	for (i = 0; i < ARRAY_SIZE(wa_bb_fn); i++) {
-		wa_bb[i]->offset = batch_ptr - batch;
-		if (WARN_ON(!IS_ALIGNED(wa_bb[i]->offset, CACHELINE_BYTES))) {
-			ret = -EINVAL;
-			break;
-		}
-		if (wa_bb_fn[i])
-			batch_ptr = wa_bb_fn[i](engine, batch_ptr);
-		wa_bb[i]->size = batch_ptr - (batch + wa_bb[i]->offset);
-	}
-
-	BUG_ON(batch_ptr - batch > CTX_WA_BB_OBJ_SIZE);
+	/* Emit the workaround batch buffer, recording its size. */
+	wa_bb->size = (void *)wa_bb_fn(engine, batch) - batch;
+	GEM_BUG_ON(wa_bb->size > CTX_WA_BB_OBJ_SIZE ||
+		   !IS_ALIGNED(wa_bb->size, CACHELINE_BYTES));
 
 	kunmap_atomic(batch);
-	if (ret)
-		lrc_destroy_wa_ctx(engine);
 
-	return ret;
+	return 0;
 }
 
 static u8 gtiir[] = {
@@ -2184,7 +2165,7 @@ static void execlists_init_reg_state(u32 *regs,
 			u32 ggtt_offset = i915_ggtt_offset(wa_ctx->vma);
 
 			regs[CTX_RCS_INDIRECT_CTX + 1] =
-				(ggtt_offset + wa_ctx->indirect_ctx.offset) |
+				ggtt_offset |
 				(wa_ctx->indirect_ctx.size / CACHELINE_BYTES);
 
 			regs[CTX_RCS_INDIRECT_CTX_OFFSET + 1] =
@@ -2192,12 +2173,6 @@ static void execlists_init_reg_state(u32 *regs,
 		}
 
 		CTX_REG(regs, CTX_BB_PER_CTX_PTR, RING_BB_PER_CTX_PTR(base), 0);
-		if (wa_ctx->per_ctx.size) {
-			u32 ggtt_offset = i915_ggtt_offset(wa_ctx->vma);
-
-			regs[CTX_BB_PER_CTX_PTR + 1] =
-				(ggtt_offset + wa_ctx->per_ctx.offset) | 0x01;
-		}
 	}
 
 	regs[CTX_LRI_HEADER_1] = MI_LOAD_REGISTER_IMM(9) | MI_LRI_FORCE_POSTED;
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h b/drivers/gpu/drm/i915/intel_ringbuffer.h
index c5ff203e42d6..6aa184f6ad2b 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.h
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.h
@@ -142,17 +142,12 @@ struct drm_i915_reg_table;
  * values are referred in terms of dwords
  *
  * struct i915_wa_ctx_bb:
- *  offset: specifies batch starting position, also helpful in case
- *    if we want to have multiple batches at different offsets based on
- *    some criteria. It is not a requirement at the moment but provides
- *    an option for future use.
- *  size: size of the batch in DWORDS
+ *  size: size of the batch in bytes
  */
 struct i915_ctx_workarounds {
 	struct i915_wa_ctx_bb {
-		u32 offset;
 		u32 size;
-	} indirect_ctx, per_ctx;
+	} indirect_ctx;
 	struct i915_vma *vma;
 };
 
-- 
2.14.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* ✓ Fi.CI.BAT: success for drm/i915: Remove unused workaround bb code and unused struct members
  2018-01-10 12:24 [PATCH] drm/i915: Remove unused workaround bb code and unused struct members Tvrtko Ursulin
@ 2018-01-10 12:43 ` Patchwork
  2018-01-10 12:50 ` [PATCH] " Chris Wilson
  2018-01-10 14:08 ` ✓ Fi.CI.IGT: success for " Patchwork
  2 siblings, 0 replies; 5+ messages in thread
From: Patchwork @ 2018-01-10 12:43 UTC (permalink / raw)
  To: Tvrtko Ursulin; +Cc: intel-gfx

== Series Details ==

Series: drm/i915: Remove unused workaround bb code and unused struct members
URL   : https://patchwork.freedesktop.org/series/36271/
State : success

== Summary ==

Series 36271v1 drm/i915: Remove unused workaround bb code and unused struct members
https://patchwork.freedesktop.org/api/1.0/series/36271/revisions/1/mbox/

Test kms_frontbuffer_tracking:
        Subgroup basic:
                incomplete -> PASS       (fi-bsw-n3050) fdo#104571
Test kms_pipe_crc_basic:
        Subgroup suspend-read-crc-pipe-a:
                dmesg-warn -> PASS       (fi-kbl-r) fdo#104172 +1

fdo#104571 https://bugs.freedesktop.org/show_bug.cgi?id=104571
fdo#104172 https://bugs.freedesktop.org/show_bug.cgi?id=104172

fi-bdw-5557u     total:288  pass:267  dwarn:0   dfail:0   fail:0   skip:21  time:422s
fi-bdw-gvtdvm    total:288  pass:264  dwarn:0   dfail:0   fail:0   skip:24  time:427s
fi-blb-e6850     total:288  pass:223  dwarn:1   dfail:0   fail:0   skip:64  time:372s
fi-bsw-n3050     total:288  pass:242  dwarn:0   dfail:0   fail:0   skip:46  time:485s
fi-bwr-2160      total:288  pass:183  dwarn:0   dfail:0   fail:0   skip:105 time:281s
fi-bxt-dsi       total:288  pass:258  dwarn:0   dfail:0   fail:0   skip:30  time:487s
fi-bxt-j4205     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:488s
fi-byt-j1900     total:288  pass:253  dwarn:0   dfail:0   fail:0   skip:35  time:470s
fi-byt-n2820     total:288  pass:249  dwarn:0   dfail:0   fail:0   skip:39  time:457s
fi-elk-e7500     total:224  pass:168  dwarn:10  dfail:0   fail:0   skip:45 
fi-gdg-551       total:288  pass:179  dwarn:0   dfail:0   fail:1   skip:108 time:273s
fi-glk-1         total:288  pass:260  dwarn:0   dfail:0   fail:0   skip:28  time:514s
fi-hsw-4770      total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:393s
fi-hsw-4770r     total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:404s
fi-ilk-650       total:288  pass:228  dwarn:0   dfail:0   fail:0   skip:60  time:409s
fi-ivb-3520m     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:460s
fi-ivb-3770      total:288  pass:255  dwarn:0   dfail:0   fail:0   skip:33  time:415s
fi-kbl-7500u     total:288  pass:263  dwarn:1   dfail:0   fail:0   skip:24  time:468s
fi-kbl-7560u     total:288  pass:269  dwarn:0   dfail:0   fail:0   skip:19  time:497s
fi-kbl-7567u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:452s
fi-kbl-r         total:288  pass:260  dwarn:1   dfail:0   fail:0   skip:27  time:503s
fi-pnv-d510      total:288  pass:222  dwarn:1   dfail:0   fail:0   skip:65  time:575s
fi-skl-6260u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:435s
fi-skl-6600u     total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:508s
fi-skl-6700hq    total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:531s
fi-skl-6700k2    total:288  pass:264  dwarn:0   dfail:0   fail:0   skip:24  time:494s
fi-skl-6770hq    total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:496s
fi-skl-gvtdvm    total:288  pass:265  dwarn:0   dfail:0   fail:0   skip:23  time:430s
fi-snb-2520m     total:288  pass:248  dwarn:0   dfail:0   fail:0   skip:40  time:532s
fi-snb-2600      total:288  pass:248  dwarn:0   dfail:0   fail:0   skip:40  time:398s
Blacklisted hosts:
fi-cfl-s2        total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:566s
fi-cnl-y2        total:288  pass:258  dwarn:3   dfail:0   fail:0   skip:27  time:544s
fi-glk-dsi       total:288  pass:186  dwarn:1   dfail:4   fail:0   skip:97  time:377s

17fd16225c4df784ff06467c8bc528bee156a274 drm-tip: 2018y-01m-10d-09h-37m-51s UTC integration manifest
7d4cd8768e9b drm/i915: Remove unused workaround bb code and unused struct members

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_7641/issues.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/i915: Remove unused workaround bb code and unused struct members
  2018-01-10 12:24 [PATCH] drm/i915: Remove unused workaround bb code and unused struct members Tvrtko Ursulin
  2018-01-10 12:43 ` ✓ Fi.CI.BAT: success for " Patchwork
@ 2018-01-10 12:50 ` Chris Wilson
  2018-01-10 14:54   ` Tvrtko Ursulin
  2018-01-10 14:08 ` ✓ Fi.CI.IGT: success for " Patchwork
  2 siblings, 1 reply; 5+ messages in thread
From: Chris Wilson @ 2018-01-10 12:50 UTC (permalink / raw)
  To: Tvrtko Ursulin, Intel-gfx

Quoting Tvrtko Ursulin (2018-01-10 12:24:49)
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> 
> After recent code changes this part of the code now looks over-engineered
> and can be simplified, together with the corresponding struct members.

I don't mind, but I was keeping it around just in case we ever need to
re-instantiate a per-bb wa batch.

If the consensus is we won't need one for the foreseeable future,
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 5+ messages in thread

* ✓ Fi.CI.IGT: success for drm/i915: Remove unused workaround bb code and unused struct members
  2018-01-10 12:24 [PATCH] drm/i915: Remove unused workaround bb code and unused struct members Tvrtko Ursulin
  2018-01-10 12:43 ` ✓ Fi.CI.BAT: success for " Patchwork
  2018-01-10 12:50 ` [PATCH] " Chris Wilson
@ 2018-01-10 14:08 ` Patchwork
  2 siblings, 0 replies; 5+ messages in thread
From: Patchwork @ 2018-01-10 14:08 UTC (permalink / raw)
  To: Tvrtko Ursulin; +Cc: intel-gfx

== Series Details ==

Series: drm/i915: Remove unused workaround bb code and unused struct members
URL   : https://patchwork.freedesktop.org/series/36271/
State : success

== Summary ==

Warning: bzip CI_DRM_3618/shard-glkb6/results30.json.bz2 wasn't in correct JSON format
Test gem_softpin:
        Subgroup noreloc-s4:
                skip       -> FAIL       (shard-hsw) fdo#103375 +1
Test kms_flip:
        Subgroup flip-vs-modeset-vs-hang:
                pass       -> DMESG-WARN (shard-snb) fdo#103821
Test kms_frontbuffer_tracking:
        Subgroup fbc-1p-offscren-pri-shrfb-draw-render:
                pass       -> FAIL       (shard-snb) fdo#101623

fdo#103375 https://bugs.freedesktop.org/show_bug.cgi?id=103375
fdo#103821 https://bugs.freedesktop.org/show_bug.cgi?id=103821
fdo#101623 https://bugs.freedesktop.org/show_bug.cgi?id=101623

shard-hsw        total:2641 pass:1500 dwarn:2   dfail:0   fail:10  skip:1128 time:8851s
shard-snb        total:2713 pass:1309 dwarn:2   dfail:0   fail:11  skip:1391 time:7901s
Blacklisted hosts:
shard-apl        total:2713 pass:1685 dwarn:1   dfail:0   fail:26  skip:1001 time:13574s
shard-kbl        total:2637 pass:1624 dwarn:129 dfail:4   fail:24  skip:856 time:10351s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_7641/shards.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/i915: Remove unused workaround bb code and unused struct members
  2018-01-10 12:50 ` [PATCH] " Chris Wilson
@ 2018-01-10 14:54   ` Tvrtko Ursulin
  0 siblings, 0 replies; 5+ messages in thread
From: Tvrtko Ursulin @ 2018-01-10 14:54 UTC (permalink / raw)
  To: Chris Wilson, Tvrtko Ursulin, Intel-gfx


On 10/01/2018 12:50, Chris Wilson wrote:
> Quoting Tvrtko Ursulin (2018-01-10 12:24:49)
>> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>>
>> After recent code changes this part of the code now looks over-engineered
>> and can be simplified, together with the corresponding struct members.
> 
> I don't mind, but I was keeping it around just in case we ever need to
> re-instantiate a per-bb wa batch.
> 
> If the consensus is we won't need one for the foreseeable future,
> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>

I expected something like that. I don't see anybody using it, but I also 
don't mind if the scaffolding stays in. I'll let it hang out there, and 
in case someone needs it it's there.

Regards,

Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-01-10 14:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-10 12:24 [PATCH] drm/i915: Remove unused workaround bb code and unused struct members Tvrtko Ursulin
2018-01-10 12:43 ` ✓ Fi.CI.BAT: success for " Patchwork
2018-01-10 12:50 ` [PATCH] " Chris Wilson
2018-01-10 14:54   ` Tvrtko Ursulin
2018-01-10 14:08 ` ✓ Fi.CI.IGT: success for " Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox