aboutsummaryrefslogtreecommitdiff
path: root/backend/drm/atomic.c
AgeCommit message (Collapse)Author
2021-04-29backend/drm: remove wlr_drm_crtc_state.modeSimon Ser
Replace it with drm_connector_state_mode, which computes the mode from the wlr_output_state to be applied.
2021-04-29backend/drm: remove wlr_drm_crtc_state.activeSimon Ser
Replace it with drm_connector_state_active, which figures out whether the connector is active depending on the wlr_output_state to be applied.
2021-04-29backend/drm: remove wlr_drm_crtc.pending_modesetSimon Ser
Replace it with a new drm_connector_state_is_modeset function that decides whether a modeset is necessary directly from the wlr_output_state which is going to be applied.
2021-04-29backend/drm: take wlr_output_state as arg in crtc_commitSimon Ser
Stop assuming that the state to be applied is in output->pending in crtc_commit. This will allow us to remove ephemeral fields in wlr_drm_crtc, which are used scratch fields to stash temporary per-commit data.
2021-04-06backend/drm: downgrade test-only commit failure log levelSimon Ser
Let's not clutter the logs with error messages when a test-only atomic commit fails.
2021-04-06backend/drm: don't set NONBLOCK with TEST_ONLYSimon Ser
The kernel ignores NONBLOCK when TEST_ONLY is set. Let's just not set it, to make it clear it's unused.
2021-01-10backend/drm: stop using surface size for BOSimon Ser
Stop using wlr_drm_surface.{width,height} to figure out the size of a gbm_bo. In the future we'll stop using wlr_drm_plane.surf, so these will be zero. Instead, rely on gbm_bo_get_{width,height}.
2021-01-10backend/drm: make wlr_drm_plane.{pending,queued,current}_fb pointersSimon Ser
This will be useful once we start re-using wlr_drm_fb.
2020-12-24backend/drm: use connector log helpers in atomic backendSimon Ser
2020-12-22backend/drm: remove drm_fb_acquireSimon Ser
Instead, import the buffer into GBM and KMS in drm_fb_import. Also move the multi-GPU copy there if necessary.
2020-12-22backend/drm: make drm_fb_acquire return a FB IDSimon Ser
2020-12-18backend/drm: introduce wlr_drm_connector.nameSimon Ser
The DRM backend is a little special when it comes to wlr_outputs: the wlr_drm_connectors are long-lived and are created even when no screen is connected. A wlr_drm_connector only advertises a wlr_output to the compositor when a screen is connected. As such, most of wlr_output's state is invalid when the connector is disconnected. We want to stop using wlr_output state on disconnected connectors. Introduce wlr_drm_connector.name which is always valid regardless of the connector status to avoid reading wlr_output.name when disconnected.
2020-12-15backend/drm: add wlr_drm_connector.backendSimon Ser
This allows the DRM code to have direct access to the wlr_drm_backend without having to go through an upcast via get_drm_backend_from_backend.
2020-06-01backend/drm: make adaptive_sync atomicSimon Ser
Stop using drmModeObjectSetProperty, set the property in the crtc_commit function instead.
2020-05-27backend/drm: don't set cursor if off-screenSimon Ser
Closes: https://github.com/swaywm/wlroots/issues/2216
2020-05-26backend/drm: introduce pending and current CRTC stateSimon Ser
Previously, we only had the pending state (crtc->pending, crtc->mode and crtc->active). This causes issues when a commit fails: the pending state is left as-is, and the next commit may read stale data from it. This will also cause issues when implementing test-only commits: we need to rollback the pending CRTC state after a test-only commit. Introduce separate pending and current CRTC states. Properly update the current state after a commit.
2020-05-26backend/drm: rollback atomic blobsSimon Ser
If the atomic commit fails or is test-only, rollback wlr_drm_crtc.{mode_id,gamma_lut} blob IDs to their previous value. This prevents the next commits from failing or applying test-only state.
2020-05-14backend/drm: fix atomic commits when the GAMMA_LUT prop is missingSimon Ser
We already have the logic to fallback to the legacy interface above. We just need to avoid calling atomic_add with a zero prop ID. Closes: https://github.com/swaywm/wlroots/issues/2187
2020-05-14output: make wlr_output_set_gamma atomicSimon Ser
wlr_output_set_gamma is now double-buffered and applies the gamma LUT on the next output commit.
2020-05-12backend/drm: print error in set_plane_propsSimon Ser
This makes it easier to understand which plane failed.
2020-05-10backend/drm: simplify atomic commit logicSimon Ser
We don't need a per-CRTC atomic request anymore. Let's make the request per-commit so that it's easier to debug. This is also groundwork for supporting wlr_output_test properly.
2020-05-10backend/drm: GAMMA_LUT_SIZE isn't atomicSimon Ser
GAMMA_LUT_SIZE isn't an atomic property. It can be used with the legacy interface too. So we can unify both codepaths and remove wlr_drm_interface.crtc_get_gamma_size. It's no guaranteed to exist though, so we still need to keep the fallback.
2020-05-09backend/drm: remove crtc_set_cursor from interfaceSimon Ser
2020-05-09backend/drm: remove conn_enable from interfaceSimon Ser
Use crtc_commit instead.
2020-05-09backend/drm: rename crtc_pageflip to crtc_commitSimon Ser
Also add a flags argument. The commit function will also be used for disabling the CRTC.
2020-05-09backend/drm: apply gamma LUT on page-flipSimon Ser
2020-05-09backend/drm: remove mode argument to crtc_pageflipSimon Ser
Add a new wlr_drm_crtc.pending bitfield which keeps track of pending output changes. More fields will be added in the future (e.g. active, gamma).
2020-05-09backend/drm: remove wlr_drm_interface.crtc_move_cursorSimon Ser
Instead, make the legacy backend call drmModeMoveCursor on page-flip.
2020-04-28backend/drm: move atomic cursor code into pageflip codeScott Anderson
It makes sense to construct as much atomic state as possible in the same place, so it doesn't get lost if we "reset" it.
2020-04-28backend/drm: don't have fallback atomic commitsScott Anderson
This is just doing atomic incorrectly.
2020-04-28backend/drm: introduce wlr_drm_fbScott Anderson
This is a type which manages gbm_surfaces and imported dmabufs in the same place, and makes the lifetime management between the two shared. It should lead to easier to understand code, and fewer special cases. This also contains a fair bit of refactoring to start using this new type. Co-authored-by: Simon Ser <contact@emersion.fr>
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-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-11Remove WLR_DRM_NO_ATOMIC_GAMMA workaroundScott Anderson
This is fixed on amdgpu, so we don't need this anymore.
2019-06-07backend/drm: fallback to drmModeAddFB2Simon Ser
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-28backend/drm: add WLR_DRM_NO_ATOMIC_GAMMA env variableemersion
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-04backend/drm: add support for the link-status propertyemersion
2018-10-03output: make gamma size a size_t and gamma table constemersion
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-08-29Use legacy modesetting for gamma controlDrew DeVault
It doesn't look like there's any motion on a fix from the AMDGPU side, and using the legacy interface for this isn't so bad.
2018-08-02Implement wlr-gamma-control-unstable-v1emersion
2018-07-09util: add wlr_ prefix to log symbolsemersion
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-04-25Make sure we don't use others' prefixesemersion
2018-04-25Remove wlr_ prefix from local symbolsemersion
2018-02-12Reformat all #include directivesemersion
2018-02-10Fallback gamma on legacy if properties don't existVincent Vanlaer
2018-02-09Use VLA instead of heap allocVincent Vanlaer
2018-02-09Fix styleVincent Vanlaer