Re: [PATCH v6] drm/virtio: Add drm_panic support
From: Dmitry Osipenko
Date: Sun Feb 02 2025 - 12:18:26 EST
Hi,
On 1/30/25 12:05, Ryosuke Yasuoka wrote:
...
> +static int virtio_drm_get_scanout_buffer(struct drm_plane *plane,
> + struct drm_scanout_buffer *sb)
> +{
> + struct virtio_gpu_object *bo;
> +
> + if (!plane->state || !plane->state->fb || !plane->state->visible)
> + return -ENODEV;
> +
> + bo = gem_to_virtio_gpu_obj(plane->state->fb->obj[0]);
> + if (virtio_gpu_is_vram(bo) || bo->base.base.import_attach)
> + return -ENODEV;
> +
> + /* try to vmap it if possible */
> + if (!bo->base.vaddr) {
> + int ret;
> +
> + ret = drm_gem_shmem_vmap(&bo->base, &sb->map[0]);
drm_gem_shmem_vmap() requires BO resv to be locked, it also may invoke
drm_gem_shmem_get_pages() that sleeps. This function can't be used in
atomic context.
For the starter, let's reject !bo->base.vaddr BOs. Normally, shmem FB
BOs are always vmapped.
--
Best regards,
Dmitry