amdgpu: add amdgpu_cs_query_reset_state2 for AMDGPU_CTX_OP_QUERY_STATE2

This is a better GPU reset query.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
main
Marek Olšák 2019-10-09 19:18:08 -04:00
parent 9a61cf4e0e
commit 00320d7d68
3 changed files with 35 additions and 0 deletions

View File

@ -46,6 +46,7 @@ amdgpu_cs_fence_to_handle
amdgpu_cs_import_syncobj amdgpu_cs_import_syncobj
amdgpu_cs_query_fence_status amdgpu_cs_query_fence_status
amdgpu_cs_query_reset_state amdgpu_cs_query_reset_state
amdgpu_cs_query_reset_state2
amdgpu_query_sw_info amdgpu_query_sw_info
amdgpu_cs_signal_semaphore amdgpu_cs_signal_semaphore
amdgpu_cs_submit amdgpu_cs_submit

View File

@ -942,6 +942,21 @@ int amdgpu_cs_ctx_override_priority(amdgpu_device_handle dev,
int amdgpu_cs_query_reset_state(amdgpu_context_handle context, int amdgpu_cs_query_reset_state(amdgpu_context_handle context,
uint32_t *state, uint32_t *hangs); uint32_t *state, uint32_t *hangs);
/**
* Query reset state for the specific GPU Context.
*
* \param context - \c [in] GPU Context handle
* \param flags - \c [out] A combination of AMDGPU_CTX_QUERY2_FLAGS_*
*
* \return 0 on success\n
* <0 - Negative POSIX Error code
*
* \sa amdgpu_cs_ctx_create()
*
*/
int amdgpu_cs_query_reset_state2(amdgpu_context_handle context,
uint64_t *flags);
/* /*
* Command Buffers Management * Command Buffers Management
* *

View File

@ -188,6 +188,25 @@ drm_public int amdgpu_cs_query_reset_state(amdgpu_context_handle context,
return r; return r;
} }
drm_public int amdgpu_cs_query_reset_state2(amdgpu_context_handle context,
uint64_t *flags)
{
union drm_amdgpu_ctx args;
int r;
if (!context)
return -EINVAL;
memset(&args, 0, sizeof(args));
args.in.op = AMDGPU_CTX_OP_QUERY_STATE2;
args.in.ctx_id = context->id;
r = drmCommandWriteRead(context->dev->fd, DRM_AMDGPU_CTX,
&args, sizeof(args));
if (!r)
*flags = args.out.state.flags;
return r;
}
/** /**
* Submit command to kernel DRM * Submit command to kernel DRM
* \param dev - \c [in] Device handle * \param dev - \c [in] Device handle