drm/virtio: Support drm_panic with non-vmapped shmem BO
Subsystems (4)
PATCH 1/1 drm/virtio: Support drm_panic with non-vmapped shmem BO
Pass array of pages of the scanout buffer [1] to shmem BO, allowing drm_panic to work even if the BO is not vmapped.
[1] https://lore.kernel.org/all/[email protected]/
--- drivers/gpu/drm/virtio/virtgpu_plane.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
drivers/gpu/drm/virtio/virtgpu_plane.c +11 -3
@@ -500,11 +500,19 @@ static int virtio_drm_get_scanout_buffer(struct drm_plane *plane, bo =gem_to_virtio_gpu_obj (plane->state->fb->obj[0 ]); -/* Only support mapped shmem bo */ -if (virtio_gpu_is_vram (bo) || bo->base.base.import_attach || !bo->base.vaddr) +if (virtio_gpu_is_vram (bo) || bo->base.base.import_attach)return -ENODEV ; -iosys_map_set_vaddr (&sb->map[0 ], bo->base.vaddr); +if (bo->base.vaddr) +iosys_map_set_vaddr (&sb->map[0 ], bo->base.vaddr); +else { +struct drm_gem_shmem_object *shmem = &bo->base; + +if (!shmem->pages) +return -ENODEV ; +/* map scanout buffer later */ + sb->pages = shmem->pages; + } sb->format = plane->state->fb->format; sb->height = plane->state->fb->height;
base-commit: e7bb7d44c3b97aea1f0e354c6499900154ac67f2
Signature · 1 line
2.49.0
Quoted 39 lines · Ryosuke Yasuoka
Pass array of pages of the scanout buffer [1] to shmem BO, allowing
drm_panicto work even if the BO is not vmapped.[1] https://lore.kernel.org/all/[email protected]/
Signed-off-by Jocelyn Falempe <[email protected]>Signed-off-by Ryosuke Yasuoka <[email protected]>--- drivers/gpu/drm/virtio/virtgpu_plane.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)drivers/gpu/drm/virtio/virtgpu_plane.c +11
-3@@ -500,11 +500,19 @@ static int virtio_drm_get_scanout_buffer(struct drm_plane *plane, bo =gem_to_virtio_gpu_obj (plane->state->fb->obj[0 ]); -/* Only support mapped shmem bo */ -if (virtio_gpu_is_vram (bo) || bo->base.base.import_attach || !bo->base.vaddr) +if (virtio_gpu_is_vram (bo) || bo->base.base.import_attach)return -ENODEV ; -iosys_map_set_vaddr (&sb->map[0 ], bo->base.vaddr); +if (bo->base.vaddr) +iosys_map_set_vaddr (&sb->map[0 ], bo->base.vaddr); +else { +struct drm_gem_shmem_object *shmem = &bo->base; + +if (!shmem->pages) +return -ENODEV ; +/* map scanout buffer later */ + sb->pages = shmem->pages; + } sb->format = plane->state->fb->format; sb->height = plane->state->fb->height;
Quoted 1 line
base-commit:
e7bb7d44c3b97aea1f0e354c6499900154ac67f2
Works well!
Signature · 2 lines
Best regards, Dmitry
Thomas Zimmermann
maintainerHi
Am 12.04.25 um 15:20 schrieb Ryosuke Yasuoka:
Quoted 16 lines
Pass array of pages of the scanout buffer [1] to shmem BO, allowing
drm_panicto work even if the BO is not vmapped.[1] https://lore.kernel.org/all/[email protected]/
Signed-off-by Jocelyn Falempe <[email protected]>Signed-off-by Ryosuke Yasuoka <[email protected]>--- drivers/gpu/drm/virtio/virtgpu_plane.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)drivers/gpu/drm/virtio/virtgpu_plane.c +0
-0
drivers/gpu/drm/virtio/virtgpu_plane.c static int virtio_drm_get_scanout_buffer(struct drm_plane *plane, · line 503
Quoted 6 lines
drivers/gpu/drm/virtio/virtgpu_plane.c +1
-2@@ -500,11 +500,19 @@ static int virtio_drm_get_scanout_buffer(struct drm_plane *plane, bo =gem_to_virtio_gpu_obj (plane->state->fb->obj[0 ]); -/* Only support mapped shmem bo */ -if (virtio_gpu_is_vram (bo) || bo->base.base.import_attach || !bo->base.vaddr) +if (virtio_gpu_is_vram (bo) || bo->base.base.import_attach)
Please adopt drm_gem_is_imported() instead of testing import_attach directly. The helper is available in v6.15-rc1 and later.
Best regards
Thomas
Quoted 18 lines
drivers/gpu/drm/virtio/virtgpu_plane.c +10
-1return -ENODEV ; -iosys_map_set_vaddr (&sb->map[0 ], bo->base.vaddr); +if (bo->base.vaddr) +iosys_map_set_vaddr (&sb->map[0 ], bo->base.vaddr); +else { +struct drm_gem_shmem_object *shmem = &bo->base; + +if (!shmem->pages) +return -ENODEV ; +/* map scanout buffer later */ + sb->pages = shmem->pages; + } sb->format = plane->state->fb->format; sb->height = plane->state->fb->height;base-commit:
e7bb7d44c3b97aea1f0e354c6499900154ac67f2
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)
Dmitry Osipenko
maintainerQuoted 25 lines · Thomas Zimmermann
Hi
Am 12.04.25 um 15:20 schrieb Ryosuke Yasuoka:
Quoted 22 lines
Pass array of pages of the scanout buffer [1] to shmem BO, allowing
drm_panicto work even if the BO is not vmapped.[1] https://lore.kernel.org/all/20250407140138.162383-3-
[email protected]/Signed-off-by Jocelyn Falempe <[email protected]>Signed-off-by Ryosuke Yasuoka <[email protected]>---
drivers/gpu/drm/virtio/virtgpu_plane.c| 14 +++++++++++---1 file changed, 11 insertions(+), 3 deletions(-)drivers/gpu/drm/ renamed from drivers/gpu/drm/virtio/virtgpu_plane.c +0
-0
virtio/virtgpu_plane.c
indexa6f5a78f436a..2ff57d559c86100644drivers/gpu/drm/virtio/virtgpu_plane.c +0
-0@@ -500,11 +500,19 @@ static int virtio_drm_get_scanout_buffer(structdrm_plane *plane, bo = gem_to_virtio_gpu_obj(plane->state->fb->obj[0]);- /* Only support mapped shmem bo */
- if (virtio_gpu_is_vram(bo)||bo->base.base.import_attach|| !bo-
Quoted 5 lines
Quoted 2 lines
Quoted 1 line
base.vaddr)
+ if (
virtio_gpu_is_vram(bo)||bo->base.base.import_attach)Please adopt
drm_gem_is_imported()instead of testingimport_attachdirectly. The helper is available in v6.15-rc1 and later.
Hi, I rebased this patch locally on top of your drm_gem_is_imported() changes and will merge it all soon.
Signature · 2 lines
Best regards, Dmitry
Dmitry Osipenko
maintainerQuoted 39 lines · Ryosuke Yasuoka
Pass array of pages of the scanout buffer [1] to shmem BO, allowing
drm_panicto work even if the BO is not vmapped.[1] https://lore.kernel.org/all/[email protected]/
Signed-off-by Jocelyn Falempe <[email protected]>Signed-off-by Ryosuke Yasuoka <[email protected]>--- drivers/gpu/drm/virtio/virtgpu_plane.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)drivers/gpu/drm/virtio/virtgpu_plane.c +11
-3@@ -500,11 +500,19 @@ static int virtio_drm_get_scanout_buffer(struct drm_plane *plane, bo =gem_to_virtio_gpu_obj (plane->state->fb->obj[0 ]); -/* Only support mapped shmem bo */ -if (virtio_gpu_is_vram (bo) || bo->base.base.import_attach || !bo->base.vaddr) +if (virtio_gpu_is_vram (bo) || bo->base.base.import_attach)return -ENODEV ; -iosys_map_set_vaddr (&sb->map[0 ], bo->base.vaddr); +if (bo->base.vaddr) +iosys_map_set_vaddr (&sb->map[0 ], bo->base.vaddr); +else { +struct drm_gem_shmem_object *shmem = &bo->base; + +if (!shmem->pages) +return -ENODEV ; +/* map scanout buffer later */ + sb->pages = shmem->pages; + } sb->format = plane->state->fb->format; sb->height = plane->state->fb->height;
Quoted 1 line
base-commit:
e7bb7d44c3b97aea1f0e354c6499900154ac67f2
Rebased on top of [1], fixed checkpatch warning about braces and applied to misc-next. Thanks!
[1] https://lore.kernel.org/all/[email protected]/
Signature · 2 lines
Best regards, Dmitry
Quoted 41 lines · Dmitry Osipenko
Quoted 39 lines · Ryosuke Yasuoka
Pass array of pages of the scanout buffer [1] to shmem BO, allowing
drm_panicto work even if the BO is not vmapped.[1] https://lore.kernel.org/all/[email protected]/
Signed-off-by Jocelyn Falempe <[email protected]>Signed-off-by Ryosuke Yasuoka <[email protected]>--- drivers/gpu/drm/virtio/virtgpu_plane.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)drivers/gpu/drm/virtio/virtgpu_plane.c +11
-3@@ -500,11 +500,19 @@ static int virtio_drm_get_scanout_buffer(struct drm_plane *plane, bo =gem_to_virtio_gpu_obj (plane->state->fb->obj[0 ]); -/* Only support mapped shmem bo */ -if (virtio_gpu_is_vram (bo) || bo->base.base.import_attach || !bo->base.vaddr) +if (virtio_gpu_is_vram (bo) || bo->base.base.import_attach)return -ENODEV ; -iosys_map_set_vaddr (&sb->map[0 ], bo->base.vaddr); +if (bo->base.vaddr) +iosys_map_set_vaddr (&sb->map[0 ], bo->base.vaddr); +else { +struct drm_gem_shmem_object *shmem = &bo->base; + +if (!shmem->pages) +return -ENODEV ; +/* map scanout buffer later */ + sb->pages = shmem->pages; + } sb->format = plane->state->fb->format; sb->height = plane->state->fb->height;
Quoted 6 lines
Quoted 1 line
base-commit:
e7bb7d44c3b97aea1f0e354c6499900154ac67f2Rebased on top of [1], fixed checkpatch warning about braces and applied to misc-next. Thanks!
Thomas,
Thank you for your comment.
Dmitry,
Thank you for fixing it and applying my patch.
Quoted 4 lines
--
Best regards,
Dmitry
Best regards,
Ryosuke