Commit graph

59 commits

Author SHA1 Message Date
Simon Ser
2aabaf8809 examples: enable new outputs 2023-06-27 16:26:30 +00:00
Alexander Orzechowski
9b9ee51b09 examples/tablet: Don't use new render API and old render API together
We're using both APIs at the same time.
2023-06-26 19:09:12 -04:00
Simon Ser
be05097968 output: add wlr_output_state_init()
This changes the semantics of wlr_output_state. Instead of having
fields with uninitialized memory when missing from the committed
bitflag, all fields are always initialized (and maybe NULL/empty),
just like we do in wlr_surface_state. This reduces the chances of
footguns when reading a field, and removes the need to check for
the committed bitfield everywhere.

A new wlr_output_state_init() function takes care of initializing
the Pixman region.
2023-06-23 18:07:26 +00:00
Alexander Orzechowski
495bcbeedd examples: Drop usage of wlr_output.pending 2023-06-13 09:19:51 +00:00
Rose Hudson
9e8947e4d5 add render timer API
Based on five calls:
wlr_render_timer_create - creates a timer which can be reused across
  frames on the same renderer
wlr_renderer_begin_buffer_pass - now takes a timer so that backends can
  record when the rendering starts and finishes
wlr_render_timer_get_time - should be called as late as possible so that
  queries can make their way back from the GPU
wlr_render_timer_destroy - self-explanatory

The timer is exposed as an opaque `struct wlr_render_timer` so that
backends can store whatever they want in there.
2023-06-05 19:50:07 +00:00
Simon Ser
8e81b4bb42 examples: convert to new rendering API
Left out multi-pointer (will be removed) and quads (requires
arbitrary rotation).
2023-05-30 16:18:19 +00:00
Simon Ser
41b7acbab7 backend: return wlr_session in wlr_backend_autocreate() call
Up until now, wlr_backend_autocreate() created the wlr_session and
then stuffed it into struct wlr_multi_backend so that compositors
can grab it later.

This is an abuse of wlr_multi_backend and the wlr_backend API:
wlr_backend_get_session() and wlr_multi_backend.session only exist
to accomodate the needs of wlr_backend_autocreate(). What's more,
the DRM and libinput backends don't implement
wlr_backend_impl.get_session.

Instead, return the struct wlr_session to the compositor in the
wlr_backend_autocreate() call. wlr_backend_get_session() will be
removed in the next commit.
2022-11-15 21:16:25 +00:00
Isaac Freund
91943a68a6 wlr_input_device: remove anon union field
This union is unnecessary since the recent input device refactor and can
now be replaced by wlr_*_from_input_device() functions.
2022-06-21 18:42:07 +00:00
Simon Zeni
e732c5c895 types/wlr_tablet_tool: uniformize events name 2022-03-17 18:16:14 +00:00
Simon Zeni
d1f543a9d8 types/wlr_tablet_pad: uniformize events name 2022-03-17 18:16:14 +00:00
Simon Zeni
9a17200446 types/wlr_keyboard: uniformize events name 2022-03-17 18:16:14 +00:00
Simon Zeni
96ccc50c57 types/wlr_input_device: move width_mm and height_mm fields to wlr_tablet and wlr_touch 2022-03-17 13:44:19 -04:00
Simon Zeni
6d6e70b9e0 examples: init wlr_output with allocator and renderer 2021-11-18 09:37:57 -05:00
Simon Zeni
e192d87731 move wlr_box from /types to /util 2021-07-06 21:43:17 +02:00
Simon Ser
fbc2182b9f Stop specifying xkb_rule_names
If a NULL xkb_rule_names pointer is passed to
xkb_keymap_new_from_names, libxkbcommon will default to reading
the XKB_* env variables. So there's no need to do it ourselves.

Also s/xkb_map_new_from_names/xkb_keymap_new_from_names/ since the
latter is more consistent with the returned struct name.

[1]: https://xkbcommon.org/doc/current/structxkb__rule__names.html
2021-04-19 17:33:28 +02:00
Simon Ser
83670fce65 examples: remove dependency on GLES2 for compositor examples
Most of the examples had a GLES2 dependency, but weren't using it.
Convert multi-pointer to wlr_renderer instead of using directly
glClear.
2021-04-19 17:32:07 +02:00
Simon Ser
fd7e565ce3 examples: use wlr_output_preferred_mode 2021-04-19 17:25:41 +02:00
Simon Ser
4b03bdc3ab Remove wlr_create_renderer_func_t
This callback allowed compositors to customize the EGL config used by
the renderer. However with renderer v6 EGL configs aren't used anymore.
Instead, buffers are allocated via GBM and GL FBOs are rendered to. So
customizing the EGL config is a no-op.
2020-12-30 17:09:40 +01:00
Isaac Freund
e06c9e43af Remove unneeded includes from wlr_input_device.h
This uncovered many places where we were using things without directly
including them.
2020-11-11 15:40:47 +01:00
Scott Anderson
2fea2fced8 examples: Fix compositor-examples
Due to the way the wlr_output API was changed, these examples would
never get a frame event to start the rendering loop. We now commit the
outputs to start it.
2020-02-08 11:38:44 +01:00
Simon Ser
16e5e9541b Add -Wmissing-prototypes
This requires functions without a prototype definition to be static.
This allows to detect dead code, export less symbols and put shared
functions in headers.
2019-11-20 02:05:03 +00:00
Simon Ser
ca45f4490c Remove all wayland-server.h includes
The documentation for wayland-server.h says:

> Use of this header file is discouraged. Prefer including
> wayland-server-core.h instead, which does not include the server protocol
> header and as such only defines the library PI, excluding the deprecated API
> below.

Replacing wayland-server.h with wayland-server-core.h allows us to drop the
WL_HIDE_DEPRECATED declaration.
2019-07-27 15:49:32 -04:00
Simon Ser
23e37e7b1d output: refactor frame submission API
This is necessary for direct scan-out and other upcoming features. This patch
changes the output API to look like the wl_surface API.

Outputs now have some double-buffered state: the frame to be submitted
(currently only wlr_renderer frames are supported) and the damaged region.
To attach a pending frame, use wlr_output_attach_render. To set the pending
damaged region, use wlr_output_set_damage.

To submit the pending state, call wlr_output_commit. This will submit the
pending frame to the backend.

To migrate from the old API to the new one:

- Replace wlr_output_make_current calls by wlr_output_attach_render
- Replace wlr_output_swap_buffers calls by wlr_output_set_damage and
  wlr_output_commit
2019-04-23 14:34:30 -06:00
random human
7105864e13
Handle setting keymap in examples more securely 2018-09-03 02:43:44 +05:30
emersion
f86f1daf9a Fix build on FreeBSD 2018-08-16 10:54:45 +01:00
Markus Ongyerth
d9e978e1b3 rename wlr_tablet_tool to wlr_tablet
The previous naming was based on the input-device capability names from
libinput.
With code that uses the libinput_tablet_tool and mapping into tablet-v2,
this is confusing, so the name is changed to follow the names used in
the protocol.
2018-07-14 09:49:58 +02:00
emersion
7cbef15206
util: add wlr_ prefix to log symbols 2018-07-09 22:49:54 +01:00
Tobias Blass
a21894a844 Fix double-free in the tablet.c and touch.c examples
The wl_display_destroy function already destroys the backend's renderer.
Freeing it by hand causes a segmentation fault.
2018-05-30 08:24:25 +02:00
Ilia Bozhinov
24cf70ae96 backends: implement custom EGL and renderer initialization
Compositors now have more control over how the backend creates its
renderer. Currently all backends create an EGL/GLES2 renderer, so
the necessary attributes for creating the context are passed to a
user-provided callback function. It is responsible for initializing
provided wlr_egl and to return a renderer. On fail, return 0.

Fixes #987
2018-05-25 14:56:52 +03:00
Timidger
9a1d0e42d2
Fixed emersion's issues 2018-05-10 19:03:58 -07:00
Timidger
7da50d065b
Fixed style issues 2018-05-10 19:03:58 -07:00
Timidger
7be5dfecc0
Made tablet standalone 2018-05-10 19:03:57 -07:00
Timidger
ad6d40c7c6
Moved cat out of support, removed support 2018-05-10 19:03:56 -07:00
emersion
f63a5d881d
examples: get wlr_renderer from the backend 2018-04-01 16:57:29 -04:00
emersion
33a2eb4b77
Untie wlr_backend from wlr_renderer 2018-03-31 18:49:43 -04:00
Drew DeVault
ac219cbda6 Remove width_mm from tablet events 2018-03-28 12:05:37 -04:00
emersion
793c3b3047
render: add simple functions to render rectangles and ellipses 2018-03-26 12:41:51 -04:00
emersion
3581573bdc
render/gles2: make wlr_renderer_begin take viewport size
This allows raw GL calls outside wlr_renderer to be removed.
2018-03-21 07:37:09 +01:00
emersion
c41de2d1be
render: split render.h into wlr_renderer.h and wlr_texture.h 2018-03-19 23:16:29 +01:00
emersion
824a95ad19
matrix: use 2D matrices 2018-03-15 15:33:58 +01:00
emersion
d26b67cb06
matrix: unify API, don't use array pointers 2018-03-15 11:10:56 +01:00
emersion
b6a3f240c7
matrix: move to types/ 2018-03-15 09:11:27 +01:00
Drew DeVault
bfc0e95d2c Add mode support to libinput backend
And extend tablet example with tilt and ring support
2018-03-07 20:57:55 -05:00
emersion
ddb1779f9f
render: make wlr_renderer_clear take a float[4] for the color 2018-02-03 09:32:02 +01:00
emersion
415a2b7c56
render: add wlr_renderer_clear and wlr_renderer_scissor 2018-01-22 16:42:22 +01:00
emersion
0365b587f0
output: add damage tracking via buffer age 2018-01-21 00:06:35 +01:00
emersion
e29a0df8c1
output: fix software cursors damage tracking 2018-01-19 14:08:47 +01:00
Timidger
264ef0c261
Fixed logging for examples 2018-01-15 22:51:00 -05:00
Drew DeVault
4f73498b78 Move shared example code 2017-11-01 15:47:58 -04:00
Drew DeVault
61e451ea1b Move keyboard logic to wlr_{keyboard,seat} 2017-09-24 14:12:56 -04:00