Skip to content

drm: Clean up VBLANK callbacks in struct drm_driver

Thomas Zimmermann amd-gfx dri-devel intel-gfx linux-arm-msm nouveau 4 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest22 patches 9 repliesIn review
  2. v322 patches 7 repliesSuperseded
  3. v221 patches 9 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v123 patches22 repliesSuperseded

Changes in v4 from the cover letter

* fixed warnings and improved code readability (Ville, Jani)

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/22drm: Remove internal setup of struct drm_device.vblank_disable_immediatedrivers/gpu/drm/drm_vblank.c+0 -130 replies
2/22drm: Add get_scanout_position() to struct drm_crtc_helper_funcsdrivers/gpu/drm/drm_vblank.c include/drm/drm_drv.h include/drm/drm_modeset_helper_vtables.h +1 more+157 -231 reply
3/22drm: Add get_vblank_timestamp() to struct drm_crtc_funcsdrivers/gpu/drm/drm_vblank.c include/drm/drm_crtc.h include/drm/drm_modeset_helper_vtables.h +1 more+125 -170 replies
4/22drm/amdgpu: Convert to struct drm_crtc_helper_funcs.get_scanout_position()drivers/gpu/drm/amd/amdgpu/amdgpu_display.c drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h +6 more+24 -121 reply
5/22drm/amdgpu: Convert to CRTC VBLANK callbacksdrivers/gpu/drm/amd/amdgpu/amdgpu.h drivers/gpu/drm/amd/amdgpu/amdgpu_display.c drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +7 more+43 -221 reply
6/22drm/gma500: Convert to CRTC VBLANK callbacksdrivers/gpu/drm/gma500/cdv_intel_display.c drivers/gpu/drm/gma500/psb_drv.c drivers/gpu/drm/gma500/psb_drv.h +3 more+22 -130 replies
7/22drm/i915: Convert to CRTC VBLANK callbacksdrivers/gpu/drm/i915/display/intel_display.c drivers/gpu/drm/i915/i915_drv.c drivers/gpu/drm/i915/i915_irq.c +1 more+24 -120 replies
8/22drm/nouveau: Convert to struct drm_crtc_helper_funcs.get_scanout_position()drivers/gpu/drm/nouveau/dispnv04/crtc.c drivers/gpu/drm/nouveau/dispnv50/head.c drivers/gpu/drm/nouveau/nouveau_display.c +2 more+9 -151 reply
9/22drm/nouveau: Convert to CRTC VBLANK callbacksdrivers/gpu/drm/nouveau/dispnv04/crtc.c drivers/gpu/drm/nouveau/dispnv50/head.c drivers/gpu/drm/nouveau/nouveau_display.c +2 more+11 -181 reply
10/22drm/radeon: Convert to struct drm_crtc_helper_funcs.get_scanout_position()drivers/gpu/drm/radeon/atombios_crtc.c drivers/gpu/drm/radeon/radeon_display.c drivers/gpu/drm/radeon/radeon_drv.c +2 more+22 -121 reply
11/22drm/radeon: Convert to CRTC VBLANK callbacksdrivers/gpu/drm/radeon/radeon_display.c drivers/gpu/drm/radeon/radeon_drv.c drivers/gpu/drm/radeon/radeon_kms.c+26 -220 replies
12/22drm/msm: Convert to struct drm_crtc_helper_funcs.get_scanout_position()drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c+67 -610 replies
13/22drm/msm: Convert to CRTC VBLANK callbacksdrivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c drivers/gpu/drm/msm/disp/mdp4/mdp4_crtc.c drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c +3 more+28 -380 replies
14/22drm/stm: Convert to struct drm_crtc_helper_funcs.get_scanout_position()drivers/gpu/drm/stm/drv.c drivers/gpu/drm/stm/ltdc.c drivers/gpu/drm/stm/ltdc.h+34 -371 reply
15/22drm/stm: Convert to CRTC VBLANK callbacksdrivers/gpu/drm/stm/drv.c drivers/gpu/drm/stm/ltdc.c+1 -11 reply
16/22drm/sti: Convert to CRTC VBLANK callbacksdrivers/gpu/drm/sti/sti_crtc.c drivers/gpu/drm/sti/sti_crtc.h drivers/gpu/drm/sti/sti_drv.c+8 -90 replies
17/22drm/vc4: Convert to struct drm_crtc_helper_funcs.get_scanout_position()drivers/gpu/drm/vc4/vc4_crtc.c drivers/gpu/drm/vc4/vc4_drv.c drivers/gpu/drm/vc4/vc4_drv.h+7 -100 replies
18/22drm/vc4: Convert to CRTC VBLANK callbacksdrivers/gpu/drm/vc4/vc4_crtc.c drivers/gpu/drm/vc4/vc4_drv.c+1 -21 reply
19/22drm/vkms: Convert to CRTC VBLANK callbacksdrivers/gpu/drm/vkms/vkms_crtc.c drivers/gpu/drm/vkms/vkms_drv.c drivers/gpu/drm/vkms/vkms_drv.h+6 -80 replies
20/22drm/vmwgfx: Convert to CRTC VBLANK callbacksdrivers/gpu/drm/vmwgfx/vmwgfx_drv.c drivers/gpu/drm/vmwgfx/vmwgfx_drv.h drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +3 more+15 -90 replies
21/22drm: Clean-up VBLANK-related callbacks in struct drm_driverdrivers/gpu/drm/drm_vblank.c include/drm/drm_drv.h include/drm/drm_vblank.h+12 -2260 replies
22/22drm: Remove legacy version of get_scanout_position()drivers/gpu/drm/drm_vblank.c drivers/gpu/drm/i915/i915_irq.c include/drm/drm_vblank.h+9 -320 replies

Reviews trailers per patch

18 of 22 patches have a Reviewed-by or Acked-by.

PatchVille SyrjäläYannick FertréPatrik JakobssonJani NikulaAlex DeucherBenjamin GaignardRodrigo SiqueiraThomas HellstromDaniel VetterPhilippe CornuBen Skeggs
1/22R-b
2/22R-b T-b
3/22R-b
4/22R-b
5/22R-b
6/22A-b
7/22R-b A-b
8/22R-b
9/22R-b
10/22R-b
11/22R-b
12/22
13/22T-b
14/22T-b A-b
15/22T-b A-b
16/22A-b
17/22
18/22
19/22R-b T-b
20/22A-b
21/22T-b R-b
22/22R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 11 reviewers.

Read the v4 thread

Cover letter [PATCH v4 00/22] drm: Clean up VBLANK callbacks in struct drm_driver

VBLANK handlers in struct drm_driver are deprecated. Only legacy, non-KMS drivers are supposed to used them. DRM drivers with kernel modesetting are supposed to use VBLANK callbacks of the CRTC infrastructure.

This patchset converts all DRM drivers to CRTC VBLANK callbacks and cleans up struct drm_driver. The remaining VBLANK callbacks in struct drm_driver are only used by legacy drivers.

Patch 1 removes an additional setup step of vblank_disable_immediate in struct drm_device. This simplifies the integration of CRTC VBLANK callbacks in patch 3. If necessary, a future patch could move vblank_disable_immedate to struct drm_crtc, so that high-precision VBLANKs could be enabled on a per-CRTC basis.

Patches 2 and 3 prepare the DRM infrastructure. These patches add get_scanout_position() to struct drm_crtc_helper_funcs, get_vblank_timestamp() to struct drm_crtc_funcs, and add helpers for the new interfaces.

Patches 4 to 20 convert drivers over.

In patch 21, all VBLANK callbacks are removed from struct drm_driver, except for get_vblank_counter(), enable_vblank(), and disable_vblank(). These interfaces are moved to the legacy section at the end of the structure. Old helper code is now unused and being removed as well. Finally, patch 22 removes an older version of get_scanout_position() from the VBLANK interface.

To cover all affected drivers, I build the patchset in x86, x86-64, arm and aarch64. I smoke-tested amdgpu, gma500, i915, radeon and vc4 on respective hardware.

v4:
* fixed warnings and improved code readability (Ville, Jani)
v3:
* refactor drm_calc_vbltimestamp_from_scanout_pos to share code with new helper (Villa, Jani)
* do more checks for crtc != NULL to cover non-KMS drivers (Ville)
* add function typedefs for readability (Ville)
v2:
* reorder patches so the i915 can be converted without duplicating helper code.
* merged cleanup patches
* changed VBLANK function signatures in amdgpu (Alex)

Thomas Zimmermann (22):
drm: Remove internal setup of struct
drm_device.vblank_disable_immediate
drm: Add get_scanout_position() to struct drm_crtc_helper_funcs
drm: Add get_vblank_timestamp() to struct drm_crtc_funcs drm/amdgpu: Convert to struct
drm_crtc_helper_funcs.get_scanout_position()
drm/amdgpu: Convert to CRTC VBLANK callbacks drm/gma500: Convert to CRTC VBLANK callbacks drm/i915: Convert to CRTC VBLANK callbacks drm/nouveau: Convert to struct
drm_crtc_helper_funcs.get_scanout_position()
drm/nouveau: Convert to CRTC VBLANK callbacks drm/radeon: Convert to struct
drm_crtc_helper_funcs.get_scanout_position()
drm/radeon: Convert to CRTC VBLANK callbacks
drm/msm: Convert to struct
drm_crtc_helper_funcs.get_scanout_position()
drm/msm: Convert to CRTC VBLANK callbacks
drm/stm: Convert to struct
drm_crtc_helper_funcs.get_scanout_position()
drm/stm: Convert to CRTC VBLANK callbacks
drm/sti: Convert to CRTC VBLANK callbacks
drm/vc4: Convert to struct
drm_crtc_helper_funcs.get_scanout_position()
drm/vc4: Convert to CRTC VBLANK callbacks
drm/vkms: Convert to CRTC VBLANK callbacks drm/vmwgfx: Convert to CRTC VBLANK callbacks
drm: Clean-up VBLANK-related callbacks in struct drm_driver
drm: Remove legacy version of get_scanout_position()

 drivers/gpu/drm/amd/amdgpu/amdgpu.h           |   6 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_display.c   |  16 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c       |  15 --
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c       |  21 ++-
 drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h      |   5 +
 drivers/gpu/drm/amd/amdgpu/dce_v10_0.c        |   5 +
 drivers/gpu/drm/amd/amdgpu/dce_v11_0.c        |   5 +
 drivers/gpu/drm/amd/amdgpu/dce_v6_0.c         |   5 +
 drivers/gpu/drm/amd/amdgpu/dce_v8_0.c         |   5 +
 drivers/gpu/drm/amd/amdgpu/dce_virtual.c      |   5 +
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  13 +-
 drivers/gpu/drm/drm_vblank.c                  | 146 +++++++++-------
 drivers/gpu/drm/gma500/cdv_intel_display.c    |   3 +
 drivers/gpu/drm/gma500/psb_drv.c              |   4 -
 drivers/gpu/drm/gma500/psb_drv.h              |   6 +-
 drivers/gpu/drm/gma500/psb_intel_display.c    |   3 +
 drivers/gpu/drm/gma500/psb_irq.c              |  12 +-
 drivers/gpu/drm/gma500/psb_irq.h              |   7 +-
 drivers/gpu/drm/i915/display/intel_display.c  |   7 +
 drivers/gpu/drm/i915/i915_drv.c               |   3 -
 drivers/gpu/drm/i915/i915_irq.c               |  20 ++-
 drivers/gpu/drm/i915/i915_irq.h               |   6 +-
 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c      |   2 +
 drivers/gpu/drm/msm/disp/mdp4/mdp4_crtc.c     |   2 +
 drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c     |  82 +++++++++
 drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c      |  95 -----------
 drivers/gpu/drm/msm/msm_drv.c                 |  10 +-
 drivers/gpu/drm/msm/msm_drv.h                 |   3 +
 drivers/gpu/drm/nouveau/dispnv04/crtc.c       |   4 +
 drivers/gpu/drm/nouveau/dispnv50/head.c       |   5 +
 drivers/gpu/drm/nouveau/nouveau_display.c     |  28 +---
 drivers/gpu/drm/nouveau/nouveau_display.h     |  11 +-
 drivers/gpu/drm/nouveau/nouveau_drm.c         |   5 -
 drivers/gpu/drm/radeon/atombios_crtc.c        |   1 +
 drivers/gpu/drm/radeon/radeon_display.c       |  25 ++-
 drivers/gpu/drm/radeon/radeon_drv.c           |  18 --
 drivers/gpu/drm/radeon/radeon_kms.c           |  29 ++--
 drivers/gpu/drm/radeon/radeon_legacy_crtc.c   |   3 +-
 drivers/gpu/drm/radeon/radeon_mode.h          |   6 +
 drivers/gpu/drm/sti/sti_crtc.c                |  11 +-
 drivers/gpu/drm/sti/sti_crtc.h                |   2 -
 drivers/gpu/drm/sti/sti_drv.c                 |   4 -
 drivers/gpu/drm/stm/drv.c                     |   2 -
 drivers/gpu/drm/stm/ltdc.c                    |  66 ++++----
 drivers/gpu/drm/stm/ltdc.h                    |   5 -
 drivers/gpu/drm/vc4/vc4_crtc.c                |  13 +-
 drivers/gpu/drm/vc4/vc4_drv.c                 |   3 -
 drivers/gpu/drm/vc4/vc4_drv.h                 |   4 -
 drivers/gpu/drm/vkms/vkms_crtc.c              |   9 +-
 drivers/gpu/drm/vkms/vkms_drv.c               |   1 -
 drivers/gpu/drm/vkms/vkms_drv.h               |   4 -
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.c           |   3 -
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.h           |   6 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c           |   6 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c           |   3 +
 drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c          |   3 +
 drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c          |   3 +
 include/drm/drm_crtc.h                        |  46 +++++-
 include/drm/drm_drv.h                         | 156 +-----------------
 include/drm/drm_modeset_helper_vtables.h      |  47 ++++++
 include/drm/drm_vblank.h                      |  35 +++-
 61 files changed, 559 insertions(+), 520 deletions(-)