bcm27xx: update to latest patches from RPi foundation
[openwrt/openwrt.git] / target / linux / bcm27xx / patches-5.4 / 950-0257-drm-vc4-Max-resolution-of-7680-is-conditional-on-bei.patch
1 From 2767f778820bd7392688512ec2996943a586db6e Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.org>
3 Date: Thu, 30 May 2019 15:55:15 +0100
4 Subject: [PATCH] drm/vc4: Max resolution of 7680 is conditional on
5 being Pi4
6
7 The max resolution had been increased from 2048 to 7680 for all
8 platforms. This code is common with Pi0-3 which have a max render
9 target for GL of 2048, therefore the increased resolution has to
10 be conditional on the platform.
11 Switch based on whether the bcm2835-v3d node is found, as that is
12 not present on Pi4. (There is a potential configuration on Pi0-3
13 with no v3d, but this is very unlikely).
14
15 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
16 ---
17 drivers/gpu/drm/vc4/vc4_kms.c | 11 +++++++++--
18 1 file changed, 9 insertions(+), 2 deletions(-)
19
20 --- a/drivers/gpu/drm/vc4/vc4_kms.c
21 +++ b/drivers/gpu/drm/vc4/vc4_kms.c
22 @@ -18,6 +18,7 @@
23 #include <drm/drm_plane_helper.h>
24 #include <drm/drm_probe_helper.h>
25 #include <drm/drm_vblank.h>
26 +#include <drm/drm_drv.h>
27
28 #include "vc4_drv.h"
29 #include "vc4_regs.h"
30 @@ -536,8 +537,14 @@ int vc4_kms_load(struct drm_device *dev)
31 return ret;
32 }
33
34 - dev->mode_config.max_width = 7680;
35 - dev->mode_config.max_height = 7680;
36 + if (!drm_core_check_feature(dev, DRIVER_RENDER)) {
37 + /* No V3D as part of vc4. Assume this is Pi4. */
38 + dev->mode_config.max_width = 7680;
39 + dev->mode_config.max_height = 7680;
40 + } else {
41 + dev->mode_config.max_width = 2048;
42 + dev->mode_config.max_height = 2048;
43 + }
44 dev->mode_config.funcs = &vc4_mode_funcs;
45 dev->mode_config.preferred_depth = 24;
46 dev->mode_config.async_page_flip = true;