diff options
author | Dave Airlie <airlied@redhat.com> | 2015-04-15 18:34:24 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2015-04-15 18:34:24 -0400 |
commit | 4a11248856933f33ca061ed55470ea7e1783b40b (patch) | |
tree | f8dab99fc365d6b1270b2ed3b3fdc7987e0e003a /include/drm | |
parent | 52139bdea1558e854123d7a07e7648f5a8c77a5c (diff) | |
parent | 2b1193d5287004edfbf89407149a3159656f47f1 (diff) |
Merge tag 'topic/drm-misc-2015-04-15' of git://anongit.freedesktop.org/drm-intel into drm-next
One more drm-misch pull for 4.1 with mostly simple stuff and boring
refactoring. Even the cursor fix from Matt is just to make a really anal
igt happy.
* tag 'topic/drm-misc-2015-04-15' of git://anongit.freedesktop.org/drm-intel:
drm: fix trivial typo mistake
drm: Make integer overflow checking cover universal cursor updates (v2)
drm: make crtc/encoder/connector/plane helper_private a const pointer
drm/armada: constify struct drm_encoder_helper_funcs pointer
drm/radeon: constify more struct drm_*_helper funcs pointers
drm/edid: add #defines for ELD versions
drm/atomic: Add for_each_{connector,crtc,plane}_in_state helper macros
drm: Use kref_put_mutex in drm_gem_object_unreference_unlocked
drm/drm: constify all struct drm_*_helper funcs pointers
drm/qxl: constify all struct drm_*_helper funcs pointers
drm/nouveau: constify all struct drm_*_helper funcs pointers
drm/radeon: constify all struct drm_*_helper funcs pointers
drm/gma500: constify all struct drm_*_helper funcs pointers
drm/mgag200: constify all struct drm_*_helper funcs pointers
drm/exynos: constify all struct drm_*_helper funcs pointers
drm: Fix some typos
Diffstat (limited to 'include/drm')
-rw-r--r-- | include/drm/drm_atomic.h | 24 | ||||
-rw-r--r-- | include/drm/drm_crtc.h | 10 | ||||
-rw-r--r-- | include/drm/drm_crtc_helper.h | 6 | ||||
-rw-r--r-- | include/drm/drm_edid.h | 2 | ||||
-rw-r--r-- | include/drm/drm_gem.h | 14 | ||||
-rw-r--r-- | include/drm/drm_plane_helper.h | 2 |
6 files changed, 43 insertions, 15 deletions
diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h index 51168a8b723a..c157103492b0 100644 --- a/include/drm/drm_atomic.h +++ b/include/drm/drm_atomic.h | |||
@@ -75,4 +75,28 @@ int __must_check drm_atomic_check_only(struct drm_atomic_state *state); | |||
75 | int __must_check drm_atomic_commit(struct drm_atomic_state *state); | 75 | int __must_check drm_atomic_commit(struct drm_atomic_state *state); |
76 | int __must_check drm_atomic_async_commit(struct drm_atomic_state *state); | 76 | int __must_check drm_atomic_async_commit(struct drm_atomic_state *state); |
77 | 77 | ||
78 | #define for_each_connector_in_state(state, connector, connector_state, __i) \ | ||
79 | for ((__i) = 0; \ | ||
80 | (connector) = (state)->connectors[__i], \ | ||
81 | (connector_state) = (state)->connector_states[__i], \ | ||
82 | (__i) < (state)->num_connector; \ | ||
83 | (__i)++) \ | ||
84 | if (connector) | ||
85 | |||
86 | #define for_each_crtc_in_state(state, crtc, crtc_state, __i) \ | ||
87 | for ((__i) = 0; \ | ||
88 | (crtc) = (state)->crtcs[__i], \ | ||
89 | (crtc_state) = (state)->crtc_states[__i], \ | ||
90 | (__i) < (state)->dev->mode_config.num_crtc; \ | ||
91 | (__i)++) \ | ||
92 | if (crtc_state) | ||
93 | |||
94 | #define for_each_plane_in_state(state, plane, plane_state, __i) \ | ||
95 | for ((__i) = 0; \ | ||
96 | (plane) = (state)->planes[__i], \ | ||
97 | (plane_state) = (state)->plane_states[__i], \ | ||
98 | (__i) < (state)->dev->mode_config.num_total_plane; \ | ||
99 | (__i)++) \ | ||
100 | if (plane_state) | ||
101 | |||
78 | #endif /* DRM_ATOMIC_H_ */ | 102 | #endif /* DRM_ATOMIC_H_ */ |
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index 2e80ad1aea84..ca71c03143d1 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h | |||
@@ -466,7 +466,7 @@ struct drm_crtc { | |||
466 | int framedur_ns, linedur_ns, pixeldur_ns; | 466 | int framedur_ns, linedur_ns, pixeldur_ns; |
467 | 467 | ||
468 | /* if you are using the helper */ | 468 | /* if you are using the helper */ |
469 | void *helper_private; | 469 | const void *helper_private; |
470 | 470 | ||
471 | struct drm_object_properties properties; | 471 | struct drm_object_properties properties; |
472 | 472 | ||
@@ -596,7 +596,7 @@ struct drm_encoder { | |||
596 | struct drm_crtc *crtc; | 596 | struct drm_crtc *crtc; |
597 | struct drm_bridge *bridge; | 597 | struct drm_bridge *bridge; |
598 | const struct drm_encoder_funcs *funcs; | 598 | const struct drm_encoder_funcs *funcs; |
599 | void *helper_private; | 599 | const void *helper_private; |
600 | }; | 600 | }; |
601 | 601 | ||
602 | /* should we poll this connector for connects and disconnects */ | 602 | /* should we poll this connector for connects and disconnects */ |
@@ -700,7 +700,7 @@ struct drm_connector { | |||
700 | /* requested DPMS state */ | 700 | /* requested DPMS state */ |
701 | int dpms; | 701 | int dpms; |
702 | 702 | ||
703 | void *helper_private; | 703 | const void *helper_private; |
704 | 704 | ||
705 | /* forced on connector */ | 705 | /* forced on connector */ |
706 | struct drm_cmdline_mode cmdline_mode; | 706 | struct drm_cmdline_mode cmdline_mode; |
@@ -863,7 +863,7 @@ struct drm_plane { | |||
863 | 863 | ||
864 | enum drm_plane_type type; | 864 | enum drm_plane_type type; |
865 | 865 | ||
866 | void *helper_private; | 866 | const void *helper_private; |
867 | 867 | ||
868 | struct drm_plane_state *state; | 868 | struct drm_plane_state *state; |
869 | }; | 869 | }; |
@@ -974,7 +974,7 @@ struct drm_mode_set { | |||
974 | * struct drm_mode_config_funcs - basic driver provided mode setting functions | 974 | * struct drm_mode_config_funcs - basic driver provided mode setting functions |
975 | * @fb_create: create a new framebuffer object | 975 | * @fb_create: create a new framebuffer object |
976 | * @output_poll_changed: function to handle output configuration changes | 976 | * @output_poll_changed: function to handle output configuration changes |
977 | * @atomic_check: check whether a give atomic state update is possible | 977 | * @atomic_check: check whether a given atomic state update is possible |
978 | * @atomic_commit: commit an atomic state update previously verified with | 978 | * @atomic_commit: commit an atomic state update previously verified with |
979 | * atomic_check() | 979 | * atomic_check() |
980 | * | 980 | * |
diff --git a/include/drm/drm_crtc_helper.h b/include/drm/drm_crtc_helper.h index 92d5135b55d2..c8fc187061de 100644 --- a/include/drm/drm_crtc_helper.h +++ b/include/drm/drm_crtc_helper.h | |||
@@ -197,19 +197,19 @@ extern void drm_helper_mode_fill_fb_struct(struct drm_framebuffer *fb, | |||
197 | static inline void drm_crtc_helper_add(struct drm_crtc *crtc, | 197 | static inline void drm_crtc_helper_add(struct drm_crtc *crtc, |
198 | const struct drm_crtc_helper_funcs *funcs) | 198 | const struct drm_crtc_helper_funcs *funcs) |
199 | { | 199 | { |
200 | crtc->helper_private = (void *)funcs; | 200 | crtc->helper_private = funcs; |
201 | } | 201 | } |
202 | 202 | ||
203 | static inline void drm_encoder_helper_add(struct drm_encoder *encoder, | 203 | static inline void drm_encoder_helper_add(struct drm_encoder *encoder, |
204 | const struct drm_encoder_helper_funcs *funcs) | 204 | const struct drm_encoder_helper_funcs *funcs) |
205 | { | 205 | { |
206 | encoder->helper_private = (void *)funcs; | 206 | encoder->helper_private = funcs; |
207 | } | 207 | } |
208 | 208 | ||
209 | static inline void drm_connector_helper_add(struct drm_connector *connector, | 209 | static inline void drm_connector_helper_add(struct drm_connector *connector, |
210 | const struct drm_connector_helper_funcs *funcs) | 210 | const struct drm_connector_helper_funcs *funcs) |
211 | { | 211 | { |
212 | connector->helper_private = (void *)funcs; | 212 | connector->helper_private = funcs; |
213 | } | 213 | } |
214 | 214 | ||
215 | extern void drm_helper_resume_force_mode(struct drm_device *dev); | 215 | extern void drm_helper_resume_force_mode(struct drm_device *dev); |
diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h index 87d85e81d3a7..799050198323 100644 --- a/include/drm/drm_edid.h +++ b/include/drm/drm_edid.h | |||
@@ -215,6 +215,8 @@ struct detailed_timing { | |||
215 | #define DRM_ELD_VER 0 | 215 | #define DRM_ELD_VER 0 |
216 | # define DRM_ELD_VER_SHIFT 3 | 216 | # define DRM_ELD_VER_SHIFT 3 |
217 | # define DRM_ELD_VER_MASK (0x1f << 3) | 217 | # define DRM_ELD_VER_MASK (0x1f << 3) |
218 | # define DRM_ELD_VER_CEA861D (2 << 3) /* supports 861D or below */ | ||
219 | # define DRM_ELD_VER_CANNED (0x1f << 3) | ||
218 | 220 | ||
219 | #define DRM_ELD_BASELINE_ELD_LEN 2 /* in dwords! */ | 221 | #define DRM_ELD_BASELINE_ELD_LEN 2 /* in dwords! */ |
220 | 222 | ||
diff --git a/include/drm/drm_gem.h b/include/drm/drm_gem.h index 1e6ae1458f7a..7a592d7e398b 100644 --- a/include/drm/drm_gem.h +++ b/include/drm/drm_gem.h | |||
@@ -149,14 +149,16 @@ drm_gem_object_unreference(struct drm_gem_object *obj) | |||
149 | static inline void | 149 | static inline void |
150 | drm_gem_object_unreference_unlocked(struct drm_gem_object *obj) | 150 | drm_gem_object_unreference_unlocked(struct drm_gem_object *obj) |
151 | { | 151 | { |
152 | if (obj && !atomic_add_unless(&obj->refcount.refcount, -1, 1)) { | 152 | struct drm_device *dev; |
153 | struct drm_device *dev = obj->dev; | 153 | |
154 | if (!obj) | ||
155 | return; | ||
154 | 156 | ||
155 | mutex_lock(&dev->struct_mutex); | 157 | dev = obj->dev; |
156 | if (likely(atomic_dec_and_test(&obj->refcount.refcount))) | 158 | if (kref_put_mutex(&obj->refcount, drm_gem_object_free, &dev->struct_mutex)) |
157 | drm_gem_object_free(&obj->refcount); | ||
158 | mutex_unlock(&dev->struct_mutex); | 159 | mutex_unlock(&dev->struct_mutex); |
159 | } | 160 | else |
161 | might_lock(&dev->struct_mutex); | ||
160 | } | 162 | } |
161 | 163 | ||
162 | int drm_gem_handle_create(struct drm_file *file_priv, | 164 | int drm_gem_handle_create(struct drm_file *file_priv, |
diff --git a/include/drm/drm_plane_helper.h b/include/drm/drm_plane_helper.h index e48157a5a59c..96e16283afb9 100644 --- a/include/drm/drm_plane_helper.h +++ b/include/drm/drm_plane_helper.h | |||
@@ -76,7 +76,7 @@ struct drm_plane_helper_funcs { | |||
76 | static inline void drm_plane_helper_add(struct drm_plane *plane, | 76 | static inline void drm_plane_helper_add(struct drm_plane *plane, |
77 | const struct drm_plane_helper_funcs *funcs) | 77 | const struct drm_plane_helper_funcs *funcs) |
78 | { | 78 | { |
79 | plane->helper_private = (void *)funcs; | 79 | plane->helper_private = funcs; |
80 | } | 80 | } |
81 | 81 | ||
82 | extern int drm_plane_helper_check_update(struct drm_plane *plane, | 82 | extern int drm_plane_helper_check_update(struct drm_plane *plane, |