drm: Add valid clones check
[ Upstream commit 41b4b11da02157c7474caf41d56baae0e941d01a ] Check that all encoders attached to a given CRTC are valid possible_clones of each other. Signed-off-by: Jessica Zhang <quic_jesszhan@quicinc.com> Reviewed-by: Maxime Ripard <mripard@kernel.org> Link: https://patchwork.freedesktop.org/patch/msgid/20241216-concurrent-wb-v4-3-fe220297a7f0@quicinc.com Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
1c58b332bc
commit
fe4a7145f0
@@ -573,6 +573,30 @@ mode_valid(struct drm_atomic_state *state)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int drm_atomic_check_valid_clones(struct drm_atomic_state *state,
|
||||
struct drm_crtc *crtc)
|
||||
{
|
||||
struct drm_encoder *drm_enc;
|
||||
struct drm_crtc_state *crtc_state = drm_atomic_get_new_crtc_state(state,
|
||||
crtc);
|
||||
|
||||
drm_for_each_encoder_mask(drm_enc, crtc->dev, crtc_state->encoder_mask) {
|
||||
if (!drm_enc->possible_clones) {
|
||||
DRM_DEBUG("enc%d possible_clones is 0\n", drm_enc->base.id);
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((crtc_state->encoder_mask & drm_enc->possible_clones) !=
|
||||
crtc_state->encoder_mask) {
|
||||
DRM_DEBUG("crtc%d failed valid clone check for mask 0x%x\n",
|
||||
crtc->base.id, crtc_state->encoder_mask);
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* drm_atomic_helper_check_modeset - validate state object for modeset changes
|
||||
* @dev: DRM device
|
||||
@@ -744,6 +768,10 @@ drm_atomic_helper_check_modeset(struct drm_device *dev,
|
||||
ret = drm_atomic_add_affected_planes(state, crtc);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
|
||||
ret = drm_atomic_check_valid_clones(state, crtc);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user