Hi
Am 15.01.25 um 15:20 schrieb Tomi Valkeinen:
[...]
My point is that we have the current UAPI, and we have userspace using
it, but we don't have clear rules what the ioctl does with specific
parameters, and we don't document how it has to be used.
Perhaps the situation is bad, and all we can really say is that
CREATE_DUMB only works for use with simple RGB formats, and the
behavior for all other formats is platform specific. But I think even
that would be valuable in the UAPI docs.
To be honest, I would not want to specify behavior for anything but the
linear RGB formats. If anything, I'd take Daniel's reply mail for
documentation as-is. Anyone stretching the UAPI beyond RGB is on their own.
Thinking about this, I wonder if this change is good for omapdrm or
xilinx (probably other platforms too that support non-simple non-RGB
formats via dumb buffers): without this patch, in both drivers, the
pitch calculations just take the bpp as bit-per-pixels, align it up,
and that's it.
With this patch we end up using drm_driver_color_mode_format(), and
aligning buffers according to RGB formats figured out via heuristics.
It does happen to work, for the formats I tested, but it sounds like
something that might easily not work, as it's doing adjustments based
on wrong format.
Should we have another version of drm_mode_size_dumb() which just
calculates using the bpp, without the drm_driver_color_mode_format()
path? Or does the drm_driver_color_mode_format() path provide some
value for the drivers that do not currently do anything similar?
With the RGB-only rule, using drm_driver_color_mode_format() makes
sense. It aligns dumb buffers and video=, provides error checking, and
overall harmonizes code. The fallback is only required because of the
existing odd cases that already bend the UAPI's rules.
Best regards
Thomas
Tomi
--
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)