Skip to contentSkip to conversation

drm: check_pixel_format() should return true if no modifiers are passed for a supported pixel format

PATCH In review Ayan Kumar Halder 3 participants 4 messages May 25, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm: check_pixel_format() should return true if no modifiers are passed for a supported pixel format

If a plane supports a pixel format and the framebuffer does not pass any modifiers, then drm_plane_check_pixel_format() should always return true for the given format regardless of whether the plane supports any modifiers or not.

---
 drivers/gpu/drm/drm_plane.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/drm_plane.c +3 -0
index 6d2a6e4..873c084 100644
@@ -564,6 +564,9 @@ int drm_plane_check_pixel_format(struct drm_plane *plane,
 	if (!plane->modifier_count)
 		return 0;
 
+	if (modifier == DRM_FORMAT_MOD_NONE)
+		return 0;
+
 	for (i = 0; i < plane->modifier_count; i++) {
 		if (modifier == plane->modifiers[i])
 			break;
Signature · 6 lines
2.7.4

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw

Hi Ayan,

Quoted 15 lines · Ayan Kumar Halder

If a plane supports a pixel format and the framebuffer does not pass any modifiers, then drm_plane_check_pixel_format() should always return true for the given format regardless of whether the plane supports any modifiers or not.

---
drivers/gpu/drm/drm_plane.c | 3 +++

1 file changed, 3 insertions(+)
drivers/gpu/drm/drm_plane.c +0 -0
index 6d2a6e4..873c084 100644

drivers/gpu/drm/drm_plane.c int drm_plane_check_pixel_format(struct drm_plane *plane, · line 569

Quoted 6 lines
drivers/gpu/drm/drm_plane.c +3 -0
@@ -564,6 +564,9 @@ int drm_plane_check_pixel_format(struct drm_plane *plane,
 	if (!plane->modifier_count)
 		return 0;
 
+	if (modifier == DRM_FORMAT_MOD_NONE)
+		return 0;
+

There can be drivers which have formats which are only supported when a modifier is used - so I don't think this check is right to have in the core.

Drivers need to check if they support the format with no modifier (same as DRM_FORMAT_MOD_LINEAR) in their format_mod_supported() callback.

Thanks,
-Brian

Quoted 6 lines
drivers/gpu/drm/drm_plane.c +0 -0
 	for (i = 0; i < plane->modifier_count; i++) {
 		if (modifier == plane->modifiers[i])
 			break;
Signature · 1 line
2.7.4
#2 lore raw
Quoted 29 lines · Brian Starkey

Hi Ayan,

Quoted 15 lines · Ayan Kumar Halder

If a plane supports a pixel format and the framebuffer does not pass any modifiers, then drm_plane_check_pixel_format() should always return true for the given format regardless of whether the plane supports any modifiers or not.

---
drivers/gpu/drm/drm_plane.c | 3 +++

1 file changed, 3 insertions(+)
drivers/gpu/drm/drm_plane.c +0 -0
index 6d2a6e4..873c084 100644

drivers/gpu/drm/drm_plane.c int drm_plane_check_pixel_format(struct drm_plane *plane, · line 569

Quoted 6 lines
drivers/gpu/drm/drm_plane.c +3 -0
@@ -564,6 +564,9 @@ int drm_plane_check_pixel_format(struct drm_plane *plane,
 	if (!plane->modifier_count)
 		return 0;
 
+	if (modifier == DRM_FORMAT_MOD_NONE)
+		return 0;
+

There can be drivers which have formats which are only supported when a modifier is used - so I don't think this check is right to have in the core.

Quoted 3 lines

Drivers need to check if they support the format with no modifier (same as DRM_FORMAT_MOD_LINEAR) in their format_mod_supported() callback.

BTW I tried to make the core hide the "did the request have modifiers or not" difference as much as possible, and to validate that there is at least one plane that can use the created fb:
https://patchwork.freedesktop.org/series/39814/

Not sure we ever figured out a good solution in the end, but at least Eric's approach in https://patchwork.freedesktop.org/series/40133/
would avoid some of the problems I was having in my attempts. I guess I should try to revisit that patchset and see if I can make it less objectionable this time around.

Quoted 14 lines

Thanks,
-Brian

Quoted 6 lines
drivers/gpu/drm/drm_plane.c +0 -0
 	for (i = 0; i < plane->modifier_count; i++) {
 		if (modifier == plane->modifiers[i])
 			break;
Signature · 1 line
2.7.4

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Signature · 6 lines
Ville Syrjälä
Intel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#3 lore raw
In reply to Ayan Kumar Halder
Quoted 4 lines · Ayan Kumar Halder

If a plane supports a pixel format and the framebuffer does not pass any modifiers, then drm_plane_check_pixel_format() should always return true for the given format regardless of whether the plane supports any modifiers or not.

If your plane supports DRM_FORMAT_MOD_LINEAR then you should add that to the plane's modifier list.

Quoted 27 lines
---
 drivers/gpu/drm/drm_plane.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/drm_plane.c +3 -0
index 6d2a6e4..873c084 100644
@@ -564,6 +564,9 @@ int drm_plane_check_pixel_format(struct drm_plane *plane,
 	if (!plane->modifier_count)
 		return 0;
 
+	if (modifier == DRM_FORMAT_MOD_NONE)
+		return 0;
+
 	for (i = 0; i < plane->modifier_count; i++) {
 		if (modifier == plane->modifiers[i])
 			break;
Signature · 6 lines
2.7.4

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 2 lines
Ville Syrjälä
Intel