@@ -1286,31 +1286,38 @@ static void vc4_set_crtc_possible_masks(struct drm_device *drm,
12861286 }
12871287}
12881288
1289- int vc4_crtc_init (struct drm_device * drm , struct platform_device * pdev ,
1290- struct vc4_crtc * vc4_crtc ,
1291- const struct vc4_crtc_data * data ,
1292- const struct drm_crtc_funcs * crtc_funcs ,
1293- const struct drm_crtc_helper_funcs * crtc_helper_funcs ,
1294- bool feeds_txp )
1289+ /**
1290+ * __vc4_crtc_init - Initializes a CRTC
1291+ * @drm: DRM Device
1292+ * @pdev: CRTC Platform Device
1293+ * @vc4_crtc: CRTC Object to Initialize
1294+ * @data: Configuration data associated with this CRTC
1295+ * @primary_plane: Primary plane for CRTC
1296+ * @crtc_funcs: Callbacks for the new CRTC
1297+ * @crtc_helper_funcs: Helper Callbacks for the new CRTC
1298+ * @feeds_txp: Is this CRTC connected to the TXP?
1299+ *
1300+ * Initializes our private CRTC structure. This function is mostly
1301+ * relevant for KUnit testing, all other users should use
1302+ * vc4_crtc_init() instead.
1303+ *
1304+ * Returns:
1305+ * 0 on success, a negative error code on failure.
1306+ */
1307+ int __vc4_crtc_init (struct drm_device * drm ,
1308+ struct platform_device * pdev ,
1309+ struct vc4_crtc * vc4_crtc ,
1310+ const struct vc4_crtc_data * data ,
1311+ struct drm_plane * primary_plane ,
1312+ const struct drm_crtc_funcs * crtc_funcs ,
1313+ const struct drm_crtc_helper_funcs * crtc_helper_funcs ,
1314+ bool feeds_txp )
12951315{
12961316 struct vc4_dev * vc4 = to_vc4_dev (drm );
12971317 struct drm_crtc * crtc = & vc4_crtc -> base ;
1298- struct drm_plane * primary_plane ;
12991318 unsigned int i ;
13001319 int ret ;
13011320
1302- /* For now, we create just the primary and the legacy cursor
1303- * planes. We should be able to stack more planes on easily,
1304- * but to do that we would need to compute the bandwidth
1305- * requirement of the plane configuration, and reject ones
1306- * that will take too much.
1307- */
1308- primary_plane = vc4_plane_init (drm , DRM_PLANE_TYPE_PRIMARY , 0 );
1309- if (IS_ERR (primary_plane )) {
1310- dev_err (drm -> dev , "failed to construct primary plane\n" );
1311- return PTR_ERR (primary_plane );
1312- }
1313-
13141321 vc4_crtc -> data = data ;
13151322 vc4_crtc -> pdev = pdev ;
13161323 vc4_crtc -> feeds_txp = feeds_txp ;
@@ -1342,6 +1349,31 @@ int vc4_crtc_init(struct drm_device *drm, struct platform_device *pdev,
13421349 return 0 ;
13431350}
13441351
1352+ int vc4_crtc_init (struct drm_device * drm , struct platform_device * pdev ,
1353+ struct vc4_crtc * vc4_crtc ,
1354+ const struct vc4_crtc_data * data ,
1355+ const struct drm_crtc_funcs * crtc_funcs ,
1356+ const struct drm_crtc_helper_funcs * crtc_helper_funcs ,
1357+ bool feeds_txp )
1358+ {
1359+ struct drm_plane * primary_plane ;
1360+
1361+ /* For now, we create just the primary and the legacy cursor
1362+ * planes. We should be able to stack more planes on easily,
1363+ * but to do that we would need to compute the bandwidth
1364+ * requirement of the plane configuration, and reject ones
1365+ * that will take too much.
1366+ */
1367+ primary_plane = vc4_plane_init (drm , DRM_PLANE_TYPE_PRIMARY , 0 );
1368+ if (IS_ERR (primary_plane )) {
1369+ dev_err (drm -> dev , "failed to construct primary plane\n" );
1370+ return PTR_ERR (primary_plane );
1371+ }
1372+
1373+ return __vc4_crtc_init (drm , pdev , vc4_crtc , data , primary_plane ,
1374+ crtc_funcs , crtc_helper_funcs , feeds_txp );
1375+ }
1376+
13451377static int vc4_crtc_bind (struct device * dev , struct device * master , void * data )
13461378{
13471379 struct platform_device * pdev = to_platform_device (dev );
0 commit comments