emersion/libliftoff

Check format & modifier

Opened this issue · 3 comments

Before trying an atomic test commit, check the format & modifier is compatible.

It's not clear it's a good idea yet: all we get is a FB ID. We can drmModeGetFB it, but then we don't save an ioctl. If we cache the info, it may become out-of-date (e.g. FB deleted and re-created with another format).

Maybe we can just get the format/modifier from the library user. Need to check whether that would really improve performance though.

but then we don't save an ioctl

Actually, if we only drmModeGetFB once at the beginning of the plane alloc (or lazily), then we could save multiple atomic test commits.

Unfortunately drmModeGetFB doesn't provide the format/modifier. We'll need to get it from the compositor (liftoff_layer_set_fb?), which we may have ended up doing anyway to avoid getting from the kernel information owned by the compositor itself.

There's a patch for getFB2: https://patchwork.freedesktop.org/patch/334263/?series=67552&rev=1

Still not sure it's a good idea to use it.