Another (somewhat expensive) drm_format_info() call has
appeared in intel_plane_can_async_flip(). That one may get
called several times per commit so we need to get rid of
it.
Fortunately most callers already have the framebuffer at
hand, so we can just grab the format info from there.
The one exception is intel_plane_format_mod_supported_async()
where we have to do the lookup. But that only gets called
(a bunch of times) during driver init to build the
IN_FORMATS_ASYNC blob, and afterwards there is no runtime
cost.
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patch.msgid.link/20251112233030.24117-4-ville.syrjala@linux.intel.com
Reviewed-by: Jouni Högander <jouni.hogander@intel.com>
{
struct intel_display *display = to_intel_display(plane);
- if (intel_plane_can_async_flip(plane, fb->format->format, fb->modifier))
+ if (intel_plane_can_async_flip(plane, fb->format, fb->modifier))
return 256 * 1024;
/* FIXME undocumented so not sure what's actually needed */
{
struct intel_display *display = to_intel_display(plane);
- if (intel_plane_can_async_flip(plane, fb->format->format, fb->modifier))
+ if (intel_plane_can_async_flip(plane, fb->format, fb->modifier))
return 256 * 1024;
if (intel_scanout_needs_vtd_wa(display))
if (!plane->async_flip)
continue;
- if (!intel_plane_can_async_flip(plane, new_plane_state->hw.fb->format->format,
+ if (!intel_plane_can_async_flip(plane, new_plane_state->hw.fb->format,
new_plane_state->hw.fb->modifier)) {
drm_dbg_kms(display->drm,
"[PLANE:%d:%s] pixel format %p4cc / modifier 0x%llx does not support async flip\n",
DISPLAY_INFO(display)->cursor_needs_physical;
}
-bool intel_plane_can_async_flip(struct intel_plane *plane, u32 format,
+bool intel_plane_can_async_flip(struct intel_plane *plane,
+ const struct drm_format_info *info,
u64 modifier)
{
- if (intel_format_info_is_yuv_semiplanar(drm_format_info(format), modifier) ||
- format == DRM_FORMAT_C8)
+ if (intel_format_info_is_yuv_semiplanar(info, modifier) ||
+ info->format == DRM_FORMAT_C8)
return false;
return plane->can_async_flip && plane->can_async_flip(modifier);
}
-bool intel_plane_format_mod_supported_async(struct drm_plane *plane,
- u32 format,
- u64 modifier)
+bool intel_plane_format_mod_supported_async(struct drm_plane *_plane,
+ u32 format, u64 modifier)
{
- if (!plane->funcs->format_mod_supported(plane, format, modifier))
+ struct intel_plane *plane = to_intel_plane(_plane);
+ const struct drm_format_info *info;
+
+ if (!plane->base.funcs->format_mod_supported(&plane->base, format, modifier))
return false;
- return intel_plane_can_async_flip(to_intel_plane(plane),
- format, modifier);
+ info = drm_get_format_info(plane->base.dev, format, modifier);
+
+ return intel_plane_can_async_flip(plane, info, modifier);
}
unsigned int intel_adjusted_rate(const struct drm_rect *src,
#include <linux/types.h>
+struct drm_format_info;
struct drm_plane;
struct drm_property;
struct drm_rect;
struct intel_plane *
intel_crtc_get_plane(struct intel_crtc *crtc, enum plane_id plane_id);
-bool intel_plane_can_async_flip(struct intel_plane *plane, u32 format,
+bool intel_plane_can_async_flip(struct intel_plane *plane,
+ const struct drm_format_info *info,
u64 modifier);
unsigned int intel_adjusted_rate(const struct drm_rect *src,
const struct drm_rect *dst,
* Figure out what's going on here...
*/
if (display->platform.alderlake_p &&
- intel_plane_can_async_flip(plane, fb->format->format, fb->modifier))
+ intel_plane_can_async_flip(plane, fb->format, fb->modifier))
return mult * 16 * 1024;
switch (fb->modifier) {