XenevaOS
Loading...
Searching...
No Matches
Public Attributes | List of all members
i915_context_param_engines Struct Reference

#include <i915_drm.h>

Collaboration diagram for i915_context_param_engines:
Collaboration graph
[legend]

Public Attributes

__u64 extensions
 
struct i915_engine_class_instance engines []
 

Detailed Description

DOC: Context Engine Map uAPI

Context engine map is a new way of addressing engines when submitting batch- buffers, replacing the existing way of using identifiers like I915_EXEC_BLT inside the flags field of struct drm_i915_gem_execbuffer2.

To use it created GEM contexts need to be configured with a list of engines the user is intending to submit to. This is accomplished using the I915_CONTEXT_PARAM_ENGINES parameter and struct i915_context_param_engines.

For such contexts the I915_EXEC_RING_MASK field becomes an index into the configured map.

Example of creating such context and submitting against it:

.. code-block:: C

I915_DEFINE_CONTEXT_PARAM_ENGINES(engines, 2) = {
    .engines = { { I915_ENGINE_CLASS_RENDER, 0 },
             { I915_ENGINE_CLASS_COPY, 0 } }
};
struct drm_i915_gem_context_create_ext_setparam p_engines = {
    .base = {
        .name = I915_CONTEXT_CREATE_EXT_SETPARAM,
    },
    .param = {
        .param = I915_CONTEXT_PARAM_ENGINES,
        .value = to_user_pointer(&engines),
        .size = sizeof(engines),
    },
};
struct drm_i915_gem_context_create_ext create = {
    .flags = I915_CONTEXT_CREATE_FLAGS_USE_EXTENSIONS,
    .extensions = to_user_pointer(&p_engines);
};

ctx_id = gem_context_create_ext(drm_fd, &create);

// We have now created a GEM context with two engines in the map:
// Index 0 points to rcs0 while index 1 points to bcs0. Other engines
// will not be accessible from this context.

...
execbuf.rsvd1 = ctx_id;
execbuf.flags = 0; // Submits to index 0, which is rcs0 for this context
gem_execbuf(drm_fd, &execbuf);

...
execbuf.rsvd1 = ctx_id;
execbuf.flags = 1; // Submits to index 0, which is bcs0 for this context
gem_execbuf(drm_fd, &execbuf);

Member Data Documentation

◆ engines

struct i915_engine_class_instance i915_context_param_engines::engines[]

◆ extensions

__u64 i915_context_param_engines::extensions

The documentation for this struct was generated from the following file: