Skip to content

Commit a041cd4

Browse files
committed
Merge branch 'develop' into fix/ebusy-on-atomic-commit
2 parents 9ec3d67 + 35dcb4d commit a041cd4

File tree

6 files changed

+204
-73
lines changed

6 files changed

+204
-73
lines changed

Makefile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
REAL_CFLAGS = -I./include $(shell pkg-config --cflags gbm libdrm glesv2 egl libsystemd libinput libudev) \
22
-DBUILD_TEXT_INPUT_PLUGIN \
3-
-DBUILD_GPIOD_PLUGIN \
4-
-DBUILD_SPIDEV_PLUGIN \
53
-DBUILD_TEST_PLUGIN \
64
-DBUILD_OMXPLAYER_VIDEO_PLAYER_PLUGIN \
75
-O0 -ggdb \

include/modesetting.h

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,17 +86,35 @@ int drmdev_configure(
8686
const drmModeModeInfo *mode
8787
);
8888

89-
int drmdev_plane_supports_rotation_value(
89+
int drmdev_plane_supports_setting_rotation_value(
9090
struct drmdev *drmdev,
9191
uint32_t plane_id,
9292
int drm_rotation,
9393
bool *result
9494
);
9595

96-
int drmdev_plane_supports_zpos_value(
96+
int drmdev_plane_get_min_zpos_value(
9797
struct drmdev *drmdev,
9898
uint32_t plane_id,
99-
int zpos,
99+
int64_t *min_zpos_out
100+
);
101+
102+
int drmdev_plane_get_max_zpos_value(
103+
struct drmdev *drmdev,
104+
uint32_t plane_id,
105+
int64_t *max_zpos_out
106+
);
107+
108+
int drmdev_plane_supports_setting_zpos(
109+
struct drmdev *drmdev,
110+
uint32_t plane_id,
111+
bool *result
112+
);
113+
114+
int drmdev_plane_supports_setting_zpos_value(
115+
struct drmdev *drmdev,
116+
uint32_t plane_id,
117+
int64_t zpos,
100118
bool *result
101119
);
102120

src/compositor.c

Lines changed: 42 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ static int rendertarget_gbm_present(
370370
drmdev_atomic_req_put_plane_property(atomic_req, drm_plane_id, "CRTC_W", flutterpi.display.width);
371371
drmdev_atomic_req_put_plane_property(atomic_req, drm_plane_id, "CRTC_H", flutterpi.display.height);
372372

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);
374374
if (ok != 0) return ok;
375375

376376
if (supported) {
@@ -388,7 +388,7 @@ static int rendertarget_gbm_present(
388388
}
389389
}
390390

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);
392392
if (ok != 0) return ok;
393393

394394
if (supported) {
@@ -492,7 +492,7 @@ static int rendertarget_nogbm_present(
492492
drmdev_atomic_req_put_plane_property(req, drm_plane_id, "CRTC_W", flutterpi.display.width);
493493
drmdev_atomic_req_put_plane_property(req, drm_plane_id, "CRTC_H", flutterpi.display.height);
494494

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);
496496
if (ok != 0) return ok;
497497

498498
if (supported) {
@@ -509,6 +509,9 @@ static int rendertarget_nogbm_present(
509509
printed = true;
510510
}
511511
}
512+
513+
ok = drmdev_plane_supports_setting_zpos_value(req->drmdev, drm_plane_id, zpos, &supported);
514+
if (ok != 0) return ok;
512515

513516
if (supported) {
514517
drmdev_atomic_req_put_plane_property(req, drm_plane_id, "zpos", zpos);
@@ -799,10 +802,32 @@ static bool on_present_layers(
799802
ok = drmdev_atomic_req_put_modeset_props(req, &req_flags);
800803
if (ok != 0) return false;
801804

805+
int64_t max_zpos = 0;
806+
802807
for_each_unreserved_plane_in_atomic_req(req, plane) {
803808
if (plane->type == DRM_PLANE_TYPE_CURSOR) {
804809
// 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+
}
806831
}
807832
}
808833

@@ -955,6 +980,17 @@ static bool on_present_layers(
955980
}
956981
}
957982
}
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+
}
958994

959995
for (int i = 0; i < layers_count; i++) {
960996
if (layers[i]->type == kFlutterLayerContentTypeBackingStore) {
@@ -989,7 +1025,7 @@ static bool on_present_layers(
9891025
0,
9901026
compositor->drmdev->selected_mode->hdisplay,
9911027
compositor->drmdev->selected_mode->vdisplay,
992-
plane->type == DRM_PLANE_TYPE_PRIMARY ? 0 : 1
1028+
i + min_zpos
9931029
);
9941030
if (ok != 0) {
9951031
fprintf(stderr, "[compositor] Could not present backing store. rendertarget->present: %s\n", strerror(ok));
@@ -1007,7 +1043,7 @@ static bool on_present_layers(
10071043
(int) round(layers[i]->offset.y),
10081044
(int) round(layers[i]->size.width),
10091045
(int) round(layers[i]->size.height),
1010-
i,
1046+
i + min_zpos,
10111047
cb_data->userdata
10121048
);
10131049
if (ok != 0) {

src/flutter-pi.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1035,7 +1035,6 @@ void on_pageflip_event(
10351035

10361036
flutterpi.flutter.libflutter_engine.FlutterEngineTraceEventInstant("pageflip");
10371037

1038-
printf("[%12.6f] pageflip ocurred at %12.6f\n", flutterpi.flutter.libflutter_engine.FlutterEngineGetCurrentTime() / 1000000000.0, sec + usec / 1000000.0);
10391038

10401039
cqueue_lock(&flutterpi.frame_queue);
10411040

0 commit comments

Comments
 (0)