From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Ville Syrjala <ville.syrjala@linux.intel.com>
Cc: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
intel-xe@lists.freedesktop.org,
Harry Wentland <harry.wentland@amd.com>,
Leo Li <sunpeng.li@amd.com>,
Rodrigo Siqueira <siqueira@igalia.com>,
Alex Deucher <alexander.deucher@amd.com>,
amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH 01/19] drm: Pass pixel_format+modifier to .get_format_info()
Date: Thu, 10 Apr 2025 22:27:45 +0300 [thread overview]
Message-ID: <20250410192745.GA27834@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20250410163218.15130-2-ville.syrjala@linux.intel.com>
Hi Ville,
Thank you for the patch.
On Thu, Apr 10, 2025 at 07:32:00PM +0300, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Decouple .get_format_info() from struct drm_mode_fb_cmd2 and just
> pass the pixel format+modifier combo in by hand.
>
> We may want to use .get_format_info() outside of the normal
> addfb paths where we won't have a struct drm_mode_fb_cmd2, and
> creating a temporary one just for this seems silly.
>
> Cc: Harry Wentland <harry.wentland@amd.com>
> Cc: Leo Li <sunpeng.li@amd.com>
> Cc: Rodrigo Siqueira <siqueira@igalia.com>
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: amd-gfx@lists.freedesktop.org
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
> drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c | 4 ++--
> drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.h | 2 +-
> drivers/gpu/drm/drm_fourcc.c | 3 ++-
> drivers/gpu/drm/i915/display/intel_fb.c | 9 +++++----
> drivers/gpu/drm/i915/display/intel_fb.h | 2 +-
> include/drm/drm_mode_config.h | 2 +-
> 6 files changed, 12 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c
> index 3e0f45f1711c..69d715b6abd3 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c
> @@ -92,9 +92,9 @@ enum dm_micro_swizzle {
> MICRO_SWIZZLE_R = 3
> };
>
> -const struct drm_format_info *amdgpu_dm_plane_get_format_info(const struct drm_mode_fb_cmd2 *cmd)
> +const struct drm_format_info *amdgpu_dm_plane_get_format_info(u32 pixel_format, u64 modifier)
> {
> - return amdgpu_lookup_format_info(cmd->pixel_format, cmd->modifier[0]);
> + return amdgpu_lookup_format_info(pixel_format, modifier);
> }
>
> void amdgpu_dm_plane_fill_blending_from_plane_state(const struct drm_plane_state *plane_state,
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.h b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.h
> index 615d2ab2b803..ea2619b507db 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.h
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.h
> @@ -58,7 +58,7 @@ int amdgpu_dm_plane_init(struct amdgpu_display_manager *dm,
> unsigned long possible_crtcs,
> const struct dc_plane_cap *plane_cap);
>
> -const struct drm_format_info *amdgpu_dm_plane_get_format_info(const struct drm_mode_fb_cmd2 *cmd);
> +const struct drm_format_info *amdgpu_dm_plane_get_format_info(u32 pixel_format, u64 modifier);
>
> void amdgpu_dm_plane_fill_blending_from_plane_state(const struct drm_plane_state *plane_state,
> bool *per_pixel_alpha, bool *pre_multiplied_alpha,
> diff --git a/drivers/gpu/drm/drm_fourcc.c b/drivers/gpu/drm/drm_fourcc.c
> index 3a94ca211f9c..f79fff8209fd 100644
> --- a/drivers/gpu/drm/drm_fourcc.c
> +++ b/drivers/gpu/drm/drm_fourcc.c
> @@ -395,7 +395,8 @@ drm_get_format_info(struct drm_device *dev,
> const struct drm_format_info *info = NULL;
>
> if (dev->mode_config.funcs->get_format_info)
> - info = dev->mode_config.funcs->get_format_info(mode_cmd);
> + info = dev->mode_config.funcs->get_format_info(mode_cmd->pixel_format,
> + mode_cmd->modifier[0]);
>
> if (!info)
> info = drm_format_info(mode_cmd->pixel_format);
> diff --git a/drivers/gpu/drm/i915/display/intel_fb.c b/drivers/gpu/drm/i915/display/intel_fb.c
> index 2b0e0f220442..b83c42fe3233 100644
> --- a/drivers/gpu/drm/i915/display/intel_fb.c
> +++ b/drivers/gpu/drm/i915/display/intel_fb.c
> @@ -421,21 +421,22 @@ unsigned int intel_fb_modifier_to_tiling(u64 fb_modifier)
>
> /**
> * intel_fb_get_format_info: Get a modifier specific format information
> - * @cmd: FB add command structure
> + * @pixel_format: pixel format
> + * @modifier: modifier
> *
> * Returns:
> * Returns the format information for @cmd->pixel_format specific to @cmd->modifier[0],
> * or %NULL if the modifier doesn't override the format.
This needs to be updated too.
> */
> const struct drm_format_info *
> -intel_fb_get_format_info(const struct drm_mode_fb_cmd2 *cmd)
> +intel_fb_get_format_info(u32 pixel_format, u64 modifier)
> {
> - const struct intel_modifier_desc *md = lookup_modifier_or_null(cmd->modifier[0]);
> + const struct intel_modifier_desc *md = lookup_modifier_or_null(modifier);
>
> if (!md || !md->formats)
> return NULL;
>
> - return lookup_format_info(md->formats, md->format_count, cmd->pixel_format);
> + return lookup_format_info(md->formats, md->format_count, pixel_format);
> }
>
> static bool plane_caps_contain_any(u8 caps, u8 mask)
> diff --git a/drivers/gpu/drm/i915/display/intel_fb.h b/drivers/gpu/drm/i915/display/intel_fb.h
> index bdd76b372957..7d1267fbeee2 100644
> --- a/drivers/gpu/drm/i915/display/intel_fb.h
> +++ b/drivers/gpu/drm/i915/display/intel_fb.h
> @@ -47,7 +47,7 @@ u64 *intel_fb_plane_get_modifiers(struct intel_display *display,
> bool intel_fb_plane_supports_modifier(struct intel_plane *plane, u64 modifier);
>
> const struct drm_format_info *
> -intel_fb_get_format_info(const struct drm_mode_fb_cmd2 *cmd);
> +intel_fb_get_format_info(u32 pixel_format, u64 modifier);
>
> bool
> intel_format_info_is_yuv_semiplanar(const struct drm_format_info *info,
> diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h
> index 4b8f0370b79b..6fca0362bc31 100644
> --- a/include/drm/drm_mode_config.h
> +++ b/include/drm/drm_mode_config.h
> @@ -95,7 +95,7 @@ struct drm_mode_config_funcs {
> * The format information specific to the given fb metadata, or
> * NULL if none is found.
And here too. The full documentation block states
/**
* @get_format_info:
*
* Allows a driver to return custom format information for special
* fb layouts (eg. ones with auxiliary compression control planes).
*
* RETURNS:
*
* The format information specific to the given fb metadata, or
* NULL if none is found.
*/
Updating the RETURNS section is easy, but the text before that is
problematic. If the intent was to support formats with auxialiary
compression control planes, this won't be possible anymore if we pass
cmd->modifier[0] only. Is that an issue, or was this a foreseen use case
that never materialized ? If we don't need to support this anymore then
the code change is fine, and the documentation should be updated
accordingly.
> */
> - const struct drm_format_info *(*get_format_info)(const struct drm_mode_fb_cmd2 *mode_cmd);
> + const struct drm_format_info *(*get_format_info)(u32 pixel_format, u64 modifier);
>
> /**
> * @mode_valid:
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2025-04-10 19:28 UTC|newest]
Thread overview: 69+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-10 16:31 [PATCH 00/19] drm: Eliminate redundant drm_format_info lookups Ville Syrjala
2025-04-10 16:32 ` [PATCH 01/19] drm: Pass pixel_format+modifier to .get_format_info() Ville Syrjala
2025-04-10 19:27 ` Laurent Pinchart [this message]
2025-04-11 6:47 ` Ville Syrjälä
2025-04-11 19:19 ` [PATCH v2 " Ville Syrjala
2025-04-10 16:32 ` [PATCH 02/19] drm: Pass pixel_format+modifier directly to drm_get_format_info() Ville Syrjala
2025-04-10 19:31 ` Laurent Pinchart
2025-04-10 19:43 ` kernel test robot
2025-04-11 7:23 ` Thomas Zimmermann
2025-04-11 19:27 ` [PATCH v2 " Ville Syrjala
2025-04-10 16:32 ` [PATCH 03/19] drm: Look up the format info earlier Ville Syrjala
2025-04-10 19:33 ` Laurent Pinchart
2025-04-11 7:01 ` Ville Syrjälä
2025-04-11 7:18 ` Thomas Zimmermann
2025-04-11 19:27 ` [PATCH v2 " Ville Syrjala
2025-04-10 16:32 ` [PATCH 04/19] drm: Pass the format info to .fb_create() Ville Syrjala
2025-04-10 19:37 ` Laurent Pinchart
2025-04-10 21:26 ` kernel test robot
2025-04-11 6:36 ` Geert Uytterhoeven
2025-04-11 19:29 ` [PATCH v2 " Ville Syrjala
2025-04-10 16:32 ` [PATCH 05/19] drm: Allow the caller to pass in the format info to drm_helper_mode_fill_fb_struct() Ville Syrjala
2025-04-10 19:38 ` Laurent Pinchart
2025-04-10 16:32 ` [PATCH 06/19] drm/malidp: Pass along the format info from .fb_create() malidp_verify_afbc_framebuffer_size() Ville Syrjala
2025-04-10 16:32 ` [PATCH 07/19] drm/gem: Pass along the format info from .fb_create() to drm_helper_mode_fill_fb_struct() Ville Syrjala
2025-04-10 19:39 ` Laurent Pinchart
2025-04-10 22:58 ` kernel test robot
2025-04-11 19:31 ` [PATCH v2 " Ville Syrjala
2025-04-10 16:32 ` [PATCH 08/19] drm/gem/afbc: Eliminate redundant drm_get_format_info() Ville Syrjala
2025-04-10 16:32 ` [PATCH 09/19] drm/amdgpu: Pass along the format info from .fb_create() to drm_helper_mode_fill_fb_struct() Ville Syrjala
2025-04-10 16:32 ` [PATCH 10/19] drm/armada: " Ville Syrjala
2025-04-10 16:32 ` [PATCH 11/19] drm/exynos: " Ville Syrjala
2025-04-10 16:32 ` [PATCH 12/19] drm/gma500: " Ville Syrjala
2025-04-10 16:32 ` [PATCH 13/19] drm/i915: " Ville Syrjala
2025-04-10 16:32 ` [PATCH 14/19] drm/komeda: " Ville Syrjala
2025-04-10 16:32 ` [PATCH 15/19] drm/msm: " Ville Syrjala
2025-04-10 19:28 ` Dmitry Baryshkov
2025-04-10 16:32 ` [PATCH 16/19] drm/tegra: " Ville Syrjala
2025-04-10 16:32 ` [PATCH 17/19] drm/virtio: " Ville Syrjala
2025-04-16 6:44 ` Dmitry Osipenko
2025-04-10 16:32 ` [PATCH 18/19] drm/vmwgfx: " Ville Syrjala
2025-04-10 16:32 ` [PATCH 19/19] drm: Make passing of format info to drm_helper_mode_fill_fb_struct() mandatory Ville Syrjala
2025-04-10 19:40 ` Laurent Pinchart
2025-04-10 18:46 ` ✓ CI.Patch_applied: success for drm: Eliminate redundant drm_format_info lookups Patchwork
2025-04-10 18:47 ` ✗ CI.checkpatch: warning " Patchwork
2025-04-10 18:48 ` ✓ CI.KUnit: success " Patchwork
2025-04-10 19:03 ` ✓ CI.Build: " Patchwork
2025-04-10 19:05 ` ✓ CI.Hooks: " Patchwork
2025-04-10 19:06 ` ✗ CI.checksparse: warning " Patchwork
2025-04-10 19:51 ` ✗ Xe.CI.BAT: failure " Patchwork
2025-04-11 0:20 ` ✗ Xe.CI.Full: " Patchwork
2025-04-11 7:30 ` [PATCH 00/19] " Thomas Zimmermann
2025-04-11 19:54 ` ✓ CI.Patch_applied: success for drm: Eliminate redundant drm_format_info lookups (rev2) Patchwork
2025-04-11 19:54 ` ✗ CI.checkpatch: warning " Patchwork
2025-04-11 19:56 ` ✓ CI.KUnit: success " Patchwork
2025-04-11 20:04 ` ✓ CI.Build: " Patchwork
2025-04-11 20:06 ` ✓ CI.Hooks: " Patchwork
2025-04-11 20:08 ` ✗ CI.checksparse: warning " Patchwork
2025-04-11 20:58 ` ✓ Xe.CI.BAT: success " Patchwork
2025-04-11 22:07 ` ✓ CI.Patch_applied: success for drm: Eliminate redundant drm_format_info lookups (rev6) Patchwork
2025-04-11 22:08 ` ✗ CI.checkpatch: warning " Patchwork
2025-04-11 22:09 ` ✓ CI.KUnit: success " Patchwork
2025-04-11 22:18 ` ✓ CI.Build: " Patchwork
2025-04-11 22:20 ` ✓ CI.Hooks: " Patchwork
2025-04-11 22:22 ` ✗ CI.checksparse: warning " Patchwork
2025-04-11 22:48 ` ✓ Xe.CI.BAT: success " Patchwork
2025-04-11 23:03 ` ✗ Xe.CI.Full: failure for drm: Eliminate redundant drm_format_info lookups (rev2) Patchwork
2025-04-12 0:56 ` ✗ Xe.CI.Full: failure for drm: Eliminate redundant drm_format_info lookups (rev6) Patchwork
2025-07-15 18:21 ` [PATCH 00/19] drm: Eliminate redundant drm_format_info lookups Alex Deucher
2025-07-15 18:22 ` Alex Deucher
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=20250410192745.GA27834@pendragon.ideasonboard.com \
--to=laurent.pinchart@ideasonboard.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=harry.wentland@amd.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=siqueira@igalia.com \
--cc=sunpeng.li@amd.com \
--cc=ville.syrjala@linux.intel.com \
/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