mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 11:08:03 +02:00
intel: enable protected context creation along with engines
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: José Roberto de Souza <jose.souza@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22898>
This commit is contained in:
parent
cbc1c6a16f
commit
cb8a878b53
7 changed files with 43 additions and 12 deletions
|
|
@ -168,8 +168,12 @@ iris_create_engines_context(struct iris_context *ice)
|
|||
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;
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ 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)
|
||||
|
|
@ -115,19 +116,41 @@ i915_gem_create_context_engines(int fd,
|
|||
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;
|
||||
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@
|
|||
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);
|
||||
|
|
|
|||
|
|
@ -74,11 +74,12 @@ 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)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -167,10 +167,16 @@ intel_gem_read_render_timestamp(int fd, enum intel_kmd_type kmd_type,
|
|||
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);
|
||||
|
|
@ -186,10 +192,6 @@ bool intel_gem_get_param(int fd, uint32_t param, int *value);
|
|||
}
|
||||
#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,
|
||||
|
|
|
|||
|
|
@ -150,7 +150,7 @@ anv_i915_device_setup_context(struct anv_device *device,
|
|||
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))
|
||||
|
|
|
|||
|
|
@ -2625,7 +2625,7 @@ anv_device_setup_context(struct anv_device *device,
|
|||
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))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue