* [PATCH] drm/vc4: Advertise supported modifiers for planes
@ 2017-08-03 14:03 Daniel Stone
2017-08-04 20:50 ` Eric Anholt
0 siblings, 1 reply; 2+ messages in thread
From: Daniel Stone @ 2017-08-03 14:03 UTC (permalink / raw)
To: eric; +Cc: dri-devel
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.
Signed-off-by: Daniel Stone <daniels@collabora.com>
---
drivers/gpu/drm/vc4/vc4_plane.c | 22 +++++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/vc4/vc4_plane.c b/drivers/gpu/drm/vc4/vc4_plane.c
index 2968b3ebb895..554325117a4e 100644
--- a/drivers/gpu/drm/vc4/vc4_plane.c
+++ b/drivers/gpu/drm/vc4/vc4_plane.c
@@ -863,6 +863,20 @@ vc4_update_plane(struct drm_plane *plane,
ctx);
}
+static bool vc4_format_mod_supported(struct drm_plane *plane,
+ uint32_t format,
+ uint64_t modifier)
+{
+ /* This is easy: both tiled and linear are supported for all formats. */
+ switch (modifier) {
+ case DRM_FORMAT_MOD_BROADCOM_VC4_T_TILED:
+ case DRM_FORMAT_MOD_LINEAR:
+ return true;
+ default:
+ return false;
+ }
+}
+
static const struct drm_plane_funcs vc4_plane_funcs = {
.update_plane = vc4_update_plane,
.disable_plane = drm_atomic_helper_disable_plane,
@@ -871,6 +885,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,
@@ -882,6 +897,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);
@@ -902,7 +922,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.13.2
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] drm/vc4: Advertise supported modifiers for planes
2017-08-03 14:03 [PATCH] drm/vc4: Advertise supported modifiers for planes Daniel Stone
@ 2017-08-04 20:50 ` Eric Anholt
0 siblings, 0 replies; 2+ messages in thread
From: Eric Anholt @ 2017-08-04 20:50 UTC (permalink / raw)
To: Daniel Stone; +Cc: dri-devel
[-- Attachment #1.1: Type: text/plain, Size: 1394 bytes --]
Daniel Stone <daniels@collabora.com> writes:
> 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.
>
> Signed-off-by: Daniel Stone <daniels@collabora.com>
> ---
> drivers/gpu/drm/vc4/vc4_plane.c | 22 +++++++++++++++++++++-
> 1 file changed, 21 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/vc4/vc4_plane.c b/drivers/gpu/drm/vc4/vc4_plane.c
> index 2968b3ebb895..554325117a4e 100644
> --- a/drivers/gpu/drm/vc4/vc4_plane.c
> +++ b/drivers/gpu/drm/vc4/vc4_plane.c
> @@ -863,6 +863,20 @@ vc4_update_plane(struct drm_plane *plane,
> ctx);
> }
>
> +static bool vc4_format_mod_supported(struct drm_plane *plane,
> + uint32_t format,
> + uint64_t modifier)
> +{
> + /* This is easy: both tiled and linear are supported for all formats. */
> + switch (modifier) {
> + case DRM_FORMAT_MOD_BROADCOM_VC4_T_TILED:
> + case DRM_FORMAT_MOD_LINEAR:
> + return true;
> + default:
> + return false;
> + }
> +}
If this is being used for userspace to decide what modifiers it might
want to use for the format, we should disable T_TILED for multi-plane
formats.
However, it also looks like this won't be called unless
dev->mode_config.allow_fb_modifiers, which we should also set.
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
[-- Attachment #2: Type: text/plain, Size: 160 bytes --]
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-08-04 20:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-03 14:03 [PATCH] drm/vc4: Advertise supported modifiers for planes Daniel Stone
2017-08-04 20:50 ` Eric Anholt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox