diff --git a/packages/linux/patches/raspberrypi/linux-010-hide-4k-modes.patch b/packages/linux/patches/raspberrypi/linux-010-hide-4k-modes.patch deleted file mode 100644 index 1a6ad3560f..0000000000 --- a/packages/linux/patches/raspberrypi/linux-010-hide-4k-modes.patch +++ /dev/null @@ -1,21 +0,0 @@ -commit ff435e359364b968d14bb4c96b5698712d9cea90 -Author: Matthias Reichl -Date: Fri Dec 18 20:53:43 2020 +0100 - - vc4_hdmi: Reduce max pixel rate to hide 4k modes - - 162MHz limits to 1920x1200@60 - -diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c -index 2386c7303a215..561d3fa3bb926 100644 ---- a/drivers/gpu/drm/vc4/vc4_hdmi.c -+++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -404,7 +404,7 @@ static void hdmi_codec_eld_chmap(struct vc4_hdmi *vc4_hdmi) - vc4_hdmi->audio.chmap = hdmi_codec_stereo_chmaps; - } - --#define HDMI_14_MAX_TMDS_CLK (340 * 1000 * 1000) -+#define HDMI_14_MAX_TMDS_CLK (162 * 1000 * 1000) - - static int vc4_hdmi_debugfs_regs(struct seq_file *m, void *unused) - { diff --git a/packages/linux/patches/raspberrypi/linux-011-fix-lbm-pr4075.patch b/packages/linux/patches/raspberrypi/linux-011-fix-lbm-pr4075.patch new file mode 100644 index 0000000000..d87af277bb --- /dev/null +++ b/packages/linux/patches/raspberrypi/linux-011-fix-lbm-pr4075.patch @@ -0,0 +1,70 @@ +From 20076ee25ac4a9ddc26dfbb508570c85c88ba6ef Mon Sep 17 00:00:00 2001 +From: Dom Cobley +Date: Thu, 14 Jan 2021 16:01:50 +0000 +Subject: [PATCH] vc4: Correct lbm size and calculation + +LBM base address is measured in units of pixels per cycle. +That is 4 for 2711 (hvs5) and 2 for 2708. + +We are wasting 75% of lbm by indexing without the scaling. +But we were also using too high a size for the lbm resulting +in partial corruption (right hand side) of vertically +scaled images, usually at 4K or lower resolutions with more layers. + +The physical RAM of LBM on 2711 is 8 * 1920 * 16 * 12-bit +(pixels are stored 12-bits per component regardless of format). + +The LBM adress indexes work in units of pixels per clock, +so for 4 pixels per clock that means we have 32 * 1920 = 60K + +Signed-off-by: Dom Cobley +--- + drivers/gpu/drm/vc4/vc4_hvs.c | 8 ++++---- + drivers/gpu/drm/vc4/vc4_plane.c | 7 ++++++- + 2 files changed, 10 insertions(+), 5 deletions(-) + +diff --git a/drivers/gpu/drm/vc4/vc4_hvs.c b/drivers/gpu/drm/vc4/vc4_hvs.c +index f2a99579a8d0f..3ceda2ff072bb 100644 +--- a/drivers/gpu/drm/vc4/vc4_hvs.c ++++ b/drivers/gpu/drm/vc4/vc4_hvs.c +@@ -661,11 +661,11 @@ static int vc4_hvs_bind(struct device *dev, struct device *master, void *data) + * for now we just allocate globally. + */ + if (!hvs->hvs5) +- /* 96kB */ +- drm_mm_init(&hvs->lbm_mm, 0, 96 * 1024); ++ /* 48k words of 2x12-bit pixels */ ++ drm_mm_init(&hvs->lbm_mm, 0, 48 * 1024); + else +- /* 70k words */ +- drm_mm_init(&hvs->lbm_mm, 0, 70 * 2 * 1024); ++ /* 60k words of 4x12-bit pixels */ ++ drm_mm_init(&hvs->lbm_mm, 0, 60 * 1024); + + /* Upload filter kernels. We only have the one for now, so we + * keep it around for the lifetime of the driver. +diff --git a/drivers/gpu/drm/vc4/vc4_plane.c b/drivers/gpu/drm/vc4/vc4_plane.c +index 100b3541bc6ef..6bdfc1ba7b46d 100644 +--- a/drivers/gpu/drm/vc4/vc4_plane.c ++++ b/drivers/gpu/drm/vc4/vc4_plane.c +@@ -444,6 +444,7 @@ static void vc4_write_ppf(struct vc4_plane_state *vc4_state, u32 src, u32 dst) + static u32 vc4_lbm_size(struct drm_plane_state *state) + { + struct vc4_plane_state *vc4_state = to_vc4_plane_state(state); ++ struct vc4_dev *vc4 = to_vc4_dev(state->plane->dev); + u32 pix_per_line; + u32 lbm; + +@@ -479,7 +480,11 @@ static u32 vc4_lbm_size(struct drm_plane_state *state) + lbm = pix_per_line * 16; + } + +- lbm = roundup(lbm, 32); ++ /* Align it to 64 or 128 (hvs5) bytes */ ++ lbm = roundup(lbm, vc4->hvs->hvs5 ? 128 : 64); ++ ++ /* Each "word" of the LBM memory contains 2 or 4 (hvs5) pixels */ ++ lbm /= vc4->hvs->hvs5 ? 4 : 2; + + return lbm; + } diff --git a/packages/linux/patches/raspberrypi/linux-012-fix-pos1-scl.patch b/packages/linux/patches/raspberrypi/linux-012-fix-pos1-scl.patch new file mode 100644 index 0000000000..239ba21039 --- /dev/null +++ b/packages/linux/patches/raspberrypi/linux-012-fix-pos1-scl.patch @@ -0,0 +1,27 @@ +From 21ed5c49de516d496f9820dc1ddaa4027daa8823 Mon Sep 17 00:00:00 2001 +From: Dom Cobley +Date: Sun, 17 Jan 2021 17:07:02 +0000 +Subject: [PATCH] vc4: Correct POS1_SCL for hvs5 + +Fixes: c54619b0bfb35c4153b3fb34916a6fa50dcf2dc1 +Signed-off-by: Dom Cobley +--- + drivers/gpu/drm/vc4/vc4_plane.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/gpu/drm/vc4/vc4_plane.c b/drivers/gpu/drm/vc4/vc4_plane.c +index 6bdfc1ba7b46d..b5586c92bfe54 100644 +--- a/drivers/gpu/drm/vc4/vc4_plane.c ++++ b/drivers/gpu/drm/vc4/vc4_plane.c +@@ -984,9 +984,9 @@ static int vc4_plane_mode_set(struct drm_plane *plane, + if (!vc4_state->is_unity) { + vc4_dlist_write(vc4_state, + VC4_SET_FIELD(vc4_state->crtc_w, +- SCALER_POS1_SCL_WIDTH) | ++ SCALER5_POS1_SCL_WIDTH) | + VC4_SET_FIELD(vc4_state->crtc_h, +- SCALER_POS1_SCL_HEIGHT)); ++ SCALER5_POS1_SCL_HEIGHT)); + } + + /* Position Word 2: Source Image Size */