@@ -370,7 +370,7 @@ static int rendertarget_gbm_present(
370
370
drmdev_atomic_req_put_plane_property (atomic_req , drm_plane_id , "CRTC_W" , flutterpi .display .width );
371
371
drmdev_atomic_req_put_plane_property (atomic_req , drm_plane_id , "CRTC_H" , flutterpi .display .height );
372
372
373
- ok = drmdev_plane_supports_rotation_value (atomic_req -> drmdev , drm_plane_id , DRM_MODE_ROTATE_0 , & supported );
373
+ ok = drmdev_plane_supports_setting_rotation_value (atomic_req -> drmdev , drm_plane_id , DRM_MODE_ROTATE_0 , & supported );
374
374
if (ok != 0 ) return ok ;
375
375
376
376
if (supported ) {
@@ -388,7 +388,7 @@ static int rendertarget_gbm_present(
388
388
}
389
389
}
390
390
391
- ok = drmdev_plane_supports_zpos_value (atomic_req -> drmdev , drm_plane_id , zpos , & supported );
391
+ ok = drmdev_plane_supports_setting_zpos_value (atomic_req -> drmdev , drm_plane_id , zpos , & supported );
392
392
if (ok != 0 ) return ok ;
393
393
394
394
if (supported ) {
@@ -492,7 +492,7 @@ static int rendertarget_nogbm_present(
492
492
drmdev_atomic_req_put_plane_property (req , drm_plane_id , "CRTC_W" , flutterpi .display .width );
493
493
drmdev_atomic_req_put_plane_property (req , drm_plane_id , "CRTC_H" , flutterpi .display .height );
494
494
495
- ok = drmdev_plane_supports_rotation_value (req -> drmdev , drm_plane_id , DRM_MODE_ROTATE_0 | DRM_MODE_REFLECT_Y , & supported );
495
+ ok = drmdev_plane_supports_setting_rotation_value (req -> drmdev , drm_plane_id , DRM_MODE_ROTATE_0 | DRM_MODE_REFLECT_Y , & supported );
496
496
if (ok != 0 ) return ok ;
497
497
498
498
if (supported ) {
@@ -509,6 +509,9 @@ static int rendertarget_nogbm_present(
509
509
printed = true;
510
510
}
511
511
}
512
+
513
+ ok = drmdev_plane_supports_setting_zpos_value (req -> drmdev , drm_plane_id , zpos , & supported );
514
+ if (ok != 0 ) return ok ;
512
515
513
516
if (supported ) {
514
517
drmdev_atomic_req_put_plane_property (req , drm_plane_id , "zpos" , zpos );
@@ -799,10 +802,32 @@ static bool on_present_layers(
799
802
ok = drmdev_atomic_req_put_modeset_props (req , & req_flags );
800
803
if (ok != 0 ) return false;
801
804
805
+ int64_t max_zpos = 0 ;
806
+
802
807
for_each_unreserved_plane_in_atomic_req (req , plane ) {
803
808
if (plane -> type == DRM_PLANE_TYPE_CURSOR ) {
804
809
// make sure the cursor is in front of everything
805
- drmdev_atomic_req_put_plane_property (req , plane -> plane -> plane_id , "zpos" , 2 );
810
+ int64_t max_zpos ;
811
+ bool supported ;
812
+
813
+ ok = drmdev_plane_get_max_zpos_value (req -> drmdev , plane -> plane -> plane_id , & max_zpos );
814
+ if (ok != 0 ) {
815
+ printf ("[compositor] Could not move cursor to front. Mouse cursor may be invisible. drmdev_plane_get_max_zpos_value: %s\n" , strerror (ok ));
816
+ continue ;
817
+ }
818
+
819
+ ok = drmdev_plane_supports_setting_zpos_value (req -> drmdev , plane -> plane -> plane_id , max_zpos , & supported );
820
+ if (ok != 0 ) {
821
+ printf ("[compositor] Could not move cursor to front. Mouse cursor may be invisible. drmdev_plane_supports_setting_zpos_value: %s\n" , strerror (ok ));
822
+ continue ;
823
+ }
824
+
825
+ if (supported ) {
826
+ drmdev_atomic_req_put_plane_property (req , plane -> plane -> plane_id , "zpos" , max_zpos );
827
+ } else {
828
+ printf ("[compositor] Could not move cursor to front. Mouse cursor may be invisible. drmdev_plane_supports_setting_zpos_value: %s\n" , strerror (ok ));
829
+ continue ;
830
+ }
806
831
}
807
832
}
808
833
@@ -955,6 +980,17 @@ static bool on_present_layers(
955
980
}
956
981
}
957
982
}
983
+
984
+ int64_t min_zpos ;
985
+ for_each_unreserved_plane_in_atomic_req (req , plane ) {
986
+ if (plane -> type == DRM_PLANE_TYPE_PRIMARY ) {
987
+ ok = drmdev_plane_get_min_zpos_value (req -> drmdev , plane -> plane -> plane_id , & min_zpos );
988
+ if (ok != 0 ) {
989
+ min_zpos = 0 ;
990
+ }
991
+ break ;
992
+ }
993
+ }
958
994
959
995
for (int i = 0 ; i < layers_count ; i ++ ) {
960
996
if (layers [i ]-> type == kFlutterLayerContentTypeBackingStore ) {
@@ -989,7 +1025,7 @@ static bool on_present_layers(
989
1025
0 ,
990
1026
compositor -> drmdev -> selected_mode -> hdisplay ,
991
1027
compositor -> drmdev -> selected_mode -> vdisplay ,
992
- plane -> type == DRM_PLANE_TYPE_PRIMARY ? 0 : 1
1028
+ i + min_zpos
993
1029
);
994
1030
if (ok != 0 ) {
995
1031
fprintf (stderr , "[compositor] Could not present backing store. rendertarget->present: %s\n" , strerror (ok ));
@@ -1007,7 +1043,7 @@ static bool on_present_layers(
1007
1043
(int ) round (layers [i ]-> offset .y ),
1008
1044
(int ) round (layers [i ]-> size .width ),
1009
1045
(int ) round (layers [i ]-> size .height ),
1010
- i ,
1046
+ i + min_zpos ,
1011
1047
cb_data -> userdata
1012
1048
);
1013
1049
if (ok != 0 ) {
0 commit comments