aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2014-12-01 17:59:34 -0500
committerDave Airlie <airlied@redhat.com>2014-12-01 17:59:34 -0500
commit9be23ae4350bfd71c0cc2ea3494671ee90e5603b (patch)
tree4233411cc12265c675125d99fb0ea03c9172423b /include
parent5a0e9d72136d90f5456bcc465d318f49d3f45838 (diff)
parente5b5341c28c66a122982d3d8822a4f9a0938f923 (diff)
Merge tag 'topic/core-stuff-2014-11-28' of git://anongit.freedesktop.org/drm-intel into drm-next
So here's a pile of atomic fixes and improvements from various people. There's still more patches in-flight, so I think I'll keep collecting them in a separate branch. * tag 'topic/core-stuff-2014-11-28' of git://anongit.freedesktop.org/drm-intel: drm/atomic: clear plane's CRTC and FB when shutting down drm: Handle atomic state properly in kms getfoo ioctl drm: use mode_object_find helpers drm: fix indentation drm/msm: switch to atomic-helpers iterator macros drm/atomic: add plane iterator macros drm/atomic: track bitmask of planes attached to crtc drm: Free atomic state during cleanup drm: Make drm_atomic.h standalone includible drm: Make drm_atomic_helper.h standalone includible drm/plane: Add missing kerneldoc drm/plane: Pass old state to ->atomic_update() drm/atomic_helper: Cope with plane->crtc == NULL in disable helper drm/atomic: Drop per-plane locking TODO drm/atomic-helper: Skip vblank waits for unchanged fbs drm: Document that drm_dev_alloc doesn't need a parent
Diffstat (limited to 'include')
-rw-r--r--include/drm/drmP.h2
-rw-r--r--include/drm/drm_atomic.h6
-rw-r--r--include/drm/drm_atomic_helper.h26
-rw-r--r--include/drm/drm_crtc.h27
-rw-r--r--include/drm/drm_plane_helper.h7
5 files changed, 61 insertions, 7 deletions
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index be776fb2db18..8ba35c622e22 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -809,7 +809,7 @@ struct drm_device {
809 struct drm_local_map *agp_buffer_map; 809 struct drm_local_map *agp_buffer_map;
810 unsigned int agp_buffer_token; 810 unsigned int agp_buffer_token;
811 811
812 struct drm_mode_config mode_config; /**< Current mode config */ 812 struct drm_mode_config mode_config; /**< Current mode config */
813 813
814 /** \name GEM information */ 814 /** \name GEM information */
815 /*@{ */ 815 /*@{ */
diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h
index 9d919168bc11..ad2229574dd9 100644
--- a/include/drm/drm_atomic.h
+++ b/include/drm/drm_atomic.h
@@ -28,6 +28,8 @@
28#ifndef DRM_ATOMIC_H_ 28#ifndef DRM_ATOMIC_H_
29#define DRM_ATOMIC_H_ 29#define DRM_ATOMIC_H_
30 30
31#include <drm/drm_crtc.h>
32
31struct drm_atomic_state * __must_check 33struct drm_atomic_state * __must_check
32drm_atomic_state_alloc(struct drm_device *dev); 34drm_atomic_state_alloc(struct drm_device *dev);
33void drm_atomic_state_clear(struct drm_atomic_state *state); 35void drm_atomic_state_clear(struct drm_atomic_state *state);
@@ -44,8 +46,8 @@ drm_atomic_get_connector_state(struct drm_atomic_state *state,
44 struct drm_connector *connector); 46 struct drm_connector *connector);
45 47
46int __must_check 48int __must_check
47drm_atomic_set_crtc_for_plane(struct drm_plane_state *plane_state, 49drm_atomic_set_crtc_for_plane(struct drm_atomic_state *state,
48 struct drm_crtc *crtc); 50 struct drm_plane *plane, struct drm_crtc *crtc);
49void drm_atomic_set_fb_for_plane(struct drm_plane_state *plane_state, 51void drm_atomic_set_fb_for_plane(struct drm_plane_state *plane_state,
50 struct drm_framebuffer *fb); 52 struct drm_framebuffer *fb);
51int __must_check 53int __must_check
diff --git a/include/drm/drm_atomic_helper.h b/include/drm/drm_atomic_helper.h
index 64b4e91b93bc..f956b413311e 100644
--- a/include/drm/drm_atomic_helper.h
+++ b/include/drm/drm_atomic_helper.h
@@ -28,6 +28,8 @@
28#ifndef DRM_ATOMIC_HELPER_H_ 28#ifndef DRM_ATOMIC_HELPER_H_
29#define DRM_ATOMIC_HELPER_H_ 29#define DRM_ATOMIC_HELPER_H_
30 30
31#include <drm/drm_crtc.h>
32
31int drm_atomic_helper_check(struct drm_device *dev, 33int drm_atomic_helper_check(struct drm_device *dev,
32 struct drm_atomic_state *state); 34 struct drm_atomic_state *state);
33int drm_atomic_helper_commit(struct drm_device *dev, 35int drm_atomic_helper_commit(struct drm_device *dev,
@@ -96,5 +98,29 @@ drm_atomic_helper_connector_duplicate_state(struct drm_connector *connector);
96void drm_atomic_helper_connector_destroy_state(struct drm_connector *connector, 98void drm_atomic_helper_connector_destroy_state(struct drm_connector *connector,
97 struct drm_connector_state *state); 99 struct drm_connector_state *state);
98 100
101/**
102 * drm_atomic_crtc_for_each_plane - iterate over planes currently attached to CRTC
103 * @plane: the loop cursor
104 * @crtc: the crtc whose planes are iterated
105 *
106 * This iterates over the current state, useful (for example) when applying
107 * atomic state after it has been checked and swapped. To iterate over the
108 * planes which *will* be attached (for ->atomic_check()) see
109 * drm_crtc_for_each_pending_plane()
110 */
111#define drm_atomic_crtc_for_each_plane(plane, crtc) \
112 drm_for_each_plane_mask(plane, (crtc)->dev, (crtc)->state->plane_mask)
113
114/**
115 * drm_crtc_atomic_state_for_each_plane - iterate over attached planes in new state
116 * @plane: the loop cursor
117 * @crtc_state: the incoming crtc-state
118 *
119 * Similar to drm_crtc_for_each_plane(), but iterates the planes that will be
120 * attached if the specified state is applied. Useful during (for example)
121 * ->atomic_check() operations, to validate the incoming state
122 */
123#define drm_atomic_crtc_state_for_each_plane(plane, crtc_state) \
124 drm_for_each_plane_mask(plane, (crtc_state)->state->dev, (crtc_state)->plane_mask)
99 125
100#endif /* DRM_ATOMIC_HELPER_H_ */ 126#endif /* DRM_ATOMIC_HELPER_H_ */
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index b459e8fbbc25..dd2c16e43333 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -231,6 +231,7 @@ struct drm_atomic_state;
231 * struct drm_crtc_state - mutable CRTC state 231 * struct drm_crtc_state - mutable CRTC state
232 * @enable: whether the CRTC should be enabled, gates all other state 232 * @enable: whether the CRTC should be enabled, gates all other state
233 * @mode_changed: for use by helpers and drivers when computing state updates 233 * @mode_changed: for use by helpers and drivers when computing state updates
234 * @plane_mask: bitmask of (1 << drm_plane_index(plane)) of attached planes
234 * @last_vblank_count: for helpers and drivers to capture the vblank of the 235 * @last_vblank_count: for helpers and drivers to capture the vblank of the
235 * update to ensure framebuffer cleanup isn't done too early 236 * update to ensure framebuffer cleanup isn't done too early
236 * @planes_changed: for use by helpers and drivers when computing state updates 237 * @planes_changed: for use by helpers and drivers when computing state updates
@@ -247,6 +248,13 @@ struct drm_crtc_state {
247 bool planes_changed : 1; 248 bool planes_changed : 1;
248 bool mode_changed : 1; 249 bool mode_changed : 1;
249 250
251 /* attached planes bitmask:
252 * WARNING: transitional helpers do not maintain plane_mask so
253 * drivers not converted over to atomic helpers should not rely
254 * on plane_mask being accurate!
255 */
256 u32 plane_mask;
257
250 /* last_vblank_count: for vblank waits before cleanup */ 258 /* last_vblank_count: for vblank waits before cleanup */
251 u32 last_vblank_count; 259 u32 last_vblank_count;
252 260
@@ -438,7 +446,7 @@ struct drm_crtc {
438 * @state: backpointer to global drm_atomic_state 446 * @state: backpointer to global drm_atomic_state
439 */ 447 */
440struct drm_connector_state { 448struct drm_connector_state {
441 struct drm_crtc *crtc; 449 struct drm_crtc *crtc; /* do not write directly, use drm_atomic_set_crtc_for_connector() */
442 450
443 struct drm_encoder *best_encoder; 451 struct drm_encoder *best_encoder;
444 452
@@ -673,8 +681,8 @@ struct drm_connector {
673 * @state: backpointer to global drm_atomic_state 681 * @state: backpointer to global drm_atomic_state
674 */ 682 */
675struct drm_plane_state { 683struct drm_plane_state {
676 struct drm_crtc *crtc; 684 struct drm_crtc *crtc; /* do not write directly, use drm_atomic_set_crtc_for_plane() */
677 struct drm_framebuffer *fb; 685 struct drm_framebuffer *fb; /* do not write directly, use drm_atomic_set_fb_for_plane() */
678 struct fence *fence; 686 struct fence *fence;
679 687
680 /* Signed dest location allows it to be partially off screen */ 688 /* Signed dest location allows it to be partially off screen */
@@ -1054,6 +1062,19 @@ struct drm_mode_config {
1054 uint32_t cursor_width, cursor_height; 1062 uint32_t cursor_width, cursor_height;
1055}; 1063};
1056 1064
1065/**
1066 * drm_for_each_plane_mask - iterate over planes specified by bitmask
1067 * @plane: the loop cursor
1068 * @dev: the DRM device
1069 * @plane_mask: bitmask of plane indices
1070 *
1071 * Iterate over all planes specified by bitmask.
1072 */
1073#define drm_for_each_plane_mask(plane, dev, plane_mask) \
1074 list_for_each_entry((plane), &(dev)->mode_config.plane_list, head) \
1075 if ((plane_mask) & (1 << drm_plane_index(plane)))
1076
1077
1057#define obj_to_crtc(x) container_of(x, struct drm_crtc, base) 1078#define obj_to_crtc(x) container_of(x, struct drm_crtc, base)
1058#define obj_to_connector(x) container_of(x, struct drm_connector, base) 1079#define obj_to_connector(x) container_of(x, struct drm_connector, base)
1059#define obj_to_encoder(x) container_of(x, struct drm_encoder, base) 1080#define obj_to_encoder(x) container_of(x, struct drm_encoder, base)
diff --git a/include/drm/drm_plane_helper.h b/include/drm/drm_plane_helper.h
index c48f14d88690..a185392cafeb 100644
--- a/include/drm/drm_plane_helper.h
+++ b/include/drm/drm_plane_helper.h
@@ -49,6 +49,10 @@ extern int drm_crtc_init(struct drm_device *dev,
49 49
50/** 50/**
51 * drm_plane_helper_funcs - helper operations for CRTCs 51 * drm_plane_helper_funcs - helper operations for CRTCs
52 * @prepare_fb: prepare a framebuffer for use by the plane
53 * @cleanup_fb: cleanup a framebuffer when it's no longer used by the plane
54 * @atomic_check: check that a given atomic state is valid and can be applied
55 * @atomic_update: apply an atomic state to the plane
52 * 56 *
53 * The helper operations are called by the mid-layer CRTC helper. 57 * The helper operations are called by the mid-layer CRTC helper.
54 */ 58 */
@@ -60,7 +64,8 @@ struct drm_plane_helper_funcs {
60 64
61 int (*atomic_check)(struct drm_plane *plane, 65 int (*atomic_check)(struct drm_plane *plane,
62 struct drm_plane_state *state); 66 struct drm_plane_state *state);
63 void (*atomic_update)(struct drm_plane *plane); 67 void (*atomic_update)(struct drm_plane *plane,
68 struct drm_plane_state *old_state);
64}; 69};
65 70
66static inline void drm_plane_helper_add(struct drm_plane *plane, 71static inline void drm_plane_helper_add(struct drm_plane *plane,