@@ -313,6 +313,8 @@ static void ipu_plane_state_reset(struct drm_plane *plane)
313
313
__drm_atomic_helper_plane_reset (plane , & ipu_state -> base );
314
314
ipu_state -> base .zpos = zpos ;
315
315
ipu_state -> base .normalized_zpos = zpos ;
316
+ ipu_state -> base .color_encoding = DRM_COLOR_YCBCR_BT601 ;
317
+ ipu_state -> base .color_range = DRM_COLOR_YCBCR_LIMITED_RANGE ;
316
318
}
317
319
}
318
320
@@ -632,6 +634,25 @@ static void ipu_plane_atomic_update(struct drm_plane *plane,
632
634
fb -> modifier , & eba );
633
635
}
634
636
637
+ if (!old_state -> fb ||
638
+ old_state -> fb -> format -> format != fb -> format -> format ||
639
+ old_state -> color_encoding != new_state -> color_encoding ||
640
+ old_state -> color_range != new_state -> color_range ) {
641
+ ics = ipu_drm_fourcc_to_colorspace (fb -> format -> format );
642
+ switch (ipu_plane -> dp_flow ) {
643
+ case IPU_DP_FLOW_SYNC_BG :
644
+ ipu_dp_setup_channel (ipu_plane -> dp , new_state -> color_encoding ,
645
+ new_state -> color_range , ics ,
646
+ IPUV3_COLORSPACE_RGB );
647
+ break ;
648
+ case IPU_DP_FLOW_SYNC_FG :
649
+ ipu_dp_setup_channel (ipu_plane -> dp , new_state -> color_encoding ,
650
+ new_state -> color_range , ics ,
651
+ IPUV3_COLORSPACE_UNKNOWN );
652
+ break ;
653
+ }
654
+ }
655
+
635
656
if (old_state -> fb && !drm_atomic_crtc_needs_modeset (crtc_state )) {
636
657
/* nothing to do if PRE is used */
637
658
if (ipu_state -> use_pre )
@@ -662,7 +683,7 @@ static void ipu_plane_atomic_update(struct drm_plane *plane,
662
683
break ;
663
684
}
664
685
665
- ipu_dmfc_config_wait4eot (ipu_plane -> dmfc , ALIGN ( drm_rect_width (dst ), 8 ));
686
+ ipu_dmfc_config_wait4eot (ipu_plane -> dmfc , drm_rect_width (dst ));
666
687
667
688
width = ipu_src_rect_width (new_state );
668
689
height = drm_rect_height (& new_state -> src ) >> 16 ;
@@ -911,6 +932,15 @@ struct ipu_plane *ipu_plane_init(struct drm_device *dev, struct ipu_soc *ipu,
911
932
if (ret )
912
933
return ERR_PTR (ret );
913
934
935
+ ret = drm_plane_create_color_properties (& ipu_plane -> base ,
936
+ BIT (DRM_COLOR_YCBCR_BT601 ) |
937
+ BIT (DRM_COLOR_YCBCR_BT709 ),
938
+ BIT (DRM_COLOR_YCBCR_LIMITED_RANGE ),
939
+ DRM_COLOR_YCBCR_BT601 ,
940
+ DRM_COLOR_YCBCR_LIMITED_RANGE );
941
+ if (ret )
942
+ return ERR_PTR (ret );
943
+
914
944
ret = ipu_plane_get_resources (dev , ipu_plane );
915
945
if (ret ) {
916
946
DRM_ERROR ("failed to get %s plane resources: %pe\n" ,
0 commit comments