drm/atomic: Extract needs_modeset function