aboutsummaryrefslogtreecommitdiffstats
path: root/include/drm
diff options
context:
space:
mode:
authorAndrea Bastoni <bastoni@cs.unc.edu>2010-10-23 01:01:49 -0400
committerAndrea Bastoni <bastoni@cs.unc.edu>2010-10-23 01:01:49 -0400
commit3dd41424090a0ca3a660218d06afe6ff4441bad3 (patch)
tree511ef1bb1799027fc5aad574adce49120ecadd87 /include/drm
parent5c5456402d467969b217d7fdd6670f8c8600f5a8 (diff)
parentf6f94e2ab1b33f0082ac22d71f66385a60d8157f (diff)
Merge commit 'v2.6.36' into wip-merge-2.6.36
Conflicts: Makefile arch/x86/include/asm/unistd_32.h arch/x86/kernel/syscall_table_32.S kernel/sched.c kernel/time/tick-sched.c Relevant API and functions changes (solved in this commit): - (API) .enqueue_task() (enqueue_task_litmus), dequeue_task() (dequeue_task_litmus), [litmus/sched_litmus.c] - (API) .select_task_rq() (select_task_rq_litmus) [litmus/sched_litmus.c] - (API) sysrq_dump_trace_buffer() and sysrq_handle_kill_rt_tasks() [litmus/sched_trace.c] - struct kfifo internal buffer name changed (buffer -> buf) [litmus/sched_trace.c] - add_wait_queue_exclusive_locked -> __add_wait_queue_tail_exclusive [litmus/fmlp.c] - syscall numbers for both x86_32 and x86_64
Diffstat (limited to 'include/drm')
-rw-r--r--include/drm/Kbuild26
-rw-r--r--include/drm/drm.h2
-rw-r--r--include/drm/drmP.h120
-rw-r--r--include/drm/drm_core.h2
-rw-r--r--include/drm/drm_crtc.h89
-rw-r--r--include/drm/drm_crtc_helper.h17
-rw-r--r--include/drm/drm_edid.h11
-rw-r--r--include/drm/drm_fb_helper.h72
-rw-r--r--include/drm/drm_fixed.h67
-rw-r--r--include/drm/drm_global.h53
-rw-r--r--include/drm/drm_mm.h27
-rw-r--r--include/drm/drm_mode.h1
-rw-r--r--include/drm/drm_pciids.h9
-rw-r--r--include/drm/i2c/sil164.h63
-rw-r--r--include/drm/i830_drm.h28
-rw-r--r--include/drm/i915_drm.h15
-rw-r--r--include/drm/mga_drm.h2
-rw-r--r--include/drm/nouveau_drm.h14
-rw-r--r--include/drm/radeon_drm.h8
-rw-r--r--include/drm/savage_drm.h8
-rw-r--r--include/drm/ttm/ttm_bo_api.h50
-rw-r--r--include/drm/ttm/ttm_bo_driver.h64
-rw-r--r--include/drm/ttm/ttm_module.h20
-rw-r--r--include/drm/ttm/ttm_page_alloc.h70
-rw-r--r--include/drm/vmwgfx_drm.h26
25 files changed, 654 insertions, 210 deletions
diff --git a/include/drm/Kbuild b/include/drm/Kbuild
index bd3a1c2fbdb4..ffec177f3481 100644
--- a/include/drm/Kbuild
+++ b/include/drm/Kbuild
@@ -1,12 +1,14 @@
1unifdef-y += drm.h drm_sarea.h drm_mode.h 1header-y += drm.h
2unifdef-y += i810_drm.h 2header-y += drm_mode.h
3unifdef-y += i830_drm.h 3header-y += drm_sarea.h
4unifdef-y += i915_drm.h 4header-y += i810_drm.h
5unifdef-y += mga_drm.h 5header-y += i830_drm.h
6unifdef-y += r128_drm.h 6header-y += i915_drm.h
7unifdef-y += radeon_drm.h 7header-y += mga_drm.h
8unifdef-y += sis_drm.h 8header-y += nouveau_drm.h
9unifdef-y += savage_drm.h 9header-y += r128_drm.h
10unifdef-y += vmwgfx_drm.h 10header-y += radeon_drm.h
11unifdef-y += via_drm.h 11header-y += savage_drm.h
12unifdef-y += nouveau_drm.h 12header-y += sis_drm.h
13header-y += via_drm.h
14header-y += vmwgfx_drm.h
diff --git a/include/drm/drm.h b/include/drm/drm.h
index e3f46e0cb7dc..e5f70617dec5 100644
--- a/include/drm/drm.h
+++ b/include/drm/drm.h
@@ -663,6 +663,8 @@ struct drm_gem_open {
663#define DRM_IOCTL_UNLOCK DRM_IOW( 0x2b, struct drm_lock) 663#define DRM_IOCTL_UNLOCK DRM_IOW( 0x2b, struct drm_lock)
664#define DRM_IOCTL_FINISH DRM_IOW( 0x2c, struct drm_lock) 664#define DRM_IOCTL_FINISH DRM_IOW( 0x2c, struct drm_lock)
665 665
666#define DRM_IOCTL_GEM_PRIME_OPEN DRM_IOWR(0x2e, struct drm_gem_open)
667
666#define DRM_IOCTL_AGP_ACQUIRE DRM_IO( 0x30) 668#define DRM_IOCTL_AGP_ACQUIRE DRM_IO( 0x30)
667#define DRM_IOCTL_AGP_RELEASE DRM_IO( 0x31) 669#define DRM_IOCTL_AGP_RELEASE DRM_IO( 0x31)
668#define DRM_IOCTL_AGP_ENABLE DRM_IOW( 0x32, struct drm_agp_mode) 670#define DRM_IOCTL_AGP_ENABLE DRM_IOW( 0x32, struct drm_agp_mode)
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 2f3b3a00b7a3..4c9461a4f9e6 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -9,6 +9,7 @@
9/* 9/*
10 * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. 10 * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
11 * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. 11 * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
12 * Copyright (c) 2009-2010, Code Aurora Forum.
12 * All rights reserved. 13 * All rights reserved.
13 * 14 *
14 * Permission is hereby granted, free of charge, to any person obtaining a 15 * Permission is hereby granted, free of charge, to any person obtaining a
@@ -48,9 +49,9 @@
48#include <linux/proc_fs.h> 49#include <linux/proc_fs.h>
49#include <linux/init.h> 50#include <linux/init.h>
50#include <linux/file.h> 51#include <linux/file.h>
52#include <linux/platform_device.h>
51#include <linux/pci.h> 53#include <linux/pci.h>
52#include <linux/jiffies.h> 54#include <linux/jiffies.h>
53#include <linux/smp_lock.h> /* For (un)lock_kernel */
54#include <linux/dma-mapping.h> 55#include <linux/dma-mapping.h>
55#include <linux/mm.h> 56#include <linux/mm.h>
56#include <linux/cdev.h> 57#include <linux/cdev.h>
@@ -144,6 +145,7 @@ extern void drm_ut_debug_printk(unsigned int request_level,
144#define DRIVER_IRQ_VBL2 0x800 145#define DRIVER_IRQ_VBL2 0x800
145#define DRIVER_GEM 0x1000 146#define DRIVER_GEM 0x1000
146#define DRIVER_MODESET 0x2000 147#define DRIVER_MODESET 0x2000
148#define DRIVER_USE_PLATFORM_DEVICE 0x4000
147 149
148/***********************************************************************/ 150/***********************************************************************/
149/** \name Begin the DRM... */ 151/** \name Begin the DRM... */
@@ -303,14 +305,16 @@ struct drm_ioctl_desc {
303 unsigned int cmd; 305 unsigned int cmd;
304 int flags; 306 int flags;
305 drm_ioctl_t *func; 307 drm_ioctl_t *func;
308 unsigned int cmd_drv;
306}; 309};
307 310
308/** 311/**
309 * Creates a driver or general drm_ioctl_desc array entry for the given 312 * Creates a driver or general drm_ioctl_desc array entry for the given
310 * ioctl, for use by drm_ioctl(). 313 * ioctl, for use by drm_ioctl().
311 */ 314 */
312#define DRM_IOCTL_DEF(ioctl, _func, _flags) \ 315
313 [DRM_IOCTL_NR(ioctl)] = {.cmd = ioctl, .func = _func, .flags = _flags} 316#define DRM_IOCTL_DEF_DRV(ioctl, _func, _flags) \
317 [DRM_IOCTL_NR(DRM_##ioctl)] = {.cmd = DRM_##ioctl, .func = _func, .flags = _flags, .cmd_drv = DRM_IOCTL_##ioctl}
314 318
315struct drm_magic_entry { 319struct drm_magic_entry {
316 struct list_head head; 320 struct list_head head;
@@ -403,6 +407,8 @@ struct drm_pending_event {
403 struct drm_event *event; 407 struct drm_event *event;
404 struct list_head link; 408 struct list_head link;
405 struct drm_file *file_priv; 409 struct drm_file *file_priv;
410 pid_t pid; /* pid of requester, no guarantee it's valid by the time
411 we deliver the event, for tracing only */
406 void (*destroy)(struct drm_pending_event *event); 412 void (*destroy)(struct drm_pending_event *event);
407}; 413};
408 414
@@ -606,7 +612,7 @@ struct drm_gem_object {
606 struct kref refcount; 612 struct kref refcount;
607 613
608 /** Handle count of this object. Each handle also holds a reference */ 614 /** Handle count of this object. Each handle also holds a reference */
609 struct kref handlecount; 615 atomic_t handle_count; /* number of handles on this object */
610 616
611 /** Related drm device */ 617 /** Related drm device */
612 struct drm_device *dev; 618 struct drm_device *dev;
@@ -802,7 +808,6 @@ struct drm_driver {
802 */ 808 */
803 int (*gem_init_object) (struct drm_gem_object *obj); 809 int (*gem_init_object) (struct drm_gem_object *obj);
804 void (*gem_free_object) (struct drm_gem_object *obj); 810 void (*gem_free_object) (struct drm_gem_object *obj);
805 void (*gem_free_object_unlocked) (struct drm_gem_object *obj);
806 811
807 /* vga arb irq handler */ 812 /* vga arb irq handler */
808 void (*vgaarb_irq)(struct drm_device *dev, bool state); 813 void (*vgaarb_irq)(struct drm_device *dev, bool state);
@@ -823,6 +828,7 @@ struct drm_driver {
823 int num_ioctls; 828 int num_ioctls;
824 struct file_operations fops; 829 struct file_operations fops;
825 struct pci_driver pci_driver; 830 struct pci_driver pci_driver;
831 struct platform_device *platform_device;
826 /* List of devices hanging off this driver */ 832 /* List of devices hanging off this driver */
827 struct list_head device_list; 833 struct list_head device_list;
828}; 834};
@@ -1015,12 +1021,16 @@ struct drm_device {
1015 1021
1016 struct drm_agp_head *agp; /**< AGP data */ 1022 struct drm_agp_head *agp; /**< AGP data */
1017 1023
1024 struct device *dev; /**< Device structure */
1018 struct pci_dev *pdev; /**< PCI device structure */ 1025 struct pci_dev *pdev; /**< PCI device structure */
1019 int pci_vendor; /**< PCI vendor id */ 1026 int pci_vendor; /**< PCI vendor id */
1020 int pci_device; /**< PCI device id */ 1027 int pci_device; /**< PCI device id */
1021#ifdef __alpha__ 1028#ifdef __alpha__
1022 struct pci_controller *hose; 1029 struct pci_controller *hose;
1023#endif 1030#endif
1031
1032 struct platform_device *platformdev; /**< Platform device struture */
1033
1024 struct drm_sg_mem *sg; /**< Scatter gather memory */ 1034 struct drm_sg_mem *sg; /**< Scatter gather memory */
1025 int num_crtcs; /**< Number of CRTCs on this device */ 1035 int num_crtcs; /**< Number of CRTCs on this device */
1026 void *dev_private; /**< device private data */ 1036 void *dev_private; /**< device private data */
@@ -1060,22 +1070,36 @@ struct drm_device {
1060 1070
1061}; 1071};
1062 1072
1063static inline int drm_dev_to_irq(struct drm_device *dev)
1064{
1065 return dev->pdev->irq;
1066}
1067
1068static __inline__ int drm_core_check_feature(struct drm_device *dev, 1073static __inline__ int drm_core_check_feature(struct drm_device *dev,
1069 int feature) 1074 int feature)
1070{ 1075{
1071 return ((dev->driver->driver_features & feature) ? 1 : 0); 1076 return ((dev->driver->driver_features & feature) ? 1 : 0);
1072} 1077}
1073 1078
1074#ifdef __alpha__ 1079static inline int drm_dev_to_irq(struct drm_device *dev)
1075#define drm_get_pci_domain(dev) dev->hose->index 1080{
1076#else 1081 if (drm_core_check_feature(dev, DRIVER_USE_PLATFORM_DEVICE))
1077#define drm_get_pci_domain(dev) 0 1082 return platform_get_irq(dev->platformdev, 0);
1078#endif 1083 else
1084 return dev->pdev->irq;
1085}
1086
1087static inline int drm_get_pci_domain(struct drm_device *dev)
1088{
1089 if (drm_core_check_feature(dev, DRIVER_USE_PLATFORM_DEVICE))
1090 return 0;
1091
1092#ifndef __alpha__
1093 /* For historical reasons, drm_get_pci_domain() is busticated
1094 * on most archs and has to remain so for userspace interface
1095 * < 1.4, except on alpha which was right from the beginning
1096 */
1097 if (dev->if_version < 0x10004)
1098 return 0;
1099#endif /* __alpha__ */
1100
1101 return pci_domain_nr(dev->pdev->bus);
1102}
1079 1103
1080#if __OS_HAS_AGP 1104#if __OS_HAS_AGP
1081static inline int drm_core_has_AGP(struct drm_device *dev) 1105static inline int drm_core_has_AGP(struct drm_device *dev)
@@ -1138,6 +1162,7 @@ extern long drm_compat_ioctl(struct file *filp,
1138extern int drm_lastclose(struct drm_device *dev); 1162extern int drm_lastclose(struct drm_device *dev);
1139 1163
1140 /* Device support (drm_fops.h) */ 1164 /* Device support (drm_fops.h) */
1165extern struct mutex drm_global_mutex;
1141extern int drm_open(struct inode *inode, struct file *filp); 1166extern int drm_open(struct inode *inode, struct file *filp);
1142extern int drm_stub_open(struct inode *inode, struct file *filp); 1167extern int drm_stub_open(struct inode *inode, struct file *filp);
1143extern int drm_fasync(int fd, struct file *filp, int on); 1168extern int drm_fasync(int fd, struct file *filp, int on);
@@ -1149,6 +1174,7 @@ extern int drm_release(struct inode *inode, struct file *filp);
1149extern int drm_mmap(struct file *filp, struct vm_area_struct *vma); 1174extern int drm_mmap(struct file *filp, struct vm_area_struct *vma);
1150extern int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma); 1175extern int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma);
1151extern void drm_vm_open_locked(struct vm_area_struct *vma); 1176extern void drm_vm_open_locked(struct vm_area_struct *vma);
1177extern void drm_vm_close_locked(struct vm_area_struct *vma);
1152extern resource_size_t drm_core_get_map_ofs(struct drm_local_map * map); 1178extern resource_size_t drm_core_get_map_ofs(struct drm_local_map * map);
1153extern resource_size_t drm_core_get_reg_ofs(struct drm_device *dev); 1179extern resource_size_t drm_core_get_reg_ofs(struct drm_device *dev);
1154extern unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait); 1180extern unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait);
@@ -1273,10 +1299,6 @@ extern int drm_freebufs(struct drm_device *dev, void *data,
1273extern int drm_mapbufs(struct drm_device *dev, void *data, 1299extern int drm_mapbufs(struct drm_device *dev, void *data,
1274 struct drm_file *file_priv); 1300 struct drm_file *file_priv);
1275extern int drm_order(unsigned long size); 1301extern int drm_order(unsigned long size);
1276extern resource_size_t drm_get_resource_start(struct drm_device *dev,
1277 unsigned int resource);
1278extern resource_size_t drm_get_resource_len(struct drm_device *dev,
1279 unsigned int resource);
1280 1302
1281 /* DMA support (drm_dma.h) */ 1303 /* DMA support (drm_dma.h) */
1282extern int drm_dma_setup(struct drm_device *dev); 1304extern int drm_dma_setup(struct drm_device *dev);
@@ -1351,8 +1373,11 @@ extern int drm_dropmaster_ioctl(struct drm_device *dev, void *data,
1351struct drm_master *drm_master_create(struct drm_minor *minor); 1373struct drm_master *drm_master_create(struct drm_minor *minor);
1352extern struct drm_master *drm_master_get(struct drm_master *master); 1374extern struct drm_master *drm_master_get(struct drm_master *master);
1353extern void drm_master_put(struct drm_master **master); 1375extern void drm_master_put(struct drm_master **master);
1354extern int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent, 1376extern int drm_get_pci_dev(struct pci_dev *pdev,
1355 struct drm_driver *driver); 1377 const struct pci_device_id *ent,
1378 struct drm_driver *driver);
1379extern int drm_get_platform_dev(struct platform_device *pdev,
1380 struct drm_driver *driver);
1356extern void drm_put_dev(struct drm_device *dev); 1381extern void drm_put_dev(struct drm_device *dev);
1357extern int drm_put_minor(struct drm_minor **minor); 1382extern int drm_put_minor(struct drm_minor **minor);
1358extern unsigned int drm_debug; 1383extern unsigned int drm_debug;
@@ -1428,15 +1453,19 @@ extern void drm_sysfs_connector_remove(struct drm_connector *connector);
1428/* Graphics Execution Manager library functions (drm_gem.c) */ 1453/* Graphics Execution Manager library functions (drm_gem.c) */
1429int drm_gem_init(struct drm_device *dev); 1454int drm_gem_init(struct drm_device *dev);
1430void drm_gem_destroy(struct drm_device *dev); 1455void drm_gem_destroy(struct drm_device *dev);
1456void drm_gem_object_release(struct drm_gem_object *obj);
1431void drm_gem_object_free(struct kref *kref); 1457void drm_gem_object_free(struct kref *kref);
1432void drm_gem_object_free_unlocked(struct kref *kref);
1433struct drm_gem_object *drm_gem_object_alloc(struct drm_device *dev, 1458struct drm_gem_object *drm_gem_object_alloc(struct drm_device *dev,
1434 size_t size); 1459 size_t size);
1435void drm_gem_object_handle_free(struct kref *kref); 1460int drm_gem_object_init(struct drm_device *dev,
1461 struct drm_gem_object *obj, size_t size);
1462void drm_gem_object_handle_free(struct drm_gem_object *obj);
1436void drm_gem_vm_open(struct vm_area_struct *vma); 1463void drm_gem_vm_open(struct vm_area_struct *vma);
1437void drm_gem_vm_close(struct vm_area_struct *vma); 1464void drm_gem_vm_close(struct vm_area_struct *vma);
1438int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma); 1465int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma);
1439 1466
1467#include "drm_global.h"
1468
1440static inline void 1469static inline void
1441drm_gem_object_reference(struct drm_gem_object *obj) 1470drm_gem_object_reference(struct drm_gem_object *obj)
1442{ 1471{
@@ -1453,8 +1482,12 @@ drm_gem_object_unreference(struct drm_gem_object *obj)
1453static inline void 1482static inline void
1454drm_gem_object_unreference_unlocked(struct drm_gem_object *obj) 1483drm_gem_object_unreference_unlocked(struct drm_gem_object *obj)
1455{ 1484{
1456 if (obj != NULL) 1485 if (obj != NULL) {
1457 kref_put(&obj->refcount, drm_gem_object_free_unlocked); 1486 struct drm_device *dev = obj->dev;
1487 mutex_lock(&dev->struct_mutex);
1488 kref_put(&obj->refcount, drm_gem_object_free);
1489 mutex_unlock(&dev->struct_mutex);
1490 }
1458} 1491}
1459 1492
1460int drm_gem_handle_create(struct drm_file *file_priv, 1493int drm_gem_handle_create(struct drm_file *file_priv,
@@ -1465,7 +1498,7 @@ static inline void
1465drm_gem_object_handle_reference(struct drm_gem_object *obj) 1498drm_gem_object_handle_reference(struct drm_gem_object *obj)
1466{ 1499{
1467 drm_gem_object_reference(obj); 1500 drm_gem_object_reference(obj);
1468 kref_get(&obj->handlecount); 1501 atomic_inc(&obj->handle_count);
1469} 1502}
1470 1503
1471static inline void 1504static inline void
@@ -1474,12 +1507,15 @@ drm_gem_object_handle_unreference(struct drm_gem_object *obj)
1474 if (obj == NULL) 1507 if (obj == NULL)
1475 return; 1508 return;
1476 1509
1510 if (atomic_read(&obj->handle_count) == 0)
1511 return;
1477 /* 1512 /*
1478 * Must bump handle count first as this may be the last 1513 * Must bump handle count first as this may be the last
1479 * ref, in which case the object would disappear before we 1514 * ref, in which case the object would disappear before we
1480 * checked for a name 1515 * checked for a name
1481 */ 1516 */
1482 kref_put(&obj->handlecount, drm_gem_object_handle_free); 1517 if (atomic_dec_and_test(&obj->handle_count))
1518 drm_gem_object_handle_free(obj);
1483 drm_gem_object_unreference(obj); 1519 drm_gem_object_unreference(obj);
1484} 1520}
1485 1521
@@ -1489,12 +1525,17 @@ drm_gem_object_handle_unreference_unlocked(struct drm_gem_object *obj)
1489 if (obj == NULL) 1525 if (obj == NULL)
1490 return; 1526 return;
1491 1527
1528 if (atomic_read(&obj->handle_count) == 0)
1529 return;
1530
1492 /* 1531 /*
1493 * Must bump handle count first as this may be the last 1532 * Must bump handle count first as this may be the last
1494 * ref, in which case the object would disappear before we 1533 * ref, in which case the object would disappear before we
1495 * checked for a name 1534 * checked for a name
1496 */ 1535 */
1497 kref_put(&obj->handlecount, drm_gem_object_handle_free); 1536
1537 if (atomic_dec_and_test(&obj->handle_count))
1538 drm_gem_object_handle_free(obj);
1498 drm_gem_object_unreference_unlocked(obj); 1539 drm_gem_object_unreference_unlocked(obj);
1499} 1540}
1500 1541
@@ -1526,6 +1567,9 @@ static __inline__ struct drm_local_map *drm_core_findmap(struct drm_device *dev,
1526 1567
1527static __inline__ int drm_device_is_agp(struct drm_device *dev) 1568static __inline__ int drm_device_is_agp(struct drm_device *dev)
1528{ 1569{
1570 if (drm_core_check_feature(dev, DRIVER_USE_PLATFORM_DEVICE))
1571 return 0;
1572
1529 if (dev->driver->device_is_agp != NULL) { 1573 if (dev->driver->device_is_agp != NULL) {
1530 int err = (*dev->driver->device_is_agp) (dev); 1574 int err = (*dev->driver->device_is_agp) (dev);
1531 1575
@@ -1539,7 +1583,10 @@ static __inline__ int drm_device_is_agp(struct drm_device *dev)
1539 1583
1540static __inline__ int drm_device_is_pcie(struct drm_device *dev) 1584static __inline__ int drm_device_is_pcie(struct drm_device *dev)
1541{ 1585{
1542 return pci_find_capability(dev->pdev, PCI_CAP_ID_EXP); 1586 if (drm_core_check_feature(dev, DRIVER_USE_PLATFORM_DEVICE))
1587 return 0;
1588 else
1589 return pci_find_capability(dev->pdev, PCI_CAP_ID_EXP);
1543} 1590}
1544 1591
1545static __inline__ void drm_core_dropmap(struct drm_local_map *map) 1592static __inline__ void drm_core_dropmap(struct drm_local_map *map)
@@ -1547,6 +1594,21 @@ static __inline__ void drm_core_dropmap(struct drm_local_map *map)
1547} 1594}
1548 1595
1549#include "drm_mem_util.h" 1596#include "drm_mem_util.h"
1597
1598static inline void *drm_get_device(struct drm_device *dev)
1599{
1600 if (drm_core_check_feature(dev, DRIVER_USE_PLATFORM_DEVICE))
1601 return dev->platformdev;
1602 else
1603 return dev->pdev;
1604}
1605
1606extern int drm_platform_init(struct drm_driver *driver);
1607extern int drm_pci_init(struct drm_driver *driver);
1608extern int drm_fill_in_dev(struct drm_device *dev,
1609 const struct pci_device_id *ent,
1610 struct drm_driver *driver);
1611int drm_get_minor(struct drm_device *dev, struct drm_minor **minor, int type);
1550/*@}*/ 1612/*@}*/
1551 1613
1552#endif /* __KERNEL__ */ 1614#endif /* __KERNEL__ */
diff --git a/include/drm/drm_core.h b/include/drm/drm_core.h
index 316739036079..4e7523863a4b 100644
--- a/include/drm/drm_core.h
+++ b/include/drm/drm_core.h
@@ -27,7 +27,7 @@
27#define CORE_DATE "20060810" 27#define CORE_DATE "20060810"
28 28
29#define DRM_IF_MAJOR 1 29#define DRM_IF_MAJOR 1
30#define DRM_IF_MINOR 3 30#define DRM_IF_MINOR 4
31 31
32#define CORE_MAJOR 1 32#define CORE_MAJOR 1
33#define CORE_MINOR 1 33#define CORE_MINOR 1
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 1347524a8e30..3e5a51af757c 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -189,49 +189,16 @@ enum subpixel_order {
189 */ 189 */
190struct drm_display_info { 190struct drm_display_info {
191 char name[DRM_DISPLAY_INFO_LEN]; 191 char name[DRM_DISPLAY_INFO_LEN];
192 /* Input info */ 192
193 bool serration_vsync;
194 bool sync_on_green;
195 bool composite_sync;
196 bool separate_syncs;
197 bool blank_to_black;
198 unsigned char video_level;
199 bool digital;
200 /* Physical size */ 193 /* Physical size */
201 unsigned int width_mm; 194 unsigned int width_mm;
202 unsigned int height_mm; 195 unsigned int height_mm;
203 196
204 /* Display parameters */
205 unsigned char gamma; /* FIXME: storage format */
206 bool gtf_supported;
207 bool standard_color;
208 enum {
209 monochrome = 0,
210 rgb,
211 other,
212 unknown,
213 } display_type;
214 bool active_off_supported;
215 bool suspend_supported;
216 bool standby_supported;
217
218 /* Color info FIXME: storage format */
219 unsigned short redx, redy;
220 unsigned short greenx, greeny;
221 unsigned short bluex, bluey;
222 unsigned short whitex, whitey;
223
224 /* Clock limits FIXME: storage format */ 197 /* Clock limits FIXME: storage format */
225 unsigned int min_vfreq, max_vfreq; 198 unsigned int min_vfreq, max_vfreq;
226 unsigned int min_hfreq, max_hfreq; 199 unsigned int min_hfreq, max_hfreq;
227 unsigned int pixel_clock; 200 unsigned int pixel_clock;
228 201
229 /* White point indices FIXME: storage format */
230 unsigned int wpx1, wpy1;
231 unsigned int wpgamma1;
232 unsigned int wpx2, wpy2;
233 unsigned int wpgamma2;
234
235 enum subpixel_order subpixel_order; 202 enum subpixel_order subpixel_order;
236 203
237 char *raw_edid; /* if any */ 204 char *raw_edid; /* if any */
@@ -271,8 +238,6 @@ struct drm_framebuffer {
271 unsigned int depth; 238 unsigned int depth;
272 int bits_per_pixel; 239 int bits_per_pixel;
273 int flags; 240 int flags;
274 struct fb_info *fbdev;
275 u32 pseudo_palette[17];
276 struct list_head filp_head; 241 struct list_head filp_head;
277 /* if you are using the helper */ 242 /* if you are using the helper */
278 void *helper_private; 243 void *helper_private;
@@ -344,7 +309,7 @@ struct drm_crtc_funcs {
344 309
345 /* Set gamma on the CRTC */ 310 /* Set gamma on the CRTC */
346 void (*gamma_set)(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b, 311 void (*gamma_set)(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b,
347 uint32_t size); 312 uint32_t start, uint32_t size);
348 /* Object destroy routine */ 313 /* Object destroy routine */
349 void (*destroy)(struct drm_crtc *crtc); 314 void (*destroy)(struct drm_crtc *crtc);
350 315
@@ -369,9 +334,6 @@ struct drm_crtc_funcs {
369 * @enabled: is this CRTC enabled? 334 * @enabled: is this CRTC enabled?
370 * @x: x position on screen 335 * @x: x position on screen
371 * @y: y position on screen 336 * @y: y position on screen
372 * @desired_mode: new desired mode
373 * @desired_x: desired x for desired_mode
374 * @desired_y: desired y for desired_mode
375 * @funcs: CRTC control functions 337 * @funcs: CRTC control functions
376 * 338 *
377 * Each CRTC may have one or more connectors associated with it. This structure 339 * Each CRTC may have one or more connectors associated with it. This structure
@@ -391,8 +353,6 @@ struct drm_crtc {
391 struct drm_display_mode mode; 353 struct drm_display_mode mode;
392 354
393 int x, y; 355 int x, y;
394 struct drm_display_mode *desired_mode;
395 int desired_x, desired_y;
396 const struct drm_crtc_funcs *funcs; 356 const struct drm_crtc_funcs *funcs;
397 357
398 /* CRTC gamma size for reporting to userspace */ 358 /* CRTC gamma size for reporting to userspace */
@@ -426,7 +386,15 @@ struct drm_connector_funcs {
426 void (*dpms)(struct drm_connector *connector, int mode); 386 void (*dpms)(struct drm_connector *connector, int mode);
427 void (*save)(struct drm_connector *connector); 387 void (*save)(struct drm_connector *connector);
428 void (*restore)(struct drm_connector *connector); 388 void (*restore)(struct drm_connector *connector);
429 enum drm_connector_status (*detect)(struct drm_connector *connector); 389
390 /* Check to see if anything is attached to the connector.
391 * @force is set to false whilst polling, true when checking the
392 * connector due to user request. @force can be used by the driver
393 * to avoid expensive, destructive operations during automated
394 * probing.
395 */
396 enum drm_connector_status (*detect)(struct drm_connector *connector,
397 bool force);
430 int (*fill_modes)(struct drm_connector *connector, uint32_t max_width, uint32_t max_height); 398 int (*fill_modes)(struct drm_connector *connector, uint32_t max_width, uint32_t max_height);
431 int (*set_property)(struct drm_connector *connector, struct drm_property *property, 399 int (*set_property)(struct drm_connector *connector, struct drm_property *property,
432 uint64_t val); 400 uint64_t val);
@@ -467,6 +435,15 @@ enum drm_connector_force {
467 DRM_FORCE_ON_DIGITAL, /* for DVI-I use digital connector */ 435 DRM_FORCE_ON_DIGITAL, /* for DVI-I use digital connector */
468}; 436};
469 437
438/* should we poll this connector for connects and disconnects */
439/* hot plug detectable */
440#define DRM_CONNECTOR_POLL_HPD (1 << 0)
441/* poll for connections */
442#define DRM_CONNECTOR_POLL_CONNECT (1 << 1)
443/* can cleanly poll for disconnections without flickering the screen */
444/* DACs should rarely do this without a lot of testing */
445#define DRM_CONNECTOR_POLL_DISCONNECT (1 << 2)
446
470/** 447/**
471 * drm_connector - central DRM connector control structure 448 * drm_connector - central DRM connector control structure
472 * @crtc: CRTC this connector is currently connected to, NULL if none 449 * @crtc: CRTC this connector is currently connected to, NULL if none
@@ -511,6 +488,8 @@ struct drm_connector {
511 u32 property_ids[DRM_CONNECTOR_MAX_PROPERTY]; 488 u32 property_ids[DRM_CONNECTOR_MAX_PROPERTY];
512 uint64_t property_values[DRM_CONNECTOR_MAX_PROPERTY]; 489 uint64_t property_values[DRM_CONNECTOR_MAX_PROPERTY];
513 490
491 uint8_t polled; /* DRM_CONNECTOR_POLL_* */
492
514 /* requested DPMS state */ 493 /* requested DPMS state */
515 int dpms; 494 int dpms;
516 495
@@ -521,7 +500,6 @@ struct drm_connector {
521 uint32_t encoder_ids[DRM_CONNECTOR_MAX_ENCODER]; 500 uint32_t encoder_ids[DRM_CONNECTOR_MAX_ENCODER];
522 uint32_t force_encoder_id; 501 uint32_t force_encoder_id;
523 struct drm_encoder *encoder; /* currently active encoder */ 502 struct drm_encoder *encoder; /* currently active encoder */
524 void *fb_helper_private;
525}; 503};
526 504
527/** 505/**
@@ -548,16 +526,10 @@ struct drm_mode_set {
548 526
549/** 527/**
550 * struct drm_mode_config_funcs - configure CRTCs for a given screen layout 528 * struct drm_mode_config_funcs - configure CRTCs for a given screen layout
551 * @resize: adjust CRTCs as necessary for the proposed layout
552 *
553 * Currently only a resize hook is available. DRM will call back into the
554 * driver with a new screen width and height. If the driver can't support
555 * the proposed size, it can return false. Otherwise it should adjust
556 * the CRTC<->connector mappings as needed and update its view of the screen.
557 */ 529 */
558struct drm_mode_config_funcs { 530struct drm_mode_config_funcs {
559 struct drm_framebuffer *(*fb_create)(struct drm_device *dev, struct drm_file *file_priv, struct drm_mode_fb_cmd *mode_cmd); 531 struct drm_framebuffer *(*fb_create)(struct drm_device *dev, struct drm_file *file_priv, struct drm_mode_fb_cmd *mode_cmd);
560 int (*fb_changed)(struct drm_device *dev); 532 void (*output_poll_changed)(struct drm_device *dev);
561}; 533};
562 534
563struct drm_mode_group { 535struct drm_mode_group {
@@ -590,14 +562,15 @@ struct drm_mode_config {
590 562
591 struct list_head property_list; 563 struct list_head property_list;
592 564
593 /* in-kernel framebuffers - hung of filp_head in drm_framebuffer */
594 struct list_head fb_kernel_list;
595
596 int min_width, min_height; 565 int min_width, min_height;
597 int max_width, max_height; 566 int max_width, max_height;
598 struct drm_mode_config_funcs *funcs; 567 struct drm_mode_config_funcs *funcs;
599 resource_size_t fb_base; 568 resource_size_t fb_base;
600 569
570 /* output poll support */
571 bool poll_enabled;
572 struct delayed_work output_poll_work;
573
601 /* pointers to standard properties */ 574 /* pointers to standard properties */
602 struct list_head property_blob_list; 575 struct list_head property_blob_list;
603 struct drm_property *edid_property; 576 struct drm_property *edid_property;
@@ -666,8 +639,6 @@ extern void drm_fb_release(struct drm_file *file_priv);
666extern int drm_mode_group_init_legacy_group(struct drm_device *dev, struct drm_mode_group *group); 639extern int drm_mode_group_init_legacy_group(struct drm_device *dev, struct drm_mode_group *group);
667extern struct edid *drm_get_edid(struct drm_connector *connector, 640extern struct edid *drm_get_edid(struct drm_connector *connector,
668 struct i2c_adapter *adapter); 641 struct i2c_adapter *adapter);
669extern int drm_do_probe_ddc_edid(struct i2c_adapter *adapter,
670 unsigned char *buf, int len);
671extern int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid); 642extern int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid);
672extern void drm_mode_probed_add(struct drm_connector *connector, struct drm_display_mode *mode); 643extern void drm_mode_probed_add(struct drm_connector *connector, struct drm_display_mode *mode);
673extern void drm_mode_remove(struct drm_connector *connector, struct drm_display_mode *mode); 644extern void drm_mode_remove(struct drm_connector *connector, struct drm_display_mode *mode);
@@ -799,8 +770,14 @@ extern struct drm_display_mode *drm_cvt_mode(struct drm_device *dev,
799extern struct drm_display_mode *drm_gtf_mode(struct drm_device *dev, 770extern struct drm_display_mode *drm_gtf_mode(struct drm_device *dev,
800 int hdisplay, int vdisplay, int vrefresh, 771 int hdisplay, int vdisplay, int vrefresh,
801 bool interlaced, int margins); 772 bool interlaced, int margins);
773extern struct drm_display_mode *drm_gtf_mode_complex(struct drm_device *dev,
774 int hdisplay, int vdisplay, int vrefresh,
775 bool interlaced, int margins, int GTF_M,
776 int GTF_2C, int GTF_K, int GTF_2J);
802extern int drm_add_modes_noedid(struct drm_connector *connector, 777extern int drm_add_modes_noedid(struct drm_connector *connector,
803 int hdisplay, int vdisplay); 778 int hdisplay, int vdisplay);
804 779
805extern bool drm_edid_is_valid(struct edid *edid); 780extern bool drm_edid_is_valid(struct edid *edid);
781struct drm_display_mode *drm_mode_find_dmt(struct drm_device *dev,
782 int hsize, int vsize, int fresh);
806#endif /* __DRM_CRTC_H__ */ 783#endif /* __DRM_CRTC_H__ */
diff --git a/include/drm/drm_crtc_helper.h b/include/drm/drm_crtc_helper.h
index b29e20168b5f..59b7073b13fe 100644
--- a/include/drm/drm_crtc_helper.h
+++ b/include/drm/drm_crtc_helper.h
@@ -39,7 +39,6 @@
39 39
40#include <linux/fb.h> 40#include <linux/fb.h>
41 41
42#include "drm_fb_helper.h"
43struct drm_crtc_helper_funcs { 42struct drm_crtc_helper_funcs {
44 /* 43 /*
45 * Control power levels on the CRTC. If the mode passed in is 44 * Control power levels on the CRTC. If the mode passed in is
@@ -61,9 +60,14 @@ struct drm_crtc_helper_funcs {
61 /* Move the crtc on the current fb to the given position *optional* */ 60 /* Move the crtc on the current fb to the given position *optional* */
62 int (*mode_set_base)(struct drm_crtc *crtc, int x, int y, 61 int (*mode_set_base)(struct drm_crtc *crtc, int x, int y,
63 struct drm_framebuffer *old_fb); 62 struct drm_framebuffer *old_fb);
63 int (*mode_set_base_atomic)(struct drm_crtc *crtc,
64 struct drm_framebuffer *fb, int x, int y);
64 65
65 /* reload the current crtc LUT */ 66 /* reload the current crtc LUT */
66 void (*load_lut)(struct drm_crtc *crtc); 67 void (*load_lut)(struct drm_crtc *crtc);
68
69 /* disable crtc when not in use - more explicit than dpms off */
70 void (*disable)(struct drm_crtc *crtc);
67}; 71};
68 72
69struct drm_encoder_helper_funcs { 73struct drm_encoder_helper_funcs {
@@ -96,8 +100,6 @@ struct drm_connector_helper_funcs {
96 100
97extern int drm_helper_probe_single_connector_modes(struct drm_connector *connector, uint32_t maxX, uint32_t maxY); 101extern int drm_helper_probe_single_connector_modes(struct drm_connector *connector, uint32_t maxX, uint32_t maxY);
98extern void drm_helper_disable_unused_functions(struct drm_device *dev); 102extern void drm_helper_disable_unused_functions(struct drm_device *dev);
99extern int drm_helper_hotplug_stage_two(struct drm_device *dev);
100extern bool drm_helper_initial_config(struct drm_device *dev);
101extern int drm_crtc_helper_set_config(struct drm_mode_set *set); 103extern int drm_crtc_helper_set_config(struct drm_mode_set *set);
102extern bool drm_crtc_helper_set_mode(struct drm_crtc *crtc, 104extern bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,
103 struct drm_display_mode *mode, 105 struct drm_display_mode *mode,
@@ -123,12 +125,17 @@ static inline void drm_encoder_helper_add(struct drm_encoder *encoder,
123 encoder->helper_private = (void *)funcs; 125 encoder->helper_private = (void *)funcs;
124} 126}
125 127
126static inline int drm_connector_helper_add(struct drm_connector *connector, 128static inline void drm_connector_helper_add(struct drm_connector *connector,
127 const struct drm_connector_helper_funcs *funcs) 129 const struct drm_connector_helper_funcs *funcs)
128{ 130{
129 connector->helper_private = (void *)funcs; 131 connector->helper_private = (void *)funcs;
130 return drm_fb_helper_add_connector(connector);
131} 132}
132 133
133extern int drm_helper_resume_force_mode(struct drm_device *dev); 134extern int drm_helper_resume_force_mode(struct drm_device *dev);
135extern void drm_kms_helper_poll_init(struct drm_device *dev);
136extern void drm_kms_helper_poll_fini(struct drm_device *dev);
137extern void drm_helper_hpd_irq_event(struct drm_device *dev);
138
139extern void drm_kms_helper_poll_disable(struct drm_device *dev);
140extern void drm_kms_helper_poll_enable(struct drm_device *dev);
134#endif 141#endif
diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h
index b4209898f115..5881fad91faa 100644
--- a/include/drm/drm_edid.h
+++ b/include/drm/drm_edid.h
@@ -28,6 +28,12 @@
28#define EDID_LENGTH 128 28#define EDID_LENGTH 128
29#define DDC_ADDR 0x50 29#define DDC_ADDR 0x50
30 30
31#define CEA_EXT 0x02
32#define VTB_EXT 0x10
33#define DI_EXT 0x40
34#define LS_EXT 0x50
35#define MI_EXT 0x60
36
31struct est_timings { 37struct est_timings {
32 u8 t1; 38 u8 t1;
33 u8 t2; 39 u8 t2;
@@ -120,7 +126,7 @@ struct detailed_non_pixel {
120 struct detailed_data_string str; 126 struct detailed_data_string str;
121 struct detailed_data_monitor_range range; 127 struct detailed_data_monitor_range range;
122 struct detailed_data_wpindex color; 128 struct detailed_data_wpindex color;
123 struct std_timing timings[5]; 129 struct std_timing timings[6];
124 struct cvt_timing cvt[4]; 130 struct cvt_timing cvt[4];
125 } data; 131 } data;
126} __attribute__((packed)); 132} __attribute__((packed));
@@ -201,7 +207,4 @@ struct edid {
201 207
202#define EDID_PRODUCT_ID(e) ((e)->prod_code[0] | ((e)->prod_code[1] << 8)) 208#define EDID_PRODUCT_ID(e) ((e)->prod_code[0] | ((e)->prod_code[1] << 8))
203 209
204/* define the number of Extension EDID block */
205#define DRM_MAX_EDID_EXT_NUM 4
206
207#endif /* __DRM_EDID_H__ */ 210#endif /* __DRM_EDID_H__ */
diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h
index 58c892a2cbfa..f22e7fe4b6db 100644
--- a/include/drm/drm_fb_helper.h
+++ b/include/drm/drm_fb_helper.h
@@ -30,17 +30,14 @@
30#ifndef DRM_FB_HELPER_H 30#ifndef DRM_FB_HELPER_H
31#define DRM_FB_HELPER_H 31#define DRM_FB_HELPER_H
32 32
33struct drm_fb_helper;
34
35#include <linux/kgdb.h>
36
33struct drm_fb_helper_crtc { 37struct drm_fb_helper_crtc {
34 uint32_t crtc_id; 38 uint32_t crtc_id;
35 struct drm_mode_set mode_set; 39 struct drm_mode_set mode_set;
36}; 40 struct drm_display_mode *desired_mode;
37
38
39struct drm_fb_helper_funcs {
40 void (*gamma_set)(struct drm_crtc *crtc, u16 red, u16 green,
41 u16 blue, int regno);
42 void (*gamma_get)(struct drm_crtc *crtc, u16 *red, u16 *green,
43 u16 *blue, int regno);
44}; 41};
45 42
46/* mode specified on the command line */ 43/* mode specified on the command line */
@@ -57,34 +54,57 @@ struct drm_fb_helper_cmdline_mode {
57 bool margins; 54 bool margins;
58}; 55};
59 56
57struct drm_fb_helper_surface_size {
58 u32 fb_width;
59 u32 fb_height;
60 u32 surface_width;
61 u32 surface_height;
62 u32 surface_bpp;
63 u32 surface_depth;
64};
65
66struct drm_fb_helper_funcs {
67 void (*gamma_set)(struct drm_crtc *crtc, u16 red, u16 green,
68 u16 blue, int regno);
69 void (*gamma_get)(struct drm_crtc *crtc, u16 *red, u16 *green,
70 u16 *blue, int regno);
71
72 int (*fb_probe)(struct drm_fb_helper *helper,
73 struct drm_fb_helper_surface_size *sizes);
74};
75
60struct drm_fb_helper_connector { 76struct drm_fb_helper_connector {
61 struct drm_fb_helper_cmdline_mode cmdline_mode; 77 struct drm_fb_helper_cmdline_mode cmdline_mode;
78 struct drm_connector *connector;
62}; 79};
63 80
64struct drm_fb_helper { 81struct drm_fb_helper {
65 struct drm_framebuffer *fb; 82 struct drm_framebuffer *fb;
83 struct drm_framebuffer *saved_fb;
66 struct drm_device *dev; 84 struct drm_device *dev;
67 struct drm_display_mode *mode; 85 struct drm_display_mode *mode;
68 int crtc_count; 86 int crtc_count;
69 struct drm_fb_helper_crtc *crtc_info; 87 struct drm_fb_helper_crtc *crtc_info;
88 int connector_count;
89 struct drm_fb_helper_connector **connector_info;
70 struct drm_fb_helper_funcs *funcs; 90 struct drm_fb_helper_funcs *funcs;
71 int conn_limit; 91 int conn_limit;
92 struct fb_info *fbdev;
93 u32 pseudo_palette[17];
72 struct list_head kernel_fb_list; 94 struct list_head kernel_fb_list;
95
96 /* we got a hotplug but fbdev wasn't running the console
97 delay until next set_par */
98 bool delayed_hotplug;
73}; 99};
74 100
75int drm_fb_helper_single_fb_probe(struct drm_device *dev, 101int drm_fb_helper_single_fb_probe(struct drm_fb_helper *helper,
76 int preferred_bpp, 102 int preferred_bpp);
77 int (*fb_create)(struct drm_device *dev, 103
78 uint32_t fb_width, 104int drm_fb_helper_init(struct drm_device *dev,
79 uint32_t fb_height, 105 struct drm_fb_helper *helper, int crtc_count,
80 uint32_t surface_width, 106 int max_conn);
81 uint32_t surface_height, 107void drm_fb_helper_fini(struct drm_fb_helper *helper);
82 uint32_t surface_depth,
83 uint32_t surface_bpp,
84 struct drm_framebuffer **fb_ptr));
85int drm_fb_helper_init_crtc_count(struct drm_fb_helper *helper, int crtc_count,
86 int max_conn);
87void drm_fb_helper_free(struct drm_fb_helper *helper);
88int drm_fb_helper_blank(int blank, struct fb_info *info); 108int drm_fb_helper_blank(int blank, struct fb_info *info);
89int drm_fb_helper_pan_display(struct fb_var_screeninfo *var, 109int drm_fb_helper_pan_display(struct fb_var_screeninfo *var,
90 struct fb_info *info); 110 struct fb_info *info);
@@ -99,13 +119,17 @@ int drm_fb_helper_setcolreg(unsigned regno,
99 struct fb_info *info); 119 struct fb_info *info);
100 120
101void drm_fb_helper_restore(void); 121void drm_fb_helper_restore(void);
102void drm_fb_helper_fill_var(struct fb_info *info, struct drm_framebuffer *fb, 122void drm_fb_helper_fill_var(struct fb_info *info, struct drm_fb_helper *fb_helper,
103 uint32_t fb_width, uint32_t fb_height); 123 uint32_t fb_width, uint32_t fb_height);
104void drm_fb_helper_fill_fix(struct fb_info *info, uint32_t pitch, 124void drm_fb_helper_fill_fix(struct fb_info *info, uint32_t pitch,
105 uint32_t depth); 125 uint32_t depth);
106 126
107int drm_fb_helper_add_connector(struct drm_connector *connector);
108int drm_fb_helper_parse_command_line(struct drm_device *dev);
109int drm_fb_helper_setcmap(struct fb_cmap *cmap, struct fb_info *info); 127int drm_fb_helper_setcmap(struct fb_cmap *cmap, struct fb_info *info);
110 128
129bool drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper);
130bool drm_fb_helper_initial_config(struct drm_fb_helper *fb_helper, int bpp_sel);
131int drm_fb_helper_single_add_all_connectors(struct drm_fb_helper *fb_helper);
132int drm_fb_helper_debug_enter(struct fb_info *info);
133int drm_fb_helper_debug_leave(struct fb_info *info);
134
111#endif 135#endif
diff --git a/include/drm/drm_fixed.h b/include/drm/drm_fixed.h
new file mode 100644
index 000000000000..4a08a664ff1f
--- /dev/null
+++ b/include/drm/drm_fixed.h
@@ -0,0 +1,67 @@
1/*
2 * Copyright 2009 Red Hat Inc.
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 COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 *
22 * Authors: Dave Airlie
23 */
24#ifndef DRM_FIXED_H
25#define DRM_FIXED_H
26
27typedef union dfixed {
28 u32 full;
29} fixed20_12;
30
31
32#define dfixed_const(A) (u32)(((A) << 12))/* + ((B + 0.000122)*4096)) */
33#define dfixed_const_half(A) (u32)(((A) << 12) + 2048)
34#define dfixed_const_666(A) (u32)(((A) << 12) + 2731)
35#define dfixed_const_8(A) (u32)(((A) << 12) + 3277)
36#define dfixed_mul(A, B) ((u64)((u64)(A).full * (B).full + 2048) >> 12)
37#define dfixed_init(A) { .full = dfixed_const((A)) }
38#define dfixed_init_half(A) { .full = dfixed_const_half((A)) }
39#define dfixed_trunc(A) ((A).full >> 12)
40
41static inline u32 dfixed_floor(fixed20_12 A)
42{
43 u32 non_frac = dfixed_trunc(A);
44
45 return dfixed_const(non_frac);
46}
47
48static inline u32 dfixed_ceil(fixed20_12 A)
49{
50 u32 non_frac = dfixed_trunc(A);
51
52 if (A.full > dfixed_const(non_frac))
53 return dfixed_const(non_frac + 1);
54 else
55 return dfixed_const(non_frac);
56}
57
58static inline u32 dfixed_div(fixed20_12 A, fixed20_12 B)
59{
60 u64 tmp = ((u64)A.full << 13);
61
62 do_div(tmp, B.full);
63 tmp += 1;
64 tmp /= 2;
65 return lower_32_bits(tmp);
66}
67#endif
diff --git a/include/drm/drm_global.h b/include/drm/drm_global.h
new file mode 100644
index 000000000000..a06805eaf649
--- /dev/null
+++ b/include/drm/drm_global.h
@@ -0,0 +1,53 @@
1/**************************************************************************
2 *
3 * Copyright 2008-2009 VMware, Inc., Palo Alto, CA., USA
4 * All Rights Reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
13 *
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
16 * of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
21 * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
22 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
23 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
24 * USE OR OTHER DEALINGS IN THE SOFTWARE.
25 *
26 **************************************************************************/
27/*
28 * Authors: Thomas Hellstrom <thellstrom-at-vmware-dot-com>
29 */
30
31#ifndef _DRM_GLOBAL_H_
32#define _DRM_GLOBAL_H_
33enum drm_global_types {
34 DRM_GLOBAL_TTM_MEM = 0,
35 DRM_GLOBAL_TTM_BO,
36 DRM_GLOBAL_TTM_OBJECT,
37 DRM_GLOBAL_NUM
38};
39
40struct drm_global_reference {
41 enum drm_global_types global_type;
42 size_t size;
43 void *object;
44 int (*init) (struct drm_global_reference *);
45 void (*release) (struct drm_global_reference *);
46};
47
48extern void drm_global_init(void);
49extern void drm_global_release(void);
50extern int drm_global_item_ref(struct drm_global_reference *ref);
51extern void drm_global_item_unref(struct drm_global_reference *ref);
52
53#endif
diff --git a/include/drm/drm_mm.h b/include/drm/drm_mm.h
index 4c10be39a43b..bf01531193d5 100644
--- a/include/drm/drm_mm.h
+++ b/include/drm/drm_mm.h
@@ -42,21 +42,31 @@
42#endif 42#endif
43 43
44struct drm_mm_node { 44struct drm_mm_node {
45 struct list_head fl_entry; 45 struct list_head free_stack;
46 struct list_head ml_entry; 46 struct list_head node_list;
47 int free; 47 unsigned free : 1;
48 unsigned scanned_block : 1;
49 unsigned scanned_prev_free : 1;
50 unsigned scanned_next_free : 1;
48 unsigned long start; 51 unsigned long start;
49 unsigned long size; 52 unsigned long size;
50 struct drm_mm *mm; 53 struct drm_mm *mm;
51 void *private;
52}; 54};
53 55
54struct drm_mm { 56struct drm_mm {
55 struct list_head fl_entry; 57 /* List of free memory blocks, most recently freed ordered. */
56 struct list_head ml_entry; 58 struct list_head free_stack;
59 /* List of all memory nodes, ordered according to the (increasing) start
60 * address of the memory node. */
61 struct list_head node_list;
57 struct list_head unused_nodes; 62 struct list_head unused_nodes;
58 int num_unused; 63 int num_unused;
59 spinlock_t unused_lock; 64 spinlock_t unused_lock;
65 unsigned scan_alignment;
66 unsigned long scan_size;
67 unsigned long scan_hit_start;
68 unsigned scan_hit_size;
69 unsigned scanned_blocks;
60}; 70};
61 71
62/* 72/*
@@ -133,6 +143,11 @@ static inline struct drm_mm *drm_get_mm(struct drm_mm_node *block)
133 return block->mm; 143 return block->mm;
134} 144}
135 145
146void drm_mm_init_scan(struct drm_mm *mm, unsigned long size,
147 unsigned alignment);
148int drm_mm_scan_add_block(struct drm_mm_node *node);
149int drm_mm_scan_remove_block(struct drm_mm_node *node);
150
136extern void drm_mm_debug_table(struct drm_mm *mm, const char *prefix); 151extern void drm_mm_debug_table(struct drm_mm *mm, const char *prefix);
137#ifdef CONFIG_DEBUG_FS 152#ifdef CONFIG_DEBUG_FS
138int drm_mm_dump_table(struct seq_file *m, struct drm_mm *mm); 153int drm_mm_dump_table(struct seq_file *m, struct drm_mm *mm);
diff --git a/include/drm/drm_mode.h b/include/drm/drm_mode.h
index c5ba1636613c..0fc7397c8f1f 100644
--- a/include/drm/drm_mode.h
+++ b/include/drm/drm_mode.h
@@ -74,6 +74,7 @@
74/* Dithering mode options */ 74/* Dithering mode options */
75#define DRM_MODE_DITHERING_OFF 0 75#define DRM_MODE_DITHERING_OFF 0
76#define DRM_MODE_DITHERING_ON 1 76#define DRM_MODE_DITHERING_ON 1
77#define DRM_MODE_DITHERING_AUTO 2
77 78
78/* Dirty info options */ 79/* Dirty info options */
79#define DRM_MODE_DIRTY_OFF 0 80#define DRM_MODE_DIRTY_OFF 0
diff --git a/include/drm/drm_pciids.h b/include/drm/drm_pciids.h
index 2d428b088cc8..883c1d439899 100644
--- a/include/drm/drm_pciids.h
+++ b/include/drm/drm_pciids.h
@@ -85,7 +85,6 @@
85 {0x1002, 0x5460, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY}, \ 85 {0x1002, 0x5460, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY}, \
86 {0x1002, 0x5462, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY}, \ 86 {0x1002, 0x5462, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY}, \
87 {0x1002, 0x5464, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY}, \ 87 {0x1002, 0x5464, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY}, \
88 {0x1002, 0x5657, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_NEW_MEMMAP}, \
89 {0x1002, 0x5548, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R423|RADEON_NEW_MEMMAP}, \ 88 {0x1002, 0x5548, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R423|RADEON_NEW_MEMMAP}, \
90 {0x1002, 0x5549, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R423|RADEON_NEW_MEMMAP}, \ 89 {0x1002, 0x5549, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R423|RADEON_NEW_MEMMAP}, \
91 {0x1002, 0x554A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R423|RADEON_NEW_MEMMAP}, \ 90 {0x1002, 0x554A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R423|RADEON_NEW_MEMMAP}, \
@@ -103,6 +102,7 @@
103 {0x1002, 0x564F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 102 {0x1002, 0x564F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
104 {0x1002, 0x5652, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 103 {0x1002, 0x5652, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
105 {0x1002, 0x5653, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 104 {0x1002, 0x5653, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
105 {0x1002, 0x5657, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_NEW_MEMMAP}, \
106 {0x1002, 0x5834, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS300|RADEON_IS_IGP}, \ 106 {0x1002, 0x5834, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS300|RADEON_IS_IGP}, \
107 {0x1002, 0x5835, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS300|RADEON_IS_IGP|RADEON_IS_MOBILITY}, \ 107 {0x1002, 0x5835, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS300|RADEON_IS_IGP|RADEON_IS_MOBILITY}, \
108 {0x1002, 0x5954, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS480|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_IS_IGPGART}, \ 108 {0x1002, 0x5954, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS480|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_IS_IGPGART}, \
@@ -146,6 +146,8 @@
146 {0x1002, 0x6888, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \ 146 {0x1002, 0x6888, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \
147 {0x1002, 0x6889, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \ 147 {0x1002, 0x6889, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \
148 {0x1002, 0x688A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \ 148 {0x1002, 0x688A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \
149 {0x1002, 0x688C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \
150 {0x1002, 0x688D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \
149 {0x1002, 0x6898, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \ 151 {0x1002, 0x6898, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \
150 {0x1002, 0x6899, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \ 152 {0x1002, 0x6899, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \
151 {0x1002, 0x689c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HEMLOCK|RADEON_NEW_MEMMAP}, \ 153 {0x1002, 0x689c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HEMLOCK|RADEON_NEW_MEMMAP}, \
@@ -161,6 +163,7 @@
161 {0x1002, 0x68be, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_JUNIPER|RADEON_NEW_MEMMAP}, \ 163 {0x1002, 0x68be, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_JUNIPER|RADEON_NEW_MEMMAP}, \
162 {0x1002, 0x68c0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_REDWOOD|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 164 {0x1002, 0x68c0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_REDWOOD|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
163 {0x1002, 0x68c1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_REDWOOD|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 165 {0x1002, 0x68c1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_REDWOOD|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
166 {0x1002, 0x68c7, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_REDWOOD|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
164 {0x1002, 0x68c8, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_REDWOOD|RADEON_NEW_MEMMAP}, \ 167 {0x1002, 0x68c8, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_REDWOOD|RADEON_NEW_MEMMAP}, \
165 {0x1002, 0x68c9, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_REDWOOD|RADEON_NEW_MEMMAP}, \ 168 {0x1002, 0x68c9, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_REDWOOD|RADEON_NEW_MEMMAP}, \
166 {0x1002, 0x68d8, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_REDWOOD|RADEON_NEW_MEMMAP}, \ 169 {0x1002, 0x68d8, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_REDWOOD|RADEON_NEW_MEMMAP}, \
@@ -174,6 +177,7 @@
174 {0x1002, 0x68e8, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_NEW_MEMMAP}, \ 177 {0x1002, 0x68e8, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_NEW_MEMMAP}, \
175 {0x1002, 0x68e9, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_NEW_MEMMAP}, \ 178 {0x1002, 0x68e9, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_NEW_MEMMAP}, \
176 {0x1002, 0x68f1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_NEW_MEMMAP}, \ 179 {0x1002, 0x68f1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_NEW_MEMMAP}, \
180 {0x1002, 0x68f2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_NEW_MEMMAP}, \
177 {0x1002, 0x68f8, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_NEW_MEMMAP}, \ 181 {0x1002, 0x68f8, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_NEW_MEMMAP}, \
178 {0x1002, 0x68f9, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_NEW_MEMMAP}, \ 182 {0x1002, 0x68f9, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_NEW_MEMMAP}, \
179 {0x1002, 0x68fe, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_NEW_MEMMAP}, \ 183 {0x1002, 0x68fe, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_NEW_MEMMAP}, \
@@ -314,6 +318,7 @@
314 {0x1002, 0x9456, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \ 318 {0x1002, 0x9456, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \
315 {0x1002, 0x945A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 319 {0x1002, 0x945A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
316 {0x1002, 0x945B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 320 {0x1002, 0x945B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
321 {0x1002, 0x945E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
317 {0x1002, 0x9460, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \ 322 {0x1002, 0x9460, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \
318 {0x1002, 0x9462, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \ 323 {0x1002, 0x9462, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \
319 {0x1002, 0x946A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 324 {0x1002, 0x946A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
@@ -324,6 +329,7 @@
324 {0x1002, 0x9487, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV730|RADEON_NEW_MEMMAP}, \ 329 {0x1002, 0x9487, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV730|RADEON_NEW_MEMMAP}, \
325 {0x1002, 0x9488, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV730|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 330 {0x1002, 0x9488, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV730|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
326 {0x1002, 0x9489, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV730|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 331 {0x1002, 0x9489, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV730|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
332 {0x1002, 0x948A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV730|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
327 {0x1002, 0x948F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV730|RADEON_NEW_MEMMAP}, \ 333 {0x1002, 0x948F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV730|RADEON_NEW_MEMMAP}, \
328 {0x1002, 0x9490, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV730|RADEON_NEW_MEMMAP}, \ 334 {0x1002, 0x9490, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV730|RADEON_NEW_MEMMAP}, \
329 {0x1002, 0x9491, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV730|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 335 {0x1002, 0x9491, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV730|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
@@ -366,6 +372,7 @@
366 {0x1002, 0x9553, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV710|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 372 {0x1002, 0x9553, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV710|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
367 {0x1002, 0x9555, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV710|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 373 {0x1002, 0x9555, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV710|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
368 {0x1002, 0x9557, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV710|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 374 {0x1002, 0x9557, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV710|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
375 {0x1002, 0x955f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV710|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
369 {0x1002, 0x9580, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV630|RADEON_NEW_MEMMAP}, \ 376 {0x1002, 0x9580, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV630|RADEON_NEW_MEMMAP}, \
370 {0x1002, 0x9581, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV630|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 377 {0x1002, 0x9581, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV630|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
371 {0x1002, 0x9583, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV630|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 378 {0x1002, 0x9583, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV630|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
diff --git a/include/drm/i2c/sil164.h b/include/drm/i2c/sil164.h
new file mode 100644
index 000000000000..205e27384c83
--- /dev/null
+++ b/include/drm/i2c/sil164.h
@@ -0,0 +1,63 @@
1/*
2 * Copyright (C) 2010 Francisco Jerez.
3 * All Rights Reserved.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining
6 * a copy of this software and associated documentation files (the
7 * "Software"), to deal in the Software without restriction, including
8 * without limitation the rights to use, copy, modify, merge, publish,
9 * distribute, sublicense, and/or sell copies of the Software, and to
10 * permit persons to whom the Software is furnished to do so, subject to
11 * the following conditions:
12 *
13 * The above copyright notice and this permission notice (including the
14 * next paragraph) shall be included in all copies or substantial
15 * portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20 * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
21 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 *
25 */
26
27#ifndef __DRM_I2C_SIL164_H__
28#define __DRM_I2C_SIL164_H__
29
30/**
31 * struct sil164_encoder_params
32 *
33 * Describes how the sil164 is connected to the GPU. It should be used
34 * as the @params parameter of its @set_config method.
35 *
36 * See "http://www.siliconimage.com/docs/SiI-DS-0021-E-164.pdf".
37 */
38struct sil164_encoder_params {
39 enum {
40 SIL164_INPUT_EDGE_FALLING = 0,
41 SIL164_INPUT_EDGE_RISING
42 } input_edge;
43
44 enum {
45 SIL164_INPUT_WIDTH_12BIT = 0,
46 SIL164_INPUT_WIDTH_24BIT
47 } input_width;
48
49 enum {
50 SIL164_INPUT_SINGLE_EDGE = 0,
51 SIL164_INPUT_DUAL_EDGE
52 } input_dual;
53
54 enum {
55 SIL164_PLL_FILTER_ON = 0,
56 SIL164_PLL_FILTER_OFF,
57 } pll_filter;
58
59 int input_skew; /** < Allowed range [-4, 3], use 0 for no de-skew. */
60 int duallink_skew; /** < Allowed range [-4, 3]. */
61};
62
63#endif
diff --git a/include/drm/i830_drm.h b/include/drm/i830_drm.h
index 4b00d2dd4f68..61315c29b8f3 100644
--- a/include/drm/i830_drm.h
+++ b/include/drm/i830_drm.h
@@ -264,20 +264,20 @@ typedef struct _drm_i830_sarea {
264#define DRM_I830_GETPARAM 0x0c 264#define DRM_I830_GETPARAM 0x0c
265#define DRM_I830_SETPARAM 0x0d 265#define DRM_I830_SETPARAM 0x0d
266 266
267#define DRM_IOCTL_I830_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_IOCTL_I830_INIT, drm_i830_init_t) 267#define DRM_IOCTL_I830_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I830_INIT, drm_i830_init_t)
268#define DRM_IOCTL_I830_VERTEX DRM_IOW( DRM_COMMAND_BASE + DRM_IOCTL_I830_VERTEX, drm_i830_vertex_t) 268#define DRM_IOCTL_I830_VERTEX DRM_IOW( DRM_COMMAND_BASE + DRM_I830_VERTEX, drm_i830_vertex_t)
269#define DRM_IOCTL_I830_CLEAR DRM_IOW( DRM_COMMAND_BASE + DRM_IOCTL_I830_CLEAR, drm_i830_clear_t) 269#define DRM_IOCTL_I830_CLEAR DRM_IOW( DRM_COMMAND_BASE + DRM_I830_CLEAR, drm_i830_clear_t)
270#define DRM_IOCTL_I830_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_IOCTL_I830_FLUSH) 270#define DRM_IOCTL_I830_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_I830_FLUSH)
271#define DRM_IOCTL_I830_GETAGE DRM_IO ( DRM_COMMAND_BASE + DRM_IOCTL_I830_GETAGE) 271#define DRM_IOCTL_I830_GETAGE DRM_IO ( DRM_COMMAND_BASE + DRM_I830_GETAGE)
272#define DRM_IOCTL_I830_GETBUF DRM_IOWR(DRM_COMMAND_BASE + DRM_IOCTL_I830_GETBUF, drm_i830_dma_t) 272#define DRM_IOCTL_I830_GETBUF DRM_IOWR(DRM_COMMAND_BASE + DRM_I830_GETBUF, drm_i830_dma_t)
273#define DRM_IOCTL_I830_SWAP DRM_IO ( DRM_COMMAND_BASE + DRM_IOCTL_I830_SWAP) 273#define DRM_IOCTL_I830_SWAP DRM_IO ( DRM_COMMAND_BASE + DRM_I830_SWAP)
274#define DRM_IOCTL_I830_COPY DRM_IOW( DRM_COMMAND_BASE + DRM_IOCTL_I830_COPY, drm_i830_copy_t) 274#define DRM_IOCTL_I830_COPY DRM_IOW( DRM_COMMAND_BASE + DRM_I830_COPY, drm_i830_copy_t)
275#define DRM_IOCTL_I830_DOCOPY DRM_IO ( DRM_COMMAND_BASE + DRM_IOCTL_I830_DOCOPY) 275#define DRM_IOCTL_I830_DOCOPY DRM_IO ( DRM_COMMAND_BASE + DRM_I830_DOCOPY)
276#define DRM_IOCTL_I830_FLIP DRM_IO ( DRM_COMMAND_BASE + DRM_IOCTL_I830_FLIP) 276#define DRM_IOCTL_I830_FLIP DRM_IO ( DRM_COMMAND_BASE + DRM_I830_FLIP)
277#define DRM_IOCTL_I830_IRQ_EMIT DRM_IOWR(DRM_COMMAND_BASE + DRM_IOCTL_I830_IRQ_EMIT, drm_i830_irq_emit_t) 277#define DRM_IOCTL_I830_IRQ_EMIT DRM_IOWR(DRM_COMMAND_BASE + DRM_I830_IRQ_EMIT, drm_i830_irq_emit_t)
278#define DRM_IOCTL_I830_IRQ_WAIT DRM_IOW( DRM_COMMAND_BASE + DRM_IOCTL_I830_IRQ_WAIT, drm_i830_irq_wait_t) 278#define DRM_IOCTL_I830_IRQ_WAIT DRM_IOW( DRM_COMMAND_BASE + DRM_I830_IRQ_WAIT, drm_i830_irq_wait_t)
279#define DRM_IOCTL_I830_GETPARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_IOCTL_I830_GETPARAM, drm_i830_getparam_t) 279#define DRM_IOCTL_I830_GETPARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_I830_GETPARAM, drm_i830_getparam_t)
280#define DRM_IOCTL_I830_SETPARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_IOCTL_I830_SETPARAM, drm_i830_setparam_t) 280#define DRM_IOCTL_I830_SETPARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_I830_SETPARAM, drm_i830_setparam_t)
281 281
282typedef struct _drm_i830_clear { 282typedef struct _drm_i830_clear {
283 int clear_color; 283 int clear_color;
diff --git a/include/drm/i915_drm.h b/include/drm/i915_drm.h
index b64a8d7cdf6d..e41c74facb6a 100644
--- a/include/drm/i915_drm.h
+++ b/include/drm/i915_drm.h
@@ -33,6 +33,15 @@
33 * subject to backwards-compatibility constraints. 33 * subject to backwards-compatibility constraints.
34 */ 34 */
35 35
36#ifdef __KERNEL__
37/* For use by IPS driver */
38extern unsigned long i915_read_mch_val(void);
39extern bool i915_gpu_raise(void);
40extern bool i915_gpu_lower(void);
41extern bool i915_gpu_busy(void);
42extern bool i915_gpu_turbo_disable(void);
43#endif
44
36/* Each region is a minimum of 16k, and there are at most 255 of them. 45/* Each region is a minimum of 16k, and there are at most 255 of them.
37 */ 46 */
38#define I915_NR_TEX_REGIONS 255 /* table size 2k - maximum due to use 47#define I915_NR_TEX_REGIONS 255 /* table size 2k - maximum due to use
@@ -206,6 +215,7 @@ typedef struct _drm_i915_sarea {
206#define DRM_IOCTL_I915_SET_VBLANK_PIPE DRM_IOW( DRM_COMMAND_BASE + DRM_I915_SET_VBLANK_PIPE, drm_i915_vblank_pipe_t) 215#define DRM_IOCTL_I915_SET_VBLANK_PIPE DRM_IOW( DRM_COMMAND_BASE + DRM_I915_SET_VBLANK_PIPE, drm_i915_vblank_pipe_t)
207#define DRM_IOCTL_I915_GET_VBLANK_PIPE DRM_IOR( DRM_COMMAND_BASE + DRM_I915_GET_VBLANK_PIPE, drm_i915_vblank_pipe_t) 216#define DRM_IOCTL_I915_GET_VBLANK_PIPE DRM_IOR( DRM_COMMAND_BASE + DRM_I915_GET_VBLANK_PIPE, drm_i915_vblank_pipe_t)
208#define DRM_IOCTL_I915_VBLANK_SWAP DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_VBLANK_SWAP, drm_i915_vblank_swap_t) 217#define DRM_IOCTL_I915_VBLANK_SWAP DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_VBLANK_SWAP, drm_i915_vblank_swap_t)
218#define DRM_IOCTL_I915_HWS_ADDR DRM_IOW(DRM_COMMAND_BASE + DRM_I915_HWS_ADDR, struct drm_i915_gem_init)
209#define DRM_IOCTL_I915_GEM_INIT DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_INIT, struct drm_i915_gem_init) 219#define DRM_IOCTL_I915_GEM_INIT DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_INIT, struct drm_i915_gem_init)
210#define DRM_IOCTL_I915_GEM_EXECBUFFER DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_EXECBUFFER, struct drm_i915_gem_execbuffer) 220#define DRM_IOCTL_I915_GEM_EXECBUFFER DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_EXECBUFFER, struct drm_i915_gem_execbuffer)
211#define DRM_IOCTL_I915_GEM_EXECBUFFER2 DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_EXECBUFFER2, struct drm_i915_gem_execbuffer2) 221#define DRM_IOCTL_I915_GEM_EXECBUFFER2 DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_EXECBUFFER2, struct drm_i915_gem_execbuffer2)
@@ -275,6 +285,7 @@ typedef struct drm_i915_irq_wait {
275#define I915_PARAM_HAS_OVERLAY 7 285#define I915_PARAM_HAS_OVERLAY 7
276#define I915_PARAM_HAS_PAGEFLIPPING 8 286#define I915_PARAM_HAS_PAGEFLIPPING 8
277#define I915_PARAM_HAS_EXECBUF2 9 287#define I915_PARAM_HAS_EXECBUF2 9
288#define I915_PARAM_HAS_BSD 10
278 289
279typedef struct drm_i915_getparam { 290typedef struct drm_i915_getparam {
280 int param; 291 int param;
@@ -616,7 +627,9 @@ struct drm_i915_gem_execbuffer2 {
616 __u32 num_cliprects; 627 __u32 num_cliprects;
617 /** This is a struct drm_clip_rect *cliprects */ 628 /** This is a struct drm_clip_rect *cliprects */
618 __u64 cliprects_ptr; 629 __u64 cliprects_ptr;
619 __u64 flags; /* currently unused */ 630#define I915_EXEC_RENDER (1<<0)
631#define I915_EXEC_BSD (1<<1)
632 __u64 flags;
620 __u64 rsvd1; 633 __u64 rsvd1;
621 __u64 rsvd2; 634 __u64 rsvd2;
622}; 635};
diff --git a/include/drm/mga_drm.h b/include/drm/mga_drm.h
index 3ffbc4798afa..c16097f99be0 100644
--- a/include/drm/mga_drm.h
+++ b/include/drm/mga_drm.h
@@ -248,7 +248,7 @@ typedef struct _drm_mga_sarea {
248#define DRM_MGA_DMA_BOOTSTRAP 0x0c 248#define DRM_MGA_DMA_BOOTSTRAP 0x0c
249 249
250#define DRM_IOCTL_MGA_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_INIT, drm_mga_init_t) 250#define DRM_IOCTL_MGA_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_INIT, drm_mga_init_t)
251#define DRM_IOCTL_MGA_FLUSH DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_FLUSH, drm_lock_t) 251#define DRM_IOCTL_MGA_FLUSH DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_FLUSH, struct drm_lock)
252#define DRM_IOCTL_MGA_RESET DRM_IO( DRM_COMMAND_BASE + DRM_MGA_RESET) 252#define DRM_IOCTL_MGA_RESET DRM_IO( DRM_COMMAND_BASE + DRM_MGA_RESET)
253#define DRM_IOCTL_MGA_SWAP DRM_IO( DRM_COMMAND_BASE + DRM_MGA_SWAP) 253#define DRM_IOCTL_MGA_SWAP DRM_IO( DRM_COMMAND_BASE + DRM_MGA_SWAP)
254#define DRM_IOCTL_MGA_CLEAR DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_CLEAR, drm_mga_clear_t) 254#define DRM_IOCTL_MGA_CLEAR DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_CLEAR, drm_mga_clear_t)
diff --git a/include/drm/nouveau_drm.h b/include/drm/nouveau_drm.h
index a6a9f4af5ebd..01a714119506 100644
--- a/include/drm/nouveau_drm.h
+++ b/include/drm/nouveau_drm.h
@@ -79,6 +79,7 @@ struct drm_nouveau_gpuobj_free {
79#define NOUVEAU_GETPARAM_CHIPSET_ID 11 79#define NOUVEAU_GETPARAM_CHIPSET_ID 11
80#define NOUVEAU_GETPARAM_VM_VRAM_BASE 12 80#define NOUVEAU_GETPARAM_VM_VRAM_BASE 12
81#define NOUVEAU_GETPARAM_GRAPH_UNITS 13 81#define NOUVEAU_GETPARAM_GRAPH_UNITS 13
82#define NOUVEAU_GETPARAM_PTIMER_TIME 14
82struct drm_nouveau_getparam { 83struct drm_nouveau_getparam {
83 uint64_t param; 84 uint64_t param;
84 uint64_t value; 85 uint64_t value;
@@ -196,4 +197,17 @@ struct drm_nouveau_sarea {
196#define DRM_NOUVEAU_GEM_CPU_FINI 0x43 197#define DRM_NOUVEAU_GEM_CPU_FINI 0x43
197#define DRM_NOUVEAU_GEM_INFO 0x44 198#define DRM_NOUVEAU_GEM_INFO 0x44
198 199
200#define DRM_IOCTL_NOUVEAU_GETPARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_GETPARAM, struct drm_nouveau_getparam)
201#define DRM_IOCTL_NOUVEAU_SETPARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_SETPARAM, struct drm_nouveau_setparam)
202#define DRM_IOCTL_NOUVEAU_CHANNEL_ALLOC DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_CHANNEL_ALLOC, struct drm_nouveau_channel_alloc)
203#define DRM_IOCTL_NOUVEAU_CHANNEL_FREE DRM_IOW (DRM_COMMAND_BASE + DRM_NOUVEAU_CHANNEL_FREE, struct drm_nouveau_channel_free)
204#define DRM_IOCTL_NOUVEAU_GROBJ_ALLOC DRM_IOW (DRM_COMMAND_BASE + DRM_NOUVEAU_GROBJ_ALLOC, struct drm_nouveau_grobj_alloc)
205#define DRM_IOCTL_NOUVEAU_NOTIFIEROBJ_ALLOC DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_NOTIFIEROBJ_ALLOC, struct drm_nouveau_notifierobj_alloc)
206#define DRM_IOCTL_NOUVEAU_GPUOBJ_FREE DRM_IOW (DRM_COMMAND_BASE + DRM_NOUVEAU_GPUOBJ_FREE, struct drm_nouveau_gpuobj_free)
207#define DRM_IOCTL_NOUVEAU_GEM_NEW DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_GEM_NEW, struct drm_nouveau_gem_new)
208#define DRM_IOCTL_NOUVEAU_GEM_PUSHBUF DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_GEM_PUSHBUF, struct drm_nouveau_gem_pushbuf)
209#define DRM_IOCTL_NOUVEAU_GEM_CPU_PREP DRM_IOW (DRM_COMMAND_BASE + DRM_NOUVEAU_GEM_CPU_PREP, struct drm_nouveau_gem_cpu_prep)
210#define DRM_IOCTL_NOUVEAU_GEM_CPU_FINI DRM_IOW (DRM_COMMAND_BASE + DRM_NOUVEAU_GEM_CPU_FINI, struct drm_nouveau_gem_cpu_fini)
211#define DRM_IOCTL_NOUVEAU_GEM_INFO DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_GEM_INFO, struct drm_nouveau_gem_info)
212
199#endif /* __NOUVEAU_DRM_H__ */ 213#endif /* __NOUVEAU_DRM_H__ */
diff --git a/include/drm/radeon_drm.h b/include/drm/radeon_drm.h
index 81e614bf2dc3..10f8b53bdd40 100644
--- a/include/drm/radeon_drm.h
+++ b/include/drm/radeon_drm.h
@@ -547,8 +547,8 @@ typedef struct {
547#define DRM_IOCTL_RADEON_GEM_WAIT_IDLE DRM_IOW(DRM_COMMAND_BASE + DRM_RADEON_GEM_WAIT_IDLE, struct drm_radeon_gem_wait_idle) 547#define DRM_IOCTL_RADEON_GEM_WAIT_IDLE DRM_IOW(DRM_COMMAND_BASE + DRM_RADEON_GEM_WAIT_IDLE, struct drm_radeon_gem_wait_idle)
548#define DRM_IOCTL_RADEON_CS DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_CS, struct drm_radeon_cs) 548#define DRM_IOCTL_RADEON_CS DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_CS, struct drm_radeon_cs)
549#define DRM_IOCTL_RADEON_INFO DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_INFO, struct drm_radeon_info) 549#define DRM_IOCTL_RADEON_INFO DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_INFO, struct drm_radeon_info)
550#define DRM_IOCTL_RADEON_SET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_SET_TILING, struct drm_radeon_gem_set_tiling) 550#define DRM_IOCTL_RADEON_GEM_SET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_SET_TILING, struct drm_radeon_gem_set_tiling)
551#define DRM_IOCTL_RADEON_GET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_GET_TILING, struct drm_radeon_gem_get_tiling) 551#define DRM_IOCTL_RADEON_GEM_GET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_GET_TILING, struct drm_radeon_gem_get_tiling)
552#define DRM_IOCTL_RADEON_GEM_BUSY DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_BUSY, struct drm_radeon_gem_busy) 552#define DRM_IOCTL_RADEON_GEM_BUSY DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_BUSY, struct drm_radeon_gem_busy)
553 553
554typedef struct drm_radeon_init { 554typedef struct drm_radeon_init {
@@ -902,6 +902,10 @@ struct drm_radeon_cs {
902#define RADEON_INFO_NUM_GB_PIPES 0x01 902#define RADEON_INFO_NUM_GB_PIPES 0x01
903#define RADEON_INFO_NUM_Z_PIPES 0x02 903#define RADEON_INFO_NUM_Z_PIPES 0x02
904#define RADEON_INFO_ACCEL_WORKING 0x03 904#define RADEON_INFO_ACCEL_WORKING 0x03
905#define RADEON_INFO_CRTC_FROM_ID 0x04
906#define RADEON_INFO_ACCEL_WORKING2 0x05
907#define RADEON_INFO_TILING_CONFIG 0x06
908#define RADEON_INFO_WANT_HYPERZ 0x07
905 909
906struct drm_radeon_info { 910struct drm_radeon_info {
907 uint32_t request; 911 uint32_t request;
diff --git a/include/drm/savage_drm.h b/include/drm/savage_drm.h
index 8a576ef01821..4863cf6bf96f 100644
--- a/include/drm/savage_drm.h
+++ b/include/drm/savage_drm.h
@@ -63,10 +63,10 @@ typedef struct _drm_savage_sarea {
63#define DRM_SAVAGE_BCI_EVENT_EMIT 0x02 63#define DRM_SAVAGE_BCI_EVENT_EMIT 0x02
64#define DRM_SAVAGE_BCI_EVENT_WAIT 0x03 64#define DRM_SAVAGE_BCI_EVENT_WAIT 0x03
65 65
66#define DRM_IOCTL_SAVAGE_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_SAVAGE_BCI_INIT, drm_savage_init_t) 66#define DRM_IOCTL_SAVAGE_BCI_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_SAVAGE_BCI_INIT, drm_savage_init_t)
67#define DRM_IOCTL_SAVAGE_CMDBUF DRM_IOW( DRM_COMMAND_BASE + DRM_SAVAGE_BCI_CMDBUF, drm_savage_cmdbuf_t) 67#define DRM_IOCTL_SAVAGE_BCI_CMDBUF DRM_IOW( DRM_COMMAND_BASE + DRM_SAVAGE_BCI_CMDBUF, drm_savage_cmdbuf_t)
68#define DRM_IOCTL_SAVAGE_EVENT_EMIT DRM_IOWR(DRM_COMMAND_BASE + DRM_SAVAGE_BCI_EVENT_EMIT, drm_savage_event_emit_t) 68#define DRM_IOCTL_SAVAGE_BCI_EVENT_EMIT DRM_IOWR(DRM_COMMAND_BASE + DRM_SAVAGE_BCI_EVENT_EMIT, drm_savage_event_emit_t)
69#define DRM_IOCTL_SAVAGE_EVENT_WAIT DRM_IOW( DRM_COMMAND_BASE + DRM_SAVAGE_BCI_EVENT_WAIT, drm_savage_event_wait_t) 69#define DRM_IOCTL_SAVAGE_BCI_EVENT_WAIT DRM_IOW( DRM_COMMAND_BASE + DRM_SAVAGE_BCI_EVENT_WAIT, drm_savage_event_wait_t)
70 70
71#define SAVAGE_DMA_PCI 1 71#define SAVAGE_DMA_PCI 1
72#define SAVAGE_DMA_AGP 3 72#define SAVAGE_DMA_AGP 3
diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h
index 81eb9f45883c..2040e6c4f172 100644
--- a/include/drm/ttm/ttm_bo_api.h
+++ b/include/drm/ttm/ttm_bo_api.h
@@ -66,6 +66,26 @@ struct ttm_placement {
66 const uint32_t *busy_placement; 66 const uint32_t *busy_placement;
67}; 67};
68 68
69/**
70 * struct ttm_bus_placement
71 *
72 * @addr: mapped virtual address
73 * @base: bus base address
74 * @is_iomem: is this io memory ?
75 * @size: size in byte
76 * @offset: offset from the base address
77 *
78 * Structure indicating the bus placement of an object.
79 */
80struct ttm_bus_placement {
81 void *addr;
82 unsigned long base;
83 unsigned long size;
84 unsigned long offset;
85 bool is_iomem;
86 bool io_reserved;
87};
88
69 89
70/** 90/**
71 * struct ttm_mem_reg 91 * struct ttm_mem_reg
@@ -75,6 +95,7 @@ struct ttm_placement {
75 * @num_pages: Actual size of memory region in pages. 95 * @num_pages: Actual size of memory region in pages.
76 * @page_alignment: Page alignment. 96 * @page_alignment: Page alignment.
77 * @placement: Placement flags. 97 * @placement: Placement flags.
98 * @bus: Placement on io bus accessible to the CPU
78 * 99 *
79 * Structure indicating the placement and space resources used by a 100 * Structure indicating the placement and space resources used by a
80 * buffer object. 101 * buffer object.
@@ -87,6 +108,7 @@ struct ttm_mem_reg {
87 uint32_t page_alignment; 108 uint32_t page_alignment;
88 uint32_t mem_type; 109 uint32_t mem_type;
89 uint32_t placement; 110 uint32_t placement;
111 struct ttm_bus_placement bus;
90}; 112};
91 113
92/** 114/**
@@ -224,9 +246,11 @@ struct ttm_buffer_object {
224 246
225 atomic_t reserved; 247 atomic_t reserved;
226 248
227
228 /** 249 /**
229 * Members protected by the bo::lock 250 * Members protected by the bo::lock
251 * In addition, setting sync_obj to anything else
252 * than NULL requires bo::reserved to be held. This allows for
253 * checking NULL while reserved but not holding bo::lock.
230 */ 254 */
231 255
232 void *sync_obj_arg; 256 void *sync_obj_arg;
@@ -274,6 +298,7 @@ struct ttm_bo_kmap_obj {
274 ttm_bo_map_kmap = 3, 298 ttm_bo_map_kmap = 3,
275 ttm_bo_map_premapped = 4 | TTM_BO_MAP_IOMEM_MASK, 299 ttm_bo_map_premapped = 4 | TTM_BO_MAP_IOMEM_MASK,
276 } bo_kmap_type; 300 } bo_kmap_type;
301 struct ttm_buffer_object *bo;
277}; 302};
278 303
279/** 304/**
@@ -313,7 +338,8 @@ extern int ttm_bo_wait(struct ttm_buffer_object *bo, bool lazy,
313 * @bo: The buffer object. 338 * @bo: The buffer object.
314 * @placement: Proposed placement for the buffer object. 339 * @placement: Proposed placement for the buffer object.
315 * @interruptible: Sleep interruptible if sleeping. 340 * @interruptible: Sleep interruptible if sleeping.
316 * @no_wait: Return immediately if the buffer is busy. 341 * @no_wait_reserve: Return immediately if other buffers are busy.
342 * @no_wait_gpu: Return immediately if the GPU is busy.
317 * 343 *
318 * Changes placement and caching policy of the buffer object 344 * Changes placement and caching policy of the buffer object
319 * according proposed placement. 345 * according proposed placement.
@@ -325,7 +351,8 @@ extern int ttm_bo_wait(struct ttm_buffer_object *bo, bool lazy,
325 */ 351 */
326extern int ttm_bo_validate(struct ttm_buffer_object *bo, 352extern int ttm_bo_validate(struct ttm_buffer_object *bo,
327 struct ttm_placement *placement, 353 struct ttm_placement *placement,
328 bool interruptible, bool no_wait); 354 bool interruptible, bool no_wait_reserve,
355 bool no_wait_gpu);
329 356
330/** 357/**
331 * ttm_bo_unref 358 * ttm_bo_unref
@@ -337,6 +364,23 @@ extern int ttm_bo_validate(struct ttm_buffer_object *bo,
337extern void ttm_bo_unref(struct ttm_buffer_object **bo); 364extern void ttm_bo_unref(struct ttm_buffer_object **bo);
338 365
339/** 366/**
367 * ttm_bo_lock_delayed_workqueue
368 *
369 * Prevent the delayed workqueue from running.
370 * Returns
371 * True if the workqueue was queued at the time
372 */
373extern int ttm_bo_lock_delayed_workqueue(struct ttm_bo_device *bdev);
374
375/**
376 * ttm_bo_unlock_delayed_workqueue
377 *
378 * Allows the delayed workqueue to run.
379 */
380extern void ttm_bo_unlock_delayed_workqueue(struct ttm_bo_device *bdev,
381 int resched);
382
383/**
340 * ttm_bo_synccpu_write_grab 384 * ttm_bo_synccpu_write_grab
341 * 385 *
342 * @bo: The buffer object: 386 * @bo: The buffer object:
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
index 6b9db917e717..b87504235f18 100644
--- a/include/drm/ttm/ttm_bo_driver.h
+++ b/include/drm/ttm/ttm_bo_driver.h
@@ -34,6 +34,7 @@
34#include "ttm/ttm_memory.h" 34#include "ttm/ttm_memory.h"
35#include "ttm/ttm_module.h" 35#include "ttm/ttm_module.h"
36#include "drm_mm.h" 36#include "drm_mm.h"
37#include "drm_global.h"
37#include "linux/workqueue.h" 38#include "linux/workqueue.h"
38#include "linux/fs.h" 39#include "linux/fs.h"
39#include "linux/spinlock.h" 40#include "linux/spinlock.h"
@@ -176,8 +177,6 @@ struct ttm_tt {
176 177
177#define TTM_MEMTYPE_FLAG_FIXED (1 << 0) /* Fixed (on-card) PCI memory */ 178#define TTM_MEMTYPE_FLAG_FIXED (1 << 0) /* Fixed (on-card) PCI memory */
178#define TTM_MEMTYPE_FLAG_MAPPABLE (1 << 1) /* Memory mappable */ 179#define TTM_MEMTYPE_FLAG_MAPPABLE (1 << 1) /* Memory mappable */
179#define TTM_MEMTYPE_FLAG_NEEDS_IOREMAP (1 << 2) /* Fixed memory needs ioremap
180 before kernel access. */
181#define TTM_MEMTYPE_FLAG_CMA (1 << 3) /* Can't map aperture */ 180#define TTM_MEMTYPE_FLAG_CMA (1 << 3) /* Can't map aperture */
182 181
183/** 182/**
@@ -189,13 +188,6 @@ struct ttm_tt {
189 * managed by this memory type. 188 * managed by this memory type.
190 * @gpu_offset: If used, the GPU offset of the first managed page of 189 * @gpu_offset: If used, the GPU offset of the first managed page of
191 * fixed memory or the first managed location in an aperture. 190 * fixed memory or the first managed location in an aperture.
192 * @io_offset: The io_offset of the first managed page of IO memory or
193 * the first managed location in an aperture. For TTM_MEMTYPE_FLAG_CMA
194 * memory, this should be set to NULL.
195 * @io_size: The size of a managed IO region (fixed memory or aperture).
196 * @io_addr: Virtual kernel address if the io region is pre-mapped. For
197 * TTM_MEMTYPE_FLAG_NEEDS_IOREMAP there is no pre-mapped io map and
198 * @io_addr should be set to NULL.
199 * @size: Size of the managed region. 191 * @size: Size of the managed region.
200 * @available_caching: A mask of available caching types, TTM_PL_FLAG_XX, 192 * @available_caching: A mask of available caching types, TTM_PL_FLAG_XX,
201 * as defined in ttm_placement_common.h 193 * as defined in ttm_placement_common.h
@@ -221,9 +213,6 @@ struct ttm_mem_type_manager {
221 bool use_type; 213 bool use_type;
222 uint32_t flags; 214 uint32_t flags;
223 unsigned long gpu_offset; 215 unsigned long gpu_offset;
224 unsigned long io_offset;
225 unsigned long io_size;
226 void *io_addr;
227 uint64_t size; 216 uint64_t size;
228 uint32_t available_caching; 217 uint32_t available_caching;
229 uint32_t default_caching; 218 uint32_t default_caching;
@@ -311,7 +300,8 @@ struct ttm_bo_driver {
311 */ 300 */
312 int (*move) (struct ttm_buffer_object *bo, 301 int (*move) (struct ttm_buffer_object *bo,
313 bool evict, bool interruptible, 302 bool evict, bool interruptible,
314 bool no_wait, struct ttm_mem_reg *new_mem); 303 bool no_wait_reserve, bool no_wait_gpu,
304 struct ttm_mem_reg *new_mem);
315 305
316 /** 306 /**
317 * struct ttm_bo_driver_member verify_access 307 * struct ttm_bo_driver_member verify_access
@@ -351,12 +341,21 @@ struct ttm_bo_driver {
351 struct ttm_mem_reg *new_mem); 341 struct ttm_mem_reg *new_mem);
352 /* notify the driver we are taking a fault on this BO 342 /* notify the driver we are taking a fault on this BO
353 * and have reserved it */ 343 * and have reserved it */
354 void (*fault_reserve_notify)(struct ttm_buffer_object *bo); 344 int (*fault_reserve_notify)(struct ttm_buffer_object *bo);
355 345
356 /** 346 /**
357 * notify the driver that we're about to swap out this bo 347 * notify the driver that we're about to swap out this bo
358 */ 348 */
359 void (*swap_notify) (struct ttm_buffer_object *bo); 349 void (*swap_notify) (struct ttm_buffer_object *bo);
350
351 /**
352 * Driver callback on when mapping io memory (for bo_move_memcpy
353 * for instance). TTM will take care to call io_mem_free whenever
354 * the mapping is not use anymore. io_mem_reserve & io_mem_free
355 * are balanced.
356 */
357 int (*io_mem_reserve)(struct ttm_bo_device *bdev, struct ttm_mem_reg *mem);
358 void (*io_mem_free)(struct ttm_bo_device *bdev, struct ttm_mem_reg *mem);
360}; 359};
361 360
362/** 361/**
@@ -364,7 +363,7 @@ struct ttm_bo_driver {
364 */ 363 */
365 364
366struct ttm_bo_global_ref { 365struct ttm_bo_global_ref {
367 struct ttm_global_reference ref; 366 struct drm_global_reference ref;
368 struct ttm_mem_global *mem_glob; 367 struct ttm_mem_global *mem_glob;
369}; 368};
370 369
@@ -633,7 +632,8 @@ extern bool ttm_mem_reg_is_pci(struct ttm_bo_device *bdev,
633 * @proposed_placement: Proposed new placement for the buffer object. 632 * @proposed_placement: Proposed new placement for the buffer object.
634 * @mem: A struct ttm_mem_reg. 633 * @mem: A struct ttm_mem_reg.
635 * @interruptible: Sleep interruptible when sliping. 634 * @interruptible: Sleep interruptible when sliping.
636 * @no_wait: Don't sleep waiting for space to become available. 635 * @no_wait_reserve: Return immediately if other buffers are busy.
636 * @no_wait_gpu: Return immediately if the GPU is busy.
637 * 637 *
638 * Allocate memory space for the buffer object pointed to by @bo, using 638 * Allocate memory space for the buffer object pointed to by @bo, using
639 * the placement flags in @mem, potentially evicting other idle buffer objects. 639 * the placement flags in @mem, potentially evicting other idle buffer objects.
@@ -647,7 +647,8 @@ extern bool ttm_mem_reg_is_pci(struct ttm_bo_device *bdev,
647extern int ttm_bo_mem_space(struct ttm_buffer_object *bo, 647extern int ttm_bo_mem_space(struct ttm_buffer_object *bo,
648 struct ttm_placement *placement, 648 struct ttm_placement *placement,
649 struct ttm_mem_reg *mem, 649 struct ttm_mem_reg *mem,
650 bool interruptible, bool no_wait); 650 bool interruptible,
651 bool no_wait_reserve, bool no_wait_gpu);
651/** 652/**
652 * ttm_bo_wait_for_cpu 653 * ttm_bo_wait_for_cpu
653 * 654 *
@@ -682,8 +683,13 @@ extern int ttm_bo_pci_offset(struct ttm_bo_device *bdev,
682 unsigned long *bus_offset, 683 unsigned long *bus_offset,
683 unsigned long *bus_size); 684 unsigned long *bus_size);
684 685
685extern void ttm_bo_global_release(struct ttm_global_reference *ref); 686extern int ttm_mem_io_reserve(struct ttm_bo_device *bdev,
686extern int ttm_bo_global_init(struct ttm_global_reference *ref); 687 struct ttm_mem_reg *mem);
688extern void ttm_mem_io_free(struct ttm_bo_device *bdev,
689 struct ttm_mem_reg *mem);
690
691extern void ttm_bo_global_release(struct drm_global_reference *ref);
692extern int ttm_bo_global_init(struct drm_global_reference *ref);
687 693
688extern int ttm_bo_device_release(struct ttm_bo_device *bdev); 694extern int ttm_bo_device_release(struct ttm_bo_device *bdev);
689 695
@@ -798,7 +804,8 @@ extern int ttm_bo_wait_unreserved(struct ttm_buffer_object *bo,
798 * 804 *
799 * @bo: A pointer to a struct ttm_buffer_object. 805 * @bo: A pointer to a struct ttm_buffer_object.
800 * @evict: 1: This is an eviction. Don't try to pipeline. 806 * @evict: 1: This is an eviction. Don't try to pipeline.
801 * @no_wait: Never sleep, but rather return with -EBUSY. 807 * @no_wait_reserve: Return immediately if other buffers are busy.
808 * @no_wait_gpu: Return immediately if the GPU is busy.
802 * @new_mem: struct ttm_mem_reg indicating where to move. 809 * @new_mem: struct ttm_mem_reg indicating where to move.
803 * 810 *
804 * Optimized move function for a buffer object with both old and 811 * Optimized move function for a buffer object with both old and
@@ -812,15 +819,16 @@ extern int ttm_bo_wait_unreserved(struct ttm_buffer_object *bo,
812 */ 819 */
813 820
814extern int ttm_bo_move_ttm(struct ttm_buffer_object *bo, 821extern int ttm_bo_move_ttm(struct ttm_buffer_object *bo,
815 bool evict, bool no_wait, 822 bool evict, bool no_wait_reserve,
816 struct ttm_mem_reg *new_mem); 823 bool no_wait_gpu, struct ttm_mem_reg *new_mem);
817 824
818/** 825/**
819 * ttm_bo_move_memcpy 826 * ttm_bo_move_memcpy
820 * 827 *
821 * @bo: A pointer to a struct ttm_buffer_object. 828 * @bo: A pointer to a struct ttm_buffer_object.
822 * @evict: 1: This is an eviction. Don't try to pipeline. 829 * @evict: 1: This is an eviction. Don't try to pipeline.
823 * @no_wait: Never sleep, but rather return with -EBUSY. 830 * @no_wait_reserve: Return immediately if other buffers are busy.
831 * @no_wait_gpu: Return immediately if the GPU is busy.
824 * @new_mem: struct ttm_mem_reg indicating where to move. 832 * @new_mem: struct ttm_mem_reg indicating where to move.
825 * 833 *
826 * Fallback move function for a mappable buffer object in mappable memory. 834 * Fallback move function for a mappable buffer object in mappable memory.
@@ -834,8 +842,8 @@ extern int ttm_bo_move_ttm(struct ttm_buffer_object *bo,
834 */ 842 */
835 843
836extern int ttm_bo_move_memcpy(struct ttm_buffer_object *bo, 844extern int ttm_bo_move_memcpy(struct ttm_buffer_object *bo,
837 bool evict, 845 bool evict, bool no_wait_reserve,
838 bool no_wait, struct ttm_mem_reg *new_mem); 846 bool no_wait_gpu, struct ttm_mem_reg *new_mem);
839 847
840/** 848/**
841 * ttm_bo_free_old_node 849 * ttm_bo_free_old_node
@@ -854,7 +862,8 @@ extern void ttm_bo_free_old_node(struct ttm_buffer_object *bo);
854 * @sync_obj_arg: An argument to pass to the sync object idle / wait 862 * @sync_obj_arg: An argument to pass to the sync object idle / wait
855 * functions. 863 * functions.
856 * @evict: This is an evict move. Don't return until the buffer is idle. 864 * @evict: This is an evict move. Don't return until the buffer is idle.
857 * @no_wait: Never sleep, but rather return with -EBUSY. 865 * @no_wait_reserve: Return immediately if other buffers are busy.
866 * @no_wait_gpu: Return immediately if the GPU is busy.
858 * @new_mem: struct ttm_mem_reg indicating where to move. 867 * @new_mem: struct ttm_mem_reg indicating where to move.
859 * 868 *
860 * Accelerated move function to be called when an accelerated move 869 * Accelerated move function to be called when an accelerated move
@@ -868,7 +877,8 @@ extern void ttm_bo_free_old_node(struct ttm_buffer_object *bo);
868extern int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo, 877extern int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo,
869 void *sync_obj, 878 void *sync_obj,
870 void *sync_obj_arg, 879 void *sync_obj_arg,
871 bool evict, bool no_wait, 880 bool evict, bool no_wait_reserve,
881 bool no_wait_gpu,
872 struct ttm_mem_reg *new_mem); 882 struct ttm_mem_reg *new_mem);
873/** 883/**
874 * ttm_io_prot 884 * ttm_io_prot
diff --git a/include/drm/ttm/ttm_module.h b/include/drm/ttm/ttm_module.h
index cf416aee19af..45fa318c1585 100644
--- a/include/drm/ttm/ttm_module.h
+++ b/include/drm/ttm/ttm_module.h
@@ -35,26 +35,6 @@
35struct kobject; 35struct kobject;
36 36
37#define TTM_PFX "[TTM] " 37#define TTM_PFX "[TTM] "
38
39enum ttm_global_types {
40 TTM_GLOBAL_TTM_MEM = 0,
41 TTM_GLOBAL_TTM_BO,
42 TTM_GLOBAL_TTM_OBJECT,
43 TTM_GLOBAL_NUM
44};
45
46struct ttm_global_reference {
47 enum ttm_global_types global_type;
48 size_t size;
49 void *object;
50 int (*init) (struct ttm_global_reference *);
51 void (*release) (struct ttm_global_reference *);
52};
53
54extern void ttm_global_init(void);
55extern void ttm_global_release(void);
56extern int ttm_global_item_ref(struct ttm_global_reference *ref);
57extern void ttm_global_item_unref(struct ttm_global_reference *ref);
58extern struct kobject *ttm_get_kobj(void); 38extern struct kobject *ttm_get_kobj(void);
59 39
60#endif /* _TTM_MODULE_H_ */ 40#endif /* _TTM_MODULE_H_ */
diff --git a/include/drm/ttm/ttm_page_alloc.h b/include/drm/ttm/ttm_page_alloc.h
new file mode 100644
index 000000000000..116821448c38
--- /dev/null
+++ b/include/drm/ttm/ttm_page_alloc.h
@@ -0,0 +1,70 @@
1/*
2 * Copyright (c) Red Hat Inc.
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 * Authors: Dave Airlie <airlied@redhat.com>
24 * Jerome Glisse <jglisse@redhat.com>
25 */
26#ifndef TTM_PAGE_ALLOC
27#define TTM_PAGE_ALLOC
28
29#include "ttm_bo_driver.h"
30#include "ttm_memory.h"
31
32/**
33 * Get count number of pages from pool to pages list.
34 *
35 * @pages: heado of empty linked list where pages are filled.
36 * @flags: ttm flags for page allocation.
37 * @cstate: ttm caching state for the page.
38 * @count: number of pages to allocate.
39 */
40int ttm_get_pages(struct list_head *pages,
41 int flags,
42 enum ttm_caching_state cstate,
43 unsigned count);
44/**
45 * Put linked list of pages to pool.
46 *
47 * @pages: list of pages to free.
48 * @page_count: number of pages in the list. Zero can be passed for unknown
49 * count.
50 * @flags: ttm flags for page allocation.
51 * @cstate: ttm caching state.
52 */
53void ttm_put_pages(struct list_head *pages,
54 unsigned page_count,
55 int flags,
56 enum ttm_caching_state cstate);
57/**
58 * Initialize pool allocator.
59 */
60int ttm_page_alloc_init(struct ttm_mem_global *glob, unsigned max_pages);
61/**
62 * Free pool allocator.
63 */
64void ttm_page_alloc_fini(void);
65
66/**
67 * Output the state of pools to debugfs file
68 */
69extern int ttm_page_alloc_debugfs(struct seq_file *m, void *data);
70#endif
diff --git a/include/drm/vmwgfx_drm.h b/include/drm/vmwgfx_drm.h
index c7645f480d12..4d0842391edc 100644
--- a/include/drm/vmwgfx_drm.h
+++ b/include/drm/vmwgfx_drm.h
@@ -50,6 +50,8 @@
50#define DRM_VMW_EXECBUF 12 50#define DRM_VMW_EXECBUF 12
51#define DRM_VMW_FIFO_DEBUG 13 51#define DRM_VMW_FIFO_DEBUG 13
52#define DRM_VMW_FENCE_WAIT 14 52#define DRM_VMW_FENCE_WAIT 14
53/* guarded by minor version >= 2 */
54#define DRM_VMW_UPDATE_LAYOUT 15
53 55
54 56
55/*************************************************************************/ 57/*************************************************************************/
@@ -585,4 +587,28 @@ struct drm_vmw_stream_arg {
585 * sure that the stream has been stopped. 587 * sure that the stream has been stopped.
586 */ 588 */
587 589
590/*************************************************************************/
591/**
592 * DRM_VMW_UPDATE_LAYOUT - Update layout
593 *
594 * Updates the prefered modes and connection status for connectors. The
595 * command conisits of one drm_vmw_update_layout_arg pointing out a array
596 * of num_outputs drm_vmw_rect's.
597 */
598
599/**
600 * struct drm_vmw_update_layout_arg
601 *
602 * @num_outputs: number of active
603 * @rects: pointer to array of drm_vmw_rect
604 *
605 * Input argument to the DRM_VMW_UPDATE_LAYOUT Ioctl.
606 */
607
608struct drm_vmw_update_layout_arg {
609 uint32_t num_outputs;
610 uint32_t pad64;
611 uint64_t rects;
612};
613
588#endif 614#endif