Skip to content

Commit 225c228

Browse files
chandra4codedanvet
authored andcommitted
drm/i915/skl: don't fail colorkey + scaler request
There is a mplayer video failure reported with xv. This is because there is a request to do both plane scaling and colorkey. Because skl hw doesn't support plane scaling and colorkey at the same time, request is failed which is expected behavior. To make xv operate, this patch allows colorkey continue to work without using scaler. Then behavior would be similar to platforms without plane scaler support. Signed-off-by: Chandra Konduru <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90449 [danvet: change can_scale to bool as requested by Ville.] Reviewed-by: Ville Syrjälä <[email protected]> Signed-off-by: Daniel Vetter <[email protected]>
1 parent 6d50b06 commit 225c228

File tree

2 files changed

+30
-14
lines changed

2 files changed

+30
-14
lines changed

drivers/gpu/drm/i915/intel_display.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4502,9 +4502,10 @@ skl_update_scaler_users(
45024502
}
45034503

45044504
/* check colorkey */
4505-
if (intel_plane && intel_plane->ckey.flags != I915_SET_COLORKEY_NONE) {
4506-
DRM_DEBUG_KMS("PLANE:%d scaling with color key not allowed",
4507-
intel_plane->base.base.id);
4505+
if (WARN_ON(intel_plane &&
4506+
intel_plane->ckey.flags != I915_SET_COLORKEY_NONE)) {
4507+
DRM_DEBUG_KMS("PLANE:%d scaling %ux%u->%ux%u not allowed with colorkey",
4508+
intel_plane->base.base.id, src_w, src_h, dst_w, dst_h);
45084509
return -EINVAL;
45094510
}
45104511

@@ -13261,8 +13262,11 @@ intel_check_primary_plane(struct drm_plane *plane,
1326113262
intel_atomic_get_crtc_state(state->base.state, intel_crtc) : NULL;
1326213263

1326313264
if (INTEL_INFO(dev)->gen >= 9) {
13264-
min_scale = 1;
13265-
max_scale = skl_max_scale(intel_crtc, crtc_state);
13265+
/* use scaler when colorkey is not required */
13266+
if (to_intel_plane(plane)->ckey.flags == I915_SET_COLORKEY_NONE) {
13267+
min_scale = 1;
13268+
max_scale = skl_max_scale(intel_crtc, crtc_state);
13269+
}
1326613270
can_position = true;
1326713271
}
1326813272

drivers/gpu/drm/i915/intel_sprite.c

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -770,6 +770,7 @@ intel_check_sprite_plane(struct drm_plane *plane,
770770
const struct drm_rect *clip = &state->clip;
771771
int hscale, vscale;
772772
int max_scale, min_scale;
773+
bool can_scale;
773774
int pixel_size;
774775
int ret;
775776

@@ -794,18 +795,29 @@ intel_check_sprite_plane(struct drm_plane *plane,
794795
return -EINVAL;
795796
}
796797

798+
/* setup can_scale, min_scale, max_scale */
799+
if (INTEL_INFO(dev)->gen >= 9) {
800+
/* use scaler when colorkey is not required */
801+
if (intel_plane->ckey.flags == I915_SET_COLORKEY_NONE) {
802+
can_scale = 1;
803+
min_scale = 1;
804+
max_scale = skl_max_scale(intel_crtc, crtc_state);
805+
} else {
806+
can_scale = 0;
807+
min_scale = DRM_PLANE_HELPER_NO_SCALING;
808+
max_scale = DRM_PLANE_HELPER_NO_SCALING;
809+
}
810+
} else {
811+
can_scale = intel_plane->can_scale;
812+
max_scale = intel_plane->max_downscale << 16;
813+
min_scale = intel_plane->can_scale ? 1 : (1 << 16);
814+
}
815+
797816
/*
798817
* FIXME the following code does a bunch of fuzzy adjustments to the
799818
* coordinates and sizes. We probably need some way to decide whether
800819
* more strict checking should be done instead.
801820
*/
802-
max_scale = intel_plane->max_downscale << 16;
803-
min_scale = intel_plane->can_scale ? 1 : (1 << 16);
804-
805-
if (INTEL_INFO(dev)->gen >= 9) {
806-
min_scale = 1;
807-
max_scale = skl_max_scale(intel_crtc, crtc_state);
808-
}
809821

810822
drm_rect_rotate(src, fb->width << 16, fb->height << 16,
811823
state->base.rotation);
@@ -876,7 +888,7 @@ intel_check_sprite_plane(struct drm_plane *plane,
876888
* Must keep src and dst the
877889
* same if we can't scale.
878890
*/
879-
if (!intel_plane->can_scale)
891+
if (!can_scale)
880892
crtc_w &= ~1;
881893

882894
if (crtc_w == 0)
@@ -888,7 +900,7 @@ intel_check_sprite_plane(struct drm_plane *plane,
888900
if (state->visible && (src_w != crtc_w || src_h != crtc_h)) {
889901
unsigned int width_bytes;
890902

891-
WARN_ON(!intel_plane->can_scale);
903+
WARN_ON(!can_scale);
892904

893905
/* FIXME interlacing min height is 6 */
894906

0 commit comments

Comments
 (0)