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/i915: Eliminate one more frequent drm_format_info()

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>

+20 -14
+2 -2
drivers/gpu/drm/i915/display/i9xx_plane.c
··· 819 819 { 820 820 struct intel_display *display = to_intel_display(plane); 821 821 822 - if (intel_plane_can_async_flip(plane, fb->format->format, fb->modifier)) 822 + if (intel_plane_can_async_flip(plane, fb->format, fb->modifier)) 823 823 return 256 * 1024; 824 824 825 825 /* FIXME undocumented so not sure what's actually needed */ ··· 843 843 { 844 844 struct intel_display *display = to_intel_display(plane); 845 845 846 - if (intel_plane_can_async_flip(plane, fb->format->format, fb->modifier)) 846 + if (intel_plane_can_async_flip(plane, fb->format, fb->modifier)) 847 847 return 256 * 1024; 848 848 849 849 if (intel_scanout_needs_vtd_wa(display))
+1 -1
drivers/gpu/drm/i915/display/intel_display.c
··· 6115 6115 if (!plane->async_flip) 6116 6116 continue; 6117 6117 6118 - if (!intel_plane_can_async_flip(plane, new_plane_state->hw.fb->format->format, 6118 + if (!intel_plane_can_async_flip(plane, new_plane_state->hw.fb->format, 6119 6119 new_plane_state->hw.fb->modifier)) { 6120 6120 drm_dbg_kms(display->drm, 6121 6121 "[PLANE:%d:%s] pixel format %p4cc / modifier 0x%llx does not support async flip\n",
+13 -9
drivers/gpu/drm/i915/display/intel_plane.c
··· 178 178 DISPLAY_INFO(display)->cursor_needs_physical; 179 179 } 180 180 181 - bool intel_plane_can_async_flip(struct intel_plane *plane, u32 format, 181 + bool intel_plane_can_async_flip(struct intel_plane *plane, 182 + const struct drm_format_info *info, 182 183 u64 modifier) 183 184 { 184 - if (intel_format_info_is_yuv_semiplanar(drm_format_info(format), modifier) || 185 - format == DRM_FORMAT_C8) 185 + if (intel_format_info_is_yuv_semiplanar(info, modifier) || 186 + info->format == DRM_FORMAT_C8) 186 187 return false; 187 188 188 189 return plane->can_async_flip && plane->can_async_flip(modifier); 189 190 } 190 191 191 - bool intel_plane_format_mod_supported_async(struct drm_plane *plane, 192 - u32 format, 193 - u64 modifier) 192 + bool intel_plane_format_mod_supported_async(struct drm_plane *_plane, 193 + u32 format, u64 modifier) 194 194 { 195 - if (!plane->funcs->format_mod_supported(plane, format, modifier)) 195 + struct intel_plane *plane = to_intel_plane(_plane); 196 + const struct drm_format_info *info; 197 + 198 + if (!plane->base.funcs->format_mod_supported(&plane->base, format, modifier)) 196 199 return false; 197 200 198 - return intel_plane_can_async_flip(to_intel_plane(plane), 199 - format, modifier); 201 + info = drm_get_format_info(plane->base.dev, format, modifier); 202 + 203 + return intel_plane_can_async_flip(plane, info, modifier); 200 204 } 201 205 202 206 unsigned int intel_adjusted_rate(const struct drm_rect *src,
+3 -1
drivers/gpu/drm/i915/display/intel_plane.h
··· 8 8 9 9 #include <linux/types.h> 10 10 11 + struct drm_format_info; 11 12 struct drm_plane; 12 13 struct drm_property; 13 14 struct drm_rect; ··· 22 21 23 22 struct intel_plane * 24 23 intel_crtc_get_plane(struct intel_crtc *crtc, enum plane_id plane_id); 25 - bool intel_plane_can_async_flip(struct intel_plane *plane, u32 format, 24 + bool intel_plane_can_async_flip(struct intel_plane *plane, 25 + const struct drm_format_info *info, 26 26 u64 modifier); 27 27 unsigned int intel_adjusted_rate(const struct drm_rect *src, 28 28 const struct drm_rect *dst,
+1 -1
drivers/gpu/drm/i915/display/skl_universal_plane.c
··· 595 595 * Figure out what's going on here... 596 596 */ 597 597 if (display->platform.alderlake_p && 598 - intel_plane_can_async_flip(plane, fb->format->format, fb->modifier)) 598 + intel_plane_can_async_flip(plane, fb->format, fb->modifier)) 599 599 return mult * 16 * 1024; 600 600 601 601 switch (fb->modifier) {