drm: Add self refresh helpers

Submitted by Sean Paul on May 2, 2019, 7:49 p.m.

Details

Reviewer None
Submitted May 2, 2019, 7:49 p.m.
Last Updated June 12, 2019, 2:50 p.m.
Revision 6

Cover Letter(s)

Revision 1
      From: Sean Paul <seanpaul@chromium.org>

Hey all,
Back from my break from this. v3 isn't a whole lot different from v2,
aside from the new helpers that I've added. These allowed me to remove
some redundant state from connector and rely solely on crtc_state.

Please take a look,

Sean


Sean Paul (10):
  drm: Add atomic variants of enable/disable to encoder helper funcs
  drm: Add drm_atomic_crtc_state_for_encoder helper
  drm: Add atomic variants for bridge enable/disable
  drm: Convert connector_helper_funcs->atomic_check to accept
    drm_atomic_state
  drm: Add helpers to kick off self refresh mode in drivers
  drm/rockchip: Use dirtyfb helper
  drm/rockchip: Check for fast link training before enabling psr
  drm/rockchip: Use the helpers for PSR
  drm/rockchip: Don't fully disable vop on self refresh
  drm/rockchip: Use drm_atomic_helper_commit_tail_rpm

 Documentation/gpu/drm-kms-helpers.rst         |   9 +
 drivers/gpu/drm/Makefile                      |   2 +-
 .../drm/bridge/analogix/analogix_dp_core.c    | 266 +++++++++++-----
 .../drm/bridge/analogix/analogix_dp_core.h    |   2 +-
 drivers/gpu/drm/drm_atomic.c                  |   2 +
 drivers/gpu/drm/drm_atomic_helper.c           | 101 +++++-
 drivers/gpu/drm/drm_atomic_state_helper.c     |   4 +
 drivers/gpu/drm/drm_atomic_uapi.c             |   7 +-
 drivers/gpu/drm/drm_bridge.c                  | 110 +++++++
 drivers/gpu/drm/drm_self_refresh_helper.c     | 205 +++++++++++++
 drivers/gpu/drm/i915/intel_atomic.c           |   8 +-
 drivers/gpu/drm/i915/intel_dp_mst.c           |   7 +-
 drivers/gpu/drm/i915/intel_drv.h              |   2 +-
 drivers/gpu/drm/i915/intel_sdvo.c             |   9 +-
 drivers/gpu/drm/i915/intel_tv.c               |   8 +-
 drivers/gpu/drm/nouveau/dispnv50/disp.c       |   5 +-
 drivers/gpu/drm/rcar-du/rcar_lvds.c           |  12 +-
 drivers/gpu/drm/rockchip/Makefile             |   3 +-
 .../gpu/drm/rockchip/analogix_dp-rockchip.c   |  86 +++---
 drivers/gpu/drm/rockchip/rockchip_drm_fb.c    |  39 +--
 drivers/gpu/drm/rockchip/rockchip_drm_psr.c   | 290 ------------------
 drivers/gpu/drm/rockchip/rockchip_drm_psr.h   |  30 --
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c   |  71 ++++-
 drivers/gpu/drm/vc4/vc4_txp.c                 |   7 +-
 include/drm/bridge/analogix_dp.h              |   4 -
 include/drm/drm_atomic.h                      |  15 +
 include/drm/drm_atomic_helper.h               |   6 +
 include/drm/drm_bridge.h                      | 114 +++++++
 include/drm/drm_connector.h                   |  14 +
 include/drm/drm_crtc.h                        |  19 ++
 include/drm/drm_modeset_helper_vtables.h      |  47 ++-
 include/drm/drm_self_refresh_helper.h         |  22 ++
 32 files changed, 983 insertions(+), 543 deletions(-)
 create mode 100644 drivers/gpu/drm/drm_self_refresh_helper.c
 delete mode 100644 drivers/gpu/drm/rockchip/rockchip_drm_psr.c
 delete mode 100644 drivers/gpu/drm/rockchip/rockchip_drm_psr.h
 create mode 100644 include/drm/drm_self_refresh_helper.h
    
Revision 2
      From: Sean Paul <seanpaul@chromium.org>

Another version of the SR helpers for your consumption.

Pretty minor differences between v4 and v3:
- lots of documentation changes
- Use connector to get at crtc state in encoders
- Use the damage helpers in rockchip to fix fbdev

Note that the rockchip patches require
e9abc611a941d4051cde1d94b2ab7473fdb50102 which is making its way through
the -fixes branches.

PTAL

Laurent Pinchart (1):
  drm: Add drm_atomic_get_(old|new-_connector_for_encoder() helpers

Sean Paul (10):
  drm: Add atomic variants of enable/disable to encoder helper funcs
  drm: Add atomic variants for bridge enable/disable
  drm: Convert connector_helper_funcs->atomic_check to accept
    drm_atomic_state
  drm: Add helpers to kick off self refresh mode in drivers
  drm/rockchip: Use dirtyfb helper
  drm/rockchip: Check for fast link training before enabling psr
  drm/rockchip: Use the helpers for PSR
  drm/rockchip: Use vop_win in vop_win_disable instead of vop_win_data
  drm/rockchip: Don't fully disable vop on self refresh
  drm/rockchip: Use drm_atomic_helper_commit_tail_rpm

 Documentation/gpu/drm-kms-helpers.rst         |   9 +
 drivers/gpu/drm/Makefile                      |   2 +-
 .../drm/bridge/analogix/analogix_dp_core.c    | 292 +++++++++++++-----
 .../drm/bridge/analogix/analogix_dp_core.h    |   2 +-
 drivers/gpu/drm/drm_atomic.c                  |  72 +++++
 drivers/gpu/drm/drm_atomic_helper.c           |  55 +++-
 drivers/gpu/drm/drm_atomic_state_helper.c     |   4 +
 drivers/gpu/drm/drm_atomic_uapi.c             |   7 +-
 drivers/gpu/drm/drm_bridge.c                  | 110 +++++++
 drivers/gpu/drm/drm_self_refresh_helper.c     | 213 +++++++++++++
 drivers/gpu/drm/i915/intel_atomic.c           |   8 +-
 drivers/gpu/drm/i915/intel_dp_mst.c           |   7 +-
 drivers/gpu/drm/i915/intel_drv.h              |   2 +-
 drivers/gpu/drm/i915/intel_sdvo.c             |   9 +-
 drivers/gpu/drm/i915/intel_tv.c               |   8 +-
 drivers/gpu/drm/nouveau/dispnv50/disp.c       |   5 +-
 drivers/gpu/drm/rcar-du/rcar_lvds.c           |  12 +-
 drivers/gpu/drm/rockchip/Makefile             |   3 +-
 .../gpu/drm/rockchip/analogix_dp-rockchip.c   | 106 ++++---
 drivers/gpu/drm/rockchip/rockchip_drm_fb.c    |  39 +--
 drivers/gpu/drm/rockchip/rockchip_drm_psr.c   | 290 -----------------
 drivers/gpu/drm/rockchip/rockchip_drm_psr.h   |  30 --
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c   |  84 ++++-
 drivers/gpu/drm/vc4/vc4_txp.c                 |   7 +-
 include/drm/bridge/analogix_dp.h              |   4 -
 include/drm/drm_atomic.h                      |  22 ++
 include/drm/drm_bridge.h                      | 106 +++++++
 include/drm/drm_connector.h                   |  14 +
 include/drm/drm_crtc.h                        |  19 ++
 include/drm/drm_modeset_helper_vtables.h      |  50 ++-
 include/drm/drm_self_refresh_helper.h         |  22 ++
 31 files changed, 1062 insertions(+), 551 deletions(-)
 create mode 100644 drivers/gpu/drm/drm_self_refresh_helper.c
 delete mode 100644 drivers/gpu/drm/rockchip/rockchip_drm_psr.c
 delete mode 100644 drivers/gpu/drm/rockchip/rockchip_drm_psr.h
 create mode 100644 include/drm/drm_self_refresh_helper.h
    
Revision 3
      From: Sean Paul <seanpaul@chromium.org>

Back again with a new version. Very little has changed from v5, in fact
I was just going to resend patch 2, but I ran into some collisions while
rebasing. I figured I'd take the opportunity to collect and apply the
tags I've accumulated so far and send the whole thing again.

I need reviews on patch 2 and patches 6 through 11 (the rockchip bits).

Link to v4 cover: https://patchwork.freedesktop.org/patch/msgid/20190508160920.144739-1-sean@poorly.run

Thanks,

Sean


Laurent Pinchart (1):
  drm: Add drm_atomic_get_(old|new_connector_for_encoder() helpers

Sean Paul (10):
  drm: Add atomic variants of enable/disable to encoder helper funcs
  drm: Add atomic variants for bridge enable/disable
  drm: Convert connector_helper_funcs->atomic_check to accept
    drm_atomic_state
  drm: Add helpers to kick off self refresh mode in drivers
  drm/rockchip: Use dirtyfb helper
  drm/rockchip: Check for fast link training before enabling psr
  drm/rockchip: Use the helpers for PSR
  drm/rockchip: Use vop_win in vop_win_disable instead of vop_win_data
  drm/rockchip: Don't fully disable vop on self refresh
  drm/rockchip: Use drm_atomic_helper_commit_tail_rpm

 Documentation/gpu/drm-kms-helpers.rst         |   9 +
 drivers/gpu/drm/Makefile                      |   2 +-
 .../drm/bridge/analogix/analogix_dp_core.c    | 292 +++++++++++++-----
 .../drm/bridge/analogix/analogix_dp_core.h    |   2 +-
 drivers/gpu/drm/drm_atomic.c                  |  71 +++++
 drivers/gpu/drm/drm_atomic_helper.c           |  55 +++-
 drivers/gpu/drm/drm_atomic_state_helper.c     |   4 +
 drivers/gpu/drm/drm_atomic_uapi.c             |   7 +-
 drivers/gpu/drm/drm_bridge.c                  | 110 +++++++
 drivers/gpu/drm/drm_self_refresh_helper.c     | 213 +++++++++++++
 drivers/gpu/drm/i915/intel_atomic.c           |   8 +-
 drivers/gpu/drm/i915/intel_atomic.h           |   2 +-
 drivers/gpu/drm/i915/intel_dp_mst.c           |   7 +-
 drivers/gpu/drm/i915/intel_sdvo.c             |   9 +-
 drivers/gpu/drm/i915/intel_tv.c               |   8 +-
 drivers/gpu/drm/nouveau/dispnv50/disp.c       |   5 +-
 drivers/gpu/drm/rcar-du/rcar_lvds.c           |  12 +-
 drivers/gpu/drm/rockchip/Makefile             |   3 +-
 .../gpu/drm/rockchip/analogix_dp-rockchip.c   | 106 ++++---
 drivers/gpu/drm/rockchip/rockchip_drm_fb.c    |  39 +--
 drivers/gpu/drm/rockchip/rockchip_drm_psr.c   | 290 -----------------
 drivers/gpu/drm/rockchip/rockchip_drm_psr.h   |  30 --
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c   |  84 ++++-
 drivers/gpu/drm/vc4/vc4_txp.c                 |   7 +-
 include/drm/bridge/analogix_dp.h              |   4 -
 include/drm/drm_atomic.h                      |  22 ++
 include/drm/drm_bridge.h                      | 106 +++++++
 include/drm/drm_connector.h                   |  19 ++
 include/drm/drm_crtc.h                        |  19 ++
 include/drm/drm_modeset_helper_vtables.h      |  50 ++-
 include/drm/drm_self_refresh_helper.h         |  22 ++
 31 files changed, 1066 insertions(+), 551 deletions(-)
 create mode 100644 drivers/gpu/drm/drm_self_refresh_helper.c
 delete mode 100644 drivers/gpu/drm/rockchip/rockchip_drm_psr.c
 delete mode 100644 drivers/gpu/drm/rockchip/rockchip_drm_psr.h
 create mode 100644 include/drm/drm_self_refresh_helper.h
    
Revision 4
      From: Sean Paul <seanpaul@chromium.org>

Back again with a new version. Very little has changed from v5, in fact
I was just going to resend patch 2, but I ran into some collisions while
rebasing. I figured I'd take the opportunity to collect and apply the
tags I've accumulated so far and send the whole thing again.

I need reviews on patch 2 and patches 6 through 11 (the rockchip bits).

Link to v4 cover: https://patchwork.freedesktop.org/patch/msgid/20190508160920.144739-1-sean@poorly.run

Thanks,

Sean


Laurent Pinchart (1):
  drm: Add drm_atomic_get_(old|new_connector_for_encoder() helpers

Sean Paul (10):
  drm: Add atomic variants of enable/disable to encoder helper funcs
  drm: Add atomic variants for bridge enable/disable
  drm: Convert connector_helper_funcs->atomic_check to accept
    drm_atomic_state
  drm: Add helpers to kick off self refresh mode in drivers
  drm/rockchip: Use dirtyfb helper
  drm/rockchip: Check for fast link training before enabling psr
  drm/rockchip: Use the helpers for PSR
  drm/rockchip: Use vop_win in vop_win_disable instead of vop_win_data
  drm/rockchip: Don't fully disable vop on self refresh
  drm/rockchip: Use drm_atomic_helper_commit_tail_rpm

 Documentation/gpu/drm-kms-helpers.rst         |   9 +
 drivers/gpu/drm/Makefile                      |   2 +-
 .../drm/bridge/analogix/analogix_dp_core.c    | 292 +++++++++++++-----
 .../drm/bridge/analogix/analogix_dp_core.h    |   2 +-
 drivers/gpu/drm/drm_atomic.c                  |  71 +++++
 drivers/gpu/drm/drm_atomic_helper.c           |  55 +++-
 drivers/gpu/drm/drm_atomic_state_helper.c     |   4 +
 drivers/gpu/drm/drm_atomic_uapi.c             |   7 +-
 drivers/gpu/drm/drm_bridge.c                  | 110 +++++++
 drivers/gpu/drm/drm_self_refresh_helper.c     | 213 +++++++++++++
 drivers/gpu/drm/i915/intel_atomic.c           |   8 +-
 drivers/gpu/drm/i915/intel_atomic.h           |   2 +-
 drivers/gpu/drm/i915/intel_dp_mst.c           |   7 +-
 drivers/gpu/drm/i915/intel_sdvo.c             |   9 +-
 drivers/gpu/drm/i915/intel_tv.c               |   8 +-
 drivers/gpu/drm/nouveau/dispnv50/disp.c       |   5 +-
 drivers/gpu/drm/rcar-du/rcar_lvds.c           |  12 +-
 drivers/gpu/drm/rockchip/Makefile             |   3 +-
 .../gpu/drm/rockchip/analogix_dp-rockchip.c   | 106 ++++---
 drivers/gpu/drm/rockchip/rockchip_drm_fb.c    |  39 +--
 drivers/gpu/drm/rockchip/rockchip_drm_psr.c   | 290 -----------------
 drivers/gpu/drm/rockchip/rockchip_drm_psr.h   |  30 --
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c   |  84 ++++-
 drivers/gpu/drm/vc4/vc4_txp.c                 |   7 +-
 include/drm/bridge/analogix_dp.h              |   4 -
 include/drm/drm_atomic.h                      |  22 ++
 include/drm/drm_bridge.h                      | 106 +++++++
 include/drm/drm_connector.h                   |  19 ++
 include/drm/drm_crtc.h                        |  19 ++
 include/drm/drm_modeset_helper_vtables.h      |  50 ++-
 include/drm/drm_self_refresh_helper.h         |  22 ++
 31 files changed, 1066 insertions(+), 551 deletions(-)
 create mode 100644 drivers/gpu/drm/drm_self_refresh_helper.c
 delete mode 100644 drivers/gpu/drm/rockchip/rockchip_drm_psr.c
 delete mode 100644 drivers/gpu/drm/rockchip/rockchip_drm_psr.h
 create mode 100644 include/drm/drm_self_refresh_helper.h
    
Revision 5
      From: Sean Paul <seanpaul@chromium.org>

Back again with a new version. Very little has changed from v5, in fact
I was just going to resend patch 2, but I ran into some collisions while
rebasing. I figured I'd take the opportunity to collect and apply the
tags I've accumulated so far and send the whole thing again.

I need reviews on patch 2 and patches 6 through 11 (the rockchip bits).

Link to v4 cover: https://patchwork.freedesktop.org/patch/msgid/20190508160920.144739-1-sean@poorly.run

Thanks,

Sean


Laurent Pinchart (1):
  drm: Add drm_atomic_get_(old|new_connector_for_encoder() helpers

Sean Paul (10):
  drm: Add atomic variants of enable/disable to encoder helper funcs
  drm: Add atomic variants for bridge enable/disable
  drm: Convert connector_helper_funcs->atomic_check to accept
    drm_atomic_state
  drm: Add helpers to kick off self refresh mode in drivers
  drm/rockchip: Use dirtyfb helper
  drm/rockchip: Check for fast link training before enabling psr
  drm/rockchip: Use the helpers for PSR
  drm/rockchip: Use vop_win in vop_win_disable instead of vop_win_data
  drm/rockchip: Don't fully disable vop on self refresh
  drm/rockchip: Use drm_atomic_helper_commit_tail_rpm

 Documentation/gpu/drm-kms-helpers.rst         |   9 +
 drivers/gpu/drm/Makefile                      |   2 +-
 .../drm/bridge/analogix/analogix_dp_core.c    | 292 +++++++++++++-----
 .../drm/bridge/analogix/analogix_dp_core.h    |   2 +-
 drivers/gpu/drm/drm_atomic.c                  |  71 +++++
 drivers/gpu/drm/drm_atomic_helper.c           |  55 +++-
 drivers/gpu/drm/drm_atomic_state_helper.c     |   4 +
 drivers/gpu/drm/drm_atomic_uapi.c             |   7 +-
 drivers/gpu/drm/drm_bridge.c                  | 110 +++++++
 drivers/gpu/drm/drm_self_refresh_helper.c     | 213 +++++++++++++
 drivers/gpu/drm/i915/intel_atomic.c           |   8 +-
 drivers/gpu/drm/i915/intel_atomic.h           |   2 +-
 drivers/gpu/drm/i915/intel_dp_mst.c           |   7 +-
 drivers/gpu/drm/i915/intel_sdvo.c             |   9 +-
 drivers/gpu/drm/i915/intel_tv.c               |   8 +-
 drivers/gpu/drm/nouveau/dispnv50/disp.c       |   5 +-
 drivers/gpu/drm/rcar-du/rcar_lvds.c           |  12 +-
 drivers/gpu/drm/rockchip/Makefile             |   3 +-
 .../gpu/drm/rockchip/analogix_dp-rockchip.c   | 106 ++++---
 drivers/gpu/drm/rockchip/rockchip_drm_fb.c    |  39 +--
 drivers/gpu/drm/rockchip/rockchip_drm_psr.c   | 290 -----------------
 drivers/gpu/drm/rockchip/rockchip_drm_psr.h   |  30 --
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c   |  84 ++++-
 drivers/gpu/drm/vc4/vc4_txp.c                 |   7 +-
 include/drm/bridge/analogix_dp.h              |   4 -
 include/drm/drm_atomic.h                      |  22 ++
 include/drm/drm_bridge.h                      | 106 +++++++
 include/drm/drm_connector.h                   |  19 ++
 include/drm/drm_crtc.h                        |  19 ++
 include/drm/drm_modeset_helper_vtables.h      |  50 ++-
 include/drm/drm_self_refresh_helper.h         |  22 ++
 31 files changed, 1066 insertions(+), 551 deletions(-)
 create mode 100644 drivers/gpu/drm/drm_self_refresh_helper.c
 delete mode 100644 drivers/gpu/drm/rockchip/rockchip_drm_psr.c
 delete mode 100644 drivers/gpu/drm/rockchip/rockchip_drm_psr.h
 create mode 100644 include/drm/drm_self_refresh_helper.h
    
Revision 6
      From: Sean Paul <seanpaul@chromium.org>

Back again with a new version. Very little has changed from v5, in fact
I was just going to resend patch 2, but I ran into some collisions while
rebasing. I figured I'd take the opportunity to collect and apply the
tags I've accumulated so far and send the whole thing again.

I need reviews on patch 2 and patches 6 through 11 (the rockchip bits).

Link to v4 cover: https://patchwork.freedesktop.org/patch/msgid/20190508160920.144739-1-sean@poorly.run

Thanks,

Sean


Laurent Pinchart (1):
  drm: Add drm_atomic_get_(old|new_connector_for_encoder() helpers

Sean Paul (10):
  drm: Add atomic variants of enable/disable to encoder helper funcs
  drm: Add atomic variants for bridge enable/disable
  drm: Convert connector_helper_funcs->atomic_check to accept
    drm_atomic_state
  drm: Add helpers to kick off self refresh mode in drivers
  drm/rockchip: Use dirtyfb helper
  drm/rockchip: Check for fast link training before enabling psr
  drm/rockchip: Use the helpers for PSR
  drm/rockchip: Use vop_win in vop_win_disable instead of vop_win_data
  drm/rockchip: Don't fully disable vop on self refresh
  drm/rockchip: Use drm_atomic_helper_commit_tail_rpm

 Documentation/gpu/drm-kms-helpers.rst         |   9 +
 drivers/gpu/drm/Makefile                      |   2 +-
 .../drm/bridge/analogix/analogix_dp_core.c    | 292 +++++++++++++-----
 .../drm/bridge/analogix/analogix_dp_core.h    |   2 +-
 drivers/gpu/drm/drm_atomic.c                  |  71 +++++
 drivers/gpu/drm/drm_atomic_helper.c           |  55 +++-
 drivers/gpu/drm/drm_atomic_state_helper.c     |   4 +
 drivers/gpu/drm/drm_atomic_uapi.c             |   7 +-
 drivers/gpu/drm/drm_bridge.c                  | 110 +++++++
 drivers/gpu/drm/drm_self_refresh_helper.c     | 213 +++++++++++++
 drivers/gpu/drm/i915/intel_atomic.c           |   8 +-
 drivers/gpu/drm/i915/intel_atomic.h           |   2 +-
 drivers/gpu/drm/i915/intel_dp_mst.c           |   7 +-
 drivers/gpu/drm/i915/intel_sdvo.c             |   9 +-
 drivers/gpu/drm/i915/intel_tv.c               |   8 +-
 drivers/gpu/drm/nouveau/dispnv50/disp.c       |   5 +-
 drivers/gpu/drm/rcar-du/rcar_lvds.c           |  12 +-
 drivers/gpu/drm/rockchip/Makefile             |   3 +-
 .../gpu/drm/rockchip/analogix_dp-rockchip.c   | 106 ++++---
 drivers/gpu/drm/rockchip/rockchip_drm_fb.c    |  39 +--
 drivers/gpu/drm/rockchip/rockchip_drm_psr.c   | 290 -----------------
 drivers/gpu/drm/rockchip/rockchip_drm_psr.h   |  30 --
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c   |  84 ++++-
 drivers/gpu/drm/vc4/vc4_txp.c                 |   7 +-
 include/drm/bridge/analogix_dp.h              |   4 -
 include/drm/drm_atomic.h                      |  22 ++
 include/drm/drm_bridge.h                      | 106 +++++++
 include/drm/drm_connector.h                   |  19 ++
 include/drm/drm_crtc.h                        |  19 ++
 include/drm/drm_modeset_helper_vtables.h      |  50 ++-
 include/drm/drm_self_refresh_helper.h         |  22 ++
 31 files changed, 1066 insertions(+), 551 deletions(-)
 create mode 100644 drivers/gpu/drm/drm_self_refresh_helper.c
 delete mode 100644 drivers/gpu/drm/rockchip/rockchip_drm_psr.c
 delete mode 100644 drivers/gpu/drm/rockchip/rockchip_drm_psr.h
 create mode 100644 include/drm/drm_self_refresh_helper.h
    

Revisions