Commit Graph

339 Commits

Author SHA1 Message Date
emersion 46b1ba386f output: remove idle_frame event source when destroying output
This prevents the idle event to be activated on a destroyed
output.

This also makes the backend responsible for free-ing modes, as it
is the one allocating them and adding them to the list. Note that
the DRM backend (the only one using modes) already frees them.
2018-10-09 10:55:03 +02:00
ixru 8d0997a5e7 Better placement of visibility check 2018-10-08 15:58:24 +02:00
ixru 6a9995d18c Fix cursor visibility on surface commit 2018-10-07 21:26:38 +02:00
emersion 5afaccedfc output: fix busy loop when backend doesn't implement schedule_frame 2018-10-05 16:26:40 +02:00
emersion ba91422747 output: don't trigger a frame immediately in schedule_frame
This desynchronizes our rendering loop with the vblank cycle.

In case a compositor doesn't swap buffers but schedules a frame,
emitting a frame event immediately enters a busy-loop.

Instead, ask the backend to send a frame when appropriate. On
Wayland we can just register a frame callback on our surface. On
DRM we can do a no-op pageflip.

Fixes #617
Fixes swaywm/sway#2748
2018-10-05 16:18:37 +02:00
Drew DeVault 1e70b4cea2
Revert "Prevent excessive frame events when compositor doesn't swap buffers" 2018-10-05 07:37:41 -04:00
Ryan Dwyer b7b781ff44 Prevent excessive frame events when compositor doesn't swap buffers
When we send an output frame event, we should not assume that the
compositor is going to call wlr_output_swap_buffers in response to it.
If the compositor does not swap the buffers, the idle event source still
exists and is executed every time the Wayland event loop becomes idle,
which means we send frame events repeatedly until the buffers are
swapped.

This moves the removal of the idle event source out of
wlr_output_swap_buffers and into wlr_output_send_frame, where it is
guaranteed to be removed.
2018-10-05 20:14:34 +10:00
emersion eac7c2ad2f output: add presentation refresh prediction 2018-10-04 22:00:24 +02:00
emersion b0635bf3e7 Rename get_present_clock to get_presentation clock, use it 2018-10-04 22:00:22 +02:00
emersion abddfc99f2 output: fix clock_gettime return value handling 2018-10-04 21:58:17 +02:00
emersion 54e1287f30 backend: add get_present_clock 2018-10-04 21:58:17 +02:00
emersion 26b9d6dbb1 output: send present event from all backends 2018-10-04 21:56:38 +02:00
emersion 78389fe722 output: add present event 2018-10-04 21:56:38 +02:00
emersion 2beb68007e output: make gamma size a size_t and gamma table const 2018-10-03 10:36:33 +02:00
emersion 928572c14d output: add wlr_output_set_hardware_cursors_enabled
And use it in screencopy.
2018-09-18 11:37:37 +02:00
Drew DeVault df991a55ab
Merge pull request #1241 from emersion/output-enable-error-checking
output: make wlr_output_enable return a bool
2018-09-14 21:14:18 -04:00
emersion cb293f09e7 output: make wlr_output_enable return a bool 2018-09-14 18:18:07 +02:00
emersion 524702eb16 output: introduce WLR_NO_HARDWARE_CURSORS 2018-09-14 18:07:21 +02:00
emersion 017cfb0b86 backend/drm: log when de-allocating CRTC 2018-09-04 19:44:44 +02:00
emersion a149c2370a Implement wlr-gamma-control-unstable-v1 2018-08-02 23:33:04 +01:00
Markus Ongyerth 9a6f77fc2c tablet-v2: fix merge commits and test again
There were a few issues after rebase, that the merge algorithm didn't
throw at my face:

wlr_output did a check on the actual role, not a string anymore, so that
had to go to allow tablet-v2 to set cursor surfaces.
A few L_DEBUG/L_ERRORs were still around
There was a user-after-free in tablet-group free()ing, probably after
insufficient testing from a previous feedback pass
2018-07-14 10:29:22 +02:00
Drew DeVault e226e2c011 Missed some old wlr_log calls 2018-07-11 18:36:31 -04:00
Drew DeVault c0b4217fce
Merge pull request #1116 from emersion/surface-role
surface: replace wlr_surface_set_role_committed with wlr_surface_role
2018-07-11 15:27:42 -07:00
emersion 7cbef15206
util: add wlr_ prefix to log symbols 2018-07-09 22:49:54 +01:00
emersion deeca53e33
Rename wl_resources to resource, wl_global to global 2018-07-08 19:21:31 +01:00
emersion 5fe50b9a28
output: make wl_output resources inert 2018-07-07 23:02:08 +01:00
emersion 33db4263a0
surface: replace wlr_surface_set_role_committed with wlr_surface_role 2018-07-07 22:45:16 +01:00
emersion f440708274
output: fix cursor attach coords handling 2018-07-04 19:12:18 +01:00
emersion 78555abba3
surface: move position and scale out of wlr_surface_state 2018-07-04 19:12:17 +01:00
emersion 3c0d672ebd
surface: make pending and current embedded structs 2018-07-04 19:12:17 +01:00
Dominique Martinet b3313b7f39 wlr_output: fix scope for 'now'
'when' points to now that was defined in the if, so compiler could reuse
that memory area by the time 'when' is called

Found through static analysis.
2018-06-30 11:38:21 +09:00
emersion 57548b557a
Merge branch 'master' into screencontent 2018-06-17 14:49:18 +01:00
emersion 0378d143d9
surface: remove wlr_surface.texture
The texture is managed by the surface's wlr_buffer now. In
particular, the buffer can destroy the texture early if it becomes
invalid.
2018-06-13 19:38:10 +01:00
emersion 21928cbe61
Merge branch 'master' into screencontent 2018-05-31 12:33:27 +01:00
emersion e26f4dff98
export-dmabuf: wait for the frame to be ready, send timestamp 2018-05-29 18:47:17 +01:00
emersion 9e26808c28
output, backend/drm: add wlr_output_export_dmabuf 2018-05-29 18:45:45 +01:00
emersion e849a68e6e
output: correctly clear screen when fullscreened 2018-05-20 13:44:18 +01:00
emersion dbba1311b7
output: fix lingering hardware cursors 2018-05-15 18:13:26 +01:00
emersion 13098a18ea
Fix hardware cursors scale & transform 2018-05-09 19:58:18 +01:00
emersion caf9f9022c
Merge pull request #936 from emersion/full-hardware-cursors
output: always use hardware cursors if available
2018-05-04 19:00:45 +01:00
emersion 7843a48432
output: simplify and update code style 2018-05-03 18:46:17 +01:00
emersion 6b3eac37f1
output: assert move_cursor if set_cursor is available 2018-05-02 15:04:35 +01:00
emersion 225d182765
output: always use hardware cursors if available
This changes the `wlr_output_impl.set_cursor` function to take a
`wlr_texture` instead of a byte buffer. This simplifies the
DRM and Wayland backends since they were creating textures from
the byte buffer anyway.

With this commit, performance should be improved when moving the
cursor since outputs don't need to be re-rendered anymore.
2018-05-01 21:38:04 +01:00
emersion 625a7a48dc
Don't use the wlr_ prefix for static functions 2018-04-25 23:51:00 +01:00
emersion 94fa6c88f4
output: don't emit the mode event if it hasn't changed
This also fixes #535.
2018-04-18 00:15:25 +01:00
emersion 1b802d9251
Make wlr_renderer_scissor take normal coords instead of upside-down ones 2018-04-12 19:38:33 -04:00
emersion 31c8bdc277
Fix wlr_output_transform_compose 2018-04-12 19:05:05 -04:00
emersion c63d94483b
Redesign wlr_texture
- Textures are now immutable (apart from those created from raw
  pixels), no more invalid textures
- Move all wl_drm stuff in wlr_renderer
- Most of wlr_texture fields are now private
- Remove some duplicated DMA-BUF code in the DRM backend
- Add more assertions
- Stride is now always given as bytes rather than pixels
- Drop wl_shm functions

Fun fact: this patch has been written 10,000 meters up in the air.
2018-03-24 23:48:32 -04:00
emersion c41de2d1be
render: split render.h into wlr_renderer.h and wlr_texture.h 2018-03-19 23:16:29 +01:00
emersion 7894fca224
matrix: rename wlr_matrix_texture to wlr_matrix_projection 2018-03-15 21:26:45 +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
emersion 8e3d294d6a
output: fix trailing cursor at (0, 0) on startup 2018-03-11 11:21:40 +01:00
emersion a951fbb264
output: don't move hidden cursors
When using the DRM backend and multiple outputs, that reduces the
number of commits.
2018-03-07 10:22:39 +01:00
Drew DeVault 0820557c8c
Merge pull request #693 from emersion/fix-output-bind-multiple
Fix clients binding multiple times to the same output
2018-03-01 11:23:41 -05:00
emersion 90148e64ab
Fix clients binding multiple times to the same output 2018-03-01 10:19:48 +01:00
Guido Günther d08792bfff Add alpha to wlr_render_with_matrix
so we can use the alpha channel to e.g. blend in textures
2018-02-25 13:47:48 +01:00
Drew DeVault 1d9be89e2d
Revert "ELF Visibility" 2018-02-19 18:01:27 -05:00
Scott Anderson 86269052eb Explicitly export EFL symbols 2018-02-19 14:26:40 +13:00
emersion 392d54a35d
Wrap wl_resource_get_user_data into safer helper functions
This ensures we're not incorrectly casting a resource.

Fixes #628
2018-02-13 23:48:46 +01:00
emersion c2e1474010
Reformat all #include directives 2018-02-12 21:29:23 +01:00
emersion 36ead80cd1
Make wlr_signal_emit_safe private 2018-02-12 19:52:47 +01:00
emersion 10ecf871f2
Remove wlr_backend.events.{output_remove,device_remove} 2018-02-12 10:36:43 +01:00
emersion 5e58d46cc1
Add wlr_signal_emit_safe 2018-02-12 09:12:31 +01:00
emersion bf6d245400
Swap buffers with damage 2018-02-09 22:54:14 +01:00
emersion faa57341ca
output: replace raw GL calls by wlr_renderer_* calls 2018-02-03 10:01:42 +01:00
emersion 3d3ea32137
Merge remote-tracking branch 'upstream/master' into output-damage 2018-02-03 00:15:44 +01:00
emersion 8eed857292
output: add destroy signal for wlr_output_cursor 2018-02-01 12:08:35 +01:00
emersion edb4c8d858
output: damage whole output when fullscreen surface size changes 2018-01-30 22:06:10 +01:00
emersion a295c805c4
output: fix output_damage_whole for scaled outputs 2018-01-30 21:42:12 +01:00
emersion babdd6ccf7
backend: fix use-after-free when destroying backends
The backend destroy signal is emitted before the output_remove
signal is. When the destroy signal is emitted listeners remove
their output_remove listener, so the output_remove signal is never
received and listeners have an invalid output pointer.

The correct way to solve this would be to remove the output_remove
signal completely and use the wlr_output.events.destroy signal
instead. This isn't yet possible because wl_signal_emit is unsafe
and listeners cannot be removed in listeners.
2018-01-30 19:45:57 +01:00
emersion 704130cc11
output: fix performance issues with wlr_output_schedule_frame 2018-01-30 14:45:02 +01:00
emersion d498855b9d
backend/drm: fix hw cursor position on rotated and scaled outputs
output: add wlr_output_transformed_resolution
2018-01-30 10:23:35 +01:00
emersion 2cc989e097
output: restrict provided damage to output bounds 2018-01-29 23:21:30 +01:00
emersion 7881d039b6
rootston: fix output_damage_whole
This should fix artifacts when leaving fullscreen on rotated outputs.
2018-01-28 21:58:02 +01:00
emersion 485aa87468
output: fix fullscreen on transformed outputs 2018-01-28 10:40:38 +01:00
emersion 7adf13e284
Fix flickering when switching VT 2018-01-27 11:16:42 +01:00
emersion 8d58ed502b
output: add wlr_output_schedule_frame 2018-01-26 22:39:23 +01:00
emersion ece2c1e4e2
Damage tracking for transformed outputs 2018-01-26 22:11:09 +01:00
emersion 6281deb90f
Merge remote-tracking branch 'upstream/master' into output-damage 2018-01-24 14:48:01 +01:00
Markus Ongyerth f946c10cb1 re-adds wlr_output_update_enabled
Re-add the wlr_output_update_enabled to make sure
wlr_output::events.enable is called when the output enabled state
changes.
2018-01-24 10:23:48 +01:00
Markus Ongyerth 3cf7225cec decouples outputenable state and wl_output global
This decouples wlr_output_enable and the wl_global.
The previously internal functions wlr_output_(destroy/create)_global are
exposed and used automatically in the wlr_output_layout to create/tear
down the global.
The compositor can handle them itself if it wants to, but I think this
is the right moment to create/destroy the wl_output when the
wlr_output_layout is used.
2018-01-23 17:40:12 +01:00
emersion 0365b587f0
output: add damage tracking via buffer age 2018-01-21 00:06:35 +01:00
emersion 4ca38b84ed
backend/drm: fix hardware cursors not moving
This adds back `wlr_output::needs_swap`. This allows a backend to
request buffer swaps even if the output isn't damaged. This is
needed by the DRM backend to trigger pageflips when the cursor
moves.
2018-01-20 16:43:14 +01:00
emersion e29a0df8c1
output: fix software cursors damage tracking 2018-01-19 14:08:47 +01:00
emersion a0f24b809e
output: add damage event 2018-01-19 13:13:46 +01:00
emersion 443bd4cd89
output: fullscreen surface damage tracking 2018-01-19 11:20:27 +01:00
emersion f061a1da63
output: fix software cursor artifacts 2018-01-18 22:18:53 +01:00
emersion 59ba8f35ed
rootston: use surface damage 2018-01-18 21:34:10 +01:00
emersion bde255933e
output: add wlr_output::damage, fixes #572 2018-01-18 19:47:21 +01:00
emersion 0eebaf98d0
drm: do not pageflip when enabling output 2018-01-15 21:49:37 +01:00
emersion 8ebd7d4dbe
output: rename resolution event to mode 2018-01-06 12:42:32 +01:00
emersion d9ecfbaf32
Add wlr_output enable event 2018-01-04 14:51:36 +01:00
emersion 771263380c
Add wlr_output::enabled 2018-01-04 12:46:15 +01:00
Drew DeVault b23bd8ea28
Merge pull request #544 from emersion/fix-views-outside-output-layout
Fix views outside output layout
2018-01-01 11:45:08 -05:00
emersion 9ac9ba861f
Free fullscreen surface and cursors when destroying output 2017-12-31 13:00:35 +01:00
emersion 1fe1d64042
Fix views outside output layout 2017-12-31 12:49:06 +01:00
Timidger 6e9cef4ed6
Don't send custom mode info twice on DRM refresh 2017-12-28 11:12:44 -06:00
Timidger f56ce11aa0
Fixes #535 send mode info on DRM refresh once
When DRM refreshed, wlr_output_set_mode is called. It would then call
the DRM set_mode callback which sends the updated matrix and mode info.

However once that call completed it would then immediantly send the
information again. This is handled poorly by xwayland, causing it to
scale up the clients twice.
2017-12-28 11:12:44 -06:00
emersion e737f65e38
Fix cursor on transformed output with DRM backend 2017-12-26 18:16:37 +01:00
emersion 01cefbb868
Output fixes
Fixes setting a hardware cursor image twice (used to fallback to
software cursor) and destroy handlers.
2017-12-19 11:06:09 +01:00
Tony Crisci d654a12b2e remove display_destroy unlisten before output free 2017-12-18 16:24:56 -05:00
Tony Crisci c59210ad17 remove display destroy when output is destroyed 2017-12-18 15:10:32 -05:00
emersion 0256de0002
Add full refresh rate support to custom modes 2017-12-17 18:02:55 +01:00
Drew DeVault 95fddf2fa8 s/L_INFO/L_DEBUG/ @ software cursor fallback 2017-12-16 09:56:30 -05:00
emersion 80b0b327de
Remove fractional output PR artifact 2017-12-15 17:14:30 +01:00
emersion 51db087210
Introduce fractional scaling 2017-12-15 01:00:03 +01:00
Drew DeVault 23fb663ea4
Merge pull request #453 from emersion/surface-transform
Add surface transforms support
2017-12-14 14:43:04 -05:00
emersion 466e86b7b2
Merge branch 'master' into surface-transform 2017-12-14 20:31:18 +01:00
emersion 75ef7860bb
Merge branch 'master' into display-destroy 2017-12-14 20:29:30 +01:00
emersion 257559d890
Remove output instead of terminating display when a wayland backend view closed 2017-12-13 21:48:59 +01:00
emersion 3b4b8953d9
Update output layout when scale or transform changes 2017-12-12 21:58:00 +01:00
emersion c67a5824b8
Merge branch 'master' into display-destroy 2017-12-11 16:14:03 +01:00
emersion 529675b7b0
Add wlr_output_set_custom_mode 2017-12-11 12:14:23 +01:00
emersion 15bb9a53b4
Fix unscaled cursor sx, sy 2017-12-08 14:40:57 +01:00
emersion 5dc303fc26
Fix client cursors hotspot on scaled outputs 2017-12-08 14:33:02 +01:00
emersion c5fa415a03
Send wl_surface.{enter,leave} to cursor surfaces 2017-12-08 14:23:33 +01:00
emersion 0e066f0d76
Listen to display destroy in output 2017-12-07 01:12:04 +01:00
emersion dac0233804
Send new output to clients when changing transform 2017-12-06 16:54:08 +01:00
emersion bf2b58eb6d
Add wlr_output_set_scale
Fixes #465
2017-12-06 16:36:46 +01:00
emersion 6a69b4419f
Make wlr_output_transform_* functions public, refactoring 2017-12-01 09:15:33 +01:00
Tony Crisci 5d7eb438d9
Merge pull request #437 from emersion/fullscreen
Fullscreen support
2017-11-30 03:25:05 -05:00
emersion 0781f6e483
Fix initial hardware cursor position 2017-11-29 00:26:55 +01:00
emersion cc2468923b
Fix non-HiDPI-aware fullscreen surface rendering in wlr_output 2017-11-21 21:12:12 +01:00
emersion 3262661e1e
Fix HiDPI support 2017-11-21 20:58:15 +01:00
emersion 5a664e1e46
Fix messed up outputs after fullscreen 2017-11-21 18:43:22 +01:00
emersion dcb168914e
Merge branch 'master' into fullscreen 2017-11-21 18:34:12 +01:00
emersion a268f57ed5
Forgot a call to glClear 2017-11-20 21:05:05 +01:00
emersion 54f1135c05
Fix fullscreen in xdg-shell 2017-11-20 20:53:13 +01:00
emersion 80998cdf57
Add support for fullscreen xwayland views 2017-11-20 17:58:26 +01:00
emersion b04a9a248d
Initial fullscreen support 2017-11-20 17:27:36 +01:00
emersion 016744ef4d
Refactor wlr_list inside wlroots 2017-11-19 00:17:40 +01:00
emersion bf1f461eba
Call wl_output_send_done when current mode is updated 2017-11-15 22:35:16 +01:00
Drew DeVault 2f6cfe4057 Fix software cursors on scaled outputs
There was an issue where it would only work within the boundaries of the
unscaled resolution.
2017-11-04 11:47:34 -04:00
Drew DeVault 6d8e1abfc0 Improve input sensitivity
We now use doubles until the last minute, which makes it so we can move
the pointer more precisely. This also includes a fix for tablet tools,
which move absolutely and sometimes do not update the X or Y axis.
2017-11-04 01:35:12 -04:00
Drew DeVault 86b8729998 Merge remote-tracking branch 'origin/master' into hidpi 2017-11-02 23:34:02 -04:00
Drew DeVault ca8cf7d48d Rethink HiDPI output layouts, fixes everything
Except for subsurfaces not rendering at the right scale. But that part
is (somewhat) easy.
2017-11-02 23:17:39 -04:00
emersion f8de7aa0fd
Add checks for wl_resource_create 2017-11-02 23:14:24 +01:00
emersion 0384c9c094
Process surface position for software cursor hotspots 2017-11-02 19:24:48 +01:00
emersion b46d2a8b33
Fix wlr_output_cursor_destroy 2017-11-02 11:42:42 +01:00
emersion d11973ed7d
Fix disabled cursors 2017-11-02 11:37:43 +01:00
emersion e18460c981
Add wlr_output.needs_swap 2017-11-01 20:08:15 +01:00
emersion a15b35aa10
Remove mysterious hotspot switch in DRM backend 2017-11-01 14:36:58 +01:00
emersion 60c018c017
Fix hidden software cursors, fix cursor transformations on DRM backend 2017-11-01 14:25:41 +01:00
Drew DeVault ed74f473d6 Fix various rebase-related bugs 2017-11-01 08:57:30 -04:00
Drew DeVault 8c0929cfb3 Fix backwards bit banging 2017-11-01 08:51:59 -04:00
Drew DeVault c8f97a3a2c Use surface matrix for software cursors
A similar change should probably be applied to hardware cursors, though
more complicated. Also, this doesn't actually fix the issue where the
cursor is too small when over a scale=2 surface. Apparently they don't
set their cursor scales to 2. Seems like a client bug? idk
2017-11-01 08:51:59 -04:00
Drew DeVault a6930cd8ea Handle output enter/leave correctly 2017-11-01 08:51:59 -04:00
Drew DeVault 9861add146 Send surface enter output events to clients 2017-11-01 08:50:33 -04:00