linux/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
/**
 * vmw_du_primary_plane_atomic_check - check if the new state is okay
 *
 * @plane: display plane
 * @state: info on the new plane state, including the FB
 *
 * Check if the new state is settable given the current state.  Other
 * than what the atomic helper checks, we care about crtc fitting
 * the FB and maintaining one active framebuffer.
 *
 * Returns 0 on success
 */
check if the new state is okay
@plane: display plane
@state: info on the new plane state, including the FB

Check if the new state is settable given the current state.  Other
than what the atomic helper checks, we care about crtc fitting
the FB and maintaining one active framebuffer.

Returns 0 on success
check if the new state is okay @plane : display plane @state : info on the new plane state including the FB Check if the new state is settable given the current state . Other than what the atomic helper checks we care about crtc fitting the FB and maintaining one active framebuffer . Returns 0 on success
int vmw_du_primary_plane_atomic_check(struct drm_plane *plane,
				      struct drm_plane_state *state)
{
	struct drm_crtc_state *crtc_state = NULL;
	struct drm_framebuffer *new_fb = state->fb;
	int ret;
	if (state->crtc)
		crtc_state = drm_atomic_get_new_crtc_state(state->state, state->crtc);
	ret = drm_atomic_helper_check_plane_state(state, crtc_state,
						  DRM_PLANE_HELPER_NO_SCALING,
						  DRM_PLANE_HELPER_NO_SCALING,
						  false, true);
	if (!ret && new_fb) {
		struct drm_crtc *crtc = state->crtc;
		struct vmw_connector_state *vcs;
		struct vmw_display_unit *du = vmw_crtc_to_du(crtc);
		struct vmw_private *dev_priv = vmw_priv(crtc->dev);
		struct vmw_framebuffer *vfb = vmw_framebuffer_to_vfb(new_fb);
		vcs = vmw_connector_state_to_vcs(du->connector.state);
		mutex_lock(&dev_priv->global_kms_state_mutex);
		if (vcs->is_implicit && dev_priv->implicit_fb &&
		    !(dev_priv->num_implicit == 1 && du->active_implicit)
		    && dev_priv->implicit_fb != vfb) {
			DRM_ERROR("Multiple implicit framebuffers "
				  "not supported.\n");
			ret = -EINVAL;
		}
		mutex_unlock(&dev_priv->global_kms_state_mutex);
	}
	return ret;
}
int vmw_du_primary_plane_atomic_check ( struct drm_plane * plane , struct drm_plane_state * state ) { struct drm_crtc_state * crtc_state = NULL ; struct drm_framebuffer * new_fb = state -> fb ; int ret ; if ( state -> crtc ) crtc_state = drm_atomic_get_new_crtc_state ( state -> state , state -> crtc ) ; ret = drm_atomic_helper_check_plane_state ( state , crtc_state , DRM_PLANE_HELPER_NO_SCALING , DRM_PLANE_HELPER_NO_SCALING , false , true ) ; if ( ! ret && new_fb ) { struct drm_crtc * crtc = state -> crtc ; struct vmw_connector_state * vcs ; struct vmw_display_unit * du = vmw_crtc_to_du ( crtc ) ; struct vmw_private * dev_priv = vmw_priv ( crtc -> dev ) ; struct vmw_framebuffer * vfb = vmw_framebuffer_to_vfb ( new_fb ) ; vcs = vmw_connector_state_to_vcs ( du -> connector . state ) ; mutex_lock ( & dev_priv -> global_kms_state_mutex ) ; if ( vcs -> is_implicit && dev_priv -> implicit_fb && ! ( dev_priv -> num_implicit == 1 && du -> active_implicit ) && dev_priv -> implicit_fb != vfb ) { DRM_ERROR ( " " " \n " ) ; ret = - EINVAL ; } mutex_unlock ( & dev_priv -> global_kms_state_mutex ) ; } return ret ; }
vmw_du_primary_plane_atomic_check - check if the new state is okay
 @plane: display plane
 @state: info on the new plane state, including the FB
vmw_du_primary_plane_atomic_check - check if the new state is okay @plane : display plane @state : info on the new plane state including the FB
/* Only one active implicit framebuffer at a time. */