Skip to content

Commit 4cdc4ff

Browse files
Update i915 prelim headers
https://github.com/intel-gpu/drm-uapi-helper/releases/tag/v2.0-rc9 Signed-off-by: Bartosz Dunajski <[email protected]>
1 parent 292f16d commit 4cdc4ff

File tree

2 files changed

+206
-28
lines changed

2 files changed

+206
-28
lines changed

third_party/uapi/prelim/drm/i915_drm.h

Lines changed: 196 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,14 @@ typedef struct drm_i915_irq_wait {
623623
#define I915_SCHEDULER_CAP_PREEMPTION (1ul << 2)
624624
#define I915_SCHEDULER_CAP_SEMAPHORES (1ul << 3)
625625
#define I915_SCHEDULER_CAP_ENGINE_BUSY_STATS (1ul << 4)
626+
/*
627+
* Indicates the 2k user priority levels are statically mapped into 3 buckets as
628+
* follows:
629+
*
630+
* -1k to -1 Low priority
631+
* 0 Normal priority
632+
* 1 to 1k Highest priority
633+
*/
626634
#define I915_SCHEDULER_CAP_STATIC_PRIORITY_MAP (1ul << 5)
627635

628636
#define I915_PARAM_HUC_STATUS 42
@@ -2072,6 +2080,61 @@ struct i915_context_engines_parallel_submit {
20722080
struct i915_engine_class_instance engines[N__]; \
20732081
} __attribute__((packed)) name__
20742082

2083+
/**
2084+
* DOC: Context Engine Map uAPI
2085+
*
2086+
* Context engine map is a new way of addressing engines when submitting batch-
2087+
* buffers, replacing the existing way of using identifiers like `I915_EXEC_BLT`
2088+
* inside the flags field of `struct drm_i915_gem_execbuffer2`.
2089+
*
2090+
* To use it created GEM contexts need to be configured with a list of engines
2091+
* the user is intending to submit to. This is accomplished using the
2092+
* `I915_CONTEXT_PARAM_ENGINES` parameter and `struct
2093+
* i915_context_param_engines`.
2094+
*
2095+
* For such contexts the `I915_EXEC_RING_MASK` field becomes an index into the
2096+
* configured map.
2097+
*
2098+
* Example of creating such context and submitting against it:
2099+
*
2100+
* .. code-block:: C
2101+
*
2102+
* I915_DEFINE_CONTEXT_PARAM_ENGINES(engines, 2) = {
2103+
* .engines = { { I915_ENGINE_CLASS_RENDER, 0 },
2104+
* { I915_ENGINE_CLASS_COPY, 0 } }
2105+
* };
2106+
* struct drm_i915_gem_context_create_ext_setparam p_engines = {
2107+
* .base = {
2108+
* .name = I915_CONTEXT_CREATE_EXT_SETPARAM,
2109+
* },
2110+
* .param = {
2111+
* .param = I915_CONTEXT_PARAM_ENGINES,
2112+
* .value = to_user_pointer(&engines),
2113+
* .size = sizeof(engines),
2114+
* },
2115+
* };
2116+
* struct drm_i915_gem_context_create_ext create = {
2117+
* .flags = I915_CONTEXT_CREATE_FLAGS_USE_EXTENSIONS,
2118+
* .extensions = to_user_pointer(&p_engines);
2119+
* };
2120+
*
2121+
* ctx_id = gem_context_create_ext(drm_fd, &create);
2122+
*
2123+
* // We have now created a GEM context with two engines in the map:
2124+
* // Index 0 points to rcs0 while index 1 points to bcs0. Other engines
2125+
* // will not be accessible from this context.
2126+
*
2127+
* ...
2128+
* execbuf.rsvd1 = ctx_id;
2129+
* execbuf.flags = 0; // Submits to index 0, which is rcs0 for this context
2130+
* gem_execbuf(drm_fd, &execbuf);
2131+
*
2132+
* ...
2133+
* execbuf.rsvd1 = ctx_id;
2134+
* execbuf.flags = 1; // Submits to index 0, which is bcs0 for this context
2135+
* gem_execbuf(drm_fd, &execbuf);
2136+
*/
2137+
20752138
struct i915_context_param_engines {
20762139
__u64 extensions; /* linked chain of extension blocks, 0 terminates */
20772140
#define I915_CONTEXT_ENGINES_EXT_LOAD_BALANCE 0 /* see i915_context_engines_load_balance */
@@ -2106,8 +2169,6 @@ struct drm_i915_gem_context_destroy {
21062169
* The id of new VM (bound to the fd) for use with I915_CONTEXT_PARAM_VM is
21072170
* returned in the outparam @id.
21082171
*
2109-
* No flags are defined, with all bits reserved and must be zero.
2110-
*
21112172
* An extension chain maybe provided, starting with @extensions, and terminated
21122173
* by the @next_extension being 0. Currently, mem region extension is defined.
21132174
*
@@ -2407,6 +2468,7 @@ struct drm_i915_query_item {
24072468
#define DRM_I915_QUERY_TOPOLOGY_INFO 1
24082469
#define DRM_I915_QUERY_ENGINE_INFO 2
24092470
#define DRM_I915_QUERY_PERF_CONFIG 3
2471+
#define DRM_I915_QUERY_MEMORY_REGIONS 4
24102472
/* Must be kept compact -- no holes and well documented */
24112473

24122474
/**
@@ -2554,8 +2616,6 @@ struct drm_i915_query_topology_info {
25542616
* struct drm_i915_engine_info
25552617
*
25562618
* Describes one engine and it's capabilities as known to the driver.
2557-
*
2558-
* FIXME: revert to upstream version after UMD switch to PRELIM version
25592619
*/
25602620
struct drm_i915_engine_info {
25612621
/** @engine: Engine class and instance. */
@@ -2649,6 +2709,138 @@ struct drm_i915_query_perf_config {
26492709
__u8 data[];
26502710
};
26512711

2712+
/**
2713+
* enum drm_i915_gem_memory_class - Supported memory classes
2714+
*/
2715+
enum drm_i915_gem_memory_class {
2716+
/** @I915_MEMORY_CLASS_SYSTEM: System memory */
2717+
I915_MEMORY_CLASS_SYSTEM = 0,
2718+
/** @I915_MEMORY_CLASS_DEVICE: Device local-memory */
2719+
I915_MEMORY_CLASS_DEVICE,
2720+
};
2721+
2722+
/**
2723+
* struct drm_i915_gem_memory_class_instance - Identify particular memory region
2724+
*/
2725+
struct drm_i915_gem_memory_class_instance {
2726+
/** @memory_class: See enum drm_i915_gem_memory_class */
2727+
__u16 memory_class;
2728+
2729+
/** @memory_instance: Which instance */
2730+
__u16 memory_instance;
2731+
};
2732+
2733+
/**
2734+
* struct drm_i915_memory_region_info - Describes one region as known to the
2735+
* driver.
2736+
*
2737+
* Note that we reserve some stuff here for potential future work. As an example
2738+
* we might want expose the capabilities for a given region, which could include
2739+
* things like if the region is CPU mappable/accessible, what are the supported
2740+
* mapping types etc.
2741+
*
2742+
* Note that to extend struct drm_i915_memory_region_info and struct
2743+
* drm_i915_query_memory_regions in the future the plan is to do the following:
2744+
*
2745+
* .. code-block:: C
2746+
*
2747+
* struct drm_i915_memory_region_info {
2748+
* struct drm_i915_gem_memory_class_instance region;
2749+
* union {
2750+
* __u32 rsvd0;
2751+
* __u32 new_thing1;
2752+
* };
2753+
* ...
2754+
* union {
2755+
* __u64 rsvd1[8];
2756+
* struct {
2757+
* __u64 new_thing2;
2758+
* __u64 new_thing3;
2759+
* ...
2760+
* };
2761+
* };
2762+
* };
2763+
*
2764+
* With this things should remain source compatible between versions for
2765+
* userspace, even as we add new fields.
2766+
*
2767+
* Note this is using both struct drm_i915_query_item and struct drm_i915_query.
2768+
* For this new query we are adding the new query id DRM_I915_QUERY_MEMORY_REGIONS
2769+
* at &drm_i915_query_item.query_id.
2770+
*/
2771+
struct drm_i915_memory_region_info {
2772+
/** @region: The class:instance pair encoding */
2773+
struct drm_i915_gem_memory_class_instance region;
2774+
2775+
/** @rsvd0: MBZ */
2776+
__u32 rsvd0;
2777+
2778+
/** @probed_size: Memory probed by the driver (-1 = unknown) */
2779+
__u64 probed_size;
2780+
2781+
/** @unallocated_size: Estimate of memory remaining (-1 = unknown) */
2782+
__u64 unallocated_size;
2783+
2784+
/** @rsvd1: MBZ */
2785+
__u64 rsvd1[8];
2786+
};
2787+
2788+
/**
2789+
* struct drm_i915_query_memory_regions
2790+
*
2791+
* The region info query enumerates all regions known to the driver by filling
2792+
* in an array of struct drm_i915_memory_region_info structures.
2793+
*
2794+
* Example for getting the list of supported regions:
2795+
*
2796+
* .. code-block:: C
2797+
*
2798+
* struct drm_i915_query_memory_regions *info;
2799+
* struct drm_i915_query_item item = {
2800+
* .query_id = DRM_I915_QUERY_MEMORY_REGIONS;
2801+
* };
2802+
* struct drm_i915_query query = {
2803+
* .num_items = 1,
2804+
* .items_ptr = (uintptr_t)&item,
2805+
* };
2806+
* int err, i;
2807+
*
2808+
* // First query the size of the blob we need, this needs to be large
2809+
* // enough to hold our array of regions. The kernel will fill out the
2810+
* // item.length for us, which is the number of bytes we need.
2811+
* err = ioctl(fd, DRM_IOCTL_I915_QUERY, &query);
2812+
* if (err) ...
2813+
*
2814+
* info = calloc(1, item.length);
2815+
* // Now that we allocated the required number of bytes, we call the ioctl
2816+
* // again, this time with the data_ptr pointing to our newly allocated
2817+
* // blob, which the kernel can then populate with the all the region info.
2818+
* item.data_ptr = (uintptr_t)&info,
2819+
*
2820+
* err = ioctl(fd, DRM_IOCTL_I915_QUERY, &query);
2821+
* if (err) ...
2822+
*
2823+
* // We can now access each region in the array
2824+
* for (i = 0; i < info->num_regions; i++) {
2825+
* struct drm_i915_memory_region_info mr = info->regions[i];
2826+
* u16 class = mr.region.class;
2827+
* u16 instance = mr.region.instance;
2828+
*
2829+
* ....
2830+
* }
2831+
*
2832+
* free(info);
2833+
*/
2834+
struct drm_i915_query_memory_regions {
2835+
/** @num_regions: Number of supported regions */
2836+
__u32 num_regions;
2837+
2838+
/** @rsvd: MBZ */
2839+
__u32 rsvd[3];
2840+
2841+
/** @regions: Info about each supported region */
2842+
struct drm_i915_memory_region_info regions[];
2843+
};
26522844
#include "i915_drm_prelim.h"
26532845

26542846
/* ID of the protected content session managed by i915 when PXP is active */

third_party/uapi/prelim/drm/i915_drm_prelim.h

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#ifndef __I915_DRM_PRELIM_H__
77
#define __I915_DRM_PRELIM_H__
88

9-
#include "drm.h"
9+
#include "i915_drm.h"
1010

1111
/*
1212
* Modifications to structs/values defined here are subject to
@@ -419,21 +419,6 @@ struct prelim_drm_i915_query_item {
419419
#define PRELIM_DRM_I915_QUERY_L3_BANK_COUNT (PRELIM_DRM_I915_QUERY | 14)
420420
};
421421

422-
/*
423-
* Number of BB in execbuf2 IOCTL - 1, used to submit more than BB in a single
424-
* execbuf2 IOCTL.
425-
*
426-
* Return -EINVAL if more than 1 BB (value 0) is specified if
427-
* PRELIM_I915_CONTEXT_ENGINES_EXT_PARALLEL_SUBMIT hasn't been called on the gem
428-
* context first. Also returns -EINVAL if gem context has been setup with
429-
* I915_PARALLEL_BB_PREEMPT_BOUNDARY and the number BBs not equal to the total
430-
* number hardware contexts in the gem context.
431-
*/
432-
#define PRELIM_I915_EXEC_NUMBER_BB_LSB (48)
433-
#define PRELIM_I915_EXEC_NUMBER_BB_MASK (0x3full << PRELIM_I915_EXEC_NUMBER_BB_LSB)
434-
#define PRELIM_I915_EXEC_NUMBER_BB_MSB (54)
435-
#define PRELIM_I915_EXEC_NUMBER_BB_MASK_MSB (1ull << PRELIM_I915_EXEC_NUMBER_BB_MSB)
436-
437422
/*
438423
* In XEHPSDV total number of engines can be more than the maximum supported
439424
* engines by I915_EXEC_RING_MASK.
@@ -488,7 +473,7 @@ enum prelim_drm_i915_oa_format {
488473
PRELIM_I915_OAC_FORMAT_A24u64_B8_C8,
489474
PRELIM_I915_OA_FORMAT_A38u64_R2u64_B8_C8,
490475
PRELIM_I915_OAM_FORMAT_A2u64_R2u64_B8_C8,
491-
PRELIM_I915_OAC_FORMAT_A24u22_B8_C8,
476+
PRELIM_I915_OAC_FORMAT_A22u32_R2u32_B8_C8,
492477

493478
PRELIM_I915_OA_FORMAT_MAX /* non-ABI */
494479
};
@@ -1228,6 +1213,13 @@ struct prelim_drm_i915_vm_bind_ext_sync_fence {
12281213
__u64 val;
12291214
};
12301215

1216+
struct prelim_drm_i915_gem_vm_control {
1217+
#define PRELIM_I915_VM_CREATE_FLAGS_DISABLE_SCRATCH (1 << 16)
1218+
#define PRELIM_I915_VM_CREATE_FLAGS_ENABLE_PAGE_FAULT (1 << 17)
1219+
#define PRELIM_I915_VM_CREATE_FLAGS_USE_VM_BIND (1 << 18)
1220+
#define PRELIM_I915_VM_CREATE_FLAGS_UNKNOWN (~(GENMASK(18, 16)))
1221+
};
1222+
12311223
struct prelim_drm_i915_gem_vm_region_ext {
12321224
#define PRELIM_I915_GEM_VM_CONTROL_EXT_REGION (PRELIM_I915_USER_EXT | 0)
12331225
struct i915_user_extension base;
@@ -1236,12 +1228,6 @@ struct prelim_drm_i915_gem_vm_region_ext {
12361228
__u32 pad;
12371229
};
12381230

1239-
struct prelim_drm_i915_gem_vm_control {
1240-
#define PRELIM_I915_VM_CREATE_FLAGS_DISABLE_SCRATCH (1 << 16)
1241-
#define PRELIM_I915_VM_CREATE_FLAGS_ENABLE_PAGE_FAULT (1 << 17)
1242-
#define PRELIM_I915_VM_CREATE_FLAGS_UNKNOWN (~(GENMASK(17, 16)))
1243-
};
1244-
12451231
struct prelim_drm_i915_vm_bind_ext_set_pat {
12461232
#define PRELIM_I915_VM_BIND_EXT_SET_PAT (PRELIM_I915_USER_EXT | 2)
12471233
struct i915_user_extension base;
@@ -1293,7 +1279,7 @@ struct prelim_drm_i915_gem_clos_free {
12931279
*/
12941280
struct prelim_drm_i915_gem_cache_reserve {
12951281
__u16 clos_index;
1296-
__u16 cache_level; // e.g. 3 for L3
1282+
__u16 cache_level; /* e.g. 3 for L3 */
12971283
__u16 num_ways;
12981284
__u16 pad16;
12991285
};

0 commit comments

Comments
 (0)