@@ -81,6 +81,7 @@ static int apple_plane_atomic_check(struct drm_plane *plane,
8181{
8282 struct drm_plane_state * new_plane_state ;
8383 struct drm_crtc_state * crtc_state ;
84+ int ret ;
8485
8586 new_plane_state = drm_atomic_get_new_plane_state (state , plane );
8687
@@ -91,6 +92,28 @@ static int apple_plane_atomic_check(struct drm_plane *plane,
9192 if (IS_ERR (crtc_state ))
9293 return PTR_ERR (crtc_state );
9394
95+ /*
96+ * DCP limits downscaling to 2x and upscaling to 4x. Attempting to
97+ * scale outside these bounds errors out when swapping.
98+ *
99+ * This function also takes care of clipping the src/dest rectangles,
100+ * which is required for correct operation. Partially off-screen
101+ * surfaces may appear corrupted.
102+ *
103+ * DCP does not distinguish plane types in the hardware, so we set
104+ * can_position. If the primary plane does not fill the screen, the
105+ * hardware will fill in zeroes (black).
106+ */
107+ ret = drm_atomic_helper_check_plane_state (new_plane_state , crtc_state ,
108+ FRAC_16_16 (1 , 2 ),
109+ FRAC_16_16 (4 , 1 ),
110+ true, true);
111+ if (ret < 0 )
112+ return ret ;
113+
114+ if (!new_plane_state -> visible )
115+ return 0 ;
116+
94117 /*
95118 * DCP does not allow a surface to clip off the screen, and will crash
96119 * if any blended surface is smaller than 32x32. Reject the atomic op
@@ -116,23 +139,7 @@ static int apple_plane_atomic_check(struct drm_plane *plane,
116139 return - EINVAL ;
117140 }
118141
119- /*
120- * DCP limits downscaling to 2x and upscaling to 4x. Attempting to
121- * scale outside these bounds errors out when swapping.
122- *
123- * This function also takes care of clipping the src/dest rectangles,
124- * which is required for correct operation. Partially off-screen
125- * surfaces may appear corrupted.
126- *
127- * DCP does not distinguish plane types in the hardware, so we set
128- * can_position. If the primary plane does not fill the screen, the
129- * hardware will fill in zeroes (black).
130- */
131- return drm_atomic_helper_check_plane_state (new_plane_state ,
132- crtc_state ,
133- FRAC_16_16 (1 , 2 ),
134- FRAC_16_16 (4 , 1 ),
135- true, true);
142+ return 0 ;
136143}
137144
138145static void apple_plane_atomic_update (struct drm_plane * plane ,
0 commit comments