diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-09-05 13:17:26 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-09-05 13:17:26 -0400 |
| commit | a09e9a7a4b907f2dfa9bdb2b98a1828ab4b340b2 (patch) | |
| tree | c7a2df4e887573648eeaf8f7939889046990d3f6 /include | |
| parent | 9ab073bc45b8b523cc39658925bb44bef35ca657 (diff) | |
| parent | 86a7e1224a68511d3a1ae0b7e11581b9d37723ae (diff) | |
Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux
Pull drm tree changes from Dave Airlie:
"This is the main drm pull request, I have some overlap with sound and
arm-soc, the sound patch is acked and may conflict based on -next
reports but should be a trivial fixup, which I'll leave to you!
Highlights:
- new drivers:
MSM driver from Rob Clark
- non-drm:
switcheroo and hdmi audio driver support for secondary GPU
poweroff, so drivers can use runtime PM to poweroff the GPUs. This
can save 5 or 6W on some optimus laptops.
- drm core:
combined GEM and TTM VMA manager
per-filp mmap permission tracking
initial rendernode support (via a runtime enable for now, until we get api stable),
remove old proc support,
lots of cleanups of legacy code
hdmi vendor infoframes and 4k modes
lots of gem/prime locking and races fixes
async pageflip scaffolding
drm bridge objects
- i915:
Haswell PC8+ support and eLLC support, HDMI 4K support, initial
per-process VMA pieces, watermark reworks, convert to generic hdmi
infoframes, encoder reworking, fastboot support,
- radeon:
CIK PM support, remove 3d blit code in favour of DMA engines,
Berlin GPU support, HDMI audio fixes
- nouveau:
secondary GPU power down support for optimus laptops, lots of
fixes, use MSI, VP3 engine support
- exynos:
runtime pm support for g2d, DT support, remove non-DT,
- tda998x i2c driver:
lots of fixes for sync issues
- gma500:
lots of cleanups
- rcar:
add LVDS support, fbdev emulation,
- tegra:
just minor fixes"
* 'drm-next' of git://people.freedesktop.org/~airlied/linux: (684 commits)
drm/exynos: Fix build error with exynos_drm_connector.c
drm/exynos: Remove non-DT support in exynos_drm_fimd
drm/exynos: Remove non-DT support in exynos_hdmi
drm/exynos: Remove non-DT support in exynos_drm_g2d
drm/exynos: Remove non-DT support in exynos_hdmiphy
drm/exynos: Remove non-DT support in exynos_ddc
drm/exynos: Make Exynos DRM drivers depend on OF
drm/exynos: Consider fallback option to allocation fail
drm/exynos: fimd: move platform data parsing to separate function
drm/exynos: fimd: get signal polarities from device tree
drm/exynos: fimd: replace struct fb_videomode with videomode
drm/exynos: check a pixel format to a particular window layer
drm/exynos: fix fimd pixel format setting
drm/exynos: Add NULL pointer check
drm/exynos: Remove redundant error messages
drm/exynos: Add missing of.h header include
drm/exynos: Remove redundant NULL check in exynos_drm_buf
drm/exynos: add device tree support for rotator
drm/exynos: Add missing includes
drm/exynos: add runtime pm interfaces to g2d driver
...
Diffstat (limited to 'include')
| -rw-r--r-- | include/drm/drmP.h | 254 | ||||
| -rw-r--r-- | include/drm/drm_agpsupport.h | 194 | ||||
| -rw-r--r-- | include/drm/drm_crtc.h | 85 | ||||
| -rw-r--r-- | include/drm/drm_dp_helper.h | 31 | ||||
| -rw-r--r-- | include/drm/drm_edid.h | 5 | ||||
| -rw-r--r-- | include/drm/drm_fb_cma_helper.h | 1 | ||||
| -rw-r--r-- | include/drm/drm_flip_work.h | 76 | ||||
| -rw-r--r-- | include/drm/drm_gem_cma_helper.h | 8 | ||||
| -rw-r--r-- | include/drm/drm_mm.h | 142 | ||||
| -rw-r--r-- | include/drm/drm_pciids.h | 48 | ||||
| -rw-r--r-- | include/drm/drm_vma_manager.h | 257 | ||||
| -rw-r--r-- | include/drm/exynos_drm.h | 3 | ||||
| -rw-r--r-- | include/drm/i2c/tda998x.h | 30 | ||||
| -rw-r--r-- | include/drm/ttm/ttm_bo_api.h | 15 | ||||
| -rw-r--r-- | include/drm/ttm/ttm_bo_driver.h | 10 | ||||
| -rw-r--r-- | include/linux/hdmi.h | 53 | ||||
| -rw-r--r-- | include/linux/platform_data/rcar-du.h | 34 | ||||
| -rw-r--r-- | include/linux/vga_switcheroo.h | 13 | ||||
| -rw-r--r-- | include/uapi/drm/Kbuild | 1 | ||||
| -rw-r--r-- | include/uapi/drm/drm.h | 3 | ||||
| -rw-r--r-- | include/uapi/drm/drm_mode.h | 16 | ||||
| -rw-r--r-- | include/uapi/drm/i915_drm.h | 49 | ||||
| -rw-r--r-- | include/uapi/drm/msm_drm.h | 207 | ||||
| -rw-r--r-- | include/uapi/drm/radeon_drm.h | 2 |
24 files changed, 1155 insertions, 382 deletions
diff --git a/include/drm/drmP.h b/include/drm/drmP.h index 12083dc862a9..290734191f72 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h | |||
| @@ -45,7 +45,6 @@ | |||
| 45 | #include <linux/kernel.h> | 45 | #include <linux/kernel.h> |
| 46 | #include <linux/miscdevice.h> | 46 | #include <linux/miscdevice.h> |
| 47 | #include <linux/fs.h> | 47 | #include <linux/fs.h> |
| 48 | #include <linux/proc_fs.h> | ||
| 49 | #include <linux/init.h> | 48 | #include <linux/init.h> |
| 50 | #include <linux/file.h> | 49 | #include <linux/file.h> |
| 51 | #include <linux/platform_device.h> | 50 | #include <linux/platform_device.h> |
| @@ -62,20 +61,18 @@ | |||
| 62 | #endif | 61 | #endif |
| 63 | #include <asm/mman.h> | 62 | #include <asm/mman.h> |
| 64 | #include <asm/uaccess.h> | 63 | #include <asm/uaccess.h> |
| 65 | #if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE) | ||
| 66 | #include <linux/types.h> | 64 | #include <linux/types.h> |
| 67 | #include <linux/agp_backend.h> | 65 | #include <linux/agp_backend.h> |
| 68 | #endif | ||
| 69 | #include <linux/workqueue.h> | 66 | #include <linux/workqueue.h> |
| 70 | #include <linux/poll.h> | 67 | #include <linux/poll.h> |
| 71 | #include <asm/pgalloc.h> | 68 | #include <asm/pgalloc.h> |
| 72 | #include <drm/drm.h> | 69 | #include <drm/drm.h> |
| 73 | #include <drm/drm_sarea.h> | 70 | #include <drm/drm_sarea.h> |
| 71 | #include <drm/drm_vma_manager.h> | ||
| 74 | 72 | ||
| 75 | #include <linux/idr.h> | 73 | #include <linux/idr.h> |
| 76 | 74 | ||
| 77 | #define __OS_HAS_AGP (defined(CONFIG_AGP) || (defined(CONFIG_AGP_MODULE) && defined(MODULE))) | 75 | #define __OS_HAS_AGP (defined(CONFIG_AGP) || (defined(CONFIG_AGP_MODULE) && defined(MODULE))) |
| 78 | #define __OS_HAS_MTRR (defined(CONFIG_MTRR)) | ||
| 79 | 76 | ||
| 80 | struct module; | 77 | struct module; |
| 81 | 78 | ||
| @@ -140,19 +137,15 @@ int drm_err(const char *func, const char *format, ...); | |||
| 140 | /* driver capabilities and requirements mask */ | 137 | /* driver capabilities and requirements mask */ |
| 141 | #define DRIVER_USE_AGP 0x1 | 138 | #define DRIVER_USE_AGP 0x1 |
| 142 | #define DRIVER_REQUIRE_AGP 0x2 | 139 | #define DRIVER_REQUIRE_AGP 0x2 |
| 143 | #define DRIVER_USE_MTRR 0x4 | ||
| 144 | #define DRIVER_PCI_DMA 0x8 | 140 | #define DRIVER_PCI_DMA 0x8 |
| 145 | #define DRIVER_SG 0x10 | 141 | #define DRIVER_SG 0x10 |
| 146 | #define DRIVER_HAVE_DMA 0x20 | 142 | #define DRIVER_HAVE_DMA 0x20 |
| 147 | #define DRIVER_HAVE_IRQ 0x40 | 143 | #define DRIVER_HAVE_IRQ 0x40 |
| 148 | #define DRIVER_IRQ_SHARED 0x80 | 144 | #define DRIVER_IRQ_SHARED 0x80 |
| 149 | #define DRIVER_IRQ_VBL 0x100 | ||
| 150 | #define DRIVER_DMA_QUEUE 0x200 | ||
| 151 | #define DRIVER_FB_DMA 0x400 | ||
| 152 | #define DRIVER_IRQ_VBL2 0x800 | ||
| 153 | #define DRIVER_GEM 0x1000 | 145 | #define DRIVER_GEM 0x1000 |
| 154 | #define DRIVER_MODESET 0x2000 | 146 | #define DRIVER_MODESET 0x2000 |
| 155 | #define DRIVER_PRIME 0x4000 | 147 | #define DRIVER_PRIME 0x4000 |
| 148 | #define DRIVER_RENDER 0x8000 | ||
| 156 | 149 | ||
| 157 | #define DRIVER_BUS_PCI 0x1 | 150 | #define DRIVER_BUS_PCI 0x1 |
| 158 | #define DRIVER_BUS_PLATFORM 0x2 | 151 | #define DRIVER_BUS_PLATFORM 0x2 |
| @@ -168,13 +161,7 @@ int drm_err(const char *func, const char *format, ...); | |||
| 168 | #define DRM_MAGIC_HASH_ORDER 4 /**< Size of key hash table. Must be power of 2. */ | 161 | #define DRM_MAGIC_HASH_ORDER 4 /**< Size of key hash table. Must be power of 2. */ |
| 169 | #define DRM_KERNEL_CONTEXT 0 /**< Change drm_resctx if changed */ | 162 | #define DRM_KERNEL_CONTEXT 0 /**< Change drm_resctx if changed */ |
| 170 | #define DRM_RESERVED_CONTEXTS 1 /**< Change drm_resctx if changed */ | 163 | #define DRM_RESERVED_CONTEXTS 1 /**< Change drm_resctx if changed */ |
| 171 | #define DRM_LOOPING_LIMIT 5000000 | ||
| 172 | #define DRM_TIME_SLICE (HZ/20) /**< Time slice for GLXContexts */ | ||
| 173 | #define DRM_LOCK_SLICE 1 /**< Time slice for lock, in jiffies */ | ||
| 174 | |||
| 175 | #define DRM_FLAG_DEBUG 0x01 | ||
| 176 | 164 | ||
| 177 | #define DRM_MAX_CTXBITMAP (PAGE_SIZE * 8) | ||
| 178 | #define DRM_MAP_HASH_OFFSET 0x10000000 | 165 | #define DRM_MAP_HASH_OFFSET 0x10000000 |
| 179 | 166 | ||
| 180 | /*@}*/ | 167 | /*@}*/ |
| @@ -263,9 +250,6 @@ int drm_err(const char *func, const char *format, ...); | |||
| 263 | 250 | ||
| 264 | #define DRM_ARRAY_SIZE(x) ARRAY_SIZE(x) | 251 | #define DRM_ARRAY_SIZE(x) ARRAY_SIZE(x) |
| 265 | 252 | ||
| 266 | #define DRM_LEFTCOUNT(x) (((x)->rp + (x)->count - (x)->wp) % ((x)->count + 1)) | ||
| 267 | #define DRM_BUFCOUNT(x) ((x)->count - DRM_LEFTCOUNT(x)) | ||
| 268 | |||
| 269 | #define DRM_IF_VERSION(maj, min) (maj << 16 | min) | 253 | #define DRM_IF_VERSION(maj, min) (maj << 16 | min) |
| 270 | 254 | ||
| 271 | /** | 255 | /** |
| @@ -307,6 +291,7 @@ typedef int drm_ioctl_compat_t(struct file *filp, unsigned int cmd, | |||
| 307 | #define DRM_ROOT_ONLY 0x4 | 291 | #define DRM_ROOT_ONLY 0x4 |
| 308 | #define DRM_CONTROL_ALLOW 0x8 | 292 | #define DRM_CONTROL_ALLOW 0x8 |
| 309 | #define DRM_UNLOCKED 0x10 | 293 | #define DRM_UNLOCKED 0x10 |
| 294 | #define DRM_RENDER_ALLOW 0x20 | ||
| 310 | 295 | ||
| 311 | struct drm_ioctl_desc { | 296 | struct drm_ioctl_desc { |
| 312 | unsigned int cmd; | 297 | unsigned int cmd; |
| @@ -587,7 +572,6 @@ struct drm_map_list { | |||
| 587 | struct drm_local_map *map; /**< mapping */ | 572 | struct drm_local_map *map; /**< mapping */ |
| 588 | uint64_t user_token; | 573 | uint64_t user_token; |
| 589 | struct drm_master *master; | 574 | struct drm_master *master; |
| 590 | struct drm_mm_node *file_offset_node; /**< fake offset */ | ||
| 591 | }; | 575 | }; |
| 592 | 576 | ||
| 593 | /** | 577 | /** |
| @@ -622,8 +606,7 @@ struct drm_ati_pcigart_info { | |||
| 622 | * GEM specific mm private for tracking GEM objects | 606 | * GEM specific mm private for tracking GEM objects |
| 623 | */ | 607 | */ |
| 624 | struct drm_gem_mm { | 608 | struct drm_gem_mm { |
| 625 | struct drm_mm offset_manager; /**< Offset mgmt for buffer objects */ | 609 | struct drm_vma_offset_manager vma_manager; |
| 626 | struct drm_open_hash offset_hash; /**< User token hash table for maps */ | ||
| 627 | }; | 610 | }; |
| 628 | 611 | ||
| 629 | /** | 612 | /** |
| @@ -634,8 +617,16 @@ struct drm_gem_object { | |||
| 634 | /** Reference count of this object */ | 617 | /** Reference count of this object */ |
| 635 | struct kref refcount; | 618 | struct kref refcount; |
| 636 | 619 | ||
| 637 | /** Handle count of this object. Each handle also holds a reference */ | 620 | /** |
| 638 | atomic_t handle_count; /* number of handles on this object */ | 621 | * handle_count - gem file_priv handle count of this object |
| 622 | * | ||
| 623 | * Each handle also holds a reference. Note that when the handle_count | ||
| 624 | * drops to 0 any global names (e.g. the id in the flink namespace) will | ||
| 625 | * be cleared. | ||
| 626 | * | ||
| 627 | * Protected by dev->object_name_lock. | ||
| 628 | * */ | ||
| 629 | unsigned handle_count; | ||
| 639 | 630 | ||
| 640 | /** Related drm device */ | 631 | /** Related drm device */ |
| 641 | struct drm_device *dev; | 632 | struct drm_device *dev; |
| @@ -644,7 +635,7 @@ struct drm_gem_object { | |||
| 644 | struct file *filp; | 635 | struct file *filp; |
| 645 | 636 | ||
| 646 | /* Mapping info for this object */ | 637 | /* Mapping info for this object */ |
| 647 | struct drm_map_list map_list; | 638 | struct drm_vma_offset_node vma_node; |
| 648 | 639 | ||
| 649 | /** | 640 | /** |
| 650 | * Size of the object, in bytes. Immutable over the object's | 641 | * Size of the object, in bytes. Immutable over the object's |
| @@ -678,10 +669,32 @@ struct drm_gem_object { | |||
| 678 | 669 | ||
| 679 | void *driver_private; | 670 | void *driver_private; |
| 680 | 671 | ||
| 681 | /* dma buf exported from this GEM object */ | 672 | /** |
| 682 | struct dma_buf *export_dma_buf; | 673 | * dma_buf - dma buf associated with this GEM object |
| 674 | * | ||
| 675 | * Pointer to the dma-buf associated with this gem object (either | ||
| 676 | * through importing or exporting). We break the resulting reference | ||
| 677 | * loop when the last gem handle for this object is released. | ||
| 678 | * | ||
| 679 | * Protected by obj->object_name_lock | ||
| 680 | */ | ||
| 681 | struct dma_buf *dma_buf; | ||
| 683 | 682 | ||
| 684 | /* dma buf attachment backing this object */ | 683 | /** |
| 684 | * import_attach - dma buf attachment backing this object | ||
| 685 | * | ||
| 686 | * Any foreign dma_buf imported as a gem object has this set to the | ||
| 687 | * attachment point for the device. This is invariant over the lifetime | ||
| 688 | * of a gem object. | ||
| 689 | * | ||
| 690 | * The driver's ->gem_free_object callback is responsible for cleaning | ||
| 691 | * up the dma_buf attachment and references acquired at import time. | ||
| 692 | * | ||
| 693 | * Note that the drm gem/prime core does not depend upon drivers setting | ||
| 694 | * this field any more. So for drivers where this doesn't make sense | ||
| 695 | * (e.g. virtual devices or a displaylink behind an usb bus) they can | ||
| 696 | * simply leave it as NULL. | ||
| 697 | */ | ||
| 685 | struct dma_buf_attachment *import_attach; | 698 | struct dma_buf_attachment *import_attach; |
| 686 | }; | 699 | }; |
| 687 | 700 | ||
| @@ -737,6 +750,7 @@ struct drm_bus { | |||
| 737 | int (*irq_by_busid)(struct drm_device *dev, struct drm_irq_busid *p); | 750 | int (*irq_by_busid)(struct drm_device *dev, struct drm_irq_busid *p); |
| 738 | /* hooks that are for PCI */ | 751 | /* hooks that are for PCI */ |
| 739 | int (*agp_init)(struct drm_device *dev); | 752 | int (*agp_init)(struct drm_device *dev); |
| 753 | void (*agp_destroy)(struct drm_device *dev); | ||
| 740 | 754 | ||
| 741 | }; | 755 | }; |
| 742 | 756 | ||
| @@ -885,8 +899,6 @@ struct drm_driver { | |||
| 885 | void (*irq_preinstall) (struct drm_device *dev); | 899 | void (*irq_preinstall) (struct drm_device *dev); |
| 886 | int (*irq_postinstall) (struct drm_device *dev); | 900 | int (*irq_postinstall) (struct drm_device *dev); |
| 887 | void (*irq_uninstall) (struct drm_device *dev); | 901 | void (*irq_uninstall) (struct drm_device *dev); |
| 888 | void (*set_version) (struct drm_device *dev, | ||
| 889 | struct drm_set_version *sv); | ||
| 890 | 902 | ||
| 891 | /* Master routines */ | 903 | /* Master routines */ |
| 892 | int (*master_create)(struct drm_device *dev, struct drm_master *master); | 904 | int (*master_create)(struct drm_device *dev, struct drm_master *master); |
| @@ -966,7 +978,7 @@ struct drm_driver { | |||
| 966 | 978 | ||
| 967 | u32 driver_features; | 979 | u32 driver_features; |
| 968 | int dev_priv_size; | 980 | int dev_priv_size; |
| 969 | struct drm_ioctl_desc *ioctls; | 981 | const struct drm_ioctl_desc *ioctls; |
| 970 | int num_ioctls; | 982 | int num_ioctls; |
| 971 | const struct file_operations *fops; | 983 | const struct file_operations *fops; |
| 972 | union { | 984 | union { |
| @@ -1037,8 +1049,6 @@ struct drm_minor { | |||
| 1037 | struct device kdev; /**< Linux device */ | 1049 | struct device kdev; /**< Linux device */ |
| 1038 | struct drm_device *dev; | 1050 | struct drm_device *dev; |
| 1039 | 1051 | ||
| 1040 | struct proc_dir_entry *proc_root; /**< proc directory entry */ | ||
| 1041 | struct drm_info_node proc_nodes; | ||
| 1042 | struct dentry *debugfs_root; | 1052 | struct dentry *debugfs_root; |
| 1043 | 1053 | ||
| 1044 | struct list_head debugfs_list; | 1054 | struct list_head debugfs_list; |
| @@ -1131,12 +1141,7 @@ struct drm_device { | |||
| 1131 | /*@{ */ | 1141 | /*@{ */ |
| 1132 | int irq_enabled; /**< True if irq handler is enabled */ | 1142 | int irq_enabled; /**< True if irq handler is enabled */ |
| 1133 | __volatile__ long context_flag; /**< Context swapping flag */ | 1143 | __volatile__ long context_flag; /**< Context swapping flag */ |
| 1134 | __volatile__ long interrupt_flag; /**< Interruption handler flag */ | ||
| 1135 | __volatile__ long dma_flag; /**< DMA dispatch flag */ | ||
| 1136 | wait_queue_head_t context_wait; /**< Processes waiting on ctx switch */ | ||
| 1137 | int last_checked; /**< Last context checked for DMA */ | ||
| 1138 | int last_context; /**< Last current context */ | 1144 | int last_context; /**< Last current context */ |
| 1139 | unsigned long last_switch; /**< jiffies at last context switch */ | ||
| 1140 | /*@} */ | 1145 | /*@} */ |
| 1141 | 1146 | ||
| 1142 | struct work_struct work; | 1147 | struct work_struct work; |
| @@ -1174,12 +1179,6 @@ struct drm_device { | |||
| 1174 | spinlock_t event_lock; | 1179 | spinlock_t event_lock; |
| 1175 | 1180 | ||
| 1176 | /*@} */ | 1181 | /*@} */ |
| 1177 | cycles_t ctx_start; | ||
| 1178 | cycles_t lck_start; | ||
| 1179 | |||
| 1180 | struct fasync_struct *buf_async;/**< Processes waiting for SIGIO */ | ||
| 1181 | wait_queue_head_t buf_readers; /**< Processes waiting to read */ | ||
| 1182 | wait_queue_head_t buf_writers; /**< Processes waiting to ctx switch */ | ||
| 1183 | 1182 | ||
| 1184 | struct drm_agp_head *agp; /**< AGP data */ | 1183 | struct drm_agp_head *agp; /**< AGP data */ |
| 1185 | 1184 | ||
| @@ -1207,12 +1206,13 @@ struct drm_device { | |||
| 1207 | unsigned int agp_buffer_token; | 1206 | unsigned int agp_buffer_token; |
| 1208 | struct drm_minor *control; /**< Control node for card */ | 1207 | struct drm_minor *control; /**< Control node for card */ |
| 1209 | struct drm_minor *primary; /**< render type primary screen head */ | 1208 | struct drm_minor *primary; /**< render type primary screen head */ |
| 1209 | struct drm_minor *render; /**< render node for card */ | ||
| 1210 | 1210 | ||
| 1211 | struct drm_mode_config mode_config; /**< Current mode config */ | 1211 | struct drm_mode_config mode_config; /**< Current mode config */ |
| 1212 | 1212 | ||
| 1213 | /** \name GEM information */ | 1213 | /** \name GEM information */ |
| 1214 | /*@{ */ | 1214 | /*@{ */ |
| 1215 | spinlock_t object_name_lock; | 1215 | struct mutex object_name_lock; |
| 1216 | struct idr object_name_idr; | 1216 | struct idr object_name_idr; |
| 1217 | /*@} */ | 1217 | /*@} */ |
| 1218 | int switch_power_state; | 1218 | int switch_power_state; |
| @@ -1223,6 +1223,7 @@ struct drm_device { | |||
| 1223 | #define DRM_SWITCH_POWER_ON 0 | 1223 | #define DRM_SWITCH_POWER_ON 0 |
| 1224 | #define DRM_SWITCH_POWER_OFF 1 | 1224 | #define DRM_SWITCH_POWER_OFF 1 |
| 1225 | #define DRM_SWITCH_POWER_CHANGING 2 | 1225 | #define DRM_SWITCH_POWER_CHANGING 2 |
| 1226 | #define DRM_SWITCH_POWER_DYNAMIC_OFF 3 | ||
| 1226 | 1227 | ||
| 1227 | static __inline__ int drm_core_check_feature(struct drm_device *dev, | 1228 | static __inline__ int drm_core_check_feature(struct drm_device *dev, |
| 1228 | int feature) | 1229 | int feature) |
| @@ -1235,25 +1236,6 @@ static inline int drm_dev_to_irq(struct drm_device *dev) | |||
| 1235 | return dev->driver->bus->get_irq(dev); | 1236 | return dev->driver->bus->get_irq(dev); |
| 1236 | } | 1237 | } |
| 1237 | 1238 | ||
| 1238 | |||
| 1239 | #if __OS_HAS_AGP | ||
| 1240 | static inline int drm_core_has_AGP(struct drm_device *dev) | ||
| 1241 | { | ||
| 1242 | return drm_core_check_feature(dev, DRIVER_USE_AGP); | ||
| 1243 | } | ||
| 1244 | #else | ||
| 1245 | #define drm_core_has_AGP(dev) (0) | ||
| 1246 | #endif | ||
| 1247 | |||
| 1248 | #if __OS_HAS_MTRR | ||
| 1249 | static inline int drm_core_has_MTRR(struct drm_device *dev) | ||
| 1250 | { | ||
| 1251 | return drm_core_check_feature(dev, DRIVER_USE_MTRR); | ||
| 1252 | } | ||
| 1253 | #else | ||
| 1254 | #define drm_core_has_MTRR(dev) (0) | ||
| 1255 | #endif | ||
| 1256 | |||
| 1257 | static inline void drm_device_set_unplugged(struct drm_device *dev) | 1239 | static inline void drm_device_set_unplugged(struct drm_device *dev) |
| 1258 | { | 1240 | { |
| 1259 | smp_wmb(); | 1241 | smp_wmb(); |
| @@ -1272,6 +1254,11 @@ static inline bool drm_modeset_is_locked(struct drm_device *dev) | |||
| 1272 | return mutex_is_locked(&dev->mode_config.mutex); | 1254 | return mutex_is_locked(&dev->mode_config.mutex); |
| 1273 | } | 1255 | } |
| 1274 | 1256 | ||
| 1257 | static inline bool drm_is_render_client(struct drm_file *file_priv) | ||
| 1258 | { | ||
| 1259 | return file_priv->minor->type == DRM_MINOR_RENDER; | ||
| 1260 | } | ||
| 1261 | |||
| 1275 | /******************************************************************/ | 1262 | /******************************************************************/ |
| 1276 | /** \name Internal function definitions */ | 1263 | /** \name Internal function definitions */ |
| 1277 | /*@{*/ | 1264 | /*@{*/ |
| @@ -1287,7 +1274,6 @@ extern int drm_lastclose(struct drm_device *dev); | |||
| 1287 | extern struct mutex drm_global_mutex; | 1274 | extern struct mutex drm_global_mutex; |
| 1288 | extern int drm_open(struct inode *inode, struct file *filp); | 1275 | extern int drm_open(struct inode *inode, struct file *filp); |
| 1289 | extern int drm_stub_open(struct inode *inode, struct file *filp); | 1276 | extern int drm_stub_open(struct inode *inode, struct file *filp); |
| 1290 | extern int drm_fasync(int fd, struct file *filp, int on); | ||
| 1291 | extern ssize_t drm_read(struct file *filp, char __user *buffer, | 1277 | extern ssize_t drm_read(struct file *filp, char __user *buffer, |
| 1292 | size_t count, loff_t *offset); | 1278 | size_t count, loff_t *offset); |
| 1293 | extern int drm_release(struct inode *inode, struct file *filp); | 1279 | extern int drm_release(struct inode *inode, struct file *filp); |
| @@ -1301,14 +1287,6 @@ extern unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait); | |||
| 1301 | 1287 | ||
| 1302 | /* Memory management support (drm_memory.h) */ | 1288 | /* Memory management support (drm_memory.h) */ |
| 1303 | #include <drm/drm_memory.h> | 1289 | #include <drm/drm_memory.h> |
| 1304 | extern void drm_free_agp(DRM_AGP_MEM * handle, int pages); | ||
| 1305 | extern int drm_bind_agp(DRM_AGP_MEM * handle, unsigned int start); | ||
| 1306 | extern DRM_AGP_MEM *drm_agp_bind_pages(struct drm_device *dev, | ||
| 1307 | struct page **pages, | ||
| 1308 | unsigned long num_pages, | ||
| 1309 | uint32_t gtt_offset, | ||
| 1310 | uint32_t type); | ||
| 1311 | extern int drm_unbind_agp(DRM_AGP_MEM * handle); | ||
| 1312 | 1290 | ||
| 1313 | /* Misc. IOCTL support (drm_ioctl.h) */ | 1291 | /* Misc. IOCTL support (drm_ioctl.h) */ |
| 1314 | extern int drm_irq_by_busid(struct drm_device *dev, void *data, | 1292 | extern int drm_irq_by_busid(struct drm_device *dev, void *data, |
| @@ -1335,8 +1313,6 @@ extern int drm_resctx(struct drm_device *dev, void *data, | |||
| 1335 | struct drm_file *file_priv); | 1313 | struct drm_file *file_priv); |
| 1336 | extern int drm_addctx(struct drm_device *dev, void *data, | 1314 | extern int drm_addctx(struct drm_device *dev, void *data, |
| 1337 | struct drm_file *file_priv); | 1315 | struct drm_file *file_priv); |
| 1338 | extern int drm_modctx(struct drm_device *dev, void *data, | ||
| 1339 | struct drm_file *file_priv); | ||
| 1340 | extern int drm_getctx(struct drm_device *dev, void *data, | 1316 | extern int drm_getctx(struct drm_device *dev, void *data, |
| 1341 | struct drm_file *file_priv); | 1317 | struct drm_file *file_priv); |
| 1342 | extern int drm_switchctx(struct drm_device *dev, void *data, | 1318 | extern int drm_switchctx(struct drm_device *dev, void *data, |
| @@ -1346,9 +1322,10 @@ extern int drm_newctx(struct drm_device *dev, void *data, | |||
| 1346 | extern int drm_rmctx(struct drm_device *dev, void *data, | 1322 | extern int drm_rmctx(struct drm_device *dev, void *data, |
| 1347 | struct drm_file *file_priv); | 1323 | struct drm_file *file_priv); |
| 1348 | 1324 | ||
| 1349 | extern int drm_ctxbitmap_init(struct drm_device *dev); | 1325 | extern void drm_legacy_ctxbitmap_init(struct drm_device *dev); |
| 1350 | extern void drm_ctxbitmap_cleanup(struct drm_device *dev); | 1326 | extern void drm_legacy_ctxbitmap_cleanup(struct drm_device *dev); |
| 1351 | extern void drm_ctxbitmap_free(struct drm_device *dev, int ctx_handle); | 1327 | extern void drm_legacy_ctxbitmap_release(struct drm_device *dev, |
| 1328 | struct drm_file *file_priv); | ||
| 1352 | 1329 | ||
| 1353 | extern int drm_setsareactx(struct drm_device *dev, void *data, | 1330 | extern int drm_setsareactx(struct drm_device *dev, void *data, |
| 1354 | struct drm_file *file_priv); | 1331 | struct drm_file *file_priv); |
| @@ -1405,11 +1382,12 @@ extern int drm_freebufs(struct drm_device *dev, void *data, | |||
| 1405 | struct drm_file *file_priv); | 1382 | struct drm_file *file_priv); |
| 1406 | extern int drm_mapbufs(struct drm_device *dev, void *data, | 1383 | extern int drm_mapbufs(struct drm_device *dev, void *data, |
| 1407 | struct drm_file *file_priv); | 1384 | struct drm_file *file_priv); |
| 1408 | extern int drm_order(unsigned long size); | 1385 | extern int drm_dma_ioctl(struct drm_device *dev, void *data, |
| 1386 | struct drm_file *file_priv); | ||
| 1409 | 1387 | ||
| 1410 | /* DMA support (drm_dma.h) */ | 1388 | /* DMA support (drm_dma.h) */ |
| 1411 | extern int drm_dma_setup(struct drm_device *dev); | 1389 | extern int drm_legacy_dma_setup(struct drm_device *dev); |
| 1412 | extern void drm_dma_takedown(struct drm_device *dev); | 1390 | extern void drm_legacy_dma_takedown(struct drm_device *dev); |
| 1413 | extern void drm_free_buffer(struct drm_device *dev, struct drm_buf * buf); | 1391 | extern void drm_free_buffer(struct drm_device *dev, struct drm_buf * buf); |
| 1414 | extern void drm_core_reclaim_buffers(struct drm_device *dev, | 1392 | extern void drm_core_reclaim_buffers(struct drm_device *dev, |
| 1415 | struct drm_file *filp); | 1393 | struct drm_file *filp); |
| @@ -1423,7 +1401,6 @@ extern int drm_irq_uninstall(struct drm_device *dev); | |||
| 1423 | extern int drm_vblank_init(struct drm_device *dev, int num_crtcs); | 1401 | extern int drm_vblank_init(struct drm_device *dev, int num_crtcs); |
| 1424 | extern int drm_wait_vblank(struct drm_device *dev, void *data, | 1402 | extern int drm_wait_vblank(struct drm_device *dev, void *data, |
| 1425 | struct drm_file *filp); | 1403 | struct drm_file *filp); |
| 1426 | extern int drm_vblank_wait(struct drm_device *dev, unsigned int *vbl_seq); | ||
| 1427 | extern u32 drm_vblank_count(struct drm_device *dev, int crtc); | 1404 | extern u32 drm_vblank_count(struct drm_device *dev, int crtc); |
| 1428 | extern u32 drm_vblank_count_and_time(struct drm_device *dev, int crtc, | 1405 | extern u32 drm_vblank_count_and_time(struct drm_device *dev, int crtc, |
| 1429 | struct timeval *vblanktime); | 1406 | struct timeval *vblanktime); |
| @@ -1465,31 +1442,8 @@ extern int drm_modeset_ctl(struct drm_device *dev, void *data, | |||
| 1465 | struct drm_file *file_priv); | 1442 | struct drm_file *file_priv); |
| 1466 | 1443 | ||
| 1467 | /* AGP/GART support (drm_agpsupport.h) */ | 1444 | /* AGP/GART support (drm_agpsupport.h) */ |
| 1468 | extern struct drm_agp_head *drm_agp_init(struct drm_device *dev); | 1445 | |
| 1469 | extern int drm_agp_acquire(struct drm_device *dev); | 1446 | #include <drm/drm_agpsupport.h> |
| 1470 | extern int drm_agp_acquire_ioctl(struct drm_device *dev, void *data, | ||
| 1471 | struct drm_file *file_priv); | ||
| 1472 | extern int drm_agp_release(struct drm_device *dev); | ||
| 1473 | extern int drm_agp_release_ioctl(struct drm_device *dev, void *data, | ||
| 1474 | struct drm_file *file_priv); | ||
| 1475 | extern int drm_agp_enable(struct drm_device *dev, struct drm_agp_mode mode); | ||
| 1476 | extern int drm_agp_enable_ioctl(struct drm_device *dev, void *data, | ||
| 1477 | struct drm_file *file_priv); | ||
| 1478 | extern int drm_agp_info(struct drm_device *dev, struct drm_agp_info *info); | ||
| 1479 | extern int drm_agp_info_ioctl(struct drm_device *dev, void *data, | ||
| 1480 | struct drm_file *file_priv); | ||
| 1481 | extern int drm_agp_alloc(struct drm_device *dev, struct drm_agp_buffer *request); | ||
| 1482 | extern int drm_agp_alloc_ioctl(struct drm_device *dev, void *data, | ||
| 1483 | struct drm_file *file_priv); | ||
| 1484 | extern int drm_agp_free(struct drm_device *dev, struct drm_agp_buffer *request); | ||
| 1485 | extern int drm_agp_free_ioctl(struct drm_device *dev, void *data, | ||
| 1486 | struct drm_file *file_priv); | ||
| 1487 | extern int drm_agp_unbind(struct drm_device *dev, struct drm_agp_binding *request); | ||
| 1488 | extern int drm_agp_unbind_ioctl(struct drm_device *dev, void *data, | ||
| 1489 | struct drm_file *file_priv); | ||
| 1490 | extern int drm_agp_bind(struct drm_device *dev, struct drm_agp_binding *request); | ||
| 1491 | extern int drm_agp_bind_ioctl(struct drm_device *dev, void *data, | ||
| 1492 | struct drm_file *file_priv); | ||
| 1493 | 1447 | ||
| 1494 | /* Stub support (drm_stub.h) */ | 1448 | /* Stub support (drm_stub.h) */ |
| 1495 | extern int drm_setmaster_ioctl(struct drm_device *dev, void *data, | 1449 | extern int drm_setmaster_ioctl(struct drm_device *dev, void *data, |
| @@ -1504,23 +1458,19 @@ extern void drm_put_dev(struct drm_device *dev); | |||
| 1504 | extern int drm_put_minor(struct drm_minor **minor); | 1458 | extern int drm_put_minor(struct drm_minor **minor); |
| 1505 | extern void drm_unplug_dev(struct drm_device *dev); | 1459 | extern void drm_unplug_dev(struct drm_device *dev); |
| 1506 | extern unsigned int drm_debug; | 1460 | extern unsigned int drm_debug; |
| 1461 | extern unsigned int drm_rnodes; | ||
| 1507 | 1462 | ||
| 1508 | extern unsigned int drm_vblank_offdelay; | 1463 | extern unsigned int drm_vblank_offdelay; |
| 1509 | extern unsigned int drm_timestamp_precision; | 1464 | extern unsigned int drm_timestamp_precision; |
| 1510 | extern unsigned int drm_timestamp_monotonic; | 1465 | extern unsigned int drm_timestamp_monotonic; |
| 1511 | 1466 | ||
| 1512 | extern struct class *drm_class; | 1467 | extern struct class *drm_class; |
| 1513 | extern struct proc_dir_entry *drm_proc_root; | ||
| 1514 | extern struct dentry *drm_debugfs_root; | 1468 | extern struct dentry *drm_debugfs_root; |
| 1515 | 1469 | ||
| 1516 | extern struct idr drm_minors_idr; | 1470 | extern struct idr drm_minors_idr; |
| 1517 | 1471 | ||
| 1518 | extern struct drm_local_map *drm_getsarea(struct drm_device *dev); | 1472 | extern struct drm_local_map *drm_getsarea(struct drm_device *dev); |
| 1519 | 1473 | ||
| 1520 | /* Proc support (drm_proc.h) */ | ||
| 1521 | extern int drm_proc_init(struct drm_minor *minor, struct proc_dir_entry *root); | ||
| 1522 | extern int drm_proc_cleanup(struct drm_minor *minor, struct proc_dir_entry *root); | ||
| 1523 | |||
| 1524 | /* Debugfs support */ | 1474 | /* Debugfs support */ |
| 1525 | #if defined(CONFIG_DEBUG_FS) | 1475 | #if defined(CONFIG_DEBUG_FS) |
| 1526 | extern int drm_debugfs_init(struct drm_minor *minor, int minor_id, | 1476 | extern int drm_debugfs_init(struct drm_minor *minor, int minor_id, |
| @@ -1550,6 +1500,7 @@ extern struct drm_gem_object *drm_gem_prime_import(struct drm_device *dev, | |||
| 1550 | struct dma_buf *dma_buf); | 1500 | struct dma_buf *dma_buf); |
| 1551 | extern int drm_gem_prime_fd_to_handle(struct drm_device *dev, | 1501 | extern int drm_gem_prime_fd_to_handle(struct drm_device *dev, |
| 1552 | struct drm_file *file_priv, int prime_fd, uint32_t *handle); | 1502 | struct drm_file *file_priv, int prime_fd, uint32_t *handle); |
| 1503 | extern void drm_gem_dmabuf_release(struct dma_buf *dma_buf); | ||
| 1553 | 1504 | ||
| 1554 | extern int drm_prime_handle_to_fd_ioctl(struct drm_device *dev, void *data, | 1505 | extern int drm_prime_handle_to_fd_ioctl(struct drm_device *dev, void *data, |
| 1555 | struct drm_file *file_priv); | 1506 | struct drm_file *file_priv); |
| @@ -1561,25 +1512,22 @@ extern int drm_prime_sg_to_page_addr_arrays(struct sg_table *sgt, struct page ** | |||
| 1561 | extern struct sg_table *drm_prime_pages_to_sg(struct page **pages, int nr_pages); | 1512 | extern struct sg_table *drm_prime_pages_to_sg(struct page **pages, int nr_pages); |
| 1562 | extern void drm_prime_gem_destroy(struct drm_gem_object *obj, struct sg_table *sg); | 1513 | extern void drm_prime_gem_destroy(struct drm_gem_object *obj, struct sg_table *sg); |
| 1563 | 1514 | ||
| 1515 | int drm_gem_dumb_destroy(struct drm_file *file, | ||
| 1516 | struct drm_device *dev, | ||
| 1517 | uint32_t handle); | ||
| 1564 | 1518 | ||
| 1565 | void drm_prime_init_file_private(struct drm_prime_file_private *prime_fpriv); | 1519 | void drm_prime_init_file_private(struct drm_prime_file_private *prime_fpriv); |
| 1566 | void drm_prime_destroy_file_private(struct drm_prime_file_private *prime_fpriv); | 1520 | void drm_prime_destroy_file_private(struct drm_prime_file_private *prime_fpriv); |
| 1567 | int drm_prime_lookup_buf_handle(struct drm_prime_file_private *prime_fpriv, struct dma_buf *dma_buf, uint32_t *handle); | 1521 | void drm_prime_remove_buf_handle_locked(struct drm_prime_file_private *prime_fpriv, struct dma_buf *dma_buf); |
| 1568 | void drm_prime_remove_buf_handle(struct drm_prime_file_private *prime_fpriv, struct dma_buf *dma_buf); | ||
| 1569 | |||
| 1570 | int drm_prime_add_dma_buf(struct drm_device *dev, struct drm_gem_object *obj); | ||
| 1571 | int drm_prime_lookup_obj(struct drm_device *dev, struct dma_buf *buf, | ||
| 1572 | struct drm_gem_object **obj); | ||
| 1573 | 1522 | ||
| 1574 | #if DRM_DEBUG_CODE | 1523 | #if DRM_DEBUG_CODE |
| 1575 | extern int drm_vma_info(struct seq_file *m, void *data); | 1524 | extern int drm_vma_info(struct seq_file *m, void *data); |
| 1576 | #endif | 1525 | #endif |
| 1577 | 1526 | ||
| 1578 | /* Scatter Gather Support (drm_scatter.h) */ | 1527 | /* Scatter Gather Support (drm_scatter.h) */ |
| 1579 | extern void drm_sg_cleanup(struct drm_sg_mem * entry); | 1528 | extern void drm_legacy_sg_cleanup(struct drm_device *dev); |
| 1580 | extern int drm_sg_alloc_ioctl(struct drm_device *dev, void *data, | 1529 | extern int drm_sg_alloc(struct drm_device *dev, void *data, |
| 1581 | struct drm_file *file_priv); | 1530 | struct drm_file *file_priv); |
| 1582 | extern int drm_sg_alloc(struct drm_device *dev, struct drm_scatter_gather * request); | ||
| 1583 | extern int drm_sg_free(struct drm_device *dev, void *data, | 1531 | extern int drm_sg_free(struct drm_device *dev, void *data, |
| 1584 | struct drm_file *file_priv); | 1532 | struct drm_file *file_priv); |
| 1585 | 1533 | ||
| @@ -1613,9 +1561,8 @@ struct drm_gem_object *drm_gem_object_alloc(struct drm_device *dev, | |||
| 1613 | size_t size); | 1561 | size_t size); |
| 1614 | int drm_gem_object_init(struct drm_device *dev, | 1562 | int drm_gem_object_init(struct drm_device *dev, |
| 1615 | struct drm_gem_object *obj, size_t size); | 1563 | struct drm_gem_object *obj, size_t size); |
| 1616 | int drm_gem_private_object_init(struct drm_device *dev, | 1564 | void drm_gem_private_object_init(struct drm_device *dev, |
| 1617 | struct drm_gem_object *obj, size_t size); | 1565 | struct drm_gem_object *obj, size_t size); |
| 1618 | void drm_gem_object_handle_free(struct drm_gem_object *obj); | ||
| 1619 | void drm_gem_vm_open(struct vm_area_struct *vma); | 1566 | void drm_gem_vm_open(struct vm_area_struct *vma); |
| 1620 | void drm_gem_vm_close(struct vm_area_struct *vma); | 1567 | void drm_gem_vm_close(struct vm_area_struct *vma); |
| 1621 | int drm_gem_mmap_obj(struct drm_gem_object *obj, unsigned long obj_size, | 1568 | int drm_gem_mmap_obj(struct drm_gem_object *obj, unsigned long obj_size, |
| @@ -1640,66 +1587,32 @@ drm_gem_object_unreference(struct drm_gem_object *obj) | |||
| 1640 | static inline void | 1587 | static inline void |
| 1641 | drm_gem_object_unreference_unlocked(struct drm_gem_object *obj) | 1588 | drm_gem_object_unreference_unlocked(struct drm_gem_object *obj) |
| 1642 | { | 1589 | { |
| 1643 | if (obj != NULL) { | 1590 | if (obj && !atomic_add_unless(&obj->refcount.refcount, -1, 1)) { |
| 1644 | struct drm_device *dev = obj->dev; | 1591 | struct drm_device *dev = obj->dev; |
| 1592 | |||
| 1645 | mutex_lock(&dev->struct_mutex); | 1593 | mutex_lock(&dev->struct_mutex); |
| 1646 | kref_put(&obj->refcount, drm_gem_object_free); | 1594 | if (likely(atomic_dec_and_test(&obj->refcount.refcount))) |
| 1595 | drm_gem_object_free(&obj->refcount); | ||
| 1647 | mutex_unlock(&dev->struct_mutex); | 1596 | mutex_unlock(&dev->struct_mutex); |
| 1648 | } | 1597 | } |
| 1649 | } | 1598 | } |
| 1650 | 1599 | ||
| 1600 | int drm_gem_handle_create_tail(struct drm_file *file_priv, | ||
| 1601 | struct drm_gem_object *obj, | ||
| 1602 | u32 *handlep); | ||
| 1651 | int drm_gem_handle_create(struct drm_file *file_priv, | 1603 | int drm_gem_handle_create(struct drm_file *file_priv, |
| 1652 | struct drm_gem_object *obj, | 1604 | struct drm_gem_object *obj, |
| 1653 | u32 *handlep); | 1605 | u32 *handlep); |
| 1654 | int drm_gem_handle_delete(struct drm_file *filp, u32 handle); | 1606 | int drm_gem_handle_delete(struct drm_file *filp, u32 handle); |
| 1655 | 1607 | ||
| 1656 | static inline void | ||
| 1657 | drm_gem_object_handle_reference(struct drm_gem_object *obj) | ||
| 1658 | { | ||
| 1659 | drm_gem_object_reference(obj); | ||
| 1660 | atomic_inc(&obj->handle_count); | ||
| 1661 | } | ||
| 1662 | |||
| 1663 | static inline void | ||
| 1664 | drm_gem_object_handle_unreference(struct drm_gem_object *obj) | ||
| 1665 | { | ||
| 1666 | if (obj == NULL) | ||
| 1667 | return; | ||
| 1668 | |||
| 1669 | if (atomic_read(&obj->handle_count) == 0) | ||
| 1670 | return; | ||
| 1671 | /* | ||
| 1672 | * Must bump handle count first as this may be the last | ||
| 1673 | * ref, in which case the object would disappear before we | ||
| 1674 | * checked for a name | ||
| 1675 | */ | ||
| 1676 | if (atomic_dec_and_test(&obj->handle_count)) | ||
| 1677 | drm_gem_object_handle_free(obj); | ||
| 1678 | drm_gem_object_unreference(obj); | ||
| 1679 | } | ||
| 1680 | |||
| 1681 | static inline void | ||
| 1682 | drm_gem_object_handle_unreference_unlocked(struct drm_gem_object *obj) | ||
| 1683 | { | ||
| 1684 | if (obj == NULL) | ||
| 1685 | return; | ||
| 1686 | |||
| 1687 | if (atomic_read(&obj->handle_count) == 0) | ||
| 1688 | return; | ||
| 1689 | |||
| 1690 | /* | ||
| 1691 | * Must bump handle count first as this may be the last | ||
| 1692 | * ref, in which case the object would disappear before we | ||
| 1693 | * checked for a name | ||
| 1694 | */ | ||
| 1695 | |||
| 1696 | if (atomic_dec_and_test(&obj->handle_count)) | ||
| 1697 | drm_gem_object_handle_free(obj); | ||
| 1698 | drm_gem_object_unreference_unlocked(obj); | ||
| 1699 | } | ||
| 1700 | 1608 | ||
| 1701 | void drm_gem_free_mmap_offset(struct drm_gem_object *obj); | 1609 | void drm_gem_free_mmap_offset(struct drm_gem_object *obj); |
| 1702 | int drm_gem_create_mmap_offset(struct drm_gem_object *obj); | 1610 | int drm_gem_create_mmap_offset(struct drm_gem_object *obj); |
| 1611 | int drm_gem_create_mmap_offset_size(struct drm_gem_object *obj, size_t size); | ||
| 1612 | |||
| 1613 | struct page **drm_gem_get_pages(struct drm_gem_object *obj, gfp_t gfpmask); | ||
| 1614 | void drm_gem_put_pages(struct drm_gem_object *obj, struct page **pages, | ||
| 1615 | bool dirty, bool accessed); | ||
| 1703 | 1616 | ||
| 1704 | struct drm_gem_object *drm_gem_object_lookup(struct drm_device *dev, | 1617 | struct drm_gem_object *drm_gem_object_lookup(struct drm_device *dev, |
| 1705 | struct drm_file *filp, | 1618 | struct drm_file *filp, |
| @@ -1769,9 +1682,6 @@ extern int drm_pcie_get_speed_cap_mask(struct drm_device *dev, u32 *speed_mask); | |||
| 1769 | extern int drm_platform_init(struct drm_driver *driver, struct platform_device *platform_device); | 1682 | extern int drm_platform_init(struct drm_driver *driver, struct platform_device *platform_device); |
| 1770 | extern void drm_platform_exit(struct drm_driver *driver, struct platform_device *platform_device); | 1683 | extern void drm_platform_exit(struct drm_driver *driver, struct platform_device *platform_device); |
| 1771 | 1684 | ||
| 1772 | extern int drm_get_platform_dev(struct platform_device *pdev, | ||
| 1773 | struct drm_driver *driver); | ||
| 1774 | |||
| 1775 | /* returns true if currently okay to sleep */ | 1685 | /* returns true if currently okay to sleep */ |
| 1776 | static __inline__ bool drm_can_sleep(void) | 1686 | static __inline__ bool drm_can_sleep(void) |
| 1777 | { | 1687 | { |
diff --git a/include/drm/drm_agpsupport.h b/include/drm/drm_agpsupport.h new file mode 100644 index 000000000000..a184eeee9c96 --- /dev/null +++ b/include/drm/drm_agpsupport.h | |||
| @@ -0,0 +1,194 @@ | |||
| 1 | #ifndef _DRM_AGPSUPPORT_H_ | ||
| 2 | #define _DRM_AGPSUPPORT_H_ | ||
| 3 | |||
| 4 | #include <linux/kernel.h> | ||
| 5 | #include <linux/mm.h> | ||
| 6 | #include <linux/mutex.h> | ||
| 7 | #include <linux/types.h> | ||
| 8 | #include <linux/agp_backend.h> | ||
| 9 | #include <drm/drmP.h> | ||
| 10 | |||
| 11 | #if __OS_HAS_AGP | ||
| 12 | |||
| 13 | void drm_free_agp(DRM_AGP_MEM * handle, int pages); | ||
| 14 | int drm_bind_agp(DRM_AGP_MEM * handle, unsigned int start); | ||
| 15 | int drm_unbind_agp(DRM_AGP_MEM * handle); | ||
| 16 | DRM_AGP_MEM *drm_agp_bind_pages(struct drm_device *dev, | ||
| 17 | struct page **pages, | ||
| 18 | unsigned long num_pages, | ||
| 19 | uint32_t gtt_offset, | ||
| 20 | uint32_t type); | ||
| 21 | |||
| 22 | struct drm_agp_head *drm_agp_init(struct drm_device *dev); | ||
| 23 | void drm_agp_destroy(struct drm_agp_head *agp); | ||
| 24 | void drm_agp_clear(struct drm_device *dev); | ||
| 25 | int drm_agp_acquire(struct drm_device *dev); | ||
| 26 | int drm_agp_acquire_ioctl(struct drm_device *dev, void *data, | ||
| 27 | struct drm_file *file_priv); | ||
| 28 | int drm_agp_release(struct drm_device *dev); | ||
| 29 | int drm_agp_release_ioctl(struct drm_device *dev, void *data, | ||
| 30 | struct drm_file *file_priv); | ||
| 31 | int drm_agp_enable(struct drm_device *dev, struct drm_agp_mode mode); | ||
| 32 | int drm_agp_enable_ioctl(struct drm_device *dev, void *data, | ||
| 33 | struct drm_file *file_priv); | ||
| 34 | int drm_agp_info(struct drm_device *dev, struct drm_agp_info *info); | ||
| 35 | int drm_agp_info_ioctl(struct drm_device *dev, void *data, | ||
| 36 | struct drm_file *file_priv); | ||
| 37 | int drm_agp_alloc(struct drm_device *dev, struct drm_agp_buffer *request); | ||
| 38 | int drm_agp_alloc_ioctl(struct drm_device *dev, void *data, | ||
| 39 | struct drm_file *file_priv); | ||
| 40 | int drm_agp_free(struct drm_device *dev, struct drm_agp_buffer *request); | ||
| 41 | int drm_agp_free_ioctl(struct drm_device *dev, void *data, | ||
| 42 | struct drm_file *file_priv); | ||
| 43 | int drm_agp_unbind(struct drm_device *dev, struct drm_agp_binding *request); | ||
| 44 | int drm_agp_unbind_ioctl(struct drm_device *dev, void *data, | ||
| 45 | struct drm_file *file_priv); | ||
| 46 | int drm_agp_bind(struct drm_device *dev, struct drm_agp_binding *request); | ||
| 47 | int drm_agp_bind_ioctl(struct drm_device *dev, void *data, | ||
| 48 | struct drm_file *file_priv); | ||
| 49 | |||
| 50 | static inline int drm_core_has_AGP(struct drm_device *dev) | ||
| 51 | { | ||
| 52 | return drm_core_check_feature(dev, DRIVER_USE_AGP); | ||
| 53 | } | ||
| 54 | |||
| 55 | #else /* __OS_HAS_AGP */ | ||
| 56 | |||
| 57 | static inline void drm_free_agp(DRM_AGP_MEM * handle, int pages) | ||
| 58 | { | ||
| 59 | } | ||
| 60 | |||
| 61 | static inline int drm_bind_agp(DRM_AGP_MEM * handle, unsigned int start) | ||
| 62 | { | ||
| 63 | return -ENODEV; | ||
| 64 | } | ||
| 65 | |||
| 66 | static inline int drm_unbind_agp(DRM_AGP_MEM * handle) | ||
| 67 | { | ||
| 68 | return -ENODEV; | ||
| 69 | } | ||
| 70 | |||
| 71 | static inline DRM_AGP_MEM *drm_agp_bind_pages(struct drm_device *dev, | ||
| 72 | struct page **pages, | ||
| 73 | unsigned long num_pages, | ||
| 74 | uint32_t gtt_offset, | ||
| 75 | uint32_t type) | ||
| 76 | { | ||
| 77 | return NULL; | ||
| 78 | } | ||
| 79 | |||
| 80 | static inline struct drm_agp_head *drm_agp_init(struct drm_device *dev) | ||
| 81 | { | ||
| 82 | return NULL; | ||
| 83 | } | ||
| 84 | |||
| 85 | static inline void drm_agp_destroy(struct drm_agp_head *agp) | ||
| 86 | { | ||
| 87 | } | ||
| 88 | |||
| 89 | static inline void drm_agp_clear(struct drm_device *dev) | ||
| 90 | { | ||
| 91 | } | ||
| 92 | |||
| 93 | static inline int drm_agp_acquire(struct drm_device *dev) | ||
| 94 | { | ||
| 95 | return -ENODEV; | ||
| 96 | } | ||
| 97 | |||
| 98 | static inline int drm_agp_acquire_ioctl(struct drm_device *dev, void *data, | ||
| 99 | struct drm_file *file_priv) | ||
| 100 | { | ||
| 101 | return -ENODEV; | ||
| 102 | } | ||
| 103 | |||
| 104 | static inline int drm_agp_release(struct drm_device *dev) | ||
| 105 | { | ||
| 106 | return -ENODEV; | ||
| 107 | } | ||
| 108 | |||
| 109 | static inline int drm_agp_release_ioctl(struct drm_device *dev, void *data, | ||
| 110 | struct drm_file *file_priv) | ||
| 111 | { | ||
| 112 | return -ENODEV; | ||
| 113 | } | ||
| 114 | |||
| 115 | static inline int drm_agp_enable(struct drm_device *dev, | ||
| 116 | struct drm_agp_mode mode) | ||
| 117 | { | ||
| 118 | return -ENODEV; | ||
| 119 | } | ||
| 120 | |||
| 121 | static inline int drm_agp_enable_ioctl(struct drm_device *dev, void *data, | ||
| 122 | struct drm_file *file_priv) | ||
| 123 | { | ||
| 124 | return -ENODEV; | ||
| 125 | } | ||
| 126 | |||
| 127 | static inline int drm_agp_info(struct drm_device *dev, | ||
| 128 | struct drm_agp_info *info) | ||
| 129 | { | ||
| 130 | return -ENODEV; | ||
| 131 | } | ||
| 132 | |||
| 133 | static inline int drm_agp_info_ioctl(struct drm_device *dev, void *data, | ||
| 134 | struct drm_file *file_priv) | ||
| 135 | { | ||
| 136 | return -ENODEV; | ||
| 137 | } | ||
| 138 | |||
| 139 | static inline int drm_agp_alloc(struct drm_device *dev, | ||
| 140 | struct drm_agp_buffer *request) | ||
| 141 | { | ||
| 142 | return -ENODEV; | ||
| 143 | } | ||
| 144 | |||
| 145 | static inline int drm_agp_alloc_ioctl(struct drm_device *dev, void *data, | ||
| 146 | struct drm_file *file_priv) | ||
| 147 | { | ||
| 148 | return -ENODEV; | ||
| 149 | } | ||
| 150 | |||
| 151 | static inline int drm_agp_free(struct drm_device *dev, | ||
| 152 | struct drm_agp_buffer *request) | ||
| 153 | { | ||
| 154 | return -ENODEV; | ||
| 155 | } | ||
| 156 | |||
| 157 | static inline int drm_agp_free_ioctl(struct drm_device *dev, void *data, | ||
| 158 | struct drm_file *file_priv) | ||
| 159 | { | ||
| 160 | return -ENODEV; | ||
| 161 | } | ||
| 162 | |||
| 163 | static inline int drm_agp_unbind(struct drm_device *dev, | ||
| 164 | struct drm_agp_binding *request) | ||
| 165 | { | ||
| 166 | return -ENODEV; | ||
| 167 | } | ||
| 168 | |||
| 169 | static inline int drm_agp_unbind_ioctl(struct drm_device *dev, void *data, | ||
| 170 | struct drm_file *file_priv) | ||
| 171 | { | ||
| 172 | return -ENODEV; | ||
| 173 | } | ||
| 174 | |||
| 175 | static inline int drm_agp_bind(struct drm_device *dev, | ||
| 176 | struct drm_agp_binding *request) | ||
| 177 | { | ||
| 178 | return -ENODEV; | ||
| 179 | } | ||
| 180 | |||
| 181 | static inline int drm_agp_bind_ioctl(struct drm_device *dev, void *data, | ||
| 182 | struct drm_file *file_priv) | ||
| 183 | { | ||
| 184 | return -ENODEV; | ||
| 185 | } | ||
| 186 | |||
| 187 | static inline int drm_core_has_AGP(struct drm_device *dev) | ||
| 188 | { | ||
| 189 | return 0; | ||
| 190 | } | ||
| 191 | |||
| 192 | #endif /* __OS_HAS_AGP */ | ||
| 193 | |||
| 194 | #endif /* _DRM_AGPSUPPORT_H_ */ | ||
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index fa12a2fa4293..24f499569a2f 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h | |||
| @@ -49,6 +49,7 @@ struct drm_clip_rect; | |||
| 49 | #define DRM_MODE_OBJECT_FB 0xfbfbfbfb | 49 | #define DRM_MODE_OBJECT_FB 0xfbfbfbfb |
| 50 | #define DRM_MODE_OBJECT_BLOB 0xbbbbbbbb | 50 | #define DRM_MODE_OBJECT_BLOB 0xbbbbbbbb |
| 51 | #define DRM_MODE_OBJECT_PLANE 0xeeeeeeee | 51 | #define DRM_MODE_OBJECT_PLANE 0xeeeeeeee |
| 52 | #define DRM_MODE_OBJECT_BRIDGE 0xbdbdbdbd | ||
| 52 | 53 | ||
| 53 | struct drm_mode_object { | 54 | struct drm_mode_object { |
| 54 | uint32_t id; | 55 | uint32_t id; |
| @@ -305,6 +306,7 @@ struct drm_connector; | |||
| 305 | struct drm_encoder; | 306 | struct drm_encoder; |
| 306 | struct drm_pending_vblank_event; | 307 | struct drm_pending_vblank_event; |
| 307 | struct drm_plane; | 308 | struct drm_plane; |
| 309 | struct drm_bridge; | ||
| 308 | 310 | ||
| 309 | /** | 311 | /** |
| 310 | * drm_crtc_funcs - control CRTCs for a given device | 312 | * drm_crtc_funcs - control CRTCs for a given device |
| @@ -363,7 +365,8 @@ struct drm_crtc_funcs { | |||
| 363 | */ | 365 | */ |
| 364 | int (*page_flip)(struct drm_crtc *crtc, | 366 | int (*page_flip)(struct drm_crtc *crtc, |
| 365 | struct drm_framebuffer *fb, | 367 | struct drm_framebuffer *fb, |
| 366 | struct drm_pending_vblank_event *event); | 368 | struct drm_pending_vblank_event *event, |
| 369 | uint32_t flags); | ||
| 367 | 370 | ||
| 368 | int (*set_property)(struct drm_crtc *crtc, | 371 | int (*set_property)(struct drm_crtc *crtc, |
| 369 | struct drm_property *property, uint64_t val); | 372 | struct drm_property *property, uint64_t val); |
| @@ -494,8 +497,6 @@ struct drm_encoder_funcs { | |||
| 494 | void (*destroy)(struct drm_encoder *encoder); | 497 | void (*destroy)(struct drm_encoder *encoder); |
| 495 | }; | 498 | }; |
| 496 | 499 | ||
| 497 | #define DRM_CONNECTOR_MAX_UMODES 16 | ||
| 498 | #define DRM_CONNECTOR_LEN 32 | ||
| 499 | #define DRM_CONNECTOR_MAX_ENCODER 3 | 500 | #define DRM_CONNECTOR_MAX_ENCODER 3 |
| 500 | 501 | ||
| 501 | /** | 502 | /** |
| @@ -507,6 +508,7 @@ struct drm_encoder_funcs { | |||
| 507 | * @possible_crtcs: bitmask of potential CRTC bindings | 508 | * @possible_crtcs: bitmask of potential CRTC bindings |
| 508 | * @possible_clones: bitmask of potential sibling encoders for cloning | 509 | * @possible_clones: bitmask of potential sibling encoders for cloning |
| 509 | * @crtc: currently bound CRTC | 510 | * @crtc: currently bound CRTC |
| 511 | * @bridge: bridge associated to the encoder | ||
| 510 | * @funcs: control functions | 512 | * @funcs: control functions |
| 511 | * @helper_private: mid-layer private data | 513 | * @helper_private: mid-layer private data |
| 512 | * | 514 | * |
| @@ -523,6 +525,7 @@ struct drm_encoder { | |||
| 523 | uint32_t possible_clones; | 525 | uint32_t possible_clones; |
| 524 | 526 | ||
| 525 | struct drm_crtc *crtc; | 527 | struct drm_crtc *crtc; |
| 528 | struct drm_bridge *bridge; | ||
| 526 | const struct drm_encoder_funcs *funcs; | 529 | const struct drm_encoder_funcs *funcs; |
| 527 | void *helper_private; | 530 | void *helper_private; |
| 528 | }; | 531 | }; |
| @@ -683,6 +686,48 @@ struct drm_plane { | |||
| 683 | }; | 686 | }; |
| 684 | 687 | ||
| 685 | /** | 688 | /** |
| 689 | * drm_bridge_funcs - drm_bridge control functions | ||
| 690 | * @mode_fixup: Try to fixup (or reject entirely) proposed mode for this bridge | ||
| 691 | * @disable: Called right before encoder prepare, disables the bridge | ||
| 692 | * @post_disable: Called right after encoder prepare, for lockstepped disable | ||
| 693 | * @mode_set: Set this mode to the bridge | ||
| 694 | * @pre_enable: Called right before encoder commit, for lockstepped commit | ||
| 695 | * @enable: Called right after encoder commit, enables the bridge | ||
| 696 | * @destroy: make object go away | ||
| 697 | */ | ||
| 698 | struct drm_bridge_funcs { | ||
| 699 | bool (*mode_fixup)(struct drm_bridge *bridge, | ||
| 700 | const struct drm_display_mode *mode, | ||
| 701 | struct drm_display_mode *adjusted_mode); | ||
| 702 | void (*disable)(struct drm_bridge *bridge); | ||
| 703 | void (*post_disable)(struct drm_bridge *bridge); | ||
| 704 | void (*mode_set)(struct drm_bridge *bridge, | ||
| 705 | struct drm_display_mode *mode, | ||
| 706 | struct drm_display_mode *adjusted_mode); | ||
| 707 | void (*pre_enable)(struct drm_bridge *bridge); | ||
| 708 | void (*enable)(struct drm_bridge *bridge); | ||
| 709 | void (*destroy)(struct drm_bridge *bridge); | ||
| 710 | }; | ||
| 711 | |||
| 712 | /** | ||
| 713 | * drm_bridge - central DRM bridge control structure | ||
| 714 | * @dev: DRM device this bridge belongs to | ||
| 715 | * @head: list management | ||
| 716 | * @base: base mode object | ||
| 717 | * @funcs: control functions | ||
| 718 | * @driver_private: pointer to the bridge driver's internal context | ||
| 719 | */ | ||
| 720 | struct drm_bridge { | ||
| 721 | struct drm_device *dev; | ||
| 722 | struct list_head head; | ||
| 723 | |||
| 724 | struct drm_mode_object base; | ||
| 725 | |||
| 726 | const struct drm_bridge_funcs *funcs; | ||
| 727 | void *driver_private; | ||
| 728 | }; | ||
| 729 | |||
| 730 | /** | ||
| 686 | * drm_mode_set - new values for a CRTC config change | 731 | * drm_mode_set - new values for a CRTC config change |
| 687 | * @head: list management | 732 | * @head: list management |
| 688 | * @fb: framebuffer to use for new config | 733 | * @fb: framebuffer to use for new config |
| @@ -742,6 +787,7 @@ struct drm_mode_group { | |||
| 742 | uint32_t num_crtcs; | 787 | uint32_t num_crtcs; |
| 743 | uint32_t num_encoders; | 788 | uint32_t num_encoders; |
| 744 | uint32_t num_connectors; | 789 | uint32_t num_connectors; |
| 790 | uint32_t num_bridges; | ||
| 745 | 791 | ||
| 746 | /* list of object IDs for this group */ | 792 | /* list of object IDs for this group */ |
| 747 | uint32_t *id_list; | 793 | uint32_t *id_list; |
| @@ -756,6 +802,8 @@ struct drm_mode_group { | |||
| 756 | * @fb_list: list of framebuffers available | 802 | * @fb_list: list of framebuffers available |
| 757 | * @num_connector: number of connectors on this device | 803 | * @num_connector: number of connectors on this device |
| 758 | * @connector_list: list of connector objects | 804 | * @connector_list: list of connector objects |
| 805 | * @num_bridge: number of bridges on this device | ||
| 806 | * @bridge_list: list of bridge objects | ||
| 759 | * @num_encoder: number of encoders on this device | 807 | * @num_encoder: number of encoders on this device |
| 760 | * @encoder_list: list of encoder objects | 808 | * @encoder_list: list of encoder objects |
| 761 | * @num_crtc: number of CRTCs on this device | 809 | * @num_crtc: number of CRTCs on this device |
| @@ -793,6 +841,8 @@ struct drm_mode_config { | |||
| 793 | 841 | ||
| 794 | int num_connector; | 842 | int num_connector; |
| 795 | struct list_head connector_list; | 843 | struct list_head connector_list; |
| 844 | int num_bridge; | ||
| 845 | struct list_head bridge_list; | ||
| 796 | int num_encoder; | 846 | int num_encoder; |
| 797 | struct list_head encoder_list; | 847 | struct list_head encoder_list; |
| 798 | int num_plane; | 848 | int num_plane; |
| @@ -839,11 +889,13 @@ struct drm_mode_config { | |||
| 839 | 889 | ||
| 840 | /* Optional properties */ | 890 | /* Optional properties */ |
| 841 | struct drm_property *scaling_mode_property; | 891 | struct drm_property *scaling_mode_property; |
| 842 | struct drm_property *dithering_mode_property; | ||
| 843 | struct drm_property *dirty_info_property; | 892 | struct drm_property *dirty_info_property; |
| 844 | 893 | ||
| 845 | /* dumb ioctl parameters */ | 894 | /* dumb ioctl parameters */ |
| 846 | uint32_t preferred_depth, prefer_shadow; | 895 | uint32_t preferred_depth, prefer_shadow; |
| 896 | |||
| 897 | /* whether async page flip is supported or not */ | ||
| 898 | bool async_page_flip; | ||
| 847 | }; | 899 | }; |
| 848 | 900 | ||
| 849 | #define obj_to_crtc(x) container_of(x, struct drm_crtc, base) | 901 | #define obj_to_crtc(x) container_of(x, struct drm_crtc, base) |
| @@ -869,6 +921,8 @@ extern int drm_crtc_init(struct drm_device *dev, | |||
| 869 | const struct drm_crtc_funcs *funcs); | 921 | const struct drm_crtc_funcs *funcs); |
| 870 | extern void drm_crtc_cleanup(struct drm_crtc *crtc); | 922 | extern void drm_crtc_cleanup(struct drm_crtc *crtc); |
| 871 | 923 | ||
| 924 | extern void drm_connector_ida_init(void); | ||
| 925 | extern void drm_connector_ida_destroy(void); | ||
| 872 | extern int drm_connector_init(struct drm_device *dev, | 926 | extern int drm_connector_init(struct drm_device *dev, |
| 873 | struct drm_connector *connector, | 927 | struct drm_connector *connector, |
| 874 | const struct drm_connector_funcs *funcs, | 928 | const struct drm_connector_funcs *funcs, |
| @@ -878,6 +932,10 @@ extern void drm_connector_cleanup(struct drm_connector *connector); | |||
| 878 | /* helper to unplug all connectors from sysfs for device */ | 932 | /* helper to unplug all connectors from sysfs for device */ |
| 879 | extern void drm_connector_unplug_all(struct drm_device *dev); | 933 | extern void drm_connector_unplug_all(struct drm_device *dev); |
| 880 | 934 | ||
| 935 | extern int drm_bridge_init(struct drm_device *dev, struct drm_bridge *bridge, | ||
| 936 | const struct drm_bridge_funcs *funcs); | ||
| 937 | extern void drm_bridge_cleanup(struct drm_bridge *bridge); | ||
| 938 | |||
| 881 | extern int drm_encoder_init(struct drm_device *dev, | 939 | extern int drm_encoder_init(struct drm_device *dev, |
| 882 | struct drm_encoder *encoder, | 940 | struct drm_encoder *encoder, |
| 883 | const struct drm_encoder_funcs *funcs, | 941 | const struct drm_encoder_funcs *funcs, |
| @@ -908,7 +966,6 @@ extern struct edid *drm_get_edid(struct drm_connector *connector, | |||
| 908 | struct i2c_adapter *adapter); | 966 | struct i2c_adapter *adapter); |
| 909 | extern int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid); | 967 | extern int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid); |
| 910 | extern void drm_mode_probed_add(struct drm_connector *connector, struct drm_display_mode *mode); | 968 | extern void drm_mode_probed_add(struct drm_connector *connector, struct drm_display_mode *mode); |
| 911 | extern void drm_mode_remove(struct drm_connector *connector, struct drm_display_mode *mode); | ||
| 912 | extern void drm_mode_copy(struct drm_display_mode *dst, const struct drm_display_mode *src); | 969 | extern void drm_mode_copy(struct drm_display_mode *dst, const struct drm_display_mode *src); |
| 913 | extern struct drm_display_mode *drm_mode_duplicate(struct drm_device *dev, | 970 | extern struct drm_display_mode *drm_mode_duplicate(struct drm_device *dev, |
| 914 | const struct drm_display_mode *mode); | 971 | const struct drm_display_mode *mode); |
| @@ -925,14 +982,9 @@ extern int drm_mode_height(const struct drm_display_mode *mode); | |||
| 925 | /* for us by fb module */ | 982 | /* for us by fb module */ |
| 926 | extern struct drm_display_mode *drm_mode_create(struct drm_device *dev); | 983 | extern struct drm_display_mode *drm_mode_create(struct drm_device *dev); |
| 927 | extern void drm_mode_destroy(struct drm_device *dev, struct drm_display_mode *mode); | 984 | extern void drm_mode_destroy(struct drm_device *dev, struct drm_display_mode *mode); |
| 928 | extern void drm_mode_list_concat(struct list_head *head, | ||
| 929 | struct list_head *new); | ||
| 930 | extern void drm_mode_validate_size(struct drm_device *dev, | 985 | extern void drm_mode_validate_size(struct drm_device *dev, |
| 931 | struct list_head *mode_list, | 986 | struct list_head *mode_list, |
| 932 | int maxX, int maxY, int maxPitch); | 987 | int maxX, int maxY, int maxPitch); |
| 933 | extern void drm_mode_validate_clocks(struct drm_device *dev, | ||
| 934 | struct list_head *mode_list, | ||
| 935 | int *min, int *max, int n_ranges); | ||
| 936 | extern void drm_mode_prune_invalid(struct drm_device *dev, | 988 | extern void drm_mode_prune_invalid(struct drm_device *dev, |
| 937 | struct list_head *mode_list, bool verbose); | 989 | struct list_head *mode_list, bool verbose); |
| 938 | extern void drm_mode_sort(struct list_head *mode_list); | 990 | extern void drm_mode_sort(struct list_head *mode_list); |
| @@ -949,9 +1001,6 @@ extern int drm_object_property_set_value(struct drm_mode_object *obj, | |||
| 949 | extern int drm_object_property_get_value(struct drm_mode_object *obj, | 1001 | extern int drm_object_property_get_value(struct drm_mode_object *obj, |
| 950 | struct drm_property *property, | 1002 | struct drm_property *property, |
| 951 | uint64_t *value); | 1003 | uint64_t *value); |
| 952 | extern struct drm_display_mode *drm_crtc_mode_create(struct drm_device *dev); | ||
| 953 | extern void drm_framebuffer_set_object(struct drm_device *dev, | ||
| 954 | unsigned long handle); | ||
| 955 | extern int drm_framebuffer_init(struct drm_device *dev, | 1004 | extern int drm_framebuffer_init(struct drm_device *dev, |
| 956 | struct drm_framebuffer *fb, | 1005 | struct drm_framebuffer *fb, |
| 957 | const struct drm_framebuffer_funcs *funcs); | 1006 | const struct drm_framebuffer_funcs *funcs); |
| @@ -962,10 +1011,6 @@ extern void drm_framebuffer_reference(struct drm_framebuffer *fb); | |||
| 962 | extern void drm_framebuffer_remove(struct drm_framebuffer *fb); | 1011 | extern void drm_framebuffer_remove(struct drm_framebuffer *fb); |
| 963 | extern void drm_framebuffer_cleanup(struct drm_framebuffer *fb); | 1012 | extern void drm_framebuffer_cleanup(struct drm_framebuffer *fb); |
| 964 | extern void drm_framebuffer_unregister_private(struct drm_framebuffer *fb); | 1013 | extern void drm_framebuffer_unregister_private(struct drm_framebuffer *fb); |
| 965 | extern int drmfb_probe(struct drm_device *dev, struct drm_crtc *crtc); | ||
| 966 | extern int drmfb_remove(struct drm_device *dev, struct drm_framebuffer *fb); | ||
| 967 | extern void drm_crtc_probe_connector_modes(struct drm_device *dev, int maxX, int maxY); | ||
| 968 | extern bool drm_crtc_in_use(struct drm_crtc *crtc); | ||
| 969 | 1014 | ||
| 970 | extern void drm_object_attach_property(struct drm_mode_object *obj, | 1015 | extern void drm_object_attach_property(struct drm_mode_object *obj, |
| 971 | struct drm_property *property, | 1016 | struct drm_property *property, |
| @@ -990,7 +1035,6 @@ extern int drm_mode_create_dvi_i_properties(struct drm_device *dev); | |||
| 990 | extern int drm_mode_create_tv_properties(struct drm_device *dev, int num_formats, | 1035 | extern int drm_mode_create_tv_properties(struct drm_device *dev, int num_formats, |
| 991 | char *formats[]); | 1036 | char *formats[]); |
| 992 | extern int drm_mode_create_scaling_mode_property(struct drm_device *dev); | 1037 | extern int drm_mode_create_scaling_mode_property(struct drm_device *dev); |
| 993 | extern int drm_mode_create_dithering_property(struct drm_device *dev); | ||
| 994 | extern int drm_mode_create_dirty_info_property(struct drm_device *dev); | 1038 | extern int drm_mode_create_dirty_info_property(struct drm_device *dev); |
| 995 | extern const char *drm_get_encoder_name(const struct drm_encoder *encoder); | 1039 | extern const char *drm_get_encoder_name(const struct drm_encoder *encoder); |
| 996 | 1040 | ||
| @@ -1040,17 +1084,12 @@ extern int drm_mode_getblob_ioctl(struct drm_device *dev, | |||
| 1040 | void *data, struct drm_file *file_priv); | 1084 | void *data, struct drm_file *file_priv); |
| 1041 | extern int drm_mode_connector_property_set_ioctl(struct drm_device *dev, | 1085 | extern int drm_mode_connector_property_set_ioctl(struct drm_device *dev, |
| 1042 | void *data, struct drm_file *file_priv); | 1086 | void *data, struct drm_file *file_priv); |
| 1043 | extern int drm_mode_hotplug_ioctl(struct drm_device *dev, | ||
| 1044 | void *data, struct drm_file *file_priv); | ||
| 1045 | extern int drm_mode_replacefb(struct drm_device *dev, | ||
| 1046 | void *data, struct drm_file *file_priv); | ||
| 1047 | extern int drm_mode_getencoder(struct drm_device *dev, | 1087 | extern int drm_mode_getencoder(struct drm_device *dev, |
| 1048 | void *data, struct drm_file *file_priv); | 1088 | void *data, struct drm_file *file_priv); |
| 1049 | extern int drm_mode_gamma_get_ioctl(struct drm_device *dev, | 1089 | extern int drm_mode_gamma_get_ioctl(struct drm_device *dev, |
| 1050 | void *data, struct drm_file *file_priv); | 1090 | void *data, struct drm_file *file_priv); |
| 1051 | extern int drm_mode_gamma_set_ioctl(struct drm_device *dev, | 1091 | extern int drm_mode_gamma_set_ioctl(struct drm_device *dev, |
| 1052 | void *data, struct drm_file *file_priv); | 1092 | void *data, struct drm_file *file_priv); |
| 1053 | extern u8 *drm_find_cea_extension(struct edid *edid); | ||
| 1054 | extern u8 drm_match_cea_mode(const struct drm_display_mode *to_match); | 1093 | extern u8 drm_match_cea_mode(const struct drm_display_mode *to_match); |
| 1055 | extern bool drm_detect_hdmi_monitor(struct edid *edid); | 1094 | extern bool drm_detect_hdmi_monitor(struct edid *edid); |
| 1056 | extern bool drm_detect_monitor_audio(struct edid *edid); | 1095 | extern bool drm_detect_monitor_audio(struct edid *edid); |
diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h index e8e1417af3d9..ae8dbfb1207c 100644 --- a/include/drm/drm_dp_helper.h +++ b/include/drm/drm_dp_helper.h | |||
| @@ -342,13 +342,42 @@ u8 drm_dp_get_adjust_request_voltage(u8 link_status[DP_LINK_STATUS_SIZE], | |||
| 342 | u8 drm_dp_get_adjust_request_pre_emphasis(u8 link_status[DP_LINK_STATUS_SIZE], | 342 | u8 drm_dp_get_adjust_request_pre_emphasis(u8 link_status[DP_LINK_STATUS_SIZE], |
| 343 | int lane); | 343 | int lane); |
| 344 | 344 | ||
| 345 | #define DP_RECEIVER_CAP_SIZE 0xf | 345 | #define DP_RECEIVER_CAP_SIZE 0xf |
| 346 | #define EDP_PSR_RECEIVER_CAP_SIZE 2 | ||
| 347 | |||
| 346 | void drm_dp_link_train_clock_recovery_delay(u8 dpcd[DP_RECEIVER_CAP_SIZE]); | 348 | void drm_dp_link_train_clock_recovery_delay(u8 dpcd[DP_RECEIVER_CAP_SIZE]); |
| 347 | void drm_dp_link_train_channel_eq_delay(u8 dpcd[DP_RECEIVER_CAP_SIZE]); | 349 | void drm_dp_link_train_channel_eq_delay(u8 dpcd[DP_RECEIVER_CAP_SIZE]); |
| 348 | 350 | ||
| 349 | u8 drm_dp_link_rate_to_bw_code(int link_rate); | 351 | u8 drm_dp_link_rate_to_bw_code(int link_rate); |
| 350 | int drm_dp_bw_code_to_link_rate(u8 link_bw); | 352 | int drm_dp_bw_code_to_link_rate(u8 link_bw); |
| 351 | 353 | ||
| 354 | struct edp_sdp_header { | ||
| 355 | u8 HB0; /* Secondary Data Packet ID */ | ||
| 356 | u8 HB1; /* Secondary Data Packet Type */ | ||
| 357 | u8 HB2; /* 7:5 reserved, 4:0 revision number */ | ||
| 358 | u8 HB3; /* 7:5 reserved, 4:0 number of valid data bytes */ | ||
| 359 | } __packed; | ||
| 360 | |||
| 361 | #define EDP_SDP_HEADER_REVISION_MASK 0x1F | ||
| 362 | #define EDP_SDP_HEADER_VALID_PAYLOAD_BYTES 0x1F | ||
| 363 | |||
| 364 | struct edp_vsc_psr { | ||
| 365 | struct edp_sdp_header sdp_header; | ||
| 366 | u8 DB0; /* Stereo Interface */ | ||
| 367 | u8 DB1; /* 0 - PSR State; 1 - Update RFB; 2 - CRC Valid */ | ||
| 368 | u8 DB2; /* CRC value bits 7:0 of the R or Cr component */ | ||
| 369 | u8 DB3; /* CRC value bits 15:8 of the R or Cr component */ | ||
| 370 | u8 DB4; /* CRC value bits 7:0 of the G or Y component */ | ||
| 371 | u8 DB5; /* CRC value bits 15:8 of the G or Y component */ | ||
| 372 | u8 DB6; /* CRC value bits 7:0 of the B or Cb component */ | ||
| 373 | u8 DB7; /* CRC value bits 15:8 of the B or Cb component */ | ||
| 374 | u8 DB8_31[24]; /* Reserved */ | ||
| 375 | } __packed; | ||
| 376 | |||
| 377 | #define EDP_VSC_PSR_STATE_ACTIVE (1<<0) | ||
| 378 | #define EDP_VSC_PSR_UPDATE_RFB (1<<1) | ||
| 379 | #define EDP_VSC_PSR_CRC_VALUES_VALID (1<<2) | ||
| 380 | |||
| 352 | static inline int | 381 | static inline int |
| 353 | drm_dp_max_link_rate(u8 dpcd[DP_RECEIVER_CAP_SIZE]) | 382 | drm_dp_max_link_rate(u8 dpcd[DP_RECEIVER_CAP_SIZE]) |
| 354 | { | 383 | { |
diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h index fc481fc17085..a1441c5ac63d 100644 --- a/include/drm/drm_edid.h +++ b/include/drm/drm_edid.h | |||
| @@ -256,9 +256,11 @@ struct drm_encoder; | |||
| 256 | struct drm_connector; | 256 | struct drm_connector; |
| 257 | struct drm_display_mode; | 257 | struct drm_display_mode; |
| 258 | struct hdmi_avi_infoframe; | 258 | struct hdmi_avi_infoframe; |
| 259 | struct hdmi_vendor_infoframe; | ||
| 259 | 260 | ||
| 260 | void drm_edid_to_eld(struct drm_connector *connector, struct edid *edid); | 261 | void drm_edid_to_eld(struct drm_connector *connector, struct edid *edid); |
| 261 | int drm_edid_to_sad(struct edid *edid, struct cea_sad **sads); | 262 | int drm_edid_to_sad(struct edid *edid, struct cea_sad **sads); |
| 263 | int drm_edid_to_speaker_allocation(struct edid *edid, u8 **sadb); | ||
| 262 | int drm_av_sync_delay(struct drm_connector *connector, | 264 | int drm_av_sync_delay(struct drm_connector *connector, |
| 263 | struct drm_display_mode *mode); | 265 | struct drm_display_mode *mode); |
| 264 | struct drm_connector *drm_select_eld(struct drm_encoder *encoder, | 266 | struct drm_connector *drm_select_eld(struct drm_encoder *encoder, |
| @@ -268,5 +270,8 @@ int drm_load_edid_firmware(struct drm_connector *connector); | |||
| 268 | int | 270 | int |
| 269 | drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame, | 271 | drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame, |
| 270 | const struct drm_display_mode *mode); | 272 | const struct drm_display_mode *mode); |
| 273 | int | ||
| 274 | drm_hdmi_vendor_infoframe_from_display_mode(struct hdmi_vendor_infoframe *frame, | ||
| 275 | const struct drm_display_mode *mode); | ||
| 271 | 276 | ||
| 272 | #endif /* __DRM_EDID_H__ */ | 277 | #endif /* __DRM_EDID_H__ */ |
diff --git a/include/drm/drm_fb_cma_helper.h b/include/drm/drm_fb_cma_helper.h index 4a3fc244301c..c54cf3d4a03f 100644 --- a/include/drm/drm_fb_cma_helper.h +++ b/include/drm/drm_fb_cma_helper.h | |||
| @@ -24,7 +24,6 @@ struct drm_gem_cma_object *drm_fb_cma_get_gem_obj(struct drm_framebuffer *fb, | |||
| 24 | unsigned int plane); | 24 | unsigned int plane); |
| 25 | 25 | ||
| 26 | #ifdef CONFIG_DEBUG_FS | 26 | #ifdef CONFIG_DEBUG_FS |
| 27 | void drm_fb_cma_describe(struct drm_framebuffer *fb, struct seq_file *m); | ||
| 28 | int drm_fb_cma_debugfs_show(struct seq_file *m, void *arg); | 27 | int drm_fb_cma_debugfs_show(struct seq_file *m, void *arg); |
| 29 | #endif | 28 | #endif |
| 30 | 29 | ||
diff --git a/include/drm/drm_flip_work.h b/include/drm/drm_flip_work.h new file mode 100644 index 000000000000..35c776ae7d3b --- /dev/null +++ b/include/drm/drm_flip_work.h | |||
| @@ -0,0 +1,76 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2013 Red Hat | ||
| 3 | * | ||
| 4 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
| 5 | * copy of this software and associated documentation files (the "Software"), | ||
| 6 | * to deal in the Software without restriction, including without limitation | ||
| 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
| 8 | * and/or sell copies of the Software, and to permit persons to whom the | ||
| 9 | * Software is furnished to do so, subject to the following conditions: | ||
| 10 | * | ||
| 11 | * The above copyright notice and this permission notice (including the next | ||
| 12 | * paragraph) shall be included in all copies or substantial portions of the | ||
| 13 | * Software. | ||
| 14 | * | ||
| 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
| 18 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| 21 | * SOFTWARE. | ||
| 22 | */ | ||
| 23 | |||
| 24 | #ifndef DRM_FLIP_WORK_H | ||
| 25 | #define DRM_FLIP_WORK_H | ||
| 26 | |||
| 27 | #include <linux/kfifo.h> | ||
| 28 | #include <linux/workqueue.h> | ||
| 29 | |||
| 30 | /** | ||
| 31 | * DOC: flip utils | ||
| 32 | * | ||
| 33 | * Util to queue up work to run from work-queue context after flip/vblank. | ||
| 34 | * Typically this can be used to defer unref of framebuffer's, cursor | ||
| 35 | * bo's, etc until after vblank. The APIs are all safe (and lockless) | ||
| 36 | * for up to one producer and once consumer at a time. The single-consumer | ||
| 37 | * aspect is ensured by committing the queued work to a single work-queue. | ||
| 38 | */ | ||
| 39 | |||
| 40 | struct drm_flip_work; | ||
| 41 | |||
| 42 | /* | ||
| 43 | * drm_flip_func_t - callback function | ||
| 44 | * | ||
| 45 | * @work: the flip work | ||
| 46 | * @val: value queued via drm_flip_work_queue() | ||
| 47 | * | ||
| 48 | * Callback function to be called for each of the queue'd work items after | ||
| 49 | * drm_flip_work_commit() is called. | ||
| 50 | */ | ||
| 51 | typedef void (*drm_flip_func_t)(struct drm_flip_work *work, void *val); | ||
| 52 | |||
| 53 | /** | ||
| 54 | * struct drm_flip_work - flip work queue | ||
| 55 | * @name: debug name | ||
| 56 | * @pending: number of queued but not committed items | ||
| 57 | * @count: number of committed items | ||
| 58 | * @func: callback fxn called for each committed item | ||
| 59 | * @worker: worker which calls @func | ||
| 60 | */ | ||
| 61 | struct drm_flip_work { | ||
| 62 | const char *name; | ||
| 63 | atomic_t pending, count; | ||
| 64 | drm_flip_func_t func; | ||
| 65 | struct work_struct worker; | ||
| 66 | DECLARE_KFIFO_PTR(fifo, void *); | ||
| 67 | }; | ||
| 68 | |||
| 69 | void drm_flip_work_queue(struct drm_flip_work *work, void *val); | ||
| 70 | void drm_flip_work_commit(struct drm_flip_work *work, | ||
| 71 | struct workqueue_struct *wq); | ||
| 72 | int drm_flip_work_init(struct drm_flip_work *work, int size, | ||
| 73 | const char *name, drm_flip_func_t func); | ||
| 74 | void drm_flip_work_cleanup(struct drm_flip_work *work); | ||
| 75 | |||
| 76 | #endif /* DRM_FLIP_WORK_H */ | ||
diff --git a/include/drm/drm_gem_cma_helper.h b/include/drm/drm_gem_cma_helper.h index c34f27f80bcc..89b4d7db1ebd 100644 --- a/include/drm/drm_gem_cma_helper.h +++ b/include/drm/drm_gem_cma_helper.h | |||
| @@ -30,14 +30,6 @@ int drm_gem_cma_dumb_map_offset(struct drm_file *file_priv, | |||
| 30 | /* set vm_flags and we can change the vm attribute to other one at here. */ | 30 | /* set vm_flags and we can change the vm attribute to other one at here. */ |
| 31 | int drm_gem_cma_mmap(struct file *filp, struct vm_area_struct *vma); | 31 | int drm_gem_cma_mmap(struct file *filp, struct vm_area_struct *vma); |
| 32 | 32 | ||
| 33 | /* | ||
| 34 | * destroy memory region allocated. | ||
| 35 | * - a gem handle and physical memory region pointed by a gem object | ||
| 36 | * would be released by drm_gem_handle_delete(). | ||
| 37 | */ | ||
| 38 | int drm_gem_cma_dumb_destroy(struct drm_file *file_priv, | ||
| 39 | struct drm_device *drm, unsigned int handle); | ||
| 40 | |||
| 41 | /* allocate physical memory. */ | 33 | /* allocate physical memory. */ |
| 42 | struct drm_gem_cma_object *drm_gem_cma_create(struct drm_device *drm, | 34 | struct drm_gem_cma_object *drm_gem_cma_create(struct drm_device *drm, |
| 43 | unsigned int size); | 35 | unsigned int size); |
diff --git a/include/drm/drm_mm.h b/include/drm/drm_mm.h index 4d06edb56d5f..cba67865d18f 100644 --- a/include/drm/drm_mm.h +++ b/include/drm/drm_mm.h | |||
| @@ -36,11 +36,19 @@ | |||
| 36 | /* | 36 | /* |
| 37 | * Generic range manager structs | 37 | * Generic range manager structs |
| 38 | */ | 38 | */ |
| 39 | #include <linux/bug.h> | ||
| 40 | #include <linux/kernel.h> | ||
| 39 | #include <linux/list.h> | 41 | #include <linux/list.h> |
| 42 | #include <linux/spinlock.h> | ||
| 40 | #ifdef CONFIG_DEBUG_FS | 43 | #ifdef CONFIG_DEBUG_FS |
| 41 | #include <linux/seq_file.h> | 44 | #include <linux/seq_file.h> |
| 42 | #endif | 45 | #endif |
| 43 | 46 | ||
| 47 | enum drm_mm_search_flags { | ||
| 48 | DRM_MM_SEARCH_DEFAULT = 0, | ||
| 49 | DRM_MM_SEARCH_BEST = 1 << 0, | ||
| 50 | }; | ||
| 51 | |||
| 44 | struct drm_mm_node { | 52 | struct drm_mm_node { |
| 45 | struct list_head node_list; | 53 | struct list_head node_list; |
| 46 | struct list_head hole_stack; | 54 | struct list_head hole_stack; |
| @@ -62,9 +70,6 @@ struct drm_mm { | |||
| 62 | /* head_node.node_list is the list of all memory nodes, ordered | 70 | /* head_node.node_list is the list of all memory nodes, ordered |
| 63 | * according to the (increasing) start address of the memory node. */ | 71 | * according to the (increasing) start address of the memory node. */ |
| 64 | struct drm_mm_node head_node; | 72 | struct drm_mm_node head_node; |
| 65 | struct list_head unused_nodes; | ||
| 66 | int num_unused; | ||
| 67 | spinlock_t unused_lock; | ||
| 68 | unsigned int scan_check_range : 1; | 73 | unsigned int scan_check_range : 1; |
| 69 | unsigned scan_alignment; | 74 | unsigned scan_alignment; |
| 70 | unsigned long scan_color; | 75 | unsigned long scan_color; |
| @@ -115,13 +120,6 @@ static inline unsigned long drm_mm_hole_node_end(struct drm_mm_node *hole_node) | |||
| 115 | #define drm_mm_for_each_node(entry, mm) list_for_each_entry(entry, \ | 120 | #define drm_mm_for_each_node(entry, mm) list_for_each_entry(entry, \ |
| 116 | &(mm)->head_node.node_list, \ | 121 | &(mm)->head_node.node_list, \ |
| 117 | node_list) | 122 | node_list) |
| 118 | #define drm_mm_for_each_scanned_node_reverse(entry, n, mm) \ | ||
| 119 | for (entry = (mm)->prev_scanned_node, \ | ||
| 120 | next = entry ? list_entry(entry->node_list.next, \ | ||
| 121 | struct drm_mm_node, node_list) : NULL; \ | ||
| 122 | entry != NULL; entry = next, \ | ||
| 123 | next = entry ? list_entry(entry->node_list.next, \ | ||
| 124 | struct drm_mm_node, node_list) : NULL) \ | ||
| 125 | 123 | ||
| 126 | /* Note that we need to unroll list_for_each_entry in order to inline | 124 | /* Note that we need to unroll list_for_each_entry in order to inline |
| 127 | * setting hole_start and hole_end on each iteration and keep the | 125 | * setting hole_start and hole_end on each iteration and keep the |
| @@ -138,124 +136,50 @@ static inline unsigned long drm_mm_hole_node_end(struct drm_mm_node *hole_node) | |||
| 138 | /* | 136 | /* |
| 139 | * Basic range manager support (drm_mm.c) | 137 | * Basic range manager support (drm_mm.c) |
| 140 | */ | 138 | */ |
| 141 | extern struct drm_mm_node *drm_mm_create_block(struct drm_mm *mm, | 139 | extern int drm_mm_reserve_node(struct drm_mm *mm, struct drm_mm_node *node); |
| 142 | unsigned long start, | ||
| 143 | unsigned long size, | ||
| 144 | bool atomic); | ||
| 145 | extern struct drm_mm_node *drm_mm_get_block_generic(struct drm_mm_node *node, | ||
| 146 | unsigned long size, | ||
| 147 | unsigned alignment, | ||
| 148 | unsigned long color, | ||
| 149 | int atomic); | ||
| 150 | extern struct drm_mm_node *drm_mm_get_block_range_generic( | ||
| 151 | struct drm_mm_node *node, | ||
| 152 | unsigned long size, | ||
| 153 | unsigned alignment, | ||
| 154 | unsigned long color, | ||
| 155 | unsigned long start, | ||
| 156 | unsigned long end, | ||
| 157 | int atomic); | ||
| 158 | static inline struct drm_mm_node *drm_mm_get_block(struct drm_mm_node *parent, | ||
| 159 | unsigned long size, | ||
| 160 | unsigned alignment) | ||
| 161 | { | ||
| 162 | return drm_mm_get_block_generic(parent, size, alignment, 0, 0); | ||
| 163 | } | ||
| 164 | static inline struct drm_mm_node *drm_mm_get_block_atomic(struct drm_mm_node *parent, | ||
| 165 | unsigned long size, | ||
| 166 | unsigned alignment) | ||
| 167 | { | ||
| 168 | return drm_mm_get_block_generic(parent, size, alignment, 0, 1); | ||
| 169 | } | ||
| 170 | static inline struct drm_mm_node *drm_mm_get_block_range( | ||
| 171 | struct drm_mm_node *parent, | ||
| 172 | unsigned long size, | ||
| 173 | unsigned alignment, | ||
| 174 | unsigned long start, | ||
| 175 | unsigned long end) | ||
| 176 | { | ||
| 177 | return drm_mm_get_block_range_generic(parent, size, alignment, 0, | ||
| 178 | start, end, 0); | ||
| 179 | } | ||
| 180 | static inline struct drm_mm_node *drm_mm_get_block_atomic_range( | ||
| 181 | struct drm_mm_node *parent, | ||
| 182 | unsigned long size, | ||
| 183 | unsigned alignment, | ||
| 184 | unsigned long start, | ||
| 185 | unsigned long end) | ||
| 186 | { | ||
| 187 | return drm_mm_get_block_range_generic(parent, size, alignment, 0, | ||
| 188 | start, end, 1); | ||
| 189 | } | ||
| 190 | 140 | ||
| 191 | extern int drm_mm_insert_node(struct drm_mm *mm, | ||
| 192 | struct drm_mm_node *node, | ||
| 193 | unsigned long size, | ||
| 194 | unsigned alignment); | ||
| 195 | extern int drm_mm_insert_node_in_range(struct drm_mm *mm, | ||
| 196 | struct drm_mm_node *node, | ||
| 197 | unsigned long size, | ||
| 198 | unsigned alignment, | ||
| 199 | unsigned long start, | ||
| 200 | unsigned long end); | ||
| 201 | extern int drm_mm_insert_node_generic(struct drm_mm *mm, | 141 | extern int drm_mm_insert_node_generic(struct drm_mm *mm, |
| 202 | struct drm_mm_node *node, | 142 | struct drm_mm_node *node, |
| 203 | unsigned long size, | 143 | unsigned long size, |
| 204 | unsigned alignment, | 144 | unsigned alignment, |
| 205 | unsigned long color); | 145 | unsigned long color, |
| 146 | enum drm_mm_search_flags flags); | ||
| 147 | static inline int drm_mm_insert_node(struct drm_mm *mm, | ||
| 148 | struct drm_mm_node *node, | ||
| 149 | unsigned long size, | ||
| 150 | unsigned alignment, | ||
| 151 | enum drm_mm_search_flags flags) | ||
| 152 | { | ||
| 153 | return drm_mm_insert_node_generic(mm, node, size, alignment, 0, flags); | ||
| 154 | } | ||
| 155 | |||
| 206 | extern int drm_mm_insert_node_in_range_generic(struct drm_mm *mm, | 156 | extern int drm_mm_insert_node_in_range_generic(struct drm_mm *mm, |
| 207 | struct drm_mm_node *node, | 157 | struct drm_mm_node *node, |
| 208 | unsigned long size, | 158 | unsigned long size, |
| 209 | unsigned alignment, | 159 | unsigned alignment, |
| 210 | unsigned long color, | 160 | unsigned long color, |
| 211 | unsigned long start, | 161 | unsigned long start, |
| 212 | unsigned long end); | 162 | unsigned long end, |
| 213 | extern void drm_mm_put_block(struct drm_mm_node *cur); | 163 | enum drm_mm_search_flags flags); |
| 214 | extern void drm_mm_remove_node(struct drm_mm_node *node); | 164 | static inline int drm_mm_insert_node_in_range(struct drm_mm *mm, |
| 215 | extern void drm_mm_replace_node(struct drm_mm_node *old, struct drm_mm_node *new); | 165 | struct drm_mm_node *node, |
| 216 | extern struct drm_mm_node *drm_mm_search_free_generic(const struct drm_mm *mm, | 166 | unsigned long size, |
| 217 | unsigned long size, | 167 | unsigned alignment, |
| 218 | unsigned alignment, | 168 | unsigned long start, |
| 219 | unsigned long color, | 169 | unsigned long end, |
| 220 | bool best_match); | 170 | enum drm_mm_search_flags flags) |
| 221 | extern struct drm_mm_node *drm_mm_search_free_in_range_generic( | ||
| 222 | const struct drm_mm *mm, | ||
| 223 | unsigned long size, | ||
| 224 | unsigned alignment, | ||
| 225 | unsigned long color, | ||
| 226 | unsigned long start, | ||
| 227 | unsigned long end, | ||
| 228 | bool best_match); | ||
| 229 | static inline struct drm_mm_node *drm_mm_search_free(const struct drm_mm *mm, | ||
| 230 | unsigned long size, | ||
| 231 | unsigned alignment, | ||
| 232 | bool best_match) | ||
| 233 | { | 171 | { |
| 234 | return drm_mm_search_free_generic(mm,size, alignment, 0, best_match); | 172 | return drm_mm_insert_node_in_range_generic(mm, node, size, alignment, |
| 235 | } | 173 | 0, start, end, flags); |
| 236 | static inline struct drm_mm_node *drm_mm_search_free_in_range( | ||
| 237 | const struct drm_mm *mm, | ||
| 238 | unsigned long size, | ||
| 239 | unsigned alignment, | ||
| 240 | unsigned long start, | ||
| 241 | unsigned long end, | ||
| 242 | bool best_match) | ||
| 243 | { | ||
| 244 | return drm_mm_search_free_in_range_generic(mm, size, alignment, 0, | ||
| 245 | start, end, best_match); | ||
| 246 | } | 174 | } |
| 247 | 175 | ||
| 176 | extern void drm_mm_remove_node(struct drm_mm_node *node); | ||
| 177 | extern void drm_mm_replace_node(struct drm_mm_node *old, struct drm_mm_node *new); | ||
| 248 | extern void drm_mm_init(struct drm_mm *mm, | 178 | extern void drm_mm_init(struct drm_mm *mm, |
| 249 | unsigned long start, | 179 | unsigned long start, |
| 250 | unsigned long size); | 180 | unsigned long size); |
| 251 | extern void drm_mm_takedown(struct drm_mm *mm); | 181 | extern void drm_mm_takedown(struct drm_mm *mm); |
| 252 | extern int drm_mm_clean(struct drm_mm *mm); | 182 | extern int drm_mm_clean(struct drm_mm *mm); |
| 253 | extern int drm_mm_pre_get(struct drm_mm *mm); | ||
| 254 | |||
| 255 | static inline struct drm_mm *drm_get_mm(struct drm_mm_node *block) | ||
| 256 | { | ||
| 257 | return block->mm; | ||
| 258 | } | ||
| 259 | 183 | ||
| 260 | void drm_mm_init_scan(struct drm_mm *mm, | 184 | void drm_mm_init_scan(struct drm_mm *mm, |
| 261 | unsigned long size, | 185 | unsigned long size, |
diff --git a/include/drm/drm_pciids.h b/include/drm/drm_pciids.h index 34efaf64cc87..fd54a14a7c2a 100644 --- a/include/drm/drm_pciids.h +++ b/include/drm/drm_pciids.h | |||
| @@ -1,4 +1,22 @@ | |||
| 1 | #define radeon_PCI_IDS \ | 1 | #define radeon_PCI_IDS \ |
| 2 | {0x1002, 0x1304, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
| 3 | {0x1002, 0x1305, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
| 4 | {0x1002, 0x1306, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
| 5 | {0x1002, 0x1307, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
| 6 | {0x1002, 0x1309, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
| 7 | {0x1002, 0x130A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
| 8 | {0x1002, 0x130B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
| 9 | {0x1002, 0x130C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
| 10 | {0x1002, 0x130D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
| 11 | {0x1002, 0x130E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
| 12 | {0x1002, 0x130F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
| 13 | {0x1002, 0x1310, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
| 14 | {0x1002, 0x1311, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
| 15 | {0x1002, 0x1313, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
| 16 | {0x1002, 0x1315, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
| 17 | {0x1002, 0x1316, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
| 18 | {0x1002, 0x131B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
| 19 | {0x1002, 0x131C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
| 2 | {0x1002, 0x3150, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY}, \ | 20 | {0x1002, 0x3150, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY}, \ |
| 3 | {0x1002, 0x3151, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | 21 | {0x1002, 0x3151, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
| 4 | {0x1002, 0x3152, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | 22 | {0x1002, 0x3152, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
| @@ -690,29 +708,6 @@ | |||
| 690 | {0x102b, 0x2527, PCI_ANY_ID, PCI_ANY_ID, 0, 0, MGA_CARD_TYPE_G550}, \ | 708 | {0x102b, 0x2527, PCI_ANY_ID, PCI_ANY_ID, 0, 0, MGA_CARD_TYPE_G550}, \ |
| 691 | {0, 0, 0} | 709 | {0, 0, 0} |
| 692 | 710 | ||
| 693 | #define mach64_PCI_IDS \ | ||
| 694 | {0x1002, 0x4749, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ | ||
| 695 | {0x1002, 0x4750, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ | ||
| 696 | {0x1002, 0x4751, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ | ||
| 697 | {0x1002, 0x4742, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ | ||
| 698 | {0x1002, 0x4744, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ | ||
| 699 | {0x1002, 0x4c49, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ | ||
| 700 | {0x1002, 0x4c50, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ | ||
| 701 | {0x1002, 0x4c51, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ | ||
| 702 | {0x1002, 0x4c42, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ | ||
| 703 | {0x1002, 0x4c44, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ | ||
| 704 | {0x1002, 0x474c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ | ||
| 705 | {0x1002, 0x474f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ | ||
| 706 | {0x1002, 0x4752, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ | ||
| 707 | {0x1002, 0x4753, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ | ||
| 708 | {0x1002, 0x474d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ | ||
| 709 | {0x1002, 0x474e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ | ||
| 710 | {0x1002, 0x4c52, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ | ||
| 711 | {0x1002, 0x4c53, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ | ||
| 712 | {0x1002, 0x4c4d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ | ||
| 713 | {0x1002, 0x4c4e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ | ||
| 714 | {0, 0, 0} | ||
| 715 | |||
| 716 | #define sisdrv_PCI_IDS \ | 711 | #define sisdrv_PCI_IDS \ |
| 717 | {0x1039, 0x0300, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ | 712 | {0x1039, 0x0300, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ |
| 718 | {0x1039, 0x5300, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ | 713 | {0x1039, 0x5300, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ |
| @@ -752,10 +747,6 @@ | |||
| 752 | {0x8086, 0x1132, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ | 747 | {0x8086, 0x1132, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ |
| 753 | {0, 0, 0} | 748 | {0, 0, 0} |
| 754 | 749 | ||
| 755 | #define gamma_PCI_IDS \ | ||
| 756 | {0x3d3d, 0x0008, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ | ||
| 757 | {0, 0, 0} | ||
| 758 | |||
| 759 | #define savage_PCI_IDS \ | 750 | #define savage_PCI_IDS \ |
| 760 | {0x5333, 0x8a20, PCI_ANY_ID, PCI_ANY_ID, 0, 0, S3_SAVAGE3D}, \ | 751 | {0x5333, 0x8a20, PCI_ANY_ID, PCI_ANY_ID, 0, 0, S3_SAVAGE3D}, \ |
| 761 | {0x5333, 0x8a21, PCI_ANY_ID, PCI_ANY_ID, 0, 0, S3_SAVAGE3D}, \ | 752 | {0x5333, 0x8a21, PCI_ANY_ID, PCI_ANY_ID, 0, 0, S3_SAVAGE3D}, \ |
| @@ -781,6 +772,3 @@ | |||
| 781 | {0x5333, 0x8d03, PCI_ANY_ID, PCI_ANY_ID, 0, 0, S3_PROSAVAGEDDR}, \ | 772 | {0x5333, 0x8d03, PCI_ANY_ID, PCI_ANY_ID, 0, 0, S3_PROSAVAGEDDR}, \ |
| 782 | {0x5333, 0x8d04, PCI_ANY_ID, PCI_ANY_ID, 0, 0, S3_PROSAVAGEDDR}, \ | 773 | {0x5333, 0x8d04, PCI_ANY_ID, PCI_ANY_ID, 0, 0, S3_PROSAVAGEDDR}, \ |
| 783 | {0, 0, 0} | 774 | {0, 0, 0} |
| 784 | |||
| 785 | #define ffb_PCI_IDS \ | ||
| 786 | {0, 0, 0} | ||
diff --git a/include/drm/drm_vma_manager.h b/include/drm/drm_vma_manager.h new file mode 100644 index 000000000000..c18a593d1744 --- /dev/null +++ b/include/drm/drm_vma_manager.h | |||
| @@ -0,0 +1,257 @@ | |||
| 1 | #ifndef __DRM_VMA_MANAGER_H__ | ||
| 2 | #define __DRM_VMA_MANAGER_H__ | ||
| 3 | |||
| 4 | /* | ||
| 5 | * Copyright (c) 2013 David Herrmann <dh.herrmann@gmail.com> | ||
| 6 | * | ||
| 7 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
| 8 | * copy of this software and associated documentation files (the "Software"), | ||
| 9 | * to deal in the Software without restriction, including without limitation | ||
| 10 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
| 11 | * and/or sell copies of the Software, and to permit persons to whom the | ||
| 12 | * Software is furnished to do so, subject to the following conditions: | ||
| 13 | * | ||
| 14 | * The above copyright notice and this permission notice shall be included in | ||
| 15 | * all copies or substantial portions of the Software. | ||
| 16 | * | ||
| 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
| 20 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||
| 21 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
| 22 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
| 23 | * OTHER DEALINGS IN THE SOFTWARE. | ||
| 24 | */ | ||
| 25 | |||
| 26 | #include <drm/drm_mm.h> | ||
| 27 | #include <linux/fs.h> | ||
| 28 | #include <linux/mm.h> | ||
| 29 | #include <linux/module.h> | ||
| 30 | #include <linux/rbtree.h> | ||
| 31 | #include <linux/spinlock.h> | ||
| 32 | #include <linux/types.h> | ||
| 33 | |||
| 34 | struct drm_vma_offset_file { | ||
| 35 | struct rb_node vm_rb; | ||
| 36 | struct file *vm_filp; | ||
| 37 | unsigned long vm_count; | ||
| 38 | }; | ||
| 39 | |||
| 40 | struct drm_vma_offset_node { | ||
| 41 | rwlock_t vm_lock; | ||
| 42 | struct drm_mm_node vm_node; | ||
| 43 | struct rb_node vm_rb; | ||
| 44 | struct rb_root vm_files; | ||
| 45 | }; | ||
| 46 | |||
| 47 | struct drm_vma_offset_manager { | ||
| 48 | rwlock_t vm_lock; | ||
| 49 | struct rb_root vm_addr_space_rb; | ||
| 50 | struct drm_mm vm_addr_space_mm; | ||
| 51 | }; | ||
| 52 | |||
| 53 | void drm_vma_offset_manager_init(struct drm_vma_offset_manager *mgr, | ||
| 54 | unsigned long page_offset, unsigned long size); | ||
| 55 | void drm_vma_offset_manager_destroy(struct drm_vma_offset_manager *mgr); | ||
| 56 | |||
| 57 | struct drm_vma_offset_node *drm_vma_offset_lookup(struct drm_vma_offset_manager *mgr, | ||
| 58 | unsigned long start, | ||
| 59 | unsigned long pages); | ||
| 60 | struct drm_vma_offset_node *drm_vma_offset_lookup_locked(struct drm_vma_offset_manager *mgr, | ||
| 61 | unsigned long start, | ||
| 62 | unsigned long pages); | ||
| 63 | int drm_vma_offset_add(struct drm_vma_offset_manager *mgr, | ||
| 64 | struct drm_vma_offset_node *node, unsigned long pages); | ||
| 65 | void drm_vma_offset_remove(struct drm_vma_offset_manager *mgr, | ||
| 66 | struct drm_vma_offset_node *node); | ||
| 67 | |||
| 68 | int drm_vma_node_allow(struct drm_vma_offset_node *node, struct file *filp); | ||
| 69 | void drm_vma_node_revoke(struct drm_vma_offset_node *node, struct file *filp); | ||
| 70 | bool drm_vma_node_is_allowed(struct drm_vma_offset_node *node, | ||
| 71 | struct file *filp); | ||
| 72 | |||
| 73 | /** | ||
| 74 | * drm_vma_offset_exact_lookup() - Look up node by exact address | ||
| 75 | * @mgr: Manager object | ||
| 76 | * @start: Start address (page-based, not byte-based) | ||
| 77 | * @pages: Size of object (page-based) | ||
| 78 | * | ||
| 79 | * Same as drm_vma_offset_lookup() but does not allow any offset into the node. | ||
| 80 | * It only returns the exact object with the given start address. | ||
| 81 | * | ||
| 82 | * RETURNS: | ||
| 83 | * Node at exact start address @start. | ||
| 84 | */ | ||
| 85 | static inline struct drm_vma_offset_node * | ||
| 86 | drm_vma_offset_exact_lookup(struct drm_vma_offset_manager *mgr, | ||
| 87 | unsigned long start, | ||
| 88 | unsigned long pages) | ||
| 89 | { | ||
| 90 | struct drm_vma_offset_node *node; | ||
| 91 | |||
| 92 | node = drm_vma_offset_lookup(mgr, start, pages); | ||
| 93 | return (node && node->vm_node.start == start) ? node : NULL; | ||
| 94 | } | ||
| 95 | |||
| 96 | /** | ||
| 97 | * drm_vma_offset_lock_lookup() - Lock lookup for extended private use | ||
| 98 | * @mgr: Manager object | ||
| 99 | * | ||
| 100 | * Lock VMA manager for extended lookups. Only *_locked() VMA function calls | ||
| 101 | * are allowed while holding this lock. All other contexts are blocked from VMA | ||
| 102 | * until the lock is released via drm_vma_offset_unlock_lookup(). | ||
| 103 | * | ||
| 104 | * Use this if you need to take a reference to the objects returned by | ||
| 105 | * drm_vma_offset_lookup_locked() before releasing this lock again. | ||
| 106 | * | ||
| 107 | * This lock must not be used for anything else than extended lookups. You must | ||
| 108 | * not call any other VMA helpers while holding this lock. | ||
| 109 | * | ||
| 110 | * Note: You're in atomic-context while holding this lock! | ||
| 111 | * | ||
| 112 | * Example: | ||
| 113 | * drm_vma_offset_lock_lookup(mgr); | ||
| 114 | * node = drm_vma_offset_lookup_locked(mgr); | ||
| 115 | * if (node) | ||
| 116 | * kref_get_unless_zero(container_of(node, sth, entr)); | ||
| 117 | * drm_vma_offset_unlock_lookup(mgr); | ||
| 118 | */ | ||
| 119 | static inline void drm_vma_offset_lock_lookup(struct drm_vma_offset_manager *mgr) | ||
| 120 | { | ||
| 121 | read_lock(&mgr->vm_lock); | ||
| 122 | } | ||
| 123 | |||
| 124 | /** | ||
| 125 | * drm_vma_offset_unlock_lookup() - Unlock lookup for extended private use | ||
| 126 | * @mgr: Manager object | ||
| 127 | * | ||
| 128 | * Release lookup-lock. See drm_vma_offset_lock_lookup() for more information. | ||
| 129 | */ | ||
| 130 | static inline void drm_vma_offset_unlock_lookup(struct drm_vma_offset_manager *mgr) | ||
| 131 | { | ||
| 132 | read_unlock(&mgr->vm_lock); | ||
| 133 | } | ||
| 134 | |||
| 135 | /** | ||
| 136 | * drm_vma_node_reset() - Initialize or reset node object | ||
| 137 | * @node: Node to initialize or reset | ||
| 138 | * | ||
| 139 | * Reset a node to its initial state. This must be called before using it with | ||
| 140 | * any VMA offset manager. | ||
| 141 | * | ||
| 142 | * This must not be called on an already allocated node, or you will leak | ||
| 143 | * memory. | ||
| 144 | */ | ||
| 145 | static inline void drm_vma_node_reset(struct drm_vma_offset_node *node) | ||
| 146 | { | ||
| 147 | memset(node, 0, sizeof(*node)); | ||
| 148 | node->vm_files = RB_ROOT; | ||
| 149 | rwlock_init(&node->vm_lock); | ||
| 150 | } | ||
| 151 | |||
| 152 | /** | ||
| 153 | * drm_vma_node_start() - Return start address for page-based addressing | ||
| 154 | * @node: Node to inspect | ||
| 155 | * | ||
| 156 | * Return the start address of the given node. This can be used as offset into | ||
| 157 | * the linear VM space that is provided by the VMA offset manager. Note that | ||
| 158 | * this can only be used for page-based addressing. If you need a proper offset | ||
| 159 | * for user-space mappings, you must apply "<< PAGE_SHIFT" or use the | ||
| 160 | * drm_vma_node_offset_addr() helper instead. | ||
| 161 | * | ||
| 162 | * RETURNS: | ||
| 163 | * Start address of @node for page-based addressing. 0 if the node does not | ||
| 164 | * have an offset allocated. | ||
| 165 | */ | ||
| 166 | static inline unsigned long drm_vma_node_start(struct drm_vma_offset_node *node) | ||
| 167 | { | ||
| 168 | return node->vm_node.start; | ||
| 169 | } | ||
| 170 | |||
| 171 | /** | ||
| 172 | * drm_vma_node_size() - Return size (page-based) | ||
| 173 | * @node: Node to inspect | ||
| 174 | * | ||
| 175 | * Return the size as number of pages for the given node. This is the same size | ||
| 176 | * that was passed to drm_vma_offset_add(). If no offset is allocated for the | ||
| 177 | * node, this is 0. | ||
| 178 | * | ||
| 179 | * RETURNS: | ||
| 180 | * Size of @node as number of pages. 0 if the node does not have an offset | ||
| 181 | * allocated. | ||
| 182 | */ | ||
| 183 | static inline unsigned long drm_vma_node_size(struct drm_vma_offset_node *node) | ||
| 184 | { | ||
| 185 | return node->vm_node.size; | ||
| 186 | } | ||
| 187 | |||
| 188 | /** | ||
| 189 | * drm_vma_node_has_offset() - Check whether node is added to offset manager | ||
| 190 | * @node: Node to be checked | ||
| 191 | * | ||
| 192 | * RETURNS: | ||
| 193 | * true iff the node was previously allocated an offset and added to | ||
| 194 | * an vma offset manager. | ||
| 195 | */ | ||
| 196 | static inline bool drm_vma_node_has_offset(struct drm_vma_offset_node *node) | ||
| 197 | { | ||
| 198 | return drm_mm_node_allocated(&node->vm_node); | ||
| 199 | } | ||
| 200 | |||
| 201 | /** | ||
| 202 | * drm_vma_node_offset_addr() - Return sanitized offset for user-space mmaps | ||
| 203 | * @node: Linked offset node | ||
| 204 | * | ||
| 205 | * Same as drm_vma_node_start() but returns the address as a valid offset that | ||
| 206 | * can be used for user-space mappings during mmap(). | ||
| 207 | * This must not be called on unlinked nodes. | ||
| 208 | * | ||
| 209 | * RETURNS: | ||
| 210 | * Offset of @node for byte-based addressing. 0 if the node does not have an | ||
| 211 | * object allocated. | ||
| 212 | */ | ||
| 213 | static inline __u64 drm_vma_node_offset_addr(struct drm_vma_offset_node *node) | ||
| 214 | { | ||
| 215 | return ((__u64)node->vm_node.start) << PAGE_SHIFT; | ||
| 216 | } | ||
| 217 | |||
| 218 | /** | ||
| 219 | * drm_vma_node_unmap() - Unmap offset node | ||
| 220 | * @node: Offset node | ||
| 221 | * @file_mapping: Address space to unmap @node from | ||
| 222 | * | ||
| 223 | * Unmap all userspace mappings for a given offset node. The mappings must be | ||
| 224 | * associated with the @file_mapping address-space. If no offset exists or | ||
| 225 | * the address-space is invalid, nothing is done. | ||
| 226 | * | ||
| 227 | * This call is unlocked. The caller must guarantee that drm_vma_offset_remove() | ||
| 228 | * is not called on this node concurrently. | ||
| 229 | */ | ||
| 230 | static inline void drm_vma_node_unmap(struct drm_vma_offset_node *node, | ||
| 231 | struct address_space *file_mapping) | ||
| 232 | { | ||
| 233 | if (file_mapping && drm_vma_node_has_offset(node)) | ||
| 234 | unmap_mapping_range(file_mapping, | ||
| 235 | drm_vma_node_offset_addr(node), | ||
| 236 | drm_vma_node_size(node) << PAGE_SHIFT, 1); | ||
| 237 | } | ||
| 238 | |||
| 239 | /** | ||
| 240 | * drm_vma_node_verify_access() - Access verification helper for TTM | ||
| 241 | * @node: Offset node | ||
| 242 | * @filp: Open-file | ||
| 243 | * | ||
| 244 | * This checks whether @filp is granted access to @node. It is the same as | ||
| 245 | * drm_vma_node_is_allowed() but suitable as drop-in helper for TTM | ||
| 246 | * verify_access() callbacks. | ||
| 247 | * | ||
| 248 | * RETURNS: | ||
| 249 | * 0 if access is granted, -EACCES otherwise. | ||
| 250 | */ | ||
| 251 | static inline int drm_vma_node_verify_access(struct drm_vma_offset_node *node, | ||
| 252 | struct file *filp) | ||
| 253 | { | ||
| 254 | return drm_vma_node_is_allowed(node, filp) ? 0 : -EACCES; | ||
| 255 | } | ||
| 256 | |||
| 257 | #endif /* __DRM_VMA_MANAGER_H__ */ | ||
diff --git a/include/drm/exynos_drm.h b/include/drm/exynos_drm.h index d6aeaf3c6d6c..cb65fa14acfc 100644 --- a/include/drm/exynos_drm.h +++ b/include/drm/exynos_drm.h | |||
| @@ -15,6 +15,7 @@ | |||
| 15 | #define _EXYNOS_DRM_H_ | 15 | #define _EXYNOS_DRM_H_ |
| 16 | 16 | ||
| 17 | #include <uapi/drm/exynos_drm.h> | 17 | #include <uapi/drm/exynos_drm.h> |
| 18 | #include <video/videomode.h> | ||
| 18 | 19 | ||
| 19 | /** | 20 | /** |
| 20 | * A structure for lcd panel information. | 21 | * A structure for lcd panel information. |
| @@ -24,7 +25,7 @@ | |||
| 24 | * @height_mm: physical size of lcd height. | 25 | * @height_mm: physical size of lcd height. |
| 25 | */ | 26 | */ |
| 26 | struct exynos_drm_panel_info { | 27 | struct exynos_drm_panel_info { |
| 27 | struct fb_videomode timing; | 28 | struct videomode vm; |
| 28 | u32 width_mm; | 29 | u32 width_mm; |
| 29 | u32 height_mm; | 30 | u32 height_mm; |
| 30 | }; | 31 | }; |
diff --git a/include/drm/i2c/tda998x.h b/include/drm/i2c/tda998x.h new file mode 100644 index 000000000000..3e419d92cf5a --- /dev/null +++ b/include/drm/i2c/tda998x.h | |||
| @@ -0,0 +1,30 @@ | |||
| 1 | #ifndef __DRM_I2C_TDA998X_H__ | ||
| 2 | #define __DRM_I2C_TDA998X_H__ | ||
| 3 | |||
| 4 | struct tda998x_encoder_params { | ||
| 5 | u8 swap_b:3; | ||
| 6 | u8 mirr_b:1; | ||
| 7 | u8 swap_a:3; | ||
| 8 | u8 mirr_a:1; | ||
| 9 | u8 swap_d:3; | ||
| 10 | u8 mirr_d:1; | ||
| 11 | u8 swap_c:3; | ||
| 12 | u8 mirr_c:1; | ||
| 13 | u8 swap_f:3; | ||
| 14 | u8 mirr_f:1; | ||
| 15 | u8 swap_e:3; | ||
| 16 | u8 mirr_e:1; | ||
| 17 | |||
| 18 | u8 audio_cfg; | ||
| 19 | u8 audio_clk_cfg; | ||
| 20 | u8 audio_frame[6]; | ||
| 21 | |||
| 22 | enum { | ||
| 23 | AFMT_SPDIF, | ||
| 24 | AFMT_I2S | ||
| 25 | } audio_format; | ||
| 26 | |||
| 27 | unsigned audio_sample_rate; | ||
| 28 | }; | ||
| 29 | |||
| 30 | #endif | ||
diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h index 8a6aa56ece52..751eaffbf0d5 100644 --- a/include/drm/ttm/ttm_bo_api.h +++ b/include/drm/ttm/ttm_bo_api.h | |||
| @@ -32,12 +32,12 @@ | |||
| 32 | #define _TTM_BO_API_H_ | 32 | #define _TTM_BO_API_H_ |
| 33 | 33 | ||
| 34 | #include <drm/drm_hashtab.h> | 34 | #include <drm/drm_hashtab.h> |
| 35 | #include <drm/drm_vma_manager.h> | ||
| 35 | #include <linux/kref.h> | 36 | #include <linux/kref.h> |
| 36 | #include <linux/list.h> | 37 | #include <linux/list.h> |
| 37 | #include <linux/wait.h> | 38 | #include <linux/wait.h> |
| 38 | #include <linux/mutex.h> | 39 | #include <linux/mutex.h> |
| 39 | #include <linux/mm.h> | 40 | #include <linux/mm.h> |
| 40 | #include <linux/rbtree.h> | ||
| 41 | #include <linux/bitmap.h> | 41 | #include <linux/bitmap.h> |
| 42 | #include <linux/reservation.h> | 42 | #include <linux/reservation.h> |
| 43 | 43 | ||
| @@ -145,7 +145,6 @@ struct ttm_tt; | |||
| 145 | * @type: The bo type. | 145 | * @type: The bo type. |
| 146 | * @destroy: Destruction function. If NULL, kfree is used. | 146 | * @destroy: Destruction function. If NULL, kfree is used. |
| 147 | * @num_pages: Actual number of pages. | 147 | * @num_pages: Actual number of pages. |
| 148 | * @addr_space_offset: Address space offset. | ||
| 149 | * @acc_size: Accounted size for this object. | 148 | * @acc_size: Accounted size for this object. |
| 150 | * @kref: Reference count of this buffer object. When this refcount reaches | 149 | * @kref: Reference count of this buffer object. When this refcount reaches |
| 151 | * zero, the object is put on the delayed delete list. | 150 | * zero, the object is put on the delayed delete list. |
| @@ -166,8 +165,7 @@ struct ttm_tt; | |||
| 166 | * @swap: List head for swap LRU list. | 165 | * @swap: List head for swap LRU list. |
| 167 | * @sync_obj: Pointer to a synchronization object. | 166 | * @sync_obj: Pointer to a synchronization object. |
| 168 | * @priv_flags: Flags describing buffer object internal state. | 167 | * @priv_flags: Flags describing buffer object internal state. |
| 169 | * @vm_rb: Rb node for the vm rb tree. | 168 | * @vma_node: Address space manager node. |
| 170 | * @vm_node: Address space manager node. | ||
| 171 | * @offset: The current GPU offset, which can have different meanings | 169 | * @offset: The current GPU offset, which can have different meanings |
| 172 | * depending on the memory type. For SYSTEM type memory, it should be 0. | 170 | * depending on the memory type. For SYSTEM type memory, it should be 0. |
| 173 | * @cur_placement: Hint of current placement. | 171 | * @cur_placement: Hint of current placement. |
| @@ -194,7 +192,6 @@ struct ttm_buffer_object { | |||
| 194 | enum ttm_bo_type type; | 192 | enum ttm_bo_type type; |
| 195 | void (*destroy) (struct ttm_buffer_object *); | 193 | void (*destroy) (struct ttm_buffer_object *); |
| 196 | unsigned long num_pages; | 194 | unsigned long num_pages; |
| 197 | uint64_t addr_space_offset; | ||
| 198 | size_t acc_size; | 195 | size_t acc_size; |
| 199 | 196 | ||
| 200 | /** | 197 | /** |
| @@ -238,13 +235,7 @@ struct ttm_buffer_object { | |||
| 238 | void *sync_obj; | 235 | void *sync_obj; |
| 239 | unsigned long priv_flags; | 236 | unsigned long priv_flags; |
| 240 | 237 | ||
| 241 | /** | 238 | struct drm_vma_offset_node vma_node; |
| 242 | * Members protected by the bdev::vm_lock | ||
| 243 | */ | ||
| 244 | |||
| 245 | struct rb_node vm_rb; | ||
| 246 | struct drm_mm_node *vm_node; | ||
| 247 | |||
| 248 | 239 | ||
| 249 | /** | 240 | /** |
| 250 | * Special members that are protected by the reserve lock | 241 | * Special members that are protected by the reserve lock |
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h index 984fc2d571a1..8639c85d61c4 100644 --- a/include/drm/ttm/ttm_bo_driver.h +++ b/include/drm/ttm/ttm_bo_driver.h | |||
| @@ -36,6 +36,7 @@ | |||
| 36 | #include <ttm/ttm_placement.h> | 36 | #include <ttm/ttm_placement.h> |
| 37 | #include <drm/drm_mm.h> | 37 | #include <drm/drm_mm.h> |
| 38 | #include <drm/drm_global.h> | 38 | #include <drm/drm_global.h> |
| 39 | #include <drm/drm_vma_manager.h> | ||
| 39 | #include <linux/workqueue.h> | 40 | #include <linux/workqueue.h> |
| 40 | #include <linux/fs.h> | 41 | #include <linux/fs.h> |
| 41 | #include <linux/spinlock.h> | 42 | #include <linux/spinlock.h> |
| @@ -519,7 +520,7 @@ struct ttm_bo_global { | |||
| 519 | * @man: An array of mem_type_managers. | 520 | * @man: An array of mem_type_managers. |
| 520 | * @fence_lock: Protects the synchronizing members on *all* bos belonging | 521 | * @fence_lock: Protects the synchronizing members on *all* bos belonging |
| 521 | * to this device. | 522 | * to this device. |
| 522 | * @addr_space_mm: Range manager for the device address space. | 523 | * @vma_manager: Address space manager |
| 523 | * lru_lock: Spinlock that protects the buffer+device lru lists and | 524 | * lru_lock: Spinlock that protects the buffer+device lru lists and |
| 524 | * ddestroy lists. | 525 | * ddestroy lists. |
| 525 | * @val_seq: Current validation sequence. | 526 | * @val_seq: Current validation sequence. |
| @@ -537,14 +538,13 @@ struct ttm_bo_device { | |||
| 537 | struct list_head device_list; | 538 | struct list_head device_list; |
| 538 | struct ttm_bo_global *glob; | 539 | struct ttm_bo_global *glob; |
| 539 | struct ttm_bo_driver *driver; | 540 | struct ttm_bo_driver *driver; |
| 540 | rwlock_t vm_lock; | ||
| 541 | struct ttm_mem_type_manager man[TTM_NUM_MEM_TYPES]; | 541 | struct ttm_mem_type_manager man[TTM_NUM_MEM_TYPES]; |
| 542 | spinlock_t fence_lock; | 542 | spinlock_t fence_lock; |
| 543 | |||
| 543 | /* | 544 | /* |
| 544 | * Protected by the vm lock. | 545 | * Protected by internal locks. |
| 545 | */ | 546 | */ |
| 546 | struct rb_root addr_space_rb; | 547 | struct drm_vma_offset_manager vma_manager; |
| 547 | struct drm_mm addr_space_mm; | ||
| 548 | 548 | ||
| 549 | /* | 549 | /* |
| 550 | * Protected by the global:lru lock. | 550 | * Protected by the global:lru lock. |
diff --git a/include/linux/hdmi.h b/include/linux/hdmi.h index 3b589440ecfe..9231be9e90a2 100644 --- a/include/linux/hdmi.h +++ b/include/linux/hdmi.h | |||
| @@ -18,11 +18,21 @@ enum hdmi_infoframe_type { | |||
| 18 | HDMI_INFOFRAME_TYPE_AUDIO = 0x84, | 18 | HDMI_INFOFRAME_TYPE_AUDIO = 0x84, |
| 19 | }; | 19 | }; |
| 20 | 20 | ||
| 21 | #define HDMI_IEEE_OUI 0x000c03 | ||
| 21 | #define HDMI_INFOFRAME_HEADER_SIZE 4 | 22 | #define HDMI_INFOFRAME_HEADER_SIZE 4 |
| 22 | #define HDMI_AVI_INFOFRAME_SIZE 13 | 23 | #define HDMI_AVI_INFOFRAME_SIZE 13 |
| 23 | #define HDMI_SPD_INFOFRAME_SIZE 25 | 24 | #define HDMI_SPD_INFOFRAME_SIZE 25 |
| 24 | #define HDMI_AUDIO_INFOFRAME_SIZE 10 | 25 | #define HDMI_AUDIO_INFOFRAME_SIZE 10 |
| 25 | 26 | ||
| 27 | #define HDMI_INFOFRAME_SIZE(type) \ | ||
| 28 | (HDMI_INFOFRAME_HEADER_SIZE + HDMI_ ## type ## _INFOFRAME_SIZE) | ||
| 29 | |||
| 30 | struct hdmi_any_infoframe { | ||
| 31 | enum hdmi_infoframe_type type; | ||
| 32 | unsigned char version; | ||
| 33 | unsigned char length; | ||
| 34 | }; | ||
| 35 | |||
| 26 | enum hdmi_colorspace { | 36 | enum hdmi_colorspace { |
| 27 | HDMI_COLORSPACE_RGB, | 37 | HDMI_COLORSPACE_RGB, |
| 28 | HDMI_COLORSPACE_YUV422, | 38 | HDMI_COLORSPACE_YUV422, |
| @@ -100,9 +110,6 @@ struct hdmi_avi_infoframe { | |||
| 100 | unsigned char version; | 110 | unsigned char version; |
| 101 | unsigned char length; | 111 | unsigned char length; |
| 102 | enum hdmi_colorspace colorspace; | 112 | enum hdmi_colorspace colorspace; |
| 103 | bool active_info_valid; | ||
| 104 | bool horizontal_bar_valid; | ||
| 105 | bool vertical_bar_valid; | ||
| 106 | enum hdmi_scan_mode scan_mode; | 113 | enum hdmi_scan_mode scan_mode; |
| 107 | enum hdmi_colorimetry colorimetry; | 114 | enum hdmi_colorimetry colorimetry; |
| 108 | enum hdmi_picture_aspect picture_aspect; | 115 | enum hdmi_picture_aspect picture_aspect; |
| @@ -218,14 +225,52 @@ int hdmi_audio_infoframe_init(struct hdmi_audio_infoframe *frame); | |||
| 218 | ssize_t hdmi_audio_infoframe_pack(struct hdmi_audio_infoframe *frame, | 225 | ssize_t hdmi_audio_infoframe_pack(struct hdmi_audio_infoframe *frame, |
| 219 | void *buffer, size_t size); | 226 | void *buffer, size_t size); |
| 220 | 227 | ||
| 228 | enum hdmi_3d_structure { | ||
| 229 | HDMI_3D_STRUCTURE_INVALID = -1, | ||
| 230 | HDMI_3D_STRUCTURE_FRAME_PACKING = 0, | ||
| 231 | HDMI_3D_STRUCTURE_FIELD_ALTERNATIVE, | ||
| 232 | HDMI_3D_STRUCTURE_LINE_ALTERNATIVE, | ||
| 233 | HDMI_3D_STRUCTURE_SIDE_BY_SIDE_FULL, | ||
| 234 | HDMI_3D_STRUCTURE_L_DEPTH, | ||
| 235 | HDMI_3D_STRUCTURE_L_DEPTH_GFX_GFX_DEPTH, | ||
| 236 | HDMI_3D_STRUCTURE_TOP_AND_BOTTOM, | ||
| 237 | HDMI_3D_STRUCTURE_SIDE_BY_SIDE_HALF = 8, | ||
| 238 | }; | ||
| 239 | |||
| 240 | |||
| 221 | struct hdmi_vendor_infoframe { | 241 | struct hdmi_vendor_infoframe { |
| 222 | enum hdmi_infoframe_type type; | 242 | enum hdmi_infoframe_type type; |
| 223 | unsigned char version; | 243 | unsigned char version; |
| 224 | unsigned char length; | 244 | unsigned char length; |
| 225 | u8 data[27]; | 245 | unsigned int oui; |
| 246 | u8 vic; | ||
| 247 | enum hdmi_3d_structure s3d_struct; | ||
| 248 | unsigned int s3d_ext_data; | ||
| 226 | }; | 249 | }; |
| 227 | 250 | ||
| 251 | int hdmi_vendor_infoframe_init(struct hdmi_vendor_infoframe *frame); | ||
| 228 | ssize_t hdmi_vendor_infoframe_pack(struct hdmi_vendor_infoframe *frame, | 252 | ssize_t hdmi_vendor_infoframe_pack(struct hdmi_vendor_infoframe *frame, |
| 229 | void *buffer, size_t size); | 253 | void *buffer, size_t size); |
| 230 | 254 | ||
| 255 | union hdmi_vendor_any_infoframe { | ||
| 256 | struct { | ||
| 257 | enum hdmi_infoframe_type type; | ||
| 258 | unsigned char version; | ||
| 259 | unsigned char length; | ||
| 260 | unsigned int oui; | ||
| 261 | } any; | ||
| 262 | struct hdmi_vendor_infoframe hdmi; | ||
| 263 | }; | ||
| 264 | |||
| 265 | union hdmi_infoframe { | ||
| 266 | struct hdmi_any_infoframe any; | ||
| 267 | struct hdmi_avi_infoframe avi; | ||
| 268 | struct hdmi_spd_infoframe spd; | ||
| 269 | union hdmi_vendor_any_infoframe vendor; | ||
| 270 | struct hdmi_audio_infoframe audio; | ||
| 271 | }; | ||
| 272 | |||
| 273 | ssize_t | ||
| 274 | hdmi_infoframe_pack(union hdmi_infoframe *frame, void *buffer, size_t size); | ||
| 275 | |||
| 231 | #endif /* _DRM_HDMI_H */ | 276 | #endif /* _DRM_HDMI_H */ |
diff --git a/include/linux/platform_data/rcar-du.h b/include/linux/platform_data/rcar-du.h index 80587fdbba3e..1a2e9901a22e 100644 --- a/include/linux/platform_data/rcar-du.h +++ b/include/linux/platform_data/rcar-du.h | |||
| @@ -16,8 +16,18 @@ | |||
| 16 | 16 | ||
| 17 | #include <drm/drm_mode.h> | 17 | #include <drm/drm_mode.h> |
| 18 | 18 | ||
| 19 | enum rcar_du_output { | ||
| 20 | RCAR_DU_OUTPUT_DPAD0, | ||
| 21 | RCAR_DU_OUTPUT_DPAD1, | ||
| 22 | RCAR_DU_OUTPUT_LVDS0, | ||
| 23 | RCAR_DU_OUTPUT_LVDS1, | ||
| 24 | RCAR_DU_OUTPUT_TCON, | ||
| 25 | RCAR_DU_OUTPUT_MAX, | ||
| 26 | }; | ||
| 27 | |||
| 19 | enum rcar_du_encoder_type { | 28 | enum rcar_du_encoder_type { |
| 20 | RCAR_DU_ENCODER_UNUSED = 0, | 29 | RCAR_DU_ENCODER_UNUSED = 0, |
| 30 | RCAR_DU_ENCODER_NONE, | ||
| 21 | RCAR_DU_ENCODER_VGA, | 31 | RCAR_DU_ENCODER_VGA, |
| 22 | RCAR_DU_ENCODER_LVDS, | 32 | RCAR_DU_ENCODER_LVDS, |
| 23 | }; | 33 | }; |
| @@ -28,22 +38,32 @@ struct rcar_du_panel_data { | |||
| 28 | struct drm_mode_modeinfo mode; | 38 | struct drm_mode_modeinfo mode; |
| 29 | }; | 39 | }; |
| 30 | 40 | ||
| 31 | struct rcar_du_encoder_lvds_data { | 41 | struct rcar_du_connector_lvds_data { |
| 32 | struct rcar_du_panel_data panel; | 42 | struct rcar_du_panel_data panel; |
| 33 | }; | 43 | }; |
| 34 | 44 | ||
| 35 | struct rcar_du_encoder_vga_data { | 45 | struct rcar_du_connector_vga_data { |
| 36 | /* TODO: Add DDC information for EDID retrieval */ | 46 | /* TODO: Add DDC information for EDID retrieval */ |
| 37 | }; | 47 | }; |
| 38 | 48 | ||
| 49 | /* | ||
| 50 | * struct rcar_du_encoder_data - Encoder platform data | ||
| 51 | * @type: the encoder type (RCAR_DU_ENCODER_*) | ||
| 52 | * @output: the DU output the connector is connected to (RCAR_DU_OUTPUT_*) | ||
| 53 | * @connector.lvds: platform data for LVDS connectors | ||
| 54 | * @connector.vga: platform data for VGA connectors | ||
| 55 | * | ||
| 56 | * Encoder platform data describes an on-board encoder, its associated DU SoC | ||
| 57 | * output, and the connector. | ||
| 58 | */ | ||
| 39 | struct rcar_du_encoder_data { | 59 | struct rcar_du_encoder_data { |
| 40 | enum rcar_du_encoder_type encoder; | 60 | enum rcar_du_encoder_type type; |
| 41 | unsigned int output; | 61 | enum rcar_du_output output; |
| 42 | 62 | ||
| 43 | union { | 63 | union { |
| 44 | struct rcar_du_encoder_lvds_data lvds; | 64 | struct rcar_du_connector_lvds_data lvds; |
| 45 | struct rcar_du_encoder_vga_data vga; | 65 | struct rcar_du_connector_vga_data vga; |
| 46 | } u; | 66 | } connector; |
| 47 | }; | 67 | }; |
| 48 | 68 | ||
| 49 | struct rcar_du_platform_data { | 69 | struct rcar_du_platform_data { |
diff --git a/include/linux/vga_switcheroo.h b/include/linux/vga_switcheroo.h index ddb419cf4530..502073a53dd3 100644 --- a/include/linux/vga_switcheroo.h +++ b/include/linux/vga_switcheroo.h | |||
| @@ -45,7 +45,8 @@ struct vga_switcheroo_client_ops { | |||
| 45 | #if defined(CONFIG_VGA_SWITCHEROO) | 45 | #if defined(CONFIG_VGA_SWITCHEROO) |
| 46 | void vga_switcheroo_unregister_client(struct pci_dev *dev); | 46 | void vga_switcheroo_unregister_client(struct pci_dev *dev); |
| 47 | int vga_switcheroo_register_client(struct pci_dev *dev, | 47 | int vga_switcheroo_register_client(struct pci_dev *dev, |
| 48 | const struct vga_switcheroo_client_ops *ops); | 48 | const struct vga_switcheroo_client_ops *ops, |
| 49 | bool driver_power_control); | ||
| 49 | int vga_switcheroo_register_audio_client(struct pci_dev *pdev, | 50 | int vga_switcheroo_register_audio_client(struct pci_dev *pdev, |
| 50 | const struct vga_switcheroo_client_ops *ops, | 51 | const struct vga_switcheroo_client_ops *ops, |
| 51 | int id, bool active); | 52 | int id, bool active); |
| @@ -60,11 +61,15 @@ int vga_switcheroo_process_delayed_switch(void); | |||
| 60 | 61 | ||
| 61 | int vga_switcheroo_get_client_state(struct pci_dev *dev); | 62 | int vga_switcheroo_get_client_state(struct pci_dev *dev); |
| 62 | 63 | ||
| 64 | void vga_switcheroo_set_dynamic_switch(struct pci_dev *pdev, enum vga_switcheroo_state dynamic); | ||
| 65 | |||
| 66 | int vga_switcheroo_init_domain_pm_ops(struct device *dev, struct dev_pm_domain *domain); | ||
| 67 | int vga_switcheroo_init_domain_pm_optimus_hdmi_audio(struct device *dev, struct dev_pm_domain *domain); | ||
| 63 | #else | 68 | #else |
| 64 | 69 | ||
| 65 | static inline void vga_switcheroo_unregister_client(struct pci_dev *dev) {} | 70 | static inline void vga_switcheroo_unregister_client(struct pci_dev *dev) {} |
| 66 | static inline int vga_switcheroo_register_client(struct pci_dev *dev, | 71 | static inline int vga_switcheroo_register_client(struct pci_dev *dev, |
| 67 | const struct vga_switcheroo_client_ops *ops) { return 0; } | 72 | const struct vga_switcheroo_client_ops *ops, bool driver_power_control) { return 0; } |
| 68 | static inline void vga_switcheroo_client_fb_set(struct pci_dev *dev, struct fb_info *info) {} | 73 | static inline void vga_switcheroo_client_fb_set(struct pci_dev *dev, struct fb_info *info) {} |
| 69 | static inline int vga_switcheroo_register_handler(struct vga_switcheroo_handler *handler) { return 0; } | 74 | static inline int vga_switcheroo_register_handler(struct vga_switcheroo_handler *handler) { return 0; } |
| 70 | static inline int vga_switcheroo_register_audio_client(struct pci_dev *pdev, | 75 | static inline int vga_switcheroo_register_audio_client(struct pci_dev *pdev, |
| @@ -74,6 +79,10 @@ static inline void vga_switcheroo_unregister_handler(void) {} | |||
| 74 | static inline int vga_switcheroo_process_delayed_switch(void) { return 0; } | 79 | static inline int vga_switcheroo_process_delayed_switch(void) { return 0; } |
| 75 | static inline int vga_switcheroo_get_client_state(struct pci_dev *dev) { return VGA_SWITCHEROO_ON; } | 80 | static inline int vga_switcheroo_get_client_state(struct pci_dev *dev) { return VGA_SWITCHEROO_ON; } |
| 76 | 81 | ||
| 82 | static inline void vga_switcheroo_set_dynamic_switch(struct pci_dev *pdev, enum vga_switcheroo_state dynamic) {} | ||
| 83 | |||
| 84 | static inline int vga_switcheroo_init_domain_pm_ops(struct device *dev, struct dev_pm_domain *domain) { return -EINVAL; } | ||
| 85 | static inline int vga_switcheroo_init_domain_pm_optimus_hdmi_audio(struct device *dev, struct dev_pm_domain *domain) { return -EINVAL; } | ||
| 77 | 86 | ||
| 78 | #endif | 87 | #endif |
| 79 | #endif /* _LINUX_VGA_SWITCHEROO_H_ */ | 88 | #endif /* _LINUX_VGA_SWITCHEROO_H_ */ |
diff --git a/include/uapi/drm/Kbuild b/include/uapi/drm/Kbuild index 119487e05e65..2d9a25daab05 100644 --- a/include/uapi/drm/Kbuild +++ b/include/uapi/drm/Kbuild | |||
| @@ -16,3 +16,4 @@ header-y += sis_drm.h | |||
| 16 | header-y += tegra_drm.h | 16 | header-y += tegra_drm.h |
| 17 | header-y += via_drm.h | 17 | header-y += via_drm.h |
| 18 | header-y += vmwgfx_drm.h | 18 | header-y += vmwgfx_drm.h |
| 19 | header-y += msm_drm.h | ||
diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h index 238a166b9fe6..ece867889cc7 100644 --- a/include/uapi/drm/drm.h +++ b/include/uapi/drm/drm.h | |||
| @@ -181,7 +181,7 @@ enum drm_map_type { | |||
| 181 | _DRM_AGP = 3, /**< AGP/GART */ | 181 | _DRM_AGP = 3, /**< AGP/GART */ |
| 182 | _DRM_SCATTER_GATHER = 4, /**< Scatter/gather memory for PCI DMA */ | 182 | _DRM_SCATTER_GATHER = 4, /**< Scatter/gather memory for PCI DMA */ |
| 183 | _DRM_CONSISTENT = 5, /**< Consistent memory for PCI DMA */ | 183 | _DRM_CONSISTENT = 5, /**< Consistent memory for PCI DMA */ |
| 184 | _DRM_GEM = 6, /**< GEM object */ | 184 | _DRM_GEM = 6, /**< GEM object (obsolete) */ |
| 185 | }; | 185 | }; |
| 186 | 186 | ||
| 187 | /** | 187 | /** |
| @@ -780,6 +780,7 @@ struct drm_event_vblank { | |||
| 780 | #define DRM_CAP_DUMB_PREFER_SHADOW 0x4 | 780 | #define DRM_CAP_DUMB_PREFER_SHADOW 0x4 |
| 781 | #define DRM_CAP_PRIME 0x5 | 781 | #define DRM_CAP_PRIME 0x5 |
| 782 | #define DRM_CAP_TIMESTAMP_MONOTONIC 0x6 | 782 | #define DRM_CAP_TIMESTAMP_MONOTONIC 0x6 |
| 783 | #define DRM_CAP_ASYNC_PAGE_FLIP 0x7 | ||
| 783 | 784 | ||
| 784 | #define DRM_PRIME_CAP_IMPORT 0x1 | 785 | #define DRM_PRIME_CAP_IMPORT 0x1 |
| 785 | #define DRM_PRIME_CAP_EXPORT 0x2 | 786 | #define DRM_PRIME_CAP_EXPORT 0x2 |
diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h index 53db7cea373b..550811712f78 100644 --- a/include/uapi/drm/drm_mode.h +++ b/include/uapi/drm/drm_mode.h | |||
| @@ -412,7 +412,8 @@ struct drm_mode_crtc_lut { | |||
| 412 | }; | 412 | }; |
| 413 | 413 | ||
| 414 | #define DRM_MODE_PAGE_FLIP_EVENT 0x01 | 414 | #define DRM_MODE_PAGE_FLIP_EVENT 0x01 |
| 415 | #define DRM_MODE_PAGE_FLIP_FLAGS DRM_MODE_PAGE_FLIP_EVENT | 415 | #define DRM_MODE_PAGE_FLIP_ASYNC 0x02 |
| 416 | #define DRM_MODE_PAGE_FLIP_FLAGS (DRM_MODE_PAGE_FLIP_EVENT|DRM_MODE_PAGE_FLIP_ASYNC) | ||
| 416 | 417 | ||
| 417 | /* | 418 | /* |
| 418 | * Request a page flip on the specified crtc. | 419 | * Request a page flip on the specified crtc. |
| @@ -426,11 +427,14 @@ struct drm_mode_crtc_lut { | |||
| 426 | * flip is already pending as the ioctl is called, EBUSY will be | 427 | * flip is already pending as the ioctl is called, EBUSY will be |
| 427 | * returned. | 428 | * returned. |
| 428 | * | 429 | * |
| 429 | * The ioctl supports one flag, DRM_MODE_PAGE_FLIP_EVENT, which will | 430 | * Flag DRM_MODE_PAGE_FLIP_EVENT requests that drm sends back a vblank |
| 430 | * request that drm sends back a vblank event (see drm.h: struct | 431 | * event (see drm.h: struct drm_event_vblank) when the page flip is |
| 431 | * drm_event_vblank) when the page flip is done. The user_data field | 432 | * done. The user_data field passed in with this ioctl will be |
| 432 | * passed in with this ioctl will be returned as the user_data field | 433 | * returned as the user_data field in the vblank event struct. |
| 433 | * in the vblank event struct. | 434 | * |
| 435 | * Flag DRM_MODE_PAGE_FLIP_ASYNC requests that the flip happen | ||
| 436 | * 'as soon as possible', meaning that it not delay waiting for vblank. | ||
| 437 | * This may cause tearing on the screen. | ||
| 434 | * | 438 | * |
| 435 | * The reserved field must be zero until we figure out something | 439 | * The reserved field must be zero until we figure out something |
| 436 | * clever to use it for. | 440 | * clever to use it for. |
diff --git a/include/uapi/drm/i915_drm.h b/include/uapi/drm/i915_drm.h index 923ed7fe5775..55bb5729bd78 100644 --- a/include/uapi/drm/i915_drm.h +++ b/include/uapi/drm/i915_drm.h | |||
| @@ -33,6 +33,30 @@ | |||
| 33 | * subject to backwards-compatibility constraints. | 33 | * subject to backwards-compatibility constraints. |
| 34 | */ | 34 | */ |
| 35 | 35 | ||
| 36 | /** | ||
| 37 | * DOC: uevents generated by i915 on it's device node | ||
| 38 | * | ||
| 39 | * I915_L3_PARITY_UEVENT - Generated when the driver receives a parity mismatch | ||
| 40 | * event from the gpu l3 cache. Additional information supplied is ROW, | ||
| 41 | * BANK, SUBBANK of the affected cacheline. Userspace should keep track of | ||
| 42 | * these events and if a specific cache-line seems to have a persistent | ||
| 43 | * error remap it with the l3 remapping tool supplied in intel-gpu-tools. | ||
| 44 | * The value supplied with the event is always 1. | ||
| 45 | * | ||
| 46 | * I915_ERROR_UEVENT - Generated upon error detection, currently only via | ||
| 47 | * hangcheck. The error detection event is a good indicator of when things | ||
| 48 | * began to go badly. The value supplied with the event is a 1 upon error | ||
| 49 | * detection, and a 0 upon reset completion, signifying no more error | ||
| 50 | * exists. NOTE: Disabling hangcheck or reset via module parameter will | ||
| 51 | * cause the related events to not be seen. | ||
| 52 | * | ||
| 53 | * I915_RESET_UEVENT - Event is generated just before an attempt to reset the | ||
| 54 | * the GPU. The value supplied with the event is always 1. NOTE: Disable | ||
| 55 | * reset via module parameter will cause this event to not be seen. | ||
| 56 | */ | ||
| 57 | #define I915_L3_PARITY_UEVENT "L3_PARITY_ERROR" | ||
| 58 | #define I915_ERROR_UEVENT "ERROR" | ||
| 59 | #define I915_RESET_UEVENT "RESET" | ||
| 36 | 60 | ||
| 37 | /* Each region is a minimum of 16k, and there are at most 255 of them. | 61 | /* Each region is a minimum of 16k, and there are at most 255 of them. |
| 38 | */ | 62 | */ |
| @@ -310,6 +334,7 @@ typedef struct drm_i915_irq_wait { | |||
| 310 | #define I915_PARAM_HAS_PINNED_BATCHES 24 | 334 | #define I915_PARAM_HAS_PINNED_BATCHES 24 |
| 311 | #define I915_PARAM_HAS_EXEC_NO_RELOC 25 | 335 | #define I915_PARAM_HAS_EXEC_NO_RELOC 25 |
| 312 | #define I915_PARAM_HAS_EXEC_HANDLE_LUT 26 | 336 | #define I915_PARAM_HAS_EXEC_HANDLE_LUT 26 |
| 337 | #define I915_PARAM_HAS_WT 27 | ||
| 313 | 338 | ||
| 314 | typedef struct drm_i915_getparam { | 339 | typedef struct drm_i915_getparam { |
| 315 | int param; | 340 | int param; |
| @@ -744,8 +769,32 @@ struct drm_i915_gem_busy { | |||
| 744 | __u32 busy; | 769 | __u32 busy; |
| 745 | }; | 770 | }; |
| 746 | 771 | ||
| 772 | /** | ||
| 773 | * I915_CACHING_NONE | ||
| 774 | * | ||
| 775 | * GPU access is not coherent with cpu caches. Default for machines without an | ||
| 776 | * LLC. | ||
| 777 | */ | ||
| 747 | #define I915_CACHING_NONE 0 | 778 | #define I915_CACHING_NONE 0 |
| 779 | /** | ||
| 780 | * I915_CACHING_CACHED | ||
| 781 | * | ||
| 782 | * GPU access is coherent with cpu caches and furthermore the data is cached in | ||
| 783 | * last-level caches shared between cpu cores and the gpu GT. Default on | ||
| 784 | * machines with HAS_LLC. | ||
| 785 | */ | ||
| 748 | #define I915_CACHING_CACHED 1 | 786 | #define I915_CACHING_CACHED 1 |
| 787 | /** | ||
| 788 | * I915_CACHING_DISPLAY | ||
| 789 | * | ||
| 790 | * Special GPU caching mode which is coherent with the scanout engines. | ||
| 791 | * Transparently falls back to I915_CACHING_NONE on platforms where no special | ||
| 792 | * cache mode (like write-through or gfdt flushing) is available. The kernel | ||
| 793 | * automatically sets this mode when using a buffer as a scanout target. | ||
| 794 | * Userspace can manually set this mode to avoid a costly stall and clflush in | ||
| 795 | * the hotpath of drawing the first frame. | ||
| 796 | */ | ||
| 797 | #define I915_CACHING_DISPLAY 2 | ||
| 749 | 798 | ||
| 750 | struct drm_i915_gem_caching { | 799 | struct drm_i915_gem_caching { |
| 751 | /** | 800 | /** |
diff --git a/include/uapi/drm/msm_drm.h b/include/uapi/drm/msm_drm.h new file mode 100644 index 000000000000..d3c62074016d --- /dev/null +++ b/include/uapi/drm/msm_drm.h | |||
| @@ -0,0 +1,207 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2013 Red Hat | ||
| 3 | * Author: Rob Clark <robdclark@gmail.com> | ||
| 4 | * | ||
| 5 | * This program is free software; you can redistribute it and/or modify it | ||
| 6 | * under the terms of the GNU General Public License version 2 as published by | ||
| 7 | * the Free Software Foundation. | ||
| 8 | * | ||
| 9 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
| 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
| 12 | * more details. | ||
| 13 | * | ||
| 14 | * You should have received a copy of the GNU General Public License along with | ||
| 15 | * this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #ifndef __MSM_DRM_H__ | ||
| 19 | #define __MSM_DRM_H__ | ||
| 20 | |||
| 21 | #include <stddef.h> | ||
| 22 | #include <drm/drm.h> | ||
| 23 | |||
| 24 | /* Please note that modifications to all structs defined here are | ||
| 25 | * subject to backwards-compatibility constraints: | ||
| 26 | * 1) Do not use pointers, use uint64_t instead for 32 bit / 64 bit | ||
| 27 | * user/kernel compatibility | ||
| 28 | * 2) Keep fields aligned to their size | ||
| 29 | * 3) Because of how drm_ioctl() works, we can add new fields at | ||
| 30 | * the end of an ioctl if some care is taken: drm_ioctl() will | ||
| 31 | * zero out the new fields at the tail of the ioctl, so a zero | ||
| 32 | * value should have a backwards compatible meaning. And for | ||
| 33 | * output params, userspace won't see the newly added output | ||
| 34 | * fields.. so that has to be somehow ok. | ||
| 35 | */ | ||
| 36 | |||
| 37 | #define MSM_PIPE_NONE 0x00 | ||
| 38 | #define MSM_PIPE_2D0 0x01 | ||
| 39 | #define MSM_PIPE_2D1 0x02 | ||
| 40 | #define MSM_PIPE_3D0 0x10 | ||
| 41 | |||
| 42 | /* timeouts are specified in clock-monotonic absolute times (to simplify | ||
| 43 | * restarting interrupted ioctls). The following struct is logically the | ||
| 44 | * same as 'struct timespec' but 32/64b ABI safe. | ||
| 45 | */ | ||
| 46 | struct drm_msm_timespec { | ||
| 47 | int64_t tv_sec; /* seconds */ | ||
| 48 | int64_t tv_nsec; /* nanoseconds */ | ||
| 49 | }; | ||
| 50 | |||
| 51 | #define MSM_PARAM_GPU_ID 0x01 | ||
| 52 | #define MSM_PARAM_GMEM_SIZE 0x02 | ||
| 53 | |||
| 54 | struct drm_msm_param { | ||
| 55 | uint32_t pipe; /* in, MSM_PIPE_x */ | ||
| 56 | uint32_t param; /* in, MSM_PARAM_x */ | ||
| 57 | uint64_t value; /* out (get_param) or in (set_param) */ | ||
| 58 | }; | ||
| 59 | |||
| 60 | /* | ||
| 61 | * GEM buffers: | ||
| 62 | */ | ||
| 63 | |||
| 64 | #define MSM_BO_SCANOUT 0x00000001 /* scanout capable */ | ||
| 65 | #define MSM_BO_GPU_READONLY 0x00000002 | ||
| 66 | #define MSM_BO_CACHE_MASK 0x000f0000 | ||
| 67 | /* cache modes */ | ||
| 68 | #define MSM_BO_CACHED 0x00010000 | ||
| 69 | #define MSM_BO_WC 0x00020000 | ||
| 70 | #define MSM_BO_UNCACHED 0x00040000 | ||
| 71 | |||
| 72 | struct drm_msm_gem_new { | ||
| 73 | uint64_t size; /* in */ | ||
| 74 | uint32_t flags; /* in, mask of MSM_BO_x */ | ||
| 75 | uint32_t handle; /* out */ | ||
| 76 | }; | ||
| 77 | |||
| 78 | struct drm_msm_gem_info { | ||
| 79 | uint32_t handle; /* in */ | ||
| 80 | uint32_t pad; | ||
| 81 | uint64_t offset; /* out, offset to pass to mmap() */ | ||
| 82 | }; | ||
| 83 | |||
| 84 | #define MSM_PREP_READ 0x01 | ||
| 85 | #define MSM_PREP_WRITE 0x02 | ||
| 86 | #define MSM_PREP_NOSYNC 0x04 | ||
| 87 | |||
| 88 | struct drm_msm_gem_cpu_prep { | ||
| 89 | uint32_t handle; /* in */ | ||
| 90 | uint32_t op; /* in, mask of MSM_PREP_x */ | ||
| 91 | struct drm_msm_timespec timeout; /* in */ | ||
| 92 | }; | ||
| 93 | |||
| 94 | struct drm_msm_gem_cpu_fini { | ||
| 95 | uint32_t handle; /* in */ | ||
| 96 | }; | ||
| 97 | |||
| 98 | /* | ||
| 99 | * Cmdstream Submission: | ||
| 100 | */ | ||
| 101 | |||
| 102 | /* The value written into the cmdstream is logically: | ||
| 103 | * | ||
| 104 | * ((relocbuf->gpuaddr + reloc_offset) << shift) | or | ||
| 105 | * | ||
| 106 | * When we have GPU's w/ >32bit ptrs, it should be possible to deal | ||
| 107 | * with this by emit'ing two reloc entries with appropriate shift | ||
| 108 | * values. Or a new MSM_SUBMIT_CMD_x type would also be an option. | ||
| 109 | * | ||
| 110 | * NOTE that reloc's must be sorted by order of increasing submit_offset, | ||
| 111 | * otherwise EINVAL. | ||
| 112 | */ | ||
| 113 | struct drm_msm_gem_submit_reloc { | ||
| 114 | uint32_t submit_offset; /* in, offset from submit_bo */ | ||
| 115 | uint32_t or; /* in, value OR'd with result */ | ||
| 116 | int32_t shift; /* in, amount of left shift (can be negative) */ | ||
| 117 | uint32_t reloc_idx; /* in, index of reloc_bo buffer */ | ||
| 118 | uint64_t reloc_offset; /* in, offset from start of reloc_bo */ | ||
| 119 | }; | ||
| 120 | |||
| 121 | /* submit-types: | ||
| 122 | * BUF - this cmd buffer is executed normally. | ||
| 123 | * IB_TARGET_BUF - this cmd buffer is an IB target. Reloc's are | ||
| 124 | * processed normally, but the kernel does not setup an IB to | ||
| 125 | * this buffer in the first-level ringbuffer | ||
| 126 | * CTX_RESTORE_BUF - only executed if there has been a GPU context | ||
| 127 | * switch since the last SUBMIT ioctl | ||
| 128 | */ | ||
| 129 | #define MSM_SUBMIT_CMD_BUF 0x0001 | ||
| 130 | #define MSM_SUBMIT_CMD_IB_TARGET_BUF 0x0002 | ||
| 131 | #define MSM_SUBMIT_CMD_CTX_RESTORE_BUF 0x0003 | ||
| 132 | struct drm_msm_gem_submit_cmd { | ||
| 133 | uint32_t type; /* in, one of MSM_SUBMIT_CMD_x */ | ||
| 134 | uint32_t submit_idx; /* in, index of submit_bo cmdstream buffer */ | ||
| 135 | uint32_t submit_offset; /* in, offset into submit_bo */ | ||
| 136 | uint32_t size; /* in, cmdstream size */ | ||
| 137 | uint32_t pad; | ||
| 138 | uint32_t nr_relocs; /* in, number of submit_reloc's */ | ||
| 139 | uint64_t __user relocs; /* in, ptr to array of submit_reloc's */ | ||
| 140 | }; | ||
| 141 | |||
| 142 | /* Each buffer referenced elsewhere in the cmdstream submit (ie. the | ||
| 143 | * cmdstream buffer(s) themselves or reloc entries) has one (and only | ||
| 144 | * one) entry in the submit->bos[] table. | ||
| 145 | * | ||
| 146 | * As a optimization, the current buffer (gpu virtual address) can be | ||
| 147 | * passed back through the 'presumed' field. If on a subsequent reloc, | ||
| 148 | * userspace passes back a 'presumed' address that is still valid, | ||
| 149 | * then patching the cmdstream for this entry is skipped. This can | ||
| 150 | * avoid kernel needing to map/access the cmdstream bo in the common | ||
| 151 | * case. | ||
| 152 | */ | ||
| 153 | #define MSM_SUBMIT_BO_READ 0x0001 | ||
| 154 | #define MSM_SUBMIT_BO_WRITE 0x0002 | ||
| 155 | struct drm_msm_gem_submit_bo { | ||
| 156 | uint32_t flags; /* in, mask of MSM_SUBMIT_BO_x */ | ||
| 157 | uint32_t handle; /* in, GEM handle */ | ||
| 158 | uint64_t presumed; /* in/out, presumed buffer address */ | ||
| 159 | }; | ||
| 160 | |||
| 161 | /* Each cmdstream submit consists of a table of buffers involved, and | ||
| 162 | * one or more cmdstream buffers. This allows for conditional execution | ||
| 163 | * (context-restore), and IB buffers needed for per tile/bin draw cmds. | ||
| 164 | */ | ||
| 165 | struct drm_msm_gem_submit { | ||
| 166 | uint32_t pipe; /* in, MSM_PIPE_x */ | ||
| 167 | uint32_t fence; /* out */ | ||
| 168 | uint32_t nr_bos; /* in, number of submit_bo's */ | ||
| 169 | uint32_t nr_cmds; /* in, number of submit_cmd's */ | ||
| 170 | uint64_t __user bos; /* in, ptr to array of submit_bo's */ | ||
| 171 | uint64_t __user cmds; /* in, ptr to array of submit_cmd's */ | ||
| 172 | }; | ||
| 173 | |||
| 174 | /* The normal way to synchronize with the GPU is just to CPU_PREP on | ||
| 175 | * a buffer if you need to access it from the CPU (other cmdstream | ||
| 176 | * submission from same or other contexts, PAGE_FLIP ioctl, etc, all | ||
| 177 | * handle the required synchronization under the hood). This ioctl | ||
| 178 | * mainly just exists as a way to implement the gallium pipe_fence | ||
| 179 | * APIs without requiring a dummy bo to synchronize on. | ||
| 180 | */ | ||
| 181 | struct drm_msm_wait_fence { | ||
| 182 | uint32_t fence; /* in */ | ||
| 183 | uint32_t pad; | ||
| 184 | struct drm_msm_timespec timeout; /* in */ | ||
| 185 | }; | ||
| 186 | |||
| 187 | #define DRM_MSM_GET_PARAM 0x00 | ||
| 188 | /* placeholder: | ||
| 189 | #define DRM_MSM_SET_PARAM 0x01 | ||
| 190 | */ | ||
| 191 | #define DRM_MSM_GEM_NEW 0x02 | ||
| 192 | #define DRM_MSM_GEM_INFO 0x03 | ||
| 193 | #define DRM_MSM_GEM_CPU_PREP 0x04 | ||
| 194 | #define DRM_MSM_GEM_CPU_FINI 0x05 | ||
| 195 | #define DRM_MSM_GEM_SUBMIT 0x06 | ||
| 196 | #define DRM_MSM_WAIT_FENCE 0x07 | ||
| 197 | #define DRM_MSM_NUM_IOCTLS 0x08 | ||
| 198 | |||
| 199 | #define DRM_IOCTL_MSM_GET_PARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_MSM_GET_PARAM, struct drm_msm_param) | ||
| 200 | #define DRM_IOCTL_MSM_GEM_NEW DRM_IOWR(DRM_COMMAND_BASE + DRM_MSM_GEM_NEW, struct drm_msm_gem_new) | ||
| 201 | #define DRM_IOCTL_MSM_GEM_INFO DRM_IOWR(DRM_COMMAND_BASE + DRM_MSM_GEM_INFO, struct drm_msm_gem_info) | ||
| 202 | #define DRM_IOCTL_MSM_GEM_CPU_PREP DRM_IOW (DRM_COMMAND_BASE + DRM_MSM_GEM_CPU_PREP, struct drm_msm_gem_cpu_prep) | ||
| 203 | #define DRM_IOCTL_MSM_GEM_CPU_FINI DRM_IOW (DRM_COMMAND_BASE + DRM_MSM_GEM_CPU_FINI, struct drm_msm_gem_cpu_fini) | ||
| 204 | #define DRM_IOCTL_MSM_GEM_SUBMIT DRM_IOWR(DRM_COMMAND_BASE + DRM_MSM_GEM_SUBMIT, struct drm_msm_gem_submit) | ||
| 205 | #define DRM_IOCTL_MSM_WAIT_FENCE DRM_IOW (DRM_COMMAND_BASE + DRM_MSM_WAIT_FENCE, struct drm_msm_wait_fence) | ||
| 206 | |||
| 207 | #endif /* __MSM_DRM_H__ */ | ||
diff --git a/include/uapi/drm/radeon_drm.h b/include/uapi/drm/radeon_drm.h index 321d4ac5c512..fa8b3adf9ffb 100644 --- a/include/uapi/drm/radeon_drm.h +++ b/include/uapi/drm/radeon_drm.h | |||
| @@ -979,6 +979,8 @@ struct drm_radeon_cs { | |||
| 979 | #define RADEON_INFO_RING_WORKING 0x15 | 979 | #define RADEON_INFO_RING_WORKING 0x15 |
| 980 | /* SI tile mode array */ | 980 | /* SI tile mode array */ |
| 981 | #define RADEON_INFO_SI_TILE_MODE_ARRAY 0x16 | 981 | #define RADEON_INFO_SI_TILE_MODE_ARRAY 0x16 |
| 982 | /* query if CP DMA is supported on the compute ring */ | ||
| 983 | #define RADEON_INFO_SI_CP_DMA_COMPUTE 0x17 | ||
| 982 | 984 | ||
| 983 | 985 | ||
| 984 | struct drm_radeon_info { | 986 | struct drm_radeon_info { |
