drm/i915: extract common ce->pin_count check
Subsystems (2)
PATCH 1/1 drm/i915: extract common ce->pin_count check
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.
--- 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(-)
drivers/gpu/drm/i915/i915_gem_context.h +7 -1
@@ -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)
drivers/gpu/drm/i915/intel_lrc.c +2 -8
@@ -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); }
drivers/gpu/drm/i915/intel_ringbuffer.c +2 -8
@@ -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); }
drivers/gpu/drm/i915/intel_ringbuffer.h +2 -1
@@ -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);
drivers/gpu/drm/i915/selftests/mock_engine.c +5 -8
@@ -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; }
Signature · 6 lines
2.19.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoting Daniele Ceraolo Spurio (2018-10-01 21:46:56)
Quoted 2 lines
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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 7 lines · Chris Wilson
Quoting Daniele Ceraolo Spurio (2018-10-01 21:46:56)
Quoted 2 lines
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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.BAT: success for drm/i915: extract common ce->pin_count check
In reply to Daniele Ceraolo Spurio== Series Details ==
== 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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.IGT: success for drm/i915: extract common ce->pin_count check
In reply to Daniele Ceraolo Spurio== Series Details ==
== 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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx