]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/ast: Handle framebuffer from dma-buf
authorJocelyn Falempe <jfalempe@redhat.com>
Thu, 30 Oct 2025 09:14:11 +0000 (10:14 +0100)
committerJocelyn Falempe <jfalempe@redhat.com>
Mon, 10 Nov 2025 15:02:13 +0000 (16:02 +0100)
In the atomic update callback, ast should call
drm_gem_fb_begin_cpu_access() to make sure it can read the
framebuffer from the CPU, otherwise the data might not be there due
to cache, and synchronization.

Tested on a Lenovo SE100, while rendering on the ArrowLake GPU with
i915 driver, and using ast for display.

Suggested-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patch.msgid.link/20251030091627.340780-1-jfalempe@redhat.com
Signed-off-by: Jocelyn Falempe <jfalempe@redhat.com>
drivers/gpu/drm/ast/ast_mode.c

index de7b6294ce40d72922e503a1ec7593cfe781f1f6..cd08990a10f936ae56fd9806bb2e20e3106db8af 100644 (file)
@@ -557,9 +557,14 @@ static void ast_primary_plane_helper_atomic_update(struct drm_plane *plane,
                ast_set_vbios_color_reg(ast, fb->format, ast_crtc_state->vmode);
        }
 
-       drm_atomic_helper_damage_iter_init(&iter, old_plane_state, plane_state);
-       drm_atomic_for_each_plane_damage(&iter, &damage) {
-               ast_handle_damage(ast_plane, shadow_plane_state->data, fb, &damage);
+       /* if the buffer comes from another device */
+       if (drm_gem_fb_begin_cpu_access(fb, DMA_FROM_DEVICE) == 0) {
+               drm_atomic_helper_damage_iter_init(&iter, old_plane_state, plane_state);
+               drm_atomic_for_each_plane_damage(&iter, &damage) {
+                       ast_handle_damage(ast_plane, shadow_plane_state->data, fb, &damage);
+               }
+
+               drm_gem_fb_end_cpu_access(fb, DMA_FROM_DEVICE);
        }
 
        /*