aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2014-04-15 04:02:43 -0400
committerDave Airlie <airlied@redhat.com>2014-04-17 23:18:50 -0400
commitb6ccd7b9873dc46becd11838c885d5c783784156 (patch)
tree1b9336f6be71f908854d77b2ca975943bea58e2c
parenta82049b1f1aeb02818092455cd43134ef83d81ea (diff)
drm/plane-helper: Don't fake-implement primary plane disabling
After thinking about this topic a bit more I've reached the conclusion that implementing this doesn't make sense: - The locking is all wrong: set_config(NULL) will also unlink encoders and connectors, but those links are protected with the mode_config mutex. In the ->disable_plane callback we only hold all modeset locks, but eventually we want to switch to just grabbing the per-crtc (and maybe per-plane) locks as needed, maybe based on ww_mutexes. Having a callback which absolutely needs all modeset locks is bad for this conversion. Note that the same isn't true for the provided ->update_plane since we've audited the crtc helpers to make sure that not encoder or connector links are changed. - There's no way to re-enable the plane with an ->update_plane: The connectors/encoder links are lost and so we can't re-enable the CRTC. Even without that issue the driver might have reassigned some shared resources (as opposed to e.g. DPMS off, where drivers are not allowed to do that to make sure the CRTC can be enabled again). - The semantics don't make much sense: Userspace asked to scan out black (or some other color if the driver supports a background color), not that the screen be disabled. - Implementing proper primary plane support (i.e. actually disabling the primary plane without disabling the CRTC) is really simple, at least if all the hw needs is flipping a bit. The big task is auditing all the interactions with other ioctls when the CRTC is on but there's no primary plane (e.g. pageflips). And some of that work still needs to be done. Cc: Matt Roper <matthew.d.roper@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Matt Roper <matthew.d.roper@intel.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r--drivers/gpu/drm/drm_plane_helper.c33
1 files changed, 5 insertions, 28 deletions
diff --git a/drivers/gpu/drm/drm_plane_helper.c b/drivers/gpu/drm/drm_plane_helper.c
index e768d35ff22e..d2b1c03b3d71 100644
--- a/drivers/gpu/drm/drm_plane_helper.c
+++ b/drivers/gpu/drm/drm_plane_helper.c
@@ -203,9 +203,9 @@ EXPORT_SYMBOL(drm_primary_helper_update);
203 * 203 *
204 * Provides a default plane disable handler for primary planes. This is handler 204 * Provides a default plane disable handler for primary planes. This is handler
205 * is called in response to a userspace SetPlane operation on the plane with a 205 * is called in response to a userspace SetPlane operation on the plane with a
206 * NULL framebuffer parameter. We call the driver's modeset handler with a NULL 206 * NULL framebuffer parameter. It unconditionally fails the disable call with
207 * framebuffer to disable the CRTC if no other planes are currently enabled. 207 * -EINVAL the only way to disable the primary plane without driver support is
208 * If other planes are still enabled on the same CRTC, we return -EBUSY. 208 * to disable the entier CRTC. Which does not match the plane ->disable hook.
209 * 209 *
210 * Note that some hardware may be able to disable the primary plane without 210 * Note that some hardware may be able to disable the primary plane without
211 * disabling the whole CRTC. Drivers for such hardware should provide their 211 * disabling the whole CRTC. Drivers for such hardware should provide their
@@ -214,34 +214,11 @@ EXPORT_SYMBOL(drm_primary_helper_update);
214 * disabled primary plane). 214 * disabled primary plane).
215 * 215 *
216 * RETURNS: 216 * RETURNS:
217 * Zero on success, error code on failure 217 * Unconditionally returns -EINVAL.
218 */ 218 */
219int drm_primary_helper_disable(struct drm_plane *plane) 219int drm_primary_helper_disable(struct drm_plane *plane)
220{ 220{
221 struct drm_plane *p; 221 return -EINVAL;
222 struct drm_mode_set set = {
223 .crtc = plane->crtc,
224 .fb = NULL,
225 };
226
227 if (plane->crtc == NULL || plane->fb == NULL)
228 /* Already disabled */
229 return 0;
230
231 list_for_each_entry(p, &plane->dev->mode_config.plane_list, head)
232 if (p != plane && p->fb) {
233 DRM_DEBUG_KMS("Cannot disable primary plane while other planes are still active on CRTC.\n");
234 return -EBUSY;
235 }
236
237 /*
238 * N.B. We call set_config() directly here rather than
239 * drm_mode_set_config_internal() since drm_mode_setplane() already
240 * handles the basic refcounting and we don't need the special
241 * cross-CRTC refcounting (no chance of stealing connectors from
242 * other CRTC's with this update).
243 */
244 return plane->crtc->funcs->set_config(&set);
245} 222}
246EXPORT_SYMBOL(drm_primary_helper_disable); 223EXPORT_SYMBOL(drm_primary_helper_disable);
247 224