diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-09-21 11:10:09 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-09-21 11:10:09 -0400 |
commit | 44040f107e64d689ccd3211ac62c6bc44f3f0775 (patch) | |
tree | f85059028aa570e758c7fb272fd8cf823ab4f119 /include/drm | |
parent | 388dba30471c236a290c4082bce5f2b5cd1a7a06 (diff) | |
parent | 28d520433b6375740990ab99d69b0d0067fd656b (diff) |
Merge branch 'drm-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6
* 'drm-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6: (133 commits)
drm/vgaarb: add VGA arbitration support to the drm and kms.
drm/radeon: some r420s have a CP race with the DMA engine.
drm/radeon/r600/kms: rv670 is not DCE3
drm/radeon/kms: r420 idle after programming GA_ENHANCE
drm/radeon/kms: more fixes to rv770 suspend/resume path.
drm/radeon/kms: more alignment for rv770.c with r600.c
drm/radeon/kms: rv770 blit init called too late.
drm/radeon/kms: move around new init path code to avoid posting at init
drm/radeon/r600: fix some issues with suspend/resume.
drm/radeon/kms: disable VGA rendering engine before taking over VRAM
drm/radeon/kms: Move radeon_get_clock_info() call out of radeon_clocks_init().
drm/radeon/kms: add initial connector properties
drm/radeon/kms: Use surfaces for scanout / cursor byte swapping on big endian.
drm/radeon/kms: don't fail if we fail to init GPU acceleration
drm/r600/kms: fixup number of loops per blit calculation.
drm/radeon/kms: reprogram format in set base.
drm/radeon: avivo chips have no separate int bit for display
drm/radeon/r600: don't do interrupts
drm: fix _DRM_GEM addmap error message
drm: update crtc x/y when only fb changes
...
Fixed up trivial conflicts in firmware/Makefile due to network driver
(cxgb3) and drm (mga/r128/radeon) firmware being listed next to each
other.
Diffstat (limited to 'include/drm')
-rw-r--r-- | include/drm/drmP.h | 57 | ||||
-rw-r--r-- | include/drm/drm_cache.h | 38 | ||||
-rw-r--r-- | include/drm/drm_crtc.h | 16 | ||||
-rw-r--r-- | include/drm/drm_crtc_helper.h | 3 | ||||
-rw-r--r-- | include/drm/drm_encoder_slave.h | 162 | ||||
-rw-r--r-- | include/drm/drm_fb_helper.h | 82 | ||||
-rw-r--r-- | include/drm/drm_mm.h | 7 | ||||
-rw-r--r-- | include/drm/drm_mode.h | 11 | ||||
-rw-r--r-- | include/drm/drm_sysfs.h | 12 | ||||
-rw-r--r-- | include/drm/radeon_drm.h | 12 | ||||
-rw-r--r-- | include/drm/ttm/ttm_bo_api.h | 13 | ||||
-rw-r--r-- | include/drm/ttm/ttm_bo_driver.h | 94 | ||||
-rw-r--r-- | include/drm/ttm/ttm_memory.h | 43 | ||||
-rw-r--r-- | include/drm/ttm/ttm_module.h | 2 |
14 files changed, 477 insertions, 75 deletions
diff --git a/include/drm/drmP.h b/include/drm/drmP.h index 45b67d9c39c1..c8e64bbadbcf 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h | |||
@@ -88,7 +88,37 @@ struct drm_device; | |||
88 | #define DRM_UT_CORE 0x01 | 88 | #define DRM_UT_CORE 0x01 |
89 | #define DRM_UT_DRIVER 0x02 | 89 | #define DRM_UT_DRIVER 0x02 |
90 | #define DRM_UT_KMS 0x04 | 90 | #define DRM_UT_KMS 0x04 |
91 | #define DRM_UT_MODE 0x08 | 91 | /* |
92 | * Three debug levels are defined. | ||
93 | * drm_core, drm_driver, drm_kms | ||
94 | * drm_core level can be used in the generic drm code. For example: | ||
95 | * drm_ioctl, drm_mm, drm_memory | ||
96 | * The macro definiton of DRM_DEBUG is used. | ||
97 | * DRM_DEBUG(fmt, args...) | ||
98 | * The debug info by using the DRM_DEBUG can be obtained by adding | ||
99 | * the boot option of "drm.debug=1". | ||
100 | * | ||
101 | * drm_driver level can be used in the specific drm driver. It is used | ||
102 | * to add the debug info related with the drm driver. For example: | ||
103 | * i915_drv, i915_dma, i915_gem, radeon_drv, | ||
104 | * The macro definition of DRM_DEBUG_DRIVER can be used. | ||
105 | * DRM_DEBUG_DRIVER(fmt, args...) | ||
106 | * The debug info by using the DRM_DEBUG_DRIVER can be obtained by | ||
107 | * adding the boot option of "drm.debug=0x02" | ||
108 | * | ||
109 | * drm_kms level can be used in the KMS code related with specific drm driver. | ||
110 | * It is used to add the debug info related with KMS mode. For example: | ||
111 | * the connector/crtc , | ||
112 | * The macro definition of DRM_DEBUG_KMS can be used. | ||
113 | * DRM_DEBUG_KMS(fmt, args...) | ||
114 | * The debug info by using the DRM_DEBUG_KMS can be obtained by | ||
115 | * adding the boot option of "drm.debug=0x04" | ||
116 | * | ||
117 | * If we add the boot option of "drm.debug=0x06", we can get the debug info by | ||
118 | * using the DRM_DEBUG_KMS and DRM_DEBUG_DRIVER. | ||
119 | * If we add the boot option of "drm.debug=0x05", we can get the debug info by | ||
120 | * using the DRM_DEBUG_KMS and DRM_DEBUG. | ||
121 | */ | ||
92 | 122 | ||
93 | extern void drm_ut_debug_printk(unsigned int request_level, | 123 | extern void drm_ut_debug_printk(unsigned int request_level, |
94 | const char *prefix, | 124 | const char *prefix, |
@@ -174,19 +204,14 @@ extern void drm_ut_debug_printk(unsigned int request_level, | |||
174 | __func__, fmt, ##args); \ | 204 | __func__, fmt, ##args); \ |
175 | } while (0) | 205 | } while (0) |
176 | 206 | ||
177 | #define DRM_DEBUG_DRIVER(prefix, fmt, args...) \ | 207 | #define DRM_DEBUG_DRIVER(fmt, args...) \ |
178 | do { \ | 208 | do { \ |
179 | drm_ut_debug_printk(DRM_UT_DRIVER, prefix, \ | 209 | drm_ut_debug_printk(DRM_UT_DRIVER, DRM_NAME, \ |
180 | __func__, fmt, ##args); \ | 210 | __func__, fmt, ##args); \ |
181 | } while (0) | 211 | } while (0) |
182 | #define DRM_DEBUG_KMS(prefix, fmt, args...) \ | 212 | #define DRM_DEBUG_KMS(fmt, args...) \ |
183 | do { \ | 213 | do { \ |
184 | drm_ut_debug_printk(DRM_UT_KMS, prefix, \ | 214 | drm_ut_debug_printk(DRM_UT_KMS, DRM_NAME, \ |
185 | __func__, fmt, ##args); \ | ||
186 | } while (0) | ||
187 | #define DRM_DEBUG_MODE(prefix, fmt, args...) \ | ||
188 | do { \ | ||
189 | drm_ut_debug_printk(DRM_UT_MODE, prefix, \ | ||
190 | __func__, fmt, ##args); \ | 215 | __func__, fmt, ##args); \ |
191 | } while (0) | 216 | } while (0) |
192 | #define DRM_LOG(fmt, args...) \ | 217 | #define DRM_LOG(fmt, args...) \ |
@@ -210,9 +235,8 @@ extern void drm_ut_debug_printk(unsigned int request_level, | |||
210 | NULL, fmt, ##args); \ | 235 | NULL, fmt, ##args); \ |
211 | } while (0) | 236 | } while (0) |
212 | #else | 237 | #else |
213 | #define DRM_DEBUG_DRIVER(prefix, fmt, args...) do { } while (0) | 238 | #define DRM_DEBUG_DRIVER(fmt, args...) do { } while (0) |
214 | #define DRM_DEBUG_KMS(prefix, fmt, args...) do { } while (0) | 239 | #define DRM_DEBUG_KMS(fmt, args...) do { } while (0) |
215 | #define DRM_DEBUG_MODE(prefix, fmt, args...) do { } while (0) | ||
216 | #define DRM_DEBUG(fmt, arg...) do { } while (0) | 240 | #define DRM_DEBUG(fmt, arg...) do { } while (0) |
217 | #define DRM_LOG(fmt, arg...) do { } while (0) | 241 | #define DRM_LOG(fmt, arg...) do { } while (0) |
218 | #define DRM_LOG_KMS(fmt, args...) do { } while (0) | 242 | #define DRM_LOG_KMS(fmt, args...) do { } while (0) |
@@ -786,6 +810,9 @@ struct drm_driver { | |||
786 | int (*gem_init_object) (struct drm_gem_object *obj); | 810 | int (*gem_init_object) (struct drm_gem_object *obj); |
787 | void (*gem_free_object) (struct drm_gem_object *obj); | 811 | void (*gem_free_object) (struct drm_gem_object *obj); |
788 | 812 | ||
813 | /* vga arb irq handler */ | ||
814 | void (*vgaarb_irq)(struct drm_device *dev, bool state); | ||
815 | |||
789 | /* Driver private ops for this object */ | 816 | /* Driver private ops for this object */ |
790 | struct vm_operations_struct *gem_vm_ops; | 817 | struct vm_operations_struct *gem_vm_ops; |
791 | 818 | ||
@@ -1417,7 +1444,7 @@ drm_gem_object_unreference(struct drm_gem_object *obj) | |||
1417 | 1444 | ||
1418 | int drm_gem_handle_create(struct drm_file *file_priv, | 1445 | int drm_gem_handle_create(struct drm_file *file_priv, |
1419 | struct drm_gem_object *obj, | 1446 | struct drm_gem_object *obj, |
1420 | int *handlep); | 1447 | u32 *handlep); |
1421 | 1448 | ||
1422 | static inline void | 1449 | static inline void |
1423 | drm_gem_object_handle_reference(struct drm_gem_object *obj) | 1450 | drm_gem_object_handle_reference(struct drm_gem_object *obj) |
@@ -1443,7 +1470,7 @@ drm_gem_object_handle_unreference(struct drm_gem_object *obj) | |||
1443 | 1470 | ||
1444 | struct drm_gem_object *drm_gem_object_lookup(struct drm_device *dev, | 1471 | struct drm_gem_object *drm_gem_object_lookup(struct drm_device *dev, |
1445 | struct drm_file *filp, | 1472 | struct drm_file *filp, |
1446 | int handle); | 1473 | u32 handle); |
1447 | int drm_gem_close_ioctl(struct drm_device *dev, void *data, | 1474 | int drm_gem_close_ioctl(struct drm_device *dev, void *data, |
1448 | struct drm_file *file_priv); | 1475 | struct drm_file *file_priv); |
1449 | int drm_gem_flink_ioctl(struct drm_device *dev, void *data, | 1476 | int drm_gem_flink_ioctl(struct drm_device *dev, void *data, |
diff --git a/include/drm/drm_cache.h b/include/drm/drm_cache.h new file mode 100644 index 000000000000..7bfb063029d8 --- /dev/null +++ b/include/drm/drm_cache.h | |||
@@ -0,0 +1,38 @@ | |||
1 | /************************************************************************** | ||
2 | * | ||
3 | * Copyright 2009 Red Hat 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 | * Authors: | ||
30 | * Dave Airlie <airlied@redhat.com> | ||
31 | */ | ||
32 | |||
33 | #ifndef _DRM_CACHE_H_ | ||
34 | #define _DRM_CACHE_H_ | ||
35 | |||
36 | void drm_clflush_pages(struct page *pages[], unsigned long num_pages); | ||
37 | |||
38 | #endif | ||
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index 7300fb866767..ae1e9e166959 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h | |||
@@ -259,6 +259,8 @@ struct drm_framebuffer { | |||
259 | void *fbdev; | 259 | void *fbdev; |
260 | u32 pseudo_palette[17]; | 260 | u32 pseudo_palette[17]; |
261 | struct list_head filp_head; | 261 | struct list_head filp_head; |
262 | /* if you are using the helper */ | ||
263 | void *helper_private; | ||
262 | }; | 264 | }; |
263 | 265 | ||
264 | struct drm_property_blob { | 266 | struct drm_property_blob { |
@@ -572,6 +574,12 @@ struct drm_mode_config { | |||
572 | struct drm_property *tv_right_margin_property; | 574 | struct drm_property *tv_right_margin_property; |
573 | struct drm_property *tv_top_margin_property; | 575 | struct drm_property *tv_top_margin_property; |
574 | struct drm_property *tv_bottom_margin_property; | 576 | struct drm_property *tv_bottom_margin_property; |
577 | struct drm_property *tv_brightness_property; | ||
578 | struct drm_property *tv_contrast_property; | ||
579 | struct drm_property *tv_flicker_reduction_property; | ||
580 | struct drm_property *tv_overscan_property; | ||
581 | struct drm_property *tv_saturation_property; | ||
582 | struct drm_property *tv_hue_property; | ||
575 | 583 | ||
576 | /* Optional properties */ | 584 | /* Optional properties */ |
577 | struct drm_property *scaling_mode_property; | 585 | struct drm_property *scaling_mode_property; |
@@ -736,4 +744,12 @@ extern int drm_mode_gamma_get_ioctl(struct drm_device *dev, | |||
736 | extern int drm_mode_gamma_set_ioctl(struct drm_device *dev, | 744 | extern int drm_mode_gamma_set_ioctl(struct drm_device *dev, |
737 | void *data, struct drm_file *file_priv); | 745 | void *data, struct drm_file *file_priv); |
738 | extern bool drm_detect_hdmi_monitor(struct edid *edid); | 746 | extern bool drm_detect_hdmi_monitor(struct edid *edid); |
747 | extern struct drm_display_mode *drm_cvt_mode(struct drm_device *dev, | ||
748 | int hdisplay, int vdisplay, int vrefresh, | ||
749 | bool reduced, bool interlaced); | ||
750 | extern struct drm_display_mode *drm_gtf_mode(struct drm_device *dev, | ||
751 | int hdisplay, int vdisplay, int vrefresh, | ||
752 | bool interlaced, int margins); | ||
753 | extern int drm_add_modes_noedid(struct drm_connector *connector, | ||
754 | int hdisplay, int vdisplay); | ||
739 | #endif /* __DRM_CRTC_H__ */ | 755 | #endif /* __DRM_CRTC_H__ */ |
diff --git a/include/drm/drm_crtc_helper.h b/include/drm/drm_crtc_helper.h index 6769ff6c1bc0..4c8dacaf4f58 100644 --- a/include/drm/drm_crtc_helper.h +++ b/include/drm/drm_crtc_helper.h | |||
@@ -79,6 +79,8 @@ struct drm_encoder_helper_funcs { | |||
79 | /* detect for DAC style encoders */ | 79 | /* detect for DAC style encoders */ |
80 | enum drm_connector_status (*detect)(struct drm_encoder *encoder, | 80 | enum drm_connector_status (*detect)(struct drm_encoder *encoder, |
81 | struct drm_connector *connector); | 81 | struct drm_connector *connector); |
82 | /* disable encoder when not in use - more explicit than dpms off */ | ||
83 | void (*disable)(struct drm_encoder *encoder); | ||
82 | }; | 84 | }; |
83 | 85 | ||
84 | struct drm_connector_helper_funcs { | 86 | struct drm_connector_helper_funcs { |
@@ -98,6 +100,7 @@ extern bool drm_crtc_helper_set_mode(struct drm_crtc *crtc, | |||
98 | int x, int y, | 100 | int x, int y, |
99 | struct drm_framebuffer *old_fb); | 101 | struct drm_framebuffer *old_fb); |
100 | extern bool drm_helper_crtc_in_use(struct drm_crtc *crtc); | 102 | extern bool drm_helper_crtc_in_use(struct drm_crtc *crtc); |
103 | extern bool drm_helper_encoder_in_use(struct drm_encoder *encoder); | ||
101 | 104 | ||
102 | extern void drm_helper_connector_dpms(struct drm_connector *connector, int mode); | 105 | extern void drm_helper_connector_dpms(struct drm_connector *connector, int mode); |
103 | 106 | ||
diff --git a/include/drm/drm_encoder_slave.h b/include/drm/drm_encoder_slave.h new file mode 100644 index 000000000000..2f65633d28a7 --- /dev/null +++ b/include/drm/drm_encoder_slave.h | |||
@@ -0,0 +1,162 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2009 Francisco Jerez. | ||
3 | * All Rights Reserved. | ||
4 | * | ||
5 | * Permission is hereby granted, free of charge, to any person obtaining | ||
6 | * a copy of this software and associated documentation files (the | ||
7 | * "Software"), to deal in the Software without restriction, including | ||
8 | * without limitation the rights to use, copy, modify, merge, publish, | ||
9 | * distribute, sublicense, and/or sell copies of the Software, and to | ||
10 | * permit persons to whom the Software is furnished to do so, subject to | ||
11 | * the following conditions: | ||
12 | * | ||
13 | * The above copyright notice and this permission notice (including the | ||
14 | * next paragraph) shall be included in all copies or substantial | ||
15 | * portions of the Software. | ||
16 | * | ||
17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | ||
20 | * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE | ||
21 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
22 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
23 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
24 | * | ||
25 | */ | ||
26 | |||
27 | #ifndef __DRM_ENCODER_SLAVE_H__ | ||
28 | #define __DRM_ENCODER_SLAVE_H__ | ||
29 | |||
30 | #include "drmP.h" | ||
31 | #include "drm_crtc.h" | ||
32 | |||
33 | /** | ||
34 | * struct drm_encoder_slave_funcs - Entry points exposed by a slave encoder driver | ||
35 | * @set_config: Initialize any encoder-specific modesetting parameters. | ||
36 | * The meaning of the @params parameter is implementation | ||
37 | * dependent. It will usually be a structure with DVO port | ||
38 | * data format settings or timings. It's not required for | ||
39 | * the new parameters to take effect until the next mode | ||
40 | * is set. | ||
41 | * | ||
42 | * Most of its members are analogous to the function pointers in | ||
43 | * &drm_encoder_helper_funcs and they can optionally be used to | ||
44 | * initialize the latter. Connector-like methods (e.g. @get_modes and | ||
45 | * @set_property) will typically be wrapped around and only be called | ||
46 | * if the encoder is the currently selected one for the connector. | ||
47 | */ | ||
48 | struct drm_encoder_slave_funcs { | ||
49 | void (*set_config)(struct drm_encoder *encoder, | ||
50 | void *params); | ||
51 | |||
52 | void (*destroy)(struct drm_encoder *encoder); | ||
53 | void (*dpms)(struct drm_encoder *encoder, int mode); | ||
54 | void (*save)(struct drm_encoder *encoder); | ||
55 | void (*restore)(struct drm_encoder *encoder); | ||
56 | bool (*mode_fixup)(struct drm_encoder *encoder, | ||
57 | struct drm_display_mode *mode, | ||
58 | struct drm_display_mode *adjusted_mode); | ||
59 | int (*mode_valid)(struct drm_encoder *encoder, | ||
60 | struct drm_display_mode *mode); | ||
61 | void (*mode_set)(struct drm_encoder *encoder, | ||
62 | struct drm_display_mode *mode, | ||
63 | struct drm_display_mode *adjusted_mode); | ||
64 | |||
65 | enum drm_connector_status (*detect)(struct drm_encoder *encoder, | ||
66 | struct drm_connector *connector); | ||
67 | int (*get_modes)(struct drm_encoder *encoder, | ||
68 | struct drm_connector *connector); | ||
69 | int (*create_resources)(struct drm_encoder *encoder, | ||
70 | struct drm_connector *connector); | ||
71 | int (*set_property)(struct drm_encoder *encoder, | ||
72 | struct drm_connector *connector, | ||
73 | struct drm_property *property, | ||
74 | uint64_t val); | ||
75 | |||
76 | }; | ||
77 | |||
78 | /** | ||
79 | * struct drm_encoder_slave - Slave encoder struct | ||
80 | * @base: DRM encoder object. | ||
81 | * @slave_funcs: Slave encoder callbacks. | ||
82 | * @slave_priv: Slave encoder private data. | ||
83 | * @bus_priv: Bus specific data. | ||
84 | * | ||
85 | * A &drm_encoder_slave has two sets of callbacks, @slave_funcs and the | ||
86 | * ones in @base. The former are never actually called by the common | ||
87 | * CRTC code, it's just a convenience for splitting the encoder | ||
88 | * functions in an upper, GPU-specific layer and a (hopefully) | ||
89 | * GPU-agnostic lower layer: It's the GPU driver responsibility to | ||
90 | * call the slave methods when appropriate. | ||
91 | * | ||
92 | * drm_i2c_encoder_init() provides a way to get an implementation of | ||
93 | * this. | ||
94 | */ | ||
95 | struct drm_encoder_slave { | ||
96 | struct drm_encoder base; | ||
97 | |||
98 | struct drm_encoder_slave_funcs *slave_funcs; | ||
99 | void *slave_priv; | ||
100 | void *bus_priv; | ||
101 | }; | ||
102 | #define to_encoder_slave(x) container_of((x), struct drm_encoder_slave, base) | ||
103 | |||
104 | int drm_i2c_encoder_init(struct drm_device *dev, | ||
105 | struct drm_encoder_slave *encoder, | ||
106 | struct i2c_adapter *adap, | ||
107 | const struct i2c_board_info *info); | ||
108 | |||
109 | |||
110 | /** | ||
111 | * struct drm_i2c_encoder_driver | ||
112 | * | ||
113 | * Describes a device driver for an encoder connected to the GPU | ||
114 | * through an I2C bus. In addition to the entry points in @i2c_driver | ||
115 | * an @encoder_init function should be provided. It will be called to | ||
116 | * give the driver an opportunity to allocate any per-encoder data | ||
117 | * structures and to initialize the @slave_funcs and (optionally) | ||
118 | * @slave_priv members of @encoder. | ||
119 | */ | ||
120 | struct drm_i2c_encoder_driver { | ||
121 | struct i2c_driver i2c_driver; | ||
122 | |||
123 | int (*encoder_init)(struct i2c_client *client, | ||
124 | struct drm_device *dev, | ||
125 | struct drm_encoder_slave *encoder); | ||
126 | |||
127 | }; | ||
128 | #define to_drm_i2c_encoder_driver(x) container_of((x), \ | ||
129 | struct drm_i2c_encoder_driver, \ | ||
130 | i2c_driver) | ||
131 | |||
132 | /** | ||
133 | * drm_i2c_encoder_get_client - Get the I2C client corresponding to an encoder | ||
134 | */ | ||
135 | static inline struct i2c_client *drm_i2c_encoder_get_client(struct drm_encoder *encoder) | ||
136 | { | ||
137 | return (struct i2c_client *)to_encoder_slave(encoder)->bus_priv; | ||
138 | } | ||
139 | |||
140 | /** | ||
141 | * drm_i2c_encoder_register - Register an I2C encoder driver | ||
142 | * @owner: Module containing the driver. | ||
143 | * @driver: Driver to be registered. | ||
144 | */ | ||
145 | static inline int drm_i2c_encoder_register(struct module *owner, | ||
146 | struct drm_i2c_encoder_driver *driver) | ||
147 | { | ||
148 | return i2c_register_driver(owner, &driver->i2c_driver); | ||
149 | } | ||
150 | |||
151 | /** | ||
152 | * drm_i2c_encoder_unregister - Unregister an I2C encoder driver | ||
153 | * @driver: Driver to be unregistered. | ||
154 | */ | ||
155 | static inline void drm_i2c_encoder_unregister(struct drm_i2c_encoder_driver *driver) | ||
156 | { | ||
157 | i2c_del_driver(&driver->i2c_driver); | ||
158 | } | ||
159 | |||
160 | void drm_i2c_encoder_destroy(struct drm_encoder *encoder); | ||
161 | |||
162 | #endif | ||
diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h new file mode 100644 index 000000000000..88fffbdfa26f --- /dev/null +++ b/include/drm/drm_fb_helper.h | |||
@@ -0,0 +1,82 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2006-2009 Red Hat Inc. | ||
3 | * Copyright (c) 2006-2008 Intel Corporation | ||
4 | * Copyright (c) 2007 Dave Airlie <airlied@linux.ie> | ||
5 | * | ||
6 | * DRM framebuffer helper functions | ||
7 | * | ||
8 | * Permission to use, copy, modify, distribute, and sell this software and its | ||
9 | * documentation for any purpose is hereby granted without fee, provided that | ||
10 | * the above copyright notice appear in all copies and that both that copyright | ||
11 | * notice and this permission notice appear in supporting documentation, and | ||
12 | * that the name of the copyright holders not be used in advertising or | ||
13 | * publicity pertaining to distribution of the software without specific, | ||
14 | * written prior permission. The copyright holders make no representations | ||
15 | * about the suitability of this software for any purpose. It is provided "as | ||
16 | * is" without express or implied warranty. | ||
17 | * | ||
18 | * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, | ||
19 | * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO | ||
20 | * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR | ||
21 | * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, | ||
22 | * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | ||
23 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | ||
24 | * OF THIS SOFTWARE. | ||
25 | * | ||
26 | * Authors: | ||
27 | * Dave Airlie <airlied@linux.ie> | ||
28 | * Jesse Barnes <jesse.barnes@intel.com> | ||
29 | */ | ||
30 | #ifndef DRM_FB_HELPER_H | ||
31 | #define DRM_FB_HELPER_H | ||
32 | |||
33 | struct drm_fb_helper_crtc { | ||
34 | uint32_t crtc_id; | ||
35 | struct drm_mode_set mode_set; | ||
36 | }; | ||
37 | |||
38 | struct drm_fb_helper_funcs { | ||
39 | void (*gamma_set)(struct drm_crtc *crtc, u16 red, u16 green, | ||
40 | u16 blue, int regno); | ||
41 | }; | ||
42 | |||
43 | struct drm_fb_helper { | ||
44 | struct drm_framebuffer *fb; | ||
45 | struct drm_device *dev; | ||
46 | struct drm_display_mode *mode; | ||
47 | int crtc_count; | ||
48 | struct drm_fb_helper_crtc *crtc_info; | ||
49 | struct drm_fb_helper_funcs *funcs; | ||
50 | int conn_limit; | ||
51 | struct list_head kernel_fb_list; | ||
52 | }; | ||
53 | |||
54 | int drm_fb_helper_single_fb_probe(struct drm_device *dev, | ||
55 | int (*fb_create)(struct drm_device *dev, | ||
56 | uint32_t fb_width, | ||
57 | uint32_t fb_height, | ||
58 | uint32_t surface_width, | ||
59 | uint32_t surface_height, | ||
60 | struct drm_framebuffer **fb_ptr)); | ||
61 | int drm_fb_helper_init_crtc_count(struct drm_fb_helper *helper, int crtc_count, | ||
62 | int max_conn); | ||
63 | void drm_fb_helper_free(struct drm_fb_helper *helper); | ||
64 | int drm_fb_helper_blank(int blank, struct fb_info *info); | ||
65 | int drm_fb_helper_pan_display(struct fb_var_screeninfo *var, | ||
66 | struct fb_info *info); | ||
67 | int drm_fb_helper_set_par(struct fb_info *info); | ||
68 | int drm_fb_helper_check_var(struct fb_var_screeninfo *var, | ||
69 | struct fb_info *info); | ||
70 | int drm_fb_helper_setcolreg(unsigned regno, | ||
71 | unsigned red, | ||
72 | unsigned green, | ||
73 | unsigned blue, | ||
74 | unsigned transp, | ||
75 | struct fb_info *info); | ||
76 | |||
77 | void drm_fb_helper_restore(void); | ||
78 | void drm_fb_helper_fill_var(struct fb_info *info, struct drm_framebuffer *fb, | ||
79 | uint32_t fb_width, uint32_t fb_height); | ||
80 | void drm_fb_helper_fill_fix(struct fb_info *info, uint32_t pitch); | ||
81 | |||
82 | #endif | ||
diff --git a/include/drm/drm_mm.h b/include/drm/drm_mm.h index f8332073d277..62329f9a42cb 100644 --- a/include/drm/drm_mm.h +++ b/include/drm/drm_mm.h | |||
@@ -37,6 +37,9 @@ | |||
37 | * Generic range manager structs | 37 | * Generic range manager structs |
38 | */ | 38 | */ |
39 | #include <linux/list.h> | 39 | #include <linux/list.h> |
40 | #ifdef CONFIG_DEBUG_FS | ||
41 | #include <linux/seq_file.h> | ||
42 | #endif | ||
40 | 43 | ||
41 | struct drm_mm_node { | 44 | struct drm_mm_node { |
42 | struct list_head fl_entry; | 45 | struct list_head fl_entry; |
@@ -96,4 +99,8 @@ static inline struct drm_mm *drm_get_mm(struct drm_mm_node *block) | |||
96 | return block->mm; | 99 | return block->mm; |
97 | } | 100 | } |
98 | 101 | ||
102 | #ifdef CONFIG_DEBUG_FS | ||
103 | int drm_mm_dump_table(struct seq_file *m, struct drm_mm *mm); | ||
104 | #endif | ||
105 | |||
99 | #endif | 106 | #endif |
diff --git a/include/drm/drm_mode.h b/include/drm/drm_mode.h index ae304cc73c90..1f908416aedb 100644 --- a/include/drm/drm_mode.h +++ b/include/drm/drm_mode.h | |||
@@ -68,10 +68,11 @@ | |||
68 | #define DRM_MODE_DPMS_OFF 3 | 68 | #define DRM_MODE_DPMS_OFF 3 |
69 | 69 | ||
70 | /* Scaling mode options */ | 70 | /* Scaling mode options */ |
71 | #define DRM_MODE_SCALE_NON_GPU 0 | 71 | #define DRM_MODE_SCALE_NONE 0 /* Unmodified timing (display or |
72 | #define DRM_MODE_SCALE_FULLSCREEN 1 | 72 | software can still scale) */ |
73 | #define DRM_MODE_SCALE_NO_SCALE 2 | 73 | #define DRM_MODE_SCALE_FULLSCREEN 1 /* Full screen, ignore aspect */ |
74 | #define DRM_MODE_SCALE_ASPECT 3 | 74 | #define DRM_MODE_SCALE_CENTER 2 /* Centered, no scaling */ |
75 | #define DRM_MODE_SCALE_ASPECT 3 /* Full screen, preserve aspect */ | ||
75 | 76 | ||
76 | /* Dithering mode options */ | 77 | /* Dithering mode options */ |
77 | #define DRM_MODE_DITHERING_OFF 0 | 78 | #define DRM_MODE_DITHERING_OFF 0 |
@@ -141,6 +142,7 @@ struct drm_mode_get_encoder { | |||
141 | #define DRM_MODE_SUBCONNECTOR_Composite 5 | 142 | #define DRM_MODE_SUBCONNECTOR_Composite 5 |
142 | #define DRM_MODE_SUBCONNECTOR_SVIDEO 6 | 143 | #define DRM_MODE_SUBCONNECTOR_SVIDEO 6 |
143 | #define DRM_MODE_SUBCONNECTOR_Component 8 | 144 | #define DRM_MODE_SUBCONNECTOR_Component 8 |
145 | #define DRM_MODE_SUBCONNECTOR_SCART 9 | ||
144 | 146 | ||
145 | #define DRM_MODE_CONNECTOR_Unknown 0 | 147 | #define DRM_MODE_CONNECTOR_Unknown 0 |
146 | #define DRM_MODE_CONNECTOR_VGA 1 | 148 | #define DRM_MODE_CONNECTOR_VGA 1 |
@@ -155,6 +157,7 @@ struct drm_mode_get_encoder { | |||
155 | #define DRM_MODE_CONNECTOR_DisplayPort 10 | 157 | #define DRM_MODE_CONNECTOR_DisplayPort 10 |
156 | #define DRM_MODE_CONNECTOR_HDMIA 11 | 158 | #define DRM_MODE_CONNECTOR_HDMIA 11 |
157 | #define DRM_MODE_CONNECTOR_HDMIB 12 | 159 | #define DRM_MODE_CONNECTOR_HDMIB 12 |
160 | #define DRM_MODE_CONNECTOR_TV 13 | ||
158 | 161 | ||
159 | struct drm_mode_get_connector { | 162 | struct drm_mode_get_connector { |
160 | 163 | ||
diff --git a/include/drm/drm_sysfs.h b/include/drm/drm_sysfs.h new file mode 100644 index 000000000000..1d8e033fde67 --- /dev/null +++ b/include/drm/drm_sysfs.h | |||
@@ -0,0 +1,12 @@ | |||
1 | #ifndef _DRM_SYSFS_H_ | ||
2 | #define _DRM_SYSFS_H_ | ||
3 | |||
4 | /** | ||
5 | * This minimalistic include file is intended for users (read TTM) that | ||
6 | * don't want to include the full drmP.h file. | ||
7 | */ | ||
8 | |||
9 | extern int drm_class_device_register(struct device *dev); | ||
10 | extern void drm_class_device_unregister(struct device *dev); | ||
11 | |||
12 | #endif | ||
diff --git a/include/drm/radeon_drm.h b/include/drm/radeon_drm.h index 2ba61e18fc8b..3b9932ab1756 100644 --- a/include/drm/radeon_drm.h +++ b/include/drm/radeon_drm.h | |||
@@ -802,11 +802,12 @@ struct drm_radeon_gem_create { | |||
802 | uint32_t flags; | 802 | uint32_t flags; |
803 | }; | 803 | }; |
804 | 804 | ||
805 | #define RADEON_TILING_MACRO 0x1 | 805 | #define RADEON_TILING_MACRO 0x1 |
806 | #define RADEON_TILING_MICRO 0x2 | 806 | #define RADEON_TILING_MICRO 0x2 |
807 | #define RADEON_TILING_SWAP 0x4 | 807 | #define RADEON_TILING_SWAP_16BIT 0x4 |
808 | #define RADEON_TILING_SURFACE 0x8 /* this object requires a surface | 808 | #define RADEON_TILING_SWAP_32BIT 0x8 |
809 | * when mapped - i.e. front buffer */ | 809 | #define RADEON_TILING_SURFACE 0x10 /* this object requires a surface |
810 | * when mapped - i.e. front buffer */ | ||
810 | 811 | ||
811 | struct drm_radeon_gem_set_tiling { | 812 | struct drm_radeon_gem_set_tiling { |
812 | uint32_t handle; | 813 | uint32_t handle; |
@@ -899,6 +900,7 @@ struct drm_radeon_cs { | |||
899 | #define RADEON_INFO_DEVICE_ID 0x00 | 900 | #define RADEON_INFO_DEVICE_ID 0x00 |
900 | #define RADEON_INFO_NUM_GB_PIPES 0x01 | 901 | #define RADEON_INFO_NUM_GB_PIPES 0x01 |
901 | #define RADEON_INFO_NUM_Z_PIPES 0x02 | 902 | #define RADEON_INFO_NUM_Z_PIPES 0x02 |
903 | #define RADEON_INFO_ACCEL_WORKING 0x03 | ||
902 | 904 | ||
903 | struct drm_radeon_info { | 905 | struct drm_radeon_info { |
904 | uint32_t request; | 906 | uint32_t request; |
diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h index cd22ab4b495c..491146170522 100644 --- a/include/drm/ttm/ttm_bo_api.h +++ b/include/drm/ttm/ttm_bo_api.h | |||
@@ -155,6 +155,7 @@ struct ttm_buffer_object { | |||
155 | * Members constant at init. | 155 | * Members constant at init. |
156 | */ | 156 | */ |
157 | 157 | ||
158 | struct ttm_bo_global *glob; | ||
158 | struct ttm_bo_device *bdev; | 159 | struct ttm_bo_device *bdev; |
159 | unsigned long buffer_start; | 160 | unsigned long buffer_start; |
160 | enum ttm_bo_type type; | 161 | enum ttm_bo_type type; |
@@ -245,14 +246,15 @@ struct ttm_buffer_object { | |||
245 | * premapped region. | 246 | * premapped region. |
246 | */ | 247 | */ |
247 | 248 | ||
249 | #define TTM_BO_MAP_IOMEM_MASK 0x80 | ||
248 | struct ttm_bo_kmap_obj { | 250 | struct ttm_bo_kmap_obj { |
249 | void *virtual; | 251 | void *virtual; |
250 | struct page *page; | 252 | struct page *page; |
251 | enum { | 253 | enum { |
252 | ttm_bo_map_iomap, | 254 | ttm_bo_map_iomap = 1 | TTM_BO_MAP_IOMEM_MASK, |
253 | ttm_bo_map_vmap, | 255 | ttm_bo_map_vmap = 2, |
254 | ttm_bo_map_kmap, | 256 | ttm_bo_map_kmap = 3, |
255 | ttm_bo_map_premapped, | 257 | ttm_bo_map_premapped = 4 | TTM_BO_MAP_IOMEM_MASK, |
256 | } bo_kmap_type; | 258 | } bo_kmap_type; |
257 | }; | 259 | }; |
258 | 260 | ||
@@ -522,8 +524,7 @@ extern int ttm_bo_evict_mm(struct ttm_bo_device *bdev, unsigned mem_type); | |||
522 | static inline void *ttm_kmap_obj_virtual(struct ttm_bo_kmap_obj *map, | 524 | static inline void *ttm_kmap_obj_virtual(struct ttm_bo_kmap_obj *map, |
523 | bool *is_iomem) | 525 | bool *is_iomem) |
524 | { | 526 | { |
525 | *is_iomem = (map->bo_kmap_type == ttm_bo_map_iomap || | 527 | *is_iomem = !!(map->bo_kmap_type & TTM_BO_MAP_IOMEM_MASK); |
526 | map->bo_kmap_type == ttm_bo_map_premapped); | ||
527 | return map->virtual; | 528 | return map->virtual; |
528 | } | 529 | } |
529 | 530 | ||
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h index a68829db381a..e8cd6d20aed2 100644 --- a/include/drm/ttm/ttm_bo_driver.h +++ b/include/drm/ttm/ttm_bo_driver.h | |||
@@ -32,6 +32,7 @@ | |||
32 | 32 | ||
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 "drm_mm.h" | 36 | #include "drm_mm.h" |
36 | #include "linux/workqueue.h" | 37 | #include "linux/workqueue.h" |
37 | #include "linux/fs.h" | 38 | #include "linux/fs.h" |
@@ -161,7 +162,7 @@ struct ttm_tt { | |||
161 | long last_lomem_page; | 162 | long last_lomem_page; |
162 | uint32_t page_flags; | 163 | uint32_t page_flags; |
163 | unsigned long num_pages; | 164 | unsigned long num_pages; |
164 | struct ttm_bo_device *bdev; | 165 | struct ttm_bo_global *glob; |
165 | struct ttm_backend *be; | 166 | struct ttm_backend *be; |
166 | struct task_struct *tsk; | 167 | struct task_struct *tsk; |
167 | unsigned long start; | 168 | unsigned long start; |
@@ -364,24 +365,73 @@ struct ttm_bo_driver { | |||
364 | void (*fault_reserve_notify)(struct ttm_buffer_object *bo); | 365 | void (*fault_reserve_notify)(struct ttm_buffer_object *bo); |
365 | }; | 366 | }; |
366 | 367 | ||
367 | #define TTM_NUM_MEM_TYPES 8 | 368 | /** |
369 | * struct ttm_bo_global_ref - Argument to initialize a struct ttm_bo_global. | ||
370 | */ | ||
371 | |||
372 | struct ttm_bo_global_ref { | ||
373 | struct ttm_global_reference ref; | ||
374 | struct ttm_mem_global *mem_glob; | ||
375 | }; | ||
368 | 376 | ||
369 | #define TTM_BO_PRIV_FLAG_MOVING 0 /* Buffer object is moving and needs | ||
370 | idling before CPU mapping */ | ||
371 | #define TTM_BO_PRIV_FLAG_MAX 1 | ||
372 | /** | 377 | /** |
373 | * struct ttm_bo_device - Buffer object driver device-specific data. | 378 | * struct ttm_bo_global - Buffer object driver global data. |
374 | * | 379 | * |
375 | * @mem_glob: Pointer to a struct ttm_mem_global object for accounting. | 380 | * @mem_glob: Pointer to a struct ttm_mem_global object for accounting. |
376 | * @driver: Pointer to a struct ttm_bo_driver struct setup by the driver. | ||
377 | * @count: Current number of buffer object. | ||
378 | * @pages: Current number of pinned pages. | ||
379 | * @dummy_read_page: Pointer to a dummy page used for mapping requests | 381 | * @dummy_read_page: Pointer to a dummy page used for mapping requests |
380 | * of unpopulated pages. | 382 | * of unpopulated pages. |
381 | * @shrink: A shrink callback object used for buffre object swap. | 383 | * @shrink: A shrink callback object used for buffer object swap. |
382 | * @ttm_bo_extra_size: Extra size (sizeof(struct ttm_buffer_object) excluded) | 384 | * @ttm_bo_extra_size: Extra size (sizeof(struct ttm_buffer_object) excluded) |
383 | * used by a buffer object. This is excluding page arrays and backing pages. | 385 | * used by a buffer object. This is excluding page arrays and backing pages. |
384 | * @ttm_bo_size: This is @ttm_bo_extra_size + sizeof(struct ttm_buffer_object). | 386 | * @ttm_bo_size: This is @ttm_bo_extra_size + sizeof(struct ttm_buffer_object). |
387 | * @device_list_mutex: Mutex protecting the device list. | ||
388 | * This mutex is held while traversing the device list for pm options. | ||
389 | * @lru_lock: Spinlock protecting the bo subsystem lru lists. | ||
390 | * @device_list: List of buffer object devices. | ||
391 | * @swap_lru: Lru list of buffer objects used for swapping. | ||
392 | */ | ||
393 | |||
394 | struct ttm_bo_global { | ||
395 | |||
396 | /** | ||
397 | * Constant after init. | ||
398 | */ | ||
399 | |||
400 | struct kobject kobj; | ||
401 | struct ttm_mem_global *mem_glob; | ||
402 | struct page *dummy_read_page; | ||
403 | struct ttm_mem_shrink shrink; | ||
404 | size_t ttm_bo_extra_size; | ||
405 | size_t ttm_bo_size; | ||
406 | struct mutex device_list_mutex; | ||
407 | spinlock_t lru_lock; | ||
408 | |||
409 | /** | ||
410 | * Protected by device_list_mutex. | ||
411 | */ | ||
412 | struct list_head device_list; | ||
413 | |||
414 | /** | ||
415 | * Protected by the lru_lock. | ||
416 | */ | ||
417 | struct list_head swap_lru; | ||
418 | |||
419 | /** | ||
420 | * Internal protection. | ||
421 | */ | ||
422 | atomic_t bo_count; | ||
423 | }; | ||
424 | |||
425 | |||
426 | #define TTM_NUM_MEM_TYPES 8 | ||
427 | |||
428 | #define TTM_BO_PRIV_FLAG_MOVING 0 /* Buffer object is moving and needs | ||
429 | idling before CPU mapping */ | ||
430 | #define TTM_BO_PRIV_FLAG_MAX 1 | ||
431 | /** | ||
432 | * struct ttm_bo_device - Buffer object driver device-specific data. | ||
433 | * | ||
434 | * @driver: Pointer to a struct ttm_bo_driver struct setup by the driver. | ||
385 | * @man: An array of mem_type_managers. | 435 | * @man: An array of mem_type_managers. |
386 | * @addr_space_mm: Range manager for the device address space. | 436 | * @addr_space_mm: Range manager for the device address space. |
387 | * lru_lock: Spinlock that protects the buffer+device lru lists and | 437 | * lru_lock: Spinlock that protects the buffer+device lru lists and |
@@ -399,32 +449,21 @@ struct ttm_bo_device { | |||
399 | /* | 449 | /* |
400 | * Constant after bo device init / atomic. | 450 | * Constant after bo device init / atomic. |
401 | */ | 451 | */ |
402 | 452 | struct list_head device_list; | |
403 | struct ttm_mem_global *mem_glob; | 453 | struct ttm_bo_global *glob; |
404 | struct ttm_bo_driver *driver; | 454 | struct ttm_bo_driver *driver; |
405 | struct page *dummy_read_page; | ||
406 | struct ttm_mem_shrink shrink; | ||
407 | |||
408 | size_t ttm_bo_extra_size; | ||
409 | size_t ttm_bo_size; | ||
410 | |||
411 | rwlock_t vm_lock; | 455 | rwlock_t vm_lock; |
456 | struct ttm_mem_type_manager man[TTM_NUM_MEM_TYPES]; | ||
412 | /* | 457 | /* |
413 | * Protected by the vm lock. | 458 | * Protected by the vm lock. |
414 | */ | 459 | */ |
415 | struct ttm_mem_type_manager man[TTM_NUM_MEM_TYPES]; | ||
416 | struct rb_root addr_space_rb; | 460 | struct rb_root addr_space_rb; |
417 | struct drm_mm addr_space_mm; | 461 | struct drm_mm addr_space_mm; |
418 | 462 | ||
419 | /* | 463 | /* |
420 | * Might want to change this to one lock per manager. | 464 | * Protected by the global:lru lock. |
421 | */ | ||
422 | spinlock_t lru_lock; | ||
423 | /* | ||
424 | * Protected by the lru lock. | ||
425 | */ | 465 | */ |
426 | struct list_head ddestroy; | 466 | struct list_head ddestroy; |
427 | struct list_head swap_lru; | ||
428 | 467 | ||
429 | /* | 468 | /* |
430 | * Protected by load / firstopen / lastclose /unload sync. | 469 | * Protected by load / firstopen / lastclose /unload sync. |
@@ -640,6 +679,9 @@ extern int ttm_bo_pci_offset(struct ttm_bo_device *bdev, | |||
640 | unsigned long *bus_offset, | 679 | unsigned long *bus_offset, |
641 | unsigned long *bus_size); | 680 | unsigned long *bus_size); |
642 | 681 | ||
682 | extern void ttm_bo_global_release(struct ttm_global_reference *ref); | ||
683 | extern int ttm_bo_global_init(struct ttm_global_reference *ref); | ||
684 | |||
643 | extern int ttm_bo_device_release(struct ttm_bo_device *bdev); | 685 | extern int ttm_bo_device_release(struct ttm_bo_device *bdev); |
644 | 686 | ||
645 | /** | 687 | /** |
@@ -657,7 +699,7 @@ extern int ttm_bo_device_release(struct ttm_bo_device *bdev); | |||
657 | * !0: Failure. | 699 | * !0: Failure. |
658 | */ | 700 | */ |
659 | extern int ttm_bo_device_init(struct ttm_bo_device *bdev, | 701 | extern int ttm_bo_device_init(struct ttm_bo_device *bdev, |
660 | struct ttm_mem_global *mem_glob, | 702 | struct ttm_bo_global *glob, |
661 | struct ttm_bo_driver *driver, | 703 | struct ttm_bo_driver *driver, |
662 | uint64_t file_page_offset, bool need_dma32); | 704 | uint64_t file_page_offset, bool need_dma32); |
663 | 705 | ||
diff --git a/include/drm/ttm/ttm_memory.h b/include/drm/ttm/ttm_memory.h index d8b8f042c4f1..6983a7cf4da4 100644 --- a/include/drm/ttm/ttm_memory.h +++ b/include/drm/ttm/ttm_memory.h | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/spinlock.h> | 32 | #include <linux/spinlock.h> |
33 | #include <linux/wait.h> | 33 | #include <linux/wait.h> |
34 | #include <linux/errno.h> | 34 | #include <linux/errno.h> |
35 | #include <linux/kobject.h> | ||
35 | 36 | ||
36 | /** | 37 | /** |
37 | * struct ttm_mem_shrink - callback to shrink TTM memory usage. | 38 | * struct ttm_mem_shrink - callback to shrink TTM memory usage. |
@@ -60,34 +61,33 @@ struct ttm_mem_shrink { | |||
60 | * @queue: Wait queue for processes suspended waiting for memory. | 61 | * @queue: Wait queue for processes suspended waiting for memory. |
61 | * @lock: Lock to protect the @shrink - and the memory accounting members, | 62 | * @lock: Lock to protect the @shrink - and the memory accounting members, |
62 | * that is, essentially the whole structure with some exceptions. | 63 | * that is, essentially the whole structure with some exceptions. |
63 | * @emer_memory: Lowmem memory limit available for root. | 64 | * @zones: Array of pointers to accounting zones. |
64 | * @max_memory: Lowmem memory limit available for non-root. | 65 | * @num_zones: Number of populated entries in the @zones array. |
65 | * @swap_limit: Lowmem memory limit where the shrink workqueue kicks in. | 66 | * @zone_kernel: Pointer to the kernel zone. |
66 | * @used_memory: Currently used lowmem memory. | 67 | * @zone_highmem: Pointer to the highmem zone if there is one. |
67 | * @used_total_memory: Currently used total (lowmem + highmem) memory. | 68 | * @zone_dma32: Pointer to the dma32 zone if there is one. |
68 | * @total_memory_swap_limit: Total memory limit where the shrink workqueue | ||
69 | * kicks in. | ||
70 | * @max_total_memory: Total memory available to non-root processes. | ||
71 | * @emer_total_memory: Total memory available to root processes. | ||
72 | * | 69 | * |
73 | * Note that this structure is not per device. It should be global for all | 70 | * Note that this structure is not per device. It should be global for all |
74 | * graphics devices. | 71 | * graphics devices. |
75 | */ | 72 | */ |
76 | 73 | ||
74 | #define TTM_MEM_MAX_ZONES 2 | ||
75 | struct ttm_mem_zone; | ||
77 | struct ttm_mem_global { | 76 | struct ttm_mem_global { |
77 | struct kobject kobj; | ||
78 | struct ttm_mem_shrink *shrink; | 78 | struct ttm_mem_shrink *shrink; |
79 | struct workqueue_struct *swap_queue; | 79 | struct workqueue_struct *swap_queue; |
80 | struct work_struct work; | 80 | struct work_struct work; |
81 | wait_queue_head_t queue; | 81 | wait_queue_head_t queue; |
82 | spinlock_t lock; | 82 | spinlock_t lock; |
83 | uint64_t emer_memory; | 83 | struct ttm_mem_zone *zones[TTM_MEM_MAX_ZONES]; |
84 | uint64_t max_memory; | 84 | unsigned int num_zones; |
85 | uint64_t swap_limit; | 85 | struct ttm_mem_zone *zone_kernel; |
86 | uint64_t used_memory; | 86 | #ifdef CONFIG_HIGHMEM |
87 | uint64_t used_total_memory; | 87 | struct ttm_mem_zone *zone_highmem; |
88 | uint64_t total_memory_swap_limit; | 88 | #else |
89 | uint64_t max_total_memory; | 89 | struct ttm_mem_zone *zone_dma32; |
90 | uint64_t emer_total_memory; | 90 | #endif |
91 | }; | 91 | }; |
92 | 92 | ||
93 | /** | 93 | /** |
@@ -146,8 +146,13 @@ static inline void ttm_mem_unregister_shrink(struct ttm_mem_global *glob, | |||
146 | extern int ttm_mem_global_init(struct ttm_mem_global *glob); | 146 | extern int ttm_mem_global_init(struct ttm_mem_global *glob); |
147 | extern void ttm_mem_global_release(struct ttm_mem_global *glob); | 147 | extern void ttm_mem_global_release(struct ttm_mem_global *glob); |
148 | extern int ttm_mem_global_alloc(struct ttm_mem_global *glob, uint64_t memory, | 148 | extern int ttm_mem_global_alloc(struct ttm_mem_global *glob, uint64_t memory, |
149 | bool no_wait, bool interruptible, bool himem); | 149 | bool no_wait, bool interruptible); |
150 | extern void ttm_mem_global_free(struct ttm_mem_global *glob, | 150 | extern void ttm_mem_global_free(struct ttm_mem_global *glob, |
151 | uint64_t amount, bool himem); | 151 | uint64_t amount); |
152 | extern int ttm_mem_global_alloc_page(struct ttm_mem_global *glob, | ||
153 | struct page *page, | ||
154 | bool no_wait, bool interruptible); | ||
155 | extern void ttm_mem_global_free_page(struct ttm_mem_global *glob, | ||
156 | struct page *page); | ||
152 | extern size_t ttm_round_pot(size_t size); | 157 | extern size_t ttm_round_pot(size_t size); |
153 | #endif | 158 | #endif |
diff --git a/include/drm/ttm/ttm_module.h b/include/drm/ttm/ttm_module.h index d1d433834e4f..cf416aee19af 100644 --- a/include/drm/ttm/ttm_module.h +++ b/include/drm/ttm/ttm_module.h | |||
@@ -32,6 +32,7 @@ | |||
32 | #define _TTM_MODULE_H_ | 32 | #define _TTM_MODULE_H_ |
33 | 33 | ||
34 | #include <linux/kernel.h> | 34 | #include <linux/kernel.h> |
35 | struct kobject; | ||
35 | 36 | ||
36 | #define TTM_PFX "[TTM] " | 37 | #define TTM_PFX "[TTM] " |
37 | 38 | ||
@@ -54,5 +55,6 @@ extern void ttm_global_init(void); | |||
54 | extern void ttm_global_release(void); | 55 | extern void ttm_global_release(void); |
55 | extern int ttm_global_item_ref(struct ttm_global_reference *ref); | 56 | extern int ttm_global_item_ref(struct ttm_global_reference *ref); |
56 | extern void ttm_global_item_unref(struct ttm_global_reference *ref); | 57 | extern void ttm_global_item_unref(struct ttm_global_reference *ref); |
58 | extern struct kobject *ttm_get_kobj(void); | ||
57 | 59 | ||
58 | #endif /* _TTM_MODULE_H_ */ | 60 | #endif /* _TTM_MODULE_H_ */ |