summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.h
diff options
context:
space:
mode:
authorArto Merilainen <amerilainen@nvidia.com>2014-03-19 03:38:25 -0400
committerDan Willemsen <dwillemsen@nvidia.com>2015-03-18 15:08:53 -0400
commita9785995d5f22aaeb659285f8aeb64d8b56982e0 (patch)
treecc75f75bcf43db316a002a7a240b81f299bf6d7f /drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.h
parent61efaf843c22b85424036ec98015121c08f5f16c (diff)
gpu: nvgpu: Add NVIDIA GPU Driver
This patch moves the NVIDIA GPU driver to a new location. Bug 1482562 Change-Id: I24293810b9d0f1504fd9be00135e21dad656ccb6 Signed-off-by: Arto Merilainen <amerilainen@nvidia.com> Reviewed-on: http://git-master/r/383722 Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.h')
-rw-r--r--drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.h102
1 files changed, 102 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.h b/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.h
new file mode 100644
index 00000000..69feb89f
--- /dev/null
+++ b/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.h
@@ -0,0 +1,102 @@
1/*
2 * drivers/video/tegra/host/gk20a/channel_sync_gk20a.h
3 *
4 * GK20A Channel Synchronization Abstraction
5 *
6 * Copyright (c) 2014, NVIDIA CORPORATION. All rights reserved.
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms and conditions of the GNU General Public License,
10 * version 2, as published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 * more details.
16 */
17
18#ifndef _GK20A_CHANNEL_SYNC_H_
19#define _GK20A_CHANNEL_SYNC_H_
20
21#include <linux/types.h>
22
23struct gk20a_channel_sync;
24struct priv_cmd_entry;
25struct channel_gk20a;
26
27struct gk20a_channel_fence {
28 bool valid;
29 bool wfi; /* was issued with preceding wfi */
30 u32 thresh; /* either semaphore or syncpoint value */
31};
32
33struct gk20a_channel_sync {
34 /* CPU wait for a fence returned by incr_syncpt() or incr_fd(). */
35 int (*wait_cpu)(struct gk20a_channel_sync *s,
36 struct gk20a_channel_fence *fence,
37 int timeout);
38
39 /* Test whether a fence returned by incr_syncpt() or incr_fd() is
40 * expired. */
41 bool (*is_expired)(struct gk20a_channel_sync *s,
42 struct gk20a_channel_fence *fence);
43
44 /* Generate a gpu wait cmdbuf from syncpoint. */
45 int (*wait_syncpt)(struct gk20a_channel_sync *s, u32 id, u32 thresh,
46 struct priv_cmd_entry **entry);
47
48 /* Generate a gpu wait cmdbuf from sync fd. */
49 int (*wait_fd)(struct gk20a_channel_sync *s, int fd,
50 struct priv_cmd_entry **entry);
51
52 /* Increment syncpoint/semaphore.
53 * Returns
54 * - a gpu cmdbuf that performs the increment when executed,
55 * - a fence that can be passed to wait_cpu() and is_expired().
56 */
57 int (*incr)(struct gk20a_channel_sync *s,
58 struct priv_cmd_entry **entry,
59 struct gk20a_channel_fence *fence);
60
61 /* Increment syncpoint/semaphore, preceded by a wfi.
62 * Returns
63 * - a gpu cmdbuf that performs the increment when executed,
64 * - a fence that can be passed to wait_cpu() and is_expired().
65 */
66 int (*incr_wfi)(struct gk20a_channel_sync *s,
67 struct priv_cmd_entry **entry,
68 struct gk20a_channel_fence *fence);
69
70 /* Increment syncpoint, so that the returned fence represents
71 * work completion (may need wfi) and can be returned to user space.
72 * Returns
73 * - a gpu cmdbuf that performs the increment when executed,
74 * - a fence that can be passed to wait_cpu() and is_expired(),
75 * - a syncpoint id/value pair that can be returned to user space.
76 */
77 int (*incr_user_syncpt)(struct gk20a_channel_sync *s,
78 struct priv_cmd_entry **entry,
79 struct gk20a_channel_fence *fence,
80 u32 *id, u32 *thresh);
81
82 /* Increment syncpoint/semaphore, so that the returned fence represents
83 * work completion (may need wfi) and can be returned to user space.
84 * Returns
85 * - a gpu cmdbuf that performs the increment when executed,
86 * - a fence that can be passed to wait_cpu() and is_expired(),
87 * - a sync fd that can be returned to user space.
88 */
89 int (*incr_user_fd)(struct gk20a_channel_sync *s,
90 struct priv_cmd_entry **entry,
91 struct gk20a_channel_fence *fence,
92 int *fd);
93
94 /* Reset the channel syncpoint/semaphore. */
95 void (*set_min_eq_max)(struct gk20a_channel_sync *s);
96
97 /* Free the resources allocated by gk20a_channel_sync_create. */
98 void (*destroy)(struct gk20a_channel_sync *s);
99};
100
101struct gk20a_channel_sync *gk20a_channel_sync_create(struct channel_gk20a *c);
102#endif