drm/i915/dmabuf: Flush the cache in vmap
Jocelyn Falempe
reviewerPATCH 1/1 drm/i915/dmabuf: Flush the cache in vmap
On a lenovo se100 server, when using i915 GPU for rendering, and the ast driver for display, the graphic output is corrupted, and almost unusable.
Adding a clflush call in the vmap function fixes this issue completely.
--- drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c +1 -0
@@ -77,6 +77,7 @@ static int i915_gem_dmabuf_vmap(struct dma_buf *dma_buf,return PTR_ERR (vaddr);iosys_map_set_vaddr (map, vaddr); +drm_clflush_virt_range (vaddr, dma_buf->size);return 0 ; }
base-commit: 0790925dadad0997580df6e32cdccd54316807f2
Signature · 1 line
2.51.0
Tvrtko Ursulin
maintainerQuoted 6 lines · Jocelyn Falempe
On a lenovo se100 server, when using i915 GPU for rendering, and the ast driver for display, the graphic output is corrupted, and almost unusable.
Adding a clflush call in the vmap function fixes this issue completely.
AST is importing i915 allocated buffer in this use case, or how exactly is the relationship?
Wondering if some path is not calling dma_buf_begin/end_cpu_access().
Regards,
Tvrtko
Quoted 20 lines
Signed-off-by Jocelyn Falempe <[email protected]>--- drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c | 1 + 1 file changed, 1 insertion(+)drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c +1
-0@@ -77,6 +77,7 @@ static int i915_gem_dmabuf_vmap(struct dma_buf *dma_buf,return PTR_ERR (vaddr);iosys_map_set_vaddr (map, vaddr); +drm_clflush_virt_range (vaddr, dma_buf->size);return 0 ; }base-commit:
0790925dadad0997580df6e32cdccd54316807f2
Thomas Zimmermann
maintainerHi
Am 24.10.25 um 13:53 schrieb Tvrtko Ursulin:
Quoted 6 lines · Jocelyn Falempe
Quoted 4 lines
On a lenovo se100 server, when using i915 GPU for rendering, and the ast driver for display, the graphic output is corrupted, and almost unusable.
Quoted 6 lines
Quoted 2 lines
Adding a clflush call in the vmap function fixes this issue completely.
AST is importing i915 allocated buffer in this use case, or how exactly is the relationship?
Wondering if some path is not calling dma_buf_begin/end_cpu_access().
Yes, ast doesn't call begin/end_cpu_access in [1].
Jocelyn, if that fixes the issue, feel free to send me a patch for review.
[1] https://elixir.bootlin.com/linux/v6.17.4/source/drivers/gpu/drm/ast/ast_mode.c
Best regards
Thomas
Quoted 25 lines
Regards,
Tvrtko
Quoted 19 lines
Signed-off-by Jocelyn Falempe <[email protected]>---
drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c| 1 +1 file changed, 1 insertion(+)drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c +1
-0@@ -77,6 +77,7 @@ static int i915_gem_dmabuf_vmap(struct dma_buf *dma_buf, return PTR_ERR(vaddr); iosys_map_set_vaddr(map, vaddr); + drm_clflush_virt_range(vaddr, dma_buf->size); return 0; }base-commit:
0790925dadad0997580df6e32cdccd54316807f2
Signature · 7 lines
-- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Frankenstrasse 146, 90461 Nuernberg, Germany GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman HRB 36809 (AG Nuernberg)
Jocelyn Falempe
reviewerQuoted 14 lines · Thomas Zimmermann
Hi
Am 24.10.25 um 13:53 schrieb Tvrtko Ursulin:
Quoted 11 lines · Jocelyn Falempe
Quoted 6 lines
On a lenovo se100 server, when using i915 GPU for rendering, and the ast driver for display, the graphic output is corrupted, and almost unusable.
Adding a clflush call in the vmap function fixes this issue completely.
AST is importing i915 allocated buffer in this use case, or how exactly is the relationship?
Quoted 7 lines
Quoted 1 line
Wondering if some path is not calling dma_buf_begin/end_cpu_access().
Yes, ast doesn't call begin/end_cpu_access in [1].
Jocelyn, if that fixes the issue, feel free to send me a patch for review.
[1] https://elixir.bootlin.com/linux/v6.17.4/source/drivers/gpu/drm/ast/
ast_mode.c
I tried the following patch, but that doesn't fix the graphical issue:
drivers/gpu/drm/ast/ast_mode.c +0 -0
@@ -564,6 +564,7 @@ static void ast_primary_plane_helper_atomic_update(struct drm_plane *plane, struct drm_crtc_state *crtc_state =
drm_atomic_get_new_crtc_state(state, crtc);
struct drm_rect damage;
struct drm_atomic_helper_damage_iter iter;+ int ret;
if (!old_fb || (fb->format != old_fb->format) ||
crtc_state->mode_changed) {
struct ast_crtc_state *ast_crtc_state =to_ast_crtc_state(crtc_state);
@@ -572,11 +573,16 @@ static void ast_primary_plane_helper_atomic_update(struct drm_plane *plane,
ast_set_vbios_color_reg(ast, fb->format,
ast_crtc_state->vmode);
}+ ret = drm_gem_fb_begin_cpu_access(fb, DMA_FROM_DEVICE);
+ pr_info("AST begin_cpu_access %d\n", ret);
+
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);
+
/*
* Some BMCs stop scanning out the video signal after the driver
* reprogrammed the offset. This stalls display output for several
Best regards,
Signature · 1 line
Jocelyn
Quoted 30 lines
Best regards
ThomasQuoted 25 lines
Regards,
Tvrtko
Quoted 19 lines
Signed-off-by Jocelyn Falempe <[email protected]>---
drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c| 1 +1 file changed, 1 insertion(+)drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c +1
-0@@ -77,6 +77,7 @@ static int i915_gem_dmabuf_vmap(struct dma_buf *dma_buf, return PTR_ERR(vaddr); iosys_map_set_vaddr(map, vaddr); + drm_clflush_virt_range(vaddr, dma_buf->size); return 0; }base-commit:
0790925dadad0997580df6e32cdccd54316807f2
Thomas Zimmermann
maintainerHi
Am 24.10.25 um 15:33 schrieb Jocelyn Falempe:
Quoted 39 lines · Thomas Zimmermann
Quoted 14 lines
Hi
Am 24.10.25 um 13:53 schrieb Tvrtko Ursulin:
Quoted 11 lines · Jocelyn Falempe
Quoted 6 lines
On a lenovo se100 server, when using i915 GPU for rendering, and the ast driver for display, the graphic output is corrupted, and almost unusable.
Adding a clflush call in the vmap function fixes this issue completely.
AST is importing i915 allocated buffer in this use case, or how exactly is the relationship?
Quoted 7 lines
Quoted 1 line
Wondering if some path is not calling dma_buf_begin/end_cpu_access().
Yes, ast doesn't call begin/end_cpu_access in [1].
Jocelyn, if that fixes the issue, feel free to send me a patch for review.
[1] https://elixir.bootlin.com/linux/v6.17.4/source/drivers/gpu/drm/ast/
ast_mode.cI tried the following patch, but that doesn't fix the graphical issue:
drivers/gpu/drm/ast/ast_mode.c +1
-0@@ -564,6 +564,7 @@ static void ast_primary_plane_helper_atomic_update(struct drm_plane *plane, struct drm_crtc_state *crtc_state = drm_atomic_get_new_crtc_state(state, crtc); struct drm_rect damage; struct drm_atomic_helper_damage_iter iter; + int ret; if (!old_fb || (fb->format != old_fb->format) || crtc_state->mode_changed) {struct
ast_crtc_state*ast_crtc_state=to_ast_crtc_state(crtc_state);
drivers/gpu/drm/ast/ast_mode.c static void · line 578
Quoted 6 lines
drivers/gpu/drm/ast/ast_mode.c +2
-0@@ -572,11 +573,16 @@ static void ast_primary_plane_helper_atomic_update(struct drm_plane *plane, ast_set_vbios_color_reg(ast, fb->format, ast_crtc_state->vmode); } + ret = drm_gem_fb_begin_cpu_access(fb, DMA_FROM_DEVICE); + pr_info("AST begin_cpu_access %d\n", ret);
Presumably, you end up in [1]. I cannot find the cflush there or in [2]. Maybe you need to add this call somewhere in there, similar to [3]. Just guessing.
Best regards
Thomas
[1] https://elixir.bootlin.com/linux/v6.17.4/source/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c#L117
[2] https://elixir.bootlin.com/linux/v6.17.4/source/drivers/gpu/drm/i915/gem/i915_gem_domain.c#L493
[3] https://elixir.bootlin.com/linux/v6.17.4/source/drivers/gpu/drm/i915/gem/i915_gem_object.c#L509
Quoted 16 lines
drivers/gpu/drm/ast/ast_mode.c +3
-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); + /** Some BMCs stop scanning out the video signal after the driver * reprogrammed the offset. This stalls display output for several
Best regards,
Signature · 7 lines
-- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Frankenstrasse 146, 90461 Nuernberg, Germany GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman HRB 36809 (AG Nuernberg)
Tvrtko Ursulin
maintainerQuoted 47 lines · Thomas Zimmermann
Hi
Am 24.10.25 um 15:33 schrieb Jocelyn Falempe:
Quoted 44 lines · Thomas Zimmermann
Quoted 14 lines
Hi
Am 24.10.25 um 13:53 schrieb Tvrtko Ursulin:
Quoted 11 lines · Jocelyn Falempe
Quoted 6 lines
On a lenovo se100 server, when using i915 GPU for rendering, and the ast driver for display, the graphic output is corrupted, and almost unusable.
Adding a clflush call in the vmap function fixes this issue completely.
AST is importing i915 allocated buffer in this use case, or how exactly is the relationship?
Quoted 7 lines
Quoted 1 line
Wondering if some path is not calling dma_buf_begin/end_cpu_access().
Yes, ast doesn't call begin/end_cpu_access in [1].
Jocelyn, if that fixes the issue, feel free to send me a patch for review.
[1] https://elixir.bootlin.com/linux/v6.17.4/source/drivers/gpu/drm/ ast/
ast_mode.cI tried the following patch, but that doesn't fix the graphical issue:
drivers/gpu/drm/ast/ast_mode.c +1
-0@@ -564,6 +564,7 @@ static void ast_primary_plane_helper_atomic_update(struct drm_plane *plane, struct drm_crtc_state *crtc_state = drm_atomic_get_new_crtc_state(state, crtc); struct drm_rect damage; struct drm_atomic_helper_damage_iter iter; + int ret;if (!old_fb || (
fb->format!=old_fb->format) || crtc_state-Quoted 1 line
mode_changed) {struct
ast_crtc_state*ast_crtc_state=to_ast_crtc_state(crtc_state);drivers/gpu/drm/ast/ast_mode.c +0
-0@@ -572,11 +573,16 @@ static void ast_primary_plane_helper_atomic_update(struct drm_plane *plane, ast_set_vbios_color_reg(ast, fb->format, ast_crtc_state->vmode); }
Quoted 4 lines
drivers/gpu/drm/ast/ast_mode.c static void · line 578
Quoted 2 lines
drivers/gpu/drm/ast/ast_mode.c +2
-0+ ret = drm_gem_fb_begin_cpu_access(fb, DMA_FROM_DEVICE); + pr_info("AST begin_cpu_access %d\n", ret);Presumably, you end up in [1]. I cannot find the cflush there or in [2]. Maybe you need to add this call somewhere in there, similar to [3]. Just guessing.
Near [2] clflush can happen at [4] *if* the driver thinks it is needed. Most GPUs are cache coherent so mostly it isn't. But if this is a Meteorlake machine (when I google Lenovo se100 it makes me think so?) then the userspace has some responsibility to manage things since there it is only 1-way coherency. Or userspace could have even told the driver to stay off in which case it then needs to manage everything. From the top of my head I am not sure how exactly this used to work, or how it is supposed to interact with exported buffers.
If this is indeed on Meteorlake, maybe Joonas or Rodrigo remember better how the special 1-way coherency is supposed to be managed there?
Regards,
Tvrtko
[4] https://elixir.bootlin.com/linux/v6.17.4/source/drivers/gpu/drm/i915/gem/i915_gem_domain.c#L510
Quoted 21 lines
[1] https://elixir.bootlin.com/linux/v6.17.4/source/drivers/gpu/drm/ i915/gem/i915_gem_dmabuf.c#L117
[2] https://elixir.bootlin.com/linux/v6.17.4/source/drivers/gpu/drm/ i915/gem/i915_gem_domain.c#L493
[3] https://elixir.bootlin.com/linux/v6.17.4/source/drivers/gpu/drm/ i915/gem/i915_gem_object.c#L509Quoted 16 lines
drivers/gpu/drm/ast/ast_mode.c +3
-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); + /** Some BMCs stop scanning out the video signal after the driver * reprogrammed the offset. This stalls display output for several
Best regards,
Jocelyn Falempe
reviewerQuoted 49 lines · Tvrtko Ursulin
Quoted 47 lines · Thomas Zimmermann
Hi
Am 24.10.25 um 15:33 schrieb Jocelyn Falempe:
Quoted 44 lines · Thomas Zimmermann
Quoted 14 lines
Hi
Am 24.10.25 um 13:53 schrieb Tvrtko Ursulin:
Quoted 11 lines · Jocelyn Falempe
Quoted 6 lines
On a lenovo se100 server, when using i915 GPU for rendering, and the ast driver for display, the graphic output is corrupted, and almost unusable.
Adding a clflush call in the vmap function fixes this issue completely.
AST is importing i915 allocated buffer in this use case, or how exactly is the relationship?
Quoted 7 lines
Quoted 1 line
Wondering if some path is not calling dma_buf_begin/end_cpu_access().
Yes, ast doesn't call begin/end_cpu_access in [1].
Jocelyn, if that fixes the issue, feel free to send me a patch for review.
[1] https://elixir.bootlin.com/linux/v6.17.4/source/drivers/gpu/drm/ ast/
ast_mode.cI tried the following patch, but that doesn't fix the graphical issue:
drivers/gpu/drm/ast/ast_mode.c +1
-0@@ -564,6 +564,7 @@ static void ast_primary_plane_helper_atomic_update(struct drm_plane *plane, struct drm_crtc_state *crtc_state = drm_atomic_get_new_crtc_state(state, crtc); struct drm_rect damage; struct drm_atomic_helper_damage_iter iter; + int ret;if (!old_fb || (
fb->format!=old_fb->format) || crtc_state-Quoted 1 line
mode_changed) {struct
ast_crtc_state*ast_crtc_state=to_ast_crtc_state(crtc_state);drivers/gpu/drm/ast/ast_mode.c +0
-0@@ -572,11 +573,16 @@ static void ast_primary_plane_helper_atomic_update(struct drm_plane *plane, ast_set_vbios_color_reg(ast, fb->format, ast_crtc_state->vmode); }
Quoted 8 lines
Quoted 4 lines
drivers/gpu/drm/ast/ast_mode.c static void · line 578
Quoted 2 lines
drivers/gpu/drm/ast/ast_mode.c +2
-0+ ret = drm_gem_fb_begin_cpu_access(fb, DMA_FROM_DEVICE); + pr_info("AST begin_cpu_access %d\n", ret);Presumably, you end up in [1]. I cannot find the cflush there or in [2]. Maybe you need to add this call somewhere in there, similar to [3]. Just guessing.
Near [2] clflush can happen at [4] *if* the driver thinks it is needed. Most GPUs are cache coherent so mostly it isn't. But if this is a Meteorlake machine (when I google Lenovo se100 it makes me think so?) then the userspace has some responsibility to manage things since there it is only 1-way coherency. Or userspace could have even told the driver to stay off in which case it then needs to manage everything. From the top of my head I am not sure how exactly this used to work, or how it is supposed to interact with exported buffers.
If this is indeed on Meteorlake, maybe Joonas or Rodrigo remember better how the special 1-way coherency is supposed to be managed there?
CPU is Intel(R) Core(TM) Ultra 5 225H
lspci says Arrow Lake for the GPU:
00:02.0 VGA compatible controller: Intel Corporation Arrow Lake-P [Intel Graphics] (rev 03)
But some other PCI devices says Meteor Lake:
00:0a.0 Signal processing controller: Intel Corporation Meteor Lake-P Platform Monitoring Technology (rev 01) 00:0b.0 Processing accelerators: Intel Corporation Meteor Lake NPU (rev 05)
Thanks a lot for helping on this.
Best regards,
Signature · 1 line
Jocelyn
Quoted 30 lines
Regards,
Tvrtko
[4] https://elixir.bootlin.com/linux/v6.17.4/source/drivers/gpu/drm/ i915/gem/i915_gem_domain.c#L510
Quoted 22 lines
[1] https://elixir.bootlin.com/linux/v6.17.4/source/drivers/gpu/drm/ i915/gem/i915_gem_dmabuf.c#L117
[2] https://elixir.bootlin.com/linux/v6.17.4/source/drivers/gpu/drm/ i915/gem/i915_gem_domain.c#L493
[3] https://elixir.bootlin.com/linux/v6.17.4/source/drivers/gpu/drm/ i915/gem/i915_gem_object.c#L509Quoted 17 lines
drivers/gpu/drm/ast/ast_mode.c +1
-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-
Quoted 1 line
data, fb, &damage);
}
+
drm_gem_fb_end_cpu_access(fb, DMA_FROM_DEVICE);
+
/*
* Some BMCs stop scanning out the video signal after the driver
* reprogrammed the offset. This stalls display output for severalBest regards,
Jocelyn Falempe
reviewerQuoted 49 lines · Tvrtko Ursulin
Quoted 47 lines · Thomas Zimmermann
Hi
Am 24.10.25 um 15:33 schrieb Jocelyn Falempe:
Quoted 44 lines · Thomas Zimmermann
Quoted 14 lines
Hi
Am 24.10.25 um 13:53 schrieb Tvrtko Ursulin:
Quoted 11 lines · Jocelyn Falempe
Quoted 6 lines
On a lenovo se100 server, when using i915 GPU for rendering, and the ast driver for display, the graphic output is corrupted, and almost unusable.
Adding a clflush call in the vmap function fixes this issue completely.
AST is importing i915 allocated buffer in this use case, or how exactly is the relationship?
Quoted 7 lines
Quoted 1 line
Wondering if some path is not calling dma_buf_begin/end_cpu_access().
Yes, ast doesn't call begin/end_cpu_access in [1].
Jocelyn, if that fixes the issue, feel free to send me a patch for review.
[1] https://elixir.bootlin.com/linux/v6.17.4/source/drivers/gpu/drm/ ast/
ast_mode.cI tried the following patch, but that doesn't fix the graphical issue:
drivers/gpu/drm/ast/ast_mode.c +1
-0@@ -564,6 +564,7 @@ static void ast_primary_plane_helper_atomic_update(struct drm_plane *plane, struct drm_crtc_state *crtc_state = drm_atomic_get_new_crtc_state(state, crtc); struct drm_rect damage; struct drm_atomic_helper_damage_iter iter; + int ret;if (!old_fb || (
fb->format!=old_fb->format) || crtc_state-Quoted 1 line
mode_changed) {struct
ast_crtc_state*ast_crtc_state=to_ast_crtc_state(crtc_state);drivers/gpu/drm/ast/ast_mode.c +0
-0@@ -572,11 +573,16 @@ static void ast_primary_plane_helper_atomic_update(struct drm_plane *plane, ast_set_vbios_color_reg(ast, fb->format, ast_crtc_state->vmode); }
Quoted 8 lines
Quoted 4 lines
drivers/gpu/drm/ast/ast_mode.c static void · line 578
Quoted 2 lines
drivers/gpu/drm/ast/ast_mode.c +2
-0+ ret = drm_gem_fb_begin_cpu_access(fb, DMA_FROM_DEVICE); + pr_info("AST begin_cpu_access %d\n", ret);Presumably, you end up in [1]. I cannot find the cflush there or in [2]. Maybe you need to add this call somewhere in there, similar to [3]. Just guessing.
Near [2] clflush can happen at [4] *if* the driver thinks it is needed. Most GPUs are cache coherent so mostly it isn't. But if this is a Meteorlake machine (when I google Lenovo se100 it makes me think so?) then the userspace has some responsibility to manage things since there it is only 1-way coherency. Or userspace could have even told the driver to stay off in which case it then needs to manage everything. From the top of my head I am not sure how exactly this used to work, or how it is supposed to interact with exported buffers.
If this is indeed on Meteorlake, maybe Joonas or Rodrigo remember better how the special 1-way coherency is supposed to be managed there?
I've made an experiment, and if I add:
* a calls to drm_gem_fb_begin_cpu_access() in the ast driver.
* and in i915_gem_domain.c flush_write_domain():
case I915_GEM_DOMAIN_RENDER:
+ i915_gem_clflush_object(obj, I915_CLFLUSH_SYNC | I915_CLFLUSH_FORCE);
Then that fixes the issue too.
So I think there are two things to fix:
* The missing call to drm_gem_fb_begin_cpu_access() in ast.
* The missing cache flush in i915 for the Arrowlake iGPU (but probably
not the way I've done it).
Regards,
Signature · 1 line
Jocelyn
Quoted 30 lines
Regards,
Tvrtko
[4] https://elixir.bootlin.com/linux/v6.17.4/source/drivers/gpu/drm/ i915/gem/i915_gem_domain.c#L510
Quoted 22 lines
[1] https://elixir.bootlin.com/linux/v6.17.4/source/drivers/gpu/drm/ i915/gem/i915_gem_dmabuf.c#L117
[2] https://elixir.bootlin.com/linux/v6.17.4/source/drivers/gpu/drm/ i915/gem/i915_gem_domain.c#L493
[3] https://elixir.bootlin.com/linux/v6.17.4/source/drivers/gpu/drm/ i915/gem/i915_gem_object.c#L509Quoted 17 lines
drivers/gpu/drm/ast/ast_mode.c +1
-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-
Quoted 1 line
data, fb, &damage);
}
+
drm_gem_fb_end_cpu_access(fb, DMA_FROM_DEVICE);
+
/*
* Some BMCs stop scanning out the video signal after the driver
* reprogrammed the offset. This stalls display output for severalBest regards,
Thomas Zimmermann
maintainerHi
Am 27.10.25 um 10:46 schrieb Jocelyn Falempe:
Quoted 66 lines · Tvrtko Ursulin
Quoted 48 lines · Thomas Zimmermann
Quoted 46 lines
Hi
Am 24.10.25 um 15:33 schrieb Jocelyn Falempe:
Quoted 43 lines · Thomas Zimmermann
Quoted 14 lines
Hi
Am 24.10.25 um 13:53 schrieb Tvrtko Ursulin:
Quoted 11 lines · Jocelyn Falempe
Quoted 6 lines
On a lenovo se100 server, when using i915 GPU for rendering, and the ast driver for display, the graphic output is corrupted, and almost unusable.
Adding a clflush call in the vmap function fixes this issue completely.
AST is importing i915 allocated buffer in this use case, or how exactly is the relationship?
Quoted 7 lines
Quoted 1 line
Wondering if some path is not calling dma_buf_begin/end_cpu_access().
Yes, ast doesn't call begin/end_cpu_access in [1].
Jocelyn, if that fixes the issue, feel free to send me a patch for review.
[1] https://elixir.bootlin.com/linux/v6.17.4/source/drivers/gpu/drm/ ast/
ast_mode.cI tried the following patch, but that doesn't fix the graphical issue:
drivers/gpu/drm/ast/ast_mode.c +1
-0@@ -564,6 +564,7 @@ static void ast_primary_plane_helper_atomic_update(struct drm_plane *plane, struct drm_crtc_state *crtc_state = drm_atomic_get_new_crtc_state(state, crtc); struct drm_rect damage; struct drm_atomic_helper_damage_iter iter; + int ret; if (!old_fb || (fb->format != old_fb->format) || crtc_state- >mode_changed) {struct
ast_crtc_state*ast_crtc_state=to_ast_crtc_state(crtc_state);drivers/gpu/drm/ast/ast_mode.c +0
-0@@ -572,11 +573,16 @@ static void ast_primary_plane_helper_atomic_update(struct drm_plane *plane, ast_set_vbios_color_reg(ast, fb->format, ast_crtc_state->vmode); }Quoted 8 lines
Quoted 4 lines
drivers/gpu/drm/ast/ast_mode.c static void · line 578
Quoted 2 lines
drivers/gpu/drm/ast/ast_mode.c +2
-0+ ret = drm_gem_fb_begin_cpu_access(fb, DMA_FROM_DEVICE); + pr_info("AST begin_cpu_access %d\n", ret);Presumably, you end up in [1]. I cannot find the cflush there or in [2]. Maybe you need to add this call somewhere in there, similar to [3]. Just guessing.
Near [2] clflush can happen at [4] *if* the driver thinks it is needed. Most GPUs are cache coherent so mostly it isn't. But if this is a Meteorlake machine (when I google Lenovo se100 it makes me think so?) then the userspace has some responsibility to manage things since there it is only 1-way coherency. Or userspace could have even told the driver to stay off in which case it then needs to manage everything. From the top of my head I am not sure how exactly this used to work, or how it is supposed to interact with exported buffers.
If this is indeed on Meteorlake, maybe Joonas or Rodrigo remember better how the special 1-way coherency is supposed to be managed there?
I've made an experiment, and if I add:
* a calls to
drm_gem_fb_begin_cpu_access()in the ast driver.
* and ini915_gem_domain.cflush_write_domain():
caseI915_GEM_DOMAIN_RENDER:
+i915_gem_clflush_object(obj, I915_CLFLUSH_SYNC | I915_CLFLUSH_FORCE);
Quoted 4 lines
Then that fixes the issue too.
So I think there are two things to fix:
* The missing call todrm_gem_fb_begin_cpu_access()in ast.
Yes. We definitely want to add these calls, as they are expected for this case.
Quoted 1 line
* The missing cache flush in i915 for the Arrowlake iGPU (but probably not the way I've done it).
You call begin_cpu_access with DMA_FROM_DEVICE, but there's no support for that flag in i915 AFAICT. Maybe this needs to be added somehow?
Best regards
Thomas
Quoted 3 lines
Regards,
Signature · 7 lines
-- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Frankenstrasse 146, 90461 Nuernberg, Germany GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman HRB 36809 (AG Nuernberg)
Tvrtko Ursulin
maintainerQuoted 69 lines · Thomas Zimmermann
Hi
Am 27.10.25 um 10:46 schrieb Jocelyn Falempe:
Quoted 66 lines · Tvrtko Ursulin
Quoted 48 lines · Thomas Zimmermann
Quoted 46 lines
Hi
Am 24.10.25 um 15:33 schrieb Jocelyn Falempe:
Quoted 43 lines · Thomas Zimmermann
Quoted 14 lines
Hi
Am 24.10.25 um 13:53 schrieb Tvrtko Ursulin:
Quoted 11 lines · Jocelyn Falempe
Quoted 6 lines
On a lenovo se100 server, when using i915 GPU for rendering, and the ast driver for display, the graphic output is corrupted, and almost unusable.
Adding a clflush call in the vmap function fixes this issue completely.
AST is importing i915 allocated buffer in this use case, or how exactly is the relationship?
Quoted 7 lines
Quoted 1 line
Wondering if some path is not calling dma_buf_begin/
end_cpu_access().Yes, ast doesn't call begin/end_cpu_access in [1].
Jocelyn, if that fixes the issue, feel free to send me a patch for review.
[1] https://elixir.bootlin.com/linux/v6.17.4/source/drivers/gpu/ drm/ ast/
ast_mode.cI tried the following patch, but that doesn't fix the graphical issue:
drivers/gpu/drm/ast/ast_mode.c +1
-0@@ -564,6 +564,7 @@ static void ast_primary_plane_helper_atomic_update(struct drm_plane *plane, struct drm_crtc_state *crtc_state = drm_atomic_get_new_crtc_state(state, crtc); struct drm_rect damage; struct drm_atomic_helper_damage_iter iter; + int ret; if (!old_fb || (fb->format != old_fb->format) || crtc_state- >mode_changed) {struct
ast_crtc_state*ast_crtc_state=to_ast_crtc_state(crtc_state);drivers/gpu/drm/ast/ast_mode.c +0
-0@@ -572,11 +573,16 @@ static void ast_primary_plane_helper_atomic_update(struct drm_plane *plane, ast_set_vbios_color_reg(ast, fb->format, ast_crtc_state->vmode); }Quoted 8 lines
Quoted 4 lines
drivers/gpu/drm/ast/ast_mode.c static void · line 578
Quoted 2 lines
drivers/gpu/drm/ast/ast_mode.c +2
-0+ ret = drm_gem_fb_begin_cpu_access(fb, DMA_FROM_DEVICE); + pr_info("AST begin_cpu_access %d\n", ret);Presumably, you end up in [1]. I cannot find the cflush there or in [2]. Maybe you need to add this call somewhere in there, similar to [3]. Just guessing.
Near [2] clflush can happen at [4] *if* the driver thinks it is needed. Most GPUs are cache coherent so mostly it isn't. But if this is a Meteorlake machine (when I google Lenovo se100 it makes me think so?) then the userspace has some responsibility to manage things since there it is only 1-way coherency. Or userspace could have even told the driver to stay off in which case it then needs to manage everything. From the top of my head I am not sure how exactly this used to work, or how it is supposed to interact with exported buffers.
If this is indeed on Meteorlake, maybe Joonas or Rodrigo remember better how the special 1-way coherency is supposed to be managed there?
I've made an experiment, and if I add:
* a calls to
drm_gem_fb_begin_cpu_access()in the ast driver.
* and ini915_gem_domain.cflush_write_domain():
caseI915_GEM_DOMAIN_RENDER:
+i915_gem_clflush_object(obj, I915_CLFLUSH_SYNC | I915_CLFLUSH_FORCE);
Quoted 6 lines
Quoted 4 lines
Then that fixes the issue too.
So I think there are two things to fix:
* The missing call todrm_gem_fb_begin_cpu_access()in ast.Yes. We definitely want to add these calls, as they are expected for this case.
Browsing around a bit, I notice ast_primary_plane_helper_atomic_update() calls to_drm_shadow_plane_state() to get the source of the memcpy. Should there somewhere be calls to drm_gem_begin_shadow_fb_access() and drm_gem_end_shadow_fb_access()? Or those should be set as vfuncs by someone? Sorry I get lost easily in the DRM maze of helpers<->vfuncs<->helpers<->vfuncs..
Quoted 3 lines
Quoted 1 line
* The missing cache flush in i915 for the Arrowlake iGPU (but probably not the way I've done it).
You call
begin_cpu_accesswithDMA_FROM_DEVICE, but there's no support for that flag in i915 AFAICT. Maybe this needs to be added somehow?
AFAIR the premise is GPU writes will not get stuck in the last level cache but I might be remembering a reverse of what Meteorlake 1-way coherency means. This area of the driver ended up a mess and was never properly cleaned up. I even had a series to try and do it but it never happened. We will need someone who actually remembers how Meteorlake works.
Regards,
Tvrtko
Jocelyn Falempe
reviewerQuoted 71 lines · Tvrtko Ursulin
Quoted 69 lines · Thomas Zimmermann
Hi
Am 27.10.25 um 10:46 schrieb Jocelyn Falempe:
Quoted 66 lines · Tvrtko Ursulin
Quoted 48 lines · Thomas Zimmermann
Quoted 46 lines
Hi
Am 24.10.25 um 15:33 schrieb Jocelyn Falempe:
Quoted 43 lines · Thomas Zimmermann
Quoted 14 lines
Hi
Am 24.10.25 um 13:53 schrieb Tvrtko Ursulin:
Quoted 11 lines · Jocelyn Falempe
Quoted 6 lines
On a lenovo se100 server, when using i915 GPU for rendering, and the ast driver for display, the graphic output is corrupted, and almost unusable.
Adding a clflush call in the vmap function fixes this issue completely.
AST is importing i915 allocated buffer in this use case, or how exactly is the relationship?
Quoted 7 lines
Quoted 1 line
Wondering if some path is not calling dma_buf_begin/
end_cpu_access().Yes, ast doesn't call begin/end_cpu_access in [1].
Jocelyn, if that fixes the issue, feel free to send me a patch for review.
[1] https://elixir.bootlin.com/linux/v6.17.4/source/drivers/gpu/ drm/ ast/
ast_mode.cI tried the following patch, but that doesn't fix the graphical issue:
drivers/gpu/drm/ast/ast_mode.c +1
-0@@ -564,6 +564,7 @@ static void ast_primary_plane_helper_atomic_update(struct drm_plane *plane, struct drm_crtc_state *crtc_state = drm_atomic_get_new_crtc_state(state, crtc); struct drm_rect damage; struct drm_atomic_helper_damage_iter iter; + int ret; if (!old_fb || (fb->format != old_fb->format) || crtc_state- >mode_changed) {struct
ast_crtc_state*ast_crtc_state=to_ast_crtc_state(crtc_state);drivers/gpu/drm/ast/ast_mode.c +0
-0@@ -572,11 +573,16 @@ static void ast_primary_plane_helper_atomic_update(struct drm_plane *plane, ast_set_vbios_color_reg(ast, fb->format, ast_crtc_state->vmode); }Quoted 8 lines
Quoted 4 lines
drivers/gpu/drm/ast/ast_mode.c static void · line 578
Quoted 2 lines
drivers/gpu/drm/ast/ast_mode.c +2
-0+ ret = drm_gem_fb_begin_cpu_access(fb, DMA_FROM_DEVICE); + pr_info("AST begin_cpu_access %d\n", ret);Presumably, you end up in [1]. I cannot find the cflush there or in [2]. Maybe you need to add this call somewhere in there, similar to [3]. Just guessing.
Near [2] clflush can happen at [4] *if* the driver thinks it is needed. Most GPUs are cache coherent so mostly it isn't. But if this is a Meteorlake machine (when I google Lenovo se100 it makes me think so?) then the userspace has some responsibility to manage things since there it is only 1-way coherency. Or userspace could have even told the driver to stay off in which case it then needs to manage everything. From the top of my head I am not sure how exactly this used to work, or how it is supposed to interact with exported buffers.
If this is indeed on Meteorlake, maybe Joonas or Rodrigo remember better how the special 1-way coherency is supposed to be managed there?
I've made an experiment, and if I add:
* a calls to
drm_gem_fb_begin_cpu_access()in the ast driver.
* and ini915_gem_domain.cflush_write_domain():
caseI915_GEM_DOMAIN_RENDER:
+i915_gem_clflush_object(obj, I915_CLFLUSH_SYNC | I915_CLFLUSH_FORCE);
Quoted 9 lines
Quoted 6 lines
Quoted 4 lines
Then that fixes the issue too.
So I think there are two things to fix:
* The missing call todrm_gem_fb_begin_cpu_access()in ast.Yes. We definitely want to add these calls, as they are expected for this case.
Browsing around a bit, I notice
ast_primary_plane_helper_atomic_update()callsto_drm_shadow_plane_state()to get the source of the memcpy. Should there somewhere be calls todrm_gem_begin_shadow_fb_access()anddrm_gem_end_shadow_fb_access()? Or those should be set as vfuncs by someone? Sorry I get lost easily in the DRM maze of helpers<->vfuncs<-Quoted 1 line
helpers<->vfuncs..
I've already submitted [1] for the ast driver.
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
* The missing cache flush in i915 for the Arrowlake iGPU (but probably not the way I've done it).
You call
begin_cpu_accesswithDMA_FROM_DEVICE, but there's no support for that flag in i915 AFAICT. Maybe this needs to be added somehow?AFAIR the premise is GPU writes will not get stuck in the last level cache but I might be remembering a reverse of what Meteorlake 1-way coherency means. This area of the driver ended up a mess and was never properly cleaned up. I even had a series to try and do it but it never happened. We will need someone who actually remembers how Meteorlake works.
Logically clflush() shouldn't have any effect, because it flushes the CPU cache, and then ast is reading from the CPU.
But from the tests, it also flushes the iGPU cache, and the iGPU cache is not coherent with the CPU cache (at least for iGPU writes), or this problem won't exist.
I've the setup ready, and this is easily reproducible, so you can send me patches, and I can quickly check if that works or not.
[1] https://lore.kernel.org/dri-devel/[email protected]/T/#t
Best regards,
Signature · 1 line
Jocelyn
Quoted 5 lines
Regards,
Tvrtko
Thomas Zimmermann
maintainerHi
Am 31.10.25 um 16:04 schrieb Jocelyn Falempe:
Quoted 74 lines · Tvrtko Ursulin
Quoted 73 lines · Thomas Zimmermann
Quoted 71 lines
Hi
Am 27.10.25 um 10:46 schrieb Jocelyn Falempe:
Quoted 68 lines · Tvrtko Ursulin
Quoted 48 lines · Thomas Zimmermann
Quoted 46 lines
Hi
Am 24.10.25 um 15:33 schrieb Jocelyn Falempe:
Quoted 43 lines · Thomas Zimmermann
Quoted 14 lines
Hi
Am 24.10.25 um 13:53 schrieb Tvrtko Ursulin:
Quoted 11 lines · Jocelyn Falempe
Quoted 6 lines
On a lenovo se100 server, when using i915 GPU for rendering, and the ast driver for display, the graphic output is corrupted, and almost unusable.
Adding a clflush call in the vmap function fixes this issue completely.
AST is importing i915 allocated buffer in this use case, or how exactly is the relationship?
Quoted 7 lines
Quoted 1 line
Wondering if some path is not calling dma_buf_begin/
end_cpu_access().Yes, ast doesn't call begin/end_cpu_access in [1].
Jocelyn, if that fixes the issue, feel free to send me a patch for review.
[1] https://elixir.bootlin.com/linux/v6.17.4/source/drivers/gpu/ drm/ ast/
ast_mode.cI tried the following patch, but that doesn't fix the graphical issue:
drivers/gpu/drm/ast/ast_mode.c +1
-0@@ -564,6 +564,7 @@ static void ast_primary_plane_helper_atomic_update(struct drm_plane *plane, struct drm_crtc_state *crtc_state = drm_atomic_get_new_crtc_state(state, crtc); struct drm_rect damage; struct drm_atomic_helper_damage_iter iter; + int ret; if (!old_fb || (fb->format != old_fb->format) || crtc_state- >mode_changed) {struct
ast_crtc_state*ast_crtc_state=to_ast_crtc_state(crtc_state);drivers/gpu/drm/ast/ast_mode.c +0
-0@@ -572,11 +573,16 @@ static void ast_primary_plane_helper_atomic_update(struct drm_plane *plane, ast_set_vbios_color_reg(ast, fb->format, ast_crtc_state->vmode); }Quoted 8 lines
Quoted 4 lines
drivers/gpu/drm/ast/ast_mode.c static void · line 578
Quoted 2 lines
drivers/gpu/drm/ast/ast_mode.c +2
-0+ ret = drm_gem_fb_begin_cpu_access(fb, DMA_FROM_DEVICE); + pr_info("AST begin_cpu_access %d\n", ret);Presumably, you end up in [1]. I cannot find the cflush there or in [2]. Maybe you need to add this call somewhere in there, similar to [3]. Just guessing.
Near [2] clflush can happen at [4] *if* the driver thinks it is needed. Most GPUs are cache coherent so mostly it isn't. But if this is a Meteorlake machine (when I google Lenovo se100 it makes me think so?) then the userspace has some responsibility to manage things since there it is only 1-way coherency. Or userspace could have even told the driver to stay off in which case it then needs to manage everything. From the top of my head I am not sure how exactly this used to work, or how it is supposed to interact with exported buffers.
If this is indeed on Meteorlake, maybe Joonas or Rodrigo remember better how the special 1-way coherency is supposed to be managed there?
I've made an experiment, and if I add:
* a calls to
drm_gem_fb_begin_cpu_access()in the ast driver.
* and ini915_gem_domain.cflush_write_domain():
caseI915_GEM_DOMAIN_RENDER:
+i915_gem_clflush_object(obj, I915_CLFLUSH_SYNC | I915_CLFLUSH_FORCE);Then that fixes the issue too.
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
So I think there are two things to fix:
* The missing call todrm_gem_fb_begin_cpu_access()in ast.Yes. We definitely want to add these calls, as they are expected for this case.
Browsing around a bit, I notice
ast_primary_plane_helper_atomic_update()callsto_drm_shadow_plane_state()to get the source of the memcpy. Should there somewhere be calls todrm_gem_begin_shadow_fb_access()anddrm_gem_end_shadow_fb_access()? Or those should be set as vfuncs by someone? Sorry I get lost easily in the DRM maze of helpers<->vfuncs<- >helpers<->vfuncs..I've already submitted [1] for the ast driver.
Don't be confused by the similar naming. The shadow-plane functions do the vmap(). The cpu-access functions do the caching and DMA sync.
Best regards
Thomas
Quoted 17 lines
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
* The missing cache flush in i915 for the Arrowlake iGPU (but probably not the way I've done it).
You call
begin_cpu_accesswithDMA_FROM_DEVICE, but there's no support for that flag in i915 AFAICT. Maybe this needs to be added somehow?AFAIR the premise is GPU writes will not get stuck in the last level cache but I might be remembering a reverse of what Meteorlake 1-way coherency means. This area of the driver ended up a mess and was never properly cleaned up. I even had a series to try and do it but it never happened. We will need someone who actually remembers how Meteorlake works.
Logically
clflush()shouldn't have any effect, because it flushes the CPU cache, and then ast is reading from the CPU.
But from the tests, it also flushes the iGPU cache, and the iGPU cache is not coherent with the CPU cache (at least for iGPU writes), or this problem won't exist.I've the setup ready, and this is easily reproducible, so you can send me patches, and I can quickly check if that works or not.
[1] https://lore.kernel.org/dri-devel/[email protected]/T/#t
Best regards,
Signature · 7 lines
-- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Frankenstrasse 146, 90461 Nuernberg, Germany GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman HRB 36809 (AG Nuernberg)
Thomas Zimmermann
maintainerHi
Am 31.10.25 um 14:12 schrieb Tvrtko Ursulin:
Quoted 71 lines · Thomas Zimmermann
Quoted 69 lines
Hi
Am 27.10.25 um 10:46 schrieb Jocelyn Falempe:
Quoted 66 lines · Tvrtko Ursulin
Quoted 48 lines · Thomas Zimmermann
Quoted 46 lines
Hi
Am 24.10.25 um 15:33 schrieb Jocelyn Falempe:
Quoted 43 lines · Thomas Zimmermann
Quoted 14 lines
Hi
Am 24.10.25 um 13:53 schrieb Tvrtko Ursulin:
Quoted 11 lines · Jocelyn Falempe
Quoted 6 lines
On a lenovo se100 server, when using i915 GPU for rendering, and the ast driver for display, the graphic output is corrupted, and almost unusable.
Adding a clflush call in the vmap function fixes this issue completely.
AST is importing i915 allocated buffer in this use case, or how exactly is the relationship?
Quoted 7 lines
Quoted 1 line
Wondering if some path is not calling dma_buf_begin/
end_cpu_access().Yes, ast doesn't call begin/end_cpu_access in [1].
Jocelyn, if that fixes the issue, feel free to send me a patch for review.
[1] https://elixir.bootlin.com/linux/v6.17.4/source/drivers/gpu/ drm/ ast/
ast_mode.cI tried the following patch, but that doesn't fix the graphical issue:
drivers/gpu/drm/ast/ast_mode.c +1
-0@@ -564,6 +564,7 @@ static void ast_primary_plane_helper_atomic_update(struct drm_plane *plane, struct drm_crtc_state *crtc_state = drm_atomic_get_new_crtc_state(state, crtc); struct drm_rect damage; struct drm_atomic_helper_damage_iter iter; + int ret; if (!old_fb || (fb->format != old_fb->format) || crtc_state- >mode_changed) {struct
ast_crtc_state*ast_crtc_state=to_ast_crtc_state(crtc_state);drivers/gpu/drm/ast/ast_mode.c +0
-0@@ -572,11 +573,16 @@ static void ast_primary_plane_helper_atomic_update(struct drm_plane *plane, ast_set_vbios_color_reg(ast, fb->format, ast_crtc_state->vmode); }Quoted 8 lines
Quoted 4 lines
drivers/gpu/drm/ast/ast_mode.c static void · line 578
Quoted 2 lines
drivers/gpu/drm/ast/ast_mode.c +2
-0+ ret = drm_gem_fb_begin_cpu_access(fb, DMA_FROM_DEVICE); + pr_info("AST begin_cpu_access %d\n", ret);Presumably, you end up in [1]. I cannot find the cflush there or in [2]. Maybe you need to add this call somewhere in there, similar to [3]. Just guessing.
Near [2] clflush can happen at [4] *if* the driver thinks it is needed. Most GPUs are cache coherent so mostly it isn't. But if this is a Meteorlake machine (when I google Lenovo se100 it makes me think so?) then the userspace has some responsibility to manage things since there it is only 1-way coherency. Or userspace could have even told the driver to stay off in which case it then needs to manage everything. From the top of my head I am not sure how exactly this used to work, or how it is supposed to interact with exported buffers.
If this is indeed on Meteorlake, maybe Joonas or Rodrigo remember better how the special 1-way coherency is supposed to be managed there?
I've made an experiment, and if I add:
* a calls to
drm_gem_fb_begin_cpu_access()in the ast driver.
* and ini915_gem_domain.cflush_write_domain():
caseI915_GEM_DOMAIN_RENDER:
+i915_gem_clflush_object(obj, I915_CLFLUSH_SYNC | I915_CLFLUSH_FORCE);
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Then that fixes the issue too.
So I think there are two things to fix:
* The missing call todrm_gem_fb_begin_cpu_access()in ast.Yes. We definitely want to add these calls, as they are expected for this case.
Browsing around a bit, I notice
ast_primary_plane_helper_atomic_update()callsto_drm_shadow_plane_state()to get the source of the memcpy. Should there somewhere be calls todrm_gem_begin_shadow_fb_access()anddrm_gem_end_shadow_fb_access()? Or those should be set as vfuncs by someone? Sorry I get lost easily in the DRM maze of helpers<->vfuncs<->helpers<->vfuncs..
It is used by DRM_GEM_SHADOW_PLANE_HELPER_FUNCS, [1] which ast uses at [2]. And then atomic helpers call it around the plane update.
[1] https://elixir.bootlin.com/linux/v6.17.6/source/include/drm/drm_gem_atomic_helper.h#L125
[2] https://elixir.bootlin.com/linux/v6.17.6/source/drivers/gpu/drm/ast/ast_mode.c#L631
Best regards
Thomas
Quoted 11 lines
Quoted 4 lines
Quoted 2 lines
* The missing cache flush in i915 for the Arrowlake iGPU (but probably not the way I've done it).
You call
begin_cpu_accesswithDMA_FROM_DEVICE, but there's no support for that flag in i915 AFAICT. Maybe this needs to be added somehow?AFAIR the premise is GPU writes will not get stuck in the last level cache but I might be remembering a reverse of what Meteorlake 1-way coherency means. This area of the driver ended up a mess and was never properly cleaned up. I even had a series to try and do it but it never happened. We will need someone who actually remembers how Meteorlake works.
Regards,
Tvrtko
Signature · 7 lines
-- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Frankenstrasse 146, 90461 Nuernberg, Germany GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman HRB 36809 (AG Nuernberg)
Jocelyn Falempe
reviewerQuoted 10 lines · Tvrtko Ursulin
Quoted 6 lines · Jocelyn Falempe
On a lenovo se100 server, when using i915 GPU for rendering, and the ast driver for display, the graphic output is corrupted, and almost unusable.
Adding a clflush call in the vmap function fixes this issue completely.
AST is importing i915 allocated buffer in this use case, or how exactly is the relationship?
I think it's mutter/gnome-shell who copy the buffer from i915 to ast, here is the logs:
gnome-shell[2079]: Failed to initialize accelerated iGPU/dGPU framebuffer sharing: Do not want to use software renderer (llvmpipe (LLVM 19.1.7, 256 bits)), falling back to CPU copy path gnome-shell[1533]: Created gbm renderer for '/dev/dri/card0'
gnome-shell[1533]: GPU /dev/dri/card1 selected as primary
card0 is ast and card1 is i915
Do you think there is something missing in mutter?
(Added Michel Dänzer that may know more about mutter).
Signature · 1 line
Jocelyn
Quoted 27 lines
Wondering if some path is not calling dma_buf_begin/end_cpu_access().
Regards,
Tvrtko
Quoted 19 lines
Signed-off-by Jocelyn Falempe <[email protected]>---
drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c| 1 +1 file changed, 1 insertion(+)drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c +1
-0@@ -77,6 +77,7 @@ static int i915_gem_dmabuf_vmap(struct dma_buf *dma_buf, return PTR_ERR(vaddr); iosys_map_set_vaddr(map, vaddr); + drm_clflush_virt_range(vaddr, dma_buf->size); return 0; }base-commit:
0790925dadad0997580df6e32cdccd54316807f2
Tvrtko Ursulin
maintainerQuoted 14 lines · Jocelyn Falempe
Quoted 10 lines · Tvrtko Ursulin
Quoted 6 lines · Jocelyn Falempe
On a lenovo se100 server, when using i915 GPU for rendering, and the ast driver for display, the graphic output is corrupted, and almost unusable.
Adding a clflush call in the vmap function fixes this issue completely.
AST is importing i915 allocated buffer in this use case, or how exactly is the relationship?
I think it's mutter/gnome-shell who copy the buffer from i915 to ast, here is the logs:
Quoted 7 lines
gnome-shell[2079]: Failed to initialize accelerated iGPU/dGPU framebuffer sharing: Do not want to use software renderer (llvmpipe (LLVM 19.1.7, 256 bits)), falling back to CPU copy path gnome-shell[1533]: Created gbm renderer for '
/dev/dri/card0'
gnome-shell[1533]: GPU/dev/dri/card1selected as primarycard0 is ast and card1 is i915
Do you think there is something missing in mutter?
No idea. I only notice that the log message "falling back to CPU copy path" has been removed from the codebase in:
commit d4e8cfa17a3a69965b9bd130ded46cf54a438908
Author: Jonas Ådahl <[email protected]> Date: Wed May 5 15:53:59 2021 +0200
renderer/native: Use MetaRenderDevice
This replaces functionality that MetaRenderDevice and friends has learned, e.g. buffer allocation, EGLDisplay creation, with the usage of those helper objects. The main objective is to shrink meta-renderer-native.c and by extension meta-onscreen-native.c, moving its functionality into more isolated objects.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1854>
So long long time ago. Maybe worth trying with a newer version?
Regards,
Tvrtko
Jocelyn Falempe
reviewerQuoted 39 lines · Tvrtko Ursulin
Quoted 14 lines · Jocelyn Falempe
Quoted 10 lines · Tvrtko Ursulin
Quoted 6 lines · Jocelyn Falempe
On a lenovo se100 server, when using i915 GPU for rendering, and the ast driver for display, the graphic output is corrupted, and almost unusable.
Adding a clflush call in the vmap function fixes this issue completely.
AST is importing i915 allocated buffer in this use case, or how exactly is the relationship?
I think it's mutter/gnome-shell who copy the buffer from i915 to ast, here is the logs:
Quoted 7 lines
gnome-shell[2079]: Failed to initialize accelerated iGPU/dGPU framebuffer sharing: Do not want to use software renderer (llvmpipe (LLVM 19.1.7, 256 bits)), falling back to CPU copy path gnome-shell[1533]: Created gbm renderer for '
/dev/dri/card0'
gnome-shell[1533]: GPU/dev/dri/card1selected as primarycard0 is ast and card1 is i915
Do you think there is something missing in mutter?
No idea. I only notice that the log message "falling back to CPU copy path" has been removed from the codebase in:
commit
d4e8cfa17a3a69965b9bd130ded46cf54a438908
Author: Jonas Ådahl <[email protected]>
Date: Wed May 5 15:53:59 2021 +0200renderer/native: Use MetaRenderDevice
This replaces functionality that MetaRenderDevice and friends has learned, e.g. buffer allocation, EGLDisplay creation, with the
usage of
those helper objects. The main objective is to shrinkmeta-renderer-native.cand by extensionmeta-onscreen-native.c, moving its functionality into more isolated objects.
Quoted 3 lines
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1854>
So long long time ago. Maybe worth trying with a newer version?
Yes, I've reproduced the issue on an old version, rhel9.6, but I'm being told it's still present in newer version as well. I will test with the latest version of mutter, to see if it's still present.
Thanks,
Signature · 1 line
Jocelyn
Quoted 5 lines
Regards,
Tvrtko
Quoted 6 lines · Jocelyn Falempe
Quoted 5 lines · Tvrtko Ursulin
Quoted 4 lines · Jocelyn Falempe
On a lenovo se100 server, when using i915 GPU for rendering, and the ast driver for display, the graphic output is corrupted, and almost unusable.
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
Adding a clflush call in the vmap function fixes this issue completely.
AST is importing i915 allocated buffer in this use case, or how exactly is the relationship?
I think it's mutter/gnome-shell who copy the buffer from i915 to ast, here is the logs:
gnome-shell[2079]: Failed to initialize accelerated iGPU/dGPU framebuffer sharing: Do not want to use software renderer (llvmpipe (LLVM 19.1.7, 256 bits)), falling back to CPU copy path
FWIW, the code which logged "falling back to CPU copy path" was removed in mutter 42. Can you still reproduce the issue with a newer version of mutter, ideally 49? A lot has changed over the last 3.5 years.
Quoted 6 lines
gnome-shell[1533]: Created gbm renderer for '
/dev/dri/card0' gnome-shell[1533]: GPU/dev/dri/card1selected as primarycard0 is ast and card1 is i915
Do you think there is something missing in mutter?
Not that I can see offhand.
After logging "Failed to initialize accelerated iGPU/dGPU framebuffer sharing", mutter tries to export a dma-buf from the i915 BO, import it into the AST device, create an KMS FB for the imported BO and assign the FB to the primary plane of a CRTC. If this path works (which seems to be the case in this scenario, or you wouldn't see BOs shared between i915 & AST), mutter doesn't do any copies between different BOs. It's between the AST & i915 drivers to correctly handle access to the shared BO.
Does the AST driver wait for the i915 GPU to finish drawing to the shared BO, by waiting for the exclusive fence of the dma-buf synchronization object, before reading from the BO?
P.S. If the path described above didn't work, mutter would fall back to reading the i915 BO contents with glReadPixels and copying them to a dumb BO allocated from the AST device, so you wouldn't see BOs shared between the drivers. With current mutter, you can force this fallback with the environment variable MUTTER_DEBUG_MULTI_GPU_FORCE_COPY_MODE=primary-gpu-cpu . Does that avoid the issue?
Signature · 2 lines
Earthling Michel Dänzer \ GNOME / Xwayland / Mesa developer https://redhat.com \ Libre software enthusiast
Thomas Zimmermann
maintainerHi
Am 24.10.25 um 18:49 schrieb Michel Dänzer:
Quoted 19 lines · Jocelyn Falempe
Quoted 6 lines · Tvrtko Ursulin
Quoted 5 lines · Jocelyn Falempe
Quoted 4 lines
On a lenovo se100 server, when using i915 GPU for rendering, and the ast driver for display, the graphic output is corrupted, and almost unusable.
Quoted 6 lines
Quoted 3 lines
Quoted 2 lines
Adding a clflush call in the vmap function fixes this issue completely.
AST is importing i915 allocated buffer in this use case, or how exactly is the relationship?
I think it's mutter/gnome-shell who copy the buffer from i915 to ast, here is the logs:
gnome-shell[2079]: Failed to initialize accelerated iGPU/dGPU framebuffer sharing: Do not want to use software renderer (llvmpipe (LLVM 19.1.7, 256 bits)), falling back to CPU copy path
FWIW, the code which logged "falling back to CPU copy path" was removed in mutter 42. Can you still reproduce the issue with a newer version of mutter, ideally 49? A lot has changed over the last 3.5 years.
Quoted 3 lines
gnome-shell[1533]: Created gbm renderer for '
/dev/dri/card0' gnome-shell[1533]: GPU/dev/dri/card1selected as primary
Quoted 8 lines
Quoted 3 lines
card0 is ast and card1 is i915
Do you think there is something missing in mutter?
Not that I can see offhand.
After logging "Failed to initialize accelerated iGPU/dGPU framebuffer sharing", mutter tries to export a dma-buf from the i915 BO, import it into the AST device, create an KMS FB for the imported BO and assign the FB to the primary plane of a CRTC. If this path works (which seems to be the case in this scenario, or you wouldn't see BOs shared between i915 & AST), mutter doesn't do any copies between different BOs. It's between the AST & i915 drivers to correctly handle access to the shared BO.
Does the AST driver wait for the i915 GPU to finish drawing to the shared BO, by waiting for the exclusive fence of the dma-buf synchronization object, before reading from the BO?
Yes, ast waits for all the plane fences here: https://elixir.bootlin.com/linux/v6.17.5/source/drivers/gpu/drm/drm_atomic_helper.c#L2762
Best regards
Thomas
Quoted 5 lines
P.S. If the path described above didn't work, mutter would fall back to reading the i915 BO contents with glReadPixels and copying them to a dumb BO allocated from the AST device, so you wouldn't see BOs shared between the drivers. With current mutter, you can force this fallback with the environment variable MUTTER_DEBUG_MULTI_GPU_FORCE_COPY_MODE=primary-gpu-cpu . Does that avoid the issue?
Signature · 7 lines
-- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Frankenstrasse 146, 90461 Nuernberg, Germany GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman HRB 36809 (AG Nuernberg)
Patchwork
CI✓ i915.CI.BAT: success for drm/i915/dmabuf: Flush the cache in vmap
In reply to Jocelyn Falempe== Series Details ==
== Series Details ==
Series: drm/i915/dmabuf: Flush the cache in vmap
URL : https://patchwork.freedesktop.org/series/156475/
State : success
== Summary ==
CI Bug Log - changes from CI_DRM_17422 -> Patchwork_156475v1
====================================================
Summary
-------
**SUCCESS**
No regressions found.
External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_156475v1/index.html
Participating hosts (45 -> 44)
------------------------------
Missing (1): fi-snb-2520m
Known issues
------------
Here are the changes found in Patchwork_156475v1 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@i915_selftest@live@workarounds:
- bat-adlp-9: [PASS][1] -> [ABORT][2] ([i915#14365]) +1 other test abort
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_17422/bat-adlp-9/igt@i915_selftest@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_156475v1/bat-adlp-9/igt@i915_selftest@[email protected]
* igt@kms_psr@psr-primary-mmap-gtt:
- fi-bsw-n3050: NOTRUN -> [SKIP][3] +21 other tests skip
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_156475v1/fi-bsw-n3050/igt@[email protected]
#### Possible fixes ####
* igt@i915_selftest@live@workarounds:
- bat-dg2-11: [DMESG-FAIL][4] ([i915#12061]) -> [PASS][5] +1 other test pass
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_17422/bat-dg2-11/igt@i915_selftest@[email protected]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_156475v1/bat-dg2-11/igt@i915_selftest@[email protected]
[i915#12061]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/12061
[i915#14365]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/14365
Build changes
-------------
* Linux: CI_DRM_17422 -> Patchwork_156475v1
CI-20190529: 20190529
CI_DRM_17422: 1e54d2c469a91e00a39ff7f6b98c31d290245ecf @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_8596: 8596
Patchwork_156475v1: 1e54d2c469a91e00a39ff7f6b98c31d290245ecf @ git://anongit.freedesktop.org/gfx-ci/linux
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_156475v1/index.html
Patchwork
CI✗ Fi.CI.BUILD: failure for drm/i915/dmabuf: Flush the cache in vmap (rev2)
In reply to Jocelyn Falempe== Series Details ==
== Series Details ==
Series: drm/i915/dmabuf: Flush the cache in vmap (rev2)
URL : https://patchwork.freedesktop.org/series/156475/
State : failure
== Summary ==
Error: patch https://patchwork.freedesktop.org/api/1.0/series/156475/revisions/2/mbox/ not applied
Applying: drm/i915/dmabuf: Flush the cache in vmap
error: corrupt patch at line 6
error: could not build fake ancestor
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 drm/i915/dmabuf: Flush the cache in vmap
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
Build failed, no error log produced