59,17 → 59,14 |
#include <linux/firmware.h> |
#include <linux/err.h> |
|
//#include <linux/fs.h> |
//#include <linux/proc_fs.h> |
#include <linux/fs.h> |
//#include <linux/init.h> |
//#include <linux/file.h> |
#include <linux/file.h> |
#include <linux/pci.h> |
#include <linux/jiffies.h> |
#include <linux/irqreturn.h> |
//#include <linux/smp_lock.h> /* For (un)lock_kernel */ |
//#include <linux/dma-mapping.h> |
//#include <linux/mm.h> |
//#include <linux/cdev.h> |
#include <linux/mutex.h> |
//#include <asm/io.h> |
//#include <asm/mman.h> |
109,6 → 106,12 |
|
#define KHZ2PICOS(a) (1000000000UL/(a)) |
|
/* Flags and return codes for get_vblank_timestamp() driver function. */ |
#define DRM_CALLED_FROM_VBLIRQ 1 |
#define DRM_VBLANKTIME_SCANOUTPOS_METHOD (1 << 0) |
#define DRM_VBLANKTIME_INVBL (1 << 1) |
|
|
/* get_scanout_position() return flags */ |
#define DRM_SCANOUTPOS_VALID (1 << 0) |
#define DRM_SCANOUTPOS_INVBL (1 << 1) |
166,7 → 169,6 |
|
/* driver capabilities and requirements mask */ |
#define DRIVER_USE_AGP 0x1 |
#define DRIVER_REQUIRE_AGP 0x2 |
#define DRIVER_PCI_DMA 0x8 |
#define DRIVER_SG 0x10 |
#define DRIVER_HAVE_DMA 0x20 |
180,24 → 182,19 |
#define DRIVER_BUS_PCI 0x1 |
#define DRIVER_BUS_PLATFORM 0x2 |
#define DRIVER_BUS_USB 0x3 |
#define DRIVER_BUS_HOST1X 0x4 |
|
/***********************************************************************/ |
/** \name Begin the DRM... */ |
/*@{*/ |
|
#define DRM_DEBUG_CODE 0 /**< Include debugging code if > 1, then |
#define DRM_DEBUG_CODE 2 /**< Include debugging code if > 1, then |
also include looping detection. */ |
|
#define DRM_MAGIC_HASH_ORDER 4 /**< Size of key hash table. Must be power of 2. */ |
#define DRM_KERNEL_CONTEXT 0 /**< Change drm_resctx if changed */ |
#define DRM_RESERVED_CONTEXTS 1 /**< Change drm_resctx if changed */ |
#define DRM_LOOPING_LIMIT 5000000 |
#define DRM_TIME_SLICE (HZ/20) /**< Time slice for GLXContexts */ |
#define DRM_LOCK_SLICE 1 /**< Time slice for lock, in jiffies */ |
|
#define DRM_FLAG_DEBUG 0x01 |
|
#define DRM_MAX_CTXBITMAP (PAGE_SIZE * 8) |
#define DRM_MAP_HASH_OFFSET 0x10000000 |
|
/*@}*/ |
215,6 → 212,22 |
#define DRM_ERROR(fmt, ...) \ |
drm_err(__func__, fmt, ##__VA_ARGS__) |
|
/** |
* Rate limited error output. Like DRM_ERROR() but won't flood the log. |
* |
* \param fmt printf() like format string. |
* \param arg arguments |
*/ |
#define DRM_ERROR_RATELIMITED(fmt, ...) \ |
({ \ |
static DEFINE_RATELIMIT_STATE(_rs, \ |
DEFAULT_RATELIMIT_INTERVAL, \ |
DEFAULT_RATELIMIT_BURST); \ |
\ |
if (__ratelimit(&_rs)) \ |
drm_err(__func__, fmt, ##__VA_ARGS__); \ |
}) |
|
#define DRM_INFO(fmt, ...) \ |
printk(KERN_INFO "[" DRM_NAME "] " fmt, ##__VA_ARGS__) |
|
442,6 → 455,11 |
|
/** File private data */ |
struct drm_file { |
unsigned always_authenticated :1; |
unsigned authenticated :1; |
unsigned is_master :1; /* this file private is a master for a minor */ |
/* true when the client has asked us to expose stereo 3D mode flags */ |
unsigned stereo_allowed :1; |
struct list_head lhead; |
unsigned long lock_count; |
|
518,7 → 536,7 |
*/ |
struct drm_agp_mem { |
unsigned long handle; /**< handle */ |
DRM_AGP_MEM *memory; |
struct agp_memory *memory; |
unsigned long bound; /**< address */ |
int pages; |
struct list_head head; |
530,7 → 548,7 |
* \sa drm_agp_init() and drm_device::agp. |
*/ |
struct drm_agp_head { |
DRM_AGP_KERN agp_info; /**< AGP device information */ |
struct agp_kern_info agp_info; /**< AGP device information */ |
struct list_head memory; |
unsigned long mode; /**< AGP mode */ |
struct agp_bridge_data *bridge; |
616,13 → 634,6 |
}; |
|
/** |
* GEM specific mm private for tracking GEM objects |
*/ |
struct drm_gem_mm { |
struct drm_vma_offset_manager vma_manager; |
}; |
|
/** |
* This structure defines the drm_mm memory object, which will be used by the |
* DRM for its buffer objects. |
*/ |
680,7 → 691,7 |
uint32_t pending_read_domains; |
uint32_t pending_write_domain; |
|
void *driver_private; |
|
}; |
|
#include <drm/drm_crtc.h> |
735,10 → 746,6 |
int (*set_unique)(struct drm_device *dev, struct drm_master *master, |
struct drm_unique *unique); |
int (*irq_by_busid)(struct drm_device *dev, struct drm_irq_busid *p); |
/* hooks that are for PCI */ |
int (*agp_init)(struct drm_device *dev); |
void (*agp_destroy)(struct drm_device *dev); |
|
}; |
#endif |
|
800,12 → 807,18 |
/** |
* Called by vblank timestamping code. |
* |
* Return the current display scanout position from a crtc. |
* Return the current display scanout position from a crtc, and an |
* optional accurate ktime_get timestamp of when position was measured. |
* |
* \param dev DRM device. |
* \param crtc Id of the crtc to query. |
* \param flags Flags from the caller (DRM_CALLED_FROM_VBLIRQ or 0). |
* \param *vpos Target location for current vertical scanout position. |
* \param *hpos Target location for current horizontal scanout position. |
* \param *stime Target location for timestamp taken immediately before |
* scanout position query. Can be NULL to skip timestamp. |
* \param *etime Target location for timestamp taken immediately after |
* scanout position query. Can be NULL to skip timestamp. |
* |
* Returns vpos as a positive number while in active scanout area. |
* Returns vpos as a negative number inside vblank, counting the number |
822,7 → 835,9 |
* |
*/ |
int (*get_scanout_position) (struct drm_device *dev, int crtc, |
int *vpos, int *hpos); |
unsigned int flags, |
int *vpos, int *hpos, void *stime, |
void *etime); |
|
/** |
* Called by \c drm_get_last_vbltimestamp. Should return a precise |
872,7 → 887,6 |
* |
* Returns 0 on success. |
*/ |
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 *); |
884,28 → 898,7 |
#define DRM_MINOR_CONTROL 2 |
#define DRM_MINOR_RENDER 3 |
|
|
/** |
* debugfs node list. This structure represents a debugfs file to |
* be created by the drm core |
*/ |
struct drm_debugfs_list { |
const char *name; /** file name */ |
// int (*show)(struct seq_file*, void*); /** show callback */ |
u32 driver_features; /**< Required driver features for this entry */ |
}; |
|
/** |
* debugfs node structure. This structure represents a debugfs file. |
*/ |
struct drm_debugfs_node { |
struct list_head list; |
struct drm_minor *minor; |
struct drm_debugfs_list *debugfs_ent; |
struct dentry *dent; |
}; |
|
/** |
* Info file list entry. This structure represents a debugfs or proc file to |
* be created by the drm core |
*/ |
968,7 → 961,7 |
* may contain multiple heads. |
*/ |
struct drm_device { |
struct list_head driver_item; /**< list of devices per driver */ |
struct list_head legacy_dev_list;/**< list of devices per driver for stealth attach cleanup */ |
char *devname; /**< For /proc/interrupts */ |
int if_version; /**< Highest interface version set */ |
|
981,31 → 974,19 |
/** \name Usage Counters */ |
/*@{ */ |
int open_count; /**< Outstanding files open */ |
atomic_t ioctl_count; /**< Outstanding IOCTLs pending */ |
atomic_t vma_count; /**< Outstanding vma areas open */ |
int buf_use; /**< Buffers in use -- cannot alloc */ |
atomic_t buf_alloc; /**< Buffer allocation in progress */ |
/*@} */ |
|
/** \name Performance counters */ |
/*@{ */ |
unsigned long counters; |
// enum drm_stat_type types[15]; |
atomic_t counts[15]; |
/*@} */ |
|
struct list_head filelist; |
|
/** \name Memory management */ |
/*@{ */ |
struct list_head maplist; /**< Linked list of regions */ |
int map_count; /**< Number of mappable regions */ |
// struct drm_open_hash map_hash; /**< User token hash table for maps */ |
|
/** \name Context handle management */ |
/*@{ */ |
struct list_head ctxlist; /**< Linked list of context handles */ |
int ctx_count; /**< Number of context handles */ |
struct mutex ctxlist_mutex; /**< For ctxlist */ |
|
struct idr ctx_idr; |
1021,12 → 1002,11 |
|
/** \name Context support */ |
/*@{ */ |
int irq_enabled; /**< True if irq handler is enabled */ |
bool irq_enabled; /**< True if irq handler is enabled */ |
__volatile__ long context_flag; /**< Context swapping flag */ |
int last_context; /**< Last current context */ |
/*@} */ |
|
// struct work_struct work; |
/** \name VBLANK IRQ support */ |
/*@{ */ |
|
1036,21 → 1016,8 |
* Once the modeset ioctl *has* been called though, we can safely |
* disable them when unused. |
*/ |
int vblank_disable_allowed; |
bool vblank_disable_allowed; |
|
// wait_queue_head_t *vbl_queue; /**< VBLANK wait queue */ |
atomic_t *_vblank_count; /**< number of VBLANK interrupts (driver must alloc the right number of counters) */ |
struct timeval *_vblank_time; /**< timestamp of current vblank_count (drivers must alloc right number of fields) */ |
spinlock_t vblank_time_lock; /**< Protects vblank count and time updates during vblank enable/disable */ |
spinlock_t vbl_lock; |
atomic_t *vblank_refcount; /* number of users of vblank interruptsper crtc */ |
u32 *last_vblank; /* protected by dev->vbl_lock, used */ |
/* for wraparound handling */ |
int *vblank_enabled; /* so we don't call enable more than |
once per disable */ |
int *vblank_inmodeset; /* Display driver is setting mode */ |
u32 *last_vblank_wait; /* Last vblank seqno waited per CRTC */ |
// struct timer_list vblank_disable_timer; |
|
u32 max_vblank_count; /**< size of vblank counter register */ |
|
1070,7 → 1037,6 |
int pci_device; /**< PCI device id */ |
unsigned int num_crtcs; /**< Number of CRTCs on this device */ |
void *dev_private; /**< device private data */ |
void *mm_private; |
struct address_space *dev_mapping; |
// struct drm_sigdata sigdata; /**< For block_all_signals */ |
// sigset_t sigmask; |
1087,6 → 1053,7 |
/*@{ */ |
struct mutex object_name_lock; |
struct idr object_name_idr; |
struct drm_vma_offset_manager *vma_offset_manager; |
/*@} */ |
int switch_power_state; |
|
1156,6 → 1123,7 |
/* Memory management support (drm_memory.h) */ |
#include <drm/drm_memory.h> |
|
|
/* Misc. IOCTL support (drm_ioctl.h) */ |
extern int drm_irq_by_busid(struct drm_device *dev, void *data, |
struct drm_file *file_priv); |
1171,6 → 1139,8 |
struct drm_file *file_priv); |
extern int drm_getcap(struct drm_device *dev, void *data, |
struct drm_file *file_priv); |
extern int drm_setclientcap(struct drm_device *dev, void *data, |
struct drm_file *file_priv); |
extern int drm_setversion(struct drm_device *dev, void *data, |
struct drm_file *file_priv); |
extern int drm_noop(struct drm_device *dev, void *data, |
1284,8 → 1254,10 |
int crtc, int *max_error, |
struct timeval *vblank_time, |
unsigned flags, |
struct drm_crtc *refcrtc); |
extern void drm_calc_timestamping_constants(struct drm_crtc *crtc); |
const struct drm_crtc *refcrtc, |
const struct drm_display_mode *mode); |
extern void drm_calc_timestamping_constants(struct drm_crtc *crtc, |
const struct drm_display_mode *mode); |
|
extern bool |
drm_mode_parse_command_line_for_connector(const char *mode_option, |
1320,7 → 1292,6 |
extern void drm_master_put(struct drm_master **master); |
|
extern void drm_put_dev(struct drm_device *dev); |
extern int drm_put_minor(struct drm_minor **minor); |
extern void drm_unplug_dev(struct drm_device *dev); |
extern unsigned int drm_debug; |
extern unsigned int drm_rnodes; |
1341,11 → 1312,36 |
#if defined(CONFIG_DEBUG_FS) |
extern int drm_debugfs_init(struct drm_minor *minor, int minor_id, |
struct dentry *root); |
extern int drm_debugfs_create_files(struct drm_info_list *files, int count, |
struct dentry *root, struct drm_minor *minor); |
extern int drm_debugfs_remove_files(struct drm_info_list *files, int count, |
extern int drm_debugfs_create_files(const struct drm_info_list *files, |
int count, struct dentry *root, |
struct drm_minor *minor); |
extern int drm_debugfs_remove_files(const struct drm_info_list *files, |
int count, struct drm_minor *minor); |
extern int drm_debugfs_cleanup(struct drm_minor *minor); |
#else |
static inline int drm_debugfs_init(struct drm_minor *minor, int minor_id, |
struct dentry *root) |
{ |
return 0; |
} |
|
static inline int drm_debugfs_create_files(const struct drm_info_list *files, |
int count, struct dentry *root, |
struct drm_minor *minor) |
{ |
return 0; |
} |
|
static inline int drm_debugfs_remove_files(const struct drm_info_list *files, |
int count, struct drm_minor *minor) |
{ |
return 0; |
} |
|
static inline int drm_debugfs_cleanup(struct drm_minor *minor) |
{ |
return 0; |
} |
#endif |
|
/* Info file support */ |
1396,8 → 1392,6 |
void drm_gem_destroy(struct drm_device *dev); |
void drm_gem_object_release(struct drm_gem_object *obj); |
void drm_gem_object_free(struct kref *kref); |
struct drm_gem_object *drm_gem_object_alloc(struct drm_device *dev, |
size_t size); |
int drm_gem_object_init(struct drm_device *dev, |
struct drm_gem_object *obj, size_t size); |
void drm_gem_private_object_init(struct drm_device *dev, |
1517,7 → 1511,7 |
#define drm_sysfs_connector_add(connector) |
#define drm_sysfs_connector_remove(connector) |
|
#define LFB_SIZE 0xC00000 |
#define LFB_SIZE 0x1000000 |
extern struct drm_device *main_device; |
extern struct drm_file *drm_file_handlers[256]; |
|