Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm: Pass pixel_format+modifier to .get_format_info()

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.

v2: Fix intel_fb_get_format_info() docs (Laurent)

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
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Acked-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20250701090722.13645-2-ville.syrjala@linux.intel.com

+13 -11
+2 -2
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c
··· 92 92 MICRO_SWIZZLE_R = 3 93 93 }; 94 94 95 - const struct drm_format_info *amdgpu_dm_plane_get_format_info(const struct drm_mode_fb_cmd2 *cmd) 95 + const struct drm_format_info *amdgpu_dm_plane_get_format_info(u32 pixel_format, u64 modifier) 96 96 { 97 - return amdgpu_lookup_format_info(cmd->pixel_format, cmd->modifier[0]); 97 + return amdgpu_lookup_format_info(pixel_format, modifier); 98 98 } 99 99 100 100 void amdgpu_dm_plane_fill_blending_from_plane_state(const struct drm_plane_state *plane_state,
+1 -1
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.h
··· 58 58 unsigned long possible_crtcs, 59 59 const struct dc_plane_cap *plane_cap); 60 60 61 - const struct drm_format_info *amdgpu_dm_plane_get_format_info(const struct drm_mode_fb_cmd2 *cmd); 61 + const struct drm_format_info *amdgpu_dm_plane_get_format_info(u32 pixel_format, u64 modifier); 62 62 63 63 void amdgpu_dm_plane_fill_blending_from_plane_state(const struct drm_plane_state *plane_state, 64 64 bool *per_pixel_alpha, bool *pre_multiplied_alpha,
+2 -1
drivers/gpu/drm/drm_fourcc.c
··· 430 430 const struct drm_format_info *info = NULL; 431 431 432 432 if (dev->mode_config.funcs->get_format_info) 433 - info = dev->mode_config.funcs->get_format_info(mode_cmd); 433 + info = dev->mode_config.funcs->get_format_info(mode_cmd->pixel_format, 434 + mode_cmd->modifier[0]); 434 435 435 436 if (!info) 436 437 info = drm_format_info(mode_cmd->pixel_format);
+6 -5
drivers/gpu/drm/i915/display/intel_fb.c
··· 422 422 423 423 /** 424 424 * intel_fb_get_format_info: Get a modifier specific format information 425 - * @cmd: FB add command structure 425 + * @pixel_format: pixel format 426 + * @modifier: modifier 426 427 * 427 428 * Returns: 428 - * Returns the format information for @cmd->pixel_format specific to @cmd->modifier[0], 429 + * Returns the format information for @pixel_format specific to @modifier, 429 430 * or %NULL if the modifier doesn't override the format. 430 431 */ 431 432 const struct drm_format_info * 432 - intel_fb_get_format_info(const struct drm_mode_fb_cmd2 *cmd) 433 + intel_fb_get_format_info(u32 pixel_format, u64 modifier) 433 434 { 434 - const struct intel_modifier_desc *md = lookup_modifier_or_null(cmd->modifier[0]); 435 + const struct intel_modifier_desc *md = lookup_modifier_or_null(modifier); 435 436 436 437 if (!md || !md->formats) 437 438 return NULL; 438 439 439 - return lookup_format_info(md->formats, md->format_count, cmd->pixel_format); 440 + return lookup_format_info(md->formats, md->format_count, pixel_format); 440 441 } 441 442 442 443 static bool plane_caps_contain_any(u8 caps, u8 mask)
+1 -1
drivers/gpu/drm/i915/display/intel_fb.h
··· 47 47 bool intel_fb_plane_supports_modifier(struct intel_plane *plane, u64 modifier); 48 48 49 49 const struct drm_format_info * 50 - intel_fb_get_format_info(const struct drm_mode_fb_cmd2 *cmd); 50 + intel_fb_get_format_info(u32 pixel_format, u64 modifier); 51 51 52 52 bool 53 53 intel_format_info_is_yuv_semiplanar(const struct drm_format_info *info,
+1 -1
include/drm/drm_mode_config.h
··· 95 95 * The format information specific to the given fb metadata, or 96 96 * NULL if none is found. 97 97 */ 98 - const struct drm_format_info *(*get_format_info)(const struct drm_mode_fb_cmd2 *mode_cmd); 98 + const struct drm_format_info *(*get_format_info)(u32 pixel_format, u64 modifier); 99 99 100 100 /** 101 101 * @mode_valid: