OSDN Git Service

drm/plane: Make format_mod_supported truly optional
authorJosé Expósito <jose.exposito89@gmail.com>
Sun, 26 Dec 2021 11:24:58 +0000 (12:24 +0100)
committerSimon Ser <contact@emersion.fr>
Wed, 5 Jan 2022 23:52:57 +0000 (00:52 +0100)
commitd14f0c205302648df29c494a1a81ec3d897a2552
tree1adc1ed9399a9b7e1245fceb6d8cfe71d280a1b1
parentb146e343a9e05605b491b1bf4a2b62a39d5638d8
drm/plane: Make format_mod_supported truly optional

The documentation for "drm_plane_funcs.format_mod_supported" reads:

  This *optional* hook is used for the DRM to determine if the given
  format/modifier combination is valid for the plane. This allows the
  DRM to generate the correct format bitmask (which formats apply to
  which modifier), and to validate modifiers at atomic_check time.

  *If not present*, then any modifier in the plane's modifier
  list is allowed with any of the plane's formats.

However, where the function is not present, an invalid IN_FORMATS blob
property with modifiers but no formats is exposed to user-space.

This breaks the latest Weston [1]. For testing purposes, I extracted the
affected code to a standalone program [2].

Make "create_in_format_blob" behave as documented.

[1] https://gitlab.freedesktop.org/wayland/weston/-/blob/9.0/libweston/backend-drm/kms.c#L431
[2] https://github.com/JoseExposito/drm-sandbox/blob/main/in_formats.c

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Reviewed-by: Simon Ser <contact@emersion.fr>
Signed-off-by: Simon Ser <contact@emersion.fr>
Link: https://patchwork.freedesktop.org/patch/msgid/20211226112503.31771-2-jose.exposito89@gmail.com
drivers/gpu/drm/drm_plane.c