drm/i915: Substitute intel_format_is_yuv() with format->is_yuv
authorAyan Kumar Halder <ayan.halder@arm.com>
Tue, 17 Jul 2018 17:13:43 +0000 (18:13 +0100)
committerAyan Kumar Halder <ayan.halder@arm.com>
Wed, 18 Jul 2018 15:58:42 +0000 (16:58 +0100)
drm_format_info table has a field 'is_yuv' to denote if the format
is yuv or not. The driver is expected to use this instead of
having a function for the same purpose.

Signed-off-by: Ayan Kumar halder <ayan.halder@arm.com>
Reviewed-by: Ville Syrjala <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1531847626-22248-2-git-send-email-ayan.halder@arm.com
drivers/gpu/drm/i915/intel_display.c
drivers/gpu/drm/i915/intel_drv.h
drivers/gpu/drm/i915/intel_sprite.c

index fbe5a6572d7d25a47f012153178d8450f3267ca7..cf0901240bd1bc0580e6d53045f0686e6a0bc864 100644 (file)
@@ -3657,7 +3657,7 @@ u32 glk_plane_color_ctl(const struct intel_crtc_state *crtc_state,
        plane_color_ctl |= PLANE_COLOR_PLANE_GAMMA_DISABLE;
        plane_color_ctl |= glk_plane_color_ctl_alpha(fb->format->format);
 
-       if (intel_format_is_yuv(fb->format->format)) {
+       if (fb->format->is_yuv) {
                if (plane_state->base.color_encoding == DRM_COLOR_YCBCR_BT709)
                        plane_color_ctl |= PLANE_COLOR_CSC_MODE_YUV709_TO_RGB709;
                else
index 0c3ac0eafde09dbf497e825bf9833da9e9c4131b..64111ead499772c2f42182405372cba6154c37f5 100644 (file)
@@ -2069,7 +2069,6 @@ bool intel_sdvo_init(struct drm_i915_private *dev_priv,
 
 
 /* intel_sprite.c */
-bool intel_format_is_yuv(u32 format);
 int intel_usecs_to_scanlines(const struct drm_display_mode *adjusted_mode,
                             int usecs);
 struct intel_plane *intel_sprite_plane_create(struct drm_i915_private *dev_priv,
@@ -2085,7 +2084,6 @@ void skl_disable_plane(struct intel_plane *plane, struct intel_crtc *crtc);
 bool skl_plane_get_hw_state(struct intel_plane *plane, enum pipe *pipe);
 bool skl_plane_has_ccs(struct drm_i915_private *dev_priv,
                       enum pipe pipe, enum plane_id plane_id);
-bool intel_format_is_yuv(uint32_t format);
 bool skl_plane_has_planar(struct drm_i915_private *dev_priv,
                          enum pipe pipe, enum plane_id plane_id);
 
index 344c0e709b19ac5f73905cbc4265b57796a8522a..1bb7bc3f84feb84c1a6d4e10576e25c33685d20f 100644 (file)
 #include <drm/i915_drm.h>
 #include "i915_drv.h"
 
-bool intel_format_is_yuv(u32 format)
-{
-       switch (format) {
-       case DRM_FORMAT_YUYV:
-       case DRM_FORMAT_UYVY:
-       case DRM_FORMAT_VYUY:
-       case DRM_FORMAT_YVYU:
-       case DRM_FORMAT_NV12:
-               return true;
-       default:
-               return false;
-       }
-}
-
 int intel_usecs_to_scanlines(const struct drm_display_mode *adjusted_mode,
                             int usecs)
 {
@@ -404,7 +390,7 @@ chv_update_csc(const struct intel_plane_state *plane_state)
        const s16 *csc = csc_matrix[plane_state->base.color_encoding];
 
        /* Seems RGB data bypasses the CSC always */
-       if (!intel_format_is_yuv(fb->format->format))
+       if (!fb->format->is_yuv)
                return;
 
        I915_WRITE_FW(SPCSCYGOFF(plane_id), SPCSC_OOFF(0) | SPCSC_IOFF(0));
@@ -439,7 +425,7 @@ vlv_update_clrc(const struct intel_plane_state *plane_state)
        enum plane_id plane_id = plane->id;
        int contrast, brightness, sh_scale, sh_sin, sh_cos;
 
-       if (intel_format_is_yuv(fb->format->format) &&
+       if (fb->format->is_yuv &&
            plane_state->base.color_range == DRM_COLOR_YCBCR_LIMITED_RANGE) {
                /*
                 * Expand limited range to full range:
@@ -1040,7 +1026,7 @@ intel_check_sprite_plane(struct intel_plane *plane,
                src->y1 = src_y << 16;
                src->y2 = (src_y + src_h) << 16;
 
-               if (intel_format_is_yuv(fb->format->format) &&
+               if (fb->format->is_yuv &&
                    fb->format->format != DRM_FORMAT_NV12 &&
                    (src_x % 2 || src_w % 2)) {
                        DRM_DEBUG_KMS("src x/w (%u, %u) must be a multiple of 2 for YUV planes\n",