wlroots icon indicating copy to clipboard operation
wlroots copied to clipboard

API stability guarantee

Open ddevault opened this issue 7 years ago • 36 comments

We need to make a plan and set a deadline for enforcing it. I'm thinking we make our first stability guarantees by July 1st.

I think we should do this by headers, marking older headers as stable and newer headers as unstable, and over time graduate everything to stable.


Non-standard and unstable protocol implementations are stricken-through.

  • [ ] backend
    • [ ] drm.h
    • [ ] headless.h
    • [ ] interface.h
    • [ ] libinput.h
    • [ ] multi.h
    • [ ] noop.h
    • [ ] session.h
    • [ ] wayland.h
    • [ ] x11.h
  • [ ] backend.h
  • [ ] config.h
  • [ ] interfaces
    • [ ] wlr_input_device.h
    • [ ] wlr_keyboard.h
    • [ ] wlr_output.h
    • [ ] wlr_pointer.h
    • [ ] wlr_switch.h
    • [ ] wlr_tablet_pad.h
    • [ ] wlr_tablet_tool.h
    • [ ] wlr_touch.h
  • [ ] render
    • [ ] dmabuf.h
    • [ ] drm_format_set.h
    • [ ] egl.h
    • [ ] gles2.h
    • [ ] interface.h
    • [ ] pixman.h
    • [ ] wlr_renderer.h
    • [ ] wlr_texture.h
  • [ ] types
    • [x] ~~wlr_box.h~~
    • [ ] wlr_buffer.h
    • [ ] wlr_compositor.h
    • [ ] wlr_cursor.h
    • [x] ~~wlr_data_control_v1.h~~
    • [ ] wlr_data_device.h
    • [x] ~~wlr_drm.h~~
    • [x] ~~wlr_export_dmabuf_v1.h~~
    • [x] ~~wlr_foreign_toplevel_management_v1.h~~
    • [x] ~~wlr_fullscreen_shell_v1.h~~
    • [x] ~~wlr_gamma_control_v1.h~~
    • [x] ~~wlr_idle.h~~
    • [x] ~~wlr_idle_inhibit_v1.h~~
    • [ ] wlr_input_device.h
    • [x] ~~wlr_input_inhibitor.h~~
    • [x] ~~wlr_input_method_v2.h~~
    • [ ] wlr_keyboard.h
    • [ ] wlr_keyboard_group.h
    • [x] ~~wlr_keyboard_shortcuts_inhibit_v1.h~~
    • [x] ~~wlr_layer_shell_v1.h~~
    • [x] ~~wlr_linux_dmabuf_v1.h~~
    • [x] wlr_matrix.h
    • [ ] wlr_output.h
    • [ ] wlr_output_damage.h
    • [ ] wlr_output_layout.h
    • [x] ~~wlr_output_management_v1.h~~
    • [x] ~~wlr_output_power_management_v1.h~~
    • [ ] wlr_pointer.h
    • [x] ~~wlr_pointer_constraints_v1.h~~
    • [x] ~~wlr_pointer_gestures_v1.h~~
    • [ ] wlr_presentation_time.h
    • [ ] wlr_primary_selection.h
    • [x] ~~wlr_primary_selection_v1.h~~
    • [x] wlr_region.h
    • [x] ~~wlr_relative_pointer_v1.h~~
    • [x] ~~wlr_screencopy_v1.h~~
    • [ ] wlr_seat.h
    • [x] ~~wlr_server_decoration.h~~
    • [ ] wlr_surface.h
    • [ ] wlr_switch.h
    • [ ] wlr_tablet_pad.h
    • [ ] wlr_tablet_tool.h
    • [x] ~~wlr_tablet_v2.h~~
    • [x] ~~wlr_text_input_v3.h~~
    • [ ] wlr_touch.h
    • [ ] wlr_viewporter.h
    • [x] ~~wlr_virtual_keyboard_v1.h~~
    • [x] ~~wlr_virtual_pointer_v1.h~~
    • [ ] wlr_xcursor_manager.h
    • [x] ~~wlr_xdg_activation_v1.h~~
    • [x] ~~wlr_xdg_decoration_v1.h~~
    • [ ] wlr_xdg_foreign_registry.h
    • [x] ~~wlr_xdg_foreign_v1.h~~
    • [x] ~~wlr_xdg_foreign_v2.h~~
    • [x] ~~wlr_xdg_output_v1.h~~
    • [ ] wlr_xdg_shell.h
  • [x] util
    • [x] box.h
    • [x] edges.h
    • [x] log.h
    • [x] region.h
  • [ ] version.h
  • [x] xcursor.h
  • [ ] xwayland.h

wlroots has migrated to gitlab.freedesktop.org. This issue has been moved to:

https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/1008

ddevault avatar May 27 '18 14:05 ddevault

I'm all for that. It makes my work on wlroots-rs easier as it means I can definitely be sure to finish wrapping something (which is non trivial with Rust's safety guarantees).

Timidger avatar May 27 '18 18:05 Timidger

Missing stability promises are the reason hsroots lags behind and mostly just supports waymonad :)

And I think it's a good idea to have a set of unstable APIs as well. I don't think huge additions like the tablet_v2 PR should be stable from the get go. Any plans on how to define them? Have them behind a if WLR_USE_UNSTABLE, under include/wlr/unstable/, a prose comment, or something completly different?

And for the transition from an unstable API to stable I suggest as rule of thumb: Implementation needs to be finished in one external compositor, written by someone who didn't add it to wlroots. I.e. waymonad wouldn't count for my additions to wlroots. This should ensure someone else used the API.

Ongy avatar May 28 '18 06:05 Ongy

In terms of ABI stability we can change WLROOTS_0_0_0 in wlrotos.symbols to WLROOTS_0_1_0 and put the existing symbols in there adding the current wlr_* to a new WLROOTS_UNSTABLE {} section. (and doing the same for 0_2_0, ... and so on.

For API stability version macros like glib based libraries use them could be used:

https://github.com/GNOME/glib/blob/master/glib/gversionmacros.h

agx avatar May 28 '18 07:05 agx

Let's keep it simple.

if WLR_USE_UNSTABLE

I like this

ddevault avatar May 28 '18 13:05 ddevault

I feel like we're getting really close to being stable. But I'd like to go through and see if anything should be made private. It's easier to add them back in later versions than it is to remove them.

acrisci avatar May 28 '18 19:05 acrisci

Also, where did we land on supporting multiple renderers? That will certainly be breaking.

acrisci avatar May 28 '18 19:05 acrisci

Also, where did we land on supporting multiple renderers? That will certainly be breaking.

RIP

emersion avatar May 28 '18 20:05 emersion

The multiple renders sounds like it would add a lot more time if we wanted it in 1.0. Is it a feature that couldn't wait until a 2.0 in the future?

Timidger avatar May 29 '18 13:05 Timidger

Multiple renderers won't happen.

emersion avatar May 29 '18 13:05 emersion

The only interface that isn't well-tested is the renderer. I'm not aware of anyone who is doing anything that might stretch the interface that might become a common use case in the future like animations except for the wayfire guy. @ammen99 do you see the renderer as it is now good enough for you to do your cube thing?

acrisci avatar May 29 '18 21:05 acrisci

@acrisci I think the rendering process in its current shape is quite good, except for the following:

A thing that "works" but is not guaranteed to work is the target framebuffer of all wlr_renderer_* operations. Currently GLES2 uses whatever I bind before these calls, but this isn't stated anywhere in the documentation.

Aside from that, the only other thing I'd like is to add the ability to have direct access to GLES2 textures, but that's only to optimize performance in some cases, so not really needed.

These both depend on #775, but if you want to leave that for wlroots 2.0, I have nothing against.

ammen99 avatar May 30 '18 04:05 ammen99

A thing that "works" but is not guaranteed to work is the target framebuffer of all wlr_renderer_* operations. Currently GLES2 uses whatever I bind before these calls, but this isn't stated anywhere in the documentation.

Yeah, you're not supposed to use raw GL calls when you're using the renderer. wlr_output_make_current binds an output, and you're not supposed to be able to bind anything else. Making your own renderer would make you able to guarantee this works, even if we change the internal behaviour of our renderer.

These both depend on #775, but if you want to leave that for wlroots 2.0, I have nothing against.

I believe #775 can be fixed in a backwards-compatible way, so this shouldn't be an issue.

emersion avatar May 30 '18 09:05 emersion

@emersion I think you wanted to make the wlr_renderer(or at least the gles2 rendering functions) reusable?

ammen99 avatar May 30 '18 22:05 ammen99

@emersion I think you wanted to make the wlr_renderer(or at least the gles2 rendering functions) reusable?

Yes, that's the plan.

emersion avatar May 30 '18 22:05 emersion

On July 1st, let's mark all of this stable:

  • interfaces/* except for wlr_tablet_*
  • util/*
  • xcursor
  • All of the backends, but not session

Types:

  • wlr_box
  • wlr_compositor
  • wlr_cursor
  • wlr_input_device
  • wlr_list
  • wlr_matrix
  • wlr_output_damage
  • wlr_output_layout
  • wlr_output
  • wlr_pointer
  • wlr_region
  • wlr_touch
  • wlr_xcursor_manager
  • wlr_xdg_shell

We're not going to mark stable anything that implements an unstable Wayland protocol. If we need an interface to be stable, we should start pushing on wayland-devel for the protocol's promotion.

Chose not to mark wlr_keyboard as stable since we've recently been sorting out some kinks with xkbcommon, and we might need to change it to support Purism's OSK work (though it seems we might be okay without any changes - let's see how it plays out before we go making any stability promises).

Chose not to mark wlr_seat as stable yet because it's complicated and I'm nervous about making any promises about it yet.

Holding off on wlr_data_device while Xwayland stuff is still up in the air.

Holding off on marking the renderer as stable, probably for a good long time. I want to make wlr_texture and wlr_buffer stable soon, though.

Holding off on the wlr_session stuff because I don't think we adequately tested or thought about all of the problems we may encounter on systems without logind/dbus/udev.

The plan

Anything headers not listed above will have the following added to them:

#ifndef WLR_USE_UNSTABLE
#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features"
#endif

Any stable headers will get:

/*
 * This is a stable interface of wlroots. Future changes are limited to:
 *
 * - New struct members
 * - New enum members
 * - New functions
 *
 * Do not stack- or statically-allocate stable structs and expect them to be
 * binary-compatible with future wlroots releases; allow wlroots to allocate
 * them on the heap for you.
 *
 * Breaking changes are announced on GitHub and follow a 1-year deprecation
 * schedule.
 */

Eventually I want to replace GitHub announcements with a wlroots-announce mailing list, but that'll have to wait until lists.sr.ht is a thing.

The future

We can extend things marked as stable, but:

  • We can only add struct members, never remove them, and only to the end of the struct. Structs which change in size cannot be inlined in other structs before other members.
  • We can only add new enum members, and only to the end of the list.
  • We cannot change function signatures, only add new functions.

If we must make breaking changes, we will mark the features as deprecated and announce the changes 1 year in advance, and bump the so version when the big day comes.

New features in stable interfaces can themselves be marked unstable.

struct some_stable_struct {
    int stable_member;
/* NOTE: unstable members follow */
    int unstable_member;
};

#ifdef WLR_USE_UNSTABLE

void some_new_function(void);

#endif

ddevault avatar Jun 09 '18 16:06 ddevault

We're not going to mark stable anything that implements an unstable Wayland protocol. If we need an interface to be stable, we should start pushing on wayland-devel for the protocol's promotion.

I don't understand this one. Unstable protocols get the same guarantees as stable protocols in wayland-protocols.

emersion avatar Jun 09 '18 17:06 emersion

If we mark it as stable we can't remove it. I don't want to have a bunch of pomp and circumstance around e.g. removing wlr_xdg_shell_v6 in favor of wlr_xdg_shell.

ddevault avatar Jun 09 '18 17:06 ddevault

wlr_list

I think this should be removed entirely.

Holding off on the wlr_session stuff because I don't think we adequately tested or thought about all of the problems we may encounter on systems without logind/dbus/udev.

I'm not sure if it's even worth trying to support systems without udev. At least, if we're going to do that, it'll be extremely bare-bones and not support hotplugging.

ascent12 avatar Jun 09 '18 22:06 ascent12

I think this should be removed entirely.

Fair enough.

I'm not sure if it's even worth trying to support systems without udev. At least, if we're going to do that, it'll be extremely bare-bones and not support hotplugging.

Also fair.

ddevault avatar Jun 09 '18 22:06 ddevault

Holding off on marking the renderer as stable, probably for a good long time.

Why? If you want to support renderers other than GLES2 in wlroots 1.x, we need to mark backends as unstable too, because they'll likely be affected too.

emersion avatar Jun 10 '18 15:06 emersion

Why? If you want to support renderers other than GLES2 in wlroots 1.x, we need to mark backends as unstable too, because they'll likely be affected too.

We might need to mark backend_autocreate as unstable. I'm not thrilled with the renderer create function in any case, it might be worth reconsidering how that works.

ddevault avatar Jun 11 '18 02:06 ddevault

We might need to mark backend_autocreate as unstable.

You probably mean "all functions that create a backend".

I'm not thrilled with the renderer create function in any case, it might be worth reconsidering how that works.

I was thinking of replacing that with a struct.

emersion avatar Jun 11 '18 06:06 emersion

Deadline is tomorrow.

ddevault avatar Jun 30 '18 14:06 ddevault

We can only add struct members, never remove them, and only to the end of the struct. Structs which change in size cannot be inlined in other structs before other members.

~~How does that work with events? It won't be possible to add new events anymore.~~ → we decided to only guarantee API stability, not ABI stability

~~https://github.com/swaywm/wlroots/issues/1096~~

wlr_box

~~https://github.com/swaywm/wlroots/issues/1094~~

wlr_output_layout

https://github.com/swaywm/wlroots/issues/1083 https://github.com/swaywm/wlroots/issues/1013 https://github.com/swaywm/wlroots/issues/812

wlr_output

https://github.com/swaywm/wlroots/issues/1058

util

~~https://github.com/swaywm/wlroots/pull/1011~~

And we also have:

~~https://github.com/swaywm/wlroots/issues/1087~~ https://github.com/swaywm/wlroots/issues/884 https://github.com/swaywm/wlroots/issues/833 https://github.com/swaywm/wlroots/issues/770

wlr_surface is not mentioned (neither in the stable list nor in the unstable one), but there's ongoing work on it.

(Maybe I forgot some issues)

emersion avatar Jun 30 '18 18:06 emersion

How does that work with events? It won't be possible to add new events anymore.

Hm. I think we might have to get rid of the nested structs for this.

ddevault avatar Jun 30 '18 18:06 ddevault

I would hold back on marking wlr_output_layout as stable until #1013 and maybe #1083 are fixed. #1013 and one of the proposed solutions of #1083 require API changes. I wouldn't mind working on them, but I don't know what would be the best solution for either issue. EDIT: missed the previous comments

VincentVanlaer avatar Jun 30 '18 19:06 VincentVanlaer

Ah, missed an issue with util/log.h: ~~https://github.com/swaywm/wlroots/pull/1011~~

emersion avatar Jul 01 '18 21:07 emersion

Is there a list of what can be stabilized next and what the remaining issues are for those items?

Timidger avatar Dec 21 '18 16:12 Timidger

Suggest some?

ddevault avatar Dec 21 '18 16:12 ddevault

wlr_box is a good candidate, I remember someone mentioning there were still some open issues on that. All I could find was #1094. I'll take a crack at this one.

wlr_region.h maybe?

xdg shell as a protocol is stable, so it would be nice to try to stabilize that though I'm sure there's still some issues regarding it.

What's blocking the input types? wlr_keyboard had some xkbcommon kinks, were those every fixed?

wlr_output only has #1058, not sure if that's blocking enough to not stabilize it.

wlr_compositor shouldn't have any blockers?

xcursor is stable, so what is blocking xcursor_manager?

Timidger avatar Dec 21 '18 18:12 Timidger