Skip to content

Commit c322c64

Browse files
committed
drm/i915: Add display WA raspberrypi#1175 for planes ending close to right screen edge
As described in the WA on GLK and CNL planes on the right edge of the screen that have less than 4 pixels visible from the beginning of the plane to the edge of the screen can cause FIFO underflow and display corruption. On GLK/CNL I could trigger the problem only if the plane was at the same time also aligned to the top edge of the screen (after clipping) and there were exactly 2 pixels visible from the start of the plane to the right edge of the screen (so couldn't trigger it with 1 or 3 pixels visible). Nevertheless, to be sure, I also applied the WA for these cases. I also couldn't see any problem with the cursor plane and later Art confirmed that it's not affected, so the WA is applied only for the other plane types. v2: - Use -ERANGE instead of -EINVAL. (Chris) Signed-off-by: Imre Deak <[email protected]> Reviewed-by: Ville Syrjälä <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 3393ce1 commit c322c64

File tree

3 files changed

+27
-6
lines changed

3 files changed

+27
-6
lines changed

drivers/gpu/drm/i915/intel_display.c

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2931,14 +2931,19 @@ static bool skl_check_main_ccs_coordinates(struct intel_plane_state *plane_state
29312931
return true;
29322932
}
29332933

2934-
static int skl_check_main_surface(struct intel_plane_state *plane_state)
2934+
static int skl_check_main_surface(const struct intel_crtc_state *crtc_state,
2935+
struct intel_plane_state *plane_state)
29352936
{
2937+
struct drm_i915_private *dev_priv =
2938+
to_i915(plane_state->base.plane->dev);
29362939
const struct drm_framebuffer *fb = plane_state->base.fb;
29372940
unsigned int rotation = plane_state->base.rotation;
29382941
int x = plane_state->base.src.x1 >> 16;
29392942
int y = plane_state->base.src.y1 >> 16;
29402943
int w = drm_rect_width(&plane_state->base.src) >> 16;
29412944
int h = drm_rect_height(&plane_state->base.src) >> 16;
2945+
int dst_x = plane_state->base.dst.x1;
2946+
int pipe_src_w = crtc_state->pipe_src_w;
29422947
int max_width = skl_max_plane_width(fb, 0, rotation);
29432948
int max_height = 4096;
29442949
u32 alignment, offset, aux_offset = plane_state->aux.offset;
@@ -2949,6 +2954,20 @@ static int skl_check_main_surface(struct intel_plane_state *plane_state)
29492954
return -EINVAL;
29502955
}
29512956

2957+
/*
2958+
* Display WA #1175: cnl,glk
2959+
* Planes other than the cursor may cause FIFO underflow and display
2960+
* corruption if starting less than 4 pixels from the right edge of
2961+
* the screen.
2962+
*/
2963+
if ((IS_GEMINILAKE(dev_priv) || IS_CANNONLAKE(dev_priv)) &&
2964+
dst_x > pipe_src_w - 4) {
2965+
DRM_DEBUG_KMS("requested plane X start position %d invalid (valid range %d-%d)\n",
2966+
dst_x,
2967+
0, pipe_src_w - 4);
2968+
return -ERANGE;
2969+
}
2970+
29522971
intel_add_fb_offsets(&x, &y, plane_state, 0);
29532972
offset = intel_compute_tile_offset(&x, &y, plane_state, 0);
29542973
alignment = intel_surf_alignment(fb, 0);
@@ -3073,7 +3092,8 @@ static int skl_check_ccs_aux_surface(struct intel_plane_state *plane_state)
30733092
return 0;
30743093
}
30753094

3076-
int skl_check_plane_surface(struct intel_plane_state *plane_state)
3095+
int skl_check_plane_surface(const struct intel_crtc_state *crtc_state,
3096+
struct intel_plane_state *plane_state)
30773097
{
30783098
const struct drm_framebuffer *fb = plane_state->base.fb;
30793099
unsigned int rotation = plane_state->base.rotation;
@@ -3113,7 +3133,7 @@ int skl_check_plane_surface(struct intel_plane_state *plane_state)
31133133
plane_state->aux.y = 0;
31143134
}
31153135

3116-
ret = skl_check_main_surface(plane_state);
3136+
ret = skl_check_main_surface(crtc_state, plane_state);
31173137
if (ret)
31183138
return ret;
31193139

@@ -12778,7 +12798,7 @@ intel_check_primary_plane(struct intel_plane *plane,
1277812798
return 0;
1277912799

1278012800
if (INTEL_GEN(dev_priv) >= 9) {
12781-
ret = skl_check_plane_surface(state);
12801+
ret = skl_check_plane_surface(crtc_state, state);
1278212802
if (ret)
1278312803
return ret;
1278412804

drivers/gpu/drm/i915/intel_drv.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1507,7 +1507,8 @@ u32 skl_plane_ctl(const struct intel_crtc_state *crtc_state,
15071507
const struct intel_plane_state *plane_state);
15081508
u32 skl_plane_stride(const struct drm_framebuffer *fb, int plane,
15091509
unsigned int rotation);
1510-
int skl_check_plane_surface(struct intel_plane_state *plane_state);
1510+
int skl_check_plane_surface(const struct intel_crtc_state *crtc_state,
1511+
struct intel_plane_state *plane_state);
15111512
int i9xx_check_plane_surface(struct intel_plane_state *plane_state);
15121513

15131514
/* intel_csr.c */

drivers/gpu/drm/i915/intel_sprite.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1028,7 +1028,7 @@ intel_check_sprite_plane(struct intel_plane *plane,
10281028
dst->y2 = crtc_y + crtc_h;
10291029

10301030
if (INTEL_GEN(dev_priv) >= 9) {
1031-
ret = skl_check_plane_surface(state);
1031+
ret = skl_check_plane_surface(crtc_state, state);
10321032
if (ret)
10331033
return ret;
10341034

0 commit comments

Comments
 (0)