mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2024-12-02 14:43:59 +08:00
anv: disable protected content around surface state copies
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: 794b0496e9
("anv: enable protected memory")
Reviewed-by: Rohan Garg <rohan.garg@intel.com>
Tested-by: Mark Janes <markjanes@swizzler.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26540>
This commit is contained in:
parent
27a3771227
commit
034a1cdb58
@ -2787,6 +2787,33 @@ genX(cmd_buffer_begin_companion)(struct anv_cmd_buffer *cmd_buffer,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
genX(cmd_buffer_set_protected_memory)(struct anv_cmd_buffer *cmd_buffer,
|
||||
bool enabled)
|
||||
{
|
||||
#if GFX_VER >= 12
|
||||
if (enabled) {
|
||||
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.PipeControlFlushEnable = true;
|
||||
pc.DCFlushEnable = true;
|
||||
pc.RenderTargetCacheFlushEnable = true;
|
||||
pc.CommandStreamerStallEnable = true;
|
||||
if (enabled)
|
||||
pc.ProtectedMemoryEnable = true;
|
||||
else
|
||||
pc.ProtectedMemoryDisable = true;
|
||||
}
|
||||
#else
|
||||
unreachable("Protected content not supported");
|
||||
#endif
|
||||
}
|
||||
|
||||
VkResult
|
||||
genX(BeginCommandBuffer)(
|
||||
VkCommandBuffer commandBuffer,
|
||||
@ -2861,19 +2888,8 @@ genX(BeginCommandBuffer)(
|
||||
|
||||
#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;
|
||||
}
|
||||
}
|
||||
cmd_buffer->vk.pool->flags & VK_COMMAND_POOL_CREATE_PROTECTED_BIT)
|
||||
genX(cmd_buffer_set_protected_memory)(cmd_buffer, true);
|
||||
#endif
|
||||
|
||||
if (cmd_buffer->device->vk.enabled_extensions.EXT_descriptor_buffer) {
|
||||
@ -3092,14 +3108,8 @@ end_command_buffer(struct anv_cmd_buffer *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;
|
||||
}
|
||||
}
|
||||
cmd_buffer->vk.pool->flags & VK_COMMAND_POOL_CREATE_PROTECTED_BIT)
|
||||
genX(cmd_buffer_set_protected_memory)(cmd_buffer, false);
|
||||
#endif
|
||||
|
||||
trace_intel_end_cmd_buffer(&cmd_buffer->trace, cmd_buffer->vk.level);
|
||||
@ -3212,6 +3222,9 @@ genX(CmdExecuteCommands)(
|
||||
}
|
||||
|
||||
if (need_surface_state_copy) {
|
||||
if (container->vk.pool->flags & VK_COMMAND_POOL_CREATE_PROTECTED_BIT)
|
||||
genX(cmd_buffer_set_protected_memory)(container, false);
|
||||
|
||||
/* The memcpy will take care of the 3D preemption requirements. */
|
||||
struct anv_memcpy_state memcpy_state;
|
||||
genX(emit_so_memcpy_init)(&memcpy_state, device, &container->batch);
|
||||
@ -3242,6 +3255,9 @@ genX(CmdExecuteCommands)(
|
||||
}
|
||||
}
|
||||
genX(emit_so_memcpy_fini)(&memcpy_state);
|
||||
|
||||
if (container->vk.pool->flags & VK_COMMAND_POOL_CREATE_PROTECTED_BIT)
|
||||
genX(cmd_buffer_set_protected_memory)(container, true);
|
||||
}
|
||||
|
||||
/* Ensure preemption is enabled (assumption for all secondary) */
|
||||
|
Loading…
Reference in New Issue
Block a user