mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-23 14:02:06 -04:00
drm/amdgpu: Ensure that the modifier requested is supported by plane.
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. === Changes from v1 === Explicitly handle DRM_FORMAT_MOD_INVALID modifier. Cc: Alex Deucher <alexander.deucher@amd.com> Cc: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl> Signed-off-by: Mark Yacoub <markyacoub@chromium.org> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
committed by
Alex Deucher
parent
a9ca9bb3af
commit
f4a9be998c
@@ -4210,6 +4210,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;
|
||||
|
||||
@@ -4217,11 +4218,22 @@ static bool dm_plane_format_mod_supported(struct drm_plane *plane,
|
||||
return false;
|
||||
|
||||
/*
|
||||
* We always have to allow this modifier, because core DRM still
|
||||
* checks LINEAR support if userspace does not provide modifers.
|
||||
* We always have to allow these modifiers:
|
||||
* 1. Core DRM checks for LINEAR support if userspace does not provide modifiers.
|
||||
* 2. Not passing any modifiers is the same as explicitly passing INVALID.
|
||||
*/
|
||||
if (modifier == DRM_FORMAT_MOD_LINEAR)
|
||||
if (modifier == DRM_FORMAT_MOD_LINEAR ||
|
||||
modifier == DRM_FORMAT_MOD_INVALID) {
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user