On Wed, Dec 15, 2021 at 05:23:10PM +0000, Simon Ser wrote:
You'll need to set the format_mod_supported hook as well, otherwise the kernel will expose a bogus IN_FORMATS prop with one modifier and zero formats.
Hi Simon,
Thank you very much for reviewing this patch, I just started learning about DRM and this kind of reviews are really helpful :)
I was a bit confused by the docs[1]: (*stars* added in the relevant parts)
format_mod_supported:
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 valdiate 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.
How I read it: "format_mod_supported" can be ignored where no filtering is intended.
Looking at "create_in_format_blob" this does not look like a bug... But I am not sure. You probably know the answer. Whether the anwser is to chage the docs or "create_in_format_blob" I can send a patch.
For what is worth, after extrating the relevant bits from Weston's "drm_plane_populate_formats" function to my test program [2], formats are not listed if "format_mod_supported" is not implemented. The same applies to drm_info. So, for the moment I emailed v2 implementing "format_mod_supported" [3].
By the way, this could be related to [4], see commit b36a6bb8a151c056e1046e9d5b1192d90d9941c9. If we decided that the docs are wrong I can send a patch as well.
Thanks again for your input, Jose
[1] https://www.kernel.org/doc/html/latest/gpu/drm-kms.html?highlight=in_formats... [2] https://github.com/JoseExposito/drm-sandbox/blob/main/in_formats.c [3] https://lore.kernel.org/dri-devel/20211216170140.15803-1-jose.exposito89@gma... [4] https://lists.freedesktop.org/archives/wayland-devel/2021-December/042072.ht...