Commit Graph

422 Commits

Author SHA1 Message Date
Simon Ser 2bdd1d0896 backend/drm: use modifiers for our GBM buffers 2019-10-11 08:11:48 -04:00
Rouven Czerwinski bf90474b74 backend/drm: check for mst: in path property
Instead of checking that the path property is not 0 to determine if the
connector is an MST connector, check if the path contains the mst:
string.

Fixes #1813
2019-09-05 10:25:12 +03:00
Simon Ser 8d2ea9544b backend/drm: fix missing plane formats
The loop populating the format list was exiting early if ARGB8888 was found.
2019-08-15 12:33:42 +12:00
Antonin Décimo 39c5d93dea backend/drm: use UINT64_C for uint64_t literals
Prevents an integer promotion bug during the byte-shift.
2019-08-12 09:37:21 +09:00
Rouven Czerwinski 01f903874b Revert "output: atomic mode"
This reverts commit ee5f98ad49.

This intoduced problems where outputs could not be turned off because
they had flips pending.
2019-08-07 16:22:11 +09:00
Rouven Czerwinski 4d36cc86eb backend/drm: destroy output immediately
Instead of waiting for the next pageflip, destroy the output immediately
since we can now handle flips for outputs which no longer exist.
Also demote the missing crtc on flip to debug.

Fixes #1739
2019-08-03 15:44:21 +02:00
Simon Ser ee5f98ad49 output: atomic mode, enabled, scale and transform
This commit makes more output properties (mode, enabled, scale and transform)
atomic. This means that they are double-buffered and only applied on commit.

Compositors now need to call wlr_output_commit after setting any of those
properties.

Internally, backends still apply properties sequentially. The behaviour should
be exactly the same as before. Future commits will update some backends to take
advantage of the atomic interface. Some backends are non-atomic by design, e.g.
the X11 backend or the legacy DRM backend.

Updates: https://github.com/swaywm/wlroots/issues/1640
2019-08-02 10:01:29 -04:00
Simon Ser ca45f4490c Remove all wayland-server.h includes
The documentation for wayland-server.h says:

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

Replacing wayland-server.h with wayland-server-core.h allows us to drop the
WL_HIDE_DEPRECATED declaration.
2019-07-27 15:49:32 -04:00
Rouven Czerwinski d10072e76c backend: drm: switch to pageflip_handler_2
atomic and legacy now both pass the backend as the user data for the
pageflip event. We than retrieve the correct connector by matching on
the crtc_id passed to the page_flip_handler2.

Wlroots also requires the DRM_CRTC_IN_VBLANK_EVENT capability now.

Fixes #1297
2019-06-27 00:17:27 +00:00
Scott Anderson 46dc4100d6 backend/drm: Exit-early if 0 crtcs
This fixes an assertion failure if we're using a device that has 0 crtcs
as a renderer.
This would happen on some laptops with discrete GPUs.
2019-06-24 09:09:36 +03:00
Scott Anderson b3f42548d0 backend/drm: Simplify object matching code
We originally used match_obj on planes, but this was largely
unnecessary. Instead, this assigns planes statically at startup.
2019-06-22 11:58:33 +03:00
Simon Ser ce3f4c3fe1 output: remove wlr_output_impl.transform
The backend doesn't need to handle transform changes, since everything is done
in software. In fact, all of the implementations were all identical and just
set the transform.

We could add support for hardware transforms, but:

- This would require a different field (something like hardware_transform)
- Not all combinations are possible because there often are hardware
  limitations
- The Wayland protocol isn't ready for this (in particular xdg-output, see [1])

This belongs to a different patch series anyway.

[1]: https://patchwork.freedesktop.org/series/52324/
2019-06-16 10:51:49 -04:00
Simon Ser e8057bb60c backend/drm: fallback to drmModeAddFB2 2019-06-07 09:06:11 -04:00
Simon Ser d1766547bd backend/drm: reject DMA-BUFs with flags 2019-06-07 09:06:11 -04:00
Simon Ser 44ba603c0e backend/drm: hold buffers while scanning out 2019-06-07 09:06:11 -04:00
Simon Ser afe7b207d5 output: fix attach_buffer semantics 2019-06-07 09:06:11 -04:00
Simon Ser 1d222309b8 output: change set_dmabuf to attach_buffer 2019-06-07 09:06:11 -04:00
Simon Ser 5c78f1b0d5 backend/drm: strip alpha channel on scan-out 2019-06-07 09:06:11 -04:00
Simon Ser e516ea4c79 backend/drm: check format when scanning out DMA-BUF 2019-06-07 09:06:11 -04:00
emersion 96d6fde5dc backend/drm: add basic support for direct scan-out 2019-06-07 09:06:11 -04:00
Simon Ser 20690346c7 output: rename needs_commit to needs_frame
This new name makes more sense, since it is a request from the backend to get
a new frame. In the future a commit may not convey a new frame.
2019-04-23 14:34:30 -06:00
Simon Ser 9a0f8a194c output: refactor backend API
This updates the backend part of the output API. This is mostly renaming:
make_current becomes attach_render and swap_buffers becomes commit.

This also fixes the RDP backend to support NULL damage.
2019-04-23 14:34:30 -06:00
Alyssa Ross 95b22619e0 Fix missing headers when building without X11
The deleted includes are redundant, because other headers will include
the necessary files. Additionally, they cause build failures, because
including EGL/egl.h or EGL/eglext.h directly, instead of through
wlr/render/egl.h or wlr/render/interface.h, will mean that
MESA_EGL_NO_X11_HEADERS will not have been defined, and so the EGL
headers will attempt to pull in unnecessary X11 headers that may not
exist on the system.

For the headers produced by glgen.sh, the includes couldn't simply be
deleted, because no other header would include the EGL headers. Neither
wlr/render/egl.h or wlr/render/interface.h felt appropriate to include,
so I opted instead to copy the MESA_EGL_NO_X11_HEADERS definition before
the EGL includes.
2019-04-22 00:04:08 +03:00
Guido Günther cd60f40bbb wlr_output: Add preferred property (#1625)
* wlr_output: Indicate modes link

* wlr_output: Introduce preferred flag

This indicates an outputs preferred mode.

* drm: Set preferred flag for an outputs preferred mode
2019-03-21 22:12:43 +02:00
Scott Anderson 6a8f17b5f6 backend/drm: Don't fail on failing to find overlay format
Some hardware exists which doesn't support XRGB/ARGB overlays, and we
aren't even using overlay planes, so don't fail on trying to find a
format.
2019-03-05 23:15:20 +01:00
Scott Anderson d945c97926 backend/drm: Unset cursor on cleanup
This will prevent the cursor from persisting on the Linux framebuffer
terminal on exit.
2019-02-24 09:04:36 +01:00
Rouven Czerwinski e1834ace28 backend/drm: fix memory leak in realloc crtcs
If *changed_outputs is not supplied by the calling function, track the local
allocation with a bool variable and free the allocation at the end of the
function.
2019-02-21 08:19:12 +01:00
Brian Ashworth 50011e7170 backend/drm: fix modeset on drm fd resume
On DRM resume, such as switching back to a TTY, the output needs to be
modeset to the current mode. However, wlr_output_set_mode will return
early when attempting to set the mode to the current mode. This just
steps around wlr_output_set_mode and calls drm_connector_set_mode
directly.
2019-02-19 16:49:51 +01:00
emersion 2a738803b2
backend/drm: fix NULL dereference when unsetting cursor
This segfault happens on multi-GPU systems.

Fixes https://github.com/swaywm/sway/issues/3717
2019-02-18 20:15:39 +01:00
Drew DeVault 2d2c79e37c
Merge pull request #1537 from VincentVanlaer/cursor-dmabuf-nouveau
Add workaround for hardware cursors on nouveau
2019-02-15 16:07:50 +01:00
Vincent Vanlaer 26a9fa8148 Add workaround for hardware cursors on nouveau 2019-02-15 15:59:09 +01:00
Drew DeVault 9a5d59a839 Revert "drm: do not modeset to current mode"
This reverts commit 72c76b128e.
2019-02-15 09:44:42 -05:00
Vincent Vanlaer bc048b22fb Copy cursor surface to secondary gpu if necessary 2019-02-14 12:31:54 +01:00
Brian Ashworth 72c76b128e drm: do not modeset to current mode
There is no point in modesetting an output to a mode that it is already
set to. Modesetting will cause the output to briefly flicker which is
undesirable for a noop. This returns early in `drm_connector_set_mode`
when attempting to modeset to the current mode.
2019-02-14 10:59:06 +01:00
Vincent Vanlaer 7bc43413ed Allow cursor render surface to be used as fb
In order for a surface to be used as a cursor plane framebuffer, it
appears that requiring the buffer to be linear is sufficient.

GBM_BO_USE_SCANOUT is added in case GBM_BO_USE_LINEAR isn't sufficient
on untested hardware.

Fixes #1323

Removed wlr_drm_plane.cursor_bo as it does not serve any purpose
anymore.

Relevant analysis (taken from the PR description):

While trying to implement a fix for #1323, I found that when exporting
the rendered surface into a DMA-BUF and reimporting it with
`GBM_BO_USE_CURSOR`, the resulting object does not appear to be valid.
After some digging (turning on drm-kms debugging and switching to legacy
mode), I managed to extract the following error: ```
[drm:__setplane_check.isra.1 [drm]] Invalid pixel format AR24
little-endian (0x34325241), modifier 0x100000000000001 ``` The format
itself refers to ARGB8888 which is the same format as
`renderer->gbm_format` used in master to create the cursor bo. However,
using `gbm_bo_create` with `GBM_BO_USE_CURSOR` results in a modifier of
0. A modifier of zero represents a linear buffer while the modifier of
the surface that is rendered to is  `I915_FORMAT_MOD_X_TILED` (see
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/include/uapi/drm/drm_fourcc.h?h=v4.20.6#n263).
In order to fix this mismatch in modifier, I added the
`GBM_BO_USE_LINEAR` to the render surface and everything started to work
just fine. I wondered however, whether the export and import is really
necessary. I then decided to test if the back buffer of the render
surface works as well, and at least on my hardware (Intel HD 530 and
Intel UHD 620) it does. This is the patch in this PR and this requires
no exporting and importing.

I have to note that I cheated in order to import DMA_BUFs into a cursor
bo when doing the first tests, since on import the Intel drivers check
that the cursor is 64x64. This is strange since cursor sizes other than
64x64 have been around for quite some time now
(https://lists.freedesktop.org/archives/mesa-commit/2014-June/050268.html).
Removing this check made everything work fine. I later (while writing
this PR) found out that `__DRI_IMAGE_USE_CURSOR` (to which
`GBM_BO_USE_CURSOR` translates) has been deprecated in mesa
(https://gitlab.freedesktop.org/mesa/mesa/blob/master/include/GL/internal/dri_interface.h#L1296),
which makes me wonder what the usecase of `GBM_BO_USE_CURSOR` is. The
reason we never encountered this is that when specifying
`GBM_BO_USE_WRITE`, a dumb buffer is created trough DRM and the usage
flag never reaches the Intel driver directly. The relevant code is in
https://gitlab.freedesktop.org/mesa/mesa/blob/master/src/gbm/backends/dri/gbm_dri.c#L1011-1089
. From this it seems that as long as the size, format and modifiers are
right, any surface can be used as a cursor.
2019-02-04 20:47:07 +01:00
emersion ee293fab58
backend/drm: fix GBM format mismatch
We create the EGL config with GBM_FORMAT_ARGB8888, but then initialize GBM BOs
with GBM_FORMAT_XRGB8888. This mismatch confuses Mesa.

Instead, we can always use GBM_FORMAT_ARGB8888, and use DRM_FORMAT_XRGB8888
when calling drmModeAddFB2.

Fixes https://github.com/swaywm/wlroots/issues/1438
2019-01-29 12:04:12 +01:00
emersion d4ffa5b7a6
backend/drm: fix state for outputs loosing their CRTC
When there aren't enough CRTCs for all outputs, we try to move a CRTC from a
disabled output to an enabled one. When this happens, the old output's state
wasn't changed, so the compositor thought it was still enabled and rendering.

This commit marks the old output as WLR_DRM_CONN_NEEDS_MODESET and sets its
current mode to NULL.
2019-01-19 10:18:03 +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
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
emersion 491f1dbf75
backend/drm: fix VLA overflow 2018-12-04 18:56:29 +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
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
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 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 54e1287f30 backend: add get_present_clock 2018-10-04 21:58:17 +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
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
emersion 139a905924 backend/drm: add assertions 2018-09-18 11:06:01 +02:00
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
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
emersion 8a6bdc193d backend/drm: damage outputs when switching CRTCs 2018-09-04 23:10:37 +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
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
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 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
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
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
emersion 2b9cbaddf3
screencopy: add support for frame flags 2018-06-30 22:18:03 +01: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
emersion 21928cbe61
Merge branch 'master' into screencontent 2018-05-31 12:33:27 +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
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 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
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
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 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 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 a2391a6047
Fix cursor transform on DRM backend 2018-03-31 20:55:31 -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 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 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 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
emersion d24f868bbe
backend/drm: fix cursor hotspot not updated 2018-03-12 19:34:43 +01:00
emersion 92ca4ad474
backend/drm: refactor wlr_drm_connector_set_cursor 2018-03-11 11:40:03 +01: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
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 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
emersion bf6d245400
Swap buffers with damage 2018-02-09 22:54:14 +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
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 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 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
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
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
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 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 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
emersion e737f65e38
Fix cursor on transformed output with DRM backend 2017-12-26 18:16:37 +01:00
Dominique Martinet be95147385 drm backend: add wlr_output_is_drm 2017-12-19 20:13:49 +01:00
emersion 0256de0002
Add full refresh rate support to custom modes 2017-12-17 18:02:55 +01:00
emersion 466e86b7b2
Merge branch 'master' into surface-transform 2017-12-14 20:31:18 +01:00
emersion 3b4b8953d9
Update output layout when scale or transform changes 2017-12-12 21:58:00 +01:00
emersion 8af779fae6
Fix segfault when moving hardware cursor 2017-12-05 22:23:01 +01:00
emersion 6a69b4419f
Make wlr_output_transform_* functions public, refactoring 2017-12-01 09:15:33 +01:00
Dominique Martinet f451ea3639 rootston exit: fix drm destroy
wlr_drm_connector were being freed without removing them
from the drm->outputs list, segfaulting on destroy
2017-11-01 19:37:35 +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
emersion 0beae99188
Apply output transformation to pointer events in Wayland backend 2017-11-01 11:00:27 +01:00
emersion c3b09f73da
Fix cursor hotspot with rotated outputs on DRM backend 2017-10-31 12:30:57 +01:00
emersion 6656e25fd4
Transform cursor hotspot 2017-10-31 12:30:56 +01:00
emersion 1b6c729360
Add wlr_output_cursor 2017-10-31 12:30:03 +01:00
Drew DeVault fa9c6ecc53 Fix segfault in DRM cursor 2017-10-28 15:09:38 -04:00
emersion 9d587d759f
Do not set hw cursor if disabled when switching VT 2017-10-26 18:58:44 +02:00
Scott Anderson 75f0a6c998 Merge pull request #286 from versusvoid/update-connector-crtc-bindings
Update Connector-CRTC bindings after resume in DRM backend
2017-10-23 20:25:40 +13:00
Versus Void 549777ca19 Set crtc field when scanning for DRM connectors
and always use it when matching CRTCs with connectors.
Fix deactivated monitors check.
2017-10-22 21:38:30 +00:00
Versus Void 3c31209a97 Reinitialize only changed DRM outputs after setting mode on one 2017-10-22 21:34:56 +00:00
Versus Void ecb2a2b0d3 Emit output resolution event only when resolution changes 2017-10-22 21:34:56 +00:00
emersion 1cc8f21d8e
Cleanup wlr_gamma_control 2017-10-22 23:11:26 +02:00
emersion e1d213fccd
Create globals only for enabled outputs in DRM backend 2017-10-22 22:21:23 +02:00
Versus Void 2ab080e79a Fix index computation in DRM output scan and CRTC match 2017-10-22 10:54:09 +00:00
Drew DeVault 16f35ecbea Merge branch 'master' into heghe/wl_list 2017-10-21 22:03:48 -04:00
Scott Anderson bdeffad7e5 Remove drm field from wlr_drm_connector 2017-10-22 10:36:07 +13:00
Scott Anderson 822a9f65a4 Add pointer to backend inside wlr_output 2017-10-22 10:36:07 +13:00
Scott Anderson 4ea84c5765 Remove unnecesary wlr_renderers 2017-10-22 10:36:07 +13:00
Heghedus Razvan 1d716241af Replace list_t with wl_list in wlr_output
Signed-off-by: Heghedus Razvan <heghedus.razvan@gmail.com>
2017-10-20 11:46:09 +03:00
Heghedus Razvan c03e774636 Replace list_t with wl_list in wlr_drm_backend
Signed-off-by: Heghedus Razvan <heghedus.razvan@gmail.com>
2017-10-20 11:46:03 +03:00
emersion 92daa790bb
Allow to update the cursor hotspot without its pixels 2017-10-12 09:40:51 +02:00
Versus Void 641d08ce7e Transform hotspot with cursor
Fix #188
2017-10-06 09:07:08 +03:00
Versus Void c5df6ca900 Fix memory leaks 2017-10-05 20:01:56 +00:00
Scott Anderson f193623ca1 Change iface prefix to suffix 2017-10-02 21:44:33 +13:00
Scott Anderson f6f9c40965 Minor fixes 2017-10-01 22:44:24 +13:00
Scott Anderson 009c3747a8 Multi-GPU DRM 2017-10-01 22:29:25 +13:00
Scott Anderson eaef028976 Add renderer pointer inside drm_surface 2017-10-01 15:55:25 +13:00
Scott Anderson 4101b89700 Rename wlr_drm_output to wlr_drm_connector 2017-09-30 23:31:08 +13:00
Scott Anderson 22e77d9195 Rename backend to drm 2017-09-30 22:22:26 +13:00
Scott Anderson ec5b95e08f Add pointer to backend from DRM outputs 2017-09-30 22:01:59 +13:00
Scott Anderson 096249a2a1 Split DRM rendering to its own file 2017-09-30 20:52:58 +13:00
Scott Anderson d0708b1a3a Split DRM internal interface to its own header 2017-09-30 19:11:41 +13:00
Scott Anderson 610b0493ac Rename files to remove pointless drm prefix 2017-09-30 19:03:34 +13:00
Scott Anderson 517ba0bc16 Change egl_get_config to always use visual id 2017-09-29 16:15:09 +13:00
Scott Anderson a466c86fba Set state properly 2017-09-24 12:06:00 +13:00
Scott Anderson db5e9385d4 Simplify retry_pageflip 2017-09-23 18:44:39 +12:00
Scott Anderson 025b3ee515 Add error recovery for failed page flips 2017-09-23 18:27:14 +12:00
Scott Anderson 459d138fa2 Add timeout to DRM cleanup
This prevents a potential infinite loop preventing us from closing
properly.
2017-09-23 16:32:25 +12:00
Scott Anderson 4a53aab466 Allow forcing legacy DRM interface 2017-09-23 13:20:17 +12:00
Scott Anderson 0aa00da1f3 Check for disappearing DRM connectors
DisplayPort MST connectors will disappear when they're disconnected, so
we need to check for that.
2017-09-09 23:09:51 +12:00
emersion 6f98b5a337
Add set_gamma and get_gamma_size to wlr_output_impl 2017-09-06 18:53:08 +02:00
Tony Crisci e3d47376dc add wlr_cursor basic implementation 2017-08-26 08:32:11 -04:00
Dominique Martinet f24b3df980 wlr renderer/texture: rename init to create when it does alloc 2017-08-19 08:33:31 +02:00
Dominique Martinet 0252c8e072 drm realloc_crtcs: check we found an output
This follows-up on #105 that just initialized to 0.
Instead, make sure we actually found an output that matches
2017-08-18 18:27:59 +02:00
Tony Crisci 784cf65635 fix uninitialized warning
`index` might be uninitialized. Warning can be produced with gcc and `-01` flag.
2017-08-18 12:08:28 -04:00
Drew DeVault e7fa4f12e1 Fix DRM problem introduced in 901c14c 2017-08-16 17:36:57 -04:00