diff options
author | Vedashree Vidwans <vvidwans@nvidia.com> | 2019-08-07 17:07:57 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2019-08-30 04:24:52 -0400 |
commit | 84f48df530a6ce0423920ebd8fd4e1dde52dd09f (patch) | |
tree | 71c596e18d0e8e35f1cdb6d6fe3f641a216c7203 | |
parent | 6500ce7581b7fa2360657a8e58d327e0cf311f25 (diff) |
gpu: nvgpu: use vpr resize API
This patch adds nvgpu API in linux and qnx to query vpr resize.
The new API nvgpu_is_vpr_resize_enabled() is used in
nvgpu_submit_channel_gpfifo().
Previously, if non-deterministic channel has timeout disabled and
GPU cannot railgate on some platform, then channel doesn't power ref
count and results in video freeze. This requires non-determinstic
channel job tracking to be enabled if vpr resize is supported or if GPU
can railgate.
Bug 200532122
Change-Id: Icfbff6253762b195b2f5955749343974b1a7a269
Signed-off-by: Vedashree Vidwans <vvidwans@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2167082
Reviewed-on: https://git-master.nvidia.com/r/2180581
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
-rw-r--r-- | drivers/gpu/nvgpu/Makefile | 3 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/Makefile.sources | 1 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/common/fifo/submit.c | 9 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/include/nvgpu/vpr.h | 30 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/os/linux/vpr.c | 22 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/os/posix/posix-vpr.c | 19 |
6 files changed, 80 insertions, 4 deletions
diff --git a/drivers/gpu/nvgpu/Makefile b/drivers/gpu/nvgpu/Makefile index bec1809b..aad186ec 100644 --- a/drivers/gpu/nvgpu/Makefile +++ b/drivers/gpu/nvgpu/Makefile | |||
@@ -95,7 +95,8 @@ nvgpu-y += \ | |||
95 | os/linux/nvlink.o \ | 95 | os/linux/nvlink.o \ |
96 | os/linux/dt.o \ | 96 | os/linux/dt.o \ |
97 | os/linux/ecc_sysfs.o \ | 97 | os/linux/ecc_sysfs.o \ |
98 | os/linux/ltc.o | 98 | os/linux/ltc.o \ |
99 | os/linux/vpr.o | ||
99 | 100 | ||
100 | nvgpu-$(CONFIG_GK20A_VIDMEM) += \ | 101 | nvgpu-$(CONFIG_GK20A_VIDMEM) += \ |
101 | os/linux/dmabuf_vidmem.o | 102 | os/linux/dmabuf_vidmem.o |
diff --git a/drivers/gpu/nvgpu/Makefile.sources b/drivers/gpu/nvgpu/Makefile.sources index 03bc8bcd..99f3b69b 100644 --- a/drivers/gpu/nvgpu/Makefile.sources +++ b/drivers/gpu/nvgpu/Makefile.sources | |||
@@ -44,6 +44,7 @@ srcs := os/posix/nvgpu.c \ | |||
44 | os/posix/nvlink.c \ | 44 | os/posix/nvlink.c \ |
45 | os/posix/lock.c \ | 45 | os/posix/lock.c \ |
46 | os/posix/stubs.c \ | 46 | os/posix/stubs.c \ |
47 | os/posix/posix-vpr.c \ | ||
47 | common/mm/nvgpu_allocator.c \ | 48 | common/mm/nvgpu_allocator.c \ |
48 | common/mm/bitmap_allocator.c \ | 49 | common/mm/bitmap_allocator.c \ |
49 | common/mm/buddy_allocator.c \ | 50 | common/mm/buddy_allocator.c \ |
diff --git a/drivers/gpu/nvgpu/common/fifo/submit.c b/drivers/gpu/nvgpu/common/fifo/submit.c index 4effc663..d518fbfb 100644 --- a/drivers/gpu/nvgpu/common/fifo/submit.c +++ b/drivers/gpu/nvgpu/common/fifo/submit.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. | 2 | * Copyright (c) 2018-2019, NVIDIA CORPORATION. All rights reserved. |
3 | * | 3 | * |
4 | * Permission is hereby granted, free of charge, to any person obtaining a | 4 | * Permission is hereby granted, free of charge, to any person obtaining a |
5 | * copy of this software and associated documentation files (the "Software"), | 5 | * copy of this software and associated documentation files (the "Software"), |
@@ -26,6 +26,7 @@ | |||
26 | #include <nvgpu/os_sched.h> | 26 | #include <nvgpu/os_sched.h> |
27 | #include <nvgpu/utils.h> | 27 | #include <nvgpu/utils.h> |
28 | #include <nvgpu/channel_sync.h> | 28 | #include <nvgpu/channel_sync.h> |
29 | #include <nvgpu/vpr.h> | ||
29 | 30 | ||
30 | #include <nvgpu/hw/gk20a/hw_pbdma_gk20a.h> | 31 | #include <nvgpu/hw/gk20a/hw_pbdma_gk20a.h> |
31 | 32 | ||
@@ -387,6 +388,7 @@ static int nvgpu_submit_channel_gpfifo(struct channel_gk20a *c, | |||
387 | * - pre- or post-fence functionality | 388 | * - pre- or post-fence functionality |
388 | * - channel wdt | 389 | * - channel wdt |
389 | * - GPU rail-gating with non-deterministic channels | 390 | * - GPU rail-gating with non-deterministic channels |
391 | * - VPR resize enabled with non-deterministic channels | ||
390 | * - buffer refcounting | 392 | * - buffer refcounting |
391 | * | 393 | * |
392 | * If none of the conditions are met, then job tracking is not | 394 | * If none of the conditions are met, then job tracking is not |
@@ -396,8 +398,9 @@ static int nvgpu_submit_channel_gpfifo(struct channel_gk20a *c, | |||
396 | need_job_tracking = (flags & NVGPU_SUBMIT_FLAGS_FENCE_WAIT) || | 398 | need_job_tracking = (flags & NVGPU_SUBMIT_FLAGS_FENCE_WAIT) || |
397 | (flags & NVGPU_SUBMIT_FLAGS_FENCE_GET) || | 399 | (flags & NVGPU_SUBMIT_FLAGS_FENCE_GET) || |
398 | c->timeout.enabled || | 400 | c->timeout.enabled || |
399 | (nvgpu_is_enabled(g, NVGPU_CAN_RAILGATE) | 401 | ((nvgpu_is_enabled(g, NVGPU_CAN_RAILGATE) || |
400 | && !c->deterministic) || | 402 | nvgpu_is_vpr_resize_enabled()) && |
403 | !c->deterministic) || | ||
401 | !skip_buffer_refcounting; | 404 | !skip_buffer_refcounting; |
402 | 405 | ||
403 | if (need_job_tracking) { | 406 | if (need_job_tracking) { |
diff --git a/drivers/gpu/nvgpu/include/nvgpu/vpr.h b/drivers/gpu/nvgpu/include/nvgpu/vpr.h new file mode 100644 index 00000000..ae0ac1b4 --- /dev/null +++ b/drivers/gpu/nvgpu/include/nvgpu/vpr.h | |||
@@ -0,0 +1,30 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. | ||
3 | * | ||
4 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
5 | * copy of this software and associated documentation files (the "Software"), | ||
6 | * to deal in the Software without restriction, including without limitation | ||
7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
8 | * and/or sell copies of the Software, and to permit persons to whom the | ||
9 | * Software is furnished to do so, subject to the following conditions: | ||
10 | * | ||
11 | * The above copyright notice and this permission notice shall be included in | ||
12 | * all copies or substantial portions of the Software. | ||
13 | * | ||
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
17 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
20 | * DEALINGS IN THE SOFTWARE. | ||
21 | */ | ||
22 | |||
23 | #ifndef NVGPU_VPR_H | ||
24 | #define NVGPU_VPR_H | ||
25 | |||
26 | #include <nvgpu/types.h> | ||
27 | |||
28 | bool nvgpu_is_vpr_resize_enabled(void); | ||
29 | |||
30 | #endif /* NVGPU_VPR_H */ | ||
diff --git a/drivers/gpu/nvgpu/os/linux/vpr.c b/drivers/gpu/nvgpu/os/linux/vpr.c new file mode 100644 index 00000000..3a981250 --- /dev/null +++ b/drivers/gpu/nvgpu/os/linux/vpr.c | |||
@@ -0,0 +1,22 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms and conditions of the GNU General Public License, | ||
6 | * version 2, as published by the Free Software Foundation. | ||
7 | * | ||
8 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
11 | * more details. | ||
12 | */ | ||
13 | |||
14 | #include <nvgpu/vpr.h> | ||
15 | |||
16 | #include <linux/init.h> | ||
17 | #include <linux/platform/tegra/common.h> | ||
18 | |||
19 | bool nvgpu_is_vpr_resize_enabled(void) | ||
20 | { | ||
21 | return tegra_is_vpr_resize_supported(); | ||
22 | } | ||
diff --git a/drivers/gpu/nvgpu/os/posix/posix-vpr.c b/drivers/gpu/nvgpu/os/posix/posix-vpr.c new file mode 100644 index 00000000..07486b1a --- /dev/null +++ b/drivers/gpu/nvgpu/os/posix/posix-vpr.c | |||
@@ -0,0 +1,19 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms and conditions of the GNU General Public License, | ||
6 | * version 2, as published by the Free Software Foundation. | ||
7 | * | ||
8 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
11 | * more details. | ||
12 | */ | ||
13 | |||
14 | #include <nvgpu/vpr.h> | ||
15 | |||
16 | bool nvgpu_is_vpr_resize_enabled(void) | ||
17 | { | ||
18 | return false; | ||
19 | } | ||