Эх сурвалжийг харах

Merge tag 'drm-misc-next-2018-07-04' of git://anongit.freedesktop.org/drm/drm-misc into drm-next

drm-misc-next for 4.19:

UAPI Changes:
v3d: add fourcc modicfier for fourcc for the Broadcom UIF format (Eric Anholt)

Cross-subsystem Changes:
console/fbcon: Add support for deferred console takeover (Hans de Goede)

Core Changes:
dma-fence clean up, improvements and docs (Daniel Vetter)
add mask function for crtc, plane, encoder and connector DRM objects(Ville Syrjälä)

Driver Changes:
pl111: add Nomadik LCDC variant (Linus Walleij)

Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180704234641.GA3981@juma
Dave Airlie 7 жил өмнө
parent
commit
a1c3b49523
100 өөрчлөгдсөн 484 нэмэгдсэн , 336 устгасан
  1. 6 0
      Documentation/driver-api/dma-buf.rst
  2. 7 0
      Documentation/fb/fbcon.txt
  3. 1 1
      Documentation/gpu/drm-kms.rst
  4. 0 1
      drivers/dma-buf/dma-fence-array.c
  5. 112 55
      drivers/dma-buf/dma-fence.c
  6. 0 1
      drivers/dma-buf/sw_sync.c
  7. 0 2
      drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_fence.c
  8. 0 1
      drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
  9. 1 1
      drivers/gpu/drm/arc/arcpgu_crtc.c
  10. 1 1
      drivers/gpu/drm/arm/hdlcd_crtc.c
  11. 5 5
      drivers/gpu/drm/drm_atomic.c
  12. 15 10
      drivers/gpu/drm/drm_atomic_helper.c
  13. 1 3
      drivers/gpu/drm/drm_connector.c
  14. 2 9
      drivers/gpu/drm/drm_crtc.c
  15. 1 1
      drivers/gpu/drm/drm_framebuffer.c
  16. 1 1
      drivers/gpu/drm/drm_global.c
  17. 6 2
      drivers/gpu/drm/drm_plane_helper.c
  18. 2 2
      drivers/gpu/drm/drm_simple_kms_helper.c
  19. 0 1
      drivers/gpu/drm/drm_syncobj.c
  20. 1 0
      drivers/gpu/drm/drm_vma_manager.c
  21. 0 7
      drivers/gpu/drm/etnaviv/etnaviv_gpu.c
  22. 1 1
      drivers/gpu/drm/i810/i810_dma.c
  23. 7 7
      drivers/gpu/drm/i915/intel_display.c
  24. 2 2
      drivers/gpu/drm/i915/intel_display.h
  25. 3 3
      drivers/gpu/drm/i915/intel_dpll_mgr.c
  26. 1 1
      drivers/gpu/drm/imx/ipuv3-crtc.c
  27. 1 1
      drivers/gpu/drm/msm/disp/mdp4/mdp4_plane.c
  28. 1 1
      drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c
  29. 1 2
      drivers/gpu/drm/nouveau/nouveau_ttm.c
  30. 1 0
      drivers/gpu/drm/pl111/Makefile
  31. 45 9
      drivers/gpu/drm/pl111/pl111_display.c
  32. 5 0
      drivers/gpu/drm/pl111/pl111_drm.h
  33. 40 4
      drivers/gpu/drm/pl111/pl111_drv.c
  34. 36 0
      drivers/gpu/drm/pl111/pl111_nomadik.c
  35. 18 0
      drivers/gpu/drm/pl111/pl111_nomadik.h
  36. 0 7
      drivers/gpu/drm/qxl/qxl_release.c
  37. 1 1
      drivers/gpu/drm/savage/savage_state.c
  38. 0 11
      drivers/gpu/drm/scheduler/sched_fence.c
  39. 1 1
      drivers/gpu/drm/sti/sti_cursor.c
  40. 1 1
      drivers/gpu/drm/sti/sti_gdp.c
  41. 1 1
      drivers/gpu/drm/sti/sti_hqvdp.c
  42. 1 1
      drivers/gpu/drm/sun4i/sun4i_crtc.c
  43. 1 1
      drivers/gpu/drm/sun4i/sun4i_lvds.c
  44. 1 1
      drivers/gpu/drm/sun4i/sun4i_rgb.c
  45. 3 3
      drivers/gpu/drm/vc4/vc4_crtc.c
  46. 27 15
      drivers/gpu/drm/vc4/vc4_dsi.c
  47. 0 8
      drivers/gpu/drm/vc4/vc4_fence.c
  48. 1 1
      drivers/gpu/drm/vc4/vc4_plane.c
  49. 1 1
      drivers/gpu/drm/vgem/vgem_drv.c
  50. 0 7
      drivers/gpu/drm/virtio/virtgpu_fence.c
  51. 1 0
      drivers/gpu/drm/vmwgfx/Kconfig
  52. 2 1
      drivers/gpu/drm/vmwgfx/device_include/svga3d_caps.h
  53. 2 1
      drivers/gpu/drm/vmwgfx/device_include/svga3d_cmd.h
  54. 2 1
      drivers/gpu/drm/vmwgfx/device_include/svga3d_devcaps.h
  55. 2 1
      drivers/gpu/drm/vmwgfx/device_include/svga3d_dx.h
  56. 2 1
      drivers/gpu/drm/vmwgfx/device_include/svga3d_limits.h
  57. 2 1
      drivers/gpu/drm/vmwgfx/device_include/svga3d_reg.h
  58. 2 2
      drivers/gpu/drm/vmwgfx/device_include/svga3d_surfacedefs.h
  59. 2 1
      drivers/gpu/drm/vmwgfx/device_include/svga3d_types.h
  60. 2 1
      drivers/gpu/drm/vmwgfx/device_include/svga_escape.h
  61. 2 1
      drivers/gpu/drm/vmwgfx/device_include/svga_overlay.h
  62. 2 1
      drivers/gpu/drm/vmwgfx/device_include/svga_reg.h
  63. 2 1
      drivers/gpu/drm/vmwgfx/device_include/svga_types.h
  64. 1 24
      drivers/gpu/drm/vmwgfx/device_include/vmware_pack_begin.h
  65. 1 24
      drivers/gpu/drm/vmwgfx/device_include/vmware_pack_end.h
  66. 2 2
      drivers/gpu/drm/vmwgfx/vmwgfx_binding.c
  67. 2 2
      drivers/gpu/drm/vmwgfx/vmwgfx_binding.h
  68. 2 1
      drivers/gpu/drm/vmwgfx/vmwgfx_blit.c
  69. 2 2
      drivers/gpu/drm/vmwgfx/vmwgfx_buffer.c
  70. 2 2
      drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c
  71. 2 2
      drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf_res.c
  72. 2 2
      drivers/gpu/drm/vmwgfx/vmwgfx_context.c
  73. 2 2
      drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c
  74. 2 2
      drivers/gpu/drm/vmwgfx/vmwgfx_dmabuf.c
  75. 2 2
      drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
  76. 2 2
      drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
  77. 2 2
      drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
  78. 2 2
      drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
  79. 2 2
      drivers/gpu/drm/vmwgfx/vmwgfx_fence.h
  80. 2 2
      drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c
  81. 2 2
      drivers/gpu/drm/vmwgfx/vmwgfx_gmr.c
  82. 2 2
      drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c
  83. 2 2
      drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c
  84. 2 2
      drivers/gpu/drm/vmwgfx/vmwgfx_irq.c
  85. 4 4
      drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
  86. 2 2
      drivers/gpu/drm/vmwgfx/vmwgfx_kms.h
  87. 2 2
      drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
  88. 2 2
      drivers/gpu/drm/vmwgfx/vmwgfx_marker.c
  89. 2 2
      drivers/gpu/drm/vmwgfx/vmwgfx_mob.c
  90. 2 2
      drivers/gpu/drm/vmwgfx/vmwgfx_msg.c
  91. 24 11
      drivers/gpu/drm/vmwgfx/vmwgfx_msg.h
  92. 2 2
      drivers/gpu/drm/vmwgfx/vmwgfx_overlay.c
  93. 2 2
      drivers/gpu/drm/vmwgfx/vmwgfx_prime.c
  94. 2 2
      drivers/gpu/drm/vmwgfx/vmwgfx_reg.h
  95. 2 2
      drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
  96. 2 2
      drivers/gpu/drm/vmwgfx/vmwgfx_resource_priv.h
  97. 2 2
      drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c
  98. 2 2
      drivers/gpu/drm/vmwgfx/vmwgfx_shader.c
  99. 2 2
      drivers/gpu/drm/vmwgfx/vmwgfx_simple_resource.c
  100. 2 2
      drivers/gpu/drm/vmwgfx/vmwgfx_so.c

+ 6 - 0
Documentation/driver-api/dma-buf.rst

@@ -130,6 +130,12 @@ Reservation Objects
 DMA Fences
 DMA Fences
 ----------
 ----------
 
 
+.. kernel-doc:: drivers/dma-buf/dma-fence.c
+   :doc: DMA fences overview
+
+DMA Fences Functions Reference
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
 .. kernel-doc:: drivers/dma-buf/dma-fence.c
 .. kernel-doc:: drivers/dma-buf/dma-fence.c
    :export:
    :export:
 
 

+ 7 - 0
Documentation/fb/fbcon.txt

@@ -155,6 +155,13 @@ C. Boot options
 	used by text. By default, this area will be black. The 'color' value
 	used by text. By default, this area will be black. The 'color' value
 	is an integer number that depends on the framebuffer driver being used.
 	is an integer number that depends on the framebuffer driver being used.
 
 
+6. fbcon=nodefer
+
+	If the kernel is compiled with deferred fbcon takeover support, normally
+	the framebuffer contents, left in place by the firmware/bootloader, will
+	be preserved until there actually is some text is output to the console.
+	This option causes fbcon to bind immediately to the fbdev device.
+
 C. Attaching, Detaching and Unloading
 C. Attaching, Detaching and Unloading
 
 
 Before going on how to attach, detach and unload the framebuffer console, an
 Before going on how to attach, detach and unload the framebuffer console, an

+ 1 - 1
Documentation/gpu/drm-kms.rst

@@ -527,7 +527,7 @@ Standard Connector Properties
    :doc: standard connector properties
    :doc: standard connector properties
 
 
 HDMI Specific Connector Properties
 HDMI Specific Connector Properties
------------------------------
+----------------------------------
 
 
 .. kernel-doc:: drivers/gpu/drm/drm_connector.c
 .. kernel-doc:: drivers/gpu/drm/drm_connector.c
    :doc: HDMI connector properties
    :doc: HDMI connector properties

+ 0 - 1
drivers/dma-buf/dma-fence-array.c

@@ -104,7 +104,6 @@ const struct dma_fence_ops dma_fence_array_ops = {
 	.get_timeline_name = dma_fence_array_get_timeline_name,
 	.get_timeline_name = dma_fence_array_get_timeline_name,
 	.enable_signaling = dma_fence_array_enable_signaling,
 	.enable_signaling = dma_fence_array_enable_signaling,
 	.signaled = dma_fence_array_signaled,
 	.signaled = dma_fence_array_signaled,
-	.wait = dma_fence_default_wait,
 	.release = dma_fence_array_release,
 	.release = dma_fence_array_release,
 };
 };
 EXPORT_SYMBOL(dma_fence_array_ops);
 EXPORT_SYMBOL(dma_fence_array_ops);

+ 112 - 55
drivers/dma-buf/dma-fence.c

@@ -38,12 +38,43 @@ EXPORT_TRACEPOINT_SYMBOL(dma_fence_enable_signal);
  */
  */
 static atomic64_t dma_fence_context_counter = ATOMIC64_INIT(0);
 static atomic64_t dma_fence_context_counter = ATOMIC64_INIT(0);
 
 
+/**
+ * DOC: DMA fences overview
+ *
+ * DMA fences, represented by &struct dma_fence, are the kernel internal
+ * synchronization primitive for DMA operations like GPU rendering, video
+ * encoding/decoding, or displaying buffers on a screen.
+ *
+ * A fence is initialized using dma_fence_init() and completed using
+ * dma_fence_signal(). Fences are associated with a context, allocated through
+ * dma_fence_context_alloc(), and all fences on the same context are
+ * fully ordered.
+ *
+ * Since the purposes of fences is to facilitate cross-device and
+ * cross-application synchronization, there's multiple ways to use one:
+ *
+ * - Individual fences can be exposed as a &sync_file, accessed as a file
+ *   descriptor from userspace, created by calling sync_file_create(). This is
+ *   called explicit fencing, since userspace passes around explicit
+ *   synchronization points.
+ *
+ * - Some subsystems also have their own explicit fencing primitives, like
+ *   &drm_syncobj. Compared to &sync_file, a &drm_syncobj allows the underlying
+ *   fence to be updated.
+ *
+ * - Then there's also implicit fencing, where the synchronization points are
+ *   implicitly passed around as part of shared &dma_buf instances. Such
+ *   implicit fences are stored in &struct reservation_object through the
+ *   &dma_buf.resv pointer.
+ */
+
 /**
 /**
  * dma_fence_context_alloc - allocate an array of fence contexts
  * dma_fence_context_alloc - allocate an array of fence contexts
- * @num:	[in]	amount of contexts to allocate
+ * @num: amount of contexts to allocate
  *
  *
- * This function will return the first index of the number of fences allocated.
- * The fence context is used for setting fence->context to a unique number.
+ * This function will return the first index of the number of fence contexts
+ * allocated.  The fence context is used for setting &dma_fence.context to a
+ * unique number by passing the context to dma_fence_init().
  */
  */
 u64 dma_fence_context_alloc(unsigned num)
 u64 dma_fence_context_alloc(unsigned num)
 {
 {
@@ -59,10 +90,14 @@ EXPORT_SYMBOL(dma_fence_context_alloc);
  * Signal completion for software callbacks on a fence, this will unblock
  * Signal completion for software callbacks on a fence, this will unblock
  * dma_fence_wait() calls and run all the callbacks added with
  * dma_fence_wait() calls and run all the callbacks added with
  * dma_fence_add_callback(). Can be called multiple times, but since a fence
  * dma_fence_add_callback(). Can be called multiple times, but since a fence
- * can only go from unsignaled to signaled state, it will only be effective
- * the first time.
+ * can only go from the unsignaled to the signaled state and not back, it will
+ * only be effective the first time.
  *
  *
- * Unlike dma_fence_signal, this function must be called with fence->lock held.
+ * Unlike dma_fence_signal(), this function must be called with &dma_fence.lock
+ * held.
+ *
+ * Returns 0 on success and a negative error value when @fence has been
+ * signalled already.
  */
  */
 int dma_fence_signal_locked(struct dma_fence *fence)
 int dma_fence_signal_locked(struct dma_fence *fence)
 {
 {
@@ -102,8 +137,11 @@ EXPORT_SYMBOL(dma_fence_signal_locked);
  * Signal completion for software callbacks on a fence, this will unblock
  * Signal completion for software callbacks on a fence, this will unblock
  * dma_fence_wait() calls and run all the callbacks added with
  * dma_fence_wait() calls and run all the callbacks added with
  * dma_fence_add_callback(). Can be called multiple times, but since a fence
  * dma_fence_add_callback(). Can be called multiple times, but since a fence
- * can only go from unsignaled to signaled state, it will only be effective
- * the first time.
+ * can only go from the unsignaled to the signaled state and not back, it will
+ * only be effective the first time.
+ *
+ * Returns 0 on success and a negative error value when @fence has been
+ * signalled already.
  */
  */
 int dma_fence_signal(struct dma_fence *fence)
 int dma_fence_signal(struct dma_fence *fence)
 {
 {
@@ -136,9 +174,9 @@ EXPORT_SYMBOL(dma_fence_signal);
 /**
 /**
  * dma_fence_wait_timeout - sleep until the fence gets signaled
  * dma_fence_wait_timeout - sleep until the fence gets signaled
  * or until timeout elapses
  * or until timeout elapses
- * @fence:	[in]	the fence to wait on
- * @intr:	[in]	if true, do an interruptible wait
- * @timeout:	[in]	timeout value in jiffies, or MAX_SCHEDULE_TIMEOUT
+ * @fence: the fence to wait on
+ * @intr: if true, do an interruptible wait
+ * @timeout: timeout value in jiffies, or MAX_SCHEDULE_TIMEOUT
  *
  *
  * Returns -ERESTARTSYS if interrupted, 0 if the wait timed out, or the
  * Returns -ERESTARTSYS if interrupted, 0 if the wait timed out, or the
  * remaining timeout in jiffies on success. Other error values may be
  * remaining timeout in jiffies on success. Other error values may be
@@ -148,6 +186,8 @@ EXPORT_SYMBOL(dma_fence_signal);
  * directly or indirectly (buf-mgr between reservation and committing)
  * directly or indirectly (buf-mgr between reservation and committing)
  * holds a reference to the fence, otherwise the fence might be
  * holds a reference to the fence, otherwise the fence might be
  * freed before return, resulting in undefined behavior.
  * freed before return, resulting in undefined behavior.
+ *
+ * See also dma_fence_wait() and dma_fence_wait_any_timeout().
  */
  */
 signed long
 signed long
 dma_fence_wait_timeout(struct dma_fence *fence, bool intr, signed long timeout)
 dma_fence_wait_timeout(struct dma_fence *fence, bool intr, signed long timeout)
@@ -158,12 +198,22 @@ dma_fence_wait_timeout(struct dma_fence *fence, bool intr, signed long timeout)
 		return -EINVAL;
 		return -EINVAL;
 
 
 	trace_dma_fence_wait_start(fence);
 	trace_dma_fence_wait_start(fence);
-	ret = fence->ops->wait(fence, intr, timeout);
+	if (fence->ops->wait)
+		ret = fence->ops->wait(fence, intr, timeout);
+	else
+		ret = dma_fence_default_wait(fence, intr, timeout);
 	trace_dma_fence_wait_end(fence);
 	trace_dma_fence_wait_end(fence);
 	return ret;
 	return ret;
 }
 }
 EXPORT_SYMBOL(dma_fence_wait_timeout);
 EXPORT_SYMBOL(dma_fence_wait_timeout);
 
 
+/**
+ * dma_fence_release - default relese function for fences
+ * @kref: &dma_fence.recfount
+ *
+ * This is the default release functions for &dma_fence. Drivers shouldn't call
+ * this directly, but instead call dma_fence_put().
+ */
 void dma_fence_release(struct kref *kref)
 void dma_fence_release(struct kref *kref)
 {
 {
 	struct dma_fence *fence =
 	struct dma_fence *fence =
@@ -181,6 +231,13 @@ void dma_fence_release(struct kref *kref)
 }
 }
 EXPORT_SYMBOL(dma_fence_release);
 EXPORT_SYMBOL(dma_fence_release);
 
 
+/**
+ * dma_fence_free - default release function for &dma_fence.
+ * @fence: fence to release
+ *
+ * This is the default implementation for &dma_fence_ops.release. It calls
+ * kfree_rcu() on @fence.
+ */
 void dma_fence_free(struct dma_fence *fence)
 void dma_fence_free(struct dma_fence *fence)
 {
 {
 	kfree_rcu(fence, rcu);
 	kfree_rcu(fence, rcu);
@@ -189,10 +246,11 @@ EXPORT_SYMBOL(dma_fence_free);
 
 
 /**
 /**
  * dma_fence_enable_sw_signaling - enable signaling on fence
  * dma_fence_enable_sw_signaling - enable signaling on fence
- * @fence:	[in]	the fence to enable
+ * @fence: the fence to enable
  *
  *
- * this will request for sw signaling to be enabled, to make the fence
- * complete as soon as possible
+ * This will request for sw signaling to be enabled, to make the fence
+ * complete as soon as possible. This calls &dma_fence_ops.enable_signaling
+ * internally.
  */
  */
 void dma_fence_enable_sw_signaling(struct dma_fence *fence)
 void dma_fence_enable_sw_signaling(struct dma_fence *fence)
 {
 {
@@ -200,7 +258,8 @@ void dma_fence_enable_sw_signaling(struct dma_fence *fence)
 
 
 	if (!test_and_set_bit(DMA_FENCE_FLAG_ENABLE_SIGNAL_BIT,
 	if (!test_and_set_bit(DMA_FENCE_FLAG_ENABLE_SIGNAL_BIT,
 			      &fence->flags) &&
 			      &fence->flags) &&
-	    !test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags)) {
+	    !test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags) &&
+	    fence->ops->enable_signaling) {
 		trace_dma_fence_enable_signal(fence);
 		trace_dma_fence_enable_signal(fence);
 
 
 		spin_lock_irqsave(fence->lock, flags);
 		spin_lock_irqsave(fence->lock, flags);
@@ -216,24 +275,24 @@ EXPORT_SYMBOL(dma_fence_enable_sw_signaling);
 /**
 /**
  * dma_fence_add_callback - add a callback to be called when the fence
  * dma_fence_add_callback - add a callback to be called when the fence
  * is signaled
  * is signaled
- * @fence:	[in]	the fence to wait on
- * @cb:		[in]	the callback to register
- * @func:	[in]	the function to call
+ * @fence: the fence to wait on
+ * @cb: the callback to register
+ * @func: the function to call
  *
  *
- * cb will be initialized by dma_fence_add_callback, no initialization
+ * @cb will be initialized by dma_fence_add_callback(), no initialization
  * by the caller is required. Any number of callbacks can be registered
  * by the caller is required. Any number of callbacks can be registered
  * to a fence, but a callback can only be registered to one fence at a time.
  * to a fence, but a callback can only be registered to one fence at a time.
  *
  *
  * Note that the callback can be called from an atomic context.  If
  * Note that the callback can be called from an atomic context.  If
  * fence is already signaled, this function will return -ENOENT (and
  * fence is already signaled, this function will return -ENOENT (and
- * *not* call the callback)
+ * *not* call the callback).
  *
  *
  * Add a software callback to the fence. Same restrictions apply to
  * Add a software callback to the fence. Same restrictions apply to
- * refcount as it does to dma_fence_wait, however the caller doesn't need to
- * keep a refcount to fence afterwards: when software access is enabled,
- * the creator of the fence is required to keep the fence alive until
- * after it signals with dma_fence_signal. The callback itself can be called
- * from irq context.
+ * refcount as it does to dma_fence_wait(), however the caller doesn't need to
+ * keep a refcount to fence afterward dma_fence_add_callback() has returned:
+ * when software access is enabled, the creator of the fence is required to keep
+ * the fence alive until after it signals with dma_fence_signal(). The callback
+ * itself can be called from irq context.
  *
  *
  * Returns 0 in case of success, -ENOENT if the fence is already signaled
  * Returns 0 in case of success, -ENOENT if the fence is already signaled
  * and -EINVAL in case of error.
  * and -EINVAL in case of error.
@@ -260,7 +319,7 @@ int dma_fence_add_callback(struct dma_fence *fence, struct dma_fence_cb *cb,
 
 
 	if (test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags))
 	if (test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags))
 		ret = -ENOENT;
 		ret = -ENOENT;
-	else if (!was_set) {
+	else if (!was_set && fence->ops->enable_signaling) {
 		trace_dma_fence_enable_signal(fence);
 		trace_dma_fence_enable_signal(fence);
 
 
 		if (!fence->ops->enable_signaling(fence)) {
 		if (!fence->ops->enable_signaling(fence)) {
@@ -282,7 +341,7 @@ EXPORT_SYMBOL(dma_fence_add_callback);
 
 
 /**
 /**
  * dma_fence_get_status - returns the status upon completion
  * dma_fence_get_status - returns the status upon completion
- * @fence: [in]	the dma_fence to query
+ * @fence: the dma_fence to query
  *
  *
  * This wraps dma_fence_get_status_locked() to return the error status
  * This wraps dma_fence_get_status_locked() to return the error status
  * condition on a signaled fence. See dma_fence_get_status_locked() for more
  * condition on a signaled fence. See dma_fence_get_status_locked() for more
@@ -307,8 +366,8 @@ EXPORT_SYMBOL(dma_fence_get_status);
 
 
 /**
 /**
  * dma_fence_remove_callback - remove a callback from the signaling list
  * dma_fence_remove_callback - remove a callback from the signaling list
- * @fence:	[in]	the fence to wait on
- * @cb:		[in]	the callback to remove
+ * @fence: the fence to wait on
+ * @cb: the callback to remove
  *
  *
  * Remove a previously queued callback from the fence. This function returns
  * Remove a previously queued callback from the fence. This function returns
  * true if the callback is successfully removed, or false if the fence has
  * true if the callback is successfully removed, or false if the fence has
@@ -319,6 +378,9 @@ EXPORT_SYMBOL(dma_fence_get_status);
  * doing, since deadlocks and race conditions could occur all too easily. For
  * doing, since deadlocks and race conditions could occur all too easily. For
  * this reason, it should only ever be done on hardware lockup recovery,
  * this reason, it should only ever be done on hardware lockup recovery,
  * with a reference held to the fence.
  * with a reference held to the fence.
+ *
+ * Behaviour is undefined if @cb has not been added to @fence using
+ * dma_fence_add_callback() beforehand.
  */
  */
 bool
 bool
 dma_fence_remove_callback(struct dma_fence *fence, struct dma_fence_cb *cb)
 dma_fence_remove_callback(struct dma_fence *fence, struct dma_fence_cb *cb)
@@ -355,9 +417,9 @@ dma_fence_default_wait_cb(struct dma_fence *fence, struct dma_fence_cb *cb)
 /**
 /**
  * dma_fence_default_wait - default sleep until the fence gets signaled
  * dma_fence_default_wait - default sleep until the fence gets signaled
  * or until timeout elapses
  * or until timeout elapses
- * @fence:	[in]	the fence to wait on
- * @intr:	[in]	if true, do an interruptible wait
- * @timeout:	[in]	timeout value in jiffies, or MAX_SCHEDULE_TIMEOUT
+ * @fence: the fence to wait on
+ * @intr: if true, do an interruptible wait
+ * @timeout: timeout value in jiffies, or MAX_SCHEDULE_TIMEOUT
  *
  *
  * Returns -ERESTARTSYS if interrupted, 0 if the wait timed out, or the
  * Returns -ERESTARTSYS if interrupted, 0 if the wait timed out, or the
  * remaining timeout in jiffies on success. If timeout is zero the value one is
  * remaining timeout in jiffies on success. If timeout is zero the value one is
@@ -388,7 +450,7 @@ dma_fence_default_wait(struct dma_fence *fence, bool intr, signed long timeout)
 	if (test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags))
 	if (test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags))
 		goto out;
 		goto out;
 
 
-	if (!was_set) {
+	if (!was_set && fence->ops->enable_signaling) {
 		trace_dma_fence_enable_signal(fence);
 		trace_dma_fence_enable_signal(fence);
 
 
 		if (!fence->ops->enable_signaling(fence)) {
 		if (!fence->ops->enable_signaling(fence)) {
@@ -450,12 +512,12 @@ dma_fence_test_signaled_any(struct dma_fence **fences, uint32_t count,
 /**
 /**
  * dma_fence_wait_any_timeout - sleep until any fence gets signaled
  * dma_fence_wait_any_timeout - sleep until any fence gets signaled
  * or until timeout elapses
  * or until timeout elapses
- * @fences:	[in]	array of fences to wait on
- * @count:	[in]	number of fences to wait on
- * @intr:	[in]	if true, do an interruptible wait
- * @timeout:	[in]	timeout value in jiffies, or MAX_SCHEDULE_TIMEOUT
- * @idx:       [out]	the first signaled fence index, meaningful only on
- *			positive return
+ * @fences: array of fences to wait on
+ * @count: number of fences to wait on
+ * @intr: if true, do an interruptible wait
+ * @timeout: timeout value in jiffies, or MAX_SCHEDULE_TIMEOUT
+ * @idx: used to store the first signaled fence index, meaningful only on
+ *	positive return
  *
  *
  * Returns -EINVAL on custom fence wait implementation, -ERESTARTSYS if
  * Returns -EINVAL on custom fence wait implementation, -ERESTARTSYS if
  * interrupted, 0 if the wait timed out, or the remaining timeout in jiffies
  * interrupted, 0 if the wait timed out, or the remaining timeout in jiffies
@@ -464,6 +526,8 @@ dma_fence_test_signaled_any(struct dma_fence **fences, uint32_t count,
  * Synchronous waits for the first fence in the array to be signaled. The
  * Synchronous waits for the first fence in the array to be signaled. The
  * caller needs to hold a reference to all fences in the array, otherwise a
  * caller needs to hold a reference to all fences in the array, otherwise a
  * fence might be freed before return, resulting in undefined behavior.
  * fence might be freed before return, resulting in undefined behavior.
+ *
+ * See also dma_fence_wait() and dma_fence_wait_timeout().
  */
  */
 signed long
 signed long
 dma_fence_wait_any_timeout(struct dma_fence **fences, uint32_t count,
 dma_fence_wait_any_timeout(struct dma_fence **fences, uint32_t count,
@@ -496,11 +560,6 @@ dma_fence_wait_any_timeout(struct dma_fence **fences, uint32_t count,
 	for (i = 0; i < count; ++i) {
 	for (i = 0; i < count; ++i) {
 		struct dma_fence *fence = fences[i];
 		struct dma_fence *fence = fences[i];
 
 
-		if (fence->ops->wait != dma_fence_default_wait) {
-			ret = -EINVAL;
-			goto fence_rm_cb;
-		}
-
 		cb[i].task = current;
 		cb[i].task = current;
 		if (dma_fence_add_callback(fence, &cb[i].base,
 		if (dma_fence_add_callback(fence, &cb[i].base,
 					   dma_fence_default_wait_cb)) {
 					   dma_fence_default_wait_cb)) {
@@ -541,27 +600,25 @@ EXPORT_SYMBOL(dma_fence_wait_any_timeout);
 
 
 /**
 /**
  * dma_fence_init - Initialize a custom fence.
  * dma_fence_init - Initialize a custom fence.
- * @fence:	[in]	the fence to initialize
- * @ops:	[in]	the dma_fence_ops for operations on this fence
- * @lock:	[in]	the irqsafe spinlock to use for locking this fence
- * @context:	[in]	the execution context this fence is run on
- * @seqno:	[in]	a linear increasing sequence number for this context
+ * @fence: the fence to initialize
+ * @ops: the dma_fence_ops for operations on this fence
+ * @lock: the irqsafe spinlock to use for locking this fence
+ * @context: the execution context this fence is run on
+ * @seqno: a linear increasing sequence number for this context
  *
  *
  * Initializes an allocated fence, the caller doesn't have to keep its
  * Initializes an allocated fence, the caller doesn't have to keep its
  * refcount after committing with this fence, but it will need to hold a
  * refcount after committing with this fence, but it will need to hold a
- * refcount again if dma_fence_ops.enable_signaling gets called. This can
- * be used for other implementing other types of fence.
+ * refcount again if &dma_fence_ops.enable_signaling gets called.
  *
  *
  * context and seqno are used for easy comparison between fences, allowing
  * context and seqno are used for easy comparison between fences, allowing
- * to check which fence is later by simply using dma_fence_later.
+ * to check which fence is later by simply using dma_fence_later().
  */
  */
 void
 void
 dma_fence_init(struct dma_fence *fence, const struct dma_fence_ops *ops,
 dma_fence_init(struct dma_fence *fence, const struct dma_fence_ops *ops,
 	       spinlock_t *lock, u64 context, unsigned seqno)
 	       spinlock_t *lock, u64 context, unsigned seqno)
 {
 {
 	BUG_ON(!lock);
 	BUG_ON(!lock);
-	BUG_ON(!ops || !ops->wait || !ops->enable_signaling ||
-	       !ops->get_driver_name || !ops->get_timeline_name);
+	BUG_ON(!ops || !ops->get_driver_name || !ops->get_timeline_name);
 
 
 	kref_init(&fence->refcount);
 	kref_init(&fence->refcount);
 	fence->ops = ops;
 	fence->ops = ops;

+ 0 - 1
drivers/dma-buf/sw_sync.c

@@ -188,7 +188,6 @@ static const struct dma_fence_ops timeline_fence_ops = {
 	.get_timeline_name = timeline_fence_get_timeline_name,
 	.get_timeline_name = timeline_fence_get_timeline_name,
 	.enable_signaling = timeline_fence_enable_signaling,
 	.enable_signaling = timeline_fence_enable_signaling,
 	.signaled = timeline_fence_signaled,
 	.signaled = timeline_fence_signaled,
-	.wait = dma_fence_default_wait,
 	.release = timeline_fence_release,
 	.release = timeline_fence_release,
 	.fence_value_str = timeline_fence_value_str,
 	.fence_value_str = timeline_fence_value_str,
 	.timeline_value_str = timeline_fence_timeline_value_str,
 	.timeline_value_str = timeline_fence_timeline_value_str,

+ 0 - 2
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_fence.c

@@ -173,7 +173,5 @@ static const struct dma_fence_ops amdkfd_fence_ops = {
 	.get_driver_name = amdkfd_fence_get_driver_name,
 	.get_driver_name = amdkfd_fence_get_driver_name,
 	.get_timeline_name = amdkfd_fence_get_timeline_name,
 	.get_timeline_name = amdkfd_fence_get_timeline_name,
 	.enable_signaling = amdkfd_fence_enable_signaling,
 	.enable_signaling = amdkfd_fence_enable_signaling,
-	.signaled = NULL,
-	.wait = dma_fence_default_wait,
 	.release = amdkfd_fence_release,
 	.release = amdkfd_fence_release,
 };
 };

+ 0 - 1
drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c

@@ -646,7 +646,6 @@ static const struct dma_fence_ops amdgpu_fence_ops = {
 	.get_driver_name = amdgpu_fence_get_driver_name,
 	.get_driver_name = amdgpu_fence_get_driver_name,
 	.get_timeline_name = amdgpu_fence_get_timeline_name,
 	.get_timeline_name = amdgpu_fence_get_timeline_name,
 	.enable_signaling = amdgpu_fence_enable_signaling,
 	.enable_signaling = amdgpu_fence_enable_signaling,
-	.wait = dma_fence_default_wait,
 	.release = amdgpu_fence_release,
 	.release = amdgpu_fence_release,
 };
 };
 
 

+ 1 - 1
drivers/gpu/drm/arc/arcpgu_crtc.c

@@ -186,7 +186,7 @@ static const struct drm_plane_helper_funcs arc_pgu_plane_helper_funcs = {
 
 
 static void arc_pgu_plane_destroy(struct drm_plane *plane)
 static void arc_pgu_plane_destroy(struct drm_plane *plane)
 {
 {
-	drm_plane_helper_disable(plane);
+	drm_plane_helper_disable(plane, NULL);
 	drm_plane_cleanup(plane);
 	drm_plane_cleanup(plane);
 }
 }
 
 

+ 1 - 1
drivers/gpu/drm/arm/hdlcd_crtc.c

@@ -282,7 +282,7 @@ static const struct drm_plane_helper_funcs hdlcd_plane_helper_funcs = {
 
 
 static void hdlcd_plane_destroy(struct drm_plane *plane)
 static void hdlcd_plane_destroy(struct drm_plane *plane)
 {
 {
-	drm_plane_helper_disable(plane);
+	drm_plane_helper_disable(plane, NULL);
 	drm_plane_cleanup(plane);
 	drm_plane_cleanup(plane);
 }
 }
 
 

+ 5 - 5
drivers/gpu/drm/drm_atomic.c

@@ -1581,7 +1581,7 @@ drm_atomic_set_crtc_for_plane(struct drm_plane_state *plane_state,
 		if (WARN_ON(IS_ERR(crtc_state)))
 		if (WARN_ON(IS_ERR(crtc_state)))
 			return PTR_ERR(crtc_state);
 			return PTR_ERR(crtc_state);
 
 
-		crtc_state->plane_mask &= ~(1 << drm_plane_index(plane));
+		crtc_state->plane_mask &= ~drm_plane_mask(plane);
 	}
 	}
 
 
 	plane_state->crtc = crtc;
 	plane_state->crtc = crtc;
@@ -1591,7 +1591,7 @@ drm_atomic_set_crtc_for_plane(struct drm_plane_state *plane_state,
 						       crtc);
 						       crtc);
 		if (IS_ERR(crtc_state))
 		if (IS_ERR(crtc_state))
 			return PTR_ERR(crtc_state);
 			return PTR_ERR(crtc_state);
-		crtc_state->plane_mask |= (1 << drm_plane_index(plane));
+		crtc_state->plane_mask |= drm_plane_mask(plane);
 	}
 	}
 
 
 	if (crtc)
 	if (crtc)
@@ -1700,7 +1700,7 @@ drm_atomic_set_crtc_for_connector(struct drm_connector_state *conn_state,
 							   conn_state->crtc);
 							   conn_state->crtc);
 
 
 		crtc_state->connector_mask &=
 		crtc_state->connector_mask &=
-			~(1 << drm_connector_index(conn_state->connector));
+			~drm_connector_mask(conn_state->connector);
 
 
 		drm_connector_put(conn_state->connector);
 		drm_connector_put(conn_state->connector);
 		conn_state->crtc = NULL;
 		conn_state->crtc = NULL;
@@ -1712,7 +1712,7 @@ drm_atomic_set_crtc_for_connector(struct drm_connector_state *conn_state,
 			return PTR_ERR(crtc_state);
 			return PTR_ERR(crtc_state);
 
 
 		crtc_state->connector_mask |=
 		crtc_state->connector_mask |=
-			1 << drm_connector_index(conn_state->connector);
+			drm_connector_mask(conn_state->connector);
 
 
 		drm_connector_get(conn_state->connector);
 		drm_connector_get(conn_state->connector);
 		conn_state->crtc = crtc;
 		conn_state->crtc = crtc;
@@ -1839,7 +1839,7 @@ drm_atomic_add_affected_connectors(struct drm_atomic_state *state,
 	 */
 	 */
 	drm_connector_list_iter_begin(state->dev, &conn_iter);
 	drm_connector_list_iter_begin(state->dev, &conn_iter);
 	drm_for_each_connector_iter(connector, &conn_iter) {
 	drm_for_each_connector_iter(connector, &conn_iter) {
-		if (!(crtc_state->connector_mask & (1 << drm_connector_index(connector))))
+		if (!(crtc_state->connector_mask & drm_connector_mask(connector)))
 			continue;
 			continue;
 
 
 		conn_state = drm_atomic_get_connector_state(state, connector);
 		conn_state = drm_atomic_get_connector_state(state, connector);

+ 15 - 10
drivers/gpu/drm/drm_atomic_helper.c

@@ -121,7 +121,7 @@ static int handle_conflicting_encoders(struct drm_atomic_state *state,
 			new_encoder = drm_atomic_helper_best_encoder(connector);
 			new_encoder = drm_atomic_helper_best_encoder(connector);
 
 
 		if (new_encoder) {
 		if (new_encoder) {
-			if (encoder_mask & (1 << drm_encoder_index(new_encoder))) {
+			if (encoder_mask & drm_encoder_mask(new_encoder)) {
 				DRM_DEBUG_ATOMIC("[ENCODER:%d:%s] on [CONNECTOR:%d:%s] already assigned\n",
 				DRM_DEBUG_ATOMIC("[ENCODER:%d:%s] on [CONNECTOR:%d:%s] already assigned\n",
 					new_encoder->base.id, new_encoder->name,
 					new_encoder->base.id, new_encoder->name,
 					connector->base.id, connector->name);
 					connector->base.id, connector->name);
@@ -129,7 +129,7 @@ static int handle_conflicting_encoders(struct drm_atomic_state *state,
 				return -EINVAL;
 				return -EINVAL;
 			}
 			}
 
 
-			encoder_mask |= 1 << drm_encoder_index(new_encoder);
+			encoder_mask |= drm_encoder_mask(new_encoder);
 		}
 		}
 	}
 	}
 
 
@@ -155,7 +155,7 @@ static int handle_conflicting_encoders(struct drm_atomic_state *state,
 			continue;
 			continue;
 
 
 		encoder = connector->state->best_encoder;
 		encoder = connector->state->best_encoder;
-		if (!encoder || !(encoder_mask & (1 << drm_encoder_index(encoder))))
+		if (!encoder || !(encoder_mask & drm_encoder_mask(encoder)))
 			continue;
 			continue;
 
 
 		if (!disable_conflicting_encoders) {
 		if (!disable_conflicting_encoders) {
@@ -223,7 +223,7 @@ set_best_encoder(struct drm_atomic_state *state,
 			crtc_state = drm_atomic_get_new_crtc_state(state, crtc);
 			crtc_state = drm_atomic_get_new_crtc_state(state, crtc);
 
 
 			crtc_state->encoder_mask &=
 			crtc_state->encoder_mask &=
-				~(1 << drm_encoder_index(conn_state->best_encoder));
+				~drm_encoder_mask(conn_state->best_encoder);
 		}
 		}
 	}
 	}
 
 
@@ -234,7 +234,7 @@ set_best_encoder(struct drm_atomic_state *state,
 			crtc_state = drm_atomic_get_new_crtc_state(state, crtc);
 			crtc_state = drm_atomic_get_new_crtc_state(state, crtc);
 
 
 			crtc_state->encoder_mask |=
 			crtc_state->encoder_mask |=
-				1 << drm_encoder_index(encoder);
+				drm_encoder_mask(encoder);
 		}
 		}
 	}
 	}
 
 
@@ -2342,11 +2342,13 @@ drm_atomic_helper_commit_planes_on_crtc(struct drm_crtc_state *old_crtc_state)
 	const struct drm_crtc_helper_funcs *crtc_funcs;
 	const struct drm_crtc_helper_funcs *crtc_funcs;
 	struct drm_crtc *crtc = old_crtc_state->crtc;
 	struct drm_crtc *crtc = old_crtc_state->crtc;
 	struct drm_atomic_state *old_state = old_crtc_state->state;
 	struct drm_atomic_state *old_state = old_crtc_state->state;
+	struct drm_crtc_state *new_crtc_state =
+		drm_atomic_get_new_crtc_state(old_state, crtc);
 	struct drm_plane *plane;
 	struct drm_plane *plane;
 	unsigned plane_mask;
 	unsigned plane_mask;
 
 
 	plane_mask = old_crtc_state->plane_mask;
 	plane_mask = old_crtc_state->plane_mask;
-	plane_mask |= crtc->state->plane_mask;
+	plane_mask |= new_crtc_state->plane_mask;
 
 
 	crtc_funcs = crtc->helper_private;
 	crtc_funcs = crtc->helper_private;
 	if (crtc_funcs && crtc_funcs->atomic_begin)
 	if (crtc_funcs && crtc_funcs->atomic_begin)
@@ -2355,6 +2357,8 @@ drm_atomic_helper_commit_planes_on_crtc(struct drm_crtc_state *old_crtc_state)
 	drm_for_each_plane_mask(plane, crtc->dev, plane_mask) {
 	drm_for_each_plane_mask(plane, crtc->dev, plane_mask) {
 		struct drm_plane_state *old_plane_state =
 		struct drm_plane_state *old_plane_state =
 			drm_atomic_get_old_plane_state(old_state, plane);
 			drm_atomic_get_old_plane_state(old_state, plane);
+		struct drm_plane_state *new_plane_state =
+			drm_atomic_get_new_plane_state(old_state, plane);
 		const struct drm_plane_helper_funcs *plane_funcs;
 		const struct drm_plane_helper_funcs *plane_funcs;
 
 
 		plane_funcs = plane->helper_private;
 		plane_funcs = plane->helper_private;
@@ -2362,13 +2366,14 @@ drm_atomic_helper_commit_planes_on_crtc(struct drm_crtc_state *old_crtc_state)
 		if (!old_plane_state || !plane_funcs)
 		if (!old_plane_state || !plane_funcs)
 			continue;
 			continue;
 
 
-		WARN_ON(plane->state->crtc && plane->state->crtc != crtc);
+		WARN_ON(new_plane_state->crtc &&
+			new_plane_state->crtc != crtc);
 
 
-		if (drm_atomic_plane_disabling(old_plane_state, plane->state) &&
+		if (drm_atomic_plane_disabling(old_plane_state, new_plane_state) &&
 		    plane_funcs->atomic_disable)
 		    plane_funcs->atomic_disable)
 			plane_funcs->atomic_disable(plane, old_plane_state);
 			plane_funcs->atomic_disable(plane, old_plane_state);
-		else if (plane->state->crtc ||
-			 drm_atomic_plane_disabling(old_plane_state, plane->state))
+		else if (new_plane_state->crtc ||
+			 drm_atomic_plane_disabling(old_plane_state, new_plane_state))
 			plane_funcs->atomic_update(plane, old_plane_state);
 			plane_funcs->atomic_update(plane, old_plane_state);
 	}
 	}
 
 

+ 1 - 3
drivers/gpu/drm/drm_connector.c

@@ -1033,9 +1033,7 @@ EXPORT_SYMBOL(drm_mode_create_dvi_i_properties);
  *
  *
  *	Drivers can set up this property by calling
  *	Drivers can set up this property by calling
  *	drm_connector_attach_content_type_property(). Decoding to
  *	drm_connector_attach_content_type_property(). Decoding to
- *	infoframe values is done through
- *	drm_hdmi_get_content_type_from_property() and
- *	drm_hdmi_get_itc_bit_from_property().
+ *	infoframe values is done through drm_hdmi_avi_infoframe_content_type().
  */
  */
 
 
 /**
 /**

+ 2 - 9
drivers/gpu/drm/drm_crtc.c

@@ -225,16 +225,9 @@ static const char *drm_crtc_fence_get_timeline_name(struct dma_fence *fence)
 	return crtc->timeline_name;
 	return crtc->timeline_name;
 }
 }
 
 
-static bool drm_crtc_fence_enable_signaling(struct dma_fence *fence)
-{
-	return true;
-}
-
 static const struct dma_fence_ops drm_crtc_fence_ops = {
 static const struct dma_fence_ops drm_crtc_fence_ops = {
 	.get_driver_name = drm_crtc_fence_get_driver_name,
 	.get_driver_name = drm_crtc_fence_get_driver_name,
 	.get_timeline_name = drm_crtc_fence_get_timeline_name,
 	.get_timeline_name = drm_crtc_fence_get_timeline_name,
-	.enable_signaling = drm_crtc_fence_enable_signaling,
-	.wait = dma_fence_default_wait,
 };
 };
 
 
 struct dma_fence *drm_crtc_create_fence(struct drm_crtc *crtc)
 struct dma_fence *drm_crtc_create_fence(struct drm_crtc *crtc)
@@ -329,9 +322,9 @@ int drm_crtc_init_with_planes(struct drm_device *dev, struct drm_crtc *crtc,
 	crtc->primary = primary;
 	crtc->primary = primary;
 	crtc->cursor = cursor;
 	crtc->cursor = cursor;
 	if (primary && !primary->possible_crtcs)
 	if (primary && !primary->possible_crtcs)
-		primary->possible_crtcs = 1 << drm_crtc_index(crtc);
+		primary->possible_crtcs = drm_crtc_mask(crtc);
 	if (cursor && !cursor->possible_crtcs)
 	if (cursor && !cursor->possible_crtcs)
-		cursor->possible_crtcs = 1 << drm_crtc_index(crtc);
+		cursor->possible_crtcs = drm_crtc_mask(crtc);
 
 
 	ret = drm_crtc_crc_init(crtc);
 	ret = drm_crtc_crc_init(crtc);
 	if (ret) {
 	if (ret) {

+ 1 - 1
drivers/gpu/drm/drm_framebuffer.c

@@ -847,7 +847,7 @@ retry:
 		if (ret)
 		if (ret)
 			goto unlock;
 			goto unlock;
 
 
-		plane_mask |= BIT(drm_plane_index(plane));
+		plane_mask |= drm_plane_mask(plane);
 	}
 	}
 
 
 	/* This list is only filled when disable_crtcs is set. */
 	/* This list is only filled when disable_crtcs is set. */

+ 1 - 1
drivers/gpu/drm/drm_global.c

@@ -1,7 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0 OR MIT
 /**************************************************************************
 /**************************************************************************
  *
  *
  * Copyright 2008-2009 VMware, Inc., Palo Alto, CA., USA
  * Copyright 2008-2009 VMware, Inc., Palo Alto, CA., USA
- * All Rights Reserved.
  *
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the
  * copy of this software and associated documentation files (the

+ 6 - 2
drivers/gpu/drm/drm_plane_helper.c

@@ -440,6 +440,7 @@ out:
  * @src_y: y offset of @fb for panning
  * @src_y: y offset of @fb for panning
  * @src_w: width of source rectangle in @fb
  * @src_w: width of source rectangle in @fb
  * @src_h: height of source rectangle in @fb
  * @src_h: height of source rectangle in @fb
+ * @ctx: lock acquire context, not used here
  *
  *
  * Provides a default plane update handler using the atomic plane update
  * Provides a default plane update handler using the atomic plane update
  * functions. It is fully left to the driver to check plane constraints and
  * functions. It is fully left to the driver to check plane constraints and
@@ -455,7 +456,8 @@ int drm_plane_helper_update(struct drm_plane *plane, struct drm_crtc *crtc,
 			    int crtc_x, int crtc_y,
 			    int crtc_x, int crtc_y,
 			    unsigned int crtc_w, unsigned int crtc_h,
 			    unsigned int crtc_w, unsigned int crtc_h,
 			    uint32_t src_x, uint32_t src_y,
 			    uint32_t src_x, uint32_t src_y,
-			    uint32_t src_w, uint32_t src_h)
+			    uint32_t src_w, uint32_t src_h,
+			    struct drm_modeset_acquire_ctx *ctx)
 {
 {
 	struct drm_plane_state *plane_state;
 	struct drm_plane_state *plane_state;
 
 
@@ -489,6 +491,7 @@ EXPORT_SYMBOL(drm_plane_helper_update);
 /**
 /**
  * drm_plane_helper_disable() - Transitional helper for plane disable
  * drm_plane_helper_disable() - Transitional helper for plane disable
  * @plane: plane to disable
  * @plane: plane to disable
+ * @ctx: lock acquire context, not used here
  *
  *
  * Provides a default plane disable handler using the atomic plane update
  * Provides a default plane disable handler using the atomic plane update
  * functions. It is fully left to the driver to check plane constraints and
  * functions. It is fully left to the driver to check plane constraints and
@@ -499,7 +502,8 @@ EXPORT_SYMBOL(drm_plane_helper_update);
  * RETURNS:
  * RETURNS:
  * Zero on success, error code on failure
  * Zero on success, error code on failure
  */
  */
-int drm_plane_helper_disable(struct drm_plane *plane)
+int drm_plane_helper_disable(struct drm_plane *plane,
+			     struct drm_modeset_acquire_ctx *ctx)
 {
 {
 	struct drm_plane_state *plane_state;
 	struct drm_plane_state *plane_state;
 	struct drm_framebuffer *old_fb;
 	struct drm_framebuffer *old_fb;

+ 2 - 2
drivers/gpu/drm/drm_simple_kms_helper.c

@@ -52,7 +52,7 @@ static int drm_simple_kms_crtc_check(struct drm_crtc *crtc,
 				     struct drm_crtc_state *state)
 				     struct drm_crtc_state *state)
 {
 {
 	bool has_primary = state->plane_mask &
 	bool has_primary = state->plane_mask &
-			   BIT(drm_plane_index(crtc->primary));
+			   drm_plane_mask(crtc->primary);
 
 
 	/* We always want to have an active plane with an active CRTC */
 	/* We always want to have an active plane with an active CRTC */
 	if (has_primary != state->enable)
 	if (has_primary != state->enable)
@@ -281,7 +281,7 @@ int drm_simple_display_pipe_init(struct drm_device *dev,
 	if (ret)
 	if (ret)
 		return ret;
 		return ret;
 
 
-	encoder->possible_crtcs = 1 << drm_crtc_index(crtc);
+	encoder->possible_crtcs = drm_crtc_mask(crtc);
 	ret = drm_encoder_init(dev, encoder, &drm_simple_kms_encoder_funcs,
 	ret = drm_encoder_init(dev, encoder, &drm_simple_kms_encoder_funcs,
 			       DRM_MODE_ENCODER_NONE, NULL);
 			       DRM_MODE_ENCODER_NONE, NULL);
 	if (ret || !connector)
 	if (ret || !connector)

+ 0 - 1
drivers/gpu/drm/drm_syncobj.c

@@ -207,7 +207,6 @@ static const struct dma_fence_ops drm_syncobj_null_fence_ops = {
 	.get_driver_name = drm_syncobj_null_fence_get_name,
 	.get_driver_name = drm_syncobj_null_fence_get_name,
 	.get_timeline_name = drm_syncobj_null_fence_get_name,
 	.get_timeline_name = drm_syncobj_null_fence_get_name,
 	.enable_signaling = drm_syncobj_null_fence_enable_signaling,
 	.enable_signaling = drm_syncobj_null_fence_enable_signaling,
-	.wait = dma_fence_default_wait,
 	.release = NULL,
 	.release = NULL,
 };
 };
 
 

+ 1 - 0
drivers/gpu/drm/drm_vma_manager.c

@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0 OR MIT
 /*
 /*
  * Copyright (c) 2006-2009 VMware, Inc., Palo Alto, CA., USA
  * Copyright (c) 2006-2009 VMware, Inc., Palo Alto, CA., USA
  * Copyright (c) 2012 David Airlie <airlied@linux.ie>
  * Copyright (c) 2012 David Airlie <airlied@linux.ie>

+ 0 - 7
drivers/gpu/drm/etnaviv/etnaviv_gpu.c

@@ -1027,11 +1027,6 @@ static const char *etnaviv_fence_get_timeline_name(struct dma_fence *fence)
 	return dev_name(f->gpu->dev);
 	return dev_name(f->gpu->dev);
 }
 }
 
 
-static bool etnaviv_fence_enable_signaling(struct dma_fence *fence)
-{
-	return true;
-}
-
 static bool etnaviv_fence_signaled(struct dma_fence *fence)
 static bool etnaviv_fence_signaled(struct dma_fence *fence)
 {
 {
 	struct etnaviv_fence *f = to_etnaviv_fence(fence);
 	struct etnaviv_fence *f = to_etnaviv_fence(fence);
@@ -1049,9 +1044,7 @@ static void etnaviv_fence_release(struct dma_fence *fence)
 static const struct dma_fence_ops etnaviv_fence_ops = {
 static const struct dma_fence_ops etnaviv_fence_ops = {
 	.get_driver_name = etnaviv_fence_get_driver_name,
 	.get_driver_name = etnaviv_fence_get_driver_name,
 	.get_timeline_name = etnaviv_fence_get_timeline_name,
 	.get_timeline_name = etnaviv_fence_get_timeline_name,
-	.enable_signaling = etnaviv_fence_enable_signaling,
 	.signaled = etnaviv_fence_signaled,
 	.signaled = etnaviv_fence_signaled,
-	.wait = dma_fence_default_wait,
 	.release = etnaviv_fence_release,
 	.release = etnaviv_fence_release,
 };
 };
 
 

+ 1 - 1
drivers/gpu/drm/i810/i810_dma.c

@@ -934,7 +934,7 @@ static int i810_dma_vertex(struct drm_device *dev, void *data,
 	DRM_DEBUG("idx %d used %d discard %d\n",
 	DRM_DEBUG("idx %d used %d discard %d\n",
 		  vertex->idx, vertex->used, vertex->discard);
 		  vertex->idx, vertex->used, vertex->discard);
 
 
-	if (vertex->idx < 0 || vertex->idx > dma->buf_count)
+	if (vertex->idx < 0 || vertex->idx >= dma->buf_count)
 		return -EINVAL;
 		return -EINVAL;
 
 
 	i810_dma_dispatch_vertex(dev,
 	i810_dma_dispatch_vertex(dev,

+ 7 - 7
drivers/gpu/drm/i915/intel_display.c

@@ -2756,10 +2756,10 @@ intel_set_plane_visible(struct intel_crtc_state *crtc_state,
 
 
 	/* FIXME pre-g4x don't work like this */
 	/* FIXME pre-g4x don't work like this */
 	if (visible) {
 	if (visible) {
-		crtc_state->base.plane_mask |= BIT(drm_plane_index(&plane->base));
+		crtc_state->base.plane_mask |= drm_plane_mask(&plane->base);
 		crtc_state->active_planes |= BIT(plane->id);
 		crtc_state->active_planes |= BIT(plane->id);
 	} else {
 	} else {
-		crtc_state->base.plane_mask &= ~BIT(drm_plane_index(&plane->base));
+		crtc_state->base.plane_mask &= ~drm_plane_mask(&plane->base);
 		crtc_state->active_planes &= ~BIT(plane->id);
 		crtc_state->active_planes &= ~BIT(plane->id);
 	}
 	}
 
 
@@ -11884,7 +11884,7 @@ verify_single_dpll_state(struct drm_i915_private *dev_priv,
 			 struct drm_crtc_state *new_state)
 			 struct drm_crtc_state *new_state)
 {
 {
 	struct intel_dpll_hw_state dpll_hw_state;
 	struct intel_dpll_hw_state dpll_hw_state;
-	unsigned crtc_mask;
+	unsigned int crtc_mask;
 	bool active;
 	bool active;
 
 
 	memset(&dpll_hw_state, 0, sizeof(dpll_hw_state));
 	memset(&dpll_hw_state, 0, sizeof(dpll_hw_state));
@@ -11911,7 +11911,7 @@ verify_single_dpll_state(struct drm_i915_private *dev_priv,
 		return;
 		return;
 	}
 	}
 
 
-	crtc_mask = 1 << drm_crtc_index(crtc);
+	crtc_mask = drm_crtc_mask(crtc);
 
 
 	if (new_state->active)
 	if (new_state->active)
 		I915_STATE_WARN(!(pll->active_mask & crtc_mask),
 		I915_STATE_WARN(!(pll->active_mask & crtc_mask),
@@ -11946,7 +11946,7 @@ verify_shared_dpll_state(struct drm_device *dev, struct drm_crtc *crtc,
 
 
 	if (old_state->shared_dpll &&
 	if (old_state->shared_dpll &&
 	    old_state->shared_dpll != new_state->shared_dpll) {
 	    old_state->shared_dpll != new_state->shared_dpll) {
-		unsigned crtc_mask = 1 << drm_crtc_index(crtc);
+		unsigned int crtc_mask = drm_crtc_mask(crtc);
 		struct intel_shared_dpll *pll = old_state->shared_dpll;
 		struct intel_shared_dpll *pll = old_state->shared_dpll;
 
 
 		I915_STATE_WARN(pll->active_mask & crtc_mask,
 		I915_STATE_WARN(pll->active_mask & crtc_mask,
@@ -15608,9 +15608,9 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev)
 				 * rely on the connector_mask being accurate.
 				 * rely on the connector_mask being accurate.
 				 */
 				 */
 				encoder->base.crtc->state->connector_mask |=
 				encoder->base.crtc->state->connector_mask |=
-					1 << drm_connector_index(&connector->base);
+					drm_connector_mask(&connector->base);
 				encoder->base.crtc->state->encoder_mask |=
 				encoder->base.crtc->state->encoder_mask |=
-					1 << drm_encoder_index(&encoder->base);
+					drm_encoder_mask(&encoder->base);
 			}
 			}
 
 
 		} else {
 		} else {

+ 2 - 2
drivers/gpu/drm/i915/intel_display.h

@@ -261,7 +261,7 @@ struct intel_link_m_n {
 			    &(dev)->mode_config.plane_list,		\
 			    &(dev)->mode_config.plane_list,		\
 			    base.head)					\
 			    base.head)					\
 		for_each_if((plane_mask) &				\
 		for_each_if((plane_mask) &				\
-			    BIT(drm_plane_index(&intel_plane->base)))
+			    drm_plane_mask(&intel_plane->base)))
 
 
 #define for_each_intel_plane_on_crtc(dev, intel_crtc, intel_plane)	\
 #define for_each_intel_plane_on_crtc(dev, intel_crtc, intel_plane)	\
 	list_for_each_entry(intel_plane,				\
 	list_for_each_entry(intel_plane,				\
@@ -278,7 +278,7 @@ struct intel_link_m_n {
 	list_for_each_entry(intel_crtc,					\
 	list_for_each_entry(intel_crtc,					\
 			    &(dev)->mode_config.crtc_list,		\
 			    &(dev)->mode_config.crtc_list,		\
 			    base.head)					\
 			    base.head)					\
-		for_each_if((crtc_mask) & BIT(drm_crtc_index(&intel_crtc->base)))
+		for_each_if((crtc_mask) & drm_crtc_mask(&intel_crtc->base))
 
 
 #define for_each_intel_encoder(dev, intel_encoder)		\
 #define for_each_intel_encoder(dev, intel_encoder)		\
 	list_for_each_entry(intel_encoder,			\
 	list_for_each_entry(intel_encoder,			\

+ 3 - 3
drivers/gpu/drm/i915/intel_dpll_mgr.c

@@ -163,8 +163,8 @@ void intel_enable_shared_dpll(struct intel_crtc *crtc)
 	struct drm_device *dev = crtc->base.dev;
 	struct drm_device *dev = crtc->base.dev;
 	struct drm_i915_private *dev_priv = to_i915(dev);
 	struct drm_i915_private *dev_priv = to_i915(dev);
 	struct intel_shared_dpll *pll = crtc->config->shared_dpll;
 	struct intel_shared_dpll *pll = crtc->config->shared_dpll;
-	unsigned crtc_mask = 1 << drm_crtc_index(&crtc->base);
-	unsigned old_mask;
+	unsigned int crtc_mask = drm_crtc_mask(&crtc->base);
+	unsigned int old_mask;
 
 
 	if (WARN_ON(pll == NULL))
 	if (WARN_ON(pll == NULL))
 		return;
 		return;
@@ -207,7 +207,7 @@ void intel_disable_shared_dpll(struct intel_crtc *crtc)
 {
 {
 	struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
 	struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
 	struct intel_shared_dpll *pll = crtc->config->shared_dpll;
 	struct intel_shared_dpll *pll = crtc->config->shared_dpll;
-	unsigned crtc_mask = 1 << drm_crtc_index(&crtc->base);
+	unsigned int crtc_mask = drm_crtc_mask(&crtc->base);
 
 
 	/* PCH only available on ILK+ */
 	/* PCH only available on ILK+ */
 	if (INTEL_GEN(dev_priv) < 5)
 	if (INTEL_GEN(dev_priv) < 5)

+ 1 - 1
drivers/gpu/drm/imx/ipuv3-crtc.c

@@ -213,7 +213,7 @@ static bool ipu_crtc_mode_fixup(struct drm_crtc *crtc,
 static int ipu_crtc_atomic_check(struct drm_crtc *crtc,
 static int ipu_crtc_atomic_check(struct drm_crtc *crtc,
 				 struct drm_crtc_state *state)
 				 struct drm_crtc_state *state)
 {
 {
-	u32 primary_plane_mask = 1 << drm_plane_index(crtc->primary);
+	u32 primary_plane_mask = drm_plane_mask(crtc->primary);
 
 
 	if (state->active && (primary_plane_mask & state->plane_mask) == 0)
 	if (state->active && (primary_plane_mask & state->plane_mask) == 0)
 		return -EINVAL;
 		return -EINVAL;

+ 1 - 1
drivers/gpu/drm/msm/disp/mdp4/mdp4_plane.c

@@ -68,7 +68,7 @@ static void mdp4_plane_destroy(struct drm_plane *plane)
 {
 {
 	struct mdp4_plane *mdp4_plane = to_mdp4_plane(plane);
 	struct mdp4_plane *mdp4_plane = to_mdp4_plane(plane);
 
 
-	drm_plane_helper_disable(plane);
+	drm_plane_helper_disable(plane, NULL);
 	drm_plane_cleanup(plane);
 	drm_plane_cleanup(plane);
 
 
 	kfree(mdp4_plane);
 	kfree(mdp4_plane);

+ 1 - 1
drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c

@@ -46,7 +46,7 @@ static void mdp5_plane_destroy(struct drm_plane *plane)
 {
 {
 	struct mdp5_plane *mdp5_plane = to_mdp5_plane(plane);
 	struct mdp5_plane *mdp5_plane = to_mdp5_plane(plane);
 
 
-	drm_plane_helper_disable(plane);
+	drm_plane_helper_disable(plane, NULL);
 	drm_plane_cleanup(plane);
 	drm_plane_cleanup(plane);
 
 
 	kfree(mdp5_plane);
 	kfree(mdp5_plane);

+ 1 - 2
drivers/gpu/drm/nouveau/nouveau_ttm.c

@@ -1,8 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0 OR MIT
 /*
 /*
  * Copyright (c) 2007-2008 Tungsten Graphics, Inc., Cedar Park, TX., USA,
  * Copyright (c) 2007-2008 Tungsten Graphics, Inc., Cedar Park, TX., USA,
- * All Rights Reserved.
  * Copyright (c) 2009 VMware, Inc., Palo Alto, CA., USA,
  * Copyright (c) 2009 VMware, Inc., Palo Alto, CA., USA,
- * All Rights Reserved.
  *
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
  * copy of this software and associated documentation files (the "Software"),

+ 1 - 0
drivers/gpu/drm/pl111/Makefile

@@ -4,6 +4,7 @@ pl111_drm-y +=	pl111_display.o \
 		pl111_drv.o
 		pl111_drv.o
 
 
 pl111_drm-$(CONFIG_ARCH_VEXPRESS) += pl111_vexpress.o
 pl111_drm-$(CONFIG_ARCH_VEXPRESS) += pl111_vexpress.o
+pl111_drm-$(CONFIG_ARCH_NOMADIK) += pl111_nomadik.o
 pl111_drm-$(CONFIG_DEBUG_FS) += pl111_debugfs.o
 pl111_drm-$(CONFIG_DEBUG_FS) += pl111_debugfs.o
 
 
 obj-$(CONFIG_DRM_PL111) += pl111_drm.o
 obj-$(CONFIG_DRM_PL111) += pl111_drm.o

+ 45 - 9
drivers/gpu/drm/pl111/pl111_display.c

@@ -223,48 +223,84 @@ static void pl111_display_enable(struct drm_simple_display_pipe *pipe,
 
 
 	/* Hard-code TFT panel */
 	/* Hard-code TFT panel */
 	cntl = CNTL_LCDEN | CNTL_LCDTFT | CNTL_LCDVCOMP(1);
 	cntl = CNTL_LCDEN | CNTL_LCDTFT | CNTL_LCDVCOMP(1);
+	/* On the ST Micro variant, assume all 24 bits are connected */
+	if (priv->variant->st_bitmux_control)
+		cntl |= CNTL_ST_CDWID_24;
 
 
-	/* Note that the the hardware's format reader takes 'r' from
+	/*
+	 * Note that the the ARM hardware's format reader takes 'r' from
 	 * the low bit, while DRM formats list channels from high bit
 	 * the low bit, while DRM formats list channels from high bit
-	 * to low bit as you read left to right.
+	 * to low bit as you read left to right. The ST Micro version of
+	 * the PL110 (LCDC) however uses the standard DRM format.
 	 */
 	 */
 	switch (fb->format->format) {
 	switch (fb->format->format) {
+	case DRM_FORMAT_BGR888:
+		/* Only supported on the ST Micro variant */
+		if (priv->variant->st_bitmux_control)
+			cntl |= CNTL_ST_LCDBPP24_PACKED | CNTL_BGR;
+		break;
+	case DRM_FORMAT_RGB888:
+		/* Only supported on the ST Micro variant */
+		if (priv->variant->st_bitmux_control)
+			cntl |= CNTL_ST_LCDBPP24_PACKED;
+		break;
 	case DRM_FORMAT_ABGR8888:
 	case DRM_FORMAT_ABGR8888:
 	case DRM_FORMAT_XBGR8888:
 	case DRM_FORMAT_XBGR8888:
-		cntl |= CNTL_LCDBPP24;
+		if (priv->variant->st_bitmux_control)
+			cntl |= CNTL_LCDBPP24 | CNTL_BGR;
+		else
+			cntl |= CNTL_LCDBPP24;
 		break;
 		break;
 	case DRM_FORMAT_ARGB8888:
 	case DRM_FORMAT_ARGB8888:
 	case DRM_FORMAT_XRGB8888:
 	case DRM_FORMAT_XRGB8888:
-		cntl |= CNTL_LCDBPP24 | CNTL_BGR;
+		if (priv->variant->st_bitmux_control)
+			cntl |= CNTL_LCDBPP24;
+		else
+			cntl |= CNTL_LCDBPP24 | CNTL_BGR;
 		break;
 		break;
 	case DRM_FORMAT_BGR565:
 	case DRM_FORMAT_BGR565:
 		if (priv->variant->is_pl110)
 		if (priv->variant->is_pl110)
 			cntl |= CNTL_LCDBPP16;
 			cntl |= CNTL_LCDBPP16;
+		else if (priv->variant->st_bitmux_control)
+			cntl |= CNTL_LCDBPP16 | CNTL_ST_1XBPP_565 | CNTL_BGR;
 		else
 		else
 			cntl |= CNTL_LCDBPP16_565;
 			cntl |= CNTL_LCDBPP16_565;
 		break;
 		break;
 	case DRM_FORMAT_RGB565:
 	case DRM_FORMAT_RGB565:
 		if (priv->variant->is_pl110)
 		if (priv->variant->is_pl110)
-			cntl |= CNTL_LCDBPP16;
+			cntl |= CNTL_LCDBPP16 | CNTL_BGR;
+		else if (priv->variant->st_bitmux_control)
+			cntl |= CNTL_LCDBPP16 | CNTL_ST_1XBPP_565;
 		else
 		else
-			cntl |= CNTL_LCDBPP16_565;
-		cntl |= CNTL_BGR;
+			cntl |= CNTL_LCDBPP16_565 | CNTL_BGR;
 		break;
 		break;
 	case DRM_FORMAT_ABGR1555:
 	case DRM_FORMAT_ABGR1555:
 	case DRM_FORMAT_XBGR1555:
 	case DRM_FORMAT_XBGR1555:
 		cntl |= CNTL_LCDBPP16;
 		cntl |= CNTL_LCDBPP16;
+		if (priv->variant->st_bitmux_control)
+			cntl |= CNTL_ST_1XBPP_5551 | CNTL_BGR;
 		break;
 		break;
 	case DRM_FORMAT_ARGB1555:
 	case DRM_FORMAT_ARGB1555:
 	case DRM_FORMAT_XRGB1555:
 	case DRM_FORMAT_XRGB1555:
-		cntl |= CNTL_LCDBPP16 | CNTL_BGR;
+		cntl |= CNTL_LCDBPP16;
+		if (priv->variant->st_bitmux_control)
+			cntl |= CNTL_ST_1XBPP_5551;
+		else
+			cntl |= CNTL_BGR;
 		break;
 		break;
 	case DRM_FORMAT_ABGR4444:
 	case DRM_FORMAT_ABGR4444:
 	case DRM_FORMAT_XBGR4444:
 	case DRM_FORMAT_XBGR4444:
 		cntl |= CNTL_LCDBPP16_444;
 		cntl |= CNTL_LCDBPP16_444;
+		if (priv->variant->st_bitmux_control)
+			cntl |= CNTL_ST_1XBPP_444 | CNTL_BGR;
 		break;
 		break;
 	case DRM_FORMAT_ARGB4444:
 	case DRM_FORMAT_ARGB4444:
 	case DRM_FORMAT_XRGB4444:
 	case DRM_FORMAT_XRGB4444:
-		cntl |= CNTL_LCDBPP16_444 | CNTL_BGR;
+		cntl |= CNTL_LCDBPP16_444;
+		if (priv->variant->st_bitmux_control)
+			cntl |= CNTL_ST_1XBPP_444;
+		else
+			cntl |= CNTL_BGR;
 		break;
 		break;
 	default:
 	default:
 		WARN_ONCE(true, "Unknown FB format 0x%08x\n",
 		WARN_ONCE(true, "Unknown FB format 0x%08x\n",

+ 5 - 0
drivers/gpu/drm/pl111/pl111_drm.h

@@ -36,11 +36,14 @@ struct drm_minor;
  * struct pl111_variant_data - encodes IP differences
  * struct pl111_variant_data - encodes IP differences
  * @name: the name of this variant
  * @name: the name of this variant
  * @is_pl110: this is the early PL110 variant
  * @is_pl110: this is the early PL110 variant
+ * @is_lcdc: this is the ST Microelectronics Nomadik LCDC variant
  * @external_bgr: this is the Versatile Pl110 variant with external
  * @external_bgr: this is the Versatile Pl110 variant with external
  *	BGR/RGB routing
  *	BGR/RGB routing
  * @broken_clockdivider: the clock divider is broken and we need to
  * @broken_clockdivider: the clock divider is broken and we need to
  *	use the supplied clock directly
  *	use the supplied clock directly
  * @broken_vblank: the vblank IRQ is broken on this variant
  * @broken_vblank: the vblank IRQ is broken on this variant
+ * @st_bitmux_control: this variant is using the ST Micro bitmux
+ *	extensions to the control register
  * @formats: array of supported pixel formats on this variant
  * @formats: array of supported pixel formats on this variant
  * @nformats: the length of the array of supported pixel formats
  * @nformats: the length of the array of supported pixel formats
  * @fb_bpp: desired bits per pixel on the default framebuffer
  * @fb_bpp: desired bits per pixel on the default framebuffer
@@ -48,9 +51,11 @@ struct drm_minor;
 struct pl111_variant_data {
 struct pl111_variant_data {
 	const char *name;
 	const char *name;
 	bool is_pl110;
 	bool is_pl110;
+	bool is_lcdc;
 	bool external_bgr;
 	bool external_bgr;
 	bool broken_clockdivider;
 	bool broken_clockdivider;
 	bool broken_vblank;
 	bool broken_vblank;
+	bool st_bitmux_control;
 	const u32 *formats;
 	const u32 *formats;
 	unsigned int nformats;
 	unsigned int nformats;
 	unsigned int fb_bpp;
 	unsigned int fb_bpp;

+ 40 - 4
drivers/gpu/drm/pl111/pl111_drv.c

@@ -75,6 +75,7 @@
 
 
 #include "pl111_drm.h"
 #include "pl111_drm.h"
 #include "pl111_versatile.h"
 #include "pl111_versatile.h"
+#include "pl111_nomadik.h"
 
 
 #define DRIVER_DESC      "DRM module for PL111"
 #define DRIVER_DESC      "DRM module for PL111"
 
 
@@ -288,8 +289,8 @@ static int pl111_amba_probe(struct amba_device *amba_dev,
 		priv->memory_bw = 0;
 		priv->memory_bw = 0;
 	}
 	}
 
 
-	/* The two variants swap this register */
-	if (variant->is_pl110) {
+	/* The two main variants swap this register */
+	if (variant->is_pl110 || variant->is_lcdc) {
 		priv->ienb = CLCD_PL110_IENB;
 		priv->ienb = CLCD_PL110_IENB;
 		priv->ctrl = CLCD_PL110_CNTL;
 		priv->ctrl = CLCD_PL110_CNTL;
 	} else {
 	} else {
@@ -308,6 +309,7 @@ static int pl111_amba_probe(struct amba_device *amba_dev,
 	ret = pl111_versatile_init(dev, priv);
 	ret = pl111_versatile_init(dev, priv);
 	if (ret)
 	if (ret)
 		goto dev_unref;
 		goto dev_unref;
+	pl111_nomadik_init(dev);
 
 
 	/* turn off interrupts before requesting the irq */
 	/* turn off interrupts before requesting the irq */
 	writel(0, priv->regs + priv->ienb);
 	writel(0, priv->regs + priv->ienb);
@@ -400,16 +402,50 @@ static const struct pl111_variant_data pl111_variant = {
 	.fb_bpp = 32,
 	.fb_bpp = 32,
 };
 };
 
 
+static const u32 pl110_nomadik_pixel_formats[] = {
+	DRM_FORMAT_RGB888,
+	DRM_FORMAT_BGR888,
+	DRM_FORMAT_ABGR8888,
+	DRM_FORMAT_XBGR8888,
+	DRM_FORMAT_ARGB8888,
+	DRM_FORMAT_XRGB8888,
+	DRM_FORMAT_BGR565,
+	DRM_FORMAT_RGB565,
+	DRM_FORMAT_ABGR1555,
+	DRM_FORMAT_XBGR1555,
+	DRM_FORMAT_ARGB1555,
+	DRM_FORMAT_XRGB1555,
+	DRM_FORMAT_ABGR4444,
+	DRM_FORMAT_XBGR4444,
+	DRM_FORMAT_ARGB4444,
+	DRM_FORMAT_XRGB4444,
+};
+
+static const struct pl111_variant_data pl110_nomadik_variant = {
+	.name = "LCDC (PL110 Nomadik)",
+	.formats = pl110_nomadik_pixel_formats,
+	.nformats = ARRAY_SIZE(pl110_nomadik_pixel_formats),
+	.is_lcdc = true,
+	.st_bitmux_control = true,
+	.broken_vblank = true,
+	.fb_bpp = 16,
+};
+
 static const struct amba_id pl111_id_table[] = {
 static const struct amba_id pl111_id_table[] = {
 	{
 	{
 		.id = 0x00041110,
 		.id = 0x00041110,
 		.mask = 0x000fffff,
 		.mask = 0x000fffff,
-		.data = (void*)&pl110_variant,
+		.data = (void *)&pl110_variant,
+	},
+	{
+		.id = 0x00180110,
+		.mask = 0x00fffffe,
+		.data = (void *)&pl110_nomadik_variant,
 	},
 	},
 	{
 	{
 		.id = 0x00041111,
 		.id = 0x00041111,
 		.mask = 0x000fffff,
 		.mask = 0x000fffff,
-		.data = (void*)&pl111_variant,
+		.data = (void *)&pl111_variant,
 	},
 	},
 	{0, 0},
 	{0, 0},
 };
 };

+ 36 - 0
drivers/gpu/drm/pl111/pl111_nomadik.c

@@ -0,0 +1,36 @@
+// SPDX-License-Identifier: GPL-2.0+
+#include <linux/device.h>
+#include <linux/regmap.h>
+#include <linux/mfd/syscon.h>
+#include <linux/bitops.h>
+#include <linux/module.h>
+#include "pl111_nomadik.h"
+
+#define PMU_CTRL_OFFSET 0x0000
+#define PMU_CTRL_LCDNDIF BIT(26)
+
+void pl111_nomadik_init(struct device *dev)
+{
+	struct regmap *pmu_regmap;
+
+	/*
+	 * Just bail out of this is not found, we could be running
+	 * multiplatform on something else than Nomadik.
+	 */
+	pmu_regmap =
+		syscon_regmap_lookup_by_compatible("stericsson,nomadik-pmu");
+	if (IS_ERR(pmu_regmap))
+		return;
+
+	/*
+	 * This bit in the PMU controller multiplexes the two graphics
+	 * blocks found in the Nomadik STn8815. The other one is called
+	 * MDIF (Master Display Interface) and gets muxed out here.
+	 */
+	regmap_update_bits(pmu_regmap,
+			   PMU_CTRL_OFFSET,
+			   PMU_CTRL_LCDNDIF,
+			   0);
+	dev_info(dev, "set Nomadik PMU mux to CLCD mode\n");
+}
+EXPORT_SYMBOL_GPL(pl111_nomadik_init);

+ 18 - 0
drivers/gpu/drm/pl111/pl111_nomadik.h

@@ -0,0 +1,18 @@
+// SPDX-License-Identifier: GPL-2.0+
+#include <linux/device.h>
+
+#ifndef PL111_NOMADIK_H
+#define PL111_NOMADIK_H
+#endif
+
+#ifdef CONFIG_ARCH_NOMADIK
+
+void pl111_nomadik_init(struct device *dev);
+
+#else
+
+static inline void pl111_nomadik_init(struct device *dev)
+{
+}
+
+#endif

+ 0 - 7
drivers/gpu/drm/qxl/qxl_release.c

@@ -50,12 +50,6 @@ static const char *qxl_get_timeline_name(struct dma_fence *fence)
 	return "release";
 	return "release";
 }
 }
 
 
-static bool qxl_nop_signaling(struct dma_fence *fence)
-{
-	/* fences are always automatically signaled, so just pretend we did this.. */
-	return true;
-}
-
 static long qxl_fence_wait(struct dma_fence *fence, bool intr,
 static long qxl_fence_wait(struct dma_fence *fence, bool intr,
 			   signed long timeout)
 			   signed long timeout)
 {
 {
@@ -119,7 +113,6 @@ signaled:
 static const struct dma_fence_ops qxl_fence_ops = {
 static const struct dma_fence_ops qxl_fence_ops = {
 	.get_driver_name = qxl_get_driver_name,
 	.get_driver_name = qxl_get_driver_name,
 	.get_timeline_name = qxl_get_timeline_name,
 	.get_timeline_name = qxl_get_timeline_name,
-	.enable_signaling = qxl_nop_signaling,
 	.wait = qxl_fence_wait,
 	.wait = qxl_fence_wait,
 };
 };
 
 

+ 1 - 1
drivers/gpu/drm/savage/savage_state.c

@@ -971,7 +971,7 @@ int savage_bci_cmdbuf(struct drm_device *dev, void *data, struct drm_file *file_
 	LOCK_TEST_WITH_RETURN(dev, file_priv);
 	LOCK_TEST_WITH_RETURN(dev, file_priv);
 
 
 	if (dma && dma->buflist) {
 	if (dma && dma->buflist) {
-		if (cmdbuf->dma_idx > dma->buf_count) {
+		if (cmdbuf->dma_idx >= dma->buf_count) {
 			DRM_ERROR
 			DRM_ERROR
 			    ("vertex buffer index %u out of range (0-%u)\n",
 			    ("vertex buffer index %u out of range (0-%u)\n",
 			     cmdbuf->dma_idx, dma->buf_count - 1);
 			     cmdbuf->dma_idx, dma->buf_count - 1);

+ 0 - 11
drivers/gpu/drm/scheduler/sched_fence.c

@@ -81,11 +81,6 @@ static const char *drm_sched_fence_get_timeline_name(struct dma_fence *f)
 	return (const char *)fence->sched->name;
 	return (const char *)fence->sched->name;
 }
 }
 
 
-static bool drm_sched_fence_enable_signaling(struct dma_fence *f)
-{
-	return true;
-}
-
 /**
 /**
  * drm_sched_fence_free - free up the fence memory
  * drm_sched_fence_free - free up the fence memory
  *
  *
@@ -134,18 +129,12 @@ static void drm_sched_fence_release_finished(struct dma_fence *f)
 const struct dma_fence_ops drm_sched_fence_ops_scheduled = {
 const struct dma_fence_ops drm_sched_fence_ops_scheduled = {
 	.get_driver_name = drm_sched_fence_get_driver_name,
 	.get_driver_name = drm_sched_fence_get_driver_name,
 	.get_timeline_name = drm_sched_fence_get_timeline_name,
 	.get_timeline_name = drm_sched_fence_get_timeline_name,
-	.enable_signaling = drm_sched_fence_enable_signaling,
-	.signaled = NULL,
-	.wait = dma_fence_default_wait,
 	.release = drm_sched_fence_release_scheduled,
 	.release = drm_sched_fence_release_scheduled,
 };
 };
 
 
 const struct dma_fence_ops drm_sched_fence_ops_finished = {
 const struct dma_fence_ops drm_sched_fence_ops_finished = {
 	.get_driver_name = drm_sched_fence_get_driver_name,
 	.get_driver_name = drm_sched_fence_get_driver_name,
 	.get_timeline_name = drm_sched_fence_get_timeline_name,
 	.get_timeline_name = drm_sched_fence_get_timeline_name,
-	.enable_signaling = drm_sched_fence_enable_signaling,
-	.signaled = NULL,
-	.wait = dma_fence_default_wait,
 	.release = drm_sched_fence_release_finished,
 	.release = drm_sched_fence_release_finished,
 };
 };
 
 

+ 1 - 1
drivers/gpu/drm/sti/sti_cursor.c

@@ -332,7 +332,7 @@ static void sti_cursor_destroy(struct drm_plane *drm_plane)
 {
 {
 	DRM_DEBUG_DRIVER("\n");
 	DRM_DEBUG_DRIVER("\n");
 
 
-	drm_plane_helper_disable(drm_plane);
+	drm_plane_helper_disable(drm_plane, NULL);
 	drm_plane_cleanup(drm_plane);
 	drm_plane_cleanup(drm_plane);
 }
 }
 
 

+ 1 - 1
drivers/gpu/drm/sti/sti_gdp.c

@@ -883,7 +883,7 @@ static void sti_gdp_destroy(struct drm_plane *drm_plane)
 {
 {
 	DRM_DEBUG_DRIVER("\n");
 	DRM_DEBUG_DRIVER("\n");
 
 
-	drm_plane_helper_disable(drm_plane);
+	drm_plane_helper_disable(drm_plane, NULL);
 	drm_plane_cleanup(drm_plane);
 	drm_plane_cleanup(drm_plane);
 }
 }
 
 

+ 1 - 1
drivers/gpu/drm/sti/sti_hqvdp.c

@@ -1260,7 +1260,7 @@ static void sti_hqvdp_destroy(struct drm_plane *drm_plane)
 {
 {
 	DRM_DEBUG_DRIVER("\n");
 	DRM_DEBUG_DRIVER("\n");
 
 
-	drm_plane_helper_disable(drm_plane);
+	drm_plane_helper_disable(drm_plane, NULL);
 	drm_plane_cleanup(drm_plane);
 	drm_plane_cleanup(drm_plane);
 }
 }
 
 

+ 1 - 1
drivers/gpu/drm/sun4i/sun4i_crtc.c

@@ -242,7 +242,7 @@ struct sun4i_crtc *sun4i_crtc_init(struct drm_device *drm,
 
 
 	/* Set possible_crtcs to this crtc for overlay planes */
 	/* Set possible_crtcs to this crtc for overlay planes */
 	for (i = 0; planes[i]; i++) {
 	for (i = 0; planes[i]; i++) {
-		uint32_t possible_crtcs = BIT(drm_crtc_index(&scrtc->crtc));
+		uint32_t possible_crtcs = drm_crtc_mask(&scrtc->crtc);
 		struct drm_plane *plane = planes[i];
 		struct drm_plane *plane = planes[i];
 
 
 		if (plane->type == DRM_PLANE_TYPE_OVERLAY)
 		if (plane->type == DRM_PLANE_TYPE_OVERLAY)

+ 1 - 1
drivers/gpu/drm/sun4i/sun4i_lvds.c

@@ -136,7 +136,7 @@ int sun4i_lvds_init(struct drm_device *drm, struct sun4i_tcon *tcon)
 	}
 	}
 
 
 	/* The LVDS encoder can only work with the TCON channel 0 */
 	/* The LVDS encoder can only work with the TCON channel 0 */
-	lvds->encoder.possible_crtcs = BIT(drm_crtc_index(&tcon->crtc->crtc));
+	lvds->encoder.possible_crtcs = drm_crtc_mask(&tcon->crtc->crtc);
 
 
 	if (tcon->panel) {
 	if (tcon->panel) {
 		drm_connector_helper_add(&lvds->connector,
 		drm_connector_helper_add(&lvds->connector,

+ 1 - 1
drivers/gpu/drm/sun4i/sun4i_rgb.c

@@ -202,7 +202,7 @@ int sun4i_rgb_init(struct drm_device *drm, struct sun4i_tcon *tcon)
 	}
 	}
 
 
 	/* The RGB encoder can only work with the TCON channel 0 */
 	/* The RGB encoder can only work with the TCON channel 0 */
-	rgb->encoder.possible_crtcs = BIT(drm_crtc_index(&tcon->crtc->crtc));
+	rgb->encoder.possible_crtcs = drm_crtc_mask(&tcon->crtc->crtc);
 
 
 	if (tcon->panel) {
 	if (tcon->panel) {
 		drm_connector_helper_add(&rgb->connector,
 		drm_connector_helper_add(&rgb->connector,

+ 3 - 3
drivers/gpu/drm/vc4/vc4_crtc.c

@@ -1081,7 +1081,7 @@ static int vc4_crtc_bind(struct device *dev, struct device *master, void *data)
 		if (IS_ERR(plane))
 		if (IS_ERR(plane))
 			continue;
 			continue;
 
 
-		plane->possible_crtcs = 1 << drm_crtc_index(crtc);
+		plane->possible_crtcs = drm_crtc_mask(crtc);
 	}
 	}
 
 
 	/* Set up the legacy cursor after overlay initialization,
 	/* Set up the legacy cursor after overlay initialization,
@@ -1090,7 +1090,7 @@ static int vc4_crtc_bind(struct device *dev, struct device *master, void *data)
 	 */
 	 */
 	cursor_plane = vc4_plane_init(drm, DRM_PLANE_TYPE_CURSOR);
 	cursor_plane = vc4_plane_init(drm, DRM_PLANE_TYPE_CURSOR);
 	if (!IS_ERR(cursor_plane)) {
 	if (!IS_ERR(cursor_plane)) {
-		cursor_plane->possible_crtcs = 1 << drm_crtc_index(crtc);
+		cursor_plane->possible_crtcs = drm_crtc_mask(crtc);
 		crtc->cursor = cursor_plane;
 		crtc->cursor = cursor_plane;
 	}
 	}
 
 
@@ -1118,7 +1118,7 @@ static int vc4_crtc_bind(struct device *dev, struct device *master, void *data)
 err_destroy_planes:
 err_destroy_planes:
 	list_for_each_entry_safe(destroy_plane, temp,
 	list_for_each_entry_safe(destroy_plane, temp,
 				 &drm->mode_config.plane_list, head) {
 				 &drm->mode_config.plane_list, head) {
-		if (destroy_plane->possible_crtcs == 1 << drm_crtc_index(crtc))
+		if (destroy_plane->possible_crtcs == drm_crtc_mask(crtc))
 		    destroy_plane->funcs->destroy(destroy_plane);
 		    destroy_plane->funcs->destroy(destroy_plane);
 	}
 	}
 err:
 err:

+ 27 - 15
drivers/gpu/drm/vc4/vc4_dsi.c

@@ -814,7 +814,9 @@ static void vc4_dsi_encoder_disable(struct drm_encoder *encoder)
 	struct vc4_dsi *dsi = vc4_encoder->dsi;
 	struct vc4_dsi *dsi = vc4_encoder->dsi;
 	struct device *dev = &dsi->pdev->dev;
 	struct device *dev = &dsi->pdev->dev;
 
 
+	drm_bridge_disable(dsi->bridge);
 	vc4_dsi_ulps(dsi, true);
 	vc4_dsi_ulps(dsi, true);
+	drm_bridge_post_disable(dsi->bridge);
 
 
 	clk_disable_unprepare(dsi->pll_phy_clock);
 	clk_disable_unprepare(dsi->pll_phy_clock);
 	clk_disable_unprepare(dsi->escape_clock);
 	clk_disable_unprepare(dsi->escape_clock);
@@ -1089,21 +1091,6 @@ static void vc4_dsi_encoder_enable(struct drm_encoder *encoder)
 	/* Display reset sequence timeout */
 	/* Display reset sequence timeout */
 	DSI_PORT_WRITE(PR_TO_CNT, 100000);
 	DSI_PORT_WRITE(PR_TO_CNT, 100000);
 
 
-	if (dsi->mode_flags & MIPI_DSI_MODE_VIDEO) {
-		DSI_PORT_WRITE(DISP0_CTRL,
-			       VC4_SET_FIELD(dsi->divider,
-					     DSI_DISP0_PIX_CLK_DIV) |
-			       VC4_SET_FIELD(dsi->format, DSI_DISP0_PFORMAT) |
-			       VC4_SET_FIELD(DSI_DISP0_LP_STOP_PERFRAME,
-					     DSI_DISP0_LP_STOP_CTRL) |
-			       DSI_DISP0_ST_END |
-			       DSI_DISP0_ENABLE);
-	} else {
-		DSI_PORT_WRITE(DISP0_CTRL,
-			       DSI_DISP0_COMMAND_MODE |
-			       DSI_DISP0_ENABLE);
-	}
-
 	/* Set up DISP1 for transferring long command payloads through
 	/* Set up DISP1 for transferring long command payloads through
 	 * the pixfifo.
 	 * the pixfifo.
 	 */
 	 */
@@ -1128,6 +1115,25 @@ static void vc4_dsi_encoder_enable(struct drm_encoder *encoder)
 
 
 	vc4_dsi_ulps(dsi, false);
 	vc4_dsi_ulps(dsi, false);
 
 
+	drm_bridge_pre_enable(dsi->bridge);
+
+	if (dsi->mode_flags & MIPI_DSI_MODE_VIDEO) {
+		DSI_PORT_WRITE(DISP0_CTRL,
+			       VC4_SET_FIELD(dsi->divider,
+					     DSI_DISP0_PIX_CLK_DIV) |
+			       VC4_SET_FIELD(dsi->format, DSI_DISP0_PFORMAT) |
+			       VC4_SET_FIELD(DSI_DISP0_LP_STOP_PERFRAME,
+					     DSI_DISP0_LP_STOP_CTRL) |
+			       DSI_DISP0_ST_END |
+			       DSI_DISP0_ENABLE);
+	} else {
+		DSI_PORT_WRITE(DISP0_CTRL,
+			       DSI_DISP0_COMMAND_MODE |
+			       DSI_DISP0_ENABLE);
+	}
+
+	drm_bridge_enable(dsi->bridge);
+
 	if (debug_dump_regs) {
 	if (debug_dump_regs) {
 		DRM_INFO("DSI regs after:\n");
 		DRM_INFO("DSI regs after:\n");
 		vc4_dsi_dump_regs(dsi);
 		vc4_dsi_dump_regs(dsi);
@@ -1639,6 +1645,12 @@ static int vc4_dsi_bind(struct device *dev, struct device *master, void *data)
 		dev_err(dev, "bridge attach failed: %d\n", ret);
 		dev_err(dev, "bridge attach failed: %d\n", ret);
 		return ret;
 		return ret;
 	}
 	}
+	/* Disable the atomic helper calls into the bridge.  We
+	 * manually call the bridge pre_enable / enable / etc. calls
+	 * from our driver, since we need to sequence them within the
+	 * encoder's enable/disable paths.
+	 */
+	dsi->encoder->bridge = NULL;
 
 
 	pm_runtime_enable(dev);
 	pm_runtime_enable(dev);
 
 

+ 0 - 8
drivers/gpu/drm/vc4/vc4_fence.c

@@ -33,11 +33,6 @@ static const char *vc4_fence_get_timeline_name(struct dma_fence *fence)
 	return "vc4-v3d";
 	return "vc4-v3d";
 }
 }
 
 
-static bool vc4_fence_enable_signaling(struct dma_fence *fence)
-{
-	return true;
-}
-
 static bool vc4_fence_signaled(struct dma_fence *fence)
 static bool vc4_fence_signaled(struct dma_fence *fence)
 {
 {
 	struct vc4_fence *f = to_vc4_fence(fence);
 	struct vc4_fence *f = to_vc4_fence(fence);
@@ -49,8 +44,5 @@ static bool vc4_fence_signaled(struct dma_fence *fence)
 const struct dma_fence_ops vc4_fence_ops = {
 const struct dma_fence_ops vc4_fence_ops = {
 	.get_driver_name = vc4_fence_get_driver_name,
 	.get_driver_name = vc4_fence_get_driver_name,
 	.get_timeline_name = vc4_fence_get_timeline_name,
 	.get_timeline_name = vc4_fence_get_timeline_name,
-	.enable_signaling = vc4_fence_enable_signaling,
 	.signaled = vc4_fence_signaled,
 	.signaled = vc4_fence_signaled,
-	.wait = dma_fence_default_wait,
-	.release = dma_fence_free,
 };
 };

+ 1 - 1
drivers/gpu/drm/vc4/vc4_plane.c

@@ -902,7 +902,7 @@ static const struct drm_plane_helper_funcs vc4_plane_helper_funcs = {
 
 
 static void vc4_plane_destroy(struct drm_plane *plane)
 static void vc4_plane_destroy(struct drm_plane *plane)
 {
 {
-	drm_plane_helper_disable(plane);
+	drm_plane_helper_disable(plane, NULL);
 	drm_plane_cleanup(plane);
 	drm_plane_cleanup(plane);
 }
 }
 
 

+ 1 - 1
drivers/gpu/drm/vgem/vgem_drv.c

@@ -74,7 +74,7 @@ static vm_fault_t vgem_gem_fault(struct vm_fault *vmf)
 
 
 	num_pages = DIV_ROUND_UP(obj->base.size, PAGE_SIZE);
 	num_pages = DIV_ROUND_UP(obj->base.size, PAGE_SIZE);
 
 
-	if (page_offset > num_pages)
+	if (page_offset >= num_pages)
 		return VM_FAULT_SIGBUS;
 		return VM_FAULT_SIGBUS;
 
 
 	mutex_lock(&obj->pages_lock);
 	mutex_lock(&obj->pages_lock);

+ 0 - 7
drivers/gpu/drm/virtio/virtgpu_fence.c

@@ -36,11 +36,6 @@ static const char *virtio_get_timeline_name(struct dma_fence *f)
 	return "controlq";
 	return "controlq";
 }
 }
 
 
-static bool virtio_enable_signaling(struct dma_fence *f)
-{
-	return true;
-}
-
 static bool virtio_signaled(struct dma_fence *f)
 static bool virtio_signaled(struct dma_fence *f)
 {
 {
 	struct virtio_gpu_fence *fence = to_virtio_fence(f);
 	struct virtio_gpu_fence *fence = to_virtio_fence(f);
@@ -67,9 +62,7 @@ static void virtio_timeline_value_str(struct dma_fence *f, char *str, int size)
 static const struct dma_fence_ops virtio_fence_ops = {
 static const struct dma_fence_ops virtio_fence_ops = {
 	.get_driver_name     = virtio_get_driver_name,
 	.get_driver_name     = virtio_get_driver_name,
 	.get_timeline_name   = virtio_get_timeline_name,
 	.get_timeline_name   = virtio_get_timeline_name,
-	.enable_signaling    = virtio_enable_signaling,
 	.signaled            = virtio_signaled,
 	.signaled            = virtio_signaled,
-	.wait                = dma_fence_default_wait,
 	.fence_value_str     = virtio_fence_value_str,
 	.fence_value_str     = virtio_fence_value_str,
 	.timeline_value_str  = virtio_timeline_value_str,
 	.timeline_value_str  = virtio_timeline_value_str,
 };
 };

+ 1 - 0
drivers/gpu/drm/vmwgfx/Kconfig

@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0
 config DRM_VMWGFX
 config DRM_VMWGFX
 	tristate "DRM driver for VMware Virtual GPU"
 	tristate "DRM driver for VMware Virtual GPU"
 	depends on DRM && PCI && X86 && MMU
 	depends on DRM && PCI && X86 && MMU

+ 2 - 1
drivers/gpu/drm/vmwgfx/device_include/svga3d_caps.h

@@ -1,5 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 OR MIT */
 /**********************************************************
 /**********************************************************
- * Copyright 2007-2015 VMware, Inc.  All rights reserved.
+ * Copyright 2007-2015 VMware, Inc.
  *
  *
  * Permission is hereby granted, free of charge, to any person
  * Permission is hereby granted, free of charge, to any person
  * obtaining a copy of this software and associated documentation
  * obtaining a copy of this software and associated documentation

+ 2 - 1
drivers/gpu/drm/vmwgfx/device_include/svga3d_cmd.h

@@ -1,5 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 OR MIT */
 /**********************************************************
 /**********************************************************
- * Copyright 1998-2015 VMware, Inc.  All rights reserved.
+ * Copyright 1998-2015 VMware, Inc.
  *
  *
  * Permission is hereby granted, free of charge, to any person
  * Permission is hereby granted, free of charge, to any person
  * obtaining a copy of this software and associated documentation
  * obtaining a copy of this software and associated documentation

+ 2 - 1
drivers/gpu/drm/vmwgfx/device_include/svga3d_devcaps.h

@@ -1,5 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 OR MIT */
 /**********************************************************
 /**********************************************************
- * Copyright 1998-2015 VMware, Inc.  All rights reserved.
+ * Copyright 1998-2015 VMware, Inc.
  *
  *
  * Permission is hereby granted, free of charge, to any person
  * Permission is hereby granted, free of charge, to any person
  * obtaining a copy of this software and associated documentation
  * obtaining a copy of this software and associated documentation

+ 2 - 1
drivers/gpu/drm/vmwgfx/device_include/svga3d_dx.h

@@ -1,5 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 OR MIT */
 /**********************************************************
 /**********************************************************
- * Copyright 2012-2015 VMware, Inc.  All rights reserved.
+ * Copyright 2012-2015 VMware, Inc.
  *
  *
  * Permission is hereby granted, free of charge, to any person
  * Permission is hereby granted, free of charge, to any person
  * obtaining a copy of this software and associated documentation
  * obtaining a copy of this software and associated documentation

+ 2 - 1
drivers/gpu/drm/vmwgfx/device_include/svga3d_limits.h

@@ -1,5 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 OR MIT */
 /**********************************************************
 /**********************************************************
- * Copyright 2007-2015 VMware, Inc.  All rights reserved.
+ * Copyright 2007-2015 VMware, Inc.
  *
  *
  * Permission is hereby granted, free of charge, to any person
  * Permission is hereby granted, free of charge, to any person
  * obtaining a copy of this software and associated documentation
  * obtaining a copy of this software and associated documentation

+ 2 - 1
drivers/gpu/drm/vmwgfx/device_include/svga3d_reg.h

@@ -1,5 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 OR MIT */
 /**********************************************************
 /**********************************************************
- * Copyright 1998-2015 VMware, Inc.  All rights reserved.
+ * Copyright 1998-2015 VMware, Inc.
  *
  *
  * Permission is hereby granted, free of charge, to any person
  * Permission is hereby granted, free of charge, to any person
  * obtaining a copy of this software and associated documentation
  * obtaining a copy of this software and associated documentation

+ 2 - 2
drivers/gpu/drm/vmwgfx/device_include/svga3d_surfacedefs.h

@@ -1,7 +1,7 @@
+/* SPDX-License-Identifier: GPL-2.0 OR MIT */
 /**************************************************************************
 /**************************************************************************
  *
  *
- * Copyright © 2008-2015 VMware, Inc., Palo Alto, CA., USA
- * All Rights Reserved.
+ * Copyright 2008-2015 VMware, Inc., Palo Alto, CA., USA
  *
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the
  * copy of this software and associated documentation files (the

+ 2 - 1
drivers/gpu/drm/vmwgfx/device_include/svga3d_types.h

@@ -1,5 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 OR MIT */
 /**********************************************************
 /**********************************************************
- * Copyright 2012-2015 VMware, Inc.  All rights reserved.
+ * Copyright 2012-2015 VMware, Inc.
  *
  *
  * Permission is hereby granted, free of charge, to any person
  * Permission is hereby granted, free of charge, to any person
  * obtaining a copy of this software and associated documentation
  * obtaining a copy of this software and associated documentation

+ 2 - 1
drivers/gpu/drm/vmwgfx/device_include/svga_escape.h

@@ -1,5 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 OR MIT */
 /**********************************************************
 /**********************************************************
- * Copyright 2007-2015 VMware, Inc.  All rights reserved.
+ * Copyright 2007-2015 VMware, Inc.
  *
  *
  * Permission is hereby granted, free of charge, to any person
  * Permission is hereby granted, free of charge, to any person
  * obtaining a copy of this software and associated documentation
  * obtaining a copy of this software and associated documentation

+ 2 - 1
drivers/gpu/drm/vmwgfx/device_include/svga_overlay.h

@@ -1,5 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 OR MIT */
 /**********************************************************
 /**********************************************************
- * Copyright 2007-2015 VMware, Inc.  All rights reserved.
+ * Copyright 2007-2015 VMware, Inc.
  *
  *
  * Permission is hereby granted, free of charge, to any person
  * Permission is hereby granted, free of charge, to any person
  * obtaining a copy of this software and associated documentation
  * obtaining a copy of this software and associated documentation

+ 2 - 1
drivers/gpu/drm/vmwgfx/device_include/svga_reg.h

@@ -1,5 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 OR MIT */
 /**********************************************************
 /**********************************************************
- * Copyright 1998-2015 VMware, Inc.  All rights reserved.
+ * Copyright 1998-2015 VMware, Inc.
  *
  *
  * Permission is hereby granted, free of charge, to any person
  * Permission is hereby granted, free of charge, to any person
  * obtaining a copy of this software and associated documentation
  * obtaining a copy of this software and associated documentation

+ 2 - 1
drivers/gpu/drm/vmwgfx/device_include/svga_types.h

@@ -1,5 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 OR MIT */
 /**********************************************************
 /**********************************************************
- * Copyright 2015 VMware, Inc.  All rights reserved.
+ * Copyright 2015 VMware, Inc.
  *
  *
  * Permission is hereby granted, free of charge, to any person
  * Permission is hereby granted, free of charge, to any person
  * obtaining a copy of this software and associated documentation
  * obtaining a copy of this software and associated documentation

+ 1 - 24
drivers/gpu/drm/vmwgfx/device_include/vmware_pack_begin.h

@@ -1,25 +1,2 @@
-/**********************************************************
- * Copyright 2015 VMware, Inc.  All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies
- * of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- **********************************************************/
+/* SPDX-License-Identifier: GPL-2.0 */
 #include <linux/compiler.h>
 #include <linux/compiler.h>

+ 1 - 24
drivers/gpu/drm/vmwgfx/device_include/vmware_pack_end.h

@@ -1,25 +1,2 @@
-/**********************************************************
- * Copyright 2015 VMware, Inc.  All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies
- * of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- **********************************************************/
+/* SPDX-License-Identifier: GPL-2.0 */
 __packed
 __packed

+ 2 - 2
drivers/gpu/drm/vmwgfx/vmwgfx_binding.c

@@ -1,7 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0 OR MIT
 /**************************************************************************
 /**************************************************************************
  *
  *
- * Copyright © 2015 VMware, Inc., Palo Alto, CA., USA
- * All Rights Reserved.
+ * Copyright 2015 VMware, Inc., Palo Alto, CA., USA
  *
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the
  * copy of this software and associated documentation files (the

+ 2 - 2
drivers/gpu/drm/vmwgfx/vmwgfx_binding.h

@@ -1,7 +1,7 @@
+/* SPDX-License-Identifier: GPL-2.0 OR MIT */
 /**************************************************************************
 /**************************************************************************
  *
  *
- * Copyright © 2015 VMware, Inc., Palo Alto, CA., USA
- * All Rights Reserved.
+ * Copyright 2015 VMware, Inc., Palo Alto, CA., USA
  *
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the
  * copy of this software and associated documentation files (the

+ 2 - 1
drivers/gpu/drm/vmwgfx/vmwgfx_blit.c

@@ -1,6 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0 OR MIT
 /**************************************************************************
 /**************************************************************************
  *
  *
- * Copyright © 2017 VMware, Inc., Palo Alto, CA., USA
+ * Copyright 2017 VMware, Inc., Palo Alto, CA., USA
  * All Rights Reserved.
  * All Rights Reserved.
  *
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * Permission is hereby granted, free of charge, to any person obtaining a

+ 2 - 2
drivers/gpu/drm/vmwgfx/vmwgfx_buffer.c

@@ -1,7 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0 OR MIT
 /**************************************************************************
 /**************************************************************************
  *
  *
- * Copyright © 2009-2015 VMware, Inc., Palo Alto, CA., USA
- * All Rights Reserved.
+ * Copyright 2009-2015 VMware, Inc., Palo Alto, CA., USA
  *
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the
  * copy of this software and associated documentation files (the

+ 2 - 2
drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c

@@ -1,7 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0 OR MIT
 /**************************************************************************
 /**************************************************************************
  *
  *
- * Copyright © 2015 VMware, Inc., Palo Alto, CA., USA
- * All Rights Reserved.
+ * Copyright 2015 VMware, Inc., Palo Alto, CA., USA
  *
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the
  * copy of this software and associated documentation files (the

+ 2 - 2
drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf_res.c

@@ -1,7 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0 OR MIT
 /**************************************************************************
 /**************************************************************************
  *
  *
- * Copyright © 2014-2015 VMware, Inc., Palo Alto, CA., USA
- * All Rights Reserved.
+ * Copyright 2014-2015 VMware, Inc., Palo Alto, CA., USA
  *
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the
  * copy of this software and associated documentation files (the

+ 2 - 2
drivers/gpu/drm/vmwgfx/vmwgfx_context.c

@@ -1,7 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0 OR MIT
 /**************************************************************************
 /**************************************************************************
  *
  *
- * Copyright © 2009-2015 VMware, Inc., Palo Alto, CA., USA
- * All Rights Reserved.
+ * Copyright 2009-2015 VMware, Inc., Palo Alto, CA., USA
  *
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the
  * copy of this software and associated documentation files (the

+ 2 - 2
drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c

@@ -1,7 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0 OR MIT
 /**************************************************************************
 /**************************************************************************
  *
  *
- * Copyright © 2014-2015 VMware, Inc., Palo Alto, CA., USA
- * All Rights Reserved.
+ * Copyright 2014-2015 VMware, Inc., Palo Alto, CA., USA
  *
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the
  * copy of this software and associated documentation files (the

+ 2 - 2
drivers/gpu/drm/vmwgfx/vmwgfx_dmabuf.c

@@ -1,7 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0 OR MIT
 /**************************************************************************
 /**************************************************************************
  *
  *
- * Copyright © 2011-2015 VMware, Inc., Palo Alto, CA., USA
- * All Rights Reserved.
+ * Copyright 2011-2015 VMware, Inc., Palo Alto, CA., USA
  *
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the
  * copy of this software and associated documentation files (the

+ 2 - 2
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c

@@ -1,7 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0 OR MIT
 /**************************************************************************
 /**************************************************************************
  *
  *
- * Copyright © 2009-2016 VMware, Inc., Palo Alto, CA., USA
- * All Rights Reserved.
+ * Copyright 2009-2016 VMware, Inc., Palo Alto, CA., USA
  *
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the
  * copy of this software and associated documentation files (the

+ 2 - 2
drivers/gpu/drm/vmwgfx/vmwgfx_drv.h

@@ -1,7 +1,7 @@
+/* SPDX-License-Identifier: GPL-2.0 OR MIT */
 /**************************************************************************
 /**************************************************************************
  *
  *
- * Copyright © 2009-2015 VMware, Inc., Palo Alto, CA., USA
- * All Rights Reserved.
+ * Copyright 2009-2015 VMware, Inc., Palo Alto, CA., USA
  *
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the
  * copy of this software and associated documentation files (the

+ 2 - 2
drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c

@@ -1,7 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0 OR MIT
 /**************************************************************************
 /**************************************************************************
  *
  *
- * Copyright © 2009 - 2015 VMware, Inc., Palo Alto, CA., USA
- * All Rights Reserved.
+ * Copyright 2009 - 2015 VMware, Inc., Palo Alto, CA., USA
  *
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the
  * copy of this software and associated documentation files (the

+ 2 - 2
drivers/gpu/drm/vmwgfx/vmwgfx_fence.c

@@ -1,7 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0 OR MIT
 /**************************************************************************
 /**************************************************************************
  *
  *
- * Copyright © 2011-2014 VMware, Inc., Palo Alto, CA., USA
- * All Rights Reserved.
+ * Copyright 2011-2014 VMware, Inc., Palo Alto, CA., USA
  *
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the
  * copy of this software and associated documentation files (the

+ 2 - 2
drivers/gpu/drm/vmwgfx/vmwgfx_fence.h

@@ -1,7 +1,7 @@
+/* SPDX-License-Identifier: GPL-2.0 OR MIT */
 /**************************************************************************
 /**************************************************************************
  *
  *
- * Copyright © 2011-2012 VMware, Inc., Palo Alto, CA., USA
- * All Rights Reserved.
+ * Copyright 2011-2012 VMware, Inc., Palo Alto, CA., USA
  *
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the
  * copy of this software and associated documentation files (the

+ 2 - 2
drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c

@@ -1,7 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0 OR MIT
 /**************************************************************************
 /**************************************************************************
  *
  *
- * Copyright © 2009-2015 VMware, Inc., Palo Alto, CA., USA
- * All Rights Reserved.
+ * Copyright 2009-2015 VMware, Inc., Palo Alto, CA., USA
  *
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the
  * copy of this software and associated documentation files (the

+ 2 - 2
drivers/gpu/drm/vmwgfx/vmwgfx_gmr.c

@@ -1,7 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0 OR MIT
 /**************************************************************************
 /**************************************************************************
  *
  *
- * Copyright © 2009-2015 VMware, Inc., Palo Alto, CA., USA
- * All Rights Reserved.
+ * Copyright 2009-2015 VMware, Inc., Palo Alto, CA., USA
  *
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the
  * copy of this software and associated documentation files (the

+ 2 - 2
drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c

@@ -1,7 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0 OR MIT
 /**************************************************************************
 /**************************************************************************
  *
  *
- * Copyright (c) 2007-2010 VMware, Inc., Palo Alto, CA., USA
- * All Rights Reserved.
+ * Copyright 2007-2010 VMware, Inc., Palo Alto, CA., USA
  *
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the
  * copy of this software and associated documentation files (the

+ 2 - 2
drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c

@@ -1,7 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0 OR MIT
 /**************************************************************************
 /**************************************************************************
  *
  *
- * Copyright © 2009-2015 VMware, Inc., Palo Alto, CA., USA
- * All Rights Reserved.
+ * Copyright 2009-2015 VMware, Inc., Palo Alto, CA., USA
  *
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the
  * copy of this software and associated documentation files (the

+ 2 - 2
drivers/gpu/drm/vmwgfx/vmwgfx_irq.c

@@ -1,7 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0 OR MIT
 /**************************************************************************
 /**************************************************************************
  *
  *
- * Copyright © 2009-2015 VMware, Inc., Palo Alto, CA., USA
- * All Rights Reserved.
+ * Copyright 2009-2015 VMware, Inc., Palo Alto, CA., USA
  *
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the
  * copy of this software and associated documentation files (the

+ 4 - 4
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c

@@ -1,7 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0 OR MIT
 /**************************************************************************
 /**************************************************************************
  *
  *
- * Copyright © 2009-2015 VMware, Inc., Palo Alto, CA., USA
- * All Rights Reserved.
+ * Copyright 2009-2015 VMware, Inc., Palo Alto, CA., USA
  *
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the
  * copy of this software and associated documentation files (the
@@ -535,9 +535,9 @@ int vmw_du_crtc_atomic_check(struct drm_crtc *crtc,
 			     struct drm_crtc_state *new_state)
 			     struct drm_crtc_state *new_state)
 {
 {
 	struct vmw_display_unit *du = vmw_crtc_to_du(new_state->crtc);
 	struct vmw_display_unit *du = vmw_crtc_to_du(new_state->crtc);
-	int connector_mask = 1 << drm_connector_index(&du->connector);
+	int connector_mask = drm_connector_mask(&du->connector);
 	bool has_primary = new_state->plane_mask &
 	bool has_primary = new_state->plane_mask &
-			   BIT(drm_plane_index(crtc->primary));
+			   drm_plane_mask(crtc->primary);
 
 
 	/* We always want to have an active plane with an active CRTC */
 	/* We always want to have an active plane with an active CRTC */
 	if (has_primary != new_state->enable)
 	if (has_primary != new_state->enable)

+ 2 - 2
drivers/gpu/drm/vmwgfx/vmwgfx_kms.h

@@ -1,7 +1,7 @@
+/* SPDX-License-Identifier: GPL-2.0 OR MIT */
 /**************************************************************************
 /**************************************************************************
  *
  *
- * Copyright © 2009-2015 VMware, Inc., Palo Alto, CA., USA
- * All Rights Reserved.
+ * Copyright 2009-2015 VMware, Inc., Palo Alto, CA., USA
  *
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the
  * copy of this software and associated documentation files (the

+ 2 - 2
drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c

@@ -1,7 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0 OR MIT
 /**************************************************************************
 /**************************************************************************
  *
  *
- * Copyright © 2009-2015 VMware, Inc., Palo Alto, CA., USA
- * All Rights Reserved.
+ * Copyright 2009-2015 VMware, Inc., Palo Alto, CA., USA
  *
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the
  * copy of this software and associated documentation files (the

+ 2 - 2
drivers/gpu/drm/vmwgfx/vmwgfx_marker.c

@@ -1,7 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0 OR MIT
 /**************************************************************************
 /**************************************************************************
  *
  *
- * Copyright (C) 2010 VMware, Inc., Palo Alto, CA., USA
- * All Rights Reserved.
+ * Copyright 2010 VMware, Inc., Palo Alto, CA., USA
  *
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the
  * copy of this software and associated documentation files (the

+ 2 - 2
drivers/gpu/drm/vmwgfx/vmwgfx_mob.c

@@ -1,7 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0 OR MIT
 /**************************************************************************
 /**************************************************************************
  *
  *
- * Copyright © 2012-2015 VMware, Inc., Palo Alto, CA., USA
- * All Rights Reserved.
+ * Copyright 2012-2015 VMware, Inc., Palo Alto, CA., USA
  *
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the
  * copy of this software and associated documentation files (the

+ 2 - 2
drivers/gpu/drm/vmwgfx/vmwgfx_msg.c

@@ -1,6 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0 OR MIT
 /*
 /*
- * Copyright © 2016 VMware, Inc., Palo Alto, CA., USA
- * All Rights Reserved.
+ * Copyright 2016 VMware, Inc., Palo Alto, CA., USA
  *
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the
  * copy of this software and associated documentation files (the

+ 24 - 11
drivers/gpu/drm/vmwgfx/vmwgfx_msg.h

@@ -1,16 +1,29 @@
-/*
- * Copyright (C) 2016, VMware, Inc.
+/* SPDX-License-Identifier: GPL-2.0+ OR MIT */
+/**************************************************************************
+ *
+ * Copyright 2016 VMware, Inc., Palo Alto, CA., USA
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
  *
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
  *
  *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
- * NON INFRINGEMENT.  See the GNU General Public License for more
- * details.
+ **************************************************************************
  *
  *
  * Based on code from vmware.c and vmmouse.c.
  * Based on code from vmware.c and vmmouse.c.
  * Author:
  * Author:

+ 2 - 2
drivers/gpu/drm/vmwgfx/vmwgfx_overlay.c

@@ -1,7 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0 OR MIT
 /**************************************************************************
 /**************************************************************************
  *
  *
- * Copyright © 2009-2014 VMware, Inc., Palo Alto, CA., USA
- * All Rights Reserved.
+ * Copyright 2009-2014 VMware, Inc., Palo Alto, CA., USA
  *
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the
  * copy of this software and associated documentation files (the

+ 2 - 2
drivers/gpu/drm/vmwgfx/vmwgfx_prime.c

@@ -1,7 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0 OR MIT
 /**************************************************************************
 /**************************************************************************
  *
  *
- * Copyright © 2013 VMware, Inc., Palo Alto, CA., USA
- * All Rights Reserved.
+ * Copyright 2013 VMware, Inc., Palo Alto, CA., USA
  *
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the
  * copy of this software and associated documentation files (the

+ 2 - 2
drivers/gpu/drm/vmwgfx/vmwgfx_reg.h

@@ -1,7 +1,7 @@
+/* SPDX-License-Identifier: GPL-2.0 OR MIT */
 /**************************************************************************
 /**************************************************************************
  *
  *
- * Copyright © 2009-2014 VMware, Inc., Palo Alto, CA., USA
- * All Rights Reserved.
+ * Copyright 2009-2014 VMware, Inc., Palo Alto, CA., USA
  *
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the
  * copy of this software and associated documentation files (the

+ 2 - 2
drivers/gpu/drm/vmwgfx/vmwgfx_resource.c

@@ -1,7 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0 OR MIT
 /**************************************************************************
 /**************************************************************************
  *
  *
- * Copyright © 2009-2015 VMware, Inc., Palo Alto, CA., USA
- * All Rights Reserved.
+ * Copyright 2009-2015 VMware, Inc., Palo Alto, CA., USA
  *
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the
  * copy of this software and associated documentation files (the

+ 2 - 2
drivers/gpu/drm/vmwgfx/vmwgfx_resource_priv.h

@@ -1,7 +1,7 @@
+/* SPDX-License-Identifier: GPL-2.0 OR MIT */
 /**************************************************************************
 /**************************************************************************
  *
  *
- * Copyright © 2012-2014 VMware, Inc., Palo Alto, CA., USA
- * All Rights Reserved.
+ * Copyright 2012-2014 VMware, Inc., Palo Alto, CA., USA
  *
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the
  * copy of this software and associated documentation files (the

+ 2 - 2
drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c

@@ -1,7 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0 OR MIT
 /**************************************************************************
 /**************************************************************************
  *
  *
- * Copyright © 2011-2015 VMware, Inc., Palo Alto, CA., USA
- * All Rights Reserved.
+ * Copyright 2011-2015 VMware, Inc., Palo Alto, CA., USA
  *
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the
  * copy of this software and associated documentation files (the

+ 2 - 2
drivers/gpu/drm/vmwgfx/vmwgfx_shader.c

@@ -1,7 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0 OR MIT
 /**************************************************************************
 /**************************************************************************
  *
  *
- * Copyright © 2009-2015 VMware, Inc., Palo Alto, CA., USA
- * All Rights Reserved.
+ * Copyright 2009-2015 VMware, Inc., Palo Alto, CA., USA
  *
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the
  * copy of this software and associated documentation files (the

+ 2 - 2
drivers/gpu/drm/vmwgfx/vmwgfx_simple_resource.c

@@ -1,7 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0 OR MIT
 /**************************************************************************
 /**************************************************************************
  *
  *
- * Copyright © 2016 VMware, Inc., Palo Alto, CA., USA
- * All Rights Reserved.
+ * Copyright 2016 VMware, Inc., Palo Alto, CA., USA
  *
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the
  * copy of this software and associated documentation files (the

+ 2 - 2
drivers/gpu/drm/vmwgfx/vmwgfx_so.c

@@ -1,6 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0 OR MIT
 /**************************************************************************
 /**************************************************************************
- * Copyright © 2014-2015 VMware, Inc., Palo Alto, CA., USA
- * All Rights Reserved.
+ * Copyright 2014-2015 VMware, Inc., Palo Alto, CA., USA
  *
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the
  * copy of this software and associated documentation files (the

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно