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

@@@ -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
  
@@@ -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
@@@ -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
@@@ -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
@@@ -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)
  
  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
@@@ -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