Commit 37a411e2 authored by Ville Syrjälä's avatar Ville Syrjälä

drm/i915: Disallow plane scaling with specific pixel formats

Plane scaling is not supported with specific pixel formats. Disallow
plane scaling when such a format is used. Currently the only such
pixel format we expose is C8, but in case we add more in the future
let's make it easy to deal with them.

v2: Redo due to plane_check() refactoring
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com> #v1
Link: https://patchwork.freedesktop.org/patch/msgid/20181005125817.22576-6-ville.syrjala@linux.intel.com
parent 934882db
...@@ -1070,6 +1070,19 @@ g4x_plane_get_hw_state(struct intel_plane *plane, ...@@ -1070,6 +1070,19 @@ g4x_plane_get_hw_state(struct intel_plane *plane,
return ret; return ret;
} }
static bool intel_fb_scalable(const struct drm_framebuffer *fb)
{
if (!fb)
return false;
switch (fb->format->format) {
case DRM_FORMAT_C8:
return false;
default:
return true;
}
}
static int static int
g4x_sprite_check_scaling(struct intel_crtc_state *crtc_state, g4x_sprite_check_scaling(struct intel_crtc_state *crtc_state,
struct intel_plane_state *plane_state) struct intel_plane_state *plane_state)
...@@ -1137,18 +1150,18 @@ g4x_sprite_check(struct intel_crtc_state *crtc_state, ...@@ -1137,18 +1150,18 @@ g4x_sprite_check(struct intel_crtc_state *crtc_state,
{ {
struct intel_plane *plane = to_intel_plane(plane_state->base.plane); struct intel_plane *plane = to_intel_plane(plane_state->base.plane);
struct drm_i915_private *dev_priv = to_i915(plane->base.dev); struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
int max_scale, min_scale; int min_scale = DRM_PLANE_HELPER_NO_SCALING;
int max_scale = DRM_PLANE_HELPER_NO_SCALING;
int ret; int ret;
if (INTEL_GEN(dev_priv) < 7) { if (intel_fb_scalable(plane_state->base.fb)) {
min_scale = 1; if (INTEL_GEN(dev_priv) < 7) {
max_scale = 16 << 16; min_scale = 1;
} else if (IS_IVYBRIDGE(dev_priv)) { max_scale = 16 << 16;
min_scale = 1; } else if (IS_IVYBRIDGE(dev_priv)) {
max_scale = 2 << 16; min_scale = 1;
} else { max_scale = 2 << 16;
min_scale = DRM_PLANE_HELPER_NO_SCALING; }
max_scale = DRM_PLANE_HELPER_NO_SCALING;
} }
ret = drm_atomic_helper_check_plane_state(&plane_state->base, ret = drm_atomic_helper_check_plane_state(&plane_state->base,
...@@ -1334,7 +1347,9 @@ int skl_plane_check(struct intel_crtc_state *crtc_state, ...@@ -1334,7 +1347,9 @@ int skl_plane_check(struct intel_crtc_state *crtc_state,
{ {
struct intel_plane *plane = to_intel_plane(plane_state->base.plane); struct intel_plane *plane = to_intel_plane(plane_state->base.plane);
struct drm_i915_private *dev_priv = to_i915(plane->base.dev); struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
int max_scale, min_scale; const struct drm_framebuffer *fb = plane_state->base.fb;
int min_scale = DRM_PLANE_HELPER_NO_SCALING;
int max_scale = DRM_PLANE_HELPER_NO_SCALING;
int ret; int ret;
ret = skl_plane_check_fb(crtc_state, plane_state); ret = skl_plane_check_fb(crtc_state, plane_state);
...@@ -1342,15 +1357,9 @@ int skl_plane_check(struct intel_crtc_state *crtc_state, ...@@ -1342,15 +1357,9 @@ int skl_plane_check(struct intel_crtc_state *crtc_state,
return ret; return ret;
/* use scaler when colorkey is not required */ /* use scaler when colorkey is not required */
if (!plane_state->ckey.flags) { if (!plane_state->ckey.flags && intel_fb_scalable(fb)) {
const struct drm_framebuffer *fb = plane_state->base.fb;
min_scale = 1; min_scale = 1;
max_scale = skl_max_scale(crtc_state, max_scale = skl_max_scale(crtc_state, fb->format->format);
fb ? fb->format->format : 0);
} else {
min_scale = DRM_PLANE_HELPER_NO_SCALING;
max_scale = DRM_PLANE_HELPER_NO_SCALING;
} }
ret = drm_atomic_helper_check_plane_state(&plane_state->base, ret = drm_atomic_helper_check_plane_state(&plane_state->base,
......
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