1. 05 May, 2023 2 commits
    • Brian Norris's avatar
      drm/rockchip: vop: Leave vblank enabled in self-refresh · 2bdba9d4
      Brian Norris authored
      If we disable vblank when entering self-refresh, vblank APIs (like
      DRM_IOCTL_WAIT_VBLANK) no longer work. But user space is not aware when
      we enter self-refresh, so this appears to be an API violation -- that
      DRM_IOCTL_WAIT_VBLANK fails with EINVAL whenever the display is idle and
      enters self-refresh.
      
      The downstream driver used by many of these systems never used to
      disable vblank for PSR, and in fact, even upstream, we didn't do that
      until radically redesigning the state machine in commit 6c836d96
      ("drm/rockchip: Use the helpers for PSR").
      
      Thus, it seems like a reasonable API fix to simply restore that
      behavior, and leave vblank enabled.
      
      Note that this appears to potentially unbalance the
      drm_crtc_vblank_{off,on}() calls in some cases, but:
      (a) drm_crtc_vblank_on() documents this as OK and
      (b) if I do the naive balancing, I find state machine issues such that
          we're not in sync properly; so it's easier to take advantage of (a).
      
      This issue was exposed by IGT's kms_vblank tests, and reported by
      KernelCI. The bug has been around a while (longer than KernelCI
      noticed), but was only exposed once self-refresh was bugfixed more
      recently, and so KernelCI could properly test it. Some other notes in:
      
        https://lore.kernel.org/dri-devel/Y6OCg9BPnJvimQLT@google.com/
        Re: renesas/master bisection: igt-kms-rockchip.kms_vblank.pipe-A-wait-forked on rk3399-gru-kevin
      
      == Backporting notes: ==
      
      Marking as 'Fixes' commit 6c836d96 ("drm/rockchip: Use the helpers
      for PSR"), but it probably depends on commit bed030a4
      ("drm/rockchip: Don't fully disable vop on self refresh") as well.
      
      We also need the previous patch ("drm/atomic: Allow vblank-enabled +
      self-refresh "disable""), of course.
      
      v3:
       * no update
      
      v2:
       * skip unnecessary lock/unlock
      
      Fixes: 6c836d96 ("drm/rockchip: Use the helpers for PSR")
      Cc: <stable@vger.kernel.org>
      Reported-by: default avatar"kernelci.org bot" <bot@kernelci.org>
      Link: https://lore.kernel.org/dri-devel/Y5itf0+yNIQa6fU4@sirena.org.uk/Signed-off-by: default avatarBrian Norris <briannorris@chromium.org>
      Signed-off-by: default avatarSean Paul <seanpaul@chromium.org>
      Link: https://patchwork.freedesktop.org/patch/msgid/20230109171809.v3.2.Ic07cba4ab9a7bd3618a9e4258b8f92ea7d10ae5a@changeid
      2bdba9d4
    • Brian Norris's avatar
      drm/atomic: Allow vblank-enabled + self-refresh "disable" · 9d0e3cac
      Brian Norris authored
      The self-refresh helper framework overloads "disable" to sometimes mean
      "go into self-refresh mode," and this mode activates automatically
      (e.g., after some period of unchanging display output). In such cases,
      the display pipe is still considered "on", and user-space is not aware
      that we went into self-refresh mode. Thus, users may expect that
      vblank-related features (such as DRM_IOCTL_WAIT_VBLANK) still work
      properly.
      
      However, we trigger the WARN_ONCE() here if a CRTC driver tries to leave
      vblank enabled.
      
      Add a different expectation: that CRTCs *should* leave vblank enabled
      when going into self-refresh.
      
      This patch is preparation for another patch -- "drm/rockchip: vop: Leave
      vblank enabled in self-refresh" -- which resolves conflicts between the
      above self-refresh behavior and the API tests in IGT's kms_vblank test
      module.
      
      == Some alternatives discussed: ==
      
      It's likely that on many display controllers, vblank interrupts will
      turn off when the CRTC is disabled, and so in some cases, self-refresh
      may not support vblank. To support such cases, we might consider
      additions to the generic helpers such that we fire vblank events based
      on a timer.
      
      However, there is currently only one driver using the common
      self-refresh helpers (i.e., rockchip), and at least as of commit
      bed030a4 ("drm/rockchip: Don't fully disable vop on self refresh"),
      the CRTC hardware is powered enough to continue to generate vblank
      interrupts.
      
      So we chose the simpler option of leaving vblank interrupts enabled. We
      can reevaluate this decision and perhaps augment the helpers if/when we
      gain a second driver that has different requirements.
      
      v3:
       * include discussion summary
      
      v2:
       * add 'ret != 0' warning case for self-refresh
       * describe failing test case and relation to drm/rockchip patch better
      
      Cc: <stable@vger.kernel.org> # dependency for "drm/rockchip: vop: Leave
                                   # vblank enabled in self-refresh"
      Signed-off-by: default avatarBrian Norris <briannorris@chromium.org>
      Signed-off-by: default avatarSean Paul <seanpaul@chromium.org>
      Link: https://patchwork.freedesktop.org/patch/msgid/20230109171809.v3.1.I3904f697863649eb1be540ecca147a66e42bfad7@changeid
      9d0e3cac
  2. 04 May, 2023 1 commit
  3. 03 May, 2023 2 commits
  4. 02 May, 2023 2 commits
  5. 28 Apr, 2023 4 commits
  6. 27 Apr, 2023 5 commits
  7. 26 Apr, 2023 3 commits
  8. 25 Apr, 2023 10 commits
  9. 24 Apr, 2023 11 commits