1. 22 Apr, 2016 13 commits
    • Lyude's avatar
      drm/dp_helper: Retry aux transactions on all errors · 82922da3
      Lyude authored
      This is part of a patch series to migrate all of the workarounds for
      commonly seen behavior from bad sinks in intel_dp_dpcd_read_wake() to
      drm's DP helper.
      
      We cannot rely on sinks NACKing or deferring when they can't receive
      transactions, nor can we rely on any other sort of consistent error to
      know when we should stop retrying. As such, we need to just retry
      unconditionally on errors. We also make sure here to return the error we
      encountered during the first transaction, since it's possible that
      retrying the transaction might return a different error then we had
      originally.
      
      This, along with the previous patch, work around a weird bug with the
      ThinkPad T560's and it's dock. When resuming the laptop, it appears that
      there's a short period of time where we're unable to complete any aux
      transactions, as they all immediately timeout. The only machine I'm able
      to reproduce this on is the T560 as other production Skylake models seem
      to be fine. The period during which AUX transactions fail appears to be
      around 22ms long. AFAIK, the dock for the T560 never actually turns off,
      the only difference is that it's in SST mode at the start of the resume
      process, so it's unclear as to why it would need so much time to come
      back up.
      
      There's been a discussion on this issue going on for a while on the
      intel-gfx mailing list about this that has, in addition to including
      developers from Intel, also had the correspondence of one of the
      hardware engineers for Intel:
      
      http://www.spinics.net/lists/intel-gfx/msg88831.html
      http://www.spinics.net/lists/intel-gfx/msg88410.html
      
      We've already looked into a couple of possible explanations for the
      problem:
      
      - Calling intel_dp_mst_resume() before right fix.
        intel_runtime_pm_enable_interrupts(). This was the first fix I tried,
        and while it worked it definitely wasn't the right fix. This worked
        because DP aux transactions don't actually require interrupts to work:
      
      	static uint32_t
      	intel_dp_aux_wait_done(struct intel_dp *intel_dp, bool has_aux_irq)
      	{
      		struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
      		struct drm_device *dev = intel_dig_port->base.base.dev;
      		struct drm_i915_private *dev_priv = dev->dev_private;
      		i915_reg_t ch_ctl = intel_dp->aux_ch_ctl_reg;
      		uint32_t status;
      		bool done;
      
      	#define C (((status = I915_READ_NOTRACE(ch_ctl)) & DP_AUX_CH_CTL_SEND_BUSY) == 0)
      		if (has_aux_irq)
      			done = wait_event_timeout(dev_priv->gmbus_wait_queue, C,
      						  msecs_to_jiffies_timeout(10));
      		else
      			done = wait_for_atomic(C, 10) == 0;
      		if (!done)
      			DRM_ERROR("dp aux hw did not signal timeout (has irq: %i)!\n",
      				  has_aux_irq);
      	#undef C
      
      		return status;
      	}
      
        When there's no interrupts enabled, we end up timing out on the
        wait_event_timeout() call, which causes us to check the DP status
        register once to see if the transaction was successful or not. Since
        this adds a 10ms delay to each aux transaction, it ends up adding a
        long enough delay to the resume process for aux transactions to become
        functional again. This gave us the illusion that enabling interrupts
        had something to do with making things work again, and put me on the
        wrong track for a while.
      
      - Interrupts occurring when we try to perform the aux transactions
        required to put the dock back into MST mode. This isn't the problem,
        as the only interrupts I've observed that come during this timeout
        period are from the snd_hda_intel driver, and disabling that driver
        doesn't appear to change the behavior at all.
      
      - Skylake's PSR block causing issues by performing aux transactions
        while we try to bring the dock out of MST mode. Disabling PSR through
        i915's command line options doesn't seem to change the behavior
        either, nor does preventing the DMC firmware from being loaded.
      
      Since this investigation went on for about 2 weeks, we decided it would
      be better for the time being to just workaround this issue by making
      sure AUX transactions wait a short period of time before retrying.
      Signed-off-by: default avatarLyude <cpaul@redhat.com>
      Tested-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: http://patchwork.freedesktop.org/patch/msgid/1460559513-32280-3-git-send-email-cpaul@redhat.com
      82922da3
    • Lyude's avatar
      drm/dp_helper: Always wait before retrying native aux transactions · e1083ff3
      Lyude authored
      This is part of a patch series to migrate all of the workarounds for
      commonly seen behavior from bad sinks in intel_dp_dpcd_read_wake() to
      drm's DP helper.
      
      Some sinks need some time during the process of resuming the system from
      sleep before they're ready to handle transactions. While it would be
      nice if they responded with NACKs in these scenarios, this isn't always
      the case as a few sinks will just timeout on all of the transactions
      they receive until they're ready.
      Signed-off-by: default avatarLyude <cpaul@redhat.com>
      Tested-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: http://patchwork.freedesktop.org/patch/msgid/1460559513-32280-2-git-send-email-cpaul@redhat.com
      e1083ff3
    • Dave Airlie's avatar
      drm/modes: stop handling framebuffer special · 027b3f8b
      Dave Airlie authored
      Since ref counting is in the object now we can just call the
      normal interfaces.
      Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      027b3f8b
    • Dave Airlie's avatar
      drm/modes: reduce fb_lock to just protecting lists · 2ddea3fd
      Dave Airlie authored
      This reduces the fb_lock to just protecting the num_fb/fb_list.
      
      "Previously fb refcounting, and especially the weak reference
      (kref_get_unless_zero) used in fb lookups have been protected by fb_lock.
      But with the refactoring to share refcounting in the drm_mode_object base
      class that switched to being protected by idr_mutex, which means fb_lock
      critical sections can be reduced."
      Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      2ddea3fd
    • Dave Airlie's avatar
      drm/modes: move reference taking into object lookup. · 72fe90b8
      Dave Airlie authored
      When we lookup an ref counted object we now take a proper reference
      using kref_get_unless_zero.
      
      Framebuffer lookup no longer needs do this itself.
      
      Convert rmfb to using framebuffer lookup and deal with the fact
      it now gets an extra reference that we have to cleanup. This should
      mean we can avoid holding fb_lock across rmfb. (if I'm wrong let me
      know).
      
      We also now only hold the fbs_lock around the list manipulation.
      
      "Previously fb refcounting, and especially the weak reference
      (kref_get_unless_zero) used in fb lookups have been protected by fb_lock.
      But with the refactoring to share refcounting in the drm_mode_object base
      class that switched to being protected by idr_mutex, which means fb_lock
      critical sections can be reduced."
      Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      72fe90b8
    • Dave Airlie's avatar
      drm/mode: reduce lock hold in addfb2 · c7e1c59a
      Dave Airlie authored
      No need to hold the lock while assigning the variable.
      
      Daniel wrote:
      "Not sure why exactly I put that under the lock, but the only thing that
      can race here is rmfb while addfb2 is still doing it's thing, with a
      correctly guess (easy to do since they're fully deterministic) fb_id."
      Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      c7e1c59a
    • Dave Airlie's avatar
      drm/mode: reduce scope of fb_lock in framebuffer init · 9cd47424
      Dave Airlie authored
      We don't need to hold the fb lock around the initialisation,
      only around the list manipulaton.
      
      So do the lock hold only around the register for now.
      
      From Daniel:
      Previously fb refcounting, and especially the weak reference
      (kref_get_unless_zero) used in fb lookups have been protected by fb_lock.
      But with the refactoring to share refcounting in the drm_mode_object base
      class that switched to being protected by idr_mutex, which means fb_lock
      critical sections can be reduced.
      Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      9cd47424
    • Dave Airlie's avatar
      drm/mode: use _object_find to find framebuffers. · cee26ac4
      Dave Airlie authored
      No point have this code dupliated at this point, use the
      _object_find code instead now.
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      cee26ac4
    • Dave Airlie's avatar
      drm/mode: move framebuffer reference into object. · d0f37cf6
      Dave Airlie authored
      This is the initial code to add references to some mode objects.
      In the future we need to start reference counting connectors so
      firstly I want to reorganise the code so the framebuffer ref counting
      uses the same paths.
      
      This patch shouldn't change any functionality, just moves the kref.
      
      [airlied: move kerneldoc as well]
      Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      d0f37cf6
    • Dave Airlie's avatar
      drm/mode: introduce wrapper to read framebuffer refcount. · 747a598f
      Dave Airlie authored
      Avoids drivers knowing where the kref is stored.
      
      [airlied: add kerneldoc]
      Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      747a598f
    • Dave Airlie's avatar
      drm/modes: drop __drm_framebuffer_unregister. · 19ab3f8b
      Dave Airlie authored
      Just use the generic function.
      
      The main side effect of this is that the fb->base.id
      is now protected by the idr mutex as well.
      Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      19ab3f8b
    • Dave Airlie's avatar
      drm/mode: move framebuffer_free up above framebuffer_init · f55f1f91
      Dave Airlie authored
      A later patch will use it in framebuffer_init, and I want
      to keep the diff cleaner.
      Acked-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      f55f1f91
    • Dave Airlie's avatar
      drm/mode: rework drm_mode_object_put to drm_mode_object_unregister. · 7c8f6d25
      Dave Airlie authored
      This changes the code to handle being called multiple times without
      side effects. The new names seems more suitable for what it does.
      Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      7c8f6d25
  2. 21 Apr, 2016 7 commits
    • Dave Airlie's avatar
      Merge branch 'drm-atmel-hlcdc-devel' of https://github.com/bbrezillon/linux-at91 into drm-next · 9a297b36
      Dave Airlie authored
      This PR contains several improvement and cleanup patches for the
      atmel-hlcdc driver to be applied on drm-next (targeting 4.7).
      
      * 'drm-atmel-hlcdc-devel' of https://github.com/bbrezillon/linux-at91:
        drm: atmel-hlcdc: route DMA accesses through AHB interfaces
        drm: atmel-hlcdc: check display mode validity in crtc->mode_fixup()
        drm: atmel-hlcdc: rework the output code to support drm bridges
        drm: atmel-hlcdc: move output mode selection in CRTC implementation
        drm: atmel-hlcdc: support extended timing ranges on sama5d4 and sama5d2
        drm: atmel-hlcdc: remove leftovers from atomic mode setting migration
        drm: atmel-hlcdc: fix connector and encoder types
        drm: atmel-hlcdc: support asynchronous atomic commit operations
        drm: atmel-hlcdc: add a ->cleanup_fb() operation
      9a297b36
    • Dave Airlie's avatar
      Merge tag 'drm-intel-next-2016-04-11' of git://anongit.freedesktop.org/drm-intel into drm-next · 605b28c8
      Dave Airlie authored
      - make modeset hw state checker atomic aware (Maarten)
      - close races in gpu stuck detection/seqno reading (Chris)
      - tons&tons of small improvements from Chris Wilson all over the gem code
      - more dsi/bxt work from Ramalingam&Jani
      - macro polish from Joonas
      - guc fw loading fixes (Arun&Dave)
      - vmap notifier (acked by Andrew) + i915 support by Chris Wilson
      - create bottom half for execlist irq processing (Chris Wilson)
      - vlv/chv pll cleanup (Ville)
      - rework DP detection, especially sink detection (Shubhangi Shrivastava)
      - make color manager support fully atomic (Maarten)
      - avoid livelock on chv in execlist irq handler (Chris)
      
      * tag 'drm-intel-next-2016-04-11' of git://anongit.freedesktop.org/drm-intel: (82 commits)
        drm/i915: Update DRIVER_DATE to 20160411
        drm/i915: Avoid allocating a vmap arena for a single page
        drm,i915: Introduce drm_malloc_gfp()
        drm/i915/shrinker: Restrict vmap purge to objects with vmaps
        drm/i915: Refactor duplicate object vmap functions
        drm/i915: Consolidate common error handling in intel_pin_and_map_ringbuffer_obj
        drm/i915/dmabuf: Tighten struct_mutex for unmap_dma_buf
        drm/i915: implement WaClearTdlStateAckDirtyBits
        drm/i915/bxt: Reversed polarity of PORT_PLL_REF_SEL bit
        drm/i915: Rename hw state checker to hw state verifier.
        drm/i915: Move modeset state verifier calls.
        drm/i915: Make modeset state verifier take crtc as argument.
        drm/i915: Replace manual barrier() with READ_ONCE() in HWS accessor
        drm/i915: Use simplest form for flushing the single cacheline in the HWS
        drm/i915: Harden detection of missed interrupts
        drm/i915: Separate out the seqno-barrier from engine->get_seqno
        drm/i915: Remove forcewake dance from seqno/irq barrier on legacy gen6+
        drm/i915: Fixup the free space logic in ring_prepare
        drm/i915: Simplify check for idleness in hangcheck
        drm/i915: Apply a mb between emitting the request and hangcheck
        ...
      605b28c8
    • Dave Airlie's avatar
      Merge tag 'v4.6-rc3' into drm-next · 49047962
      Dave Airlie authored
      Backmerge 4.6-rc3 for i915.
      
      Linux 4.6-rc3
      49047962
    • Dave Airlie's avatar
      Merge tag 'topic/drm-misc-2016-04-21' of git://anongit.freedesktop.org/drm-intel into drm-next · d57d4773
      Dave Airlie authored
      misc pull req all over. Biggest thing is the
      drm_connector_(un)register_all cleanup from Alexey for drivers without the
      load/unload midlayer hooks. I.e. all the new ones, and a bunch of the
      pending new atomic drivers depend upon this. Or at least I asked them to
      rebase ;-)
      
      * tag 'topic/drm-misc-2016-04-21' of git://anongit.freedesktop.org/drm-intel:
        drm: Make drm.debug parameter description more helpful
        drm: Remove warning from drm_connector_unregister_all()
        drm: probe_helper: Hide ugly ifdef
        drm: rcar-du: Use generic drm_connector_register_all() helper
        drm: atmel_hldc: Use generic drm_connector_register_all() helper
        drm: Introduce drm_connector_register_all() helper
        drm: fix lut value extraction function
        drm/atomic-helper: Print an error if vblank wait times out
        drm/dp/mst: Restore primary hub guid on resume
        drm: Release driver references to handle before making it available again
        drm/i915/dp/mst: Add source port info to debugfs output
        drm/dp/mst: Enhance DP MST debugfs output
        drm/edid: Add drm_edid_get_monitor_name()
        include/drm: Reword debug categories comment.
        drm/crtc_helper: Reset empty plane state in drm_helper_crtc_mode_set_base()
        drm/virtio: Drop dummy gamma table support
        drm/bochs: Drop fake gamma support
        drm/core: Fix ordering in drm_mode_config_cleanup.
      d57d4773
    • Dave Airlie's avatar
      Merge tag 'topic/struct_mutex-2016-04-21' of git://anongit.freedesktop.org/drm-intel into drm-next · f230ffa1
      Dave Airlie authored
      struct_mutex cleanups and error paths fixes. Unfortunately I didn't manage
      to get acks from everyone, but this stuff has been hanging out for months
      now and imo simple enough to just land the remaining few patches. But
      separate pull request so that you can take a look yourself.
      
      * tag 'topic/struct_mutex-2016-04-21' of git://anongit.freedesktop.org/drm-intel:
        drm/vma_manage: Drop has_offset
        drm/vgem: Drop dev->struct_mutex
        drm/vgem: Move get_pages to gem_create
        drm/vgem: Simplify dumb_map
        drm/exynos: drop struct_mutex from fbdev setup
        drm/exynos: drop struct_mutex from exynos_drm_gem_get_ioctl
        drm/exynos: drop struct_mutex from exynos_gem_map_sgt_with_dma
        drm/exynos: Drop dev->struct_mutex from mmap offset function
        drm/nouveau: Drop dev->struct_mutex from fbdev init
        drm/qxl: Use unlocked gem unreferencing
        drm/omapdrm: Use unlocked gem unreferencing
        drm/nouveau: Use unlocked gem unreferencing
      f230ffa1
    • Ezequiel Garcia's avatar
      drm: Make drm.debug parameter description more helpful · 6dc3e22e
      Ezequiel Garcia authored
      Let's be user-friendly and print an actually helpful parameter
      description.
      
      This makes modinfo output the debug parameter like this:
      
      parm:           debug:Enable debug output, where each bit enables a debug category.
      		Bit 0 (0x01) will enable CORE messages (drm core code)
      		Bit 1 (0x02) will enable DRIVER messages (drm controller code)
      		Bit 2 (0x04) will enable KMS messages (modesetting code)
      		Bit 3 (0x08) will enable PRIME messages (prime code)
      		Bit 4 (0x10) will enable ATOMIC messages (atomic code)
      		Bit 5 (0x20) will enable VBL messages (vblank code) (int)
      
      Changes from v1:
      
        * Fixed s/PRMIE/PRIME typo.
        * Add ATOMIC and VBL debug parameter documentation.
        * Prefix the continuation lines with two tabs and
          removed the last new line.
        * Remove spurious whitespace.
      Signed-off-by: default avatarEzequiel Garcia <ezequiel@vanguardiasur.com.ar>
      Reviewed-by: default avatarJani Nikula <jani.nikula@intel.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: http://patchwork.freedesktop.org/patch/msgid/1461170703-11216-1-git-send-email-ezequiel@vanguardiasur.com.ar
      6dc3e22e
    • Laurent Pinchart's avatar
      drm: Remove warning from drm_connector_unregister_all() · 14ba0031
      Laurent Pinchart authored
      Commit 6c87e5c3 ("drm: Rename drm_connector_unplug_all() to
      drm_connector_unregister_all()") replaced a manual connectors list walk
      in drm_connector_unregister_all() with drm_for_each_connector(). The
      list was walked without the mode config mutex locked as that ends up in
      a clash with sysfs, but drm_connector_unregister_all() warns when the
      mutex isn't locked.
      
      The problem is known and doesn't require a large warning every time
      drm_connector_unregister_all() is called. Fix it by reverting to manual
      list walk.
      
      Fixes: 6c87e5c3 ("drm: Rename drm_connector_unplug_all() to drm_connector_unregister_all()")
      Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: http://patchwork.freedesktop.org/patch/msgid/1461190874-32674-1-git-send-email-laurent.pinchart+renesas@ideasonboard.com
      14ba0031
  3. 20 Apr, 2016 17 commits
  4. 18 Apr, 2016 1 commit
  5. 15 Apr, 2016 2 commits