diff options
author | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-22 10:38:37 -0500 |
---|---|---|
committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-22 10:38:37 -0500 |
commit | fcc9d2e5a6c89d22b8b773a64fb4ad21ac318446 (patch) | |
tree | a57612d1888735a2ec7972891b68c1ac5ec8faea /drivers/video/tegra/host/nvhost_job.h | |
parent | 8dea78da5cee153b8af9c07a2745f6c55057fe12 (diff) |
Diffstat (limited to 'drivers/video/tegra/host/nvhost_job.h')
-rw-r--r-- | drivers/video/tegra/host/nvhost_job.h | 150 |
1 files changed, 150 insertions, 0 deletions
diff --git a/drivers/video/tegra/host/nvhost_job.h b/drivers/video/tegra/host/nvhost_job.h new file mode 100644 index 00000000000..ad9d1af60da --- /dev/null +++ b/drivers/video/tegra/host/nvhost_job.h | |||
@@ -0,0 +1,150 @@ | |||
1 | /* | ||
2 | * drivers/video/tegra/host/nvhost_job.h | ||
3 | * | ||
4 | * Tegra Graphics Host Interrupt Management | ||
5 | * | ||
6 | * Copyright (c) 2011-2012, NVIDIA Corporation. | ||
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 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
19 | */ | ||
20 | |||
21 | #ifndef __NVHOST_JOB_H | ||
22 | #define __NVHOST_JOB_H | ||
23 | |||
24 | #include <linux/nvhost_ioctl.h> | ||
25 | |||
26 | struct nvhost_channel; | ||
27 | struct nvhost_hwctx; | ||
28 | struct nvmap_client; | ||
29 | struct nvhost_waitchk; | ||
30 | struct nvmap_handle; | ||
31 | |||
32 | /* | ||
33 | * Each submit is tracked as a nvhost_job. | ||
34 | */ | ||
35 | struct nvhost_job { | ||
36 | /* When refcount goes to zero, job can be freed */ | ||
37 | struct kref ref; | ||
38 | |||
39 | /* List entry */ | ||
40 | struct list_head list; | ||
41 | |||
42 | /* Channel where job is submitted to */ | ||
43 | struct nvhost_channel *ch; | ||
44 | |||
45 | /* Hardware context valid for this client */ | ||
46 | struct nvhost_hwctx *hwctx; | ||
47 | int clientid; | ||
48 | |||
49 | /* Nvmap to be used for pinning & unpinning memory */ | ||
50 | struct nvmap_client *nvmap; | ||
51 | |||
52 | /* Gathers and their memory */ | ||
53 | struct nvmap_handle_ref *gather_mem; | ||
54 | struct nvhost_channel_gather *gathers; | ||
55 | int num_gathers; | ||
56 | int gather_mem_size; | ||
57 | |||
58 | /* Wait checks to be processed at submit time */ | ||
59 | struct nvhost_waitchk *waitchk; | ||
60 | int num_waitchk; | ||
61 | u32 waitchk_mask; | ||
62 | |||
63 | /* Array of handles to be pinned & unpinned */ | ||
64 | struct nvmap_pinarray_elem *pinarray; | ||
65 | int num_pins; | ||
66 | struct nvmap_handle **unpins; | ||
67 | int num_unpins; | ||
68 | |||
69 | /* Sync point id, number of increments and end related to the submit */ | ||
70 | u32 syncpt_id; | ||
71 | u32 syncpt_incrs; | ||
72 | u32 syncpt_end; | ||
73 | |||
74 | /* Priority of this submit. */ | ||
75 | int priority; | ||
76 | |||
77 | /* Maximum time to wait for this job */ | ||
78 | int timeout; | ||
79 | |||
80 | /* Null kickoff prevents submit from being sent to hardware */ | ||
81 | bool null_kickoff; | ||
82 | |||
83 | /* Index and number of slots used in the push buffer */ | ||
84 | int first_get; | ||
85 | int num_slots; | ||
86 | |||
87 | /* Context to be freed */ | ||
88 | struct nvhost_hwctx *hwctxref; | ||
89 | }; | ||
90 | |||
91 | /* | ||
92 | * Allocate memory for a job. Just enough memory will be allocated to | ||
93 | * accomodate the submit announced in submit header. | ||
94 | */ | ||
95 | struct nvhost_job *nvhost_job_alloc(struct nvhost_channel *ch, | ||
96 | struct nvhost_hwctx *hwctx, | ||
97 | struct nvhost_submit_hdr_ext *hdr, | ||
98 | struct nvmap_client *nvmap, | ||
99 | int priority, int clientid); | ||
100 | |||
101 | /* | ||
102 | * Allocate memory for a job. Just enough memory will be allocated to | ||
103 | * accomodate the submit announced in submit header. Gather memory from | ||
104 | * oldjob will be reused, and nvhost_job_put() will be called to it. | ||
105 | */ | ||
106 | struct nvhost_job *nvhost_job_realloc(struct nvhost_job *oldjob, | ||
107 | struct nvhost_hwctx *hwctx, | ||
108 | struct nvhost_submit_hdr_ext *hdr, | ||
109 | struct nvmap_client *nvmap, | ||
110 | int priority, int clientid); | ||
111 | |||
112 | /* | ||
113 | * Add a gather to a job. | ||
114 | */ | ||
115 | void nvhost_job_add_gather(struct nvhost_job *job, | ||
116 | u32 mem_id, u32 words, u32 offset); | ||
117 | |||
118 | /* | ||
119 | * Increment reference going to nvhost_job. | ||
120 | */ | ||
121 | void nvhost_job_get(struct nvhost_job *job); | ||
122 | |||
123 | /* | ||
124 | * Increment reference for a hardware context. | ||
125 | */ | ||
126 | void nvhost_job_get_hwctx(struct nvhost_job *job, struct nvhost_hwctx *hwctx); | ||
127 | |||
128 | /* | ||
129 | * Decrement reference job, free if goes to zero. | ||
130 | */ | ||
131 | void nvhost_job_put(struct nvhost_job *job); | ||
132 | |||
133 | /* | ||
134 | * Pin memory related to job. This handles relocation of addresses to the | ||
135 | * host1x address space. Handles both the gather memory and any other memory | ||
136 | * referred to from the gather buffers. | ||
137 | */ | ||
138 | int nvhost_job_pin(struct nvhost_job *job); | ||
139 | |||
140 | /* | ||
141 | * Unpin memory related to job. | ||
142 | */ | ||
143 | void nvhost_job_unpin(struct nvhost_job *job); | ||
144 | |||
145 | /* | ||
146 | * Dump contents of job to debug output. | ||
147 | */ | ||
148 | void nvhost_job_dump(struct device *dev, struct nvhost_job *job); | ||
149 | |||
150 | #endif | ||