* [PATCH] drm/i915: extract common ce->pin_count check
@ 2018-10-01 20:46 Daniele Ceraolo Spurio
2018-10-01 21:09 ` Chris Wilson
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Daniele Ceraolo Spurio @ 2018-10-01 20:46 UTC (permalink / raw)
To: intel-gfx
We already have it coded 3 times and a 4th one is coming for the GuC
path in an upcoming patch, so let's move it to a common place.
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
---
drivers/gpu/drm/i915/i915_gem_context.h | 8 +++++++-
drivers/gpu/drm/i915/intel_lrc.c | 10 ++--------
drivers/gpu/drm/i915/intel_ringbuffer.c | 10 ++--------
drivers/gpu/drm/i915/intel_ringbuffer.h | 3 ++-
drivers/gpu/drm/i915/selftests/mock_engine.c | 13 +++++--------
5 files changed, 18 insertions(+), 26 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_gem_context.h b/drivers/gpu/drm/i915/i915_gem_context.h
index 08165f6a0a84..5309004f8f8a 100644
--- a/drivers/gpu/drm/i915/i915_gem_context.h
+++ b/drivers/gpu/drm/i915/i915_gem_context.h
@@ -302,7 +302,13 @@ to_intel_context(struct i915_gem_context *ctx,
static inline struct intel_context *
intel_context_pin(struct i915_gem_context *ctx, struct intel_engine_cs *engine)
{
- return engine->context_pin(engine, ctx);
+ struct intel_context *ce = to_intel_context(ctx, engine);
+
+ if (likely(ce->pin_count++))
+ return ce;
+ GEM_BUG_ON(!ce->pin_count); /* no overflow please! */
+
+ return engine->context_pin(engine, ctx, ce);
}
static inline void __intel_context_pin(struct intel_context *ce)
diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
index 4ee00f531153..a97f455361f6 100644
--- a/drivers/gpu/drm/i915/intel_lrc.c
+++ b/drivers/gpu/drm/i915/intel_lrc.c
@@ -1422,19 +1422,13 @@ static const struct intel_context_ops execlists_context_ops = {
static struct intel_context *
execlists_context_pin(struct intel_engine_cs *engine,
- struct i915_gem_context *ctx)
+ struct i915_gem_context *ctx,
+ struct intel_context *ce)
{
- struct intel_context *ce = to_intel_context(ctx, engine);
-
lockdep_assert_held(&ctx->i915->drm.struct_mutex);
GEM_BUG_ON(!ctx->ppgtt);
- if (likely(ce->pin_count++))
- return ce;
- GEM_BUG_ON(!ce->pin_count); /* no overflow please! */
-
ce->ops = &execlists_context_ops;
-
return __execlists_context_pin(engine, ctx, ce);
}
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
index c092d5099ebf..a82564c50496 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
@@ -1386,18 +1386,12 @@ static const struct intel_context_ops ring_context_ops = {
static struct intel_context *
intel_ring_context_pin(struct intel_engine_cs *engine,
- struct i915_gem_context *ctx)
+ struct i915_gem_context *ctx,
+ struct intel_context *ce)
{
- struct intel_context *ce = to_intel_context(ctx, engine);
-
lockdep_assert_held(&ctx->i915->drm.struct_mutex);
- if (likely(ce->pin_count++))
- return ce;
- GEM_BUG_ON(!ce->pin_count); /* no overflow please! */
-
ce->ops = &ring_context_ops;
-
return __ring_context_pin(engine, ctx, ce);
}
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h b/drivers/gpu/drm/i915/intel_ringbuffer.h
index 1534de5bb852..91973bd9003c 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.h
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.h
@@ -473,7 +473,8 @@ struct intel_engine_cs {
void (*set_default_submission)(struct intel_engine_cs *engine);
struct intel_context *(*context_pin)(struct intel_engine_cs *engine,
- struct i915_gem_context *ctx);
+ struct i915_gem_context *ctx,
+ struct intel_context *ce);
int (*request_alloc)(struct i915_request *rq);
int (*init_context)(struct i915_request *rq);
diff --git a/drivers/gpu/drm/i915/selftests/mock_engine.c b/drivers/gpu/drm/i915/selftests/mock_engine.c
index 22a73da45ad5..4d5103634a2b 100644
--- a/drivers/gpu/drm/i915/selftests/mock_engine.c
+++ b/drivers/gpu/drm/i915/selftests/mock_engine.c
@@ -89,15 +89,12 @@ static const struct intel_context_ops mock_context_ops = {
static struct intel_context *
mock_context_pin(struct intel_engine_cs *engine,
- struct i915_gem_context *ctx)
+ struct i915_gem_context *ctx,
+ struct intel_context *ce)
{
- struct intel_context *ce = to_intel_context(ctx, engine);
-
- if (!ce->pin_count++) {
- i915_gem_context_get(ctx);
- ce->ring = engine->buffer;
- ce->ops = &mock_context_ops;
- }
+ i915_gem_context_get(ctx);
+ ce->ring = engine->buffer;
+ ce->ops = &mock_context_ops;
return ce;
}
--
2.19.0
_______________________________________________
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
* Re: [PATCH] drm/i915: extract common ce->pin_count check
2018-10-01 20:46 [PATCH] drm/i915: extract common ce->pin_count check Daniele Ceraolo Spurio
@ 2018-10-01 21:09 ` Chris Wilson
2018-10-01 21:34 ` Daniele Ceraolo Spurio
2018-10-01 22:51 ` ✓ Fi.CI.BAT: success for " Patchwork
2018-10-02 3:03 ` ✓ Fi.CI.IGT: " Patchwork
2 siblings, 1 reply; 5+ messages in thread
From: Chris Wilson @ 2018-10-01 21:09 UTC (permalink / raw)
To: Daniele Ceraolo Spurio, intel-gfx
Quoting Daniele Ceraolo Spurio (2018-10-01 21:46:56)
> We already have it coded 3 times and a 4th one is coming for the GuC
> path in an upcoming patch, so let's move it to a common place.
Nope. It is separate as virtual engine does not follow the same pattern.
-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
* Re: [PATCH] drm/i915: extract common ce->pin_count check
2018-10-01 21:09 ` Chris Wilson
@ 2018-10-01 21:34 ` Daniele Ceraolo Spurio
0 siblings, 0 replies; 5+ messages in thread
From: Daniele Ceraolo Spurio @ 2018-10-01 21:34 UTC (permalink / raw)
To: Chris Wilson, intel-gfx
On 01/10/18 14:09, Chris Wilson wrote:
> Quoting Daniele Ceraolo Spurio (2018-10-01 21:46:56)
>> We already have it coded 3 times and a 4th one is coming for the GuC
>> path in an upcoming patch, so let's move it to a common place.
>
> Nope. It is separate as virtual engine does not follow the same pattern.
> -Chris
>
Would it be worth adding virtual engine knowledge to to_intel_context()?
e.g.:
static inline struct intel_context *
to_intel_context(struct i915_gem_context *ctx,
const struct intel_engine_cs *engine)
{
if (intel_engine_is_virtual(engine)) {
struct virtual_engine *ve = to_virtual_engine(engine);
return &ve->context;
} else {
return &ctx->__engine[engine->id];
}
}
Maybe a bit overkill, but having the same check repeated in 5 versions
of *_context_pin() really bugs me :P
Daniele
_______________________________________________
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.BAT: success for drm/i915: extract common ce->pin_count check
2018-10-01 20:46 [PATCH] drm/i915: extract common ce->pin_count check Daniele Ceraolo Spurio
2018-10-01 21:09 ` Chris Wilson
@ 2018-10-01 22:51 ` Patchwork
2018-10-02 3:03 ` ✓ Fi.CI.IGT: " Patchwork
2 siblings, 0 replies; 5+ messages in thread
From: Patchwork @ 2018-10-01 22:51 UTC (permalink / raw)
To: Daniele Ceraolo Spurio; +Cc: intel-gfx
== Series Details ==
Series: drm/i915: extract common ce->pin_count check
URL : https://patchwork.freedesktop.org/series/50414/
State : success
== Summary ==
= CI Bug Log - changes from CI_DRM_4911 -> Patchwork_10315 =
== Summary - SUCCESS ==
No regressions found.
External URL: https://patchwork.freedesktop.org/api/1.0/series/50414/revisions/1/mbox/
== Known issues ==
Here are the changes found in Patchwork_10315 that come from known issues:
=== IGT changes ===
==== Issues hit ====
igt@gem_exec_suspend@basic-s4-devices:
fi-blb-e6850: PASS -> INCOMPLETE (fdo#107718)
igt@kms_frontbuffer_tracking@basic:
fi-byt-clapper: PASS -> FAIL (fdo#103167)
igt@kms_pipe_crc_basic@suspend-read-crc-pipe-b:
fi-byt-clapper: PASS -> FAIL (fdo#107362, fdo#103191)
==== Possible fixes ====
igt@kms_pipe_crc_basic@hang-read-crc-pipe-b:
fi-byt-clapper: FAIL (fdo#107362, fdo#103191) -> PASS
fdo#103167 https://bugs.freedesktop.org/show_bug.cgi?id=103167
fdo#103191 https://bugs.freedesktop.org/show_bug.cgi?id=103191
fdo#107362 https://bugs.freedesktop.org/show_bug.cgi?id=107362
fdo#107718 https://bugs.freedesktop.org/show_bug.cgi?id=107718
== Participating hosts (49 -> 46) ==
Additional (3): fi-gdg-551 fi-snb-2520m fi-pnv-d510
Missing (6): fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-icl-u2 fi-ctg-p8600
== Build changes ==
* Linux: CI_DRM_4911 -> Patchwork_10315
CI_DRM_4911: e46b4809753a2e3d3d73c5a9e028cd030bea60e5 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4659: 7f41adfbfd17027b71c332d6ae997f1364f73731 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_10315: 1eeadaad02c581c752a3247f773897552f77f34c @ git://anongit.freedesktop.org/gfx-ci/linux
== Linux commits ==
1eeadaad02c5 drm/i915: extract common ce->pin_count check
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_10315/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
* ✓ Fi.CI.IGT: success for drm/i915: extract common ce->pin_count check
2018-10-01 20:46 [PATCH] drm/i915: extract common ce->pin_count check Daniele Ceraolo Spurio
2018-10-01 21:09 ` Chris Wilson
2018-10-01 22:51 ` ✓ Fi.CI.BAT: success for " Patchwork
@ 2018-10-02 3:03 ` Patchwork
2 siblings, 0 replies; 5+ messages in thread
From: Patchwork @ 2018-10-02 3:03 UTC (permalink / raw)
To: Daniele Ceraolo Spurio; +Cc: intel-gfx
== Series Details ==
Series: drm/i915: extract common ce->pin_count check
URL : https://patchwork.freedesktop.org/series/50414/
State : success
== Summary ==
= CI Bug Log - changes from CI_DRM_4911_full -> Patchwork_10315_full =
== Summary - WARNING ==
Minor unknown changes coming with Patchwork_10315_full need to be verified
manually.
If you think the reported changes have nothing to do with the changes
introduced in Patchwork_10315_full, please notify your bug team to allow them
to document this new failure mode, which will reduce false positives in CI.
== Possible new issues ==
Here are the unknown changes that may have been introduced in Patchwork_10315_full:
=== IGT changes ===
==== Warnings ====
igt@kms_frontbuffer_tracking@fbc-1p-offscren-pri-shrfb-draw-render:
shard-snb: PASS -> SKIP +6
igt@perf_pmu@rc6:
shard-kbl: PASS -> SKIP
== Known issues ==
Here are the changes found in Patchwork_10315_full that come from known issues:
=== IGT changes ===
==== Issues hit ====
igt@kms_busy@extended-modeset-hang-newfb-with-reset-render-a:
shard-hsw: PASS -> DMESG-WARN (fdo#107956)
igt@kms_busy@extended-modeset-hang-newfb-with-reset-render-b:
shard-kbl: PASS -> DMESG-WARN (fdo#107956) +1
igt@kms_flip@flip-vs-expired-vblank:
shard-glk: PASS -> FAIL (fdo#105363)
igt@kms_setmode@basic:
shard-apl: PASS -> FAIL (fdo#99912)
shard-kbl: PASS -> FAIL (fdo#99912)
==== Possible fixes ====
igt@kms_flip@2x-flip-vs-expired-vblank-interruptible:
shard-glk: FAIL (fdo#105363) -> PASS
igt@kms_vblank@pipe-c-ts-continuation-dpms-suspend:
shard-apl: DMESG-WARN (fdo#103558, fdo#105602) -> PASS +4
fdo#103558 https://bugs.freedesktop.org/show_bug.cgi?id=103558
fdo#105363 https://bugs.freedesktop.org/show_bug.cgi?id=105363
fdo#105602 https://bugs.freedesktop.org/show_bug.cgi?id=105602
fdo#107956 https://bugs.freedesktop.org/show_bug.cgi?id=107956
fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912
== Participating hosts (6 -> 5) ==
Missing (1): shard-skl
== Build changes ==
* Linux: CI_DRM_4911 -> Patchwork_10315
CI_DRM_4911: e46b4809753a2e3d3d73c5a9e028cd030bea60e5 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4659: 7f41adfbfd17027b71c332d6ae997f1364f73731 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_10315: 1eeadaad02c581c752a3247f773897552f77f34c @ git://anongit.freedesktop.org/gfx-ci/linux
piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_10315/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
end of thread, other threads:[~2018-10-02 3:03 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-01 20:46 [PATCH] drm/i915: extract common ce->pin_count check Daniele Ceraolo Spurio
2018-10-01 21:09 ` Chris Wilson
2018-10-01 21:34 ` Daniele Ceraolo Spurio
2018-10-01 22:51 ` ✓ Fi.CI.BAT: success for " Patchwork
2018-10-02 3:03 ` ✓ Fi.CI.IGT: " Patchwork
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.