[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YcRkB7uWyt4EbcZm@intel.com>
Date: Thu, 23 Dec 2021 13:56:55 +0200
From: Ville Syrjälä <ville.syrjala@...ux.intel.com>
To: José Expósito <jose.exposito89@...il.com>
Cc: contact@...rsion.fr, airlied@...ux.ie,
alexandre.torgue@...s.st.com, benjamin.gaignard@...aro.org,
linux-stm32@...md-mailman.stormreply.com, marex@...x.de,
linux-imx@....com, intel-gfx@...ts.freedesktop.org,
tzimmermann@...e.de, s.hauer@...gutronix.de,
rodrigo.vivi@...el.com, kernel@...gutronix.de,
linux-arm-kernel@...ts.infradead.org,
dri-devel@...ts.freedesktop.org, yannick.fertre@...s.st.com,
linux-kernel@...r.kernel.org, philippe.cornu@...s.st.com,
mcoquelin.stm32@...il.com, dmitry.baryshkov@...aro.org,
shawnguo@...nel.org
Subject: Re: [PATCH v2 1/6] drm/plane: Make format_mod_supported truly optional
On Wed, Dec 22, 2021 at 10:05:47AM +0100, José Expósito wrote:
> 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@...il.com>
> ---
> drivers/gpu/drm/drm_plane.c | 8 ++------
> 1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
> index 82afb854141b..c1186b7215ee 100644
> --- a/drivers/gpu/drm/drm_plane.c
> +++ b/drivers/gpu/drm/drm_plane.c
> @@ -202,17 +202,13 @@ static int create_in_format_blob(struct drm_device *dev, struct drm_plane *plane
>
> memcpy(formats_ptr(blob_data), plane->format_types, formats_size);
>
> - /* If we can't determine support, just bail */
> - if (!plane->funcs->format_mod_supported)
> - goto done;
> -
> mod = modifiers_ptr(blob_data);
> for (i = 0; i < plane->modifier_count; i++) {
> for (j = 0; j < plane->format_count; j++) {
> - if (plane->funcs->format_mod_supported(plane,
> + if (!plane->funcs->format_mod_supported ||
> + plane->funcs->format_mod_supported(plane,
> plane->format_types[j],
> plane->modifiers[i])) {
So instead of skipping the whole loop you just skip doing anything
inside the loop? Can't see how that achieves anything at all.
https://patchwork.freedesktop.org/series/83018/
is what I had in mind earlier but no one reviewed it and
the discussion veered off track IIRC.
--
Ville Syrjälä
Intel
Powered by blists - more mailing lists