aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2013-11-05 01:21:00 -0500
committerDave Airlie <airlied@redhat.com>2013-11-05 01:21:00 -0500
commit90c37067b70d6090a316227698a0cba40f8003bd (patch)
treeb556c667fb57da57c8323e069df27f1d5297c214 /include
parentcc87509d87696d7cd393882f5dedea01e03e41a9 (diff)
parent977386a04bae2a5a5092c965c92c7c4d36eed23f (diff)
Merge tag 'drm/for-3.13-rc1' of git://anongit.freedesktop.org/tegra/linux into drm-next
drm/tegra: Changes for v3.13-rc1 The biggest part of the changes is the decoupling of the host1x and DRM drivers followed by the move of Tegra DRM back to drivers/gpu/drm/tegra from whence it came. There is a lot of cleanup as well, and the drivers can now be properly unloaded and reloaded. HDMI support for the Tegra114 SoC was contributed by Mikko Perttunen. gr2d support was extended to Tegra114 and the gr3d driver that has been in the works for quite some time finally made it in. All pieces to run an OpenGL driver on top of an upstream kernel are now available. Support for syncpoint bases was added by Arto Merilainen. This is useful for synchronizing between command streams from different engines such as gr2d and gr3d. Erik Faye-Lund and Wei Yongjun contributed various small fixes. Thanks! * tag 'drm/for-3.13-rc1' of git://anongit.freedesktop.org/tegra/linux: (45 commits) drm/tegra: Reserve syncpoint base for gr3d drm/tegra: Reserve base for gr2d drm/tegra: Deliver syncpoint base to user space gpu: host1x: Add syncpoint base support gpu: host1x: Add 'flags' field to syncpt request drm/tegra: Disable clock on probe failure gpu: host1x: Disable clock on probe failure drm/tegra: Support bottom-up buffer objects drm/tegra: Add support for tiled buffer objects drm/tegra: Add 3D support drm/tegra: Introduce tegra_drm_submit() drm/tegra: Use symbolic names for gr2d registers drm/tegra: Start connectors with correct DPMS mode drm/tegra: hdmi: Enable VDD earlier for hotplug/DDC drm/tegra: hdmi: Fix build warnings drm/tegra: hdmi: Detect DVI-only displays drm/tegra: Add Tegra114 HDMI support drm/tegra: hdmi: Parameterize based on compatible property drm/tegra: hdmi: Rename tegra{2,3} to tegra{20,30} gpu: host1x: Add support for Tegra114 ...
Diffstat (limited to 'include')
-rw-r--r--include/drm/drmP.h1
-rw-r--r--include/linux/host1x.h284
-rw-r--r--include/uapi/drm/tegra_drm.h29
3 files changed, 305 insertions, 9 deletions
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 7062307a4a2d..e6d0cd9f518e 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -150,6 +150,7 @@ int drm_err(const char *func, const char *format, ...);
150#define DRIVER_BUS_PCI 0x1 150#define DRIVER_BUS_PCI 0x1
151#define DRIVER_BUS_PLATFORM 0x2 151#define DRIVER_BUS_PLATFORM 0x2
152#define DRIVER_BUS_USB 0x3 152#define DRIVER_BUS_USB 0x3
153#define DRIVER_BUS_HOST1X 0x4
153 154
154/***********************************************************************/ 155/***********************************************************************/
155/** \name Begin the DRM... */ 156/** \name Begin the DRM... */
diff --git a/include/linux/host1x.h b/include/linux/host1x.h
new file mode 100644
index 000000000000..f5b9b87ac9a9
--- /dev/null
+++ b/include/linux/host1x.h
@@ -0,0 +1,284 @@
1/*
2 * Copyright (c) 2009-2013, NVIDIA Corporation. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 */
18
19#ifndef __LINUX_HOST1X_H
20#define __LINUX_HOST1X_H
21
22#include <linux/device.h>
23#include <linux/types.h>
24
25enum host1x_class {
26 HOST1X_CLASS_HOST1X = 0x1,
27 HOST1X_CLASS_GR2D = 0x51,
28 HOST1X_CLASS_GR2D_SB = 0x52,
29 HOST1X_CLASS_GR3D = 0x60,
30};
31
32struct host1x_client;
33
34struct host1x_client_ops {
35 int (*init)(struct host1x_client *client);
36 int (*exit)(struct host1x_client *client);
37};
38
39struct host1x_client {
40 struct list_head list;
41 struct device *parent;
42 struct device *dev;
43
44 const struct host1x_client_ops *ops;
45
46 enum host1x_class class;
47 struct host1x_channel *channel;
48
49 struct host1x_syncpt **syncpts;
50 unsigned int num_syncpts;
51};
52
53/*
54 * host1x buffer objects
55 */
56
57struct host1x_bo;
58struct sg_table;
59
60struct host1x_bo_ops {
61 struct host1x_bo *(*get)(struct host1x_bo *bo);
62 void (*put)(struct host1x_bo *bo);
63 dma_addr_t (*pin)(struct host1x_bo *bo, struct sg_table **sgt);
64 void (*unpin)(struct host1x_bo *bo, struct sg_table *sgt);
65 void *(*mmap)(struct host1x_bo *bo);
66 void (*munmap)(struct host1x_bo *bo, void *addr);
67 void *(*kmap)(struct host1x_bo *bo, unsigned int pagenum);
68 void (*kunmap)(struct host1x_bo *bo, unsigned int pagenum, void *addr);
69};
70
71struct host1x_bo {
72 const struct host1x_bo_ops *ops;
73};
74
75static inline void host1x_bo_init(struct host1x_bo *bo,
76 const struct host1x_bo_ops *ops)
77{
78 bo->ops = ops;
79}
80
81static inline struct host1x_bo *host1x_bo_get(struct host1x_bo *bo)
82{
83 return bo->ops->get(bo);
84}
85
86static inline void host1x_bo_put(struct host1x_bo *bo)
87{
88 bo->ops->put(bo);
89}
90
91static inline dma_addr_t host1x_bo_pin(struct host1x_bo *bo,
92 struct sg_table **sgt)
93{
94 return bo->ops->pin(bo, sgt);
95}
96
97static inline void host1x_bo_unpin(struct host1x_bo *bo, struct sg_table *sgt)
98{
99 bo->ops->unpin(bo, sgt);
100}
101
102static inline void *host1x_bo_mmap(struct host1x_bo *bo)
103{
104 return bo->ops->mmap(bo);
105}
106
107static inline void host1x_bo_munmap(struct host1x_bo *bo, void *addr)
108{
109 bo->ops->munmap(bo, addr);
110}
111
112static inline void *host1x_bo_kmap(struct host1x_bo *bo, unsigned int pagenum)
113{
114 return bo->ops->kmap(bo, pagenum);
115}
116
117static inline void host1x_bo_kunmap(struct host1x_bo *bo,
118 unsigned int pagenum, void *addr)
119{
120 bo->ops->kunmap(bo, pagenum, addr);
121}
122
123/*
124 * host1x syncpoints
125 */
126
127#define HOST1X_SYNCPT_CLIENT_MANAGED (1 << 0)
128#define HOST1X_SYNCPT_HAS_BASE (1 << 1)
129
130struct host1x_syncpt_base;
131struct host1x_syncpt;
132struct host1x;
133
134struct host1x_syncpt *host1x_syncpt_get(struct host1x *host, u32 id);
135u32 host1x_syncpt_id(struct host1x_syncpt *sp);
136u32 host1x_syncpt_read_min(struct host1x_syncpt *sp);
137u32 host1x_syncpt_read_max(struct host1x_syncpt *sp);
138int host1x_syncpt_incr(struct host1x_syncpt *sp);
139int host1x_syncpt_wait(struct host1x_syncpt *sp, u32 thresh, long timeout,
140 u32 *value);
141struct host1x_syncpt *host1x_syncpt_request(struct device *dev,
142 unsigned long flags);
143void host1x_syncpt_free(struct host1x_syncpt *sp);
144
145struct host1x_syncpt_base *host1x_syncpt_get_base(struct host1x_syncpt *sp);
146u32 host1x_syncpt_base_id(struct host1x_syncpt_base *base);
147
148/*
149 * host1x channel
150 */
151
152struct host1x_channel;
153struct host1x_job;
154
155struct host1x_channel *host1x_channel_request(struct device *dev);
156void host1x_channel_free(struct host1x_channel *channel);
157struct host1x_channel *host1x_channel_get(struct host1x_channel *channel);
158void host1x_channel_put(struct host1x_channel *channel);
159int host1x_job_submit(struct host1x_job *job);
160
161/*
162 * host1x job
163 */
164
165struct host1x_reloc {
166 struct host1x_bo *cmdbuf;
167 u32 cmdbuf_offset;
168 struct host1x_bo *target;
169 u32 target_offset;
170 u32 shift;
171 u32 pad;
172};
173
174struct host1x_job {
175 /* When refcount goes to zero, job can be freed */
176 struct kref ref;
177
178 /* List entry */
179 struct list_head list;
180
181 /* Channel where job is submitted to */
182 struct host1x_channel *channel;
183
184 u32 client;
185
186 /* Gathers and their memory */
187 struct host1x_job_gather *gathers;
188 unsigned int num_gathers;
189
190 /* Wait checks to be processed at submit time */
191 struct host1x_waitchk *waitchk;
192 unsigned int num_waitchk;
193 u32 waitchk_mask;
194
195 /* Array of handles to be pinned & unpinned */
196 struct host1x_reloc *relocarray;
197 unsigned int num_relocs;
198 struct host1x_job_unpin_data *unpins;
199 unsigned int num_unpins;
200
201 dma_addr_t *addr_phys;
202 dma_addr_t *gather_addr_phys;
203 dma_addr_t *reloc_addr_phys;
204
205 /* Sync point id, number of increments and end related to the submit */
206 u32 syncpt_id;
207 u32 syncpt_incrs;
208 u32 syncpt_end;
209
210 /* Maximum time to wait for this job */
211 unsigned int timeout;
212
213 /* Index and number of slots used in the push buffer */
214 unsigned int first_get;
215 unsigned int num_slots;
216
217 /* Copy of gathers */
218 size_t gather_copy_size;
219 dma_addr_t gather_copy;
220 u8 *gather_copy_mapped;
221
222 /* Check if register is marked as an address reg */
223 int (*is_addr_reg)(struct device *dev, u32 reg, u32 class);
224
225 /* Request a SETCLASS to this class */
226 u32 class;
227
228 /* Add a channel wait for previous ops to complete */
229 bool serialize;
230};
231
232struct host1x_job *host1x_job_alloc(struct host1x_channel *ch,
233 u32 num_cmdbufs, u32 num_relocs,
234 u32 num_waitchks);
235void host1x_job_add_gather(struct host1x_job *job, struct host1x_bo *mem_id,
236 u32 words, u32 offset);
237struct host1x_job *host1x_job_get(struct host1x_job *job);
238void host1x_job_put(struct host1x_job *job);
239int host1x_job_pin(struct host1x_job *job, struct device *dev);
240void host1x_job_unpin(struct host1x_job *job);
241
242/*
243 * subdevice probe infrastructure
244 */
245
246struct host1x_device;
247
248struct host1x_driver {
249 const struct of_device_id *subdevs;
250 struct list_head list;
251 const char *name;
252
253 int (*probe)(struct host1x_device *device);
254 int (*remove)(struct host1x_device *device);
255};
256
257int host1x_driver_register(struct host1x_driver *driver);
258void host1x_driver_unregister(struct host1x_driver *driver);
259
260struct host1x_device {
261 struct host1x_driver *driver;
262 struct list_head list;
263 struct device dev;
264
265 struct mutex subdevs_lock;
266 struct list_head subdevs;
267 struct list_head active;
268
269 struct mutex clients_lock;
270 struct list_head clients;
271};
272
273static inline struct host1x_device *to_host1x_device(struct device *dev)
274{
275 return container_of(dev, struct host1x_device, dev);
276}
277
278int host1x_device_init(struct host1x_device *device);
279int host1x_device_exit(struct host1x_device *device);
280
281int host1x_client_register(struct host1x_client *client);
282int host1x_client_unregister(struct host1x_client *client);
283
284#endif
diff --git a/include/uapi/drm/tegra_drm.h b/include/uapi/drm/tegra_drm.h
index 73bde4eaf16c..5e1ab552cbed 100644
--- a/include/uapi/drm/tegra_drm.h
+++ b/include/uapi/drm/tegra_drm.h
@@ -19,6 +19,9 @@
19 19
20#include <drm/drm.h> 20#include <drm/drm.h>
21 21
22#define DRM_TEGRA_GEM_CREATE_TILED (1 << 0)
23#define DRM_TEGRA_GEM_CREATE_BOTTOM_UP (1 << 1)
24
22struct drm_tegra_gem_create { 25struct drm_tegra_gem_create {
23 __u64 size; 26 __u64 size;
24 __u32 flags; 27 __u32 flags;
@@ -65,6 +68,12 @@ struct drm_tegra_get_syncpt {
65 __u32 id; 68 __u32 id;
66}; 69};
67 70
71struct drm_tegra_get_syncpt_base {
72 __u64 context;
73 __u32 syncpt;
74 __u32 id;
75};
76
68struct drm_tegra_syncpt { 77struct drm_tegra_syncpt {
69 __u32 id; 78 __u32 id;
70 __u32 incrs; 79 __u32 incrs;
@@ -115,15 +124,16 @@ struct drm_tegra_submit {
115 __u32 reserved[5]; /* future expansion */ 124 __u32 reserved[5]; /* future expansion */
116}; 125};
117 126
118#define DRM_TEGRA_GEM_CREATE 0x00 127#define DRM_TEGRA_GEM_CREATE 0x00
119#define DRM_TEGRA_GEM_MMAP 0x01 128#define DRM_TEGRA_GEM_MMAP 0x01
120#define DRM_TEGRA_SYNCPT_READ 0x02 129#define DRM_TEGRA_SYNCPT_READ 0x02
121#define DRM_TEGRA_SYNCPT_INCR 0x03 130#define DRM_TEGRA_SYNCPT_INCR 0x03
122#define DRM_TEGRA_SYNCPT_WAIT 0x04 131#define DRM_TEGRA_SYNCPT_WAIT 0x04
123#define DRM_TEGRA_OPEN_CHANNEL 0x05 132#define DRM_TEGRA_OPEN_CHANNEL 0x05
124#define DRM_TEGRA_CLOSE_CHANNEL 0x06 133#define DRM_TEGRA_CLOSE_CHANNEL 0x06
125#define DRM_TEGRA_GET_SYNCPT 0x07 134#define DRM_TEGRA_GET_SYNCPT 0x07
126#define DRM_TEGRA_SUBMIT 0x08 135#define DRM_TEGRA_SUBMIT 0x08
136#define DRM_TEGRA_GET_SYNCPT_BASE 0x09
127 137
128#define DRM_IOCTL_TEGRA_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_CREATE, struct drm_tegra_gem_create) 138#define DRM_IOCTL_TEGRA_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_CREATE, struct drm_tegra_gem_create)
129#define DRM_IOCTL_TEGRA_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_MMAP, struct drm_tegra_gem_mmap) 139#define DRM_IOCTL_TEGRA_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_MMAP, struct drm_tegra_gem_mmap)
@@ -134,5 +144,6 @@ struct drm_tegra_submit {
134#define DRM_IOCTL_TEGRA_CLOSE_CHANNEL DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_CLOSE_CHANNEL, struct drm_tegra_open_channel) 144#define DRM_IOCTL_TEGRA_CLOSE_CHANNEL DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_CLOSE_CHANNEL, struct drm_tegra_open_channel)
135#define DRM_IOCTL_TEGRA_GET_SYNCPT DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GET_SYNCPT, struct drm_tegra_get_syncpt) 145#define DRM_IOCTL_TEGRA_GET_SYNCPT DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GET_SYNCPT, struct drm_tegra_get_syncpt)
136#define DRM_IOCTL_TEGRA_SUBMIT DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_SUBMIT, struct drm_tegra_submit) 146#define DRM_IOCTL_TEGRA_SUBMIT DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_SUBMIT, struct drm_tegra_submit)
147#define DRM_IOCTL_TEGRA_GET_SYNCPT_BASE DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GET_SYNCPT_BASE, struct drm_tegra_get_syncpt_base)
137 148
138#endif 149#endif