|
@@ -3087,85 +3087,6 @@ fail:
|
|
|
}
|
|
|
EXPORT_SYMBOL(drm_atomic_helper_page_flip_target);
|
|
|
|
|
|
-/**
|
|
|
- * drm_atomic_helper_connector_dpms() - connector dpms helper implementation
|
|
|
- * @connector: affected connector
|
|
|
- * @mode: DPMS mode
|
|
|
- *
|
|
|
- * This is the main helper function provided by the atomic helper framework for
|
|
|
- * implementing the legacy DPMS connector interface. It computes the new desired
|
|
|
- * &drm_crtc_state.active state for the corresponding CRTC (if the connector is
|
|
|
- * enabled) and updates it.
|
|
|
- *
|
|
|
- * Returns:
|
|
|
- * Returns 0 on success, negative errno numbers on failure.
|
|
|
- */
|
|
|
-int drm_atomic_helper_connector_dpms(struct drm_connector *connector,
|
|
|
- int mode)
|
|
|
-{
|
|
|
- struct drm_mode_config *config = &connector->dev->mode_config;
|
|
|
- struct drm_atomic_state *state;
|
|
|
- struct drm_crtc_state *crtc_state;
|
|
|
- struct drm_crtc *crtc;
|
|
|
- struct drm_connector *tmp_connector;
|
|
|
- struct drm_connector_list_iter conn_iter;
|
|
|
- int ret;
|
|
|
- bool active = false;
|
|
|
- int old_mode = connector->dpms;
|
|
|
-
|
|
|
- if (mode != DRM_MODE_DPMS_ON)
|
|
|
- mode = DRM_MODE_DPMS_OFF;
|
|
|
-
|
|
|
- connector->dpms = mode;
|
|
|
- crtc = connector->state->crtc;
|
|
|
-
|
|
|
- if (!crtc)
|
|
|
- return 0;
|
|
|
-
|
|
|
- state = drm_atomic_state_alloc(connector->dev);
|
|
|
- if (!state)
|
|
|
- return -ENOMEM;
|
|
|
-
|
|
|
- state->acquire_ctx = crtc->dev->mode_config.acquire_ctx;
|
|
|
-retry:
|
|
|
- crtc_state = drm_atomic_get_crtc_state(state, crtc);
|
|
|
- if (IS_ERR(crtc_state)) {
|
|
|
- ret = PTR_ERR(crtc_state);
|
|
|
- goto fail;
|
|
|
- }
|
|
|
-
|
|
|
- WARN_ON(!drm_modeset_is_locked(&config->connection_mutex));
|
|
|
-
|
|
|
- drm_connector_list_iter_begin(connector->dev, &conn_iter);
|
|
|
- drm_for_each_connector_iter(tmp_connector, &conn_iter) {
|
|
|
- if (tmp_connector->state->crtc != crtc)
|
|
|
- continue;
|
|
|
-
|
|
|
- if (tmp_connector->dpms == DRM_MODE_DPMS_ON) {
|
|
|
- active = true;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- drm_connector_list_iter_end(&conn_iter);
|
|
|
- crtc_state->active = active;
|
|
|
-
|
|
|
- ret = drm_atomic_commit(state);
|
|
|
-fail:
|
|
|
- if (ret == -EDEADLK)
|
|
|
- goto backoff;
|
|
|
- if (ret != 0)
|
|
|
- connector->dpms = old_mode;
|
|
|
- drm_atomic_state_put(state);
|
|
|
- return ret;
|
|
|
-
|
|
|
-backoff:
|
|
|
- drm_atomic_state_clear(state);
|
|
|
- drm_atomic_legacy_backoff(state);
|
|
|
-
|
|
|
- goto retry;
|
|
|
-}
|
|
|
-EXPORT_SYMBOL(drm_atomic_helper_connector_dpms);
|
|
|
-
|
|
|
/**
|
|
|
* drm_atomic_helper_best_encoder - Helper for
|
|
|
* &drm_connector_helper_funcs.best_encoder callback
|