drm/i915: Engine discovery query
Subsystems (3)
PATCH v11 1/1 drm/i915: Engine discovery query
From: Tvrtko Ursulin <[email protected]>
Engine discovery query allows userspace to enumerate engines, probe their configuration features, all without needing to maintain the internal PCI ID based database.
A new query for the generic i915 query ioctl is added named DRM_I915_QUERY_ENGINE_INFO, together with accompanying structure drm_i915_query_engine_info. The address of latter should be passed to the kernel in the query.data_ptr field, and should be large enough for the kernel to fill out all known engines as struct drm_i915_engine_info elements trailing the query.
As with other queries, setting the item query length to zero allows userspace to query minimum required buffer size.
Enumerated engines have common type mask which can be used to query all hardware engines, versus engines userspace can submit to using the execbuf uAPI.
Engines also have capabilities which are per engine class namespace of bits describing features not present on all engine instances.
v2:
* Fixed HEVC assignment.
* Reorder some fields, rename type to flags, increase width. (Lionel)
* No need to allocate temporary storage if we do it engine by engine. (Lionel)
v3:
* Describe engine flags and mark mbz fields. (Lionel)
* HEVC only applies to VCS.
v4:
* Squash SFC flag into main patch.
* Tidy some comments.
v5:
* Add uabi_ prefix to engine capabilities. (Chris Wilson)
* Report exact size of engine info array. (Chris Wilson)
* Drop the engine flags. (Joonas Lahtinen)
* Added some more reserved fields.
* Move flags after class/instance.
v6:
* Do not check engine info array was zeroed by userspace but zero the unused fields for them instead.
v7:
* Simplify length calculation loop. (Lionel Landwerlin)
v8:
* Remove MBZ comments where not applicable.
* Rename ABI flags to match engine class define naming.
* Rename SFC ABI flag to reflect it applies to VCS and VECS.
* SFC is wired to even _logical_ engine instances.
* SFC applies to VCS and VECS.
* HEVC is present on all instances on Gen11. (Tony)
* Simplify length calculation even more. (Chris Wilson)
* Move info_ptr assigment closer to loop for clarity. (Chris Wilson)
* Use vdbox_sfc_access from runtime info.
* Rebase for RUNTIME_INFO.
* Refactor for lower indentation.
* Rename uAPI class/instance to engine_class/instance to avoid C++ keyword.
v9:
* Rebase for s/num_rings/num_engines/ in RUNTIME_INFO.
v10:
* Use new copy_query_item.
v11:
* Consolidate with struct i915_engine_class_instnace.
--- drivers/gpu/drm/i915/gt/intel_engine_cs.c | 41 ++++++++++++++++ drivers/gpu/drm/i915/gt/intel_engine_types.h | 2 + drivers/gpu/drm/i915/i915_query.c | 49 ++++++++++++++++++++ include/uapi/drm/i915_drm.h | 42 +++++++++++++++++ 4 files changed, 134 insertions(+)
drivers/gpu/drm/i915/gt/intel_engine_cs.c +41 -0
@@ -343,6 +343,45 @@ intel_engine_setup(struct drm_i915_private *dev_priv,return 0 ; } +static void __setup_engine_capabilities (struct intel_engine_cs *engine) +{ +struct drm_i915_private *i915 = engine->i915; + +if (engine->class ==VIDEO_DECODE_CLASS ) { +/* +* HEVC support is present on first engine instance +* before Gen11 and on all instances afterwards. +*/ +if (INTEL_GEN (i915) >=11 || + (INTEL_GEN (i915) >=9 && engine->instance ==0 )) + engine->uabi_capabilities |= +I915_VIDEO_CLASS_CAPABILITY_HEVC ; + +/* +* SFC block is present only on even logical engine +* instances. +*/ +if ((INTEL_GEN (i915) >=11 && +RUNTIME_INFO (i915)->vdbox_sfc_access & engine->mask) || + (INTEL_GEN (i915) >=9 && engine->instance ==0 )) + engine->uabi_capabilities |= +I915_VIDEO_AND_ENHANCE_CLASS_CAPABILITY_SFC ; + }else if (engine->class ==VIDEO_ENHANCEMENT_CLASS ) { +if (INTEL_GEN (i915) >=9 ) + engine->uabi_capabilities |= +I915_VIDEO_AND_ENHANCE_CLASS_CAPABILITY_SFC ; + } +} + +static void intel_setup_engine_capabilities (struct drm_i915_private *i915) +{ +struct intel_engine_cs *engine; +enum intel_engine_id id; + +for_each_engine (engine, i915, id) +__setup_engine_capabilities (engine); +} +/** * intel_engines_init_mmio() - allocate and prepare the Engine Command Streamers * @dev_priv: i915 device private
@@ -395,6 +434,8 @@ int intel_engines_init_mmio(struct drm_i915_private *dev_priv)i915_check_and_clear_faults (dev_priv); +intel_setup_engine_capabilities (i915); +return 0 ; cleanup:
drivers/gpu/drm/i915/gt/intel_engine_types.h +2 -0
@@ -279,6 +279,8 @@ struct intel_engine_cs {u32 context_size;u32 mmio_base; +u32 uabi_capabilities; +struct intel_sseu sseu;struct intel_ring *buffer;
drivers/gpu/drm/i915/i915_query.c +49 -0
58 lines not on this page · raw message
include/uapi/drm/i915_drm.h +42 -0
54 lines not on this page · raw message
Signature · 6 lines
2.19.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.BAT: failure for drm/i915: Engine discovery query (rev8)
== Series Details ==
== Series Details ==
Series: drm/i915: Engine discovery query (rev8)
URL : https://patchwork.freedesktop.org/series/39958/
State : failure
== Summary ==
CALL scripts/checksyscalls.sh
CALL scripts/atomic/check-atomics.sh
DESCEND objtool
CHK include/generated/compile.h
AR drivers/gpu/drm/i915/built-in.a
CC [M] drivers/gpu/drm/i915/header_test_i915_active_types.o
CC [M] drivers/gpu/drm/i915/header_test_i915_drv.o
CC [M] drivers/gpu/drm/i915/header_test_i915_gem_context_types.o
CC [M] drivers/gpu/drm/i915/header_test_i915_gem_pm.o
CC [M] drivers/gpu/drm/i915/header_test_i915_irq.o
CC [M] drivers/gpu/drm/i915/header_test_i915_params.o
CC [M] drivers/gpu/drm/i915/header_test_i915_priolist_types.o
CC [M] drivers/gpu/drm/i915/header_test_i915_reg.o
CC [M] drivers/gpu/drm/i915/header_test_i915_scheduler_types.o
CC [M] drivers/gpu/drm/i915/header_test_i915_timeline_types.o
CC [M] drivers/gpu/drm/i915/header_test_intel_atomic.o
CC [M] drivers/gpu/drm/i915/header_test_intel_atomic_plane.o
CC [M] drivers/gpu/drm/i915/header_test_intel_audio.o
CC [M] drivers/gpu/drm/i915/header_test_intel_bios.o
CC [M] drivers/gpu/drm/i915/header_test_intel_cdclk.o
CC [M] drivers/gpu/drm/i915/header_test_intel_color.o
CC [M] drivers/gpu/drm/i915/header_test_intel_combo_phy.o
CC [M] drivers/gpu/drm/i915/header_test_intel_connector.o
CC [M] drivers/gpu/drm/i915/header_test_intel_crt.o
CC [M] drivers/gpu/drm/i915/header_test_intel_csr.o
CC [M] drivers/gpu/drm/i915/header_test_intel_ddi.o
CC [M] drivers/gpu/drm/i915/header_test_intel_dp.o
CC [M] drivers/gpu/drm/i915/header_test_intel_dp_aux_backlight.o
CC [M] drivers/gpu/drm/i915/header_test_intel_dp_link_training.o
CC [M] drivers/gpu/drm/i915/header_test_intel_dp_mst.o
CC [M] drivers/gpu/drm/i915/header_test_intel_dpll_mgr.o
CC [M] drivers/gpu/drm/i915/header_test_intel_drv.o
CC [M] drivers/gpu/drm/i915/header_test_intel_dsi.o
CC [M] drivers/gpu/drm/i915/header_test_intel_dsi_dcs_backlight.o
CC [M] drivers/gpu/drm/i915/header_test_intel_dvo.o
CC [M] drivers/gpu/drm/i915/header_test_intel_dvo_dev.o
CC [M] drivers/gpu/drm/i915/header_test_intel_fbc.o
CC [M] drivers/gpu/drm/i915/header_test_intel_fbdev.o
CC [M] drivers/gpu/drm/i915/header_test_intel_fifo_underrun.o
CC [M] drivers/gpu/drm/i915/header_test_intel_frontbuffer.o
CC [M] drivers/gpu/drm/i915/header_test_intel_hdcp.o
CC [M] drivers/gpu/drm/i915/header_test_intel_hdmi.o
CC [M] drivers/gpu/drm/i915/header_test_intel_hotplug.o
CC [M] drivers/gpu/drm/i915/header_test_intel_lspcon.o
CC [M] drivers/gpu/drm/i915/header_test_intel_lvds.o
CC [M] drivers/gpu/drm/i915/header_test_intel_overlay.o
CC [M] drivers/gpu/drm/i915/header_test_intel_panel.o
CC [M] drivers/gpu/drm/i915/header_test_intel_pipe_crc.o
CC [M] drivers/gpu/drm/i915/header_test_intel_pm.o
CC [M] drivers/gpu/drm/i915/header_test_intel_psr.o
CC [M] drivers/gpu/drm/i915/header_test_intel_quirks.o
CC [M] drivers/gpu/drm/i915/header_test_intel_sdvo.o
CC [M] drivers/gpu/drm/i915/header_test_intel_sideband.o
CC [M] drivers/gpu/drm/i915/header_test_intel_sprite.o
CC [M] drivers/gpu/drm/i915/header_test_intel_tv.o
CC [M] drivers/gpu/drm/i915/header_test_intel_uncore.o
CC [M] drivers/gpu/drm/i915/header_test_intel_vdsc.o
CC [M] drivers/gpu/drm/i915/header_test_intel_wakeref.o
CC [M] drivers/gpu/drm/i915/gt/intel_engine_cs.o
drivers/gpu/drm/i915/gt/intel_engine_cs.c: In function ‘intel_engines_init_mmio’:
drivers/gpu/drm/i915/gt/intel_engine_cs.c:437:34: error: ‘i915’ undeclared (first use in this function)
intel_setup_engine_capabilities(i915);
^~~~drivers/gpu/drm/i915/gt/intel_engine_cs.c:437:34: note: each undeclared identifier is reported only once for each function it appears in scripts/Makefile.build:275: recipe for target 'drivers/gpu/drm/i915/gt/intel_engine_cs.o' failed
make[4]: *** [drivers/gpu/drm/i915/gt/intel_engine_cs.o] Error 1scripts/Makefile.build:486: recipe for target 'drivers/gpu/drm/i915' failed
make[3]: *** [drivers/gpu/drm/i915] Error 2scripts/Makefile.build:486: recipe for target 'drivers/gpu/drm' failed
make[2]: *** [drivers/gpu/drm] Error 2scripts/Makefile.build:486: recipe for target 'drivers/gpu' failed
make[1]: *** [drivers/gpu] Error 2
Makefile:1051: recipe for target 'drivers' failed
make: *** [drivers] Error 2
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoting Tvrtko Ursulin (2019-05-01 11:52:28)
Quoted 89 lines
From: Tvrtko Ursulin <[email protected]>
Engine discovery query allows userspace to enumerate engines, probe their configuration features, all without needing to maintain the internal PCI ID based database.
A new query for the generic i915 query ioctl is added named
DRM_I915_QUERY_ENGINE_INFO, together with accompanying structuredrm_i915_query_engine_info. The address of latter should be passed to the kernel in the query.data_ptr field, and should be large enough for the kernel to fill out all known engines as structdrm_i915_engine_infoelements trailing the query.As with other queries, setting the item query length to zero allows userspace to query minimum required buffer size.
Enumerated engines have common type mask which can be used to query all hardware engines, versus engines userspace can submit to using the execbuf uAPI.
Engines also have capabilities which are per engine class namespace of bits describing features not present on all engine instances.
v2:
* Fixed HEVC assignment.
* Reorder some fields, rename type to flags, increase width. (Lionel)
* No need to allocate temporary storage if we do it engine by engine. (Lionel)v3:
* Describe engine flags and mark mbz fields. (Lionel)
* HEVC only applies to VCS.v4:
* Squash SFC flag into main patch.
* Tidy some comments.v5:
* Adduabi_prefix to engine capabilities. (Chris Wilson)
* Report exact size of engine info array. (Chris Wilson)
* Drop the engine flags. (Joonas Lahtinen)
* Added some more reserved fields.
* Move flags after class/instance.v6:
* Do not check engine info array was zeroed by userspace but zero the unused fields for them instead.v7:
* Simplify length calculation loop. (Lionel Landwerlin)v8:
* Remove MBZ comments where not applicable.
* Rename ABI flags to match engine class define naming.
* Rename SFC ABI flag to reflect it applies to VCS and VECS.
* SFC is wired to even _logical_ engine instances.
* SFC applies to VCS and VECS.
* HEVC is present on all instances on Gen11. (Tony)
* Simplify length calculation even more. (Chris Wilson)
* Moveinfo_ptrassigment closer to loop for clarity. (Chris Wilson)
* Usevdbox_sfc_accessfrom runtime info.
* Rebase forRUNTIME_INFO.
* Refactor for lower indentation.
* Rename uAPI class/instance to engine_class/instance to avoid C++ keyword.v9:
* Rebase for s/num_rings/num_engines/ inRUNTIME_INFO.v10:
* Use newcopy_query_item.v11:
* Consolidate with structi915_engine_class_instnace.Signed-off-by Tvrtko Ursulin <[email protected]>Cc Chris Wilson <[email protected]>Cc Jon Bloomfield <[email protected]>Cc Dmitry Rogozhkin <[email protected]>Cc Lionel Landwerlin <[email protected]>Cc Joonas Lahtinen <[email protected]>Cc Tony Ye <[email protected]>Reviewed-by Lionel Landwerlin <[email protected]> # v7Reviewed-by Chris Wilson <[email protected]> # v7---
include/uapi/drm/i915_drm.h +4
-0+/** +* struct drm_i915_engine_info +* +* Describes one engine and it's capabilities as known to the driver.
include/uapi/drm/i915_drm.h struct drm_i915_query_topology_info { · line 1936
Quoted 10 lines
include/uapi/drm/i915_drm.h +10
-0+*/ +struct drm_i915_engine_info { +/** Engine class and instance. */ +struct i915_engine_class_instance engine; + +/** Reserved field. */ +__u32 rsvd0; + +/** Engine flags. */ +__u64 flags;
Do you think we could do something like BUILD_BUG_ON(!IS_ALIGNED(offsetof(*info, flags), sizeof(info->flags));
Will that work, and worthwhile? Maybe work into a
BUILD_BUG_ON(check_user_alignment(info, flags));
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 104 lines · Chris Wilson
Quoting Tvrtko Ursulin (2019-05-01 11:52:28)
Quoted 89 lines
From: Tvrtko Ursulin <[email protected]>
Engine discovery query allows userspace to enumerate engines, probe their configuration features, all without needing to maintain the internal PCI ID based database.
A new query for the generic i915 query ioctl is added named
DRM_I915_QUERY_ENGINE_INFO, together with accompanying structuredrm_i915_query_engine_info. The address of latter should be passed to the kernel in the query.data_ptr field, and should be large enough for the kernel to fill out all known engines as structdrm_i915_engine_infoelements trailing the query.As with other queries, setting the item query length to zero allows userspace to query minimum required buffer size.
Enumerated engines have common type mask which can be used to query all hardware engines, versus engines userspace can submit to using the execbuf uAPI.
Engines also have capabilities which are per engine class namespace of bits describing features not present on all engine instances.
v2:
* Fixed HEVC assignment.
* Reorder some fields, rename type to flags, increase width. (Lionel)
* No need to allocate temporary storage if we do it engine by engine. (Lionel)v3:
* Describe engine flags and mark mbz fields. (Lionel)
* HEVC only applies to VCS.v4:
* Squash SFC flag into main patch.
* Tidy some comments.v5:
* Adduabi_prefix to engine capabilities. (Chris Wilson)
* Report exact size of engine info array. (Chris Wilson)
* Drop the engine flags. (Joonas Lahtinen)
* Added some more reserved fields.
* Move flags after class/instance.v6:
* Do not check engine info array was zeroed by userspace but zero the unused fields for them instead.v7:
* Simplify length calculation loop. (Lionel Landwerlin)v8:
* Remove MBZ comments where not applicable.
* Rename ABI flags to match engine class define naming.
* Rename SFC ABI flag to reflect it applies to VCS and VECS.
* SFC is wired to even _logical_ engine instances.
* SFC applies to VCS and VECS.
* HEVC is present on all instances on Gen11. (Tony)
* Simplify length calculation even more. (Chris Wilson)
* Moveinfo_ptrassigment closer to loop for clarity. (Chris Wilson)
* Usevdbox_sfc_accessfrom runtime info.
* Rebase forRUNTIME_INFO.
* Refactor for lower indentation.
* Rename uAPI class/instance to engine_class/instance to avoid C++ keyword.v9:
* Rebase for s/num_rings/num_engines/ inRUNTIME_INFO.v10:
* Use newcopy_query_item.v11:
* Consolidate with structi915_engine_class_instnace.Signed-off-by Tvrtko Ursulin <[email protected]>Cc Chris Wilson <[email protected]>Cc Jon Bloomfield <[email protected]>Cc Dmitry Rogozhkin <[email protected]>Cc Lionel Landwerlin <[email protected]>Cc Joonas Lahtinen <[email protected]>Cc Tony Ye <[email protected]>Reviewed-by Lionel Landwerlin <[email protected]> # v7Reviewed-by Chris Wilson <[email protected]> # v7---
include/uapi/drm/i915_drm.h +4
-0+/** +* struct drm_i915_engine_info +* +* Describes one engine and it's capabilities as known to the driver. include/uapi/drm/i915_drm.h struct drm_i915_query_topology_info { · line 1936
Quoted 10 lines
include/uapi/drm/i915_drm.h +10
-0+*/ +struct drm_i915_engine_info { +/** Engine class and instance. */ +struct i915_engine_class_instance engine; + +/** Reserved field. */ +__u32 rsvd0; + +/** Engine flags. */ +__u64 flags;Do you think we could do something like BUILD_BUG_ON(!IS_ALIGNED(offsetof(*info, flags),
sizeof(info->flags));
Quoted 3 lines
Will that work, and worthwhile? Maybe work into a
BUILD_BUG_ON(check_user_alignment(info, flags));
Hmm.. probably manual check for no holes _and_ alignment is good enough for uAPI since once it's in it's in. Will triple-check.
Quoted 1 line
Reviewed-by Chris Wilson <[email protected]>
Thanks! I apparently messed up the actual branch and will resend once IGT series finished so I can play with Test-with:
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoting Tvrtko Ursulin (2019-05-01 12:45:36)
Quoted 106 lines · Chris Wilson
Quoted 104 lines
Quoting Tvrtko Ursulin (2019-05-01 11:52:28)
Quoted 89 lines
From: Tvrtko Ursulin <[email protected]>
Engine discovery query allows userspace to enumerate engines, probe their configuration features, all without needing to maintain the internal PCI ID based database.
A new query for the generic i915 query ioctl is added named
DRM_I915_QUERY_ENGINE_INFO, together with accompanying structuredrm_i915_query_engine_info. The address of latter should be passed to the kernel in the query.data_ptr field, and should be large enough for the kernel to fill out all known engines as structdrm_i915_engine_infoelements trailing the query.As with other queries, setting the item query length to zero allows userspace to query minimum required buffer size.
Enumerated engines have common type mask which can be used to query all hardware engines, versus engines userspace can submit to using the execbuf uAPI.
Engines also have capabilities which are per engine class namespace of bits describing features not present on all engine instances.
v2:
* Fixed HEVC assignment.
* Reorder some fields, rename type to flags, increase width. (Lionel)
* No need to allocate temporary storage if we do it engine by engine. (Lionel)v3:
* Describe engine flags and mark mbz fields. (Lionel)
* HEVC only applies to VCS.v4:
* Squash SFC flag into main patch.
* Tidy some comments.v5:
* Adduabi_prefix to engine capabilities. (Chris Wilson)
* Report exact size of engine info array. (Chris Wilson)
* Drop the engine flags. (Joonas Lahtinen)
* Added some more reserved fields.
* Move flags after class/instance.v6:
* Do not check engine info array was zeroed by userspace but zero the unused fields for them instead.v7:
* Simplify length calculation loop. (Lionel Landwerlin)v8:
* Remove MBZ comments where not applicable.
* Rename ABI flags to match engine class define naming.
* Rename SFC ABI flag to reflect it applies to VCS and VECS.
* SFC is wired to even _logical_ engine instances.
* SFC applies to VCS and VECS.
* HEVC is present on all instances on Gen11. (Tony)
* Simplify length calculation even more. (Chris Wilson)
* Moveinfo_ptrassigment closer to loop for clarity. (Chris Wilson)
* Usevdbox_sfc_accessfrom runtime info.
* Rebase forRUNTIME_INFO.
* Refactor for lower indentation.
* Rename uAPI class/instance to engine_class/instance to avoid C++ keyword.v9:
* Rebase for s/num_rings/num_engines/ inRUNTIME_INFO.v10:
* Use newcopy_query_item.v11:
* Consolidate with structi915_engine_class_instnace.Signed-off-by Tvrtko Ursulin <[email protected]>Cc Chris Wilson <[email protected]>Cc Jon Bloomfield <[email protected]>Cc Dmitry Rogozhkin <[email protected]>Cc Lionel Landwerlin <[email protected]>Cc Joonas Lahtinen <[email protected]>Cc Tony Ye <[email protected]>Reviewed-by Lionel Landwerlin <[email protected]> # v7Reviewed-by Chris Wilson <[email protected]> # v7---
include/uapi/drm/i915_drm.h +4
-0+/** +* struct drm_i915_engine_info +* +* Describes one engine and it's capabilities as known to the driver. include/uapi/drm/i915_drm.h struct drm_i915_query_topology_info { · line 1936
Quoted 10 lines
include/uapi/drm/i915_drm.h +10
-0+*/ +struct drm_i915_engine_info { +/** Engine class and instance. */ +struct i915_engine_class_instance engine; + +/** Reserved field. */ +__u32 rsvd0; + +/** Engine flags. */ +__u64 flags;Do you think we could do something like BUILD_BUG_ON(!IS_ALIGNED(offsetof(*info, flags),
sizeof(info->flags));
Quoted 6 lines
Quoted 3 lines
Will that work, and worthwhile? Maybe work into a
BUILD_BUG_ON(check_user_alignment(info, flags));Hmm.. probably manual check for no holes _and_ alignment is good enough for uAPI since once it's in it's in. Will triple-check.
Yeah, we actually need something more like offsetofend(previous_field) == offsetof(next_field)
BUILD_BUG_ON(check_user_struct(info, previous_field, next_field)) ? -Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 111 lines · Chris Wilson
Quoting Tvrtko Ursulin (2019-05-01 12:45:36)
Quoted 110 lines · Chris Wilson
Quoted 107 lines
Quoting Tvrtko Ursulin (2019-05-01 11:52:28)
Quoted 89 lines
From: Tvrtko Ursulin <[email protected]>
Engine discovery query allows userspace to enumerate engines, probe their configuration features, all without needing to maintain the internal PCI ID based database.
A new query for the generic i915 query ioctl is added named
DRM_I915_QUERY_ENGINE_INFO, together with accompanying structuredrm_i915_query_engine_info. The address of latter should be passed to the kernel in the query.data_ptr field, and should be large enough for the kernel to fill out all known engines as structdrm_i915_engine_infoelements trailing the query.As with other queries, setting the item query length to zero allows userspace to query minimum required buffer size.
Enumerated engines have common type mask which can be used to query all hardware engines, versus engines userspace can submit to using the execbuf uAPI.
Engines also have capabilities which are per engine class namespace of bits describing features not present on all engine instances.
v2:
* Fixed HEVC assignment.
* Reorder some fields, rename type to flags, increase width. (Lionel)
* No need to allocate temporary storage if we do it engine by engine. (Lionel)v3:
* Describe engine flags and mark mbz fields. (Lionel)
* HEVC only applies to VCS.v4:
* Squash SFC flag into main patch.
* Tidy some comments.v5:
* Adduabi_prefix to engine capabilities. (Chris Wilson)
* Report exact size of engine info array. (Chris Wilson)
* Drop the engine flags. (Joonas Lahtinen)
* Added some more reserved fields.
* Move flags after class/instance.v6:
* Do not check engine info array was zeroed by userspace but zero the unused fields for them instead.v7:
* Simplify length calculation loop. (Lionel Landwerlin)v8:
* Remove MBZ comments where not applicable.
* Rename ABI flags to match engine class define naming.
* Rename SFC ABI flag to reflect it applies to VCS and VECS.
* SFC is wired to even _logical_ engine instances.
* SFC applies to VCS and VECS.
* HEVC is present on all instances on Gen11. (Tony)
* Simplify length calculation even more. (Chris Wilson)
* Moveinfo_ptrassigment closer to loop for clarity. (Chris Wilson)
* Usevdbox_sfc_accessfrom runtime info.
* Rebase forRUNTIME_INFO.
* Refactor for lower indentation.
* Rename uAPI class/instance to engine_class/instance to avoid C++ keyword.v9:
* Rebase for s/num_rings/num_engines/ inRUNTIME_INFO.v10:
* Use newcopy_query_item.v11:
* Consolidate with structi915_engine_class_instnace.Signed-off-by Tvrtko Ursulin <[email protected]>Cc Chris Wilson <[email protected]>Cc Jon Bloomfield <[email protected]>Cc Dmitry Rogozhkin <[email protected]>Cc Lionel Landwerlin <[email protected]>Cc Joonas Lahtinen <[email protected]>Cc Tony Ye <[email protected]>Reviewed-by Lionel Landwerlin <[email protected]> # v7Reviewed-by Chris Wilson <[email protected]> # v7---
include/uapi/drm/i915_drm.h +4
-0+/** +* struct drm_i915_engine_info +* +* Describes one engine and it's capabilities as known to the driver. include/uapi/drm/i915_drm.h struct drm_i915_query_topology_info { · line 1936
Quoted 10 lines
include/uapi/drm/i915_drm.h +10
-0+*/ +struct drm_i915_engine_info { +/** Engine class and instance. */ +struct i915_engine_class_instance engine; + +/** Reserved field. */ +__u32 rsvd0; + +/** Engine flags. */ +__u64 flags;Do you think we could do something like BUILD_BUG_ON(!IS_ALIGNED(offsetof(*info, flags),
sizeof(info->flags));Will that work, and worthwhile? Maybe work into a
BUILD_BUG_ON(check_user_alignment(info, flags));
Quoted 7 lines
Quoted 2 lines
Hmm.. probably manual check for no holes _and_ alignment is good enough for uAPI since once it's in it's in. Will triple-check.
Yeah, we actually need something more like
offsetofend(previous_field)==offsetof(next_field)
BUILD_BUG_ON(check_user_struct(info, previous_field, next_field))?
How would you logistically do it? List all struct members for each uapi struct you want to check?
Maybe a variadic macro like:
CHECK_USER_STRUCT_FUNCTION(type, member0, ... memberN);
Which expands to a dedicated function to check this type, using va_start/va_end to iterate all members checking for holes. So somewhere in code we would also need:
CHECK_USER_STRUCT(type);
Which would call the function. But thats not build time.. Could be under debug and selftests I guess. Could even be IGT in this case.
But I am not to keen in listing each struct member with a prev/next_field BUILD_BUG_ON.
Perhaps IGT is indeed a better place to start testing for this. Since we anyway require each new uAPI to have good IGT coverage.
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoting Tvrtko Ursulin (2019-05-01 16:51:28)
Quoted 24 lines · Chris Wilson
Quoted 8 lines
Quoting Tvrtko Ursulin (2019-05-01 12:45:36)
Quoted 2 lines
Hmm.. probably manual check for no holes _and_ alignment is good enough for uAPI since once it's in it's in. Will triple-check.
Yeah, we actually need something more like
offsetofend(previous_field)==offsetof(next_field)
BUILD_BUG_ON(check_user_struct(info, previous_field, next_field))?How would you logistically do it? List all struct members for each uapi struct you want to check?
Maybe a variadic macro like:
CHECK_USER_STRUCT_FUNCTION(type, member0, ... memberN);
Which expands to a dedicated function to check this type, using va_start/va_end to iterate all members checking for holes. So somewhere in code we would also need:
CHECK_USER_STRUCT(type);
Quoted 8 lines
Which would call the function. But thats not build time.. Could be under debug and selftests I guess. Could even be IGT in this case.
But I am not to keen in listing each struct member with a prev/next_field
BUILD_BUG_ON.Perhaps IGT is indeed a better place to start testing for this. Since we anyway require each new uAPI to have good IGT coverage.
Definitely don't like the idea of doing it manually, I could have just about accepted it if we could have rolled it into a get_user wrapper.
We should just go annoy Jani to whip up some Makefile magic to call pahole and check the structs defined in uapi.h
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx