Skip to content

Commit 3e28a67

Browse files
vgovind2jlahtine-intel
authored andcommitted
drm/i915/display: fix the pixel normalization handling for xe3p_lpd
Pixel normalizer is enabled with normalization factor as 1.0 for FP16 formats in order to support FBC for those formats in xe3p_lpd. Previously pixel normalizer gets disabled during the plane disable routine. But there could be plane format settings without explicitly calling the plane disable in-between and we could endup keeping the pixel normalizer enabled for formats which we don't require that. This is causing crc mismatches in yuv formats and FIFO underruns in planar formats like NV12. Fix this by updating the pixel normalizer configuration based on the pixel formats explicitly during the plane settings arm calls itself - enable it for FP16 and disable it for other formats in HDR capable planes. v2: avoid redundant pixel normalization setting updates v3: moved the normalization factor definition to intel_fbc.c and some updates to comments v4: simplified the pixel normalizer setting handling Fixes: 5298eea ("drm/i915/xe3p_lpd: use pixel normalizer for fp16 formats for FBC") Signed-off-by: Vinod Govindapillai <[email protected]> Reviewed-by: Uma Shankar <[email protected]> Link: https://patch.msgid.link/[email protected] (cherry picked from commit c0dc68f) Signed-off-by: Joonas Lahtinen <[email protected]>
1 parent ad3ebcc commit 3e28a67

4 files changed

Lines changed: 26 additions & 24 deletions

File tree

drivers/gpu/drm/i915/display/intel_display_device.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ struct intel_display_platforms {
193193
#define HAS_MSO(__display) (DISPLAY_VER(__display) >= 12)
194194
#define HAS_OVERLAY(__display) (DISPLAY_INFO(__display)->has_overlay)
195195
#define HAS_PIPEDMC(__display) (DISPLAY_VER(__display) >= 12)
196+
#define HAS_PIXEL_NORMALIZER(__display) (DISPLAY_VER(__display) >= 35)
196197
#define HAS_PSR(__display) (DISPLAY_INFO(__display)->has_psr)
197198
#define HAS_PSR_HW_TRACKING(__display) (DISPLAY_INFO(__display)->has_psr_hw_tracking)
198199
#define HAS_PSR2_SEL_FETCH(__display) (DISPLAY_VER(__display) >= 12)

drivers/gpu/drm/i915/display/intel_fbc.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1215,13 +1215,15 @@ static bool xe3p_lpd_fbc_pixel_format_is_valid(const struct intel_plane_state *p
12151215
}
12161216
}
12171217

1218-
bool
1219-
intel_fbc_is_enable_pixel_normalizer(const struct intel_plane_state *plane_state)
1218+
bool intel_fbc_need_pixel_normalizer(const struct intel_plane_state *plane_state)
12201219
{
12211220
struct intel_display *display = to_intel_display(plane_state);
12221221

1223-
return DISPLAY_VER(display) >= 35 &&
1224-
xe3p_lpd_fbc_fp16_format_is_valid(plane_state);
1222+
if (HAS_PIXEL_NORMALIZER(display) &&
1223+
xe3p_lpd_fbc_fp16_format_is_valid(plane_state))
1224+
return true;
1225+
1226+
return false;
12251227
}
12261228

12271229
static bool pixel_format_is_valid(const struct intel_plane_state *plane_state)

drivers/gpu/drm/i915/display/intel_fbc.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ void intel_fbc_prepare_dirty_rect(struct intel_atomic_state *state,
5656
struct intel_crtc *crtc);
5757
void intel_fbc_dirty_rect_update_noarm(struct intel_dsb *dsb,
5858
struct intel_plane *plane);
59-
bool
60-
intel_fbc_is_enable_pixel_normalizer(const struct intel_plane_state *plane_state);
59+
bool intel_fbc_need_pixel_normalizer(const struct intel_plane_state *plane_state);
6160

6261
#endif /* __INTEL_FBC_H__ */

drivers/gpu/drm/i915/display/skl_universal_plane.c

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -891,23 +891,20 @@ static void icl_plane_disable_sel_fetch_arm(struct intel_dsb *dsb,
891891
intel_de_write_dsb(display, dsb, SEL_FETCH_PLANE_CTL(pipe, plane->id), 0);
892892
}
893893

894-
static void x3p_lpd_plane_update_pixel_normalizer(struct intel_dsb *dsb,
895-
struct intel_plane *plane,
896-
bool enable)
894+
static bool plane_has_normalizer(struct intel_plane *plane)
897895
{
898896
struct intel_display *display = to_intel_display(plane);
899-
enum intel_fbc_id fbc_id = skl_fbc_id_for_pipe(plane->pipe);
900-
u32 val;
901897

902-
/* Only HDR planes have pixel normalizer and don't matter if no FBC */
903-
if (!skl_plane_has_fbc(display, fbc_id, plane->id))
904-
return;
898+
return HAS_PIXEL_NORMALIZER(display) && icl_is_hdr_plane(display, plane->id);
899+
}
905900

906-
val = enable ? PLANE_PIXEL_NORMALIZE_NORM_FACTOR(PLANE_PIXEL_NORMALIZE_NORM_FACTOR_1_0) |
907-
PLANE_PIXEL_NORMALIZE_ENABLE : 0;
901+
static u32 pixel_normalizer_value(const struct intel_plane_state *plane_state)
902+
{
903+
if (!intel_fbc_need_pixel_normalizer(plane_state))
904+
return 0;
908905

909-
intel_de_write_dsb(display, dsb,
910-
PLANE_PIXEL_NORMALIZE(plane->pipe, plane->id), val);
906+
return PLANE_PIXEL_NORMALIZE_ENABLE |
907+
PLANE_PIXEL_NORMALIZE_NORM_FACTOR(PLANE_PIXEL_NORMALIZE_NORM_FACTOR_1_0);
911908
}
912909

913910
static void
@@ -926,8 +923,9 @@ icl_plane_disable_arm(struct intel_dsb *dsb,
926923

927924
icl_plane_disable_sel_fetch_arm(dsb, plane, crtc_state);
928925

929-
if (DISPLAY_VER(display) >= 35)
930-
x3p_lpd_plane_update_pixel_normalizer(dsb, plane, false);
926+
if (plane_has_normalizer(plane))
927+
intel_de_write_dsb(display, dsb,
928+
PLANE_PIXEL_NORMALIZE(plane->pipe, plane->id), 0);
931929

932930
intel_de_write_dsb(display, dsb, PLANE_CTL(pipe, plane_id), 0);
933931
intel_de_write_dsb(display, dsb, PLANE_SURF(pipe, plane_id), 0);
@@ -1676,11 +1674,13 @@ icl_plane_update_arm(struct intel_dsb *dsb,
16761674

16771675
/*
16781676
* In order to have FBC for fp16 formats pixel normalizer block must be
1679-
* active. Check if pixel normalizer block need to be enabled for FBC.
1680-
* If needed, use normalization factor as 1.0 and enable the block.
1677+
* active. For FP16 formats, use normalization factor as 1.0 and enable
1678+
* the block.
16811679
*/
1682-
if (intel_fbc_is_enable_pixel_normalizer(plane_state))
1683-
x3p_lpd_plane_update_pixel_normalizer(dsb, plane, true);
1680+
if (plane_has_normalizer(plane))
1681+
intel_de_write_dsb(display, dsb,
1682+
PLANE_PIXEL_NORMALIZE(plane->pipe, plane->id),
1683+
pixel_normalizer_value(plane_state));
16841684

16851685
/*
16861686
* The control register self-arms if the plane was previously

0 commit comments

Comments
 (0)