X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;ds=sidebyside;f=src%2Flibsystemd-terminal%2Fgrdev-drm.c;h=dba6db2691c836cf009a4cf6fb6fcb38ec0d1dec;hb=aba248ee6b1eb10baf3d89eca2ad7569459af6ab;hp=57b930bc0faff523b6bbc8ea3905d1a806463efa;hpb=aec3f44651998211d559b474bb830aad65680a62;p=elogind.git diff --git a/src/libsystemd-terminal/grdev-drm.c b/src/libsystemd-terminal/grdev-drm.c index 57b930bc0..dba6db269 100644 --- a/src/libsystemd-terminal/grdev-drm.c +++ b/src/libsystemd-terminal/grdev-drm.c @@ -1158,8 +1158,21 @@ static int grdrm_crtc_commit_flip(grdrm_crtc *crtc, grdev_fb *basefb) { assert(basefb); assert(pipe); - if (!crtc->applied && !grdrm_modes_compatible(&crtc->kern.mode, &crtc->set.mode)) + if (!crtc->applied) { + if (!grdrm_modes_compatible(&crtc->kern.mode, &crtc->set.mode)) + return 0; + + /* TODO: Theoretically, we should be able to page-flip to our + * framebuffer here. We didn't perform any deep modeset, but the + * DRM driver is really supposed to reject our page-flip in case + * the FB is not compatible. We then properly fall back to a + * deep modeset. + * As it turns out, drivers don't to this. Therefore, we need to + * perform a full modeset on enter now. We might avoid this in + * the future with fixed drivers.. */ + return 0; + } fb = fb_from_base(basefb); @@ -1442,6 +1455,9 @@ grdrm_fb *grdrm_fb_free(grdrm_fb *fb) { assert(fb->card); + if (fb->base.free_fn) + fb->base.free_fn(fb->base.data.ptr); + if (fb->id > 0 && fb->card->fd >= 0) { r = ioctl(fb->card->fd, DRM_IOCTL_MODE_RMFB, fb->id); if (r < 0) @@ -1546,9 +1562,23 @@ static grdev_fb *grdrm_pipe_target(grdev_pipe *basepipe) { return basepipe->back; } +static void grdrm_pipe_enable(grdev_pipe *basepipe) { + grdrm_pipe *pipe = grdrm_pipe_from_base(basepipe); + + pipe->crtc->applied = false; +} + +static void grdrm_pipe_disable(grdev_pipe *basepipe) { + grdrm_pipe *pipe = grdrm_pipe_from_base(basepipe); + + pipe->crtc->applied = false; +} + static const grdev_pipe_vtable grdrm_pipe_vtable = { .free = grdrm_pipe_free, .target = grdrm_pipe_target, + .enable = grdrm_pipe_enable, + .disable = grdrm_pipe_disable, }; /*