Merge airlied/drm-next into drm-misc-next
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Sun, 26 Feb 2017 20:34:42 +0000 (21:34 +0100)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Sun, 26 Feb 2017 20:34:42 +0000 (21:34 +0100)
Backmerge the main pull request to sync up with all the newly landed
drivers. Otherwise we'll have chaos even before 4.12 started in
earnest.

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
23 files changed:
1  2 
Documentation/gpu/index.rst
drivers/gpu/drm/drm_atomic.c
drivers/gpu/drm/drm_atomic_helper.c
drivers/gpu/drm/drm_fb_helper.c
drivers/gpu/drm/exynos/exynos_hdmi.c
drivers/gpu/drm/i915/i915_irq.c
drivers/gpu/drm/i915/intel_display.c
drivers/gpu/drm/imx/imx-drm-core.c
drivers/gpu/drm/msm/dsi/dsi_host.c
drivers/gpu/drm/msm/msm_drv.c
drivers/gpu/drm/nouveau/nouveau_drm.c
drivers/gpu/drm/nouveau/nouveau_fbcon.c
drivers/gpu/drm/nouveau/nv50_display.c
drivers/gpu/drm/omapdrm/omap_crtc.c
drivers/gpu/drm/omapdrm/omap_drv.c
drivers/gpu/drm/rockchip/rockchip_drm_drv.c
drivers/gpu/drm/rockchip/rockchip_drm_drv.h
drivers/gpu/drm/rockchip/rockchip_drm_fb.c
drivers/gpu/drm/rockchip/rockchip_drm_vop.c
drivers/gpu/drm/sti/sti_drv.c
drivers/gpu/drm/vc4/vc4_crtc.c
include/drm/drm_atomic.h
include/drm/drm_mode_config.h

index c9b08b02f57c31c4e1b0f66c9371106d34238fab,f81278a7c2cc57aa74c1c7053f080247cdc7288c..70a91b372b21d15a66c25213904e4b8de072a706
@@@ -11,9 -11,9 +11,10 @@@ Linux GPU Driver Developer's Guid
     drm-kms-helpers
     drm-uapi
     i915
+    tinydrm
     vga-switcheroo
     vgaarbiter
 +   todo
  
  .. only::  subproject and html
  
index 5a0c7082c8f8fe1fed0f5427fa459640f2e5ae09,a5673107db26c403236d2562ce8d6c36bc162c54..afec53832145968feb5cfa24e38ead1675dbfcac
@@@ -1950,8 -1938,8 +1950,8 @@@ static int prepare_crtc_signaling(struc
        if (arg->flags & DRM_MODE_ATOMIC_TEST_ONLY)
                return 0;
  
 -      for_each_crtc_in_state(state, crtc, crtc_state, i) {
 +      for_each_new_crtc_in_state(state, crtc, crtc_state, i) {
-               u64 __user *fence_ptr;
+               s32 __user *fence_ptr;
  
                fence_ptr = get_out_fence_for_crtc(crtc_state->state, crtc);
  
@@@ -2030,14 -2018,17 +2030,17 @@@ static void complete_crtc_signaling(str
                return;
        }
  
 -      for_each_crtc_in_state(state, crtc, crtc_state, i) {
 +      for_each_new_crtc_in_state(state, crtc, crtc_state, i) {
+               struct drm_pending_vblank_event *event = crtc_state->event;
                /*
-                * TEST_ONLY and PAGE_FLIP_EVENT are mutually
-                * exclusive, if they weren't, this code should be
-                * called on success for TEST_ONLY too.
+                * Free the allocated event. drm_atomic_helper_setup_commit
+                * can allocate an event too, so only free it if it's ours
+                * to prevent a double free in drm_atomic_state_clear.
                 */
-               if (crtc_state->event)
-                       drm_event_cancel_free(dev, &crtc_state->event->base);
+               if (event && (event->base.fence || event->base.file_priv)) {
+                       drm_event_cancel_free(dev, &event->base);
+                       crtc_state->event = NULL;
+               }
        }
  
        if (!fence_state)
Simple merge
index c91240598471b7cf8d8e156fd15e18f6bd016cd1,f6d4d9700734e6d48792e90d47c7bfe4081116a1..0dd5da8c55e5f819c267dc415a755a1ff8f2905b
@@@ -837,27 -833,36 +837,30 @@@ void drm_fb_helper_unregister_fbi(struc
  EXPORT_SYMBOL(drm_fb_helper_unregister_fbi);
  
  /**
 - * drm_fb_helper_release_fbi - dealloc fb_info and its members
 + * drm_fb_helper_fini - finialize a &struct drm_fb_helper
   * @fb_helper: driver-allocated fbdev helper
   *
 - * A helper to free memory taken by fb_info and the members cmap and
 - * apertures
 + * This cleans up all remaining resources associated with @fb_helper. Must be
 + * called after drm_fb_helper_unlink_fbi() was called.
   */
 -void drm_fb_helper_release_fbi(struct drm_fb_helper *fb_helper)
 +void drm_fb_helper_fini(struct drm_fb_helper *fb_helper)
  {
 -      if (fb_helper) {
 -              struct fb_info *info = fb_helper->fbdev;
 +      struct fb_info *info;
  
 -              if (info) {
 -                      if (info->cmap.len)
 -                              fb_dealloc_cmap(&info->cmap);
 -                      framebuffer_release(info);
 -              }
 +      if (!drm_fbdev_emulation || !fb_helper)
 +              return;
  
 -              fb_helper->fbdev = NULL;
 +      info = fb_helper->fbdev;
 +      if (info) {
 +              if (info->cmap.len)
 +                      fb_dealloc_cmap(&info->cmap);
 +              framebuffer_release(info);
        }
 -}
 -EXPORT_SYMBOL(drm_fb_helper_release_fbi);
 -
 -void drm_fb_helper_fini(struct drm_fb_helper *fb_helper)
 -{
 -      if (!drm_fbdev_emulation)
 -              return;
 +      fb_helper->fbdev = NULL;
  
+       cancel_work_sync(&fb_helper->resume_work);
+       cancel_work_sync(&fb_helper->dirty_work);
        mutex_lock(&kernel_fb_helper_lock);
        if (!list_empty(&fb_helper->kernel_fb_list)) {
                list_del(&fb_helper->kernel_fb_list);
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
index 413b178c86b2c1476fb10526677940aa6d3c69d1,0b4440ffbeae21a3d33e67ed1c727e00cf3884b3..2517adbe70894cab2122b2313819e5c9e31f9322
@@@ -847,12 -846,9 +847,12 @@@ nv50_wndw_atomic_check_acquire(struct n
        asyw->image.w = fb->base.width;
        asyw->image.h = fb->base.height;
        asyw->image.kind = (fb->nvbo->tile_flags & 0x0000ff00) >> 8;
 +
 +      asyw->interval = pflip_flags & DRM_MODE_PAGE_FLIP_ASYNC ? 0 : 1;
 +
        if (asyw->image.kind) {
                asyw->image.layout = 0;
-               if (drm->device.info.chipset >= 0xc0)
+               if (drm->client.device.info.chipset >= 0xc0)
                        asyw->image.block = fb->nvbo->tile_mode >> 4;
                else
                        asyw->image.block = fb->nvbo->tile_mode;
Simple merge
Simple merge
index 7719b9cd5b7499ccb92f81f3f3a3838ce536ca22,b360e6251836d990e382f0f7451788054336a0d5..ccf45693879260f6e4aee57f331bab0048635990
@@@ -71,7 -74,92 +74,43 @@@ void rockchip_drm_dma_detach_device(str
        if (!is_support_iommu)
                return;
  
-       arm_iommu_detach_device(dev);
+       iommu_detach_device(domain, dev);
+ }
 -int rockchip_register_crtc_funcs(struct drm_crtc *crtc,
 -                               const struct rockchip_crtc_funcs *crtc_funcs)
 -{
 -      int pipe = drm_crtc_index(crtc);
 -      struct rockchip_drm_private *priv = crtc->dev->dev_private;
 -
 -      if (pipe >= ROCKCHIP_MAX_CRTC)
 -              return -EINVAL;
 -
 -      priv->crtc_funcs[pipe] = crtc_funcs;
 -
 -      return 0;
 -}
 -
 -void rockchip_unregister_crtc_funcs(struct drm_crtc *crtc)
 -{
 -      int pipe = drm_crtc_index(crtc);
 -      struct rockchip_drm_private *priv = crtc->dev->dev_private;
 -
 -      if (pipe >= ROCKCHIP_MAX_CRTC)
 -              return;
 -
 -      priv->crtc_funcs[pipe] = NULL;
 -}
 -
 -static int rockchip_drm_crtc_enable_vblank(struct drm_device *dev,
 -                                         unsigned int pipe)
 -{
 -      struct rockchip_drm_private *priv = dev->dev_private;
 -      struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe);
 -
 -      if (crtc && priv->crtc_funcs[pipe] &&
 -          priv->crtc_funcs[pipe]->enable_vblank)
 -              return priv->crtc_funcs[pipe]->enable_vblank(crtc);
 -
 -      return 0;
 -}
 -
 -static void rockchip_drm_crtc_disable_vblank(struct drm_device *dev,
 -                                           unsigned int pipe)
 -{
 -      struct rockchip_drm_private *priv = dev->dev_private;
 -      struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe);
 -
 -      if (crtc && priv->crtc_funcs[pipe] &&
 -          priv->crtc_funcs[pipe]->enable_vblank)
 -              priv->crtc_funcs[pipe]->disable_vblank(crtc);
 -}
 -
+ static int rockchip_drm_init_iommu(struct drm_device *drm_dev)
+ {
+       struct rockchip_drm_private *private = drm_dev->dev_private;
+       struct iommu_domain_geometry *geometry;
+       u64 start, end;
+       if (!is_support_iommu)
+               return 0;
+       private->domain = iommu_domain_alloc(&platform_bus_type);
+       if (!private->domain)
+               return -ENOMEM;
+       geometry = &private->domain->geometry;
+       start = geometry->aperture_start;
+       end = geometry->aperture_end;
+       DRM_DEBUG("IOMMU context initialized (aperture: %#llx-%#llx)\n",
+                 start, end);
+       drm_mm_init(&private->mm, start, end - start + 1);
+       mutex_init(&private->mm_lock);
+       return 0;
+ }
+ static void rockchip_iommu_cleanup(struct drm_device *drm_dev)
+ {
+       struct rockchip_drm_private *private = drm_dev->dev_private;
+       if (!is_support_iommu)
+               return;
+       drm_mm_takedown(&private->mm);
+       iommu_domain_free(private->domain);
  }
  
  static int rockchip_drm_bind(struct device *dev)
index 9f9bc959b108264d7b4610589828504226757232,adc39302bec56b07852ecf3855f3bfa09df12cc1..8aca219ec4c8f822e193e6e4a872ae9c0c848e05
  
  struct drm_device;
  struct drm_connector;
+ struct iommu_domain;
  
 -/*
 - * Rockchip drm private crtc funcs.
 - * @enable_vblank: enable crtc vblank irq.
 - * @disable_vblank: disable crtc vblank irq.
 - */
 -struct rockchip_crtc_funcs {
 -      int (*enable_vblank)(struct drm_crtc *crtc);
 -      void (*disable_vblank)(struct drm_crtc *crtc);
 -};
 -
  struct rockchip_crtc_state {
        struct drm_crtc_state base;
        int output_type;
  struct rockchip_drm_private {
        struct drm_fb_helper fbdev_helper;
        struct drm_gem_object *fbdev_bo;
 -      const struct rockchip_crtc_funcs *crtc_funcs[ROCKCHIP_MAX_CRTC];
        struct drm_atomic_state *state;
+       struct iommu_domain *domain;
+       /* protect drm_mm on multi-threads */
+       struct mutex mm_lock;
+       struct drm_mm mm;
        struct list_head psr_list;
        spinlock_t psr_list_lock;
  };
Simple merge
Simple merge
index 3fa6e8dcb9d8de68fc5039fdf043bb7d06c04666,052ab161b239275cf8bc29891fa75ed0d9e1227e..c6f355a970d26e3b55c6b0706166560b5cbcc478
@@@ -143,9 -143,9 +143,9 @@@ struct __drm_planes_state 
  
  struct __drm_crtcs_state {
        struct drm_crtc *ptr;
 -      struct drm_crtc_state *state;
 +      struct drm_crtc_state *state, *old_state, *new_state;
        struct drm_crtc_commit *commit;
-       s64 __user *out_fence_ptr;
+       s32 __user *out_fence_ptr;
        unsigned last_vblank_count;
  };
  
Simple merge