@@ -762,7 +762,6 @@ impl<'a> KmsGuard<'a> {
762762 . context ( "Failed to enable devices" ) ?;
763763 }
764764
765- let mut all_outputs = Vec :: new ( ) ;
766765 for device in self . drm_devices . values_mut ( ) {
767766 let now = clock. now ( ) ;
768767 let output_map = device
@@ -772,28 +771,6 @@ impl<'a> KmsGuard<'a> {
772771 . map ( |( crtc, surface) | ( * crtc, surface. output . clone ( ) ) )
773772 . collect :: < HashMap < _ , _ > > ( ) ;
774773
775- // configure primary scanout allowance
776- if !device. surfaces . is_empty ( ) {
777- let mut renderer = self
778- . api
779- . single_renderer ( & device. render_node )
780- . with_context ( || "Failed to create renderer" ) ?;
781-
782- device
783- . allow_primary_scanout_any (
784- device
785- . surfaces
786- . values ( )
787- . filter ( |s| s. output . is_enabled ( ) && s. output . mirroring ( ) . is_none ( ) )
788- . count ( )
789- <= 1 ,
790- & mut renderer,
791- clock,
792- & shell,
793- )
794- . context ( "Failed to switch primary-plane scanout flags" ) ?;
795- }
796-
797774 // reconfigure existing
798775 for ( crtc, surface) in device. surfaces . iter_mut ( ) {
799776 let output_config = surface. output . config ( ) ;
@@ -972,26 +949,27 @@ impl<'a> KmsGuard<'a> {
972949 }
973950 }
974951
975- all_outputs. extend (
976- device
977- . outputs
978- . iter ( )
979- . filter ( |( conn, _) | {
980- !device
981- . leased_connectors
982- . iter ( )
983- . any ( |( leased_conn, _) | * conn == leased_conn)
984- } )
985- . map ( |( _, output) | output. clone ( ) )
986- . collect :: < Vec < _ > > ( ) ,
987- ) ;
988-
952+ // configure primary scanout allowance
989953 if !device. surfaces . is_empty ( ) {
990954 let mut renderer = self
991955 . api
992956 . single_renderer ( & device. render_node )
993957 . with_context ( || "Failed to create renderer" ) ?;
994958
959+ device
960+ . allow_primary_scanout_any (
961+ device
962+ . surfaces
963+ . values ( )
964+ . filter ( |s| s. output . is_enabled ( ) && s. output . mirroring ( ) . is_none ( ) )
965+ . count ( )
966+ <= 1 ,
967+ & mut renderer,
968+ clock,
969+ & shell,
970+ )
971+ . context ( "Failed to switch primary-plane scanout flags" ) ?;
972+
995973 let mut elements = DrmOutputRenderElements :: default ( ) ;
996974 for ( crtc, output) in output_map. iter ( ) {
997975 let output_elements = output_elements (
@@ -1018,6 +996,7 @@ impl<'a> KmsGuard<'a> {
1018996 }
1019997
1020998 // we need to handle mirroring, after all outputs have been enabled
999+ let all_outputs = self . all_outputs ( ) ;
10211000 for device in self . drm_devices . values_mut ( ) {
10221001 for surface in device. surfaces . values_mut ( ) {
10231002 let mirrored_output =
0 commit comments