• Helen Koike's avatar
    drm: don't block fb changes for async plane updates · ff8386d9
    Helen Koike authored
    commit 89a4aac0ab0e6f5eea10d7bf4869dd15c3de2cd4 upstream.
    
    In the case of a normal sync update, the preparation of framebuffers (be
    it calling drm_atomic_helper_prepare_planes() or doing setups with
    drm_framebuffer_get()) are performed in the new_state and the respective
    cleanups are performed in the old_state.
    
    In the case of async updates, the preparation is also done in the
    new_state but the cleanups are done in the new_state (because updates
    are performed in place, i.e. in the current state).
    
    The current code blocks async udpates when the fb is changed, turning
    async updates into sync updates, slowing down cursor updates and
    introducing regressions in igt tests with errors of type:
    
    "CRITICAL: completed 97 cursor updated in a period of 30 flips, we
    expect to complete approximately 15360 updates, with the threshold set
    at 7680"
    
    Fb changes in async updates were prevented to avoid the following scenario:
    
    - Async update, oldfb = NULL, newfb = fb1, prepare fb1, cleanup fb1
    - Async update, oldfb = fb1, newfb = fb2, prepare fb2, cleanup fb2
    - Non-async commit, oldfb = fb2, newfb = fb1, prepare fb1, cleanup fb2 (wrong)
    Where we have a single call to prepare fb2 but double cleanup call to fb2.
    
    To solve the above problems, instead of blocking async fb changes, we
    place the old framebuffer in the new_state object, so when the code
    performs cleanups in the new_state it will cleanup the old_fb and we
    will have the following scenario instead:
    
    - Async update, oldfb = NULL, newfb = fb1, prepare fb1, no cleanup
    - Async update, oldfb = fb1, newfb = fb2, prepare fb2, cleanup fb1
    - Non-async commit, oldfb = fb2, newfb = fb1, prepare fb1, cleanup fb2
    
    Where calls to prepare/cleanup are balanced.
    
    Cc: <stable@vger.kernel.org> # v4.14+
    Fixes: 25dc194b34dd ("drm: Block fb changes for async plane updates")
    Suggested-by: 's avatarBoris Brezillon <boris.brezillon@collabora.com>
    Signed-off-by: 's avatarHelen Koike <helen.koike@collabora.com>
    Reviewed-by: 's avatarBoris Brezillon <boris.brezillon@collabora.com>
    Reviewed-by: 's avatarNicholas Kazlauskas <nicholas.kazlauskas@amd.com>
    Signed-off-by: 's avatarBoris Brezillon <boris.brezillon@collabora.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20190603165610.24614-6-helen.koike@collabora.comSigned-off-by: 's avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    ff8386d9
Name
Last commit
Last update
..
bridge Loading commit data...
i2c Loading commit data...
tinydrm Loading commit data...
ttm Loading commit data...
ati_pcigart.h Loading commit data...
drmP.h Loading commit data...
drm_agpsupport.h Loading commit data...
drm_atomic.h Loading commit data...
drm_atomic_helper.h Loading commit data...
drm_auth.h Loading commit data...
drm_blend.h Loading commit data...
drm_bridge.h Loading commit data...
drm_cache.h Loading commit data...
drm_color_mgmt.h Loading commit data...
drm_connector.h Loading commit data...
drm_crtc.h Loading commit data...
drm_crtc_helper.h Loading commit data...
drm_debugfs.h Loading commit data...
drm_debugfs_crc.h Loading commit data...
drm_device.h Loading commit data...
drm_displayid.h Loading commit data...
drm_dp_dual_mode_helper.h Loading commit data...
drm_dp_helper.h Loading commit data...
drm_dp_mst_helper.h Loading commit data...
drm_drv.h Loading commit data...
drm_edid.h Loading commit data...
drm_encoder.h Loading commit data...
drm_encoder_slave.h Loading commit data...
drm_fb_cma_helper.h Loading commit data...
drm_fb_helper.h Loading commit data...
drm_file.h Loading commit data...
drm_fixed.h Loading commit data...
drm_flip_work.h Loading commit data...
drm_fourcc.h Loading commit data...
drm_framebuffer.h Loading commit data...
drm_gem.h Loading commit data...
drm_gem_cma_helper.h Loading commit data...
drm_gem_framebuffer_helper.h Loading commit data...
drm_global.h Loading commit data...
drm_hashtab.h Loading commit data...
drm_ioctl.h Loading commit data...
drm_irq.h Loading commit data...
drm_legacy.h Loading commit data...
drm_mipi_dsi.h Loading commit data...
drm_mm.h Loading commit data...
drm_mode_config.h Loading commit data...
drm_mode_object.h Loading commit data...
drm_modes.h Loading commit data...
drm_modeset_helper.h Loading commit data...
drm_modeset_helper_vtables.h Loading commit data...
drm_modeset_lock.h Loading commit data...
drm_of.h Loading commit data...
drm_os_linux.h Loading commit data...
drm_panel.h Loading commit data...
drm_pci.h Loading commit data...
drm_pciids.h Loading commit data...
drm_plane.h Loading commit data...
drm_plane_helper.h Loading commit data...
drm_prime.h Loading commit data...
drm_print.h Loading commit data...
drm_property.h Loading commit data...
drm_rect.h Loading commit data...
drm_scdc_helper.h Loading commit data...
drm_simple_kms_helper.h Loading commit data...
drm_syncobj.h Loading commit data...
drm_sysfs.h Loading commit data...
drm_vblank.h Loading commit data...
drm_vma_manager.h Loading commit data...
gma_drm.h Loading commit data...
i915_component.h Loading commit data...
i915_drm.h Loading commit data...
i915_pciids.h Loading commit data...
intel-gtt.h Loading commit data...
intel_lpe_audio.h Loading commit data...