aboutsummaryrefslogtreecommitdiff
path: root/include/backend/drm/drm.h
AgeCommit message (Collapse)Author
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-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.
2019-01-29backend/drm: fix GBM format mismatchemersion
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
2018-10-04backend: add get_present_clockemersion
2018-10-03backend/drm: reset gamma table on VT switchemersion
2018-09-28backend/drm: don't free connector immediatelyemersion
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-18backend/drm: add assertionsemersion
2018-09-15backend/drm: steal CRTCs from disabled outputsemersion
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-14output: make wlr_output_enable return a boolemersion
2018-09-04backend/drm: better hotplug handlingemersion
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-08-13move wlr_drm_connector_add_mode to wlr/backend/drm.hIlia Bozhinov
2018-07-07drm: Allow to add additional modesGuido Günther
This allows to add additional modes to the list of available video modes using VESA Coordinated Video Timing information. Closes #1080
2018-04-25Make sure we don't use others' prefixesemersion
2018-04-25Remove wlr_ prefix from local symbolsemersion
2018-03-24Redesign wlr_textureemersion
- 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-15matrix: use 2D matricesemersion
2018-02-26restore dpms state on drm resumeMarkus Ongyerth
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-12Reformat all #include directivesemersion
2018-02-09Add atomic gamma lut size fetchingVincent Vanlaer
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-09Add atomic gamma settingVincent Vanlaer
2018-02-02backend/drm: support updating cursor when session is pausedemersion
2017-12-19remove session from multibackendTony Crisci
2017-12-19drm backend: add wlr_output_is_drmDominique Martinet
2017-12-07Listen to display destroy in backendsemersion
2017-11-19Refactor wlr_list inside wlrootsemersion
2017-10-31Fix cursor hotspot with rotated outputs on DRM backendemersion
2017-10-26Do not set hw cursor if disabled when switching VTemersion
2017-10-21Merge branch 'master' into heghe/wl_listDrew DeVault
2017-10-22Remove drm field from wlr_drm_connectorScott Anderson
2017-10-22Remove unnecesary wlr_renderersScott Anderson
2017-10-22Move egl.h to render/egl.hScott Anderson
2017-10-20Replace list_t with wl_list in wlr_drm_backendHeghedus Razvan
Signed-off-by: Heghedus Razvan <heghedus.razvan@gmail.com>
2017-10-01Multi-GPU DRMScott Anderson
2017-09-30Rename wlr_drm_output to wlr_drm_connectorScott Anderson
2017-09-30Add pointer to backend from DRM outputsScott Anderson
2017-09-30Split DRM rendering to its own fileScott Anderson
2017-09-30Split DRM internal interface to its own headerScott Anderson
2017-09-30Rename files to remove pointless drm prefixScott Anderson
2017-06-10Combine internal DRM headers into oneDrew DeVault
Everything always just included both anyway
2017-06-09Fixed rendering bug: Delay calling gbm_surface_release_buffer until itScott Anderson
has been scanned out.
2017-06-08Filled out more wlr_output fields.Scott Anderson
2017-06-01Merge branch 'master' into sessionascent12
2017-05-31Generalize DPMS, remove DRM refs from exampleDrew DeVault
2017-05-14Refactored renderer startup to function.Scott Anderson
2017-05-14Working commitScott Anderson
2017-05-13DPMS supportScott Anderson
2017-05-07Generalize output handlingDrew DeVault
2017-05-07Refactor backend state managementDrew DeVault
2017-05-03Removed unused fields.Scott Anderson
2017-05-03Changed modesetting interface.Scott Anderson