mirror of
https://github.com/Ysurac/openmptcprouter.git
synced 2025-02-15 04:42:02 +00:00
104 lines
3.4 KiB
Diff
104 lines
3.4 KiB
Diff
From 8b386830eaa6a56942bf72e6a1caff7f9b5a2d39 Mon Sep 17 00:00:00 2001
|
|
From: Daniel Stone <daniels@collabora.com>
|
|
Date: Tue, 8 Aug 2017 17:44:48 +0100
|
|
Subject: [PATCH 388/401] drm/vc4: Advertise supported modifiers for planes
|
|
|
|
The IN_FORMATS blob allows the kernel to advertise to userspace which
|
|
format/modifier combinations are supported, per plane. Use this to
|
|
advertise that we support both T_TILED and linear.
|
|
|
|
v2:
|
|
- Only advertise T_TILED for RGB (Eric)
|
|
- Actually turn on allow_fb_modifiers (Eric)
|
|
|
|
Signed-off-by: Daniel Stone <daniels@collabora.com>
|
|
Signed-off-by: Eric Anholt <eric@anholt.net>
|
|
Reviewed-by: Eric Anholt <eric@anholt.net>
|
|
Link: https://patchwork.freedesktop.org/patch/170828/
|
|
(cherry picked from commit 423ad7b3cbd1158d080e20119a7a5f93a085a486)
|
|
---
|
|
drivers/gpu/drm/vc4/vc4_kms.c | 1 +
|
|
drivers/gpu/drm/vc4/vc4_plane.c | 34 +++++++++++++++++++++++++++++++++-
|
|
2 files changed, 34 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/drivers/gpu/drm/vc4/vc4_kms.c b/drivers/gpu/drm/vc4/vc4_kms.c
|
|
index f73343e08fe6..36b53258fe62 100644
|
|
--- a/drivers/gpu/drm/vc4/vc4_kms.c
|
|
+++ b/drivers/gpu/drm/vc4/vc4_kms.c
|
|
@@ -222,6 +222,7 @@ int vc4_kms_load(struct drm_device *dev)
|
|
dev->mode_config.funcs = &vc4_mode_funcs;
|
|
dev->mode_config.preferred_depth = 24;
|
|
dev->mode_config.async_page_flip = true;
|
|
+ dev->mode_config.allow_fb_modifiers = true;
|
|
|
|
drm_mode_config_reset(dev);
|
|
|
|
diff --git a/drivers/gpu/drm/vc4/vc4_plane.c b/drivers/gpu/drm/vc4/vc4_plane.c
|
|
index 770f50c31e57..a2d65ae3c1c2 100644
|
|
--- a/drivers/gpu/drm/vc4/vc4_plane.c
|
|
+++ b/drivers/gpu/drm/vc4/vc4_plane.c
|
|
@@ -865,6 +865,32 @@ vc4_update_plane(struct drm_plane *plane,
|
|
ctx);
|
|
}
|
|
|
|
+static bool vc4_format_mod_supported(struct drm_plane *plane,
|
|
+ uint32_t format,
|
|
+ uint64_t modifier)
|
|
+{
|
|
+ /* Support T_TILING for RGB formats only. */
|
|
+ switch (format) {
|
|
+ case DRM_FORMAT_XRGB8888:
|
|
+ case DRM_FORMAT_ARGB8888:
|
|
+ case DRM_FORMAT_ABGR8888:
|
|
+ case DRM_FORMAT_XBGR8888:
|
|
+ case DRM_FORMAT_RGB565:
|
|
+ case DRM_FORMAT_BGR565:
|
|
+ case DRM_FORMAT_ARGB1555:
|
|
+ case DRM_FORMAT_XRGB1555:
|
|
+ return true;
|
|
+ case DRM_FORMAT_YUV422:
|
|
+ case DRM_FORMAT_YVU422:
|
|
+ case DRM_FORMAT_YUV420:
|
|
+ case DRM_FORMAT_YVU420:
|
|
+ case DRM_FORMAT_NV12:
|
|
+ case DRM_FORMAT_NV16:
|
|
+ default:
|
|
+ return (modifier == DRM_FORMAT_MOD_LINEAR);
|
|
+ }
|
|
+}
|
|
+
|
|
static const struct drm_plane_funcs vc4_plane_funcs = {
|
|
.update_plane = vc4_update_plane,
|
|
.disable_plane = drm_atomic_helper_disable_plane,
|
|
@@ -873,6 +899,7 @@ static const struct drm_plane_funcs vc4_plane_funcs = {
|
|
.reset = vc4_plane_reset,
|
|
.atomic_duplicate_state = vc4_plane_duplicate_state,
|
|
.atomic_destroy_state = vc4_plane_destroy_state,
|
|
+ .format_mod_supported = vc4_format_mod_supported,
|
|
};
|
|
|
|
struct drm_plane *vc4_plane_init(struct drm_device *dev,
|
|
@@ -884,6 +911,11 @@ struct drm_plane *vc4_plane_init(struct drm_device *dev,
|
|
u32 num_formats = 0;
|
|
int ret = 0;
|
|
unsigned i;
|
|
+ static const uint64_t modifiers[] = {
|
|
+ DRM_FORMAT_MOD_BROADCOM_VC4_T_TILED,
|
|
+ DRM_FORMAT_MOD_LINEAR,
|
|
+ DRM_FORMAT_MOD_INVALID
|
|
+ };
|
|
|
|
vc4_plane = devm_kzalloc(dev->dev, sizeof(*vc4_plane),
|
|
GFP_KERNEL);
|
|
@@ -904,7 +936,7 @@ struct drm_plane *vc4_plane_init(struct drm_device *dev,
|
|
ret = drm_universal_plane_init(dev, plane, 0,
|
|
&vc4_plane_funcs,
|
|
formats, num_formats,
|
|
- NULL, type, NULL);
|
|
+ modifiers, type, NULL);
|
|
|
|
drm_plane_helper_add(plane, &vc4_plane_helper_funcs);
|
|
|
|
--
|
|
2.16.1
|
|
|