OpenCloudOS-Kernel/drivers/gpu/drm
Jason Ekstrand e7aca5031a drm/syncobj: Allow wait for submit and signal behavior (v5)
Vulkan VkFence semantics require that the application be able to perform
a CPU wait on work which may not yet have been submitted.  This is
perfectly safe because the CPU wait has a timeout which will get
triggered eventually if no work is ever submitted.  This behavior is
advantageous for multi-threaded workloads because, so long as all of the
threads agree on what fences to use up-front, you don't have the extra
cross-thread synchronization cost of thread A telling thread B that it
has submitted its dependent work and thread B is now free to wait.

Within a single process, this can be implemented in the userspace driver
by doing exactly the same kind of tracking the app would have to do
using posix condition variables or similar.  However, in order for this
to work cross-process (as is required by VK_KHR_external_fence), we need
to handle this in the kernel.

This commit adds a WAIT_FOR_SUBMIT flag to DRM_IOCTL_SYNCOBJ_WAIT which
instructs the IOCTL to wait for the syncobj to have a non-null fence and
then wait on the fence.  Combined with DRM_IOCTL_SYNCOBJ_RESET, you can
easily get the Vulkan behavior.

v2:
 - Fix a bug in the invalid syncobj error path
 - Unify the wait-all and wait-any cases
v3:
 - Unify the timeout == 0 case a bit with the timeout > 0 case
 - Use wait_event_interruptible_timeout
v4:
 - Use proxy fence
v5:
 - Revert to a combination of v2 and v3
 - Don't use proxy fences
 - Don't use wait_event_interruptible_timeout because it just adds an
   extra layer of callbacks

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Cc: Dave Airlie <airlied@redhat.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Christian König <christian.koenig@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2017-08-29 06:28:17 +10:00
..
amd drm/syncobj: Rename fence_get to find_fence 2017-08-29 06:17:37 +10:00
arc Merge tag 'drm-misc-next-2017-08-16' of git://anongit.freedesktop.org/git/drm-misc into drm-next 2017-08-17 07:33:41 +10:00
arm drm: Nuke drm_atomic_helper_plane_set_property 2017-08-08 14:45:16 +02:00
armada drm: armada: remove dead empty functions 2017-08-04 11:35:34 +02:00
ast Merge tag 'drm-misc-next-2017-08-16' of git://anongit.freedesktop.org/git/drm-misc into drm-next 2017-08-17 07:33:41 +10:00
atmel-hlcdc drm: Nuke drm_atomic_helper_plane_set_property 2017-08-08 14:45:16 +02:00
bochs drm/bochs: Use the drm_driver.dumb_destroy default 2017-08-16 20:18:55 +02:00
bridge Merge tag 'drm-misc-next-2017-08-16' of git://anongit.freedesktop.org/git/drm-misc into drm-next 2017-08-17 07:33:41 +10:00
cirrus drm/cirrus: Use the drm_driver.dumb_destroy default 2017-08-16 20:14:22 +02:00
etnaviv Merge branch 'etnaviv/next' of https://git.pengutronix.de/git/lst/linux into drm-next 2017-08-21 14:34:15 +10:00
exynos Merge tag 'drm-misc-next-2017-08-16' of git://anongit.freedesktop.org/git/drm-misc into drm-next 2017-08-17 07:33:41 +10:00
fsl-dcu drm: Nuke drm_atomic_helper_connector_dpms 2017-08-08 14:48:48 +02:00
gma500 drm/gma500: fix potential NULL pointer dereference dereference 2017-08-18 09:10:46 +02:00
hisilicon drm: kirin: Add mode_valid logic to avoid mode clocks we can't generate 2017-08-29 05:20:35 +10:00
i2c drm: Nuke drm_atomic_helper_connector_dpms 2017-08-08 14:48:48 +02:00
i810 drm/pci: Deprecate drm_pci_init/exit completely 2017-06-20 10:41:03 +02:00
i915 i915: Use drm_syncobj_fence_get 2017-08-29 06:20:31 +10:00
imx imx-drm: lock scanout transfers for consecutive bursts 2017-08-22 16:51:11 +10:00
lib
mediatek drm/mediatek: switch to drm_*_get(), drm_*_put() helpers 2017-08-11 11:35:02 -04:00
meson drm/meson: Use .dumb_map_offset and .dumb_destroy defaults 2017-08-16 20:11:43 +02:00
mga Merge airlied/drm-next into drm-misc-next 2017-07-26 13:43:33 +02:00
mgag200 drm/mgag200: Use the drm_driver.dumb_destroy default 2017-08-16 20:18:22 +02:00
msm Merge tag 'drm-msm-next-2017-08-22' of git://people.freedesktop.org/~robclark/linux into drm-next 2017-08-25 09:29:45 +10:00
mxsfb drm/mxsfb: Use .dumb_map_offset and .dumb_destroy defaults 2017-08-16 20:12:19 +02:00
nouveau drm/nouveau/kms/nv50: perform null check on msto[i] rathern than msto 2017-08-22 18:04:36 +10:00
omapdrm drm/omap: work-around for omap3 display enable 2017-08-23 12:22:12 +03:00
panel drm: Convert to using %pOF instead of full_name 2017-07-26 13:45:06 +02:00
pl111 drm/pl111: Use drm_gem_fb_create() and drm_gem_fb_prepare_fb() 2017-08-16 21:35:38 +02:00
qxl drm/qxl: Use the drm_driver.dumb_destroy default 2017-08-16 20:15:38 +02:00
r128 drm/pci: Deprecate drm_pci_init/exit completely 2017-06-20 10:41:03 +02:00
radeon Merge tag 'drm-amdkfd-next-2017-08-18' of git://people.freedesktop.org/~gabbayo/linux into drm-next 2017-08-21 10:49:48 +10:00
rcar-du Merge tag 'drm-misc-next-2017-08-08' of git://anongit.freedesktop.org/git/drm-misc into drm-next 2017-08-10 10:47:33 +10:00
rockchip Merge tag 'drm-misc-next-2017-08-16' of git://anongit.freedesktop.org/git/drm-misc into drm-next 2017-08-17 07:33:41 +10:00
savage drm/pci: Deprecate drm_pci_init/exit completely 2017-06-20 10:41:03 +02:00
selftests
shmobile drm/shmobile: Use .dumb_map_offset and .dumb_destroy defaults 2017-07-29 13:57:33 +02:00
sis drm/pci: Deprecate drm_pci_init/exit completely 2017-06-20 10:41:03 +02:00
sti drm: Nuke drm_atomic_helper_connector_dpms 2017-08-08 14:48:48 +02:00
stm drm: make DRM_STM default n 2017-08-10 11:26:49 +10:00
sun4i sun4i DRM changes for 4.14, take 2 2017-08-25 09:30:54 +10:00
tdfx drm/pci: Deprecate drm_pci_init/exit completely 2017-06-20 10:41:03 +02:00
tegra drm/tegra: Changes for v4.14-rc1 2017-08-21 17:37:33 +10:00
tilcdc drm: Nuke drm_atomic_helper_connector_dpms 2017-08-08 14:48:48 +02:00
tinydrm drm/tinydrm: make function st7586_pipe_enable static 2017-08-16 21:39:26 +02:00
ttm drm/ttm: use reservation_object_trylock in ttm_bo_individualize_resv v2 2017-08-18 12:02:58 -04:00
udl drm: udl: constify usb_device_id 2017-08-18 09:10:46 +02:00
vc4 drm/vc4: Use drm_gem_fb_create() 2017-08-16 21:35:57 +02:00
vgem drm/vgem: switch to drm_*_get(), drm_*_put() helpers 2017-08-11 11:41:43 -04:00
via drm/pci: Deprecate drm_pci_init/exit completely 2017-06-20 10:41:03 +02:00
virtio drm/ttm: make ttm_mem_type_manager_func debug more useful 2017-08-17 15:45:59 -04:00
vmwgfx drm/ttm: make ttm_mem_type_manager_func debug more useful 2017-08-17 15:45:59 -04:00
zte drm: Nuke drm_atomic_helper_connector_dpms 2017-08-08 14:48:48 +02:00
Kconfig
Makefile drm: Add GEM backed framebuffer library 2017-08-16 21:32:23 +02:00
ati_pcigart.c
drm_agpsupport.c
drm_atomic.c drm: Nuke drm_atomic_legacy_backoff 2017-08-08 14:49:29 +02:00
drm_atomic_helper.c Merge airlied/drm-next into drm-intel-next-queued 2017-08-10 18:12:01 +02:00
drm_auth.c
drm_blend.c
drm_bridge.c
drm_bufs.c switch compat_drm_mapbufs() to drm_ioctl_kernel() 2017-07-04 13:16:26 -04:00
drm_cache.c
drm_color_mgmt.c drm: More links for gamma support helpers 2017-06-20 12:13:11 +02:00
drm_connector.c drm: Handle properties in the core for atomic drivers 2017-08-08 14:45:09 +02:00
drm_context.c
drm_crtc.c drm: Handle properties in the core for atomic drivers 2017-08-08 14:45:09 +02:00
drm_crtc_helper.c drm: Handle properties in the core for atomic drivers 2017-08-08 14:45:09 +02:00
drm_crtc_helper_internal.h
drm_crtc_internal.h drm: Handle properties in the core for atomic drivers 2017-08-08 14:45:09 +02:00
drm_debugfs.c
drm_debugfs_crc.c drm/crc: Only open CRC on atomic drivers when the CRTC is active. 2017-07-17 16:34:51 +02:00
drm_dma.c
drm_dp_aux_dev.c drm_dp_aux_dev: switch to read_iter/write_iter 2017-07-08 20:51:46 -04:00
drm_dp_dual_mode_helper.c
drm_dp_helper.c drm/dp: Don't trust drm_dp_downstream_id() 2017-07-21 17:45:26 +03:00
drm_dp_mst_topology.c Linux 4.13-rc2 2017-07-27 08:15:43 +10:00
drm_drv.c drm: Clean up drm_dev_unplug 2017-08-11 10:49:21 +02:00
drm_dumb_buffers.c drm/dumb-buffers: Add defaults for .dumb_map_offset and .dumb_destroy 2017-07-29 13:51:44 +02:00
drm_edid.c drm/edid: parse ycbcr 420 deep color information 2017-07-14 21:23:54 +03:00
drm_edid_load.c
drm_encoder.c
drm_encoder_slave.c
drm_fb_cma_helper.c drm/fb-cma-helper: Use drm_gem_framebuffer_helper 2017-08-16 21:34:38 +02:00
drm_fb_helper.c drm/fb-helper: pass physical dimensions to fbdev 2017-08-07 17:01:15 +02:00
drm_file.c drm: Document device unplug infrastructure 2017-08-11 10:48:03 +02:00
drm_flip_work.c
drm_fourcc.c
drm_framebuffer.c Merge airlied/drm-next into drm-misc-next 2017-07-26 13:43:33 +02:00
drm_gem.c drm: Document device unplug infrastructure 2017-08-11 10:48:03 +02:00
drm_gem_cma_helper.c drm/gem-cma-helper: Remove drm_gem_cma_dumb_map_offset() 2017-08-16 20:21:24 +02:00
drm_gem_framebuffer_helper.c drm: Add GEM backed framebuffer library 2017-08-16 21:32:23 +02:00
drm_global.c
drm_hashtab.c
drm_info.c
drm_internal.h drm/syncobj: add sync obj wait interface. (v8) 2017-08-29 06:26:32 +10:00
drm_ioc32.c Merge airlied/drm-next into drm-misc-next 2017-07-26 13:43:33 +02:00
drm_ioctl.c drm/syncobj: add sync obj wait interface. (v8) 2017-08-29 06:26:32 +10:00
drm_irq.c
drm_kms_helper_common.c
drm_legacy.h switch compat_drm_mapbufs() to drm_ioctl_kernel() 2017-07-04 13:16:26 -04:00
drm_lock.c
drm_memory.c
drm_mipi_dsi.c drm: Convert to using %pOF instead of full_name 2017-07-26 13:45:06 +02:00
drm_mm.c
drm_mode_config.c drm: Create a format/modifier blob 2017-08-01 17:50:06 +01:00
drm_mode_object.c drm: Handle properties in the core for atomic drivers 2017-08-08 14:45:09 +02:00
drm_modes.c drm/modes: Fix drm_mode_is_420_only() comment 2017-07-31 14:23:30 +02:00
drm_modeset_helper.c drm: Plumb modifiers through plane init 2017-08-01 17:50:06 +01:00
drm_modeset_lock.c drm: Improve kerneldoc for drm_modeset_lock 2017-07-26 13:45:08 +02:00
drm_of.c drm: Convert to using %pOF instead of full_name 2017-07-26 13:45:06 +02:00
drm_panel.c
drm_pci.c drm/pci: Deprecate drm_pci_init/exit completely 2017-06-20 10:41:03 +02:00
drm_plane.c drm: Shift wrap bug in create_in_format_blob() 2017-08-09 10:15:52 -04:00
drm_plane_helper.c
drm_prime.c
drm_print.c
drm_probe_helper.c drm: add helper to validate YCBCR420 modes 2017-07-14 21:23:54 +03:00
drm_property.c drm: rename, adjust and export drm_atomic_replace_property_blob 2017-07-14 15:53:06 +02:00
drm_rect.c
drm_scatter.c
drm_scdc_helper.c drm: Fix warning when building docs for scdc_helper 2017-07-31 14:24:14 +02:00
drm_simple_kms_helper.c drm: Plumb modifiers through plane init 2017-08-01 17:50:06 +01:00
drm_syncobj.c drm/syncobj: Allow wait for submit and signal behavior (v5) 2017-08-29 06:28:17 +10:00
drm_sysfs.c
drm_trace.h
drm_trace_points.c
drm_vblank.c Merge airlied/drm-next into drm-misc-next 2017-07-26 13:43:33 +02:00
drm_vm.c drm: Document device unplug infrastructure 2017-08-11 10:48:03 +02:00
drm_vma_manager.c