mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-22 17:36:20 +03:00
gpu: nvgpu: add user fence type
Decouple the fence information needed for providing submit postfences to userspace by adding a separate type for that and using it to pass fence data to ioctls. The data in struct nvgpu_fence_type is used in various places: - job tracking needs to know when a post fence is expired - job submitters within the driver (vidmem clears) need to be able to wait for these fences - userspace needs the fence as an id, value pair or as a file descriptor created from an os fence To keep object lifetimes strict, start decoupling the os fence data out of struct nvgpu_fence_type: delete nvgpu_fence_install_fd() and add nvgpu_fence_extract_user() to return a struct nvgpu_user_fence that contains only the necessary information. Storing the os fence in job tracking metadata is legacy code and not useful. Passing the os fence from where it's created through the whole submit path inside this combined fence type has been convenient, though. The internally stored cde job fence in dmabuf compression metadata is still nvgpu_fence_type to keep this patch simple. Jira NVGPU-5248 Change-Id: I75b7da676fb6aa083828f888c55571bbf7645ef3 Signed-off-by: Konsta Hölttä <kholtta@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2359064 Reviewed-by: automaticguardword <automaticguardword@nvidia.com> Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com> Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com> Reviewed-by: Alex Waterman <alexw@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com> GVS: Gerrit_Virtual_Submit
This commit is contained in:
committed by
Alex Waterman
parent
8c224adb91
commit
ca1f93bdd7
@@ -52,6 +52,7 @@
|
||||
#include <nvgpu/channel_sync_syncpt.h>
|
||||
#include <nvgpu/soc.h>
|
||||
#include <nvgpu/nvgpu_init.h>
|
||||
#include <nvgpu/user_fence.h>
|
||||
|
||||
#include "ioctl_ctrl.h"
|
||||
#include "ioctl_dbg.h"
|
||||
@@ -442,7 +443,7 @@ static int gk20a_ctrl_prepare_compressible_read(
|
||||
#ifdef CONFIG_NVGPU_SUPPORT_CDE
|
||||
struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
|
||||
struct nvgpu_channel_fence fence;
|
||||
struct nvgpu_fence_type *fence_out = NULL;
|
||||
struct nvgpu_user_fence fence_out = nvgpu_user_fence_init();
|
||||
int submit_flags = nvgpu_submit_gpfifo_user_flags_to_common_flags(
|
||||
args->submit_flags);
|
||||
int fd = -1;
|
||||
@@ -472,31 +473,31 @@ static int gk20a_ctrl_prepare_compressible_read(
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Convert fence_out to something we can pass back to user space. */
|
||||
/*
|
||||
* Convert fence_out, if any, to something we can pass back to user
|
||||
* space. Even if successful, the fence may not exist if there was
|
||||
* nothing to be done (no compbits requested); that's not an error.
|
||||
*/
|
||||
if (submit_flags & NVGPU_SUBMIT_FLAGS_FENCE_GET) {
|
||||
if (submit_flags & NVGPU_SUBMIT_FLAGS_SYNC_FENCE) {
|
||||
if (fence_out) {
|
||||
ret = nvgpu_fence_install_fd(fence_out, fd);
|
||||
if (ret)
|
||||
if (nvgpu_os_fence_is_initialized(&fence_out.os_fence)) {
|
||||
ret = fence_out.os_fence.ops->install_fence(
|
||||
&fence_out.os_fence, fd);
|
||||
if (ret) {
|
||||
put_unused_fd(fd);
|
||||
else
|
||||
args->fence.fd = fd;
|
||||
fd = -1;
|
||||
}
|
||||
} else {
|
||||
args->fence.fd = -1;
|
||||
put_unused_fd(fd);
|
||||
fd = -1;
|
||||
}
|
||||
args->fence.fd = fd;
|
||||
} else {
|
||||
if (fence_out) {
|
||||
args->fence.syncpt_id = fence_out->syncpt_id;
|
||||
args->fence.syncpt_value =
|
||||
fence_out->syncpt_value;
|
||||
} else {
|
||||
args->fence.syncpt_id = NVGPU_INVALID_SYNCPT_ID;
|
||||
args->fence.syncpt_value = 0;
|
||||
}
|
||||
args->fence.syncpt_id = fence_out.syncpt_id;
|
||||
args->fence.syncpt_value = fence_out.syncpt_value;
|
||||
}
|
||||
nvgpu_user_fence_release(&fence_out);
|
||||
}
|
||||
nvgpu_fence_put(fence_out);
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
|
||||
Reference in New Issue
Block a user