aboutsummaryrefslogtreecommitdiff
path: root/backend/drm/drm.c
AgeCommit message (Collapse)Author
2019-01-19backend/drm: fix state for outputs loosing their CRTCemersion
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.
2018-12-21Standardize the wlr_box input paramatersTimidger
Fixes #1094
2018-12-16backend/drm: don't insert duplicate custom modes, fix refresh rateemersion
2018-12-09backend/drm: Fix uninitialized variableScott Anderson
2018-12-09backend/drm: Improve encoder logicScott Anderson
This fixes an issue that can occur with DP MST connectors not reporting any encoders.
2018-12-09backend/drm: fix disappeared output indicesemersion
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-04backend/drm: fix VLA overflowemersion
2018-11-22Fix interlaced mode rejectionRostislav Pehlivanov
2018-11-21Skip interlaced modes during drm mode detectionRostislav Pehlivanov
Fixes #3167 A better solution could be made if there's a need to.
2018-10-29backend/drm: fix frame scheduling on secondary GPUsemersion
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-17Increase _POSIX_C_SOURCE to 200112Lsghctoma
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-09backend/drm: don't reset conn->pageflip_pending in drm_connector_cleanupemersion
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-09Merge pull request #1298 from emersion/output-dangling-idle-frameDrew DeVault
output: remove idle_frame event source when destroying output
2018-10-09backend/drm: set drmEventContext version to 2Rouven Czerwinski
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-09output: remove idle_frame event source when destroying outputemersion
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-08Merge pull request #1280 from emersion/drm-link-statusScott Anderson
backend/drm: add support for the link-status property
2018-10-07backend/drm: fix zero-length VLAsemersion
2018-10-07backend/drm: properly handle GPUs without CRTCsemersion
2018-10-05output: don't trigger a frame immediately in schedule_frameemersion
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-04output: add presentation refresh predictionemersion
2018-10-04backend: add get_present_clockemersion
2018-10-04output: add present eventemersion
2018-10-04backend/drm: add support for the link-status propertyemersion
2018-10-03backend/drm: reset gamma table on VT switchemersion
2018-10-03output: make gamma size a size_t and gamma table constemersion
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-10backend/drm: de-allocate unused CRTCsemersion
They can be re-used by another output after a subsequent hotplug.
2018-09-04backend/drm: damage outputs when switching CRTCsemersion
2018-09-04backend/drm: log when de-allocating CRTCemersion
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-09-02backend/drm: fix invalid VLA size in scan_drm_connectorsemersion
I failed to see this issue with Valgrind because of the +1.
2018-09-02backend/drm: emit new_output after scanning connectorsemersion
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-01backend/drm: allow disabling outputs in NEEDS_MODESET stateemersion
This correctly frees CRTCs when disabling outputs without setting a mode.
2018-08-05Check for DRM primeScott Anderson
This will indicate the user properly when multi-GPU is not supported by their GPU driver.
2018-08-04Fix hardware cursor on secondary GPUScott Anderson
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-02backend/drm: remove unnecessary castsemersion
2018-08-02backend/drm: allow to pass empty gamma ramp to reset itemersion
2018-08-02Implement wlr-gamma-control-unstable-v1emersion
2018-07-09util: add wlr_ prefix to log symbolsemersion
2018-07-07Merge pull request #1095 from agx/output-add-modeDrew DeVault
Allow to add additional modes to outputs
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-06-30screencopy: add support for frame flagsemersion
2018-06-30drm backend: overflow fixesDominique Martinet
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-05-31Merge branch 'master' into screencontentemersion
2018-05-29backend/drm: support multi-planar DMA-BUFs when exportingemersion
2018-05-29output, backend/drm: add wlr_output_export_dmabufemersion
2018-05-27backend/drm: better connector cleanup, add more logsemersion