Commit 0f2922ef authored by Imre Deak's avatar Imre Deak

drm/i915: Move intel_format_info_is_yuv_semiplanar() to intel_fb.c

Move intel_format_info_is_yuv_semiplanar() to intel_fb.c . The number of
planes for YUV semiplanar formats using CCS modifiers will change on
future platforms. We can use the modifier descriptors to simplify
getting the plane numbers for all modifiers, prepare for that here.

Cc: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Signed-off-by: default avatarImre Deak <imre.deak@intel.com>
Reviewed-by: default avatarJuha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20211020195138.1841242-7-imre.deak@intel.com
parent b1562f0f
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
#include "intel_atomic_plane.h" #include "intel_atomic_plane.h"
#include "intel_cdclk.h" #include "intel_cdclk.h"
#include "intel_display_types.h" #include "intel_display_types.h"
#include "intel_fb.h"
#include "intel_fb_pin.h" #include "intel_fb_pin.h"
#include "intel_pm.h" #include "intel_pm.h"
#include "intel_sprite.h" #include "intel_sprite.h"
......
...@@ -595,14 +595,6 @@ void intel_disable_transcoder(const struct intel_crtc_state *old_crtc_state) ...@@ -595,14 +595,6 @@ void intel_disable_transcoder(const struct intel_crtc_state *old_crtc_state)
intel_wait_for_pipe_off(old_crtc_state); intel_wait_for_pipe_off(old_crtc_state);
} }
bool
intel_format_info_is_yuv_semiplanar(const struct drm_format_info *info,
u64 modifier)
{
return info->is_yuv &&
info->num_planes == (is_ccs_modifier(modifier) ? 4 : 2);
}
unsigned int intel_rotation_info_size(const struct intel_rotation_info *rot_info) unsigned int intel_rotation_info_size(const struct intel_rotation_info *rot_info)
{ {
unsigned int size = 0; unsigned int size = 0;
......
...@@ -605,9 +605,6 @@ int bdw_get_pipemisc_bpp(struct intel_crtc *crtc); ...@@ -605,9 +605,6 @@ int bdw_get_pipemisc_bpp(struct intel_crtc *crtc);
unsigned int intel_plane_fence_y_offset(const struct intel_plane_state *plane_state); unsigned int intel_plane_fence_y_offset(const struct intel_plane_state *plane_state);
bool intel_plane_uses_fence(const struct intel_plane_state *plane_state); bool intel_plane_uses_fence(const struct intel_plane_state *plane_state);
bool
intel_format_info_is_yuv_semiplanar(const struct drm_format_info *info,
u64 modifier);
struct intel_encoder * struct intel_encoder *
intel_get_crtc_new_encoder(const struct intel_atomic_state *state, intel_get_crtc_new_encoder(const struct intel_atomic_state *state,
......
...@@ -330,6 +330,36 @@ bool intel_fb_plane_supports_modifier(struct intel_plane *plane, u64 modifier) ...@@ -330,6 +330,36 @@ bool intel_fb_plane_supports_modifier(struct intel_plane *plane, u64 modifier)
return false; return false;
} }
static bool format_is_yuv_semiplanar(const struct intel_modifier_desc *md,
const struct drm_format_info *info)
{
int yuv_planes;
if (!info->is_yuv)
return false;
if (is_ccs_type_modifier(md, INTEL_CCS_ANY))
yuv_planes = 4;
else
yuv_planes = 2;
return info->num_planes == yuv_planes;
}
/**
* intel_format_info_is_yuv_semiplanar: Check if the given format is YUV semiplanar
* @info: format to check
* @modifier: modifier used with the format
*
* Returns:
* %true if @info / @modifier is YUV semiplanar.
*/
bool intel_format_info_is_yuv_semiplanar(const struct drm_format_info *info,
u64 modifier)
{
return format_is_yuv_semiplanar(lookup_modifier(modifier), info);
}
bool is_ccs_plane(const struct drm_framebuffer *fb, int plane) bool is_ccs_plane(const struct drm_framebuffer *fb, int plane)
{ {
if (!is_ccs_modifier(fb->modifier)) if (!is_ccs_modifier(fb->modifier))
......
...@@ -38,6 +38,10 @@ bool intel_fb_plane_supports_modifier(struct intel_plane *plane, u64 modifier); ...@@ -38,6 +38,10 @@ bool intel_fb_plane_supports_modifier(struct intel_plane *plane, u64 modifier);
const struct drm_format_info * const struct drm_format_info *
intel_fb_get_format_info(const struct drm_mode_fb_cmd2 *cmd); intel_fb_get_format_info(const struct drm_mode_fb_cmd2 *cmd);
bool
intel_format_info_is_yuv_semiplanar(const struct drm_format_info *info,
u64 modifier);
bool is_surface_linear(const struct drm_framebuffer *fb, int color_plane); bool is_surface_linear(const struct drm_framebuffer *fb, int color_plane);
int main_to_ccs_plane(const struct drm_framebuffer *fb, int main_plane); int main_to_ccs_plane(const struct drm_framebuffer *fb, int main_plane);
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include "display/intel_bw.h" #include "display/intel_bw.h"
#include "display/intel_de.h" #include "display/intel_de.h"
#include "display/intel_display_types.h" #include "display/intel_display_types.h"
#include "display/intel_fb.h"
#include "display/intel_fbc.h" #include "display/intel_fbc.h"
#include "display/intel_sprite.h" #include "display/intel_sprite.h"
#include "display/skl_universal_plane.h" #include "display/skl_universal_plane.h"
......
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