aboutsummaryrefslogtreecommitdiff
path: root/backend/drm
AgeCommit message (Collapse)Author
2019-12-20backend/drm: print preferred modeRouven Czerwinski
While printing the supported output modes, annotate the preferred mode.
2019-12-20Refactor EGL/GL API loadingSimon Ser
Remove glapi.sh code generation, replace it with hand-written loading code that checks extension strings before calling eglGetProcAddress. The GLES2 renderer still uses global state because of: - {PUSH,POP}_GLES2_DEBUG macros - wlr_gles2_texture_from_* taking a wlr_egl instead of the renderer
2019-12-11backend/drm: add BenQ to manufacturer listSimon Ser
2019-12-05backend/drm: fix segfault in init_drm_surfaceSimon Ser
When surf->gbm was previously set, we destroy it without setting it to NULL. Later on, we only create the GBM surface if surf->gbm is NULL. This result in a use-after-free when we start using surf->gbm. Closes: https://github.com/swaywm/wlroots/issues/1868 Closes: https://github.com/swaywm/wlroots/issues/1874 Closes: https://github.com/swaywm/sway/issues/4785 Closes: https://github.com/swaywm/sway/issues/4717 Closes: https://github.com/swaywm/sway/issues/4730 Fixes: 2bdd1d0896cc ("backend/drm: use modifiers for our GBM buffers")
2019-12-01backend/drm, backend/libinput: listen to session destroySimon Ser
This fixes a heap-use-after-free when the session is destroyed before the backend during wl_display_destroy: ==1085==ERROR: AddressSanitizer: heap-use-after-free on address 0x614000000180 at pc 0x7f88e3590c2d bp 0x7ffdc4e33f90 sp 0x7ffdc4e33f80 READ of size 8 at 0x614000000180 thread T0 #0 0x7f88e3590c2c in find_device ../subprojects/wlroots/backend/session/session.c:192 #1 0x7f88e3590e85 in wlr_session_close_file ../subprojects/wlroots/backend/session/session.c:204 #2 0x7f88e357b80c in libinput_close_restricted ../subprojects/wlroots/backend/libinput/backend.c:24 #3 0x7f88e21af274 (/lib64/libinput.so.10+0x28274) #4 0x7f88e21aff1d (/lib64/libinput.so.10+0x28f1d) #5 0x7f88e219ddac (/lib64/libinput.so.10+0x16dac) #6 0x7f88e21b415d in libinput_unref (/lib64/libinput.so.10+0x2d15d) #7 0x7f88e357c9d6 in backend_destroy ../subprojects/wlroots/backend/libinput/backend.c:130 #8 0x7f88e3545a09 in wlr_backend_destroy ../subprojects/wlroots/backend/backend.c:50 #9 0x7f88e358981a in multi_backend_destroy ../subprojects/wlroots/backend/multi/backend.c:54 #10 0x7f88e358a059 in handle_display_destroy ../subprojects/wlroots/backend/multi/backend.c:107 #11 0x7f88e314acde (/lib64/libwayland-server.so.0+0x8cde) #12 0x7f88e314b466 in wl_display_destroy (/lib64/libwayland-server.so.0+0x9466) #13 0x559fefb52385 in main ../main.c:67 #14 0x7f88e2639152 in __libc_start_main (/lib64/libc.so.6+0x27152) #15 0x559fefb4297d in _start (/home/simon/src/glider/build/glider+0x2297d) 0x614000000180 is located 320 bytes inside of 416-byte region [0x614000000040,0x6140000001e0) freed by thread T0 here: #0 0x7f88e3d0a6b0 in __interceptor_free /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cc:122 #1 0x7f88e35b51fb in logind_session_destroy ../subprojects/wlroots/backend/session/logind.c:270 #2 0x7f88e35905a4 in wlr_session_destroy ../subprojects/wlroots/backend/session/session.c:156 #3 0x7f88e358f440 in handle_display_destroy ../subprojects/wlroots/backend/session/session.c:65 #4 0x7f88e314acde (/lib64/libwayland-server.so.0+0x8cde) previously allocated by thread T0 here: #0 0x7f88e3d0acd8 in __interceptor_calloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cc:153 #1 0x7f88e35b911c in logind_session_create ../subprojects/wlroots/backend/session/logind.c:746 #2 0x7f88e358f6b4 in wlr_session_create ../subprojects/wlroots/backend/session/session.c:91 #3 0x559fefb51ea6 in main ../main.c:20 #4 0x7f88e2639152 in __libc_start_main (/lib64/libc.so.6+0x27152)
2019-11-23Amend typosJason
2019-11-20Add -Wmissing-prototypesSimon Ser
This requires functions without a prototype definition to be static. This allows to detect dead code, export less symbols and put shared functions in headers.
2019-11-17output: add wlr_output_event_present.commit_seqSimon Ser
This is set to the value of wlr_output.commit_seq when the frame has been submitted. This allows tracking presentation with more then 1 full frame of latency. References: https://github.com/swaywm/wlroots/issues/1917
2019-10-27backend/drm: add support for custom modesSimon Ser
Use the CVT algorithm to create a drmModeModeInfo.
2019-10-23backend/drm: retry without modifiers for the primary planeSimon Ser
On some Intel cards using modifiers can fill the FIFO and prevent hotplugged outputs from being properly enabled. Add a fallback without modifiers. Fixes: 2bdd1d0896cc ("backend/drm: use modifiers for our GBM buffers") References: https://github.com/swaywm/wlroots/issues/1840 Closes: https://github.com/swaywm/wlroots/issues/1852
2019-10-22backend/drm: track gbm_bo during direct scan-outSimon Ser
We need to destroy the gbm_bo we imported and drmModeRmFb. Closes: https://github.com/swaywm/sway/issues/4662
2019-10-11backend/drm: use modifiers for our GBM buffersSimon Ser
2019-09-26drm: use IMPORT_FD for INVALID modifierIvan Molodetskikh
GBM_BO_IMPORT_FD_MODIFIER doesn't accept the INVALID modifier.
2019-09-05backend/drm: check for mst: in path propertyRouven Czerwinski
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-08-15backend/drm: fix missing plane formatsSimon Ser
The loop populating the format list was exiting early if ARGB8888 was found.
2019-08-12backend/drm: use UINT64_C for uint64_t literalsAntonin Décimo
Prevents an integer promotion bug during the byte-shift.
2019-08-07Revert "output: atomic mode"Rouven Czerwinski
This reverts commit ee5f98ad49fed0439f3313ec685307831d1d1d05. This intoduced problems where outputs could not be turned off because they had flips pending.
2019-08-03backend/drm: destroy output immediatelyRouven Czerwinski
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-02output: atomic mode, enabled, scale and transformSimon Ser
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-07-27Remove all wayland-server.h includesSimon Ser
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-06-27backend: drm: switch to pageflip_handler_2Rouven Czerwinski
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-24backend/drm: Exit-early if 0 crtcsScott Anderson
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-22backend/drm: Simplify object matching codeScott Anderson
We originally used match_obj on planes, but this was largely unnecessary. Instead, this assigns planes statically at startup.
2019-06-16output: remove wlr_output_impl.transformSimon Ser
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-11Remove WLR_DRM_NO_ATOMIC_GAMMA workaroundScott Anderson
This is fixed on amdgpu, so we don't need this anymore.
2019-06-07backend/drm: add support for multiplanar BOsSimon Ser
2019-06-07backend/drm: fallback to drmModeAddFB2Simon Ser
2019-06-07backend/drm: reject DMA-BUFs with flagsSimon Ser
2019-06-07backend/drm: hold buffers while scanning outSimon Ser
2019-06-07output: fix attach_buffer semanticsSimon Ser
2019-06-07output: change set_dmabuf to attach_bufferSimon Ser
2019-06-07backend/drm: strip alpha channel on scan-outSimon Ser
2019-06-07backend/drm: check format when scanning out DMA-BUFSimon Ser
2019-06-07backend/drm: add basic support for direct scan-outemersion
2019-06-02drm: legacy: issue a NULL modeset on disableRouven Czerwinski
The DRM subsystem needs a NULL modeset for connectors which disappear from the system to disable the hardware pipes, otherwise the pixels get rendered but are sent nowhere. The atomic backend does the equivalent by removing the properties and issuing a commit. Fixes #1706
2019-04-23output: rename needs_commit to needs_frameSimon Ser
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-23output: refactor backend APISimon Ser
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-22Fix missing headers when building without X11Alyssa Ross
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-03-21wlr_output: Add preferred property (#1625)Guido Günther
* 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-05backend/drm: Don't fail on failing to find overlay formatScott Anderson
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-02-24backend/drm: Unset cursor on cleanupScott Anderson
This will prevent the cursor from persisting on the Linux framebuffer terminal on exit.
2019-02-21backend/drm: fix memory leak in realloc crtcsRouven Czerwinski
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-19backend/drm: fix modeset on drm fd resumeBrian Ashworth
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-18backend/drm: fix NULL dereference when unsetting cursoremersion
This segfault happens on multi-GPU systems. Fixes https://github.com/swaywm/sway/issues/3717
2019-02-15Merge pull request #1537 from VincentVanlaer/cursor-dmabuf-nouveauDrew DeVault
Add workaround for hardware cursors on nouveau
2019-02-15Add workaround for hardware cursors on nouveauVincent Vanlaer
2019-02-15Revert "drm: do not modeset to current mode"Drew DeVault
This reverts commit 72c76b128e562c482868b42b1945ed49cbd44353.
2019-02-14Copy cursor surface to secondary gpu if necessaryVincent Vanlaer
2019-02-14drm: do not modeset to current modeBrian Ashworth
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-04Allow cursor render surface to be used as fbVincent Vanlaer
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.