drm/arm/malidp: Added support for AFBC modifiers for all layers except DE_SMART
authorAyan Kumar Halder <ayan.halder@arm.com>
Tue, 15 May 2018 12:35:57 +0000 (13:35 +0100)
committerAyan kumar halder <ayan.halder@arm.com>
Tue, 12 Mar 2019 18:25:10 +0000 (18:25 +0000)
The list of modifiers to be supported for each plane has been dynamically generated
from 'malidp_format_modifiers[]' and 'malidp_hw_regmap->features'.

Changes from v1:-
1. Replaced DRM_ERROR() with DRM_DEBUG_KMS() in malidp_format_mod_supported()
to report unsupported modifiers.

Changes from v2:-
1. Removed malidp_format_mod_supported() from the current patch. This has been added
in "PATCH 7/12"
2. Dynamically generate the list of modifiers (to be supported for each plane) from
'malidp_format_modifiers' and features.

Changes since v3 (series):
- Added the ack
- Rebased on the latest drm-misc-next

Signed-off-by: Ayan Kumar halder <ayan.halder@arm.com>
Reviewed-by: Liviu Dudau <liviu.dudau@arm.com>
Acked-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Link: https://patchwork.freedesktop.org/patch/291767/?series=57895&rev=1
drivers/gpu/drm/arm/malidp_drv.c
drivers/gpu/drm/arm/malidp_planes.c

index 4106f5d393b6e5a4dcf3482c0b8fbde002d04bd1..21725c9b9f5e0d3a5c15e5b96e2b9f053aa31ce9 100644 (file)
@@ -391,6 +391,7 @@ static int malidp_init(struct drm_device *drm)
        drm->mode_config.max_height = hwdev->max_line_size;
        drm->mode_config.funcs = &malidp_mode_config_funcs;
        drm->mode_config.helper_private = &malidp_mode_config_helpers;
+       drm->mode_config.allow_fb_modifiers = true;
 
        ret = malidp_crtc_init(drm);
        if (ret)
index 044bf7f3cfca3e3723c476b66b77fe63139f00bf..d42e0ea9a303c2a3d263e88e96395e76d8713751 100644 (file)
@@ -939,7 +939,26 @@ int malidp_de_planes_init(struct drm_device *drm)
                                  BIT(DRM_MODE_BLEND_PREMULTI)   |
                                  BIT(DRM_MODE_BLEND_COVERAGE);
        u32 *formats;
-       int ret, i, j, n;
+       int ret, i = 0, j = 0, n;
+       u64 supported_modifiers[MODIFIERS_COUNT_MAX];
+       const u64 *modifiers;
+
+       modifiers = malidp_format_modifiers;
+
+       if (!(map->features & MALIDP_DEVICE_AFBC_SUPPORT_SPLIT)) {
+               /*
+                * Since our hardware does not support SPLIT, so build the list
+                * of supported modifiers excluding SPLIT ones.
+                */
+               while (*modifiers != DRM_FORMAT_MOD_INVALID) {
+                       if (!(*modifiers & AFBC_SPLIT))
+                               supported_modifiers[j++] = *modifiers;
+
+                       modifiers++;
+               }
+               supported_modifiers[j++] = DRM_FORMAT_MOD_INVALID;
+               modifiers = supported_modifiers;
+       }
 
        formats = kcalloc(map->n_pixel_formats, sizeof(*formats), GFP_KERNEL);
        if (!formats) {
@@ -964,9 +983,15 @@ int malidp_de_planes_init(struct drm_device *drm)
 
                plane_type = (i == 0) ? DRM_PLANE_TYPE_PRIMARY :
                                        DRM_PLANE_TYPE_OVERLAY;
+
+               /*
+                * All the layers except smart layer supports AFBC modifiers.
+                */
                ret = drm_universal_plane_init(drm, &plane->base, crtcs,
-                                              &malidp_de_plane_funcs, formats,
-                                              n, NULL, plane_type, NULL);
+                               &malidp_de_plane_funcs, formats, n,
+                               (id == DE_SMART) ? NULL : modifiers, plane_type,
+                               NULL);
+
                if (ret < 0)
                        goto cleanup;