1 From 3d8b2b7adbec2ea7bf9012300c5e381cb60c270e Mon Sep 17 00:00:00 2001
2 From: Eric Anholt <eric@anholt.net>
3 Date: Mon, 18 Mar 2019 16:38:32 -0700
4 Subject: [PATCH 596/703] drm/vc4: Expose the format modifiers for firmware
7 This should technically not expose VC4_T_TILED on pi4. However, if we
8 don't expose anything, then userspace will assume that display can
9 handle whatever modifiers 3d can do (UIF on 2711). By exposing a
10 list, that will get intersected with what 3D can do so that we get T
11 tiling for display on 2710 and linear on 2711.
13 Signed-off-by: Eric Anholt <eric@anholt.net>
15 drivers/gpu/drm/vc4/vc4_firmware_kms.c | 33 +++++++++++++++++++++++++-
16 1 file changed, 32 insertions(+), 1 deletion(-)
18 --- a/drivers/gpu/drm/vc4/vc4_firmware_kms.c
19 +++ b/drivers/gpu/drm/vc4/vc4_firmware_kms.c
20 @@ -281,6 +281,27 @@ static void vc4_plane_destroy(struct drm
21 drm_plane_cleanup(plane);
24 +static bool vc4_fkms_format_mod_supported(struct drm_plane *plane,
28 + /* Support T_TILING for RGB formats only. */
30 + case DRM_FORMAT_XRGB8888:
31 + case DRM_FORMAT_ARGB8888:
33 + case DRM_FORMAT_MOD_BROADCOM_VC4_T_TILED:
34 + case DRM_FORMAT_MOD_LINEAR:
35 + case DRM_FORMAT_MOD_BROADCOM_UIF:
45 static const struct drm_plane_funcs vc4_plane_funcs = {
46 .update_plane = drm_atomic_helper_update_plane,
47 .disable_plane = drm_atomic_helper_disable_plane,
48 @@ -289,6 +310,7 @@ static const struct drm_plane_funcs vc4_
49 .reset = drm_atomic_helper_plane_reset,
50 .atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
51 .atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
52 + .format_mod_supported = vc4_fkms_format_mod_supported,
55 static const struct drm_plane_helper_funcs vc4_primary_plane_helper_funcs = {
56 @@ -316,6 +338,14 @@ static struct drm_plane *vc4_fkms_plane_
57 u32 argb8888 = DRM_FORMAT_ARGB8888;
59 bool primary = (type == DRM_PLANE_TYPE_PRIMARY);
60 + static const uint64_t modifiers[] = {
61 + DRM_FORMAT_MOD_LINEAR,
62 + /* VC4_T_TILED should come after linear, because we
63 + * would prefer to scan out linear (less bus traffic).
65 + DRM_FORMAT_MOD_BROADCOM_VC4_T_TILED,
66 + DRM_FORMAT_MOD_INVALID,
69 vc4_plane = devm_kzalloc(dev->dev, sizeof(*vc4_plane),
71 @@ -327,7 +357,8 @@ static struct drm_plane *vc4_fkms_plane_
72 plane = &vc4_plane->base;
73 ret = drm_universal_plane_init(dev, plane, 0xff,
75 - primary ? &xrgb8888 : &argb8888, 1, NULL,
76 + primary ? &xrgb8888 : &argb8888, 1,
78 type, primary ? "primary" : "cursor");
80 if (type == DRM_PLANE_TYPE_PRIMARY) {