Skip to content

Commit 0389e42

Browse files
committed
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 <[email protected]> Cc: Leo Li <[email protected]> Cc: Rodrigo Siqueira <[email protected]> Cc: Alex Deucher <[email protected]> Cc: [email protected] Cc: Laurent Pinchart <[email protected]> Reviewed-by: Thomas Zimmermann <[email protected]> Reviewed-by: Laurent Pinchart <[email protected]> Acked-by: Alex Deucher <[email protected]> Acked-by: Rodrigo Vivi <[email protected]> Signed-off-by: Ville Syrjälä <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent d618363 commit 0389e42

File tree

6 files changed

+13
-11
lines changed

6 files changed

+13
-11
lines changed

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,9 @@ enum dm_micro_swizzle {
9292
MICRO_SWIZZLE_R = 3
9393
};
9494

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)
9696
{
97-
return amdgpu_lookup_format_info(cmd->pixel_format, cmd->modifier[0]);
97+
return amdgpu_lookup_format_info(pixel_format, modifier);
9898
}
9999

100100
void amdgpu_dm_plane_fill_blending_from_plane_state(const struct drm_plane_state *plane_state,

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ int amdgpu_dm_plane_init(struct amdgpu_display_manager *dm,
5858
unsigned long possible_crtcs,
5959
const struct dc_plane_cap *plane_cap);
6060

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);
6262

6363
void amdgpu_dm_plane_fill_blending_from_plane_state(const struct drm_plane_state *plane_state,
6464
bool *per_pixel_alpha, bool *pre_multiplied_alpha,

drivers/gpu/drm/drm_fourcc.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,8 @@ drm_get_format_info(struct drm_device *dev,
430430
const struct drm_format_info *info = NULL;
431431

432432
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]);
434435

435436
if (!info)
436437
info = drm_format_info(mode_cmd->pixel_format);

drivers/gpu/drm/i915/display/intel_fb.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -422,21 +422,22 @@ unsigned int intel_fb_modifier_to_tiling(u64 fb_modifier)
422422

423423
/**
424424
* 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
426427
*
427428
* 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,
429430
* or %NULL if the modifier doesn't override the format.
430431
*/
431432
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)
433434
{
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);
435436

436437
if (!md || !md->formats)
437438
return NULL;
438439

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);
440441
}
441442

442443
static bool plane_caps_contain_any(u8 caps, u8 mask)

drivers/gpu/drm/i915/display/intel_fb.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ u64 *intel_fb_plane_get_modifiers(struct intel_display *display,
4747
bool intel_fb_plane_supports_modifier(struct intel_plane *plane, u64 modifier);
4848

4949
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);
5151

5252
bool
5353
intel_format_info_is_yuv_semiplanar(const struct drm_format_info *info,

include/drm/drm_mode_config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ struct drm_mode_config_funcs {
9595
* The format information specific to the given fb metadata, or
9696
* NULL if none is found.
9797
*/
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);
9999

100100
/**
101101
* @mode_valid:

0 commit comments

Comments
 (0)