Commit 63eaf9ac authored by Dhinakaran Pandiyan's avatar Dhinakaran Pandiyan

drm/i915: Add a small wrapper to check for CCS modifiers.

Code looks cleaner with modifiers hidden inside this wrapper.
v2: Remove const qualifier (Ville)
Signed-off-by: default avatarDhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
Reviewed-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180822193827.6341-1-dhinakaran.pandiyan@intel.com
parent 0577ab48
...@@ -2474,6 +2474,12 @@ intel_get_format_info(const struct drm_mode_fb_cmd2 *cmd) ...@@ -2474,6 +2474,12 @@ intel_get_format_info(const struct drm_mode_fb_cmd2 *cmd)
} }
} }
bool is_ccs_modifier(u64 modifier)
{
return modifier == I915_FORMAT_MOD_Y_TILED_CCS ||
modifier == I915_FORMAT_MOD_Yf_TILED_CCS;
}
static int static int
intel_fill_fb_info(struct drm_i915_private *dev_priv, intel_fill_fb_info(struct drm_i915_private *dev_priv,
struct drm_framebuffer *fb) struct drm_framebuffer *fb)
...@@ -2504,8 +2510,7 @@ intel_fill_fb_info(struct drm_i915_private *dev_priv, ...@@ -2504,8 +2510,7 @@ intel_fill_fb_info(struct drm_i915_private *dev_priv,
return ret; return ret;
} }
if ((fb->modifier == I915_FORMAT_MOD_Y_TILED_CCS || if (is_ccs_modifier(fb->modifier) && i == 1) {
fb->modifier == I915_FORMAT_MOD_Yf_TILED_CCS) && i == 1) {
int hsub = fb->format->hsub; int hsub = fb->format->hsub;
int vsub = fb->format->vsub; int vsub = fb->format->vsub;
int tile_width, tile_height; int tile_width, tile_height;
...@@ -3055,8 +3060,7 @@ static int skl_check_main_surface(const struct intel_crtc_state *crtc_state, ...@@ -3055,8 +3060,7 @@ static int skl_check_main_surface(const struct intel_crtc_state *crtc_state,
* CCS AUX surface doesn't have its own x/y offsets, we must make sure * CCS AUX surface doesn't have its own x/y offsets, we must make sure
* they match with the main surface x/y offsets. * they match with the main surface x/y offsets.
*/ */
if (fb->modifier == I915_FORMAT_MOD_Y_TILED_CCS || if (is_ccs_modifier(fb->modifier)) {
fb->modifier == I915_FORMAT_MOD_Yf_TILED_CCS) {
while (!skl_check_main_ccs_coordinates(plane_state, x, y, offset)) { while (!skl_check_main_ccs_coordinates(plane_state, x, y, offset)) {
if (offset == 0) if (offset == 0)
break; break;
...@@ -3190,8 +3194,7 @@ int skl_check_plane_surface(const struct intel_crtc_state *crtc_state, ...@@ -3190,8 +3194,7 @@ int skl_check_plane_surface(const struct intel_crtc_state *crtc_state,
ret = skl_check_nv12_aux_surface(plane_state); ret = skl_check_nv12_aux_surface(plane_state);
if (ret) if (ret)
return ret; return ret;
} else if (fb->modifier == I915_FORMAT_MOD_Y_TILED_CCS || } else if (is_ccs_modifier(fb->modifier)) {
fb->modifier == I915_FORMAT_MOD_Yf_TILED_CCS) {
ret = skl_check_ccs_aux_surface(plane_state); ret = skl_check_ccs_aux_surface(plane_state);
if (ret) if (ret)
return ret; return ret;
...@@ -13398,8 +13401,7 @@ static bool skl_plane_format_mod_supported(struct drm_plane *_plane, ...@@ -13398,8 +13401,7 @@ static bool skl_plane_format_mod_supported(struct drm_plane *_plane,
case DRM_FORMAT_XBGR8888: case DRM_FORMAT_XBGR8888:
case DRM_FORMAT_ARGB8888: case DRM_FORMAT_ARGB8888:
case DRM_FORMAT_ABGR8888: case DRM_FORMAT_ABGR8888:
if (modifier == I915_FORMAT_MOD_Yf_TILED_CCS || if (is_ccs_modifier(modifier))
modifier == I915_FORMAT_MOD_Y_TILED_CCS)
return true; return true;
/* fall through */ /* fall through */
case DRM_FORMAT_RGB565: case DRM_FORMAT_RGB565:
...@@ -14595,8 +14597,7 @@ static int intel_framebuffer_init(struct intel_framebuffer *intel_fb, ...@@ -14595,8 +14597,7 @@ static int intel_framebuffer_init(struct intel_framebuffer *intel_fb,
* potential runtime errors at plane configuration time. * potential runtime errors at plane configuration time.
*/ */
if (IS_GEN9(dev_priv) && i == 0 && fb->width > 3840 && if (IS_GEN9(dev_priv) && i == 0 && fb->width > 3840 &&
(fb->modifier == I915_FORMAT_MOD_Y_TILED_CCS || is_ccs_modifier(fb->modifier))
fb->modifier == I915_FORMAT_MOD_Yf_TILED_CCS))
stride_alignment *= 4; stride_alignment *= 4;
if (fb->pitches[i] & (stride_alignment - 1)) { if (fb->pitches[i] & (stride_alignment - 1)) {
......
...@@ -381,4 +381,5 @@ void intel_link_compute_m_n(int bpp, int nlanes, ...@@ -381,4 +381,5 @@ void intel_link_compute_m_n(int bpp, int nlanes,
struct intel_link_m_n *m_n, struct intel_link_m_n *m_n,
bool reduce_m_n); bool reduce_m_n);
bool is_ccs_modifier(u64 modifier);
#endif #endif
...@@ -1409,8 +1409,7 @@ static bool skl_plane_format_mod_supported(struct drm_plane *_plane, ...@@ -1409,8 +1409,7 @@ static bool skl_plane_format_mod_supported(struct drm_plane *_plane,
case DRM_FORMAT_XBGR8888: case DRM_FORMAT_XBGR8888:
case DRM_FORMAT_ARGB8888: case DRM_FORMAT_ARGB8888:
case DRM_FORMAT_ABGR8888: case DRM_FORMAT_ABGR8888:
if (modifier == I915_FORMAT_MOD_Yf_TILED_CCS || if (is_ccs_modifier(modifier))
modifier == I915_FORMAT_MOD_Y_TILED_CCS)
return true; return true;
/* fall through */ /* fall through */
case DRM_FORMAT_RGB565: case DRM_FORMAT_RGB565:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment