Skip to content

Rework 2D coordinate handling

Derek Foreman requested to merge derekf/weston:matrix_resurrections into main

This is a bit of a follow up of a years old series that replaced some internal operations with matrix multiplication.

It starts by finishing that work, and carries on by removing x, y pairs and replacing them with a struct weston_coord. There are several reasons to do this. It lets us stop concerning ourselves with fixed vs int vs double for the bulk of our handling, and we only need to deal with that at "edges" (input from external sources, output to drm and wayland events). It also lets us hide the homogeneous coordinate normalization step instead of open coding it in several places.

The most important benefit is that we can track what space a coordinate is in, as well as what spaces a matrix based transformation converts between. This lets us more readily catch mistakes in coordinate handling (multiplying by the wrong matrix, or adding coordinates in different spaces).

The bulk of the series is simply converting all sites to use the new struct weston_coord piece by piece, after which coordinate space metadata is added, then set appropriate for each coordinate creation and rigidly validated via assert()s.

Along the way we also base our criteria for applying linear filtering or using drm planes on matrix analysis.

Edited by Derek Foreman

Merge request reports