diff options
author | Tvrtko Ursulin <tvrtko.ursulin@intel.com> | 2015-03-03 09:22:31 -0500 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2015-03-04 18:49:02 -0500 |
commit | d136dfeec84bfe3e4238bacd23f21e161268deac (patch) | |
tree | 0b12433e23cbf549e0698269535a166f8f6bbf2f /drivers/gpu/drm | |
parent | 7547af91868f0ea940abc25460accc4025c5ce0a (diff) |
drm: Pass in new and old plane state to prepare_fb and cleanup_fb
Use cases like rotation require these hooks to have some context so they
know how to prepare and cleanup the frame buffer correctly.
For i915 specifically, object backing pages need to be mapped differently
for different rotation modes and the driver needs to know which mapping to
instantiate and which to tear down when transitioning between them.
v2: Made passed in states const. (Daniel Vetter)
[airlied: add mdp5 and atmel fixups]
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: dri-devel@lists.freedesktop.org
Reviewed-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r-- | drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c | 3 | ||||
-rw-r--r-- | drivers/gpu/drm/drm_atomic_helper.c | 13 | ||||
-rw-r--r-- | drivers/gpu/drm/drm_plane_helper.c | 5 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_display.c | 6 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_drv.h | 6 | ||||
-rw-r--r-- | drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c | 6 | ||||
-rw-r--r-- | drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c | 6 | ||||
-rw-r--r-- | drivers/gpu/drm/tegra/dc.c | 6 |
8 files changed, 33 insertions, 18 deletions
diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c index dbf97d999d40..be9fa8220499 100644 --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c | |||
@@ -712,7 +712,8 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane *p, | |||
712 | } | 712 | } |
713 | 713 | ||
714 | static int atmel_hlcdc_plane_prepare_fb(struct drm_plane *p, | 714 | static int atmel_hlcdc_plane_prepare_fb(struct drm_plane *p, |
715 | struct drm_framebuffer *fb) | 715 | struct drm_framebuffer *fb, |
716 | const struct drm_plane_state *new_state) | ||
716 | { | 717 | { |
717 | struct atmel_hlcdc_plane *plane = drm_plane_to_atmel_hlcdc_plane(p); | 718 | struct atmel_hlcdc_plane *plane = drm_plane_to_atmel_hlcdc_plane(p); |
718 | 719 | ||
diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index 28aa87510551..7715c40d4e74 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c | |||
@@ -1116,6 +1116,7 @@ int drm_atomic_helper_prepare_planes(struct drm_device *dev, | |||
1116 | for (i = 0; i < nplanes; i++) { | 1116 | for (i = 0; i < nplanes; i++) { |
1117 | struct drm_plane_helper_funcs *funcs; | 1117 | struct drm_plane_helper_funcs *funcs; |
1118 | struct drm_plane *plane = state->planes[i]; | 1118 | struct drm_plane *plane = state->planes[i]; |
1119 | struct drm_plane_state *plane_state = state->plane_states[i]; | ||
1119 | struct drm_framebuffer *fb; | 1120 | struct drm_framebuffer *fb; |
1120 | 1121 | ||
1121 | if (!plane) | 1122 | if (!plane) |
@@ -1123,10 +1124,10 @@ int drm_atomic_helper_prepare_planes(struct drm_device *dev, | |||
1123 | 1124 | ||
1124 | funcs = plane->helper_private; | 1125 | funcs = plane->helper_private; |
1125 | 1126 | ||
1126 | fb = state->plane_states[i]->fb; | 1127 | fb = plane_state->fb; |
1127 | 1128 | ||
1128 | if (fb && funcs->prepare_fb) { | 1129 | if (fb && funcs->prepare_fb) { |
1129 | ret = funcs->prepare_fb(plane, fb); | 1130 | ret = funcs->prepare_fb(plane, fb, plane_state); |
1130 | if (ret) | 1131 | if (ret) |
1131 | goto fail; | 1132 | goto fail; |
1132 | } | 1133 | } |
@@ -1138,6 +1139,7 @@ fail: | |||
1138 | for (i--; i >= 0; i--) { | 1139 | for (i--; i >= 0; i--) { |
1139 | struct drm_plane_helper_funcs *funcs; | 1140 | struct drm_plane_helper_funcs *funcs; |
1140 | struct drm_plane *plane = state->planes[i]; | 1141 | struct drm_plane *plane = state->planes[i]; |
1142 | struct drm_plane_state *plane_state = state->plane_states[i]; | ||
1141 | struct drm_framebuffer *fb; | 1143 | struct drm_framebuffer *fb; |
1142 | 1144 | ||
1143 | if (!plane) | 1145 | if (!plane) |
@@ -1148,7 +1150,7 @@ fail: | |||
1148 | fb = state->plane_states[i]->fb; | 1150 | fb = state->plane_states[i]->fb; |
1149 | 1151 | ||
1150 | if (fb && funcs->cleanup_fb) | 1152 | if (fb && funcs->cleanup_fb) |
1151 | funcs->cleanup_fb(plane, fb); | 1153 | funcs->cleanup_fb(plane, fb, plane_state); |
1152 | 1154 | ||
1153 | } | 1155 | } |
1154 | 1156 | ||
@@ -1254,6 +1256,7 @@ void drm_atomic_helper_cleanup_planes(struct drm_device *dev, | |||
1254 | for (i = 0; i < nplanes; i++) { | 1256 | for (i = 0; i < nplanes; i++) { |
1255 | struct drm_plane_helper_funcs *funcs; | 1257 | struct drm_plane_helper_funcs *funcs; |
1256 | struct drm_plane *plane = old_state->planes[i]; | 1258 | struct drm_plane *plane = old_state->planes[i]; |
1259 | struct drm_plane_state *plane_state = old_state->plane_states[i]; | ||
1257 | struct drm_framebuffer *old_fb; | 1260 | struct drm_framebuffer *old_fb; |
1258 | 1261 | ||
1259 | if (!plane) | 1262 | if (!plane) |
@@ -1261,10 +1264,10 @@ void drm_atomic_helper_cleanup_planes(struct drm_device *dev, | |||
1261 | 1264 | ||
1262 | funcs = plane->helper_private; | 1265 | funcs = plane->helper_private; |
1263 | 1266 | ||
1264 | old_fb = old_state->plane_states[i]->fb; | 1267 | old_fb = plane_state->fb; |
1265 | 1268 | ||
1266 | if (old_fb && funcs->cleanup_fb) | 1269 | if (old_fb && funcs->cleanup_fb) |
1267 | funcs->cleanup_fb(plane, old_fb); | 1270 | funcs->cleanup_fb(plane, old_fb, plane_state); |
1268 | } | 1271 | } |
1269 | } | 1272 | } |
1270 | EXPORT_SYMBOL(drm_atomic_helper_cleanup_planes); | 1273 | EXPORT_SYMBOL(drm_atomic_helper_cleanup_planes); |
diff --git a/drivers/gpu/drm/drm_plane_helper.c b/drivers/gpu/drm/drm_plane_helper.c index 5ba5792bfdba..813a06627eb3 100644 --- a/drivers/gpu/drm/drm_plane_helper.c +++ b/drivers/gpu/drm/drm_plane_helper.c | |||
@@ -437,7 +437,8 @@ int drm_plane_helper_commit(struct drm_plane *plane, | |||
437 | 437 | ||
438 | if (plane_funcs->prepare_fb && plane_state->fb && | 438 | if (plane_funcs->prepare_fb && plane_state->fb && |
439 | plane_state->fb != old_fb) { | 439 | plane_state->fb != old_fb) { |
440 | ret = plane_funcs->prepare_fb(plane, plane_state->fb); | 440 | ret = plane_funcs->prepare_fb(plane, plane_state->fb, |
441 | plane_state); | ||
441 | if (ret) | 442 | if (ret) |
442 | goto out; | 443 | goto out; |
443 | } | 444 | } |
@@ -487,7 +488,7 @@ int drm_plane_helper_commit(struct drm_plane *plane, | |||
487 | } | 488 | } |
488 | 489 | ||
489 | if (plane_funcs->cleanup_fb && old_fb) | 490 | if (plane_funcs->cleanup_fb && old_fb) |
490 | plane_funcs->cleanup_fb(plane, old_fb); | 491 | plane_funcs->cleanup_fb(plane, old_fb, plane_state); |
491 | out: | 492 | out: |
492 | if (plane_state) { | 493 | if (plane_state) { |
493 | if (plane->funcs->atomic_destroy_state) | 494 | if (plane->funcs->atomic_destroy_state) |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 3b0fe9f1f3c9..c234af0379fc 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -11776,7 +11776,8 @@ static void intel_shared_dpll_init(struct drm_device *dev) | |||
11776 | */ | 11776 | */ |
11777 | int | 11777 | int |
11778 | intel_prepare_plane_fb(struct drm_plane *plane, | 11778 | intel_prepare_plane_fb(struct drm_plane *plane, |
11779 | struct drm_framebuffer *fb) | 11779 | struct drm_framebuffer *fb, |
11780 | const struct drm_plane_state *new_state) | ||
11780 | { | 11781 | { |
11781 | struct drm_device *dev = plane->dev; | 11782 | struct drm_device *dev = plane->dev; |
11782 | struct intel_plane *intel_plane = to_intel_plane(plane); | 11783 | struct intel_plane *intel_plane = to_intel_plane(plane); |
@@ -11830,7 +11831,8 @@ intel_prepare_plane_fb(struct drm_plane *plane, | |||
11830 | */ | 11831 | */ |
11831 | void | 11832 | void |
11832 | intel_cleanup_plane_fb(struct drm_plane *plane, | 11833 | intel_cleanup_plane_fb(struct drm_plane *plane, |
11833 | struct drm_framebuffer *fb) | 11834 | struct drm_framebuffer *fb, |
11835 | const struct drm_plane_state *old_state) | ||
11834 | { | 11836 | { |
11835 | struct drm_device *dev = plane->dev; | 11837 | struct drm_device *dev = plane->dev; |
11836 | struct drm_i915_gem_object *obj = intel_fb_obj(fb); | 11838 | struct drm_i915_gem_object *obj = intel_fb_obj(fb); |
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 1de8e20474d7..58d11a8066d4 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h | |||
@@ -943,9 +943,11 @@ void intel_finish_page_flip(struct drm_device *dev, int pipe); | |||
943 | void intel_finish_page_flip_plane(struct drm_device *dev, int plane); | 943 | void intel_finish_page_flip_plane(struct drm_device *dev, int plane); |
944 | void intel_check_page_flip(struct drm_device *dev, int pipe); | 944 | void intel_check_page_flip(struct drm_device *dev, int pipe); |
945 | int intel_prepare_plane_fb(struct drm_plane *plane, | 945 | int intel_prepare_plane_fb(struct drm_plane *plane, |
946 | struct drm_framebuffer *fb); | 946 | struct drm_framebuffer *fb, |
947 | const struct drm_plane_state *new_state); | ||
947 | void intel_cleanup_plane_fb(struct drm_plane *plane, | 948 | void intel_cleanup_plane_fb(struct drm_plane *plane, |
948 | struct drm_framebuffer *fb); | 949 | struct drm_framebuffer *fb, |
950 | const struct drm_plane_state *old_state); | ||
949 | int intel_plane_atomic_get_property(struct drm_plane *plane, | 951 | int intel_plane_atomic_get_property(struct drm_plane *plane, |
950 | const struct drm_plane_state *state, | 952 | const struct drm_plane_state *state, |
951 | struct drm_property *property, | 953 | struct drm_property *property, |
diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c index cde25009203a..dbc068988377 100644 --- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c +++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c | |||
@@ -83,7 +83,8 @@ static const struct drm_plane_funcs mdp4_plane_funcs = { | |||
83 | }; | 83 | }; |
84 | 84 | ||
85 | static int mdp4_plane_prepare_fb(struct drm_plane *plane, | 85 | static int mdp4_plane_prepare_fb(struct drm_plane *plane, |
86 | struct drm_framebuffer *fb) | 86 | struct drm_framebuffer *fb, |
87 | const struct drm_plane_state *new_state) | ||
87 | { | 88 | { |
88 | struct mdp4_plane *mdp4_plane = to_mdp4_plane(plane); | 89 | struct mdp4_plane *mdp4_plane = to_mdp4_plane(plane); |
89 | struct mdp4_kms *mdp4_kms = get_kms(plane); | 90 | struct mdp4_kms *mdp4_kms = get_kms(plane); |
@@ -93,7 +94,8 @@ static int mdp4_plane_prepare_fb(struct drm_plane *plane, | |||
93 | } | 94 | } |
94 | 95 | ||
95 | static void mdp4_plane_cleanup_fb(struct drm_plane *plane, | 96 | static void mdp4_plane_cleanup_fb(struct drm_plane *plane, |
96 | struct drm_framebuffer *fb) | 97 | struct drm_framebuffer *fb, |
98 | const struct drm_plane_state *old_state) | ||
97 | { | 99 | { |
98 | struct mdp4_plane *mdp4_plane = to_mdp4_plane(plane); | 100 | struct mdp4_plane *mdp4_plane = to_mdp4_plane(plane); |
99 | struct mdp4_kms *mdp4_kms = get_kms(plane); | 101 | struct mdp4_kms *mdp4_kms = get_kms(plane); |
diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c index 05cf9ab2a876..6bd48e246283 100644 --- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c +++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c | |||
@@ -156,7 +156,8 @@ static const struct drm_plane_funcs mdp5_plane_funcs = { | |||
156 | }; | 156 | }; |
157 | 157 | ||
158 | static int mdp5_plane_prepare_fb(struct drm_plane *plane, | 158 | static int mdp5_plane_prepare_fb(struct drm_plane *plane, |
159 | struct drm_framebuffer *fb) | 159 | struct drm_framebuffer *fb, |
160 | const struct drm_plane_state *new_state) | ||
160 | { | 161 | { |
161 | struct mdp5_plane *mdp5_plane = to_mdp5_plane(plane); | 162 | struct mdp5_plane *mdp5_plane = to_mdp5_plane(plane); |
162 | struct mdp5_kms *mdp5_kms = get_kms(plane); | 163 | struct mdp5_kms *mdp5_kms = get_kms(plane); |
@@ -166,7 +167,8 @@ static int mdp5_plane_prepare_fb(struct drm_plane *plane, | |||
166 | } | 167 | } |
167 | 168 | ||
168 | static void mdp5_plane_cleanup_fb(struct drm_plane *plane, | 169 | static void mdp5_plane_cleanup_fb(struct drm_plane *plane, |
169 | struct drm_framebuffer *fb) | 170 | struct drm_framebuffer *fb, |
171 | const struct drm_plane_state *old_state) | ||
170 | { | 172 | { |
171 | struct mdp5_plane *mdp5_plane = to_mdp5_plane(plane); | 173 | struct mdp5_plane *mdp5_plane = to_mdp5_plane(plane); |
172 | struct mdp5_kms *mdp5_kms = get_kms(plane); | 174 | struct mdp5_kms *mdp5_kms = get_kms(plane); |
diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c index 3aaa84ae2681..bc3e85186b88 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c | |||
@@ -472,13 +472,15 @@ static const struct drm_plane_funcs tegra_primary_plane_funcs = { | |||
472 | }; | 472 | }; |
473 | 473 | ||
474 | static int tegra_plane_prepare_fb(struct drm_plane *plane, | 474 | static int tegra_plane_prepare_fb(struct drm_plane *plane, |
475 | struct drm_framebuffer *fb) | 475 | struct drm_framebuffer *fb, |
476 | const struct drm_plane_state *new_state) | ||
476 | { | 477 | { |
477 | return 0; | 478 | return 0; |
478 | } | 479 | } |
479 | 480 | ||
480 | static void tegra_plane_cleanup_fb(struct drm_plane *plane, | 481 | static void tegra_plane_cleanup_fb(struct drm_plane *plane, |
481 | struct drm_framebuffer *fb) | 482 | struct drm_framebuffer *fb, |
483 | const struct drm_plane_state *old_fb) | ||
482 | { | 484 | { |
483 | } | 485 | } |
484 | 486 | ||