diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-07-09 19:04:31 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-07-09 19:04:31 -0400 |
| commit | 2e17c5a97e231f3cb426f4b7895eab5be5c5442e (patch) | |
| tree | 80871817427250200d6931a45ccb4833c4add74a /include | |
| parent | 5f097cd249f00683442c3e265d6f27d80fc83563 (diff) | |
| parent | 774d8e34e46506222bb5e2888e3ef42b2775715f (diff) | |
Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux
Pull drm updates from Dave Airlie:
"Okay this is the big one, I was stalled on the fbdev pull req as I
stupidly let fbdev guys merge a patch I required to fix a warning with
some patches I had, they ended up merging the patch from the wrong
place, but the warning should be fixed. In future I'll just take the
patch myself!
Outside drm:
There are some snd changes for the HDMI audio interactions on haswell,
they've been acked for inclusion via my tree. This relies on the
wound/wait tree from Ingo which is already merged.
Major changes:
AMD finally released the dynamic power management code for all their
GPUs from r600->present day, this is great, off by default for now but
also a huge amount of code, in fact it is most of this pull request.
Since it landed there has been a lot of community testing and Alex has
sent a lot of fixes for any bugs found so far. I suspect radeon might
now be the biggest kernel driver ever :-P p.s. radeon.dpm=1 to enable
dynamic powermanagement for anyone.
New drivers:
Renesas r-car display unit.
Other highlights:
- core: GEM CMA prime support, use new w/w mutexs for TTM
reservations, cursor hotspot, doc updates
- dvo chips: chrontel 7010B support
- i915: Haswell (fbc, ips, vecs, watermarks, audio powerwell),
Valleyview (enabled by default, rc6), lots of pll reworking, 30bpp
support (this time for sure)
- nouveau: async buffer object deletion, context/register init
updates, kernel vp2 engine support, GF117 support, GK110 accel
support (with external nvidia ucode), context cleanups.
- exynos: memory leak fixes, Add S3C64XX SoC series support, device
tree updates, common clock framework support,
- qxl: cursor hotspot support, multi-monitor support, suspend/resume
support
- mgag200: hw cursor support, g200 mode limiting
- shmobile: prime support
- tegra: fixes mostly
I've been banging on this quite a lot due to the size of it, and it
seems to okay on everything I've tested it on."
* 'drm-next' of git://people.freedesktop.org/~airlied/linux: (811 commits)
drm/radeon/dpm: implement vblank_too_short callback for si
drm/radeon/dpm: implement vblank_too_short callback for cayman
drm/radeon/dpm: implement vblank_too_short callback for btc
drm/radeon/dpm: implement vblank_too_short callback for evergreen
drm/radeon/dpm: implement vblank_too_short callback for 7xx
drm/radeon/dpm: add checks against vblank time
drm/radeon/dpm: add helper to calculate vblank time
drm/radeon: remove stray line in old pm code
drm/radeon/dpm: fix display_gap programming on rv7xx
drm/nvc0/gr: fix gpc firmware regression
drm/nouveau: fix minor thinko causing bo moves to not be async on kepler
drm/radeon/dpm: implement force performance level for TN
drm/radeon/dpm: implement force performance level for ON/LN
drm/radeon/dpm: implement force performance level for SI
drm/radeon/dpm: implement force performance level for cayman
drm/radeon/dpm: implement force performance levels for 7xx/eg/btc
drm/radeon/dpm: add infrastructure to force performance levels
drm/radeon: fix surface setup on r1xx
drm/radeon: add support for 3d perf states on older asics
drm/radeon: set default clocks for SI when DPM is disabled
...
Diffstat (limited to 'include')
| -rw-r--r-- | include/drm/drmP.h | 40 | ||||
| -rw-r--r-- | include/drm/drm_crtc.h | 37 | ||||
| -rw-r--r-- | include/drm/drm_fixed.h | 94 | ||||
| -rw-r--r-- | include/drm/drm_gem_cma_helper.h | 12 | ||||
| -rw-r--r-- | include/drm/drm_mm.h | 38 | ||||
| -rw-r--r-- | include/drm/drm_os_linux.h | 16 | ||||
| -rw-r--r-- | include/drm/drm_pciids.h | 24 | ||||
| -rw-r--r-- | include/drm/drm_rect.h | 167 | ||||
| -rw-r--r-- | include/drm/i915_powerwell.h | 36 | ||||
| -rw-r--r-- | include/drm/ttm/ttm_bo_api.h | 37 | ||||
| -rw-r--r-- | include/drm/ttm/ttm_bo_driver.h | 169 | ||||
| -rw-r--r-- | include/drm/ttm/ttm_execbuf_util.h | 12 | ||||
| -rw-r--r-- | include/linux/io.h | 25 | ||||
| -rw-r--r-- | include/linux/platform_data/rcar-du.h | 54 | ||||
| -rw-r--r-- | include/linux/reservation.h | 62 | ||||
| -rw-r--r-- | include/uapi/drm/drm.h | 1 | ||||
| -rw-r--r-- | include/uapi/drm/drm_mode.h | 13 | ||||
| -rw-r--r-- | include/uapi/drm/i915_drm.h | 3 | ||||
| -rw-r--r-- | include/uapi/drm/tegra_drm.h | 2 | ||||
| -rw-r--r-- | include/video/display_timing.h | 1 | ||||
| -rw-r--r-- | include/video/uvesafb.h | 1 |
21 files changed, 646 insertions, 198 deletions
diff --git a/include/drm/drmP.h b/include/drm/drmP.h index 63d17ee9eb48..12083dc862a9 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h | |||
| @@ -55,16 +55,13 @@ | |||
| 55 | #include <linux/mm.h> | 55 | #include <linux/mm.h> |
| 56 | #include <linux/cdev.h> | 56 | #include <linux/cdev.h> |
| 57 | #include <linux/mutex.h> | 57 | #include <linux/mutex.h> |
| 58 | #include <linux/io.h> | ||
| 58 | #include <linux/slab.h> | 59 | #include <linux/slab.h> |
| 59 | #if defined(__alpha__) || defined(__powerpc__) | 60 | #if defined(__alpha__) || defined(__powerpc__) |
| 60 | #include <asm/pgtable.h> /* For pte_wrprotect */ | 61 | #include <asm/pgtable.h> /* For pte_wrprotect */ |
| 61 | #endif | 62 | #endif |
| 62 | #include <asm/io.h> | ||
| 63 | #include <asm/mman.h> | 63 | #include <asm/mman.h> |
| 64 | #include <asm/uaccess.h> | 64 | #include <asm/uaccess.h> |
| 65 | #ifdef CONFIG_MTRR | ||
| 66 | #include <asm/mtrr.h> | ||
| 67 | #endif | ||
| 68 | #if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE) | 65 | #if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE) |
| 69 | #include <linux/types.h> | 66 | #include <linux/types.h> |
| 70 | #include <linux/agp_backend.h> | 67 | #include <linux/agp_backend.h> |
| @@ -933,12 +930,15 @@ struct drm_driver { | |||
| 933 | struct dma_buf *dma_buf); | 930 | struct dma_buf *dma_buf); |
| 934 | /* low-level interface used by drm_gem_prime_{import,export} */ | 931 | /* low-level interface used by drm_gem_prime_{import,export} */ |
| 935 | int (*gem_prime_pin)(struct drm_gem_object *obj); | 932 | int (*gem_prime_pin)(struct drm_gem_object *obj); |
| 933 | void (*gem_prime_unpin)(struct drm_gem_object *obj); | ||
| 936 | struct sg_table *(*gem_prime_get_sg_table)(struct drm_gem_object *obj); | 934 | struct sg_table *(*gem_prime_get_sg_table)(struct drm_gem_object *obj); |
| 937 | struct drm_gem_object *(*gem_prime_import_sg_table)( | 935 | struct drm_gem_object *(*gem_prime_import_sg_table)( |
| 938 | struct drm_device *dev, size_t size, | 936 | struct drm_device *dev, size_t size, |
| 939 | struct sg_table *sgt); | 937 | struct sg_table *sgt); |
| 940 | void *(*gem_prime_vmap)(struct drm_gem_object *obj); | 938 | void *(*gem_prime_vmap)(struct drm_gem_object *obj); |
| 941 | void (*gem_prime_vunmap)(struct drm_gem_object *obj, void *vaddr); | 939 | void (*gem_prime_vunmap)(struct drm_gem_object *obj, void *vaddr); |
| 940 | int (*gem_prime_mmap)(struct drm_gem_object *obj, | ||
| 941 | struct vm_area_struct *vma); | ||
| 942 | 942 | ||
| 943 | /* vga arb irq handler */ | 943 | /* vga arb irq handler */ |
| 944 | void (*vgaarb_irq)(struct drm_device *dev, bool state); | 944 | void (*vgaarb_irq)(struct drm_device *dev, bool state); |
| @@ -1250,37 +1250,8 @@ static inline int drm_core_has_MTRR(struct drm_device *dev) | |||
| 1250 | { | 1250 | { |
| 1251 | return drm_core_check_feature(dev, DRIVER_USE_MTRR); | 1251 | return drm_core_check_feature(dev, DRIVER_USE_MTRR); |
| 1252 | } | 1252 | } |
| 1253 | |||
| 1254 | #define DRM_MTRR_WC MTRR_TYPE_WRCOMB | ||
| 1255 | |||
| 1256 | static inline int drm_mtrr_add(unsigned long offset, unsigned long size, | ||
| 1257 | unsigned int flags) | ||
| 1258 | { | ||
| 1259 | return mtrr_add(offset, size, flags, 1); | ||
| 1260 | } | ||
| 1261 | |||
| 1262 | static inline int drm_mtrr_del(int handle, unsigned long offset, | ||
| 1263 | unsigned long size, unsigned int flags) | ||
| 1264 | { | ||
| 1265 | return mtrr_del(handle, offset, size); | ||
| 1266 | } | ||
| 1267 | |||
| 1268 | #else | 1253 | #else |
| 1269 | #define drm_core_has_MTRR(dev) (0) | 1254 | #define drm_core_has_MTRR(dev) (0) |
| 1270 | |||
| 1271 | #define DRM_MTRR_WC 0 | ||
| 1272 | |||
| 1273 | static inline int drm_mtrr_add(unsigned long offset, unsigned long size, | ||
| 1274 | unsigned int flags) | ||
| 1275 | { | ||
| 1276 | return 0; | ||
| 1277 | } | ||
| 1278 | |||
| 1279 | static inline int drm_mtrr_del(int handle, unsigned long offset, | ||
| 1280 | unsigned long size, unsigned int flags) | ||
| 1281 | { | ||
| 1282 | return 0; | ||
| 1283 | } | ||
| 1284 | #endif | 1255 | #endif |
| 1285 | 1256 | ||
| 1286 | static inline void drm_device_set_unplugged(struct drm_device *dev) | 1257 | static inline void drm_device_set_unplugged(struct drm_device *dev) |
| @@ -1630,7 +1601,6 @@ extern void drm_sysfs_destroy(void); | |||
| 1630 | extern int drm_sysfs_device_add(struct drm_minor *minor); | 1601 | extern int drm_sysfs_device_add(struct drm_minor *minor); |
| 1631 | extern void drm_sysfs_hotplug_event(struct drm_device *dev); | 1602 | extern void drm_sysfs_hotplug_event(struct drm_device *dev); |
| 1632 | extern void drm_sysfs_device_remove(struct drm_minor *minor); | 1603 | extern void drm_sysfs_device_remove(struct drm_minor *minor); |
| 1633 | extern char *drm_get_connector_status_name(enum drm_connector_status status); | ||
| 1634 | extern int drm_sysfs_connector_add(struct drm_connector *connector); | 1604 | extern int drm_sysfs_connector_add(struct drm_connector *connector); |
| 1635 | extern void drm_sysfs_connector_remove(struct drm_connector *connector); | 1605 | extern void drm_sysfs_connector_remove(struct drm_connector *connector); |
| 1636 | 1606 | ||
| @@ -1648,6 +1618,8 @@ int drm_gem_private_object_init(struct drm_device *dev, | |||
| 1648 | void drm_gem_object_handle_free(struct drm_gem_object *obj); | 1618 | void drm_gem_object_handle_free(struct drm_gem_object *obj); |
| 1649 | void drm_gem_vm_open(struct vm_area_struct *vma); | 1619 | void drm_gem_vm_open(struct vm_area_struct *vma); |
| 1650 | void drm_gem_vm_close(struct vm_area_struct *vma); | 1620 | 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, | ||
| 1622 | struct vm_area_struct *vma); | ||
| 1651 | int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma); | 1623 | int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma); |
| 1652 | 1624 | ||
| 1653 | #include <drm/drm_global.h> | 1625 | #include <drm/drm_global.h> |
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index adb3f9b625f6..fa12a2fa4293 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h | |||
| @@ -339,6 +339,9 @@ struct drm_crtc_funcs { | |||
| 339 | /* cursor controls */ | 339 | /* cursor controls */ |
| 340 | int (*cursor_set)(struct drm_crtc *crtc, struct drm_file *file_priv, | 340 | int (*cursor_set)(struct drm_crtc *crtc, struct drm_file *file_priv, |
| 341 | uint32_t handle, uint32_t width, uint32_t height); | 341 | uint32_t handle, uint32_t width, uint32_t height); |
| 342 | int (*cursor_set2)(struct drm_crtc *crtc, struct drm_file *file_priv, | ||
| 343 | uint32_t handle, uint32_t width, uint32_t height, | ||
| 344 | int32_t hot_x, int32_t hot_y); | ||
| 342 | int (*cursor_move)(struct drm_crtc *crtc, int x, int y); | 345 | int (*cursor_move)(struct drm_crtc *crtc, int x, int y); |
| 343 | 346 | ||
| 344 | /* Set gamma on the CRTC */ | 347 | /* Set gamma on the CRTC */ |
| @@ -409,6 +412,10 @@ struct drm_crtc { | |||
| 409 | /* framebuffer the connector is currently bound to */ | 412 | /* framebuffer the connector is currently bound to */ |
| 410 | struct drm_framebuffer *fb; | 413 | struct drm_framebuffer *fb; |
| 411 | 414 | ||
| 415 | /* Temporary tracking of the old fb while a modeset is ongoing. Used | ||
| 416 | * by drm_mode_set_config_internal to implement correct refcounting. */ | ||
| 417 | struct drm_framebuffer *old_fb; | ||
| 418 | |||
| 412 | bool enabled; | 419 | bool enabled; |
| 413 | 420 | ||
| 414 | /* Requested mode from modesetting. */ | 421 | /* Requested mode from modesetting. */ |
| @@ -654,11 +661,7 @@ struct drm_plane_funcs { | |||
| 654 | * @format_count: number of formats supported | 661 | * @format_count: number of formats supported |
| 655 | * @crtc: currently bound CRTC | 662 | * @crtc: currently bound CRTC |
| 656 | * @fb: currently bound fb | 663 | * @fb: currently bound fb |
| 657 | * @gamma_size: size of gamma table | ||
| 658 | * @gamma_store: gamma correction table | ||
| 659 | * @enabled: enabled flag | ||
| 660 | * @funcs: helper functions | 664 | * @funcs: helper functions |
| 661 | * @helper_private: storage for drver layer | ||
| 662 | * @properties: property tracking for this plane | 665 | * @properties: property tracking for this plane |
| 663 | */ | 666 | */ |
| 664 | struct drm_plane { | 667 | struct drm_plane { |
| @@ -674,14 +677,7 @@ struct drm_plane { | |||
| 674 | struct drm_crtc *crtc; | 677 | struct drm_crtc *crtc; |
| 675 | struct drm_framebuffer *fb; | 678 | struct drm_framebuffer *fb; |
| 676 | 679 | ||
| 677 | /* CRTC gamma size for reporting to userspace */ | ||
| 678 | uint32_t gamma_size; | ||
| 679 | uint16_t *gamma_store; | ||
| 680 | |||
| 681 | bool enabled; | ||
| 682 | |||
| 683 | const struct drm_plane_funcs *funcs; | 680 | const struct drm_plane_funcs *funcs; |
| 684 | void *helper_private; | ||
| 685 | 681 | ||
| 686 | struct drm_object_properties properties; | 682 | struct drm_object_properties properties; |
| 687 | }; | 683 | }; |
| @@ -894,15 +890,17 @@ extern int drm_plane_init(struct drm_device *dev, | |||
| 894 | const uint32_t *formats, uint32_t format_count, | 890 | const uint32_t *formats, uint32_t format_count, |
| 895 | bool priv); | 891 | bool priv); |
| 896 | extern void drm_plane_cleanup(struct drm_plane *plane); | 892 | extern void drm_plane_cleanup(struct drm_plane *plane); |
| 893 | extern void drm_plane_force_disable(struct drm_plane *plane); | ||
| 897 | 894 | ||
| 898 | extern void drm_encoder_cleanup(struct drm_encoder *encoder); | 895 | extern void drm_encoder_cleanup(struct drm_encoder *encoder); |
| 899 | 896 | ||
| 900 | extern char *drm_get_connector_name(struct drm_connector *connector); | 897 | extern const char *drm_get_connector_name(const struct drm_connector *connector); |
| 901 | extern char *drm_get_dpms_name(int val); | 898 | extern const char *drm_get_connector_status_name(enum drm_connector_status status); |
| 902 | extern char *drm_get_dvi_i_subconnector_name(int val); | 899 | extern const char *drm_get_dpms_name(int val); |
| 903 | extern char *drm_get_dvi_i_select_name(int val); | 900 | extern const char *drm_get_dvi_i_subconnector_name(int val); |
| 904 | extern char *drm_get_tv_subconnector_name(int val); | 901 | extern const char *drm_get_dvi_i_select_name(int val); |
| 905 | extern char *drm_get_tv_select_name(int val); | 902 | extern const char *drm_get_tv_subconnector_name(int val); |
| 903 | extern const char *drm_get_tv_select_name(int val); | ||
| 906 | extern void drm_fb_release(struct drm_file *file_priv); | 904 | extern void drm_fb_release(struct drm_file *file_priv); |
| 907 | extern int drm_mode_group_init_legacy_group(struct drm_device *dev, struct drm_mode_group *group); | 905 | extern int drm_mode_group_init_legacy_group(struct drm_device *dev, struct drm_mode_group *group); |
| 908 | extern bool drm_probe_ddc(struct i2c_adapter *adapter); | 906 | extern bool drm_probe_ddc(struct i2c_adapter *adapter); |
| @@ -994,7 +992,7 @@ extern int drm_mode_create_tv_properties(struct drm_device *dev, int num_formats | |||
| 994 | extern int drm_mode_create_scaling_mode_property(struct drm_device *dev); | 992 | extern int drm_mode_create_scaling_mode_property(struct drm_device *dev); |
| 995 | extern int drm_mode_create_dithering_property(struct drm_device *dev); | 993 | extern int drm_mode_create_dithering_property(struct drm_device *dev); |
| 996 | extern int drm_mode_create_dirty_info_property(struct drm_device *dev); | 994 | extern int drm_mode_create_dirty_info_property(struct drm_device *dev); |
| 997 | extern char *drm_get_encoder_name(struct drm_encoder *encoder); | 995 | extern const char *drm_get_encoder_name(const struct drm_encoder *encoder); |
| 998 | 996 | ||
| 999 | extern int drm_mode_connector_attach_encoder(struct drm_connector *connector, | 997 | extern int drm_mode_connector_attach_encoder(struct drm_connector *connector, |
| 1000 | struct drm_encoder *encoder); | 998 | struct drm_encoder *encoder); |
| @@ -1022,6 +1020,8 @@ extern int drm_mode_setplane(struct drm_device *dev, | |||
| 1022 | void *data, struct drm_file *file_priv); | 1020 | void *data, struct drm_file *file_priv); |
| 1023 | extern int drm_mode_cursor_ioctl(struct drm_device *dev, | 1021 | extern int drm_mode_cursor_ioctl(struct drm_device *dev, |
| 1024 | void *data, struct drm_file *file_priv); | 1022 | void *data, struct drm_file *file_priv); |
| 1023 | extern int drm_mode_cursor2_ioctl(struct drm_device *dev, | ||
| 1024 | void *data, struct drm_file *file_priv); | ||
| 1025 | extern int drm_mode_addfb(struct drm_device *dev, | 1025 | extern int drm_mode_addfb(struct drm_device *dev, |
| 1026 | void *data, struct drm_file *file_priv); | 1026 | void *data, struct drm_file *file_priv); |
| 1027 | extern int drm_mode_addfb2(struct drm_device *dev, | 1027 | extern int drm_mode_addfb2(struct drm_device *dev, |
| @@ -1094,5 +1094,6 @@ extern int drm_format_num_planes(uint32_t format); | |||
| 1094 | extern int drm_format_plane_cpp(uint32_t format, int plane); | 1094 | extern int drm_format_plane_cpp(uint32_t format, int plane); |
| 1095 | extern int drm_format_horz_chroma_subsampling(uint32_t format); | 1095 | extern int drm_format_horz_chroma_subsampling(uint32_t format); |
| 1096 | extern int drm_format_vert_chroma_subsampling(uint32_t format); | 1096 | extern int drm_format_vert_chroma_subsampling(uint32_t format); |
| 1097 | extern const char *drm_get_format_name(uint32_t format); | ||
| 1097 | 1098 | ||
| 1098 | #endif /* __DRM_CRTC_H__ */ | 1099 | #endif /* __DRM_CRTC_H__ */ |
diff --git a/include/drm/drm_fixed.h b/include/drm/drm_fixed.h index 0ead502e17d2..f5e1168c7647 100644 --- a/include/drm/drm_fixed.h +++ b/include/drm/drm_fixed.h | |||
| @@ -20,10 +20,13 @@ | |||
| 20 | * OTHER DEALINGS IN THE SOFTWARE. | 20 | * OTHER DEALINGS IN THE SOFTWARE. |
| 21 | * | 21 | * |
| 22 | * Authors: Dave Airlie | 22 | * Authors: Dave Airlie |
| 23 | * Christian König | ||
| 23 | */ | 24 | */ |
| 24 | #ifndef DRM_FIXED_H | 25 | #ifndef DRM_FIXED_H |
| 25 | #define DRM_FIXED_H | 26 | #define DRM_FIXED_H |
| 26 | 27 | ||
| 28 | #include <linux/math64.h> | ||
| 29 | |||
| 27 | typedef union dfixed { | 30 | typedef union dfixed { |
| 28 | u32 full; | 31 | u32 full; |
| 29 | } fixed20_12; | 32 | } fixed20_12; |
| @@ -65,4 +68,95 @@ static inline u32 dfixed_div(fixed20_12 A, fixed20_12 B) | |||
| 65 | tmp /= 2; | 68 | tmp /= 2; |
| 66 | return lower_32_bits(tmp); | 69 | return lower_32_bits(tmp); |
| 67 | } | 70 | } |
| 71 | |||
| 72 | #define DRM_FIXED_POINT 32 | ||
| 73 | #define DRM_FIXED_ONE (1ULL << DRM_FIXED_POINT) | ||
| 74 | #define DRM_FIXED_DECIMAL_MASK (DRM_FIXED_ONE - 1) | ||
| 75 | #define DRM_FIXED_DIGITS_MASK (~DRM_FIXED_DECIMAL_MASK) | ||
| 76 | |||
| 77 | static inline s64 drm_int2fixp(int a) | ||
| 78 | { | ||
| 79 | return ((s64)a) << DRM_FIXED_POINT; | ||
| 80 | } | ||
| 81 | |||
| 82 | static inline int drm_fixp2int(int64_t a) | ||
| 83 | { | ||
| 84 | return ((s64)a) >> DRM_FIXED_POINT; | ||
| 85 | } | ||
| 86 | |||
| 87 | static inline s64 drm_fixp_msbset(int64_t a) | ||
| 88 | { | ||
| 89 | unsigned shift, sign = (a >> 63) & 1; | ||
| 90 | |||
| 91 | for (shift = 62; shift > 0; --shift) | ||
| 92 | if ((a >> shift) != sign) | ||
| 93 | return shift; | ||
| 94 | |||
| 95 | return 0; | ||
| 96 | } | ||
| 97 | |||
| 98 | static inline s64 drm_fixp_mul(s64 a, s64 b) | ||
| 99 | { | ||
| 100 | unsigned shift = drm_fixp_msbset(a) + drm_fixp_msbset(b); | ||
| 101 | s64 result; | ||
| 102 | |||
| 103 | if (shift > 63) { | ||
| 104 | shift = shift - 63; | ||
| 105 | a >>= shift >> 1; | ||
| 106 | b >>= shift >> 1; | ||
| 107 | } else | ||
| 108 | shift = 0; | ||
| 109 | |||
| 110 | result = a * b; | ||
| 111 | |||
| 112 | if (shift > DRM_FIXED_POINT) | ||
| 113 | return result << (shift - DRM_FIXED_POINT); | ||
| 114 | |||
| 115 | if (shift < DRM_FIXED_POINT) | ||
| 116 | return result >> (DRM_FIXED_POINT - shift); | ||
| 117 | |||
| 118 | return result; | ||
| 119 | } | ||
| 120 | |||
| 121 | static inline s64 drm_fixp_div(s64 a, s64 b) | ||
| 122 | { | ||
| 123 | unsigned shift = 63 - drm_fixp_msbset(a); | ||
| 124 | s64 result; | ||
| 125 | |||
| 126 | a <<= shift; | ||
| 127 | |||
| 128 | if (shift < DRM_FIXED_POINT) | ||
| 129 | b >>= (DRM_FIXED_POINT - shift); | ||
| 130 | |||
| 131 | result = div64_s64(a, b); | ||
| 132 | |||
| 133 | if (shift > DRM_FIXED_POINT) | ||
| 134 | return result >> (shift - DRM_FIXED_POINT); | ||
| 135 | |||
| 136 | return result; | ||
| 137 | } | ||
| 138 | |||
| 139 | static inline s64 drm_fixp_exp(s64 x) | ||
| 140 | { | ||
| 141 | s64 tolerance = div64_s64(DRM_FIXED_ONE, 1000000); | ||
| 142 | s64 sum = DRM_FIXED_ONE, term, y = x; | ||
| 143 | u64 count = 1; | ||
| 144 | |||
| 145 | if (x < 0) | ||
| 146 | y = -1 * x; | ||
| 147 | |||
| 148 | term = y; | ||
| 149 | |||
| 150 | while (term >= tolerance) { | ||
| 151 | sum = sum + term; | ||
| 152 | count = count + 1; | ||
| 153 | term = drm_fixp_mul(term, div64_s64(y, count)); | ||
| 154 | } | ||
| 155 | |||
| 156 | if (x < 0) | ||
| 157 | sum = drm_fixp_div(1, sum); | ||
| 158 | |||
| 159 | return sum; | ||
| 160 | } | ||
| 161 | |||
| 68 | #endif | 162 | #endif |
diff --git a/include/drm/drm_gem_cma_helper.h b/include/drm/drm_gem_cma_helper.h index 63397ced9254..c34f27f80bcc 100644 --- a/include/drm/drm_gem_cma_helper.h +++ b/include/drm/drm_gem_cma_helper.h | |||
| @@ -4,6 +4,9 @@ | |||
| 4 | struct drm_gem_cma_object { | 4 | struct drm_gem_cma_object { |
| 5 | struct drm_gem_object base; | 5 | struct drm_gem_object base; |
| 6 | dma_addr_t paddr; | 6 | dma_addr_t paddr; |
| 7 | struct sg_table *sgt; | ||
| 8 | |||
| 9 | /* For objects with DMA memory allocated by GEM CMA */ | ||
| 7 | void *vaddr; | 10 | void *vaddr; |
| 8 | }; | 11 | }; |
| 9 | 12 | ||
| @@ -45,4 +48,13 @@ extern const struct vm_operations_struct drm_gem_cma_vm_ops; | |||
| 45 | void drm_gem_cma_describe(struct drm_gem_cma_object *obj, struct seq_file *m); | 48 | void drm_gem_cma_describe(struct drm_gem_cma_object *obj, struct seq_file *m); |
| 46 | #endif | 49 | #endif |
| 47 | 50 | ||
| 51 | struct sg_table *drm_gem_cma_prime_get_sg_table(struct drm_gem_object *obj); | ||
| 52 | struct drm_gem_object * | ||
| 53 | drm_gem_cma_prime_import_sg_table(struct drm_device *dev, size_t size, | ||
| 54 | struct sg_table *sgt); | ||
| 55 | int drm_gem_cma_prime_mmap(struct drm_gem_object *obj, | ||
| 56 | struct vm_area_struct *vma); | ||
| 57 | void *drm_gem_cma_prime_vmap(struct drm_gem_object *obj); | ||
| 58 | void drm_gem_cma_prime_vunmap(struct drm_gem_object *obj, void *vaddr); | ||
| 59 | |||
| 48 | #endif /* __DRM_GEM_CMA_HELPER_H__ */ | 60 | #endif /* __DRM_GEM_CMA_HELPER_H__ */ |
diff --git a/include/drm/drm_mm.h b/include/drm/drm_mm.h index 88591ef8fa24..4d06edb56d5f 100644 --- a/include/drm/drm_mm.h +++ b/include/drm/drm_mm.h | |||
| @@ -177,17 +177,6 @@ static inline struct drm_mm_node *drm_mm_get_block_range( | |||
| 177 | return drm_mm_get_block_range_generic(parent, size, alignment, 0, | 177 | return drm_mm_get_block_range_generic(parent, size, alignment, 0, |
| 178 | start, end, 0); | 178 | start, end, 0); |
| 179 | } | 179 | } |
| 180 | static inline struct drm_mm_node *drm_mm_get_color_block_range( | ||
| 181 | struct drm_mm_node *parent, | ||
| 182 | unsigned long size, | ||
| 183 | unsigned alignment, | ||
| 184 | unsigned long color, | ||
| 185 | unsigned long start, | ||
| 186 | unsigned long end) | ||
| 187 | { | ||
| 188 | return drm_mm_get_block_range_generic(parent, size, alignment, color, | ||
| 189 | start, end, 0); | ||
| 190 | } | ||
| 191 | static inline struct drm_mm_node *drm_mm_get_block_atomic_range( | 180 | static inline struct drm_mm_node *drm_mm_get_block_atomic_range( |
| 192 | struct drm_mm_node *parent, | 181 | struct drm_mm_node *parent, |
| 193 | unsigned long size, | 182 | unsigned long size, |
| @@ -255,29 +244,10 @@ static inline struct drm_mm_node *drm_mm_search_free_in_range( | |||
| 255 | return drm_mm_search_free_in_range_generic(mm, size, alignment, 0, | 244 | return drm_mm_search_free_in_range_generic(mm, size, alignment, 0, |
| 256 | start, end, best_match); | 245 | start, end, best_match); |
| 257 | } | 246 | } |
| 258 | static inline struct drm_mm_node *drm_mm_search_free_color(const struct drm_mm *mm, | 247 | |
| 259 | unsigned long size, | 248 | extern void drm_mm_init(struct drm_mm *mm, |
| 260 | unsigned alignment, | 249 | unsigned long start, |
| 261 | unsigned long color, | 250 | unsigned long size); |
| 262 | bool best_match) | ||
| 263 | { | ||
| 264 | return drm_mm_search_free_generic(mm,size, alignment, color, best_match); | ||
| 265 | } | ||
| 266 | static inline struct drm_mm_node *drm_mm_search_free_in_range_color( | ||
| 267 | const struct drm_mm *mm, | ||
| 268 | unsigned long size, | ||
| 269 | unsigned alignment, | ||
| 270 | unsigned long color, | ||
| 271 | unsigned long start, | ||
| 272 | unsigned long end, | ||
| 273 | bool best_match) | ||
| 274 | { | ||
| 275 | return drm_mm_search_free_in_range_generic(mm, size, alignment, color, | ||
| 276 | start, end, best_match); | ||
| 277 | } | ||
| 278 | extern int drm_mm_init(struct drm_mm *mm, | ||
| 279 | unsigned long start, | ||
| 280 | unsigned long size); | ||
| 281 | extern void drm_mm_takedown(struct drm_mm *mm); | 251 | extern void drm_mm_takedown(struct drm_mm *mm); |
| 282 | extern int drm_mm_clean(struct drm_mm *mm); | 252 | extern int drm_mm_clean(struct drm_mm *mm); |
| 283 | extern int drm_mm_pre_get(struct drm_mm *mm); | 253 | extern int drm_mm_pre_get(struct drm_mm *mm); |
diff --git a/include/drm/drm_os_linux.h b/include/drm/drm_os_linux.h index 675ddf4b441f..815fafc6b4ad 100644 --- a/include/drm/drm_os_linux.h +++ b/include/drm/drm_os_linux.h | |||
| @@ -65,22 +65,6 @@ struct no_agp_kern { | |||
| 65 | #define DRM_AGP_KERN struct no_agp_kern | 65 | #define DRM_AGP_KERN struct no_agp_kern |
| 66 | #endif | 66 | #endif |
| 67 | 67 | ||
| 68 | #if !(__OS_HAS_MTRR) | ||
| 69 | static __inline__ int mtrr_add(unsigned long base, unsigned long size, | ||
| 70 | unsigned int type, char increment) | ||
| 71 | { | ||
| 72 | return -ENODEV; | ||
| 73 | } | ||
| 74 | |||
| 75 | static __inline__ int mtrr_del(int reg, unsigned long base, unsigned long size) | ||
| 76 | { | ||
| 77 | return -ENODEV; | ||
| 78 | } | ||
| 79 | |||
| 80 | #define MTRR_TYPE_WRCOMB 1 | ||
| 81 | |||
| 82 | #endif | ||
| 83 | |||
| 84 | /** Other copying of data to kernel space */ | 68 | /** Other copying of data to kernel space */ |
| 85 | #define DRM_COPY_FROM_USER(arg1, arg2, arg3) \ | 69 | #define DRM_COPY_FROM_USER(arg1, arg2, arg3) \ |
| 86 | copy_from_user(arg1, arg2, arg3) | 70 | copy_from_user(arg1, arg2, arg3) |
diff --git a/include/drm/drm_pciids.h b/include/drm/drm_pciids.h index bb1bc485390b..34efaf64cc87 100644 --- a/include/drm/drm_pciids.h +++ b/include/drm/drm_pciids.h | |||
| @@ -152,6 +152,14 @@ | |||
| 152 | {0x1002, 0x6621, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | 152 | {0x1002, 0x6621, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
| 153 | {0x1002, 0x6623, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | 153 | {0x1002, 0x6623, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
| 154 | {0x1002, 0x6631, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \ | 154 | {0x1002, 0x6631, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \ |
| 155 | {0x1002, 0x6640, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | ||
| 156 | {0x1002, 0x6641, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | ||
| 157 | {0x1002, 0x6649, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_NEW_MEMMAP}, \ | ||
| 158 | {0x1002, 0x6650, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_NEW_MEMMAP}, \ | ||
| 159 | {0x1002, 0x6651, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_NEW_MEMMAP}, \ | ||
| 160 | {0x1002, 0x6658, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_NEW_MEMMAP}, \ | ||
| 161 | {0x1002, 0x665c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_NEW_MEMMAP}, \ | ||
| 162 | {0x1002, 0x665d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_NEW_MEMMAP}, \ | ||
| 155 | {0x1002, 0x6660, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HAINAN|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | 163 | {0x1002, 0x6660, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HAINAN|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
| 156 | {0x1002, 0x6663, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HAINAN|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | 164 | {0x1002, 0x6663, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HAINAN|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
| 157 | {0x1002, 0x6664, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HAINAN|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | 165 | {0x1002, 0x6664, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HAINAN|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
| @@ -580,6 +588,22 @@ | |||
| 580 | {0x1002, 0x9808, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | 588 | {0x1002, 0x9808, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
| 581 | {0x1002, 0x9809, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | 589 | {0x1002, 0x9809, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
| 582 | {0x1002, 0x980A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | 590 | {0x1002, 0x980A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
| 591 | {0x1002, 0x9830, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KABINI|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
| 592 | {0x1002, 0x9831, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KABINI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
| 593 | {0x1002, 0x9832, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KABINI|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
| 594 | {0x1002, 0x9833, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KABINI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
| 595 | {0x1002, 0x9834, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KABINI|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
| 596 | {0x1002, 0x9835, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KABINI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
| 597 | {0x1002, 0x9836, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KABINI|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
| 598 | {0x1002, 0x9837, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KABINI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
| 599 | {0x1002, 0x9838, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KABINI|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
| 600 | {0x1002, 0x9839, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KABINI|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
| 601 | {0x1002, 0x983a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KABINI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
| 602 | {0x1002, 0x983b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KABINI|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
| 603 | {0x1002, 0x983c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KABINI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
| 604 | {0x1002, 0x983d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KABINI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
| 605 | {0x1002, 0x983e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KABINI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
| 606 | {0x1002, 0x983f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KABINI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
| 583 | {0x1002, 0x9900, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | 607 | {0x1002, 0x9900, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
| 584 | {0x1002, 0x9901, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | 608 | {0x1002, 0x9901, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
| 585 | {0x1002, 0x9903, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | 609 | {0x1002, 0x9903, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
diff --git a/include/drm/drm_rect.h b/include/drm/drm_rect.h new file mode 100644 index 000000000000..d1286297567b --- /dev/null +++ b/include/drm/drm_rect.h | |||
| @@ -0,0 +1,167 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2011-2013 Intel Corporation | ||
| 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_RECT_H | ||
| 25 | #define DRM_RECT_H | ||
| 26 | |||
| 27 | /** | ||
| 28 | * DOC: rect utils | ||
| 29 | * | ||
| 30 | * Utility functions to help manage rectangular areas for | ||
| 31 | * clipping, scaling, etc. calculations. | ||
| 32 | */ | ||
| 33 | |||
| 34 | /** | ||
| 35 | * struct drm_rect - two dimensional rectangle | ||
| 36 | * @x1: horizontal starting coordinate (inclusive) | ||
| 37 | * @x2: horizontal ending coordinate (exclusive) | ||
| 38 | * @y1: vertical starting coordinate (inclusive) | ||
| 39 | * @y2: vertical ending coordinate (exclusive) | ||
| 40 | */ | ||
| 41 | struct drm_rect { | ||
| 42 | int x1, y1, x2, y2; | ||
| 43 | }; | ||
| 44 | |||
| 45 | /** | ||
| 46 | * drm_rect_adjust_size - adjust the size of the rectangle | ||
| 47 | * @r: rectangle to be adjusted | ||
| 48 | * @dw: horizontal adjustment | ||
| 49 | * @dh: vertical adjustment | ||
| 50 | * | ||
| 51 | * Change the size of rectangle @r by @dw in the horizontal direction, | ||
| 52 | * and by @dh in the vertical direction, while keeping the center | ||
| 53 | * of @r stationary. | ||
| 54 | * | ||
| 55 | * Positive @dw and @dh increase the size, negative values decrease it. | ||
| 56 | */ | ||
| 57 | static inline void drm_rect_adjust_size(struct drm_rect *r, int dw, int dh) | ||
| 58 | { | ||
| 59 | r->x1 -= dw >> 1; | ||
| 60 | r->y1 -= dh >> 1; | ||
| 61 | r->x2 += (dw + 1) >> 1; | ||
| 62 | r->y2 += (dh + 1) >> 1; | ||
| 63 | } | ||
| 64 | |||
| 65 | /** | ||
| 66 | * drm_rect_translate - translate the rectangle | ||
| 67 | * @r: rectangle to be tranlated | ||
| 68 | * @dx: horizontal translation | ||
| 69 | * @dy: vertical translation | ||
| 70 | * | ||
| 71 | * Move rectangle @r by @dx in the horizontal direction, | ||
| 72 | * and by @dy in the vertical direction. | ||
| 73 | */ | ||
| 74 | static inline void drm_rect_translate(struct drm_rect *r, int dx, int dy) | ||
| 75 | { | ||
| 76 | r->x1 += dx; | ||
| 77 | r->y1 += dy; | ||
| 78 | r->x2 += dx; | ||
| 79 | r->y2 += dy; | ||
| 80 | } | ||
| 81 | |||
| 82 | /** | ||
| 83 | * drm_rect_downscale - downscale a rectangle | ||
| 84 | * @r: rectangle to be downscaled | ||
| 85 | * @horz: horizontal downscale factor | ||
| 86 | * @vert: vertical downscale factor | ||
| 87 | * | ||
| 88 | * Divide the coordinates of rectangle @r by @horz and @vert. | ||
| 89 | */ | ||
| 90 | static inline void drm_rect_downscale(struct drm_rect *r, int horz, int vert) | ||
| 91 | { | ||
| 92 | r->x1 /= horz; | ||
| 93 | r->y1 /= vert; | ||
| 94 | r->x2 /= horz; | ||
| 95 | r->y2 /= vert; | ||
| 96 | } | ||
| 97 | |||
| 98 | /** | ||
| 99 | * drm_rect_width - determine the rectangle width | ||
| 100 | * @r: rectangle whose width is returned | ||
| 101 | * | ||
| 102 | * RETURNS: | ||
| 103 | * The width of the rectangle. | ||
| 104 | */ | ||
| 105 | static inline int drm_rect_width(const struct drm_rect *r) | ||
| 106 | { | ||
| 107 | return r->x2 - r->x1; | ||
| 108 | } | ||
| 109 | |||
| 110 | /** | ||
| 111 | * drm_rect_height - determine the rectangle height | ||
| 112 | * @r: rectangle whose height is returned | ||
| 113 | * | ||
| 114 | * RETURNS: | ||
| 115 | * The height of the rectangle. | ||
| 116 | */ | ||
| 117 | static inline int drm_rect_height(const struct drm_rect *r) | ||
| 118 | { | ||
| 119 | return r->y2 - r->y1; | ||
| 120 | } | ||
| 121 | |||
| 122 | /** | ||
| 123 | * drm_rect_visible - determine if the the rectangle is visible | ||
| 124 | * @r: rectangle whose visibility is returned | ||
| 125 | * | ||
| 126 | * RETURNS: | ||
| 127 | * %true if the rectangle is visible, %false otherwise. | ||
| 128 | */ | ||
| 129 | static inline bool drm_rect_visible(const struct drm_rect *r) | ||
| 130 | { | ||
| 131 | return drm_rect_width(r) > 0 && drm_rect_height(r) > 0; | ||
| 132 | } | ||
| 133 | |||
| 134 | /** | ||
| 135 | * drm_rect_equals - determine if two rectangles are equal | ||
| 136 | * @r1: first rectangle | ||
| 137 | * @r2: second rectangle | ||
| 138 | * | ||
| 139 | * RETURNS: | ||
| 140 | * %true if the rectangles are equal, %false otherwise. | ||
| 141 | */ | ||
| 142 | static inline bool drm_rect_equals(const struct drm_rect *r1, | ||
| 143 | const struct drm_rect *r2) | ||
| 144 | { | ||
| 145 | return r1->x1 == r2->x1 && r1->x2 == r2->x2 && | ||
| 146 | r1->y1 == r2->y1 && r1->y2 == r2->y2; | ||
| 147 | } | ||
| 148 | |||
| 149 | bool drm_rect_intersect(struct drm_rect *r, const struct drm_rect *clip); | ||
| 150 | bool drm_rect_clip_scaled(struct drm_rect *src, struct drm_rect *dst, | ||
| 151 | const struct drm_rect *clip, | ||
| 152 | int hscale, int vscale); | ||
| 153 | int drm_rect_calc_hscale(const struct drm_rect *src, | ||
| 154 | const struct drm_rect *dst, | ||
| 155 | int min_hscale, int max_hscale); | ||
| 156 | int drm_rect_calc_vscale(const struct drm_rect *src, | ||
| 157 | const struct drm_rect *dst, | ||
| 158 | int min_vscale, int max_vscale); | ||
| 159 | int drm_rect_calc_hscale_relaxed(struct drm_rect *src, | ||
| 160 | struct drm_rect *dst, | ||
| 161 | int min_hscale, int max_hscale); | ||
| 162 | int drm_rect_calc_vscale_relaxed(struct drm_rect *src, | ||
| 163 | struct drm_rect *dst, | ||
| 164 | int min_vscale, int max_vscale); | ||
| 165 | void drm_rect_debug_print(const struct drm_rect *r, bool fixed_point); | ||
| 166 | |||
| 167 | #endif | ||
diff --git a/include/drm/i915_powerwell.h b/include/drm/i915_powerwell.h new file mode 100644 index 000000000000..cfdc884405b7 --- /dev/null +++ b/include/drm/i915_powerwell.h | |||
| @@ -0,0 +1,36 @@ | |||
| 1 | /************************************************************************** | ||
| 2 | * | ||
| 3 | * Copyright 2013 Intel Inc. | ||
| 4 | * All Rights Reserved. | ||
| 5 | * | ||
| 6 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
| 7 | * copy of this software and associated documentation files (the | ||
| 8 | * "Software"), to deal in the Software without restriction, including | ||
| 9 | * without limitation the rights to use, copy, modify, merge, publish, | ||
| 10 | * distribute, sub license, and/or sell copies of the Software, and to | ||
| 11 | * permit persons to whom the Software is furnished to do so, subject to | ||
| 12 | * the following conditions: | ||
| 13 | * | ||
| 14 | * The above copyright notice and this permission notice (including the | ||
| 15 | * next paragraph) shall be included in all copies or substantial portions | ||
| 16 | * of the Software. | ||
| 17 | * | ||
| 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL | ||
| 21 | * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, | ||
| 22 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR | ||
| 23 | * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE | ||
| 24 | * USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 25 | * | ||
| 26 | * | ||
| 27 | **************************************************************************/ | ||
| 28 | |||
| 29 | #ifndef _I915_POWERWELL_H_ | ||
| 30 | #define _I915_POWERWELL_H_ | ||
| 31 | |||
| 32 | /* For use by hda_i915 driver */ | ||
| 33 | extern void i915_request_power_well(void); | ||
| 34 | extern void i915_release_power_well(void); | ||
| 35 | |||
| 36 | #endif /* _I915_POWERWELL_H_ */ | ||
diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h index 3cb5d848fb66..8a6aa56ece52 100644 --- a/include/drm/ttm/ttm_bo_api.h +++ b/include/drm/ttm/ttm_bo_api.h | |||
| @@ -39,6 +39,7 @@ | |||
| 39 | #include <linux/mm.h> | 39 | #include <linux/mm.h> |
| 40 | #include <linux/rbtree.h> | 40 | #include <linux/rbtree.h> |
| 41 | #include <linux/bitmap.h> | 41 | #include <linux/bitmap.h> |
| 42 | #include <linux/reservation.h> | ||
| 42 | 43 | ||
| 43 | struct ttm_bo_device; | 44 | struct ttm_bo_device; |
| 44 | 45 | ||
| @@ -153,7 +154,6 @@ struct ttm_tt; | |||
| 153 | * Lru lists may keep one refcount, the delayed delete list, and kref != 0 | 154 | * Lru lists may keep one refcount, the delayed delete list, and kref != 0 |
| 154 | * keeps one refcount. When this refcount reaches zero, | 155 | * keeps one refcount. When this refcount reaches zero, |
| 155 | * the object is destroyed. | 156 | * the object is destroyed. |
| 156 | * @event_queue: Queue for processes waiting on buffer object status change. | ||
| 157 | * @mem: structure describing current placement. | 157 | * @mem: structure describing current placement. |
| 158 | * @persistent_swap_storage: Usually the swap storage is deleted for buffers | 158 | * @persistent_swap_storage: Usually the swap storage is deleted for buffers |
| 159 | * pinned in physical memory. If this behaviour is not desired, this member | 159 | * pinned in physical memory. If this behaviour is not desired, this member |
| @@ -164,12 +164,6 @@ struct ttm_tt; | |||
| 164 | * @lru: List head for the lru list. | 164 | * @lru: List head for the lru list. |
| 165 | * @ddestroy: List head for the delayed destroy list. | 165 | * @ddestroy: List head for the delayed destroy list. |
| 166 | * @swap: List head for swap LRU list. | 166 | * @swap: List head for swap LRU list. |
| 167 | * @val_seq: Sequence of the validation holding the @reserved lock. | ||
| 168 | * Used to avoid starvation when many processes compete to validate the | ||
| 169 | * buffer. This member is protected by the bo_device::lru_lock. | ||
| 170 | * @seq_valid: The value of @val_seq is valid. This value is protected by | ||
| 171 | * the bo_device::lru_lock. | ||
| 172 | * @reserved: Deadlock-free lock used for synchronization state transitions. | ||
| 173 | * @sync_obj: Pointer to a synchronization object. | 167 | * @sync_obj: Pointer to a synchronization object. |
| 174 | * @priv_flags: Flags describing buffer object internal state. | 168 | * @priv_flags: Flags describing buffer object internal state. |
| 175 | * @vm_rb: Rb node for the vm rb tree. | 169 | * @vm_rb: Rb node for the vm rb tree. |
| @@ -209,10 +203,9 @@ struct ttm_buffer_object { | |||
| 209 | 203 | ||
| 210 | struct kref kref; | 204 | struct kref kref; |
| 211 | struct kref list_kref; | 205 | struct kref list_kref; |
| 212 | wait_queue_head_t event_queue; | ||
| 213 | 206 | ||
| 214 | /** | 207 | /** |
| 215 | * Members protected by the bo::reserved lock. | 208 | * Members protected by the bo::resv::reserved lock. |
| 216 | */ | 209 | */ |
| 217 | 210 | ||
| 218 | struct ttm_mem_reg mem; | 211 | struct ttm_mem_reg mem; |
| @@ -234,15 +227,6 @@ struct ttm_buffer_object { | |||
| 234 | struct list_head ddestroy; | 227 | struct list_head ddestroy; |
| 235 | struct list_head swap; | 228 | struct list_head swap; |
| 236 | struct list_head io_reserve_lru; | 229 | struct list_head io_reserve_lru; |
| 237 | uint32_t val_seq; | ||
| 238 | bool seq_valid; | ||
| 239 | |||
| 240 | /** | ||
| 241 | * Members protected by the bdev::lru_lock | ||
| 242 | * only when written to. | ||
| 243 | */ | ||
| 244 | |||
| 245 | atomic_t reserved; | ||
| 246 | 230 | ||
| 247 | /** | 231 | /** |
| 248 | * Members protected by struct buffer_object_device::fence_lock | 232 | * Members protected by struct buffer_object_device::fence_lock |
| @@ -272,6 +256,9 @@ struct ttm_buffer_object { | |||
| 272 | uint32_t cur_placement; | 256 | uint32_t cur_placement; |
| 273 | 257 | ||
| 274 | struct sg_table *sg; | 258 | struct sg_table *sg; |
| 259 | |||
| 260 | struct reservation_object *resv; | ||
| 261 | struct reservation_object ttm_resv; | ||
| 275 | }; | 262 | }; |
| 276 | 263 | ||
| 277 | /** | 264 | /** |
| @@ -725,18 +712,4 @@ extern ssize_t ttm_bo_io(struct ttm_bo_device *bdev, struct file *filp, | |||
| 725 | 712 | ||
| 726 | extern void ttm_bo_swapout_all(struct ttm_bo_device *bdev); | 713 | extern void ttm_bo_swapout_all(struct ttm_bo_device *bdev); |
| 727 | 714 | ||
| 728 | /** | ||
| 729 | * ttm_bo_is_reserved - return an indication if a ttm buffer object is reserved | ||
| 730 | * | ||
| 731 | * @bo: The buffer object to check. | ||
| 732 | * | ||
| 733 | * This function returns an indication if a bo is reserved or not, and should | ||
| 734 | * only be used to print an error when it is not from incorrect api usage, since | ||
| 735 | * there's no guarantee that it is the caller that is holding the reservation. | ||
| 736 | */ | ||
| 737 | static inline bool ttm_bo_is_reserved(struct ttm_buffer_object *bo) | ||
| 738 | { | ||
| 739 | return atomic_read(&bo->reserved); | ||
| 740 | } | ||
| 741 | |||
| 742 | #endif | 715 | #endif |
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h index 9c8dca79808e..984fc2d571a1 100644 --- a/include/drm/ttm/ttm_bo_driver.h +++ b/include/drm/ttm/ttm_bo_driver.h | |||
| @@ -33,11 +33,13 @@ | |||
| 33 | #include <ttm/ttm_bo_api.h> | 33 | #include <ttm/ttm_bo_api.h> |
| 34 | #include <ttm/ttm_memory.h> | 34 | #include <ttm/ttm_memory.h> |
| 35 | #include <ttm/ttm_module.h> | 35 | #include <ttm/ttm_module.h> |
| 36 | #include <ttm/ttm_placement.h> | ||
| 36 | #include <drm/drm_mm.h> | 37 | #include <drm/drm_mm.h> |
| 37 | #include <drm/drm_global.h> | 38 | #include <drm/drm_global.h> |
| 38 | #include <linux/workqueue.h> | 39 | #include <linux/workqueue.h> |
| 39 | #include <linux/fs.h> | 40 | #include <linux/fs.h> |
| 40 | #include <linux/spinlock.h> | 41 | #include <linux/spinlock.h> |
| 42 | #include <linux/reservation.h> | ||
| 41 | 43 | ||
| 42 | struct ttm_backend_func { | 44 | struct ttm_backend_func { |
| 43 | /** | 45 | /** |
| @@ -771,6 +773,55 @@ extern int ttm_mem_io_lock(struct ttm_mem_type_manager *man, | |||
| 771 | bool interruptible); | 773 | bool interruptible); |
| 772 | extern void ttm_mem_io_unlock(struct ttm_mem_type_manager *man); | 774 | extern void ttm_mem_io_unlock(struct ttm_mem_type_manager *man); |
| 773 | 775 | ||
| 776 | extern void ttm_bo_del_sub_from_lru(struct ttm_buffer_object *bo); | ||
| 777 | extern void ttm_bo_add_to_lru(struct ttm_buffer_object *bo); | ||
| 778 | |||
| 779 | /** | ||
| 780 | * ttm_bo_reserve_nolru: | ||
| 781 | * | ||
| 782 | * @bo: A pointer to a struct ttm_buffer_object. | ||
| 783 | * @interruptible: Sleep interruptible if waiting. | ||
| 784 | * @no_wait: Don't sleep while trying to reserve, rather return -EBUSY. | ||
| 785 | * @use_ticket: If @bo is already reserved, Only sleep waiting for | ||
| 786 | * it to become unreserved if @ticket->stamp is older. | ||
| 787 | * | ||
| 788 | * Will not remove reserved buffers from the lru lists. | ||
| 789 | * Otherwise identical to ttm_bo_reserve. | ||
| 790 | * | ||
| 791 | * Returns: | ||
| 792 | * -EDEADLK: The reservation may cause a deadlock. | ||
| 793 | * Release all buffer reservations, wait for @bo to become unreserved and | ||
| 794 | * try again. (only if use_sequence == 1). | ||
| 795 | * -ERESTARTSYS: A wait for the buffer to become unreserved was interrupted by | ||
| 796 | * a signal. Release all buffer reservations and return to user-space. | ||
| 797 | * -EBUSY: The function needed to sleep, but @no_wait was true | ||
| 798 | * -EALREADY: Bo already reserved using @ticket. This error code will only | ||
| 799 | * be returned if @use_ticket is set to true. | ||
| 800 | */ | ||
| 801 | static inline int ttm_bo_reserve_nolru(struct ttm_buffer_object *bo, | ||
| 802 | bool interruptible, | ||
| 803 | bool no_wait, bool use_ticket, | ||
| 804 | struct ww_acquire_ctx *ticket) | ||
| 805 | { | ||
| 806 | int ret = 0; | ||
| 807 | |||
| 808 | if (no_wait) { | ||
| 809 | bool success; | ||
| 810 | if (WARN_ON(ticket)) | ||
| 811 | return -EBUSY; | ||
| 812 | |||
| 813 | success = ww_mutex_trylock(&bo->resv->lock); | ||
| 814 | return success ? 0 : -EBUSY; | ||
| 815 | } | ||
| 816 | |||
| 817 | if (interruptible) | ||
| 818 | ret = ww_mutex_lock_interruptible(&bo->resv->lock, ticket); | ||
| 819 | else | ||
| 820 | ret = ww_mutex_lock(&bo->resv->lock, ticket); | ||
| 821 | if (ret == -EINTR) | ||
| 822 | return -ERESTARTSYS; | ||
| 823 | return ret; | ||
| 824 | } | ||
| 774 | 825 | ||
| 775 | /** | 826 | /** |
| 776 | * ttm_bo_reserve: | 827 | * ttm_bo_reserve: |
| @@ -778,8 +829,8 @@ extern void ttm_mem_io_unlock(struct ttm_mem_type_manager *man); | |||
| 778 | * @bo: A pointer to a struct ttm_buffer_object. | 829 | * @bo: A pointer to a struct ttm_buffer_object. |
| 779 | * @interruptible: Sleep interruptible if waiting. | 830 | * @interruptible: Sleep interruptible if waiting. |
| 780 | * @no_wait: Don't sleep while trying to reserve, rather return -EBUSY. | 831 | * @no_wait: Don't sleep while trying to reserve, rather return -EBUSY. |
| 781 | * @use_sequence: If @bo is already reserved, Only sleep waiting for | 832 | * @use_ticket: If @bo is already reserved, Only sleep waiting for |
| 782 | * it to become unreserved if @sequence < (@bo)->sequence. | 833 | * it to become unreserved if @ticket->stamp is older. |
| 783 | * | 834 | * |
| 784 | * Locks a buffer object for validation. (Or prevents other processes from | 835 | * Locks a buffer object for validation. (Or prevents other processes from |
| 785 | * locking it for validation) and removes it from lru lists, while taking | 836 | * locking it for validation) and removes it from lru lists, while taking |
| @@ -793,7 +844,7 @@ extern void ttm_mem_io_unlock(struct ttm_mem_type_manager *man); | |||
| 793 | * Processes attempting to reserve multiple buffers other than for eviction, | 844 | * Processes attempting to reserve multiple buffers other than for eviction, |
| 794 | * (typically execbuf), should first obtain a unique 32-bit | 845 | * (typically execbuf), should first obtain a unique 32-bit |
| 795 | * validation sequence number, | 846 | * validation sequence number, |
| 796 | * and call this function with @use_sequence == 1 and @sequence == the unique | 847 | * and call this function with @use_ticket == 1 and @ticket->stamp == the unique |
| 797 | * sequence number. If upon call of this function, the buffer object is already | 848 | * sequence number. If upon call of this function, the buffer object is already |
| 798 | * reserved, the validation sequence is checked against the validation | 849 | * reserved, the validation sequence is checked against the validation |
| 799 | * sequence of the process currently reserving the buffer, | 850 | * sequence of the process currently reserving the buffer, |
| @@ -808,36 +859,31 @@ extern void ttm_mem_io_unlock(struct ttm_mem_type_manager *man); | |||
| 808 | * will eventually succeed, preventing both deadlocks and starvation. | 859 | * will eventually succeed, preventing both deadlocks and starvation. |
| 809 | * | 860 | * |
| 810 | * Returns: | 861 | * Returns: |
| 811 | * -EAGAIN: The reservation may cause a deadlock. | 862 | * -EDEADLK: The reservation may cause a deadlock. |
| 812 | * Release all buffer reservations, wait for @bo to become unreserved and | 863 | * Release all buffer reservations, wait for @bo to become unreserved and |
| 813 | * try again. (only if use_sequence == 1). | 864 | * try again. (only if use_sequence == 1). |
| 814 | * -ERESTARTSYS: A wait for the buffer to become unreserved was interrupted by | 865 | * -ERESTARTSYS: A wait for the buffer to become unreserved was interrupted by |
| 815 | * a signal. Release all buffer reservations and return to user-space. | 866 | * a signal. Release all buffer reservations and return to user-space. |
| 816 | * -EBUSY: The function needed to sleep, but @no_wait was true | 867 | * -EBUSY: The function needed to sleep, but @no_wait was true |
| 817 | * -EDEADLK: Bo already reserved using @sequence. This error code will only | 868 | * -EALREADY: Bo already reserved using @ticket. This error code will only |
| 818 | * be returned if @use_sequence is set to true. | 869 | * be returned if @use_ticket is set to true. |
| 819 | */ | 870 | */ |
| 820 | extern int ttm_bo_reserve(struct ttm_buffer_object *bo, | 871 | static inline int ttm_bo_reserve(struct ttm_buffer_object *bo, |
| 821 | bool interruptible, | 872 | bool interruptible, |
| 822 | bool no_wait, bool use_sequence, uint32_t sequence); | 873 | bool no_wait, bool use_ticket, |
| 874 | struct ww_acquire_ctx *ticket) | ||
| 875 | { | ||
| 876 | int ret; | ||
| 823 | 877 | ||
| 824 | /** | 878 | WARN_ON(!atomic_read(&bo->kref.refcount)); |
| 825 | * ttm_bo_reserve_slowpath_nolru: | ||
| 826 | * @bo: A pointer to a struct ttm_buffer_object. | ||
| 827 | * @interruptible: Sleep interruptible if waiting. | ||
| 828 | * @sequence: Set (@bo)->sequence to this value after lock | ||
| 829 | * | ||
| 830 | * This is called after ttm_bo_reserve returns -EAGAIN and we backed off | ||
| 831 | * from all our other reservations. Because there are no other reservations | ||
| 832 | * held by us, this function cannot deadlock any more. | ||
| 833 | * | ||
| 834 | * Will not remove reserved buffers from the lru lists. | ||
| 835 | * Otherwise identical to ttm_bo_reserve_slowpath. | ||
| 836 | */ | ||
| 837 | extern int ttm_bo_reserve_slowpath_nolru(struct ttm_buffer_object *bo, | ||
| 838 | bool interruptible, | ||
| 839 | uint32_t sequence); | ||
| 840 | 879 | ||
| 880 | ret = ttm_bo_reserve_nolru(bo, interruptible, no_wait, use_ticket, | ||
| 881 | ticket); | ||
| 882 | if (likely(ret == 0)) | ||
| 883 | ttm_bo_del_sub_from_lru(bo); | ||
| 884 | |||
| 885 | return ret; | ||
| 886 | } | ||
| 841 | 887 | ||
| 842 | /** | 888 | /** |
| 843 | * ttm_bo_reserve_slowpath: | 889 | * ttm_bo_reserve_slowpath: |
| @@ -849,54 +895,57 @@ extern int ttm_bo_reserve_slowpath_nolru(struct ttm_buffer_object *bo, | |||
| 849 | * from all our other reservations. Because there are no other reservations | 895 | * from all our other reservations. Because there are no other reservations |
| 850 | * held by us, this function cannot deadlock any more. | 896 | * held by us, this function cannot deadlock any more. |
| 851 | */ | 897 | */ |
| 852 | extern int ttm_bo_reserve_slowpath(struct ttm_buffer_object *bo, | 898 | static inline int ttm_bo_reserve_slowpath(struct ttm_buffer_object *bo, |
| 853 | bool interruptible, uint32_t sequence); | 899 | bool interruptible, |
| 900 | struct ww_acquire_ctx *ticket) | ||
| 901 | { | ||
| 902 | int ret = 0; | ||
| 854 | 903 | ||
| 855 | /** | 904 | WARN_ON(!atomic_read(&bo->kref.refcount)); |
| 856 | * ttm_bo_reserve_nolru: | 905 | |
| 857 | * | 906 | if (interruptible) |
| 858 | * @bo: A pointer to a struct ttm_buffer_object. | 907 | ret = ww_mutex_lock_slow_interruptible(&bo->resv->lock, |
| 859 | * @interruptible: Sleep interruptible if waiting. | 908 | ticket); |
| 860 | * @no_wait: Don't sleep while trying to reserve, rather return -EBUSY. | 909 | else |
| 861 | * @use_sequence: If @bo is already reserved, Only sleep waiting for | 910 | ww_mutex_lock_slow(&bo->resv->lock, ticket); |
| 862 | * it to become unreserved if @sequence < (@bo)->sequence. | 911 | |
| 863 | * | 912 | if (likely(ret == 0)) |
| 864 | * Will not remove reserved buffers from the lru lists. | 913 | ttm_bo_del_sub_from_lru(bo); |
| 865 | * Otherwise identical to ttm_bo_reserve. | 914 | else if (ret == -EINTR) |
| 866 | * | 915 | ret = -ERESTARTSYS; |
| 867 | * Returns: | 916 | |
| 868 | * -EAGAIN: The reservation may cause a deadlock. | 917 | return ret; |
| 869 | * Release all buffer reservations, wait for @bo to become unreserved and | 918 | } |
| 870 | * try again. (only if use_sequence == 1). | ||
| 871 | * -ERESTARTSYS: A wait for the buffer to become unreserved was interrupted by | ||
| 872 | * a signal. Release all buffer reservations and return to user-space. | ||
| 873 | * -EBUSY: The function needed to sleep, but @no_wait was true | ||
| 874 | * -EDEADLK: Bo already reserved using @sequence. This error code will only | ||
| 875 | * be returned if @use_sequence is set to true. | ||
| 876 | */ | ||
| 877 | extern int ttm_bo_reserve_nolru(struct ttm_buffer_object *bo, | ||
| 878 | bool interruptible, | ||
| 879 | bool no_wait, bool use_sequence, | ||
| 880 | uint32_t sequence); | ||
| 881 | 919 | ||
| 882 | /** | 920 | /** |
| 883 | * ttm_bo_unreserve | 921 | * ttm_bo_unreserve_ticket |
| 884 | * | ||
| 885 | * @bo: A pointer to a struct ttm_buffer_object. | 922 | * @bo: A pointer to a struct ttm_buffer_object. |
| 923 | * @ticket: ww_acquire_ctx used for reserving | ||
| 886 | * | 924 | * |
| 887 | * Unreserve a previous reservation of @bo. | 925 | * Unreserve a previous reservation of @bo made with @ticket. |
| 888 | */ | 926 | */ |
| 889 | extern void ttm_bo_unreserve(struct ttm_buffer_object *bo); | 927 | static inline void ttm_bo_unreserve_ticket(struct ttm_buffer_object *bo, |
| 928 | struct ww_acquire_ctx *t) | ||
| 929 | { | ||
| 930 | if (!(bo->mem.placement & TTM_PL_FLAG_NO_EVICT)) { | ||
| 931 | spin_lock(&bo->glob->lru_lock); | ||
| 932 | ttm_bo_add_to_lru(bo); | ||
| 933 | spin_unlock(&bo->glob->lru_lock); | ||
| 934 | } | ||
| 935 | ww_mutex_unlock(&bo->resv->lock); | ||
| 936 | } | ||
| 890 | 937 | ||
| 891 | /** | 938 | /** |
| 892 | * ttm_bo_unreserve_locked | 939 | * ttm_bo_unreserve |
| 893 | * | 940 | * |
| 894 | * @bo: A pointer to a struct ttm_buffer_object. | 941 | * @bo: A pointer to a struct ttm_buffer_object. |
| 895 | * | 942 | * |
| 896 | * Unreserve a previous reservation of @bo. | 943 | * Unreserve a previous reservation of @bo. |
| 897 | * Needs to be called with struct ttm_bo_global::lru_lock held. | ||
| 898 | */ | 944 | */ |
| 899 | extern void ttm_bo_unreserve_locked(struct ttm_buffer_object *bo); | 945 | static inline void ttm_bo_unreserve(struct ttm_buffer_object *bo) |
| 946 | { | ||
| 947 | ttm_bo_unreserve_ticket(bo, NULL); | ||
| 948 | } | ||
| 900 | 949 | ||
| 901 | /* | 950 | /* |
| 902 | * ttm_bo_util.c | 951 | * ttm_bo_util.c |
diff --git a/include/drm/ttm/ttm_execbuf_util.h b/include/drm/ttm/ttm_execbuf_util.h index 547e19f06e57..ec8a1d306510 100644 --- a/include/drm/ttm/ttm_execbuf_util.h +++ b/include/drm/ttm/ttm_execbuf_util.h | |||
| @@ -57,17 +57,20 @@ struct ttm_validate_buffer { | |||
| 57 | /** | 57 | /** |
| 58 | * function ttm_eu_backoff_reservation | 58 | * function ttm_eu_backoff_reservation |
| 59 | * | 59 | * |
| 60 | * @ticket: ww_acquire_ctx from reserve call | ||
| 60 | * @list: thread private list of ttm_validate_buffer structs. | 61 | * @list: thread private list of ttm_validate_buffer structs. |
| 61 | * | 62 | * |
| 62 | * Undoes all buffer validation reservations for bos pointed to by | 63 | * Undoes all buffer validation reservations for bos pointed to by |
| 63 | * the list entries. | 64 | * the list entries. |
| 64 | */ | 65 | */ |
| 65 | 66 | ||
| 66 | extern void ttm_eu_backoff_reservation(struct list_head *list); | 67 | extern void ttm_eu_backoff_reservation(struct ww_acquire_ctx *ticket, |
| 68 | struct list_head *list); | ||
| 67 | 69 | ||
| 68 | /** | 70 | /** |
| 69 | * function ttm_eu_reserve_buffers | 71 | * function ttm_eu_reserve_buffers |
| 70 | * | 72 | * |
| 73 | * @ticket: [out] ww_acquire_ctx returned by call. | ||
| 71 | * @list: thread private list of ttm_validate_buffer structs. | 74 | * @list: thread private list of ttm_validate_buffer structs. |
| 72 | * | 75 | * |
| 73 | * Tries to reserve bos pointed to by the list entries for validation. | 76 | * Tries to reserve bos pointed to by the list entries for validation. |
| @@ -90,11 +93,13 @@ extern void ttm_eu_backoff_reservation(struct list_head *list); | |||
| 90 | * has failed. | 93 | * has failed. |
| 91 | */ | 94 | */ |
| 92 | 95 | ||
| 93 | extern int ttm_eu_reserve_buffers(struct list_head *list); | 96 | extern int ttm_eu_reserve_buffers(struct ww_acquire_ctx *ticket, |
| 97 | struct list_head *list); | ||
| 94 | 98 | ||
| 95 | /** | 99 | /** |
| 96 | * function ttm_eu_fence_buffer_objects. | 100 | * function ttm_eu_fence_buffer_objects. |
| 97 | * | 101 | * |
| 102 | * @ticket: ww_acquire_ctx from reserve call | ||
| 98 | * @list: thread private list of ttm_validate_buffer structs. | 103 | * @list: thread private list of ttm_validate_buffer structs. |
| 99 | * @sync_obj: The new sync object for the buffers. | 104 | * @sync_obj: The new sync object for the buffers. |
| 100 | * | 105 | * |
| @@ -104,6 +109,7 @@ extern int ttm_eu_reserve_buffers(struct list_head *list); | |||
| 104 | * | 109 | * |
| 105 | */ | 110 | */ |
| 106 | 111 | ||
| 107 | extern void ttm_eu_fence_buffer_objects(struct list_head *list, void *sync_obj); | 112 | extern void ttm_eu_fence_buffer_objects(struct ww_acquire_ctx *ticket, |
| 113 | struct list_head *list, void *sync_obj); | ||
| 108 | 114 | ||
| 109 | #endif | 115 | #endif |
diff --git a/include/linux/io.h b/include/linux/io.h index 069e4075f872..f4f42faec686 100644 --- a/include/linux/io.h +++ b/include/linux/io.h | |||
| @@ -76,4 +76,29 @@ void devm_ioremap_release(struct device *dev, void *res); | |||
| 76 | #define arch_has_dev_port() (1) | 76 | #define arch_has_dev_port() (1) |
| 77 | #endif | 77 | #endif |
| 78 | 78 | ||
| 79 | /* | ||
| 80 | * Some systems (x86 without PAT) have a somewhat reliable way to mark a | ||
| 81 | * physical address range such that uncached mappings will actually | ||
| 82 | * end up write-combining. This facility should be used in conjunction | ||
| 83 | * with pgprot_writecombine, ioremap-wc, or set_memory_wc, since it has | ||
| 84 | * no effect if the per-page mechanisms are functional. | ||
| 85 | * (On x86 without PAT, these functions manipulate MTRRs.) | ||
| 86 | * | ||
| 87 | * arch_phys_del_wc(0) or arch_phys_del_wc(any error code) is guaranteed | ||
| 88 | * to have no effect. | ||
| 89 | */ | ||
| 90 | #ifndef arch_phys_wc_add | ||
| 91 | static inline int __must_check arch_phys_wc_add(unsigned long base, | ||
| 92 | unsigned long size) | ||
| 93 | { | ||
| 94 | return 0; /* It worked (i.e. did nothing). */ | ||
| 95 | } | ||
| 96 | |||
| 97 | static inline void arch_phys_wc_del(int handle) | ||
| 98 | { | ||
| 99 | } | ||
| 100 | |||
| 101 | #define arch_phys_wc_add arch_phys_wc_add | ||
| 102 | #endif | ||
| 103 | |||
| 79 | #endif /* _LINUX_IO_H */ | 104 | #endif /* _LINUX_IO_H */ |
diff --git a/include/linux/platform_data/rcar-du.h b/include/linux/platform_data/rcar-du.h new file mode 100644 index 000000000000..80587fdbba3e --- /dev/null +++ b/include/linux/platform_data/rcar-du.h | |||
| @@ -0,0 +1,54 @@ | |||
| 1 | /* | ||
| 2 | * rcar_du.h -- R-Car Display Unit DRM driver | ||
| 3 | * | ||
| 4 | * Copyright (C) 2013 Renesas Corporation | ||
| 5 | * | ||
| 6 | * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com) | ||
| 7 | * | ||
| 8 | * This program is free software; you can redistribute it and/or modify | ||
| 9 | * it under the terms of the GNU General Public License as published by | ||
| 10 | * the Free Software Foundation; either version 2 of the License, or | ||
| 11 | * (at your option) any later version. | ||
| 12 | */ | ||
| 13 | |||
| 14 | #ifndef __RCAR_DU_H__ | ||
| 15 | #define __RCAR_DU_H__ | ||
| 16 | |||
| 17 | #include <drm/drm_mode.h> | ||
| 18 | |||
| 19 | enum rcar_du_encoder_type { | ||
| 20 | RCAR_DU_ENCODER_UNUSED = 0, | ||
| 21 | RCAR_DU_ENCODER_VGA, | ||
| 22 | RCAR_DU_ENCODER_LVDS, | ||
| 23 | }; | ||
| 24 | |||
| 25 | struct rcar_du_panel_data { | ||
| 26 | unsigned int width_mm; /* Panel width in mm */ | ||
| 27 | unsigned int height_mm; /* Panel height in mm */ | ||
| 28 | struct drm_mode_modeinfo mode; | ||
| 29 | }; | ||
| 30 | |||
| 31 | struct rcar_du_encoder_lvds_data { | ||
| 32 | struct rcar_du_panel_data panel; | ||
| 33 | }; | ||
| 34 | |||
| 35 | struct rcar_du_encoder_vga_data { | ||
| 36 | /* TODO: Add DDC information for EDID retrieval */ | ||
| 37 | }; | ||
| 38 | |||
| 39 | struct rcar_du_encoder_data { | ||
| 40 | enum rcar_du_encoder_type encoder; | ||
| 41 | unsigned int output; | ||
| 42 | |||
| 43 | union { | ||
| 44 | struct rcar_du_encoder_lvds_data lvds; | ||
| 45 | struct rcar_du_encoder_vga_data vga; | ||
| 46 | } u; | ||
| 47 | }; | ||
| 48 | |||
| 49 | struct rcar_du_platform_data { | ||
| 50 | struct rcar_du_encoder_data *encoders; | ||
| 51 | unsigned int num_encoders; | ||
| 52 | }; | ||
| 53 | |||
| 54 | #endif /* __RCAR_DU_H__ */ | ||
diff --git a/include/linux/reservation.h b/include/linux/reservation.h new file mode 100644 index 000000000000..e9ee806a9d72 --- /dev/null +++ b/include/linux/reservation.h | |||
| @@ -0,0 +1,62 @@ | |||
| 1 | /* | ||
| 2 | * Header file for reservations for dma-buf and ttm | ||
| 3 | * | ||
| 4 | * Copyright(C) 2011 Linaro Limited. All rights reserved. | ||
| 5 | * Copyright (C) 2012-2013 Canonical Ltd | ||
| 6 | * Copyright (C) 2012 Texas Instruments | ||
| 7 | * | ||
| 8 | * Authors: | ||
| 9 | * Rob Clark <rob.clark@linaro.org> | ||
| 10 | * Maarten Lankhorst <maarten.lankhorst@canonical.com> | ||
| 11 | * Thomas Hellstrom <thellstrom-at-vmware-dot-com> | ||
| 12 | * | ||
| 13 | * Based on bo.c which bears the following copyright notice, | ||
| 14 | * but is dual licensed: | ||
| 15 | * | ||
| 16 | * Copyright (c) 2006-2009 VMware, Inc., Palo Alto, CA., USA | ||
| 17 | * All Rights Reserved. | ||
| 18 | * | ||
| 19 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
| 20 | * copy of this software and associated documentation files (the | ||
| 21 | * "Software"), to deal in the Software without restriction, including | ||
| 22 | * without limitation the rights to use, copy, modify, merge, publish, | ||
| 23 | * distribute, sub license, and/or sell copies of the Software, and to | ||
| 24 | * permit persons to whom the Software is furnished to do so, subject to | ||
| 25 | * the following conditions: | ||
| 26 | * | ||
| 27 | * The above copyright notice and this permission notice (including the | ||
| 28 | * next paragraph) shall be included in all copies or substantial portions | ||
| 29 | * of the Software. | ||
| 30 | * | ||
| 31 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 32 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| 33 | * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL | ||
| 34 | * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, | ||
| 35 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR | ||
| 36 | * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE | ||
| 37 | * USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 38 | */ | ||
| 39 | #ifndef _LINUX_RESERVATION_H | ||
| 40 | #define _LINUX_RESERVATION_H | ||
| 41 | |||
| 42 | #include <linux/mutex.h> | ||
| 43 | |||
| 44 | extern struct ww_class reservation_ww_class; | ||
| 45 | |||
| 46 | struct reservation_object { | ||
| 47 | struct ww_mutex lock; | ||
| 48 | }; | ||
| 49 | |||
| 50 | static inline void | ||
| 51 | reservation_object_init(struct reservation_object *obj) | ||
| 52 | { | ||
| 53 | ww_mutex_init(&obj->lock, &reservation_ww_class); | ||
| 54 | } | ||
| 55 | |||
| 56 | static inline void | ||
| 57 | reservation_object_fini(struct reservation_object *obj) | ||
| 58 | { | ||
| 59 | ww_mutex_destroy(&obj->lock); | ||
| 60 | } | ||
| 61 | |||
| 62 | #endif /* _LINUX_RESERVATION_H */ | ||
diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h index 5a57be68bab7..238a166b9fe6 100644 --- a/include/uapi/drm/drm.h +++ b/include/uapi/drm/drm.h | |||
| @@ -732,6 +732,7 @@ struct drm_prime_handle { | |||
| 732 | #define DRM_IOCTL_MODE_ADDFB2 DRM_IOWR(0xB8, struct drm_mode_fb_cmd2) | 732 | #define DRM_IOCTL_MODE_ADDFB2 DRM_IOWR(0xB8, struct drm_mode_fb_cmd2) |
| 733 | #define DRM_IOCTL_MODE_OBJ_GETPROPERTIES DRM_IOWR(0xB9, struct drm_mode_obj_get_properties) | 733 | #define DRM_IOCTL_MODE_OBJ_GETPROPERTIES DRM_IOWR(0xB9, struct drm_mode_obj_get_properties) |
| 734 | #define DRM_IOCTL_MODE_OBJ_SETPROPERTY DRM_IOWR(0xBA, struct drm_mode_obj_set_property) | 734 | #define DRM_IOCTL_MODE_OBJ_SETPROPERTY DRM_IOWR(0xBA, struct drm_mode_obj_set_property) |
| 735 | #define DRM_IOCTL_MODE_CURSOR2 DRM_IOWR(0xBB, struct drm_mode_cursor2) | ||
| 735 | 736 | ||
| 736 | /** | 737 | /** |
| 737 | * Device specific ioctls should only be in their respective headers | 738 | * Device specific ioctls should only be in their respective headers |
diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h index 090e5331ab7e..53db7cea373b 100644 --- a/include/uapi/drm/drm_mode.h +++ b/include/uapi/drm/drm_mode.h | |||
| @@ -388,6 +388,19 @@ struct drm_mode_cursor { | |||
| 388 | __u32 handle; | 388 | __u32 handle; |
| 389 | }; | 389 | }; |
| 390 | 390 | ||
| 391 | struct drm_mode_cursor2 { | ||
| 392 | __u32 flags; | ||
| 393 | __u32 crtc_id; | ||
| 394 | __s32 x; | ||
| 395 | __s32 y; | ||
| 396 | __u32 width; | ||
| 397 | __u32 height; | ||
| 398 | /* driver specific handle */ | ||
| 399 | __u32 handle; | ||
| 400 | __s32 hot_x; | ||
| 401 | __s32 hot_y; | ||
| 402 | }; | ||
| 403 | |||
| 391 | struct drm_mode_crtc_lut { | 404 | struct drm_mode_crtc_lut { |
| 392 | __u32 crtc_id; | 405 | __u32 crtc_id; |
| 393 | __u32 gamma_size; | 406 | __u32 gamma_size; |
diff --git a/include/uapi/drm/i915_drm.h b/include/uapi/drm/i915_drm.h index 07d59419fe6b..923ed7fe5775 100644 --- a/include/uapi/drm/i915_drm.h +++ b/include/uapi/drm/i915_drm.h | |||
| @@ -305,7 +305,7 @@ typedef struct drm_i915_irq_wait { | |||
| 305 | #define I915_PARAM_HAS_WAIT_TIMEOUT 19 | 305 | #define I915_PARAM_HAS_WAIT_TIMEOUT 19 |
| 306 | #define I915_PARAM_HAS_SEMAPHORES 20 | 306 | #define I915_PARAM_HAS_SEMAPHORES 20 |
| 307 | #define I915_PARAM_HAS_PRIME_VMAP_FLUSH 21 | 307 | #define I915_PARAM_HAS_PRIME_VMAP_FLUSH 21 |
| 308 | #define I915_PARAM_RSVD_FOR_FUTURE_USE 22 | 308 | #define I915_PARAM_HAS_VEBOX 22 |
| 309 | #define I915_PARAM_HAS_SECURE_BATCHES 23 | 309 | #define I915_PARAM_HAS_SECURE_BATCHES 23 |
| 310 | #define I915_PARAM_HAS_PINNED_BATCHES 24 | 310 | #define I915_PARAM_HAS_PINNED_BATCHES 24 |
| 311 | #define I915_PARAM_HAS_EXEC_NO_RELOC 25 | 311 | #define I915_PARAM_HAS_EXEC_NO_RELOC 25 |
| @@ -660,6 +660,7 @@ struct drm_i915_gem_execbuffer2 { | |||
| 660 | #define I915_EXEC_RENDER (1<<0) | 660 | #define I915_EXEC_RENDER (1<<0) |
| 661 | #define I915_EXEC_BSD (2<<0) | 661 | #define I915_EXEC_BSD (2<<0) |
| 662 | #define I915_EXEC_BLT (3<<0) | 662 | #define I915_EXEC_BLT (3<<0) |
| 663 | #define I915_EXEC_VEBOX (4<<0) | ||
| 663 | 664 | ||
| 664 | /* Used for switching the constants addressing mode on gen4+ RENDER ring. | 665 | /* Used for switching the constants addressing mode on gen4+ RENDER ring. |
| 665 | * Gen6+ only supports relative addressing to dynamic state (default) and | 666 | * Gen6+ only supports relative addressing to dynamic state (default) and |
diff --git a/include/uapi/drm/tegra_drm.h b/include/uapi/drm/tegra_drm.h index 6e132a2f7420..73bde4eaf16c 100644 --- a/include/uapi/drm/tegra_drm.h +++ b/include/uapi/drm/tegra_drm.h | |||
| @@ -17,6 +17,8 @@ | |||
| 17 | #ifndef _UAPI_TEGRA_DRM_H_ | 17 | #ifndef _UAPI_TEGRA_DRM_H_ |
| 18 | #define _UAPI_TEGRA_DRM_H_ | 18 | #define _UAPI_TEGRA_DRM_H_ |
| 19 | 19 | ||
| 20 | #include <drm/drm.h> | ||
| 21 | |||
| 20 | struct drm_tegra_gem_create { | 22 | struct drm_tegra_gem_create { |
| 21 | __u64 size; | 23 | __u64 size; |
| 22 | __u32 flags; | 24 | __u32 flags; |
diff --git a/include/video/display_timing.h b/include/video/display_timing.h index 5d0259b08e01..28d9d0d566ca 100644 --- a/include/video/display_timing.h +++ b/include/video/display_timing.h | |||
| @@ -27,6 +27,7 @@ enum display_flags { | |||
| 27 | DISPLAY_FLAGS_PIXDATA_NEGEDGE = BIT(7), | 27 | DISPLAY_FLAGS_PIXDATA_NEGEDGE = BIT(7), |
| 28 | DISPLAY_FLAGS_INTERLACED = BIT(8), | 28 | DISPLAY_FLAGS_INTERLACED = BIT(8), |
| 29 | DISPLAY_FLAGS_DOUBLESCAN = BIT(9), | 29 | DISPLAY_FLAGS_DOUBLESCAN = BIT(9), |
| 30 | DISPLAY_FLAGS_DOUBLECLK = BIT(10), | ||
| 30 | }; | 31 | }; |
| 31 | 32 | ||
| 32 | /* | 33 | /* |
diff --git a/include/video/uvesafb.h b/include/video/uvesafb.h index 1a91850cb961..30f53625415c 100644 --- a/include/video/uvesafb.h +++ b/include/video/uvesafb.h | |||
| @@ -134,6 +134,7 @@ struct uvesafb_par { | |||
| 134 | 134 | ||
| 135 | int mode_idx; | 135 | int mode_idx; |
| 136 | struct vbe_crtc_ib crtc; | 136 | struct vbe_crtc_ib crtc; |
| 137 | int mtrr_handle; | ||
| 137 | }; | 138 | }; |
| 138 | 139 | ||
| 139 | #endif /* _UVESAFB_H */ | 140 | #endif /* _UVESAFB_H */ |
