* [PATCH v2] drm/vc4: Advertise supported modifiers for planes
@ 2017-08-08 16:44 Daniel Stone
2018-03-05 18:21 ` Eric Anholt
0 siblings, 1 reply; 5+ messages in thread
From: Daniel Stone @ 2017-08-08 16:44 UTC (permalink / raw)
To: 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.
v2:
- Only advertise T_TILED for RGB (Eric)
- Actually turn on allow_fb_modifiers (Eric)
Signed-off-by: Daniel Stone <daniels@collabora.com>
---
drivers/gpu/drm/vc4/vc4_kms.c | 3 ++-
drivers/gpu/drm/vc4/vc4_plane.c | 34 +++++++++++++++++++++++++++++++++-
2 files changed, 35 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/vc4/vc4_kms.c b/drivers/gpu/drm/vc4/vc4_kms.c
index 893312e4e2d7..062e7993f61b 100644
--- a/drivers/gpu/drm/vc4/vc4_kms.c
+++ b/drivers/gpu/drm/vc4/vc4_kms.c
@@ -187,7 +187,7 @@ static struct drm_framebuffer *vc4_fb_create(struct drm_device *dev,
/* Make sure that the modifier in AddFB2 is consistent with the tiling
* mode set through vc4_set_tiling_ioctl().
*/
- if (mode_cmd.modifier[0] != tiling_ioctl) {
+ if (mode_cmd->modifier[0] != tiling_ioctl) {
DRM_DEBUG_KMS("Mismatch between user-provided modifier and "
"tiling ioctl\n");
return ERR_PTR(-EINVAL);
@@ -224,6 +224,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 2968b3ebb895..d769803ac3a5 100644
--- a/drivers/gpu/drm/vc4/vc4_plane.c
+++ b/drivers/gpu/drm/vc4/vc4_plane.c
@@ -863,6 +863,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,
@@ -871,6 +897,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 +909,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 +934,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] 5+ messages in thread
* Re: [PATCH v2] drm/vc4: Advertise supported modifiers for planes
2017-08-08 16:44 [PATCH v2] drm/vc4: Advertise supported modifiers for planes Daniel Stone
@ 2018-03-05 18:21 ` Eric Anholt
0 siblings, 0 replies; 5+ messages in thread
From: Eric Anholt @ 2018-03-05 18:21 UTC (permalink / raw)
To: Daniel Stone, dri-devel
[-- Attachment #1.1: Type: text/plain, Size: 444 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.
>
> v2:
> - Only advertise T_TILED for RGB (Eric)
> - Actually turn on allow_fb_modifiers (Eric)
>
> Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed and pushed to drm-misc-next. Thanks!
[-- 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] 5+ messages in thread
* Re: [PATCH v2] drm/vc4: Advertise supported modifiers for planes
2017-08-08 20:36 ` Eric Anholt
@ 2017-08-09 16:50 ` Daniel Stone
0 siblings, 0 replies; 5+ messages in thread
From: Daniel Stone @ 2017-08-09 16:50 UTC (permalink / raw)
To: Eric Anholt; +Cc: dri-devel
On 8 August 2017 at 21:36, Eric Anholt <eric@anholt.net> wrote:
> Daniel Stone <daniels@collabora.com> writes:
>> + case DRM_FORMAT_YUV422:
>> + case DRM_FORMAT_YVU422:
>> + case DRM_FORMAT_YUV420:
>> + case DRM_FORMAT_YVU420:
>> + case DRM_FORMAT_NV12:
>> + case DRM_FORMAT_NV16:
>> + return (modifier == DRM_FORMAT_MOD_LINEAR);
>> + }
>> +}
>
> drivers/gpu/drm/vc4/vc4_plane.c: In function ‘vc4_format_mod_supported’:
> drivers/gpu/drm/vc4/vc4_plane.c:889:1: warning: control reaches end of non-void function [-Wreturn-type]
> }
>
> Can we just replace the ARGB cases with a default case? Or maybe just
> drm_format_info(format)->num_planes > 1?
I'd sent the wrong version whilst juggling trees; see the follow-up
sent very shortly after. Really don't mind which; was trying to search
for something which seemed most foolproof. num_planes > 1 is probably
the best proxy, so I'll do that. The patch to check modifier
correctness also needs a rebase after the bo-unref changes, so I'll
resend bothj.
Cheers,
Daniel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] drm/vc4: Advertise supported modifiers for planes
2017-08-08 16:37 Daniel Stone
@ 2017-08-08 20:36 ` Eric Anholt
2017-08-09 16:50 ` Daniel Stone
0 siblings, 1 reply; 5+ messages in thread
From: Eric Anholt @ 2017-08-08 20:36 UTC (permalink / raw)
To: Daniel Stone, dri-devel
[-- Attachment #1.1: Type: text/plain, Size: 2395 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.
>
> v2:
> - Only advertise T_TILED for RGB (Eric)
> - Actually turn on allow_fb_modifiers (Eric)
>
> Signed-off-by: Daniel Stone <daniels@collabora.com>
> ---
> drivers/gpu/drm/vc4/vc4_kms.c | 1 +
> drivers/gpu/drm/vc4/vc4_plane.c | 33 ++++++++++++++++++++++++++++++++-
> 2 files changed, 33 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/vc4/vc4_kms.c b/drivers/gpu/drm/vc4/vc4_kms.c
> index 893312e4e2d7..ef82b5de71fd 100644
> --- a/drivers/gpu/drm/vc4/vc4_kms.c
> +++ b/drivers/gpu/drm/vc4/vc4_kms.c
> @@ -224,6 +224,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 2968b3ebb895..a21590991490 100644
> --- a/drivers/gpu/drm/vc4/vc4_plane.c
> +++ b/drivers/gpu/drm/vc4/vc4_plane.c
> @@ -863,6 +863,31 @@ 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:
> + return (modifier == DRM_FORMAT_MOD_LINEAR);
> + }
> +}
drivers/gpu/drm/vc4/vc4_plane.c: In function ‘vc4_format_mod_supported’:
drivers/gpu/drm/vc4/vc4_plane.c:889:1: warning: control reaches end of non-void function [-Wreturn-type]
}
Can we just replace the ARGB cases with a default case? Or maybe just
drm_format_info(format)->num_planes > 1?
[-- 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] 5+ messages in thread
* [PATCH v2] drm/vc4: Advertise supported modifiers for planes
@ 2017-08-08 16:37 Daniel Stone
2017-08-08 20:36 ` Eric Anholt
0 siblings, 1 reply; 5+ messages in thread
From: Daniel Stone @ 2017-08-08 16:37 UTC (permalink / raw)
To: 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.
v2:
- Only advertise T_TILED for RGB (Eric)
- Actually turn on allow_fb_modifiers (Eric)
Signed-off-by: Daniel Stone <daniels@collabora.com>
---
drivers/gpu/drm/vc4/vc4_kms.c | 1 +
drivers/gpu/drm/vc4/vc4_plane.c | 33 ++++++++++++++++++++++++++++++++-
2 files changed, 33 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/vc4/vc4_kms.c b/drivers/gpu/drm/vc4/vc4_kms.c
index 893312e4e2d7..ef82b5de71fd 100644
--- a/drivers/gpu/drm/vc4/vc4_kms.c
+++ b/drivers/gpu/drm/vc4/vc4_kms.c
@@ -224,6 +224,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 2968b3ebb895..a21590991490 100644
--- a/drivers/gpu/drm/vc4/vc4_plane.c
+++ b/drivers/gpu/drm/vc4/vc4_plane.c
@@ -863,6 +863,31 @@ 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:
+ 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,
@@ -871,6 +896,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 +908,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 +933,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] 5+ messages in thread
end of thread, other threads:[~2018-03-05 18:21 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-08 16:44 [PATCH v2] drm/vc4: Advertise supported modifiers for planes Daniel Stone
2018-03-05 18:21 ` Eric Anholt
-- strict thread matches above, loose matches on Subject: below --
2017-08-08 16:37 Daniel Stone
2017-08-08 20:36 ` Eric Anholt
2017-08-09 16:50 ` Daniel Stone
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).