Commit Graph

715 Commits

Author SHA1 Message Date
emersion 9b1d9fb91e
backend/drm: get physical size from libdrm
Values from libdrm are likely more reliable than raw values from the EDID. We
were already using values from libdrm, but they were overwritten by parse_edid.
See drm.c:

    wlr_conn->output.phys_width = drm_conn->mmWidth;
    wlr_conn->output.phys_height = drm_conn->mmHeight;
2018-12-23 10:36:53 +01:00
Timidger 9af0c5338f
Standardize the wlr_box input paramaters
Fixes #1094
2018-12-21 13:56:10 -05:00
emersion ff6c4f80b2
backend/drm: don't insert duplicate custom modes, fix refresh rate 2018-12-16 11:06:46 +01:00
Ryan Walklin 2a3c62b4d2 [WIP][DONTMERGE]Add support for libinput_switch input devices
These are used primarily by laptops to signal
the state of the lid (open/closed) and tablet
mode if supported, based on ACPI events.
2018-12-15 14:42:35 +11:00
Scott Anderson fec88770dd backend/drm: Fix uninitialized variable 2018-12-09 22:55:53 +13:00
Scott Anderson efdd4d6ea2 backend/drm: Improve encoder logic
This fixes an issue that can occur with DP MST connectors not reporting
any encoders.
2018-12-09 22:48:00 +13:00
emersion f8056a0350
backend/drm: fix disappeared output indices
This commit changes `scan_drm_connectors` to add new outputs to the end of the
list. That way, it's easier to understand what's going on with indices.

When we need to destroy outputs, we now walk the list in reverse order. This
ensures indices remain correct while iterating and removing items from the
list.

We now also make outputs without a CRTC disappear (those are in
WLR_DRM_CONN_NEEDS_MODESET state).
2018-12-09 10:12:52 +01:00
Drew DeVault 20f5fc9e2e
Merge pull request #1413 from emersion/logind-session-logs
backend/session/logind: improve logging
2018-12-06 18:03:33 -05:00
emersion e23fe328a6
backend/session/logind: improve logging 2018-12-06 17:01:17 +01:00
emersion 491f1dbf75
backend/drm: fix VLA overflow 2018-12-04 18:56:29 +01:00
emersion 408e2a77e9
backend/wayland: fix zero-length VLA 2018-11-27 23:18:12 +01:00
Rostislav Pehlivanov 91513c89cd Fix interlaced mode rejection 2018-11-22 17:52:52 +00:00
Rostislav Pehlivanov dc9fdd6385 Skip interlaced modes during drm mode detection
Fixes #3167
A better solution could be made if there's a need to.
2018-11-21 19:23:48 +00:00
Scott Anderson d3ee69f76b backend/x11: Hide cursor with Xfixes 2018-11-13 10:55:03 +13:00
Scott Anderson 70ae76304e backend/x11: Remove old input functions
This also allows us to remove xcb-xkb, since Xinput will now give us the
appropriate XKB modifiers with each event.
2018-11-13 10:55:03 +13:00
Scott Anderson d89e868cc9 backend/x11: Add new Xinput events 2018-11-13 10:42:02 +13:00
Scott Anderson 88b2d6fe25 backend/x11: Check for xinput extension 2018-11-13 10:41:37 +13:00
Scott Anderson 9c1b87f210 backend/x11: Move atom initilisation earlier
There isn't any real reason to delay this until the backend is started.
2018-11-13 10:40:52 +13:00
Scott Anderson ab2c57984b backend/x11: Make header order consistent 2018-11-13 10:40:52 +13:00
Scott Anderson 51a283cbe4 backend/x11: Rename xcb_conn to xcb
When the Xlib connection is removed, this _conn suffix is going to be
pointless. I'm removing this preemtively for that.
2018-11-13 10:39:24 +13:00
Drew DeVault 77dfac4fa4
Merge pull request #1372 from emersion/config10
Use #if instead of #ifdef for wlroots config data
2018-11-12 16:14:18 -05:00
emersion 51bfdd620e
Use #if instead of #ifdef for wlroots config data
This prevents some annoying issues when e.g. not including wlr/config.h or
making a typo in the guard name.
2018-11-12 10:12:46 +01:00
emersion 180151ed09
backend/wayland: handle WL_EVENT_WRITABLE for Wayland socket
We need to flush when the connection is writable again. This is important in
case the write buffer becomes full. This is also what Weston does [1].

[1]: https://gitlab.freedesktop.org/wayland/weston/blob/master/libweston/compositor-wayland.c#L2593
2018-11-11 21:14:15 +01:00
Scott Anderson aaff4b8c00 backend/wayland: Make header order consistent 2018-11-11 22:29:35 +13:00
Scott Anderson bbce92a923 backend/wayland: Move initilisation code earlier
The renderer redesign is going to need the render fd before the backend
is fully started, so we have to move the wl registry code to when the
backend is created instead of when it is started.

We also need to stash the wl_keyboard and emit it to library users
later, once they've added their listeners and started the backend.
2018-11-11 18:11:56 +13:00
Scott Anderson 47545cf550 backend/wayland: Use specific wl_global versions
Explicitly use the version we support instead of accepting the
compositor's version.
2018-11-11 18:11:56 +13:00
Scott Anderson 4e03802057 backend/wayland: Move registry into backend
Registry was a very small file, and is heavily related to the backend,
so there is not point in keeping them separate.
2018-11-11 18:11:56 +13:00
emersion 09550032b7
render: correctly set EGL_RENDERABLE_TYPE
This should be set to EGL_OPENGL_ES2_BIT.

Also fixes EGL config attributes in the headless and X11 backends.
2018-11-10 13:20:54 +01:00
emersion b5125ff328
backend/drm: specify minimum config attributes
Since the format used by DRM is GBM_FORMAT_ARGB8888, we need at least a R, G, B
and A channel.
2018-11-04 09:00:55 +01:00
Drew DeVault 70ca7daeb2
Merge pull request #1346 from emersion/fix-schedule-frame-mgpu
backend/drm: fix frame scheduling on secondary GPUs
2018-10-30 01:59:25 +01:00
emersion 68362b37a8
backend/drm: fix frame scheduling on secondary GPUs
There was a missing copy_drm_surface_mgpu call in drm_connector_schedule_frame
so we asked for a pageflip with an unknown BO, resulting in ENOENT.

Additionally, this commit makes schedule_frame return a bool indicating
failures. This allows schedule_frame_handle_idle_timer to only set
frame_pending to true if a frame has been successfully scheduled. Thus, if a
pageflip fails, rendering won't be blocked forever anymore.

In case a pageflip is already pending, true is returned because a frame has
already been scheduled and will be sent sometime soon.
2018-10-29 20:38:57 +01:00
emersion 443a38bd3f
backend/drm: add WLR_DRM_NO_ATOMIC_GAMMA env variable
This allows the legacy interface to be used instead of atomic if needed. This
is a workaround to make some Intel GPUs work (if this variable is unset) as
well as to make some AMD GPUs work (if this variable is set).
2018-10-28 23:43:21 +01:00
Drew DeVault e0cf97da69
Merge pull request #1307 from emersion/static-analysis
Fix a few bugs found by the static analyzer
2018-10-21 19:18:39 +02:00
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