backend/drm: handle changes in the set of fixed output modes

In virtualised environments, it is possible for the set of fixed modes
advertised by a connected output to change. This happens for example
when resizing the window in the host system, which causes the preferred
mode in the virtualised display to change to match the new size of the
host window.

This change keeps the value of `modes` in `struct wlr_output` updated
when the available DRM modes change. Also, it adds a signal
`available_modes` which notifies compositors when this occurs.
This commit is contained in:
Daniel Playfair Cal 2021-01-06 22:09:27 +11:00
parent 64da8f0c8d
commit b7aa6ee176
4 changed files with 111 additions and 29 deletions

View file

@ -109,6 +109,13 @@ void wlr_output_update_mode(struct wlr_output *output,
*/
void wlr_output_update_custom_mode(struct wlr_output *output, int32_t width,
int32_t height, int32_t refresh);
/**
* Update the output available modes.
*
* The backend must call this function when the available modes are updated
* to notify compositors about the change.
*/
void wlr_output_update_available_modes(struct wlr_output *output);
/**
* Update the current output status.
*

View file

@ -170,6 +170,7 @@ struct wlr_output {
struct wl_signal bind; // wlr_output_event_bind
struct wl_signal enable;
struct wl_signal mode;
struct wl_signal available_modes;
struct wl_signal scale;
struct wl_signal transform;
struct wl_signal description;