drm/i915: Extract per-platform plane->check() functions
Split up intel_check_primary_plane() and intel_check_sprite_plane() into per-platform variants. This way we can get a unified behaviour between the SKL universal planes, and we stop checking for non-SKL specific scaling limits for the "sprite" planes. And we now get a natural place where to add more plarform specific checks. v2: Split the .check_plane() calling convention change out (José) Reviewed-by: José Roberto de Souza <jose.souza@intel.com> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20180907152413.15761-10-ville.syrjala@linux.intel.com
This commit is contained in:
@@ -3355,6 +3355,36 @@ int i9xx_check_plane_surface(struct intel_plane_state *plane_state)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
i9xx_plane_check(struct intel_crtc_state *crtc_state,
|
||||
struct intel_plane_state *plane_state)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = drm_atomic_helper_check_plane_state(&plane_state->base,
|
||||
&crtc_state->base,
|
||||
DRM_PLANE_HELPER_NO_SCALING,
|
||||
DRM_PLANE_HELPER_NO_SCALING,
|
||||
false, true);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (!plane_state->base.visible)
|
||||
return 0;
|
||||
|
||||
ret = intel_plane_check_src_coordinates(plane_state);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = i9xx_check_plane_surface(plane_state);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
plane_state->ctl = i9xx_plane_ctl(crtc_state, plane_state);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void i9xx_update_plane(struct intel_plane *plane,
|
||||
const struct intel_crtc_state *crtc_state,
|
||||
const struct intel_plane_state *plane_state)
|
||||
@@ -9691,6 +9721,11 @@ static int intel_check_cursor(struct intel_crtc_state *crtc_state,
|
||||
u32 offset;
|
||||
int ret;
|
||||
|
||||
if (fb && fb->modifier != DRM_FORMAT_MOD_LINEAR) {
|
||||
DRM_DEBUG_KMS("cursor cannot be tiled\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
ret = drm_atomic_helper_check_plane_state(&plane_state->base,
|
||||
&crtc_state->base,
|
||||
DRM_PLANE_HELPER_NO_SCALING,
|
||||
@@ -9699,13 +9734,12 @@ static int intel_check_cursor(struct intel_crtc_state *crtc_state,
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (!fb)
|
||||
if (!plane_state->base.visible)
|
||||
return 0;
|
||||
|
||||
if (fb->modifier != DRM_FORMAT_MOD_LINEAR) {
|
||||
DRM_DEBUG_KMS("cursor cannot be tiled\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
ret = intel_plane_check_src_coordinates(plane_state);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
intel_fill_fb_ggtt_view(&plane_state->view, fb, rotation);
|
||||
plane_state->color_plane[0].stride = intel_fb_pitch(fb, 0, rotation);
|
||||
@@ -13230,19 +13264,17 @@ intel_cleanup_plane_fb(struct drm_plane *plane,
|
||||
}
|
||||
|
||||
int
|
||||
skl_max_scale(struct intel_crtc *intel_crtc,
|
||||
struct intel_crtc_state *crtc_state,
|
||||
uint32_t pixel_format)
|
||||
skl_max_scale(const struct intel_crtc_state *crtc_state,
|
||||
u32 pixel_format)
|
||||
{
|
||||
struct drm_i915_private *dev_priv;
|
||||
struct intel_crtc *crtc = to_intel_crtc(crtc_state->base.crtc);
|
||||
struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
|
||||
int max_scale, mult;
|
||||
int crtc_clock, max_dotclk, tmpclk1, tmpclk2;
|
||||
|
||||
if (!intel_crtc || !crtc_state->base.enable)
|
||||
if (!crtc_state->base.enable)
|
||||
return DRM_PLANE_HELPER_NO_SCALING;
|
||||
|
||||
dev_priv = to_i915(intel_crtc->base.dev);
|
||||
|
||||
crtc_clock = crtc_state->base.adjusted_mode.crtc_clock;
|
||||
max_dotclk = to_intel_atomic_state(crtc_state->base.state)->cdclk.logical.cdclk;
|
||||
|
||||
@@ -13266,61 +13298,6 @@ skl_max_scale(struct intel_crtc *intel_crtc,
|
||||
return max_scale;
|
||||
}
|
||||
|
||||
static int
|
||||
intel_check_primary_plane(struct intel_crtc_state *crtc_state,
|
||||
struct intel_plane_state *state)
|
||||
{
|
||||
struct intel_plane *plane = to_intel_plane(state->base.plane);
|
||||
struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
|
||||
struct drm_crtc *crtc = state->base.crtc;
|
||||
int min_scale = DRM_PLANE_HELPER_NO_SCALING;
|
||||
int max_scale = DRM_PLANE_HELPER_NO_SCALING;
|
||||
bool can_position = false;
|
||||
int ret;
|
||||
uint32_t pixel_format = 0;
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 9) {
|
||||
/* use scaler when colorkey is not required */
|
||||
if (!state->ckey.flags) {
|
||||
min_scale = 1;
|
||||
if (state->base.fb)
|
||||
pixel_format = state->base.fb->format->format;
|
||||
max_scale = skl_max_scale(to_intel_crtc(crtc),
|
||||
crtc_state, pixel_format);
|
||||
}
|
||||
can_position = true;
|
||||
}
|
||||
|
||||
ret = drm_atomic_helper_check_plane_state(&state->base,
|
||||
&crtc_state->base,
|
||||
min_scale, max_scale,
|
||||
can_position, true);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (!state->base.fb)
|
||||
return 0;
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 9) {
|
||||
ret = skl_check_plane_surface(crtc_state, state);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
state->ctl = skl_plane_ctl(crtc_state, state);
|
||||
} else {
|
||||
ret = i9xx_check_plane_surface(state);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
state->ctl = i9xx_plane_ctl(crtc_state, state);
|
||||
}
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv))
|
||||
state->color_ctl = glk_plane_color_ctl(crtc_state, state);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void intel_begin_crtc_commit(struct drm_crtc *crtc,
|
||||
struct drm_crtc_state *old_crtc_state)
|
||||
{
|
||||
@@ -13770,8 +13747,6 @@ intel_primary_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe)
|
||||
fbc->possible_framebuffer_bits |= primary->frontbuffer_bit;
|
||||
}
|
||||
|
||||
primary->check_plane = intel_check_primary_plane;
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 9) {
|
||||
primary->has_ccs = skl_plane_has_ccs(dev_priv, pipe,
|
||||
PLANE_PRIMARY);
|
||||
@@ -13793,6 +13768,7 @@ intel_primary_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe)
|
||||
primary->update_plane = skl_update_plane;
|
||||
primary->disable_plane = skl_disable_plane;
|
||||
primary->get_hw_state = skl_plane_get_hw_state;
|
||||
primary->check_plane = skl_plane_check;
|
||||
|
||||
plane_funcs = &skl_plane_funcs;
|
||||
} else if (INTEL_GEN(dev_priv) >= 4) {
|
||||
@@ -13804,6 +13780,7 @@ intel_primary_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe)
|
||||
primary->update_plane = i9xx_update_plane;
|
||||
primary->disable_plane = i9xx_disable_plane;
|
||||
primary->get_hw_state = i9xx_plane_get_hw_state;
|
||||
primary->check_plane = i9xx_plane_check;
|
||||
|
||||
plane_funcs = &i965_plane_funcs;
|
||||
} else {
|
||||
@@ -13815,6 +13792,7 @@ intel_primary_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe)
|
||||
primary->update_plane = i9xx_update_plane;
|
||||
primary->disable_plane = i9xx_disable_plane;
|
||||
primary->get_hw_state = i9xx_plane_get_hw_state;
|
||||
primary->check_plane = i9xx_plane_check;
|
||||
|
||||
plane_funcs = &i8xx_plane_funcs;
|
||||
}
|
||||
|
Reference in New Issue
Block a user