/drivers/include/drm/radeon_drm.h |
---|
File deleted |
/drivers/include/drm/drm_mode.h |
---|
File deleted |
/drivers/include/drm/drm_fourcc.h |
---|
File deleted |
/drivers/include/drm/drmP.h |
---|
64,17 → 64,19 |
#include <linux/file.h> |
#include <linux/pci.h> |
#include <linux/jiffies.h> |
#include <linux/dma-mapping.h> |
#include <linux/irqreturn.h> |
//#include <linux/smp_lock.h> /* For (un)lock_kernel */ |
//#include <linux/dma-mapping.h> |
#include <linux/mutex.h> |
//#include <asm/io.h> |
//#include <asm/mman.h> |
#include <linux/slab.h> |
//#include <asm/uaccess.h> |
//#include <linux/workqueue.h> |
//#include <linux/poll.h> |
//#include <asm/pgalloc.h> |
#include <linux/types.h> |
#include <linux/workqueue.h> |
92,6 → 94,7 |
struct device_node; |
struct videomode; |
struct reservation_object; |
struct inode; |
struct poll_table_struct; |
117,48 → 120,41 |
#define DRM_SCANOUTPOS_INVBL (1 << 1) |
#define DRM_SCANOUTPOS_ACCURATE (1 << 2) |
#define DRM_UT_CORE 0x01 |
#define DRM_UT_DRIVER 0x02 |
#define DRM_UT_KMS 0x04 |
#define DRM_UT_PRIME 0x08 |
/* |
* Three debug levels are defined. |
* drm_core, drm_driver, drm_kms |
* drm_core level can be used in the generic drm code. For example: |
* drm_ioctl, drm_mm, drm_memory |
* The macro definition of DRM_DEBUG is used. |
* DRM_DEBUG(fmt, args...) |
* The debug info by using the DRM_DEBUG can be obtained by adding |
* the boot option of "drm.debug=1". |
* 4 debug categories are defined: |
* |
* drm_driver level can be used in the specific drm driver. It is used |
* to add the debug info related with the drm driver. For example: |
* i915_drv, i915_dma, i915_gem, radeon_drv, |
* The macro definition of DRM_DEBUG_DRIVER can be used. |
* DRM_DEBUG_DRIVER(fmt, args...) |
* The debug info by using the DRM_DEBUG_DRIVER can be obtained by |
* adding the boot option of "drm.debug=0x02" |
* CORE: Used in the generic drm code: drm_ioctl.c, drm_mm.c, drm_memory.c, ... |
* This is the category used by the DRM_DEBUG() macro. |
* |
* drm_kms level can be used in the KMS code related with specific drm driver. |
* It is used to add the debug info related with KMS mode. For example: |
* the connector/crtc , |
* The macro definition of DRM_DEBUG_KMS can be used. |
* DRM_DEBUG_KMS(fmt, args...) |
* The debug info by using the DRM_DEBUG_KMS can be obtained by |
* adding the boot option of "drm.debug=0x04" |
* DRIVER: Used in the vendor specific part of the driver: i915, radeon, ... |
* This is the category used by the DRM_DEBUG_DRIVER() macro. |
* |
* If we add the boot option of "drm.debug=0x06", we can get the debug info by |
* using the DRM_DEBUG_KMS and DRM_DEBUG_DRIVER. |
* If we add the boot option of "drm.debug=0x05", we can get the debug info by |
* using the DRM_DEBUG_KMS and DRM_DEBUG. |
* KMS: used in the modesetting code. |
* This is the category used by the DRM_DEBUG_KMS() macro. |
* |
* PRIME: used in the prime code. |
* This is the category used by the DRM_DEBUG_PRIME() macro. |
* |
* Enabling verbose debug messages is done through the drm.debug parameter, |
* each category being enabled by a bit. |
* |
* drm.debug=0x1 will enable CORE messages |
* drm.debug=0x2 will enable DRIVER messages |
* drm.debug=0x3 will enable CORE and DRIVER messages |
* ... |
* drm.debug=0xf will enable all messages |
* |
* An interesting feature is that it's possible to enable verbose logging at |
* run-time by echoing the debug value in its sysfs node: |
* # echo 0xf > /sys/module/drm/parameters/debug |
*/ |
#define DRM_UT_CORE 0x01 |
#define DRM_UT_DRIVER 0x02 |
#define DRM_UT_KMS 0x04 |
#define DRM_UT_PRIME 0x08 |
extern __printf(4, 5) |
void drm_ut_debug_printk(unsigned int request_level, |
const char *prefix, |
const char *function_name, |
extern __printf(2, 3) |
void drm_ut_debug_printk(const char *function_name, |
const char *format, ...); |
extern __printf(2, 3) |
int drm_err(const char *func, const char *format, ...); |
192,8 → 188,6 |
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_MAP_HASH_OFFSET 0x10000000 |
231,6 → 225,9 |
#define DRM_INFO(fmt, ...) \ |
printk(KERN_INFO "[" DRM_NAME "] " fmt, ##__VA_ARGS__) |
#define DRM_INFO_ONCE(fmt, ...) \ |
printk_once(KERN_INFO "[" DRM_NAME "] " fmt, ##__VA_ARGS__) |
/** |
* Debug output. |
* |
238,49 → 235,28 |
* \param arg arguments |
*/ |
#if DRM_DEBUG_CODE |
#define DRM_DEBUG(fmt, ...) \ |
#define DRM_DEBUG(fmt, args...) \ |
do { \ |
printk(KERN_INFO "[" DRM_NAME "] " fmt, ##__VA_ARGS__); \ |
printk(KERN_INFO "[" DRM_NAME "] " fmt, ##args); \ |
} while (0) |
#define DRM_DEBUG_DRIVER(fmt, ...) \ |
#define DRM_DEBUG_DRIVER(fmt, args...) \ |
do { \ |
printk(KERN_INFO "[" DRM_NAME "] " fmt, ##__VA_ARGS__); \ |
printk(KERN_INFO "[" DRM_NAME "] " fmt, ##args); \ |
} while (0) |
#define DRM_DEBUG_KMS(fmt, ...) \ |
#define DRM_DEBUG_KMS(fmt, args...) \ |
do { \ |
printk(KERN_INFO "[" DRM_NAME "] " fmt, ##__VA_ARGS__); \ |
printk(KERN_INFO "[" DRM_NAME "] " fmt, ##args); \ |
} while (0) |
#define DRM_DEBUG_PRIME(fmt, ...) \ |
#define DRM_DEBUG_PRIME(fmt, args...) \ |
do { \ |
printk(KERN_INFO "[" DRM_NAME "] " fmt, ##__VA_ARGS__); \ |
printk(KERN_INFO "[" DRM_NAME "] " fmt, ##args); \ |
} while (0) |
#define DRM_LOG(fmt, ...) \ |
do { \ |
printk(KERN_INFO "[" DRM_NAME "] " fmt, ##__VA_ARGS__); \ |
} while (0) |
#define DRM_LOG_KMS(fmt, ...) \ |
do { \ |
printk(KERN_INFO "[" DRM_NAME "] " fmt, ##__VA_ARGS__); \ |
} while (0) |
#define DRM_LOG_MODE(fmt, ...) \ |
do { \ |
printk(KERN_INFO "[" DRM_NAME "] " fmt, ##__VA_ARGS__); \ |
} while (0) |
#define DRM_LOG_DRIVER(fmt, ...) \ |
do { \ |
printk(KERN_INFO "[" DRM_NAME "] " fmt, ##__VA_ARGS__); \ |
} while (0) |
#else |
#define DRM_DEBUG_DRIVER(fmt, args...) do { } while (0) |
#define DRM_DEBUG_KMS(fmt, args...) do { } while (0) |
#define DRM_DEBUG_PRIME(fmt, args...) do { } while (0) |
#define DRM_DEBUG(fmt, arg...) do { } while (0) |
#define DRM_LOG(fmt, arg...) do { } while (0) |
#define DRM_LOG_KMS(fmt, args...) do { } while (0) |
#define DRM_LOG_MODE(fmt, arg...) do { } while (0) |
#define DRM_LOG_DRIVER(fmt, arg...) do { } while (0) |
#endif |
/*@}*/ |
310,7 → 286,6 |
} \ |
} while (0) |
#if 0 |
/** |
* Ioctl function type. |
* |
351,6 → 326,7 |
#define DRM_IOCTL_DEF_DRV(ioctl, _func, _flags) \ |
[DRM_IOCTL_NR(DRM_##ioctl)] = {.cmd = DRM_##ioctl, .func = _func, .flags = _flags, .cmd_drv = DRM_IOCTL_##ioctl, .name = #ioctl} |
#if 0 |
struct drm_magic_entry { |
struct list_head head; |
struct drm_hash_item hash_item; |
405,18 → 381,7 |
}; |
#endif |
struct drm_freelist { |
int initialized; /**< Freelist in use */ |
atomic_t count; /**< Number of free buffers */ |
struct drm_buf *next; /**< End pointer */ |
wait_queue_head_t waiting; /**< Processes waiting on free bufs */ |
int low_mark; /**< Low water mark */ |
int high_mark; /**< High water mark */ |
atomic_t wfh; /**< If waiting for high mark */ |
spinlock_t lock; |
}; |
typedef struct drm_dma_handle { |
dma_addr_t busaddr; |
void *vaddr; |
434,7 → 399,8 |
int page_order; |
struct drm_dma_handle **seglist; |
struct drm_freelist freelist; |
int low_mark; /**< Low water mark */ |
int high_mark; /**< High water mark */ |
}; |
/* Event queued up for userspace to read */ |
455,11 → 421,16 |
/** 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 */ |
/* Whether we're master for a minor. Protected by master_mutex */ |
unsigned is_master :1; |
/* true when the client has asked us to expose stereo 3D mode flags */ |
unsigned stereo_allowed :1; |
/* |
* true if client understands CRTC primary planes and cursor planes |
* in the plane list |
*/ |
unsigned universal_planes:1; |
struct list_head lhead; |
unsigned long lock_count; |
470,7 → 441,16 |
void *driver_priv; |
struct drm_master *master; /* master this node is currently associated with |
N.B. not always minor->master */ |
/** |
* fbs - List of framebuffers associated with this file. |
* |
* Protected by fbs_lock. Note that the fbs list holds a reference on |
* the fb object to prevent it from untimely disappearing. |
*/ |
struct list_head fbs; |
struct mutex fbs_lock; |
wait_queue_head_t event_wait; |
struct list_head event_list; |
478,23 → 458,6 |
}; |
#if 0 |
/** Wait queue */ |
struct drm_queue { |
atomic_t use_count; /**< Outstanding uses (+1) */ |
atomic_t finalization; /**< Finalization in progress */ |
atomic_t block_count; /**< Count of processes waiting */ |
atomic_t block_read; /**< Queue blocked for reads */ |
wait_queue_head_t read_queue; /**< Processes waiting on block_read */ |
atomic_t block_write; /**< Queue blocked for writes */ |
wait_queue_head_t write_queue; /**< Processes waiting on block_write */ |
atomic_t total_queued; /**< Total queued statistic */ |
atomic_t total_flushed; /**< Total flushes statistic */ |
atomic_t total_locks; /**< Total locks statistics */ |
enum drm_ctx_flags flags; /**< Context preserving and 2D-only */ |
struct drm_waitlist waitlist; /**< Pending buffers */ |
wait_queue_head_t flush_queue; /**< Processes waiting until flush */ |
}; |
/** |
* Lock data. |
*/ |
578,7 → 541,6 |
#endif |
/** |
* Kernel side of a mapping |
*/ |
605,15 → 567,6 |
struct drm_master *master; |
}; |
/** |
* Context handle list |
*/ |
struct drm_ctx_list { |
struct list_head head; /**< list head */ |
drm_context_t handle; /**< context handle */ |
struct drm_file *tag; /**< associated fd private data */ |
}; |
/* location of GART table */ |
#define DRM_ATI_GART_MAIN 1 |
#define DRM_ATI_GART_FB 2 |
691,38 → 644,46 |
uint32_t pending_read_domains; |
uint32_t pending_write_domain; |
/** |
* dma_buf - dma buf associated with this GEM object |
* |
* Pointer to the dma-buf associated with this gem object (either |
* through importing or exporting). We break the resulting reference |
* loop when the last gem handle for this object is released. |
* |
* Protected by obj->object_name_lock |
*/ |
struct dma_buf *dma_buf; |
}; |
#include <drm/drm_crtc.h> |
/* per-master structure */ |
/** |
* struct drm_master - drm master structure |
* |
* @refcount: Refcount for this master object. |
* @minor: Link back to minor char device we are master for. Immutable. |
* @unique: Unique identifier: e.g. busid. Protected by drm_global_mutex. |
* @unique_len: Length of unique field. Protected by drm_global_mutex. |
* @unique_size: Amount allocated. Protected by drm_global_mutex. |
* @magiclist: Hash of used authentication tokens. Protected by struct_mutex. |
* @magicfree: List of used authentication tokens. Protected by struct_mutex. |
* @lock: DRI lock information. |
* @driver_priv: Pointer to driver-private information. |
*/ |
struct drm_master { |
struct kref refcount; /* refcount for this master */ |
struct list_head head; /**< each minor contains a list of masters */ |
struct drm_minor *minor; /**< link back to minor we are a master for */ |
char *unique; /**< Unique identifier: e.g., busid */ |
int unique_len; /**< Length of unique field */ |
int unique_size; /**< amount allocated */ |
int blocked; /**< Blocked due to VC switch? */ |
/** \name Authentication */ |
/*@{ */ |
struct kref refcount; |
struct drm_minor *minor; |
char *unique; |
int unique_len; |
int unique_size; |
// struct drm_open_hash magiclist; |
// struct list_head magicfree; |
/*@} */ |
// struct drm_lock_data lock; /**< Information on hardware lock */ |
void *driver_priv; /**< Private structure for driver to use */ |
// struct drm_lock_data lock; |
void *driver_priv; |
}; |
#if 0 |
/* Size of ringbuffer for vblank timestamps. Just double-buffer |
* in initial implementation. |
*/ |
739,18 → 700,9 |
#define DRM_SCANOUTPOS_ACCURATE (1 << 2) |
struct drm_bus { |
int bus_type; |
int (*get_irq)(struct drm_device *dev); |
const char *(*get_name)(struct drm_device *dev); |
int (*set_busid)(struct drm_device *dev, struct drm_master *master); |
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); |
}; |
#endif |
#define DRM_IRQ_ARGS int irq, void *arg |
/** |
* DRM driver structure. This structure represent the common code for |
* a family of cards. There will one drm_device for each card present |
876,7 → 828,7 |
/* these have to be filled in */ |
irqreturn_t(*irq_handler) (DRM_IRQ_ARGS); |
irqreturn_t(*irq_handler) (int irq, void *arg); |
void (*irq_preinstall) (struct drm_device *dev); |
int (*irq_postinstall) (struct drm_device *dev); |
void (*irq_uninstall) (struct drm_device *dev); |
891,12 → 843,15 |
int (*gem_open_object) (struct drm_gem_object *, struct drm_file *); |
void (*gem_close_object) (struct drm_gem_object *, struct drm_file *); |
u32 driver_features; |
int dev_priv_size; |
}; |
#define DRM_MINOR_UNASSIGNED 0 |
#define DRM_MINOR_LEGACY 1 |
#define DRM_MINOR_CONTROL 2 |
#define DRM_MINOR_RENDER 3 |
enum drm_minor_type { |
DRM_MINOR_LEGACY, |
DRM_MINOR_CONTROL, |
DRM_MINOR_RENDER, |
DRM_MINOR_CNT, |
}; |
/** |
* Info file list entry. This structure represents a debugfs or proc file to |
925,33 → 880,17 |
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 */ |
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 dentry *debugfs_root; |
struct drm_master *master; /* currently active master for this node */ |
// struct list_head master_list; |
// struct drm_mode_group mode_group; |
}; |
struct list_head debugfs_list; |
struct mutex debugfs_lock; /* Protects debugfs_list. */ |
/* mode specified on the command line */ |
struct drm_cmdline_mode { |
bool specified; |
bool refresh_specified; |
bool bpp_specified; |
int xres, yres; |
int bpp; |
int refresh; |
bool rb; |
bool interlace; |
bool cvt; |
bool margins; |
enum drm_connector_force force; |
/* currently active master for this node. Protected by master_mutex */ |
struct drm_master *master; |
struct drm_mode_group mode_group; |
}; |
962,18 → 901,23 |
*/ |
struct drm_device { |
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 */ |
struct device *dev; /**< Device structure of bus-device */ |
struct drm_driver *driver; /**< DRM driver managing the device */ |
void *dev_private; /**< DRM driver private data */ |
struct drm_minor *primary; /**< Primary node */ |
atomic_t unplugged; /**< Flag whether dev is dead */ |
/** \name Locks */ |
/*@{ */ |
spinlock_t count_lock; /**< For inuse, drm_device::open_count, drm_device::buf_use */ |
struct mutex struct_mutex; /**< For others */ |
struct mutex master_mutex; /**< For drm_minor::master and drm_file::is_master */ |
/*@} */ |
/** \name Usage Counters */ |
/*@{ */ |
int open_count; /**< Outstanding files open */ |
int open_count; /**< Outstanding files open, protected by drm_global_mutex. */ |
spinlock_t buf_lock; /**< For drm_device::buf_use and a few other things. */ |
int buf_use; /**< Buffers in use -- cannot alloc */ |
atomic_t buf_alloc; /**< Buffer allocation in progress */ |
/*@} */ |
1003,6 → 947,8 |
/** \name Context support */ |
/*@{ */ |
bool irq_enabled; /**< True if irq handler is enabled */ |
int irq; |
__volatile__ long context_flag; /**< Context swapping flag */ |
int last_context; /**< Last current context */ |
/*@} */ |
1018,7 → 964,12 |
*/ |
bool vblank_disable_allowed; |
/* array of size num_crtcs */ |
struct drm_vblank_crtc *vblank; |
spinlock_t vblank_time_lock; /**< Protects vblank count and time updates during vblank enable/disable */ |
spinlock_t vbl_lock; |
u32 max_vblank_count; /**< size of vblank counter register */ |
/** |
1031,21 → 982,10 |
// struct drm_agp_head *agp; /**< AGP data */ |
struct device *dev; /**< Device structure */ |
struct pci_dev *pdev; /**< PCI device structure */ |
int pci_vendor; /**< PCI vendor id */ |
int pci_device; /**< PCI device id */ |
unsigned int num_crtcs; /**< Number of CRTCs on this device */ |
void *dev_private; /**< device private data */ |
struct address_space *dev_mapping; |
// struct drm_sigdata sigdata; /**< For block_all_signals */ |
// sigset_t sigmask; |
struct drm_driver *driver; |
// 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_mode_config mode_config; /**< Current mode config */ |
1056,8 → 996,6 |
struct drm_vma_offset_manager *vma_offset_manager; |
/*@} */ |
int switch_power_state; |
atomic_t unplugged; /* device has been unplugged or gone away */ |
}; |
#define DRM_SWITCH_POWER_ON 0 |
1071,11 → 1009,6 |
return ((dev->driver->driver_features & feature) ? 1 : 0); |
} |
static inline int drm_dev_to_irq(struct drm_device *dev) |
{ |
return dev->pdev->irq; |
} |
static inline void drm_device_set_unplugged(struct drm_device *dev) |
{ |
smp_wmb(); |
1089,10 → 1022,6 |
return ret; |
} |
static inline bool drm_modeset_is_locked(struct drm_device *dev) |
{ |
return mutex_is_locked(&dev->mode_config.mutex); |
} |
/******************************************************************/ |
/** \name Internal function definitions */ |
1104,11 → 1033,11 |
extern long drm_compat_ioctl(struct file *filp, |
unsigned int cmd, unsigned long arg); |
extern int drm_lastclose(struct drm_device *dev); |
extern bool drm_ioctl_flags(unsigned int nr, unsigned int *flags); |
/* Device support (drm_fops.h) */ |
extern struct mutex drm_global_mutex; |
extern int drm_open(struct inode *inode, struct file *filp); |
extern int drm_stub_open(struct inode *inode, struct file *filp); |
extern ssize_t drm_read(struct file *filp, char __user *buffer, |
size_t count, loff_t *offset); |
extern int drm_release(struct inode *inode, struct file *filp); |
1146,29 → 1075,6 |
extern int drm_noop(struct drm_device *dev, void *data, |
struct drm_file *file_priv); |
/* Context IOCTL support (drm_context.h) */ |
extern int drm_resctx(struct drm_device *dev, void *data, |
struct drm_file *file_priv); |
extern int drm_addctx(struct drm_device *dev, void *data, |
struct drm_file *file_priv); |
extern int drm_getctx(struct drm_device *dev, void *data, |
struct drm_file *file_priv); |
extern int drm_switchctx(struct drm_device *dev, void *data, |
struct drm_file *file_priv); |
extern int drm_newctx(struct drm_device *dev, void *data, |
struct drm_file *file_priv); |
extern int drm_rmctx(struct drm_device *dev, void *data, |
struct drm_file *file_priv); |
extern int drm_ctxbitmap_init(struct drm_device *dev); |
extern void drm_ctxbitmap_cleanup(struct drm_device *dev); |
extern void drm_ctxbitmap_free(struct drm_device *dev, int ctx_handle); |
extern int drm_setsareactx(struct drm_device *dev, void *data, |
struct drm_file *file_priv); |
extern int drm_getsareactx(struct drm_device *dev, void *data, |
struct drm_file *file_priv); |
/* Authentication IOCTL support (drm_auth.h) */ |
extern int drm_getmagic(struct drm_device *dev, void *data, |
struct drm_file *file_priv); |
1179,7 → 1085,7 |
/* Cache management (drm_cache.c) */ |
void drm_clflush_pages(struct page *pages[], unsigned long num_pages); |
void drm_clflush_sg(struct sg_table *st); |
void drm_clflush_virt_range(char *addr, unsigned long length); |
void drm_clflush_virt_range(void *addr, unsigned long length); |
/* Locking IOCTL support (drm_lock.h) */ |
extern int drm_lock(struct drm_device *dev, void *data, |
1232,7 → 1138,7 |
/* IRQ support (drm_irq.h) */ |
extern int drm_control(struct drm_device *dev, void *data, |
struct drm_file *file_priv); |
extern int drm_irq_install(struct drm_device *dev); |
extern int drm_irq_install(struct drm_device *dev, int irq); |
extern int drm_irq_uninstall(struct drm_device *dev); |
extern int drm_vblank_init(struct drm_device *dev, int num_crtcs); |
1246,8 → 1152,14 |
extern bool drm_handle_vblank(struct drm_device *dev, int crtc); |
extern int drm_vblank_get(struct drm_device *dev, int crtc); |
extern void drm_vblank_put(struct drm_device *dev, int crtc); |
extern int drm_crtc_vblank_get(struct drm_crtc *crtc); |
extern void drm_crtc_vblank_put(struct drm_crtc *crtc); |
extern void drm_vblank_off(struct drm_device *dev, int crtc); |
extern void drm_vblank_on(struct drm_device *dev, int crtc); |
extern void drm_crtc_vblank_off(struct drm_crtc *crtc); |
extern void drm_crtc_vblank_on(struct drm_crtc *crtc); |
extern void drm_vblank_cleanup(struct drm_device *dev); |
extern u32 drm_get_last_vbltimestamp(struct drm_device *dev, int crtc, |
struct timeval *tvblank, unsigned flags); |
extern int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev, |
1259,21 → 1171,7 |
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, |
struct drm_connector *connector, |
struct drm_cmdline_mode *mode); |
extern struct drm_display_mode * |
drm_mode_create_from_cmdline_mode(struct drm_device *dev, |
struct drm_cmdline_mode *cmd); |
extern int drm_display_mode_from_videomode(const struct videomode *vm, |
struct drm_display_mode *dmode); |
extern int of_get_drm_display_mode(struct device_node *np, |
struct drm_display_mode *dmode, |
int index); |
/* Modesetting support */ |
extern void drm_vblank_pre_modeset(struct drm_device *dev, int crtc); |
extern void drm_vblank_post_modeset(struct drm_device *dev, int crtc); |
1294,7 → 1192,6 |
extern void drm_put_dev(struct drm_device *dev); |
extern void drm_unplug_dev(struct drm_device *dev); |
extern unsigned int drm_debug; |
extern unsigned int drm_rnodes; |
#if 0 |
extern unsigned int drm_vblank_offdelay; |
1302,12 → 1199,9 |
extern unsigned int drm_timestamp_monotonic; |
extern struct class *drm_class; |
extern struct dentry *drm_debugfs_root; |
extern struct idr drm_minors_idr; |
extern struct drm_local_map *drm_getsarea(struct drm_device *dev); |
#endif |
/* Debugfs support */ |
#if defined(CONFIG_DEBUG_FS) |
extern int drm_debugfs_init(struct drm_minor *minor, int minor_id, |
1318,6 → 1212,8 |
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); |
extern int drm_debugfs_connector_add(struct drm_connector *connector); |
extern void drm_debugfs_connector_remove(struct drm_connector *connector); |
#else |
static inline int drm_debugfs_init(struct drm_minor *minor, int minor_id, |
struct dentry *root) |
1342,6 → 1238,15 |
{ |
return 0; |
} |
static inline int drm_debugfs_connector_add(struct drm_connector *connector) |
{ |
return 0; |
} |
static inline void drm_debugfs_connector_remove(struct drm_connector *connector) |
{ |
} |
#endif |
/* Info file support */ |
1368,7 → 1273,6 |
struct drm_ati_pcigart_info * gart_info); |
extern int drm_ati_pcigart_cleanup(struct drm_device *dev, |
struct drm_ati_pcigart_info * gart_info); |
#endif |
extern drm_dma_handle_t *drm_pci_alloc(struct drm_device *dev, size_t size, |
size_t align); |
1380,9 → 1284,8 |
struct drm_sysfs_class; |
extern struct class *drm_sysfs_create(struct module *owner, char *name); |
extern void drm_sysfs_destroy(void); |
extern int drm_sysfs_device_add(struct drm_minor *minor); |
extern struct device *drm_sysfs_minor_alloc(struct drm_minor *minor); |
extern void drm_sysfs_hotplug_event(struct drm_device *dev); |
extern void drm_sysfs_device_remove(struct drm_minor *minor); |
extern int drm_sysfs_connector_add(struct drm_connector *connector); |
extern void drm_sysfs_connector_remove(struct drm_connector *connector); |
#endif |
1443,7 → 1346,7 |
int drm_gem_create_mmap_offset(struct drm_gem_object *obj); |
int drm_gem_create_mmap_offset_size(struct drm_gem_object *obj, size_t size); |
struct page **drm_gem_get_pages(struct drm_gem_object *obj, gfp_t gfpmask); |
struct page **drm_gem_get_pages(struct drm_gem_object *obj); |
void drm_gem_put_pages(struct drm_gem_object *obj, struct page **pages, |
bool dirty, bool accessed); |
1477,7 → 1380,7 |
{ |
} |
//#include <drm/drm_mem_util.h> |
#include <drm/drm_mem_util.h> |
extern int drm_fill_in_dev(struct drm_device *dev, |
const struct pci_device_id *ent, |
1486,10 → 1389,13 |
/*@}*/ |
#if 0 |
extern int drm_pci_init(struct drm_driver *driver, struct pci_driver *pdriver); |
extern void drm_pci_exit(struct drm_driver *driver, struct pci_driver *pdriver); |
extern int drm_get_pci_dev(struct pci_dev *pdev, |
const struct pci_device_id *ent, |
struct drm_driver *driver); |
#endif |
#define DRM_PCIE_SPEED_25 1 |
#define DRM_PCIE_SPEED_50 2 |
/drivers/include/drm/drm_crtc.h |
---|
32,8 → 32,8 |
#include <linux/fb.h> |
#include <linux/hdmi.h> |
#include <drm/drm_mode.h> |
#include <drm/drm_fourcc.h> |
#include <drm/drm_modeset_lock.h> |
struct drm_device; |
struct drm_mode_set; |
41,6 → 41,7 |
struct drm_object_properties; |
struct drm_file; |
struct drm_clip_rect; |
struct device_node; |
#define DRM_MODE_OBJECT_CRTC 0xcccccccc |
#define DRM_MODE_OBJECT_CONNECTOR 0xc0c0c0c0 |
51,6 → 52,7 |
#define DRM_MODE_OBJECT_BLOB 0xbbbbbbbb |
#define DRM_MODE_OBJECT_PLANE 0xeeeeeeee |
#define DRM_MODE_OBJECT_BRIDGE 0xbdbdbdbd |
#define DRM_MODE_OBJECT_ANY 0 |
struct drm_mode_object { |
uint32_t id; |
65,130 → 67,31 |
uint64_t values[DRM_OBJECT_MAX_PROPERTY]; |
}; |
/* |
* Note on terminology: here, for brevity and convenience, we refer to connector |
* control chips as 'CRTCs'. They can control any type of connector, VGA, LVDS, |
* DVI, etc. And 'screen' refers to the whole of the visible display, which |
* may span multiple monitors (and therefore multiple CRTC and connector |
* structures). |
*/ |
static inline int64_t U642I64(uint64_t val) |
{ |
return (int64_t)*((int64_t *)&val); |
} |
static inline uint64_t I642U64(int64_t val) |
{ |
return (uint64_t)*((uint64_t *)&val); |
} |
enum drm_mode_status { |
MODE_OK = 0, /* Mode OK */ |
MODE_HSYNC, /* hsync out of range */ |
MODE_VSYNC, /* vsync out of range */ |
MODE_H_ILLEGAL, /* mode has illegal horizontal timings */ |
MODE_V_ILLEGAL, /* mode has illegal horizontal timings */ |
MODE_BAD_WIDTH, /* requires an unsupported linepitch */ |
MODE_NOMODE, /* no mode with a matching name */ |
MODE_NO_INTERLACE, /* interlaced mode not supported */ |
MODE_NO_DBLESCAN, /* doublescan mode not supported */ |
MODE_NO_VSCAN, /* multiscan mode not supported */ |
MODE_MEM, /* insufficient video memory */ |
MODE_VIRTUAL_X, /* mode width too large for specified virtual size */ |
MODE_VIRTUAL_Y, /* mode height too large for specified virtual size */ |
MODE_MEM_VIRT, /* insufficient video memory given virtual size */ |
MODE_NOCLOCK, /* no fixed clock available */ |
MODE_CLOCK_HIGH, /* clock required is too high */ |
MODE_CLOCK_LOW, /* clock required is too low */ |
MODE_CLOCK_RANGE, /* clock/mode isn't in a ClockRange */ |
MODE_BAD_HVALUE, /* horizontal timing was out of range */ |
MODE_BAD_VVALUE, /* vertical timing was out of range */ |
MODE_BAD_VSCAN, /* VScan value out of range */ |
MODE_HSYNC_NARROW, /* horizontal sync too narrow */ |
MODE_HSYNC_WIDE, /* horizontal sync too wide */ |
MODE_HBLANK_NARROW, /* horizontal blanking too narrow */ |
MODE_HBLANK_WIDE, /* horizontal blanking too wide */ |
MODE_VSYNC_NARROW, /* vertical sync too narrow */ |
MODE_VSYNC_WIDE, /* vertical sync too wide */ |
MODE_VBLANK_NARROW, /* vertical blanking too narrow */ |
MODE_VBLANK_WIDE, /* vertical blanking too wide */ |
MODE_PANEL, /* exceeds panel dimensions */ |
MODE_INTERLACE_WIDTH, /* width too large for interlaced mode */ |
MODE_ONE_WIDTH, /* only one width is supported */ |
MODE_ONE_HEIGHT, /* only one height is supported */ |
MODE_ONE_SIZE, /* only one resolution is supported */ |
MODE_NO_REDUCED, /* monitor doesn't accept reduced blanking */ |
MODE_NO_STEREO, /* stereo modes not supported */ |
MODE_UNVERIFIED = -3, /* mode needs to reverified */ |
MODE_BAD = -2, /* unspecified reason */ |
MODE_ERROR = -1 /* error condition */ |
}; |
/* rotation property bits */ |
#define DRM_ROTATE_0 0 |
#define DRM_ROTATE_90 1 |
#define DRM_ROTATE_180 2 |
#define DRM_ROTATE_270 3 |
#define DRM_REFLECT_X 4 |
#define DRM_REFLECT_Y 5 |
#define DRM_MODE_TYPE_CLOCK_CRTC_C (DRM_MODE_TYPE_CLOCK_C | \ |
DRM_MODE_TYPE_CRTC_C) |
#define DRM_MODE(nm, t, c, hd, hss, hse, ht, hsk, vd, vss, vse, vt, vs, f) \ |
.name = nm, .status = 0, .type = (t), .clock = (c), \ |
.hdisplay = (hd), .hsync_start = (hss), .hsync_end = (hse), \ |
.htotal = (ht), .hskew = (hsk), .vdisplay = (vd), \ |
.vsync_start = (vss), .vsync_end = (vse), .vtotal = (vt), \ |
.vscan = (vs), .flags = (f), \ |
.base.type = DRM_MODE_OBJECT_MODE |
#define CRTC_INTERLACE_HALVE_V (1 << 0) /* halve V values for interlacing */ |
#define CRTC_STEREO_DOUBLE (1 << 1) /* adjust timings for stereo modes */ |
#define DRM_MODE_FLAG_3D_MAX DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF |
struct drm_display_mode { |
/* Header */ |
struct list_head head; |
struct drm_mode_object base; |
char name[DRM_DISPLAY_MODE_LEN]; |
enum drm_mode_status status; |
unsigned int type; |
/* Proposed mode values */ |
int clock; /* in kHz */ |
int hdisplay; |
int hsync_start; |
int hsync_end; |
int htotal; |
int hskew; |
int vdisplay; |
int vsync_start; |
int vsync_end; |
int vtotal; |
int vscan; |
unsigned int flags; |
/* Addressable image size (may be 0 for projectors, etc.) */ |
int width_mm; |
int height_mm; |
/* Actual mode we give to hw */ |
int crtc_clock; /* in KHz */ |
int crtc_hdisplay; |
int crtc_hblank_start; |
int crtc_hblank_end; |
int crtc_hsync_start; |
int crtc_hsync_end; |
int crtc_htotal; |
int crtc_hskew; |
int crtc_vdisplay; |
int crtc_vblank_start; |
int crtc_vblank_end; |
int crtc_vsync_start; |
int crtc_vsync_end; |
int crtc_vtotal; |
/* Driver private mode info */ |
int private_size; |
int *private; |
int private_flags; |
int vrefresh; /* in Hz */ |
int hsync; /* in kHz */ |
enum hdmi_picture_aspect picture_aspect_ratio; |
enum drm_connector_force { |
DRM_FORCE_UNSPECIFIED, |
DRM_FORCE_OFF, |
DRM_FORCE_ON, /* force on analog part normally */ |
DRM_FORCE_ON_DIGITAL, /* for DVI-I use digital connector */ |
}; |
static inline bool drm_mode_is_stereo(const struct drm_display_mode *mode) |
{ |
return mode->flags & DRM_MODE_FLAG_3D_MASK; |
} |
#include <drm/drm_modes.h> |
enum drm_connector_status { |
connector_status_connected = 1, |
227,6 → 130,9 |
enum subpixel_order subpixel_order; |
u32 color_formats; |
/* Mask of supported hdmi deep color modes */ |
u8 edid_hdmi_dc_modes; |
u8 cea_rev; |
}; |
307,10 → 213,15 |
char name[DRM_PROP_NAME_LEN]; |
uint32_t num_values; |
uint64_t *values; |
struct drm_device *dev; |
struct list_head enum_blob_list; |
}; |
void drm_modeset_lock_all(struct drm_device *dev); |
void drm_modeset_unlock_all(struct drm_device *dev); |
void drm_warn_on_modeset_not_all_locked(struct drm_device *dev); |
struct drm_crtc; |
struct drm_connector; |
struct drm_encoder; |
386,7 → 297,10 |
* drm_crtc - central CRTC control structure |
* @dev: parent DRM device |
* @head: list management |
* @mutex: per-CRTC locking |
* @base: base KMS object for ID tracking etc. |
* @primary: primary plane for this CRTC |
* @cursor: cursor plane for this CRTC |
* @enabled: is this CRTC enabled? |
* @mode: current mode timings |
* @hwmode: mode timings as programmed to hw regs |
409,6 → 323,7 |
*/ |
struct drm_crtc { |
struct drm_device *dev; |
struct device_node *port; |
struct list_head head; |
/** |
418,13 → 333,18 |
* state, ...) and a write lock for everything which can be update |
* without a full modeset (fb, cursor data, ...) |
*/ |
struct mutex mutex; |
struct drm_modeset_lock mutex; |
struct drm_mode_object base; |
/* framebuffer the connector is currently bound to */ |
struct drm_framebuffer *fb; |
/* primary and cursor planes for CRTC */ |
struct drm_plane *primary; |
struct drm_plane *cursor; |
/* position of cursor plane on crtc */ |
int cursor_x; |
int cursor_y; |
/* Temporary tracking of the old fb while a modeset is ongoing. Used |
* by drm_mode_set_config_internal to implement correct refcounting. */ |
struct drm_framebuffer *old_fb; |
514,6 → 434,7 |
* @dev: parent DRM device |
* @head: list management |
* @base: base KMS object |
* @name: encoder name |
* @encoder_type: one of the %DRM_MODE_ENCODER_<foo> types in drm_mode.h |
* @possible_crtcs: bitmask of potential CRTC bindings |
* @possible_clones: bitmask of potential sibling encoders for cloning |
530,6 → 451,7 |
struct list_head head; |
struct drm_mode_object base; |
char *name; |
int encoder_type; |
uint32_t possible_crtcs; |
uint32_t possible_clones; |
540,13 → 462,6 |
void *helper_private; |
}; |
enum drm_connector_force { |
DRM_FORCE_UNSPECIFIED, |
DRM_FORCE_OFF, |
DRM_FORCE_ON, /* force on analog part normally */ |
DRM_FORCE_ON_DIGITAL, /* for DVI-I use digital connector */ |
}; |
/* should we poll this connector for connects and disconnects */ |
/* hot plug detectable */ |
#define DRM_CONNECTOR_POLL_HPD (1 << 0) |
565,6 → 480,7 |
* @attr: sysfs attributes |
* @head: list management |
* @base: base KMS object |
* @name: connector name |
* @connector_type: one of the %DRM_MODE_CONNECTOR_<foo> types from drm_mode.h |
* @connector_type_id: index into connector type enum |
* @interlace_allowed: can this connector handle interlaced modes? |
603,6 → 519,7 |
struct drm_mode_object base; |
char *name; |
int connector_type; |
int connector_type_id; |
bool interlace_allowed; |
621,6 → 538,8 |
struct drm_property_blob *edid_blob_ptr; |
struct drm_object_properties properties; |
struct drm_property_blob *path_blob_ptr; |
uint8_t polled; /* DRM_CONNECTOR_POLL_* */ |
/* requested DPMS state */ |
630,6 → 549,7 |
/* forced on connector */ |
enum drm_connector_force force; |
bool override_edid; |
uint32_t encoder_ids[DRM_CONNECTOR_MAX_ENCODER]; |
struct drm_encoder *encoder; /* currently active encoder */ |
642,6 → 562,8 |
int audio_latency[2]; |
int null_edid_counter; /* needed to workaround some HW bugs where we get all 0s */ |
unsigned bad_edid_counter; |
struct dentry *debugfs_entry; |
}; |
/** |
665,6 → 587,12 |
struct drm_property *property, uint64_t val); |
}; |
enum drm_plane_type { |
DRM_PLANE_TYPE_OVERLAY, |
DRM_PLANE_TYPE_PRIMARY, |
DRM_PLANE_TYPE_CURSOR, |
}; |
/** |
* drm_plane - central DRM plane control structure |
* @dev: DRM device this plane belongs to |
677,6 → 605,7 |
* @fb: currently bound fb |
* @funcs: helper functions |
* @properties: property tracking for this plane |
* @type: type of plane (overlay, primary, cursor) |
*/ |
struct drm_plane { |
struct drm_device *dev; |
694,6 → 623,8 |
const struct drm_plane_funcs *funcs; |
struct drm_object_properties properties; |
enum drm_plane_type type; |
}; |
/** |
835,6 → 766,8 |
*/ |
struct drm_mode_config { |
struct mutex mutex; /* protects configuration (mode lists etc.) */ |
struct drm_modeset_lock connection_mutex; /* protects connector->encoder and encoder->crtc links */ |
struct drm_modeset_acquire_ctx *acquire_ctx; /* for legacy _lock_all() / _unlock_all() */ |
struct mutex idr_mutex; /* for IDR management */ |
struct idr crtc_idr; /* use this idr for all IDs, fb, crtc, connector, modes - just makes life easier */ |
/* this is limited to one for now */ |
856,7 → 789,15 |
struct list_head bridge_list; |
int num_encoder; |
struct list_head encoder_list; |
int num_plane; |
/* |
* Track # of overlay planes separately from # of total planes. By |
* default we only advertise overlay planes to userspace; if userspace |
* sets the "universal plane" capability bit, we'll go ahead and |
* expose all planes. |
*/ |
int num_overlay_plane; |
int num_total_plane; |
struct list_head plane_list; |
int num_crtc; |
878,6 → 819,8 |
struct list_head property_blob_list; |
struct drm_property *edid_property; |
struct drm_property *dpms_property; |
struct drm_property *path_property; |
struct drm_property *plane_type_property; |
/* DVI-I properties */ |
struct drm_property *dvi_i_subconnector_property; |
900,6 → 843,7 |
/* Optional properties */ |
struct drm_property *scaling_mode_property; |
struct drm_property *aspect_ratio_property; |
struct drm_property *dirty_info_property; |
/* dumb ioctl parameters */ |
907,6 → 851,9 |
/* whether async page flip is supported or not */ |
bool async_page_flip; |
/* cursor size */ |
uint32_t cursor_width, cursor_height; |
}; |
#define obj_to_crtc(x) container_of(x, struct drm_crtc, base) |
923,10 → 870,11 |
char *name; |
}; |
extern void drm_modeset_lock_all(struct drm_device *dev); |
extern void drm_modeset_unlock_all(struct drm_device *dev); |
extern void drm_warn_on_modeset_not_all_locked(struct drm_device *dev); |
extern int drm_crtc_init_with_planes(struct drm_device *dev, |
struct drm_crtc *crtc, |
struct drm_plane *primary, |
struct drm_plane *cursor, |
const struct drm_crtc_funcs *funcs); |
extern int drm_crtc_init(struct drm_device *dev, |
struct drm_crtc *crtc, |
const struct drm_crtc_funcs *funcs); |
951,6 → 899,8 |
struct drm_connector *connector, |
const struct drm_connector_funcs *funcs, |
int connector_type); |
int drm_connector_register(struct drm_connector *connector); |
void drm_connector_unregister(struct drm_connector *connector); |
extern void drm_connector_cleanup(struct drm_connector *connector); |
/* helper to unplug all connectors from sysfs for device */ |
978,19 → 928,30 |
return !!(encoder->possible_crtcs & drm_crtc_mask(crtc)); |
} |
extern int drm_universal_plane_init(struct drm_device *dev, |
struct drm_plane *plane, |
unsigned long possible_crtcs, |
const struct drm_plane_funcs *funcs, |
const uint32_t *formats, |
uint32_t format_count, |
enum drm_plane_type type); |
extern int drm_plane_init(struct drm_device *dev, |
struct drm_plane *plane, |
unsigned long possible_crtcs, |
const struct drm_plane_funcs *funcs, |
const uint32_t *formats, uint32_t format_count, |
bool priv); |
bool is_primary); |
extern void drm_plane_cleanup(struct drm_plane *plane); |
extern void drm_plane_force_disable(struct drm_plane *plane); |
extern int drm_crtc_check_viewport(const struct drm_crtc *crtc, |
int x, int y, |
const struct drm_display_mode *mode, |
const struct drm_framebuffer *fb); |
extern void drm_encoder_cleanup(struct drm_encoder *encoder); |
extern const char *drm_get_connector_name(const struct drm_connector *connector); |
extern const char *drm_get_connector_status_name(enum drm_connector_status status); |
extern const char *drm_get_subpixel_order_name(enum subpixel_order order); |
extern const char *drm_get_dpms_name(int val); |
extern const char *drm_get_dvi_i_subconnector_name(int val); |
extern const char *drm_get_dvi_i_select_name(int val); |
998,41 → 959,38 |
extern const char *drm_get_tv_select_name(int val); |
extern void drm_fb_release(struct drm_file *file_priv); |
extern int drm_mode_group_init_legacy_group(struct drm_device *dev, struct drm_mode_group *group); |
extern void drm_mode_group_destroy(struct drm_mode_group *group); |
extern void drm_reinit_primary_mode_group(struct drm_device *dev); |
extern bool drm_probe_ddc(struct i2c_adapter *adapter); |
extern struct edid *drm_get_edid(struct drm_connector *connector, |
struct i2c_adapter *adapter); |
extern struct edid *drm_edid_duplicate(const struct edid *edid); |
extern int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid); |
extern void drm_mode_probed_add(struct drm_connector *connector, struct drm_display_mode *mode); |
extern void drm_mode_copy(struct drm_display_mode *dst, const struct drm_display_mode *src); |
extern struct drm_display_mode *drm_mode_duplicate(struct drm_device *dev, |
const struct drm_display_mode *mode); |
extern void drm_mode_debug_printmodeline(const struct drm_display_mode *mode); |
extern void drm_mode_config_init(struct drm_device *dev); |
extern void drm_mode_config_reset(struct drm_device *dev); |
extern void drm_mode_config_cleanup(struct drm_device *dev); |
extern void drm_mode_set_name(struct drm_display_mode *mode); |
extern bool drm_mode_equal(const struct drm_display_mode *mode1, const struct drm_display_mode *mode2); |
extern bool drm_mode_equal_no_clocks_no_stereo(const struct drm_display_mode *mode1, const struct drm_display_mode *mode2); |
extern int drm_mode_width(const struct drm_display_mode *mode); |
extern int drm_mode_height(const struct drm_display_mode *mode); |
/* for us by fb module */ |
extern struct drm_display_mode *drm_mode_create(struct drm_device *dev); |
extern void drm_mode_destroy(struct drm_device *dev, struct drm_display_mode *mode); |
extern void drm_mode_validate_size(struct drm_device *dev, |
struct list_head *mode_list, |
int maxX, int maxY, int maxPitch); |
extern void drm_mode_prune_invalid(struct drm_device *dev, |
struct list_head *mode_list, bool verbose); |
extern void drm_mode_sort(struct list_head *mode_list); |
extern int drm_mode_hsync(const struct drm_display_mode *mode); |
extern int drm_mode_vrefresh(const struct drm_display_mode *mode); |
extern void drm_mode_set_crtcinfo(struct drm_display_mode *p, |
int adjust_flags); |
extern void drm_mode_connector_list_update(struct drm_connector *connector); |
extern int drm_mode_connector_set_path_property(struct drm_connector *connector, |
char *path); |
extern int drm_mode_connector_update_edid_property(struct drm_connector *connector, |
struct edid *edid); |
static inline bool drm_property_type_is(struct drm_property *property, |
uint32_t type) |
{ |
/* instanceof for props.. handles extended type vs original types: */ |
if (property->flags & DRM_MODE_PROP_EXTENDED_TYPE) |
return (property->flags & DRM_MODE_PROP_EXTENDED_TYPE) == type; |
return property->flags & type; |
} |
static inline bool drm_property_type_valid(struct drm_property *property) |
{ |
if (property->flags & DRM_MODE_PROP_EXTENDED_TYPE) |
return !(property->flags & DRM_MODE_PROP_LEGACY_TYPE); |
return !!(property->flags & DRM_MODE_PROP_LEGACY_TYPE); |
} |
extern int drm_object_property_set_value(struct drm_mode_object *obj, |
struct drm_property *property, |
uint64_t val); |
1062,10 → 1020,16 |
struct drm_property *drm_property_create_bitmask(struct drm_device *dev, |
int flags, const char *name, |
const struct drm_prop_enum_list *props, |
int num_values); |
int num_props, |
uint64_t supported_bits); |
struct drm_property *drm_property_create_range(struct drm_device *dev, int flags, |
const char *name, |
uint64_t min, uint64_t max); |
struct drm_property *drm_property_create_signed_range(struct drm_device *dev, |
int flags, const char *name, |
int64_t min, int64_t max); |
struct drm_property *drm_property_create_object(struct drm_device *dev, |
int flags, const char *name, uint32_t type); |
extern void drm_property_destroy(struct drm_device *dev, struct drm_property *property); |
extern int drm_property_add_enum(struct drm_property *property, int index, |
uint64_t value, const char *name); |
1073,17 → 1037,16 |
extern int drm_mode_create_tv_properties(struct drm_device *dev, int num_formats, |
char *formats[]); |
extern int drm_mode_create_scaling_mode_property(struct drm_device *dev); |
extern int drm_mode_create_aspect_ratio_property(struct drm_device *dev); |
extern int drm_mode_create_dirty_info_property(struct drm_device *dev); |
extern const char *drm_get_encoder_name(const struct drm_encoder *encoder); |
extern int drm_mode_connector_attach_encoder(struct drm_connector *connector, |
struct drm_encoder *encoder); |
extern void drm_mode_connector_detach_encoder(struct drm_connector *connector, |
struct drm_encoder *encoder); |
extern int drm_mode_crtc_set_gamma_size(struct drm_crtc *crtc, |
int gamma_size); |
extern struct drm_mode_object *drm_mode_object_find(struct drm_device *dev, |
uint32_t id, uint32_t type); |
/* IOCTLs */ |
extern int drm_mode_getresources(struct drm_device *dev, |
void *data, struct drm_file *file_priv); |
1129,21 → 1092,12 |
extern int drm_mode_gamma_set_ioctl(struct drm_device *dev, |
void *data, struct drm_file *file_priv); |
extern u8 drm_match_cea_mode(const struct drm_display_mode *to_match); |
extern enum hdmi_picture_aspect drm_get_cea_aspect_ratio(const u8 video_code); |
extern bool drm_detect_hdmi_monitor(struct edid *edid); |
extern bool drm_detect_monitor_audio(struct edid *edid); |
extern bool drm_rgb_quant_range_selectable(struct edid *edid); |
extern int drm_mode_page_flip_ioctl(struct drm_device *dev, |
void *data, struct drm_file *file_priv); |
extern struct drm_display_mode *drm_cvt_mode(struct drm_device *dev, |
int hdisplay, int vdisplay, int vrefresh, |
bool reduced, bool interlaced, bool margins); |
extern struct drm_display_mode *drm_gtf_mode(struct drm_device *dev, |
int hdisplay, int vdisplay, int vrefresh, |
bool interlaced, int margins); |
extern struct drm_display_mode *drm_gtf_mode_complex(struct drm_device *dev, |
int hdisplay, int vdisplay, int vrefresh, |
bool interlaced, int margins, int GTF_M, |
int GTF_2C, int GTF_K, int GTF_2J); |
extern int drm_add_modes_noedid(struct drm_connector *connector, |
int hdisplay, int vdisplay); |
extern void drm_set_preferred_mode(struct drm_connector *connector, |
1174,8 → 1128,21 |
extern int drm_format_horz_chroma_subsampling(uint32_t format); |
extern int drm_format_vert_chroma_subsampling(uint32_t format); |
extern const char *drm_get_format_name(uint32_t format); |
extern struct drm_property *drm_mode_create_rotation_property(struct drm_device *dev, |
unsigned int supported_rotations); |
extern unsigned int drm_rotation_simplify(unsigned int rotation, |
unsigned int supported_rotations); |
/* Helpers */ |
static inline struct drm_plane *drm_plane_find(struct drm_device *dev, |
uint32_t id) |
{ |
struct drm_mode_object *mo; |
mo = drm_mode_object_find(dev, id, DRM_MODE_OBJECT_PLANE); |
return mo ? obj_to_plane(mo) : NULL; |
} |
static inline struct drm_crtc *drm_crtc_find(struct drm_device *dev, |
uint32_t id) |
{ |
1192,4 → 1159,33 |
return mo ? obj_to_encoder(mo) : NULL; |
} |
static inline struct drm_connector *drm_connector_find(struct drm_device *dev, |
uint32_t id) |
{ |
struct drm_mode_object *mo; |
mo = drm_mode_object_find(dev, id, DRM_MODE_OBJECT_CONNECTOR); |
return mo ? obj_to_connector(mo) : NULL; |
} |
static inline struct drm_property *drm_property_find(struct drm_device *dev, |
uint32_t id) |
{ |
struct drm_mode_object *mo; |
mo = drm_mode_object_find(dev, id, DRM_MODE_OBJECT_PROPERTY); |
return mo ? obj_to_property(mo) : NULL; |
} |
static inline struct drm_property_blob * |
drm_property_blob_find(struct drm_device *dev, uint32_t id) |
{ |
struct drm_mode_object *mo; |
mo = drm_mode_object_find(dev, id, DRM_MODE_OBJECT_BLOB); |
return mo ? obj_to_blob(mo) : NULL; |
} |
/* Plane list iterator for legacy (overlay only) planes. */ |
#define drm_for_each_legacy_plane(plane, planelist) \ |
list_for_each_entry(plane, planelist, head) \ |
if (plane->type == DRM_PLANE_TYPE_OVERLAY) |
#endif /* __DRM_CRTC_H__ */ |
/drivers/include/drm/drm_crtc_helper.h |
---|
114,7 → 114,7 |
/** |
* drm_connector_helper_funcs - helper operations for connectors |
* @get_modes: get mode list for this connector |
* @mode_valid: is this mode valid on the given connector? |
* @mode_valid (optional): is this mode valid on the given connector? |
* |
* The helper operations are called by the mid-layer CRTC helper. |
*/ |
125,7 → 125,6 |
struct drm_encoder *(*best_encoder)(struct drm_connector *connector); |
}; |
extern int drm_helper_probe_single_connector_modes(struct drm_connector *connector, uint32_t maxX, uint32_t maxY); |
extern void drm_helper_disable_unused_functions(struct drm_device *dev); |
extern int drm_crtc_helper_set_config(struct drm_mode_set *set); |
extern bool drm_crtc_helper_set_mode(struct drm_crtc *crtc, |
139,7 → 138,7 |
extern void drm_helper_move_panel_connectors_to_head(struct drm_device *); |
extern int drm_helper_mode_fill_fb_struct(struct drm_framebuffer *fb, |
extern void drm_helper_mode_fill_fb_struct(struct drm_framebuffer *fb, |
struct drm_mode_fb_cmd2 *mode_cmd); |
static inline void drm_crtc_helper_add(struct drm_crtc *crtc, |
160,7 → 159,16 |
connector->helper_private = (void *)funcs; |
} |
extern int drm_helper_resume_force_mode(struct drm_device *dev); |
extern void drm_helper_resume_force_mode(struct drm_device *dev); |
/* drm_probe_helper.c */ |
extern int drm_helper_probe_single_connector_modes(struct drm_connector |
*connector, uint32_t maxX, |
uint32_t maxY); |
extern int drm_helper_probe_single_connector_modes_nomerge(struct drm_connector |
*connector, |
uint32_t maxX, |
uint32_t maxY); |
extern void drm_kms_helper_poll_init(struct drm_device *dev); |
extern void drm_kms_helper_poll_fini(struct drm_device *dev); |
extern bool drm_helper_hpd_irq_event(struct drm_device *dev); |
/drivers/include/drm/drm_dp_helper.h |
---|
37,6 → 37,7 |
* eDP: Embedded DisplayPort version 1 |
* DPI: DisplayPort Interoperability Guideline v1.1a |
* 1.2: DisplayPort 1.2 |
* MST: Multistream Transport - part of DP 1.2a |
* |
* 1.2 formally includes both eDP and DPI definitions. |
*/ |
103,9 → 104,14 |
#define DP_TRAINING_AUX_RD_INTERVAL 0x00e /* XXX 1.2? */ |
/* Multiple stream transport */ |
#define DP_FAUX_CAP 0x020 /* 1.2 */ |
# define DP_FAUX_CAP_1 (1 << 0) |
#define DP_MSTM_CAP 0x021 /* 1.2 */ |
# define DP_MST_CAP (1 << 0) |
#define DP_GUID 0x030 /* 1.2 */ |
#define DP_PSR_SUPPORT 0x070 /* XXX 1.2? */ |
# define DP_PSR_IS_SUPPORTED 1 |
#define DP_PSR_CAPS 0x071 /* XXX 1.2? */ |
221,6 → 227,16 |
# define DP_PSR_CRC_VERIFICATION (1 << 2) |
# define DP_PSR_FRAME_CAPTURE (1 << 3) |
#define DP_ADAPTER_CTRL 0x1a0 |
# define DP_ADAPTER_CTRL_FORCE_LOAD_SENSE (1 << 0) |
#define DP_BRANCH_DEVICE_CTRL 0x1a1 |
# define DP_BRANCH_DEVICE_IRQ_HPD (1 << 0) |
#define DP_PAYLOAD_ALLOCATE_SET 0x1c0 |
#define DP_PAYLOAD_ALLOCATE_START_TIME_SLOT 0x1c1 |
#define DP_PAYLOAD_ALLOCATE_TIME_SLOT_COUNT 0x1c2 |
#define DP_SINK_COUNT 0x200 |
/* prior to 1.2 bit 7 was reserved mbz */ |
# define DP_GET_SINK_COUNT(x) ((((x) & 0x80) >> 1) | ((x) & 0x3f)) |
230,6 → 246,9 |
# define DP_REMOTE_CONTROL_COMMAND_PENDING (1 << 0) |
# define DP_AUTOMATED_TEST_REQUEST (1 << 1) |
# define DP_CP_IRQ (1 << 2) |
# define DP_MCCS_IRQ (1 << 3) |
# define DP_DOWN_REP_MSG_RDY (1 << 4) /* 1.2 MST */ |
# define DP_UP_REQ_MSG_RDY (1 << 5) /* 1.2 MST */ |
# define DP_SINK_SPECIFIC_IRQ (1 << 6) |
#define DP_LANE0_1_STATUS 0x202 |
279,11 → 298,30 |
#define DP_TEST_PATTERN 0x221 |
#define DP_TEST_CRC_R_CR 0x240 |
#define DP_TEST_CRC_G_Y 0x242 |
#define DP_TEST_CRC_B_CB 0x244 |
#define DP_TEST_SINK_MISC 0x246 |
#define DP_TEST_CRC_SUPPORTED (1 << 5) |
#define DP_TEST_RESPONSE 0x260 |
# define DP_TEST_ACK (1 << 0) |
# define DP_TEST_NAK (1 << 1) |
# define DP_TEST_EDID_CHECKSUM_WRITE (1 << 2) |
#define DP_TEST_EDID_CHECKSUM 0x261 |
#define DP_TEST_SINK 0x270 |
#define DP_TEST_SINK_START (1 << 0) |
#define DP_PAYLOAD_TABLE_UPDATE_STATUS 0x2c0 /* 1.2 MST */ |
# define DP_PAYLOAD_TABLE_UPDATED (1 << 0) |
# define DP_PAYLOAD_ACT_HANDLED (1 << 1) |
#define DP_VC_PAYLOAD_ID_SLOT_1 0x2c1 /* 1.2 MST */ |
/* up to ID_SLOT_63 at 0x2ff */ |
#define DP_SOURCE_OUI 0x300 |
#define DP_SINK_OUI 0x400 |
#define DP_BRANCH_OUI 0x500 |
291,7 → 329,23 |
#define DP_SET_POWER 0x600 |
# define DP_SET_POWER_D0 0x1 |
# define DP_SET_POWER_D3 0x2 |
# define DP_SET_POWER_MASK 0x3 |
#define DP_SIDEBAND_MSG_DOWN_REQ_BASE 0x1000 /* 1.2 MST */ |
#define DP_SIDEBAND_MSG_UP_REP_BASE 0x1200 /* 1.2 MST */ |
#define DP_SIDEBAND_MSG_DOWN_REP_BASE 0x1400 /* 1.2 MST */ |
#define DP_SIDEBAND_MSG_UP_REQ_BASE 0x1600 /* 1.2 MST */ |
#define DP_SINK_COUNT_ESI 0x2002 /* 1.2 */ |
/* 0-5 sink count */ |
# define DP_SINK_COUNT_CP_READY (1 << 6) |
#define DP_DEVICE_SERVICE_IRQ_VECTOR_ESI0 0x2003 /* 1.2 */ |
#define DP_DEVICE_SERVICE_IRQ_VECTOR_ESI1 0x2004 /* 1.2 */ |
#define DP_LINK_SERVICE_IRQ_VECTOR_ESI0 0x2005 /* 1.2 */ |
#define DP_PSR_ERROR_STATUS 0x2006 /* XXX 1.2? */ |
# define DP_PSR_LINK_CRC_ERROR (1 << 0) |
# define DP_PSR_RFB_STORAGE_ERROR (1 << 1) |
308,6 → 362,43 |
# define DP_PSR_SINK_INTERNAL_ERROR 7 |
# define DP_PSR_SINK_STATE_MASK 0x07 |
/* DP 1.2 Sideband message defines */ |
/* peer device type - DP 1.2a Table 2-92 */ |
#define DP_PEER_DEVICE_NONE 0x0 |
#define DP_PEER_DEVICE_SOURCE_OR_SST 0x1 |
#define DP_PEER_DEVICE_MST_BRANCHING 0x2 |
#define DP_PEER_DEVICE_SST_SINK 0x3 |
#define DP_PEER_DEVICE_DP_LEGACY_CONV 0x4 |
/* DP 1.2 MST sideband request names DP 1.2a Table 2-80 */ |
#define DP_LINK_ADDRESS 0x01 |
#define DP_CONNECTION_STATUS_NOTIFY 0x02 |
#define DP_ENUM_PATH_RESOURCES 0x10 |
#define DP_ALLOCATE_PAYLOAD 0x11 |
#define DP_QUERY_PAYLOAD 0x12 |
#define DP_RESOURCE_STATUS_NOTIFY 0x13 |
#define DP_CLEAR_PAYLOAD_ID_TABLE 0x14 |
#define DP_REMOTE_DPCD_READ 0x20 |
#define DP_REMOTE_DPCD_WRITE 0x21 |
#define DP_REMOTE_I2C_READ 0x22 |
#define DP_REMOTE_I2C_WRITE 0x23 |
#define DP_POWER_UP_PHY 0x24 |
#define DP_POWER_DOWN_PHY 0x25 |
#define DP_SINK_EVENT_NOTIFY 0x30 |
#define DP_QUERY_STREAM_ENC_STATUS 0x38 |
/* DP 1.2 MST sideband nak reasons - table 2.84 */ |
#define DP_NAK_WRITE_FAILURE 0x01 |
#define DP_NAK_INVALID_READ 0x02 |
#define DP_NAK_CRC_FAILURE 0x03 |
#define DP_NAK_BAD_PARAM 0x04 |
#define DP_NAK_DEFER 0x05 |
#define DP_NAK_LINK_FAILURE 0x06 |
#define DP_NAK_NO_RESOURCES 0x07 |
#define DP_NAK_DPCD_FAIL 0x08 |
#define DP_NAK_I2C_NAK 0x09 |
#define DP_NAK_ALLOCATE_FAIL 0x0a |
#define MODE_I2C_START 1 |
#define MODE_I2C_WRITE 2 |
#define MODE_I2C_READ 4 |
398,4 → 489,124 |
(dpcd[DP_MAX_LANE_COUNT] & DP_ENHANCED_FRAME_CAP); |
} |
/* |
* DisplayPort AUX channel |
*/ |
/** |
* struct drm_dp_aux_msg - DisplayPort AUX channel transaction |
* @address: address of the (first) register to access |
* @request: contains the type of transaction (see DP_AUX_* macros) |
* @reply: upon completion, contains the reply type of the transaction |
* @buffer: pointer to a transmission or reception buffer |
* @size: size of @buffer |
*/ |
struct drm_dp_aux_msg { |
unsigned int address; |
u8 request; |
u8 reply; |
void *buffer; |
size_t size; |
}; |
/** |
* struct drm_dp_aux - DisplayPort AUX channel |
* @name: user-visible name of this AUX channel and the I2C-over-AUX adapter |
* @ddc: I2C adapter that can be used for I2C-over-AUX communication |
* @dev: pointer to struct device that is the parent for this AUX channel |
* @hw_mutex: internal mutex used for locking transfers |
* @transfer: transfers a message representing a single AUX transaction |
* |
* The .dev field should be set to a pointer to the device that implements |
* the AUX channel. |
* |
* The .name field may be used to specify the name of the I2C adapter. If set to |
* NULL, dev_name() of .dev will be used. |
* |
* Drivers provide a hardware-specific implementation of how transactions |
* are executed via the .transfer() function. A pointer to a drm_dp_aux_msg |
* structure describing the transaction is passed into this function. Upon |
* success, the implementation should return the number of payload bytes |
* that were transferred, or a negative error-code on failure. Helpers |
* propagate errors from the .transfer() function, with the exception of |
* the -EBUSY error, which causes a transaction to be retried. On a short, |
* helpers will return -EPROTO to make it simpler to check for failure. |
* |
* An AUX channel can also be used to transport I2C messages to a sink. A |
* typical application of that is to access an EDID that's present in the |
* sink device. The .transfer() function can also be used to execute such |
* transactions. The drm_dp_aux_register_i2c_bus() function registers an |
* I2C adapter that can be passed to drm_probe_ddc(). Upon removal, drivers |
* should call drm_dp_aux_unregister_i2c_bus() to remove the I2C adapter. |
* |
* Note that the aux helper code assumes that the .transfer() function |
* only modifies the reply field of the drm_dp_aux_msg structure. The |
* retry logic and i2c helpers assume this is the case. |
*/ |
struct drm_dp_aux { |
const char *name; |
struct i2c_adapter ddc; |
struct device *dev; |
struct mutex hw_mutex; |
ssize_t (*transfer)(struct drm_dp_aux *aux, |
struct drm_dp_aux_msg *msg); |
}; |
ssize_t drm_dp_dpcd_read(struct drm_dp_aux *aux, unsigned int offset, |
void *buffer, size_t size); |
ssize_t drm_dp_dpcd_write(struct drm_dp_aux *aux, unsigned int offset, |
void *buffer, size_t size); |
/** |
* drm_dp_dpcd_readb() - read a single byte from the DPCD |
* @aux: DisplayPort AUX channel |
* @offset: address of the register to read |
* @valuep: location where the value of the register will be stored |
* |
* Returns the number of bytes transferred (1) on success, or a negative |
* error code on failure. |
*/ |
static inline ssize_t drm_dp_dpcd_readb(struct drm_dp_aux *aux, |
unsigned int offset, u8 *valuep) |
{ |
return drm_dp_dpcd_read(aux, offset, valuep, 1); |
} |
/** |
* drm_dp_dpcd_writeb() - write a single byte to the DPCD |
* @aux: DisplayPort AUX channel |
* @offset: address of the register to write |
* @value: value to write to the register |
* |
* Returns the number of bytes transferred (1) on success, or a negative |
* error code on failure. |
*/ |
static inline ssize_t drm_dp_dpcd_writeb(struct drm_dp_aux *aux, |
unsigned int offset, u8 value) |
{ |
return drm_dp_dpcd_write(aux, offset, &value, 1); |
} |
int drm_dp_dpcd_read_link_status(struct drm_dp_aux *aux, |
u8 status[DP_LINK_STATUS_SIZE]); |
/* |
* DisplayPort link |
*/ |
#define DP_LINK_CAP_ENHANCED_FRAMING (1 << 0) |
struct drm_dp_link { |
unsigned char revision; |
unsigned int rate; |
unsigned int num_lanes; |
unsigned long capabilities; |
}; |
int drm_dp_link_probe(struct drm_dp_aux *aux, struct drm_dp_link *link); |
int drm_dp_link_power_up(struct drm_dp_aux *aux, struct drm_dp_link *link); |
int drm_dp_link_configure(struct drm_dp_aux *aux, struct drm_dp_link *link); |
int drm_dp_aux_register(struct drm_dp_aux *aux); |
void drm_dp_aux_unregister(struct drm_dp_aux *aux); |
#endif /* _DRM_DP_HELPER_H_ */ |
/drivers/include/drm/drm_dp_mst_helper.h |
---|
0,0 → 1,509 |
/* |
* Copyright © 2014 Red Hat. |
* |
* Permission to use, copy, modify, distribute, and sell this software and its |
* documentation for any purpose is hereby granted without fee, provided that |
* the above copyright notice appear in all copies and that both that copyright |
* notice and this permission notice appear in supporting documentation, and |
* that the name of the copyright holders not be used in advertising or |
* publicity pertaining to distribution of the software without specific, |
* written prior permission. The copyright holders make no representations |
* about the suitability of this software for any purpose. It is provided "as |
* is" without express or implied warranty. |
* |
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, |
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO |
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR |
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, |
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE |
* OF THIS SOFTWARE. |
*/ |
#ifndef _DRM_DP_MST_HELPER_H_ |
#define _DRM_DP_MST_HELPER_H_ |
#include <linux/types.h> |
#include <drm/drm_dp_helper.h> |
struct drm_dp_mst_branch; |
/** |
* struct drm_dp_vcpi - Virtual Channel Payload Identifer |
* @vcpi: Virtual channel ID. |
* @pbn: Payload Bandwidth Number for this channel |
* @aligned_pbn: PBN aligned with slot size |
* @num_slots: number of slots for this PBN |
*/ |
struct drm_dp_vcpi { |
int vcpi; |
int pbn; |
int aligned_pbn; |
int num_slots; |
}; |
/** |
* struct drm_dp_mst_port - MST port |
* @kref: reference count for this port. |
* @guid_valid: for DP 1.2 devices if we have validated the GUID. |
* @guid: guid for DP 1.2 device on this port. |
* @port_num: port number |
* @input: if this port is an input port. |
* @mcs: message capability status - DP 1.2 spec. |
* @ddps: DisplayPort Device Plug Status - DP 1.2 |
* @pdt: Peer Device Type |
* @ldps: Legacy Device Plug Status |
* @dpcd_rev: DPCD revision of device on this port |
* @num_sdp_streams: Number of simultaneous streams |
* @num_sdp_stream_sinks: Number of stream sinks |
* @available_pbn: Available bandwidth for this port. |
* @next: link to next port on this branch device |
* @mstb: branch device attach below this port |
* @aux: i2c aux transport to talk to device connected to this port. |
* @parent: branch device parent of this port |
* @vcpi: Virtual Channel Payload info for this port. |
* @connector: DRM connector this port is connected to. |
* @mgr: topology manager this port lives under. |
* |
* This structure represents an MST port endpoint on a device somewhere |
* in the MST topology. |
*/ |
struct drm_dp_mst_port { |
struct kref kref; |
/* if dpcd 1.2 device is on this port - its GUID info */ |
bool guid_valid; |
u8 guid[16]; |
u8 port_num; |
bool input; |
bool mcs; |
bool ddps; |
u8 pdt; |
bool ldps; |
u8 dpcd_rev; |
u8 num_sdp_streams; |
u8 num_sdp_stream_sinks; |
uint16_t available_pbn; |
struct list_head next; |
struct drm_dp_mst_branch *mstb; /* pointer to an mstb if this port has one */ |
struct drm_dp_aux aux; /* i2c bus for this port? */ |
struct drm_dp_mst_branch *parent; |
struct drm_dp_vcpi vcpi; |
struct drm_connector *connector; |
struct drm_dp_mst_topology_mgr *mgr; |
}; |
/** |
* struct drm_dp_mst_branch - MST branch device. |
* @kref: reference count for this port. |
* @rad: Relative Address to talk to this branch device. |
* @lct: Link count total to talk to this branch device. |
* @num_ports: number of ports on the branch. |
* @msg_slots: one bit per transmitted msg slot. |
* @ports: linked list of ports on this branch. |
* @port_parent: pointer to the port parent, NULL if toplevel. |
* @mgr: topology manager for this branch device. |
* @tx_slots: transmission slots for this device. |
* @last_seqno: last sequence number used to talk to this. |
* @link_address_sent: if a link address message has been sent to this device yet. |
* |
* This structure represents an MST branch device, there is one |
* primary branch device at the root, along with any others connected |
* to downstream ports |
*/ |
struct drm_dp_mst_branch { |
struct kref kref; |
u8 rad[8]; |
u8 lct; |
int num_ports; |
int msg_slots; |
struct list_head ports; |
/* list of tx ops queue for this port */ |
struct drm_dp_mst_port *port_parent; |
struct drm_dp_mst_topology_mgr *mgr; |
/* slots are protected by mstb->mgr->qlock */ |
struct drm_dp_sideband_msg_tx *tx_slots[2]; |
int last_seqno; |
bool link_address_sent; |
}; |
/* sideband msg header - not bit struct */ |
struct drm_dp_sideband_msg_hdr { |
u8 lct; |
u8 lcr; |
u8 rad[8]; |
bool broadcast; |
bool path_msg; |
u8 msg_len; |
bool somt; |
bool eomt; |
bool seqno; |
}; |
struct drm_dp_nak_reply { |
u8 guid[16]; |
u8 reason; |
u8 nak_data; |
}; |
struct drm_dp_link_address_ack_reply { |
u8 guid[16]; |
u8 nports; |
struct drm_dp_link_addr_reply_port { |
bool input_port; |
u8 peer_device_type; |
u8 port_number; |
bool mcs; |
bool ddps; |
bool legacy_device_plug_status; |
u8 dpcd_revision; |
u8 peer_guid[16]; |
u8 num_sdp_streams; |
u8 num_sdp_stream_sinks; |
} ports[16]; |
}; |
struct drm_dp_remote_dpcd_read_ack_reply { |
u8 port_number; |
u8 num_bytes; |
u8 bytes[255]; |
}; |
struct drm_dp_remote_dpcd_write_ack_reply { |
u8 port_number; |
}; |
struct drm_dp_remote_dpcd_write_nak_reply { |
u8 port_number; |
u8 reason; |
u8 bytes_written_before_failure; |
}; |
struct drm_dp_remote_i2c_read_ack_reply { |
u8 port_number; |
u8 num_bytes; |
u8 bytes[255]; |
}; |
struct drm_dp_remote_i2c_read_nak_reply { |
u8 port_number; |
u8 nak_reason; |
u8 i2c_nak_transaction; |
}; |
struct drm_dp_remote_i2c_write_ack_reply { |
u8 port_number; |
}; |
struct drm_dp_sideband_msg_rx { |
u8 chunk[48]; |
u8 msg[256]; |
u8 curchunk_len; |
u8 curchunk_idx; /* chunk we are parsing now */ |
u8 curchunk_hdrlen; |
u8 curlen; /* total length of the msg */ |
bool have_somt; |
bool have_eomt; |
struct drm_dp_sideband_msg_hdr initial_hdr; |
}; |
struct drm_dp_allocate_payload { |
u8 port_number; |
u8 number_sdp_streams; |
u8 vcpi; |
u16 pbn; |
u8 sdp_stream_sink[8]; |
}; |
struct drm_dp_allocate_payload_ack_reply { |
u8 port_number; |
u8 vcpi; |
u16 allocated_pbn; |
}; |
struct drm_dp_connection_status_notify { |
u8 guid[16]; |
u8 port_number; |
bool legacy_device_plug_status; |
bool displayport_device_plug_status; |
bool message_capability_status; |
bool input_port; |
u8 peer_device_type; |
}; |
struct drm_dp_remote_dpcd_read { |
u8 port_number; |
u32 dpcd_address; |
u8 num_bytes; |
}; |
struct drm_dp_remote_dpcd_write { |
u8 port_number; |
u32 dpcd_address; |
u8 num_bytes; |
u8 *bytes; |
}; |
struct drm_dp_remote_i2c_read { |
u8 num_transactions; |
u8 port_number; |
struct { |
u8 i2c_dev_id; |
u8 num_bytes; |
u8 *bytes; |
u8 no_stop_bit; |
u8 i2c_transaction_delay; |
} transactions[4]; |
u8 read_i2c_device_id; |
u8 num_bytes_read; |
}; |
struct drm_dp_remote_i2c_write { |
u8 port_number; |
u8 write_i2c_device_id; |
u8 num_bytes; |
u8 *bytes; |
}; |
/* this covers ENUM_RESOURCES, POWER_DOWN_PHY, POWER_UP_PHY */ |
struct drm_dp_port_number_req { |
u8 port_number; |
}; |
struct drm_dp_enum_path_resources_ack_reply { |
u8 port_number; |
u16 full_payload_bw_number; |
u16 avail_payload_bw_number; |
}; |
/* covers POWER_DOWN_PHY, POWER_UP_PHY */ |
struct drm_dp_port_number_rep { |
u8 port_number; |
}; |
struct drm_dp_query_payload { |
u8 port_number; |
u8 vcpi; |
}; |
struct drm_dp_resource_status_notify { |
u8 port_number; |
u8 guid[16]; |
u16 available_pbn; |
}; |
struct drm_dp_query_payload_ack_reply { |
u8 port_number; |
u8 allocated_pbn; |
}; |
struct drm_dp_sideband_msg_req_body { |
u8 req_type; |
union ack_req { |
struct drm_dp_connection_status_notify conn_stat; |
struct drm_dp_port_number_req port_num; |
struct drm_dp_resource_status_notify resource_stat; |
struct drm_dp_query_payload query_payload; |
struct drm_dp_allocate_payload allocate_payload; |
struct drm_dp_remote_dpcd_read dpcd_read; |
struct drm_dp_remote_dpcd_write dpcd_write; |
struct drm_dp_remote_i2c_read i2c_read; |
struct drm_dp_remote_i2c_write i2c_write; |
} u; |
}; |
struct drm_dp_sideband_msg_reply_body { |
u8 reply_type; |
u8 req_type; |
union ack_replies { |
struct drm_dp_nak_reply nak; |
struct drm_dp_link_address_ack_reply link_addr; |
struct drm_dp_port_number_rep port_number; |
struct drm_dp_enum_path_resources_ack_reply path_resources; |
struct drm_dp_allocate_payload_ack_reply allocate_payload; |
struct drm_dp_query_payload_ack_reply query_payload; |
struct drm_dp_remote_dpcd_read_ack_reply remote_dpcd_read_ack; |
struct drm_dp_remote_dpcd_write_ack_reply remote_dpcd_write_ack; |
struct drm_dp_remote_dpcd_write_nak_reply remote_dpcd_write_nack; |
struct drm_dp_remote_i2c_read_ack_reply remote_i2c_read_ack; |
struct drm_dp_remote_i2c_read_nak_reply remote_i2c_read_nack; |
struct drm_dp_remote_i2c_write_ack_reply remote_i2c_write_ack; |
} u; |
}; |
/* msg is queued to be put into a slot */ |
#define DRM_DP_SIDEBAND_TX_QUEUED 0 |
/* msg has started transmitting on a slot - still on msgq */ |
#define DRM_DP_SIDEBAND_TX_START_SEND 1 |
/* msg has finished transmitting on a slot - removed from msgq only in slot */ |
#define DRM_DP_SIDEBAND_TX_SENT 2 |
/* msg has received a response - removed from slot */ |
#define DRM_DP_SIDEBAND_TX_RX 3 |
#define DRM_DP_SIDEBAND_TX_TIMEOUT 4 |
struct drm_dp_sideband_msg_tx { |
u8 msg[256]; |
u8 chunk[48]; |
u8 cur_offset; |
u8 cur_len; |
struct drm_dp_mst_branch *dst; |
struct list_head next; |
int seqno; |
int state; |
bool path_msg; |
struct drm_dp_sideband_msg_reply_body reply; |
}; |
/* sideband msg handler */ |
struct drm_dp_mst_topology_mgr; |
struct drm_dp_mst_topology_cbs { |
/* create a connector for a port */ |
struct drm_connector *(*add_connector)(struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port, char *path); |
void (*destroy_connector)(struct drm_dp_mst_topology_mgr *mgr, |
struct drm_connector *connector); |
void (*hotplug)(struct drm_dp_mst_topology_mgr *mgr); |
}; |
#define DP_MAX_PAYLOAD (sizeof(unsigned long) * 8) |
#define DP_PAYLOAD_LOCAL 1 |
#define DP_PAYLOAD_REMOTE 2 |
#define DP_PAYLOAD_DELETE_LOCAL 3 |
struct drm_dp_payload { |
int payload_state; |
int start_slot; |
int num_slots; |
}; |
/** |
* struct drm_dp_mst_topology_mgr - DisplayPort MST manager |
* @dev: device pointer for adding i2c devices etc. |
* @cbs: callbacks for connector addition and destruction. |
* @max_dpcd_transaction_bytes - maximum number of bytes to read/write in one go. |
* @aux: aux channel for the DP connector. |
* @max_payloads: maximum number of payloads the GPU can generate. |
* @conn_base_id: DRM connector ID this mgr is connected to. |
* @down_rep_recv: msg receiver state for down replies. |
* @up_req_recv: msg receiver state for up requests. |
* @lock: protects mst state, primary, guid, dpcd. |
* @mst_state: if this manager is enabled for an MST capable port. |
* @mst_primary: pointer to the primary branch device. |
* @guid_valid: GUID valid for the primary branch device. |
* @guid: GUID for primary port. |
* @dpcd: cache of DPCD for primary port. |
* @pbn_div: PBN to slots divisor. |
* |
* This struct represents the toplevel displayport MST topology manager. |
* There should be one instance of this for every MST capable DP connector |
* on the GPU. |
*/ |
struct drm_dp_mst_topology_mgr { |
struct device *dev; |
struct drm_dp_mst_topology_cbs *cbs; |
int max_dpcd_transaction_bytes; |
struct drm_dp_aux *aux; /* auxch for this topology mgr to use */ |
int max_payloads; |
int conn_base_id; |
/* only ever accessed from the workqueue - which should be serialised */ |
struct drm_dp_sideband_msg_rx down_rep_recv; |
struct drm_dp_sideband_msg_rx up_req_recv; |
/* pointer to info about the initial MST device */ |
struct mutex lock; /* protects mst_state + primary + guid + dpcd */ |
bool mst_state; |
struct drm_dp_mst_branch *mst_primary; |
/* primary MST device GUID */ |
bool guid_valid; |
u8 guid[16]; |
u8 dpcd[DP_RECEIVER_CAP_SIZE]; |
u8 sink_count; |
int pbn_div; |
int total_slots; |
int avail_slots; |
int total_pbn; |
/* messages to be transmitted */ |
/* qlock protects the upq/downq and in_progress, |
the mstb tx_slots and txmsg->state once they are queued */ |
struct mutex qlock; |
struct list_head tx_msg_downq; |
struct list_head tx_msg_upq; |
bool tx_down_in_progress; |
bool tx_up_in_progress; |
/* payload info + lock for it */ |
struct mutex payload_lock; |
struct drm_dp_vcpi **proposed_vcpis; |
struct drm_dp_payload *payloads; |
unsigned long payload_mask; |
wait_queue_head_t tx_waitq; |
struct work_struct work; |
struct work_struct tx_work; |
}; |
int drm_dp_mst_topology_mgr_init(struct drm_dp_mst_topology_mgr *mgr, struct device *dev, struct drm_dp_aux *aux, int max_dpcd_transaction_bytes, int max_payloads, int conn_base_id); |
void drm_dp_mst_topology_mgr_destroy(struct drm_dp_mst_topology_mgr *mgr); |
int drm_dp_mst_topology_mgr_set_mst(struct drm_dp_mst_topology_mgr *mgr, bool mst_state); |
int drm_dp_mst_hpd_irq(struct drm_dp_mst_topology_mgr *mgr, u8 *esi, bool *handled); |
enum drm_connector_status drm_dp_mst_detect_port(struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port); |
struct edid *drm_dp_mst_get_edid(struct drm_connector *connector, struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port); |
int drm_dp_calc_pbn_mode(int clock, int bpp); |
bool drm_dp_mst_allocate_vcpi(struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port, int pbn, int *slots); |
void drm_dp_mst_reset_vcpi_slots(struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port); |
void drm_dp_mst_deallocate_vcpi(struct drm_dp_mst_topology_mgr *mgr, |
struct drm_dp_mst_port *port); |
int drm_dp_find_vcpi_slots(struct drm_dp_mst_topology_mgr *mgr, |
int pbn); |
int drm_dp_update_payload_part1(struct drm_dp_mst_topology_mgr *mgr); |
int drm_dp_update_payload_part2(struct drm_dp_mst_topology_mgr *mgr); |
int drm_dp_check_act_status(struct drm_dp_mst_topology_mgr *mgr); |
void drm_dp_mst_dump_topology(struct seq_file *m, |
struct drm_dp_mst_topology_mgr *mgr); |
void drm_dp_mst_topology_mgr_suspend(struct drm_dp_mst_topology_mgr *mgr); |
int drm_dp_mst_topology_mgr_resume(struct drm_dp_mst_topology_mgr *mgr); |
#endif |
/drivers/include/drm/drm_edid.h |
---|
202,6 → 202,11 |
#define DRM_EDID_FEATURE_PM_SUSPEND (1 << 6) |
#define DRM_EDID_FEATURE_PM_STANDBY (1 << 7) |
#define DRM_EDID_HDMI_DC_48 (1 << 6) |
#define DRM_EDID_HDMI_DC_36 (1 << 5) |
#define DRM_EDID_HDMI_DC_30 (1 << 4) |
#define DRM_EDID_HDMI_DC_Y444 (1 << 3) |
struct edid { |
u8 header[8]; |
/* Vendor & product info */ |
/drivers/include/drm/drm_fb_helper.h |
---|
32,6 → 32,7 |
struct drm_fb_helper; |
#include <linux/kgdb.h> |
struct drm_fb_helper_crtc { |
struct drm_mode_set mode_set; |
54,7 → 55,7 |
* save the current lut when force-restoring the fbdev for e.g. |
* kdbg. |
* @fb_probe: Driver callback to allocate and initialize the fbdev info |
* structure. Futhermore it also needs to allocate the drm |
* structure. Furthermore it also needs to allocate the drm |
* framebuffer used to back the fbdev. |
* @initial_config: Setup an initial fbdev display configuration |
* |
85,8 → 86,9 |
int crtc_count; |
struct drm_fb_helper_crtc *crtc_info; |
int connector_count; |
int connector_info_alloc_count; |
struct drm_fb_helper_connector **connector_info; |
struct drm_fb_helper_funcs *funcs; |
const struct drm_fb_helper_funcs *funcs; |
struct fb_info *fbdev; |
u32 pseudo_palette[17]; |
struct list_head kernel_fb_list; |
96,6 → 98,8 |
bool delayed_hotplug; |
}; |
void drm_fb_helper_prepare(struct drm_device *dev, struct drm_fb_helper *helper, |
const struct drm_fb_helper_funcs *funcs); |
int drm_fb_helper_init(struct drm_device *dev, |
struct drm_fb_helper *helper, int crtc_count, |
int max_conn); |
107,7 → 111,7 |
int drm_fb_helper_check_var(struct fb_var_screeninfo *var, |
struct fb_info *info); |
bool drm_fb_helper_restore_fbdev_mode(struct drm_fb_helper *fb_helper); |
bool drm_fb_helper_restore_fbdev_mode_unlocked(struct drm_fb_helper *fb_helper); |
void drm_fb_helper_fill_var(struct fb_info *info, struct drm_fb_helper *fb_helper, |
uint32_t fb_width, uint32_t fb_height); |
void drm_fb_helper_fill_fix(struct fb_info *info, uint32_t pitch, |
120,5 → 124,14 |
int drm_fb_helper_single_add_all_connectors(struct drm_fb_helper *fb_helper); |
int drm_fb_helper_debug_enter(struct fb_info *info); |
int drm_fb_helper_debug_leave(struct fb_info *info); |
struct drm_display_mode * |
drm_has_preferred_mode(struct drm_fb_helper_connector *fb_connector, |
int width, int height); |
struct drm_display_mode * |
drm_pick_cmdline_mode(struct drm_fb_helper_connector *fb_helper_conn, |
int width, int height); |
int drm_fb_helper_add_one_connector(struct drm_fb_helper *fb_helper, struct drm_connector *connector); |
int drm_fb_helper_remove_one_connector(struct drm_fb_helper *fb_helper, |
struct drm_connector *connector); |
#endif |
/drivers/include/drm/drm_mm.h |
---|
47,8 → 47,17 |
enum drm_mm_search_flags { |
DRM_MM_SEARCH_DEFAULT = 0, |
DRM_MM_SEARCH_BEST = 1 << 0, |
DRM_MM_SEARCH_BELOW = 1 << 1, |
}; |
enum drm_mm_allocator_flags { |
DRM_MM_CREATE_DEFAULT = 0, |
DRM_MM_CREATE_TOP = 1 << 0, |
}; |
#define DRM_MM_BOTTOMUP DRM_MM_SEARCH_DEFAULT, DRM_MM_CREATE_DEFAULT |
#define DRM_MM_TOPDOWN DRM_MM_SEARCH_BELOW, DRM_MM_CREATE_TOP |
struct drm_mm_node { |
struct list_head node_list; |
struct list_head hole_stack; |
85,11 → 94,31 |
unsigned long *start, unsigned long *end); |
}; |
/** |
* drm_mm_node_allocated - checks whether a node is allocated |
* @node: drm_mm_node to check |
* |
* Drivers should use this helpers for proper encapusulation of drm_mm |
* internals. |
* |
* Returns: |
* True if the @node is allocated. |
*/ |
static inline bool drm_mm_node_allocated(struct drm_mm_node *node) |
{ |
return node->allocated; |
} |
/** |
* drm_mm_initialized - checks whether an allocator is initialized |
* @mm: drm_mm to check |
* |
* Drivers should use this helpers for proper encapusulation of drm_mm |
* internals. |
* |
* Returns: |
* True if the @mm is initialized. |
*/ |
static inline bool drm_mm_initialized(struct drm_mm *mm) |
{ |
return mm->hole_stack.next; |
100,6 → 129,17 |
return hole_node->start + hole_node->size; |
} |
/** |
* drm_mm_hole_node_start - computes the start of the hole following @node |
* @hole_node: drm_mm_node which implicitly tracks the following hole |
* |
* This is useful for driver-sepific debug dumpers. Otherwise drivers should not |
* inspect holes themselves. Drivers must check first whether a hole indeed |
* follows by looking at node->hole_follows. |
* |
* Returns: |
* Start of the subsequent hole. |
*/ |
static inline unsigned long drm_mm_hole_node_start(struct drm_mm_node *hole_node) |
{ |
BUG_ON(!hole_node->hole_follows); |
112,18 → 152,52 |
struct drm_mm_node, node_list)->start; |
} |
/** |
* drm_mm_hole_node_end - computes the end of the hole following @node |
* @hole_node: drm_mm_node which implicitly tracks the following hole |
* |
* This is useful for driver-sepific debug dumpers. Otherwise drivers should not |
* inspect holes themselves. Drivers must check first whether a hole indeed |
* follows by looking at node->hole_follows. |
* |
* Returns: |
* End of the subsequent hole. |
*/ |
static inline unsigned long drm_mm_hole_node_end(struct drm_mm_node *hole_node) |
{ |
return __drm_mm_hole_node_end(hole_node); |
} |
/** |
* drm_mm_for_each_node - iterator to walk over all allocated nodes |
* @entry: drm_mm_node structure to assign to in each iteration step |
* @mm: drm_mm allocator to walk |
* |
* This iterator walks over all nodes in the range allocator. It is implemented |
* with list_for_each, so not save against removal of elements. |
*/ |
#define drm_mm_for_each_node(entry, mm) list_for_each_entry(entry, \ |
&(mm)->head_node.node_list, \ |
node_list) |
/* Note that we need to unroll list_for_each_entry in order to inline |
* setting hole_start and hole_end on each iteration and keep the |
* macro sane. |
/** |
* drm_mm_for_each_hole - iterator to walk over all holes |
* @entry: drm_mm_node used internally to track progress |
* @mm: drm_mm allocator to walk |
* @hole_start: ulong variable to assign the hole start to on each iteration |
* @hole_end: ulong variable to assign the hole end to on each iteration |
* |
* This iterator walks over all holes in the range allocator. It is implemented |
* with list_for_each, so not save against removal of elements. @entry is used |
* internally and will not reflect a real drm_mm_node for the very first hole. |
* Hence users of this iterator may not access it. |
* |
* Implementation Note: |
* We need to inline list_for_each_entry in order to be able to set hole_start |
* and hole_end on each iteration while keeping the macro sane. |
* |
* The __drm_mm_for_each_hole version is similar, but with added support for |
* going backwards. |
*/ |
#define drm_mm_for_each_hole(entry, mm, hole_start, hole_end) \ |
for (entry = list_entry((mm)->hole_stack.next, struct drm_mm_node, hole_stack); \ |
133,17 → 207,42 |
1 : 0; \ |
entry = list_entry(entry->hole_stack.next, struct drm_mm_node, hole_stack)) |
#define __drm_mm_for_each_hole(entry, mm, hole_start, hole_end, backwards) \ |
for (entry = list_entry((backwards) ? (mm)->hole_stack.prev : (mm)->hole_stack.next, struct drm_mm_node, hole_stack); \ |
&entry->hole_stack != &(mm)->hole_stack ? \ |
hole_start = drm_mm_hole_node_start(entry), \ |
hole_end = drm_mm_hole_node_end(entry), \ |
1 : 0; \ |
entry = list_entry((backwards) ? entry->hole_stack.prev : entry->hole_stack.next, struct drm_mm_node, hole_stack)) |
/* |
* Basic range manager support (drm_mm.c) |
*/ |
extern int drm_mm_reserve_node(struct drm_mm *mm, struct drm_mm_node *node); |
int drm_mm_reserve_node(struct drm_mm *mm, struct drm_mm_node *node); |
extern int drm_mm_insert_node_generic(struct drm_mm *mm, |
int drm_mm_insert_node_generic(struct drm_mm *mm, |
struct drm_mm_node *node, |
unsigned long size, |
unsigned alignment, |
unsigned long color, |
enum drm_mm_search_flags flags); |
enum drm_mm_search_flags sflags, |
enum drm_mm_allocator_flags aflags); |
/** |
* drm_mm_insert_node - search for space and insert @node |
* @mm: drm_mm to allocate from |
* @node: preallocate node to insert |
* @size: size of the allocation |
* @alignment: alignment of the allocation |
* @flags: flags to fine-tune the allocation |
* |
* This is a simplified version of drm_mm_insert_node_generic() with @color set |
* to 0. |
* |
* The preallocated node must be cleared to 0. |
* |
* Returns: |
* 0 on success, -ENOSPC if there's no suitable hole. |
*/ |
static inline int drm_mm_insert_node(struct drm_mm *mm, |
struct drm_mm_node *node, |
unsigned long size, |
150,10 → 249,11 |
unsigned alignment, |
enum drm_mm_search_flags flags) |
{ |
return drm_mm_insert_node_generic(mm, node, size, alignment, 0, flags); |
return drm_mm_insert_node_generic(mm, node, size, alignment, 0, flags, |
DRM_MM_CREATE_DEFAULT); |
} |
extern int drm_mm_insert_node_in_range_generic(struct drm_mm *mm, |
int drm_mm_insert_node_in_range_generic(struct drm_mm *mm, |
struct drm_mm_node *node, |
unsigned long size, |
unsigned alignment, |
160,7 → 260,26 |
unsigned long color, |
unsigned long start, |
unsigned long end, |
enum drm_mm_search_flags flags); |
enum drm_mm_search_flags sflags, |
enum drm_mm_allocator_flags aflags); |
/** |
* drm_mm_insert_node_in_range - ranged search for space and insert @node |
* @mm: drm_mm to allocate from |
* @node: preallocate node to insert |
* @size: size of the allocation |
* @alignment: alignment of the allocation |
* @start: start of the allowed range for this node |
* @end: end of the allowed range for this node |
* @flags: flags to fine-tune the allocation |
* |
* This is a simplified version of drm_mm_insert_node_in_range_generic() with |
* @color set to 0. |
* |
* The preallocated node must be cleared to 0. |
* |
* Returns: |
* 0 on success, -ENOSPC if there's no suitable hole. |
*/ |
static inline int drm_mm_insert_node_in_range(struct drm_mm *mm, |
struct drm_mm_node *node, |
unsigned long size, |
170,16 → 289,17 |
enum drm_mm_search_flags flags) |
{ |
return drm_mm_insert_node_in_range_generic(mm, node, size, alignment, |
0, start, end, flags); |
0, start, end, flags, |
DRM_MM_CREATE_DEFAULT); |
} |
extern void drm_mm_remove_node(struct drm_mm_node *node); |
extern void drm_mm_replace_node(struct drm_mm_node *old, struct drm_mm_node *new); |
extern void drm_mm_init(struct drm_mm *mm, |
void drm_mm_remove_node(struct drm_mm_node *node); |
void drm_mm_replace_node(struct drm_mm_node *old, struct drm_mm_node *new); |
void drm_mm_init(struct drm_mm *mm, |
unsigned long start, |
unsigned long size); |
extern void drm_mm_takedown(struct drm_mm *mm); |
extern int drm_mm_clean(struct drm_mm *mm); |
void drm_mm_takedown(struct drm_mm *mm); |
bool drm_mm_clean(struct drm_mm *mm); |
void drm_mm_init_scan(struct drm_mm *mm, |
unsigned long size, |
191,10 → 311,10 |
unsigned long color, |
unsigned long start, |
unsigned long end); |
int drm_mm_scan_add_block(struct drm_mm_node *node); |
int drm_mm_scan_remove_block(struct drm_mm_node *node); |
bool drm_mm_scan_add_block(struct drm_mm_node *node); |
bool drm_mm_scan_remove_block(struct drm_mm_node *node); |
extern void drm_mm_debug_table(struct drm_mm *mm, const char *prefix); |
void drm_mm_debug_table(struct drm_mm *mm, const char *prefix); |
#ifdef CONFIG_DEBUG_FS |
int drm_mm_dump_table(struct seq_file *m, struct drm_mm *mm); |
#endif |
/drivers/include/drm/drm_modes.h |
---|
0,0 → 1,237 |
/* |
* Copyright © 2006 Keith Packard |
* Copyright © 2007-2008 Dave Airlie |
* Copyright © 2007-2008 Intel Corporation |
* Jesse Barnes <jesse.barnes@intel.com> |
* Copyright © 2014 Intel Corporation |
* Daniel Vetter <daniel.vetter@ffwll.ch> |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included in |
* all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR |
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
* OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef __DRM_MODES_H__ |
#define __DRM_MODES_H__ |
/* |
* Note on terminology: here, for brevity and convenience, we refer to connector |
* control chips as 'CRTCs'. They can control any type of connector, VGA, LVDS, |
* DVI, etc. And 'screen' refers to the whole of the visible display, which |
* may span multiple monitors (and therefore multiple CRTC and connector |
* structures). |
*/ |
enum drm_mode_status { |
MODE_OK = 0, /* Mode OK */ |
MODE_HSYNC, /* hsync out of range */ |
MODE_VSYNC, /* vsync out of range */ |
MODE_H_ILLEGAL, /* mode has illegal horizontal timings */ |
MODE_V_ILLEGAL, /* mode has illegal horizontal timings */ |
MODE_BAD_WIDTH, /* requires an unsupported linepitch */ |
MODE_NOMODE, /* no mode with a matching name */ |
MODE_NO_INTERLACE, /* interlaced mode not supported */ |
MODE_NO_DBLESCAN, /* doublescan mode not supported */ |
MODE_NO_VSCAN, /* multiscan mode not supported */ |
MODE_MEM, /* insufficient video memory */ |
MODE_VIRTUAL_X, /* mode width too large for specified virtual size */ |
MODE_VIRTUAL_Y, /* mode height too large for specified virtual size */ |
MODE_MEM_VIRT, /* insufficient video memory given virtual size */ |
MODE_NOCLOCK, /* no fixed clock available */ |
MODE_CLOCK_HIGH, /* clock required is too high */ |
MODE_CLOCK_LOW, /* clock required is too low */ |
MODE_CLOCK_RANGE, /* clock/mode isn't in a ClockRange */ |
MODE_BAD_HVALUE, /* horizontal timing was out of range */ |
MODE_BAD_VVALUE, /* vertical timing was out of range */ |
MODE_BAD_VSCAN, /* VScan value out of range */ |
MODE_HSYNC_NARROW, /* horizontal sync too narrow */ |
MODE_HSYNC_WIDE, /* horizontal sync too wide */ |
MODE_HBLANK_NARROW, /* horizontal blanking too narrow */ |
MODE_HBLANK_WIDE, /* horizontal blanking too wide */ |
MODE_VSYNC_NARROW, /* vertical sync too narrow */ |
MODE_VSYNC_WIDE, /* vertical sync too wide */ |
MODE_VBLANK_NARROW, /* vertical blanking too narrow */ |
MODE_VBLANK_WIDE, /* vertical blanking too wide */ |
MODE_PANEL, /* exceeds panel dimensions */ |
MODE_INTERLACE_WIDTH, /* width too large for interlaced mode */ |
MODE_ONE_WIDTH, /* only one width is supported */ |
MODE_ONE_HEIGHT, /* only one height is supported */ |
MODE_ONE_SIZE, /* only one resolution is supported */ |
MODE_NO_REDUCED, /* monitor doesn't accept reduced blanking */ |
MODE_NO_STEREO, /* stereo modes not supported */ |
MODE_UNVERIFIED = -3, /* mode needs to reverified */ |
MODE_BAD = -2, /* unspecified reason */ |
MODE_ERROR = -1 /* error condition */ |
}; |
#define DRM_MODE_TYPE_CLOCK_CRTC_C (DRM_MODE_TYPE_CLOCK_C | \ |
DRM_MODE_TYPE_CRTC_C) |
#define DRM_MODE(nm, t, c, hd, hss, hse, ht, hsk, vd, vss, vse, vt, vs, f) \ |
.name = nm, .status = 0, .type = (t), .clock = (c), \ |
.hdisplay = (hd), .hsync_start = (hss), .hsync_end = (hse), \ |
.htotal = (ht), .hskew = (hsk), .vdisplay = (vd), \ |
.vsync_start = (vss), .vsync_end = (vse), .vtotal = (vt), \ |
.vscan = (vs), .flags = (f), \ |
.base.type = DRM_MODE_OBJECT_MODE |
#define CRTC_INTERLACE_HALVE_V (1 << 0) /* halve V values for interlacing */ |
#define CRTC_STEREO_DOUBLE (1 << 1) /* adjust timings for stereo modes */ |
#define DRM_MODE_FLAG_3D_MAX DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF |
struct drm_display_mode { |
/* Header */ |
struct list_head head; |
struct drm_mode_object base; |
char name[DRM_DISPLAY_MODE_LEN]; |
enum drm_mode_status status; |
unsigned int type; |
/* Proposed mode values */ |
int clock; /* in kHz */ |
int hdisplay; |
int hsync_start; |
int hsync_end; |
int htotal; |
int hskew; |
int vdisplay; |
int vsync_start; |
int vsync_end; |
int vtotal; |
int vscan; |
unsigned int flags; |
/* Addressable image size (may be 0 for projectors, etc.) */ |
int width_mm; |
int height_mm; |
/* Actual mode we give to hw */ |
int crtc_clock; /* in KHz */ |
int crtc_hdisplay; |
int crtc_hblank_start; |
int crtc_hblank_end; |
int crtc_hsync_start; |
int crtc_hsync_end; |
int crtc_htotal; |
int crtc_hskew; |
int crtc_vdisplay; |
int crtc_vblank_start; |
int crtc_vblank_end; |
int crtc_vsync_start; |
int crtc_vsync_end; |
int crtc_vtotal; |
/* Driver private mode info */ |
int *private; |
int private_flags; |
int vrefresh; /* in Hz */ |
int hsync; /* in kHz */ |
enum hdmi_picture_aspect picture_aspect_ratio; |
}; |
/* mode specified on the command line */ |
struct drm_cmdline_mode { |
bool specified; |
bool refresh_specified; |
bool bpp_specified; |
int xres, yres; |
int bpp; |
int refresh; |
bool rb; |
bool interlace; |
bool cvt; |
bool margins; |
enum drm_connector_force force; |
}; |
/** |
* drm_mode_is_stereo - check for stereo mode flags |
* @mode: drm_display_mode to check |
* |
* Returns: |
* True if the mode is one of the stereo modes (like side-by-side), false if |
* not. |
*/ |
static inline bool drm_mode_is_stereo(const struct drm_display_mode *mode) |
{ |
return mode->flags & DRM_MODE_FLAG_3D_MASK; |
} |
struct drm_connector; |
struct drm_cmdline_mode; |
struct drm_display_mode *drm_mode_create(struct drm_device *dev); |
void drm_mode_destroy(struct drm_device *dev, struct drm_display_mode *mode); |
void drm_mode_probed_add(struct drm_connector *connector, struct drm_display_mode *mode); |
void drm_mode_debug_printmodeline(const struct drm_display_mode *mode); |
struct drm_display_mode *drm_cvt_mode(struct drm_device *dev, |
int hdisplay, int vdisplay, int vrefresh, |
bool reduced, bool interlaced, |
bool margins); |
struct drm_display_mode *drm_gtf_mode(struct drm_device *dev, |
int hdisplay, int vdisplay, int vrefresh, |
bool interlaced, int margins); |
struct drm_display_mode *drm_gtf_mode_complex(struct drm_device *dev, |
int hdisplay, int vdisplay, |
int vrefresh, bool interlaced, |
int margins, |
int GTF_M, int GTF_2C, |
int GTF_K, int GTF_2J); |
void drm_display_mode_from_videomode(const struct videomode *vm, |
struct drm_display_mode *dmode); |
int of_get_drm_display_mode(struct device_node *np, |
struct drm_display_mode *dmode, |
int index); |
void drm_mode_set_name(struct drm_display_mode *mode); |
int drm_mode_hsync(const struct drm_display_mode *mode); |
int drm_mode_vrefresh(const struct drm_display_mode *mode); |
void drm_mode_set_crtcinfo(struct drm_display_mode *p, |
int adjust_flags); |
void drm_mode_copy(struct drm_display_mode *dst, |
const struct drm_display_mode *src); |
struct drm_display_mode *drm_mode_duplicate(struct drm_device *dev, |
const struct drm_display_mode *mode); |
bool drm_mode_equal(const struct drm_display_mode *mode1, |
const struct drm_display_mode *mode2); |
bool drm_mode_equal_no_clocks_no_stereo(const struct drm_display_mode *mode1, |
const struct drm_display_mode *mode2); |
/* for use by the crtc helper probe functions */ |
void drm_mode_validate_size(struct drm_device *dev, |
struct list_head *mode_list, |
int maxX, int maxY); |
void drm_mode_prune_invalid(struct drm_device *dev, |
struct list_head *mode_list, bool verbose); |
void drm_mode_sort(struct list_head *mode_list); |
void drm_mode_connector_list_update(struct drm_connector *connector, bool merge_type_bits); |
/* parsing cmdline modes */ |
bool |
drm_mode_parse_command_line_for_connector(const char *mode_option, |
struct drm_connector *connector, |
struct drm_cmdline_mode *mode); |
struct drm_display_mode * |
drm_mode_create_from_cmdline_mode(struct drm_device *dev, |
struct drm_cmdline_mode *cmd); |
#endif /* __DRM_MODES_H__ */ |
/drivers/include/drm/drm_modeset_lock.h |
---|
0,0 → 1,126 |
/* |
* Copyright (C) 2014 Red Hat |
* Author: Rob Clark <robdclark@gmail.com> |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included in |
* all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR |
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
* OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef DRM_MODESET_LOCK_H_ |
#define DRM_MODESET_LOCK_H_ |
#include <linux/ww_mutex.h> |
struct drm_modeset_lock; |
/** |
* drm_modeset_acquire_ctx - locking context (see ww_acquire_ctx) |
* @ww_ctx: base acquire ctx |
* @contended: used internally for -EDEADLK handling |
* @locked: list of held locks |
* |
* Each thread competing for a set of locks must use one acquire |
* ctx. And if any lock fxn returns -EDEADLK, it must backoff and |
* retry. |
*/ |
struct drm_modeset_acquire_ctx { |
struct ww_acquire_ctx ww_ctx; |
/** |
* Contended lock: if a lock is contended you should only call |
* drm_modeset_backoff() which drops locks and slow-locks the |
* contended lock. |
*/ |
struct drm_modeset_lock *contended; |
/** |
* list of held locks (drm_modeset_lock) |
*/ |
struct list_head locked; |
}; |
/** |
* drm_modeset_lock - used for locking modeset resources. |
* @mutex: resource locking |
* @head: used to hold it's place on state->locked list when |
* part of an atomic update |
* |
* Used for locking CRTCs and other modeset resources. |
*/ |
struct drm_modeset_lock { |
/** |
* modeset lock |
*/ |
struct ww_mutex mutex; |
/** |
* Resources that are locked as part of an atomic update are added |
* to a list (so we know what to unlock at the end). |
*/ |
struct list_head head; |
}; |
extern struct ww_class crtc_ww_class; |
void drm_modeset_acquire_init(struct drm_modeset_acquire_ctx *ctx, |
uint32_t flags); |
void drm_modeset_acquire_fini(struct drm_modeset_acquire_ctx *ctx); |
void drm_modeset_drop_locks(struct drm_modeset_acquire_ctx *ctx); |
void drm_modeset_backoff(struct drm_modeset_acquire_ctx *ctx); |
int drm_modeset_backoff_interruptible(struct drm_modeset_acquire_ctx *ctx); |
/** |
* drm_modeset_lock_init - initialize lock |
* @lock: lock to init |
*/ |
static inline void drm_modeset_lock_init(struct drm_modeset_lock *lock) |
{ |
ww_mutex_init(&lock->mutex, &crtc_ww_class); |
INIT_LIST_HEAD(&lock->head); |
} |
/** |
* drm_modeset_lock_fini - cleanup lock |
* @lock: lock to cleanup |
*/ |
static inline void drm_modeset_lock_fini(struct drm_modeset_lock *lock) |
{ |
WARN_ON(!list_empty(&lock->head)); |
} |
/** |
* drm_modeset_is_locked - equivalent to mutex_is_locked() |
* @lock: lock to check |
*/ |
static inline bool drm_modeset_is_locked(struct drm_modeset_lock *lock) |
{ |
return ww_mutex_is_locked(&lock->mutex); |
} |
int drm_modeset_lock(struct drm_modeset_lock *lock, |
struct drm_modeset_acquire_ctx *ctx); |
int drm_modeset_lock_interruptible(struct drm_modeset_lock *lock, |
struct drm_modeset_acquire_ctx *ctx); |
void drm_modeset_unlock(struct drm_modeset_lock *lock); |
struct drm_device; |
int drm_modeset_lock_all_crtcs(struct drm_device *dev, |
struct drm_modeset_acquire_ctx *ctx); |
#endif /* DRM_MODESET_LOCK_H_ */ |
/drivers/include/drm/drm_pciids.h |
---|
637,6 → 637,22 |
{0x1002, 0x983d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KABINI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
{0x1002, 0x983e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KABINI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
{0x1002, 0x983f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KABINI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
{0x1002, 0x9850, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_MULLINS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
{0x1002, 0x9851, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_MULLINS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
{0x1002, 0x9852, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_MULLINS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
{0x1002, 0x9853, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_MULLINS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
{0x1002, 0x9854, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_MULLINS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
{0x1002, 0x9855, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_MULLINS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
{0x1002, 0x9856, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_MULLINS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
{0x1002, 0x9857, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_MULLINS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
{0x1002, 0x9858, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_MULLINS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
{0x1002, 0x9859, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_MULLINS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
{0x1002, 0x985A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_MULLINS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
{0x1002, 0x985B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_MULLINS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
{0x1002, 0x985C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_MULLINS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
{0x1002, 0x985D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_MULLINS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
{0x1002, 0x985E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_MULLINS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
{0x1002, 0x985F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_MULLINS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
{0x1002, 0x9900, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
{0x1002, 0x9901, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
{0x1002, 0x9903, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
/drivers/include/drm/drm_plane_helper.h |
---|
0,0 → 1,71 |
/* |
* Copyright (C) 2011-2013 Intel Corporation |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice (including the next |
* paragraph) shall be included in all copies or substantial portions of the |
* Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
* SOFTWARE. |
*/ |
#ifndef DRM_PLANE_HELPER_H |
#define DRM_PLANE_HELPER_H |
#include <drm/drm_rect.h> |
/* |
* Drivers that don't allow primary plane scaling may pass this macro in place |
* of the min/max scale parameters of the update checker function. |
* |
* Due to src being in 16.16 fixed point and dest being in integer pixels, |
* 1<<16 represents no scaling. |
*/ |
#define DRM_PLANE_HELPER_NO_SCALING (1<<16) |
/** |
* DOC: plane helpers |
* |
* Helper functions to assist with creation and handling of CRTC primary |
* planes. |
*/ |
extern int drm_plane_helper_check_update(struct drm_plane *plane, |
struct drm_crtc *crtc, |
struct drm_framebuffer *fb, |
struct drm_rect *src, |
struct drm_rect *dest, |
const struct drm_rect *clip, |
int min_scale, |
int max_scale, |
bool can_position, |
bool can_update_disabled, |
bool *visible); |
extern int drm_primary_helper_update(struct drm_plane *plane, |
struct drm_crtc *crtc, |
struct drm_framebuffer *fb, |
int crtc_x, int crtc_y, |
unsigned int crtc_w, unsigned int crtc_h, |
uint32_t src_x, uint32_t src_y, |
uint32_t src_w, uint32_t src_h); |
extern int drm_primary_helper_disable(struct drm_plane *plane); |
extern void drm_primary_helper_destroy(struct drm_plane *plane); |
extern const struct drm_plane_funcs drm_primary_helper_funcs; |
extern struct drm_plane *drm_primary_helper_create_plane(struct drm_device *dev, |
const uint32_t *formats, |
int num_formats); |
#endif |
/drivers/include/drm/drm_rect.h |
---|
163,5 → 163,11 |
struct drm_rect *dst, |
int min_vscale, int max_vscale); |
void drm_rect_debug_print(const struct drm_rect *r, bool fixed_point); |
void drm_rect_rotate(struct drm_rect *r, |
int width, int height, |
unsigned int rotation); |
void drm_rect_rotate_inv(struct drm_rect *r, |
int width, int height, |
unsigned int rotation); |
#endif |
/drivers/include/drm/drm_vma_manager.h |
---|
221,8 → 221,8 |
* @file_mapping: Address space to unmap @node from |
* |
* Unmap all userspace mappings for a given offset node. The mappings must be |
* associated with the @file_mapping address-space. If no offset exists or |
* the address-space is invalid, nothing is done. |
* associated with the @file_mapping address-space. If no offset exists |
* nothing is done. |
* |
* This call is unlocked. The caller must guarantee that drm_vma_offset_remove() |
* is not called on this node concurrently. |
230,10 → 230,10 |
static inline void drm_vma_node_unmap(struct drm_vma_offset_node *node, |
struct address_space *file_mapping) |
{ |
if (file_mapping && drm_vma_node_has_offset(node)) |
unmap_mapping_range(file_mapping, |
drm_vma_node_offset_addr(node), |
drm_vma_node_size(node) << PAGE_SHIFT, 1); |
// if (drm_vma_node_has_offset(node)) |
// unmap_mapping_range(file_mapping, |
// drm_vma_node_offset_addr(node), |
// drm_vma_node_size(node) << PAGE_SHIFT, 1); |
} |
/** |
/drivers/include/drm/i915_drm.h |
---|
56,6 → 56,12 |
#define I830_GMCH_CTRL 0x52 |
#define I830_GMCH_GMS_MASK 0x70 |
#define I830_GMCH_GMS_LOCAL 0x10 |
#define I830_GMCH_GMS_STOLEN_512 0x20 |
#define I830_GMCH_GMS_STOLEN_1024 0x30 |
#define I830_GMCH_GMS_STOLEN_8192 0x40 |
#define I855_GMCH_GMS_MASK 0xF0 |
#define I855_GMCH_GMS_STOLEN_0M 0x0 |
#define I855_GMCH_GMS_STOLEN_1M (0x1 << 4) |
72,4 → 78,18 |
#define INTEL_GMCH_GMS_STOLEN_224M (0xc << 4) |
#define INTEL_GMCH_GMS_STOLEN_352M (0xd << 4) |
#define I830_DRB3 0x63 |
#define I85X_DRB3 0x43 |
#define I865_TOUD 0xc4 |
#define I830_ESMRAMC 0x91 |
#define I845_ESMRAMC 0x9e |
#define I85X_ESMRAMC 0x61 |
#define TSEG_ENABLE (1 << 0) |
#define I830_TSEG_SIZE_512K (0 << 1) |
#define I830_TSEG_SIZE_1M (1 << 1) |
#define I845_TSEG_SIZE_MASK (3 << 1) |
#define I845_TSEG_SIZE_512K (2 << 1) |
#define I845_TSEG_SIZE_1M (3 << 1) |
#endif /* _I915_DRM_H_ */ |
/drivers/include/drm/i915_pciids.h |
---|
191,8 → 191,8 |
INTEL_VGA_DEVICE(0x0A06, info), /* ULT GT1 mobile */ \ |
INTEL_VGA_DEVICE(0x0A16, info), /* ULT GT2 mobile */ \ |
INTEL_VGA_DEVICE(0x0A26, info), /* ULT GT3 mobile */ \ |
INTEL_VGA_DEVICE(0x0A0E, info), /* ULT GT1 reserved */ \ |
INTEL_VGA_DEVICE(0x0A1E, info), /* ULT GT2 reserved */ \ |
INTEL_VGA_DEVICE(0x0A0E, info), /* ULX GT1 mobile */ \ |
INTEL_VGA_DEVICE(0x0A1E, info), /* ULX GT2 mobile */ \ |
INTEL_VGA_DEVICE(0x0A2E, info), /* ULT GT3 reserved */ \ |
INTEL_VGA_DEVICE(0x0D06, info), /* CRW GT1 mobile */ \ |
INTEL_VGA_DEVICE(0x0D16, info), /* CRW GT2 mobile */ \ |
223,14 → 223,40 |
_INTEL_BDW_D(gt, 0x160A, info), /* Server */ \ |
_INTEL_BDW_D(gt, 0x160D, info) /* Workstation */ |
#define INTEL_BDW_M_IDS(info) \ |
#define INTEL_BDW_GT12M_IDS(info) \ |
_INTEL_BDW_M_IDS(1, info), \ |
_INTEL_BDW_M_IDS(2, info), \ |
_INTEL_BDW_M_IDS(2, info) |
#define INTEL_BDW_GT12D_IDS(info) \ |
_INTEL_BDW_D_IDS(1, info), \ |
_INTEL_BDW_D_IDS(2, info) |
#define INTEL_BDW_GT3M_IDS(info) \ |
_INTEL_BDW_M_IDS(3, info) |
#define INTEL_BDW_D_IDS(info) \ |
_INTEL_BDW_D_IDS(1, info), \ |
_INTEL_BDW_D_IDS(2, info), \ |
#define INTEL_BDW_GT3D_IDS(info) \ |
_INTEL_BDW_D_IDS(3, info) |
#define INTEL_BDW_RSVDM_IDS(info) \ |
_INTEL_BDW_M_IDS(4, info) |
#define INTEL_BDW_RSVDD_IDS(info) \ |
_INTEL_BDW_D_IDS(4, info) |
#define INTEL_BDW_M_IDS(info) \ |
INTEL_BDW_GT12M_IDS(info), \ |
INTEL_BDW_GT3M_IDS(info), \ |
INTEL_BDW_RSVDM_IDS(info) |
#define INTEL_BDW_D_IDS(info) \ |
INTEL_BDW_GT12D_IDS(info), \ |
INTEL_BDW_GT3D_IDS(info), \ |
INTEL_BDW_RSVDD_IDS(info) |
#define INTEL_CHV_IDS(info) \ |
INTEL_VGA_DEVICE(0x22b0, info), \ |
INTEL_VGA_DEVICE(0x22b1, info), \ |
INTEL_VGA_DEVICE(0x22b2, info), \ |
INTEL_VGA_DEVICE(0x22b3, info) |
#endif /* _I915_PCIIDS_H */ |
/drivers/include/drm/i915_powerwell.h |
---|
30,7 → 30,8 |
#define _I915_POWERWELL_H_ |
/* For use by hda_i915 driver */ |
extern void i915_request_power_well(void); |
extern void i915_release_power_well(void); |
extern int i915_request_power_well(void); |
extern int i915_release_power_well(void); |
extern int i915_get_cdclk_freq(void); |
#endif /* _I915_POWERWELL_H_ */ |
/drivers/include/drm/ttm/ttm_bo_api.h |
---|
39,16 → 39,13 |
#include <linux/mutex.h> |
#include <linux/mm.h> |
#include <linux/bitmap.h> |
#include <linux/reservation.h> |
struct ttm_bo_device; |
struct drm_mm_node; |
struct reservation_object { |
struct mutex lock; |
}; |
/** |
* struct ttm_placement |
* |
488,13 → 485,12 |
void (*destroy) (struct ttm_buffer_object *)); |
/** |
* ttm_bo_synccpu_object_init |
* ttm_bo_create |
* |
* @bdev: Pointer to a ttm_bo_device struct. |
* @bo: Pointer to a ttm_buffer_object to be initialized. |
* @size: Requested size of buffer object. |
* @type: Requested type of buffer object. |
* @flags: Initial placement flags. |
* @placement: Initial placement. |
* @page_alignment: Data alignment in pages. |
* @interruptible: If needing to sleep while waiting for GPU resources, |
* sleep interruptible. |
/drivers/include/drm/ttm/ttm_bo_driver.h |
---|
37,12 → 37,11 |
#include <drm/drm_mm.h> |
#include <drm/drm_global.h> |
#include <drm/drm_vma_manager.h> |
//#include <linux/workqueue.h> |
#include <linux/workqueue.h> |
#include <linux/fs.h> |
#include <linux/spinlock.h> |
#include <linux/reservation.h> |
struct ww_acquire_ctx; |
struct ttm_backend_func { |
/** |
* struct ttm_backend_func member bind |
134,6 → 133,7 |
* struct ttm_dma_tt |
* |
* @ttm: Base ttm_tt struct. |
* @cpu_address: The CPU address of the pages |
* @dma_address: The DMA (bus) addresses of the pages |
* @pages_list: used by some page allocation backend |
* |
143,6 → 143,7 |
*/ |
struct ttm_dma_tt { |
struct ttm_tt ttm; |
void **cpu_address; |
dma_addr_t *dma_address; |
struct list_head pages_list; |
}; |
183,6 → 184,7 |
* @man: Pointer to a memory type manager. |
* @bo: Pointer to the buffer object we're allocating space for. |
* @placement: Placement details. |
* @flags: Additional placement flags. |
* @mem: Pointer to a struct ttm_mem_reg to be filled in. |
* |
* This function should allocate space in the memory type managed |
207,6 → 209,7 |
int (*get_node)(struct ttm_mem_type_manager *man, |
struct ttm_buffer_object *bo, |
struct ttm_placement *placement, |
uint32_t flags, |
struct ttm_mem_reg *mem); |
/** |
654,18 → 657,6 |
extern int ttm_tt_swapin(struct ttm_tt *ttm); |
/** |
* ttm_tt_cache_flush: |
* |
* @pages: An array of pointers to struct page:s to flush. |
* @num_pages: Number of pages to flush. |
* |
* Flush the data of the indicated pages from the cpu caches. |
* This is used when changing caching attributes of the pages from |
* cache-coherent. |
*/ |
extern void ttm_tt_cache_flush(struct page *pages[], unsigned long num_pages); |
/** |
* ttm_tt_set_placement_caching: |
* |
* @ttm A struct ttm_tt the backing pages of which will change caching policy. |
748,6 → 739,7 |
* @bdev: A pointer to a struct ttm_bo_device to initialize. |
* @glob: A pointer to an initialized struct ttm_bo_global. |
* @driver: A pointer to a struct ttm_bo_driver set up by the caller. |
* @mapping: The address space to use for this bo. |
* @file_page_offset: Offset into the device address space that is available |
* for buffer data. This ensures compatibility with other users of the |
* address space. |
759,6 → 751,7 |
extern int ttm_bo_device_init(struct ttm_bo_device *bdev, |
struct ttm_bo_global *glob, |
struct ttm_bo_driver *driver, |
struct address_space *mapping, |
uint64_t file_page_offset, bool need_dma32); |
/** |
787,7 → 780,7 |
extern void ttm_bo_add_to_lru(struct ttm_buffer_object *bo); |
/** |
* ttm_bo_reserve_nolru: |
* __ttm_bo_reserve: |
* |
* @bo: A pointer to a struct ttm_buffer_object. |
* @interruptible: Sleep interruptible if waiting. |
808,13 → 801,13 |
* -EALREADY: Bo already reserved using @ticket. This error code will only |
* be returned if @use_ticket is set to true. |
*/ |
static inline int ttm_bo_reserve_nolru(struct ttm_buffer_object *bo, |
static inline int __ttm_bo_reserve(struct ttm_buffer_object *bo, |
bool interruptible, |
bool no_wait, bool use_ticket, |
struct ww_acquire_ctx *ticket) |
{ |
int ret = 0; |
/* |
if (no_wait) { |
bool success; |
if (WARN_ON(ticket)) |
830,7 → 823,6 |
ret = ww_mutex_lock(&bo->resv->lock, ticket); |
if (ret == -EINTR) |
return -ERESTARTSYS; |
*/ |
return ret; |
} |
888,8 → 880,7 |
WARN_ON(!atomic_read(&bo->kref.refcount)); |
ret = ttm_bo_reserve_nolru(bo, interruptible, no_wait, use_ticket, |
ticket); |
ret = __ttm_bo_reserve(bo, interruptible, no_wait, use_ticket, ticket); |
if (likely(ret == 0)) |
ttm_bo_del_sub_from_lru(bo); |
914,10 → 905,6 |
WARN_ON(!atomic_read(&bo->kref.refcount)); |
if (interruptible) |
ret = ww_mutex_lock_slow_interruptible(&bo->resv->lock, |
ticket); |
else |
ww_mutex_lock_slow(&bo->resv->lock, ticket); |
if (likely(ret == 0)) |
929,33 → 916,45 |
} |
/** |
* ttm_bo_unreserve_ticket |
* __ttm_bo_unreserve |
* @bo: A pointer to a struct ttm_buffer_object. |
* @ticket: ww_acquire_ctx used for reserving |
* |
* Unreserve a previous reservation of @bo made with @ticket. |
* Unreserve a previous reservation of @bo where the buffer object is |
* already on lru lists. |
*/ |
static inline void ttm_bo_unreserve_ticket(struct ttm_buffer_object *bo, |
struct ww_acquire_ctx *t) |
static inline void __ttm_bo_unreserve(struct ttm_buffer_object *bo) |
{ |
ww_mutex_unlock(&bo->resv->lock); |
} |
/** |
* ttm_bo_unreserve |
* |
* @bo: A pointer to a struct ttm_buffer_object. |
* |
* Unreserve a previous reservation of @bo. |
*/ |
static inline void ttm_bo_unreserve(struct ttm_buffer_object *bo) |
{ |
if (!(bo->mem.placement & TTM_PL_FLAG_NO_EVICT)) { |
spin_lock(&bo->glob->lru_lock); |
ttm_bo_add_to_lru(bo); |
spin_unlock(&bo->glob->lru_lock); |
} |
// ww_mutex_unlock(&bo->resv->lock); |
__ttm_bo_unreserve(bo); |
} |
/** |
* ttm_bo_unreserve |
* |
* ttm_bo_unreserve_ticket |
* @bo: A pointer to a struct ttm_buffer_object. |
* @ticket: ww_acquire_ctx used for reserving |
* |
* Unreserve a previous reservation of @bo. |
* Unreserve a previous reservation of @bo made with @ticket. |
*/ |
static inline void ttm_bo_unreserve(struct ttm_buffer_object *bo) |
static inline void ttm_bo_unreserve_ticket(struct ttm_buffer_object *bo, |
struct ww_acquire_ctx *t) |
{ |
ttm_bo_unreserve_ticket(bo, NULL); |
ttm_bo_unreserve(bo); |
} |
/* |
/drivers/include/drm/ttm/ttm_lock.h |
---|
51,7 → 51,7 |
#include <ttm/ttm_object.h> |
#include <linux/wait.h> |
#include <linux/atomic.h> |
//#include <linux/atomic.h> |
/** |
* struct ttm_lock |
/drivers/include/drm/ttm/ttm_object.h |
---|
244,6 → 244,10 |
extern int ttm_ref_object_add(struct ttm_object_file *tfile, |
struct ttm_base_object *base, |
enum ttm_ref_type ref_type, bool *existed); |
extern bool ttm_ref_object_exists(struct ttm_object_file *tfile, |
struct ttm_base_object *base); |
/** |
* ttm_ref_object_base_unref |
* |
/drivers/include/drm/ttm/ttm_page_alloc.h |
---|
29,6 → 29,8 |
#include <drm/ttm/ttm_bo_driver.h> |
#include <drm/ttm/ttm_memory.h> |
struct device; |
/** |
* Initialize pool allocator. |
*/ |
/drivers/include/drm/ttm/ttm_placement.h |
---|
65,6 → 65,8 |
* reference the buffer. |
* TTM_PL_FLAG_NO_EVICT means that the buffer may never |
* be evicted to make room for other buffers. |
* TTM_PL_FLAG_TOPDOWN requests to be placed from the |
* top of the memory area, instead of the bottom. |
*/ |
#define TTM_PL_FLAG_CACHED (1 << 16) |
72,6 → 74,7 |
#define TTM_PL_FLAG_WC (1 << 18) |
#define TTM_PL_FLAG_SHARED (1 << 20) |
#define TTM_PL_FLAG_NO_EVICT (1 << 21) |
#define TTM_PL_FLAG_TOPDOWN (1 << 22) |
#define TTM_PL_MASK_CACHING (TTM_PL_FLAG_CACHED | \ |
TTM_PL_FLAG_UNCACHED | \ |