Commit graph

932 commits

Author SHA1 Message Date
sghctoma
fa587b8ea9 Increase _POSIX_C_SOURCE to 200112L
CLOCK_MONOTONIC appeared in IEEE Std. 1003.1-200x, it was not part of
POSIX.1b (the 1993 version), and FreeBSD treats it accordingly.
2018-10-17 08:33:19 +02:00
emersion
f9eb5df80e backend: fix use-after-free in wlr_backend_autocreate
Found by clang static analyzer.
2018-10-13 10:58:59 +02:00
emersion
b66041a9e5 backend/drm: don't reset conn->pageflip_pending in drm_connector_cleanup
If a pageflip is pending before cleanup, it's still pending after. This
is used line 1177: drm_connector_cleanup is called and
conn->pageflip_pending is checked afterwards.

Fixes #1297
2018-10-09 14:54:33 +02:00
Drew DeVault
8488ed2997
Merge pull request #1298 from emersion/output-dangling-idle-frame
output: remove idle_frame event source when destroying output
2018-10-09 13:41:04 +02:00
Rouven Czerwinski
77478ac302 backend/drm: set drmEventContext version to 2
As per [1] set drmEventContext version to 2, since wlroots does not use the
page_flip_handler2.

[1]: https://s-opensource.org/2017/04/12/libdrm-event-handling-youre-probably-wrong/
2018-10-09 12:34:01 +02:00
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
Scott Anderson
885586a831
Merge pull request #1280 from emersion/drm-link-status
backend/drm: add support for the link-status property
2018-10-08 21:01:30 +02:00
emersion
37de179013 backend/drm: fix zero-length VLAs 2018-10-07 13:04:52 +02:00
emersion
776008da69 backend/drm: properly handle GPUs without CRTCs 2018-10-07 12:59:00 +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
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
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
f5a147b739 backend/drm: add support for the link-status property 2018-10-04 21:54:27 +02:00
Drew DeVault
841d04db99
Merge pull request #1262 from nyorain/session_fix
Improve session handling
2018-10-04 17:36:39 +02:00
nyorain
b4d46aa9c2 Use sd_bus_get_property_trivial & remove numbering 2018-10-04 14:04:06 +02:00
emersion
7ab37bf152 backend/drm: update EDID manufacturers database 2018-10-04 10:58:45 +02:00
emersion
e88db9a3fb backend/drm: reset gamma table on VT switch 2018-10-03 10:53:35 +02:00
emersion
2beb68007e output: make gamma size a size_t and gamma table const 2018-10-03 10:36:33 +02:00
emersion
79dd9ba151 backend/drm: don't free connector immediately
When a pageflip is pending, we'll get a DRM event for the connector
in the future. We don't want to free the connector immediately
otherwise we'll use-after-free in the pageflip handler.

This commit adds a new state, "DISAPPEARED". This asks the pageflip
handler to destroy the output after it's done pageflipping.
2018-09-28 10:00:40 +02:00
nyorain
7b52388424 Rework session handling
Sessions can now be retrieved from a backend in a more general manner.
Multi-backend gets back its `session` field that contains the session
if one was created, removing the interfacing from multi backend with the
drm backend directly. This adds the possibility to use sessions even
without the drm backend.

It additionally fixes the bug that 2 session objects got created when
WLR_BACKENDS were set to "libinput,drm".

To allow vt switching without drm backend (and drm fd) on logind, start
listening to PropertiesChanged signals from dbus and parse the session
"Active" property when no master fd was created (this does not change
current drm backend behaviour in any way).
2018-09-24 23:35:09 +02:00
sghctoma
9383e1f76c Apply multiseat fixes to FreeBSD direct backend
This commit applies the multiseat fixes that are part of PR #1063 (
commits 964e0a50 and 47895d2) to the FreeBSD direct backend.
2018-09-21 15:02:32 +02:00
Ryan Dwyer
691a63d66b Introduce wlr_multi_for_each_backend 2018-09-19 21:53:51 +10:00
emersion
139a905924 backend/drm: add assertions 2018-09-18 11:06:01 +02:00
emersion
02231554c8 backend/x11: add assertions 2018-09-18 11:06:01 +02:00
emersion
e98cb7c5ab backend/wayland: add assertions 2018-09-18 11:06:01 +02:00
emersion
07ea98dab9 backend/session: add assertions 2018-09-18 11:06:01 +02:00
emersion
6c05f17a25 backend/multi: add assertions 2018-09-18 11:06:01 +02:00
emersion
7bcf0d9599 backend/libinput: add assertions 2018-09-18 11:05:55 +02:00
emersion
bc34486c04 backend/headless: add assertions 2018-09-18 11:01:53 +02:00
random human
572dfcdba7
Add support for WLR_SESSION env variable
Valid values are "logind"/"systemd" and "direct". If WLR_SESSION is set,
only its value is potentially tried; it will not try any other option.
2018-09-18 05:06:32 +05:30
emersion
f8a50e4fe7 backend/drm: steal CRTCs from disabled outputs
This commit allows outputs that need a CRTC to steal it from
user-disabled outputs. Note that in the case there are enough
CRTCs, disabled outputs don't loose it (so there's no modeset
and plane initialization needed after DPMS). CRTC allocation
still prefers to keep the old configuration, even if that means
allocating an extra CRTC to a disabled output.

CRTC reallocation now happen when enabling/disabling an output as
well as when trying to modeset. When enabling an output without a
CRTC, we realloc to try to steal a CRTC from a disabled output
(that doesn't really need the CRTC). When disabling an output, we
try to give our CRTC to an output that needs one. Modesetting is
similar to enabling.

A new DRM connector field has been added: `desired_enabled`.
Outputs without CRTCs get automatically disabled. This field keeps
track of the state desired by the user, allowing to automatically
re-enable outputs when a CRTC becomes free.

This required some changes to the allocation algorithm. Previously,
the algorithm tried to keep the previous configuration even if a
new configuration with a better score was possible (it only changed
configuration when the old one didn't work anymore). This is now
changed and the old configuration (still preferred) is only
retained without considering new possibilities when it's perfect
(all outputs have CRTCs).

User-disabled outputs now have `possible_crtcs` set to 0, meaning
they can only retain a previous CRTC (not acquire a new one). The
allocation algorithm has been updated to do not bump the score
when assigning a CRTC to a disabled output.
2018-09-15 08:37:33 +02:00
emersion
cb293f09e7 output: make wlr_output_enable return a bool 2018-09-14 18:18:07 +02:00
Drew DeVault
ca331c0468
Merge pull request #1235 from emersion/dealloc-unused-crtcs
backend/drm: de-allocate unused CRTCs
2018-09-10 21:51:36 -04:00
Drew DeVault
7ba50469e0
Merge pull request #1205 from sghctoma/fix-freebsd-direct-session
Add drmSetMaster and drmDropMaster calls to FreeBSD direct session
2018-09-10 21:11:22 -04:00
emersion
1fcecd68df backend/drm: de-allocate unused CRTCs
They can be re-used by another output after a subsequent hotplug.
2018-09-10 18:46:30 +02:00
mntmn
e1c91884fb fix cursor loss w/ legacy drm and software cursor (tested on etnaviv) 2018-09-10 17:30:26 +02:00
sghctoma
ba5df0d21d Fix build failure on non-FreeBSD systems
Accidentally included the FreeBSD-specific dev/evdev/input.h file on
other systems too. This commit fixes that.
2018-09-07 17:44:48 +02:00
sghctoma
7a5d3c4d3b Implement device type discovery using ioctl calls
This commit implements device type discovery by calling two ioctls
(DRM_IOCTL_VERSION and EVIOCGVERSION) on the device. These iocts are
specific to drm and input devices respectively, therefore we can
determine the device type based on which one returns an error.
2018-09-07 16:37:25 +02:00
sghctoma
bbeed1bd31 Merge remote-tracking branch 'upstream/master' into fix-freebsd-direct-session 2018-09-07 15:45:20 +02:00
emersion
8a6bdc193d backend/drm: damage outputs when switching CRTCs 2018-09-04 23:10:37 +02:00
emersion
1342393632 backend/drm: cosmetic enhancements 2018-09-04 23:08:45 +02:00
emersion
5b13b8a12c backend/drm: consider continue not using resources
Fixes #1230
2018-09-04 22:57:09 +02:00
emersion
fb94f03b43 backend/drm: prevent use of uninitialized data 2018-09-04 22:50:59 +02:00
emersion
d605b2ea07 backend/drm: remove unused if 2018-09-04 22:49:54 +02:00
emersion
017cfb0b86 backend/drm: log when de-allocating CRTC 2018-09-04 19:44:44 +02:00
emersion
b877daded1 backend/drm: better hotplug handling
This commit handles better situations in which the number of
connected outputs is greater than the number of available CRTCs.
It'll enable as many outputs as possible, and transfer CRTCs to
outputs that need one on unplug.

This changes CRTC and plane reallocation to happen after scanning
DRM connectors instead of on modeset.

This cleanups CRTCs and planes on unplug to allow them to be
re-used for other outputs.

On modeset, if an output doesn't have a CRTC, the desired mode is
saved and used later when the output gains a CRTC.

Future work includes giving priority to enabled outputs over
disabled ones for CRTC allocation. This requires the compositor to
know about all outputs (even outputs without CRTCs) to properly
modeset outputs enabled in the compositor config file and disable
outputs disabled in the config file.
2018-09-04 15:09:07 +02:00
sghctoma
d948bffd3e Activate last active VT after compositor exit
The VT the compositor was started from was not activated after exiting
the compositor, which resulted in arriving on a blank VT. This commit
fixes that by introducing a new field in direct_session struct that
stores the last active VT so that it can be activated in
direct_session_destroy.
2018-09-02 20:28:06 +02:00
sghctoma
3b2b8c1844 Merge remote-tracking branch 'upstream/master' into fix-freebsd-direct-session 2018-09-02 18:32:31 +02:00
random human
7bc2657984
Free unused pointer in x11/backend.c 2018-09-02 20:52:09 +05:30
emersion
95d05acda5 backend/drm: fix invalid VLA size in scan_drm_connectors
I failed to see this issue with Valgrind because of the +1.
2018-09-02 10:11:23 +02:00
emersion
ef88df2142 backend/drm: emit new_output after scanning connectors
This prevents receiving modesetting requests from the compositor
while we don't have the whole picture (ie. while we haven't yet
scanned all connectors).

This also makes connectors without CRTCs disabled (they can't be
enabled yet even if some CRTCs are free'd -- this is future work).
2018-09-02 01:03:20 +02:00
emersion
e84f01168d backend/drm: allow disabling outputs in NEEDS_MODESET state
This correctly frees CRTCs when disabling outputs without setting
a mode.
2018-09-01 23:43:16 +02:00
random human
8589ae19de Fix bugs listed by clang's static analyzer
A few pedantic changes and unused variables (1-4), and genuine bugs (5,
6).

The reports with the corresponding files and lines numbers are as
follows.

1. backend/libinput/tablet_pad.c@31,44,57
"Allocator sizeof operand mismatch"
"Result of 'calloc' is converted to a pointer of type 'unsigned int',
which is incompatible with sizeof operand type 'int'"

2. types/tablet_v2/wlr_tablet_v2_pad.c@371
"Allocator sizeof operand mismatch"
"Result of 'calloc' is converted to a pointer of type 'uint32_t', which
is incompatible with sizeof operand type 'int'"

3. types/wlr_cursor.c@335
"Dead initialization"
"Value stored to 'dx'/'dy' during its initialization is never read"

4. rootston/xdg_shell.c@510
"Dead initialization"
"Value stored to 'desktop' during its initialization is never read"

5. types/tablet_v2/wlr_tablet_v2_pad.c@475
"Dereference of null pointer"
"Access to field 'strips' results in a dereference of a null pointer
(loaded from field 'current_client')"

The boolean logic was incorrect (c.f. the check in the following
function).

6. examples/idle.c@163,174,182
"Uninitialized argument value"
"1st function call argument is an uninitialized value"

If close_timeout != 0, but simulate_activity_timeout >= close_timeout,
the program would segfault at pthread_cancel(t1).
2018-08-31 19:41:18 +02:00
sghctoma
2bd6fbf20e Fix that major(st_rdev) have no meaning on FreeBSD
The major device number does not indicate the device type on FreeBSD,
and AFAIK the only way to differentiate between DRM, input, and other
devices is checking the fd path. This commit implements that.

The drmDropmaster and drmSetmaster calls are necessary, because the
implicit drop (that should occur when the DRM fd is closed) seems not
to be working in some scenarios (e.g. if you have a tmux session
running - maybe the fd is retained somehow by tmux?). This is a
problem, because once you exit the compositor, you can't start it (or
any other program that wants to be DRM master) again until you close
all your tmux sessions.
2018-08-30 11:15:39 +02:00
Drew DeVault
633663cdde Use legacy modesetting for gamma control
It doesn't look like there's any motion on a fix from the AMDGPU side,
and using the legacy interface for this isn't so bad.
2018-08-29 23:05:38 +02:00
Alexander Bakker
221d412824 Init the new destroy signals added by #1200 2018-08-27 18:21:36 +02:00
Alexander Bakker
20db29779e Add destroy signals to types that are destroyed by wl_display_destroy 2018-08-26 23:23:12 +02:00
Scott Anderson
fd3fa760d3 Revert "Revert "Merge pull request #1194 from ascent12/meson_feature""
This reverts commit 9c886f20b9.
2018-08-24 19:35:02 +12:00
Drew DeVault
9c886f20b9 Revert "Merge pull request #1194 from ascent12/meson_feature"
This breaks wlroots when used as a meson subproject.

This reverts commit dea311992e, reversing
changes made to 6db9c4b746.
2018-08-23 21:00:58 -04:00
Scott Anderson
784c20c82f Use new options for X11 backend and Xwayland 2018-08-22 20:27:37 +12:00
Scott Anderson
94ed2fc7bb Use feature options for libcap/logind
We now use a combo choice between systemd/elogind as they are mutually
exclusive anyway.
2018-08-22 19:53:00 +12:00
emersion
7a3f7b3c8a backend/drm: add support for DRM_MODE_CONNECTOR_DPI 2018-08-21 13:05:38 +01:00
emersion
d66d33f5a2
Merge pull request #1188 from emersion/freebsd-fixes
Fix build on FreeBSD
2018-08-16 11:02:21 +01:00
emersion
f86f1daf9a Fix build on FreeBSD 2018-08-16 10:54:45 +01:00
sdilts
8e7df5eb88 Fix xcb_create_window parameters
Set the window width and height, not the location of the window.
2018-08-10 18:05:34 -06:00
sdilts
da79fef5f7 Add guard for changing the size of X11 backend windows
Events that set the window to either a width or height of zero are now
ignored and logged.
2018-08-09 22:09:48 -06:00
sdilts
55cca6deaa Set default output size for X11 backend
Fixes issue #1170
Also set the created window size to match the output size.
2018-08-09 22:05:18 -06:00
Ilia Bozhinov
cb42e16f64 session: load GPU devices even if they have zero crtcs/connectors/encoders
On some systems (most notably laptops with two GPUs) there are GPUs that
don't have attached outputs. However, we still want to load those GPUs
because they could still be used by the compositor for rendering.
2018-08-08 07:34:12 +03:00
Scott Anderson
2d8f53affd Check for DRM prime
This will indicate the user properly when multi-GPU is not supported by
their GPU driver.
2018-08-05 18:25:25 +12:00
Scott Anderson
1a2b3445dc Remove unused data from gbm_bo userdata
These aren't used anymore and crashes when the gbm_bo tries to get
destroyed (e.g. on hotplug).
2018-08-04 17:02:53 +12:00
Scott Anderson
4bee710c30 Fix hardware cursor on secondary GPU
Create rendering resources on parent GPU, so that we can sample the
passed in texture properly. The cursor buffer needs to remain on the
same GPU.
2018-08-04 15:08:28 +12:00
Mariusz Bialonczyk
e547e55be0 multi-gpu: do not flip screens on secondary GPU
All screens on secondary GPU in multiple GPU configurations
was flipped 180.

The flipped screens was always on secondary card (the primary card
was always correct).

Tested on nouveau with:
WLR_DRM_DEVICES=/dev/dri/card1:/dev/dri/card2
WLR_DRM_DEVICES=/dev/dri/card2:/dev/dri/card1

The commit is fixing this problem. Now all screens are "normal".
2018-08-03 07:43:22 +02:00
Mariusz Bialonczyk
15dacebc36 multi-backend: do not expose internal renderers
backend_get_renderer() is now returning the renderer of the primary GPU, instead
of its own renderer, since that's the thing which actually does all of the "real"
rendering

wlr_multi_backend_add() is now adding all subbackends (otherwise only one GPU
is handled).

credits: @ascent12
2018-08-03 07:43:22 +02:00
emersion
364afced3e backend/drm: remove unnecessary casts 2018-08-02 23:33:59 +01:00
emersion
2ebecb6727 backend/drm: allow to pass empty gamma ramp to reset it 2018-08-02 23:33:59 +01:00
emersion
a149c2370a Implement wlr-gamma-control-unstable-v1 2018-08-02 23:33:04 +01:00
Drew DeVault
4b096fc114 Revert "Merge pull request #1153 from emersion/include-config"
This reverts commit ef0a6ea4d2, reversing
changes made to 8d03bc9178.
2018-07-21 09:44:20 -04:00
emersion
41094a7df5 Always include config.h 2018-07-21 13:08:23 +01:00
Markus Ongyerth
36955204cf Remove last remnant of tool_tool in libinput 2018-07-14 09:49:58 +02: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
Markus Ongyerth
48e2cba9b6 Handle relative motion for mouse tools 2018-07-14 09:48:57 +02:00
Markus Ongyerth
3be916f9b8 Add asserts and rename destroy function in libinput backend 2018-07-14 09:48:57 +02:00
Markus Ongyerth
0c9a26828a Use wlr_list for paths, and improve inert resource handling 2018-07-14 09:43:17 +02:00
Markus Ongyerth
adba68a3c1 Use tablet_tool impl in libinput backend 2018-07-14 09:43:16 +02:00
Markus Ongyerth
31cec36b74 1st feedback pass
Rename make_ functions to _create
Implement set_cursor and set_feedback
2018-07-14 09:43:16 +02:00
Markus Ongyerth
599f84f736 Fix borked rebase 2018-07-14 09:40:39 +02:00
Markus Ongyerth
5c7a37f309 Add tool buttons 2018-07-14 09:40:39 +02:00
Markus Ongyerth
391eef6ea9 Propagate most axis events to clients 2018-07-14 09:40:39 +02:00
Markus Ongyerth
f375246657 Implement basic tablet_pad handling (bound to keyboard focus) 2018-07-14 09:40:39 +02:00
Markus Ongyerth
e235f7d336 Basic tablet_v2 object lifetime 2018-07-14 09:40:39 +02:00
Markus Ongyerth
77bac448cc storage commit #2 2018-07-14 09:40:39 +02:00
Markus Ongyerth
000b305ecc backend/libinput: Manage tablet tool livetimes
This adds the management code to manage tablet tools lifetimes from
libinput.
It follows the suggestion made in the tablet-unstable-v2.xml to destroy
tablet_tools once all tablets that it got into contact with were removed
from the system. This is implemented via a refcount.

If a tool is *not* unique, it will be destroyed on proximity out. This
is libinput specific and mentioned in libinput docs that tools will not
be found again, so we shouldn't keep a reference to them.
Also they can't be on other tablets as well, because they cannot be
tracked.

The naming in this commit is a bit off (to not break things).
The wlr names stay the same, tablet_tool is the libinput_device with
capaiblity LIBINPUT_DEVICE_CAP_TABLET_TOOL which is more akin to
"tablet" in the tablet-unstable-v2 protocol.
The struct that corresponds to the tablet_tool in tablet-unstable-v2 is
called tablet_tool_tool, a rename should be done at some point in the
future.
2018-07-14 09:40:39 +02:00
Guido Günther
40fe252c2d x11: make sure event source is drained
Otherwise running under Xvfb will not deliver any events. This results
in e.g. weston-info reporting a 0x0 window size (which results in all
sorts of problems).
2018-07-11 17:34:43 +02:00
Guido Günther
8515b7c65b x11: use correct type for events in wl_event_loop_add_fd 2018-07-11 17:30:45 +02:00
Guido Günther
e463b49166 x11: Check if xcb_configure_window worked
So far we did not check for any errors
2018-07-11 17:29:41 +02:00
emersion
7cbef15206
util: add wlr_ prefix to log symbols 2018-07-09 22:49:54 +01:00
Drew DeVault
be54278207
Merge pull request #1095 from agx/output-add-mode
Allow to add additional modes to outputs
2018-07-07 08:58:17 -07:00
Guido Günther
8d72090afe drm: Allow to add additional modes
This allows to add additional modes to the list of available video modes
using VESA Coordinated Video Timing information.

Closes #1080
2018-07-07 14:51:39 +02:00
Drew DeVault
07209d062c
Merge pull request #1104 from VincentVanlaer/logind-fd-leak
Close fd's obtained from logind
2018-06-30 17:49:45 -07:00
Vincent Vanlaer
ece58514b4 Close fd's obtained from logind 2018-07-01 02:22:57 +02:00
emersion
2b9cbaddf3
screencopy: add support for frame flags 2018-06-30 22:18:03 +01:00
Dominique Martinet
0c2a64df18 headless add_input_device: fix leak on error
Found through static analysis
2018-06-30 20:46:58 +09:00
Dominique Martinet
e5348ad7d3 backend autocreate: fix leak when WLR_BACKENDS is set
Found through static analysis
2018-06-30 11:45:57 +09:00
Dominique Martinet
1940c6bbd9 wayland backend: fix width/height == 0 check
We cannot handle just one of the two being NULL later down the road
(e.g. divide by zero in matrix projection code),
just ignore any such configure request.

Found through static analysis
2018-06-30 11:38:21 +09:00
Dominique Martinet
266898ca1f direct session backend: fix closing -1 on error
Found through static analysis
2018-06-30 11:38:21 +09:00
Dominique Martinet
bcc2c64c1e x11 backend init: fix leak on failed XOpenDisplay
Found through static analysis
2018-06-30 11:38:21 +09:00
Dominique Martinet
4f7b1382d4 wayland backend seat: fix NULL output check
The test was done after dereferencing output in pointer_handle_enter,
just move it up one line.
No reason pointer_handle_leave would not need the check if enter needs
it, add it there.

Found through static analysis.
2018-06-30 11:38:21 +09:00
Dominique Martinet
f0d455f088 drm backend: overflow fixes
These operations are done in 32-bit arithmetics before being casted to 64-bit,
thus can overflow before the cast.
Casting early fixes the issue.

Found through static analysis
2018-06-30 11:21:22 +09:00
Drew DeVault
e459fe0ec7
Merge pull request #992 from emersion/screencontent
Implement wlr_export_dmabuf_unstable_v1 protocol
2018-06-22 05:37:07 -07:00
Tobias Blass
482fc48c74 FIX: Suprocess loops endlessly when the control socket closes.
recvmsg(3) returns 0 if the connection partner has shut down its socket.
The communicate function considered 0 a successful message, though, and
keeps calling recvmsg(3) again and again.
2018-06-20 22:00:45 +02:00
emersion
57548b557a
Merge branch 'master' into screencontent 2018-06-17 14:49:18 +01:00
Scott Anderson
964e0a50be Check for seat0 properly 2018-06-14 21:02:32 +12:00
Scott Anderson
47985d2dc5 Multiseat fixes 2018-06-14 20:46:16 +12:00
emersion
551700e887
backend/wayland: fix keyboard keys not pressed/released when focus changes 2018-06-03 13:18:57 +01:00
emersion
21928cbe61
Merge branch 'master' into screencontent 2018-05-31 12:33:27 +01:00
emersion
28020ff577
Only allow one modifier per DMA-BUF, split attributes struct in render/ 2018-05-30 09:29:12 +01:00
emersion
bd430b8620
backend/drm: support multi-planar DMA-BUFs when exporting 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
79683ee497
backend/drm: better connector cleanup, add more logs 2018-05-27 13:21:41 +01:00
emersion
6eb4b5b54d
Merge pull request #993 from emersion/bind-wl-drm-in-renderer
render: bind wl_drm in renderer
2018-05-25 13:54:16 +01: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
emersion
41130fe54b
render: bind wl_drm in renderer 2018-05-21 19:07:08 +01:00
emersion
9e3dd6b560
backend/wayland: fix segfault when destroying backend before starting it 2018-05-19 09:34:16 +01:00
emersion
75b10cd621
backend: support creating DRM and libinput via WLR_BACKENDS 2018-05-19 09:32:08 +01:00
emersion
007d83c6ee
backend: allow multiple backends in WLR_BACKENDS 2018-05-19 09:09:03 +01:00
emersion
52bd8aa716
backend/multi: disallow multiple renderers at the same time 2018-05-19 09:09:03 +01:00
emersion
a1631dd9ee
backend: add WLR_BACKEND env variable 2018-05-19 09:08:59 +01:00
Markus Ongyerth
6a46fcc6f2 recalculate cursor projection matrix on set_cursor
Updates the projection matrix for the cursor plane in the DRM backend,
when the cursor is set, so new cursor are uploaded with the correct
transformation.
2018-05-16 15:44:41 +02:00
emersion
198ad27bd5
backend/wayland: print output name in window title 2018-05-15 00:16:18 +01:00
emersion
0b58579564
Add support for discrete axis values 2018-05-12 13:34:58 +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
morganamilo
6305e6327f
Fix typos in comments and strings 2018-05-03 21:59:43 +01:00
Guido Günther
1637053ef8 drm: only disable atomic modesetting when WLR_DRM_NO_ATOMIC == 1
Don't allow any value of the env var to disable atomic mode setting.
2018-05-03 15:37:37 +02:00
Guido Günther
545d54439d backend/wayland: don't transform pointer events
We do this in a backend independent way in wlr_cursor now.
2018-05-03 11:09:14 +02:00
Guido Günther
6f01c12b40 backend/x11: don't transform pointer events
We do this in a backend independent way in wlr_cursor now.
2018-05-03 11:09:14 +02: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
178ac8bffe
backend/{wayland,x11}: fix pointer coords for transformed outputs 2018-04-30 10:48:35 +01:00
emersion
62d7337d00
backend/x11: add one pointer per output 2018-04-29 14:46:29 +01:00
emersion
ddac792b61
backend/wayland: only set one pointer listener 2018-04-29 14:30:13 +01:00
emersion
9f8a7c8fc4
backend/wayland: create one virtual pointer per output 2018-04-29 14:30:13 +01:00
emersion
2551ef8871
input-device: add output_name field, populate it from libinput 2018-04-29 14:30:09 +01:00
emersion
f8e0a03451
backend/x11: correctly destroy input devices 2018-04-28 12:55:36 +01:00
emersion
79da4c175e
backend/headless: remove useless destructor 2018-04-28 12:48:05 +01:00
emersion
57c36ddcb3
backend/wayland: add proper error handling to wlr_wl_backend_create 2018-04-28 12:38:03 +01:00
Drew DeVault
fecb971518
Merge pull request #902 from emersion/various-memory-leaks
Various memory leaks
2018-04-26 11:34:49 +02:00
emersion
cd9f25711c
backend: destroy renderer when destroying backend 2018-04-25 23:53:43 +01:00
emersion
625a7a48dc
Don't use the wlr_ prefix for static functions 2018-04-25 23:51:00 +01:00
emersion
71ca45e2c0
Make sure we don't use others' prefixes 2018-04-25 23:24:58 +01:00
emersion
b0d99f5c67
Remove wlr_ prefix from local symbols 2018-04-25 23:00:46 +01:00
emersion
018b82c01e
render/egl: allow passing NULL to surface and image destructors 2018-04-25 08:28:48 +01:00
emersion
eaed6bd03b
render/egl: add wlr_egl_destroy_surface 2018-04-24 23:44:43 +01:00
Drew DeVault
dbdc63ddde
Merge pull request #873 from emersion/output-dont-emit-mode-twice
output: don't emit the mode event if it hasn't changed
2018-04-17 21:08:27 -04: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
Uli Schlachter
e5ab12339f x11 backend: Expose events mean "needs swap"
When the X11 server sends an expose event, that means that "this
rectangle here (the event contains x,y,width,height) has undefined
contents on your window; please redraw that". This means that we need a
swap. However, so far the code does not actually enforce that a swap
happens.

For example, start rootston, switch to another workspace and then switch
back. The rootston window will not be redrawn (before commit
52b058c2a3, it would just be fully white; after that commit it will
show whatever was visible on the old workspace). This is because the
drawing code concludes that nothing needs to be done. However, in fact a
swap is necessary.

This reverts commit e79d924588, because its optimisation is already
done now: wlr_output_update_needs_swap() emits a signal, which is
handled by wlr_output_damage with a call to wlr_output_schedule_frame().
This function does nothing if a frame is already pending. Thus, the
optimisation from commit e79d924588 now happens implicitly.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-04-15 11:41:09 +02:00
Uli Schlachter
e79d924588 x11 backend: Ignore expose if frame is pending
When resizing rootston with the mouse, the result is really slow. One
can see that rootston needs quite a while for drawing the newly visible
area. This is because every single expose event is handled on its own
and causes (apparently) a full repaint or at least a swap.

This commit improves things by only causing a new frame if none is
pending already.

With this change, there is almost no delay in rootston drawing the newly
visible area.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-04-15 11:07:31 +02:00
Uli Schlachter
52b058c2a3 x11 backend: Do not set a back pixel on windows
Before this commit, the x11 server would fill any exposed area with
white before the wlroots x11 backend got a chance to do anything. This
was e.g. visible when running rootston and resizing the window: When the
window becomes larger, the new area is filled with black.

By just not setting a back pixel value, this commit gets rid of this
behaviour.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-04-15 11:07:31 +02:00
Uli Schlachter
98f8ec6a08 x11_handle_input_event: Remove return value
handle_x11_event() and x11_handle_input_event() react to different kinds
of events, so it does not make much of a difference if
x11_handle_input_event() signals if it handled an event or not.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-04-15 10:33:53 +02:00
Uli Schlachter
3728abd1fc handle_x11_event: Remove return value
This function always returns "false", so its return type can simply be
changed to void.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-04-15 10:32:30 +02:00
emersion
d2ebbd103c
backend: remove wlr_backend_get_egl 2018-04-08 11:00:56 -04:00
emersion
03563b61a8
backend/{x11,headless}: use default if supplied refresh is invalid 2018-04-05 22:48:00 -04:00
Tancredi Orlando
68ad7e5092 Add ifdef to build without X11 2018-04-04 19:59:47 +02:00
emersion
2d6bbf12f8
backend/{x11,headless}: fix refresh rate 2018-04-03 22:54:01 -04:00
Drew DeVault
2ecce27dd5
Merge pull request #807 from swaywm/input-inhibit
Input inhibit
2018-04-03 15:58:47 -04:00
Drew DeVault
56deff41b6 Implement input inhibit in rootston 2018-04-03 15:09:53 -04:00
emersion
9609985f29
backend/x11: fix cursor position when receiving configure event 2018-04-03 13:32:24 -04:00
emersion
60f07ee321
backend/x11: fix WLR_HAS_XCB_XKB always undefined 2018-04-03 13:12:52 -04:00
Drew DeVault
8b37e8f67a
Merge pull request #792 from emersion/x11-backend-blank-cursor
backend/x11: hide cursor
2018-04-02 10:21:07 -04:00
Drew DeVault
b60e31e5c0
Merge pull request #794 from emersion/renderer-untie-backend
Untie wlr_backend from wlr_renderer
2018-03-31 21:31:15 -04:00
emersion
a2391a6047
Fix cursor transform on DRM backend 2018-03-31 20:55:31 -04:00
emersion
33a2eb4b77
Untie wlr_backend from wlr_renderer 2018-03-31 18:49:43 -04:00
emersion
37aae0b2cd
backend/x11: flush after destroying window
Otherwise the destroy message is kept buffered and never reaches
the X11 server. Thanks X11.
2018-03-31 13:28:50 -04:00
emersion
7b88ace557
backend/x11: hide cursor 2018-03-31 12:10:43 -04:00
emersion
5111f7df84
backend/x11: fix extra output 2018-03-30 23:51:20 -04:00
emersion
f37e8c5b6e
backend/wayland: cleanup input transform code 2018-03-30 23:51:20 -04:00
emersion
aa6ae710f7
backend/x11: fix input events 2018-03-30 23:51:19 -04:00
emersion
0a7a8cbd1c
backend/x11: add WLR_X11_OUTPUTS support 2018-03-30 23:51:19 -04:00
emersion
d4f7ced6e2
backend/x11: refactor, prepare support for multiple outputs 2018-03-30 23:51:16 -04:00
emersion
5dd022da13
Merge pull request #765 from swaywm/transformed-events
Use libinput transformed events instead of width_mm/height_mm
2018-03-28 14:11:39 -04:00
Drew DeVault
3813121fef Fix wayland output absolute input handling 2018-03-28 14:04:23 -04:00
Drew DeVault
52d621e097
Merge pull request #763 from emersion/x11-backend-kbd-modifiers
backend/x11: correctly update keyboard modifiers
2018-03-28 12:51:08 -04:00
Drew DeVault
ac219cbda6 Remove width_mm from tablet events 2018-03-28 12:05:37 -04:00
Drew DeVault
324b9d910d Remove width_mm from wlr_touch events 2018-03-28 11:04:40 -04:00
Drew DeVault
a35a5786b0 Remove width_mm from wlr_pointer events 2018-03-28 10:46:50 -04:00
emersion
f033f717a2
backend/x11: make xcb-xkb optional, remove global state 2018-03-28 00:26:15 -04:00
Tony Crisci
330ee08126
Merge pull request #744 from emersion/texture-redesign
Redesign wlr_texture
2018-03-28 00:14:57 -04:00
emersion
8d1b5c7600
backend/x11: correctly update keyboard modifiers 2018-03-28 00:04:32 -04:00
Dominique Martinet
a0b52a0dff Fix x11 backend
Need to include wlr/config.h before using the various WLR_HAS_xxx defines
2018-03-27 09:20:21 +02:00
Drew DeVault
b1c4f01bad
Merge pull request #713 from ManDay/master
Make X11 fully optional
2018-03-26 23:20:46 -04:00
Drew DeVault
706f77e3c7 Address review feedback 2018-03-26 23:15:21 -04:00
emersion
adf4fb08dd
Merge branch 'master' into texture-redesign 2018-03-26 19:13:13 -04:00
emersion
3bda7e2ef8
Use DRM_FORMAT_MOD_LINEAR instead of a hardcoded constant 2018-03-26 12:00:08 -04:00
Uli Schlachter
c7f8b28d8d Fix use-after-free in x11 backend during shutdown
The xcb_connection_t instance that is used here comes from
XGetXCBConnection(), is created by XOpenDisplay(), and is owned by the
returned Display*. Calling xcb_disconnect() directly on it leads to
various use-after-frees during shutdown, as reported by valgrind. The
first one of the about 30 errors is:

    Invalid read of size 4
       at 0x71F2051: xcb_take_socket (in /usr/lib64/libxcb.so.1.1.0)
       by 0x78551DD: ??? (in /usr/lib64/libX11.so.6.3.0)
       by 0x7855A14: _XFlush (in /usr/lib64/libX11.so.6.3.0)
       by 0x7858504: _XGetRequest (in /usr/lib64/libX11.so.6.3.0)
       by 0x7838966: XFreeGC (in /usr/lib64/libX11.so.6.3.0)
       by 0x783238B: XCloseDisplay (in /usr/lib64/libX11.so.6.3.0)
       by 0x4E680C2: wlr_x11_backend_destroy (backend.c:333)
       by 0x4E57E94: wlr_backend_destroy (backend.c:39)
       by 0x4E629FB: multi_backend_destroy (backend.c:47)
       by 0x4E62B5A: handle_display_destroy (backend.c:90)
       by 0x50B7E9F: ??? (in /usr/lib64/libwayland-server.so.0.1.0)
       by 0x50B8476: wl_display_destroy (in /usr/lib64/libwayland-server.so.0.1.0)
     Address 0xc14dda0 is 0 bytes inside a block of size 21,152 free'd
       at 0x4C2DD18: free (vg_replace_malloc.c:530)
       by 0x4E680A5: wlr_x11_backend_destroy (backend.c:330)
       by 0x4E57E94: wlr_backend_destroy (backend.c:39)
       by 0x4E629FB: multi_backend_destroy (backend.c:47)
       by 0x4E62B5A: handle_display_destroy (backend.c:90)
       by 0x50B7E9F: ??? (in /usr/lib64/libwayland-server.so.0.1.0)
       by 0x50B8476: wl_display_destroy (in /usr/lib64/libwayland-server.so.0.1.0)
       by 0x40C54E: main (main.c:84)
     Block was alloc'd at
       at 0x4C2EA1E: calloc (vg_replace_malloc.c:711)
       by 0x71F0C60: xcb_connect_to_fd (in /usr/lib64/libxcb.so.1.1.0)
       by 0x71F4BD4: xcb_connect_to_display_with_auth_info (in /usr/lib64/libxcb.so.1.1.0)
       by 0x7854AA1: _XConnectXCB (in /usr/lib64/libX11.so.6.3.0)
       by 0x7845481: XOpenDisplay (in /usr/lib64/libX11.so.6.3.0)
       by 0x4E681B6: wlr_x11_backend_create (backend.c:376)
       by 0x4E580EE: wlr_backend_autocreate (backend.c:99)
       by 0x40C27D: main (main.c:35)

Normally, one would expect this to crash during XCloseDisplay() when
xcb_disconnect() is called again and frees the same data again (glibc would
detect a double free). However, XCloseDisplay() tries to clean up some internal
caches first for which it has to send requests to the X11 server (e.g. the
XFreeGC() above). This fails since the file descriptor was already closed,
which causes an IO error. Xlib's _XDefaultIOError() handles this by printing an
error message and calling exit(1).

Thus, the only symptom of this problem was compositors exiting
mid-shutdown and printing an error message:

    XIO:  fatal IO error 11 (Resource temporarily unavailable) on X server ":0"
          after 6 requests (6 known processed) with 0 events remaining.

Fixes: https://github.com/swaywm/wlroots/issues/745
Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-03-26 10:48:30 +02: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
Cedric Sodhi
51141dd11e Minor corrections 2018-03-23 10:28:36 +01:00
emersion
a854c2f246
Merge branch 'master' into gles2-renderer-redesign 2018-03-23 00:55:55 +01:00
Drew DeVault
ef3769851f
Merge pull request #740 from emersion/egl-debug
render/egl: use EGL_KHR_debug
2018-03-22 18:54:21 -04:00
Dominique Martinet
d5e14ab247 wayland backend: fix use-after free on output destroy
==12021==ERROR: AddressSanitizer: heap-use-after-free on address 0x617000015698 at pc 0x7f1a9abe1c09 bp 0x7ffe9068f6b0 sp 0x7ffe9068f6a0
WRITE of size 4 at 0x617000015698 thread T0
    #0 0x7f1a9abe1c08 in pointer_handle_leave ../backend/wayland/wl_seat.c:40
    #1 0x7f1a96ae7d1d in ffi_call_unix64 (/lib64/libffi.so.6+0x5d1d)
    #2 0x7f1a96ae768e in ffi_call (/lib64/libffi.so.6+0x568e)
    #3 0x7f1a988e0d8a  (/lib64/libwayland-client.so.0+0x8d8a)
    #4 0x7f1a988dd927  (/lib64/libwayland-client.so.0+0x5927)
    #5 0x7f1a988debe3 in wl_display_dispatch_queue_pending (/lib64/libwayland-client.so.0+0x6be3)
    #6 0x7f1a9abdd6d6 in dispatch_events ../backend/wayland/backend.c:28
    #7 0x7f1a9a968c11 in wl_event_loop_dispatch (/lib64/libwayland-server.so.0+0x9c11)
    #8 0x7f1a9a967449 in wl_display_run (/lib64/libwayland-server.so.0+0x8449)
    #9 0x418dff in main ../rootston/main.c:81
    #10 0x7f1a99b5ef29 in __libc_start_main (/lib64/libc.so.6+0x20f29)
    #11 0x4057c9 in _start (/home/shared/wayland/wlroots/build/rootston/rootston+0x4057c9)

0x617000015698 is located 664 bytes inside of 696-byte region [0x617000015400,0x6170000156b8)
freed by thread T0 here:
    #0 0x7f1a9af754b8 in __interceptor_free (/lib64/libasan.so.4+0xde4b8)
    #1 0x7f1a9abe01ee in wlr_wl_output_destroy ../backend/wayland/output.c:194
    #2 0x7f1a9ac12918 in wlr_output_destroy ../types/wlr_output.c:299
    #3 0x7f1a9abe061b in xdg_toplevel_handle_close ../backend/wayland/output.c:255
    #4 0x7f1a96ae7d1d in ffi_call_unix64 (/lib64/libffi.so.6+0x5d1d)
    #5 0x7f1a96ae768e in ffi_call (/lib64/libffi.so.6+0x568e)
    #6 0x7f1a988e0d8a  (/lib64/libwayland-client.so.0+0x8d8a)
    #7 0x7f1a988dd927  (/lib64/libwayland-client.so.0+0x5927)
    #8 0x7f1a988debe3 in wl_display_dispatch_queue_pending (/lib64/libwayland-client.so.0+0x6be3)
    #9 0x7f1a9abdd6d6 in dispatch_events ../backend/wayland/backend.c:28
    #10 0x7f1a9a968c11 in wl_event_loop_dispatch (/lib64/libwayland-server.so.0+0x9c11)
    #11 0x7f1a9a967449 in wl_display_run (/lib64/libwayland-server.so.0+0x8449)
    #12 0x418dff in main ../rootston/main.c:81
    #13 0x7f1a99b5ef29 in __libc_start_main (/lib64/libc.so.6+0x20f29)
    #14 0x4057c9 in _start (/home/shared/wayland/wlroots/build/rootston/rootston+0x4057c9)

previously allocated by thread T0 here:
    #0 0x7f1a9af75a38 in __interceptor_calloc (/lib64/libasan.so.4+0xdea38)
    #1 0x7f1a9abe0703 in wlr_wl_output_create ../backend/wayland/output.c:272
    #2 0x7f1a9abdd8eb in wlr_wl_backend_start ../backend/wayland/backend.c:55
    #3 0x7f1a9abbeb49 in wlr_backend_start ../backend/backend.c:28
    #4 0x7f1a9abd8ce1 in multi_backend_start ../backend/multi/backend.c:24
    #5 0x7f1a9abbeb49 in wlr_backend_start ../backend/backend.c:28
    #6 0x418c32 in main ../rootston/main.c:58
    #7 0x7f1a99b5ef29 in __libc_start_main (/lib64/libc.so.6+0x20f29)
    #8 0x4057c9 in _start (/home/shared/wayland/wlroots/build/rootston/rootston+0x4057c9)
2018-03-22 21:27:49 +01:00
Dominique Martinet
b0c2bbebd1 x11 backend: fix various leaks
- xcb_query_pointer_reply return value needs to be freed
 - call XCloseDisplay
 - remove wl event_source
2018-03-22 21:25:41 +01:00
emersion
60bfe0a6aa
backend/drm: remove remaining raw GL call
This makes the hardware cursor code a less efficient. Can be
fixed with a GLES3 renderer.
2018-03-21 11:34:08 +01:00
emersion
b1f93bc5cc
render/egl: use EGL_KHR_debug 2018-03-21 10:42:43 +01: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
6227da96b1
backend/drm: don't hardcode matrix 2018-03-18 11:34:23 +01:00
emersion
7894fca224
matrix: rename wlr_matrix_texture to wlr_matrix_projection 2018-03-15 21:26:45 +01:00
emersion
876f07e9f1
renderer: replace wlr_texture_get_matrix by wlr_render_texture 2018-03-15 19:31:02 +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
Tony Crisci
efa9eeb5d5
Merge pull request #716 from emersion/fix-cursor-hotspot-update
Fix cursor hotspot update
2018-03-12 21:50:07 -04:00
emersion
d24f868bbe
backend/drm: fix cursor hotspot not updated 2018-03-12 19:34:43 +01:00
emersion
7cdad5cde4
Merge pull request #710 from emersion/dont-move-hidden-cursors
output: don't move hidden cursors
2018-03-12 14:25:20 +01:00
emersion
92ca4ad474
backend/drm: refactor wlr_drm_connector_set_cursor 2018-03-11 11:40:03 +01:00
Cedric Sodhi
ebdabc2030 Make X11 fully optional
Make X11 Backend (in addition to XWayland) optional and small bug fix on XWayland includes.
2018-03-09 15:17:15 +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
Scott Anderson
3c9fc7c68e Add const to x11 and input interfaces 2018-03-06 21:16:18 +13:00
Scott Anderson
902d6cc240 Use xcb atoms properly 2018-03-06 21:15:47 +13:00
Markus Ongyerth
2cea430488 prevent current_mode null on output_enable(false)
The current mode was set to NULL to abuse it as state variable
persisting DRM suspend/resume, this results resulted in a segfault on
normal DPMS cycle.

This reverts that change and uses the wlr_output enabled variable, which
also persists and makes more sense.
2018-03-01 15:48:25 +01:00
Markus Ongyerth
a65ef8ea86 restore dpms state on drm resume
If there is no current mode, set outputs to dpms off in drm resume.
Sets current mode to null on disable to ensure this can be checked.
2018-02-26 18:12:51 +01:00
Drew DeVault
3296365ce5
Merge pull request #659 from agx/alpha
Make wlr_render_with_matrix use alpha
2018-02-25 13:16:35 -05: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
7da653bbb4
Merge pull request #669 from acrisci/headless-output-frame-timer
destroy frame timer in headless output
2018-02-25 00:26:32 -05:00
Tony Crisci
721e4ec55f remove frame timer from headless output 2018-02-24 22:32:57 -05:00
Dan Robertson
99e6cba3c3
Fix null deref in wlr_libinput_backend_destroy
If input_event is null (e.g. if backend_start has not been called yet)
wl_event_source_remove will result in a null deref.
2018-02-25 02:26:56 +00:00
Tony Crisci
94d53d53f9
Merge pull request #657 from emersion/wl-backend-uninitialized-field
backend/wayland: fix uninitialized wlr_event_keyboard_key::update_state
2018-02-24 10:14:22 -05:00
Guido Günther
9716aa9b92 x11: parse vendor and model out of xcb setup information 2018-02-23 09:52:56 +01:00
emersion
11e5f0bac8
backend/wayland: fix uninitialized wlr_event_keyboard_key::update_state 2018-02-23 09:40:31 +01:00
Drew DeVault
1d9be89e2d
Revert "ELF Visibility" 2018-02-19 18:01:27 -05:00
Drew DeVault
868ad5af69
Merge pull request #647 from ascent12/elf_visibility
ELF Visibility
2018-02-18 21:49:23 -05:00
Scott Anderson
86269052eb Explicitly export EFL symbols 2018-02-19 14:26:40 +13:00
Guido Günther
15afef6cbc x11 backend: set window title
This makes windows identifiable in the window list
2018-02-18 23:42:04 +01:00
Scott Anderson
f27c0b44b8 Remove usec_to_msec from public API 2018-02-19 10:43:25 +13:00
Rodrigo Lourenço
168e26489a Add missing dependencies 2018-02-14 18:42:39 +00: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
Drew DeVault
664d7bfe4e
Merge pull request #618 from VincentVanlaer/atomic-gamma
Add atomic gamma control
2018-02-10 09:51:09 -05:00
Drew DeVault
8fc7edd636
Merge pull request #623 from martinetd/mesonopt
Meson option enhancements
2018-02-10 09:49:13 -05:00
Dominique Martinet
435aec0033 meson build: only link with deps when required by options 2018-02-10 11:30:47 +01:00
Dominique Martinet
19d7edb430 meson.build status: print actual build options in message
We were printing the option intent (true by default for all), but
some are disabled when a component is not found and this was not
reflected.
2018-02-10 10:44:42 +01:00
Vincent Vanlaer
7cb828ac70 Fallback gamma on legacy if properties don't exist 2018-02-10 10:24:49 +01:00
emersion
bf6d245400
Swap buffers with damage 2018-02-09 22:54:14 +01:00
Vincent Vanlaer
dd69d7b764 Use VLA instead of heap alloc 2018-02-09 19:37:01 +01:00
Vincent Vanlaer
0232269a2d Fix style 2018-02-09 19:35:44 +01:00
Vincent Vanlaer
b2f6941617 Free gamma when property blob creation fails 2018-02-09 18:54:56 +01:00
Vincent Vanlaer
2df97ed16a Set needs_swap on output when gamma changes 2018-02-09 17:29:14 +01:00
Vincent Vanlaer
f5e5d1983b Do not allow gamma control without a crtc 2018-02-09 17:29:14 +01:00
Vincent Vanlaer
ab011406ad Add atomic gamma lut size fetching
Legacy gamma lut size now uses the new legacy_crtc member of
wlr_drm_crtc. This was Previously doen using old_crtc in
wlr_drm_connector, but since this refers to the crtc that was connected to
the ouput, this could give the wrong result.
2018-02-09 17:29:14 +01:00
Vincent Vanlaer
cc1229e75e Add atomic gamma setting 2018-02-09 17:29:04 +01:00
emersion
cdd55b5d19
Merge remote-tracking branch 'upstream/master' into output-damage 2018-02-09 14:50:26 +01:00
Markus Ongyerth
08fda567d2 prevents reuse of outdated wlr_output state
On the drm output the wlr_drm_connector structs are reused.
This struct contains the wlr_output struct, which is reused as well.
The old code kept modes/edid and output state persistent over hotplug.
This nulls the relevant strings, reads newer edid data and removes old
modes on unplug.
2018-02-06 22:45:37 +01:00
emersion
3d3ea32137
Merge remote-tracking branch 'upstream/master' into output-damage 2018-02-03 00:15:44 +01:00
emersion
bb39277e97
backend/drm: update output enabled property on modeset 2018-02-02 22:28:08 +01:00
emersion
bb4aeb3b2f
backend/drm: support updating cursor when session is paused 2018-02-02 21:01:59 +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
Guido Günther
c5aac77692 Fix some typos
Prefer initialize over initialise since used more often in the sources.
2018-01-30 16:10:07 +01:00
emersion
704130cc11
output: fix performance issues with wlr_output_schedule_frame 2018-01-30 14:45:02 +01:00
emersion
f152fdb4c5
Merge pull request #594 from Ongy/drm-surface-buffers
relases gbm buffers on init
2018-01-30 11:04:01 +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
51c22d39a4
Merge remote-tracking branch 'upstream/master' into output-damage 2018-01-29 23:24:09 +01:00
Tony Crisci
ed5b1fdedd
Merge pull request #580 from emersion/screenshooter-renderer-backport
Backport screenshooter fixes from the renderer redesign v1
2018-01-29 17:13:23 -05:00
Markus Ongyerth
cde0f454b3 Clean up the gbm/egl as well 2018-01-29 11:49:31 +01:00
Markus Ongyerth
2cdb646531 relases gbm buffers on init
The wlr_drm_surface_init function is called (upon others) when the drm
mode is changed.
When the surface was used previously this replaced the gbm_surface, but
did not replace the gbm buffers (front/back).
With this, wlr_drm_surface_get_from never set up the new buffers with
the new glViewport because surf->front existed.

This frees the buffers to get new buffers on the new surface with the
new viewport.
2018-01-29 11:29:54 +01:00
emersion
b47e8c4a1d
backend/drm: do not retry pageflip when swapping buffers 2018-01-28 23:33:38 +01:00
emersion
20e6861021
Do not flush damage if swapping buffers failed
This should solve issues with multiple outputs on DRM backend.
2018-01-28 22:39:24 +01:00
emersion
1ee61dbd0f
Merge remote-tracking branch 'upstream/master' into output-damage 2018-01-28 21:22:50 +01:00
Patrick Steinhardt
41ec686693 meson: add systemd/elogind backends only if enabled
Right now, we are adding systemd and elogind backends to the build
system as soon as their libraries are found on the build system.
Instead, we should only add them if the libraries have been found _and_
the user has actually requested them to be included.
2018-01-28 16:14:38 +00:00
Guido Günther
d7dfbd23fa drm: Use ptrdiff_t instead of intmax_t in format string
since we're looking at pointer differences.

Otherwise the build fails on arm like

In file included from ../backend/drm/drm.c:19:0:
../include/wlr/util/log.h:34:17: error: format '%jd' expects argument of type 'intmax_t', but argument 7 has type 'int' [-Werror=format=]
  _wlr_log(verb, "[%s:%d] " fmt, _strip_path(__FILE__), __LINE__, ##__VA_ARGS__)
                 ^
../backend/drm/drm.c:462:2: note: in expansion of macro 'wlr_log'
  wlr_log(L_DEBUG, "%s: crtc=%ju ovr=%jd pri=%jd cur=%jd", conn->output.name,
  ^~~~~~~
../backend/drm/drm.c:462:39: note: format string is defined here
  wlr_log(L_DEBUG, "%s: crtc=%ju ovr=%jd pri=%jd cur=%jd", conn->output.name,
                                     ~~^
                                     %d
2018-01-27 12:29:56 +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
Vincent Vanlaer
72507f9820 Clean up session signal handler on drm init fail 2018-01-24 18:27:53 +01:00
emersion
4fa90b0511
Backport screenshooter fixes from the renderer redesign v1
This backports some changes to #319 to fix the screenshooter data
format. This also adds wlr_backend_get_renderer which will be
useful to support multiple renderers.
2018-01-23 22:06:54 +01:00
emersion
59c53e8333
Merge remote-tracking branch 'upstream/master' into output-damage 2018-01-21 22:18:06 +01:00
Timidger
f8b9f44ff5
Add con/crtc null check to move_cursor in drm 2018-01-21 15:47:02 -05:00
Timidger
9d4ea146b6
Added crtc null check for other drm funcs 2018-01-21 15:37:23 -05:00
Timidger
4478cf1ddc
Fixes #575 2018-01-21 14:57:24 -05:00
Johannes Schramm
e37ebf6869 style: add comment to empty while loop in logind.c 2018-01-21 17:00:15 +01:00
Johannes Schramm
dcc743047b style: include brackets for if/while/for, even if it's a single statement 2018-01-21 16:28:21 +01:00
emersion
0365b587f0
output: add damage tracking via buffer age 2018-01-21 00:06:35 +01:00
emersion
78c13ead16
backend/x11: force rendering the whole output 2018-01-20 18:10:11 +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
584f06ad2f
backend/drm: do not try a pageflip is another one is in pending 2018-01-19 23:46:40 +01:00
emersion
f0f97280a0
backend/drm: fix retry pageflip 2018-01-19 23:35:23 +01:00
emersion
bde255933e
output: add wlr_output::damage, fixes #572 2018-01-18 19:47:21 +01:00
emersion
6fa0a91ee2
backend/wayland: fix segfault in wlr_wl_output_destroy 2018-01-18 13:06:57 +01:00
Drew DeVault
b331c5c2c5
Merge pull request #549 from emersion/output-enabled
Add wlr_output::enabled
2018-01-15 20:53:13 -05:00
emersion
0eebaf98d0
drm: do not pageflip when enabling output 2018-01-15 21:49:37 +01:00
Guido Günther
3101c300b1 Don't crash if crtc->cursor is NULL
Same as what atomic_crtc_set_cursor does

 Core was generated by `_build/rootston/rootston'.
 Program terminated with signal SIGSEGV, Segmentation fault.
 0  0xb6f28a1c in atomic_crtc_move_cursor (drm=0x1ebc8e8, crtc=0x1ead498, x=0, y=0) at ../backend/drm/atomic.c:170
 170		if (!crtc || !crtc->cursor) {
 (gdb) bt
 0  0xb6f28a1c in atomic_crtc_move_cursor (drm=0x1ebc8e8, crtc=0x1ead498, x=0, y=0) at ../backend/drm/atomic.c:170
 1  0xb6f2a856 in wlr_drm_connector_move_cursor (output=0x2242b28, x=0, y=0) at ../backend/drm/drm.c:634
 2  0xb6f3cea0 in wlr_output_cursor_set_image (cursor=0x21a0338, pixels=0x22e1290 "", stride=24, width=24, height=24, hotspot_x=4, hotspot_y=4) at ../types/wlr_output.c:516
 3  0xb6f39da2 in wlr_cursor_set_image (cur=0x22cfc90, pixels=0x22e1290 "", stride=24, width=24, height=24, hotspot_x=4, hotspot_y=4, scale=1) at ../types/wlr_cursor.c:310
 4  0xb6f44d2a in wlr_xcursor_manager_set_cursor_image (manager=0x22cfd10, name=0x434420 "left_ptr", cursor=0x22cfc90) at ../types/wlr_xcursor_manager.c:80
 5  0x00431c0a in roots_seat_configure_xcursor (seat=0x22cef08) at ../rootston/seat.c:515
 6  0x0043137c in roots_seat_init_cursor (seat=0x22cef08) at ../rootston/seat.c:210
 7  0x004315ec in roots_seat_create (input=0x218d220, name=0x434594 "seat0") at ../rootston/seat.c:289
 8  0x0042ecba in input_get_seat (input=0x218d220, name=0x434594 "seat0") at ../rootston/input.c:39
 9  0x0042ed04 in input_add_notify (listener=0x218d228, data=0x218d3b0) at ../rootston/input.c:54
 10 0xb6f2f2e6 in wl_signal_emit (signal=0x1ea548c, data=0x218d3b0) at /usr/include/wayland-server-core.h:387
 11 0xb6f2f572 in input_add_reemit (listener=0x1ea9990, data=0x218d3b0) at ../backend/multi/backend.c:101
 12 0xb6f2db7e in wl_signal_emit (signal=0x1ea992c, data=0x218d3b0) at /usr/include/wayland-server-core.h:387
 13 0xb6f2ddaa in handle_device_added (backend=0x1ea9920, libinput_dev=0x2292598) at ../backend/libinput/events.c:87
 14 0xb6f2e164 in wlr_libinput_event (backend=0x1ea9920, event=0x2292b78) at ../backend/libinput/events.c:198
 15 0xb6f2d678 in wlr_libinput_readable (fd=23, mask=1, _backend=0x1ea9920) at ../backend/libinput/backend.c:28
 16 0xb6f2d7c0 in wlr_libinput_backend_start (_backend=0x1ea9920) at ../backend/libinput/backend.c:74
 17 0xb6f27170 in wlr_backend_start (backend=0x1ea9920) at ../backend/backend.c:30
 18 0xb6f2f320 in multi_backend_start (wlr_backend=0x1ea5480) at ../backend/multi/backend.c:22
 19 0xb6f27170 in wlr_backend_start (backend=0x1ea5480) at ../backend/backend.c:30
 20 0x0042fbc6 in main (argc=1, argv=0xbe89dd04) at ../rootston/main.c:60
2018-01-15 13:37:53 +01:00
Markus Ongyerth
c00e9d1416 adds remote argument to wayland backend create
Add a remote display name argument to wlr_wl_backend_create.
If NULL is passed to the wayland backend at all times, creating a
wayland backend *after* the compositor was started up, would require
changing the WAYLAND_DISPLAY environment variable.
2018-01-13 21:20:15 +01:00
emersion
53ba9b4eec
Fix output enable in DRM backend 2018-01-07 00:28:21 +01:00
emersion
771263380c
Add wlr_output::enabled 2018-01-04 12:46:15 +01:00
PoroCYon
7574e27c6a fix build without systemd 2018-01-02 16:39:58 +01:00
Timidger
1478ef3202
Remove display_destroy on multi-backend destroy 2017-12-28 10:54:30 -06:00
Drew DeVault
bb24895a2b
Merge pull request #533 from martinetd/wl_array_add
ENOMEM checks: consistently check wl_array_add return
2017-12-28 07:44:21 -08:00
Dominique Martinet
8e24aaa3c6 style: fix sizeof() calls without parentheses 2017-12-28 16:28:19 +01:00