A framebuffer reconstructed from a hardware state readout describes a buffer that the firmware allocated, outside of the kernel memory allocator, so its planes have no GEM object attached.
drm_gem_plane_helper_prepare_fb() retrieves the GEM object of every plane through drm_gem_fb_get_obj() to extract the implicit fences from its reservation. For a readout framebuffer, this triggers drm_WARN_ON_ONCE(!fb->obj[plane]), returns NULL, and fails the whole commit with -EINVAL. This can be hit as soon as the state readout installs such a framebuffer on a plane: any commit that includes the plane without userspace providing a new framebuffer will duplicate its current state, readout framebuffer included, and run prepare_fb() on it. Blanking the display through DPMS right after boot is such a case, since it pulls the plane in through drm_atomic_add_affected_planes(). Access the framebuffer obj[] array directly and skip the planes without a GEM object: there is no reservation to extract implicit fences from anyway. This mirrors what drm_fb_dma_get_scanout_buffer() does for such framebuffers. Signed-off-by: Maxime Ripard <[email protected]> --- drivers/gpu/drm/drm_gem_atomic_helper.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/drm_gem_atomic_helper.c b/drivers/gpu/drm/drm_gem_atomic_helper.c index c952cfed84c1..bab354d12fe7 100644 --- a/drivers/gpu/drm/drm_gem_atomic_helper.c +++ b/drivers/gpu/drm/drm_gem_atomic_helper.c @@ -138,11 +138,15 @@ int drm_gem_plane_helper_prepare_fb(struct drm_plane *plane, for (i = 0; i < state->fb->format->num_planes; ++i) { - struct drm_gem_object *obj = drm_gem_fb_get_obj(state->fb, i); + struct drm_gem_object *obj = state->fb->obj[i]; struct dma_fence *new; - if (!obj) { - ret = -EINVAL; - goto error; - } + /* + * A framebuffer reconstructed from a hardware state + * readout has no GEM object backing its planes, as it + * describes a buffer allocated outside of the kernel: + * there is no implicit fencing to wait on. + */ + if (!obj) + continue; ret = dma_resv_get_singleton(obj->resv, usage, &new); -- 2.55.0
