aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-01-29 23:49:12 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2014-01-29 23:49:12 -0500
commit9b0cd304f26b9fca140de15deeac2bf357d1f388 (patch)
tree03a0d74614865a5b776b2a98a433232013b1d369 /include
parentca2a650f3dfdc30d71d21bcbb04d2d057779f3f9 (diff)
parentef64cf9d06049e4e9df661f3be60b217e476bee1 (diff)
Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux
Pull drm updates from Dave Airlie: "Been a bit busy, first week of kids school, and waiting on other trees to go in before I could send this, so its a bit later than I'd normally like. Highlights: - core: timestamp fixes, lots of misc cleanups - new drivers: bochs virtual vga - vmwgfx: major overhaul for their nextgen virt gpu. - i915: runtime D3 on HSW, watermark fixes, power well work, fbc fixes, bdw is no longer prelim. - nouveau: gk110/208 acceleration, more pm groundwork, old overlay support - radeon: dpm rework and clockgating for CIK, pci config reset, big endian fixes - tegra: panel support and DSI support, build as module, prime. - armada, omap, gma500, rcar, exynos, mgag200, cirrus, ast: fixes - msm: hdmi support for mdp5" * 'drm-next' of git://people.freedesktop.org/~airlied/linux: (595 commits) drm/nouveau: resume display if any later suspend bits fail drm/nouveau: fix lock unbalance in nouveau_crtc_page_flip drm/nouveau: implement hooks for needed for drm vblank timestamping support drm/nouveau/disp: add a method to fetch info needed by drm vblank timestamping drm/nv50: fill in crtc mode struct members from crtc_mode_fixup drm/radeon/dce8: workaround for atom BlankCrtc table drm/radeon/DCE4+: clear bios scratch dpms bit (v2) drm/radeon: set si_notify_smc_display_change properly drm/radeon: fix DAC interrupt handling on DCE5+ drm/radeon: clean up active vram sizing drm/radeon: skip async dma init on r6xx drm/radeon/runpm: don't runtime suspend non-PX cards drm/radeon: add ring to fence trace functions drm/radeon: add missing trace point drm/radeon: fix VMID use tracking drm: ast,cirrus,mgag200: use drm_can_sleep drm/gma500: Lock struct_mutex around cursor updates drm/i915: Fix the offset issue for the stolen GEM objects DRM: armada: fix missing DRM_KMS_FB_HELPER select drm/i915: Decouple GPU error reporting from ring initialisation ...
Diffstat (limited to 'include')
-rw-r--r--include/drm/drmP.h81
-rw-r--r--include/drm/drm_agpsupport.h33
-rw-r--r--include/drm/drm_crtc.h30
-rw-r--r--include/drm/drm_crtc_helper.h4
-rw-r--r--include/drm/drm_dp_helper.h35
-rw-r--r--include/drm/drm_mipi_dsi.h158
-rw-r--r--include/drm/drm_os_linux.h37
-rw-r--r--include/drm/drm_panel.h82
-rw-r--r--include/drm/ttm/ttm_bo_driver.h9
-rw-r--r--include/drm/ttm/ttm_object.h18
-rw-r--r--include/linux/fb.h4
-rw-r--r--include/linux/host1x.h6
-rw-r--r--include/uapi/drm/drm.h1
-rw-r--r--include/uapi/drm/i915_drm.h21
-rw-r--r--include/uapi/drm/radeon_drm.h2
-rw-r--r--include/uapi/drm/vmwgfx_drm.h260
16 files changed, 668 insertions, 113 deletions
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 1d4a920ef7ff..04086c5be930 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -56,6 +56,7 @@
56#include <linux/mutex.h> 56#include <linux/mutex.h>
57#include <linux/io.h> 57#include <linux/io.h>
58#include <linux/slab.h> 58#include <linux/slab.h>
59#include <linux/ratelimit.h>
59#if defined(__alpha__) || defined(__powerpc__) 60#if defined(__alpha__) || defined(__powerpc__)
60#include <asm/pgtable.h> /* For pte_wrprotect */ 61#include <asm/pgtable.h> /* For pte_wrprotect */
61#endif 62#endif
@@ -136,7 +137,6 @@ int drm_err(const char *func, const char *format, ...);
136 137
137/* driver capabilities and requirements mask */ 138/* driver capabilities and requirements mask */
138#define DRIVER_USE_AGP 0x1 139#define DRIVER_USE_AGP 0x1
139#define DRIVER_REQUIRE_AGP 0x2
140#define DRIVER_PCI_DMA 0x8 140#define DRIVER_PCI_DMA 0x8
141#define DRIVER_SG 0x10 141#define DRIVER_SG 0x10
142#define DRIVER_HAVE_DMA 0x20 142#define DRIVER_HAVE_DMA 0x20
@@ -180,6 +180,22 @@ int drm_err(const char *func, const char *format, ...);
180#define DRM_ERROR(fmt, ...) \ 180#define DRM_ERROR(fmt, ...) \
181 drm_err(__func__, fmt, ##__VA_ARGS__) 181 drm_err(__func__, fmt, ##__VA_ARGS__)
182 182
183/**
184 * Rate limited error output. Like DRM_ERROR() but won't flood the log.
185 *
186 * \param fmt printf() like format string.
187 * \param arg arguments
188 */
189#define DRM_ERROR_RATELIMITED(fmt, ...) \
190({ \
191 static DEFINE_RATELIMIT_STATE(_rs, \
192 DEFAULT_RATELIMIT_INTERVAL, \
193 DEFAULT_RATELIMIT_BURST); \
194 \
195 if (__ratelimit(&_rs)) \
196 drm_err(__func__, fmt, ##__VA_ARGS__); \
197})
198
183#define DRM_INFO(fmt, ...) \ 199#define DRM_INFO(fmt, ...) \
184 printk(KERN_INFO "[" DRM_NAME "] " fmt, ##__VA_ARGS__) 200 printk(KERN_INFO "[" DRM_NAME "] " fmt, ##__VA_ARGS__)
185 201
@@ -422,7 +438,6 @@ struct drm_file {
422 struct pid *pid; 438 struct pid *pid;
423 kuid_t uid; 439 kuid_t uid;
424 drm_magic_t magic; 440 drm_magic_t magic;
425 unsigned long ioctl_count;
426 struct list_head lhead; 441 struct list_head lhead;
427 struct drm_minor *minor; 442 struct drm_minor *minor;
428 unsigned long lock_count; 443 unsigned long lock_count;
@@ -511,7 +526,7 @@ struct drm_device_dma {
511 */ 526 */
512struct drm_agp_mem { 527struct drm_agp_mem {
513 unsigned long handle; /**< handle */ 528 unsigned long handle; /**< handle */
514 DRM_AGP_MEM *memory; 529 struct agp_memory *memory;
515 unsigned long bound; /**< address */ 530 unsigned long bound; /**< address */
516 int pages; 531 int pages;
517 struct list_head head; 532 struct list_head head;
@@ -523,7 +538,7 @@ struct drm_agp_mem {
523 * \sa drm_agp_init() and drm_device::agp. 538 * \sa drm_agp_init() and drm_device::agp.
524 */ 539 */
525struct drm_agp_head { 540struct drm_agp_head {
526 DRM_AGP_KERN agp_info; /**< AGP device information */ 541 struct agp_kern_info agp_info; /**< AGP device information */
527 struct list_head memory; 542 struct list_head memory;
528 unsigned long mode; /**< AGP mode */ 543 unsigned long mode; /**< AGP mode */
529 struct agp_bridge_data *bridge; 544 struct agp_bridge_data *bridge;
@@ -607,13 +622,6 @@ struct drm_ati_pcigart_info {
607}; 622};
608 623
609/** 624/**
610 * GEM specific mm private for tracking GEM objects
611 */
612struct drm_gem_mm {
613 struct drm_vma_offset_manager vma_manager;
614};
615
616/**
617 * This structure defines the drm_mm memory object, which will be used by the 625 * This structure defines the drm_mm memory object, which will be used by the
618 * DRM for its buffer objects. 626 * DRM for its buffer objects.
619 */ 627 */
@@ -750,10 +758,6 @@ struct drm_bus {
750 int (*set_unique)(struct drm_device *dev, struct drm_master *master, 758 int (*set_unique)(struct drm_device *dev, struct drm_master *master,
751 struct drm_unique *unique); 759 struct drm_unique *unique);
752 int (*irq_by_busid)(struct drm_device *dev, struct drm_irq_busid *p); 760 int (*irq_by_busid)(struct drm_device *dev, struct drm_irq_busid *p);
753 /* hooks that are for PCI */
754 int (*agp_init)(struct drm_device *dev);
755 void (*agp_destroy)(struct drm_device *dev);
756
757}; 761};
758 762
759/** 763/**
@@ -841,6 +845,7 @@ struct drm_driver {
841 * 845 *
842 * \param dev DRM device. 846 * \param dev DRM device.
843 * \param crtc Id of the crtc to query. 847 * \param crtc Id of the crtc to query.
848 * \param flags Flags from the caller (DRM_CALLED_FROM_VBLIRQ or 0).
844 * \param *vpos Target location for current vertical scanout position. 849 * \param *vpos Target location for current vertical scanout position.
845 * \param *hpos Target location for current horizontal scanout position. 850 * \param *hpos Target location for current horizontal scanout position.
846 * \param *stime Target location for timestamp taken immediately before 851 * \param *stime Target location for timestamp taken immediately before
@@ -863,6 +868,7 @@ struct drm_driver {
863 * 868 *
864 */ 869 */
865 int (*get_scanout_position) (struct drm_device *dev, int crtc, 870 int (*get_scanout_position) (struct drm_device *dev, int crtc,
871 unsigned int flags,
866 int *vpos, int *hpos, ktime_t *stime, 872 int *vpos, int *hpos, ktime_t *stime,
867 ktime_t *etime); 873 ktime_t *etime);
868 874
@@ -903,7 +909,7 @@ struct drm_driver {
903 909
904 /* these have to be filled in */ 910 /* these have to be filled in */
905 911
906 irqreturn_t(*irq_handler) (DRM_IRQ_ARGS); 912 irqreturn_t(*irq_handler) (int irq, void *arg);
907 void (*irq_preinstall) (struct drm_device *dev); 913 void (*irq_preinstall) (struct drm_device *dev);
908 int (*irq_postinstall) (struct drm_device *dev); 914 int (*irq_postinstall) (struct drm_device *dev);
909 void (*irq_uninstall) (struct drm_device *dev); 915 void (*irq_uninstall) (struct drm_device *dev);
@@ -995,8 +1001,8 @@ struct drm_driver {
995 } kdriver; 1001 } kdriver;
996 struct drm_bus *bus; 1002 struct drm_bus *bus;
997 1003
998 /* List of devices hanging off this driver */ 1004 /* List of devices hanging off this driver with stealth attach. */
999 struct list_head device_list; 1005 struct list_head legacy_dev_list;
1000}; 1006};
1001 1007
1002#define DRM_MINOR_UNASSIGNED 0 1008#define DRM_MINOR_UNASSIGNED 0
@@ -1085,7 +1091,7 @@ struct drm_vblank_crtc {
1085 * may contain multiple heads. 1091 * may contain multiple heads.
1086 */ 1092 */
1087struct drm_device { 1093struct drm_device {
1088 struct list_head driver_item; /**< list of devices per driver */ 1094 struct list_head legacy_dev_list;/**< list of devices per driver for stealth attach cleanup */
1089 char *devname; /**< For /proc/interrupts */ 1095 char *devname; /**< For /proc/interrupts */
1090 int if_version; /**< Highest interface version set */ 1096 int if_version; /**< Highest interface version set */
1091 1097
@@ -1098,8 +1104,6 @@ struct drm_device {
1098 /** \name Usage Counters */ 1104 /** \name Usage Counters */
1099 /*@{ */ 1105 /*@{ */
1100 int open_count; /**< Outstanding files open */ 1106 int open_count; /**< Outstanding files open */
1101 atomic_t ioctl_count; /**< Outstanding IOCTLs pending */
1102 atomic_t vma_count; /**< Outstanding vma areas open */
1103 int buf_use; /**< Buffers in use -- cannot alloc */ 1107 int buf_use; /**< Buffers in use -- cannot alloc */
1104 atomic_t buf_alloc; /**< Buffer allocation in progress */ 1108 atomic_t buf_alloc; /**< Buffer allocation in progress */
1105 /*@} */ 1109 /*@} */
@@ -1176,7 +1180,6 @@ struct drm_device {
1176 struct drm_sg_mem *sg; /**< Scatter gather memory */ 1180 struct drm_sg_mem *sg; /**< Scatter gather memory */
1177 unsigned int num_crtcs; /**< Number of CRTCs on this device */ 1181 unsigned int num_crtcs; /**< Number of CRTCs on this device */
1178 void *dev_private; /**< device private data */ 1182 void *dev_private; /**< device private data */
1179 void *mm_private;
1180 struct address_space *dev_mapping; 1183 struct address_space *dev_mapping;
1181 struct drm_sigdata sigdata; /**< For block_all_signals */ 1184 struct drm_sigdata sigdata; /**< For block_all_signals */
1182 sigset_t sigmask; 1185 sigset_t sigmask;
@@ -1194,6 +1197,7 @@ struct drm_device {
1194 /*@{ */ 1197 /*@{ */
1195 struct mutex object_name_lock; 1198 struct mutex object_name_lock;
1196 struct idr object_name_idr; 1199 struct idr object_name_idr;
1200 struct drm_vma_offset_manager *vma_offset_manager;
1197 /*@} */ 1201 /*@} */
1198 int switch_power_state; 1202 int switch_power_state;
1199 1203
@@ -1268,6 +1272,7 @@ extern unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait);
1268 /* Memory management support (drm_memory.h) */ 1272 /* Memory management support (drm_memory.h) */
1269#include <drm/drm_memory.h> 1273#include <drm/drm_memory.h>
1270 1274
1275
1271 /* Misc. IOCTL support (drm_ioctl.h) */ 1276 /* Misc. IOCTL support (drm_ioctl.h) */
1272extern int drm_irq_by_busid(struct drm_device *dev, void *data, 1277extern int drm_irq_by_busid(struct drm_device *dev, void *data,
1273 struct drm_file *file_priv); 1278 struct drm_file *file_priv);
@@ -1398,8 +1403,10 @@ extern int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
1398 int crtc, int *max_error, 1403 int crtc, int *max_error,
1399 struct timeval *vblank_time, 1404 struct timeval *vblank_time,
1400 unsigned flags, 1405 unsigned flags,
1401 struct drm_crtc *refcrtc); 1406 const struct drm_crtc *refcrtc,
1402extern void drm_calc_timestamping_constants(struct drm_crtc *crtc); 1407 const struct drm_display_mode *mode);
1408extern void drm_calc_timestamping_constants(struct drm_crtc *crtc,
1409 const struct drm_display_mode *mode);
1403 1410
1404extern bool 1411extern bool
1405drm_mode_parse_command_line_for_connector(const char *mode_option, 1412drm_mode_parse_command_line_for_connector(const char *mode_option,
@@ -1461,6 +1468,30 @@ extern int drm_debugfs_create_files(const struct drm_info_list *files,
1461extern int drm_debugfs_remove_files(const struct drm_info_list *files, 1468extern int drm_debugfs_remove_files(const struct drm_info_list *files,
1462 int count, struct drm_minor *minor); 1469 int count, struct drm_minor *minor);
1463extern int drm_debugfs_cleanup(struct drm_minor *minor); 1470extern int drm_debugfs_cleanup(struct drm_minor *minor);
1471#else
1472static inline int drm_debugfs_init(struct drm_minor *minor, int minor_id,
1473 struct dentry *root)
1474{
1475 return 0;
1476}
1477
1478static inline int drm_debugfs_create_files(const struct drm_info_list *files,
1479 int count, struct dentry *root,
1480 struct drm_minor *minor)
1481{
1482 return 0;
1483}
1484
1485static inline int drm_debugfs_remove_files(const struct drm_info_list *files,
1486 int count, struct drm_minor *minor)
1487{
1488 return 0;
1489}
1490
1491static inline int drm_debugfs_cleanup(struct drm_minor *minor)
1492{
1493 return 0;
1494}
1464#endif 1495#endif
1465 1496
1466 /* Info file support */ 1497 /* Info file support */
@@ -1645,6 +1676,7 @@ static __inline__ int drm_pci_device_is_agp(struct drm_device *dev)
1645 1676
1646 return pci_find_capability(dev->pdev, PCI_CAP_ID_AGP); 1677 return pci_find_capability(dev->pdev, PCI_CAP_ID_AGP);
1647} 1678}
1679void drm_pci_agp_destroy(struct drm_device *dev);
1648 1680
1649extern int drm_pci_init(struct drm_driver *driver, struct pci_driver *pdriver); 1681extern int drm_pci_init(struct drm_driver *driver, struct pci_driver *pdriver);
1650extern void drm_pci_exit(struct drm_driver *driver, struct pci_driver *pdriver); 1682extern void drm_pci_exit(struct drm_driver *driver, struct pci_driver *pdriver);
@@ -1660,7 +1692,6 @@ extern int drm_pcie_get_speed_cap_mask(struct drm_device *dev, u32 *speed_mask);
1660 1692
1661/* platform section */ 1693/* platform section */
1662extern int drm_platform_init(struct drm_driver *driver, struct platform_device *platform_device); 1694extern int drm_platform_init(struct drm_driver *driver, struct platform_device *platform_device);
1663extern void drm_platform_exit(struct drm_driver *driver, struct platform_device *platform_device);
1664 1695
1665/* returns true if currently okay to sleep */ 1696/* returns true if currently okay to sleep */
1666static __inline__ bool drm_can_sleep(void) 1697static __inline__ bool drm_can_sleep(void)
diff --git a/include/drm/drm_agpsupport.h b/include/drm/drm_agpsupport.h
index a184eeee9c96..86a02188074b 100644
--- a/include/drm/drm_agpsupport.h
+++ b/include/drm/drm_agpsupport.h
@@ -10,17 +10,16 @@
10 10
11#if __OS_HAS_AGP 11#if __OS_HAS_AGP
12 12
13void drm_free_agp(DRM_AGP_MEM * handle, int pages); 13void drm_free_agp(struct agp_memory * handle, int pages);
14int drm_bind_agp(DRM_AGP_MEM * handle, unsigned int start); 14int drm_bind_agp(struct agp_memory * handle, unsigned int start);
15int drm_unbind_agp(DRM_AGP_MEM * handle); 15int drm_unbind_agp(struct agp_memory * handle);
16DRM_AGP_MEM *drm_agp_bind_pages(struct drm_device *dev, 16struct agp_memory *drm_agp_bind_pages(struct drm_device *dev,
17 struct page **pages, 17 struct page **pages,
18 unsigned long num_pages, 18 unsigned long num_pages,
19 uint32_t gtt_offset, 19 uint32_t gtt_offset,
20 uint32_t type); 20 uint32_t type);
21 21
22struct drm_agp_head *drm_agp_init(struct drm_device *dev); 22struct drm_agp_head *drm_agp_init(struct drm_device *dev);
23void drm_agp_destroy(struct drm_agp_head *agp);
24void drm_agp_clear(struct drm_device *dev); 23void drm_agp_clear(struct drm_device *dev);
25int drm_agp_acquire(struct drm_device *dev); 24int drm_agp_acquire(struct drm_device *dev);
26int drm_agp_acquire_ioctl(struct drm_device *dev, void *data, 25int drm_agp_acquire_ioctl(struct drm_device *dev, void *data,
@@ -46,29 +45,23 @@ int drm_agp_unbind_ioctl(struct drm_device *dev, void *data,
46int drm_agp_bind(struct drm_device *dev, struct drm_agp_binding *request); 45int drm_agp_bind(struct drm_device *dev, struct drm_agp_binding *request);
47int drm_agp_bind_ioctl(struct drm_device *dev, void *data, 46int drm_agp_bind_ioctl(struct drm_device *dev, void *data,
48 struct drm_file *file_priv); 47 struct drm_file *file_priv);
49
50static inline int drm_core_has_AGP(struct drm_device *dev)
51{
52 return drm_core_check_feature(dev, DRIVER_USE_AGP);
53}
54
55#else /* __OS_HAS_AGP */ 48#else /* __OS_HAS_AGP */
56 49
57static inline void drm_free_agp(DRM_AGP_MEM * handle, int pages) 50static inline void drm_free_agp(struct agp_memory * handle, int pages)
58{ 51{
59} 52}
60 53
61static inline int drm_bind_agp(DRM_AGP_MEM * handle, unsigned int start) 54static inline int drm_bind_agp(struct agp_memory * handle, unsigned int start)
62{ 55{
63 return -ENODEV; 56 return -ENODEV;
64} 57}
65 58
66static inline int drm_unbind_agp(DRM_AGP_MEM * handle) 59static inline int drm_unbind_agp(struct agp_memory * handle)
67{ 60{
68 return -ENODEV; 61 return -ENODEV;
69} 62}
70 63
71static inline DRM_AGP_MEM *drm_agp_bind_pages(struct drm_device *dev, 64static inline struct agp_memory *drm_agp_bind_pages(struct drm_device *dev,
72 struct page **pages, 65 struct page **pages,
73 unsigned long num_pages, 66 unsigned long num_pages,
74 uint32_t gtt_offset, 67 uint32_t gtt_offset,
@@ -82,10 +75,6 @@ static inline struct drm_agp_head *drm_agp_init(struct drm_device *dev)
82 return NULL; 75 return NULL;
83} 76}
84 77
85static inline void drm_agp_destroy(struct drm_agp_head *agp)
86{
87}
88
89static inline void drm_agp_clear(struct drm_device *dev) 78static inline void drm_agp_clear(struct drm_device *dev)
90{ 79{
91} 80}
@@ -183,12 +172,6 @@ static inline int drm_agp_bind_ioctl(struct drm_device *dev, void *data,
183{ 172{
184 return -ENODEV; 173 return -ENODEV;
185} 174}
186
187static inline int drm_core_has_AGP(struct drm_device *dev)
188{
189 return 0;
190}
191
192#endif /* __OS_HAS_AGP */ 175#endif /* __OS_HAS_AGP */
193 176
194#endif /* _DRM_AGPSUPPORT_H_ */ 177#endif /* _DRM_AGPSUPPORT_H_ */
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index f32c5cd51f41..71727b6210ae 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -30,6 +30,7 @@
30#include <linux/types.h> 30#include <linux/types.h>
31#include <linux/idr.h> 31#include <linux/idr.h>
32#include <linux/fb.h> 32#include <linux/fb.h>
33#include <linux/hdmi.h>
33#include <drm/drm_mode.h> 34#include <drm/drm_mode.h>
34 35
35#include <drm/drm_fourcc.h> 36#include <drm/drm_fourcc.h>
@@ -181,6 +182,7 @@ struct drm_display_mode {
181 182
182 int vrefresh; /* in Hz */ 183 int vrefresh; /* in Hz */
183 int hsync; /* in kHz */ 184 int hsync; /* in kHz */
185 enum hdmi_picture_aspect picture_aspect_ratio;
184}; 186};
185 187
186static inline bool drm_mode_is_stereo(const struct drm_display_mode *mode) 188static inline bool drm_mode_is_stereo(const struct drm_display_mode *mode)
@@ -447,7 +449,7 @@ struct drm_crtc {
447 uint16_t *gamma_store; 449 uint16_t *gamma_store;
448 450
449 /* Constants needed for precise vblank and swap timestamping. */ 451 /* Constants needed for precise vblank and swap timestamping. */
450 s64 framedur_ns, linedur_ns, pixeldur_ns; 452 int framedur_ns, linedur_ns, pixeldur_ns;
451 453
452 /* if you are using the helper */ 454 /* if you are using the helper */
453 void *helper_private; 455 void *helper_private;
@@ -929,6 +931,19 @@ extern int drm_crtc_init(struct drm_device *dev,
929 struct drm_crtc *crtc, 931 struct drm_crtc *crtc,
930 const struct drm_crtc_funcs *funcs); 932 const struct drm_crtc_funcs *funcs);
931extern void drm_crtc_cleanup(struct drm_crtc *crtc); 933extern void drm_crtc_cleanup(struct drm_crtc *crtc);
934extern unsigned int drm_crtc_index(struct drm_crtc *crtc);
935
936/**
937 * drm_crtc_mask - find the mask of a registered CRTC
938 * @crtc: CRTC to find mask for
939 *
940 * Given a registered CRTC, return the mask bit of that CRTC for an
941 * encoder's possible_crtcs field.
942 */
943static inline uint32_t drm_crtc_mask(struct drm_crtc *crtc)
944{
945 return 1 << drm_crtc_index(crtc);
946}
932 947
933extern void drm_connector_ida_init(void); 948extern void drm_connector_ida_init(void);
934extern void drm_connector_ida_destroy(void); 949extern void drm_connector_ida_destroy(void);
@@ -950,6 +965,19 @@ extern int drm_encoder_init(struct drm_device *dev,
950 const struct drm_encoder_funcs *funcs, 965 const struct drm_encoder_funcs *funcs,
951 int encoder_type); 966 int encoder_type);
952 967
968/**
969 * drm_encoder_crtc_ok - can a given crtc drive a given encoder?
970 * @encoder: encoder to test
971 * @crtc: crtc to test
972 *
973 * Return false if @encoder can't be driven by @crtc, true otherwise.
974 */
975static inline bool drm_encoder_crtc_ok(struct drm_encoder *encoder,
976 struct drm_crtc *crtc)
977{
978 return !!(encoder->possible_crtcs & drm_crtc_mask(crtc));
979}
980
953extern int drm_plane_init(struct drm_device *dev, 981extern int drm_plane_init(struct drm_device *dev,
954 struct drm_plane *plane, 982 struct drm_plane *plane,
955 unsigned long possible_crtcs, 983 unsigned long possible_crtcs,
diff --git a/include/drm/drm_crtc_helper.h b/include/drm/drm_crtc_helper.h
index ef6ad3a8e58e..b1388b5fe7ac 100644
--- a/include/drm/drm_crtc_helper.h
+++ b/include/drm/drm_crtc_helper.h
@@ -120,8 +120,8 @@ struct drm_encoder_helper_funcs {
120 */ 120 */
121struct drm_connector_helper_funcs { 121struct drm_connector_helper_funcs {
122 int (*get_modes)(struct drm_connector *connector); 122 int (*get_modes)(struct drm_connector *connector);
123 int (*mode_valid)(struct drm_connector *connector, 123 enum drm_mode_status (*mode_valid)(struct drm_connector *connector,
124 struct drm_display_mode *mode); 124 struct drm_display_mode *mode);
125 struct drm_encoder *(*best_encoder)(struct drm_connector *connector); 125 struct drm_encoder *(*best_encoder)(struct drm_connector *connector);
126}; 126};
127 127
diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h
index a92c3754e3bb..1d09050a8c00 100644
--- a/include/drm/drm_dp_helper.h
+++ b/include/drm/drm_dp_helper.h
@@ -41,22 +41,22 @@
41 * 1.2 formally includes both eDP and DPI definitions. 41 * 1.2 formally includes both eDP and DPI definitions.
42 */ 42 */
43 43
44#define AUX_NATIVE_WRITE 0x8 44#define DP_AUX_I2C_WRITE 0x0
45#define AUX_NATIVE_READ 0x9 45#define DP_AUX_I2C_READ 0x1
46#define AUX_I2C_WRITE 0x0 46#define DP_AUX_I2C_STATUS 0x2
47#define AUX_I2C_READ 0x1 47#define DP_AUX_I2C_MOT 0x4
48#define AUX_I2C_STATUS 0x2 48#define DP_AUX_NATIVE_WRITE 0x8
49#define AUX_I2C_MOT 0x4 49#define DP_AUX_NATIVE_READ 0x9
50 50
51#define AUX_NATIVE_REPLY_ACK (0x0 << 4) 51#define DP_AUX_NATIVE_REPLY_ACK (0x0 << 0)
52#define AUX_NATIVE_REPLY_NACK (0x1 << 4) 52#define DP_AUX_NATIVE_REPLY_NACK (0x1 << 0)
53#define AUX_NATIVE_REPLY_DEFER (0x2 << 4) 53#define DP_AUX_NATIVE_REPLY_DEFER (0x2 << 0)
54#define AUX_NATIVE_REPLY_MASK (0x3 << 4) 54#define DP_AUX_NATIVE_REPLY_MASK (0x3 << 0)
55 55
56#define AUX_I2C_REPLY_ACK (0x0 << 6) 56#define DP_AUX_I2C_REPLY_ACK (0x0 << 2)
57#define AUX_I2C_REPLY_NACK (0x1 << 6) 57#define DP_AUX_I2C_REPLY_NACK (0x1 << 2)
58#define AUX_I2C_REPLY_DEFER (0x2 << 6) 58#define DP_AUX_I2C_REPLY_DEFER (0x2 << 2)
59#define AUX_I2C_REPLY_MASK (0x3 << 6) 59#define DP_AUX_I2C_REPLY_MASK (0x3 << 2)
60 60
61/* AUX CH addresses */ 61/* AUX CH addresses */
62/* DPCD */ 62/* DPCD */
@@ -266,9 +266,10 @@
266 266
267#define DP_TEST_REQUEST 0x218 267#define DP_TEST_REQUEST 0x218
268# define DP_TEST_LINK_TRAINING (1 << 0) 268# define DP_TEST_LINK_TRAINING (1 << 0)
269# define DP_TEST_LINK_PATTERN (1 << 1) 269# define DP_TEST_LINK_VIDEO_PATTERN (1 << 1)
270# define DP_TEST_LINK_EDID_READ (1 << 2) 270# define DP_TEST_LINK_EDID_READ (1 << 2)
271# define DP_TEST_LINK_PHY_TEST_PATTERN (1 << 3) /* DPCD >= 1.1 */ 271# define DP_TEST_LINK_PHY_TEST_PATTERN (1 << 3) /* DPCD >= 1.1 */
272# define DP_TEST_LINK_FAUX_PATTERN (1 << 4) /* DPCD >= 1.2 */
272 273
273#define DP_TEST_LINK_RATE 0x219 274#define DP_TEST_LINK_RATE 0x219
274# define DP_LINK_RATE_162 (0x6) 275# define DP_LINK_RATE_162 (0x6)
diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h
new file mode 100644
index 000000000000..d32628acdd90
--- /dev/null
+++ b/include/drm/drm_mipi_dsi.h
@@ -0,0 +1,158 @@
1/*
2 * MIPI DSI Bus
3 *
4 * Copyright (C) 2012-2013, Samsung Electronics, Co., Ltd.
5 * Andrzej Hajda <a.hajda@samsung.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef __DRM_MIPI_DSI_H__
13#define __DRM_MIPI_DSI_H__
14
15#include <linux/device.h>
16
17struct mipi_dsi_host;
18struct mipi_dsi_device;
19
20/**
21 * struct mipi_dsi_msg - read/write DSI buffer
22 * @channel: virtual channel id
23 * @type: payload data type
24 * @tx_len: length of @tx_buf
25 * @tx_buf: data to be written
26 * @rx_len: length of @rx_buf
27 * @rx_buf: data to be read, or NULL
28 */
29struct mipi_dsi_msg {
30 u8 channel;
31 u8 type;
32
33 size_t tx_len;
34 const void *tx_buf;
35
36 size_t rx_len;
37 void *rx_buf;
38};
39
40/**
41 * struct mipi_dsi_host_ops - DSI bus operations
42 * @attach: attach DSI device to DSI host
43 * @detach: detach DSI device from DSI host
44 * @transfer: send and/or receive DSI packet, return number of received bytes,
45 * or error
46 */
47struct mipi_dsi_host_ops {
48 int (*attach)(struct mipi_dsi_host *host,
49 struct mipi_dsi_device *dsi);
50 int (*detach)(struct mipi_dsi_host *host,
51 struct mipi_dsi_device *dsi);
52 ssize_t (*transfer)(struct mipi_dsi_host *host,
53 struct mipi_dsi_msg *msg);
54};
55
56/**
57 * struct mipi_dsi_host - DSI host device
58 * @dev: driver model device node for this DSI host
59 * @ops: DSI host operations
60 */
61struct mipi_dsi_host {
62 struct device *dev;
63 const struct mipi_dsi_host_ops *ops;
64};
65
66int mipi_dsi_host_register(struct mipi_dsi_host *host);
67void mipi_dsi_host_unregister(struct mipi_dsi_host *host);
68
69/* DSI mode flags */
70
71/* video mode */
72#define MIPI_DSI_MODE_VIDEO BIT(0)
73/* video burst mode */
74#define MIPI_DSI_MODE_VIDEO_BURST BIT(1)
75/* video pulse mode */
76#define MIPI_DSI_MODE_VIDEO_SYNC_PULSE BIT(2)
77/* enable auto vertical count mode */
78#define MIPI_DSI_MODE_VIDEO_AUTO_VERT BIT(3)
79/* enable hsync-end packets in vsync-pulse and v-porch area */
80#define MIPI_DSI_MODE_VIDEO_HSE BIT(4)
81/* disable hfront-porch area */
82#define MIPI_DSI_MODE_VIDEO_HFP BIT(5)
83/* disable hback-porch area */
84#define MIPI_DSI_MODE_VIDEO_HBP BIT(6)
85/* disable hsync-active area */
86#define MIPI_DSI_MODE_VIDEO_HSA BIT(7)
87/* flush display FIFO on vsync pulse */
88#define MIPI_DSI_MODE_VSYNC_FLUSH BIT(8)
89/* disable EoT packets in HS mode */
90#define MIPI_DSI_MODE_EOT_PACKET BIT(9)
91
92enum mipi_dsi_pixel_format {
93 MIPI_DSI_FMT_RGB888,
94 MIPI_DSI_FMT_RGB666,
95 MIPI_DSI_FMT_RGB666_PACKED,
96 MIPI_DSI_FMT_RGB565,
97};
98
99/**
100 * struct mipi_dsi_device - DSI peripheral device
101 * @host: DSI host for this peripheral
102 * @dev: driver model device node for this peripheral
103 * @channel: virtual channel assigned to the peripheral
104 * @format: pixel format for video mode
105 * @lanes: number of active data lanes
106 * @mode_flags: DSI operation mode related flags
107 */
108struct mipi_dsi_device {
109 struct mipi_dsi_host *host;
110 struct device dev;
111
112 unsigned int channel;
113 unsigned int lanes;
114 enum mipi_dsi_pixel_format format;
115 unsigned long mode_flags;
116};
117
118#define to_mipi_dsi_device(d) container_of(d, struct mipi_dsi_device, dev)
119
120int mipi_dsi_attach(struct mipi_dsi_device *dsi);
121int mipi_dsi_detach(struct mipi_dsi_device *dsi);
122int mipi_dsi_dcs_write(struct mipi_dsi_device *dsi, unsigned int channel,
123 const void *data, size_t len);
124ssize_t mipi_dsi_dcs_read(struct mipi_dsi_device *dsi, unsigned int channel,
125 u8 cmd, void *data, size_t len);
126
127/**
128 * struct mipi_dsi_driver - DSI driver
129 * @driver: device driver model driver
130 * @probe: callback for device binding
131 * @remove: callback for device unbinding
132 */
133struct mipi_dsi_driver {
134 struct device_driver driver;
135 int(*probe)(struct mipi_dsi_device *dsi);
136 int(*remove)(struct mipi_dsi_device *dsi);
137};
138
139#define to_mipi_dsi_driver(d) container_of(d, struct mipi_dsi_driver, driver)
140
141static inline void *mipi_dsi_get_drvdata(const struct mipi_dsi_device *dsi)
142{
143 return dev_get_drvdata(&dsi->dev);
144}
145
146static inline void mipi_dsi_set_drvdata(struct mipi_dsi_device *dsi, void *data)
147{
148 dev_set_drvdata(&dsi->dev, data);
149}
150
151int mipi_dsi_driver_register(struct mipi_dsi_driver *driver);
152void mipi_dsi_driver_unregister(struct mipi_dsi_driver *driver);
153
154#define module_mipi_dsi_driver(__mipi_dsi_driver) \
155 module_driver(__mipi_dsi_driver, mipi_dsi_driver_register, \
156 mipi_dsi_driver_unregister)
157
158#endif /* __DRM_MIPI_DSI__ */
diff --git a/include/drm/drm_os_linux.h b/include/drm/drm_os_linux.h
index 815fafc6b4ad..86ab99bc0ac5 100644
--- a/include/drm/drm_os_linux.h
+++ b/include/drm/drm_os_linux.h
@@ -21,7 +21,6 @@ static inline void writeq(u64 val, void __iomem *reg)
21 21
22/** Current process ID */ 22/** Current process ID */
23#define DRM_CURRENTPID task_pid_nr(current) 23#define DRM_CURRENTPID task_pid_nr(current)
24#define DRM_SUSER(p) capable(CAP_SYS_ADMIN)
25#define DRM_UDELAY(d) udelay(d) 24#define DRM_UDELAY(d) udelay(d)
26/** Read a byte from a MMIO region */ 25/** Read a byte from a MMIO region */
27#define DRM_READ8(map, offset) readb(((void __iomem *)(map)->handle) + (offset)) 26#define DRM_READ8(map, offset) readb(((void __iomem *)(map)->handle) + (offset))
@@ -35,45 +34,12 @@ static inline void writeq(u64 val, void __iomem *reg)
35#define DRM_WRITE16(map, offset, val) writew(val, ((void __iomem *)(map)->handle) + (offset)) 34#define DRM_WRITE16(map, offset, val) writew(val, ((void __iomem *)(map)->handle) + (offset))
36/** Write a dword into a MMIO region */ 35/** Write a dword into a MMIO region */
37#define DRM_WRITE32(map, offset, val) writel(val, ((void __iomem *)(map)->handle) + (offset)) 36#define DRM_WRITE32(map, offset, val) writel(val, ((void __iomem *)(map)->handle) + (offset))
38/** Read memory barrier */
39 37
40/** Read a qword from a MMIO region - be careful using these unless you really understand them */ 38/** Read a qword from a MMIO region - be careful using these unless you really understand them */
41#define DRM_READ64(map, offset) readq(((void __iomem *)(map)->handle) + (offset)) 39#define DRM_READ64(map, offset) readq(((void __iomem *)(map)->handle) + (offset))
42/** Write a qword into a MMIO region */ 40/** Write a qword into a MMIO region */
43#define DRM_WRITE64(map, offset, val) writeq(val, ((void __iomem *)(map)->handle) + (offset)) 41#define DRM_WRITE64(map, offset, val) writeq(val, ((void __iomem *)(map)->handle) + (offset))
44 42
45#define DRM_READMEMORYBARRIER() rmb()
46/** Write memory barrier */
47#define DRM_WRITEMEMORYBARRIER() wmb()
48/** Read/write memory barrier */
49#define DRM_MEMORYBARRIER() mb()
50
51/** IRQ handler arguments and return type and values */
52#define DRM_IRQ_ARGS int irq, void *arg
53
54/** AGP types */
55#if __OS_HAS_AGP
56#define DRM_AGP_MEM struct agp_memory
57#define DRM_AGP_KERN struct agp_kern_info
58#else
59/* define some dummy types for non AGP supporting kernels */
60struct no_agp_kern {
61 unsigned long aper_base;
62 unsigned long aper_size;
63};
64#define DRM_AGP_MEM int
65#define DRM_AGP_KERN struct no_agp_kern
66#endif
67
68/** Other copying of data to kernel space */
69#define DRM_COPY_FROM_USER(arg1, arg2, arg3) \
70 copy_from_user(arg1, arg2, arg3)
71/** Other copying of data from kernel space */
72#define DRM_COPY_TO_USER(arg1, arg2, arg3) \
73 copy_to_user(arg1, arg2, arg3)
74
75#define DRM_HZ HZ
76
77#define DRM_WAIT_ON( ret, queue, timeout, condition ) \ 43#define DRM_WAIT_ON( ret, queue, timeout, condition ) \
78do { \ 44do { \
79 DECLARE_WAITQUEUE(entry, current); \ 45 DECLARE_WAITQUEUE(entry, current); \
@@ -97,6 +63,3 @@ do { \
97 __set_current_state(TASK_RUNNING); \ 63 __set_current_state(TASK_RUNNING); \
98 remove_wait_queue(&(queue), &entry); \ 64 remove_wait_queue(&(queue), &entry); \
99} while (0) 65} while (0)
100
101#define DRM_WAKEUP( queue ) wake_up( queue )
102#define DRM_INIT_WAITQUEUE( queue ) init_waitqueue_head( queue )
diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h
new file mode 100644
index 000000000000..c2ab77add67c
--- /dev/null
+++ b/include/drm/drm_panel.h
@@ -0,0 +1,82 @@
1/*
2 * Copyright (C) 2013, 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, sub license,
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 (including the
12 * next paragraph) shall be included in all copies or substantial portions
13 * of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
22 */
23
24#ifndef __DRM_PANEL_H__
25#define __DRM_PANEL_H__
26
27#include <linux/list.h>
28
29struct drm_connector;
30struct drm_device;
31struct drm_panel;
32
33struct drm_panel_funcs {
34 int (*disable)(struct drm_panel *panel);
35 int (*enable)(struct drm_panel *panel);
36 int (*get_modes)(struct drm_panel *panel);
37};
38
39struct drm_panel {
40 struct drm_device *drm;
41 struct drm_connector *connector;
42 struct device *dev;
43
44 const struct drm_panel_funcs *funcs;
45
46 struct list_head list;
47};
48
49static inline int drm_panel_disable(struct drm_panel *panel)
50{
51 if (panel && panel->funcs && panel->funcs->disable)
52 return panel->funcs->disable(panel);
53
54 return panel ? -ENOSYS : -EINVAL;
55}
56
57static inline int drm_panel_enable(struct drm_panel *panel)
58{
59 if (panel && panel->funcs && panel->funcs->enable)
60 return panel->funcs->enable(panel);
61
62 return panel ? -ENOSYS : -EINVAL;
63}
64
65void drm_panel_init(struct drm_panel *panel);
66
67int drm_panel_add(struct drm_panel *panel);
68void drm_panel_remove(struct drm_panel *panel);
69
70int drm_panel_attach(struct drm_panel *panel, struct drm_connector *connector);
71int drm_panel_detach(struct drm_panel *panel);
72
73#ifdef CONFIG_OF
74struct drm_panel *of_drm_find_panel(struct device_node *np);
75#else
76static inline struct drm_panel *of_drm_find_panel(struct device_node *np)
77{
78 return NULL;
79}
80#endif
81
82#endif
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
index 8639c85d61c4..32d34ebf0706 100644
--- a/include/drm/ttm/ttm_bo_driver.h
+++ b/include/drm/ttm/ttm_bo_driver.h
@@ -681,6 +681,15 @@ extern int ttm_tt_set_placement_caching(struct ttm_tt *ttm, uint32_t placement);
681extern int ttm_tt_swapout(struct ttm_tt *ttm, 681extern int ttm_tt_swapout(struct ttm_tt *ttm,
682 struct file *persistent_swap_storage); 682 struct file *persistent_swap_storage);
683 683
684/**
685 * ttm_tt_unpopulate - free pages from a ttm
686 *
687 * @ttm: Pointer to the ttm_tt structure
688 *
689 * Calls the driver method to free all pages from a ttm
690 */
691extern void ttm_tt_unpopulate(struct ttm_tt *ttm);
692
684/* 693/*
685 * ttm_bo.c 694 * ttm_bo.c
686 */ 695 */
diff --git a/include/drm/ttm/ttm_object.h b/include/drm/ttm/ttm_object.h
index 58b029894eb3..0097cc03034e 100644
--- a/include/drm/ttm/ttm_object.h
+++ b/include/drm/ttm/ttm_object.h
@@ -190,14 +190,26 @@ extern int ttm_base_object_init(struct ttm_object_file *tfile,
190 * @key: Hash key 190 * @key: Hash key
191 * 191 *
192 * Looks up a struct ttm_base_object with the key @key. 192 * Looks up a struct ttm_base_object with the key @key.
193 * Also verifies that the object is visible to the application, by
194 * comparing the @tfile argument and checking the object shareable flag.
195 */ 193 */
196 194
197extern struct ttm_base_object *ttm_base_object_lookup(struct ttm_object_file 195extern struct ttm_base_object *ttm_base_object_lookup(struct ttm_object_file
198 *tfile, uint32_t key); 196 *tfile, uint32_t key);
199 197
200/** 198/**
199 * ttm_base_object_lookup_for_ref
200 *
201 * @tdev: Pointer to a struct ttm_object_device.
202 * @key: Hash key
203 *
204 * Looks up a struct ttm_base_object with the key @key.
205 * This function should only be used when the struct tfile associated with the
206 * caller doesn't yet have a reference to the base object.
207 */
208
209extern struct ttm_base_object *
210ttm_base_object_lookup_for_ref(struct ttm_object_device *tdev, uint32_t key);
211
212/**
201 * ttm_base_object_unref 213 * ttm_base_object_unref
202 * 214 *
203 * @p_base: Pointer to a pointer referencing a struct ttm_base_object. 215 * @p_base: Pointer to a pointer referencing a struct ttm_base_object.
@@ -218,6 +230,8 @@ extern void ttm_base_object_unref(struct ttm_base_object **p_base);
218 * @existed: Upon completion, indicates that an identical reference object 230 * @existed: Upon completion, indicates that an identical reference object
219 * already existed, and the refcount was upped on that object instead. 231 * already existed, and the refcount was upped on that object instead.
220 * 232 *
233 * Checks that the base object is shareable and adds a ref object to it.
234 *
221 * Adding a ref object to a base object is basically like referencing the 235 * Adding a ref object to a base object is basically like referencing the
222 * base object, but a user-space application holds the reference. When the 236 * base object, but a user-space application holds the reference. When the
223 * file corresponding to @tfile is closed, all its reference objects are 237 * file corresponding to @tfile is closed, all its reference objects are
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 70c4836e4a9f..fe6ac956550e 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -613,8 +613,8 @@ extern ssize_t fb_sys_write(struct fb_info *info, const char __user *buf,
613extern int register_framebuffer(struct fb_info *fb_info); 613extern int register_framebuffer(struct fb_info *fb_info);
614extern int unregister_framebuffer(struct fb_info *fb_info); 614extern int unregister_framebuffer(struct fb_info *fb_info);
615extern int unlink_framebuffer(struct fb_info *fb_info); 615extern int unlink_framebuffer(struct fb_info *fb_info);
616extern void remove_conflicting_framebuffers(struct apertures_struct *a, 616extern int remove_conflicting_framebuffers(struct apertures_struct *a,
617 const char *name, bool primary); 617 const char *name, bool primary);
618extern int fb_prepare_logo(struct fb_info *fb_info, int rotate); 618extern int fb_prepare_logo(struct fb_info *fb_info, int rotate);
619extern int fb_show_logo(struct fb_info *fb_info, int rotate); 619extern int fb_show_logo(struct fb_info *fb_info, int rotate);
620extern char* fb_get_buffer_offset(struct fb_info *info, struct fb_pixmap *buf, u32 size); 620extern char* fb_get_buffer_offset(struct fb_info *info, struct fb_pixmap *buf, u32 size);
diff --git a/include/linux/host1x.h b/include/linux/host1x.h
index f5b9b87ac9a9..3af847273277 100644
--- a/include/linux/host1x.h
+++ b/include/linux/host1x.h
@@ -281,4 +281,10 @@ int host1x_device_exit(struct host1x_device *device);
281int host1x_client_register(struct host1x_client *client); 281int host1x_client_register(struct host1x_client *client);
282int host1x_client_unregister(struct host1x_client *client); 282int host1x_client_unregister(struct host1x_client *client);
283 283
284struct tegra_mipi_device;
285
286struct tegra_mipi_device *tegra_mipi_request(struct device *device);
287void tegra_mipi_free(struct tegra_mipi_device *device);
288int tegra_mipi_calibrate(struct tegra_mipi_device *device);
289
284#endif 290#endif
diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h
index 9b24d65fed72..3c9a833992e8 100644
--- a/include/uapi/drm/drm.h
+++ b/include/uapi/drm/drm.h
@@ -181,7 +181,6 @@ enum drm_map_type {
181 _DRM_AGP = 3, /**< AGP/GART */ 181 _DRM_AGP = 3, /**< AGP/GART */
182 _DRM_SCATTER_GATHER = 4, /**< Scatter/gather memory for PCI DMA */ 182 _DRM_SCATTER_GATHER = 4, /**< Scatter/gather memory for PCI DMA */
183 _DRM_CONSISTENT = 5, /**< Consistent memory for PCI DMA */ 183 _DRM_CONSISTENT = 5, /**< Consistent memory for PCI DMA */
184 _DRM_GEM = 6, /**< GEM object (obsolete) */
185}; 184};
186 185
187/** 186/**
diff --git a/include/uapi/drm/i915_drm.h b/include/uapi/drm/i915_drm.h
index 3a4e97bd8607..126bfaa8bb6b 100644
--- a/include/uapi/drm/i915_drm.h
+++ b/include/uapi/drm/i915_drm.h
@@ -222,6 +222,7 @@ typedef struct _drm_i915_sarea {
222#define DRM_I915_GEM_SET_CACHING 0x2f 222#define DRM_I915_GEM_SET_CACHING 0x2f
223#define DRM_I915_GEM_GET_CACHING 0x30 223#define DRM_I915_GEM_GET_CACHING 0x30
224#define DRM_I915_REG_READ 0x31 224#define DRM_I915_REG_READ 0x31
225#define DRM_I915_GET_RESET_STATS 0x32
225 226
226#define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t) 227#define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t)
227#define DRM_IOCTL_I915_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH) 228#define DRM_IOCTL_I915_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH)
@@ -271,6 +272,7 @@ typedef struct _drm_i915_sarea {
271#define DRM_IOCTL_I915_GEM_CONTEXT_CREATE DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_CREATE, struct drm_i915_gem_context_create) 272#define DRM_IOCTL_I915_GEM_CONTEXT_CREATE DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_CREATE, struct drm_i915_gem_context_create)
272#define DRM_IOCTL_I915_GEM_CONTEXT_DESTROY DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_DESTROY, struct drm_i915_gem_context_destroy) 273#define DRM_IOCTL_I915_GEM_CONTEXT_DESTROY DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_DESTROY, struct drm_i915_gem_context_destroy)
273#define DRM_IOCTL_I915_REG_READ DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_REG_READ, struct drm_i915_reg_read) 274#define DRM_IOCTL_I915_REG_READ DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_REG_READ, struct drm_i915_reg_read)
275#define DRM_IOCTL_I915_GET_RESET_STATS DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GET_RESET_STATS, struct drm_i915_reset_stats)
274 276
275/* Allow drivers to submit batchbuffers directly to hardware, relying 277/* Allow drivers to submit batchbuffers directly to hardware, relying
276 * on the security mechanisms provided by hardware. 278 * on the security mechanisms provided by hardware.
@@ -719,7 +721,7 @@ struct drm_i915_gem_execbuffer2 {
719 */ 721 */
720#define I915_EXEC_IS_PINNED (1<<10) 722#define I915_EXEC_IS_PINNED (1<<10)
721 723
722/** Provide a hint to the kernel that the command stream and auxilliary 724/** Provide a hint to the kernel that the command stream and auxiliary
723 * state buffers already holds the correct presumed addresses and so the 725 * state buffers already holds the correct presumed addresses and so the
724 * relocation process may be skipped if no buffers need to be moved in 726 * relocation process may be skipped if no buffers need to be moved in
725 * preparation for the execbuffer. 727 * preparation for the execbuffer.
@@ -1030,4 +1032,21 @@ struct drm_i915_reg_read {
1030 __u64 offset; 1032 __u64 offset;
1031 __u64 val; /* Return value */ 1033 __u64 val; /* Return value */
1032}; 1034};
1035
1036struct drm_i915_reset_stats {
1037 __u32 ctx_id;
1038 __u32 flags;
1039
1040 /* All resets since boot/module reload, for all contexts */
1041 __u32 reset_count;
1042
1043 /* Number of batches lost when active in GPU, for this context */
1044 __u32 batch_active;
1045
1046 /* Number of batches lost pending for execution, for this context */
1047 __u32 batch_pending;
1048
1049 __u32 pad;
1050};
1051
1033#endif /* _UAPI_I915_DRM_H_ */ 1052#endif /* _UAPI_I915_DRM_H_ */
diff --git a/include/uapi/drm/radeon_drm.h b/include/uapi/drm/radeon_drm.h
index fe421e8a431b..d9ea3a73afe2 100644
--- a/include/uapi/drm/radeon_drm.h
+++ b/include/uapi/drm/radeon_drm.h
@@ -985,6 +985,8 @@ struct drm_radeon_cs {
985#define RADEON_INFO_CIK_MACROTILE_MODE_ARRAY 0x18 985#define RADEON_INFO_CIK_MACROTILE_MODE_ARRAY 0x18
986/* query the number of render backends */ 986/* query the number of render backends */
987#define RADEON_INFO_SI_BACKEND_ENABLED_MASK 0x19 987#define RADEON_INFO_SI_BACKEND_ENABLED_MASK 0x19
988/* max engine clock - needed for OpenCL */
989#define RADEON_INFO_MAX_SCLK 0x1a
988 990
989 991
990struct drm_radeon_info { 992struct drm_radeon_info {
diff --git a/include/uapi/drm/vmwgfx_drm.h b/include/uapi/drm/vmwgfx_drm.h
index f854ca4a1372..9971c560ed9a 100644
--- a/include/uapi/drm/vmwgfx_drm.h
+++ b/include/uapi/drm/vmwgfx_drm.h
@@ -28,6 +28,10 @@
28#ifndef __VMWGFX_DRM_H__ 28#ifndef __VMWGFX_DRM_H__
29#define __VMWGFX_DRM_H__ 29#define __VMWGFX_DRM_H__
30 30
31#ifndef __KERNEL__
32#include <drm.h>
33#endif
34
31#define DRM_VMW_MAX_SURFACE_FACES 6 35#define DRM_VMW_MAX_SURFACE_FACES 6
32#define DRM_VMW_MAX_MIP_LEVELS 24 36#define DRM_VMW_MAX_MIP_LEVELS 24
33 37
@@ -55,6 +59,11 @@
55#define DRM_VMW_PRESENT 18 59#define DRM_VMW_PRESENT 18
56#define DRM_VMW_PRESENT_READBACK 19 60#define DRM_VMW_PRESENT_READBACK 19
57#define DRM_VMW_UPDATE_LAYOUT 20 61#define DRM_VMW_UPDATE_LAYOUT 20
62#define DRM_VMW_CREATE_SHADER 21
63#define DRM_VMW_UNREF_SHADER 22
64#define DRM_VMW_GB_SURFACE_CREATE 23
65#define DRM_VMW_GB_SURFACE_REF 24
66#define DRM_VMW_SYNCCPU 25
58 67
59/*************************************************************************/ 68/*************************************************************************/
60/** 69/**
@@ -76,6 +85,8 @@
76#define DRM_VMW_PARAM_MAX_FB_SIZE 5 85#define DRM_VMW_PARAM_MAX_FB_SIZE 5
77#define DRM_VMW_PARAM_FIFO_HW_VERSION 6 86#define DRM_VMW_PARAM_FIFO_HW_VERSION 6
78#define DRM_VMW_PARAM_MAX_SURF_MEMORY 7 87#define DRM_VMW_PARAM_MAX_SURF_MEMORY 7
88#define DRM_VMW_PARAM_3D_CAPS_SIZE 8
89#define DRM_VMW_PARAM_MAX_MOB_MEMORY 9
79 90
80/** 91/**
81 * struct drm_vmw_getparam_arg 92 * struct drm_vmw_getparam_arg
@@ -788,4 +799,253 @@ struct drm_vmw_update_layout_arg {
788 uint64_t rects; 799 uint64_t rects;
789}; 800};
790 801
802
803/*************************************************************************/
804/**
805 * DRM_VMW_CREATE_SHADER - Create shader
806 *
807 * Creates a shader and optionally binds it to a dma buffer containing
808 * the shader byte-code.
809 */
810
811/**
812 * enum drm_vmw_shader_type - Shader types
813 */
814enum drm_vmw_shader_type {
815 drm_vmw_shader_type_vs = 0,
816 drm_vmw_shader_type_ps,
817 drm_vmw_shader_type_gs
818};
819
820
821/**
822 * struct drm_vmw_shader_create_arg
823 *
824 * @shader_type: Shader type of the shader to create.
825 * @size: Size of the byte-code in bytes.
826 * where the shader byte-code starts
827 * @buffer_handle: Buffer handle identifying the buffer containing the
828 * shader byte-code
829 * @shader_handle: On successful completion contains a handle that
830 * can be used to subsequently identify the shader.
831 * @offset: Offset in bytes into the buffer given by @buffer_handle,
832 *
833 * Input / Output argument to the DRM_VMW_CREATE_SHADER Ioctl.
834 */
835struct drm_vmw_shader_create_arg {
836 enum drm_vmw_shader_type shader_type;
837 uint32_t size;
838 uint32_t buffer_handle;
839 uint32_t shader_handle;
840 uint64_t offset;
841};
842
843/*************************************************************************/
844/**
845 * DRM_VMW_UNREF_SHADER - Unreferences a shader
846 *
847 * Destroys a user-space reference to a shader, optionally destroying
848 * it.
849 */
850
851/**
852 * struct drm_vmw_shader_arg
853 *
854 * @handle: Handle identifying the shader to destroy.
855 *
856 * Input argument to the DRM_VMW_UNREF_SHADER ioctl.
857 */
858struct drm_vmw_shader_arg {
859 uint32_t handle;
860 uint32_t pad64;
861};
862
863/*************************************************************************/
864/**
865 * DRM_VMW_GB_SURFACE_CREATE - Create a host guest-backed surface.
866 *
867 * Allocates a surface handle and queues a create surface command
868 * for the host on the first use of the surface. The surface ID can
869 * be used as the surface ID in commands referencing the surface.
870 */
871
872/**
873 * enum drm_vmw_surface_flags
874 *
875 * @drm_vmw_surface_flag_shareable: Whether the surface is shareable
876 * @drm_vmw_surface_flag_scanout: Whether the surface is a scanout
877 * surface.
878 * @drm_vmw_surface_flag_create_buffer: Create a backup buffer if none is
879 * given.
880 */
881enum drm_vmw_surface_flags {
882 drm_vmw_surface_flag_shareable = (1 << 0),
883 drm_vmw_surface_flag_scanout = (1 << 1),
884 drm_vmw_surface_flag_create_buffer = (1 << 2)
885};
886
887/**
888 * struct drm_vmw_gb_surface_create_req
889 *
890 * @svga3d_flags: SVGA3d surface flags for the device.
891 * @format: SVGA3d format.
892 * @mip_level: Number of mip levels for all faces.
893 * @drm_surface_flags Flags as described above.
894 * @multisample_count Future use. Set to 0.
895 * @autogen_filter Future use. Set to 0.
896 * @buffer_handle Buffer handle of backup buffer. SVGA3D_INVALID_ID
897 * if none.
898 * @base_size Size of the base mip level for all faces.
899 *
900 * Input argument to the DRM_VMW_GB_SURFACE_CREATE Ioctl.
901 * Part of output argument for the DRM_VMW_GB_SURFACE_REF Ioctl.
902 */
903struct drm_vmw_gb_surface_create_req {
904 uint32_t svga3d_flags;
905 uint32_t format;
906 uint32_t mip_levels;
907 enum drm_vmw_surface_flags drm_surface_flags;
908 uint32_t multisample_count;
909 uint32_t autogen_filter;
910 uint32_t buffer_handle;
911 uint32_t pad64;
912 struct drm_vmw_size base_size;
913};
914
915/**
916 * struct drm_vmw_gb_surface_create_rep
917 *
918 * @handle: Surface handle.
919 * @backup_size: Size of backup buffers for this surface.
920 * @buffer_handle: Handle of backup buffer. SVGA3D_INVALID_ID if none.
921 * @buffer_size: Actual size of the buffer identified by
922 * @buffer_handle
923 * @buffer_map_handle: Offset into device address space for the buffer
924 * identified by @buffer_handle.
925 *
926 * Part of output argument for the DRM_VMW_GB_SURFACE_REF ioctl.
927 * Output argument for the DRM_VMW_GB_SURFACE_CREATE ioctl.
928 */
929struct drm_vmw_gb_surface_create_rep {
930 uint32_t handle;
931 uint32_t backup_size;
932 uint32_t buffer_handle;
933 uint32_t buffer_size;
934 uint64_t buffer_map_handle;
935};
936
937/**
938 * union drm_vmw_gb_surface_create_arg
939 *
940 * @req: Input argument as described above.
941 * @rep: Output argument as described above.
942 *
943 * Argument to the DRM_VMW_GB_SURFACE_CREATE ioctl.
944 */
945union drm_vmw_gb_surface_create_arg {
946 struct drm_vmw_gb_surface_create_rep rep;
947 struct drm_vmw_gb_surface_create_req req;
948};
949
950/*************************************************************************/
951/**
952 * DRM_VMW_GB_SURFACE_REF - Reference a host surface.
953 *
954 * Puts a reference on a host surface with a given handle, as previously
955 * returned by the DRM_VMW_GB_SURFACE_CREATE ioctl.
956 * A reference will make sure the surface isn't destroyed while we hold
957 * it and will allow the calling client to use the surface handle in
958 * the command stream.
959 *
960 * On successful return, the Ioctl returns the surface information given
961 * to and returned from the DRM_VMW_GB_SURFACE_CREATE ioctl.
962 */
963
964/**
965 * struct drm_vmw_gb_surface_reference_arg
966 *
967 * @creq: The data used as input when the surface was created, as described
968 * above at "struct drm_vmw_gb_surface_create_req"
969 * @crep: Additional data output when the surface was created, as described
970 * above at "struct drm_vmw_gb_surface_create_rep"
971 *
972 * Output Argument to the DRM_VMW_GB_SURFACE_REF ioctl.
973 */
974struct drm_vmw_gb_surface_ref_rep {
975 struct drm_vmw_gb_surface_create_req creq;
976 struct drm_vmw_gb_surface_create_rep crep;
977};
978
979/**
980 * union drm_vmw_gb_surface_reference_arg
981 *
982 * @req: Input data as described above at "struct drm_vmw_surface_arg"
983 * @rep: Output data as described above at "struct drm_vmw_gb_surface_ref_rep"
984 *
985 * Argument to the DRM_VMW_GB_SURFACE_REF Ioctl.
986 */
987union drm_vmw_gb_surface_reference_arg {
988 struct drm_vmw_gb_surface_ref_rep rep;
989 struct drm_vmw_surface_arg req;
990};
991
992
993/*************************************************************************/
994/**
995 * DRM_VMW_SYNCCPU - Sync a DMA buffer / MOB for CPU access.
996 *
997 * Idles any previously submitted GPU operations on the buffer and
998 * by default blocks command submissions that reference the buffer.
999 * If the file descriptor used to grab a blocking CPU sync is closed, the
1000 * cpu sync is released.
1001 * The flags argument indicates how the grab / release operation should be
1002 * performed:
1003 */
1004
1005/**
1006 * enum drm_vmw_synccpu_flags - Synccpu flags:
1007 *
1008 * @drm_vmw_synccpu_read: Sync for read. If sync is done for read only, it's a
1009 * hint to the kernel to allow command submissions that references the buffer
1010 * for read-only.
1011 * @drm_vmw_synccpu_write: Sync for write. Block all command submissions
1012 * referencing this buffer.
1013 * @drm_vmw_synccpu_dontblock: Dont wait for GPU idle, but rather return
1014 * -EBUSY should the buffer be busy.
1015 * @drm_vmw_synccpu_allow_cs: Allow command submission that touches the buffer
1016 * while the buffer is synced for CPU. This is similar to the GEM bo idle
1017 * behavior.
1018 */
1019enum drm_vmw_synccpu_flags {
1020 drm_vmw_synccpu_read = (1 << 0),
1021 drm_vmw_synccpu_write = (1 << 1),
1022 drm_vmw_synccpu_dontblock = (1 << 2),
1023 drm_vmw_synccpu_allow_cs = (1 << 3)
1024};
1025
1026/**
1027 * enum drm_vmw_synccpu_op - Synccpu operations:
1028 *
1029 * @drm_vmw_synccpu_grab: Grab the buffer for CPU operations
1030 * @drm_vmw_synccpu_release: Release a previous grab.
1031 */
1032enum drm_vmw_synccpu_op {
1033 drm_vmw_synccpu_grab,
1034 drm_vmw_synccpu_release
1035};
1036
1037/**
1038 * struct drm_vmw_synccpu_arg
1039 *
1040 * @op: The synccpu operation as described above.
1041 * @handle: Handle identifying the buffer object.
1042 * @flags: Flags as described above.
1043 */
1044struct drm_vmw_synccpu_arg {
1045 enum drm_vmw_synccpu_op op;
1046 enum drm_vmw_synccpu_flags flags;
1047 uint32_t handle;
1048 uint32_t pad64;
1049};
1050
791#endif 1051#endif