Skip to content

Commit eee0912

Browse files
Jessica Zhanglumag
authored andcommitted
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 <[email protected]> Reviewed-by: Abhinav Kumar <[email protected]> Reviewed-by: Maxime Ripard <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Dmitry Baryshkov <[email protected]>
1 parent 73d934d commit eee0912

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

drivers/gpu/drm/drm_crtc.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -939,3 +939,23 @@ int drm_crtc_create_scaling_filter_property(struct drm_crtc *crtc,
939939
return 0;
940940
}
941941
EXPORT_SYMBOL(drm_crtc_create_scaling_filter_property);
942+
943+
/**
944+
* drm_crtc_in_clone_mode - check if the given CRTC state is in clone mode
945+
*
946+
* @crtc_state: CRTC state to check
947+
*
948+
* This function determines if the given CRTC state is being cloned by multiple
949+
* encoders.
950+
*
951+
* RETURNS:
952+
* True if the CRTC state is in clone mode. False otherwise
953+
*/
954+
bool drm_crtc_in_clone_mode(struct drm_crtc_state *crtc_state)
955+
{
956+
if (!crtc_state)
957+
return false;
958+
959+
return hweight32(crtc_state->encoder_mask) > 1;
960+
}
961+
EXPORT_SYMBOL(drm_crtc_in_clone_mode);

include/drm/drm_crtc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1323,5 +1323,5 @@ static inline struct drm_crtc *drm_crtc_find(struct drm_device *dev,
13231323

13241324
int drm_crtc_create_scaling_filter_property(struct drm_crtc *crtc,
13251325
unsigned int supported_filters);
1326-
1326+
bool drm_crtc_in_clone_mode(struct drm_crtc_state *crtc_state);
13271327
#endif /* __DRM_CRTC_H__ */

0 commit comments

Comments
 (0)