lib/intel_bb: Enable custom engine support for xe
PATCH 1/1 lib/intel_bb: Enable custom engine support for xe
Currently the 'ctx' field in batch buffer creation is interpreted as a vm id for xe. In i915 it is interpreted as a context id. Since a xe engine more closely resembles an i915 context, change the current behaviour and interpret the 'ctx' fied as an xe engine id. This also allows us to use the compute engine on xe, which currently is not possible, due to reliance on legacy i915 flags.
--- lib/intel_batchbuffer.c | 26 ++++++++++++++++++-------- tests/xe/xe_intel_bb.c | 6 ++++-- 2 files changed, 22 insertions(+), 10 deletions(-)
lib/intel_batchbuffer.c +18 -8
@@ -946,15 +946,13 @@ __intel_bb_create(int fd, uint32_t ctx, const intel_ctx_cfg_t *cfg, ibb->gtt_size =1ull <<min_t (uint32_t,xe_va_bits (fd),48 ); end = ibb->gtt_size; -if (!ctx) - ctx =xe_vm_create (fd,DRM_XE_VM_CREATE_ASYNC_BIND_OPS ,0 ); + ibb->vm_id =xe_vm_create (fd,DRM_XE_VM_CREATE_ASYNC_BIND_OPS ,0 ); ibb->uses_full_ppgtt = true; ibb->allocator_handle = -intel_allocator_open_full (fd, ctx, start, end, +intel_allocator_open_full (fd, ibb->vm_id, start, end, allocator_type, strategy, ibb->alignment); - ibb->vm_id = ctx; ibb->last_engine = ~0U ; }
@@ -1228,6 +1226,16 @@ static void __intel_bb_remove_intel_bufs(struct intel_bb *ibb)intel_bb_remove_intel_buf (ibb, entry); } +static void __xe_bb_destroy (struct intel_bb *ibb) +{ +if (ibb->engine_id) +xe_engine_destroy (ibb->fd, ibb->engine_id); +if (ibb->ctx) +xe_engine_destroy (ibb->fd, ibb->ctx); +if (ibb->vm_id) +xe_vm_destroy (ibb->fd, ibb->vm_id); +} +/** * intel_bb_destroy: * @ibb: pointer to intel_bb
@@ -1262,8 +1270,8 @@ void intel_bb_destroy(struct intel_bb *ibb)close (ibb->fence);if (ibb->engine_syncobj)syncobj_destroy (ibb->fd, ibb->engine_syncobj); -if (ibb->vm_id && !ibb->ctx) -xe_vm_destroy (ibb->fd, ibb->vm_id); +if (ibb->driver ==INTEL_DRIVER_XE ) +__xe_bb_destroy (ibb);free (ibb->batch);free (ibb->cfg);
@@ -2298,7 +2306,9 @@ __xe_bb_exec(struct intel_bb *ibb, uint64_t flags, bool sync)igt_assert_eq (ibb->num_relocs,0 );igt_assert_eq (ibb->xe_bound, false); -if (ibb->last_engine != engine) { +if (ibb->ctx) { + engine_id = ibb->ctx; + }else if (ibb->last_engine != engine) {struct drm_xe_engine_class_instance inst = { }; inst.engine_instance =
@@ -2325,10 +2335,10 @@ __xe_bb_exec(struct intel_bb *ibb, uint64_t flags, bool sync) ibb->engine_id = engine_id =xe_engine_create (ibb->fd, ibb->vm_id, &inst,0 ); + ibb->last_engine = engine; }else { engine_id = ibb->engine_id; } - ibb->last_engine = engine; map =xe_bo_map (ibb->fd, ibb->handle, ibb->size);memcpy (map, ibb->batch, ibb->size);
tests/xe/xe_intel_bb.c +4 -2
@@ -177,6 +177,7 @@ static void simple_bb(struct buf_ops *bops, bool new_context)int xe =buf_ops_get_fd (bops);struct intel_bb *ibb;uint32_t ctx =0 ; +uint32_t vm =0 ; ibb =intel_bb_create_with_allocator (xe, ctx,NULL ,PAGE_SIZE ,INTEL_ALLOCATOR_SIMPLE );
@@ -195,7 +196,8 @@ static void simple_bb(struct buf_ops *bops, bool new_context)intel_bb_reset (ibb, true);if (new_context) { - ctx =xe_vm_create (xe,DRM_XE_VM_CREATE_ASYNC_BIND_OPS ,0 ); + vm =xe_vm_create (xe,DRM_XE_VM_CREATE_ASYNC_BIND_OPS ,0 ); + ctx =xe_engine_create (xe, vm,xe_hw_engine (xe,0 ),0 );intel_bb_destroy (ibb); ibb =intel_bb_create_with_context (xe, ctx,NULL ,PAGE_SIZE );intel_bb_out (ibb,MI_BATCH_BUFFER_END );
@@ -203,7 +205,7 @@ static void simple_bb(struct buf_ops *bops, bool new_context)intel_bb_exec (ibb,intel_bb_offset (ibb),I915_EXEC_DEFAULT |I915_EXEC_NO_RELOC , true); -xe_vm_destroy (xe, ctx); +xe_vm_destroy (xe, vm); }intel_bb_destroy (ibb);
Signature · 1 line
2.40.1
Quoted 37 lines · Christoph Manszewski
Currently the 'ctx' field in batch buffer creation is interpreted as a vm id for xe. In i915 it is interpreted as a context id. Since a xe engine more closely resembles an i915 context, change the current behaviour and interpret the 'ctx' fied as an xe engine id. This also allows us to use the compute engine on xe, which currently is not possible, due to reliance on legacy i915 flags.
Signed-off-by Christoph Manszewski <[email protected]>Cc Zbigniew Kempczyński <[email protected]>--- lib/intel_batchbuffer.c | 26 ++++++++++++++++++-------- tests/xe/xe_intel_bb.c | 6 ++++-- 2 files changed, 22 insertions(+), 10 deletions(-)lib/intel_batchbuffer.c +2
-4@@ -946,15 +946,13 @@ __intel_bb_create(int fd, uint32_t ctx, const intel_ctx_cfg_t *cfg, ibb->gtt_size =1ull <<min_t (uint32_t,xe_va_bits (fd),48 ); end = ibb->gtt_size; -if (!ctx) - ctx =xe_vm_create (fd,DRM_XE_VM_CREATE_ASYNC_BIND_OPS ,0 ); + ibb->vm_id =xe_vm_create (fd,DRM_XE_VM_CREATE_ASYNC_BIND_OPS ,0 ); ibb->uses_full_ppgtt = true; ibb->allocator_handle = -intel_allocator_open_full (fd, ctx, start, end, +intel_allocator_open_full (fd, ibb->vm_id, start, end, allocator_type, strategy, ibb->alignment); - ibb->vm_id = ctx; ibb->last_engine = ~0U ; }
lib/intel_batchbuffer.c static void __intel_bb_remove_intel_bufs(struct intel_bb *ibb) · line 1234
Quoted 9 lines
lib/intel_batchbuffer.c +6
-0@@ -1228,6 +1226,16 @@ static void __intel_bb_remove_intel_bufs(struct intel_bb *ibb)intel_bb_remove_intel_buf (ibb, entry); } +static void __xe_bb_destroy (struct intel_bb *ibb) +{ +if (ibb->engine_id) +xe_engine_destroy (ibb->fd, ibb->engine_id); +if (ibb->ctx) +xe_engine_destroy (ibb->fd, ibb->ctx);
Why do you want to destroy engine you don't have ownership to?
Quoted 54 lines
lib/intel_batchbuffer.c +10
-4+if (ibb->vm_id) +xe_vm_destroy (ibb->fd, ibb->vm_id); +} +/** * intel_bb_destroy: * @ibb: pointer to intel_bb @@ -1262,8 +1270,8 @@ void intel_bb_destroy(struct intel_bb *ibb)close (ibb->fence);if (ibb->engine_syncobj)syncobj_destroy (ibb->fd, ibb->engine_syncobj); -if (ibb->vm_id && !ibb->ctx) -xe_vm_destroy (ibb->fd, ibb->vm_id); +if (ibb->driver ==INTEL_DRIVER_XE ) +__xe_bb_destroy (ibb);free (ibb->batch);free (ibb->cfg);@@ -2298,7 +2306,9 @@ __xe_bb_exec(struct intel_bb *ibb, uint64_t flags, bool sync)igt_assert_eq (ibb->num_relocs,0 );igt_assert_eq (ibb->xe_bound, false); -if (ibb->last_engine != engine) { +if (ibb->ctx) { + engine_id = ibb->ctx; + }else if (ibb->last_engine != engine) {struct drm_xe_engine_class_instance inst = { }; inst.engine_instance =@@ -2325,10 +2335,10 @@ __xe_bb_exec(struct intel_bb *ibb, uint64_t flags, bool sync) ibb->engine_id = engine_id =xe_engine_create (ibb->fd, ibb->vm_id, &inst,0 ); + ibb->last_engine = engine; }else { engine_id = ibb->engine_id; } - ibb->last_engine = engine; map =xe_bo_map (ibb->fd, ibb->handle, ibb->size);memcpy (map, ibb->batch, ibb->size);tests/xe/xe_intel_bb.c +1
-0@@ -177,6 +177,7 @@ static void simple_bb(struct buf_ops *bops, bool new_context)int xe =buf_ops_get_fd (bops);struct intel_bb *ibb;uint32_t ctx =0 ; +uint32_t vm =0 ; ibb =intel_bb_create_with_allocator (xe, ctx,NULL ,PAGE_SIZE ,INTEL_ALLOCATOR_SIMPLE );
tests/xe/xe_intel_bb.c static void simple_bb(struct buf_ops *bops, bool new_context) · line 200
Quoted 6 lines
tests/xe/xe_intel_bb.c +2
-1@@ -195,7 +196,8 @@ static void simple_bb(struct buf_ops *bops, bool new_context)intel_bb_reset (ibb, true);if (new_context) { - ctx =xe_vm_create (xe,DRM_XE_VM_CREATE_ASYNC_BIND_OPS ,0 ); + vm =xe_vm_create (xe,DRM_XE_VM_CREATE_ASYNC_BIND_OPS ,0 ); + ctx =xe_engine_create (xe, vm,xe_hw_engine (xe,0 ),0 );
In this case test (caller) should destroy the engine, not bb.
--
Zbigniew
Quoted 15 lines
tests/xe/xe_intel_bb.c +1
-1intel_bb_destroy (ibb); ibb =intel_bb_create_with_context (xe, ctx,NULL ,PAGE_SIZE );intel_bb_out (ibb,MI_BATCH_BUFFER_END );@@ -203,7 +205,7 @@ static void simple_bb(struct buf_ops *bops, bool new_context)intel_bb_exec (ibb,intel_bb_offset (ibb),I915_EXEC_DEFAULT |I915_EXEC_NO_RELOC , true); -xe_vm_destroy (xe, ctx); +xe_vm_destroy (xe, vm); }intel_bb_destroy (ibb);Signature · 1 line
2.40.1
Patchwork
CI[igt-dev] ✗ Fi.CI.BAT: failure for lib/intel_bb: Enable custom engine support for xe
In reply to Christoph Manszewski== Series Details ==
== Series Details ==
Series: lib/intel_bb: Enable custom engine support for xe
URL : https://patchwork.freedesktop.org/series/118227/
State : failure
== Summary ==
CI Bug Log - changes from CI_DRM_13178 -> IGTPW_9023
====================================================
Summary
-------
**FAILURE**
Serious unknown changes coming with IGTPW_9023 absolutely need to be verified manually.
If you think the reported changes have nothing to do with the changes introduced in IGTPW_9023, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.
External URL: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9023/index.html
Participating hosts (38 -> 38)
------------------------------
Additional (1): bat-rpls-2
Missing (1): fi-snb-2520m
Possible new issues
-------------------
Here are the unknown changes that may have been introduced in IGTPW_9023:
### IGT changes ###
#### Possible regressions ####
* igt@i915_suspend@basic-s3-without-i915:
- fi-elk-e7500: [PASS][1] -> [ABORT][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13178/fi-elk-e7500/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9023/fi-elk-e7500/igt@[email protected]
* igt@kms_pipe_crc_basic@suspend-read-crc@pipe-c-dp-1:
- fi-cfl-8109u: [PASS][3] -> [ABORT][4]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13178/fi-cfl-8109u/igt@kms_pipe_crc_basic@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9023/fi-cfl-8109u/igt@kms_pipe_crc_basic@[email protected]
Known issues
------------
Here are the changes found in IGTPW_9023 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@debugfs_test@basic-hwmon:
- bat-rpls-2: NOTRUN -> [SKIP][5] ([i915#7456])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9023/bat-rpls-2/igt@[email protected]
* igt@fbdev@read:
- bat-rpls-2: NOTRUN -> [SKIP][6] ([i915#2582]) +4 similar issues
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9023/bat-rpls-2/igt@[email protected]
* igt@gem_lmem_swapping@verify-random:
- bat-rpls-2: NOTRUN -> [SKIP][7] ([i915#4613]) +3 similar issues
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9023/bat-rpls-2/igt@[email protected]
* igt@gem_tiled_pread_basic:
- bat-rpls-2: NOTRUN -> [SKIP][8] ([i915#3282])
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9023/bat-rpls-2/igt@gem_tiled_pread_basic.html
* igt@i915_pm_backlight@basic-brightness:
- bat-rpls-2: NOTRUN -> [SKIP][9] ([i915#7561])
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9023/bat-rpls-2/igt@[email protected]
* igt@i915_pm_rps@basic-api:
- bat-rpls-2: NOTRUN -> [SKIP][10] ([i915#6621])
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9023/bat-rpls-2/igt@[email protected]
* igt@i915_selftest@live@gt_pm:
- bat-rpls-2: NOTRUN -> [DMESG-FAIL][11] ([i915#4258] / [i915#7913])
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9023/bat-rpls-2/igt@i915_selftest@live@gt_pm.html
* igt@i915_selftest@live@migrate:
- bat-adlp-9: [PASS][12] -> [DMESG-FAIL][13] ([i915#7699] / [i915#7913])
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13178/bat-adlp-9/igt@i915_selftest@[email protected]
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9023/bat-adlp-9/igt@i915_selftest@[email protected]
* igt@i915_selftest@live@requests:
- bat-rpls-2: NOTRUN -> [ABORT][14] ([i915#7913] / [i915#7982])
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9023/bat-rpls-2/igt@i915_selftest@[email protected]
* igt@i915_selftest@live@slpc:
- bat-rpls-1: [PASS][15] -> [DMESG-WARN][16] ([i915#6367])
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13178/bat-rpls-1/igt@i915_selftest@[email protected]
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9023/bat-rpls-1/igt@i915_selftest@[email protected]
* igt@kms_busy@basic:
- bat-rpls-2: NOTRUN -> [SKIP][17] ([i915#1845]) +14 similar issues
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9023/bat-rpls-2/igt@[email protected]
* igt@kms_chamelium_edid@hdmi-edid-read:
- bat-rpls-2: NOTRUN -> [SKIP][18] ([i915#7828]) +7 similar issues
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9023/bat-rpls-2/igt@[email protected]
* igt@kms_chamelium_hpd@common-hpd-after-suspend:
- bat-dg2-11: NOTRUN -> [SKIP][19] ([i915#7828])
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9023/bat-dg2-11/igt@[email protected]
* igt@kms_flip@basic-flip-vs-dpms:
- bat-rpls-2: NOTRUN -> [SKIP][20] ([i915#3637]) +3 similar issues
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9023/bat-rpls-2/igt@[email protected]
* igt@kms_force_connector_basic@force-load-detect:
- bat-rpls-2: NOTRUN -> [SKIP][21] ([fdo#109285])
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9023/bat-rpls-2/igt@[email protected]
* igt@kms_frontbuffer_tracking@basic:
- bat-rpls-2: NOTRUN -> [SKIP][22] ([i915#1849])
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9023/bat-rpls-2/igt@[email protected]
* igt@kms_pipe_crc_basic@nonblocking-crc-frame-sequence:
- bat-dg2-11: NOTRUN -> [SKIP][23] ([i915#1845] / [i915#5354]) +2 similar issues
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9023/bat-dg2-11/igt@[email protected]
* igt@kms_pipe_crc_basic@read-crc:
- bat-adlp-9: NOTRUN -> [SKIP][24] ([i915#3546]) +1 similar issue
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9023/bat-adlp-9/igt@[email protected]
* igt@kms_psr@sprite_plane_onoff:
- bat-rpls-2: NOTRUN -> [SKIP][25] ([i915#1072]) +3 similar issues
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9023/bat-rpls-2/igt@kms_psr@sprite_plane_onoff.html
* igt@kms_setmode@basic-clone-single-crtc:
- bat-rpls-2: NOTRUN -> [SKIP][26] ([i915#3555] / [i915#4579])
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9023/bat-rpls-2/igt@[email protected]
* igt@prime_vgem@basic-fence-flip:
- bat-rpls-2: NOTRUN -> [SKIP][27] ([fdo#109295] / [i915#1845] / [i915#3708])
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9023/bat-rpls-2/igt@[email protected]
* igt@prime_vgem@basic-fence-read:
- bat-rpls-2: NOTRUN -> [SKIP][28] ([fdo#109295] / [i915#3708]) +2 similar issues
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9023/bat-rpls-2/igt@[email protected]
#### Possible fixes ####
* igt@i915_selftest@live@requests:
- {bat-mtlp-8}: [DMESG-FAIL][29] ([i915#8497]) -> [PASS][30]
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13178/bat-mtlp-8/igt@i915_selftest@[email protected]
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9023/bat-mtlp-8/igt@i915_selftest@[email protected]
* igt@i915_selftest@live@reset:
- bat-dg2-11: [ABORT][31] ([i915#7461] / [i915#7913]) -> [PASS][32]
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13178/bat-dg2-11/igt@i915_selftest@[email protected]
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9023/bat-dg2-11/igt@i915_selftest@[email protected]
* igt@i915_selftest@live@slpc:
- {bat-mtlp-6}: [DMESG-WARN][33] ([i915#6367]) -> [PASS][34]
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13178/bat-mtlp-6/igt@i915_selftest@[email protected]
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9023/bat-mtlp-6/igt@i915_selftest@[email protected]
* igt@kms_pipe_crc_basic@nonblocking-crc-frame-sequence@pipe-c-dp-1:
- bat-dg2-8: [FAIL][35] ([i915#7932]) -> [PASS][36] +1 similar issue
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13178/bat-dg2-8/igt@kms_pipe_crc_basic@[email protected]
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9023/bat-dg2-8/igt@kms_pipe_crc_basic@[email protected]
{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).
[fdo#109285]: https://bugs.freedesktop.org/show_bug.cgi?id=109285
[fdo#109295]: https://bugs.freedesktop.org/show_bug.cgi?id=109295
[i915#1072]: https://gitlab.freedesktop.org/drm/intel/issues/1072
[i915#1845]: https://gitlab.freedesktop.org/drm/intel/issues/1845
[i915#1849]: https://gitlab.freedesktop.org/drm/intel/issues/1849
[i915#2582]: https://gitlab.freedesktop.org/drm/intel/issues/2582
[i915#3282]: https://gitlab.freedesktop.org/drm/intel/issues/3282
[i915#3546]: https://gitlab.freedesktop.org/drm/intel/issues/3546
[i915#3555]: https://gitlab.freedesktop.org/drm/intel/issues/3555
[i915#3637]: https://gitlab.freedesktop.org/drm/intel/issues/3637
[i915#3708]: https://gitlab.freedesktop.org/drm/intel/issues/3708
[i915#4258]: https://gitlab.freedesktop.org/drm/intel/issues/4258
[i915#4579]: https://gitlab.freedesktop.org/drm/intel/issues/4579
[i915#4613]: https://gitlab.freedesktop.org/drm/intel/issues/4613
[i915#5354]: https://gitlab.freedesktop.org/drm/intel/issues/5354
[i915#6367]: https://gitlab.freedesktop.org/drm/intel/issues/6367
[i915#6621]: https://gitlab.freedesktop.org/drm/intel/issues/6621
[i915#7456]: https://gitlab.freedesktop.org/drm/intel/issues/7456
[i915#7461]: https://gitlab.freedesktop.org/drm/intel/issues/7461
[i915#7561]: https://gitlab.freedesktop.org/drm/intel/issues/7561
[i915#7699]: https://gitlab.freedesktop.org/drm/intel/issues/7699
[i915#7828]: https://gitlab.freedesktop.org/drm/intel/issues/7828
[i915#7913]: https://gitlab.freedesktop.org/drm/intel/issues/7913
[i915#7932]: https://gitlab.freedesktop.org/drm/intel/issues/7932
[i915#7982]: https://gitlab.freedesktop.org/drm/intel/issues/7982
[i915#8497]: https://gitlab.freedesktop.org/drm/intel/issues/8497
Build changes
-------------
* CI: CI-20190529 -> None
* IGT: IGT_7301 -> IGTPW_9023
CI-20190529: 20190529
CI_DRM_13178: 33314ba176a844492c624b29876647cfcd627282 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_9023: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9023/index.html
IGT_7301: 4b388fa87e1281587e723ef864e466fe396c3381 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9023/index.html