drm: add clone mode check for CRTC

Add a common helper to check if the given CRTC state is in clone mode.
This can be used by drivers to help detect if a CRTC is being shared by
multiple encoders

Signed-off-by: Jessica Zhang <quic_jesszhan@quicinc.com>
Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
Reviewed-by: Maxime Ripard <mripard@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20241216-concurrent-wb-v4-1-fe220297a7f0@quicinc.com
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
This commit is contained in:
Jessica Zhang 2024-12-16 16:43:12 -08:00 committed by Dmitry Baryshkov
parent 73d934d7b6
commit eee0912a71
2 changed files with 21 additions and 1 deletions

View File

@ -939,3 +939,23 @@ int drm_crtc_create_scaling_filter_property(struct drm_crtc *crtc,
return 0;
}
EXPORT_SYMBOL(drm_crtc_create_scaling_filter_property);
/**
* drm_crtc_in_clone_mode - check if the given CRTC state is in clone mode
*
* @crtc_state: CRTC state to check
*
* This function determines if the given CRTC state is being cloned by multiple
* encoders.
*
* RETURNS:
* True if the CRTC state is in clone mode. False otherwise
*/
bool drm_crtc_in_clone_mode(struct drm_crtc_state *crtc_state)
{
if (!crtc_state)
return false;
return hweight32(crtc_state->encoder_mask) > 1;
}
EXPORT_SYMBOL(drm_crtc_in_clone_mode);

View File

@ -1323,5 +1323,5 @@ static inline struct drm_crtc *drm_crtc_find(struct drm_device *dev,
int drm_crtc_create_scaling_filter_property(struct drm_crtc *crtc,
unsigned int supported_filters);
bool drm_crtc_in_clone_mode(struct drm_crtc_state *crtc_state);
#endif /* __DRM_CRTC_H__ */