Skip to content

Fix invalid plane state on monitor reconnect

When dissociating a universal plane from a crtc, we currently don't reset the current state of the plane (plane->state_cur). When attempting to use this plane in the future, we can run into invalid memory accesses due to left over associations with potentially freed drm backend objects. This commit resets the state of the scanout and cursor universal planes associated with a crtc.

The following scenario exhibits the problem:

  1. Start a (fullscreen) client that is suitable for and assigned to the scanout plane. The plane's state_cur->output value is set.
  2. Unplug the monitor: the scanout plane is "released" but still maintains the state_cur->output association.
  3. Replug the monitor: the plane is deemed unavailable due to an existing, albeit invalid, state_cur->output value. Note the memory errors trying to access the drm_output which was freed at step (2).

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>

Merge request reports