On 29 October 2016 at 18:59, Chad Versace <chadvers...@chromium.org> wrote: > On Wed 19 Oct 2016, Emil Velikov wrote: >> On 18 October 2016 at 18:33, Chad Versace <chadvers...@chromium.org> wrote: >> > Now waffle_init() supports WAFFLE_PLATFORM_SURFACELESS_EGL. >> > >> > Cc: Gurchetan Singh <gurchetansi...@chromium.org> >> > Cc: Haixia Shi <h...@chromium.org> >> > --- >> > include/waffle/waffle.h | 1 + >> > man/waffle_init.3.xml | 9 ++ >> > src/waffle/CMakeLists.txt | 9 ++ >> > src/waffle/api/waffle_init.c | 12 +++ >> > src/waffle/egl/wegl_platform.c | 6 ++ >> > src/waffle/surfaceless_egl/sl_display.c | 70 +++++++++++++++ >> > src/waffle/surfaceless_egl/sl_display.h | 45 ++++++++++ >> > src/waffle/surfaceless_egl/sl_platform.c | 144 >> > +++++++++++++++++++++++++++++++ >> > src/waffle/surfaceless_egl/sl_platform.h | 49 +++++++++++ >> > src/waffle/surfaceless_egl/sl_window.c | 92 ++++++++++++++++++++ >> > src/waffle/surfaceless_egl/sl_window.h | 53 ++++++++++++ >> > 11 files changed, 490 insertions(+) >> > create mode 100644 src/waffle/surfaceless_egl/sl_display.c >> > create mode 100644 src/waffle/surfaceless_egl/sl_display.h >> > create mode 100644 src/waffle/surfaceless_egl/sl_platform.c >> > create mode 100644 src/waffle/surfaceless_egl/sl_platform.h >> > create mode 100644 src/waffle/surfaceless_egl/sl_window.c >> > create mode 100644 src/waffle/surfaceless_egl/sl_window.h >> > > >> Should there be an extra case in src/waffle/core/wcore_util.c's >> wcore_enum_to_string() ? > > Oops. I squashed the fix into this patch. > >> > +// [chadv] I regret the design of the get_native interface, and wish to >> > +// deprecate and replace it with the interface that Ian Romanick orignally >> > +// recommended: waffle_display_get_egl_display(), >> > +// waffle_display_get_gbm_device(), waffle_display_get_xlib_display(), >> > etc. As >> > +// a first step towards that goal, I choose to not support the interface >> > on new >> > +// platforms. > >> Silly question: what's wrong with the current [generic] get_native_{foo,bar} >> ? > > Each get_native function returns a non-extensible struct. The problem is > the non-extensibility. > > Example 1: > > On Wayland, waffle_window_get_window() returns > > struct waffle_wayland_window { > struct waffle_wayland_display display; // Definition below > struct wl_surface *wl_surface; > struct wl_shell_surface *wl_shell_surface; > struct wl_egl_window *wl_window; > EGLSurface egl_surface; > }; > > struct waffle_wayland_display { > struct wl_display *wl_display; > struct wl_compositor *wl_compositor; > struct wl_shell *wl_shell; > EGLDisplay egl_display; > }; > > If in the future we need to add more members to that struct, or even > remove > members, due to changes in Wayland, then there is no good way to do > that. > > Example 2: > > I want to add the ability to do KMS with waffle_window/waffle_display > on > the gbm and surfaceless platforms. Again, because the get_native > structs > are non-extensible, there is no good way for > waffle_window_get_native()/waffle_display_get_native() to return > things > such as the CRTC. > > So I see two solutions: > > Solution 1: Change the get_native APIs to return "extensible" structs. If > someone is going to go through all that trouble, though, they might as > well go with solution 2, which is cleaner and less work. > > Solution 2: For each possible native resourse of each Waffle resource, add > a specific getter that returns null-or-whatever if it doesn't exist. For > example, > > EGLSurface waffle_window_get_egl_surface(...); > struct gbm_surface *waffle_window_get_gbm_surface(...);
IMHO the only part that prevents one to extend the structs is the embedded waffle_$platform_display into the confirg/context/window structs. With those converted to struct * things should be just fine. On the removal side - I cannot think of any way to make that happen w/o breaking the API/ABI. Be that with the current or proposed solution. If anything I'd opt/suggest the struct * route since it will results in less code - within waffle, its API and the users. The work for ^^ will be mostly copy/paste afaics. Emil _______________________________________________ waffle mailing list waffle@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/waffle