Disable AFBC for resolutions bigger than 2560x1600 as RK3399 doesn't
support them.

>From the datasheet[1] ("1.2.10 Video IN/OUT", "Display Interface", p. 17):

  Support AFBC function co-operation with GPU
    * support 2560x1600 UI

Tested on RockPro64 (rk3399).
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7968

Signed-off-by: Konstantin Shabanov <m...@etehtsea.me>
Suggested-by: Dan Callaghan <d...@djc.id.au>
Reported-by: Dan Callaghan <d...@djc.id.au>
Reported-by: Tom Hebb <tommyh...@gmail.com>

[1]: 
https://opensource.rock-chips.com/images/d/d7/Rockchip_RK3399_Datasheet_V2.1-20200323.pdf
---
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c 
b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
index e3596e2b557d..c8d073347809 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
@@ -112,6 +112,7 @@
 
 #define AFBC_TILE_16x16                BIT(4)
 
+#define AFBC_MAX_WIDTH         2560
 /*
  * The coefficients of the following matrix are all fixed points.
  * The format is S2.10 for the 3x3 part of the matrix, and S9.12 for the 
offsets.
@@ -860,6 +861,13 @@ static int vop_plane_atomic_check(struct drm_plane *plane,
        }
 
        if (rockchip_afbc(fb->modifier)) {
+               if (fb->width > AFBC_MAX_WIDTH) {
+                       DRM_DEBUG_KMS("AFBC does not support width %d (max 
%d)\n",
+                                     fb->width,
+                                     AFBC_MAX_WIDTH);
+                       return -EINVAL;
+               }
+
                struct vop *vop = to_vop(crtc);
 
                if (!vop->data->afbc) {

base-commit: 6b60c282330c46954be9ae1d33cd5c7e5acb315c
-- 
2.48.1

Reply via email to