36,17 → 36,15 |
#define _DRM_P_H_ |
|
#ifdef __KERNEL__ |
#ifdef __alpha__ |
/* add include of current.h so that "current" is defined |
* before static inline funcs in wait.h. Doing this so we |
* can build the DRM (part of PI DRI). 4/21/2000 S + B */ |
#include <asm/current.h> |
#endif /* __alpha__ */ |
|
#include <syscall.h> |
|
#include <linux/module.h> |
#include <linux/kernel.h> |
#include <errno-base.h> |
#include <linux/errno.h> |
#include <linux/kref.h> |
#include <linux/spinlock.h> |
#include <linux/wait.h> |
|
//#include <linux/miscdevice.h> |
//#include <linux/fs.h> |
54,7 → 52,7 |
//#include <linux/init.h> |
//#include <linux/file.h> |
#include <linux/pci.h> |
//#include <linux/jiffies.h> |
#include <linux/jiffies.h> |
//#include <linux/smp_lock.h> /* For (un)lock_kernel */ |
//#include <linux/dma-mapping.h> |
//#include <linux/mm.h> |
122,17 → 120,16 |
printk("[" DRM_NAME ":%s] " fmt , __func__ , ##args); \ |
} while(0) |
|
#define dev_err(dev, format, arg...) \ |
printk("Error %s " format, __func__ , ## arg) |
#define DRM_DEBUG_DRIVER(fmt, args...) \ |
do { \ |
printk("[" DRM_NAME ":%s] " fmt , __func__ , ##args); \ |
} while (0) |
|
#define dev_warn(dev, format, arg...) \ |
printk("Warning %s " format, __func__ , ## arg) |
#define DRM_LOG_KMS(fmt, args...) \ |
do { \ |
printk("[" DRM_NAME "]" fmt, ##args); \ |
} while (0) |
|
#define dev_info(dev, format, arg...) \ |
printk("Info %s " format , __func__, ## arg) |
|
|
|
static inline int drm_sysfs_connector_add(struct drm_connector *connector) |
{ return 0; }; |
|
160,8 → 157,11 |
#define DRIVER_IRQ_VBL2 0x800 |
#define DRIVER_GEM 0x1000 |
#define DRIVER_MODESET 0x2000 |
#define DRIVER_USE_PLATFORM_DEVICE 0x4000 |
|
#define DRIVER_BUS_PCI 0x1 |
#define DRIVER_BUS_PLATFORM 0x2 |
#define DRIVER_BUS_USB 0x3 |
|
/***********************************************************************/ |
/** \name Begin the DRM... */ |
/*@{*/ |
396,6 → 396,7 |
atomic_t wfh; /**< If waiting for high mark */ |
spinlock_t lock; |
}; |
#endif |
|
typedef struct drm_dma_handle { |
dma_addr_t busaddr; |
403,6 → 404,7 |
size_t size; |
} drm_dma_handle_t; |
|
#if 0 |
/** |
* Buffer entry. There is one of this for each buffer size order. |
*/ |
554,7 → 556,9 |
struct drm_hw_lock *lock; |
}; |
|
#endif |
|
|
/** |
* Kernel side of a mapping |
*/ |
570,6 → 574,7 |
|
typedef struct drm_local_map drm_local_map_t; |
|
#if 0 |
/** |
* Mappings list |
*/ |
638,7 → 643,6 |
struct file *filp; |
|
/* Mapping info for this object */ |
// struct drm_map_list map_list; |
|
/** |
* Size of the object, in bytes. Immutable over the object's |
673,8 → 677,6 |
void *driver_private; |
}; |
|
#if 0 |
|
#include "drm_crtc.h" |
|
/* per-master structure */ |
693,15 → 695,17 |
|
/** \name Authentication */ |
/*@{ */ |
struct drm_open_hash magiclist; |
struct list_head magicfree; |
// struct drm_open_hash magiclist; |
// struct list_head magicfree; |
/*@} */ |
|
struct drm_lock_data lock; /**< Information on hardware lock */ |
// struct drm_lock_data lock; /**< Information on hardware lock */ |
|
void *driver_priv; /**< Private structure for driver to use */ |
}; |
|
#if 0 |
|
/* Size of ringbuffer for vblank timestamps. Just double-buffer |
* in initial implementation. |
*/ |
841,7 → 845,7 |
* Specifically, the timestamp in @vblank_time should correspond as |
* closely as possible to the time when the first video scanline of |
* the video frame after the end of VBLANK will start scanning out, |
* the time immmediately after end of the VBLANK interval. If the |
* the time immediately after end of the VBLANK interval. If the |
* @crtc is currently inside VBLANK, this will be a time in the future. |
* If the @crtc is currently scanning out a frame, this will be the |
* past start time of the current scanout. This is meant to adhere |
908,10 → 912,23 |
*/ |
int (*gem_init_object) (struct drm_gem_object *obj); |
void (*gem_free_object) (struct drm_gem_object *obj); |
int (*gem_open_object) (struct drm_gem_object *, struct drm_file *); |
void (*gem_close_object) (struct drm_gem_object *, struct drm_file *); |
|
/* vga arb irq handler */ |
void (*vgaarb_irq)(struct drm_device *dev, bool state); |
|
/* dumb alloc support */ |
int (*dumb_create)(struct drm_file *file_priv, |
struct drm_device *dev, |
struct drm_mode_create_dumb *args); |
int (*dumb_map_offset)(struct drm_file *file_priv, |
struct drm_device *dev, uint32_t handle, |
uint64_t *offset); |
int (*dumb_destroy)(struct drm_file *file_priv, |
struct drm_device *dev, |
uint32_t handle); |
|
/* Driver private ops for this object */ |
struct vm_operations_struct *gem_vm_ops; |
|
926,12 → 943,20 |
int dev_priv_size; |
struct drm_ioctl_desc *ioctls; |
int num_ioctls; |
struct file_operations fops; |
struct pci_driver pci_driver; |
const struct file_operations *fops; |
union { |
struct pci_driver *pci; |
struct platform_device *platform_device; |
struct usb_driver *usb; |
} kdriver; |
struct drm_bus *bus; |
|
/* List of devices hanging off this driver */ |
struct list_head device_list; |
}; |
|
#endif |
|
#define DRM_MINOR_UNASSIGNED 0 |
#define DRM_MINOR_LEGACY 1 |
#define DRM_MINOR_CONTROL 2 |
944,7 → 969,7 |
*/ |
struct drm_debugfs_list { |
const char *name; /** file name */ |
int (*show)(struct seq_file*, void*); /** show callback */ |
// int (*show)(struct seq_file*, void*); /** show callback */ |
u32 driver_features; /**< Required driver features for this entry */ |
}; |
|
964,7 → 989,7 |
*/ |
struct drm_info_list { |
const char *name; /** file name */ |
int (*show)(struct seq_file*, void*); /** show callback */ |
// int (*show)(struct seq_file*, void*); /** show callback */ |
u32 driver_features; /**< Required driver features for this entry */ |
void *data; |
}; |
985,22 → 1010,20 |
struct drm_minor { |
int index; /**< Minor device number */ |
int type; /**< Control or render */ |
dev_t device; /**< Device number for mknod */ |
struct device kdev; /**< Linux device */ |
// dev_t device; /**< Device number for mknod */ |
// struct device kdev; /**< Linux device */ |
struct drm_device *dev; |
|
struct proc_dir_entry *proc_root; /**< proc directory entry */ |
struct drm_info_node proc_nodes; |
struct dentry *debugfs_root; |
struct drm_info_node debugfs_nodes; |
// struct proc_dir_entry *proc_root; /**< proc directory entry */ |
// struct drm_info_node proc_nodes; |
// struct dentry *debugfs_root; |
// struct drm_info_node debugfs_nodes; |
|
struct drm_master *master; /* currently active master for this node */ |
struct list_head master_list; |
struct drm_mode_group mode_group; |
// struct list_head master_list; |
// struct drm_mode_group mode_group; |
}; |
|
#endif |
|
/* mode specified on the command line */ |
struct drm_cmdline_mode { |
bool specified; |
1149,7 → 1172,7 |
// struct drm_local_map *agp_buffer_map; |
// unsigned int agp_buffer_token; |
// struct drm_minor *control; /**< Control node for card */ |
// struct drm_minor *primary; /**< render type primary screen head */ |
struct drm_minor *primary; /**< render type primary screen head */ |
|
struct drm_mode_config mode_config; /**< Current mode config */ |
|
1166,37 → 1189,12 |
#define DRM_SWITCH_POWER_CHANGING 2 |
|
|
|
|
|
|
|
|
|
|
static __inline__ int drm_device_is_agp(struct drm_device *dev) |
{ |
return pci_find_capability(dev->pdev, PCI_CAP_ID_AGP); |
} |
|
static __inline__ int drm_device_is_pcie(struct drm_device *dev) |
{ |
return pci_find_capability(dev->pdev, PCI_CAP_ID_EXP); |
} |
|
|
|
#if 0 |
static inline int drm_dev_to_irq(struct drm_device *dev) |
{ |
return dev->pdev->irq; |
} |
|
static __inline__ int drm_core_check_feature(struct drm_device *dev, |
int feature) |
{ |
return ((dev->driver->driver_features & feature) ? 1 : 0); |
} |
#if 0 |
|
#ifdef __alpha__ |
#define drm_get_pci_domain(dev) dev->hose->index |
1344,6 → 1342,7 |
struct drm_file *file_priv); |
extern int drm_authmagic(struct drm_device *dev, void *data, |
struct drm_file *file_priv); |
extern int drm_remove_magic(struct drm_master *master, drm_magic_t magic); |
|
/* Cache management (drm_cache.c) */ |
void drm_clflush_pages(struct page *pages[], unsigned long num_pages); |
1555,6 → 1554,8 |
static inline void drm_sysfs_connector_remove(struct drm_connector *connector) |
{ }; |
|
#endif |
|
/* Graphics Execution Manager library functions (drm_gem.c) */ |
int drm_gem_init(struct drm_device *dev); |
void drm_gem_destroy(struct drm_device *dev); |
1564,11 → 1565,14 |
size_t size); |
int drm_gem_object_init(struct drm_device *dev, |
struct drm_gem_object *obj, size_t size); |
int drm_gem_private_object_init(struct drm_device *dev, |
struct drm_gem_object *obj, size_t size); |
void drm_gem_object_handle_free(struct drm_gem_object *obj); |
void drm_gem_vm_open(struct vm_area_struct *vma); |
void drm_gem_vm_close(struct vm_area_struct *vma); |
int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma); |
|
|
static inline void |
drm_gem_object_reference(struct drm_gem_object *obj) |
{ |
1578,11 → 1582,21 |
static inline void |
drm_gem_object_unreference(struct drm_gem_object *obj) |
{ |
if (obj == NULL) |
return; |
if (obj != NULL) |
kref_put(&obj->refcount, drm_gem_object_free); |
} |
|
#if 0 |
static inline void |
drm_gem_object_unreference_unlocked(struct drm_gem_object *obj) |
{ |
if (obj != NULL) { |
struct drm_device *dev = obj->dev; |
mutex_lock(&dev->struct_mutex); |
kref_put(&obj->refcount, drm_gem_object_free); |
mutex_unlock(&dev->struct_mutex); |
} |
} |
|
int drm_gem_handle_create(struct drm_file *file_priv, |
struct drm_gem_object *obj, |
1609,10 → 1623,32 |
* ref, in which case the object would disappear before we |
* checked for a name |
*/ |
kref_put(&obj->handlecount, drm_gem_object_handle_free); |
if (atomic_dec_and_test(&obj->handle_count)) |
drm_gem_object_handle_free(obj); |
drm_gem_object_unreference(obj); |
} |
|
static inline void |
drm_gem_object_handle_unreference_unlocked(struct drm_gem_object *obj) |
{ |
if (obj == NULL) |
return; |
|
if (atomic_read(&obj->handle_count) == 0) |
return; |
|
/* |
* Must bump handle count first as this may be the last |
* ref, in which case the object would disappear before we |
* checked for a name |
*/ |
|
if (atomic_dec_and_test(&obj->handle_count)) |
drm_gem_object_handle_free(obj); |
drm_gem_object_unreference_unlocked(obj); |
} |
|
|
struct drm_gem_object *drm_gem_object_lookup(struct drm_device *dev, |
struct drm_file *filp, |
u32 handle); |
1663,11 → 1699,18 |
|
vfree(ptr); |
} |
/*@}*/ |
|
#endif |
|
|
static __inline__ int drm_device_is_agp(struct drm_device *dev) |
{ |
return pci_find_capability(dev->pdev, PCI_CAP_ID_AGP); |
} |
|
static __inline__ int drm_device_is_pcie(struct drm_device *dev) |
{ |
return pci_find_capability(dev->pdev, PCI_CAP_ID_EXP); |
} |
#endif /* __KERNEL__ */ |
#endif |