From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7B9DA28E24 for ; Fri, 24 Nov 2023 13:52:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="vt5sYK7O" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8228FC433C8; Fri, 24 Nov 2023 13:52:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1700833938; bh=Ligcp4EVHJsDLRsMP0SeSXk3s9BRFRGJoYJJqNocnJo=; h=Subject:To:Cc:From:Date:From; b=vt5sYK7OsQmD+C/bSjvc57FmNZJOwwBoKXRbhMrQXKuqHmdiZ8LkQwqf7s5K6PIQa iVYYM74zZs8FrTTuv1B8PuRIRbgElvId791AgLJShUFKQ/6GDjTzTU8q5XF9KoZ09/ Vt7rgvrmHysoFYFWf9kemTwvFtcQgiAmKaM1YucI= Subject: FAILED: patch "[PATCH] drm/amdgpu: register a dirty framebuffer callback for fbcon" failed to apply to 6.5-stable tree To: hamza.mahfooz@amd.com,alexander.deucher@amd.com,aurabindo.pillai@amd.com,mario.limonciello@amd.com Cc: From: Date: Fri, 24 Nov 2023 13:52:08 +0000 Message-ID: <2023112408-impulsive-mammary-e971@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit The patch below does not apply to the 6.5-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.5.y git checkout FETCH_HEAD git cherry-pick -x 1c6b6bd0780f2f9e460567c4ccf1d69c3fb212cf # git commit -s git send-email --to '' --in-reply-to '2023112408-impulsive-mammary-e971@gregkh' --subject-prefix 'PATCH 6.5.y' HEAD^.. Possible dependencies: 1c6b6bd0780f ("drm/amdgpu: register a dirty framebuffer callback for fbcon") thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 1c6b6bd0780f2f9e460567c4ccf1d69c3fb212cf Mon Sep 17 00:00:00 2001 From: Hamza Mahfooz Date: Tue, 15 Aug 2023 09:13:37 -0400 Subject: [PATCH] drm/amdgpu: register a dirty framebuffer callback for fbcon fbcon requires that we implement &drm_framebuffer_funcs.dirty. Otherwise, the framebuffer might take a while to flush (which would manifest as noticeable lag). However, we can't enable this callback for non-fbcon cases since it may cause too many atomic commits to be made at once. So, implement amdgpu_dirtyfb() and only enable it for fbcon framebuffers (we can use the "struct drm_file file" parameter in the callback to check for this since it is only NULL when called by fbcon, at least in the mainline kernel) on devices that support atomic KMS. Cc: Aurabindo Pillai Cc: Mario Limonciello Cc: stable@vger.kernel.org # 6.1+ Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2519 Reviewed-by: Mario Limonciello Signed-off-by: Hamza Mahfooz Signed-off-by: Alex Deucher diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c index d20dd3f852fc..363e6a2cad8c 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c @@ -38,6 +38,8 @@ #include #include #include +#include +#include #include #include #include @@ -532,11 +534,29 @@ bool amdgpu_display_ddc_probe(struct amdgpu_connector *amdgpu_connector, return true; } +static int amdgpu_dirtyfb(struct drm_framebuffer *fb, struct drm_file *file, + unsigned int flags, unsigned int color, + struct drm_clip_rect *clips, unsigned int num_clips) +{ + + if (file) + return -ENOSYS; + + return drm_atomic_helper_dirtyfb(fb, file, flags, color, clips, + num_clips); +} + static const struct drm_framebuffer_funcs amdgpu_fb_funcs = { .destroy = drm_gem_fb_destroy, .create_handle = drm_gem_fb_create_handle, }; +static const struct drm_framebuffer_funcs amdgpu_fb_funcs_atomic = { + .destroy = drm_gem_fb_destroy, + .create_handle = drm_gem_fb_create_handle, + .dirty = amdgpu_dirtyfb +}; + uint32_t amdgpu_display_supported_domains(struct amdgpu_device *adev, uint64_t bo_flags) { @@ -1139,7 +1159,11 @@ static int amdgpu_display_gem_fb_verify_and_init(struct drm_device *dev, if (ret) goto err; - ret = drm_framebuffer_init(dev, &rfb->base, &amdgpu_fb_funcs); + if (drm_drv_uses_atomic_modeset(dev)) + ret = drm_framebuffer_init(dev, &rfb->base, + &amdgpu_fb_funcs_atomic); + else + ret = drm_framebuffer_init(dev, &rfb->base, &amdgpu_fb_funcs); if (ret) goto err;