/** * vc4_mock_atomic_add_output() - Enables an output in a state * @test: The test context object * @state: Atomic state to enable the output in. * @type: Type of the output encoder * * Adds an output CRTC and connector to a state, and enables them. * * Returns: * 0 on success, a negative error code on failure. If the error is * EDEADLK, the entire atomic sequence must be restarted. All other * errors are fatal.
*/ int vc4_mock_atomic_add_output(struct kunit *test, struct drm_atomic_state *state, enum vc4_encoder_type type)
{ struct drm_device *drm = state->dev; struct drm_connector_state *conn_state; struct drm_crtc_state *crtc_state; struct vc4_dummy_output *output; struct drm_connector *conn; struct drm_encoder *encoder; struct drm_crtc *crtc; int ret;
encoder = vc4_find_encoder_by_type(drm, type); if (!encoder) return -ENODEV;
crtc = vc4_find_crtc_for_encoder(test, drm, encoder); if (!crtc) return -ENODEV;
ret = drm_atomic_set_crtc_for_connector(conn_state, crtc); if (ret) return ret;
crtc_state = drm_atomic_get_crtc_state(state, crtc); if (IS_ERR(crtc_state)) return PTR_ERR(crtc_state);
ret = drm_atomic_set_mode_for_crtc(crtc_state, &default_mode); if (ret) return ret;
crtc_state->active = true;
return 0;
}
/** * vc4_mock_atomic_del_output() - Disables an output in a state * @test: The test context object * @state: Atomic state to disable the output in. * @type: Type of the output encoder * * Adds an output CRTC and connector to a state, and disables them. * * Returns: * 0 on success, a negative error code on failure. If the error is * EDEADLK, the entire atomic sequence must be restarted. All other * errors are fatal.
*/ int vc4_mock_atomic_del_output(struct kunit *test, struct drm_atomic_state *state, enum vc4_encoder_type type)
{ struct drm_device *drm = state->dev; struct drm_connector_state *conn_state; struct drm_crtc_state *crtc_state; struct vc4_dummy_output *output; struct drm_connector *conn; struct drm_encoder *encoder; struct drm_crtc *crtc; int ret;
encoder = vc4_find_encoder_by_type(drm, type); if (!encoder) return -ENODEV;
crtc = vc4_find_crtc_for_encoder(test, drm, encoder); if (!crtc) return -ENODEV;
crtc_state = drm_atomic_get_crtc_state(state, crtc); if (IS_ERR(crtc_state)) return PTR_ERR(crtc_state);
crtc_state->active = false;
ret = drm_atomic_set_mode_for_crtc(crtc_state, NULL); if (ret) return ret;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.