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