mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-24 10:34:43 +03:00
gpu: nvgpu: move syncpt priv cmd allocation
channel_sync_syncpt_gen_wait_cmd() is rather simple now and is called from two places where one has the buf preallocated and the other doesn't. Remove the preallocated flag from the function, moving the allocation to the single place where it is needed. Jira NVGPU-4548 Change-Id: I48083f4f6f1093d64b67c63582291392a3481932 Signed-off-by: Konsta Hölttä <kholtta@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2325101 (cherry picked from commit afb566721e2b4c15349ff79d51f5eddc49b66014) Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2331338 Reviewed-by: automaticguardword <automaticguardword@nvidia.com> Reviewed-by: Automatic_Commit_Validation_User 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> GVS: Gerrit_Virtual_Submit Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
Alex Waterman
parent
4acf78dff3
commit
aa1322f975
@@ -56,27 +56,14 @@ nvgpu_channel_sync_syncpt_from_base(struct nvgpu_channel_sync *base)
|
||||
offsetof(struct nvgpu_channel_sync_syncpt, base));
|
||||
}
|
||||
|
||||
static int channel_sync_syncpt_gen_wait_cmd(struct nvgpu_channel *c,
|
||||
static void channel_sync_syncpt_gen_wait_cmd(struct nvgpu_channel *c,
|
||||
u32 id, u32 thresh, struct priv_cmd_entry *wait_cmd,
|
||||
u32 wait_cmd_size, bool preallocated)
|
||||
u32 wait_cmd_size)
|
||||
{
|
||||
int err = 0;
|
||||
|
||||
if (!preallocated) {
|
||||
err = nvgpu_channel_alloc_priv_cmdbuf(c,
|
||||
c->g->ops.sync.syncpt.get_wait_cmd_size(),
|
||||
wait_cmd);
|
||||
if (err != 0) {
|
||||
nvgpu_err(c->g, "not enough priv cmd buffer space");
|
||||
return err;
|
||||
}
|
||||
}
|
||||
nvgpu_log(c->g, gpu_dbg_info, "sp->id %d gpu va %llx",
|
||||
id, c->vm->syncpt_ro_map_gpu_va);
|
||||
c->g->ops.sync.syncpt.add_wait_cmd(c->g, wait_cmd, id, thresh,
|
||||
c->vm->syncpt_ro_map_gpu_va);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int channel_sync_syncpt_wait_raw(struct nvgpu_channel_sync_syncpt *s,
|
||||
@@ -90,10 +77,18 @@ static int channel_sync_syncpt_wait_raw(struct nvgpu_channel_sync_syncpt *s,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
err = channel_sync_syncpt_gen_wait_cmd(c, id, thresh,
|
||||
wait_cmd, wait_cmd_size, false);
|
||||
err = nvgpu_channel_alloc_priv_cmdbuf(c,
|
||||
c->g->ops.sync.syncpt.get_wait_cmd_size(),
|
||||
wait_cmd);
|
||||
if (err != 0) {
|
||||
nvgpu_err(c->g, "not enough priv cmd buffer space");
|
||||
return err;
|
||||
}
|
||||
|
||||
return err;
|
||||
channel_sync_syncpt_gen_wait_cmd(c, id, thresh,
|
||||
wait_cmd, wait_cmd_size);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int channel_sync_syncpt_wait_fd(struct nvgpu_channel_sync *s, int fd,
|
||||
@@ -152,8 +147,8 @@ static int channel_sync_syncpt_wait_fd(struct nvgpu_channel_sync *s, int fd,
|
||||
for (i = 0; i < num_fences; i++) {
|
||||
nvgpu_os_fence_syncpt_extract_nth_syncpt(
|
||||
&os_fence_syncpt, i, &syncpt_id, &syncpt_thresh);
|
||||
err = channel_sync_syncpt_gen_wait_cmd(c, syncpt_id,
|
||||
syncpt_thresh, wait_cmd, wait_cmd_size, true);
|
||||
channel_sync_syncpt_gen_wait_cmd(c, syncpt_id,
|
||||
syncpt_thresh, wait_cmd, wait_cmd_size);
|
||||
}
|
||||
|
||||
cleanup:
|
||||
|
||||
Reference in New Issue
Block a user