~emersion/linux

6d69a0cef868ded2d2ab92e78e12fe52004c7697 — Simon Ser 2 years ago 1ee16c7 cursor-plane-linear
drm/amd: reject addfb2 for buffers without the scanout flag

It doesn't make sense to allow adding FBs that can't be scanned out.
Reject them at the addfb2 stage.

Signed-off-by: Simon Ser <contact@emersion.fr>
References: https://gitlab.freedesktop.org/drm/amd/-/issues/1390
Cc: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Harry Wentland <hwentlan@amd.com>
Cc: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
1 files changed, 5 insertions(+), 1 deletions(-)

M drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
M drivers/gpu/drm/amd/amdgpu/amdgpu_display.c => drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +5 -1
@@ 679,7 679,11 @@ static int convert_tiling_flags_to_modifier(struct amdgpu_framebuffer *afb)
	struct amdgpu_device *adev = drm_to_adev(afb->base.dev);
	uint64_t modifier = 0;

	if (!afb->tiling_flags || !AMDGPU_TILING_GET(afb->tiling_flags, SWIZZLE_MODE)) {
	if (!AMDGPU_TILING_GET(afb->tiling_flags, SCANOUT)) {
		return -EINVAL;
	}

	if (!AMDGPU_TILING_GET(afb->tiling_flags, SWIZZLE_MODE)) {
		modifier = DRM_FORMAT_MOD_LINEAR;
	} else {
		int swizzle = AMDGPU_TILING_GET(afb->tiling_flags, SWIZZLE_MODE);