intel_engines_count(engines_info, INTEL_ENGINE_CLASS_COMPUTE) > 0)
engine_classes[IRIS_BATCH_COMPUTE] = INTEL_ENGINE_CLASS_COMPUTE;
+ enum intel_gem_create_context_flags flags = 0;
+ if (ice->protected)
+ flags |= INTEL_GEM_CREATE_CONTEXT_EXT_PROTECTED_FLAG;
+
uint32_t engines_ctx;
- if (!intel_gem_create_context_engines(fd, engines_info, num_batches,
+ if (!intel_gem_create_context_engines(fd, flags, engines_info, num_batches,
engine_classes, &engines_ctx)) {
free(engines_info);
return -1;
bool
i915_gem_create_context_engines(int fd,
+ enum intel_gem_create_context_flags flags,
const struct intel_query_engine_info *info,
int num_engines, enum intel_engine_class *engine_classes,
uint32_t *context_id)
uint32_t size = sizeof(engines_param.extensions);
size += sizeof(engines_param.engines[0]) * num_engines;
struct drm_i915_gem_context_create_ext_setparam set_engines = {
- .base = {
- .name = I915_CONTEXT_CREATE_EXT_SETPARAM,
- },
.param = {
.param = I915_CONTEXT_PARAM_ENGINES,
.value = (uintptr_t)&engines_param,
.size = size,
}
};
+ struct drm_i915_gem_context_create_ext_setparam protected_param = {
+ .param = {
+ .param = I915_CONTEXT_PARAM_PROTECTED_CONTENT,
+ .value = flags & INTEL_GEM_CREATE_CONTEXT_EXT_PROTECTED_FLAG,
+ },
+ };
+ struct drm_i915_gem_context_create_ext_setparam recoverable_param = {
+ .param = {
+ .param = I915_CONTEXT_PARAM_RECOVERABLE,
+ .value = flags & INTEL_GEM_CREATE_CONTEXT_EXT_RECOVERABLE_FLAG,
+ },
+ };
struct drm_i915_gem_context_create_ext create = {
.flags = I915_CONTEXT_CREATE_FLAGS_USE_EXTENSIONS,
- .extensions = (uintptr_t)&set_engines,
};
+
+ intel_gem_add_ext(&create.extensions,
+ I915_CONTEXT_CREATE_EXT_SETPARAM,
+ &set_engines.base);
+ intel_gem_add_ext(&create.extensions,
+ I915_CONTEXT_CREATE_EXT_SETPARAM,
+ &recoverable_param.base);
+
+ if (flags & INTEL_GEM_CREATE_CONTEXT_EXT_PROTECTED_FLAG) {
+ intel_gem_add_ext(&create.extensions,
+ I915_CONTEXT_CREATE_EXT_SETPARAM,
+ &protected_param.base);
+ }
+
if (intel_ioctl(fd, DRM_IOCTL_I915_GEM_CONTEXT_CREATE_EXT, &create) == -1)
return false;
bool i915_gem_create_context(int fd, uint32_t *context_id);
bool i915_gem_destroy_context(int fd, uint32_t context_id);
bool i915_gem_create_context_engines(int fd,
+ enum intel_gem_create_context_flags flags,
const struct intel_query_engine_info *info,
int num_engines, enum intel_engine_class *engine_classes,
uint32_t *context_id);
bool
intel_gem_create_context_engines(int fd,
+ enum intel_gem_create_context_flags flags,
const struct intel_query_engine_info *info,
int num_engines, enum intel_engine_class *engine_classes,
uint32_t *context_id)
{
- return i915_gem_create_context_engines(fd, info, num_engines,
+ return i915_gem_create_context_engines(fd, flags, info, num_engines,
engine_classes, context_id);
}
bool intel_gem_can_render_on_fd(int fd, enum intel_kmd_type kmd_type);
/* Functions only used by i915 */
+enum intel_gem_create_context_flags {
+ INTEL_GEM_CREATE_CONTEXT_EXT_RECOVERABLE_FLAG = BITFIELD_BIT(0),
+ INTEL_GEM_CREATE_CONTEXT_EXT_PROTECTED_FLAG = BITFIELD_BIT(1),
+};
+
bool intel_gem_create_context(int fd, uint32_t *context_id);
bool intel_gem_destroy_context(int fd, uint32_t context_id);
bool
intel_gem_create_context_engines(int fd,
+ enum intel_gem_create_context_flags flags,
const struct intel_query_engine_info *info,
int num_engines, enum intel_engine_class *engine_classes,
uint32_t *context_id);
}
#endif
-enum intel_gem_create_context_flags {
- INTEL_GEM_CREATE_CONTEXT_EXT_RECOVERABLE_FLAG = BITFIELD_BIT(0),
- INTEL_GEM_CREATE_CONTEXT_EXT_PROTECTED_FLAG = BITFIELD_BIT(1),
-};
bool intel_gem_create_context_ext(int fd, enum intel_gem_create_context_flags flags,
uint32_t *ctx_id);
bool intel_gem_supports_protected_context(int fd,
for (uint32_t j = 0; j < queueCreateInfo->queueCount; j++)
engine_classes[engine_count++] = queue_family->engine_class;
}
- if (!intel_gem_create_context_engines(device->fd,
+ if (!intel_gem_create_context_engines(device->fd, 0 /* flags */,
physical_device->engine_info,
engine_count, engine_classes,
(uint32_t *)&device->context_id))
for (uint32_t j = 0; j < queueCreateInfo->queueCount; j++)
engine_classes[engine_count++] = queue_family->engine_class;
}
- if (!intel_gem_create_context_engines(device->fd,
+ if (!intel_gem_create_context_engines(device->fd, 0 /* flags */,
physical_device->engine_info,
engine_count, engine_classes,
(uint32_t *)&device->context_id))