1. 11 12月, 2019 1 次提交
  2. 07 11月, 2019 1 次提交
  3. 14 6月, 2019 2 次提交
  4. 29 4月, 2019 1 次提交
  5. 06 2月, 2019 1 次提交
    • L
      drm/atomic: Add drm_atomic_state->duplicated · 022debad
      Lyude Paul 提交于
      Since
      
      commit 39b50c60 ("drm/atomic_helper: Stop modesets on unregistered
      connectors harder")
      
      We've been failing atomic checks if they try to enable new displays on
      unregistered connectors. This is fine except for the one situation that
      breaks atomic assumptions: suspend/resume. If a connector is
      unregistered before we attempt to restore the atomic state, something we
      end up failing the atomic check that happens when trying to restore the
      state during resume.
      
      Normally this would be OK: we try our best to make sure that the atomic
      state pre-suspend can be restored post-suspend, but failures at that
      point usually don't cause problems. That is of course, until we
      introduced the new atomic MST VCPI helpers:
      
      [drm:drm_atomic_helper_check_modeset [drm_kms_helper]] [CRTC:65:pipe B] active changed
      [drm:drm_atomic_helper_check_modeset [drm_kms_helper]] Updating routing for [CONNECTOR:123:DP-5]
      [drm:drm_atomic_helper_check_modeset [drm_kms_helper]] Disabling [CONNECTOR:123:DP-5]
      [drm:drm_atomic_get_private_obj_state [drm]] Added new private object 0000000025844636 state 000000009fd2899a to 000000003a13d7b8
      WARNING: CPU: 6 PID: 1070 at drivers/gpu/drm/drm_dp_mst_topology.c:3153 drm_dp_atomic_release_vcpi_slots+0xb9/0x200 [drm_kms_helper]
      Modules linked in: fuse vfat fat snd_hda_codec_hdmi snd_hda_codec_realtek snd_hda_codec_generic joydev iTCO_wdt i915(O) wmi_bmof intel_rapl btusb btrtl x86_pkg_temp_thermal btbcm btintel coretemp i2c_algo_bit drm_kms_helper(O) crc32_pclmul snd_hda_intel syscopyarea sysfillrect snd_hda_codec sysimgblt snd_hda_core bluetooth fb_sys_fops snd_pcm pcspkr drm(O) psmouse snd_timer mei_me ecdh_generic i2c_i801 mei i2c_core ucsi_acpi typec_ucsi typec wmi thinkpad_acpi ledtrig_audio snd soundcore tpm_tis rfkill tpm_tis_core video tpm acpi_pad pcc_cpufreq uas usb_storage crc32c_intel nvme serio_raw xhci_pci nvme_core xhci_hcd
      CPU: 6 PID: 1070 Comm: gnome-shell Tainted: G        W  O      5.0.0-rc2Lyude-Test+ #1
      Hardware name: LENOVO 20L8S2N800/20L8S2N800, BIOS N22ET35W (1.12 ) 04/09/2018
      RIP: 0010:drm_dp_atomic_release_vcpi_slots+0xb9/0x200 [drm_kms_helper]
      Code: 00 4c 39 6d f0 74 49 48 8d 7b 10 48 89 f9 48 c1 e9 03 42 80 3c 21 00 0f 85 d2 00 00 00 48 8b 6b 10 48 8d 5d f0 49 39 ee 75 c5 <0f> 0b 48 c7 c7 c0 78 b3 a0 48 89 c2 4c 89 ee e8 03 6c aa ff b8 ea
      RSP: 0018:ffff88841235f268 EFLAGS: 00010246
      RAX: ffff88841bf12ab0 RBX: ffff88841bf12aa8 RCX: 1ffff110837e2557
      RDX: dffffc0000000000 RSI: 0000000000000000 RDI: ffffed108246bde0
      RBP: ffff88841bf12ab8 R08: ffffed1083db3c93 R09: ffffed1083db3c92
      R10: ffffed1083db3c92 R11: ffff88841ed9e497 R12: ffff888419555d80
      R13: ffff8883bc499100 R14: ffff88841bf12ab8 R15: 0000000000000000
      FS:  00007f16fbd4cd00(0000) GS:ffff88841ed80000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 00007f1687c9f000 CR3: 00000003ba3cc003 CR4: 00000000003606e0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      Call Trace:
       drm_atomic_helper_check_modeset+0xf21/0x2f50 [drm_kms_helper]
       ? drm_atomic_helper_commit_modeset_enables+0xa90/0xa90 [drm_kms_helper]
       ? __printk_safe_exit+0x10/0x10
       ? save_stack+0x8c/0xb0
       ? vprintk_func+0x96/0x1bf
       ? __printk_safe_exit+0x10/0x10
       intel_atomic_check+0x234/0x4750 [i915]
       ? printk+0x9f/0xc5
       ? kmsg_dump_rewind_nolock+0xd9/0xd9
       ? _raw_spin_lock_irqsave+0xa4/0x140
       ? drm_atomic_check_only+0xb1/0x28b0 [drm]
       ? drm_dbg+0x186/0x1b0 [drm]
       ? drm_dev_dbg+0x200/0x200 [drm]
       ? intel_link_compute_m_n+0xb0/0xb0 [i915]
       ? drm_mode_put_tile_group+0x20/0x20 [drm]
       ? skl_plane_format_mod_supported+0x17f/0x1b0 [i915]
       ? drm_plane_check_pixel_format+0x14a/0x310 [drm]
       drm_atomic_check_only+0x13c4/0x28b0 [drm]
       ? drm_state_info+0x220/0x220 [drm]
       ? drm_atomic_helper_disable_plane+0x1d0/0x1d0 [drm_kms_helper]
       ? pick_single_encoder_for_connector+0xe0/0xe0 [drm_kms_helper]
       ? kasan_unpoison_shadow+0x35/0x40
       drm_atomic_commit+0x3b/0x100 [drm]
       drm_atomic_helper_set_config+0xd5/0x100 [drm_kms_helper]
       drm_mode_setcrtc+0x636/0x1660 [drm]
       ? vprintk_func+0x96/0x1bf
       ? drm_dev_dbg+0x200/0x200 [drm]
       ? drm_mode_getcrtc+0x790/0x790 [drm]
       ? printk+0x9f/0xc5
       ? mutex_unlock+0x1d/0x40
       ? drm_mode_addfb2+0x2e9/0x3a0 [drm]
       ? rcu_sync_dtor+0x2e0/0x2e0
       ? drm_dbg+0x186/0x1b0 [drm]
       ? set_page_dirty+0x271/0x4d0
       drm_ioctl_kernel+0x203/0x290 [drm]
       ? drm_mode_getcrtc+0x790/0x790 [drm]
       ? drm_setversion+0x7f0/0x7f0 [drm]
       ? __switch_to_asm+0x34/0x70
       ? __switch_to_asm+0x34/0x70
       drm_ioctl+0x445/0x950 [drm]
       ? drm_mode_getcrtc+0x790/0x790 [drm]
       ? drm_getunique+0x220/0x220 [drm]
       ? expand_files.part.10+0x920/0x920
       do_vfs_ioctl+0x1a1/0x13d0
       ? ioctl_preallocate+0x2b0/0x2b0
       ? __fget_light+0x2d6/0x390
       ? schedule+0xd7/0x2e0
       ? fget_raw+0x10/0x10
       ? apic_timer_interrupt+0xa/0x20
       ? apic_timer_interrupt+0xa/0x20
       ? rcu_cleanup_dead_rnp+0x2c0/0x2c0
       ksys_ioctl+0x60/0x90
       __x64_sys_ioctl+0x6f/0xb0
       do_syscall_64+0x136/0x440
       ? syscall_return_slowpath+0x2d0/0x2d0
       ? do_page_fault+0x89/0x330
       ? __do_page_fault+0x9c0/0x9c0
       ? prepare_exit_to_usermode+0x188/0x200
       ? perf_trace_sys_enter+0x1090/0x1090
       ? __x64_sys_sigaltstack+0x280/0x280
       ? __put_user_4+0x1c/0x30
       entry_SYSCALL_64_after_hwframe+0x44/0xa9
      RIP: 0033:0x7f16ff89a09b
      Code: 0f 1e fa 48 8b 05 ed bd 0c 00 64 c7 00 26 00 00 00 48 c7 c0 ff ff ff ff c3 66 0f 1f 44 00 00 f3 0f 1e fa b8 10 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d bd bd 0c 00 f7 d8 64 89 01 48
      RSP: 002b:00007fff001232b8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
      RAX: ffffffffffffffda RBX: 00007fff001232f0 RCX: 00007f16ff89a09b
      RDX: 00007fff001232f0 RSI: 00000000c06864a2 RDI: 000000000000000b
      RBP: 00007fff001232f0 R08: 0000000000000000 R09: 000055a79d484460
      R10: 000055a79d44e770 R11: 0000000000000246 R12: 00000000c06864a2
      R13: 000000000000000b R14: 0000000000000000 R15: 000055a79d44e770
      WARNING: CPU: 6 PID: 1070 at drivers/gpu/drm/drm_dp_mst_topology.c:3153 drm_dp_atomic_release_vcpi_slots+0xb9/0x200 [drm_kms_helper]
      ---[ end trace d536c05c13c83be2 ]---
      [drm:drm_dp_atomic_release_vcpi_slots [drm_kms_helper]] *ERROR* no VCPI for [MST PORT:00000000f9e2b143] found in mst state 000000009fd2899a
      
      This appears to be happening because we destroy the VCPI allocations
      when disabling all connected displays while suspending, and those VCPI
      allocations don't get restored on resume due to failing to restore the
      atomic state.
      
      So, fix this by introducing the suspending option to
      drm_atomic_helper_duplicate_state() and use that to indicate in the
      atomic state that it's being used for suspending or resuming the system,
      and thus needs to be fixed up by the driver. We can then use the new
      state->duplicated hook to tell update_connector_routing() in
      drm_atomic_check_modeset() to allow for modesets on unregistered
      connectors, which allows us to restore atomic states that contain MST
      topologies that were removed after the state was duplicated and thus:
      mostly fixing suspend and resume. This just leaves some issues that were
      introduced with nouveau, that will be addressed next.
      
      Changes since v3:
      * Remove ->duplicated hunks that I left in the VCPI helpers by accident.
        These don't need to be here, that was the supposed to be the purpose
        of the last revision
      Changes since v2:
      * Remove the changes in this patch to the VCPI helpers, they aren't
        needed anymore
      Changes since v1:
      * Rename suspend_or_resume to duplicated
      Signed-off-by: NLyude Paul <lyude@redhat.com>
      Fixes: eceae147 ("drm/dp_mst: Start tracking per-port VCPI allocations")
      Cc: Daniel Vetter <daniel@ffwll.ch>
      Reviewed-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: https://patchwork.freedesktop.org/patch/msgid/20190202002023.29665-4-lyude@redhat.com
      022debad
  6. 04 2月, 2019 1 次提交
  7. 11 1月, 2019 1 次提交
  8. 11 12月, 2018 1 次提交
  9. 19 10月, 2018 1 次提交
    • L
      drm: Get ref on CRTC commit object when waiting for flip_done · 4364bcb2
      Leo Li 提交于
      This fixes a general protection fault, caused by accessing the contents
      of a flip_done completion object that has already been freed. It occurs
      due to the preemption of a non-blocking commit worker thread W by
      another commit thread X. X continues to clear its atomic state at the
      end, destroying the CRTC commit object that W still needs. Switching
      back to W and accessing the commit objects then leads to bad results.
      
      Worker W becomes preemptable when waiting for flip_done to complete. At
      this point, a frequently occurring commit thread X can take over. Here's
      an example where W is a worker thread that flips on both CRTCs, and X
      does a legacy cursor update on both CRTCs:
      
              ...
           1. W does flip work
           2. W runs commit_hw_done()
           3. W waits for flip_done on CRTC 1
           4. > flip_done for CRTC 1 completes
           5. W finishes waiting for CRTC 1
           6. W waits for flip_done on CRTC 2
      
           7. > Preempted by X
           8. > flip_done for CRTC 2 completes
           9. X atomic_check: hw_done and flip_done are complete on all CRTCs
          10. X updates cursor on both CRTCs
          11. X destroys atomic state
          12. X done
      
          13. > Switch back to W
          14. W waits for flip_done on CRTC 2
          15. W raises general protection fault
      
      The error looks like so:
      
          general protection fault: 0000 [#1] PREEMPT SMP PTI
          **snip**
          Call Trace:
           lock_acquire+0xa2/0x1b0
           _raw_spin_lock_irq+0x39/0x70
           wait_for_completion_timeout+0x31/0x130
           drm_atomic_helper_wait_for_flip_done+0x64/0x90 [drm_kms_helper]
           amdgpu_dm_atomic_commit_tail+0xcae/0xdd0 [amdgpu]
           commit_tail+0x3d/0x70 [drm_kms_helper]
           process_one_work+0x212/0x650
           worker_thread+0x49/0x420
           kthread+0xfb/0x130
           ret_from_fork+0x3a/0x50
          Modules linked in: x86_pkg_temp_thermal amdgpu(O) chash(O)
          gpu_sched(O) drm_kms_helper(O) syscopyarea sysfillrect sysimgblt
          fb_sys_fops ttm(O) drm(O)
      
      Note that i915 has this issue masked, since hw_done is signaled after
      waiting for flip_done. Doing so will block the cursor update from
      happening until hw_done is signaled, preventing the cursor commit from
      destroying the state.
      
      v2: The reference on the commit object needs to be obtained before
          hw_done() is signaled, since that's the point where another commit
          is allowed to modify the state. Assuming that the
          new_crtc_state->commit object still exists within flip_done() is
          incorrect.
      
          Fix by getting a reference in setup_commit(), and releasing it
          during default_clear().
      Signed-off-by: NLeo Li <sunpeng.li@amd.com>
      Reviewed-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: NHarry Wentland <harry.wentland@amd.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/1539611200-6184-1-git-send-email-sunpeng.li@amd.com
      4364bcb2
  10. 06 10月, 2018 1 次提交
  11. 09 9月, 2018 3 次提交
  12. 20 6月, 2018 2 次提交
    • B
      drm: writeback: Add out-fences for writeback connectors · b13cc8dd
      Brian Starkey 提交于
      Add the WRITEBACK_OUT_FENCE_PTR property to writeback connectors, to
      enable userspace to get a fence which will signal once the writeback is
      complete. It is not allowed to request an out-fence without a
      framebuffer attached to the connector.
      
      A timeline is added to drm_writeback_connector for use by the writeback
      out-fences.
      
      In the case of a commit failure or DRM_MODE_ATOMIC_TEST_ONLY, the fence
      is set to -1.
      
      Changes from v2:
       - Rebase onto Gustavo Padovan's v9 explicit sync series
       - Change out_fence_ptr type to s32 __user *
       - Set *out_fence_ptr to -1 in drm_atomic_connector_set_property
       - Store fence in drm_writeback_job
       Gustavo Padovan:
       - Move out_fence_ptr out of connector_state
       - Signal fence from drm_writeback_signal_completion instead of
         in driver directly
      
      Changes from v3:
       - Rebase onto commit 7e9081c5 ("drm/fence: fix memory overwrite
         when setting out_fence fd") (change out_fence_ptr to s32 __user *,
         for real this time.)
       - Update documentation around WRITEBACK_OUT_FENCE_PTR
      Signed-off-by: NBrian Starkey <brian.starkey@arm.com>
      [rebased and fixed conflicts]
      Signed-off-by: NMihail Atanassov <mihail.atanassov@arm.com>
      Signed-off-by: NLiviu Dudau <liviu.dudau@arm.com>
      Reviewed-by: NEric Anholt <eric@anholt.net>
      Reviewed-by: NSean Paul <seanpaul@chromium.org>
      Link: https://patchwork.freedesktop.org/patch/229036/
      b13cc8dd
    • B
      drm: Add writeback connector type · 935774cd
      Brian Starkey 提交于
      Writeback connectors represent writeback engines which can write the
      CRTC output to a memory framebuffer. Add a writeback connector type and
      related support functions.
      
      Drivers should initialize a writeback connector with
      drm_writeback_connector_init() which takes care of setting up all the
      writeback-specific details on top of the normal functionality of
      drm_connector_init().
      
      Writeback connectors have a WRITEBACK_FB_ID property, used to set the
      output framebuffer, and a WRITEBACK_PIXEL_FORMATS blob used to expose the
      supported writeback formats to userspace.
      
      When a framebuffer is attached to a writeback connector with the
      WRITEBACK_FB_ID property, it is used only once (for the commit in which
      it was included), and userspace can never read back the value of
      WRITEBACK_FB_ID. WRITEBACK_FB_ID can only be set if the connector is
      attached to a CRTC.
      
      Changes since v1:
       - Added drm_writeback.c + documentation
       - Added helper to initialize writeback connector in one go
       - Added core checks
       - Squashed into a single commit
       - Dropped the client cap
       - Writeback framebuffers are no longer persistent
      
      Changes since v2:
       Daniel Vetter:
       - Subclass drm_connector to drm_writeback_connector
       - Relax check to allow CRTC to be set without an FB
       - Add some writeback_ prefixes
       - Drop PIXEL_FORMATS_SIZE property, as it was unnecessary
       Gustavo Padovan:
       - Add drm_writeback_job to handle writeback signalling centrally
      
      Changes since v3:
       - Rebased
       - Rename PIXEL_FORMATS -> WRITEBACK_PIXEL_FORMATS
      
      Chances since v4:
       - Embed a drm_encoder inside the drm_writeback_connector to
         reduce the amount of boilerplate code required from the drivers
         that are using it.
      
      Changes since v5:
       - Added Rob Clark's atomic_commit() vfunc to connector helper
         funcs, so that writeback jobs are committed from atomic helpers
       - Updated create_writeback_properties() signature to return an
         error code rather than a boolean false for failure.
       - Free writeback job with the connector state rather than when
         doing the cleanup_work()
      
      Changes since v7:
       - fix extraneous use of out_fence that is only introduced in a
         subsequent patch.
      
      Changes since v8:
       - whitespace changes pull from subsequent patch
      
      Changes since v9:
       - Revert the v6 changes that free the writeback job in the connector
         state cleanup and return to doing it in the cleanup_work() function
      Signed-off-by: NBrian Starkey <brian.starkey@arm.com>
      [rebased and fixed conflicts]
      Signed-off-by: NMihail Atanassov <mihail.atanassov@arm.com>
      [rebased and added atomic_commit() vfunc for writeback jobs]
      Signed-off-by: NRob Clark <robdclark@gmail.com>
      Signed-off-by: NLiviu Dudau <liviu.dudau@arm.com>
      Reviewed-by: NEric Anholt <eric@anholt.net>
      Link: https://patchwork.freedesktop.org/patch/229037/
      935774cd
  13. 12 6月, 2018 1 次提交
  14. 08 3月, 2018 1 次提交
  15. 16 2月, 2018 1 次提交
  16. 01 2月, 2018 1 次提交
  17. 30 1月, 2018 1 次提交
  18. 15 12月, 2017 2 次提交
  19. 06 10月, 2017 2 次提交
  20. 08 9月, 2017 4 次提交
  21. 02 9月, 2017 1 次提交
  22. 08 8月, 2017 3 次提交
  23. 31 7月, 2017 1 次提交
  24. 14 7月, 2017 1 次提交
  25. 03 7月, 2017 1 次提交
    • G
      drm/atomic: initial support for asynchronous plane update · fef9df8b
      Gustavo Padovan 提交于
      In some cases, like cursor updates, it is interesting to update the
      plane in an asynchronous fashion to avoid big delays. The current queued
      update could be still waiting for a fence to signal and thus block any
      subsequent update until its scan out. In cases like this if we update the
      cursor synchronously through the atomic API it will cause significant
      delays that would even be noticed by the final user.
      
      This patch creates a fast path to jump ahead the current queued state and
      do single planes updates without going through all atomic steps in
      drm_atomic_helper_commit(). We take this path for legacy cursor updates.
      
      For now only single plane updates are supported, but we plan to support
      multiple planes updates and async PageFlips through this interface as well
      in the near future.
      
      v6:	- move check code to drm_atomic_helper.c (Daniel Vetter)
      
      v5:
      	- improve comments (Eric Anholt)
      
      v4:
      	- fix state->crtc NULL check (Archit Taneja)
      
      v3:
      	- fix iteration on the wrong crtc state
      	- put back code to forbid updates if there is a queued update for
      	the same plane (Ville Syrjälä)
      	- move size checks back to drivers (Ville Syrjälä)
      	- move ASYNC_UPDATE flag addition to its own patch (Ville Syrjälä)
      
      v2:
      	- allow updates even if there is a queued update for the same
      	plane.
              - fixes on the documentation (Emil Velikov)
              - unconditionally call ->atomic_async_update (Emil Velikov)
              - check for ->atomic_async_update earlier (Daniel Vetter)
              - make ->atomic_async_check() the last step (Daniel Vetter)
              - add ASYNC_UPDATE flag (Eric Anholt)
              - update state in core after ->atomic_async_update (Eric Anholt)
      	- update docs (Eric Anholt)
      
      Cc: Daniel Vetter <daniel.vetter@intel.com>
      Cc: Rob Clark <robdclark@gmail.com>
      Cc: Eric Anholt <eric@anholt.net>
      Signed-off-by: NGustavo Padovan <gustavo.padovan@collabora.com>
      Reviewed-by: Archit Taneja <architt@codeaurora.org> (v5)
      Acked-by: Eric Anholt <eric@anholt.net> (v5)
      Reviewed-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: http://patchwork.freedesktop.org/patch/msgid/20170630180322.29007-2-gustavo@padovan.org
      fef9df8b
  26. 31 5月, 2017 1 次提交
  27. 04 5月, 2017 1 次提交
  28. 07 4月, 2017 1 次提交
  29. 29 3月, 2017 1 次提交