@@ -332,8 +332,7 @@ static void vc5_hvs_pv_muxing_commit(struct vc4_dev *vc4,
332
332
}
333
333
}
334
334
335
- static void
336
- vc4_atomic_complete_commit (struct drm_atomic_state * state )
335
+ static void vc4_atomic_commit_tail (struct drm_atomic_state * state )
337
336
{
338
337
struct drm_device * dev = state -> dev ;
339
338
struct vc4_dev * vc4 = to_vc4_dev (dev );
@@ -357,10 +356,6 @@ vc4_atomic_complete_commit(struct drm_atomic_state *state)
357
356
if (vc4 -> hvs -> hvs5 )
358
357
clk_set_min_rate (hvs -> core_clk , 500000000 );
359
358
360
- drm_atomic_helper_wait_for_fences (dev , state , false);
361
-
362
- drm_atomic_helper_wait_for_dependencies (state );
363
-
364
359
old_hvs_state = vc4_hvs_get_old_global_state (state );
365
360
if (!old_hvs_state )
366
361
return ;
@@ -412,20 +407,8 @@ vc4_atomic_complete_commit(struct drm_atomic_state *state)
412
407
413
408
drm_atomic_helper_cleanup_planes (dev , state );
414
409
415
- drm_atomic_helper_commit_cleanup_done (state );
416
-
417
410
if (vc4 -> hvs -> hvs5 )
418
411
clk_set_min_rate (hvs -> core_clk , 0 );
419
-
420
- drm_atomic_state_put (state );
421
- }
422
-
423
- static void commit_work (struct work_struct * work )
424
- {
425
- struct drm_atomic_state * state = container_of (work ,
426
- struct drm_atomic_state ,
427
- commit_work );
428
- vc4_atomic_complete_commit (state );
429
412
}
430
413
431
414
static int vc4_atomic_commit_setup (struct drm_atomic_state * state )
@@ -458,94 +441,6 @@ static int vc4_atomic_commit_setup(struct drm_atomic_state *state)
458
441
return 0 ;
459
442
}
460
443
461
- /**
462
- * vc4_atomic_commit - commit validated state object
463
- * @dev: DRM device
464
- * @state: the driver state object
465
- * @nonblock: nonblocking commit
466
- *
467
- * This function commits a with drm_atomic_helper_check() pre-validated state
468
- * object. This can still fail when e.g. the framebuffer reservation fails. For
469
- * now this doesn't implement asynchronous commits.
470
- *
471
- * RETURNS
472
- * Zero for success or -errno.
473
- */
474
- static int vc4_atomic_commit (struct drm_device * dev ,
475
- struct drm_atomic_state * state ,
476
- bool nonblock )
477
- {
478
- int ret ;
479
-
480
- if (state -> async_update ) {
481
- ret = drm_atomic_helper_prepare_planes (dev , state );
482
- if (ret )
483
- return ret ;
484
-
485
- drm_atomic_helper_async_commit (dev , state );
486
-
487
- drm_atomic_helper_cleanup_planes (dev , state );
488
-
489
- return 0 ;
490
- }
491
-
492
- /* We know for sure we don't want an async update here. Set
493
- * state->legacy_cursor_update to false to prevent
494
- * drm_atomic_helper_setup_commit() from auto-completing
495
- * commit->flip_done.
496
- */
497
- state -> legacy_cursor_update = false;
498
- ret = drm_atomic_helper_setup_commit (state , nonblock );
499
- if (ret )
500
- return ret ;
501
-
502
- INIT_WORK (& state -> commit_work , commit_work );
503
-
504
- ret = drm_atomic_helper_prepare_planes (dev , state );
505
- if (ret )
506
- return ret ;
507
-
508
- if (!nonblock ) {
509
- ret = drm_atomic_helper_wait_for_fences (dev , state , true);
510
- if (ret ) {
511
- drm_atomic_helper_cleanup_planes (dev , state );
512
- return ret ;
513
- }
514
- }
515
-
516
- /*
517
- * This is the point of no return - everything below never fails except
518
- * when the hw goes bonghits. Which means we can commit the new state on
519
- * the software side now.
520
- */
521
-
522
- BUG_ON (drm_atomic_helper_swap_state (state , false) < 0 );
523
-
524
- /*
525
- * Everything below can be run asynchronously without the need to grab
526
- * any modeset locks at all under one condition: It must be guaranteed
527
- * that the asynchronous work has either been cancelled (if the driver
528
- * supports it, which at least requires that the framebuffers get
529
- * cleaned up with drm_atomic_helper_cleanup_planes()) or completed
530
- * before the new state gets committed on the software side with
531
- * drm_atomic_helper_swap_state().
532
- *
533
- * This scheme allows new atomic state updates to be prepared and
534
- * checked in parallel to the asynchronous completion of the previous
535
- * update. Which is important since compositors need to figure out the
536
- * composition of the next frame right after having submitted the
537
- * current layout.
538
- */
539
-
540
- drm_atomic_state_get (state );
541
- if (nonblock )
542
- queue_work (system_unbound_wq , & state -> commit_work );
543
- else
544
- vc4_atomic_complete_commit (state );
545
-
546
- return 0 ;
547
- }
548
-
549
444
static struct drm_framebuffer * vc4_fb_create (struct drm_device * dev ,
550
445
struct drm_file * file_priv ,
551
446
const struct drm_mode_fb_cmd2 * mode_cmd )
@@ -966,11 +861,12 @@ vc4_atomic_check(struct drm_device *dev, struct drm_atomic_state *state)
966
861
967
862
static struct drm_mode_config_helper_funcs vc4_mode_config_helpers = {
968
863
.atomic_commit_setup = vc4_atomic_commit_setup ,
864
+ .atomic_commit_tail = vc4_atomic_commit_tail ,
969
865
};
970
866
971
867
static const struct drm_mode_config_funcs vc4_mode_funcs = {
972
868
.atomic_check = vc4_atomic_check ,
973
- .atomic_commit = vc4_atomic_commit ,
869
+ .atomic_commit = drm_atomic_helper_commit ,
974
870
.fb_create = vc4_fb_create ,
975
871
};
976
872
0 commit comments