Subversion Repositories Kolibri OS

Rev

Rev 4065 | Rev 4244 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4065 Rev 4103
Line 79... Line 79...
79
//#include 
79
//#include 
Line 80... Line 80...
80
 
80
 
Line 81... Line 81...
81
#include 
81
#include 
-
 
82
 
Line 82... Line 83...
82
 
83
 
Line 83... Line 84...
83
 
84
#include 
84
#include "drm.h"
-
 
Line 85... Line 85...
85
 
85
#include 
Line 86... Line 86...
86
#include 
86
 
87
 
87
#include 
Line 88... Line 88...
88
#define __OS_HAS_AGP (defined(CONFIG_AGP) || (defined(CONFIG_AGP_MODULE) && defined(MODULE)))
88
 
89
#define __OS_HAS_MTRR (defined(CONFIG_MTRR))
89
#define __OS_HAS_AGP (defined(CONFIG_AGP) || (defined(CONFIG_AGP_MODULE) && defined(MODULE)))
-
 
90
 
-
 
91
struct module;
-
 
92
 
-
 
93
struct drm_file;
-
 
94
struct drm_device;
-
 
95
 
-
 
96
struct device_node;
-
 
97
struct videomode;
90
 
98
 
91
struct module;
99
struct inode;
92
 
100
struct poll_table_struct;
Line 93... Line 101...
93
struct drm_file;
101
struct drm_lock_data;
Line 157... Line 165...
157
/*@{*/
165
/*@{*/
Line 158... Line 166...
158
 
166
 
159
/* driver capabilities and requirements mask */
167
/* driver capabilities and requirements mask */
160
#define DRIVER_USE_AGP     0x1
168
#define DRIVER_USE_AGP     0x1
161
#define DRIVER_REQUIRE_AGP 0x2
-
 
162
#define DRIVER_USE_MTRR    0x4
169
#define DRIVER_REQUIRE_AGP 0x2
163
#define DRIVER_PCI_DMA     0x8
170
#define DRIVER_PCI_DMA     0x8
164
#define DRIVER_SG          0x10
171
#define DRIVER_SG          0x10
165
#define DRIVER_HAVE_DMA    0x20
172
#define DRIVER_HAVE_DMA    0x20
166
#define DRIVER_HAVE_IRQ    0x40
173
#define DRIVER_HAVE_IRQ    0x40
167
#define DRIVER_IRQ_SHARED  0x80
-
 
168
#define DRIVER_IRQ_VBL     0x100
-
 
169
#define DRIVER_DMA_QUEUE   0x200
-
 
170
#define DRIVER_FB_DMA      0x400
-
 
171
#define DRIVER_IRQ_VBL2    0x800
174
#define DRIVER_IRQ_SHARED  0x80
172
#define DRIVER_GEM         0x1000
175
#define DRIVER_GEM         0x1000
173
#define DRIVER_MODESET     0x2000
176
#define DRIVER_MODESET     0x2000
-
 
177
#define DRIVER_PRIME       0x4000
Line 174... Line 178...
174
#define DRIVER_PRIME       0x4000
178
#define DRIVER_RENDER      0x8000
175
 
179
 
176
#define DRIVER_BUS_PCI 0x1
180
#define DRIVER_BUS_PCI 0x1
Line 272... Line 276...
272
/** \name Internal types and structures */
276
/** \name Internal types and structures */
273
/*@{*/
277
/*@{*/
Line 274... Line 278...
274
 
278
 
Line 275... Line -...
275
#define DRM_ARRAY_SIZE(x) ARRAY_SIZE(x)
-
 
276
 
-
 
277
#define DRM_LEFTCOUNT(x) (((x)->rp + (x)->count - (x)->wp) % ((x)->count + 1))
-
 
278
#define DRM_BUFCOUNT(x) ((x)->count - DRM_LEFTCOUNT(x))
279
#define DRM_ARRAY_SIZE(x) ARRAY_SIZE(x)
Line 279... Line 280...
279
 
280
 
280
#define DRM_IF_VERSION(maj, min) (maj << 16 | min)
281
#define DRM_IF_VERSION(maj, min) (maj << 16 | min)
281
 
282
 
Line 317... Line 318...
317
#define DRM_AUTH	0x1
318
#define DRM_AUTH	0x1
318
#define	DRM_MASTER	0x2
319
#define	DRM_MASTER	0x2
319
#define DRM_ROOT_ONLY	0x4
320
#define DRM_ROOT_ONLY	0x4
320
#define DRM_CONTROL_ALLOW 0x8
321
#define DRM_CONTROL_ALLOW 0x8
321
#define DRM_UNLOCKED	0x10
322
#define DRM_UNLOCKED	0x10
-
 
323
#define DRM_RENDER_ALLOW 0x20
Line 322... Line 324...
322
 
324
 
323
struct drm_ioctl_desc {
325
struct drm_ioctl_desc {
324
	unsigned int cmd;
326
	unsigned int cmd;
325
	int flags;
327
	int flags;
Line 572... Line 574...
572
	int mtrr;		 /**< MTRR slot used */
574
	int mtrr;		 /**< MTRR slot used */
573
};
575
};
Line 574... Line 576...
574
 
576
 
Line 575... Line -...
575
typedef struct drm_local_map drm_local_map_t;
-
 
576
 
577
typedef struct drm_local_map drm_local_map_t;
577
#if 0
578
 
578
/**
579
/**
579
 * Mappings list
580
 * Mappings list
580
 */
581
 */
581
struct drm_map_list {
582
struct drm_map_list {
582
	struct list_head head;		/**< list head */
583
	struct list_head head;		/**< list head */
583
	struct drm_hash_item hash;
584
	struct drm_hash_item hash;
584
	struct drm_local_map *map;	/**< mapping */
585
	struct drm_local_map *map;	/**< mapping */
585
	uint64_t user_token;
-
 
586
	struct drm_master *master;
586
	uint64_t user_token;
Line 587... Line 587...
587
	struct drm_mm_node *file_offset_node;	/**< fake offset */
587
	struct drm_master *master;
588
};
588
};
589
 
589
 
Line 617... Line 617...
617
 
617
 
618
/**
618
/**
619
 * GEM specific mm private for tracking GEM objects
619
 * GEM specific mm private for tracking GEM objects
620
 */
620
 */
621
struct drm_gem_mm {
621
struct drm_gem_mm {
622
	struct drm_mm offset_manager;	/**< Offset mgmt for buffer objects */
-
 
623
	struct drm_open_hash offset_hash; /**< User token hash table for maps */
622
	struct drm_vma_offset_manager vma_manager;
Line 624... Line -...
624
};
-
 
625
 
-
 
626
#endif
623
};
627
 
624
 
628
/**
625
/**
629
 * This structure defines the drm_mm memory object, which will be used by the
626
 * This structure defines the drm_mm memory object, which will be used by the
630
 * DRM for its buffer objects.
627
 * DRM for its buffer objects.
631
 */
628
 */
632
struct drm_gem_object {
629
struct drm_gem_object {
Line -... Line 630...
-
 
630
	/** Reference count of this object */
633
	/** Reference count of this object */
631
	struct kref refcount;
-
 
632
 
634
	struct kref refcount;
633
	/**
-
 
634
	 * handle_count - gem file_priv handle count of this object
-
 
635
	 *
-
 
636
	 * Each handle also holds a reference. Note that when the handle_count
-
 
637
	 * drops to 0 any global names (e.g. the id in the flink namespace) will
-
 
638
	 * be cleared.
-
 
639
	 *
Line 635... Line 640...
635
 
640
	 * Protected by dev->object_name_lock.
636
	/** Handle count of this object. Each handle also holds a reference */
641
	 * */
Line 637... Line 642...
637
	atomic_t handle_count; /* number of handles on this object */
642
	unsigned handle_count;
638
 
643
 
Line 639... Line 644...
639
	/** Related drm device */
644
	/** Related drm device */
-
 
645
	struct drm_device *dev;
Line 640... Line 646...
640
	struct drm_device *dev;
646
 
641
 
647
	/** File representing the shmem storage */
642
	/** File representing the shmem storage */
648
	struct file *filp;
643
	struct file *filp;
649
 
Line 729... Line 735...
729
	int (*set_unique)(struct drm_device *dev, struct drm_master *master,
735
	int (*set_unique)(struct drm_device *dev, struct drm_master *master,
730
			  struct drm_unique *unique);
736
			  struct drm_unique *unique);
731
	int (*irq_by_busid)(struct drm_device *dev, struct drm_irq_busid *p);
737
	int (*irq_by_busid)(struct drm_device *dev, struct drm_irq_busid *p);
732
	/* hooks that are for PCI */
738
	/* hooks that are for PCI */
733
	int (*agp_init)(struct drm_device *dev);
739
	int (*agp_init)(struct drm_device *dev);
-
 
740
	void (*agp_destroy)(struct drm_device *dev);
Line 734... Line 741...
734
 
741
 
Line 735... Line 742...
735
};
742
};
736
 
743
 
Line 877... Line 884...
877
 
884
 
878
	irqreturn_t(*irq_handler) (DRM_IRQ_ARGS);
885
	irqreturn_t(*irq_handler) (DRM_IRQ_ARGS);
879
	void (*irq_preinstall) (struct drm_device *dev);
886
	void (*irq_preinstall) (struct drm_device *dev);
880
	int (*irq_postinstall) (struct drm_device *dev);
887
	int (*irq_postinstall) (struct drm_device *dev);
881
	void (*irq_uninstall) (struct drm_device *dev);
-
 
882
	void (*set_version) (struct drm_device *dev,
-
 
Line 883... Line 888...
883
			     struct drm_set_version *sv);
888
	void (*irq_uninstall) (struct drm_device *dev);
884
 
889
 
885
	/* Master routines */
890
	/* Master routines */
886
	int (*master_create)(struct drm_device *dev, struct drm_master *master);
891
	int (*master_create)(struct drm_device *dev, struct drm_master *master);
Line 947... Line 952...
947
	char *desc;
952
	char *desc;
948
	char *date;
953
	char *date;
Line 949... Line 954...
949
 
954
 
950
	u32 driver_features;
955
	u32 driver_features;
951
	int dev_priv_size;
956
	int dev_priv_size;
952
	struct drm_ioctl_desc *ioctls;
957
	const struct drm_ioctl_desc *ioctls;
953
	int num_ioctls;
958
	int num_ioctls;
954
	const struct file_operations *fops;
959
	const struct file_operations *fops;
955
	union {
960
	union {
956
		struct pci_driver *pci;
961
		struct pci_driver *pci;
Line 966... Line 971...
966
#endif
971
#endif
Line 967... Line 972...
967
 
972
 
Line 968... Line 973...
968
#define DRM_IRQ_ARGS            int irq, void *arg 
973
#define DRM_IRQ_ARGS            int irq, void *arg
-
 
974
 
969
 
975
struct drm_driver {
Line 970... Line 976...
970
struct drm_driver {
976
	int (*load) (struct drm_device *, unsigned long flags);
971
	int (*open) (struct drm_device *, struct drm_file *);
977
	int (*open) (struct drm_device *, struct drm_file *);
972
 
978
 
Line 1124... Line 1130...
1124
 
1130
 
1125
	/** \name Context support */
1131
	/** \name Context support */
1126
	/*@{ */
1132
	/*@{ */
1127
	int irq_enabled;		/**< True if irq handler is enabled */
1133
	int irq_enabled;		/**< True if irq handler is enabled */
1128
	__volatile__ long context_flag;	/**< Context swapping flag */
-
 
1129
	__volatile__ long interrupt_flag; /**< Interruption handler flag */
-
 
1130
	__volatile__ long dma_flag;	/**< DMA dispatch flag */
-
 
1131
//   wait_queue_head_t context_wait; /**< Processes waiting on ctx switch */
-
 
1132
	int last_checked;		/**< Last context checked for DMA */
1134
	__volatile__ long context_flag;	/**< Context swapping flag */
1133
	int last_context;		/**< Last current context */
-
 
1134
	unsigned long last_switch;	/**< jiffies at last context switch */
1135
	int last_context;		/**< Last current context */
Line 1135... Line 1136...
1135
	/*@} */
1136
	/*@} */
1136
 
1137
 
1137
//   struct work_struct work;
1138
//   struct work_struct work;
Line 1167... Line 1168...
1167
	 */
1168
	 */
1168
	struct list_head vblank_event_list;
1169
	struct list_head vblank_event_list;
1169
	spinlock_t event_lock;
1170
	spinlock_t event_lock;
Line 1170... Line 1171...
1170
 
1171
 
1171
	/*@} */
-
 
1172
//   cycles_t ctx_start;
-
 
1173
//   cycles_t lck_start;
-
 
1174
 
-
 
1175
//   struct fasync_struct *buf_async;/**< Processes waiting for SIGIO */
-
 
1176
//   wait_queue_head_t buf_readers;  /**< Processes waiting to read */
-
 
Line 1177... Line 1172...
1177
//   wait_queue_head_t buf_writers;  /**< Processes waiting to ctx switch */
1172
	/*@} */
Line 1178... Line 1173...
1178
 
1173
 
1179
//   struct drm_agp_head *agp;   /**< AGP data */
1174
//   struct drm_agp_head *agp;   /**< AGP data */
Line 1197... Line 1192...
1197
 
1192
 
Line 1198... Line 1193...
1198
        struct drm_mode_config mode_config;	/**< Current mode config */
1193
        struct drm_mode_config mode_config;	/**< Current mode config */
1199
 
1194
 
1200
	/** \name GEM information */
1195
	/** \name GEM information */
1201
	/*@{ */
1196
	/*@{ */
1202
   spinlock_t object_name_lock;
1197
	struct mutex object_name_lock;
1203
	struct idr object_name_idr;
1198
	struct idr object_name_idr;
Line 1204... Line 1199...
1204
	/*@} */
1199
	/*@} */
1205
	int switch_power_state;
1200
	int switch_power_state;
Line 1206... Line 1201...
1206
 
1201
 
1207
	atomic_t unplugged; /* device has been unplugged or gone away */
1202
	atomic_t unplugged; /* device has been unplugged or gone away */
1208
};
1203
};
-
 
1204
 
Line 1209... Line 1205...
1209
 
1205
#define DRM_SWITCH_POWER_ON 0
1210
#define DRM_SWITCH_POWER_ON 0
1206
#define DRM_SWITCH_POWER_OFF 1
1211
#define DRM_SWITCH_POWER_OFF 1
1207
#define DRM_SWITCH_POWER_CHANGING 2
1212
#define DRM_SWITCH_POWER_CHANGING 2
1208
#define DRM_SWITCH_POWER_DYNAMIC_OFF 3
Line 1220... Line 1216...
1220
static inline int drm_dev_to_irq(struct drm_device *dev)
1216
static inline int drm_dev_to_irq(struct drm_device *dev)
1221
{
1217
{
1222
	return dev->pdev->irq;
1218
	return dev->pdev->irq;
1223
}
1219
}
Line 1224... Line -...
1224
 
-
 
1225
#if 0
-
 
1226
 
-
 
1227
#if __OS_HAS_AGP
-
 
1228
static inline int drm_core_has_AGP(struct drm_device *dev)
-
 
1229
{
-
 
1230
	return drm_core_check_feature(dev, DRIVER_USE_AGP);
-
 
1231
}
-
 
1232
#else
-
 
1233
#define drm_core_has_AGP(dev) (0)
-
 
1234
#endif
-
 
1235
 
-
 
1236
#if __OS_HAS_MTRR
-
 
1237
static inline int drm_core_has_MTRR(struct drm_device *dev)
-
 
1238
{
-
 
1239
	return drm_core_check_feature(dev, DRIVER_USE_MTRR);
-
 
1240
}
-
 
1241
#else
-
 
1242
#define drm_core_has_MTRR(dev) (0)
-
 
1243
#endif
-
 
1244
 
1220
 
1245
static inline void drm_device_set_unplugged(struct drm_device *dev)
1221
static inline void drm_device_set_unplugged(struct drm_device *dev)
1246
{
1222
{
1247
	smp_wmb();
1223
	smp_wmb();
1248
	atomic_set(&dev->unplugged, 1);
1224
	atomic_set(&dev->unplugged, 1);
Line 1273... Line 1249...
1273
 
1249
 
1274
				/* Device support (drm_fops.h) */
1250
				/* Device support (drm_fops.h) */
1275
extern struct mutex drm_global_mutex;
1251
extern struct mutex drm_global_mutex;
1276
extern int drm_open(struct inode *inode, struct file *filp);
1252
extern int drm_open(struct inode *inode, struct file *filp);
1277
extern int drm_stub_open(struct inode *inode, struct file *filp);
-
 
1278
extern int drm_fasync(int fd, struct file *filp, int on);
1253
extern int drm_stub_open(struct inode *inode, struct file *filp);
1279
extern ssize_t drm_read(struct file *filp, char __user *buffer,
1254
extern ssize_t drm_read(struct file *filp, char __user *buffer,
1280
			size_t count, loff_t *offset);
1255
			size_t count, loff_t *offset);
Line 1281... Line 1256...
1281
extern int drm_release(struct inode *inode, struct file *filp);
1256
extern int drm_release(struct inode *inode, struct file *filp);
Line 1287... Line 1262...
1287
extern void drm_vm_close_locked(struct drm_device *dev, struct vm_area_struct *vma);
1262
extern void drm_vm_close_locked(struct drm_device *dev, struct vm_area_struct *vma);
1288
extern unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait);
1263
extern unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait);
Line 1289... Line 1264...
1289
 
1264
 
1290
				/* Memory management support (drm_memory.h) */
1265
				/* Memory management support (drm_memory.h) */
1291
#include 
-
 
1292
extern void drm_free_agp(DRM_AGP_MEM * handle, int pages);
-
 
1293
extern int drm_bind_agp(DRM_AGP_MEM * handle, unsigned int start);
-
 
1294
extern DRM_AGP_MEM *drm_agp_bind_pages(struct drm_device *dev,
-
 
1295
				       struct page **pages,
-
 
1296
				       unsigned long num_pages,
-
 
1297
				       uint32_t gtt_offset,
-
 
1298
				       uint32_t type);
-
 
Line 1299... Line 1266...
1299
extern int drm_unbind_agp(DRM_AGP_MEM * handle);
1266
#include 
1300
 
1267
 
1301
				/* Misc. IOCTL support (drm_ioctl.h) */
1268
				/* Misc. IOCTL support (drm_ioctl.h) */
1302
extern int drm_irq_by_busid(struct drm_device *dev, void *data,
1269
extern int drm_irq_by_busid(struct drm_device *dev, void *data,
Line 1321... Line 1288...
1321
				/* Context IOCTL support (drm_context.h) */
1288
				/* Context IOCTL support (drm_context.h) */
1322
extern int drm_resctx(struct drm_device *dev, void *data,
1289
extern int drm_resctx(struct drm_device *dev, void *data,
1323
		      struct drm_file *file_priv);
1290
		      struct drm_file *file_priv);
1324
extern int drm_addctx(struct drm_device *dev, void *data,
1291
extern int drm_addctx(struct drm_device *dev, void *data,
1325
		      struct drm_file *file_priv);
1292
		      struct drm_file *file_priv);
1326
extern int drm_modctx(struct drm_device *dev, void *data,
-
 
1327
		      struct drm_file *file_priv);
-
 
1328
extern int drm_getctx(struct drm_device *dev, void *data,
1293
extern int drm_getctx(struct drm_device *dev, void *data,
1329
		      struct drm_file *file_priv);
1294
		      struct drm_file *file_priv);
1330
extern int drm_switchctx(struct drm_device *dev, void *data,
1295
extern int drm_switchctx(struct drm_device *dev, void *data,
1331
			 struct drm_file *file_priv);
1296
			 struct drm_file *file_priv);
1332
extern int drm_newctx(struct drm_device *dev, void *data,
1297
extern int drm_newctx(struct drm_device *dev, void *data,
Line 1394... Line 1359...
1394
extern int drm_mapbufs(struct drm_device *dev, void *data,
1359
extern int drm_mapbufs(struct drm_device *dev, void *data,
1395
		       struct drm_file *file_priv);
1360
		       struct drm_file *file_priv);
1396
extern int drm_order(unsigned long size);
1361
extern int drm_order(unsigned long size);
Line 1397... Line 1362...
1397
 
1362
 
1398
				/* DMA support (drm_dma.h) */
1363
				/* DMA support (drm_dma.h) */
1399
extern int drm_dma_setup(struct drm_device *dev);
1364
extern int drm_legacy_dma_setup(struct drm_device *dev);
1400
extern void drm_dma_takedown(struct drm_device *dev);
1365
extern void drm_legacy_dma_takedown(struct drm_device *dev);
1401
extern void drm_free_buffer(struct drm_device *dev, struct drm_buf * buf);
1366
extern void drm_free_buffer(struct drm_device *dev, struct drm_buf * buf);
1402
extern void drm_core_reclaim_buffers(struct drm_device *dev,
1367
extern void drm_core_reclaim_buffers(struct drm_device *dev,
Line 1403... Line 1368...
1403
				     struct drm_file *filp);
1368
				     struct drm_file *filp);
Line 1409... Line 1374...
1409
extern int drm_irq_uninstall(struct drm_device *dev);
1374
extern int drm_irq_uninstall(struct drm_device *dev);
Line 1410... Line 1375...
1410
 
1375
 
1411
extern int drm_vblank_init(struct drm_device *dev, int num_crtcs);
1376
extern int drm_vblank_init(struct drm_device *dev, int num_crtcs);
1412
extern int drm_wait_vblank(struct drm_device *dev, void *data,
1377
extern int drm_wait_vblank(struct drm_device *dev, void *data,
1413
			   struct drm_file *filp);
-
 
1414
extern int drm_vblank_wait(struct drm_device *dev, unsigned int *vbl_seq);
1378
			   struct drm_file *filp);
1415
extern u32 drm_vblank_count(struct drm_device *dev, int crtc);
1379
extern u32 drm_vblank_count(struct drm_device *dev, int crtc);
1416
extern u32 drm_vblank_count_and_time(struct drm_device *dev, int crtc,
1380
extern u32 drm_vblank_count_and_time(struct drm_device *dev, int crtc,
1417
				     struct timeval *vblanktime);
1381
				     struct timeval *vblanktime);
1418
extern void drm_send_vblank_event(struct drm_device *dev, int crtc,
1382
extern void drm_send_vblank_event(struct drm_device *dev, int crtc,
Line 1451... Line 1415...
1451
extern void drm_vblank_post_modeset(struct drm_device *dev, int crtc);
1415
extern void drm_vblank_post_modeset(struct drm_device *dev, int crtc);
1452
extern int drm_modeset_ctl(struct drm_device *dev, void *data,
1416
extern int drm_modeset_ctl(struct drm_device *dev, void *data,
1453
			   struct drm_file *file_priv);
1417
			   struct drm_file *file_priv);
Line 1454... Line 1418...
1454
 
1418
 
1455
				/* AGP/GART support (drm_agpsupport.h) */
-
 
1456
extern struct drm_agp_head *drm_agp_init(struct drm_device *dev);
-
 
1457
extern int drm_agp_acquire(struct drm_device *dev);
-
 
1458
extern int drm_agp_acquire_ioctl(struct drm_device *dev, void *data,
-
 
1459
				 struct drm_file *file_priv);
-
 
1460
extern int drm_agp_release(struct drm_device *dev);
-
 
1461
extern int drm_agp_release_ioctl(struct drm_device *dev, void *data,
-
 
1462
				 struct drm_file *file_priv);
-
 
1463
extern int drm_agp_enable(struct drm_device *dev, struct drm_agp_mode mode);
-
 
1464
extern int drm_agp_enable_ioctl(struct drm_device *dev, void *data,
-
 
1465
				struct drm_file *file_priv);
-
 
1466
extern int drm_agp_info(struct drm_device *dev, struct drm_agp_info *info);
-
 
1467
extern int drm_agp_info_ioctl(struct drm_device *dev, void *data,
-
 
1468
			struct drm_file *file_priv);
-
 
1469
extern int drm_agp_alloc(struct drm_device *dev, struct drm_agp_buffer *request);
-
 
1470
extern int drm_agp_alloc_ioctl(struct drm_device *dev, void *data,
-
 
1471
			 struct drm_file *file_priv);
-
 
1472
extern int drm_agp_free(struct drm_device *dev, struct drm_agp_buffer *request);
-
 
1473
extern int drm_agp_free_ioctl(struct drm_device *dev, void *data,
-
 
1474
			struct drm_file *file_priv);
-
 
1475
extern int drm_agp_unbind(struct drm_device *dev, struct drm_agp_binding *request);
-
 
1476
extern int drm_agp_unbind_ioctl(struct drm_device *dev, void *data,
-
 
1477
			  struct drm_file *file_priv);
-
 
1478
extern int drm_agp_bind(struct drm_device *dev, struct drm_agp_binding *request);
-
 
1479
extern int drm_agp_bind_ioctl(struct drm_device *dev, void *data,
-
 
Line 1480... Line 1419...
1480
			struct drm_file *file_priv);
1419
				/* AGP/GART support (drm_agpsupport.h) */
1481
 
1420
 
1482
				/* Stub support (drm_stub.h) */
1421
				/* Stub support (drm_stub.h) */
1483
extern int drm_setmaster_ioctl(struct drm_device *dev, void *data,
1422
extern int drm_setmaster_ioctl(struct drm_device *dev, void *data,
Line 1489... Line 1428...
1489
extern void drm_master_put(struct drm_master **master);
1428
extern void drm_master_put(struct drm_master **master);
Line 1490... Line 1429...
1490
 
1429
 
1491
extern void drm_put_dev(struct drm_device *dev);
1430
extern void drm_put_dev(struct drm_device *dev);
1492
extern int drm_put_minor(struct drm_minor **minor);
1431
extern int drm_put_minor(struct drm_minor **minor);
1493
extern void drm_unplug_dev(struct drm_device *dev);
-
 
1494
#endif
-
 
1495
 
1432
extern void drm_unplug_dev(struct drm_device *dev);
-
 
1433
extern unsigned int drm_debug;
Line 1496... Line 1434...
1496
extern unsigned int drm_debug;
1434
extern unsigned int drm_rnodes;
1497
 
1435
 
1498
#if 0
1436
#if 0
1499
extern unsigned int drm_vblank_offdelay;
1437
extern unsigned int drm_vblank_offdelay;
Line 1500... Line 1438...
1500
extern unsigned int drm_timestamp_precision;
1438
extern unsigned int drm_timestamp_precision;
1501
extern unsigned int drm_timestamp_monotonic;
-
 
1502
 
1439
extern unsigned int drm_timestamp_monotonic;
Line 1503... Line 1440...
1503
extern struct class *drm_class;
1440
 
Line 1504... Line 1441...
1504
extern struct proc_dir_entry *drm_proc_root;
1441
extern struct class *drm_class;
Line 1505... Line -...
1505
extern struct dentry *drm_debugfs_root;
-
 
1506
 
-
 
1507
extern struct idr drm_minors_idr;
-
 
1508
 
-
 
1509
extern struct drm_local_map *drm_getsarea(struct drm_device *dev);
1442
extern struct dentry *drm_debugfs_root;
1510
 
1443
 
1511
				/* Proc support (drm_proc.h) */
1444
extern struct idr drm_minors_idr;
1512
extern int drm_proc_init(struct drm_minor *minor, struct proc_dir_entry *root);
1445
 
1513
extern int drm_proc_cleanup(struct drm_minor *minor, struct proc_dir_entry *root);
1446
extern struct drm_local_map *drm_getsarea(struct drm_device *dev);
Line 1534... Line 1467...
1534
#if DRM_DEBUG_CODE
1467
#if DRM_DEBUG_CODE
1535
extern int drm_vma_info(struct seq_file *m, void *data);
1468
extern int drm_vma_info(struct seq_file *m, void *data);
1536
#endif
1469
#endif
Line 1537... Line 1470...
1537
 
1470
 
1538
				/* Scatter Gather Support (drm_scatter.h) */
1471
				/* Scatter Gather Support (drm_scatter.h) */
1539
extern void drm_sg_cleanup(struct drm_sg_mem * entry);
1472
extern void drm_legacy_sg_cleanup(struct drm_device *dev);
1540
extern int drm_sg_alloc_ioctl(struct drm_device *dev, void *data,
1473
extern int drm_sg_alloc(struct drm_device *dev, void *data,
1541
			struct drm_file *file_priv);
-
 
1542
extern int drm_sg_alloc(struct drm_device *dev, struct drm_scatter_gather * request);
1474
			struct drm_file *file_priv);
1543
extern int drm_sg_free(struct drm_device *dev, void *data,
1475
extern int drm_sg_free(struct drm_device *dev, void *data,
Line 1544... Line 1476...
1544
		       struct drm_file *file_priv);
1476
		       struct drm_file *file_priv);
1545
 
1477
 
Line 1561... Line 1493...
1561
extern struct class *drm_sysfs_create(struct module *owner, char *name);
1493
extern struct class *drm_sysfs_create(struct module *owner, char *name);
1562
extern void drm_sysfs_destroy(void);
1494
extern void drm_sysfs_destroy(void);
1563
extern int drm_sysfs_device_add(struct drm_minor *minor);
1495
extern int drm_sysfs_device_add(struct drm_minor *minor);
1564
extern void drm_sysfs_hotplug_event(struct drm_device *dev);
1496
extern void drm_sysfs_hotplug_event(struct drm_device *dev);
1565
extern void drm_sysfs_device_remove(struct drm_minor *minor);
1497
extern void drm_sysfs_device_remove(struct drm_minor *minor);
1566
extern char *drm_get_connector_status_name(enum drm_connector_status status);
-
 
1567
 
-
 
1568
static inline int drm_sysfs_connector_add(struct drm_connector *connector)
1498
extern int drm_sysfs_connector_add(struct drm_connector *connector);
1569
{ return 0; };
-
 
1570
 
-
 
1571
static inline void drm_sysfs_connector_remove(struct drm_connector *connector)
1499
extern void drm_sysfs_connector_remove(struct drm_connector *connector);
1572
{ };
-
 
1573
 
-
 
1574
#endif
1500
#endif
Line 1575... Line 1501...
1575
 
1501
 
1576
/* Graphics Execution Manager library functions (drm_gem.c) */
1502
/* Graphics Execution Manager library functions (drm_gem.c) */
1577
int drm_gem_init(struct drm_device *dev);
1503
int drm_gem_init(struct drm_device *dev);
Line 1580... Line 1506...
1580
void drm_gem_object_free(struct kref *kref);
1506
void drm_gem_object_free(struct kref *kref);
1581
struct drm_gem_object *drm_gem_object_alloc(struct drm_device *dev,
1507
struct drm_gem_object *drm_gem_object_alloc(struct drm_device *dev,
1582
					    size_t size);
1508
					    size_t size);
1583
int drm_gem_object_init(struct drm_device *dev,
1509
int drm_gem_object_init(struct drm_device *dev,
1584
			struct drm_gem_object *obj, size_t size);
1510
			struct drm_gem_object *obj, size_t size);
1585
int drm_gem_private_object_init(struct drm_device *dev,
1511
void drm_gem_private_object_init(struct drm_device *dev,
1586
			struct drm_gem_object *obj, size_t size);
1512
			struct drm_gem_object *obj, size_t size);
1587
void drm_gem_object_handle_free(struct drm_gem_object *obj);
-
 
1588
void drm_gem_vm_open(struct vm_area_struct *vma);
1513
void drm_gem_vm_open(struct vm_area_struct *vma);
1589
void drm_gem_vm_close(struct vm_area_struct *vma);
1514
void drm_gem_vm_close(struct vm_area_struct *vma);
-
 
1515
int drm_gem_mmap_obj(struct drm_gem_object *obj, unsigned long obj_size,
-
 
1516
		     struct vm_area_struct *vma);
1590
int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma);
1517
int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma);
Line -... Line 1518...
-
 
1518
 
Line 1591... Line 1519...
1591
 
1519
#include 
1592
 
1520
 
1593
static inline void
1521
static inline void
1594
drm_gem_object_reference(struct drm_gem_object *obj)
1522
drm_gem_object_reference(struct drm_gem_object *obj)
Line 1604... Line 1532...
1604
}
1532
}
Line 1605... Line 1533...
1605
 
1533
 
1606
static inline void
1534
static inline void
1607
drm_gem_object_unreference_unlocked(struct drm_gem_object *obj)
1535
drm_gem_object_unreference_unlocked(struct drm_gem_object *obj)
1608
{
1536
{
1609
	if (obj != NULL) {
1537
	if (obj && !atomic_add_unless(&obj->refcount.refcount, -1, 1)) {
-
 
1538
		struct drm_device *dev = obj->dev;
1610
		struct drm_device *dev = obj->dev;
1539
 
-
 
1540
		mutex_lock(&dev->struct_mutex);
1611
		mutex_lock(&dev->struct_mutex);
1541
		if (likely(atomic_dec_and_test(&obj->refcount.refcount)))
1612
	kref_put(&obj->refcount, drm_gem_object_free);
1542
			drm_gem_object_free(&obj->refcount);
1613
		mutex_unlock(&dev->struct_mutex);
1543
		mutex_unlock(&dev->struct_mutex);
1614
	}
1544
	}
Line -... Line 1545...
-
 
1545
}
-
 
1546
 
-
 
1547
int drm_gem_handle_create_tail(struct drm_file *file_priv,
1615
}
1548
			       struct drm_gem_object *obj,
1616
 
1549
			       u32 *handlep);
1617
int drm_gem_handle_create(struct drm_file *file_priv,
1550
int drm_gem_handle_create(struct drm_file *file_priv,
1618
			  struct drm_gem_object *obj,
1551
			  struct drm_gem_object *obj,
Line 1619... Line -...
1619
			  u32 *handlep);
-
 
1620
int drm_gem_handle_delete(struct drm_file *filp, u32 handle);
-
 
1621
 
-
 
1622
static inline void
-
 
1623
drm_gem_object_handle_reference(struct drm_gem_object *obj)
-
 
1624
{
-
 
1625
	drm_gem_object_reference(obj);
-
 
1626
	atomic_inc(&obj->handle_count);
-
 
1627
}
-
 
1628
 
-
 
1629
static inline void
-
 
1630
drm_gem_object_handle_unreference(struct drm_gem_object *obj)
-
 
1631
{
-
 
1632
	if (obj == NULL)
-
 
1633
		return;
-
 
1634
 
-
 
1635
	if (atomic_read(&obj->handle_count) == 0)
-
 
1636
		return;
-
 
1637
	/*
-
 
1638
	 * Must bump handle count first as this may be the last
-
 
1639
	 * ref, in which case the object would disappear before we
-
 
1640
	 * checked for a name
-
 
1641
	 */
-
 
1642
	if (atomic_dec_and_test(&obj->handle_count))
-
 
1643
		drm_gem_object_handle_free(obj);
-
 
1644
	drm_gem_object_unreference(obj);
-
 
1645
}
-
 
1646
 
-
 
1647
static inline void
-
 
1648
drm_gem_object_handle_unreference_unlocked(struct drm_gem_object *obj)
-
 
1649
{
-
 
1650
	if (obj == NULL)
-
 
1651
		return;
-
 
1652
 
-
 
1653
	if (atomic_read(&obj->handle_count) == 0)
-
 
1654
		return;
-
 
1655
 
-
 
1656
	/*
-
 
1657
	* Must bump handle count first as this may be the last
-
 
1658
	* ref, in which case the object would disappear before we
-
 
1659
	* checked for a name
-
 
1660
	*/
-
 
1661
 
-
 
1662
	if (atomic_dec_and_test(&obj->handle_count))
-
 
Line 1663... Line 1552...
1663
		drm_gem_object_handle_free(obj);
1552
			  u32 *handlep);
1664
	drm_gem_object_unreference_unlocked(obj);
1553
int drm_gem_handle_delete(struct drm_file *filp, u32 handle);
-
 
1554
 
-
 
1555
 
-
 
1556
void drm_gem_free_mmap_offset(struct drm_gem_object *obj);
-
 
1557
int drm_gem_create_mmap_offset(struct drm_gem_object *obj);
-
 
1558
int drm_gem_create_mmap_offset_size(struct drm_gem_object *obj, size_t size);
Line 1665... Line 1559...
1665
}
1559
 
1666
 
1560
struct page **drm_gem_get_pages(struct drm_gem_object *obj, gfp_t gfpmask);
1667
void drm_gem_free_mmap_offset(struct drm_gem_object *obj);
1561
void drm_gem_put_pages(struct drm_gem_object *obj, struct page **pages,
1668
int drm_gem_create_mmap_offset(struct drm_gem_object *obj);
1562
		bool dirty, bool accessed);
Line 1681... Line 1575...
1681
 
1575
 
1682
extern void drm_core_ioremap(struct drm_local_map *map, struct drm_device *dev);
1576
extern void drm_core_ioremap(struct drm_local_map *map, struct drm_device *dev);
1683
extern void drm_core_ioremap_wc(struct drm_local_map *map, struct drm_device *dev);
1577
extern void drm_core_ioremap_wc(struct drm_local_map *map, struct drm_device *dev);
Line 1684... Line -...
1684
extern void drm_core_ioremapfree(struct drm_local_map *map, struct drm_device *dev);
-
 
1685
 
-
 
1686
#if 0
1578
extern void drm_core_ioremapfree(struct drm_local_map *map, struct drm_device *dev);
1687
 
1579
 
1688
static __inline__ struct drm_local_map *drm_core_findmap(struct drm_device *dev,
1580
static __inline__ struct drm_local_map *drm_core_findmap(struct drm_device *dev,
1689
							 unsigned int token)
1581
							 unsigned int token)
1690
{
1582
{
Line 1697... Line 1589...
1697
 
1589
 
1698
static __inline__ void drm_core_dropmap(struct drm_local_map *map)
1590
static __inline__ void drm_core_dropmap(struct drm_local_map *map)
1699
{
1591
{
Line -... Line 1592...
-
 
1592
}
Line -... Line 1593...
-
 
1593
 
-
 
1594
//#include 
-
 
1595
 
-
 
1596
extern int drm_fill_in_dev(struct drm_device *dev,
-
 
1597
			   const struct pci_device_id *ent,
Line 1700... Line -...
1700
}
-
 
1701
 
-
 
1702
 
-
 
1703
 
-
 
1704
static __inline__ void *drm_calloc_large(size_t nmemb, size_t size)
-
 
1705
{
-
 
1706
	if (size * nmemb <= PAGE_SIZE)
-
 
1707
	    return kcalloc(nmemb, size, GFP_KERNEL);
-
 
1708
 
-
 
1709
	if (size != 0 && nmemb > ULONG_MAX / size)
-
 
1710
		return NULL;
-
 
1711
 
-
 
1712
	return __vmalloc(size * nmemb,
-
 
1713
			 GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO, PAGE_KERNEL);
-
 
1714
}
-
 
1715
 
-
 
Line 1716... Line -...
1716
static __inline void drm_free_large(void *ptr)
-
 
1717
{
-
 
Line -... Line 1598...
-
 
1598
			   struct drm_driver *driver);
-
 
1599
int drm_get_minor(struct drm_device *dev, struct drm_minor **minor, int type);
1718
	if (!is_vmalloc_addr(ptr))
1600
/*@}*/
Line 1719... Line 1601...
1719
		return kfree(ptr);
1601
 
1720
 
1602
 
1721
	vfree(ptr);
1603
 
Line 1742... Line 1624...
1742
 
1624
 
1743
#define drm_sysfs_connector_add(connector)
1625
#define drm_sysfs_connector_add(connector)
Line 1744... Line 1626...
1744
#define drm_sysfs_connector_remove(connector)
1626
#define drm_sysfs_connector_remove(connector)
-
 
1627
 
-
 
1628
#define LFB_SIZE 0xC00000
Line 1745... Line 1629...
1745
 
1629
extern struct drm_device *main_device;