From: Ville Syrjälä Date: Thu, 9 Oct 2025 21:13:05 +0000 (+0300) Subject: drm/i915: Rewrite icl_min_plane_width() X-Git-Tag: v6.19-rc1~157^2~17^2~64 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0e64ee70ed8fb25e1a66502cf940017b9b2cc703;p=thirdparty%2Fkernel%2Flinux.git drm/i915: Rewrite icl_min_plane_width() Replace the ginormous switch statement in icl_plane_min_width() with simple arithmetic. Signed-off-by: Ville Syrjälä Link: https://patch.msgid.link/20251009211313.30234-2-ville.syrjala@linux.intel.com Reviewed-by: Juha-Pekka Heikkila --- diff --git a/drivers/gpu/drm/i915/display/skl_universal_plane.c b/drivers/gpu/drm/i915/display/skl_universal_plane.c index 765d288cce2b0..e16e42baf86c5 100644 --- a/drivers/gpu/drm/i915/display/skl_universal_plane.c +++ b/drivers/gpu/drm/i915/display/skl_universal_plane.c @@ -394,40 +394,17 @@ static int icl_plane_min_width(const struct drm_framebuffer *fb, int color_plane, unsigned int rotation) { + int min_width; + + min_width = 16 / fb->format->cpp[color_plane]; + /* Wa_14011264657, Wa_14011050563: gen11+ */ - switch (fb->format->format) { - case DRM_FORMAT_C8: - return 18; - case DRM_FORMAT_RGB565: - return 10; - case DRM_FORMAT_XRGB8888: - case DRM_FORMAT_XBGR8888: - case DRM_FORMAT_ARGB8888: - case DRM_FORMAT_ABGR8888: - case DRM_FORMAT_XRGB2101010: - case DRM_FORMAT_XBGR2101010: - case DRM_FORMAT_ARGB2101010: - case DRM_FORMAT_ABGR2101010: - case DRM_FORMAT_XVYU2101010: - case DRM_FORMAT_Y212: - case DRM_FORMAT_Y216: - return 6; - case DRM_FORMAT_NV12: - return 20; - case DRM_FORMAT_P010: - case DRM_FORMAT_P012: - case DRM_FORMAT_P016: - return 12; - case DRM_FORMAT_XRGB16161616F: - case DRM_FORMAT_XBGR16161616F: - case DRM_FORMAT_ARGB16161616F: - case DRM_FORMAT_ABGR16161616F: - case DRM_FORMAT_XVYU12_16161616: - case DRM_FORMAT_XVYU16161616: - return 4; - default: - return 1; - } + if (intel_format_info_is_yuv_semiplanar(fb->format, fb->modifier)) + min_width += 4; + else + min_width += 2; + + return min_width; } static int xe3_plane_max_width(const struct drm_framebuffer *fb,