dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
To: "José Expósito" <jose.exposito89@gmail.com>
Cc: freedreno@lists.freedesktop.org, jernej.skrabec@gmail.com,
	airlied@linux.ie, linux-arm-msm@vger.kernel.org,
	dri-devel@lists.freedesktop.org, wens@csie.org,
	linux-kernel@vger.kernel.org, maxime@cerno.tech,
	tzimmermann@suse.de, sean@poorly.run,
	linux-sunxi@lists.linux.dev,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 1/3] drm/plane: Mention format_mod_supported in IN_FORMATS docs
Date: Tue, 21 Dec 2021 13:48:15 +0300	[thread overview]
Message-ID: <CAA8EJppMsqot1isnMYeSWVJm4tC-PoqUDL9jwd5HJ72tca0HQQ@mail.gmail.com> (raw)
In-Reply-To: <20211221101319.7980-2-jose.exposito89@gmail.com>

On Tue, 21 Dec 2021 at 13:13, José Expósito <jose.exposito89@gmail.com> wrote:
>
> Adding format modifiers without implementing the function
> "drm_plane_funcs.format_mod_supported" exposes an invalid IN_FORMATS
> blob with modifiers but no formats to user-space.

I think the fix should be applied to the generic code. The docs at
drm_plane.h clearly state that this callback is optional:

         * 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.

So, one should fix the core code in create_in_format_blob() to include
all combinations.

>
> This breaks the latest Weston [1]. For testing purposes, I extracted the
> affected code to a standalone program [2].
>
> Make clear in the IN_FORMATS documentation that implementing
> "format_mod_supported" is mandatory.

format_mod_supported() being optional or mandatory should be
documented in the format_mod_supported() docs, not in the IN_FORMAT
docs.

>
> [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>
> ---
>  drivers/gpu/drm/drm_plane.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
> index 82afb854141b..347571f8909a 100644
> --- a/drivers/gpu/drm/drm_plane.c
> +++ b/drivers/gpu/drm/drm_plane.c
> @@ -126,8 +126,11 @@
>   * IN_FORMATS:
>   *     Blob property which contains the set of buffer format and modifier
>   *     pairs supported by this plane. The blob is a struct
> - *     drm_format_modifier_blob. Without this property the plane doesn't
> - *     support buffers with modifiers. Userspace cannot change this property.
> + *     drm_format_modifier_blob and the drm_plane_funcs.format_mod_supported
> + *     function must be implemented by the driver to determine if the given
> + *     format/modifier combination is valid for the plane. Without this property
> + *     the plane doesn't support buffers with modifiers. Userspace cannot change
> + *     this property.
>   *
>   *     Note that userspace can check the &DRM_CAP_ADDFB2_MODIFIERS driver
>   *     capability for general modifier support. If this flag is set then every
> --
> 2.25.1
>


-- 
With best wishes
Dmitry

  parent reply	other threads:[~2021-12-21 10:48 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-21 10:13 [PATCH 0/3] Add missing format_mod_supported functions José Expósito
2021-12-21 10:13 ` [PATCH 1/3] drm/plane: Mention format_mod_supported in IN_FORMATS docs José Expósito
2021-12-21 10:33   ` Simon Ser
2021-12-21 10:48   ` Dmitry Baryshkov [this message]
2021-12-21 10:50     ` Simon Ser
2021-12-21 12:33       ` Dmitry Baryshkov
2021-12-21 12:50         ` Simon Ser
2021-12-21 10:13 ` [PATCH 2/3] drm/msm/mdp4: Add format_mod_supported function José Expósito
2021-12-21 10:13 ` [PATCH 3/3] drm/sun4i: " José Expósito
2021-12-21 10:50 ` [PATCH 0/3] Add missing format_mod_supported functions Dmitry Baryshkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAA8EJppMsqot1isnMYeSWVJm4tC-PoqUDL9jwd5HJ72tca0HQQ@mail.gmail.com \
    --to=dmitry.baryshkov@linaro.org \
    --cc=airlied@linux.ie \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=jernej.skrabec@gmail.com \
    --cc=jose.exposito89@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=maxime@cerno.tech \
    --cc=sean@poorly.run \
    --cc=tzimmermann@suse.de \
    --cc=wens@csie.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).