]> Git Repo - linux.git/commitdiff
Merge tag 'topic/drm-misc-2016-05-04' of git://anongit.freedesktop.org/drm-intel...
authorDave Airlie <[email protected]>
Wed, 4 May 2016 23:56:30 +0000 (09:56 +1000)
committerDave Airlie <[email protected]>
Wed, 4 May 2016 23:56:30 +0000 (09:56 +1000)
Ofc I promise just a few leftovers for drm-misc and somehow it's the
biggest pull. But really mostly trivial stuff:
- MAINTAINERS updates from Emil
- rename async to nonblock in atomic_commit to avoid the confusion between
  nonblocking ioctl and async flip (= not vblank synced), from Maarten.
  Needs to be regened with newer drivers, but probably only after -rc1 to
  catch them all.
- actually lockless gem_object_free, plus acked driver conversion patches.
  All the trickier prep stuff already is in drm-next.
- Noralf's nice work for generic defio support in our fbdev emulation.
  Keeps the udl hack, and qxl is tested by Gerd.

* tag 'topic/drm-misc-2016-05-04' of git://anongit.freedesktop.org/drm-intel: (47 commits)
  drm: Fixup locking WARN_ON mistake around gem_object_free_unlocked
  drm/etnaviv: Use lockless gem BO free callback
  drm/imx: Use lockless gem BO free callback
  drm/radeon: Use lockless gem BO free callback
  drm/amdgpu: Use lockless gem BO free callback
  drm/gem: support BO freeing without dev->struct_mutex
  MAINTAINERS: Add myself for the new VC4 (RPi GPU) graphics driver.
  MAINTAINERS: Add a bunch of legacy (UMS) DRM drivers
  MAINTAINERS: Add a few DRM drivers by Dave Airlie
  MAINTAINERS: List the correct git repo for the Renesas DRM drivers
  MAINTAINERS: Update the files list for the Renesas DRM drivers
  MAINTAINERS: Update the files list for the Armada DRM driver
  MAINTAINERS: Update the files list for the Rockchip DRM driver
  MAINTAINERS: Update the files list for the Exynos DRM driver
  MAINTAINERS: Add maintainer entry for the VMWGFX DRM driver
  MAINTAINERS: Add maintainer entry for the MSM DRM driver
  MAINTAINERS: Add maintainer entry for the Nouveau DRM driver
  MAINTAINERS: Update the files list for the Etnaviv DRM driver
  MAINTAINERS: Remove unneded wildcard for the i915 DRM driver
  drm/atomic: Add WARN_ON when state->acquire_ctx is not set.
  ...

1  2 
MAINTAINERS
drivers/gpu/drm/Kconfig
drivers/gpu/drm/drm_atomic_helper.c
drivers/gpu/drm/exynos/exynos_drm_drv.h
drivers/gpu/drm/i915/intel_display.c
include/drm/drm_crtc.h
include/drm/drm_fb_cma_helper.h

diff --combined MAINTAINERS
index f262128644e68b82dd316c0f5ede6224bcc56a1b,1bbf5ece1dd445ef6eb80e51863f4775bddd4f79..8c10b4cc4da7b2c8636f74bed61d2b01cf7beba9
@@@ -847,12 -847,6 +847,12 @@@ S:       Maintaine
  F:    drivers/net/arcnet/
  F:    include/uapi/linux/if_arcnet.h
  
 +ARC PGU DRM DRIVER
 +M:    Alexey Brodkin <[email protected]>
 +S:    Supported
 +F:    drivers/gpu/drm/arc/
 +F:    Documentation/devicetree/bindings/display/snps,arcpgu.txt
 +
  ARM HDLCD DRM DRIVER
  M:    Liviu Dudau <[email protected]>
  S:    Supported
@@@ -3768,6 -3762,21 +3768,21 @@@ F:    drivers/gpu/vga
  F:    include/drm/
  F:    include/uapi/drm/
  
+ DRM DRIVER FOR AST SERVER GRAPHICS CHIPS
+ M:    Dave Airlie <[email protected]>
+ S:    Odd Fixes
+ F:    drivers/gpu/drm/ast/
+ DRM DRIVER FOR BOCHS VIRTUAL GPU
+ M:    Gerd Hoffmann <[email protected]>
+ S:    Odd Fixes
+ F:    drivers/gpu/drm/bochs/
+ DRM DRIVER FOR QEMU'S CIRRUS DEVICE
+ M:    Dave Airlie <[email protected]>
+ S:    Odd Fixes
+ F:    drivers/gpu/drm/cirrus/
  RADEON and AMDGPU DRM DRIVERS
  M:    Alex Deucher <[email protected]>
  M:    Christian König <[email protected]>
@@@ -3800,7 -3809,7 +3815,7 @@@ T:      git git://anongit.freedesktop.org/dr
  S:    Supported
  F:    drivers/gpu/drm/i915/
  F:    include/drm/i915*
- F:    include/uapi/drm/i915*
+ F:    include/uapi/drm/i915_drm.h
  
  DRM DRIVERS FOR ATMEL HLCDC
  M:    Boris Brezillon <[email protected]>
@@@ -3809,13 -3818,6 +3824,13 @@@ S:    Supporte
  F:    drivers/gpu/drm/atmel-hlcdc/
  F:    Documentation/devicetree/bindings/drm/atmel/
  
 +DRM DRIVERS FOR ALLWINNER A10
 +M:    Maxime Ripard  <[email protected]>
 +L:    [email protected]
 +S:    Supported
 +F:    drivers/gpu/drm/sun4i/
 +F:    Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt
 +
  DRM DRIVERS FOR EXYNOS
  M:    Inki Dae <[email protected]>
  M:    Joonyoung Shim <[email protected]>
@@@ -3825,8 -3827,8 +3840,8 @@@ L:      [email protected]
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos.git
  S:    Supported
  F:    drivers/gpu/drm/exynos/
- F:    include/drm/exynos*
- F:    include/uapi/drm/exynos*
+ F:    include/uapi/drm/exynos_drm.h
+ F:    Documentation/devicetree/bindings/display/exynos/
  
  DRM DRIVERS FOR FREESCALE DCU
  M:    Stefan Agner <[email protected]>
@@@ -3835,7 -3837,6 +3850,7 @@@ L:      [email protected]
  S:    Supported
  F:    drivers/gpu/drm/fsl-dcu/
  F:    Documentation/devicetree/bindings/display/fsl,dcu.txt
 +F:    Documentation/devicetree/bindings/display/fsl,tcon.txt
  F:    Documentation/devicetree/bindings/display/panel/nec,nl4827hc19_05b.txt
  
  DRM DRIVERS FOR FREESCALE IMX
@@@ -3853,16 -3854,31 +3868,41 @@@ T:   git git://github.com/patjak/drm-gma5
  S:    Maintained
  F:    drivers/gpu/drm/gma500/
  
 +DRM DRIVERS FOR HISILICON
 +M:    Xinliang Liu <[email protected]>
 +R:    Xinwei Kong <[email protected]>
 +R:    Chen Feng <[email protected]>
 +L:    [email protected]
 +T:    git git://github.com/xin3liang/linux.git
 +S:    Maintained
 +F:    drivers/gpu/drm/hisilicon/
 +F:    Documentation/devicetree/bindings/display/hisilicon/
 +
+ DRM DRIVER FOR INTEL I810 VIDEO CARDS
+ S:    Orphan / Obsolete
+ F:    drivers/gpu/drm/i810/
+ F:    include/uapi/drm/i810_drm.h
+ DRM DRIVER FOR MSM ADRENO GPU
+ M:    Rob Clark <[email protected]>
+ L:    [email protected]
+ L:    [email protected]
+ L:    [email protected]
+ T:    git git://people.freedesktop.org/~robclark/linux
+ S:    Maintained
+ F:    drivers/gpu/drm/msm/
+ F:    include/uapi/drm/msm_drm.h
+ F:    Documentation/devicetree/bindings/display/msm/
+ DRM DRIVER FOR NVIDIA GEFORCE/QUADRO GPUS
+ M:    Ben Skeggs <[email protected]>
+ L:    [email protected]
+ L:    [email protected]
+ T:    git git://github.com/skeggsb/linux
+ S:    Supported
+ F:    drivers/gpu/drm/nouveau/
+ F:    include/uapi/drm/nouveau_drm.h
  DRM DRIVERS FOR NVIDIA TEGRA
  M:    Thierry Reding <[email protected]>
  M:    Terje Bergström <[email protected]>
@@@ -3876,22 -3892,54 +3916,54 @@@ F:   include/linux/host1x.
  F:    include/uapi/drm/tegra_drm.h
  F:    Documentation/devicetree/bindings/display/tegra/nvidia,tegra20-host1x.txt
  
+ DRM DRIVER FOR MATROX G200/G400 GRAPHICS CARDS
+ S:    Orphan / Obsolete
+ F:    drivers/gpu/drm/mga/
+ F:    include/uapi/drm/mga_drm.h
+ DRM DRIVER FOR MGA G200 SERVER GRAPHICS CHIPS
+ M:    Dave Airlie <[email protected]>
+ S:    Odd Fixes
+ F:    drivers/gpu/drm/mgag200/
+ DRM DRIVER FOR RAGE 128 VIDEO CARDS
+ S:    Orphan / Obsolete
+ F:    drivers/gpu/drm/r128/
+ F:    include/uapi/drm/r128_drm.h
  DRM DRIVERS FOR RENESAS
  M:    Laurent Pinchart <[email protected]>
  L:    [email protected]
  L:    [email protected]
- T:    git git://people.freedesktop.org/~airlied/linux
+ T:    git git://linuxtv.org/pinchartl/fbdev
  S:    Supported
  F:    drivers/gpu/drm/rcar-du/
  F:    drivers/gpu/drm/shmobile/
  F:    include/linux/platform_data/shmob_drm.h
+ F:    Documentation/devicetree/bindings/display/renesas,du.txt
+ DRM DRIVER FOR QXL VIRTUAL GPU
+ M:    Dave Airlie <[email protected]>
+ S:    Odd Fixes
+ F:    drivers/gpu/drm/qxl/
+ F:    include/uapi/drm/qxl_drm.h
  
  DRM DRIVERS FOR ROCKCHIP
  M:    Mark Yao <[email protected]>
  L:    [email protected]
  S:    Maintained
  F:    drivers/gpu/drm/rockchip/
- F:    Documentation/devicetree/bindings/display/rockchip*
+ F:    Documentation/devicetree/bindings/display/rockchip/
+ DRM DRIVER FOR SAVAGE VIDEO CARDS
+ S:    Orphan / Obsolete
+ F:    drivers/gpu/drm/savage/
+ F:    include/uapi/drm/savage_drm.h
+ DRM DRIVER FOR SIS VIDEO CARDS
+ S:    Orphan / Obsolete
+ F:    drivers/gpu/drm/sis/
+ F:    include/uapi/drm/sis_drm.h
  
  DRM DRIVERS FOR STI
  M:    Benjamin Gaignard <[email protected]>
@@@ -3902,14 -3950,43 +3974,43 @@@ S:   Maintaine
  F:    drivers/gpu/drm/sti
  F:    Documentation/devicetree/bindings/display/st,stih4xx.txt
  
+ DRM DRIVER FOR TDFX VIDEO CARDS
+ S:    Orphan / Obsolete
+ F:    drivers/gpu/drm/tdfx/
+ DRM DRIVER FOR USB DISPLAYLINK VIDEO ADAPTERS
+ M:    Dave Airlie <[email protected]>
+ S:    Odd Fixes
+ F:    drivers/gpu/drm/udl/
  DRM DRIVERS FOR VIVANTE GPU IP
  M:    Lucas Stach <[email protected]>
  R:    Russell King <[email protected]>
  R:    Christian Gmeiner <[email protected]>
  L:    [email protected]
  S:    Maintained
- F:    drivers/gpu/drm/etnaviv
- F:    Documentation/devicetree/bindings/display/etnaviv
+ F:    drivers/gpu/drm/etnaviv/
+ F:    include/uapi/drm/etnaviv_drm.h
+ F:    Documentation/devicetree/bindings/display/etnaviv/
+ DRM DRIVER FOR VMWARE VIRTUAL GPU
+ M:    "VMware Graphics" <[email protected]>
+ M:    Sinclair Yeh <[email protected]>
+ M:    Thomas Hellstrom <[email protected]>
+ L:    [email protected]
+ T:    git git://people.freedesktop.org/~syeh/repos_linux
+ T:    git git://people.freedesktop.org/~thomash/linux
+ S:    Supported
+ F:    drivers/gpu/drm/vmwgfx/
+ F:    include/uapi/drm/vmwgfx_drm.h
+ DRM DRIVERS FOR VC4
+ M:    Eric Anholt <[email protected]>
+ T:    git git://github.com/anholt/linux
+ S:    Supported
+ F:    drivers/gpu/drm/vc4/
+ F:    include/uapi/drm/vc4_drm.h
+ F:    Documentation/devicetree/bindings/display/brcm,bcm-vc4.txt
  
  DSBR100 USB FM RADIO DRIVER
  M:    Alexey Klimov <[email protected]>
@@@ -6931,6 -7008,8 +7032,8 @@@ MARVELL ARMADA DRM SUPPOR
  M:    Russell King <[email protected]>
  S:    Maintained
  F:    drivers/gpu/drm/armada/
+ F:    include/uapi/drm/armada_drm.h
+ F:    Documentation/devicetree/bindings/display/armada/
  
  MARVELL 88E6352 DSA support
  M:    Guenter Roeck <[email protected]>
diff --combined drivers/gpu/drm/Kconfig
index 87f9ab68e8d1a2b0764fbb94644dfac3d18249b8,414c79bf63a7b6f2c93890dab5a4a615aab1a978..16e4c2135aad89f7dd26de07cc6184c2b63e2b1b
@@@ -52,6 -52,7 +52,7 @@@ config DRM_KMS_FB_HELPE
        select FB_CFB_FILLRECT
        select FB_CFB_COPYAREA
        select FB_CFB_IMAGEBLIT
+       select FB_DEFERRED_IO
        help
          FBDEV helpers for KMS drivers.
  
@@@ -252,8 -253,6 +253,8 @@@ source "drivers/gpu/drm/rcar-du/Kconfig
  
  source "drivers/gpu/drm/shmobile/Kconfig"
  
 +source "drivers/gpu/drm/sun4i/Kconfig"
 +
  source "drivers/gpu/drm/omapdrm/Kconfig"
  
  source "drivers/gpu/drm/tilcdc/Kconfig"
@@@ -283,7 -282,3 +284,7 @@@ source "drivers/gpu/drm/imx/Kconfig
  source "drivers/gpu/drm/vc4/Kconfig"
  
  source "drivers/gpu/drm/etnaviv/Kconfig"
 +
 +source "drivers/gpu/drm/arc/Kconfig"
 +
 +source "drivers/gpu/drm/hisilicon/Kconfig"
index d25abce0450febc419c9b096911901c21a7836ba,b04662e0e608ef06430c229b9f0e907e8c03aba8..92e11a2b83c84a39959b6e778391e576b2974015
@@@ -1114,13 -1114,13 +1114,13 @@@ EXPORT_SYMBOL(drm_atomic_helper_wait_fo
   * drm_atomic_helper_commit - commit validated state object
   * @dev: DRM device
   * @state: the driver state object
-  * @async: asynchronous commit
+  * @nonblocking: whether nonblocking behavior is requested.
   *
   * This function commits a with drm_atomic_helper_check() pre-validated state
   * object. This can still fail when e.g. the framebuffer reservation fails. For
-  * now this doesn't implement asynchronous commits.
+  * now this doesn't implement nonblocking commits.
   *
-  * Note that right now this function does not support async commits, and hence
+  * Note that right now this function does not support nonblocking commits, hence
   * driver writers must implement their own version for now. Also note that the
   * default ordering of how the various stages are called is to match the legacy
   * modeset helper library closest. One peculiarity of that is that it doesn't
   */
  int drm_atomic_helper_commit(struct drm_device *dev,
                             struct drm_atomic_state *state,
-                            bool async)
+                            bool nonblock)
  {
        int ret;
  
-       if (async)
+       if (nonblock)
                return -EBUSY;
  
        ret = drm_atomic_helper_prepare_planes(dev, state);
  EXPORT_SYMBOL(drm_atomic_helper_commit);
  
  /**
-  * DOC: implementing async commit
+  * DOC: implementing nonblocking commit
   *
-  * For now the atomic helpers don't support async commit directly. If there is
-  * real need it could be added though, using the dma-buf fence infrastructure
-  * for generic synchronization with outstanding rendering.
+  * For now the atomic helpers don't support nonblocking commit directly. If
+  * there is real need it could be added though, using the dma-buf fence
+  * infrastructure for generic synchronization with outstanding rendering.
   *
-  * For now drivers have to implement async commit themselves, with the following
-  * sequence being the recommended one:
+  * For now drivers have to implement nonblocking commit themselves, with the
+  * following sequence being the recommended one:
   *
   * 1. Run drm_atomic_helper_prepare_planes() first. This is the only function
   * which commit needs to call which can fail, so we want to run it first and
   * synchronously.
   *
-  * 2. Synchronize with any outstanding asynchronous commit worker threads which
+  * 2. Synchronize with any outstanding nonblocking commit worker threads which
   * might be affected the new state update. This can be done by either cancelling
   * or flushing the work items, depending upon whether the driver can deal with
   * cancelled updates. Note that it is important to ensure that the framebuffer
   * 3. The software state is updated synchronously with
   * drm_atomic_helper_swap_state(). Doing this under the protection of all modeset
   * locks means concurrent callers never see inconsistent state. And doing this
-  * while it's guaranteed that no relevant async worker runs means that async
-  * workers do not need grab any locks. Actually they must not grab locks, for
-  * otherwise the work flushing will deadlock.
+  * while it's guaranteed that no relevant nonblocking worker runs means that
+  * nonblocking workers do not need grab any locks. Actually they must not grab
+  * locks, for otherwise the work flushing will deadlock.
   *
   * 4. Schedule a work item to do all subsequent steps, using the split-out
   * commit helpers: a) pre-plane commit b) plane commit c) post-plane commit and
@@@ -2371,11 -2371,11 +2371,11 @@@ retry
                goto fail;
        }
  
-       ret = drm_atomic_async_commit(state);
+       ret = drm_atomic_nonblocking_commit(state);
        if (ret != 0)
                goto fail;
  
-       /* Driver takes ownership of state on successful async commit. */
+       /* Driver takes ownership of state on successful commit. */
        return 0;
  fail:
        if (ret == -EDEADLK)
@@@ -2510,9 -2510,12 +2510,9 @@@ EXPORT_SYMBOL(drm_atomic_helper_connect
   */
  void drm_atomic_helper_crtc_reset(struct drm_crtc *crtc)
  {
 -      if (crtc->state) {
 -              drm_property_unreference_blob(crtc->state->mode_blob);
 -              drm_property_unreference_blob(crtc->state->degamma_lut);
 -              drm_property_unreference_blob(crtc->state->ctm);
 -              drm_property_unreference_blob(crtc->state->gamma_lut);
 -      }
 +      if (crtc->state)
 +              __drm_atomic_helper_crtc_destroy_state(crtc, crtc->state);
 +
        kfree(crtc->state);
        crtc->state = kzalloc(sizeof(*crtc->state), GFP_KERNEL);
  
@@@ -2618,8 -2621,8 +2618,8 @@@ EXPORT_SYMBOL(drm_atomic_helper_crtc_de
   */
  void drm_atomic_helper_plane_reset(struct drm_plane *plane)
  {
 -      if (plane->state && plane->state->fb)
 -              drm_framebuffer_unreference(plane->state->fb);
 +      if (plane->state)
 +              __drm_atomic_helper_plane_destroy_state(plane, plane->state);
  
        kfree(plane->state);
        plane->state = kzalloc(sizeof(*plane->state), GFP_KERNEL);
@@@ -2740,10 -2743,6 +2740,10 @@@ void drm_atomic_helper_connector_reset(
        struct drm_connector_state *conn_state =
                kzalloc(sizeof(*conn_state), GFP_KERNEL);
  
 +      if (connector->state)
 +              __drm_atomic_helper_connector_destroy_state(connector,
 +                                                          connector->state);
 +
        kfree(connector->state);
        __drm_atomic_helper_connector_reset(connector, conn_state);
  }
index 2ca719cc3e2ae76f74856249ab591b5095b9c4fc,e50c09b4dce1898f36401d7bd7eaa936bbc90112..cc33ec9296e7e15b80cf110cc3f6f860a2e226de
@@@ -120,6 -120,8 +120,6 @@@ struct exynos_drm_plane_config 
   * @commit: set current hw specific display mode to hw.
   * @enable_vblank: specific driver callback for enabling vblank interrupt.
   * @disable_vblank: specific driver callback for disabling vblank interrupt.
 - * @wait_for_vblank: wait for vblank interrupt to make sure that
 - *    hardware overlay is updated.
   * @atomic_check: validate state
   * @atomic_begin: prepare device to receive an update
   * @atomic_flush: mark the end of device update
   * @disable_plane: disable hardware specific overlay.
   * @te_handler: trigger to transfer video image at the tearing effect
   *    synchronization signal if there is a page flip request.
 - * @clock_enable: optional function enabling/disabling display domain clock,
 - *    called from exynos-dp driver before powering up (with
 - *    'enable' argument as true) and after powering down (with
 - *    'enable' as false).
   */
  struct exynos_drm_crtc;
  struct exynos_drm_crtc_ops {
        void (*commit)(struct exynos_drm_crtc *crtc);
        int (*enable_vblank)(struct exynos_drm_crtc *crtc);
        void (*disable_vblank)(struct exynos_drm_crtc *crtc);
 -      void (*wait_for_vblank)(struct exynos_drm_crtc *crtc);
        int (*atomic_check)(struct exynos_drm_crtc *crtc,
                            struct drm_crtc_state *state);
        void (*atomic_begin)(struct exynos_drm_crtc *crtc);
                              struct exynos_drm_plane *plane);
        void (*atomic_flush)(struct exynos_drm_crtc *crtc);
        void (*te_handler)(struct exynos_drm_crtc *crtc);
 -      void (*clock_enable)(struct exynos_drm_crtc *crtc, bool enable);
 +};
 +
 +struct exynos_drm_clk {
 +      void (*enable)(struct exynos_drm_clk *clk, bool enable);
  };
  
  /*
@@@ -178,16 -182,8 +178,16 @@@ struct exynos_drm_crtc 
        atomic_t                        pending_update;
        const struct exynos_drm_crtc_ops        *ops;
        void                            *ctx;
 +      struct exynos_drm_clk           *pipe_clk;
  };
  
 +static inline void exynos_drm_pipe_clk_enable(struct exynos_drm_crtc *crtc,
 +                                            bool enable)
 +{
 +      if (crtc->pipe_clk)
 +              crtc->pipe_clk->enable(crtc->pipe_clk, enable);
 +}
 +
  struct exynos_drm_g2d_private {
        struct device           *dev;
        struct list_head        inuse_cmdlist;
@@@ -236,14 -232,6 +236,14 @@@ struct exynos_drm_private 
        wait_queue_head_t       wait;
  };
  
 +static inline struct exynos_drm_crtc *
 +exynos_drm_crtc_from_pipe(struct drm_device *dev, int pipe)
 +{
 +      struct exynos_drm_private *private = dev->dev_private;
 +
 +      return to_exynos_crtc(private->crtc[pipe]);
 +}
 +
  static inline struct device *to_dma_dev(struct drm_device *dev)
  {
        struct exynos_drm_private *priv = dev->dev_private;
@@@ -308,7 -296,7 +308,7 @@@ static inline int exynos_dpi_bind(struc
  #endif
  
  int exynos_atomic_commit(struct drm_device *dev, struct drm_atomic_state *state,
-                        bool async);
+                        bool nonblock);
  
  
  extern struct platform_driver fimd_driver;
index ff60241b1f768ec1bd9bf5e2d0eed09220ca8422,5d29b838d8d7aacef88cadda967af55aa387a9e6..73299f9e77a81ec01811aa7f38b98c91a853cf6d
@@@ -1530,47 -1530,45 +1530,47 @@@ static void assert_pch_ports_disabled(s
        assert_pch_hdmi_disabled(dev_priv, pipe, PCH_HDMID);
  }
  
 +static void _vlv_enable_pll(struct intel_crtc *crtc,
 +                          const struct intel_crtc_state *pipe_config)
 +{
 +      struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
 +      enum pipe pipe = crtc->pipe;
 +
 +      I915_WRITE(DPLL(pipe), pipe_config->dpll_hw_state.dpll);
 +      POSTING_READ(DPLL(pipe));
 +      udelay(150);
 +
 +      if (wait_for(((I915_READ(DPLL(pipe)) & DPLL_LOCK_VLV) == DPLL_LOCK_VLV), 1))
 +              DRM_ERROR("DPLL %d failed to lock\n", pipe);
 +}
 +
  static void vlv_enable_pll(struct intel_crtc *crtc,
                           const struct intel_crtc_state *pipe_config)
  {
 -      struct drm_device *dev = crtc->base.dev;
 -      struct drm_i915_private *dev_priv = dev->dev_private;
 +      struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
        enum pipe pipe = crtc->pipe;
 -      i915_reg_t reg = DPLL(pipe);
 -      u32 dpll = pipe_config->dpll_hw_state.dpll;
  
        assert_pipe_disabled(dev_priv, pipe);
  
        /* PLL is protected by panel, make sure we can write it */
        assert_panel_unlocked(dev_priv, pipe);
  
 -      I915_WRITE(reg, dpll);
 -      POSTING_READ(reg);
 -      udelay(150);
 -
 -      if (wait_for(((I915_READ(reg) & DPLL_LOCK_VLV) == DPLL_LOCK_VLV), 1))
 -              DRM_ERROR("DPLL %d failed to lock\n", pipe);
 +      if (pipe_config->dpll_hw_state.dpll & DPLL_VCO_ENABLE)
 +              _vlv_enable_pll(crtc, pipe_config);
  
        I915_WRITE(DPLL_MD(pipe), pipe_config->dpll_hw_state.dpll_md);
        POSTING_READ(DPLL_MD(pipe));
  }
  
 -static void chv_enable_pll(struct intel_crtc *crtc,
 -                         const struct intel_crtc_state *pipe_config)
 +
 +static void _chv_enable_pll(struct intel_crtc *crtc,
 +                          const struct intel_crtc_state *pipe_config)
  {
 -      struct drm_device *dev = crtc->base.dev;
 -      struct drm_i915_private *dev_priv = dev->dev_private;
 +      struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
        enum pipe pipe = crtc->pipe;
        enum dpio_channel port = vlv_pipe_to_channel(pipe);
        u32 tmp;
  
 -      assert_pipe_disabled(dev_priv, pipe);
 -
 -      /* PLL is protected by panel, make sure we can write it */
 -      assert_panel_unlocked(dev_priv, pipe);
 -
        mutex_lock(&dev_priv->sb_lock);
  
        /* Enable back the 10bit clock to display controller */
        /* Check PLL is locked */
        if (wait_for(((I915_READ(DPLL(pipe)) & DPLL_LOCK_VLV) == DPLL_LOCK_VLV), 1))
                DRM_ERROR("PLL %d failed to lock\n", pipe);
 +}
 +
 +static void chv_enable_pll(struct intel_crtc *crtc,
 +                         const struct intel_crtc_state *pipe_config)
 +{
 +      struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
 +      enum pipe pipe = crtc->pipe;
 +
 +      assert_pipe_disabled(dev_priv, pipe);
 +
 +      /* PLL is protected by panel, make sure we can write it */
 +      assert_panel_unlocked(dev_priv, pipe);
 +
 +      if (pipe_config->dpll_hw_state.dpll & DPLL_VCO_ENABLE)
 +              _chv_enable_pll(crtc, pipe_config);
  
        if (pipe != PIPE_A) {
                /*
@@@ -3215,12 -3198,12 +3215,12 @@@ void intel_finish_reset(struct drm_devi
  static bool intel_crtc_has_pending_flip(struct drm_crtc *crtc)
  {
        struct drm_device *dev = crtc->dev;
 -      struct drm_i915_private *dev_priv = dev->dev_private;
        struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
 +      unsigned reset_counter;
        bool pending;
  
 -      if (i915_reset_in_progress(&dev_priv->gpu_error) ||
 -          intel_crtc->reset_counter != atomic_read(&dev_priv->gpu_error.reset_counter))
 +      reset_counter = i915_reset_counter(&to_i915(dev)->gpu_error);
 +      if (intel_crtc->reset_counter != reset_counter)
                return false;
  
        spin_lock_irq(&dev->event_lock);
@@@ -3822,7 -3805,9 +3822,7 @@@ static void page_flip_completed(struct 
        intel_crtc->unpin_work = NULL;
  
        if (work->event)
 -              drm_send_vblank_event(intel_crtc->base.dev,
 -                                    intel_crtc->pipe,
 -                                    work->event);
 +              drm_crtc_send_vblank_event(&intel_crtc->base, work->event);
  
        drm_crtc_vblank_put(&intel_crtc->base);
  
@@@ -4103,6 -4088,12 +4103,6 @@@ static void ironlake_pch_enable(struct 
        I915_WRITE(FDI_RX_TUSIZE1(pipe),
                   I915_READ(PIPE_DATA_M1(pipe)) & TU_SIZE_MASK);
  
 -      /*
 -       * Sometimes spurious CPU pipe underruns happen during FDI
 -       * training, at least with VGA+HDMI cloning. Suppress them.
 -       */
 -      intel_set_cpu_fifo_underrun_reporting(dev_priv, pipe, false);
 -
        /* For PCH output, training FDI link */
        dev_priv->display.fdi_link_train(crtc);
  
  
        intel_fdi_normal_train(crtc);
  
 -      intel_set_cpu_fifo_underrun_reporting(dev_priv, pipe, true);
 -
        /* For PCH DP, enable TRANS_DP_CTL */
        if (HAS_PCH_CPT(dev) && intel_crtc->config->has_dp_encoder) {
                const struct drm_display_mode *adjusted_mode =
@@@ -4739,18 -4732,6 +4739,18 @@@ static void ironlake_crtc_enable(struc
        if (WARN_ON(intel_crtc->active))
                return;
  
 +      /*
 +       * Sometimes spurious CPU pipe underruns happen during FDI
 +       * training, at least with VGA+HDMI cloning. Suppress them.
 +       *
 +       * On ILK we get an occasional spurious CPU pipe underruns
 +       * between eDP port A enable and vdd enable. Also PCH port
 +       * enable seems to result in the occasional CPU pipe underrun.
 +       *
 +       * Spurious PCH underruns also occur during PCH enabling.
 +       */
 +      if (intel_crtc->config->has_pch_encoder || IS_GEN5(dev_priv))
 +              intel_set_cpu_fifo_underrun_reporting(dev_priv, pipe, false);
        if (intel_crtc->config->has_pch_encoder)
                intel_set_pch_fifo_underrun_reporting(dev_priv, pipe, false);
  
  
        intel_crtc->active = true;
  
 -      intel_set_cpu_fifo_underrun_reporting(dev_priv, pipe, true);
 -
        for_each_encoder_on_crtc(dev, crtc, encoder)
                if (encoder->pre_enable)
                        encoder->pre_enable(encoder);
        /* Must wait for vblank to avoid spurious PCH FIFO underruns */
        if (intel_crtc->config->has_pch_encoder)
                intel_wait_for_vblank(dev, pipe);
 +      intel_set_cpu_fifo_underrun_reporting(dev_priv, pipe, true);
        intel_set_pch_fifo_underrun_reporting(dev_priv, pipe, true);
  }
  
@@@ -4966,15 -4948,8 +4966,15 @@@ static void ironlake_crtc_disable(struc
        struct intel_encoder *encoder;
        int pipe = intel_crtc->pipe;
  
 -      if (intel_crtc->config->has_pch_encoder)
 +      /*
 +       * Sometimes spurious CPU pipe underruns happen when the
 +       * pipe is already disabled, but FDI RX/TX is still enabled.
 +       * Happens at least with VGA+HDMI cloning. Suppress them.
 +       */
 +      if (intel_crtc->config->has_pch_encoder) {
 +              intel_set_cpu_fifo_underrun_reporting(dev_priv, pipe, false);
                intel_set_pch_fifo_underrun_reporting(dev_priv, pipe, false);
 +      }
  
        for_each_encoder_on_crtc(dev, crtc, encoder)
                encoder->disable(encoder);
        drm_crtc_vblank_off(crtc);
        assert_vblank_disabled(crtc);
  
 -      /*
 -       * Sometimes spurious CPU pipe underruns happen when the
 -       * pipe is already disabled, but FDI RX/TX is still enabled.
 -       * Happens at least with VGA+HDMI cloning. Suppress them.
 -       */
 -      if (intel_crtc->config->has_pch_encoder)
 -              intel_set_cpu_fifo_underrun_reporting(dev_priv, pipe, false);
 -
        intel_disable_pipe(intel_crtc);
  
        ironlake_pfit_disable(intel_crtc, false);
  
 -      if (intel_crtc->config->has_pch_encoder) {
 +      if (intel_crtc->config->has_pch_encoder)
                ironlake_fdi_disable(crtc);
 -              intel_set_cpu_fifo_underrun_reporting(dev_priv, pipe, true);
 -      }
  
        for_each_encoder_on_crtc(dev, crtc, encoder)
                if (encoder->post_disable)
                ironlake_fdi_pll_disable(intel_crtc);
        }
  
 +      intel_set_cpu_fifo_underrun_reporting(dev_priv, pipe, true);
        intel_set_pch_fifo_underrun_reporting(dev_priv, pipe, true);
  }
  
@@@ -5345,8 -5329,9 +5345,8 @@@ static void intel_update_cdclk(struct d
                intel_update_max_cdclk(dev);
  }
  
 -static void broxton_set_cdclk(struct drm_device *dev, int frequency)
 +static void broxton_set_cdclk(struct drm_i915_private *dev_priv, int frequency)
  {
 -      struct drm_i915_private *dev_priv = dev->dev_private;
        uint32_t divider;
        uint32_t ratio;
        uint32_t current_freq;
                return;
        }
  
 -      intel_update_cdclk(dev);
 +      intel_update_cdclk(dev_priv->dev);
  }
  
 -void broxton_init_cdclk(struct drm_device *dev)
 +static bool broxton_cdclk_is_enabled(struct drm_i915_private *dev_priv)
  {
 -      struct drm_i915_private *dev_priv = dev->dev_private;
 -      uint32_t val;
 +      if (!(I915_READ(BXT_DE_PLL_ENABLE) & BXT_DE_PLL_PLL_ENABLE))
 +              return false;
  
 -      /*
 -       * NDE_RSTWRN_OPT RST PCH Handshake En must always be 0b on BXT
 -       * or else the reset will hang because there is no PCH to respond.
 -       * Move the handshake programming to initialization sequence.
 -       * Previously was left up to BIOS.
 -       */
 -      val = I915_READ(HSW_NDE_RSTWRN_OPT);
 -      val &= ~RESET_PCH_HANDSHAKE_ENABLE;
 -      I915_WRITE(HSW_NDE_RSTWRN_OPT, val);
 +      /* TODO: Check for a valid CDCLK rate */
 +
 +      if (!(I915_READ(DBUF_CTL) & DBUF_POWER_REQUEST)) {
 +              DRM_DEBUG_DRIVER("CDCLK enabled, but DBUF power not requested\n");
 +
 +              return false;
 +      }
 +
 +      if (!(I915_READ(DBUF_CTL) & DBUF_POWER_STATE)) {
 +              DRM_DEBUG_DRIVER("CDCLK enabled, but DBUF power hasn't settled\n");
 +
 +              return false;
 +      }
 +
 +      return true;
 +}
  
 -      /* Enable PG1 for cdclk */
 -      intel_display_power_get(dev_priv, POWER_DOMAIN_PLLS);
 +bool broxton_cdclk_verify_state(struct drm_i915_private *dev_priv)
 +{
 +      return broxton_cdclk_is_enabled(dev_priv);
 +}
  
 +void broxton_init_cdclk(struct drm_i915_private *dev_priv)
 +{
        /* check if cd clock is enabled */
 -      if (I915_READ(BXT_DE_PLL_ENABLE) & BXT_DE_PLL_PLL_ENABLE) {
 -              DRM_DEBUG_KMS("Display already initialized\n");
 +      if (broxton_cdclk_is_enabled(dev_priv)) {
 +              DRM_DEBUG_KMS("CDCLK already enabled, won't reprogram it\n");
                return;
        }
  
 +      DRM_DEBUG_KMS("CDCLK not enabled, enabling it\n");
 +
        /*
         * FIXME:
         * - The initial CDCLK needs to be read from VBT.
         * - check if setting the max (or any) cdclk freq is really necessary
         *   here, it belongs to modeset time
         */
 -      broxton_set_cdclk(dev, 624000);
 +      broxton_set_cdclk(dev_priv, 624000);
  
        I915_WRITE(DBUF_CTL, I915_READ(DBUF_CTL) | DBUF_POWER_REQUEST);
        POSTING_READ(DBUF_CTL);
                DRM_ERROR("DBuf power enable timeout!\n");
  }
  
 -void broxton_uninit_cdclk(struct drm_device *dev)
 +void broxton_uninit_cdclk(struct drm_i915_private *dev_priv)
  {
 -      struct drm_i915_private *dev_priv = dev->dev_private;
 -
        I915_WRITE(DBUF_CTL, I915_READ(DBUF_CTL) & ~DBUF_POWER_REQUEST);
        POSTING_READ(DBUF_CTL);
  
                DRM_ERROR("DBuf power disable timeout!\n");
  
        /* Set minimum (bypass) frequency, in effect turning off the DE PLL */
 -      broxton_set_cdclk(dev, 19200);
 -
 -      intel_display_power_put(dev_priv, POWER_DOMAIN_PLLS);
 +      broxton_set_cdclk(dev_priv, 19200);
  }
  
  static const struct skl_cdclk_entry {
@@@ -6096,12 -6072,14 +6096,12 @@@ static void valleyview_crtc_enable(stru
                if (encoder->pre_pll_enable)
                        encoder->pre_pll_enable(encoder);
  
 -      if (!intel_crtc->config->has_dsi_encoder) {
 -              if (IS_CHERRYVIEW(dev)) {
 -                      chv_prepare_pll(intel_crtc, intel_crtc->config);
 -                      chv_enable_pll(intel_crtc, intel_crtc->config);
 -              } else {
 -                      vlv_prepare_pll(intel_crtc, intel_crtc->config);
 -                      vlv_enable_pll(intel_crtc, intel_crtc->config);
 -              }
 +      if (IS_CHERRYVIEW(dev)) {
 +              chv_prepare_pll(intel_crtc, intel_crtc->config);
 +              chv_enable_pll(intel_crtc, intel_crtc->config);
 +      } else {
 +              vlv_prepare_pll(intel_crtc, intel_crtc->config);
 +              vlv_enable_pll(intel_crtc, intel_crtc->config);
        }
  
        for_each_encoder_on_crtc(dev, crtc, encoder)
@@@ -6139,7 -6117,7 +6139,7 @@@ static void i9xx_crtc_enable(struct drm
        struct intel_encoder *encoder;
        struct intel_crtc_state *pipe_config =
                to_intel_crtc_state(crtc->state);
 -      int pipe = intel_crtc->pipe;
 +      enum pipe pipe = intel_crtc->pipe;
  
        if (WARN_ON(intel_crtc->active))
                return;
@@@ -7195,15 -7173,11 +7195,15 @@@ static void vlv_compute_dpll(struct int
                             struct intel_crtc_state *pipe_config)
  {
        pipe_config->dpll_hw_state.dpll = DPLL_INTEGRATED_REF_CLK_VLV |
 -              DPLL_REF_CLK_ENABLE_VLV | DPLL_VGA_MODE_DIS |
 -              DPLL_VCO_ENABLE | DPLL_EXT_BUFFER_ENABLE_VLV;
 +              DPLL_REF_CLK_ENABLE_VLV | DPLL_VGA_MODE_DIS;
        if (crtc->pipe != PIPE_A)
                pipe_config->dpll_hw_state.dpll |= DPLL_INTEGRATED_CRI_CLK_VLV;
  
 +      /* DPLL not used with DSI, but still need the rest set up */
 +      if (!pipe_config->has_dsi_encoder)
 +              pipe_config->dpll_hw_state.dpll |= DPLL_VCO_ENABLE |
 +                      DPLL_EXT_BUFFER_ENABLE_VLV;
 +
        pipe_config->dpll_hw_state.dpll_md =
                (pipe_config->pixel_multiplier - 1) << DPLL_MD_UDI_MULTIPLIER_SHIFT;
  }
@@@ -7212,14 -7186,11 +7212,14 @@@ static void chv_compute_dpll(struct int
                             struct intel_crtc_state *pipe_config)
  {
        pipe_config->dpll_hw_state.dpll = DPLL_SSC_REF_CLK_CHV |
 -              DPLL_REF_CLK_ENABLE_VLV | DPLL_VGA_MODE_DIS |
 -              DPLL_VCO_ENABLE;
 +              DPLL_REF_CLK_ENABLE_VLV | DPLL_VGA_MODE_DIS;
        if (crtc->pipe != PIPE_A)
                pipe_config->dpll_hw_state.dpll |= DPLL_INTEGRATED_CRI_CLK_VLV;
  
 +      /* DPLL not used with DSI, but still need the rest set up */
 +      if (!pipe_config->has_dsi_encoder)
 +              pipe_config->dpll_hw_state.dpll |= DPLL_VCO_ENABLE;
 +
        pipe_config->dpll_hw_state.dpll_md =
                (pipe_config->pixel_multiplier - 1) << DPLL_MD_UDI_MULTIPLIER_SHIFT;
  }
@@@ -7229,20 -7200,11 +7229,20 @@@ static void vlv_prepare_pll(struct inte
  {
        struct drm_device *dev = crtc->base.dev;
        struct drm_i915_private *dev_priv = dev->dev_private;
 -      int pipe = crtc->pipe;
 +      enum pipe pipe = crtc->pipe;
        u32 mdiv;
        u32 bestn, bestm1, bestm2, bestp1, bestp2;
        u32 coreclk, reg_val;
  
 +      /* Enable Refclk */
 +      I915_WRITE(DPLL(pipe),
 +                 pipe_config->dpll_hw_state.dpll &
 +                 ~(DPLL_VCO_ENABLE | DPLL_EXT_BUFFER_ENABLE_VLV));
 +
 +      /* No need to actually set up the DPLL with DSI */
 +      if ((pipe_config->dpll_hw_state.dpll & DPLL_VCO_ENABLE) == 0)
 +              return;
 +
        mutex_lock(&dev_priv->sb_lock);
  
        bestn = pipe_config->dpll.n;
@@@ -7329,21 -7291,14 +7329,21 @@@ static void chv_prepare_pll(struct inte
  {
        struct drm_device *dev = crtc->base.dev;
        struct drm_i915_private *dev_priv = dev->dev_private;
 -      int pipe = crtc->pipe;
 -      i915_reg_t dpll_reg = DPLL(crtc->pipe);
 +      enum pipe pipe = crtc->pipe;
        enum dpio_channel port = vlv_pipe_to_channel(pipe);
        u32 loopfilter, tribuf_calcntr;
        u32 bestn, bestm1, bestm2, bestp1, bestp2, bestm2_frac;
        u32 dpio_val;
        int vco;
  
 +      /* Enable Refclk and SSC */
 +      I915_WRITE(DPLL(pipe),
 +                 pipe_config->dpll_hw_state.dpll & ~DPLL_VCO_ENABLE);
 +
 +      /* No need to actually set up the DPLL with DSI */
 +      if ((pipe_config->dpll_hw_state.dpll & DPLL_VCO_ENABLE) == 0)
 +              return;
 +
        bestn = pipe_config->dpll.n;
        bestm2_frac = pipe_config->dpll.m2 & 0x3fffff;
        bestm1 = pipe_config->dpll.m1;
        dpio_val = 0;
        loopfilter = 0;
  
 -      /*
 -       * Enable Refclk and SSC
 -       */
 -      I915_WRITE(dpll_reg,
 -                 pipe_config->dpll_hw_state.dpll & ~DPLL_VCO_ENABLE);
 -
        mutex_lock(&dev_priv->sb_lock);
  
        /* p1 and p2 divider */
@@@ -7968,6 -7929,9 +7968,6 @@@ static int chv_crtc_compute_clock(struc
        memset(&crtc_state->dpll_hw_state, 0,
               sizeof(crtc_state->dpll_hw_state));
  
 -      if (crtc_state->has_dsi_encoder)
 -              return 0;
 -
        if (!crtc_state->clock_set &&
            !chv_find_best_dpll(limit, crtc_state, crtc_state->port_clock,
                                refclk, NULL, &crtc_state->dpll)) {
@@@ -7989,6 -7953,9 +7989,6 @@@ static int vlv_crtc_compute_clock(struc
        memset(&crtc_state->dpll_hw_state, 0,
               sizeof(crtc_state->dpll_hw_state));
  
 -      if (crtc_state->has_dsi_encoder)
 -              return 0;
 -
        if (!crtc_state->clock_set &&
            !vlv_find_best_dpll(limit, crtc_state, crtc_state->port_clock,
                                refclk, NULL, &crtc_state->dpll)) {
@@@ -8041,8 -8008,8 +8041,8 @@@ static void vlv_crtc_clock_get(struct i
        u32 mdiv;
        int refclk = 100000;
  
 -      /* In case of MIPI DPLL will not even be used */
 -      if (!(pipe_config->dpll_hw_state.dpll & DPLL_VCO_ENABLE))
 +      /* In case of DSI, DPLL will not be used */
 +      if ((pipe_config->dpll_hw_state.dpll & DPLL_VCO_ENABLE) == 0)
                return;
  
        mutex_lock(&dev_priv->sb_lock);
@@@ -8138,10 -8105,6 +8138,10 @@@ static void chv_crtc_clock_get(struct i
        u32 cmn_dw13, pll_dw0, pll_dw1, pll_dw2, pll_dw3;
        int refclk = 100000;
  
 +      /* In case of DSI, DPLL will not be used */
 +      if ((pipe_config->dpll_hw_state.dpll & DPLL_VCO_ENABLE) == 0)
 +              return;
 +
        mutex_lock(&dev_priv->sb_lock);
        cmn_dw13 = vlv_dpio_read(dev_priv, pipe, CHV_CMN_DW13(port));
        pll_dw0 = vlv_dpio_read(dev_priv, pipe, CHV_PLL_DW0(port));
@@@ -9570,7 -9533,7 +9570,7 @@@ static void broxton_modeset_commit_cdcl
                to_intel_atomic_state(old_state);
        unsigned int req_cdclk = old_intel_state->dev_cdclk;
  
 -      broxton_set_cdclk(dev, req_cdclk);
 +      broxton_set_cdclk(to_i915(dev), req_cdclk);
  }
  
  /* compute the max rate for new configuration */
@@@ -10940,10 -10903,9 +10940,10 @@@ static bool page_flip_finished(struct i
  {
        struct drm_device *dev = crtc->base.dev;
        struct drm_i915_private *dev_priv = dev->dev_private;
 +      unsigned reset_counter;
  
 -      if (i915_reset_in_progress(&dev_priv->gpu_error) ||
 -          crtc->reset_counter != atomic_read(&dev_priv->gpu_error.reset_counter))
 +      reset_counter = i915_reset_counter(&dev_priv->gpu_error);
 +      if (crtc->reset_counter != reset_counter)
                return true;
  
        /*
@@@ -11397,6 -11359,7 +11397,6 @@@ static void intel_mmio_flip_work_func(s
  
        if (mmio_flip->req) {
                WARN_ON(__i915_wait_request(mmio_flip->req,
 -                                          mmio_flip->crtc->reset_counter,
                                            false, NULL,
                                            &mmio_flip->i915->rps.mmioflips));
                i915_gem_request_unreference__unlocked(mmio_flip->req);
@@@ -11604,13 -11567,8 +11604,13 @@@ static int intel_crtc_page_flip(struct 
        if (ret)
                goto cleanup;
  
 +      intel_crtc->reset_counter = i915_reset_counter(&dev_priv->gpu_error);
 +      if (__i915_reset_in_progress_or_wedged(intel_crtc->reset_counter)) {
 +              ret = -EIO;
 +              goto cleanup;
 +      }
 +
        atomic_inc(&intel_crtc->unpin_work_count);
 -      intel_crtc->reset_counter = atomic_read(&dev_priv->gpu_error.reset_counter);
  
        if (INTEL_INFO(dev)->gen >= 5 || IS_G4X(dev))
                work->flip_count = I915_READ(PIPE_FLIPCOUNT_G4X(pipe)) + 1;
@@@ -11696,7 -11654,7 +11696,7 @@@ cleanup_unpin
        intel_unpin_fb_obj(fb, crtc->primary->state->rotation);
  cleanup_pending:
        if (!IS_ERR_OR_NULL(request))
 -              i915_gem_request_cancel(request);
 +              i915_add_request_no_flush(request);
        atomic_dec(&intel_crtc->unpin_work_count);
        mutex_unlock(&dev->struct_mutex);
  cleanup:
@@@ -11746,7 -11704,7 +11746,7 @@@ retry
  
                if (ret == 0 && event) {
                        spin_lock_irq(&dev->event_lock);
 -                      drm_send_vblank_event(dev, pipe, event);
 +                      drm_crtc_send_vblank_event(crtc, event);
                        spin_unlock_irq(&dev->event_lock);
                }
        }
@@@ -12728,7 -12686,7 +12728,7 @@@ intel_pipe_config_compare(struct drm_de
        PIPE_CONF_CHECK_X(gmch_pfit.control);
        /* pfit ratios are autocomputed by the hw on gen4+ */
        if (INTEL_INFO(dev)->gen < 4)
 -              PIPE_CONF_CHECK_I(gmch_pfit.pgm_ratios);
 +              PIPE_CONF_CHECK_X(gmch_pfit.pgm_ratios);
        PIPE_CONF_CHECK_X(gmch_pfit.lvds_border_bits);
  
        if (!adjust) {
        PIPE_CONF_CHECK_X(dpll_hw_state.cfgcr1);
        PIPE_CONF_CHECK_X(dpll_hw_state.cfgcr2);
  
 +      PIPE_CONF_CHECK_X(dsi_pll.ctrl);
 +      PIPE_CONF_CHECK_X(dsi_pll.div);
 +
        if (IS_G4X(dev) || INTEL_INFO(dev)->gen >= 5)
                PIPE_CONF_CHECK_I(pipe_bpp);
  
@@@ -13431,7 -13386,7 +13431,7 @@@ static int intel_atomic_check(struct dr
  
  static int intel_atomic_prepare_commit(struct drm_device *dev,
                                       struct drm_atomic_state *state,
-                                      bool async)
+                                      bool nonblock)
  {
        struct drm_i915_private *dev_priv = dev->dev_private;
        struct drm_plane_state *plane_state;
        struct drm_crtc *crtc;
        int i, ret;
  
-       if (async) {
-               DRM_DEBUG_KMS("i915 does not yet support async commit\n");
+       if (nonblock) {
+               DRM_DEBUG_KMS("i915 does not yet support nonblocking commit\n");
                return -EINVAL;
        }
  
        for_each_crtc_in_state(state, crtc, crtc_state, i) {
 +              if (state->legacy_cursor_update)
 +                      continue;
 +
                ret = intel_crtc_wait_for_pending_flips(crtc);
                if (ret)
                        return ret;
                return ret;
  
        ret = drm_atomic_helper_prepare_planes(dev, state);
 -      if (!ret && !nonblock && !i915_reset_in_progress(&dev_priv->gpu_error)) {
 -              u32 reset_counter;
 -
 -              reset_counter = atomic_read(&dev_priv->gpu_error.reset_counter);
 -              mutex_unlock(&dev->struct_mutex);
 +      mutex_unlock(&dev->struct_mutex);
  
-       if (!ret && !async) {
++      if (!ret && !nonblock) {
                for_each_plane_in_state(state, plane, plane_state, i) {
                        struct intel_plane_state *intel_plane_state =
                                to_intel_plane_state(plane_state);
                                continue;
  
                        ret = __i915_wait_request(intel_plane_state->wait_req,
 -                                                reset_counter, true,
 -                                                NULL, NULL);
 -
 -                      /* Swallow -EIO errors to allow updates during hw lockup. */
 -                      if (ret == -EIO)
 -                              ret = 0;
 -
 -                      if (ret)
 +                                                true, NULL, NULL);
 +                      if (ret) {
 +                              /* Any hang should be swallowed by the wait */
 +                              WARN_ON(ret == -EIO);
 +                              mutex_lock(&dev->struct_mutex);
 +                              drm_atomic_helper_cleanup_planes(dev, state);
 +                              mutex_unlock(&dev->struct_mutex);
                                break;
 +                      }
                }
 -
 -              if (!ret)
 -                      return 0;
 -
 -              mutex_lock(&dev->struct_mutex);
 -              drm_atomic_helper_cleanup_planes(dev, state);
        }
  
 -      mutex_unlock(&dev->struct_mutex);
        return ret;
  }
  
@@@ -13526,7 -13488,7 +13526,7 @@@ static void intel_atomic_wait_for_vblan
                                        drm_crtc_vblank_count(crtc),
                                msecs_to_jiffies(50));
  
 -              WARN_ON(!lret);
 +              WARN(!lret, "pipe %c vblank wait timed out\n", pipe_name(pipe));
  
                drm_crtc_vblank_put(crtc);
        }
@@@ -13557,21 -13519,21 +13557,21 @@@ static bool needs_vblank_wait(struct in
   * intel_atomic_commit - commit validated state object
   * @dev: DRM device
   * @state: the top-level driver state object
-  * @async: asynchronous commit
+  * @nonblock: nonblocking commit
   *
   * This function commits a top-level state object that has been validated
   * with drm_atomic_helper_check().
   *
   * FIXME:  Atomic modeset support for i915 is not yet complete.  At the moment
   * we can only handle plane-related operations and do not yet support
-  * asynchronous commit.
+  * nonblocking commit.
   *
   * RETURNS
   * Zero for success or -errno.
   */
  static int intel_atomic_commit(struct drm_device *dev,
                               struct drm_atomic_state *state,
-                              bool async)
+                              bool nonblock)
  {
        struct intel_atomic_state *intel_state = to_intel_atomic_state(state);
        struct drm_i915_private *dev_priv = dev->dev_private;
        unsigned long put_domains[I915_MAX_PIPES] = {};
        unsigned crtc_vblank_mask = 0;
  
-       ret = intel_atomic_prepare_commit(dev, state, async);
+       ret = intel_atomic_prepare_commit(dev, state, nonblock);
        if (ret) {
                DRM_DEBUG_ATOMIC("Preparing state failed with %i\n", ret);
                return ret;
@@@ -13828,11 -13790,10 +13828,11 @@@ intel_prepare_plane_fb(struct drm_plan
                 */
                if (needs_modeset(crtc_state))
                        ret = i915_gem_object_wait_rendering(old_obj, true);
 -
 -              /* Swallow -EIO errors to allow updates during hw lockup. */
 -              if (ret && ret != -EIO)
 +              if (ret) {
 +                      /* GPU hangs should have been swallowed by the wait */
 +                      WARN_ON(ret == -EIO);
                        return ret;
 +              }
        }
  
        /* For framebuffer backed by dmabuf, wait for fence */
diff --combined include/drm/drm_crtc.h
index 297e527f1cacf593ad049c5fce2a931eec9f90e0,800c48e80811f7293265761572dcf0802971a1f7..2f2bf23d96759198dcbc0580207ff7dc898a1728
@@@ -250,6 -250,7 +250,6 @@@ struct drm_framebuffer 
  struct drm_property_blob {
        struct drm_mode_object base;
        struct drm_device *dev;
 -      struct kref refcount;
        struct list_head head_global;
        struct list_head head_file;
        size_t length;
@@@ -1886,7 -1887,7 +1886,7 @@@ struct drm_mode_config_funcs 
         * drm_atomic_helper_commit(), or one of the exported sub-functions of
         * it.
         *
-        * Asynchronous commits (as indicated with the async parameter) must
+        * Nonblocking commits (as indicated with the nonblock parameter) must
         * do any preparatory work which might result in an unsuccessful commit
         * in the context of this callback. The only exceptions are hardware
         * errors resulting in -EIO. But even in that case the driver must
         * The driver must wait for any pending rendering to the new
         * framebuffers to complete before executing the flip. It should also
         * wait for any pending rendering from other drivers if the underlying
-        * buffer is a shared dma-buf. Asynchronous commits must not wait for
+        * buffer is a shared dma-buf. Nonblocking commits must not wait for
         * rendering in the context of this callback.
         *
         * An application can request to be notified when the atomic commit has
         *
         * 0 on success or one of the below negative error codes:
         *
-        *  - -EBUSY, if an asynchronous updated is requested and there is
+        *  - -EBUSY, if a nonblocking updated is requested and there is
         *    an earlier updated pending. Drivers are allowed to support a queue
         *    of outstanding updates, but currently no driver supports that.
         *    Note that drivers must wait for preceding updates to complete if a
         */
        int (*atomic_commit)(struct drm_device *dev,
                             struct drm_atomic_state *state,
-                            bool async);
+                            bool nonblock);
  
        /**
         * @atomic_state_alloc:
index ae49c24fbf503ab1472d99be4be6962462275d84,6554b6f38bb4175cd2cb15a6528217d39704f63b..c6d9c9c55794ce8fa3db6d0fe5e62a9c6c1c4766
@@@ -4,11 -4,18 +4,18 @@@
  struct drm_fbdev_cma;
  struct drm_gem_cma_object;
  
+ struct drm_fb_helper_surface_size;
+ struct drm_framebuffer_funcs;
+ struct drm_fb_helper_funcs;
  struct drm_framebuffer;
+ struct drm_fb_helper;
  struct drm_device;
  struct drm_file;
  struct drm_mode_fb_cmd2;
  
+ struct drm_fbdev_cma *drm_fbdev_cma_init_with_funcs(struct drm_device *dev,
+       unsigned int preferred_bpp, unsigned int num_crtc,
+       unsigned int max_conn_count, const struct drm_fb_helper_funcs *funcs);
  struct drm_fbdev_cma *drm_fbdev_cma_init(struct drm_device *dev,
        unsigned int preferred_bpp, unsigned int num_crtc,
        unsigned int max_conn_count);
@@@ -16,6 -23,13 +23,13 @@@ void drm_fbdev_cma_fini(struct drm_fbde
  
  void drm_fbdev_cma_restore_mode(struct drm_fbdev_cma *fbdev_cma);
  void drm_fbdev_cma_hotplug_event(struct drm_fbdev_cma *fbdev_cma);
+ int drm_fbdev_cma_create_with_funcs(struct drm_fb_helper *helper,
+       struct drm_fb_helper_surface_size *sizes,
+       struct drm_framebuffer_funcs *funcs);
+ void drm_fb_cma_destroy(struct drm_framebuffer *fb);
+ int drm_fb_cma_create_handle(struct drm_framebuffer *fb,
+       struct drm_file *file_priv, unsigned int *handle);
  
  struct drm_framebuffer *drm_fb_cma_create(struct drm_device *dev,
        struct drm_file *file_priv, const struct drm_mode_fb_cmd2 *mode_cmd);
@@@ -24,8 -38,6 +38,8 @@@ struct drm_gem_cma_object *drm_fb_cma_g
        unsigned int plane);
  
  #ifdef CONFIG_DEBUG_FS
 +struct seq_file;
 +
  int drm_fb_cma_debugfs_show(struct seq_file *m, void *arg);
  #endif
  
This page took 0.168718 seconds and 4 git commands to generate.