anv: Emit protection + session ID on protected command buffers

v2: Add the missing PIPE_CONTROL enable/disable bits

v3: Use new I915_PROTECTED_CONTENT_DEFAULT_SESSION

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/8064>
This commit is contained in:
Lionel Landwerlin 2020-12-10 16:01:31 +02:00 committed by Marge Bot
parent be327b1452
commit be201008ca
3 changed files with 33 additions and 0 deletions

View file

@ -1648,6 +1648,8 @@ struct anv_device {
bool robust_buffer_access;
uint32_t protected_session_id;
/** Shadow ray query BO
*
* The ray_query_bo only holds the current ray being traced. When using

View file

@ -3332,6 +3332,23 @@ genX(BeginCommandBuffer)(
anv_cmd_buffer_is_blitter_queue(cmd_buffer))
return VK_SUCCESS;
#if GFX_VER >= 12
if (cmd_buffer->vk.level == VK_COMMAND_BUFFER_LEVEL_PRIMARY &&
cmd_buffer->vk.pool->flags & VK_COMMAND_POOL_CREATE_PROTECTED_BIT) {
anv_batch_emit(&cmd_buffer->batch, GENX(MI_SET_APPID), appid) {
/* Default value for single session. */
appid.ProtectedMemoryApplicationID = cmd_buffer->device->protected_session_id;
appid.ProtectedMemoryApplicationIDType = DISPLAY_APP;
}
anv_batch_emit(&cmd_buffer->batch, GENX(PIPE_CONTROL), pc) {
pc.CommandStreamerStallEnable = true;
pc.DCFlushEnable = true;
pc.RenderTargetCacheFlushEnable = true;
pc.ProtectedMemoryEnable = true;
}
}
#endif
genX(cmd_buffer_emit_state_base_address)(cmd_buffer);
/* We sometimes store vertex data in the dynamic state buffer for blorp
@ -3540,6 +3557,18 @@ end_command_buffer(struct anv_cmd_buffer *cmd_buffer)
emit_isp_disable(cmd_buffer);
#if GFX_VER >= 12
if (cmd_buffer->vk.level == VK_COMMAND_BUFFER_LEVEL_PRIMARY &&
cmd_buffer->vk.pool->flags & VK_COMMAND_POOL_CREATE_PROTECTED_BIT) {
anv_batch_emit(&cmd_buffer->batch, GENX(PIPE_CONTROL), pc) {
pc.CommandStreamerStallEnable = true;
pc.DCFlushEnable = true;
pc.RenderTargetCacheFlushEnable = true;
pc.ProtectedMemoryDisable = true;
}
}
#endif
trace_intel_end_cmd_buffer(&cmd_buffer->trace, cmd_buffer->vk.level);
anv_cmd_buffer_end_batch_buffer(cmd_buffer);

View file

@ -264,6 +264,8 @@ anv_i915_device_setup_context(struct anv_device *device,
const VkDeviceCreateInfo *pCreateInfo,
const uint32_t num_queues)
{
device->protected_session_id = I915_PROTECTED_CONTENT_DEFAULT_SESSION;
if (device->physical->has_vm_control)
return anv_i915_device_setup_vm(device);