Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 69a8a196 authored by Ville Syrjälä's avatar Ville Syrjälä
Browse files

drm: Skip __drm_mode_set_config_internal() on atomic drivers



Everything (apart from the actual ->set_config() call)
__drm_mode_set_config_internal() does is now useless on
atomic drivers. So let's just skip all the foreplay.

v2: Use drm_drv_uses_atomic_modeset() (Daniel)

Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20180705190010.19836-1-ville.syrjala@linux.intel.com
parent e7695eb6
Loading
Loading
Loading
Loading
+10 −5
Original line number Diff line number Diff line
@@ -461,6 +461,8 @@ static int __drm_mode_set_config_internal(struct drm_mode_set *set,
	struct drm_crtc *tmp;
	int ret;

	WARN_ON(drm_drv_uses_atomic_modeset(crtc->dev));

	/*
	 * NOTE: ->set_config can also disable other crtcs (if we steal all
	 * connectors from it), hence we need to refcount the fbs across all
@@ -478,11 +480,9 @@ static int __drm_mode_set_config_internal(struct drm_mode_set *set,
	if (ret == 0) {
		struct drm_plane *plane = crtc->primary;

		if (!plane->state) {
		plane->crtc = fb ? crtc : NULL;
		plane->fb = fb;
	}
	}

	drm_for_each_crtc(tmp, crtc->dev) {
		struct drm_plane *plane = tmp->primary;
@@ -496,6 +496,7 @@ static int __drm_mode_set_config_internal(struct drm_mode_set *set,

	return ret;
}

/**
 * drm_mode_set_config_internal - helper to call &drm_mode_config_funcs.set_config
 * @set: modeset config to set
@@ -740,6 +741,10 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
	set.connectors = connector_set;
	set.num_connectors = crtc_req->count_connectors;
	set.fb = fb;

	if (drm_drv_uses_atomic_modeset(dev))
		ret = crtc->funcs->set_config(&set, &ctx);
	else
		ret = __drm_mode_set_config_internal(&set, &ctx);

out: