aboutsummaryrefslogtreecommitdiffstats
path: root/include/drm
diff options
context:
space:
mode:
Diffstat (limited to 'include/drm')
-rw-r--r--include/drm/drmP.h56
-rw-r--r--include/drm/drm_crtc_helper.h3
-rw-r--r--include/drm/drm_mm.h27
-rw-r--r--include/drm/ttm/ttm_page_alloc.h4
4 files changed, 68 insertions, 22 deletions
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 8364a705f125..04b564bfc4a1 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,6 +49,7 @@
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 */ 55#include <linux/smp_lock.h> /* For (un)lock_kernel */
@@ -144,6 +146,7 @@ extern void drm_ut_debug_printk(unsigned int request_level,
144#define DRIVER_IRQ_VBL2 0x800 146#define DRIVER_IRQ_VBL2 0x800
145#define DRIVER_GEM 0x1000 147#define DRIVER_GEM 0x1000
146#define DRIVER_MODESET 0x2000 148#define DRIVER_MODESET 0x2000
149#define DRIVER_USE_PLATFORM_DEVICE 0x4000
147 150
148/***********************************************************************/ 151/***********************************************************************/
149/** \name Begin the DRM... */ 152/** \name Begin the DRM... */
@@ -825,6 +828,7 @@ struct drm_driver {
825 int num_ioctls; 828 int num_ioctls;
826 struct file_operations fops; 829 struct file_operations fops;
827 struct pci_driver pci_driver; 830 struct pci_driver pci_driver;
831 struct platform_device *platform_device;
828 /* List of devices hanging off this driver */ 832 /* List of devices hanging off this driver */
829 struct list_head device_list; 833 struct list_head device_list;
830}; 834};
@@ -1017,12 +1021,16 @@ struct drm_device {
1017 1021
1018 struct drm_agp_head *agp; /**< AGP data */ 1022 struct drm_agp_head *agp; /**< AGP data */
1019 1023
1024 struct device *dev; /**< Device structure */
1020 struct pci_dev *pdev; /**< PCI device structure */ 1025 struct pci_dev *pdev; /**< PCI device structure */
1021 int pci_vendor; /**< PCI vendor id */ 1026 int pci_vendor; /**< PCI vendor id */
1022 int pci_device; /**< PCI device id */ 1027 int pci_device; /**< PCI device id */
1023#ifdef __alpha__ 1028#ifdef __alpha__
1024 struct pci_controller *hose; 1029 struct pci_controller *hose;
1025#endif 1030#endif
1031
1032 struct platform_device *platformdev; /**< Platform device struture */
1033
1026 struct drm_sg_mem *sg; /**< Scatter gather memory */ 1034 struct drm_sg_mem *sg; /**< Scatter gather memory */
1027 int num_crtcs; /**< Number of CRTCs on this device */ 1035 int num_crtcs; /**< Number of CRTCs on this device */
1028 void *dev_private; /**< device private data */ 1036 void *dev_private; /**< device private data */
@@ -1062,17 +1070,21 @@ struct drm_device {
1062 1070
1063}; 1071};
1064 1072
1065static inline int drm_dev_to_irq(struct drm_device *dev)
1066{
1067 return dev->pdev->irq;
1068}
1069
1070static __inline__ int drm_core_check_feature(struct drm_device *dev, 1073static __inline__ int drm_core_check_feature(struct drm_device *dev,
1071 int feature) 1074 int feature)
1072{ 1075{
1073 return ((dev->driver->driver_features & feature) ? 1 : 0); 1076 return ((dev->driver->driver_features & feature) ? 1 : 0);
1074} 1077}
1075 1078
1079
1080static inline int drm_dev_to_irq(struct drm_device *dev)
1081{
1082 if (drm_core_check_feature(dev, DRIVER_USE_PLATFORM_DEVICE))
1083 return platform_get_irq(dev->platformdev, 0);
1084 else
1085 return dev->pdev->irq;
1086}
1087
1076#ifdef __alpha__ 1088#ifdef __alpha__
1077#define drm_get_pci_domain(dev) dev->hose->index 1089#define drm_get_pci_domain(dev) dev->hose->index
1078#else 1090#else
@@ -1275,10 +1287,6 @@ extern int drm_freebufs(struct drm_device *dev, void *data,
1275extern int drm_mapbufs(struct drm_device *dev, void *data, 1287extern int drm_mapbufs(struct drm_device *dev, void *data,
1276 struct drm_file *file_priv); 1288 struct drm_file *file_priv);
1277extern int drm_order(unsigned long size); 1289extern int drm_order(unsigned long size);
1278extern resource_size_t drm_get_resource_start(struct drm_device *dev,
1279 unsigned int resource);
1280extern resource_size_t drm_get_resource_len(struct drm_device *dev,
1281 unsigned int resource);
1282 1290
1283 /* DMA support (drm_dma.h) */ 1291 /* DMA support (drm_dma.h) */
1284extern int drm_dma_setup(struct drm_device *dev); 1292extern int drm_dma_setup(struct drm_device *dev);
@@ -1353,8 +1361,11 @@ extern int drm_dropmaster_ioctl(struct drm_device *dev, void *data,
1353struct drm_master *drm_master_create(struct drm_minor *minor); 1361struct drm_master *drm_master_create(struct drm_minor *minor);
1354extern struct drm_master *drm_master_get(struct drm_master *master); 1362extern struct drm_master *drm_master_get(struct drm_master *master);
1355extern void drm_master_put(struct drm_master **master); 1363extern void drm_master_put(struct drm_master **master);
1356extern int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent, 1364extern int drm_get_pci_dev(struct pci_dev *pdev,
1357 struct drm_driver *driver); 1365 const struct pci_device_id *ent,
1366 struct drm_driver *driver);
1367extern int drm_get_platform_dev(struct platform_device *pdev,
1368 struct drm_driver *driver);
1358extern void drm_put_dev(struct drm_device *dev); 1369extern void drm_put_dev(struct drm_device *dev);
1359extern int drm_put_minor(struct drm_minor **minor); 1370extern int drm_put_minor(struct drm_minor **minor);
1360extern unsigned int drm_debug; 1371extern unsigned int drm_debug;
@@ -1531,6 +1542,9 @@ static __inline__ struct drm_local_map *drm_core_findmap(struct drm_device *dev,
1531 1542
1532static __inline__ int drm_device_is_agp(struct drm_device *dev) 1543static __inline__ int drm_device_is_agp(struct drm_device *dev)
1533{ 1544{
1545 if (drm_core_check_feature(dev, DRIVER_USE_PLATFORM_DEVICE))
1546 return 0;
1547
1534 if (dev->driver->device_is_agp != NULL) { 1548 if (dev->driver->device_is_agp != NULL) {
1535 int err = (*dev->driver->device_is_agp) (dev); 1549 int err = (*dev->driver->device_is_agp) (dev);
1536 1550
@@ -1544,7 +1558,10 @@ static __inline__ int drm_device_is_agp(struct drm_device *dev)
1544 1558
1545static __inline__ int drm_device_is_pcie(struct drm_device *dev) 1559static __inline__ int drm_device_is_pcie(struct drm_device *dev)
1546{ 1560{
1547 return pci_find_capability(dev->pdev, PCI_CAP_ID_EXP); 1561 if (drm_core_check_feature(dev, DRIVER_USE_PLATFORM_DEVICE))
1562 return 0;
1563 else
1564 return pci_find_capability(dev->pdev, PCI_CAP_ID_EXP);
1548} 1565}
1549 1566
1550static __inline__ void drm_core_dropmap(struct drm_local_map *map) 1567static __inline__ void drm_core_dropmap(struct drm_local_map *map)
@@ -1552,6 +1569,21 @@ static __inline__ void drm_core_dropmap(struct drm_local_map *map)
1552} 1569}
1553 1570
1554#include "drm_mem_util.h" 1571#include "drm_mem_util.h"
1572
1573static inline void *drm_get_device(struct drm_device *dev)
1574{
1575 if (drm_core_check_feature(dev, DRIVER_USE_PLATFORM_DEVICE))
1576 return dev->platformdev;
1577 else
1578 return dev->pdev;
1579}
1580
1581extern int drm_platform_init(struct drm_driver *driver);
1582extern int drm_pci_init(struct drm_driver *driver);
1583extern int drm_fill_in_dev(struct drm_device *dev,
1584 const struct pci_device_id *ent,
1585 struct drm_driver *driver);
1586int drm_get_minor(struct drm_device *dev, struct drm_minor **minor, int type);
1555/*@}*/ 1587/*@}*/
1556 1588
1557#endif /* __KERNEL__ */ 1589#endif /* __KERNEL__ */
diff --git a/include/drm/drm_crtc_helper.h b/include/drm/drm_crtc_helper.h
index 1121f7799c6f..7e3c9766acba 100644
--- a/include/drm/drm_crtc_helper.h
+++ b/include/drm/drm_crtc_helper.h
@@ -63,6 +63,9 @@ struct drm_crtc_helper_funcs {
63 63
64 /* reload the current crtc LUT */ 64 /* reload the current crtc LUT */
65 void (*load_lut)(struct drm_crtc *crtc); 65 void (*load_lut)(struct drm_crtc *crtc);
66
67 /* disable crtc when not in use - more explicit than dpms off */
68 void (*disable)(struct drm_crtc *crtc);
66}; 69};
67 70
68struct drm_encoder_helper_funcs { 71struct drm_encoder_helper_funcs {
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/ttm/ttm_page_alloc.h b/include/drm/ttm/ttm_page_alloc.h
index 8bb4de567b2c..116821448c38 100644
--- a/include/drm/ttm/ttm_page_alloc.h
+++ b/include/drm/ttm/ttm_page_alloc.h
@@ -56,10 +56,6 @@ void ttm_put_pages(struct list_head *pages,
56 enum ttm_caching_state cstate); 56 enum ttm_caching_state cstate);
57/** 57/**
58 * Initialize pool allocator. 58 * Initialize pool allocator.
59 *
60 * Pool allocator is internaly reference counted so it can be initialized
61 * multiple times but ttm_page_alloc_fini has to be called same number of
62 * times.
63 */ 59 */
64int ttm_page_alloc_init(struct ttm_mem_global *glob, unsigned max_pages); 60int ttm_page_alloc_init(struct ttm_mem_global *glob, unsigned max_pages);
65/** 61/**