@@ -225,8 +225,8 @@ static u32 i9xx_plane_ctl(const struct intel_crtc_state *crtc_state,
225225
226226int i9xx_check_plane_surface (struct intel_plane_state * plane_state )
227227{
228- struct drm_i915_private * dev_priv =
229- to_i915 (plane_state -> uapi . plane -> dev );
228+ struct intel_plane * plane = to_intel_plane ( plane_state -> uapi . plane );
229+ struct drm_i915_private * dev_priv = to_i915 (plane -> base . dev );
230230 const struct drm_framebuffer * fb = plane_state -> hw .fb ;
231231 int src_x , src_y , src_w ;
232232 u32 offset ;
@@ -267,7 +267,7 @@ int i9xx_check_plane_surface(struct intel_plane_state *plane_state)
267267 * despite them not using the linear offset anymore.
268268 */
269269 if (DISPLAY_VER (dev_priv ) >= 4 && fb -> modifier == I915_FORMAT_MOD_X_TILED ) {
270- unsigned int alignment = intel_surf_alignment ( fb , 0 );
270+ unsigned int alignment = plane -> min_alignment ( plane , fb , 0 );
271271 int cpp = fb -> format -> cpp [0 ];
272272
273273 while ((src_x + src_w ) * cpp > plane_state -> view .color_plane [0 ].mapping_stride ) {
@@ -764,6 +764,66 @@ i8xx_plane_max_stride(struct intel_plane *plane,
764764 return 8 * 1024 ;
765765}
766766
767+ static unsigned int vlv_primary_min_alignment (struct intel_plane * plane ,
768+ const struct drm_framebuffer * fb ,
769+ int color_plane )
770+ {
771+ struct drm_i915_private * i915 = to_i915 (plane -> base .dev );
772+
773+ switch (fb -> modifier ) {
774+ case I915_FORMAT_MOD_X_TILED :
775+ if (HAS_ASYNC_FLIPS (i915 ))
776+ return 256 * 1024 ;
777+ return 4 * 1024 ;
778+ case DRM_FORMAT_MOD_LINEAR :
779+ return 128 * 1024 ;
780+ default :
781+ MISSING_CASE (fb -> modifier );
782+ return 0 ;
783+ }
784+ }
785+
786+ static unsigned int g4x_primary_min_alignment (struct intel_plane * plane ,
787+ const struct drm_framebuffer * fb ,
788+ int color_plane )
789+ {
790+ struct drm_i915_private * i915 = to_i915 (plane -> base .dev );
791+
792+ switch (fb -> modifier ) {
793+ case I915_FORMAT_MOD_X_TILED :
794+ if (HAS_ASYNC_FLIPS (i915 ))
795+ return 256 * 1024 ;
796+ return 4 * 1024 ;
797+ case DRM_FORMAT_MOD_LINEAR :
798+ return 4 * 1024 ;
799+ default :
800+ MISSING_CASE (fb -> modifier );
801+ return 0 ;
802+ }
803+ }
804+
805+ static unsigned int i965_plane_min_alignment (struct intel_plane * plane ,
806+ const struct drm_framebuffer * fb ,
807+ int color_plane )
808+ {
809+ switch (fb -> modifier ) {
810+ case I915_FORMAT_MOD_X_TILED :
811+ return 4 * 1024 ;
812+ case DRM_FORMAT_MOD_LINEAR :
813+ return 128 * 1024 ;
814+ default :
815+ MISSING_CASE (fb -> modifier );
816+ return 0 ;
817+ }
818+ }
819+
820+ static unsigned int i9xx_plane_min_alignment (struct intel_plane * plane ,
821+ const struct drm_framebuffer * fb ,
822+ int color_plane )
823+ {
824+ return 0 ;
825+ }
826+
767827static const struct drm_plane_funcs i965_plane_funcs = {
768828 .update_plane = drm_atomic_helper_update_plane ,
769829 .disable_plane = drm_atomic_helper_disable_plane ,
@@ -869,6 +929,15 @@ intel_primary_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe)
869929 plane -> max_stride = ilk_primary_max_stride ;
870930 }
871931
932+ if (IS_VALLEYVIEW (dev_priv ) || IS_CHERRYVIEW (dev_priv ))
933+ plane -> min_alignment = vlv_primary_min_alignment ;
934+ else if (DISPLAY_VER (dev_priv ) >= 5 || IS_G4X (dev_priv ))
935+ plane -> min_alignment = g4x_primary_min_alignment ;
936+ else if (DISPLAY_VER (dev_priv ) == 4 )
937+ plane -> min_alignment = i965_plane_min_alignment ;
938+ else
939+ plane -> min_alignment = i9xx_plane_min_alignment ;
940+
872941 if (IS_I830 (dev_priv ) || IS_I845G (dev_priv )) {
873942 plane -> update_arm = i830_plane_update_arm ;
874943 } else {
0 commit comments