Commit graph

680 commits

Author SHA1 Message Date
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