Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/ast: Handle framebuffer from dma-buf

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>

+8 -3
+8 -3
drivers/gpu/drm/ast/ast_mode.c
··· 557 557 ast_set_vbios_color_reg(ast, fb->format, ast_crtc_state->vmode); 558 558 } 559 559 560 - drm_atomic_helper_damage_iter_init(&iter, old_plane_state, plane_state); 561 - drm_atomic_for_each_plane_damage(&iter, &damage) { 562 - ast_handle_damage(ast_plane, shadow_plane_state->data, fb, &damage); 560 + /* if the buffer comes from another device */ 561 + if (drm_gem_fb_begin_cpu_access(fb, DMA_FROM_DEVICE) == 0) { 562 + drm_atomic_helper_damage_iter_init(&iter, old_plane_state, plane_state); 563 + drm_atomic_for_each_plane_damage(&iter, &damage) { 564 + ast_handle_damage(ast_plane, shadow_plane_state->data, fb, &damage); 565 + } 566 + 567 + drm_gem_fb_end_cpu_access(fb, DMA_FROM_DEVICE); 563 568 } 564 569 565 570 /*