drm/amdgpu: Ensure that the modifier requested is supported by plane.
Subsystems (3)
PATCH 1/1 drm/amdgpu: Ensure that the modifier requested is supported by plane.
From: Mark Yacoub <[email protected]>
On initializing the framebuffer, call drm_any_plane_has_format to do a check if the modifier is supported. drm_any_plane_has_format calls dm_plane_format_mod_supported which is extended to validate that the modifier is on the list of the plane's supported modifiers.
The bug was caught using igt-gpu-tools test: kms_addfb_basic.addfb25-bad-modifier
Tested on ChromeOS Zork by turning on the display, running an overlay test, and running a YT video.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 13 +++++++++++++ drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 9 +++++++++ 2 files changed, 22 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +13 -0
@@ -908,6 +908,19 @@ int amdgpu_display_gem_fb_verify_and_init( &amdgpu_fb_funcs);if (ret) goto err; +/* Verify that the modifier is supported. */ +if (!drm_any_plane_has_format (dev, mode_cmd->pixel_format, + mode_cmd->modifier[0 ])) { +struct drm_format_name_buf format_name; +drm_dbg_kms (dev, +"unsupported pixel format %s / modifier 0x%llx\n" , +drm_get_format_name (mode_cmd->pixel_format, + &format_name), + mode_cmd->modifier[0 ]); + + ret = -EINVAL ; + goto err; + } ret =amdgpu_display_framebuffer_init (dev, rfb, mode_cmd, obj);if (ret)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +9 -0
@@ -3939,6 +3939,7 @@ static bool dm_plane_format_mod_supported(struct drm_plane *plane, {struct amdgpu_device *adev =drm_to_adev (plane->dev);const struct drm_format_info *info =drm_format_info (format); +int i;enum dm_micro_swizzle microtile =modifier_gfx9_swizzle_mode (modifier) &3 ;
@@ -3952,6 +3953,14 @@ static bool dm_plane_format_mod_supported(struct drm_plane *plane,if (modifier ==DRM_FORMAT_MOD_LINEAR )return true; +/* Check that the modifier is on the list of the plane's supported modifiers. */ +for (i =0 ; i < plane->modifier_count; i++) { +if (modifier == plane->modifiers[i]) +break ; + } +if (i == plane->modifier_count) +return false; +/* * The arbitrary tiling support for multiplane formats has not been hooked * up.
Signature · 6 lines
2.30.1.766.gb4fecdf3b7-goog _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
"friendly ping"
Quoted 78 lines · Mark Yacoub
From: Mark Yacoub <[email protected]>
On initializing the framebuffer, call
drm_any_plane_has_formatto do a check if the modifier is supported.drm_any_plane_has_formatcallsdm_plane_format_mod_supportedwhich is extended to validate that the modifier is on the list of the plane's supported modifiers.The bug was caught using igt-gpu-tools test:
kms_addfb_basic.addfb25-bad-modifierTested on ChromeOS Zork by turning on the display, running an overlay test, and running a YT video.
Cc Alex Deucher <[email protected]>Cc Bas Nieuwenhuizen <[email protected]>Signed-off-by default avatarMark Yacoub <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 13 +++++++++++++ drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 9 +++++++++ 2 files changed, 22 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +13
-0@@ -908,6 +908,19 @@ int amdgpu_display_gem_fb_verify_and_init( &amdgpu_fb_funcs);if (ret) goto err; +/* Verify that the modifier is supported. */ +if (!drm_any_plane_has_format (dev, mode_cmd->pixel_format, + mode_cmd->modifier[0 ])) { +struct drm_format_name_buf format_name; +drm_dbg_kms (dev, + "unsupported pixel format %s / modifier 0x%llx\n", + drm_get_format_name(mode_cmd->pixel_format, + &format_name), + mode_cmd->modifier[0 ]); + + ret = -EINVAL ; + goto err; + } ret =amdgpu_display_framebuffer_init (dev, rfb, mode_cmd, obj);if (ret)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1
-0@@ -3939,6 +3939,7 @@ static bool dm_plane_format_mod_supported(struct drm_plane *plane, {struct amdgpu_device *adev =drm_to_adev (plane->dev);const struct drm_format_info *info =drm_format_info (format); +int i; enum dm_micro_swizzle microtile =
modifier_gfx9_swizzle_mode(modifier)& 3;drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1
-0@@ -3952,6 +3953,14 @@ static bool dm_plane_format_mod_supported(struct drm_plane *plane, if (modifier == DRM_FORMAT_MOD_LINEAR)return true; +/* Check that the modifier is on the list of the plane's supported modifiers. */
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +7
-0+for (i =0 ; i < plane->modifier_count; i++) { +if (modifier == plane->modifiers[i]) +break ; + } +if (i == plane->modifier_count) +return false; +/* * The arbitrary tiling support for multiplane formats has not
Quoted 6 lines
been hooked
* up.
--
2.30.1.766.gb4fecdf3b7-goog
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 8 lines · Mark Yacoub
From: Mark Yacoub <[email protected]>
On initializing the framebuffer, call
drm_any_plane_has_formatto do a check if the modifier is supported.drm_any_plane_has_formatcallsdm_plane_format_mod_supportedwhich is extended to validate that the modifier is on the list of the plane's supported modifiers.
Quoted 8 lines
The bug was caught using igt-gpu-tools test: kms_addfb_basic.addfb25-bad-modifier
Tested on ChromeOS Zork by turning on the display, running an overlay test, and running a YT video.
Cc Alex Deucher <[email protected]>Cc Bas Nieuwenhuizen <[email protected]>Signed-off-by default avatarMark Yacoub <[email protected]>
I'm not an expert with modifiers yet. Will this break chips which don't currently support modifiers?
Alex
Quoted 59 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 13 +++++++++++++ drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 9 +++++++++ 2 files changed, 22 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +13
-0@@ -908,6 +908,19 @@ int amdgpu_display_gem_fb_verify_and_init( &amdgpu_fb_funcs);if (ret) goto err; +/* Verify that the modifier is supported. */ +if (!drm_any_plane_has_format (dev, mode_cmd->pixel_format, + mode_cmd->modifier[0 ])) { +struct drm_format_name_buf format_name; +drm_dbg_kms (dev, +"unsupported pixel format %s / modifier 0x%llx\n" , +drm_get_format_name (mode_cmd->pixel_format, + &format_name), + mode_cmd->modifier[0 ]); + + ret = -EINVAL ; + goto err; + } ret =amdgpu_display_framebuffer_init (dev, rfb, mode_cmd, obj);if (ret)drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +9
-1@@ -3939,6 +3939,7 @@ static bool dm_plane_format_mod_supported(struct drm_plane *plane, {struct amdgpu_device *adev =drm_to_adev (plane->dev);const struct drm_format_info *info =drm_format_info (format); +int i;enum dm_micro_swizzle microtile =modifier_gfx9_swizzle_mode (modifier) &3 ;@@ -3952,6 +3953,14 @@ static bool dm_plane_format_mod_supported(struct drm_plane *plane,if (modifier ==DRM_FORMAT_MOD_LINEAR )return true; +/* Check that the modifier is on the list of the plane's supported modifiers. */ +for (i =0 ; i < plane->modifier_count; i++) { +if (modifier == plane->modifiers[i]) +break ; + } +if (i == plane->modifier_count) +return false; +/* * The arbitrary tiling support for multiplane formats has not been hooked * up. -- 2.30.1.766.gb4fecdf3b7-goog
Quoted 4 lines
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 15 lines · Alex Deucher
Quoted 13 lines · Mark Yacoub
From: Mark Yacoub <[email protected]>
On initializing the framebuffer, call
drm_any_plane_has_formatto do a check if the modifier is supported.drm_any_plane_has_formatcallsdm_plane_format_mod_supportedwhich is extended to validate that the modifier is on the list of the plane's supported modifiers.The bug was caught using igt-gpu-tools test: kms_addfb_basic.addfb25-bad-modifier
Tested on ChromeOS Zork by turning on the display, running an overlay test, and running a YT video.
Quoted 6 lines
Quoted 3 lines
Cc Alex Deucher <[email protected]>Cc Bas Nieuwenhuizen <[email protected]>Signed-off-by default avatarMark Yacoub <[email protected]>I'm not an expert with modifiers yet. Will this break chips which don't currently support modifiers?
No it shouldn't. When you don't support modifiers yet, your will default to Linear Modifier (DRM_FORMAT_MOD_LINEAR),
which is later checked in amdgpu_dm.c::dm_plane_format_mod_supported()
/*
* We always have to allow this modifier, because core DRM still
* checks LINEAR support if userspace does not provide modifiers.
*/
if (modifier == DRM_FORMAT_MOD_LINEAR)
return true;Quoted 63 lines
Alex
Quoted 59 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 13 +++++++++++++ drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 9 +++++++++ 2 files changed, 22 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +13
-0@@ -908,6 +908,19 @@ int amdgpu_display_gem_fb_verify_and_init( &amdgpu_fb_funcs);if (ret) goto err; +/* Verify that the modifier is supported. */ +if (!drm_any_plane_has_format (dev, mode_cmd->pixel_format, + mode_cmd->modifier[0 ])) { +struct drm_format_name_buf format_name; +drm_dbg_kms (dev, +"unsupported pixel format %s / modifier 0x%llx\n" , +drm_get_format_name (mode_cmd->pixel_format, + &format_name), + mode_cmd->modifier[0 ]); + + ret = -EINVAL ; + goto err; + } ret =amdgpu_display_framebuffer_init (dev, rfb, mode_cmd, obj);if (ret)drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +9
-1@@ -3939,6 +3939,7 @@ static bool dm_plane_format_mod_supported(struct drm_plane *plane, {struct amdgpu_device *adev =drm_to_adev (plane->dev);const struct drm_format_info *info =drm_format_info (format); +int i;enum dm_micro_swizzle microtile =modifier_gfx9_swizzle_mode (modifier) &3 ;@@ -3952,6 +3953,14 @@ static bool dm_plane_format_mod_supported(struct drm_plane *plane,if (modifier ==DRM_FORMAT_MOD_LINEAR )return true; +/* Check that the modifier is on the list of the plane's supported modifiers. */ +for (i =0 ; i < plane->modifier_count; i++) { +if (modifier == plane->modifiers[i]) +break ; + } +if (i == plane->modifier_count) +return false; +/* * The arbitrary tiling support for multiplane formats has not been hooked * up. -- 2.30.1.766.gb4fecdf3b7-goog
Quoted 4 lines
Quoted 4 lines
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 20 lines · Mark Yacoub
Quoted 19 lines · Alex Deucher
Quoted 16 lines · Mark Yacoub
From: Mark Yacoub <[email protected]>
On initializing the framebuffer, call
drm_any_plane_has_formatto do a check if the modifier is supported.drm_any_plane_has_formatcallsdm_plane_format_mod_supportedwhich is extended to validate that the modifier is on the list of the plane's supported modifiers.The bug was caught using igt-gpu-tools test: kms_addfb_basic.addfb25-bad-modifier
Tested on ChromeOS Zork by turning on the display, running an overlay test, and running a YT video.
Cc Alex Deucher <[email protected]>Cc Bas Nieuwenhuizen <[email protected]>Signed-off-by default avatarMark Yacoub <[email protected]>
Quoted 5 lines
Quoted 2 lines
I'm not an expert with modifiers yet. Will this break chips which don't currently support modifiers?
No it shouldn't. When you don't support modifiers yet, your will default to Linear Modifier (
DRM_FORMAT_MOD_LINEAR), [...]
No modifier support does not imply linear. It's generally signalled via DRM_FORMAT_MOD_INVALID, which roughly means "tiling is determined by driver specific mechanisms".
Signature · 6 lines
Earthling Michel Dänzer | https://redhat.com Libre software enthusiast | Mesa and X developer _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 24 lines · Michel Dänzer
Quoted 1 line · Mark Yacoub
On Tue, Mar 23, 2021 at 11:02 AM Alex Deucher <[email protected]>
Quoted 2 lines · wrote:
Quoted 2 lines
On Wed, Mar 10, 2021 at 11:15 AM Mark Yacoub <[email protected]>
Quoted 9 lines · wrote:
Quoted 9 lines
Quoted 9 lines
From: Mark Yacoub <[email protected]>
On initializing the framebuffer, call
drm_any_plane_has_formatto do a check if the modifier is supported.drm_any_plane_has_formatcallsdm_plane_format_mod_supportedwhich is extended to validate that the modifier is on the list of the plane's supported modifiers.The bug was caught using igt-gpu-tools test:
kms_addfb_basic.addfb25-bad-modifier
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Tested on ChromeOS Zork by turning on the display, running an overlay test, and running a YT video.
Cc Alex Deucher <[email protected]>Cc Bas Nieuwenhuizen <[email protected]>Signed-off-by default avatarMark Yacoub <[email protected]>
Quoted 9 lines
Quoted 5 lines
Quoted 2 lines
I'm not an expert with modifiers yet. Will this break chips which don't currently support modifiers?
No it shouldn't. When you don't support modifiers yet, your will default to Linear Modifier (
DRM_FORMAT_MOD_LINEAR), [...]No modifier support does not imply linear. It's generally signalled via
DRM_FORMAT_MOD_INVALID, which roughly means "tiling is determined by driver specific mechanisms".
Doesn't quite work that way in the kernel sadly. If you don't set DRM_MODE_FB_MODIFIERS then the modifier fields have to be 0 (which happens to alias DRM_FORMAT_MOD_LINEAR and then now deprecated DRM_FORMAT_MOD_NONE). This is verified in shared drm code.
(and all userspace code I've seen simply doesn't set DRM_MODE_FB_MODIFIERS if the incoming modifier is DRM_FORMAT_MOD_INVALID)
Quoted 10 lines
--
Earthling Michel Dänzer | https://redhat.com
Libre software enthusiast | Mesa and X developer
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 7 lines · Bas Nieuwenhuizen
Quoted 4 lines · Michel Dänzer
No modifier support does not imply linear. It's generally signalled via
DRM_FORMAT_MOD_INVALID, which roughly means "tiling is determined by driver specific mechanisms".
Quoted 8 lines
Doesn't quite work that way in the kernel sadly. If you don't set
DRM_MODE_FB_MODIFIERSthen the modifier fields have to be 0 (which happens to aliasDRM_FORMAT_MOD_LINEARand then now deprecatedDRM_FORMAT_MOD_NONE). This is verified in shared drm code.(and all userspace code I've seen simply doesn't set
DRM_MODE_FB_MODIFIERSif the incoming modifier isDRM_FORMAT_MOD_INVALID)
Yes, but even though the field is zero, the lack of the flag means it must be treated as INVALID. If the kernel is not doing this, the kernel is objectively wrong. (And I know it doesn't do this in most cases, because otherwise I wouldn't be able to use this GNOME session on an Intel laptop, where modifiers are blacklisted.)
Cheers,
Daniel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 6 lines · Daniel Stone
Quoted 4 lines · Bas Nieuwenhuizen
Quoted 2 lines · Michel Dänzer
No modifier support does not imply linear. It's generally signalled via
DRM_FORMAT_MOD_INVALID, which roughly means "tiling is determined by driver specific mechanisms".
So you mean it would make more sense to be more explicit in handling DRM_FORMAT_MOD_INVALID as an incoming modifier (which will, just like DRM_FORMAT_MOD_LINEAR, will return true in dm_plane_format_mod_supported)?
Quoted 11 lines
Quoted 5 lines
Doesn't quite work that way in the kernel sadly. If you don't set
DRM_MODE_FB_MODIFIERSthen the modifier fields have to be 0 (which happens to aliasDRM_FORMAT_MOD_LINEARand then now deprecatedDRM_FORMAT_MOD_NONE). This is verified in shared drm code.(and all userspace code I've seen simply doesn't set
DRM_MODE_FB_MODIFIERSif the incoming modifier isDRM_FORMAT_MOD_INVALID)Yes, but even though the field is zero, the lack of the flag means it must be treated as INVALID. If the kernel is not doing this, the kernel is objectively wrong. (And I know it doesn't do this in most cases, because otherwise I wouldn't be able to use this GNOME session on an Intel laptop, where modifiers are blacklisted.)
Cheers,
Daniel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Hi Mark,
Quoted 5 lines · Mark Yacoub
So you mean it would make more sense to be more explicit in handling
DRM_FORMAT_MOD_INVALIDas an incoming modifier (which will, just likeDRM_FORMAT_MOD_LINEAR, will return true indm_plane_format_mod_supported)?
That's correct. Not passing any modifiers is the same as explicitly passing INVALID, both of which mean 'the driver will figure it out somehow'; that driver-specific determination is not the same as explicit LINEAR.
(I cannot regret enough that INVALID is not 0.)
Cheers,
Daniel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 11 lines · Daniel Stone
Hi Mark,
Quoted 5 lines · Mark Yacoub
So you mean it would make more sense to be more explicit in handling
DRM_FORMAT_MOD_INVALIDas an incoming modifier (which will, just likeDRM_FORMAT_MOD_LINEAR, will return true indm_plane_format_mod_supported)?
Quoted 3 lines
That's correct. Not passing any modifiers is the same as explicitly passing INVALID, both of which mean 'the driver will figure it out somehow'; that driver-specific determination is not the same as explicit LINEAR.
(I cannot regret enough that INVALID is not 0.)
I feel you. When I tested it on a board that doesn't support modifiers, the modifier value was Zero. when I checked it, it was basically LINEAR.
I'll amend my changes to explicitly handle INVALID.
Quoted 3 lines
Cheers,
Daniel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 35 lines · Mark Yacoub
From: Mark Yacoub <[email protected]>
On initializing the framebuffer, call
drm_any_plane_has_formatto do a check if the modifier is supported.drm_any_plane_has_formatcallsdm_plane_format_mod_supportedwhich is extended to validate that the modifier is on the list of the plane's supported modifiers.The bug was caught using igt-gpu-tools test:
kms_addfb_basic.addfb25-bad-modifierTested on ChromeOS Zork by turning on the display, running an overlay test, and running a YT video.
Cc Alex Deucher <[email protected]>Cc Bas Nieuwenhuizen <[email protected]>Signed-off-by default avatarMark Yacoub <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 13 +++++++++++++ drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 9 +++++++++ 2 files changed, 22 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +5
-0@@ -908,6 +908,19 @@ int amdgpu_display_gem_fb_verify_and_init( &amdgpu_fb_funcs);if (ret) goto err; +/* Verify that the modifier is supported. */ +if (!drm_any_plane_has_format (dev, mode_cmd->pixel_format, + mode_cmd->modifier[0 ])) { +struct drm_format_name_buf format_name; + drm_dbg_kms(dev,
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c int amdgpu_display_gem_fb_verify_and_init( · line 925
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +8
-0+ "unsupported pixel format %s / modifier 0x%llx\n", + drm_get_format_name(mode_cmd->pixel_format, + &format_name), + mode_cmd->modifier[0]); + + ret = -EINVAL ; + goto err; + }
Why is this needed?
Quoted 25 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +0
-0ret =amdgpu_display_framebuffer_init (dev, rfb, mode_cmd, obj);if (ret)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1
-0@@ -3939,6 +3939,7 @@ static bool dm_plane_format_mod_supported(struct drm_plane *plane, {struct amdgpu_device *adev =drm_to_adev (plane->dev);const struct drm_format_info *info =drm_format_info (format); +int i; enum dm_micro_swizzle microtile =
modifier_gfx9_swizzle_mode(modifier)& 3;drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1
-0@@ -3952,6 +3953,14 @@ static bool dm_plane_format_mod_supported(struct drm_plane *plane, if (modifier == DRM_FORMAT_MOD_LINEAR)return true; +/* Check that the modifier is on the list of the plane's supported modifiers. */
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c static bool dm_plane_format_mod_supported(struct drm_plane *plane, · line 3963
Quoted 7 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +7
-0+for (i =0 ; i < plane->modifier_count; i++) { +if (modifier == plane->modifiers[i]) +break ; + } +if (i == plane->modifier_count) +return false; +
This part seems fine by me.
Quoted 8 lines
/*
* The arbitrary tiling support for multiplane formats has not
been hooked
* up.
--
2.30.1.766.gb4fecdf3b7-goog
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 41 lines · Bas Nieuwenhuizen
Quoted 37 lines · Mark Yacoub
From: Mark Yacoub <[email protected]>
On initializing the framebuffer, call
drm_any_plane_has_formatto do a check if the modifier is supported.drm_any_plane_has_formatcallsdm_plane_format_mod_supportedwhich is extended to validate that the modifier is on the list of the plane's supported modifiers.The bug was caught using igt-gpu-tools test: kms_addfb_basic.addfb25-bad-modifier
Tested on ChromeOS Zork by turning on the display, running an overlay test, and running a YT video.
Cc Alex Deucher <[email protected]>Cc Bas Nieuwenhuizen <[email protected]>Signed-off-by default avatarMark Yacoub <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 13 +++++++++++++ drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 9 +++++++++ 2 files changed, 22 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +8
-0@@ -908,6 +908,19 @@ int amdgpu_display_gem_fb_verify_and_init( &amdgpu_fb_funcs);if (ret) goto err; +/* Verify that the modifier is supported. */ +if (!drm_any_plane_has_format (dev, mode_cmd->pixel_format, + mode_cmd->modifier[0 ])) { +struct drm_format_name_buf format_name; + drm_dbg_kms(dev, + "unsupported pixel format %s / modifier 0x%llx\n", + drm_get_format_name(mode_cmd->pixel_format, + &format_name),
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c int amdgpu_display_gem_fb_verify_and_init( · line 923
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +5
-0+ mode_cmd->modifier[0]); + + ret = -EINVAL ; + goto err; + }Why is this needed?
This is the function that initiates the check for modifiers. Inside it we call plane->funcs->format_mod_supported which is implemented as dm_plane_format_mod_supported in amdgpu_dm.c, modified below as well.
Quoted 20 lines
Quoted 20 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +0
-0ret =amdgpu_display_framebuffer_init (dev, rfb, mode_cmd, obj);if (ret)drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1
-0@@ -3939,6 +3939,7 @@ static bool dm_plane_format_mod_supported(struct drm_plane *plane, {struct amdgpu_device *adev =drm_to_adev (plane->dev);const struct drm_format_info *info =drm_format_info (format); +int i;enum dm_micro_swizzle microtile =modifier_gfx9_swizzle_mode (modifier) &3 ;@@ -3952,6 +3953,14 @@ static bool dm_plane_format_mod_supported(struct drm_plane *plane,if (modifier ==DRM_FORMAT_MOD_LINEAR )return true;
Quoted 18 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c static bool dm_plane_format_mod_supported(struct drm_plane *plane, · line 3963
Quoted 8 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +8
-0+/* Check that the modifier is on the list of the plane's supported modifiers. */ +for (i =0 ; i < plane->modifier_count; i++) { +if (modifier == plane->modifiers[i]) +break ; + } +if (i == plane->modifier_count) +return false; +This part seems fine by me.
Quoted 7 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +0
-1/* * The arbitrary tiling support for multiplane formats has not been hooked * up. -- 2.30.1.766.gb4fecdf3b7-goog
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel