OpenCloudOS-Kernel/drivers/gpu/drm/rcar-du
Laurent Pinchart 5ee5a81df5 drm: rcar-du: Fix race condition in hardware plane allocator
The plane allocator has been inherently racy since the beginning of the
transition to atomic updates, as the allocator lock is released between
free plane check (at .atomic_check() time) and the reservation (at
.atomic_update() time).

To fix it, create a new allocator solely based on the atomic plane
states without keeping any external state and perform allocation in the
.atomic_check() handler. The core idea is to replace the free planes
bitmask with a collective knowledge based on the allocated hardware
plane(s) for each KMS plane. The allocator then loops over all plane
states to compute the free planes bitmask, allocates hardware planes
based on that bitmask, and stores the result back in the plane states.

For this to work we need to access the current state of planes not
touched by the atomic update. To ensure that it won't be modified, we
need to lock all planes using drm_atomic_get_plane_state(). This
effectively serializes atomic updates from .atomic_check() up to
completion, either when swapping the states if the check step has
succeeded, or when freeing the states if the check step has failed.

Suggested-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
2015-03-03 16:16:30 +02:00
..
Kconfig drm: Kconfig: Let all DRM_GEM_CMA_HELPER related macros depend on HAVE_DMA_ATTRS 2015-02-03 11:12:37 +10:00
Makefile drm: rcar-du: Add HDMI encoder and connector support 2014-11-26 20:09:38 +02:00
rcar_du_crtc.c drm: rcar-du: Fix race condition in hardware plane allocator 2015-03-03 16:16:30 +02:00
rcar_du_crtc.h drm: rcar-du: Remove unneeded rcar_du_crtc plane field 2015-03-03 16:16:26 +02:00
rcar_du_drv.c drm: rcar-du: Implement asynchronous commit support 2015-03-03 16:16:21 +02:00
rcar_du_drv.h drm: rcar-du: Implement asynchronous commit support 2015-03-03 16:16:21 +02:00
rcar_du_encoder.c drm: rcar-du: Replace encoder mode_fixup with atomic_check 2015-03-03 16:16:21 +02:00
rcar_du_encoder.h drm: rcar-du: Add HDMI encoder and connector support 2014-11-26 20:09:38 +02:00
rcar_du_group.c drm: rcar-du: Add support for external pixel clock 2014-12-23 12:01:50 +02:00
rcar_du_group.h drm: rcar-du: Fix race condition in hardware plane allocator 2015-03-03 16:16:30 +02:00
rcar_du_hdmicon.c drm: rcar-du: Switch connector DPMS to atomic helpers 2015-03-03 16:16:20 +02:00
rcar_du_hdmicon.h drm: rcar-du: Add HDMI encoder and connector support 2014-11-26 20:09:38 +02:00
rcar_du_hdmienc.c drm: rcar-du: Replace encoder mode_fixup with atomic_check 2015-03-03 16:16:21 +02:00
rcar_du_hdmienc.h drm: rcar-du: Add HDMI encoder and connector support 2014-11-26 20:09:38 +02:00
rcar_du_kms.c drm: rcar-du: Fix race condition in hardware plane allocator 2015-03-03 16:16:30 +02:00
rcar_du_kms.h drm/rcar-du: Update copyright notice 2014-09-15 11:34:06 +03:00
rcar_du_lvdscon.c drm: rcar-du: Switch connector DPMS to atomic helpers 2015-03-03 16:16:20 +02:00
rcar_du_lvdscon.h drm: rcar-du: Remove platform data support 2014-11-26 20:09:36 +02:00
rcar_du_lvdsenc.c drm: rcar-du: Replace LVDS encoder DPMS by enable/disable 2015-03-03 16:16:14 +02:00
rcar_du_lvdsenc.h drm: rcar-du: Replace LVDS encoder DPMS by enable/disable 2015-03-03 16:16:14 +02:00
rcar_du_plane.c drm: rcar-du: Fix race condition in hardware plane allocator 2015-03-03 16:16:30 +02:00
rcar_du_plane.h drm: rcar-du: Fix race condition in hardware plane allocator 2015-03-03 16:16:30 +02:00
rcar_du_regs.h drm: rcar-du: Implement support for interlaced modes 2014-12-23 12:01:52 +02:00
rcar_du_vgacon.c drm: rcar-du: Switch connector DPMS to atomic helpers 2015-03-03 16:16:20 +02:00
rcar_du_vgacon.h drm/rcar-du: Update copyright notice 2014-09-15 11:34:06 +03:00
rcar_lvds_regs.h drm/rcar-du: Add internal LVDS encoder support 2013-08-09 23:17:53 +02:00