All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/23] drm: Clean up VBLANK callbacks in struct drm_driver
@ 2020-01-10  9:21 ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: dri-devel, amd-gfx, intel-gfx, linux-arm-msm, freedreno, nouveau,
	Thomas Zimmermann

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.

Patches 1 to 9 move get_scanout_position() to struct drm_crtc_helper_funcs
and convert drivers over. The callback is a helper for the default
implementation of get_vblank_timestamp() (i.e.,
drm_calc_vbltimestamp_from_scanoutpos()). The original callback is removed
from struct drm_driver.

Patch 10 changes the VBLANK code to evaluate vblank_disable_immediate in
struct derm_device. This simplifies the later integration of CRTC VBLANK
callbacks. 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 11 to 23 move get_vblank_timestamp() to struct drm_crtc_funcs
and convert DRM drivers over. 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.

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.

Thomas Zimmermann (23):
  drm: Add get_scanout_position() to struct drm_crtc_helper_funcs
  drm/amdgpu: Convert to struct
    drm_crtc_helper_funcs.get_scanout_position()
  drm/i915: Don't use struct drm_driver.get_scanout_position()
  drm/nouveau: Convert to struct
    drm_crtc_helper_funcs.get_scanout_position()
  drm/radeon: Convert to struct
    drm_crtc_helper_funcs.get_scanout_position()
  drm/msm: Convert to struct
    drm_crtc_helper_funcs.get_scanout_position()
  drm/vc4: Convert to struct
    drm_crtc_helper_funcs.get_scanout_position()
  drm/stm: Convert to struct
    drm_crtc_helper_funcs.get_scanout_position()
  drm: Remove struct drm_driver.get_scanout_position()
  drm: Evaluate struct drm_device.vblank_disable_immediate on each use
  drm: Add get_vblank_timestamp() to struct drm_crtc_funcs
  drm/amdgpu: Convert to CRTC VBLANK callbacks
  drm/gma500: Convert to CRTC VBLANK callbacks
  drm/i915: Convert to CRTC VBLANK callbacks
  drm/msm: Convert to CRTC VBLANK callbacks
  drm/nouveau: Convert to CRTC VBLANK callbacks
  drm/radeon: Convert to CRTC VBLANK callbacks
  drm/sti: Convert to CRTC VBLANK callbacks
  drm/stm: Convert to CRTC VBLANK callbacks
  drm/vc4: Convert to CRTC VBLANK callbacks
  drm/vkms: Convert to CRTC VBLANK callbacks
  drm/vmwgfx: Convert to CRTC VBLANK callbacks
  drm: Cleanup VBLANK callbacks in struct drm_driver

 drivers/gpu/drm/amd/amdgpu/amdgpu.h           |   3 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_display.c   |  12 ++
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c       |  15 --
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c       |  24 +++
 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 |   5 +-
 drivers/gpu/drm/drm_vblank.c                  | 128 +++++++++-----
 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               | 110 +++++++++++-
 drivers/gpu/drm/i915/i915_irq.h               |   8 +-
 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     |   6 +-
 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                 |   3 -
 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           |   5 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.h           |   6 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c           |   8 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c           |   3 +
 drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c          |   5 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c          |   3 +
 include/drm/drm_crtc.h                        |  41 +++++
 include/drm/drm_drv.h                         | 156 +-----------------
 include/drm/drm_modeset_helper_vtables.h      |  47 ++++++
 include/drm/drm_vblank.h                      |   4 +
 61 files changed, 631 insertions(+), 474 deletions(-)

--
2.24.1


^ permalink raw reply	[flat|nested] 217+ messages in thread

* [PATCH 00/23] drm: Clean up VBLANK callbacks in struct drm_driver
@ 2020-01-10  9:21 ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: dri-devel, amd-gfx, intel-gfx, linux-arm-msm, freedreno, nouveau,
	Thomas Zimmermann

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.

Patches 1 to 9 move get_scanout_position() to struct drm_crtc_helper_funcs
and convert drivers over. The callback is a helper for the default
implementation of get_vblank_timestamp() (i.e.,
drm_calc_vbltimestamp_from_scanoutpos()). The original callback is removed
from struct drm_driver.

Patch 10 changes the VBLANK code to evaluate vblank_disable_immediate in
struct derm_device. This simplifies the later integration of CRTC VBLANK
callbacks. 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 11 to 23 move get_vblank_timestamp() to struct drm_crtc_funcs
and convert DRM drivers over. 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.

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.

Thomas Zimmermann (23):
  drm: Add get_scanout_position() to struct drm_crtc_helper_funcs
  drm/amdgpu: Convert to struct
    drm_crtc_helper_funcs.get_scanout_position()
  drm/i915: Don't use struct drm_driver.get_scanout_position()
  drm/nouveau: Convert to struct
    drm_crtc_helper_funcs.get_scanout_position()
  drm/radeon: Convert to struct
    drm_crtc_helper_funcs.get_scanout_position()
  drm/msm: Convert to struct
    drm_crtc_helper_funcs.get_scanout_position()
  drm/vc4: Convert to struct
    drm_crtc_helper_funcs.get_scanout_position()
  drm/stm: Convert to struct
    drm_crtc_helper_funcs.get_scanout_position()
  drm: Remove struct drm_driver.get_scanout_position()
  drm: Evaluate struct drm_device.vblank_disable_immediate on each use
  drm: Add get_vblank_timestamp() to struct drm_crtc_funcs
  drm/amdgpu: Convert to CRTC VBLANK callbacks
  drm/gma500: Convert to CRTC VBLANK callbacks
  drm/i915: Convert to CRTC VBLANK callbacks
  drm/msm: Convert to CRTC VBLANK callbacks
  drm/nouveau: Convert to CRTC VBLANK callbacks
  drm/radeon: Convert to CRTC VBLANK callbacks
  drm/sti: Convert to CRTC VBLANK callbacks
  drm/stm: Convert to CRTC VBLANK callbacks
  drm/vc4: Convert to CRTC VBLANK callbacks
  drm/vkms: Convert to CRTC VBLANK callbacks
  drm/vmwgfx: Convert to CRTC VBLANK callbacks
  drm: Cleanup VBLANK callbacks in struct drm_driver

 drivers/gpu/drm/amd/amdgpu/amdgpu.h           |   3 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_display.c   |  12 ++
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c       |  15 --
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c       |  24 +++
 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 |   5 +-
 drivers/gpu/drm/drm_vblank.c                  | 128 +++++++++-----
 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               | 110 +++++++++++-
 drivers/gpu/drm/i915/i915_irq.h               |   8 +-
 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     |   6 +-
 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                 |   3 -
 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           |   5 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.h           |   6 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c           |   8 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c           |   3 +
 drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c          |   5 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c          |   3 +
 include/drm/drm_crtc.h                        |  41 +++++
 include/drm/drm_drv.h                         | 156 +-----------------
 include/drm/drm_modeset_helper_vtables.h      |  47 ++++++
 include/drm/drm_vblank.h                      |   4 +
 61 files changed, 631 insertions(+), 474 deletions(-)

^ permalink raw reply	[flat|nested] 217+ messages in thread

* [PATCH 00/23] drm: Clean up VBLANK callbacks in struct drm_driver
@ 2020-01-10  9:21 ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

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.

Patches 1 to 9 move get_scanout_position() to struct drm_crtc_helper_funcs
and convert drivers over. The callback is a helper for the default
implementation of get_vblank_timestamp() (i.e.,
drm_calc_vbltimestamp_from_scanoutpos()). The original callback is removed
from struct drm_driver.

Patch 10 changes the VBLANK code to evaluate vblank_disable_immediate in
struct derm_device. This simplifies the later integration of CRTC VBLANK
callbacks. 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 11 to 23 move get_vblank_timestamp() to struct drm_crtc_funcs
and convert DRM drivers over. 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.

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.

Thomas Zimmermann (23):
  drm: Add get_scanout_position() to struct drm_crtc_helper_funcs
  drm/amdgpu: Convert to struct
    drm_crtc_helper_funcs.get_scanout_position()
  drm/i915: Don't use struct drm_driver.get_scanout_position()
  drm/nouveau: Convert to struct
    drm_crtc_helper_funcs.get_scanout_position()
  drm/radeon: Convert to struct
    drm_crtc_helper_funcs.get_scanout_position()
  drm/msm: Convert to struct
    drm_crtc_helper_funcs.get_scanout_position()
  drm/vc4: Convert to struct
    drm_crtc_helper_funcs.get_scanout_position()
  drm/stm: Convert to struct
    drm_crtc_helper_funcs.get_scanout_position()
  drm: Remove struct drm_driver.get_scanout_position()
  drm: Evaluate struct drm_device.vblank_disable_immediate on each use
  drm: Add get_vblank_timestamp() to struct drm_crtc_funcs
  drm/amdgpu: Convert to CRTC VBLANK callbacks
  drm/gma500: Convert to CRTC VBLANK callbacks
  drm/i915: Convert to CRTC VBLANK callbacks
  drm/msm: Convert to CRTC VBLANK callbacks
  drm/nouveau: Convert to CRTC VBLANK callbacks
  drm/radeon: Convert to CRTC VBLANK callbacks
  drm/sti: Convert to CRTC VBLANK callbacks
  drm/stm: Convert to CRTC VBLANK callbacks
  drm/vc4: Convert to CRTC VBLANK callbacks
  drm/vkms: Convert to CRTC VBLANK callbacks
  drm/vmwgfx: Convert to CRTC VBLANK callbacks
  drm: Cleanup VBLANK callbacks in struct drm_driver

 drivers/gpu/drm/amd/amdgpu/amdgpu.h           |   3 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_display.c   |  12 ++
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c       |  15 --
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c       |  24 +++
 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 |   5 +-
 drivers/gpu/drm/drm_vblank.c                  | 128 +++++++++-----
 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               | 110 +++++++++++-
 drivers/gpu/drm/i915/i915_irq.h               |   8 +-
 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     |   6 +-
 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                 |   3 -
 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           |   5 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.h           |   6 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c           |   8 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c           |   3 +
 drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c          |   5 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c          |   3 +
 include/drm/drm_crtc.h                        |  41 +++++
 include/drm/drm_drv.h                         | 156 +-----------------
 include/drm/drm_modeset_helper_vtables.h      |  47 ++++++
 include/drm/drm_vblank.h                      |   4 +
 61 files changed, 631 insertions(+), 474 deletions(-)

--
2.24.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 217+ messages in thread

* [Intel-gfx] [PATCH 00/23] drm: Clean up VBLANK callbacks in struct drm_driver
@ 2020-01-10  9:21 ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

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.

Patches 1 to 9 move get_scanout_position() to struct drm_crtc_helper_funcs
and convert drivers over. The callback is a helper for the default
implementation of get_vblank_timestamp() (i.e.,
drm_calc_vbltimestamp_from_scanoutpos()). The original callback is removed
from struct drm_driver.

Patch 10 changes the VBLANK code to evaluate vblank_disable_immediate in
struct derm_device. This simplifies the later integration of CRTC VBLANK
callbacks. 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 11 to 23 move get_vblank_timestamp() to struct drm_crtc_funcs
and convert DRM drivers over. 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.

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.

Thomas Zimmermann (23):
  drm: Add get_scanout_position() to struct drm_crtc_helper_funcs
  drm/amdgpu: Convert to struct
    drm_crtc_helper_funcs.get_scanout_position()
  drm/i915: Don't use struct drm_driver.get_scanout_position()
  drm/nouveau: Convert to struct
    drm_crtc_helper_funcs.get_scanout_position()
  drm/radeon: Convert to struct
    drm_crtc_helper_funcs.get_scanout_position()
  drm/msm: Convert to struct
    drm_crtc_helper_funcs.get_scanout_position()
  drm/vc4: Convert to struct
    drm_crtc_helper_funcs.get_scanout_position()
  drm/stm: Convert to struct
    drm_crtc_helper_funcs.get_scanout_position()
  drm: Remove struct drm_driver.get_scanout_position()
  drm: Evaluate struct drm_device.vblank_disable_immediate on each use
  drm: Add get_vblank_timestamp() to struct drm_crtc_funcs
  drm/amdgpu: Convert to CRTC VBLANK callbacks
  drm/gma500: Convert to CRTC VBLANK callbacks
  drm/i915: Convert to CRTC VBLANK callbacks
  drm/msm: Convert to CRTC VBLANK callbacks
  drm/nouveau: Convert to CRTC VBLANK callbacks
  drm/radeon: Convert to CRTC VBLANK callbacks
  drm/sti: Convert to CRTC VBLANK callbacks
  drm/stm: Convert to CRTC VBLANK callbacks
  drm/vc4: Convert to CRTC VBLANK callbacks
  drm/vkms: Convert to CRTC VBLANK callbacks
  drm/vmwgfx: Convert to CRTC VBLANK callbacks
  drm: Cleanup VBLANK callbacks in struct drm_driver

 drivers/gpu/drm/amd/amdgpu/amdgpu.h           |   3 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_display.c   |  12 ++
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c       |  15 --
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c       |  24 +++
 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 |   5 +-
 drivers/gpu/drm/drm_vblank.c                  | 128 +++++++++-----
 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               | 110 +++++++++++-
 drivers/gpu/drm/i915/i915_irq.h               |   8 +-
 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     |   6 +-
 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                 |   3 -
 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           |   5 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.h           |   6 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c           |   8 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c           |   3 +
 drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c          |   5 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c          |   3 +
 include/drm/drm_crtc.h                        |  41 +++++
 include/drm/drm_drv.h                         | 156 +-----------------
 include/drm/drm_modeset_helper_vtables.h      |  47 ++++++
 include/drm/drm_vblank.h                      |   4 +
 61 files changed, 631 insertions(+), 474 deletions(-)

--
2.24.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 217+ messages in thread

* [PATCH 00/23] drm: Clean up VBLANK callbacks in struct drm_driver
@ 2020-01-10  9:21 ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

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.

Patches 1 to 9 move get_scanout_position() to struct drm_crtc_helper_funcs
and convert drivers over. The callback is a helper for the default
implementation of get_vblank_timestamp() (i.e.,
drm_calc_vbltimestamp_from_scanoutpos()). The original callback is removed
from struct drm_driver.

Patch 10 changes the VBLANK code to evaluate vblank_disable_immediate in
struct derm_device. This simplifies the later integration of CRTC VBLANK
callbacks. 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 11 to 23 move get_vblank_timestamp() to struct drm_crtc_funcs
and convert DRM drivers over. 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.

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.

Thomas Zimmermann (23):
  drm: Add get_scanout_position() to struct drm_crtc_helper_funcs
  drm/amdgpu: Convert to struct
    drm_crtc_helper_funcs.get_scanout_position()
  drm/i915: Don't use struct drm_driver.get_scanout_position()
  drm/nouveau: Convert to struct
    drm_crtc_helper_funcs.get_scanout_position()
  drm/radeon: Convert to struct
    drm_crtc_helper_funcs.get_scanout_position()
  drm/msm: Convert to struct
    drm_crtc_helper_funcs.get_scanout_position()
  drm/vc4: Convert to struct
    drm_crtc_helper_funcs.get_scanout_position()
  drm/stm: Convert to struct
    drm_crtc_helper_funcs.get_scanout_position()
  drm: Remove struct drm_driver.get_scanout_position()
  drm: Evaluate struct drm_device.vblank_disable_immediate on each use
  drm: Add get_vblank_timestamp() to struct drm_crtc_funcs
  drm/amdgpu: Convert to CRTC VBLANK callbacks
  drm/gma500: Convert to CRTC VBLANK callbacks
  drm/i915: Convert to CRTC VBLANK callbacks
  drm/msm: Convert to CRTC VBLANK callbacks
  drm/nouveau: Convert to CRTC VBLANK callbacks
  drm/radeon: Convert to CRTC VBLANK callbacks
  drm/sti: Convert to CRTC VBLANK callbacks
  drm/stm: Convert to CRTC VBLANK callbacks
  drm/vc4: Convert to CRTC VBLANK callbacks
  drm/vkms: Convert to CRTC VBLANK callbacks
  drm/vmwgfx: Convert to CRTC VBLANK callbacks
  drm: Cleanup VBLANK callbacks in struct drm_driver

 drivers/gpu/drm/amd/amdgpu/amdgpu.h           |   3 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_display.c   |  12 ++
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c       |  15 --
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c       |  24 +++
 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 |   5 +-
 drivers/gpu/drm/drm_vblank.c                  | 128 +++++++++-----
 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               | 110 +++++++++++-
 drivers/gpu/drm/i915/i915_irq.h               |   8 +-
 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     |   6 +-
 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                 |   3 -
 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           |   5 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.h           |   6 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c           |   8 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c           |   3 +
 drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c          |   5 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c          |   3 +
 include/drm/drm_crtc.h                        |  41 +++++
 include/drm/drm_drv.h                         | 156 +-----------------
 include/drm/drm_modeset_helper_vtables.h      |  47 ++++++
 include/drm/drm_vblank.h                      |   4 +
 61 files changed, 631 insertions(+), 474 deletions(-)

--
2.24.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 217+ messages in thread

* [PATCH 01/23] drm: Add get_scanout_position() to struct drm_crtc_helper_funcs
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: dri-devel, amd-gfx, intel-gfx, linux-arm-msm, freedreno, nouveau,
	Thomas Zimmermann

The new callback get_scanout_position() reads the current location of
the scanout process. The operation is currentyl located in struct
drm_driver, but really belongs to the CRTC. Drivers will be converted
in separate patches.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/drm_vblank.c             | 24 ++++++++----
 include/drm/drm_drv.h                    |  7 +---
 include/drm/drm_modeset_helper_vtables.h | 47 ++++++++++++++++++++++++
 3 files changed, 65 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
index 1659b13b178c..c12f0b333e14 100644
--- a/drivers/gpu/drm/drm_vblank.c
+++ b/drivers/gpu/drm/drm_vblank.c
@@ -30,6 +30,7 @@
 #include <drm/drm_crtc.h>
 #include <drm/drm_drv.h>
 #include <drm/drm_framebuffer.h>
+#include <drm/drm_modeset_helper_vtables.h>
 #include <drm/drm_print.h>
 #include <drm/drm_vblank.h>
 
@@ -590,7 +591,7 @@ EXPORT_SYMBOL(drm_calc_timestamping_constants);
  * Implements calculation of exact vblank timestamps from given drm_display_mode
  * timings and current video scanout position of a CRTC. This can be directly
  * used as the &drm_driver.get_vblank_timestamp implementation of a kms driver
- * if &drm_driver.get_scanout_position is implemented.
+ * if &drm_crtc_helper_funcs.get_scanout_position is implemented.
  *
  * The current implementation only handles standard video modes. For double scan
  * and interlaced modes the driver is supposed to adjust the hardware mode
@@ -632,8 +633,9 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
 	}
 
 	/* Scanout position query not supported? Should not happen. */
-	if (!dev->driver->get_scanout_position) {
-		DRM_ERROR("Called from driver w/o get_scanout_position()!?\n");
+	if (!dev->driver->get_scanout_position ||
+	    !crtc->helper_private->get_scanout_position) {
+		DRM_ERROR("Called from CRTC w/o get_scanout_position()!?\n");
 		return false;
 	}
 
@@ -664,11 +666,17 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
 		 * Get vertical and horizontal scanout position vpos, hpos,
 		 * and bounding timestamps stime, etime, pre/post query.
 		 */
-		vbl_status = dev->driver->get_scanout_position(dev, pipe,
-							       in_vblank_irq,
-							       &vpos, &hpos,
-							       &stime, &etime,
-							       mode);
+		if (crtc->helper_private->get_scanout_position) {
+			vbl_status =
+				crtc->helper_private->get_scanout_position(
+					crtc, in_vblank_irq, &vpos, &hpos,
+					&stime, &etime, mode);
+		} else {
+			vbl_status =
+				dev->driver->get_scanout_position(
+					dev, pipe, in_vblank_irq, &vpos,
+					&hpos, &stime, &etime, mode);
+		}
 
 		/* Return as no-op if scanout query unsupported or failed. */
 		if (!vbl_status) {
diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
index cf13470810a5..d0049e5786fc 100644
--- a/include/drm/drm_drv.h
+++ b/include/drm/drm_drv.h
@@ -362,11 +362,8 @@ struct drm_driver {
 	 * True on success, false if a reliable scanout position counter could
 	 * not be read out.
 	 *
-	 * FIXME:
-	 *
-	 * Since this is a helper to implement @get_vblank_timestamp, we should
-	 * move it to &struct drm_crtc_helper_funcs, like all the other
-	 * helper-internal hooks.
+	 * This is deprecated and should not be used by new drivers.
+	 * Use &drm_crtc_helper_funcs.get_scanout_position instead.
 	 */
 	bool (*get_scanout_position) (struct drm_device *dev, unsigned int pipe,
 				      bool in_vblank_irq, int *vpos, int *hpos,
diff --git a/include/drm/drm_modeset_helper_vtables.h b/include/drm/drm_modeset_helper_vtables.h
index 5a87f1bd7a3f..e398512bfd5f 100644
--- a/include/drm/drm_modeset_helper_vtables.h
+++ b/include/drm/drm_modeset_helper_vtables.h
@@ -450,6 +450,53 @@ struct drm_crtc_helper_funcs {
 	 */
 	void (*atomic_disable)(struct drm_crtc *crtc,
 			       struct drm_crtc_state *old_crtc_state);
+
+	/**
+	 * @get_scanout_position:
+	 *
+	 * Called by vblank timestamping code.
+	 *
+	 * Returns the current display scanout position from a CRTC and an
+	 * optional accurate ktime_get() timestamp of when the position was
+	 * measured. Note that this is a helper callback which is only used
+	 * if a driver uses drm_calc_vbltimestamp_from_scanoutpos() for the
+	 * @drm_driver.get_vblank_timestamp callback.
+	 *
+	 * Parameters:
+	 *
+	 * crtc:
+	 *     The CRTC.
+	 * in_vblank_irq:
+	 *     True when called from drm_crtc_handle_vblank(). Some drivers
+	 *     need to apply some workarounds for gpu-specific vblank irq
+	 *     quirks if the flag is set.
+	 * vpos:
+	 *     Target location for current vertical scanout position.
+	 * hpos:
+	 *     Target location for current horizontal scanout position.
+	 * stime:
+	 *     Target location for timestamp taken immediately before
+	 *     scanout position query. Can be NULL to skip timestamp.
+	 * etime:
+	 *     Target location for timestamp taken immediately after
+	 *     scanout position query. Can be NULL to skip timestamp.
+	 * mode:
+	 *     Current display timings.
+	 *
+	 * Returns vpos as a positive number while in active scanout area.
+	 * Returns vpos as a negative number inside vblank, counting the number
+	 * of scanlines to go until end of vblank, e.g., -1 means "one scanline
+	 * until start of active scanout / end of vblank."
+	 *
+	 * Returns:
+	 *
+	 * True on success, false if a reliable scanout position counter could
+	 * not be read out.
+	 */
+	bool (*get_scanout_position)(struct drm_crtc *crtc,
+				     bool in_vblank_irq, int *vpos, int *hpos,
+				     ktime_t *stime, ktime_t *etime,
+				     const struct drm_display_mode *mode);
 };
 
 /**
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 01/23] drm: Add get_scanout_position() to struct drm_crtc_helper_funcs
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied-cv59FeDIM0c, daniel-/w4YWyX8dFk,
	alexander.deucher-5C7GfCeVMHo, christian.koenig-5C7GfCeVMHo,
	David1.Zhou-5C7GfCeVMHo,
	maarten.lankhorst-VuQAYsv1563Yd54FQh9/CA,
	patrik.r.jakobsson-Re5JQEeQqe8AvxtiuMwx3w,
	robdclark-Re5JQEeQqe8AvxtiuMwx3w, sean-p7yTbzM4H96eqtR555YLDQ,
	benjamin.gaignard-QSEj5FYQhm4dnm+yROfE0A,
	vincent.abriou-qxv4g6HH51o, yannick.fertre-qxv4g6HH51o,
	philippe.cornu-qxv4g6HH51o,
	mcoquelin.stm32-Re5JQEeQqe8AvxtiuMwx3w,
	alexandre.torgue-qxv4g6HH51o, eric-WhKQ6XTQaPysTnJN9+BGXg,
	rodrigosiqueiramelo-Re5JQEeQqe8AvxtiuMwx3w,
	hamohammed.sa-Re5JQEeQqe8AvxtiuMwx3w,
	linux-graphics-maintainer-pghWNbHTmq7QT0dZR+AlfA,
	thellstrom-pghWNbHTmq7QT0dZR+AlfA,
	bskeggs-H+wXaHxf7aLQT0dZR+AlfA, harry.wentland-5C7GfCeVMHo,
	sunpeng.li-5C7GfCeVMHo, jani.nikula-VuQAYsv1563Yd54FQh9/CA,
	joonas.lahtinen-VuQAYsv1563Yd54FQh9/CA,
	rodrigo.vivi-ral2JQCrhuEAvxtiuMwx3w
  Cc: linux-arm-msm-u79uwXL29TY76Z2rM5mHXA,
	intel-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Thomas Zimmermann,
	nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

The new callback get_scanout_position() reads the current location of
the scanout process. The operation is currentyl located in struct
drm_driver, but really belongs to the CRTC. Drivers will be converted
in separate patches.

Signed-off-by: Thomas Zimmermann <tzimmermann-l3A5Bk7waGM@public.gmane.org>
---
 drivers/gpu/drm/drm_vblank.c             | 24 ++++++++----
 include/drm/drm_drv.h                    |  7 +---
 include/drm/drm_modeset_helper_vtables.h | 47 ++++++++++++++++++++++++
 3 files changed, 65 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
index 1659b13b178c..c12f0b333e14 100644
--- a/drivers/gpu/drm/drm_vblank.c
+++ b/drivers/gpu/drm/drm_vblank.c
@@ -30,6 +30,7 @@
 #include <drm/drm_crtc.h>
 #include <drm/drm_drv.h>
 #include <drm/drm_framebuffer.h>
+#include <drm/drm_modeset_helper_vtables.h>
 #include <drm/drm_print.h>
 #include <drm/drm_vblank.h>
 
@@ -590,7 +591,7 @@ EXPORT_SYMBOL(drm_calc_timestamping_constants);
  * Implements calculation of exact vblank timestamps from given drm_display_mode
  * timings and current video scanout position of a CRTC. This can be directly
  * used as the &drm_driver.get_vblank_timestamp implementation of a kms driver
- * if &drm_driver.get_scanout_position is implemented.
+ * if &drm_crtc_helper_funcs.get_scanout_position is implemented.
  *
  * The current implementation only handles standard video modes. For double scan
  * and interlaced modes the driver is supposed to adjust the hardware mode
@@ -632,8 +633,9 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
 	}
 
 	/* Scanout position query not supported? Should not happen. */
-	if (!dev->driver->get_scanout_position) {
-		DRM_ERROR("Called from driver w/o get_scanout_position()!?\n");
+	if (!dev->driver->get_scanout_position ||
+	    !crtc->helper_private->get_scanout_position) {
+		DRM_ERROR("Called from CRTC w/o get_scanout_position()!?\n");
 		return false;
 	}
 
@@ -664,11 +666,17 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
 		 * Get vertical and horizontal scanout position vpos, hpos,
 		 * and bounding timestamps stime, etime, pre/post query.
 		 */
-		vbl_status = dev->driver->get_scanout_position(dev, pipe,
-							       in_vblank_irq,
-							       &vpos, &hpos,
-							       &stime, &etime,
-							       mode);
+		if (crtc->helper_private->get_scanout_position) {
+			vbl_status =
+				crtc->helper_private->get_scanout_position(
+					crtc, in_vblank_irq, &vpos, &hpos,
+					&stime, &etime, mode);
+		} else {
+			vbl_status =
+				dev->driver->get_scanout_position(
+					dev, pipe, in_vblank_irq, &vpos,
+					&hpos, &stime, &etime, mode);
+		}
 
 		/* Return as no-op if scanout query unsupported or failed. */
 		if (!vbl_status) {
diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
index cf13470810a5..d0049e5786fc 100644
--- a/include/drm/drm_drv.h
+++ b/include/drm/drm_drv.h
@@ -362,11 +362,8 @@ struct drm_driver {
 	 * True on success, false if a reliable scanout position counter could
 	 * not be read out.
 	 *
-	 * FIXME:
-	 *
-	 * Since this is a helper to implement @get_vblank_timestamp, we should
-	 * move it to &struct drm_crtc_helper_funcs, like all the other
-	 * helper-internal hooks.
+	 * This is deprecated and should not be used by new drivers.
+	 * Use &drm_crtc_helper_funcs.get_scanout_position instead.
 	 */
 	bool (*get_scanout_position) (struct drm_device *dev, unsigned int pipe,
 				      bool in_vblank_irq, int *vpos, int *hpos,
diff --git a/include/drm/drm_modeset_helper_vtables.h b/include/drm/drm_modeset_helper_vtables.h
index 5a87f1bd7a3f..e398512bfd5f 100644
--- a/include/drm/drm_modeset_helper_vtables.h
+++ b/include/drm/drm_modeset_helper_vtables.h
@@ -450,6 +450,53 @@ struct drm_crtc_helper_funcs {
 	 */
 	void (*atomic_disable)(struct drm_crtc *crtc,
 			       struct drm_crtc_state *old_crtc_state);
+
+	/**
+	 * @get_scanout_position:
+	 *
+	 * Called by vblank timestamping code.
+	 *
+	 * Returns the current display scanout position from a CRTC and an
+	 * optional accurate ktime_get() timestamp of when the position was
+	 * measured. Note that this is a helper callback which is only used
+	 * if a driver uses drm_calc_vbltimestamp_from_scanoutpos() for the
+	 * @drm_driver.get_vblank_timestamp callback.
+	 *
+	 * Parameters:
+	 *
+	 * crtc:
+	 *     The CRTC.
+	 * in_vblank_irq:
+	 *     True when called from drm_crtc_handle_vblank(). Some drivers
+	 *     need to apply some workarounds for gpu-specific vblank irq
+	 *     quirks if the flag is set.
+	 * vpos:
+	 *     Target location for current vertical scanout position.
+	 * hpos:
+	 *     Target location for current horizontal scanout position.
+	 * stime:
+	 *     Target location for timestamp taken immediately before
+	 *     scanout position query. Can be NULL to skip timestamp.
+	 * etime:
+	 *     Target location for timestamp taken immediately after
+	 *     scanout position query. Can be NULL to skip timestamp.
+	 * mode:
+	 *     Current display timings.
+	 *
+	 * Returns vpos as a positive number while in active scanout area.
+	 * Returns vpos as a negative number inside vblank, counting the number
+	 * of scanlines to go until end of vblank, e.g., -1 means "one scanline
+	 * until start of active scanout / end of vblank."
+	 *
+	 * Returns:
+	 *
+	 * True on success, false if a reliable scanout position counter could
+	 * not be read out.
+	 */
+	bool (*get_scanout_position)(struct drm_crtc *crtc,
+				     bool in_vblank_irq, int *vpos, int *hpos,
+				     ktime_t *stime, ktime_t *etime,
+				     const struct drm_display_mode *mode);
 };
 
 /**
-- 
2.24.1

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 01/23] drm: Add get_scanout_position() to struct drm_crtc_helper_funcs
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

The new callback get_scanout_position() reads the current location of
the scanout process. The operation is currentyl located in struct
drm_driver, but really belongs to the CRTC. Drivers will be converted
in separate patches.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/drm_vblank.c             | 24 ++++++++----
 include/drm/drm_drv.h                    |  7 +---
 include/drm/drm_modeset_helper_vtables.h | 47 ++++++++++++++++++++++++
 3 files changed, 65 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
index 1659b13b178c..c12f0b333e14 100644
--- a/drivers/gpu/drm/drm_vblank.c
+++ b/drivers/gpu/drm/drm_vblank.c
@@ -30,6 +30,7 @@
 #include <drm/drm_crtc.h>
 #include <drm/drm_drv.h>
 #include <drm/drm_framebuffer.h>
+#include <drm/drm_modeset_helper_vtables.h>
 #include <drm/drm_print.h>
 #include <drm/drm_vblank.h>
 
@@ -590,7 +591,7 @@ EXPORT_SYMBOL(drm_calc_timestamping_constants);
  * Implements calculation of exact vblank timestamps from given drm_display_mode
  * timings and current video scanout position of a CRTC. This can be directly
  * used as the &drm_driver.get_vblank_timestamp implementation of a kms driver
- * if &drm_driver.get_scanout_position is implemented.
+ * if &drm_crtc_helper_funcs.get_scanout_position is implemented.
  *
  * The current implementation only handles standard video modes. For double scan
  * and interlaced modes the driver is supposed to adjust the hardware mode
@@ -632,8 +633,9 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
 	}
 
 	/* Scanout position query not supported? Should not happen. */
-	if (!dev->driver->get_scanout_position) {
-		DRM_ERROR("Called from driver w/o get_scanout_position()!?\n");
+	if (!dev->driver->get_scanout_position ||
+	    !crtc->helper_private->get_scanout_position) {
+		DRM_ERROR("Called from CRTC w/o get_scanout_position()!?\n");
 		return false;
 	}
 
@@ -664,11 +666,17 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
 		 * Get vertical and horizontal scanout position vpos, hpos,
 		 * and bounding timestamps stime, etime, pre/post query.
 		 */
-		vbl_status = dev->driver->get_scanout_position(dev, pipe,
-							       in_vblank_irq,
-							       &vpos, &hpos,
-							       &stime, &etime,
-							       mode);
+		if (crtc->helper_private->get_scanout_position) {
+			vbl_status =
+				crtc->helper_private->get_scanout_position(
+					crtc, in_vblank_irq, &vpos, &hpos,
+					&stime, &etime, mode);
+		} else {
+			vbl_status =
+				dev->driver->get_scanout_position(
+					dev, pipe, in_vblank_irq, &vpos,
+					&hpos, &stime, &etime, mode);
+		}
 
 		/* Return as no-op if scanout query unsupported or failed. */
 		if (!vbl_status) {
diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
index cf13470810a5..d0049e5786fc 100644
--- a/include/drm/drm_drv.h
+++ b/include/drm/drm_drv.h
@@ -362,11 +362,8 @@ struct drm_driver {
 	 * True on success, false if a reliable scanout position counter could
 	 * not be read out.
 	 *
-	 * FIXME:
-	 *
-	 * Since this is a helper to implement @get_vblank_timestamp, we should
-	 * move it to &struct drm_crtc_helper_funcs, like all the other
-	 * helper-internal hooks.
+	 * This is deprecated and should not be used by new drivers.
+	 * Use &drm_crtc_helper_funcs.get_scanout_position instead.
 	 */
 	bool (*get_scanout_position) (struct drm_device *dev, unsigned int pipe,
 				      bool in_vblank_irq, int *vpos, int *hpos,
diff --git a/include/drm/drm_modeset_helper_vtables.h b/include/drm/drm_modeset_helper_vtables.h
index 5a87f1bd7a3f..e398512bfd5f 100644
--- a/include/drm/drm_modeset_helper_vtables.h
+++ b/include/drm/drm_modeset_helper_vtables.h
@@ -450,6 +450,53 @@ struct drm_crtc_helper_funcs {
 	 */
 	void (*atomic_disable)(struct drm_crtc *crtc,
 			       struct drm_crtc_state *old_crtc_state);
+
+	/**
+	 * @get_scanout_position:
+	 *
+	 * Called by vblank timestamping code.
+	 *
+	 * Returns the current display scanout position from a CRTC and an
+	 * optional accurate ktime_get() timestamp of when the position was
+	 * measured. Note that this is a helper callback which is only used
+	 * if a driver uses drm_calc_vbltimestamp_from_scanoutpos() for the
+	 * @drm_driver.get_vblank_timestamp callback.
+	 *
+	 * Parameters:
+	 *
+	 * crtc:
+	 *     The CRTC.
+	 * in_vblank_irq:
+	 *     True when called from drm_crtc_handle_vblank(). Some drivers
+	 *     need to apply some workarounds for gpu-specific vblank irq
+	 *     quirks if the flag is set.
+	 * vpos:
+	 *     Target location for current vertical scanout position.
+	 * hpos:
+	 *     Target location for current horizontal scanout position.
+	 * stime:
+	 *     Target location for timestamp taken immediately before
+	 *     scanout position query. Can be NULL to skip timestamp.
+	 * etime:
+	 *     Target location for timestamp taken immediately after
+	 *     scanout position query. Can be NULL to skip timestamp.
+	 * mode:
+	 *     Current display timings.
+	 *
+	 * Returns vpos as a positive number while in active scanout area.
+	 * Returns vpos as a negative number inside vblank, counting the number
+	 * of scanlines to go until end of vblank, e.g., -1 means "one scanline
+	 * until start of active scanout / end of vblank."
+	 *
+	 * Returns:
+	 *
+	 * True on success, false if a reliable scanout position counter could
+	 * not be read out.
+	 */
+	bool (*get_scanout_position)(struct drm_crtc *crtc,
+				     bool in_vblank_irq, int *vpos, int *hpos,
+				     ktime_t *stime, ktime_t *etime,
+				     const struct drm_display_mode *mode);
 };
 
 /**
-- 
2.24.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [Intel-gfx] [PATCH 01/23] drm: Add get_scanout_position() to struct drm_crtc_helper_funcs
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

The new callback get_scanout_position() reads the current location of
the scanout process. The operation is currentyl located in struct
drm_driver, but really belongs to the CRTC. Drivers will be converted
in separate patches.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/drm_vblank.c             | 24 ++++++++----
 include/drm/drm_drv.h                    |  7 +---
 include/drm/drm_modeset_helper_vtables.h | 47 ++++++++++++++++++++++++
 3 files changed, 65 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
index 1659b13b178c..c12f0b333e14 100644
--- a/drivers/gpu/drm/drm_vblank.c
+++ b/drivers/gpu/drm/drm_vblank.c
@@ -30,6 +30,7 @@
 #include <drm/drm_crtc.h>
 #include <drm/drm_drv.h>
 #include <drm/drm_framebuffer.h>
+#include <drm/drm_modeset_helper_vtables.h>
 #include <drm/drm_print.h>
 #include <drm/drm_vblank.h>
 
@@ -590,7 +591,7 @@ EXPORT_SYMBOL(drm_calc_timestamping_constants);
  * Implements calculation of exact vblank timestamps from given drm_display_mode
  * timings and current video scanout position of a CRTC. This can be directly
  * used as the &drm_driver.get_vblank_timestamp implementation of a kms driver
- * if &drm_driver.get_scanout_position is implemented.
+ * if &drm_crtc_helper_funcs.get_scanout_position is implemented.
  *
  * The current implementation only handles standard video modes. For double scan
  * and interlaced modes the driver is supposed to adjust the hardware mode
@@ -632,8 +633,9 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
 	}
 
 	/* Scanout position query not supported? Should not happen. */
-	if (!dev->driver->get_scanout_position) {
-		DRM_ERROR("Called from driver w/o get_scanout_position()!?\n");
+	if (!dev->driver->get_scanout_position ||
+	    !crtc->helper_private->get_scanout_position) {
+		DRM_ERROR("Called from CRTC w/o get_scanout_position()!?\n");
 		return false;
 	}
 
@@ -664,11 +666,17 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
 		 * Get vertical and horizontal scanout position vpos, hpos,
 		 * and bounding timestamps stime, etime, pre/post query.
 		 */
-		vbl_status = dev->driver->get_scanout_position(dev, pipe,
-							       in_vblank_irq,
-							       &vpos, &hpos,
-							       &stime, &etime,
-							       mode);
+		if (crtc->helper_private->get_scanout_position) {
+			vbl_status =
+				crtc->helper_private->get_scanout_position(
+					crtc, in_vblank_irq, &vpos, &hpos,
+					&stime, &etime, mode);
+		} else {
+			vbl_status =
+				dev->driver->get_scanout_position(
+					dev, pipe, in_vblank_irq, &vpos,
+					&hpos, &stime, &etime, mode);
+		}
 
 		/* Return as no-op if scanout query unsupported or failed. */
 		if (!vbl_status) {
diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
index cf13470810a5..d0049e5786fc 100644
--- a/include/drm/drm_drv.h
+++ b/include/drm/drm_drv.h
@@ -362,11 +362,8 @@ struct drm_driver {
 	 * True on success, false if a reliable scanout position counter could
 	 * not be read out.
 	 *
-	 * FIXME:
-	 *
-	 * Since this is a helper to implement @get_vblank_timestamp, we should
-	 * move it to &struct drm_crtc_helper_funcs, like all the other
-	 * helper-internal hooks.
+	 * This is deprecated and should not be used by new drivers.
+	 * Use &drm_crtc_helper_funcs.get_scanout_position instead.
 	 */
 	bool (*get_scanout_position) (struct drm_device *dev, unsigned int pipe,
 				      bool in_vblank_irq, int *vpos, int *hpos,
diff --git a/include/drm/drm_modeset_helper_vtables.h b/include/drm/drm_modeset_helper_vtables.h
index 5a87f1bd7a3f..e398512bfd5f 100644
--- a/include/drm/drm_modeset_helper_vtables.h
+++ b/include/drm/drm_modeset_helper_vtables.h
@@ -450,6 +450,53 @@ struct drm_crtc_helper_funcs {
 	 */
 	void (*atomic_disable)(struct drm_crtc *crtc,
 			       struct drm_crtc_state *old_crtc_state);
+
+	/**
+	 * @get_scanout_position:
+	 *
+	 * Called by vblank timestamping code.
+	 *
+	 * Returns the current display scanout position from a CRTC and an
+	 * optional accurate ktime_get() timestamp of when the position was
+	 * measured. Note that this is a helper callback which is only used
+	 * if a driver uses drm_calc_vbltimestamp_from_scanoutpos() for the
+	 * @drm_driver.get_vblank_timestamp callback.
+	 *
+	 * Parameters:
+	 *
+	 * crtc:
+	 *     The CRTC.
+	 * in_vblank_irq:
+	 *     True when called from drm_crtc_handle_vblank(). Some drivers
+	 *     need to apply some workarounds for gpu-specific vblank irq
+	 *     quirks if the flag is set.
+	 * vpos:
+	 *     Target location for current vertical scanout position.
+	 * hpos:
+	 *     Target location for current horizontal scanout position.
+	 * stime:
+	 *     Target location for timestamp taken immediately before
+	 *     scanout position query. Can be NULL to skip timestamp.
+	 * etime:
+	 *     Target location for timestamp taken immediately after
+	 *     scanout position query. Can be NULL to skip timestamp.
+	 * mode:
+	 *     Current display timings.
+	 *
+	 * Returns vpos as a positive number while in active scanout area.
+	 * Returns vpos as a negative number inside vblank, counting the number
+	 * of scanlines to go until end of vblank, e.g., -1 means "one scanline
+	 * until start of active scanout / end of vblank."
+	 *
+	 * Returns:
+	 *
+	 * True on success, false if a reliable scanout position counter could
+	 * not be read out.
+	 */
+	bool (*get_scanout_position)(struct drm_crtc *crtc,
+				     bool in_vblank_irq, int *vpos, int *hpos,
+				     ktime_t *stime, ktime_t *etime,
+				     const struct drm_display_mode *mode);
 };
 
 /**
-- 
2.24.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 01/23] drm: Add get_scanout_position() to struct drm_crtc_helper_funcs
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

The new callback get_scanout_position() reads the current location of
the scanout process. The operation is currentyl located in struct
drm_driver, but really belongs to the CRTC. Drivers will be converted
in separate patches.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/drm_vblank.c             | 24 ++++++++----
 include/drm/drm_drv.h                    |  7 +---
 include/drm/drm_modeset_helper_vtables.h | 47 ++++++++++++++++++++++++
 3 files changed, 65 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
index 1659b13b178c..c12f0b333e14 100644
--- a/drivers/gpu/drm/drm_vblank.c
+++ b/drivers/gpu/drm/drm_vblank.c
@@ -30,6 +30,7 @@
 #include <drm/drm_crtc.h>
 #include <drm/drm_drv.h>
 #include <drm/drm_framebuffer.h>
+#include <drm/drm_modeset_helper_vtables.h>
 #include <drm/drm_print.h>
 #include <drm/drm_vblank.h>
 
@@ -590,7 +591,7 @@ EXPORT_SYMBOL(drm_calc_timestamping_constants);
  * Implements calculation of exact vblank timestamps from given drm_display_mode
  * timings and current video scanout position of a CRTC. This can be directly
  * used as the &drm_driver.get_vblank_timestamp implementation of a kms driver
- * if &drm_driver.get_scanout_position is implemented.
+ * if &drm_crtc_helper_funcs.get_scanout_position is implemented.
  *
  * The current implementation only handles standard video modes. For double scan
  * and interlaced modes the driver is supposed to adjust the hardware mode
@@ -632,8 +633,9 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
 	}
 
 	/* Scanout position query not supported? Should not happen. */
-	if (!dev->driver->get_scanout_position) {
-		DRM_ERROR("Called from driver w/o get_scanout_position()!?\n");
+	if (!dev->driver->get_scanout_position ||
+	    !crtc->helper_private->get_scanout_position) {
+		DRM_ERROR("Called from CRTC w/o get_scanout_position()!?\n");
 		return false;
 	}
 
@@ -664,11 +666,17 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
 		 * Get vertical and horizontal scanout position vpos, hpos,
 		 * and bounding timestamps stime, etime, pre/post query.
 		 */
-		vbl_status = dev->driver->get_scanout_position(dev, pipe,
-							       in_vblank_irq,
-							       &vpos, &hpos,
-							       &stime, &etime,
-							       mode);
+		if (crtc->helper_private->get_scanout_position) {
+			vbl_status =
+				crtc->helper_private->get_scanout_position(
+					crtc, in_vblank_irq, &vpos, &hpos,
+					&stime, &etime, mode);
+		} else {
+			vbl_status =
+				dev->driver->get_scanout_position(
+					dev, pipe, in_vblank_irq, &vpos,
+					&hpos, &stime, &etime, mode);
+		}
 
 		/* Return as no-op if scanout query unsupported or failed. */
 		if (!vbl_status) {
diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
index cf13470810a5..d0049e5786fc 100644
--- a/include/drm/drm_drv.h
+++ b/include/drm/drm_drv.h
@@ -362,11 +362,8 @@ struct drm_driver {
 	 * True on success, false if a reliable scanout position counter could
 	 * not be read out.
 	 *
-	 * FIXME:
-	 *
-	 * Since this is a helper to implement @get_vblank_timestamp, we should
-	 * move it to &struct drm_crtc_helper_funcs, like all the other
-	 * helper-internal hooks.
+	 * This is deprecated and should not be used by new drivers.
+	 * Use &drm_crtc_helper_funcs.get_scanout_position instead.
 	 */
 	bool (*get_scanout_position) (struct drm_device *dev, unsigned int pipe,
 				      bool in_vblank_irq, int *vpos, int *hpos,
diff --git a/include/drm/drm_modeset_helper_vtables.h b/include/drm/drm_modeset_helper_vtables.h
index 5a87f1bd7a3f..e398512bfd5f 100644
--- a/include/drm/drm_modeset_helper_vtables.h
+++ b/include/drm/drm_modeset_helper_vtables.h
@@ -450,6 +450,53 @@ struct drm_crtc_helper_funcs {
 	 */
 	void (*atomic_disable)(struct drm_crtc *crtc,
 			       struct drm_crtc_state *old_crtc_state);
+
+	/**
+	 * @get_scanout_position:
+	 *
+	 * Called by vblank timestamping code.
+	 *
+	 * Returns the current display scanout position from a CRTC and an
+	 * optional accurate ktime_get() timestamp of when the position was
+	 * measured. Note that this is a helper callback which is only used
+	 * if a driver uses drm_calc_vbltimestamp_from_scanoutpos() for the
+	 * @drm_driver.get_vblank_timestamp callback.
+	 *
+	 * Parameters:
+	 *
+	 * crtc:
+	 *     The CRTC.
+	 * in_vblank_irq:
+	 *     True when called from drm_crtc_handle_vblank(). Some drivers
+	 *     need to apply some workarounds for gpu-specific vblank irq
+	 *     quirks if the flag is set.
+	 * vpos:
+	 *     Target location for current vertical scanout position.
+	 * hpos:
+	 *     Target location for current horizontal scanout position.
+	 * stime:
+	 *     Target location for timestamp taken immediately before
+	 *     scanout position query. Can be NULL to skip timestamp.
+	 * etime:
+	 *     Target location for timestamp taken immediately after
+	 *     scanout position query. Can be NULL to skip timestamp.
+	 * mode:
+	 *     Current display timings.
+	 *
+	 * Returns vpos as a positive number while in active scanout area.
+	 * Returns vpos as a negative number inside vblank, counting the number
+	 * of scanlines to go until end of vblank, e.g., -1 means "one scanline
+	 * until start of active scanout / end of vblank."
+	 *
+	 * Returns:
+	 *
+	 * True on success, false if a reliable scanout position counter could
+	 * not be read out.
+	 */
+	bool (*get_scanout_position)(struct drm_crtc *crtc,
+				     bool in_vblank_irq, int *vpos, int *hpos,
+				     ktime_t *stime, ktime_t *etime,
+				     const struct drm_display_mode *mode);
 };
 
 /**
-- 
2.24.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 02/23] drm/amdgpu: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: dri-devel, amd-gfx, intel-gfx, linux-arm-msm, freedreno, nouveau,
	Thomas Zimmermann

The callback struct drm_driver.get_scanout_position() is deprecated in
favor of struct drm_crtc_helper_funcs.get_scanout_position(). Convert
amdgpu over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_display.c       | 12 ++++++++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c           | 11 -----------
 drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h          |  5 +++++
 drivers/gpu/drm/amd/amdgpu/dce_v10_0.c            |  1 +
 drivers/gpu/drm/amd/amdgpu/dce_v11_0.c            |  1 +
 drivers/gpu/drm/amd/amdgpu/dce_v6_0.c             |  1 +
 drivers/gpu/drm/amd/amdgpu/dce_v8_0.c             |  1 +
 drivers/gpu/drm/amd/amdgpu/dce_virtual.c          |  1 +
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  3 ++-
 9 files changed, 24 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
index 4e699071d144..a1e769d4417d 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
@@ -914,3 +914,15 @@ int amdgpu_display_crtc_idx_to_irq_type(struct amdgpu_device *adev, int crtc)
 		return AMDGPU_CRTC_IRQ_NONE;
 	}
 }
+
+bool amdgpu_crtc_get_scanout_position(struct drm_crtc *crtc,
+			bool in_vblank_irq, int *vpos,
+			int *hpos, ktime_t *stime, ktime_t *etime,
+			const struct drm_display_mode *mode)
+{
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
+
+	return amdgpu_display_get_crtc_scanoutpos(dev, pipe, 0, vpos, hpos,
+						  stime, etime, mode);
+}
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index 3f6f14ce1511..0749285dd1c7 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -1367,16 +1367,6 @@ int amdgpu_file_to_fpriv(struct file *filp, struct amdgpu_fpriv **fpriv)
 	return 0;
 }
 
-static bool
-amdgpu_get_crtc_scanout_position(struct drm_device *dev, unsigned int pipe,
-				 bool in_vblank_irq, int *vpos, int *hpos,
-				 ktime_t *stime, ktime_t *etime,
-				 const struct drm_display_mode *mode)
-{
-	return amdgpu_display_get_crtc_scanoutpos(dev, pipe, 0, vpos, hpos,
-						  stime, etime, mode);
-}
-
 static struct drm_driver kms_driver = {
 	.driver_features =
 	    DRIVER_USE_AGP | DRIVER_ATOMIC |
@@ -1391,7 +1381,6 @@ static struct drm_driver kms_driver = {
 	.enable_vblank = amdgpu_enable_vblank_kms,
 	.disable_vblank = amdgpu_disable_vblank_kms,
 	.get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
-	.get_scanout_position = amdgpu_get_crtc_scanout_position,
 	.irq_handler = amdgpu_irq_handler,
 	.ioctls = amdgpu_ioctls_kms,
 	.gem_free_object_unlocked = amdgpu_gem_object_free,
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
index eb9975f4decb..37ba07e2feb5 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
@@ -612,6 +612,11 @@ void amdgpu_panel_mode_fixup(struct drm_encoder *encoder,
 			     struct drm_display_mode *adjusted_mode);
 int amdgpu_display_crtc_idx_to_irq_type(struct amdgpu_device *adev, int crtc);
 
+bool amdgpu_crtc_get_scanout_position(struct drm_crtc *crtc,
+			bool in_vblank_irq, int *vpos,
+			int *hpos, ktime_t *stime, ktime_t *etime,
+			const struct drm_display_mode *mode);
+
 /* fbdev layer */
 int amdgpu_fbdev_init(struct amdgpu_device *adev);
 void amdgpu_fbdev_fini(struct amdgpu_device *adev);
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
index 40d2ac723dd6..bdc1e0f036d4 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
@@ -2685,6 +2685,7 @@ static const struct drm_crtc_helper_funcs dce_v10_0_crtc_helper_funcs = {
 	.prepare = dce_v10_0_crtc_prepare,
 	.commit = dce_v10_0_crtc_commit,
 	.disable = dce_v10_0_crtc_disable,
+	.get_scanout_position = amdgpu_crtc_get_scanout_position,
 };
 
 static int dce_v10_0_crtc_init(struct amdgpu_device *adev, int index)
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
index 898ef72d423c..0319da5f7bf9 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
@@ -2793,6 +2793,7 @@ static const struct drm_crtc_helper_funcs dce_v11_0_crtc_helper_funcs = {
 	.prepare = dce_v11_0_crtc_prepare,
 	.commit = dce_v11_0_crtc_commit,
 	.disable = dce_v11_0_crtc_disable,
+	.get_scanout_position = amdgpu_crtc_get_scanout_position,
 };
 
 static int dce_v11_0_crtc_init(struct amdgpu_device *adev, int index)
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
index db15a112becc..78642c3b14fc 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
@@ -2575,6 +2575,7 @@ static const struct drm_crtc_helper_funcs dce_v6_0_crtc_helper_funcs = {
 	.prepare = dce_v6_0_crtc_prepare,
 	.commit = dce_v6_0_crtc_commit,
 	.disable = dce_v6_0_crtc_disable,
+	.get_scanout_position = amdgpu_crtc_get_scanout_position,
 };
 
 static int dce_v6_0_crtc_init(struct amdgpu_device *adev, int index)
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
index f06c9022c1fd..1e8d4975435a 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
@@ -2593,6 +2593,7 @@ static const struct drm_crtc_helper_funcs dce_v8_0_crtc_helper_funcs = {
 	.prepare = dce_v8_0_crtc_prepare,
 	.commit = dce_v8_0_crtc_commit,
 	.disable = dce_v8_0_crtc_disable,
+	.get_scanout_position = amdgpu_crtc_get_scanout_position,
 };
 
 static int dce_v8_0_crtc_init(struct amdgpu_device *adev, int index)
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
index e4f94863332c..4b2f915aba47 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
@@ -218,6 +218,7 @@ static const struct drm_crtc_helper_funcs dce_virtual_crtc_helper_funcs = {
 	.prepare = dce_virtual_crtc_prepare,
 	.commit = dce_virtual_crtc_commit,
 	.disable = dce_virtual_crtc_disable,
+	.get_scanout_position = amdgpu_crtc_get_scanout_position,
 };
 
 static int dce_virtual_crtc_init(struct amdgpu_device *adev, int index)
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index f2db400a3920..39c5cf242c1b 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -4821,7 +4821,8 @@ static bool dm_crtc_helper_mode_fixup(struct drm_crtc *crtc,
 static const struct drm_crtc_helper_funcs amdgpu_dm_crtc_helper_funcs = {
 	.disable = dm_crtc_helper_disable,
 	.atomic_check = dm_crtc_helper_atomic_check,
-	.mode_fixup = dm_crtc_helper_mode_fixup
+	.mode_fixup = dm_crtc_helper_mode_fixup,
+	.get_scanout_position = amdgpu_crtc_get_scanout_position,
 };
 
 static void dm_encoder_helper_disable(struct drm_encoder *encoder)
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 02/23] drm/amdgpu: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied-cv59FeDIM0c, daniel-/w4YWyX8dFk,
	alexander.deucher-5C7GfCeVMHo, christian.koenig-5C7GfCeVMHo,
	David1.Zhou-5C7GfCeVMHo,
	maarten.lankhorst-VuQAYsv1563Yd54FQh9/CA,
	patrik.r.jakobsson-Re5JQEeQqe8AvxtiuMwx3w,
	robdclark-Re5JQEeQqe8AvxtiuMwx3w, sean-p7yTbzM4H96eqtR555YLDQ,
	benjamin.gaignard-QSEj5FYQhm4dnm+yROfE0A,
	vincent.abriou-qxv4g6HH51o, yannick.fertre-qxv4g6HH51o,
	philippe.cornu-qxv4g6HH51o,
	mcoquelin.stm32-Re5JQEeQqe8AvxtiuMwx3w,
	alexandre.torgue-qxv4g6HH51o, eric-WhKQ6XTQaPysTnJN9+BGXg,
	rodrigosiqueiramelo-Re5JQEeQqe8AvxtiuMwx3w,
	hamohammed.sa-Re5JQEeQqe8AvxtiuMwx3w,
	linux-graphics-maintainer-pghWNbHTmq7QT0dZR+AlfA,
	thellstrom-pghWNbHTmq7QT0dZR+AlfA,
	bskeggs-H+wXaHxf7aLQT0dZR+AlfA, harry.wentland-5C7GfCeVMHo,
	sunpeng.li-5C7GfCeVMHo, jani.nikula-VuQAYsv1563Yd54FQh9/CA,
	joonas.lahtinen-VuQAYsv1563Yd54FQh9/CA,
	rodrigo.vivi-ral2JQCrhuEAvxtiuMwx3w
  Cc: linux-arm-msm-u79uwXL29TY76Z2rM5mHXA,
	intel-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Thomas Zimmermann,
	nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

The callback struct drm_driver.get_scanout_position() is deprecated in
favor of struct drm_crtc_helper_funcs.get_scanout_position(). Convert
amdgpu over.

Signed-off-by: Thomas Zimmermann <tzimmermann-l3A5Bk7waGM@public.gmane.org>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_display.c       | 12 ++++++++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c           | 11 -----------
 drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h          |  5 +++++
 drivers/gpu/drm/amd/amdgpu/dce_v10_0.c            |  1 +
 drivers/gpu/drm/amd/amdgpu/dce_v11_0.c            |  1 +
 drivers/gpu/drm/amd/amdgpu/dce_v6_0.c             |  1 +
 drivers/gpu/drm/amd/amdgpu/dce_v8_0.c             |  1 +
 drivers/gpu/drm/amd/amdgpu/dce_virtual.c          |  1 +
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  3 ++-
 9 files changed, 24 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
index 4e699071d144..a1e769d4417d 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
@@ -914,3 +914,15 @@ int amdgpu_display_crtc_idx_to_irq_type(struct amdgpu_device *adev, int crtc)
 		return AMDGPU_CRTC_IRQ_NONE;
 	}
 }
+
+bool amdgpu_crtc_get_scanout_position(struct drm_crtc *crtc,
+			bool in_vblank_irq, int *vpos,
+			int *hpos, ktime_t *stime, ktime_t *etime,
+			const struct drm_display_mode *mode)
+{
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
+
+	return amdgpu_display_get_crtc_scanoutpos(dev, pipe, 0, vpos, hpos,
+						  stime, etime, mode);
+}
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index 3f6f14ce1511..0749285dd1c7 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -1367,16 +1367,6 @@ int amdgpu_file_to_fpriv(struct file *filp, struct amdgpu_fpriv **fpriv)
 	return 0;
 }
 
-static bool
-amdgpu_get_crtc_scanout_position(struct drm_device *dev, unsigned int pipe,
-				 bool in_vblank_irq, int *vpos, int *hpos,
-				 ktime_t *stime, ktime_t *etime,
-				 const struct drm_display_mode *mode)
-{
-	return amdgpu_display_get_crtc_scanoutpos(dev, pipe, 0, vpos, hpos,
-						  stime, etime, mode);
-}
-
 static struct drm_driver kms_driver = {
 	.driver_features =
 	    DRIVER_USE_AGP | DRIVER_ATOMIC |
@@ -1391,7 +1381,6 @@ static struct drm_driver kms_driver = {
 	.enable_vblank = amdgpu_enable_vblank_kms,
 	.disable_vblank = amdgpu_disable_vblank_kms,
 	.get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
-	.get_scanout_position = amdgpu_get_crtc_scanout_position,
 	.irq_handler = amdgpu_irq_handler,
 	.ioctls = amdgpu_ioctls_kms,
 	.gem_free_object_unlocked = amdgpu_gem_object_free,
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
index eb9975f4decb..37ba07e2feb5 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
@@ -612,6 +612,11 @@ void amdgpu_panel_mode_fixup(struct drm_encoder *encoder,
 			     struct drm_display_mode *adjusted_mode);
 int amdgpu_display_crtc_idx_to_irq_type(struct amdgpu_device *adev, int crtc);
 
+bool amdgpu_crtc_get_scanout_position(struct drm_crtc *crtc,
+			bool in_vblank_irq, int *vpos,
+			int *hpos, ktime_t *stime, ktime_t *etime,
+			const struct drm_display_mode *mode);
+
 /* fbdev layer */
 int amdgpu_fbdev_init(struct amdgpu_device *adev);
 void amdgpu_fbdev_fini(struct amdgpu_device *adev);
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
index 40d2ac723dd6..bdc1e0f036d4 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
@@ -2685,6 +2685,7 @@ static const struct drm_crtc_helper_funcs dce_v10_0_crtc_helper_funcs = {
 	.prepare = dce_v10_0_crtc_prepare,
 	.commit = dce_v10_0_crtc_commit,
 	.disable = dce_v10_0_crtc_disable,
+	.get_scanout_position = amdgpu_crtc_get_scanout_position,
 };
 
 static int dce_v10_0_crtc_init(struct amdgpu_device *adev, int index)
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
index 898ef72d423c..0319da5f7bf9 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
@@ -2793,6 +2793,7 @@ static const struct drm_crtc_helper_funcs dce_v11_0_crtc_helper_funcs = {
 	.prepare = dce_v11_0_crtc_prepare,
 	.commit = dce_v11_0_crtc_commit,
 	.disable = dce_v11_0_crtc_disable,
+	.get_scanout_position = amdgpu_crtc_get_scanout_position,
 };
 
 static int dce_v11_0_crtc_init(struct amdgpu_device *adev, int index)
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
index db15a112becc..78642c3b14fc 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
@@ -2575,6 +2575,7 @@ static const struct drm_crtc_helper_funcs dce_v6_0_crtc_helper_funcs = {
 	.prepare = dce_v6_0_crtc_prepare,
 	.commit = dce_v6_0_crtc_commit,
 	.disable = dce_v6_0_crtc_disable,
+	.get_scanout_position = amdgpu_crtc_get_scanout_position,
 };
 
 static int dce_v6_0_crtc_init(struct amdgpu_device *adev, int index)
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
index f06c9022c1fd..1e8d4975435a 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
@@ -2593,6 +2593,7 @@ static const struct drm_crtc_helper_funcs dce_v8_0_crtc_helper_funcs = {
 	.prepare = dce_v8_0_crtc_prepare,
 	.commit = dce_v8_0_crtc_commit,
 	.disable = dce_v8_0_crtc_disable,
+	.get_scanout_position = amdgpu_crtc_get_scanout_position,
 };
 
 static int dce_v8_0_crtc_init(struct amdgpu_device *adev, int index)
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
index e4f94863332c..4b2f915aba47 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
@@ -218,6 +218,7 @@ static const struct drm_crtc_helper_funcs dce_virtual_crtc_helper_funcs = {
 	.prepare = dce_virtual_crtc_prepare,
 	.commit = dce_virtual_crtc_commit,
 	.disable = dce_virtual_crtc_disable,
+	.get_scanout_position = amdgpu_crtc_get_scanout_position,
 };
 
 static int dce_virtual_crtc_init(struct amdgpu_device *adev, int index)
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index f2db400a3920..39c5cf242c1b 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -4821,7 +4821,8 @@ static bool dm_crtc_helper_mode_fixup(struct drm_crtc *crtc,
 static const struct drm_crtc_helper_funcs amdgpu_dm_crtc_helper_funcs = {
 	.disable = dm_crtc_helper_disable,
 	.atomic_check = dm_crtc_helper_atomic_check,
-	.mode_fixup = dm_crtc_helper_mode_fixup
+	.mode_fixup = dm_crtc_helper_mode_fixup,
+	.get_scanout_position = amdgpu_crtc_get_scanout_position,
 };
 
 static void dm_encoder_helper_disable(struct drm_encoder *encoder)
-- 
2.24.1

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 02/23] drm/amdgpu: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

The callback struct drm_driver.get_scanout_position() is deprecated in
favor of struct drm_crtc_helper_funcs.get_scanout_position(). Convert
amdgpu over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_display.c       | 12 ++++++++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c           | 11 -----------
 drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h          |  5 +++++
 drivers/gpu/drm/amd/amdgpu/dce_v10_0.c            |  1 +
 drivers/gpu/drm/amd/amdgpu/dce_v11_0.c            |  1 +
 drivers/gpu/drm/amd/amdgpu/dce_v6_0.c             |  1 +
 drivers/gpu/drm/amd/amdgpu/dce_v8_0.c             |  1 +
 drivers/gpu/drm/amd/amdgpu/dce_virtual.c          |  1 +
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  3 ++-
 9 files changed, 24 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
index 4e699071d144..a1e769d4417d 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
@@ -914,3 +914,15 @@ int amdgpu_display_crtc_idx_to_irq_type(struct amdgpu_device *adev, int crtc)
 		return AMDGPU_CRTC_IRQ_NONE;
 	}
 }
+
+bool amdgpu_crtc_get_scanout_position(struct drm_crtc *crtc,
+			bool in_vblank_irq, int *vpos,
+			int *hpos, ktime_t *stime, ktime_t *etime,
+			const struct drm_display_mode *mode)
+{
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
+
+	return amdgpu_display_get_crtc_scanoutpos(dev, pipe, 0, vpos, hpos,
+						  stime, etime, mode);
+}
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index 3f6f14ce1511..0749285dd1c7 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -1367,16 +1367,6 @@ int amdgpu_file_to_fpriv(struct file *filp, struct amdgpu_fpriv **fpriv)
 	return 0;
 }
 
-static bool
-amdgpu_get_crtc_scanout_position(struct drm_device *dev, unsigned int pipe,
-				 bool in_vblank_irq, int *vpos, int *hpos,
-				 ktime_t *stime, ktime_t *etime,
-				 const struct drm_display_mode *mode)
-{
-	return amdgpu_display_get_crtc_scanoutpos(dev, pipe, 0, vpos, hpos,
-						  stime, etime, mode);
-}
-
 static struct drm_driver kms_driver = {
 	.driver_features =
 	    DRIVER_USE_AGP | DRIVER_ATOMIC |
@@ -1391,7 +1381,6 @@ static struct drm_driver kms_driver = {
 	.enable_vblank = amdgpu_enable_vblank_kms,
 	.disable_vblank = amdgpu_disable_vblank_kms,
 	.get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
-	.get_scanout_position = amdgpu_get_crtc_scanout_position,
 	.irq_handler = amdgpu_irq_handler,
 	.ioctls = amdgpu_ioctls_kms,
 	.gem_free_object_unlocked = amdgpu_gem_object_free,
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
index eb9975f4decb..37ba07e2feb5 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
@@ -612,6 +612,11 @@ void amdgpu_panel_mode_fixup(struct drm_encoder *encoder,
 			     struct drm_display_mode *adjusted_mode);
 int amdgpu_display_crtc_idx_to_irq_type(struct amdgpu_device *adev, int crtc);
 
+bool amdgpu_crtc_get_scanout_position(struct drm_crtc *crtc,
+			bool in_vblank_irq, int *vpos,
+			int *hpos, ktime_t *stime, ktime_t *etime,
+			const struct drm_display_mode *mode);
+
 /* fbdev layer */
 int amdgpu_fbdev_init(struct amdgpu_device *adev);
 void amdgpu_fbdev_fini(struct amdgpu_device *adev);
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
index 40d2ac723dd6..bdc1e0f036d4 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
@@ -2685,6 +2685,7 @@ static const struct drm_crtc_helper_funcs dce_v10_0_crtc_helper_funcs = {
 	.prepare = dce_v10_0_crtc_prepare,
 	.commit = dce_v10_0_crtc_commit,
 	.disable = dce_v10_0_crtc_disable,
+	.get_scanout_position = amdgpu_crtc_get_scanout_position,
 };
 
 static int dce_v10_0_crtc_init(struct amdgpu_device *adev, int index)
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
index 898ef72d423c..0319da5f7bf9 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
@@ -2793,6 +2793,7 @@ static const struct drm_crtc_helper_funcs dce_v11_0_crtc_helper_funcs = {
 	.prepare = dce_v11_0_crtc_prepare,
 	.commit = dce_v11_0_crtc_commit,
 	.disable = dce_v11_0_crtc_disable,
+	.get_scanout_position = amdgpu_crtc_get_scanout_position,
 };
 
 static int dce_v11_0_crtc_init(struct amdgpu_device *adev, int index)
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
index db15a112becc..78642c3b14fc 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
@@ -2575,6 +2575,7 @@ static const struct drm_crtc_helper_funcs dce_v6_0_crtc_helper_funcs = {
 	.prepare = dce_v6_0_crtc_prepare,
 	.commit = dce_v6_0_crtc_commit,
 	.disable = dce_v6_0_crtc_disable,
+	.get_scanout_position = amdgpu_crtc_get_scanout_position,
 };
 
 static int dce_v6_0_crtc_init(struct amdgpu_device *adev, int index)
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
index f06c9022c1fd..1e8d4975435a 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
@@ -2593,6 +2593,7 @@ static const struct drm_crtc_helper_funcs dce_v8_0_crtc_helper_funcs = {
 	.prepare = dce_v8_0_crtc_prepare,
 	.commit = dce_v8_0_crtc_commit,
 	.disable = dce_v8_0_crtc_disable,
+	.get_scanout_position = amdgpu_crtc_get_scanout_position,
 };
 
 static int dce_v8_0_crtc_init(struct amdgpu_device *adev, int index)
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
index e4f94863332c..4b2f915aba47 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
@@ -218,6 +218,7 @@ static const struct drm_crtc_helper_funcs dce_virtual_crtc_helper_funcs = {
 	.prepare = dce_virtual_crtc_prepare,
 	.commit = dce_virtual_crtc_commit,
 	.disable = dce_virtual_crtc_disable,
+	.get_scanout_position = amdgpu_crtc_get_scanout_position,
 };
 
 static int dce_virtual_crtc_init(struct amdgpu_device *adev, int index)
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index f2db400a3920..39c5cf242c1b 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -4821,7 +4821,8 @@ static bool dm_crtc_helper_mode_fixup(struct drm_crtc *crtc,
 static const struct drm_crtc_helper_funcs amdgpu_dm_crtc_helper_funcs = {
 	.disable = dm_crtc_helper_disable,
 	.atomic_check = dm_crtc_helper_atomic_check,
-	.mode_fixup = dm_crtc_helper_mode_fixup
+	.mode_fixup = dm_crtc_helper_mode_fixup,
+	.get_scanout_position = amdgpu_crtc_get_scanout_position,
 };
 
 static void dm_encoder_helper_disable(struct drm_encoder *encoder)
-- 
2.24.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [Intel-gfx] [PATCH 02/23] drm/amdgpu: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

The callback struct drm_driver.get_scanout_position() is deprecated in
favor of struct drm_crtc_helper_funcs.get_scanout_position(). Convert
amdgpu over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_display.c       | 12 ++++++++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c           | 11 -----------
 drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h          |  5 +++++
 drivers/gpu/drm/amd/amdgpu/dce_v10_0.c            |  1 +
 drivers/gpu/drm/amd/amdgpu/dce_v11_0.c            |  1 +
 drivers/gpu/drm/amd/amdgpu/dce_v6_0.c             |  1 +
 drivers/gpu/drm/amd/amdgpu/dce_v8_0.c             |  1 +
 drivers/gpu/drm/amd/amdgpu/dce_virtual.c          |  1 +
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  3 ++-
 9 files changed, 24 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
index 4e699071d144..a1e769d4417d 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
@@ -914,3 +914,15 @@ int amdgpu_display_crtc_idx_to_irq_type(struct amdgpu_device *adev, int crtc)
 		return AMDGPU_CRTC_IRQ_NONE;
 	}
 }
+
+bool amdgpu_crtc_get_scanout_position(struct drm_crtc *crtc,
+			bool in_vblank_irq, int *vpos,
+			int *hpos, ktime_t *stime, ktime_t *etime,
+			const struct drm_display_mode *mode)
+{
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
+
+	return amdgpu_display_get_crtc_scanoutpos(dev, pipe, 0, vpos, hpos,
+						  stime, etime, mode);
+}
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index 3f6f14ce1511..0749285dd1c7 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -1367,16 +1367,6 @@ int amdgpu_file_to_fpriv(struct file *filp, struct amdgpu_fpriv **fpriv)
 	return 0;
 }
 
-static bool
-amdgpu_get_crtc_scanout_position(struct drm_device *dev, unsigned int pipe,
-				 bool in_vblank_irq, int *vpos, int *hpos,
-				 ktime_t *stime, ktime_t *etime,
-				 const struct drm_display_mode *mode)
-{
-	return amdgpu_display_get_crtc_scanoutpos(dev, pipe, 0, vpos, hpos,
-						  stime, etime, mode);
-}
-
 static struct drm_driver kms_driver = {
 	.driver_features =
 	    DRIVER_USE_AGP | DRIVER_ATOMIC |
@@ -1391,7 +1381,6 @@ static struct drm_driver kms_driver = {
 	.enable_vblank = amdgpu_enable_vblank_kms,
 	.disable_vblank = amdgpu_disable_vblank_kms,
 	.get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
-	.get_scanout_position = amdgpu_get_crtc_scanout_position,
 	.irq_handler = amdgpu_irq_handler,
 	.ioctls = amdgpu_ioctls_kms,
 	.gem_free_object_unlocked = amdgpu_gem_object_free,
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
index eb9975f4decb..37ba07e2feb5 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
@@ -612,6 +612,11 @@ void amdgpu_panel_mode_fixup(struct drm_encoder *encoder,
 			     struct drm_display_mode *adjusted_mode);
 int amdgpu_display_crtc_idx_to_irq_type(struct amdgpu_device *adev, int crtc);
 
+bool amdgpu_crtc_get_scanout_position(struct drm_crtc *crtc,
+			bool in_vblank_irq, int *vpos,
+			int *hpos, ktime_t *stime, ktime_t *etime,
+			const struct drm_display_mode *mode);
+
 /* fbdev layer */
 int amdgpu_fbdev_init(struct amdgpu_device *adev);
 void amdgpu_fbdev_fini(struct amdgpu_device *adev);
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
index 40d2ac723dd6..bdc1e0f036d4 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
@@ -2685,6 +2685,7 @@ static const struct drm_crtc_helper_funcs dce_v10_0_crtc_helper_funcs = {
 	.prepare = dce_v10_0_crtc_prepare,
 	.commit = dce_v10_0_crtc_commit,
 	.disable = dce_v10_0_crtc_disable,
+	.get_scanout_position = amdgpu_crtc_get_scanout_position,
 };
 
 static int dce_v10_0_crtc_init(struct amdgpu_device *adev, int index)
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
index 898ef72d423c..0319da5f7bf9 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
@@ -2793,6 +2793,7 @@ static const struct drm_crtc_helper_funcs dce_v11_0_crtc_helper_funcs = {
 	.prepare = dce_v11_0_crtc_prepare,
 	.commit = dce_v11_0_crtc_commit,
 	.disable = dce_v11_0_crtc_disable,
+	.get_scanout_position = amdgpu_crtc_get_scanout_position,
 };
 
 static int dce_v11_0_crtc_init(struct amdgpu_device *adev, int index)
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
index db15a112becc..78642c3b14fc 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
@@ -2575,6 +2575,7 @@ static const struct drm_crtc_helper_funcs dce_v6_0_crtc_helper_funcs = {
 	.prepare = dce_v6_0_crtc_prepare,
 	.commit = dce_v6_0_crtc_commit,
 	.disable = dce_v6_0_crtc_disable,
+	.get_scanout_position = amdgpu_crtc_get_scanout_position,
 };
 
 static int dce_v6_0_crtc_init(struct amdgpu_device *adev, int index)
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
index f06c9022c1fd..1e8d4975435a 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
@@ -2593,6 +2593,7 @@ static const struct drm_crtc_helper_funcs dce_v8_0_crtc_helper_funcs = {
 	.prepare = dce_v8_0_crtc_prepare,
 	.commit = dce_v8_0_crtc_commit,
 	.disable = dce_v8_0_crtc_disable,
+	.get_scanout_position = amdgpu_crtc_get_scanout_position,
 };
 
 static int dce_v8_0_crtc_init(struct amdgpu_device *adev, int index)
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
index e4f94863332c..4b2f915aba47 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
@@ -218,6 +218,7 @@ static const struct drm_crtc_helper_funcs dce_virtual_crtc_helper_funcs = {
 	.prepare = dce_virtual_crtc_prepare,
 	.commit = dce_virtual_crtc_commit,
 	.disable = dce_virtual_crtc_disable,
+	.get_scanout_position = amdgpu_crtc_get_scanout_position,
 };
 
 static int dce_virtual_crtc_init(struct amdgpu_device *adev, int index)
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index f2db400a3920..39c5cf242c1b 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -4821,7 +4821,8 @@ static bool dm_crtc_helper_mode_fixup(struct drm_crtc *crtc,
 static const struct drm_crtc_helper_funcs amdgpu_dm_crtc_helper_funcs = {
 	.disable = dm_crtc_helper_disable,
 	.atomic_check = dm_crtc_helper_atomic_check,
-	.mode_fixup = dm_crtc_helper_mode_fixup
+	.mode_fixup = dm_crtc_helper_mode_fixup,
+	.get_scanout_position = amdgpu_crtc_get_scanout_position,
 };
 
 static void dm_encoder_helper_disable(struct drm_encoder *encoder)
-- 
2.24.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 02/23] drm/amdgpu: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

The callback struct drm_driver.get_scanout_position() is deprecated in
favor of struct drm_crtc_helper_funcs.get_scanout_position(). Convert
amdgpu over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_display.c       | 12 ++++++++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c           | 11 -----------
 drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h          |  5 +++++
 drivers/gpu/drm/amd/amdgpu/dce_v10_0.c            |  1 +
 drivers/gpu/drm/amd/amdgpu/dce_v11_0.c            |  1 +
 drivers/gpu/drm/amd/amdgpu/dce_v6_0.c             |  1 +
 drivers/gpu/drm/amd/amdgpu/dce_v8_0.c             |  1 +
 drivers/gpu/drm/amd/amdgpu/dce_virtual.c          |  1 +
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  3 ++-
 9 files changed, 24 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
index 4e699071d144..a1e769d4417d 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
@@ -914,3 +914,15 @@ int amdgpu_display_crtc_idx_to_irq_type(struct amdgpu_device *adev, int crtc)
 		return AMDGPU_CRTC_IRQ_NONE;
 	}
 }
+
+bool amdgpu_crtc_get_scanout_position(struct drm_crtc *crtc,
+			bool in_vblank_irq, int *vpos,
+			int *hpos, ktime_t *stime, ktime_t *etime,
+			const struct drm_display_mode *mode)
+{
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
+
+	return amdgpu_display_get_crtc_scanoutpos(dev, pipe, 0, vpos, hpos,
+						  stime, etime, mode);
+}
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index 3f6f14ce1511..0749285dd1c7 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -1367,16 +1367,6 @@ int amdgpu_file_to_fpriv(struct file *filp, struct amdgpu_fpriv **fpriv)
 	return 0;
 }
 
-static bool
-amdgpu_get_crtc_scanout_position(struct drm_device *dev, unsigned int pipe,
-				 bool in_vblank_irq, int *vpos, int *hpos,
-				 ktime_t *stime, ktime_t *etime,
-				 const struct drm_display_mode *mode)
-{
-	return amdgpu_display_get_crtc_scanoutpos(dev, pipe, 0, vpos, hpos,
-						  stime, etime, mode);
-}
-
 static struct drm_driver kms_driver = {
 	.driver_features =
 	    DRIVER_USE_AGP | DRIVER_ATOMIC |
@@ -1391,7 +1381,6 @@ static struct drm_driver kms_driver = {
 	.enable_vblank = amdgpu_enable_vblank_kms,
 	.disable_vblank = amdgpu_disable_vblank_kms,
 	.get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
-	.get_scanout_position = amdgpu_get_crtc_scanout_position,
 	.irq_handler = amdgpu_irq_handler,
 	.ioctls = amdgpu_ioctls_kms,
 	.gem_free_object_unlocked = amdgpu_gem_object_free,
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
index eb9975f4decb..37ba07e2feb5 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
@@ -612,6 +612,11 @@ void amdgpu_panel_mode_fixup(struct drm_encoder *encoder,
 			     struct drm_display_mode *adjusted_mode);
 int amdgpu_display_crtc_idx_to_irq_type(struct amdgpu_device *adev, int crtc);
 
+bool amdgpu_crtc_get_scanout_position(struct drm_crtc *crtc,
+			bool in_vblank_irq, int *vpos,
+			int *hpos, ktime_t *stime, ktime_t *etime,
+			const struct drm_display_mode *mode);
+
 /* fbdev layer */
 int amdgpu_fbdev_init(struct amdgpu_device *adev);
 void amdgpu_fbdev_fini(struct amdgpu_device *adev);
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
index 40d2ac723dd6..bdc1e0f036d4 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
@@ -2685,6 +2685,7 @@ static const struct drm_crtc_helper_funcs dce_v10_0_crtc_helper_funcs = {
 	.prepare = dce_v10_0_crtc_prepare,
 	.commit = dce_v10_0_crtc_commit,
 	.disable = dce_v10_0_crtc_disable,
+	.get_scanout_position = amdgpu_crtc_get_scanout_position,
 };
 
 static int dce_v10_0_crtc_init(struct amdgpu_device *adev, int index)
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
index 898ef72d423c..0319da5f7bf9 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
@@ -2793,6 +2793,7 @@ static const struct drm_crtc_helper_funcs dce_v11_0_crtc_helper_funcs = {
 	.prepare = dce_v11_0_crtc_prepare,
 	.commit = dce_v11_0_crtc_commit,
 	.disable = dce_v11_0_crtc_disable,
+	.get_scanout_position = amdgpu_crtc_get_scanout_position,
 };
 
 static int dce_v11_0_crtc_init(struct amdgpu_device *adev, int index)
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
index db15a112becc..78642c3b14fc 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
@@ -2575,6 +2575,7 @@ static const struct drm_crtc_helper_funcs dce_v6_0_crtc_helper_funcs = {
 	.prepare = dce_v6_0_crtc_prepare,
 	.commit = dce_v6_0_crtc_commit,
 	.disable = dce_v6_0_crtc_disable,
+	.get_scanout_position = amdgpu_crtc_get_scanout_position,
 };
 
 static int dce_v6_0_crtc_init(struct amdgpu_device *adev, int index)
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
index f06c9022c1fd..1e8d4975435a 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
@@ -2593,6 +2593,7 @@ static const struct drm_crtc_helper_funcs dce_v8_0_crtc_helper_funcs = {
 	.prepare = dce_v8_0_crtc_prepare,
 	.commit = dce_v8_0_crtc_commit,
 	.disable = dce_v8_0_crtc_disable,
+	.get_scanout_position = amdgpu_crtc_get_scanout_position,
 };
 
 static int dce_v8_0_crtc_init(struct amdgpu_device *adev, int index)
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
index e4f94863332c..4b2f915aba47 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
@@ -218,6 +218,7 @@ static const struct drm_crtc_helper_funcs dce_virtual_crtc_helper_funcs = {
 	.prepare = dce_virtual_crtc_prepare,
 	.commit = dce_virtual_crtc_commit,
 	.disable = dce_virtual_crtc_disable,
+	.get_scanout_position = amdgpu_crtc_get_scanout_position,
 };
 
 static int dce_virtual_crtc_init(struct amdgpu_device *adev, int index)
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index f2db400a3920..39c5cf242c1b 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -4821,7 +4821,8 @@ static bool dm_crtc_helper_mode_fixup(struct drm_crtc *crtc,
 static const struct drm_crtc_helper_funcs amdgpu_dm_crtc_helper_funcs = {
 	.disable = dm_crtc_helper_disable,
 	.atomic_check = dm_crtc_helper_atomic_check,
-	.mode_fixup = dm_crtc_helper_mode_fixup
+	.mode_fixup = dm_crtc_helper_mode_fixup,
+	.get_scanout_position = amdgpu_crtc_get_scanout_position,
 };
 
 static void dm_encoder_helper_disable(struct drm_encoder *encoder)
-- 
2.24.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 03/23] drm/i915: Don't use struct drm_driver.get_scanout_position()
  2020-01-10  9:21 ` Thomas Zimmermann
                     ` (2 preceding siblings ...)
  (?)
@ 2020-01-10  9:21   ` Thomas Zimmermann
  -1 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: dri-devel, amd-gfx, intel-gfx, linux-arm-msm, freedreno, nouveau,
	Thomas Zimmermann

The callback struct drm_driver.get_scanout_position() is deprecated in
favor of struct drm_crtc_helper_funcs.get_scanout_position().

i915 doesn't use CRTC helpers. The patch duplicates the caller
drm_calc_vbltimestamp_from_scanoutpos() for i915, such that the callback
function is not needed.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/i915/i915_drv.c |   3 +-
 drivers/gpu/drm/i915/i915_irq.c | 117 ++++++++++++++++++++++++++++++--
 drivers/gpu/drm/i915/i915_irq.h |   9 +--
 3 files changed, 119 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index f7385abdd74b..4a0a7fb85c53 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -2769,8 +2769,7 @@ static struct drm_driver driver = {
 	.gem_prime_export = i915_gem_prime_export,
 	.gem_prime_import = i915_gem_prime_import,
 
-	.get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
-	.get_scanout_position = i915_get_crtc_scanoutpos,
+	.get_vblank_timestamp = i915_calc_vbltimestamp_from_scanoutpos,
 
 	.dumb_create = i915_gem_dumb_create,
 	.dumb_map_offset = i915_gem_dumb_mmap_offset,
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index afc6aad9bf8c..99d0c3b0feae 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -52,6 +52,11 @@
 #include "i915_trace.h"
 #include "intel_pm.h"
 
+/* Retry timestamp calculation up to 3 times to satisfy
+ * drm_timestamp_precision before giving up.
+ */
+#define I915_TIMESTAMP_MAXRETRIES 3
+
 /**
  * DOC: interrupt handling
  *
@@ -762,10 +767,11 @@ static int __intel_get_crtc_scanline(struct intel_crtc *crtc)
 	return (position + crtc->scanline_offset) % vtotal;
 }
 
-bool i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int index,
-			      bool in_vblank_irq, int *vpos, int *hpos,
-			      ktime_t *stime, ktime_t *etime,
-			      const struct drm_display_mode *mode)
+static bool i915_get_crtc_scanoutpos(struct drm_device *dev,
+				     unsigned int index, bool in_vblank_irq,
+				     int *vpos, int *hpos,
+				     ktime_t *stime, ktime_t *etime,
+				     const struct drm_display_mode *mode)
 {
 	struct drm_i915_private *dev_priv = to_i915(dev);
 	struct intel_crtc *crtc = to_intel_crtc(drm_crtc_from_index(dev, index));
@@ -879,6 +885,109 @@ bool i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int index,
 	return true;
 }
 
+bool i915_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
+					    unsigned int pipe,
+					    int *max_error,
+					    ktime_t *vblank_time,
+					    bool in_vblank_irq)
+{
+	struct timespec64 ts_etime, ts_vblank_time;
+	ktime_t stime, etime;
+	bool vbl_status;
+	struct drm_crtc *crtc;
+	const struct drm_display_mode *mode;
+	struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
+	int vpos, hpos, i;
+	int delta_ns, duration_ns;
+
+	crtc = drm_crtc_from_index(dev, pipe);
+
+	if (pipe >= dev->num_crtcs || !crtc) {
+		DRM_ERROR("Invalid crtc %u\n", pipe);
+		return false;
+	}
+
+	if (drm_drv_uses_atomic_modeset(dev))
+		mode = &vblank->hwmode;
+	else
+		mode = &crtc->hwmode;
+
+	/* If mode timing undefined, just return as no-op:
+	 * Happens during initial modesetting of a crtc.
+	 */
+	if (mode->crtc_clock == 0) {
+		DRM_DEBUG("crtc %u: Noop due to uninitialized mode.\n", pipe);
+		WARN_ON_ONCE(drm_drv_uses_atomic_modeset(dev));
+
+		return false;
+	}
+
+	/* Get current scanout position with system timestamp.
+	 * Repeat query up to DRM_TIMESTAMP_MAXRETRIES times
+	 * if single query takes longer than max_error nanoseconds.
+	 *
+	 * This guarantees a tight bound on maximum error if
+	 * code gets preempted or delayed for some reason.
+	 */
+	for (i = 0; i < I915_TIMESTAMP_MAXRETRIES; i++) {
+		/*
+		 * Get vertical and horizontal scanout position vpos, hpos,
+		 * and bounding timestamps stime, etime, pre/post query.
+		 */
+		vbl_status = i915_get_crtc_scanoutpos(dev, pipe, in_vblank_irq,
+						      &vpos, &hpos, &stime,
+						      &etime, mode);
+		/* Return as no-op if scanout query unsupported or failed. */
+		if (!vbl_status) {
+			DRM_DEBUG("crtc %u : scanoutpos query failed.\n",
+				  pipe);
+			return false;
+		}
+
+		/* Compute uncertainty in timestamp of scanout position query. */
+		duration_ns = ktime_to_ns(etime) - ktime_to_ns(stime);
+
+		/* Accept result with <  max_error nsecs timing uncertainty. */
+		if (duration_ns <= *max_error)
+			break;
+	}
+
+	/* Noisy system timing? */
+	if (i == I915_TIMESTAMP_MAXRETRIES) {
+		DRM_DEBUG("crtc %u: Noisy timestamp %d us > %d us [%d reps].\n",
+			  pipe, duration_ns/1000, *max_error/1000, i);
+	}
+
+	/* Return upper bound of timestamp precision error. */
+	*max_error = duration_ns;
+
+	/* Convert scanout position into elapsed time at raw_time query
+	 * since start of scanout at first display scanline. delta_ns
+	 * can be negative if start of scanout hasn't happened yet.
+	 */
+	delta_ns = div_s64(1000000LL * (vpos * mode->crtc_htotal + hpos),
+			   mode->crtc_clock);
+
+	/* Subtract time delta from raw timestamp to get final
+	 * vblank_time timestamp for end of vblank.
+	 */
+	*vblank_time = ktime_sub_ns(etime, delta_ns);
+
+	if (!drm_debug_enabled(DRM_UT_VBL))
+		return true;
+
+	ts_etime = ktime_to_timespec64(etime);
+	ts_vblank_time = ktime_to_timespec64(*vblank_time);
+
+	DRM_DEBUG_VBL("crtc %u : v p(%d,%d)@ %lld.%06ld -> %lld.%06ld [e %d us, %d rep]\n",
+		      pipe, hpos, vpos,
+		      (u64)ts_etime.tv_sec, ts_etime.tv_nsec / 1000,
+		      (u64)ts_vblank_time.tv_sec, ts_vblank_time.tv_nsec / 1000,
+		      duration_ns / 1000, i);
+
+	return true;
+}
+
 int intel_get_crtc_scanline(struct intel_crtc *crtc)
 {
 	struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
diff --git a/drivers/gpu/drm/i915/i915_irq.h b/drivers/gpu/drm/i915/i915_irq.h
index 812c47a9c2d6..5f7b133ce721 100644
--- a/drivers/gpu/drm/i915/i915_irq.h
+++ b/drivers/gpu/drm/i915/i915_irq.h
@@ -101,10 +101,11 @@ void gen8_irq_power_well_post_enable(struct drm_i915_private *dev_priv,
 void gen8_irq_power_well_pre_disable(struct drm_i915_private *dev_priv,
 				     u8 pipe_mask);
 
-bool i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe,
-			      bool in_vblank_irq, int *vpos, int *hpos,
-			      ktime_t *stime, ktime_t *etime,
-			      const struct drm_display_mode *mode);
+bool i915_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
+					    unsigned int pipe,
+					    int *max_error,
+					    ktime_t *vblank_time,
+					    bool in_vblank_irq);
 
 u32 i915_get_vblank_counter(struct drm_crtc *crtc);
 u32 g4x_get_vblank_counter(struct drm_crtc *crtc);
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 03/23] drm/i915: Don't use struct drm_driver.get_scanout_position()
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

The callback struct drm_driver.get_scanout_position() is deprecated in
favor of struct drm_crtc_helper_funcs.get_scanout_position().

i915 doesn't use CRTC helpers. The patch duplicates the caller
drm_calc_vbltimestamp_from_scanoutpos() for i915, such that the callback
function is not needed.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/i915/i915_drv.c |   3 +-
 drivers/gpu/drm/i915/i915_irq.c | 117 ++++++++++++++++++++++++++++++--
 drivers/gpu/drm/i915/i915_irq.h |   9 +--
 3 files changed, 119 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index f7385abdd74b..4a0a7fb85c53 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -2769,8 +2769,7 @@ static struct drm_driver driver = {
 	.gem_prime_export = i915_gem_prime_export,
 	.gem_prime_import = i915_gem_prime_import,
 
-	.get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
-	.get_scanout_position = i915_get_crtc_scanoutpos,
+	.get_vblank_timestamp = i915_calc_vbltimestamp_from_scanoutpos,
 
 	.dumb_create = i915_gem_dumb_create,
 	.dumb_map_offset = i915_gem_dumb_mmap_offset,
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index afc6aad9bf8c..99d0c3b0feae 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -52,6 +52,11 @@
 #include "i915_trace.h"
 #include "intel_pm.h"
 
+/* Retry timestamp calculation up to 3 times to satisfy
+ * drm_timestamp_precision before giving up.
+ */
+#define I915_TIMESTAMP_MAXRETRIES 3
+
 /**
  * DOC: interrupt handling
  *
@@ -762,10 +767,11 @@ static int __intel_get_crtc_scanline(struct intel_crtc *crtc)
 	return (position + crtc->scanline_offset) % vtotal;
 }
 
-bool i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int index,
-			      bool in_vblank_irq, int *vpos, int *hpos,
-			      ktime_t *stime, ktime_t *etime,
-			      const struct drm_display_mode *mode)
+static bool i915_get_crtc_scanoutpos(struct drm_device *dev,
+				     unsigned int index, bool in_vblank_irq,
+				     int *vpos, int *hpos,
+				     ktime_t *stime, ktime_t *etime,
+				     const struct drm_display_mode *mode)
 {
 	struct drm_i915_private *dev_priv = to_i915(dev);
 	struct intel_crtc *crtc = to_intel_crtc(drm_crtc_from_index(dev, index));
@@ -879,6 +885,109 @@ bool i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int index,
 	return true;
 }
 
+bool i915_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
+					    unsigned int pipe,
+					    int *max_error,
+					    ktime_t *vblank_time,
+					    bool in_vblank_irq)
+{
+	struct timespec64 ts_etime, ts_vblank_time;
+	ktime_t stime, etime;
+	bool vbl_status;
+	struct drm_crtc *crtc;
+	const struct drm_display_mode *mode;
+	struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
+	int vpos, hpos, i;
+	int delta_ns, duration_ns;
+
+	crtc = drm_crtc_from_index(dev, pipe);
+
+	if (pipe >= dev->num_crtcs || !crtc) {
+		DRM_ERROR("Invalid crtc %u\n", pipe);
+		return false;
+	}
+
+	if (drm_drv_uses_atomic_modeset(dev))
+		mode = &vblank->hwmode;
+	else
+		mode = &crtc->hwmode;
+
+	/* If mode timing undefined, just return as no-op:
+	 * Happens during initial modesetting of a crtc.
+	 */
+	if (mode->crtc_clock == 0) {
+		DRM_DEBUG("crtc %u: Noop due to uninitialized mode.\n", pipe);
+		WARN_ON_ONCE(drm_drv_uses_atomic_modeset(dev));
+
+		return false;
+	}
+
+	/* Get current scanout position with system timestamp.
+	 * Repeat query up to DRM_TIMESTAMP_MAXRETRIES times
+	 * if single query takes longer than max_error nanoseconds.
+	 *
+	 * This guarantees a tight bound on maximum error if
+	 * code gets preempted or delayed for some reason.
+	 */
+	for (i = 0; i < I915_TIMESTAMP_MAXRETRIES; i++) {
+		/*
+		 * Get vertical and horizontal scanout position vpos, hpos,
+		 * and bounding timestamps stime, etime, pre/post query.
+		 */
+		vbl_status = i915_get_crtc_scanoutpos(dev, pipe, in_vblank_irq,
+						      &vpos, &hpos, &stime,
+						      &etime, mode);
+		/* Return as no-op if scanout query unsupported or failed. */
+		if (!vbl_status) {
+			DRM_DEBUG("crtc %u : scanoutpos query failed.\n",
+				  pipe);
+			return false;
+		}
+
+		/* Compute uncertainty in timestamp of scanout position query. */
+		duration_ns = ktime_to_ns(etime) - ktime_to_ns(stime);
+
+		/* Accept result with <  max_error nsecs timing uncertainty. */
+		if (duration_ns <= *max_error)
+			break;
+	}
+
+	/* Noisy system timing? */
+	if (i == I915_TIMESTAMP_MAXRETRIES) {
+		DRM_DEBUG("crtc %u: Noisy timestamp %d us > %d us [%d reps].\n",
+			  pipe, duration_ns/1000, *max_error/1000, i);
+	}
+
+	/* Return upper bound of timestamp precision error. */
+	*max_error = duration_ns;
+
+	/* Convert scanout position into elapsed time at raw_time query
+	 * since start of scanout at first display scanline. delta_ns
+	 * can be negative if start of scanout hasn't happened yet.
+	 */
+	delta_ns = div_s64(1000000LL * (vpos * mode->crtc_htotal + hpos),
+			   mode->crtc_clock);
+
+	/* Subtract time delta from raw timestamp to get final
+	 * vblank_time timestamp for end of vblank.
+	 */
+	*vblank_time = ktime_sub_ns(etime, delta_ns);
+
+	if (!drm_debug_enabled(DRM_UT_VBL))
+		return true;
+
+	ts_etime = ktime_to_timespec64(etime);
+	ts_vblank_time = ktime_to_timespec64(*vblank_time);
+
+	DRM_DEBUG_VBL("crtc %u : v p(%d,%d)@ %lld.%06ld -> %lld.%06ld [e %d us, %d rep]\n",
+		      pipe, hpos, vpos,
+		      (u64)ts_etime.tv_sec, ts_etime.tv_nsec / 1000,
+		      (u64)ts_vblank_time.tv_sec, ts_vblank_time.tv_nsec / 1000,
+		      duration_ns / 1000, i);
+
+	return true;
+}
+
 int intel_get_crtc_scanline(struct intel_crtc *crtc)
 {
 	struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
diff --git a/drivers/gpu/drm/i915/i915_irq.h b/drivers/gpu/drm/i915/i915_irq.h
index 812c47a9c2d6..5f7b133ce721 100644
--- a/drivers/gpu/drm/i915/i915_irq.h
+++ b/drivers/gpu/drm/i915/i915_irq.h
@@ -101,10 +101,11 @@ void gen8_irq_power_well_post_enable(struct drm_i915_private *dev_priv,
 void gen8_irq_power_well_pre_disable(struct drm_i915_private *dev_priv,
 				     u8 pipe_mask);
 
-bool i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe,
-			      bool in_vblank_irq, int *vpos, int *hpos,
-			      ktime_t *stime, ktime_t *etime,
-			      const struct drm_display_mode *mode);
+bool i915_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
+					    unsigned int pipe,
+					    int *max_error,
+					    ktime_t *vblank_time,
+					    bool in_vblank_irq);
 
 u32 i915_get_vblank_counter(struct drm_crtc *crtc);
 u32 g4x_get_vblank_counter(struct drm_crtc *crtc);
-- 
2.24.1

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 03/23] drm/i915: Don't use struct drm_driver.get_scanout_position()
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

The callback struct drm_driver.get_scanout_position() is deprecated in
favor of struct drm_crtc_helper_funcs.get_scanout_position().

i915 doesn't use CRTC helpers. The patch duplicates the caller
drm_calc_vbltimestamp_from_scanoutpos() for i915, such that the callback
function is not needed.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/i915/i915_drv.c |   3 +-
 drivers/gpu/drm/i915/i915_irq.c | 117 ++++++++++++++++++++++++++++++--
 drivers/gpu/drm/i915/i915_irq.h |   9 +--
 3 files changed, 119 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index f7385abdd74b..4a0a7fb85c53 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -2769,8 +2769,7 @@ static struct drm_driver driver = {
 	.gem_prime_export = i915_gem_prime_export,
 	.gem_prime_import = i915_gem_prime_import,
 
-	.get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
-	.get_scanout_position = i915_get_crtc_scanoutpos,
+	.get_vblank_timestamp = i915_calc_vbltimestamp_from_scanoutpos,
 
 	.dumb_create = i915_gem_dumb_create,
 	.dumb_map_offset = i915_gem_dumb_mmap_offset,
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index afc6aad9bf8c..99d0c3b0feae 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -52,6 +52,11 @@
 #include "i915_trace.h"
 #include "intel_pm.h"
 
+/* Retry timestamp calculation up to 3 times to satisfy
+ * drm_timestamp_precision before giving up.
+ */
+#define I915_TIMESTAMP_MAXRETRIES 3
+
 /**
  * DOC: interrupt handling
  *
@@ -762,10 +767,11 @@ static int __intel_get_crtc_scanline(struct intel_crtc *crtc)
 	return (position + crtc->scanline_offset) % vtotal;
 }
 
-bool i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int index,
-			      bool in_vblank_irq, int *vpos, int *hpos,
-			      ktime_t *stime, ktime_t *etime,
-			      const struct drm_display_mode *mode)
+static bool i915_get_crtc_scanoutpos(struct drm_device *dev,
+				     unsigned int index, bool in_vblank_irq,
+				     int *vpos, int *hpos,
+				     ktime_t *stime, ktime_t *etime,
+				     const struct drm_display_mode *mode)
 {
 	struct drm_i915_private *dev_priv = to_i915(dev);
 	struct intel_crtc *crtc = to_intel_crtc(drm_crtc_from_index(dev, index));
@@ -879,6 +885,109 @@ bool i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int index,
 	return true;
 }
 
+bool i915_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
+					    unsigned int pipe,
+					    int *max_error,
+					    ktime_t *vblank_time,
+					    bool in_vblank_irq)
+{
+	struct timespec64 ts_etime, ts_vblank_time;
+	ktime_t stime, etime;
+	bool vbl_status;
+	struct drm_crtc *crtc;
+	const struct drm_display_mode *mode;
+	struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
+	int vpos, hpos, i;
+	int delta_ns, duration_ns;
+
+	crtc = drm_crtc_from_index(dev, pipe);
+
+	if (pipe >= dev->num_crtcs || !crtc) {
+		DRM_ERROR("Invalid crtc %u\n", pipe);
+		return false;
+	}
+
+	if (drm_drv_uses_atomic_modeset(dev))
+		mode = &vblank->hwmode;
+	else
+		mode = &crtc->hwmode;
+
+	/* If mode timing undefined, just return as no-op:
+	 * Happens during initial modesetting of a crtc.
+	 */
+	if (mode->crtc_clock == 0) {
+		DRM_DEBUG("crtc %u: Noop due to uninitialized mode.\n", pipe);
+		WARN_ON_ONCE(drm_drv_uses_atomic_modeset(dev));
+
+		return false;
+	}
+
+	/* Get current scanout position with system timestamp.
+	 * Repeat query up to DRM_TIMESTAMP_MAXRETRIES times
+	 * if single query takes longer than max_error nanoseconds.
+	 *
+	 * This guarantees a tight bound on maximum error if
+	 * code gets preempted or delayed for some reason.
+	 */
+	for (i = 0; i < I915_TIMESTAMP_MAXRETRIES; i++) {
+		/*
+		 * Get vertical and horizontal scanout position vpos, hpos,
+		 * and bounding timestamps stime, etime, pre/post query.
+		 */
+		vbl_status = i915_get_crtc_scanoutpos(dev, pipe, in_vblank_irq,
+						      &vpos, &hpos, &stime,
+						      &etime, mode);
+		/* Return as no-op if scanout query unsupported or failed. */
+		if (!vbl_status) {
+			DRM_DEBUG("crtc %u : scanoutpos query failed.\n",
+				  pipe);
+			return false;
+		}
+
+		/* Compute uncertainty in timestamp of scanout position query. */
+		duration_ns = ktime_to_ns(etime) - ktime_to_ns(stime);
+
+		/* Accept result with <  max_error nsecs timing uncertainty. */
+		if (duration_ns <= *max_error)
+			break;
+	}
+
+	/* Noisy system timing? */
+	if (i == I915_TIMESTAMP_MAXRETRIES) {
+		DRM_DEBUG("crtc %u: Noisy timestamp %d us > %d us [%d reps].\n",
+			  pipe, duration_ns/1000, *max_error/1000, i);
+	}
+
+	/* Return upper bound of timestamp precision error. */
+	*max_error = duration_ns;
+
+	/* Convert scanout position into elapsed time at raw_time query
+	 * since start of scanout at first display scanline. delta_ns
+	 * can be negative if start of scanout hasn't happened yet.
+	 */
+	delta_ns = div_s64(1000000LL * (vpos * mode->crtc_htotal + hpos),
+			   mode->crtc_clock);
+
+	/* Subtract time delta from raw timestamp to get final
+	 * vblank_time timestamp for end of vblank.
+	 */
+	*vblank_time = ktime_sub_ns(etime, delta_ns);
+
+	if (!drm_debug_enabled(DRM_UT_VBL))
+		return true;
+
+	ts_etime = ktime_to_timespec64(etime);
+	ts_vblank_time = ktime_to_timespec64(*vblank_time);
+
+	DRM_DEBUG_VBL("crtc %u : v p(%d,%d)@ %lld.%06ld -> %lld.%06ld [e %d us, %d rep]\n",
+		      pipe, hpos, vpos,
+		      (u64)ts_etime.tv_sec, ts_etime.tv_nsec / 1000,
+		      (u64)ts_vblank_time.tv_sec, ts_vblank_time.tv_nsec / 1000,
+		      duration_ns / 1000, i);
+
+	return true;
+}
+
 int intel_get_crtc_scanline(struct intel_crtc *crtc)
 {
 	struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
diff --git a/drivers/gpu/drm/i915/i915_irq.h b/drivers/gpu/drm/i915/i915_irq.h
index 812c47a9c2d6..5f7b133ce721 100644
--- a/drivers/gpu/drm/i915/i915_irq.h
+++ b/drivers/gpu/drm/i915/i915_irq.h
@@ -101,10 +101,11 @@ void gen8_irq_power_well_post_enable(struct drm_i915_private *dev_priv,
 void gen8_irq_power_well_pre_disable(struct drm_i915_private *dev_priv,
 				     u8 pipe_mask);
 
-bool i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe,
-			      bool in_vblank_irq, int *vpos, int *hpos,
-			      ktime_t *stime, ktime_t *etime,
-			      const struct drm_display_mode *mode);
+bool i915_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
+					    unsigned int pipe,
+					    int *max_error,
+					    ktime_t *vblank_time,
+					    bool in_vblank_irq);
 
 u32 i915_get_vblank_counter(struct drm_crtc *crtc);
 u32 g4x_get_vblank_counter(struct drm_crtc *crtc);
-- 
2.24.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [Intel-gfx] [PATCH 03/23] drm/i915: Don't use struct drm_driver.get_scanout_position()
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

The callback struct drm_driver.get_scanout_position() is deprecated in
favor of struct drm_crtc_helper_funcs.get_scanout_position().

i915 doesn't use CRTC helpers. The patch duplicates the caller
drm_calc_vbltimestamp_from_scanoutpos() for i915, such that the callback
function is not needed.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/i915/i915_drv.c |   3 +-
 drivers/gpu/drm/i915/i915_irq.c | 117 ++++++++++++++++++++++++++++++--
 drivers/gpu/drm/i915/i915_irq.h |   9 +--
 3 files changed, 119 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index f7385abdd74b..4a0a7fb85c53 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -2769,8 +2769,7 @@ static struct drm_driver driver = {
 	.gem_prime_export = i915_gem_prime_export,
 	.gem_prime_import = i915_gem_prime_import,
 
-	.get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
-	.get_scanout_position = i915_get_crtc_scanoutpos,
+	.get_vblank_timestamp = i915_calc_vbltimestamp_from_scanoutpos,
 
 	.dumb_create = i915_gem_dumb_create,
 	.dumb_map_offset = i915_gem_dumb_mmap_offset,
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index afc6aad9bf8c..99d0c3b0feae 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -52,6 +52,11 @@
 #include "i915_trace.h"
 #include "intel_pm.h"
 
+/* Retry timestamp calculation up to 3 times to satisfy
+ * drm_timestamp_precision before giving up.
+ */
+#define I915_TIMESTAMP_MAXRETRIES 3
+
 /**
  * DOC: interrupt handling
  *
@@ -762,10 +767,11 @@ static int __intel_get_crtc_scanline(struct intel_crtc *crtc)
 	return (position + crtc->scanline_offset) % vtotal;
 }
 
-bool i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int index,
-			      bool in_vblank_irq, int *vpos, int *hpos,
-			      ktime_t *stime, ktime_t *etime,
-			      const struct drm_display_mode *mode)
+static bool i915_get_crtc_scanoutpos(struct drm_device *dev,
+				     unsigned int index, bool in_vblank_irq,
+				     int *vpos, int *hpos,
+				     ktime_t *stime, ktime_t *etime,
+				     const struct drm_display_mode *mode)
 {
 	struct drm_i915_private *dev_priv = to_i915(dev);
 	struct intel_crtc *crtc = to_intel_crtc(drm_crtc_from_index(dev, index));
@@ -879,6 +885,109 @@ bool i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int index,
 	return true;
 }
 
+bool i915_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
+					    unsigned int pipe,
+					    int *max_error,
+					    ktime_t *vblank_time,
+					    bool in_vblank_irq)
+{
+	struct timespec64 ts_etime, ts_vblank_time;
+	ktime_t stime, etime;
+	bool vbl_status;
+	struct drm_crtc *crtc;
+	const struct drm_display_mode *mode;
+	struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
+	int vpos, hpos, i;
+	int delta_ns, duration_ns;
+
+	crtc = drm_crtc_from_index(dev, pipe);
+
+	if (pipe >= dev->num_crtcs || !crtc) {
+		DRM_ERROR("Invalid crtc %u\n", pipe);
+		return false;
+	}
+
+	if (drm_drv_uses_atomic_modeset(dev))
+		mode = &vblank->hwmode;
+	else
+		mode = &crtc->hwmode;
+
+	/* If mode timing undefined, just return as no-op:
+	 * Happens during initial modesetting of a crtc.
+	 */
+	if (mode->crtc_clock == 0) {
+		DRM_DEBUG("crtc %u: Noop due to uninitialized mode.\n", pipe);
+		WARN_ON_ONCE(drm_drv_uses_atomic_modeset(dev));
+
+		return false;
+	}
+
+	/* Get current scanout position with system timestamp.
+	 * Repeat query up to DRM_TIMESTAMP_MAXRETRIES times
+	 * if single query takes longer than max_error nanoseconds.
+	 *
+	 * This guarantees a tight bound on maximum error if
+	 * code gets preempted or delayed for some reason.
+	 */
+	for (i = 0; i < I915_TIMESTAMP_MAXRETRIES; i++) {
+		/*
+		 * Get vertical and horizontal scanout position vpos, hpos,
+		 * and bounding timestamps stime, etime, pre/post query.
+		 */
+		vbl_status = i915_get_crtc_scanoutpos(dev, pipe, in_vblank_irq,
+						      &vpos, &hpos, &stime,
+						      &etime, mode);
+		/* Return as no-op if scanout query unsupported or failed. */
+		if (!vbl_status) {
+			DRM_DEBUG("crtc %u : scanoutpos query failed.\n",
+				  pipe);
+			return false;
+		}
+
+		/* Compute uncertainty in timestamp of scanout position query. */
+		duration_ns = ktime_to_ns(etime) - ktime_to_ns(stime);
+
+		/* Accept result with <  max_error nsecs timing uncertainty. */
+		if (duration_ns <= *max_error)
+			break;
+	}
+
+	/* Noisy system timing? */
+	if (i == I915_TIMESTAMP_MAXRETRIES) {
+		DRM_DEBUG("crtc %u: Noisy timestamp %d us > %d us [%d reps].\n",
+			  pipe, duration_ns/1000, *max_error/1000, i);
+	}
+
+	/* Return upper bound of timestamp precision error. */
+	*max_error = duration_ns;
+
+	/* Convert scanout position into elapsed time at raw_time query
+	 * since start of scanout at first display scanline. delta_ns
+	 * can be negative if start of scanout hasn't happened yet.
+	 */
+	delta_ns = div_s64(1000000LL * (vpos * mode->crtc_htotal + hpos),
+			   mode->crtc_clock);
+
+	/* Subtract time delta from raw timestamp to get final
+	 * vblank_time timestamp for end of vblank.
+	 */
+	*vblank_time = ktime_sub_ns(etime, delta_ns);
+
+	if (!drm_debug_enabled(DRM_UT_VBL))
+		return true;
+
+	ts_etime = ktime_to_timespec64(etime);
+	ts_vblank_time = ktime_to_timespec64(*vblank_time);
+
+	DRM_DEBUG_VBL("crtc %u : v p(%d,%d)@ %lld.%06ld -> %lld.%06ld [e %d us, %d rep]\n",
+		      pipe, hpos, vpos,
+		      (u64)ts_etime.tv_sec, ts_etime.tv_nsec / 1000,
+		      (u64)ts_vblank_time.tv_sec, ts_vblank_time.tv_nsec / 1000,
+		      duration_ns / 1000, i);
+
+	return true;
+}
+
 int intel_get_crtc_scanline(struct intel_crtc *crtc)
 {
 	struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
diff --git a/drivers/gpu/drm/i915/i915_irq.h b/drivers/gpu/drm/i915/i915_irq.h
index 812c47a9c2d6..5f7b133ce721 100644
--- a/drivers/gpu/drm/i915/i915_irq.h
+++ b/drivers/gpu/drm/i915/i915_irq.h
@@ -101,10 +101,11 @@ void gen8_irq_power_well_post_enable(struct drm_i915_private *dev_priv,
 void gen8_irq_power_well_pre_disable(struct drm_i915_private *dev_priv,
 				     u8 pipe_mask);
 
-bool i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe,
-			      bool in_vblank_irq, int *vpos, int *hpos,
-			      ktime_t *stime, ktime_t *etime,
-			      const struct drm_display_mode *mode);
+bool i915_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
+					    unsigned int pipe,
+					    int *max_error,
+					    ktime_t *vblank_time,
+					    bool in_vblank_irq);
 
 u32 i915_get_vblank_counter(struct drm_crtc *crtc);
 u32 g4x_get_vblank_counter(struct drm_crtc *crtc);
-- 
2.24.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 03/23] drm/i915: Don't use struct drm_driver.get_scanout_position()
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

The callback struct drm_driver.get_scanout_position() is deprecated in
favor of struct drm_crtc_helper_funcs.get_scanout_position().

i915 doesn't use CRTC helpers. The patch duplicates the caller
drm_calc_vbltimestamp_from_scanoutpos() for i915, such that the callback
function is not needed.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/i915/i915_drv.c |   3 +-
 drivers/gpu/drm/i915/i915_irq.c | 117 ++++++++++++++++++++++++++++++--
 drivers/gpu/drm/i915/i915_irq.h |   9 +--
 3 files changed, 119 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index f7385abdd74b..4a0a7fb85c53 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -2769,8 +2769,7 @@ static struct drm_driver driver = {
 	.gem_prime_export = i915_gem_prime_export,
 	.gem_prime_import = i915_gem_prime_import,
 
-	.get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
-	.get_scanout_position = i915_get_crtc_scanoutpos,
+	.get_vblank_timestamp = i915_calc_vbltimestamp_from_scanoutpos,
 
 	.dumb_create = i915_gem_dumb_create,
 	.dumb_map_offset = i915_gem_dumb_mmap_offset,
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index afc6aad9bf8c..99d0c3b0feae 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -52,6 +52,11 @@
 #include "i915_trace.h"
 #include "intel_pm.h"
 
+/* Retry timestamp calculation up to 3 times to satisfy
+ * drm_timestamp_precision before giving up.
+ */
+#define I915_TIMESTAMP_MAXRETRIES 3
+
 /**
  * DOC: interrupt handling
  *
@@ -762,10 +767,11 @@ static int __intel_get_crtc_scanline(struct intel_crtc *crtc)
 	return (position + crtc->scanline_offset) % vtotal;
 }
 
-bool i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int index,
-			      bool in_vblank_irq, int *vpos, int *hpos,
-			      ktime_t *stime, ktime_t *etime,
-			      const struct drm_display_mode *mode)
+static bool i915_get_crtc_scanoutpos(struct drm_device *dev,
+				     unsigned int index, bool in_vblank_irq,
+				     int *vpos, int *hpos,
+				     ktime_t *stime, ktime_t *etime,
+				     const struct drm_display_mode *mode)
 {
 	struct drm_i915_private *dev_priv = to_i915(dev);
 	struct intel_crtc *crtc = to_intel_crtc(drm_crtc_from_index(dev, index));
@@ -879,6 +885,109 @@ bool i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int index,
 	return true;
 }
 
+bool i915_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
+					    unsigned int pipe,
+					    int *max_error,
+					    ktime_t *vblank_time,
+					    bool in_vblank_irq)
+{
+	struct timespec64 ts_etime, ts_vblank_time;
+	ktime_t stime, etime;
+	bool vbl_status;
+	struct drm_crtc *crtc;
+	const struct drm_display_mode *mode;
+	struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
+	int vpos, hpos, i;
+	int delta_ns, duration_ns;
+
+	crtc = drm_crtc_from_index(dev, pipe);
+
+	if (pipe >= dev->num_crtcs || !crtc) {
+		DRM_ERROR("Invalid crtc %u\n", pipe);
+		return false;
+	}
+
+	if (drm_drv_uses_atomic_modeset(dev))
+		mode = &vblank->hwmode;
+	else
+		mode = &crtc->hwmode;
+
+	/* If mode timing undefined, just return as no-op:
+	 * Happens during initial modesetting of a crtc.
+	 */
+	if (mode->crtc_clock == 0) {
+		DRM_DEBUG("crtc %u: Noop due to uninitialized mode.\n", pipe);
+		WARN_ON_ONCE(drm_drv_uses_atomic_modeset(dev));
+
+		return false;
+	}
+
+	/* Get current scanout position with system timestamp.
+	 * Repeat query up to DRM_TIMESTAMP_MAXRETRIES times
+	 * if single query takes longer than max_error nanoseconds.
+	 *
+	 * This guarantees a tight bound on maximum error if
+	 * code gets preempted or delayed for some reason.
+	 */
+	for (i = 0; i < I915_TIMESTAMP_MAXRETRIES; i++) {
+		/*
+		 * Get vertical and horizontal scanout position vpos, hpos,
+		 * and bounding timestamps stime, etime, pre/post query.
+		 */
+		vbl_status = i915_get_crtc_scanoutpos(dev, pipe, in_vblank_irq,
+						      &vpos, &hpos, &stime,
+						      &etime, mode);
+		/* Return as no-op if scanout query unsupported or failed. */
+		if (!vbl_status) {
+			DRM_DEBUG("crtc %u : scanoutpos query failed.\n",
+				  pipe);
+			return false;
+		}
+
+		/* Compute uncertainty in timestamp of scanout position query. */
+		duration_ns = ktime_to_ns(etime) - ktime_to_ns(stime);
+
+		/* Accept result with <  max_error nsecs timing uncertainty. */
+		if (duration_ns <= *max_error)
+			break;
+	}
+
+	/* Noisy system timing? */
+	if (i == I915_TIMESTAMP_MAXRETRIES) {
+		DRM_DEBUG("crtc %u: Noisy timestamp %d us > %d us [%d reps].\n",
+			  pipe, duration_ns/1000, *max_error/1000, i);
+	}
+
+	/* Return upper bound of timestamp precision error. */
+	*max_error = duration_ns;
+
+	/* Convert scanout position into elapsed time at raw_time query
+	 * since start of scanout at first display scanline. delta_ns
+	 * can be negative if start of scanout hasn't happened yet.
+	 */
+	delta_ns = div_s64(1000000LL * (vpos * mode->crtc_htotal + hpos),
+			   mode->crtc_clock);
+
+	/* Subtract time delta from raw timestamp to get final
+	 * vblank_time timestamp for end of vblank.
+	 */
+	*vblank_time = ktime_sub_ns(etime, delta_ns);
+
+	if (!drm_debug_enabled(DRM_UT_VBL))
+		return true;
+
+	ts_etime = ktime_to_timespec64(etime);
+	ts_vblank_time = ktime_to_timespec64(*vblank_time);
+
+	DRM_DEBUG_VBL("crtc %u : v p(%d,%d)@ %lld.%06ld -> %lld.%06ld [e %d us, %d rep]\n",
+		      pipe, hpos, vpos,
+		      (u64)ts_etime.tv_sec, ts_etime.tv_nsec / 1000,
+		      (u64)ts_vblank_time.tv_sec, ts_vblank_time.tv_nsec / 1000,
+		      duration_ns / 1000, i);
+
+	return true;
+}
+
 int intel_get_crtc_scanline(struct intel_crtc *crtc)
 {
 	struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
diff --git a/drivers/gpu/drm/i915/i915_irq.h b/drivers/gpu/drm/i915/i915_irq.h
index 812c47a9c2d6..5f7b133ce721 100644
--- a/drivers/gpu/drm/i915/i915_irq.h
+++ b/drivers/gpu/drm/i915/i915_irq.h
@@ -101,10 +101,11 @@ void gen8_irq_power_well_post_enable(struct drm_i915_private *dev_priv,
 void gen8_irq_power_well_pre_disable(struct drm_i915_private *dev_priv,
 				     u8 pipe_mask);
 
-bool i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe,
-			      bool in_vblank_irq, int *vpos, int *hpos,
-			      ktime_t *stime, ktime_t *etime,
-			      const struct drm_display_mode *mode);
+bool i915_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
+					    unsigned int pipe,
+					    int *max_error,
+					    ktime_t *vblank_time,
+					    bool in_vblank_irq);
 
 u32 i915_get_vblank_counter(struct drm_crtc *crtc);
 u32 g4x_get_vblank_counter(struct drm_crtc *crtc);
-- 
2.24.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 04/23] drm/nouveau: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
  2020-01-10  9:21 ` Thomas Zimmermann
  (?)
  (?)
@ 2020-01-10  9:21   ` Thomas Zimmermann
  -1 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: dri-devel, amd-gfx, intel-gfx, linux-arm-msm, freedreno, nouveau,
	Thomas Zimmermann

The callback struct drm_driver.get_scanout_position() is deprecated in
favor of struct drm_crtc_helper_funcs.get_scanout_position(). Convert
nouveau over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/nouveau/dispnv04/crtc.c   |  1 +
 drivers/gpu/drm/nouveau/dispnv50/head.c   |  1 +
 drivers/gpu/drm/nouveau/nouveau_display.c | 14 +++-----------
 drivers/gpu/drm/nouveau/nouveau_display.h |  2 +-
 drivers/gpu/drm/nouveau/nouveau_drm.c     |  1 -
 5 files changed, 6 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/dispnv04/crtc.c b/drivers/gpu/drm/nouveau/dispnv04/crtc.c
index 37c50ea8f847..17e9d1c078a0 100644
--- a/drivers/gpu/drm/nouveau/dispnv04/crtc.c
+++ b/drivers/gpu/drm/nouveau/dispnv04/crtc.c
@@ -1258,6 +1258,7 @@ static const struct drm_crtc_helper_funcs nv04_crtc_helper_funcs = {
 	.mode_set_base = nv04_crtc_mode_set_base,
 	.mode_set_base_atomic = nv04_crtc_mode_set_base_atomic,
 	.disable = nv_crtc_disable,
+	.get_scanout_position = nouveau_display_scanoutpos,
 };
 
 static const uint32_t modeset_formats[] = {
diff --git a/drivers/gpu/drm/nouveau/dispnv50/head.c b/drivers/gpu/drm/nouveau/dispnv50/head.c
index c9692df2b76c..1354d19d9a18 100644
--- a/drivers/gpu/drm/nouveau/dispnv50/head.c
+++ b/drivers/gpu/drm/nouveau/dispnv50/head.c
@@ -403,6 +403,7 @@ nv50_head_atomic_check(struct drm_crtc *crtc, struct drm_crtc_state *state)
 static const struct drm_crtc_helper_funcs
 nv50_head_help = {
 	.atomic_check = nv50_head_atomic_check,
+	.get_scanout_position = nouveau_display_scanoutpos,
 };
 
 static void
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c
index 53f9bceaf17a..86f99dc8fcef 100644
--- a/drivers/gpu/drm/nouveau/nouveau_display.c
+++ b/drivers/gpu/drm/nouveau/nouveau_display.c
@@ -136,21 +136,13 @@ nouveau_display_scanoutpos_head(struct drm_crtc *crtc, int *vpos, int *hpos,
 }
 
 bool
-nouveau_display_scanoutpos(struct drm_device *dev, unsigned int pipe,
+nouveau_display_scanoutpos(struct drm_crtc *crtc,
 			   bool in_vblank_irq, int *vpos, int *hpos,
 			   ktime_t *stime, ktime_t *etime,
 			   const struct drm_display_mode *mode)
 {
-	struct drm_crtc *crtc;
-
-	list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
-		if (nouveau_crtc(crtc)->index == pipe) {
-			return nouveau_display_scanoutpos_head(crtc, vpos, hpos,
-							       stime, etime);
-		}
-	}
-
-	return false;
+	return nouveau_display_scanoutpos_head(crtc, vpos, hpos,
+					       stime, etime);
 }
 
 static void
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.h b/drivers/gpu/drm/nouveau/nouveau_display.h
index 6e8e66882e45..71e2af693f7f 100644
--- a/drivers/gpu/drm/nouveau/nouveau_display.h
+++ b/drivers/gpu/drm/nouveau/nouveau_display.h
@@ -63,7 +63,7 @@ int  nouveau_display_suspend(struct drm_device *dev, bool runtime);
 void nouveau_display_resume(struct drm_device *dev, bool runtime);
 int  nouveau_display_vblank_enable(struct drm_device *, unsigned int);
 void nouveau_display_vblank_disable(struct drm_device *, unsigned int);
-bool  nouveau_display_scanoutpos(struct drm_device *, unsigned int,
+bool  nouveau_display_scanoutpos(struct drm_crtc *,
 				 bool, int *, int *, ktime_t *,
 				 ktime_t *, const struct drm_display_mode *);
 
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c
index 2cd83849600f..9fb38a018240 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
@@ -1123,7 +1123,6 @@ driver_stub = {
 
 	.enable_vblank = nouveau_display_vblank_enable,
 	.disable_vblank = nouveau_display_vblank_disable,
-	.get_scanout_position = nouveau_display_scanoutpos,
 	.get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
 
 	.ioctls = nouveau_ioctls,
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 04/23] drm/nouveau: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

The callback struct drm_driver.get_scanout_position() is deprecated in
favor of struct drm_crtc_helper_funcs.get_scanout_position(). Convert
nouveau over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/nouveau/dispnv04/crtc.c   |  1 +
 drivers/gpu/drm/nouveau/dispnv50/head.c   |  1 +
 drivers/gpu/drm/nouveau/nouveau_display.c | 14 +++-----------
 drivers/gpu/drm/nouveau/nouveau_display.h |  2 +-
 drivers/gpu/drm/nouveau/nouveau_drm.c     |  1 -
 5 files changed, 6 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/dispnv04/crtc.c b/drivers/gpu/drm/nouveau/dispnv04/crtc.c
index 37c50ea8f847..17e9d1c078a0 100644
--- a/drivers/gpu/drm/nouveau/dispnv04/crtc.c
+++ b/drivers/gpu/drm/nouveau/dispnv04/crtc.c
@@ -1258,6 +1258,7 @@ static const struct drm_crtc_helper_funcs nv04_crtc_helper_funcs = {
 	.mode_set_base = nv04_crtc_mode_set_base,
 	.mode_set_base_atomic = nv04_crtc_mode_set_base_atomic,
 	.disable = nv_crtc_disable,
+	.get_scanout_position = nouveau_display_scanoutpos,
 };
 
 static const uint32_t modeset_formats[] = {
diff --git a/drivers/gpu/drm/nouveau/dispnv50/head.c b/drivers/gpu/drm/nouveau/dispnv50/head.c
index c9692df2b76c..1354d19d9a18 100644
--- a/drivers/gpu/drm/nouveau/dispnv50/head.c
+++ b/drivers/gpu/drm/nouveau/dispnv50/head.c
@@ -403,6 +403,7 @@ nv50_head_atomic_check(struct drm_crtc *crtc, struct drm_crtc_state *state)
 static const struct drm_crtc_helper_funcs
 nv50_head_help = {
 	.atomic_check = nv50_head_atomic_check,
+	.get_scanout_position = nouveau_display_scanoutpos,
 };
 
 static void
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c
index 53f9bceaf17a..86f99dc8fcef 100644
--- a/drivers/gpu/drm/nouveau/nouveau_display.c
+++ b/drivers/gpu/drm/nouveau/nouveau_display.c
@@ -136,21 +136,13 @@ nouveau_display_scanoutpos_head(struct drm_crtc *crtc, int *vpos, int *hpos,
 }
 
 bool
-nouveau_display_scanoutpos(struct drm_device *dev, unsigned int pipe,
+nouveau_display_scanoutpos(struct drm_crtc *crtc,
 			   bool in_vblank_irq, int *vpos, int *hpos,
 			   ktime_t *stime, ktime_t *etime,
 			   const struct drm_display_mode *mode)
 {
-	struct drm_crtc *crtc;
-
-	list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
-		if (nouveau_crtc(crtc)->index == pipe) {
-			return nouveau_display_scanoutpos_head(crtc, vpos, hpos,
-							       stime, etime);
-		}
-	}
-
-	return false;
+	return nouveau_display_scanoutpos_head(crtc, vpos, hpos,
+					       stime, etime);
 }
 
 static void
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.h b/drivers/gpu/drm/nouveau/nouveau_display.h
index 6e8e66882e45..71e2af693f7f 100644
--- a/drivers/gpu/drm/nouveau/nouveau_display.h
+++ b/drivers/gpu/drm/nouveau/nouveau_display.h
@@ -63,7 +63,7 @@ int  nouveau_display_suspend(struct drm_device *dev, bool runtime);
 void nouveau_display_resume(struct drm_device *dev, bool runtime);
 int  nouveau_display_vblank_enable(struct drm_device *, unsigned int);
 void nouveau_display_vblank_disable(struct drm_device *, unsigned int);
-bool  nouveau_display_scanoutpos(struct drm_device *, unsigned int,
+bool  nouveau_display_scanoutpos(struct drm_crtc *,
 				 bool, int *, int *, ktime_t *,
 				 ktime_t *, const struct drm_display_mode *);
 
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c
index 2cd83849600f..9fb38a018240 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
@@ -1123,7 +1123,6 @@ driver_stub = {
 
 	.enable_vblank = nouveau_display_vblank_enable,
 	.disable_vblank = nouveau_display_vblank_disable,
-	.get_scanout_position = nouveau_display_scanoutpos,
 	.get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
 
 	.ioctls = nouveau_ioctls,
-- 
2.24.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [Intel-gfx] [PATCH 04/23] drm/nouveau: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

The callback struct drm_driver.get_scanout_position() is deprecated in
favor of struct drm_crtc_helper_funcs.get_scanout_position(). Convert
nouveau over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/nouveau/dispnv04/crtc.c   |  1 +
 drivers/gpu/drm/nouveau/dispnv50/head.c   |  1 +
 drivers/gpu/drm/nouveau/nouveau_display.c | 14 +++-----------
 drivers/gpu/drm/nouveau/nouveau_display.h |  2 +-
 drivers/gpu/drm/nouveau/nouveau_drm.c     |  1 -
 5 files changed, 6 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/dispnv04/crtc.c b/drivers/gpu/drm/nouveau/dispnv04/crtc.c
index 37c50ea8f847..17e9d1c078a0 100644
--- a/drivers/gpu/drm/nouveau/dispnv04/crtc.c
+++ b/drivers/gpu/drm/nouveau/dispnv04/crtc.c
@@ -1258,6 +1258,7 @@ static const struct drm_crtc_helper_funcs nv04_crtc_helper_funcs = {
 	.mode_set_base = nv04_crtc_mode_set_base,
 	.mode_set_base_atomic = nv04_crtc_mode_set_base_atomic,
 	.disable = nv_crtc_disable,
+	.get_scanout_position = nouveau_display_scanoutpos,
 };
 
 static const uint32_t modeset_formats[] = {
diff --git a/drivers/gpu/drm/nouveau/dispnv50/head.c b/drivers/gpu/drm/nouveau/dispnv50/head.c
index c9692df2b76c..1354d19d9a18 100644
--- a/drivers/gpu/drm/nouveau/dispnv50/head.c
+++ b/drivers/gpu/drm/nouveau/dispnv50/head.c
@@ -403,6 +403,7 @@ nv50_head_atomic_check(struct drm_crtc *crtc, struct drm_crtc_state *state)
 static const struct drm_crtc_helper_funcs
 nv50_head_help = {
 	.atomic_check = nv50_head_atomic_check,
+	.get_scanout_position = nouveau_display_scanoutpos,
 };
 
 static void
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c
index 53f9bceaf17a..86f99dc8fcef 100644
--- a/drivers/gpu/drm/nouveau/nouveau_display.c
+++ b/drivers/gpu/drm/nouveau/nouveau_display.c
@@ -136,21 +136,13 @@ nouveau_display_scanoutpos_head(struct drm_crtc *crtc, int *vpos, int *hpos,
 }
 
 bool
-nouveau_display_scanoutpos(struct drm_device *dev, unsigned int pipe,
+nouveau_display_scanoutpos(struct drm_crtc *crtc,
 			   bool in_vblank_irq, int *vpos, int *hpos,
 			   ktime_t *stime, ktime_t *etime,
 			   const struct drm_display_mode *mode)
 {
-	struct drm_crtc *crtc;
-
-	list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
-		if (nouveau_crtc(crtc)->index == pipe) {
-			return nouveau_display_scanoutpos_head(crtc, vpos, hpos,
-							       stime, etime);
-		}
-	}
-
-	return false;
+	return nouveau_display_scanoutpos_head(crtc, vpos, hpos,
+					       stime, etime);
 }
 
 static void
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.h b/drivers/gpu/drm/nouveau/nouveau_display.h
index 6e8e66882e45..71e2af693f7f 100644
--- a/drivers/gpu/drm/nouveau/nouveau_display.h
+++ b/drivers/gpu/drm/nouveau/nouveau_display.h
@@ -63,7 +63,7 @@ int  nouveau_display_suspend(struct drm_device *dev, bool runtime);
 void nouveau_display_resume(struct drm_device *dev, bool runtime);
 int  nouveau_display_vblank_enable(struct drm_device *, unsigned int);
 void nouveau_display_vblank_disable(struct drm_device *, unsigned int);
-bool  nouveau_display_scanoutpos(struct drm_device *, unsigned int,
+bool  nouveau_display_scanoutpos(struct drm_crtc *,
 				 bool, int *, int *, ktime_t *,
 				 ktime_t *, const struct drm_display_mode *);
 
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c
index 2cd83849600f..9fb38a018240 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
@@ -1123,7 +1123,6 @@ driver_stub = {
 
 	.enable_vblank = nouveau_display_vblank_enable,
 	.disable_vblank = nouveau_display_vblank_disable,
-	.get_scanout_position = nouveau_display_scanoutpos,
 	.get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
 
 	.ioctls = nouveau_ioctls,
-- 
2.24.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 04/23] drm/nouveau: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

The callback struct drm_driver.get_scanout_position() is deprecated in
favor of struct drm_crtc_helper_funcs.get_scanout_position(). Convert
nouveau over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/nouveau/dispnv04/crtc.c   |  1 +
 drivers/gpu/drm/nouveau/dispnv50/head.c   |  1 +
 drivers/gpu/drm/nouveau/nouveau_display.c | 14 +++-----------
 drivers/gpu/drm/nouveau/nouveau_display.h |  2 +-
 drivers/gpu/drm/nouveau/nouveau_drm.c     |  1 -
 5 files changed, 6 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/dispnv04/crtc.c b/drivers/gpu/drm/nouveau/dispnv04/crtc.c
index 37c50ea8f847..17e9d1c078a0 100644
--- a/drivers/gpu/drm/nouveau/dispnv04/crtc.c
+++ b/drivers/gpu/drm/nouveau/dispnv04/crtc.c
@@ -1258,6 +1258,7 @@ static const struct drm_crtc_helper_funcs nv04_crtc_helper_funcs = {
 	.mode_set_base = nv04_crtc_mode_set_base,
 	.mode_set_base_atomic = nv04_crtc_mode_set_base_atomic,
 	.disable = nv_crtc_disable,
+	.get_scanout_position = nouveau_display_scanoutpos,
 };
 
 static const uint32_t modeset_formats[] = {
diff --git a/drivers/gpu/drm/nouveau/dispnv50/head.c b/drivers/gpu/drm/nouveau/dispnv50/head.c
index c9692df2b76c..1354d19d9a18 100644
--- a/drivers/gpu/drm/nouveau/dispnv50/head.c
+++ b/drivers/gpu/drm/nouveau/dispnv50/head.c
@@ -403,6 +403,7 @@ nv50_head_atomic_check(struct drm_crtc *crtc, struct drm_crtc_state *state)
 static const struct drm_crtc_helper_funcs
 nv50_head_help = {
 	.atomic_check = nv50_head_atomic_check,
+	.get_scanout_position = nouveau_display_scanoutpos,
 };
 
 static void
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c
index 53f9bceaf17a..86f99dc8fcef 100644
--- a/drivers/gpu/drm/nouveau/nouveau_display.c
+++ b/drivers/gpu/drm/nouveau/nouveau_display.c
@@ -136,21 +136,13 @@ nouveau_display_scanoutpos_head(struct drm_crtc *crtc, int *vpos, int *hpos,
 }
 
 bool
-nouveau_display_scanoutpos(struct drm_device *dev, unsigned int pipe,
+nouveau_display_scanoutpos(struct drm_crtc *crtc,
 			   bool in_vblank_irq, int *vpos, int *hpos,
 			   ktime_t *stime, ktime_t *etime,
 			   const struct drm_display_mode *mode)
 {
-	struct drm_crtc *crtc;
-
-	list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
-		if (nouveau_crtc(crtc)->index == pipe) {
-			return nouveau_display_scanoutpos_head(crtc, vpos, hpos,
-							       stime, etime);
-		}
-	}
-
-	return false;
+	return nouveau_display_scanoutpos_head(crtc, vpos, hpos,
+					       stime, etime);
 }
 
 static void
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.h b/drivers/gpu/drm/nouveau/nouveau_display.h
index 6e8e66882e45..71e2af693f7f 100644
--- a/drivers/gpu/drm/nouveau/nouveau_display.h
+++ b/drivers/gpu/drm/nouveau/nouveau_display.h
@@ -63,7 +63,7 @@ int  nouveau_display_suspend(struct drm_device *dev, bool runtime);
 void nouveau_display_resume(struct drm_device *dev, bool runtime);
 int  nouveau_display_vblank_enable(struct drm_device *, unsigned int);
 void nouveau_display_vblank_disable(struct drm_device *, unsigned int);
-bool  nouveau_display_scanoutpos(struct drm_device *, unsigned int,
+bool  nouveau_display_scanoutpos(struct drm_crtc *,
 				 bool, int *, int *, ktime_t *,
 				 ktime_t *, const struct drm_display_mode *);
 
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c
index 2cd83849600f..9fb38a018240 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
@@ -1123,7 +1123,6 @@ driver_stub = {
 
 	.enable_vblank = nouveau_display_vblank_enable,
 	.disable_vblank = nouveau_display_vblank_disable,
-	.get_scanout_position = nouveau_display_scanoutpos,
 	.get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
 
 	.ioctls = nouveau_ioctls,
-- 
2.24.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 05/23] drm/radeon: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
  2020-01-10  9:21 ` Thomas Zimmermann
                     ` (2 preceding siblings ...)
  (?)
@ 2020-01-10  9:21   ` Thomas Zimmermann
  -1 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: dri-devel, amd-gfx, intel-gfx, linux-arm-msm, freedreno, nouveau,
	Thomas Zimmermann

The callback struct drm_driver.get_scanout_position() is deprecated in
favor of struct drm_crtc_helper_funcs.get_scanout_position(). Convert
radeon over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/radeon/atombios_crtc.c      |  1 +
 drivers/gpu/drm/radeon/radeon_display.c     | 13 +++++++++++++
 drivers/gpu/drm/radeon/radeon_drv.c         | 11 -----------
 drivers/gpu/drm/radeon/radeon_legacy_crtc.c |  3 ++-
 drivers/gpu/drm/radeon/radeon_mode.h        |  6 ++++++
 5 files changed, 22 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c
index da2c9e295408..447d74b78f19 100644
--- a/drivers/gpu/drm/radeon/atombios_crtc.c
+++ b/drivers/gpu/drm/radeon/atombios_crtc.c
@@ -2232,6 +2232,7 @@ static const struct drm_crtc_helper_funcs atombios_helper_funcs = {
 	.prepare = atombios_crtc_prepare,
 	.commit = atombios_crtc_commit,
 	.disable = atombios_crtc_disable,
+	.get_scanout_position = radeon_get_crtc_scanout_position,
 };
 
 void radeon_atombios_init_crtc(struct drm_device *dev,
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
index 962575e27cde..7187158b9963 100644
--- a/drivers/gpu/drm/radeon/radeon_display.c
+++ b/drivers/gpu/drm/radeon/radeon_display.c
@@ -1978,3 +1978,16 @@ int radeon_get_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe,
 
 	return ret;
 }
+
+bool
+radeon_get_crtc_scanout_position(struct drm_crtc *crtc,
+				 bool in_vblank_irq, int *vpos, int *hpos,
+				 ktime_t *stime, ktime_t *etime,
+				 const struct drm_display_mode *mode)
+{
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
+
+	return radeon_get_crtc_scanoutpos(dev, pipe, 0, vpos, hpos,
+					  stime, etime, mode);
+}
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
index fd74e2611185..1f597f166bff 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -563,16 +563,6 @@ static const struct file_operations radeon_driver_kms_fops = {
 #endif
 };
 
-static bool
-radeon_get_crtc_scanout_position(struct drm_device *dev, unsigned int pipe,
-				 bool in_vblank_irq, int *vpos, int *hpos,
-				 ktime_t *stime, ktime_t *etime,
-				 const struct drm_display_mode *mode)
-{
-	return radeon_get_crtc_scanoutpos(dev, pipe, 0, vpos, hpos,
-					  stime, etime, mode);
-}
-
 static struct drm_driver kms_driver = {
 	.driver_features =
 	    DRIVER_USE_AGP | DRIVER_GEM | DRIVER_RENDER,
@@ -585,7 +575,6 @@ static struct drm_driver kms_driver = {
 	.enable_vblank = radeon_enable_vblank_kms,
 	.disable_vblank = radeon_disable_vblank_kms,
 	.get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
-	.get_scanout_position = radeon_get_crtc_scanout_position,
 	.irq_preinstall = radeon_driver_irq_preinstall_kms,
 	.irq_postinstall = radeon_driver_irq_postinstall_kms,
 	.irq_uninstall = radeon_driver_irq_uninstall_kms,
diff --git a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
index a1985a552794..8817fd033cd0 100644
--- a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
+++ b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
@@ -1111,7 +1111,8 @@ static const struct drm_crtc_helper_funcs legacy_helper_funcs = {
 	.mode_set_base_atomic = radeon_crtc_set_base_atomic,
 	.prepare = radeon_crtc_prepare,
 	.commit = radeon_crtc_commit,
-	.disable = radeon_crtc_disable
+	.disable = radeon_crtc_disable,
+	.get_scanout_position = radeon_get_crtc_scanout_position,
 };
 
 
diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h
index fd470d6bf3f4..06c4c527d376 100644
--- a/drivers/gpu/drm/radeon/radeon_mode.h
+++ b/drivers/gpu/drm/radeon/radeon_mode.h
@@ -881,6 +881,12 @@ extern int radeon_get_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe,
 				      ktime_t *stime, ktime_t *etime,
 				      const struct drm_display_mode *mode);
 
+extern bool radeon_get_crtc_scanout_position(struct drm_crtc *crtc,
+					     bool in_vblank_irq, int *vpos,
+					     int *hpos, ktime_t *stime,
+					     ktime_t *etime,
+					     const struct drm_display_mode *mode);
+
 extern bool radeon_combios_check_hardcoded_edid(struct radeon_device *rdev);
 extern struct edid *
 radeon_bios_get_hardcoded_edid(struct radeon_device *rdev);
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 05/23] drm/radeon: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

The callback struct drm_driver.get_scanout_position() is deprecated in
favor of struct drm_crtc_helper_funcs.get_scanout_position(). Convert
radeon over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/radeon/atombios_crtc.c      |  1 +
 drivers/gpu/drm/radeon/radeon_display.c     | 13 +++++++++++++
 drivers/gpu/drm/radeon/radeon_drv.c         | 11 -----------
 drivers/gpu/drm/radeon/radeon_legacy_crtc.c |  3 ++-
 drivers/gpu/drm/radeon/radeon_mode.h        |  6 ++++++
 5 files changed, 22 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c
index da2c9e295408..447d74b78f19 100644
--- a/drivers/gpu/drm/radeon/atombios_crtc.c
+++ b/drivers/gpu/drm/radeon/atombios_crtc.c
@@ -2232,6 +2232,7 @@ static const struct drm_crtc_helper_funcs atombios_helper_funcs = {
 	.prepare = atombios_crtc_prepare,
 	.commit = atombios_crtc_commit,
 	.disable = atombios_crtc_disable,
+	.get_scanout_position = radeon_get_crtc_scanout_position,
 };
 
 void radeon_atombios_init_crtc(struct drm_device *dev,
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
index 962575e27cde..7187158b9963 100644
--- a/drivers/gpu/drm/radeon/radeon_display.c
+++ b/drivers/gpu/drm/radeon/radeon_display.c
@@ -1978,3 +1978,16 @@ int radeon_get_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe,
 
 	return ret;
 }
+
+bool
+radeon_get_crtc_scanout_position(struct drm_crtc *crtc,
+				 bool in_vblank_irq, int *vpos, int *hpos,
+				 ktime_t *stime, ktime_t *etime,
+				 const struct drm_display_mode *mode)
+{
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
+
+	return radeon_get_crtc_scanoutpos(dev, pipe, 0, vpos, hpos,
+					  stime, etime, mode);
+}
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
index fd74e2611185..1f597f166bff 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -563,16 +563,6 @@ static const struct file_operations radeon_driver_kms_fops = {
 #endif
 };
 
-static bool
-radeon_get_crtc_scanout_position(struct drm_device *dev, unsigned int pipe,
-				 bool in_vblank_irq, int *vpos, int *hpos,
-				 ktime_t *stime, ktime_t *etime,
-				 const struct drm_display_mode *mode)
-{
-	return radeon_get_crtc_scanoutpos(dev, pipe, 0, vpos, hpos,
-					  stime, etime, mode);
-}
-
 static struct drm_driver kms_driver = {
 	.driver_features =
 	    DRIVER_USE_AGP | DRIVER_GEM | DRIVER_RENDER,
@@ -585,7 +575,6 @@ static struct drm_driver kms_driver = {
 	.enable_vblank = radeon_enable_vblank_kms,
 	.disable_vblank = radeon_disable_vblank_kms,
 	.get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
-	.get_scanout_position = radeon_get_crtc_scanout_position,
 	.irq_preinstall = radeon_driver_irq_preinstall_kms,
 	.irq_postinstall = radeon_driver_irq_postinstall_kms,
 	.irq_uninstall = radeon_driver_irq_uninstall_kms,
diff --git a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
index a1985a552794..8817fd033cd0 100644
--- a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
+++ b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
@@ -1111,7 +1111,8 @@ static const struct drm_crtc_helper_funcs legacy_helper_funcs = {
 	.mode_set_base_atomic = radeon_crtc_set_base_atomic,
 	.prepare = radeon_crtc_prepare,
 	.commit = radeon_crtc_commit,
-	.disable = radeon_crtc_disable
+	.disable = radeon_crtc_disable,
+	.get_scanout_position = radeon_get_crtc_scanout_position,
 };
 
 
diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h
index fd470d6bf3f4..06c4c527d376 100644
--- a/drivers/gpu/drm/radeon/radeon_mode.h
+++ b/drivers/gpu/drm/radeon/radeon_mode.h
@@ -881,6 +881,12 @@ extern int radeon_get_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe,
 				      ktime_t *stime, ktime_t *etime,
 				      const struct drm_display_mode *mode);
 
+extern bool radeon_get_crtc_scanout_position(struct drm_crtc *crtc,
+					     bool in_vblank_irq, int *vpos,
+					     int *hpos, ktime_t *stime,
+					     ktime_t *etime,
+					     const struct drm_display_mode *mode);
+
 extern bool radeon_combios_check_hardcoded_edid(struct radeon_device *rdev);
 extern struct edid *
 radeon_bios_get_hardcoded_edid(struct radeon_device *rdev);
-- 
2.24.1

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 05/23] drm/radeon: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

The callback struct drm_driver.get_scanout_position() is deprecated in
favor of struct drm_crtc_helper_funcs.get_scanout_position(). Convert
radeon over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/radeon/atombios_crtc.c      |  1 +
 drivers/gpu/drm/radeon/radeon_display.c     | 13 +++++++++++++
 drivers/gpu/drm/radeon/radeon_drv.c         | 11 -----------
 drivers/gpu/drm/radeon/radeon_legacy_crtc.c |  3 ++-
 drivers/gpu/drm/radeon/radeon_mode.h        |  6 ++++++
 5 files changed, 22 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c
index da2c9e295408..447d74b78f19 100644
--- a/drivers/gpu/drm/radeon/atombios_crtc.c
+++ b/drivers/gpu/drm/radeon/atombios_crtc.c
@@ -2232,6 +2232,7 @@ static const struct drm_crtc_helper_funcs atombios_helper_funcs = {
 	.prepare = atombios_crtc_prepare,
 	.commit = atombios_crtc_commit,
 	.disable = atombios_crtc_disable,
+	.get_scanout_position = radeon_get_crtc_scanout_position,
 };
 
 void radeon_atombios_init_crtc(struct drm_device *dev,
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
index 962575e27cde..7187158b9963 100644
--- a/drivers/gpu/drm/radeon/radeon_display.c
+++ b/drivers/gpu/drm/radeon/radeon_display.c
@@ -1978,3 +1978,16 @@ int radeon_get_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe,
 
 	return ret;
 }
+
+bool
+radeon_get_crtc_scanout_position(struct drm_crtc *crtc,
+				 bool in_vblank_irq, int *vpos, int *hpos,
+				 ktime_t *stime, ktime_t *etime,
+				 const struct drm_display_mode *mode)
+{
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
+
+	return radeon_get_crtc_scanoutpos(dev, pipe, 0, vpos, hpos,
+					  stime, etime, mode);
+}
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
index fd74e2611185..1f597f166bff 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -563,16 +563,6 @@ static const struct file_operations radeon_driver_kms_fops = {
 #endif
 };
 
-static bool
-radeon_get_crtc_scanout_position(struct drm_device *dev, unsigned int pipe,
-				 bool in_vblank_irq, int *vpos, int *hpos,
-				 ktime_t *stime, ktime_t *etime,
-				 const struct drm_display_mode *mode)
-{
-	return radeon_get_crtc_scanoutpos(dev, pipe, 0, vpos, hpos,
-					  stime, etime, mode);
-}
-
 static struct drm_driver kms_driver = {
 	.driver_features =
 	    DRIVER_USE_AGP | DRIVER_GEM | DRIVER_RENDER,
@@ -585,7 +575,6 @@ static struct drm_driver kms_driver = {
 	.enable_vblank = radeon_enable_vblank_kms,
 	.disable_vblank = radeon_disable_vblank_kms,
 	.get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
-	.get_scanout_position = radeon_get_crtc_scanout_position,
 	.irq_preinstall = radeon_driver_irq_preinstall_kms,
 	.irq_postinstall = radeon_driver_irq_postinstall_kms,
 	.irq_uninstall = radeon_driver_irq_uninstall_kms,
diff --git a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
index a1985a552794..8817fd033cd0 100644
--- a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
+++ b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
@@ -1111,7 +1111,8 @@ static const struct drm_crtc_helper_funcs legacy_helper_funcs = {
 	.mode_set_base_atomic = radeon_crtc_set_base_atomic,
 	.prepare = radeon_crtc_prepare,
 	.commit = radeon_crtc_commit,
-	.disable = radeon_crtc_disable
+	.disable = radeon_crtc_disable,
+	.get_scanout_position = radeon_get_crtc_scanout_position,
 };
 
 
diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h
index fd470d6bf3f4..06c4c527d376 100644
--- a/drivers/gpu/drm/radeon/radeon_mode.h
+++ b/drivers/gpu/drm/radeon/radeon_mode.h
@@ -881,6 +881,12 @@ extern int radeon_get_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe,
 				      ktime_t *stime, ktime_t *etime,
 				      const struct drm_display_mode *mode);
 
+extern bool radeon_get_crtc_scanout_position(struct drm_crtc *crtc,
+					     bool in_vblank_irq, int *vpos,
+					     int *hpos, ktime_t *stime,
+					     ktime_t *etime,
+					     const struct drm_display_mode *mode);
+
 extern bool radeon_combios_check_hardcoded_edid(struct radeon_device *rdev);
 extern struct edid *
 radeon_bios_get_hardcoded_edid(struct radeon_device *rdev);
-- 
2.24.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [Intel-gfx] [PATCH 05/23] drm/radeon: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

The callback struct drm_driver.get_scanout_position() is deprecated in
favor of struct drm_crtc_helper_funcs.get_scanout_position(). Convert
radeon over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/radeon/atombios_crtc.c      |  1 +
 drivers/gpu/drm/radeon/radeon_display.c     | 13 +++++++++++++
 drivers/gpu/drm/radeon/radeon_drv.c         | 11 -----------
 drivers/gpu/drm/radeon/radeon_legacy_crtc.c |  3 ++-
 drivers/gpu/drm/radeon/radeon_mode.h        |  6 ++++++
 5 files changed, 22 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c
index da2c9e295408..447d74b78f19 100644
--- a/drivers/gpu/drm/radeon/atombios_crtc.c
+++ b/drivers/gpu/drm/radeon/atombios_crtc.c
@@ -2232,6 +2232,7 @@ static const struct drm_crtc_helper_funcs atombios_helper_funcs = {
 	.prepare = atombios_crtc_prepare,
 	.commit = atombios_crtc_commit,
 	.disable = atombios_crtc_disable,
+	.get_scanout_position = radeon_get_crtc_scanout_position,
 };
 
 void radeon_atombios_init_crtc(struct drm_device *dev,
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
index 962575e27cde..7187158b9963 100644
--- a/drivers/gpu/drm/radeon/radeon_display.c
+++ b/drivers/gpu/drm/radeon/radeon_display.c
@@ -1978,3 +1978,16 @@ int radeon_get_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe,
 
 	return ret;
 }
+
+bool
+radeon_get_crtc_scanout_position(struct drm_crtc *crtc,
+				 bool in_vblank_irq, int *vpos, int *hpos,
+				 ktime_t *stime, ktime_t *etime,
+				 const struct drm_display_mode *mode)
+{
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
+
+	return radeon_get_crtc_scanoutpos(dev, pipe, 0, vpos, hpos,
+					  stime, etime, mode);
+}
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
index fd74e2611185..1f597f166bff 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -563,16 +563,6 @@ static const struct file_operations radeon_driver_kms_fops = {
 #endif
 };
 
-static bool
-radeon_get_crtc_scanout_position(struct drm_device *dev, unsigned int pipe,
-				 bool in_vblank_irq, int *vpos, int *hpos,
-				 ktime_t *stime, ktime_t *etime,
-				 const struct drm_display_mode *mode)
-{
-	return radeon_get_crtc_scanoutpos(dev, pipe, 0, vpos, hpos,
-					  stime, etime, mode);
-}
-
 static struct drm_driver kms_driver = {
 	.driver_features =
 	    DRIVER_USE_AGP | DRIVER_GEM | DRIVER_RENDER,
@@ -585,7 +575,6 @@ static struct drm_driver kms_driver = {
 	.enable_vblank = radeon_enable_vblank_kms,
 	.disable_vblank = radeon_disable_vblank_kms,
 	.get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
-	.get_scanout_position = radeon_get_crtc_scanout_position,
 	.irq_preinstall = radeon_driver_irq_preinstall_kms,
 	.irq_postinstall = radeon_driver_irq_postinstall_kms,
 	.irq_uninstall = radeon_driver_irq_uninstall_kms,
diff --git a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
index a1985a552794..8817fd033cd0 100644
--- a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
+++ b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
@@ -1111,7 +1111,8 @@ static const struct drm_crtc_helper_funcs legacy_helper_funcs = {
 	.mode_set_base_atomic = radeon_crtc_set_base_atomic,
 	.prepare = radeon_crtc_prepare,
 	.commit = radeon_crtc_commit,
-	.disable = radeon_crtc_disable
+	.disable = radeon_crtc_disable,
+	.get_scanout_position = radeon_get_crtc_scanout_position,
 };
 
 
diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h
index fd470d6bf3f4..06c4c527d376 100644
--- a/drivers/gpu/drm/radeon/radeon_mode.h
+++ b/drivers/gpu/drm/radeon/radeon_mode.h
@@ -881,6 +881,12 @@ extern int radeon_get_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe,
 				      ktime_t *stime, ktime_t *etime,
 				      const struct drm_display_mode *mode);
 
+extern bool radeon_get_crtc_scanout_position(struct drm_crtc *crtc,
+					     bool in_vblank_irq, int *vpos,
+					     int *hpos, ktime_t *stime,
+					     ktime_t *etime,
+					     const struct drm_display_mode *mode);
+
 extern bool radeon_combios_check_hardcoded_edid(struct radeon_device *rdev);
 extern struct edid *
 radeon_bios_get_hardcoded_edid(struct radeon_device *rdev);
-- 
2.24.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 05/23] drm/radeon: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

The callback struct drm_driver.get_scanout_position() is deprecated in
favor of struct drm_crtc_helper_funcs.get_scanout_position(). Convert
radeon over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/radeon/atombios_crtc.c      |  1 +
 drivers/gpu/drm/radeon/radeon_display.c     | 13 +++++++++++++
 drivers/gpu/drm/radeon/radeon_drv.c         | 11 -----------
 drivers/gpu/drm/radeon/radeon_legacy_crtc.c |  3 ++-
 drivers/gpu/drm/radeon/radeon_mode.h        |  6 ++++++
 5 files changed, 22 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c
index da2c9e295408..447d74b78f19 100644
--- a/drivers/gpu/drm/radeon/atombios_crtc.c
+++ b/drivers/gpu/drm/radeon/atombios_crtc.c
@@ -2232,6 +2232,7 @@ static const struct drm_crtc_helper_funcs atombios_helper_funcs = {
 	.prepare = atombios_crtc_prepare,
 	.commit = atombios_crtc_commit,
 	.disable = atombios_crtc_disable,
+	.get_scanout_position = radeon_get_crtc_scanout_position,
 };
 
 void radeon_atombios_init_crtc(struct drm_device *dev,
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
index 962575e27cde..7187158b9963 100644
--- a/drivers/gpu/drm/radeon/radeon_display.c
+++ b/drivers/gpu/drm/radeon/radeon_display.c
@@ -1978,3 +1978,16 @@ int radeon_get_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe,
 
 	return ret;
 }
+
+bool
+radeon_get_crtc_scanout_position(struct drm_crtc *crtc,
+				 bool in_vblank_irq, int *vpos, int *hpos,
+				 ktime_t *stime, ktime_t *etime,
+				 const struct drm_display_mode *mode)
+{
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
+
+	return radeon_get_crtc_scanoutpos(dev, pipe, 0, vpos, hpos,
+					  stime, etime, mode);
+}
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
index fd74e2611185..1f597f166bff 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -563,16 +563,6 @@ static const struct file_operations radeon_driver_kms_fops = {
 #endif
 };
 
-static bool
-radeon_get_crtc_scanout_position(struct drm_device *dev, unsigned int pipe,
-				 bool in_vblank_irq, int *vpos, int *hpos,
-				 ktime_t *stime, ktime_t *etime,
-				 const struct drm_display_mode *mode)
-{
-	return radeon_get_crtc_scanoutpos(dev, pipe, 0, vpos, hpos,
-					  stime, etime, mode);
-}
-
 static struct drm_driver kms_driver = {
 	.driver_features =
 	    DRIVER_USE_AGP | DRIVER_GEM | DRIVER_RENDER,
@@ -585,7 +575,6 @@ static struct drm_driver kms_driver = {
 	.enable_vblank = radeon_enable_vblank_kms,
 	.disable_vblank = radeon_disable_vblank_kms,
 	.get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
-	.get_scanout_position = radeon_get_crtc_scanout_position,
 	.irq_preinstall = radeon_driver_irq_preinstall_kms,
 	.irq_postinstall = radeon_driver_irq_postinstall_kms,
 	.irq_uninstall = radeon_driver_irq_uninstall_kms,
diff --git a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
index a1985a552794..8817fd033cd0 100644
--- a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
+++ b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
@@ -1111,7 +1111,8 @@ static const struct drm_crtc_helper_funcs legacy_helper_funcs = {
 	.mode_set_base_atomic = radeon_crtc_set_base_atomic,
 	.prepare = radeon_crtc_prepare,
 	.commit = radeon_crtc_commit,
-	.disable = radeon_crtc_disable
+	.disable = radeon_crtc_disable,
+	.get_scanout_position = radeon_get_crtc_scanout_position,
 };
 
 
diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h
index fd470d6bf3f4..06c4c527d376 100644
--- a/drivers/gpu/drm/radeon/radeon_mode.h
+++ b/drivers/gpu/drm/radeon/radeon_mode.h
@@ -881,6 +881,12 @@ extern int radeon_get_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe,
 				      ktime_t *stime, ktime_t *etime,
 				      const struct drm_display_mode *mode);
 
+extern bool radeon_get_crtc_scanout_position(struct drm_crtc *crtc,
+					     bool in_vblank_irq, int *vpos,
+					     int *hpos, ktime_t *stime,
+					     ktime_t *etime,
+					     const struct drm_display_mode *mode);
+
 extern bool radeon_combios_check_hardcoded_edid(struct radeon_device *rdev);
 extern struct edid *
 radeon_bios_get_hardcoded_edid(struct radeon_device *rdev);
-- 
2.24.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 06/23] drm/msm: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: dri-devel, amd-gfx, intel-gfx, linux-arm-msm, freedreno, nouveau,
	Thomas Zimmermann

The callback struct drm_driver.get_scanout_position() is deprecated in
favor of struct drm_crtc_helper_funcs.get_scanout_position(). Convert
mem over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c | 67 +++++++++++++++++++++++
 drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c  | 61 ---------------------
 2 files changed, 67 insertions(+), 61 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
index 05cc04f729d6..4decf19847a8 100644
--- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
+++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
@@ -405,6 +405,72 @@ static void mdp5_crtc_mode_set_nofb(struct drm_crtc *crtc)
 	spin_unlock_irqrestore(&mdp5_crtc->lm_lock, flags);
 }
 
+static struct drm_encoder *get_encoder_from_crtc(struct drm_crtc *crtc)
+{
+	struct drm_device *dev = crtc->dev;
+	struct drm_encoder *encoder;
+
+	drm_for_each_encoder(encoder, dev)
+		if (encoder->crtc == crtc)
+			return encoder;
+
+	return NULL;
+}
+
+static bool mdp5_crtc_get_scanout_position(struct drm_crtc *crtc,
+					   bool in_vblank_irq,
+					   int *vpos, int *hpos,
+					   ktime_t *stime, ktime_t *etime,
+					   const struct drm_display_mode *mode)
+{
+	unsigned int pipe = crtc->index;
+	struct drm_encoder *encoder;
+	int line, vsw, vbp, vactive_start, vactive_end, vfp_end;
+
+
+	encoder = get_encoder_from_crtc(crtc);
+	if (!encoder) {
+		DRM_ERROR("no encoder found for crtc %d\n", pipe);
+		return false;
+	}
+
+	vsw = mode->crtc_vsync_end - mode->crtc_vsync_start;
+	vbp = mode->crtc_vtotal - mode->crtc_vsync_end;
+
+	/*
+	 * the line counter is 1 at the start of the VSYNC pulse and VTOTAL at
+	 * the end of VFP. Translate the porch values relative to the line
+	 * counter positions.
+	 */
+
+	vactive_start = vsw + vbp + 1;
+
+	vactive_end = vactive_start + mode->crtc_vdisplay;
+
+	/* last scan line before VSYNC */
+	vfp_end = mode->crtc_vtotal;
+
+	if (stime)
+		*stime = ktime_get();
+
+	line = mdp5_encoder_get_linecount(encoder);
+
+	if (line < vactive_start)
+		line -= vactive_start;
+	else if (line > vactive_end)
+		line = line - vfp_end - vactive_start;
+	else
+		line -= vactive_start;
+
+	*vpos = line;
+	*hpos = 0;
+
+	if (etime)
+		*etime = ktime_get();
+
+	return true;
+}
+
 static void mdp5_crtc_atomic_disable(struct drm_crtc *crtc,
 				     struct drm_crtc_state *old_state)
 {
@@ -1063,6 +1129,7 @@ static const struct drm_crtc_helper_funcs mdp5_crtc_helper_funcs = {
 	.atomic_flush = mdp5_crtc_atomic_flush,
 	.atomic_enable = mdp5_crtc_atomic_enable,
 	.atomic_disable = mdp5_crtc_atomic_disable,
+	.get_scanout_position = mdp5_crtc_get_scanout_position,
 };
 
 static void mdp5_crtc_vblank_irq(struct mdp_irq *irq, uint32_t irqstatus)
diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
index e43ecd4be10a..8b72ac44ce55 100644
--- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
+++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
@@ -595,66 +595,6 @@ static struct drm_encoder *get_encoder_from_crtc(struct drm_crtc *crtc)
 	return NULL;
 }
 
-static bool mdp5_get_scanoutpos(struct drm_device *dev, unsigned int pipe,
-				bool in_vblank_irq, int *vpos, int *hpos,
-				ktime_t *stime, ktime_t *etime,
-				const struct drm_display_mode *mode)
-{
-	struct msm_drm_private *priv = dev->dev_private;
-	struct drm_crtc *crtc;
-	struct drm_encoder *encoder;
-	int line, vsw, vbp, vactive_start, vactive_end, vfp_end;
-
-	crtc = priv->crtcs[pipe];
-	if (!crtc) {
-		DRM_ERROR("Invalid crtc %d\n", pipe);
-		return false;
-	}
-
-	encoder = get_encoder_from_crtc(crtc);
-	if (!encoder) {
-		DRM_ERROR("no encoder found for crtc %d\n", pipe);
-		return false;
-	}
-
-	vsw = mode->crtc_vsync_end - mode->crtc_vsync_start;
-	vbp = mode->crtc_vtotal - mode->crtc_vsync_end;
-
-	/*
-	 * the line counter is 1 at the start of the VSYNC pulse and VTOTAL at
-	 * the end of VFP. Translate the porch values relative to the line
-	 * counter positions.
-	 */
-
-	vactive_start = vsw + vbp + 1;
-
-	vactive_end = vactive_start + mode->crtc_vdisplay;
-
-	/* last scan line before VSYNC */
-	vfp_end = mode->crtc_vtotal;
-
-	if (stime)
-		*stime = ktime_get();
-
-	line = mdp5_encoder_get_linecount(encoder);
-
-	if (line < vactive_start) {
-		line -= vactive_start;
-	} else if (line > vactive_end) {
-		line = line - vfp_end - vactive_start;
-	} else {
-		line -= vactive_start;
-	}
-
-	*vpos = line;
-	*hpos = 0;
-
-	if (etime)
-		*etime = ktime_get();
-
-	return true;
-}
-
 static u32 mdp5_get_vblank_counter(struct drm_device *dev, unsigned int pipe)
 {
 	struct msm_drm_private *priv = dev->dev_private;
@@ -763,7 +703,6 @@ struct msm_kms *mdp5_kms_init(struct drm_device *dev)
 	dev->mode_config.max_height = 0xffff;
 
 	dev->driver->get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos;
-	dev->driver->get_scanout_position = mdp5_get_scanoutpos;
 	dev->driver->get_vblank_counter = mdp5_get_vblank_counter;
 	dev->max_vblank_count = 0; /* max_vblank_count is set on each CRTC */
 	dev->vblank_disable_immediate = true;
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 06/23] drm/msm: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied-cv59FeDIM0c, daniel-/w4YWyX8dFk,
	alexander.deucher-5C7GfCeVMHo, christian.koenig-5C7GfCeVMHo,
	David1.Zhou-5C7GfCeVMHo,
	maarten.lankhorst-VuQAYsv1563Yd54FQh9/CA,
	patrik.r.jakobsson-Re5JQEeQqe8AvxtiuMwx3w,
	robdclark-Re5JQEeQqe8AvxtiuMwx3w, sean-p7yTbzM4H96eqtR555YLDQ,
	benjamin.gaignard-QSEj5FYQhm4dnm+yROfE0A,
	vincent.abriou-qxv4g6HH51o, yannick.fertre-qxv4g6HH51o,
	philippe.cornu-qxv4g6HH51o,
	mcoquelin.stm32-Re5JQEeQqe8AvxtiuMwx3w,
	alexandre.torgue-qxv4g6HH51o, eric-WhKQ6XTQaPysTnJN9+BGXg,
	rodrigosiqueiramelo-Re5JQEeQqe8AvxtiuMwx3w,
	hamohammed.sa-Re5JQEeQqe8AvxtiuMwx3w,
	linux-graphics-maintainer-pghWNbHTmq7QT0dZR+AlfA,
	thellstrom-pghWNbHTmq7QT0dZR+AlfA,
	bskeggs-H+wXaHxf7aLQT0dZR+AlfA, harry.wentland-5C7GfCeVMHo,
	sunpeng.li-5C7GfCeVMHo, jani.nikula-VuQAYsv1563Yd54FQh9/CA,
	joonas.lahtinen-VuQAYsv1563Yd54FQh9/CA,
	rodrigo.vivi-ral2JQCrhuEAvxtiuMwx3w
  Cc: linux-arm-msm-u79uwXL29TY76Z2rM5mHXA,
	intel-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Thomas Zimmermann,
	nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

The callback struct drm_driver.get_scanout_position() is deprecated in
favor of struct drm_crtc_helper_funcs.get_scanout_position(). Convert
mem over.

Signed-off-by: Thomas Zimmermann <tzimmermann-l3A5Bk7waGM@public.gmane.org>
---
 drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c | 67 +++++++++++++++++++++++
 drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c  | 61 ---------------------
 2 files changed, 67 insertions(+), 61 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
index 05cc04f729d6..4decf19847a8 100644
--- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
+++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
@@ -405,6 +405,72 @@ static void mdp5_crtc_mode_set_nofb(struct drm_crtc *crtc)
 	spin_unlock_irqrestore(&mdp5_crtc->lm_lock, flags);
 }
 
+static struct drm_encoder *get_encoder_from_crtc(struct drm_crtc *crtc)
+{
+	struct drm_device *dev = crtc->dev;
+	struct drm_encoder *encoder;
+
+	drm_for_each_encoder(encoder, dev)
+		if (encoder->crtc == crtc)
+			return encoder;
+
+	return NULL;
+}
+
+static bool mdp5_crtc_get_scanout_position(struct drm_crtc *crtc,
+					   bool in_vblank_irq,
+					   int *vpos, int *hpos,
+					   ktime_t *stime, ktime_t *etime,
+					   const struct drm_display_mode *mode)
+{
+	unsigned int pipe = crtc->index;
+	struct drm_encoder *encoder;
+	int line, vsw, vbp, vactive_start, vactive_end, vfp_end;
+
+
+	encoder = get_encoder_from_crtc(crtc);
+	if (!encoder) {
+		DRM_ERROR("no encoder found for crtc %d\n", pipe);
+		return false;
+	}
+
+	vsw = mode->crtc_vsync_end - mode->crtc_vsync_start;
+	vbp = mode->crtc_vtotal - mode->crtc_vsync_end;
+
+	/*
+	 * the line counter is 1 at the start of the VSYNC pulse and VTOTAL at
+	 * the end of VFP. Translate the porch values relative to the line
+	 * counter positions.
+	 */
+
+	vactive_start = vsw + vbp + 1;
+
+	vactive_end = vactive_start + mode->crtc_vdisplay;
+
+	/* last scan line before VSYNC */
+	vfp_end = mode->crtc_vtotal;
+
+	if (stime)
+		*stime = ktime_get();
+
+	line = mdp5_encoder_get_linecount(encoder);
+
+	if (line < vactive_start)
+		line -= vactive_start;
+	else if (line > vactive_end)
+		line = line - vfp_end - vactive_start;
+	else
+		line -= vactive_start;
+
+	*vpos = line;
+	*hpos = 0;
+
+	if (etime)
+		*etime = ktime_get();
+
+	return true;
+}
+
 static void mdp5_crtc_atomic_disable(struct drm_crtc *crtc,
 				     struct drm_crtc_state *old_state)
 {
@@ -1063,6 +1129,7 @@ static const struct drm_crtc_helper_funcs mdp5_crtc_helper_funcs = {
 	.atomic_flush = mdp5_crtc_atomic_flush,
 	.atomic_enable = mdp5_crtc_atomic_enable,
 	.atomic_disable = mdp5_crtc_atomic_disable,
+	.get_scanout_position = mdp5_crtc_get_scanout_position,
 };
 
 static void mdp5_crtc_vblank_irq(struct mdp_irq *irq, uint32_t irqstatus)
diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
index e43ecd4be10a..8b72ac44ce55 100644
--- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
+++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
@@ -595,66 +595,6 @@ static struct drm_encoder *get_encoder_from_crtc(struct drm_crtc *crtc)
 	return NULL;
 }
 
-static bool mdp5_get_scanoutpos(struct drm_device *dev, unsigned int pipe,
-				bool in_vblank_irq, int *vpos, int *hpos,
-				ktime_t *stime, ktime_t *etime,
-				const struct drm_display_mode *mode)
-{
-	struct msm_drm_private *priv = dev->dev_private;
-	struct drm_crtc *crtc;
-	struct drm_encoder *encoder;
-	int line, vsw, vbp, vactive_start, vactive_end, vfp_end;
-
-	crtc = priv->crtcs[pipe];
-	if (!crtc) {
-		DRM_ERROR("Invalid crtc %d\n", pipe);
-		return false;
-	}
-
-	encoder = get_encoder_from_crtc(crtc);
-	if (!encoder) {
-		DRM_ERROR("no encoder found for crtc %d\n", pipe);
-		return false;
-	}
-
-	vsw = mode->crtc_vsync_end - mode->crtc_vsync_start;
-	vbp = mode->crtc_vtotal - mode->crtc_vsync_end;
-
-	/*
-	 * the line counter is 1 at the start of the VSYNC pulse and VTOTAL at
-	 * the end of VFP. Translate the porch values relative to the line
-	 * counter positions.
-	 */
-
-	vactive_start = vsw + vbp + 1;
-
-	vactive_end = vactive_start + mode->crtc_vdisplay;
-
-	/* last scan line before VSYNC */
-	vfp_end = mode->crtc_vtotal;
-
-	if (stime)
-		*stime = ktime_get();
-
-	line = mdp5_encoder_get_linecount(encoder);
-
-	if (line < vactive_start) {
-		line -= vactive_start;
-	} else if (line > vactive_end) {
-		line = line - vfp_end - vactive_start;
-	} else {
-		line -= vactive_start;
-	}
-
-	*vpos = line;
-	*hpos = 0;
-
-	if (etime)
-		*etime = ktime_get();
-
-	return true;
-}
-
 static u32 mdp5_get_vblank_counter(struct drm_device *dev, unsigned int pipe)
 {
 	struct msm_drm_private *priv = dev->dev_private;
@@ -763,7 +703,6 @@ struct msm_kms *mdp5_kms_init(struct drm_device *dev)
 	dev->mode_config.max_height = 0xffff;
 
 	dev->driver->get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos;
-	dev->driver->get_scanout_position = mdp5_get_scanoutpos;
 	dev->driver->get_vblank_counter = mdp5_get_vblank_counter;
 	dev->max_vblank_count = 0; /* max_vblank_count is set on each CRTC */
 	dev->vblank_disable_immediate = true;
-- 
2.24.1

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 06/23] drm/msm: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

The callback struct drm_driver.get_scanout_position() is deprecated in
favor of struct drm_crtc_helper_funcs.get_scanout_position(). Convert
mem over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c | 67 +++++++++++++++++++++++
 drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c  | 61 ---------------------
 2 files changed, 67 insertions(+), 61 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
index 05cc04f729d6..4decf19847a8 100644
--- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
+++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
@@ -405,6 +405,72 @@ static void mdp5_crtc_mode_set_nofb(struct drm_crtc *crtc)
 	spin_unlock_irqrestore(&mdp5_crtc->lm_lock, flags);
 }
 
+static struct drm_encoder *get_encoder_from_crtc(struct drm_crtc *crtc)
+{
+	struct drm_device *dev = crtc->dev;
+	struct drm_encoder *encoder;
+
+	drm_for_each_encoder(encoder, dev)
+		if (encoder->crtc == crtc)
+			return encoder;
+
+	return NULL;
+}
+
+static bool mdp5_crtc_get_scanout_position(struct drm_crtc *crtc,
+					   bool in_vblank_irq,
+					   int *vpos, int *hpos,
+					   ktime_t *stime, ktime_t *etime,
+					   const struct drm_display_mode *mode)
+{
+	unsigned int pipe = crtc->index;
+	struct drm_encoder *encoder;
+	int line, vsw, vbp, vactive_start, vactive_end, vfp_end;
+
+
+	encoder = get_encoder_from_crtc(crtc);
+	if (!encoder) {
+		DRM_ERROR("no encoder found for crtc %d\n", pipe);
+		return false;
+	}
+
+	vsw = mode->crtc_vsync_end - mode->crtc_vsync_start;
+	vbp = mode->crtc_vtotal - mode->crtc_vsync_end;
+
+	/*
+	 * the line counter is 1 at the start of the VSYNC pulse and VTOTAL at
+	 * the end of VFP. Translate the porch values relative to the line
+	 * counter positions.
+	 */
+
+	vactive_start = vsw + vbp + 1;
+
+	vactive_end = vactive_start + mode->crtc_vdisplay;
+
+	/* last scan line before VSYNC */
+	vfp_end = mode->crtc_vtotal;
+
+	if (stime)
+		*stime = ktime_get();
+
+	line = mdp5_encoder_get_linecount(encoder);
+
+	if (line < vactive_start)
+		line -= vactive_start;
+	else if (line > vactive_end)
+		line = line - vfp_end - vactive_start;
+	else
+		line -= vactive_start;
+
+	*vpos = line;
+	*hpos = 0;
+
+	if (etime)
+		*etime = ktime_get();
+
+	return true;
+}
+
 static void mdp5_crtc_atomic_disable(struct drm_crtc *crtc,
 				     struct drm_crtc_state *old_state)
 {
@@ -1063,6 +1129,7 @@ static const struct drm_crtc_helper_funcs mdp5_crtc_helper_funcs = {
 	.atomic_flush = mdp5_crtc_atomic_flush,
 	.atomic_enable = mdp5_crtc_atomic_enable,
 	.atomic_disable = mdp5_crtc_atomic_disable,
+	.get_scanout_position = mdp5_crtc_get_scanout_position,
 };
 
 static void mdp5_crtc_vblank_irq(struct mdp_irq *irq, uint32_t irqstatus)
diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
index e43ecd4be10a..8b72ac44ce55 100644
--- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
+++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
@@ -595,66 +595,6 @@ static struct drm_encoder *get_encoder_from_crtc(struct drm_crtc *crtc)
 	return NULL;
 }
 
-static bool mdp5_get_scanoutpos(struct drm_device *dev, unsigned int pipe,
-				bool in_vblank_irq, int *vpos, int *hpos,
-				ktime_t *stime, ktime_t *etime,
-				const struct drm_display_mode *mode)
-{
-	struct msm_drm_private *priv = dev->dev_private;
-	struct drm_crtc *crtc;
-	struct drm_encoder *encoder;
-	int line, vsw, vbp, vactive_start, vactive_end, vfp_end;
-
-	crtc = priv->crtcs[pipe];
-	if (!crtc) {
-		DRM_ERROR("Invalid crtc %d\n", pipe);
-		return false;
-	}
-
-	encoder = get_encoder_from_crtc(crtc);
-	if (!encoder) {
-		DRM_ERROR("no encoder found for crtc %d\n", pipe);
-		return false;
-	}
-
-	vsw = mode->crtc_vsync_end - mode->crtc_vsync_start;
-	vbp = mode->crtc_vtotal - mode->crtc_vsync_end;
-
-	/*
-	 * the line counter is 1 at the start of the VSYNC pulse and VTOTAL at
-	 * the end of VFP. Translate the porch values relative to the line
-	 * counter positions.
-	 */
-
-	vactive_start = vsw + vbp + 1;
-
-	vactive_end = vactive_start + mode->crtc_vdisplay;
-
-	/* last scan line before VSYNC */
-	vfp_end = mode->crtc_vtotal;
-
-	if (stime)
-		*stime = ktime_get();
-
-	line = mdp5_encoder_get_linecount(encoder);
-
-	if (line < vactive_start) {
-		line -= vactive_start;
-	} else if (line > vactive_end) {
-		line = line - vfp_end - vactive_start;
-	} else {
-		line -= vactive_start;
-	}
-
-	*vpos = line;
-	*hpos = 0;
-
-	if (etime)
-		*etime = ktime_get();
-
-	return true;
-}
-
 static u32 mdp5_get_vblank_counter(struct drm_device *dev, unsigned int pipe)
 {
 	struct msm_drm_private *priv = dev->dev_private;
@@ -763,7 +703,6 @@ struct msm_kms *mdp5_kms_init(struct drm_device *dev)
 	dev->mode_config.max_height = 0xffff;
 
 	dev->driver->get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos;
-	dev->driver->get_scanout_position = mdp5_get_scanoutpos;
 	dev->driver->get_vblank_counter = mdp5_get_vblank_counter;
 	dev->max_vblank_count = 0; /* max_vblank_count is set on each CRTC */
 	dev->vblank_disable_immediate = true;
-- 
2.24.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [Intel-gfx] [PATCH 06/23] drm/msm: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

The callback struct drm_driver.get_scanout_position() is deprecated in
favor of struct drm_crtc_helper_funcs.get_scanout_position(). Convert
mem over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c | 67 +++++++++++++++++++++++
 drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c  | 61 ---------------------
 2 files changed, 67 insertions(+), 61 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
index 05cc04f729d6..4decf19847a8 100644
--- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
+++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
@@ -405,6 +405,72 @@ static void mdp5_crtc_mode_set_nofb(struct drm_crtc *crtc)
 	spin_unlock_irqrestore(&mdp5_crtc->lm_lock, flags);
 }
 
+static struct drm_encoder *get_encoder_from_crtc(struct drm_crtc *crtc)
+{
+	struct drm_device *dev = crtc->dev;
+	struct drm_encoder *encoder;
+
+	drm_for_each_encoder(encoder, dev)
+		if (encoder->crtc == crtc)
+			return encoder;
+
+	return NULL;
+}
+
+static bool mdp5_crtc_get_scanout_position(struct drm_crtc *crtc,
+					   bool in_vblank_irq,
+					   int *vpos, int *hpos,
+					   ktime_t *stime, ktime_t *etime,
+					   const struct drm_display_mode *mode)
+{
+	unsigned int pipe = crtc->index;
+	struct drm_encoder *encoder;
+	int line, vsw, vbp, vactive_start, vactive_end, vfp_end;
+
+
+	encoder = get_encoder_from_crtc(crtc);
+	if (!encoder) {
+		DRM_ERROR("no encoder found for crtc %d\n", pipe);
+		return false;
+	}
+
+	vsw = mode->crtc_vsync_end - mode->crtc_vsync_start;
+	vbp = mode->crtc_vtotal - mode->crtc_vsync_end;
+
+	/*
+	 * the line counter is 1 at the start of the VSYNC pulse and VTOTAL at
+	 * the end of VFP. Translate the porch values relative to the line
+	 * counter positions.
+	 */
+
+	vactive_start = vsw + vbp + 1;
+
+	vactive_end = vactive_start + mode->crtc_vdisplay;
+
+	/* last scan line before VSYNC */
+	vfp_end = mode->crtc_vtotal;
+
+	if (stime)
+		*stime = ktime_get();
+
+	line = mdp5_encoder_get_linecount(encoder);
+
+	if (line < vactive_start)
+		line -= vactive_start;
+	else if (line > vactive_end)
+		line = line - vfp_end - vactive_start;
+	else
+		line -= vactive_start;
+
+	*vpos = line;
+	*hpos = 0;
+
+	if (etime)
+		*etime = ktime_get();
+
+	return true;
+}
+
 static void mdp5_crtc_atomic_disable(struct drm_crtc *crtc,
 				     struct drm_crtc_state *old_state)
 {
@@ -1063,6 +1129,7 @@ static const struct drm_crtc_helper_funcs mdp5_crtc_helper_funcs = {
 	.atomic_flush = mdp5_crtc_atomic_flush,
 	.atomic_enable = mdp5_crtc_atomic_enable,
 	.atomic_disable = mdp5_crtc_atomic_disable,
+	.get_scanout_position = mdp5_crtc_get_scanout_position,
 };
 
 static void mdp5_crtc_vblank_irq(struct mdp_irq *irq, uint32_t irqstatus)
diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
index e43ecd4be10a..8b72ac44ce55 100644
--- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
+++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
@@ -595,66 +595,6 @@ static struct drm_encoder *get_encoder_from_crtc(struct drm_crtc *crtc)
 	return NULL;
 }
 
-static bool mdp5_get_scanoutpos(struct drm_device *dev, unsigned int pipe,
-				bool in_vblank_irq, int *vpos, int *hpos,
-				ktime_t *stime, ktime_t *etime,
-				const struct drm_display_mode *mode)
-{
-	struct msm_drm_private *priv = dev->dev_private;
-	struct drm_crtc *crtc;
-	struct drm_encoder *encoder;
-	int line, vsw, vbp, vactive_start, vactive_end, vfp_end;
-
-	crtc = priv->crtcs[pipe];
-	if (!crtc) {
-		DRM_ERROR("Invalid crtc %d\n", pipe);
-		return false;
-	}
-
-	encoder = get_encoder_from_crtc(crtc);
-	if (!encoder) {
-		DRM_ERROR("no encoder found for crtc %d\n", pipe);
-		return false;
-	}
-
-	vsw = mode->crtc_vsync_end - mode->crtc_vsync_start;
-	vbp = mode->crtc_vtotal - mode->crtc_vsync_end;
-
-	/*
-	 * the line counter is 1 at the start of the VSYNC pulse and VTOTAL at
-	 * the end of VFP. Translate the porch values relative to the line
-	 * counter positions.
-	 */
-
-	vactive_start = vsw + vbp + 1;
-
-	vactive_end = vactive_start + mode->crtc_vdisplay;
-
-	/* last scan line before VSYNC */
-	vfp_end = mode->crtc_vtotal;
-
-	if (stime)
-		*stime = ktime_get();
-
-	line = mdp5_encoder_get_linecount(encoder);
-
-	if (line < vactive_start) {
-		line -= vactive_start;
-	} else if (line > vactive_end) {
-		line = line - vfp_end - vactive_start;
-	} else {
-		line -= vactive_start;
-	}
-
-	*vpos = line;
-	*hpos = 0;
-
-	if (etime)
-		*etime = ktime_get();
-
-	return true;
-}
-
 static u32 mdp5_get_vblank_counter(struct drm_device *dev, unsigned int pipe)
 {
 	struct msm_drm_private *priv = dev->dev_private;
@@ -763,7 +703,6 @@ struct msm_kms *mdp5_kms_init(struct drm_device *dev)
 	dev->mode_config.max_height = 0xffff;
 
 	dev->driver->get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos;
-	dev->driver->get_scanout_position = mdp5_get_scanoutpos;
 	dev->driver->get_vblank_counter = mdp5_get_vblank_counter;
 	dev->max_vblank_count = 0; /* max_vblank_count is set on each CRTC */
 	dev->vblank_disable_immediate = true;
-- 
2.24.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 06/23] drm/msm: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

The callback struct drm_driver.get_scanout_position() is deprecated in
favor of struct drm_crtc_helper_funcs.get_scanout_position(). Convert
mem over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c | 67 +++++++++++++++++++++++
 drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c  | 61 ---------------------
 2 files changed, 67 insertions(+), 61 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
index 05cc04f729d6..4decf19847a8 100644
--- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
+++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
@@ -405,6 +405,72 @@ static void mdp5_crtc_mode_set_nofb(struct drm_crtc *crtc)
 	spin_unlock_irqrestore(&mdp5_crtc->lm_lock, flags);
 }
 
+static struct drm_encoder *get_encoder_from_crtc(struct drm_crtc *crtc)
+{
+	struct drm_device *dev = crtc->dev;
+	struct drm_encoder *encoder;
+
+	drm_for_each_encoder(encoder, dev)
+		if (encoder->crtc == crtc)
+			return encoder;
+
+	return NULL;
+}
+
+static bool mdp5_crtc_get_scanout_position(struct drm_crtc *crtc,
+					   bool in_vblank_irq,
+					   int *vpos, int *hpos,
+					   ktime_t *stime, ktime_t *etime,
+					   const struct drm_display_mode *mode)
+{
+	unsigned int pipe = crtc->index;
+	struct drm_encoder *encoder;
+	int line, vsw, vbp, vactive_start, vactive_end, vfp_end;
+
+
+	encoder = get_encoder_from_crtc(crtc);
+	if (!encoder) {
+		DRM_ERROR("no encoder found for crtc %d\n", pipe);
+		return false;
+	}
+
+	vsw = mode->crtc_vsync_end - mode->crtc_vsync_start;
+	vbp = mode->crtc_vtotal - mode->crtc_vsync_end;
+
+	/*
+	 * the line counter is 1 at the start of the VSYNC pulse and VTOTAL at
+	 * the end of VFP. Translate the porch values relative to the line
+	 * counter positions.
+	 */
+
+	vactive_start = vsw + vbp + 1;
+
+	vactive_end = vactive_start + mode->crtc_vdisplay;
+
+	/* last scan line before VSYNC */
+	vfp_end = mode->crtc_vtotal;
+
+	if (stime)
+		*stime = ktime_get();
+
+	line = mdp5_encoder_get_linecount(encoder);
+
+	if (line < vactive_start)
+		line -= vactive_start;
+	else if (line > vactive_end)
+		line = line - vfp_end - vactive_start;
+	else
+		line -= vactive_start;
+
+	*vpos = line;
+	*hpos = 0;
+
+	if (etime)
+		*etime = ktime_get();
+
+	return true;
+}
+
 static void mdp5_crtc_atomic_disable(struct drm_crtc *crtc,
 				     struct drm_crtc_state *old_state)
 {
@@ -1063,6 +1129,7 @@ static const struct drm_crtc_helper_funcs mdp5_crtc_helper_funcs = {
 	.atomic_flush = mdp5_crtc_atomic_flush,
 	.atomic_enable = mdp5_crtc_atomic_enable,
 	.atomic_disable = mdp5_crtc_atomic_disable,
+	.get_scanout_position = mdp5_crtc_get_scanout_position,
 };
 
 static void mdp5_crtc_vblank_irq(struct mdp_irq *irq, uint32_t irqstatus)
diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
index e43ecd4be10a..8b72ac44ce55 100644
--- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
+++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
@@ -595,66 +595,6 @@ static struct drm_encoder *get_encoder_from_crtc(struct drm_crtc *crtc)
 	return NULL;
 }
 
-static bool mdp5_get_scanoutpos(struct drm_device *dev, unsigned int pipe,
-				bool in_vblank_irq, int *vpos, int *hpos,
-				ktime_t *stime, ktime_t *etime,
-				const struct drm_display_mode *mode)
-{
-	struct msm_drm_private *priv = dev->dev_private;
-	struct drm_crtc *crtc;
-	struct drm_encoder *encoder;
-	int line, vsw, vbp, vactive_start, vactive_end, vfp_end;
-
-	crtc = priv->crtcs[pipe];
-	if (!crtc) {
-		DRM_ERROR("Invalid crtc %d\n", pipe);
-		return false;
-	}
-
-	encoder = get_encoder_from_crtc(crtc);
-	if (!encoder) {
-		DRM_ERROR("no encoder found for crtc %d\n", pipe);
-		return false;
-	}
-
-	vsw = mode->crtc_vsync_end - mode->crtc_vsync_start;
-	vbp = mode->crtc_vtotal - mode->crtc_vsync_end;
-
-	/*
-	 * the line counter is 1 at the start of the VSYNC pulse and VTOTAL at
-	 * the end of VFP. Translate the porch values relative to the line
-	 * counter positions.
-	 */
-
-	vactive_start = vsw + vbp + 1;
-
-	vactive_end = vactive_start + mode->crtc_vdisplay;
-
-	/* last scan line before VSYNC */
-	vfp_end = mode->crtc_vtotal;
-
-	if (stime)
-		*stime = ktime_get();
-
-	line = mdp5_encoder_get_linecount(encoder);
-
-	if (line < vactive_start) {
-		line -= vactive_start;
-	} else if (line > vactive_end) {
-		line = line - vfp_end - vactive_start;
-	} else {
-		line -= vactive_start;
-	}
-
-	*vpos = line;
-	*hpos = 0;
-
-	if (etime)
-		*etime = ktime_get();
-
-	return true;
-}
-
 static u32 mdp5_get_vblank_counter(struct drm_device *dev, unsigned int pipe)
 {
 	struct msm_drm_private *priv = dev->dev_private;
@@ -763,7 +703,6 @@ struct msm_kms *mdp5_kms_init(struct drm_device *dev)
 	dev->mode_config.max_height = 0xffff;
 
 	dev->driver->get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos;
-	dev->driver->get_scanout_position = mdp5_get_scanoutpos;
 	dev->driver->get_vblank_counter = mdp5_get_vblank_counter;
 	dev->max_vblank_count = 0; /* max_vblank_count is set on each CRTC */
 	dev->vblank_disable_immediate = true;
-- 
2.24.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 07/23] drm/vc4: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: dri-devel, amd-gfx, intel-gfx, linux-arm-msm, freedreno, nouveau,
	Thomas Zimmermann

The callback struct drm_driver.get_scanout_position() is deprecated in
favor of struct drm_crtc_helper_funcs.get_scanout_position(). Convert vc4
over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/vc4/vc4_crtc.c | 12 +++++++-----
 drivers/gpu/drm/vc4/vc4_drv.c  |  1 -
 drivers/gpu/drm/vc4/vc4_drv.h  |  4 ----
 3 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c
index b00e20f5ce05..f1e7597ea17e 100644
--- a/drivers/gpu/drm/vc4/vc4_crtc.c
+++ b/drivers/gpu/drm/vc4/vc4_crtc.c
@@ -84,13 +84,14 @@ static const struct debugfs_reg32 crtc_regs[] = {
 	VC4_REG32(PV_HACT_ACT),
 };
 
-bool vc4_crtc_get_scanoutpos(struct drm_device *dev, unsigned int crtc_id,
-			     bool in_vblank_irq, int *vpos, int *hpos,
-			     ktime_t *stime, ktime_t *etime,
-			     const struct drm_display_mode *mode)
+static bool vc4_crtc_get_scanout_position(struct drm_crtc *crtc,
+					  bool in_vblank_irq,
+					  int *vpos, int *hpos,
+					  ktime_t *stime, ktime_t *etime,
+					  const struct drm_display_mode *mode)
 {
+	struct drm_device *dev = crtc->dev;
 	struct vc4_dev *vc4 = to_vc4_dev(dev);
-	struct drm_crtc *crtc = drm_crtc_from_index(dev, crtc_id);
 	struct vc4_crtc *vc4_crtc = to_vc4_crtc(crtc);
 	u32 val;
 	int fifo_lines;
@@ -1039,6 +1040,7 @@ static const struct drm_crtc_helper_funcs vc4_crtc_helper_funcs = {
 	.atomic_flush = vc4_crtc_atomic_flush,
 	.atomic_enable = vc4_crtc_atomic_enable,
 	.atomic_disable = vc4_crtc_atomic_disable,
+	.get_scanout_position = vc4_crtc_get_scanout_position,
 };
 
 static const struct vc4_crtc_data pv0_data = {
diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c
index 5e6fb6c2307f..e6982a7b0c5e 100644
--- a/drivers/gpu/drm/vc4/vc4_drv.c
+++ b/drivers/gpu/drm/vc4/vc4_drv.c
@@ -190,7 +190,6 @@ static struct drm_driver vc4_drm_driver = {
 	.irq_postinstall = vc4_irq_postinstall,
 	.irq_uninstall = vc4_irq_uninstall,
 
-	.get_scanout_position = vc4_crtc_get_scanoutpos,
 	.get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
 
 #if defined(CONFIG_DEBUG_FS)
diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h
index 6627b20c99e9..f90c0d08e740 100644
--- a/drivers/gpu/drm/vc4/vc4_drv.h
+++ b/drivers/gpu/drm/vc4/vc4_drv.h
@@ -743,10 +743,6 @@ void vc4_bo_remove_from_purgeable_pool(struct vc4_bo *bo);
 
 /* vc4_crtc.c */
 extern struct platform_driver vc4_crtc_driver;
-bool vc4_crtc_get_scanoutpos(struct drm_device *dev, unsigned int crtc_id,
-			     bool in_vblank_irq, int *vpos, int *hpos,
-			     ktime_t *stime, ktime_t *etime,
-			     const struct drm_display_mode *mode);
 void vc4_crtc_handle_vblank(struct vc4_crtc *crtc);
 void vc4_crtc_txp_armed(struct drm_crtc_state *state);
 void vc4_crtc_get_margins(struct drm_crtc_state *state,
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 07/23] drm/vc4: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied-cv59FeDIM0c, daniel-/w4YWyX8dFk,
	alexander.deucher-5C7GfCeVMHo, christian.koenig-5C7GfCeVMHo,
	David1.Zhou-5C7GfCeVMHo,
	maarten.lankhorst-VuQAYsv1563Yd54FQh9/CA,
	patrik.r.jakobsson-Re5JQEeQqe8AvxtiuMwx3w,
	robdclark-Re5JQEeQqe8AvxtiuMwx3w, sean-p7yTbzM4H96eqtR555YLDQ,
	benjamin.gaignard-QSEj5FYQhm4dnm+yROfE0A,
	vincent.abriou-qxv4g6HH51o, yannick.fertre-qxv4g6HH51o,
	philippe.cornu-qxv4g6HH51o,
	mcoquelin.stm32-Re5JQEeQqe8AvxtiuMwx3w,
	alexandre.torgue-qxv4g6HH51o, eric-WhKQ6XTQaPysTnJN9+BGXg,
	rodrigosiqueiramelo-Re5JQEeQqe8AvxtiuMwx3w,
	hamohammed.sa-Re5JQEeQqe8AvxtiuMwx3w,
	linux-graphics-maintainer-pghWNbHTmq7QT0dZR+AlfA,
	thellstrom-pghWNbHTmq7QT0dZR+AlfA,
	bskeggs-H+wXaHxf7aLQT0dZR+AlfA, harry.wentland-5C7GfCeVMHo,
	sunpeng.li-5C7GfCeVMHo, jani.nikula-VuQAYsv1563Yd54FQh9/CA,
	joonas.lahtinen-VuQAYsv1563Yd54FQh9/CA,
	rodrigo.vivi-ral2JQCrhuEAvxtiuMwx3w
  Cc: linux-arm-msm-u79uwXL29TY76Z2rM5mHXA,
	intel-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Thomas Zimmermann,
	nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

The callback struct drm_driver.get_scanout_position() is deprecated in
favor of struct drm_crtc_helper_funcs.get_scanout_position(). Convert vc4
over.

Signed-off-by: Thomas Zimmermann <tzimmermann-l3A5Bk7waGM@public.gmane.org>
---
 drivers/gpu/drm/vc4/vc4_crtc.c | 12 +++++++-----
 drivers/gpu/drm/vc4/vc4_drv.c  |  1 -
 drivers/gpu/drm/vc4/vc4_drv.h  |  4 ----
 3 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c
index b00e20f5ce05..f1e7597ea17e 100644
--- a/drivers/gpu/drm/vc4/vc4_crtc.c
+++ b/drivers/gpu/drm/vc4/vc4_crtc.c
@@ -84,13 +84,14 @@ static const struct debugfs_reg32 crtc_regs[] = {
 	VC4_REG32(PV_HACT_ACT),
 };
 
-bool vc4_crtc_get_scanoutpos(struct drm_device *dev, unsigned int crtc_id,
-			     bool in_vblank_irq, int *vpos, int *hpos,
-			     ktime_t *stime, ktime_t *etime,
-			     const struct drm_display_mode *mode)
+static bool vc4_crtc_get_scanout_position(struct drm_crtc *crtc,
+					  bool in_vblank_irq,
+					  int *vpos, int *hpos,
+					  ktime_t *stime, ktime_t *etime,
+					  const struct drm_display_mode *mode)
 {
+	struct drm_device *dev = crtc->dev;
 	struct vc4_dev *vc4 = to_vc4_dev(dev);
-	struct drm_crtc *crtc = drm_crtc_from_index(dev, crtc_id);
 	struct vc4_crtc *vc4_crtc = to_vc4_crtc(crtc);
 	u32 val;
 	int fifo_lines;
@@ -1039,6 +1040,7 @@ static const struct drm_crtc_helper_funcs vc4_crtc_helper_funcs = {
 	.atomic_flush = vc4_crtc_atomic_flush,
 	.atomic_enable = vc4_crtc_atomic_enable,
 	.atomic_disable = vc4_crtc_atomic_disable,
+	.get_scanout_position = vc4_crtc_get_scanout_position,
 };
 
 static const struct vc4_crtc_data pv0_data = {
diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c
index 5e6fb6c2307f..e6982a7b0c5e 100644
--- a/drivers/gpu/drm/vc4/vc4_drv.c
+++ b/drivers/gpu/drm/vc4/vc4_drv.c
@@ -190,7 +190,6 @@ static struct drm_driver vc4_drm_driver = {
 	.irq_postinstall = vc4_irq_postinstall,
 	.irq_uninstall = vc4_irq_uninstall,
 
-	.get_scanout_position = vc4_crtc_get_scanoutpos,
 	.get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
 
 #if defined(CONFIG_DEBUG_FS)
diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h
index 6627b20c99e9..f90c0d08e740 100644
--- a/drivers/gpu/drm/vc4/vc4_drv.h
+++ b/drivers/gpu/drm/vc4/vc4_drv.h
@@ -743,10 +743,6 @@ void vc4_bo_remove_from_purgeable_pool(struct vc4_bo *bo);
 
 /* vc4_crtc.c */
 extern struct platform_driver vc4_crtc_driver;
-bool vc4_crtc_get_scanoutpos(struct drm_device *dev, unsigned int crtc_id,
-			     bool in_vblank_irq, int *vpos, int *hpos,
-			     ktime_t *stime, ktime_t *etime,
-			     const struct drm_display_mode *mode);
 void vc4_crtc_handle_vblank(struct vc4_crtc *crtc);
 void vc4_crtc_txp_armed(struct drm_crtc_state *state);
 void vc4_crtc_get_margins(struct drm_crtc_state *state,
-- 
2.24.1

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 07/23] drm/vc4: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

The callback struct drm_driver.get_scanout_position() is deprecated in
favor of struct drm_crtc_helper_funcs.get_scanout_position(). Convert vc4
over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/vc4/vc4_crtc.c | 12 +++++++-----
 drivers/gpu/drm/vc4/vc4_drv.c  |  1 -
 drivers/gpu/drm/vc4/vc4_drv.h  |  4 ----
 3 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c
index b00e20f5ce05..f1e7597ea17e 100644
--- a/drivers/gpu/drm/vc4/vc4_crtc.c
+++ b/drivers/gpu/drm/vc4/vc4_crtc.c
@@ -84,13 +84,14 @@ static const struct debugfs_reg32 crtc_regs[] = {
 	VC4_REG32(PV_HACT_ACT),
 };
 
-bool vc4_crtc_get_scanoutpos(struct drm_device *dev, unsigned int crtc_id,
-			     bool in_vblank_irq, int *vpos, int *hpos,
-			     ktime_t *stime, ktime_t *etime,
-			     const struct drm_display_mode *mode)
+static bool vc4_crtc_get_scanout_position(struct drm_crtc *crtc,
+					  bool in_vblank_irq,
+					  int *vpos, int *hpos,
+					  ktime_t *stime, ktime_t *etime,
+					  const struct drm_display_mode *mode)
 {
+	struct drm_device *dev = crtc->dev;
 	struct vc4_dev *vc4 = to_vc4_dev(dev);
-	struct drm_crtc *crtc = drm_crtc_from_index(dev, crtc_id);
 	struct vc4_crtc *vc4_crtc = to_vc4_crtc(crtc);
 	u32 val;
 	int fifo_lines;
@@ -1039,6 +1040,7 @@ static const struct drm_crtc_helper_funcs vc4_crtc_helper_funcs = {
 	.atomic_flush = vc4_crtc_atomic_flush,
 	.atomic_enable = vc4_crtc_atomic_enable,
 	.atomic_disable = vc4_crtc_atomic_disable,
+	.get_scanout_position = vc4_crtc_get_scanout_position,
 };
 
 static const struct vc4_crtc_data pv0_data = {
diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c
index 5e6fb6c2307f..e6982a7b0c5e 100644
--- a/drivers/gpu/drm/vc4/vc4_drv.c
+++ b/drivers/gpu/drm/vc4/vc4_drv.c
@@ -190,7 +190,6 @@ static struct drm_driver vc4_drm_driver = {
 	.irq_postinstall = vc4_irq_postinstall,
 	.irq_uninstall = vc4_irq_uninstall,
 
-	.get_scanout_position = vc4_crtc_get_scanoutpos,
 	.get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
 
 #if defined(CONFIG_DEBUG_FS)
diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h
index 6627b20c99e9..f90c0d08e740 100644
--- a/drivers/gpu/drm/vc4/vc4_drv.h
+++ b/drivers/gpu/drm/vc4/vc4_drv.h
@@ -743,10 +743,6 @@ void vc4_bo_remove_from_purgeable_pool(struct vc4_bo *bo);
 
 /* vc4_crtc.c */
 extern struct platform_driver vc4_crtc_driver;
-bool vc4_crtc_get_scanoutpos(struct drm_device *dev, unsigned int crtc_id,
-			     bool in_vblank_irq, int *vpos, int *hpos,
-			     ktime_t *stime, ktime_t *etime,
-			     const struct drm_display_mode *mode);
 void vc4_crtc_handle_vblank(struct vc4_crtc *crtc);
 void vc4_crtc_txp_armed(struct drm_crtc_state *state);
 void vc4_crtc_get_margins(struct drm_crtc_state *state,
-- 
2.24.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [Intel-gfx] [PATCH 07/23] drm/vc4: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

The callback struct drm_driver.get_scanout_position() is deprecated in
favor of struct drm_crtc_helper_funcs.get_scanout_position(). Convert vc4
over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/vc4/vc4_crtc.c | 12 +++++++-----
 drivers/gpu/drm/vc4/vc4_drv.c  |  1 -
 drivers/gpu/drm/vc4/vc4_drv.h  |  4 ----
 3 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c
index b00e20f5ce05..f1e7597ea17e 100644
--- a/drivers/gpu/drm/vc4/vc4_crtc.c
+++ b/drivers/gpu/drm/vc4/vc4_crtc.c
@@ -84,13 +84,14 @@ static const struct debugfs_reg32 crtc_regs[] = {
 	VC4_REG32(PV_HACT_ACT),
 };
 
-bool vc4_crtc_get_scanoutpos(struct drm_device *dev, unsigned int crtc_id,
-			     bool in_vblank_irq, int *vpos, int *hpos,
-			     ktime_t *stime, ktime_t *etime,
-			     const struct drm_display_mode *mode)
+static bool vc4_crtc_get_scanout_position(struct drm_crtc *crtc,
+					  bool in_vblank_irq,
+					  int *vpos, int *hpos,
+					  ktime_t *stime, ktime_t *etime,
+					  const struct drm_display_mode *mode)
 {
+	struct drm_device *dev = crtc->dev;
 	struct vc4_dev *vc4 = to_vc4_dev(dev);
-	struct drm_crtc *crtc = drm_crtc_from_index(dev, crtc_id);
 	struct vc4_crtc *vc4_crtc = to_vc4_crtc(crtc);
 	u32 val;
 	int fifo_lines;
@@ -1039,6 +1040,7 @@ static const struct drm_crtc_helper_funcs vc4_crtc_helper_funcs = {
 	.atomic_flush = vc4_crtc_atomic_flush,
 	.atomic_enable = vc4_crtc_atomic_enable,
 	.atomic_disable = vc4_crtc_atomic_disable,
+	.get_scanout_position = vc4_crtc_get_scanout_position,
 };
 
 static const struct vc4_crtc_data pv0_data = {
diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c
index 5e6fb6c2307f..e6982a7b0c5e 100644
--- a/drivers/gpu/drm/vc4/vc4_drv.c
+++ b/drivers/gpu/drm/vc4/vc4_drv.c
@@ -190,7 +190,6 @@ static struct drm_driver vc4_drm_driver = {
 	.irq_postinstall = vc4_irq_postinstall,
 	.irq_uninstall = vc4_irq_uninstall,
 
-	.get_scanout_position = vc4_crtc_get_scanoutpos,
 	.get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
 
 #if defined(CONFIG_DEBUG_FS)
diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h
index 6627b20c99e9..f90c0d08e740 100644
--- a/drivers/gpu/drm/vc4/vc4_drv.h
+++ b/drivers/gpu/drm/vc4/vc4_drv.h
@@ -743,10 +743,6 @@ void vc4_bo_remove_from_purgeable_pool(struct vc4_bo *bo);
 
 /* vc4_crtc.c */
 extern struct platform_driver vc4_crtc_driver;
-bool vc4_crtc_get_scanoutpos(struct drm_device *dev, unsigned int crtc_id,
-			     bool in_vblank_irq, int *vpos, int *hpos,
-			     ktime_t *stime, ktime_t *etime,
-			     const struct drm_display_mode *mode);
 void vc4_crtc_handle_vblank(struct vc4_crtc *crtc);
 void vc4_crtc_txp_armed(struct drm_crtc_state *state);
 void vc4_crtc_get_margins(struct drm_crtc_state *state,
-- 
2.24.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 07/23] drm/vc4: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

The callback struct drm_driver.get_scanout_position() is deprecated in
favor of struct drm_crtc_helper_funcs.get_scanout_position(). Convert vc4
over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/vc4/vc4_crtc.c | 12 +++++++-----
 drivers/gpu/drm/vc4/vc4_drv.c  |  1 -
 drivers/gpu/drm/vc4/vc4_drv.h  |  4 ----
 3 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c
index b00e20f5ce05..f1e7597ea17e 100644
--- a/drivers/gpu/drm/vc4/vc4_crtc.c
+++ b/drivers/gpu/drm/vc4/vc4_crtc.c
@@ -84,13 +84,14 @@ static const struct debugfs_reg32 crtc_regs[] = {
 	VC4_REG32(PV_HACT_ACT),
 };
 
-bool vc4_crtc_get_scanoutpos(struct drm_device *dev, unsigned int crtc_id,
-			     bool in_vblank_irq, int *vpos, int *hpos,
-			     ktime_t *stime, ktime_t *etime,
-			     const struct drm_display_mode *mode)
+static bool vc4_crtc_get_scanout_position(struct drm_crtc *crtc,
+					  bool in_vblank_irq,
+					  int *vpos, int *hpos,
+					  ktime_t *stime, ktime_t *etime,
+					  const struct drm_display_mode *mode)
 {
+	struct drm_device *dev = crtc->dev;
 	struct vc4_dev *vc4 = to_vc4_dev(dev);
-	struct drm_crtc *crtc = drm_crtc_from_index(dev, crtc_id);
 	struct vc4_crtc *vc4_crtc = to_vc4_crtc(crtc);
 	u32 val;
 	int fifo_lines;
@@ -1039,6 +1040,7 @@ static const struct drm_crtc_helper_funcs vc4_crtc_helper_funcs = {
 	.atomic_flush = vc4_crtc_atomic_flush,
 	.atomic_enable = vc4_crtc_atomic_enable,
 	.atomic_disable = vc4_crtc_atomic_disable,
+	.get_scanout_position = vc4_crtc_get_scanout_position,
 };
 
 static const struct vc4_crtc_data pv0_data = {
diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c
index 5e6fb6c2307f..e6982a7b0c5e 100644
--- a/drivers/gpu/drm/vc4/vc4_drv.c
+++ b/drivers/gpu/drm/vc4/vc4_drv.c
@@ -190,7 +190,6 @@ static struct drm_driver vc4_drm_driver = {
 	.irq_postinstall = vc4_irq_postinstall,
 	.irq_uninstall = vc4_irq_uninstall,
 
-	.get_scanout_position = vc4_crtc_get_scanoutpos,
 	.get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
 
 #if defined(CONFIG_DEBUG_FS)
diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h
index 6627b20c99e9..f90c0d08e740 100644
--- a/drivers/gpu/drm/vc4/vc4_drv.h
+++ b/drivers/gpu/drm/vc4/vc4_drv.h
@@ -743,10 +743,6 @@ void vc4_bo_remove_from_purgeable_pool(struct vc4_bo *bo);
 
 /* vc4_crtc.c */
 extern struct platform_driver vc4_crtc_driver;
-bool vc4_crtc_get_scanoutpos(struct drm_device *dev, unsigned int crtc_id,
-			     bool in_vblank_irq, int *vpos, int *hpos,
-			     ktime_t *stime, ktime_t *etime,
-			     const struct drm_display_mode *mode);
 void vc4_crtc_handle_vblank(struct vc4_crtc *crtc);
 void vc4_crtc_txp_armed(struct drm_crtc_state *state);
 void vc4_crtc_get_margins(struct drm_crtc_state *state,
-- 
2.24.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 08/23] drm/stm: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
  2020-01-10  9:21 ` Thomas Zimmermann
                     ` (2 preceding siblings ...)
  (?)
@ 2020-01-10  9:21   ` Thomas Zimmermann
  -1 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: dri-devel, amd-gfx, intel-gfx, linux-arm-msm, freedreno, nouveau,
	Thomas Zimmermann

The callback struct drm_driver.get_scanout_position() is deprecated in
favor of struct drm_crtc_helper_funcs.get_scanout_position(). Convert stm
over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/stm/drv.c  |  1 -
 drivers/gpu/drm/stm/ltdc.c | 65 ++++++++++++++++++++------------------
 drivers/gpu/drm/stm/ltdc.h |  5 ---
 3 files changed, 34 insertions(+), 37 deletions(-)

diff --git a/drivers/gpu/drm/stm/drv.c b/drivers/gpu/drm/stm/drv.c
index 5a9f9aca8bc2..486985604109 100644
--- a/drivers/gpu/drm/stm/drv.c
+++ b/drivers/gpu/drm/stm/drv.c
@@ -72,7 +72,6 @@ static struct drm_driver drv_driver = {
 	.gem_prime_vmap = drm_gem_cma_prime_vmap,
 	.gem_prime_vunmap = drm_gem_cma_prime_vunmap,
 	.gem_prime_mmap = drm_gem_cma_prime_mmap,
-	.get_scanout_position = ltdc_crtc_scanoutpos,
 	.get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
 };
 
diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
index c2815e8ae1da..8b6d1a2252e3 100644
--- a/drivers/gpu/drm/stm/ltdc.c
+++ b/drivers/gpu/drm/stm/ltdc.c
@@ -636,38 +636,13 @@ static void ltdc_crtc_atomic_flush(struct drm_crtc *crtc,
 	}
 }
 
-static const struct drm_crtc_helper_funcs ltdc_crtc_helper_funcs = {
-	.mode_valid = ltdc_crtc_mode_valid,
-	.mode_fixup = ltdc_crtc_mode_fixup,
-	.mode_set_nofb = ltdc_crtc_mode_set_nofb,
-	.atomic_flush = ltdc_crtc_atomic_flush,
-	.atomic_enable = ltdc_crtc_atomic_enable,
-	.atomic_disable = ltdc_crtc_atomic_disable,
-};
-
-static int ltdc_crtc_enable_vblank(struct drm_crtc *crtc)
-{
-	struct ltdc_device *ldev = crtc_to_ltdc(crtc);
-
-	DRM_DEBUG_DRIVER("\n");
-	reg_set(ldev->regs, LTDC_IER, IER_LIE);
-
-	return 0;
-}
-
-static void ltdc_crtc_disable_vblank(struct drm_crtc *crtc)
-{
-	struct ltdc_device *ldev = crtc_to_ltdc(crtc);
-
-	DRM_DEBUG_DRIVER("\n");
-	reg_clear(ldev->regs, LTDC_IER, IER_LIE);
-}
-
-bool ltdc_crtc_scanoutpos(struct drm_device *ddev, unsigned int pipe,
-			  bool in_vblank_irq, int *vpos, int *hpos,
-			  ktime_t *stime, ktime_t *etime,
-			  const struct drm_display_mode *mode)
+static bool ltdc_crtc_get_scanout_position(struct drm_crtc *crtc,
+					   bool in_vblank_irq,
+					   int *vpos, int *hpos,
+					   ktime_t *stime, ktime_t *etime,
+					   const struct drm_display_mode *mode)
 {
+	struct drm_device *ddev = crtc->dev;
 	struct ltdc_device *ldev = ddev->dev_private;
 	int line, vactive_start, vactive_end, vtotal;
 
@@ -710,6 +685,34 @@ bool ltdc_crtc_scanoutpos(struct drm_device *ddev, unsigned int pipe,
 	return true;
 }
 
+static const struct drm_crtc_helper_funcs ltdc_crtc_helper_funcs = {
+	.mode_valid = ltdc_crtc_mode_valid,
+	.mode_fixup = ltdc_crtc_mode_fixup,
+	.mode_set_nofb = ltdc_crtc_mode_set_nofb,
+	.atomic_flush = ltdc_crtc_atomic_flush,
+	.atomic_enable = ltdc_crtc_atomic_enable,
+	.atomic_disable = ltdc_crtc_atomic_disable,
+	.get_scanout_position = ltdc_crtc_get_scanout_position,
+};
+
+static int ltdc_crtc_enable_vblank(struct drm_crtc *crtc)
+{
+	struct ltdc_device *ldev = crtc_to_ltdc(crtc);
+
+	DRM_DEBUG_DRIVER("\n");
+	reg_set(ldev->regs, LTDC_IER, IER_LIE);
+
+	return 0;
+}
+
+static void ltdc_crtc_disable_vblank(struct drm_crtc *crtc)
+{
+	struct ltdc_device *ldev = crtc_to_ltdc(crtc);
+
+	DRM_DEBUG_DRIVER("\n");
+	reg_clear(ldev->regs, LTDC_IER, IER_LIE);
+}
+
 static const struct drm_crtc_funcs ltdc_crtc_funcs = {
 	.destroy = drm_crtc_cleanup,
 	.set_config = drm_atomic_helper_set_config,
diff --git a/drivers/gpu/drm/stm/ltdc.h b/drivers/gpu/drm/stm/ltdc.h
index a1ad0ae3b006..c5467d74e707 100644
--- a/drivers/gpu/drm/stm/ltdc.h
+++ b/drivers/gpu/drm/stm/ltdc.h
@@ -39,11 +39,6 @@ struct ltdc_device {
 	struct drm_atomic_state *suspend_state;
 };
 
-bool ltdc_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe,
-			  bool in_vblank_irq, int *vpos, int *hpos,
-			  ktime_t *stime, ktime_t *etime,
-			  const struct drm_display_mode *mode);
-
 int ltdc_load(struct drm_device *ddev);
 void ltdc_unload(struct drm_device *ddev);
 void ltdc_suspend(struct drm_device *ddev);
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 08/23] drm/stm: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

The callback struct drm_driver.get_scanout_position() is deprecated in
favor of struct drm_crtc_helper_funcs.get_scanout_position(). Convert stm
over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/stm/drv.c  |  1 -
 drivers/gpu/drm/stm/ltdc.c | 65 ++++++++++++++++++++------------------
 drivers/gpu/drm/stm/ltdc.h |  5 ---
 3 files changed, 34 insertions(+), 37 deletions(-)

diff --git a/drivers/gpu/drm/stm/drv.c b/drivers/gpu/drm/stm/drv.c
index 5a9f9aca8bc2..486985604109 100644
--- a/drivers/gpu/drm/stm/drv.c
+++ b/drivers/gpu/drm/stm/drv.c
@@ -72,7 +72,6 @@ static struct drm_driver drv_driver = {
 	.gem_prime_vmap = drm_gem_cma_prime_vmap,
 	.gem_prime_vunmap = drm_gem_cma_prime_vunmap,
 	.gem_prime_mmap = drm_gem_cma_prime_mmap,
-	.get_scanout_position = ltdc_crtc_scanoutpos,
 	.get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
 };
 
diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
index c2815e8ae1da..8b6d1a2252e3 100644
--- a/drivers/gpu/drm/stm/ltdc.c
+++ b/drivers/gpu/drm/stm/ltdc.c
@@ -636,38 +636,13 @@ static void ltdc_crtc_atomic_flush(struct drm_crtc *crtc,
 	}
 }
 
-static const struct drm_crtc_helper_funcs ltdc_crtc_helper_funcs = {
-	.mode_valid = ltdc_crtc_mode_valid,
-	.mode_fixup = ltdc_crtc_mode_fixup,
-	.mode_set_nofb = ltdc_crtc_mode_set_nofb,
-	.atomic_flush = ltdc_crtc_atomic_flush,
-	.atomic_enable = ltdc_crtc_atomic_enable,
-	.atomic_disable = ltdc_crtc_atomic_disable,
-};
-
-static int ltdc_crtc_enable_vblank(struct drm_crtc *crtc)
-{
-	struct ltdc_device *ldev = crtc_to_ltdc(crtc);
-
-	DRM_DEBUG_DRIVER("\n");
-	reg_set(ldev->regs, LTDC_IER, IER_LIE);
-
-	return 0;
-}
-
-static void ltdc_crtc_disable_vblank(struct drm_crtc *crtc)
-{
-	struct ltdc_device *ldev = crtc_to_ltdc(crtc);
-
-	DRM_DEBUG_DRIVER("\n");
-	reg_clear(ldev->regs, LTDC_IER, IER_LIE);
-}
-
-bool ltdc_crtc_scanoutpos(struct drm_device *ddev, unsigned int pipe,
-			  bool in_vblank_irq, int *vpos, int *hpos,
-			  ktime_t *stime, ktime_t *etime,
-			  const struct drm_display_mode *mode)
+static bool ltdc_crtc_get_scanout_position(struct drm_crtc *crtc,
+					   bool in_vblank_irq,
+					   int *vpos, int *hpos,
+					   ktime_t *stime, ktime_t *etime,
+					   const struct drm_display_mode *mode)
 {
+	struct drm_device *ddev = crtc->dev;
 	struct ltdc_device *ldev = ddev->dev_private;
 	int line, vactive_start, vactive_end, vtotal;
 
@@ -710,6 +685,34 @@ bool ltdc_crtc_scanoutpos(struct drm_device *ddev, unsigned int pipe,
 	return true;
 }
 
+static const struct drm_crtc_helper_funcs ltdc_crtc_helper_funcs = {
+	.mode_valid = ltdc_crtc_mode_valid,
+	.mode_fixup = ltdc_crtc_mode_fixup,
+	.mode_set_nofb = ltdc_crtc_mode_set_nofb,
+	.atomic_flush = ltdc_crtc_atomic_flush,
+	.atomic_enable = ltdc_crtc_atomic_enable,
+	.atomic_disable = ltdc_crtc_atomic_disable,
+	.get_scanout_position = ltdc_crtc_get_scanout_position,
+};
+
+static int ltdc_crtc_enable_vblank(struct drm_crtc *crtc)
+{
+	struct ltdc_device *ldev = crtc_to_ltdc(crtc);
+
+	DRM_DEBUG_DRIVER("\n");
+	reg_set(ldev->regs, LTDC_IER, IER_LIE);
+
+	return 0;
+}
+
+static void ltdc_crtc_disable_vblank(struct drm_crtc *crtc)
+{
+	struct ltdc_device *ldev = crtc_to_ltdc(crtc);
+
+	DRM_DEBUG_DRIVER("\n");
+	reg_clear(ldev->regs, LTDC_IER, IER_LIE);
+}
+
 static const struct drm_crtc_funcs ltdc_crtc_funcs = {
 	.destroy = drm_crtc_cleanup,
 	.set_config = drm_atomic_helper_set_config,
diff --git a/drivers/gpu/drm/stm/ltdc.h b/drivers/gpu/drm/stm/ltdc.h
index a1ad0ae3b006..c5467d74e707 100644
--- a/drivers/gpu/drm/stm/ltdc.h
+++ b/drivers/gpu/drm/stm/ltdc.h
@@ -39,11 +39,6 @@ struct ltdc_device {
 	struct drm_atomic_state *suspend_state;
 };
 
-bool ltdc_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe,
-			  bool in_vblank_irq, int *vpos, int *hpos,
-			  ktime_t *stime, ktime_t *etime,
-			  const struct drm_display_mode *mode);
-
 int ltdc_load(struct drm_device *ddev);
 void ltdc_unload(struct drm_device *ddev);
 void ltdc_suspend(struct drm_device *ddev);
-- 
2.24.1

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 08/23] drm/stm: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

The callback struct drm_driver.get_scanout_position() is deprecated in
favor of struct drm_crtc_helper_funcs.get_scanout_position(). Convert stm
over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/stm/drv.c  |  1 -
 drivers/gpu/drm/stm/ltdc.c | 65 ++++++++++++++++++++------------------
 drivers/gpu/drm/stm/ltdc.h |  5 ---
 3 files changed, 34 insertions(+), 37 deletions(-)

diff --git a/drivers/gpu/drm/stm/drv.c b/drivers/gpu/drm/stm/drv.c
index 5a9f9aca8bc2..486985604109 100644
--- a/drivers/gpu/drm/stm/drv.c
+++ b/drivers/gpu/drm/stm/drv.c
@@ -72,7 +72,6 @@ static struct drm_driver drv_driver = {
 	.gem_prime_vmap = drm_gem_cma_prime_vmap,
 	.gem_prime_vunmap = drm_gem_cma_prime_vunmap,
 	.gem_prime_mmap = drm_gem_cma_prime_mmap,
-	.get_scanout_position = ltdc_crtc_scanoutpos,
 	.get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
 };
 
diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
index c2815e8ae1da..8b6d1a2252e3 100644
--- a/drivers/gpu/drm/stm/ltdc.c
+++ b/drivers/gpu/drm/stm/ltdc.c
@@ -636,38 +636,13 @@ static void ltdc_crtc_atomic_flush(struct drm_crtc *crtc,
 	}
 }
 
-static const struct drm_crtc_helper_funcs ltdc_crtc_helper_funcs = {
-	.mode_valid = ltdc_crtc_mode_valid,
-	.mode_fixup = ltdc_crtc_mode_fixup,
-	.mode_set_nofb = ltdc_crtc_mode_set_nofb,
-	.atomic_flush = ltdc_crtc_atomic_flush,
-	.atomic_enable = ltdc_crtc_atomic_enable,
-	.atomic_disable = ltdc_crtc_atomic_disable,
-};
-
-static int ltdc_crtc_enable_vblank(struct drm_crtc *crtc)
-{
-	struct ltdc_device *ldev = crtc_to_ltdc(crtc);
-
-	DRM_DEBUG_DRIVER("\n");
-	reg_set(ldev->regs, LTDC_IER, IER_LIE);
-
-	return 0;
-}
-
-static void ltdc_crtc_disable_vblank(struct drm_crtc *crtc)
-{
-	struct ltdc_device *ldev = crtc_to_ltdc(crtc);
-
-	DRM_DEBUG_DRIVER("\n");
-	reg_clear(ldev->regs, LTDC_IER, IER_LIE);
-}
-
-bool ltdc_crtc_scanoutpos(struct drm_device *ddev, unsigned int pipe,
-			  bool in_vblank_irq, int *vpos, int *hpos,
-			  ktime_t *stime, ktime_t *etime,
-			  const struct drm_display_mode *mode)
+static bool ltdc_crtc_get_scanout_position(struct drm_crtc *crtc,
+					   bool in_vblank_irq,
+					   int *vpos, int *hpos,
+					   ktime_t *stime, ktime_t *etime,
+					   const struct drm_display_mode *mode)
 {
+	struct drm_device *ddev = crtc->dev;
 	struct ltdc_device *ldev = ddev->dev_private;
 	int line, vactive_start, vactive_end, vtotal;
 
@@ -710,6 +685,34 @@ bool ltdc_crtc_scanoutpos(struct drm_device *ddev, unsigned int pipe,
 	return true;
 }
 
+static const struct drm_crtc_helper_funcs ltdc_crtc_helper_funcs = {
+	.mode_valid = ltdc_crtc_mode_valid,
+	.mode_fixup = ltdc_crtc_mode_fixup,
+	.mode_set_nofb = ltdc_crtc_mode_set_nofb,
+	.atomic_flush = ltdc_crtc_atomic_flush,
+	.atomic_enable = ltdc_crtc_atomic_enable,
+	.atomic_disable = ltdc_crtc_atomic_disable,
+	.get_scanout_position = ltdc_crtc_get_scanout_position,
+};
+
+static int ltdc_crtc_enable_vblank(struct drm_crtc *crtc)
+{
+	struct ltdc_device *ldev = crtc_to_ltdc(crtc);
+
+	DRM_DEBUG_DRIVER("\n");
+	reg_set(ldev->regs, LTDC_IER, IER_LIE);
+
+	return 0;
+}
+
+static void ltdc_crtc_disable_vblank(struct drm_crtc *crtc)
+{
+	struct ltdc_device *ldev = crtc_to_ltdc(crtc);
+
+	DRM_DEBUG_DRIVER("\n");
+	reg_clear(ldev->regs, LTDC_IER, IER_LIE);
+}
+
 static const struct drm_crtc_funcs ltdc_crtc_funcs = {
 	.destroy = drm_crtc_cleanup,
 	.set_config = drm_atomic_helper_set_config,
diff --git a/drivers/gpu/drm/stm/ltdc.h b/drivers/gpu/drm/stm/ltdc.h
index a1ad0ae3b006..c5467d74e707 100644
--- a/drivers/gpu/drm/stm/ltdc.h
+++ b/drivers/gpu/drm/stm/ltdc.h
@@ -39,11 +39,6 @@ struct ltdc_device {
 	struct drm_atomic_state *suspend_state;
 };
 
-bool ltdc_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe,
-			  bool in_vblank_irq, int *vpos, int *hpos,
-			  ktime_t *stime, ktime_t *etime,
-			  const struct drm_display_mode *mode);
-
 int ltdc_load(struct drm_device *ddev);
 void ltdc_unload(struct drm_device *ddev);
 void ltdc_suspend(struct drm_device *ddev);
-- 
2.24.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [Intel-gfx] [PATCH 08/23] drm/stm: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

The callback struct drm_driver.get_scanout_position() is deprecated in
favor of struct drm_crtc_helper_funcs.get_scanout_position(). Convert stm
over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/stm/drv.c  |  1 -
 drivers/gpu/drm/stm/ltdc.c | 65 ++++++++++++++++++++------------------
 drivers/gpu/drm/stm/ltdc.h |  5 ---
 3 files changed, 34 insertions(+), 37 deletions(-)

diff --git a/drivers/gpu/drm/stm/drv.c b/drivers/gpu/drm/stm/drv.c
index 5a9f9aca8bc2..486985604109 100644
--- a/drivers/gpu/drm/stm/drv.c
+++ b/drivers/gpu/drm/stm/drv.c
@@ -72,7 +72,6 @@ static struct drm_driver drv_driver = {
 	.gem_prime_vmap = drm_gem_cma_prime_vmap,
 	.gem_prime_vunmap = drm_gem_cma_prime_vunmap,
 	.gem_prime_mmap = drm_gem_cma_prime_mmap,
-	.get_scanout_position = ltdc_crtc_scanoutpos,
 	.get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
 };
 
diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
index c2815e8ae1da..8b6d1a2252e3 100644
--- a/drivers/gpu/drm/stm/ltdc.c
+++ b/drivers/gpu/drm/stm/ltdc.c
@@ -636,38 +636,13 @@ static void ltdc_crtc_atomic_flush(struct drm_crtc *crtc,
 	}
 }
 
-static const struct drm_crtc_helper_funcs ltdc_crtc_helper_funcs = {
-	.mode_valid = ltdc_crtc_mode_valid,
-	.mode_fixup = ltdc_crtc_mode_fixup,
-	.mode_set_nofb = ltdc_crtc_mode_set_nofb,
-	.atomic_flush = ltdc_crtc_atomic_flush,
-	.atomic_enable = ltdc_crtc_atomic_enable,
-	.atomic_disable = ltdc_crtc_atomic_disable,
-};
-
-static int ltdc_crtc_enable_vblank(struct drm_crtc *crtc)
-{
-	struct ltdc_device *ldev = crtc_to_ltdc(crtc);
-
-	DRM_DEBUG_DRIVER("\n");
-	reg_set(ldev->regs, LTDC_IER, IER_LIE);
-
-	return 0;
-}
-
-static void ltdc_crtc_disable_vblank(struct drm_crtc *crtc)
-{
-	struct ltdc_device *ldev = crtc_to_ltdc(crtc);
-
-	DRM_DEBUG_DRIVER("\n");
-	reg_clear(ldev->regs, LTDC_IER, IER_LIE);
-}
-
-bool ltdc_crtc_scanoutpos(struct drm_device *ddev, unsigned int pipe,
-			  bool in_vblank_irq, int *vpos, int *hpos,
-			  ktime_t *stime, ktime_t *etime,
-			  const struct drm_display_mode *mode)
+static bool ltdc_crtc_get_scanout_position(struct drm_crtc *crtc,
+					   bool in_vblank_irq,
+					   int *vpos, int *hpos,
+					   ktime_t *stime, ktime_t *etime,
+					   const struct drm_display_mode *mode)
 {
+	struct drm_device *ddev = crtc->dev;
 	struct ltdc_device *ldev = ddev->dev_private;
 	int line, vactive_start, vactive_end, vtotal;
 
@@ -710,6 +685,34 @@ bool ltdc_crtc_scanoutpos(struct drm_device *ddev, unsigned int pipe,
 	return true;
 }
 
+static const struct drm_crtc_helper_funcs ltdc_crtc_helper_funcs = {
+	.mode_valid = ltdc_crtc_mode_valid,
+	.mode_fixup = ltdc_crtc_mode_fixup,
+	.mode_set_nofb = ltdc_crtc_mode_set_nofb,
+	.atomic_flush = ltdc_crtc_atomic_flush,
+	.atomic_enable = ltdc_crtc_atomic_enable,
+	.atomic_disable = ltdc_crtc_atomic_disable,
+	.get_scanout_position = ltdc_crtc_get_scanout_position,
+};
+
+static int ltdc_crtc_enable_vblank(struct drm_crtc *crtc)
+{
+	struct ltdc_device *ldev = crtc_to_ltdc(crtc);
+
+	DRM_DEBUG_DRIVER("\n");
+	reg_set(ldev->regs, LTDC_IER, IER_LIE);
+
+	return 0;
+}
+
+static void ltdc_crtc_disable_vblank(struct drm_crtc *crtc)
+{
+	struct ltdc_device *ldev = crtc_to_ltdc(crtc);
+
+	DRM_DEBUG_DRIVER("\n");
+	reg_clear(ldev->regs, LTDC_IER, IER_LIE);
+}
+
 static const struct drm_crtc_funcs ltdc_crtc_funcs = {
 	.destroy = drm_crtc_cleanup,
 	.set_config = drm_atomic_helper_set_config,
diff --git a/drivers/gpu/drm/stm/ltdc.h b/drivers/gpu/drm/stm/ltdc.h
index a1ad0ae3b006..c5467d74e707 100644
--- a/drivers/gpu/drm/stm/ltdc.h
+++ b/drivers/gpu/drm/stm/ltdc.h
@@ -39,11 +39,6 @@ struct ltdc_device {
 	struct drm_atomic_state *suspend_state;
 };
 
-bool ltdc_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe,
-			  bool in_vblank_irq, int *vpos, int *hpos,
-			  ktime_t *stime, ktime_t *etime,
-			  const struct drm_display_mode *mode);
-
 int ltdc_load(struct drm_device *ddev);
 void ltdc_unload(struct drm_device *ddev);
 void ltdc_suspend(struct drm_device *ddev);
-- 
2.24.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 08/23] drm/stm: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

The callback struct drm_driver.get_scanout_position() is deprecated in
favor of struct drm_crtc_helper_funcs.get_scanout_position(). Convert stm
over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/stm/drv.c  |  1 -
 drivers/gpu/drm/stm/ltdc.c | 65 ++++++++++++++++++++------------------
 drivers/gpu/drm/stm/ltdc.h |  5 ---
 3 files changed, 34 insertions(+), 37 deletions(-)

diff --git a/drivers/gpu/drm/stm/drv.c b/drivers/gpu/drm/stm/drv.c
index 5a9f9aca8bc2..486985604109 100644
--- a/drivers/gpu/drm/stm/drv.c
+++ b/drivers/gpu/drm/stm/drv.c
@@ -72,7 +72,6 @@ static struct drm_driver drv_driver = {
 	.gem_prime_vmap = drm_gem_cma_prime_vmap,
 	.gem_prime_vunmap = drm_gem_cma_prime_vunmap,
 	.gem_prime_mmap = drm_gem_cma_prime_mmap,
-	.get_scanout_position = ltdc_crtc_scanoutpos,
 	.get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
 };
 
diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
index c2815e8ae1da..8b6d1a2252e3 100644
--- a/drivers/gpu/drm/stm/ltdc.c
+++ b/drivers/gpu/drm/stm/ltdc.c
@@ -636,38 +636,13 @@ static void ltdc_crtc_atomic_flush(struct drm_crtc *crtc,
 	}
 }
 
-static const struct drm_crtc_helper_funcs ltdc_crtc_helper_funcs = {
-	.mode_valid = ltdc_crtc_mode_valid,
-	.mode_fixup = ltdc_crtc_mode_fixup,
-	.mode_set_nofb = ltdc_crtc_mode_set_nofb,
-	.atomic_flush = ltdc_crtc_atomic_flush,
-	.atomic_enable = ltdc_crtc_atomic_enable,
-	.atomic_disable = ltdc_crtc_atomic_disable,
-};
-
-static int ltdc_crtc_enable_vblank(struct drm_crtc *crtc)
-{
-	struct ltdc_device *ldev = crtc_to_ltdc(crtc);
-
-	DRM_DEBUG_DRIVER("\n");
-	reg_set(ldev->regs, LTDC_IER, IER_LIE);
-
-	return 0;
-}
-
-static void ltdc_crtc_disable_vblank(struct drm_crtc *crtc)
-{
-	struct ltdc_device *ldev = crtc_to_ltdc(crtc);
-
-	DRM_DEBUG_DRIVER("\n");
-	reg_clear(ldev->regs, LTDC_IER, IER_LIE);
-}
-
-bool ltdc_crtc_scanoutpos(struct drm_device *ddev, unsigned int pipe,
-			  bool in_vblank_irq, int *vpos, int *hpos,
-			  ktime_t *stime, ktime_t *etime,
-			  const struct drm_display_mode *mode)
+static bool ltdc_crtc_get_scanout_position(struct drm_crtc *crtc,
+					   bool in_vblank_irq,
+					   int *vpos, int *hpos,
+					   ktime_t *stime, ktime_t *etime,
+					   const struct drm_display_mode *mode)
 {
+	struct drm_device *ddev = crtc->dev;
 	struct ltdc_device *ldev = ddev->dev_private;
 	int line, vactive_start, vactive_end, vtotal;
 
@@ -710,6 +685,34 @@ bool ltdc_crtc_scanoutpos(struct drm_device *ddev, unsigned int pipe,
 	return true;
 }
 
+static const struct drm_crtc_helper_funcs ltdc_crtc_helper_funcs = {
+	.mode_valid = ltdc_crtc_mode_valid,
+	.mode_fixup = ltdc_crtc_mode_fixup,
+	.mode_set_nofb = ltdc_crtc_mode_set_nofb,
+	.atomic_flush = ltdc_crtc_atomic_flush,
+	.atomic_enable = ltdc_crtc_atomic_enable,
+	.atomic_disable = ltdc_crtc_atomic_disable,
+	.get_scanout_position = ltdc_crtc_get_scanout_position,
+};
+
+static int ltdc_crtc_enable_vblank(struct drm_crtc *crtc)
+{
+	struct ltdc_device *ldev = crtc_to_ltdc(crtc);
+
+	DRM_DEBUG_DRIVER("\n");
+	reg_set(ldev->regs, LTDC_IER, IER_LIE);
+
+	return 0;
+}
+
+static void ltdc_crtc_disable_vblank(struct drm_crtc *crtc)
+{
+	struct ltdc_device *ldev = crtc_to_ltdc(crtc);
+
+	DRM_DEBUG_DRIVER("\n");
+	reg_clear(ldev->regs, LTDC_IER, IER_LIE);
+}
+
 static const struct drm_crtc_funcs ltdc_crtc_funcs = {
 	.destroy = drm_crtc_cleanup,
 	.set_config = drm_atomic_helper_set_config,
diff --git a/drivers/gpu/drm/stm/ltdc.h b/drivers/gpu/drm/stm/ltdc.h
index a1ad0ae3b006..c5467d74e707 100644
--- a/drivers/gpu/drm/stm/ltdc.h
+++ b/drivers/gpu/drm/stm/ltdc.h
@@ -39,11 +39,6 @@ struct ltdc_device {
 	struct drm_atomic_state *suspend_state;
 };
 
-bool ltdc_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe,
-			  bool in_vblank_irq, int *vpos, int *hpos,
-			  ktime_t *stime, ktime_t *etime,
-			  const struct drm_display_mode *mode);
-
 int ltdc_load(struct drm_device *ddev);
 void ltdc_unload(struct drm_device *ddev);
 void ltdc_suspend(struct drm_device *ddev);
-- 
2.24.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 09/23] drm: Remove struct drm_driver.get_scanout_position()
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: dri-devel, amd-gfx, intel-gfx, linux-arm-msm, freedreno, nouveau,
	Thomas Zimmermann

All users of struct drm_driver.get_scanout_position() have been
covnerted to the respective CRTC helper function. Remove the callback
from struct drm_driver.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/drm_vblank.c | 13 ++-------
 include/drm/drm_drv.h        | 52 ------------------------------------
 2 files changed, 2 insertions(+), 63 deletions(-)

diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
index c12f0b333e14..b84065911d69 100644
--- a/drivers/gpu/drm/drm_vblank.c
+++ b/drivers/gpu/drm/drm_vblank.c
@@ -633,8 +633,7 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
 	}
 
 	/* Scanout position query not supported? Should not happen. */
-	if (!dev->driver->get_scanout_position ||
-	    !crtc->helper_private->get_scanout_position) {
+	if (!crtc->helper_private->get_scanout_position) {
 		DRM_ERROR("Called from CRTC w/o get_scanout_position()!?\n");
 		return false;
 	}
@@ -666,17 +665,9 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
 		 * Get vertical and horizontal scanout position vpos, hpos,
 		 * and bounding timestamps stime, etime, pre/post query.
 		 */
-		if (crtc->helper_private->get_scanout_position) {
-			vbl_status =
-				crtc->helper_private->get_scanout_position(
+		vbl_status = crtc->helper_private->get_scanout_position(
 					crtc, in_vblank_irq, &vpos, &hpos,
 					&stime, &etime, mode);
-		} else {
-			vbl_status =
-				dev->driver->get_scanout_position(
-					dev, pipe, in_vblank_irq, &vpos,
-					&hpos, &stime, &etime, mode);
-		}
 
 		/* Return as no-op if scanout query unsupported or failed. */
 		if (!vbl_status) {
diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
index d0049e5786fc..b704e252f3b2 100644
--- a/include/drm/drm_drv.h
+++ b/include/drm/drm_drv.h
@@ -318,58 +318,6 @@ struct drm_driver {
 	 */
 	void (*disable_vblank) (struct drm_device *dev, unsigned int pipe);
 
-	/**
-	 * @get_scanout_position:
-	 *
-	 * Called by vblank timestamping code.
-	 *
-	 * Returns the current display scanout position from a crtc, and an
-	 * optional accurate ktime_get() timestamp of when position was
-	 * measured. Note that this is a helper callback which is only used if a
-	 * driver uses drm_calc_vbltimestamp_from_scanoutpos() for the
-	 * @get_vblank_timestamp callback.
-	 *
-	 * Parameters:
-	 *
-	 * dev:
-	 *     DRM device.
-	 * pipe:
-	 *     Id of the crtc to query.
-	 * in_vblank_irq:
-	 *     True when called from drm_crtc_handle_vblank().  Some drivers
-	 *     need to apply some workarounds for gpu-specific vblank irq quirks
-	 *     if flag is set.
-	 * vpos:
-	 *     Target location for current vertical scanout position.
-	 * hpos:
-	 *     Target location for current horizontal scanout position.
-	 * stime:
-	 *     Target location for timestamp taken immediately before
-	 *     scanout position query. Can be NULL to skip timestamp.
-	 * etime:
-	 *     Target location for timestamp taken immediately after
-	 *     scanout position query. Can be NULL to skip timestamp.
-	 * mode:
-	 *     Current display timings.
-	 *
-	 * Returns vpos as a positive number while in active scanout area.
-	 * Returns vpos as a negative number inside vblank, counting the number
-	 * of scanlines to go until end of vblank, e.g., -1 means "one scanline
-	 * until start of active scanout / end of vblank."
-	 *
-	 * Returns:
-	 *
-	 * True on success, false if a reliable scanout position counter could
-	 * not be read out.
-	 *
-	 * This is deprecated and should not be used by new drivers.
-	 * Use &drm_crtc_helper_funcs.get_scanout_position instead.
-	 */
-	bool (*get_scanout_position) (struct drm_device *dev, unsigned int pipe,
-				      bool in_vblank_irq, int *vpos, int *hpos,
-				      ktime_t *stime, ktime_t *etime,
-				      const struct drm_display_mode *mode);
-
 	/**
 	 * @get_vblank_timestamp:
 	 *
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 09/23] drm: Remove struct drm_driver.get_scanout_position()
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied-cv59FeDIM0c, daniel-/w4YWyX8dFk,
	alexander.deucher-5C7GfCeVMHo, christian.koenig-5C7GfCeVMHo,
	David1.Zhou-5C7GfCeVMHo,
	maarten.lankhorst-VuQAYsv1563Yd54FQh9/CA,
	patrik.r.jakobsson-Re5JQEeQqe8AvxtiuMwx3w,
	robdclark-Re5JQEeQqe8AvxtiuMwx3w, sean-p7yTbzM4H96eqtR555YLDQ,
	benjamin.gaignard-QSEj5FYQhm4dnm+yROfE0A,
	vincent.abriou-qxv4g6HH51o, yannick.fertre-qxv4g6HH51o,
	philippe.cornu-qxv4g6HH51o,
	mcoquelin.stm32-Re5JQEeQqe8AvxtiuMwx3w,
	alexandre.torgue-qxv4g6HH51o, eric-WhKQ6XTQaPysTnJN9+BGXg,
	rodrigosiqueiramelo-Re5JQEeQqe8AvxtiuMwx3w,
	hamohammed.sa-Re5JQEeQqe8AvxtiuMwx3w,
	linux-graphics-maintainer-pghWNbHTmq7QT0dZR+AlfA,
	thellstrom-pghWNbHTmq7QT0dZR+AlfA,
	bskeggs-H+wXaHxf7aLQT0dZR+AlfA, harry.wentland-5C7GfCeVMHo,
	sunpeng.li-5C7GfCeVMHo, jani.nikula-VuQAYsv1563Yd54FQh9/CA,
	joonas.lahtinen-VuQAYsv1563Yd54FQh9/CA,
	rodrigo.vivi-ral2JQCrhuEAvxtiuMwx3w
  Cc: linux-arm-msm-u79uwXL29TY76Z2rM5mHXA,
	intel-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Thomas Zimmermann,
	nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

All users of struct drm_driver.get_scanout_position() have been
covnerted to the respective CRTC helper function. Remove the callback
from struct drm_driver.

Signed-off-by: Thomas Zimmermann <tzimmermann-l3A5Bk7waGM@public.gmane.org>
---
 drivers/gpu/drm/drm_vblank.c | 13 ++-------
 include/drm/drm_drv.h        | 52 ------------------------------------
 2 files changed, 2 insertions(+), 63 deletions(-)

diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
index c12f0b333e14..b84065911d69 100644
--- a/drivers/gpu/drm/drm_vblank.c
+++ b/drivers/gpu/drm/drm_vblank.c
@@ -633,8 +633,7 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
 	}
 
 	/* Scanout position query not supported? Should not happen. */
-	if (!dev->driver->get_scanout_position ||
-	    !crtc->helper_private->get_scanout_position) {
+	if (!crtc->helper_private->get_scanout_position) {
 		DRM_ERROR("Called from CRTC w/o get_scanout_position()!?\n");
 		return false;
 	}
@@ -666,17 +665,9 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
 		 * Get vertical and horizontal scanout position vpos, hpos,
 		 * and bounding timestamps stime, etime, pre/post query.
 		 */
-		if (crtc->helper_private->get_scanout_position) {
-			vbl_status =
-				crtc->helper_private->get_scanout_position(
+		vbl_status = crtc->helper_private->get_scanout_position(
 					crtc, in_vblank_irq, &vpos, &hpos,
 					&stime, &etime, mode);
-		} else {
-			vbl_status =
-				dev->driver->get_scanout_position(
-					dev, pipe, in_vblank_irq, &vpos,
-					&hpos, &stime, &etime, mode);
-		}
 
 		/* Return as no-op if scanout query unsupported or failed. */
 		if (!vbl_status) {
diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
index d0049e5786fc..b704e252f3b2 100644
--- a/include/drm/drm_drv.h
+++ b/include/drm/drm_drv.h
@@ -318,58 +318,6 @@ struct drm_driver {
 	 */
 	void (*disable_vblank) (struct drm_device *dev, unsigned int pipe);
 
-	/**
-	 * @get_scanout_position:
-	 *
-	 * Called by vblank timestamping code.
-	 *
-	 * Returns the current display scanout position from a crtc, and an
-	 * optional accurate ktime_get() timestamp of when position was
-	 * measured. Note that this is a helper callback which is only used if a
-	 * driver uses drm_calc_vbltimestamp_from_scanoutpos() for the
-	 * @get_vblank_timestamp callback.
-	 *
-	 * Parameters:
-	 *
-	 * dev:
-	 *     DRM device.
-	 * pipe:
-	 *     Id of the crtc to query.
-	 * in_vblank_irq:
-	 *     True when called from drm_crtc_handle_vblank().  Some drivers
-	 *     need to apply some workarounds for gpu-specific vblank irq quirks
-	 *     if flag is set.
-	 * vpos:
-	 *     Target location for current vertical scanout position.
-	 * hpos:
-	 *     Target location for current horizontal scanout position.
-	 * stime:
-	 *     Target location for timestamp taken immediately before
-	 *     scanout position query. Can be NULL to skip timestamp.
-	 * etime:
-	 *     Target location for timestamp taken immediately after
-	 *     scanout position query. Can be NULL to skip timestamp.
-	 * mode:
-	 *     Current display timings.
-	 *
-	 * Returns vpos as a positive number while in active scanout area.
-	 * Returns vpos as a negative number inside vblank, counting the number
-	 * of scanlines to go until end of vblank, e.g., -1 means "one scanline
-	 * until start of active scanout / end of vblank."
-	 *
-	 * Returns:
-	 *
-	 * True on success, false if a reliable scanout position counter could
-	 * not be read out.
-	 *
-	 * This is deprecated and should not be used by new drivers.
-	 * Use &drm_crtc_helper_funcs.get_scanout_position instead.
-	 */
-	bool (*get_scanout_position) (struct drm_device *dev, unsigned int pipe,
-				      bool in_vblank_irq, int *vpos, int *hpos,
-				      ktime_t *stime, ktime_t *etime,
-				      const struct drm_display_mode *mode);
-
 	/**
 	 * @get_vblank_timestamp:
 	 *
-- 
2.24.1

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 09/23] drm: Remove struct drm_driver.get_scanout_position()
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

All users of struct drm_driver.get_scanout_position() have been
covnerted to the respective CRTC helper function. Remove the callback
from struct drm_driver.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/drm_vblank.c | 13 ++-------
 include/drm/drm_drv.h        | 52 ------------------------------------
 2 files changed, 2 insertions(+), 63 deletions(-)

diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
index c12f0b333e14..b84065911d69 100644
--- a/drivers/gpu/drm/drm_vblank.c
+++ b/drivers/gpu/drm/drm_vblank.c
@@ -633,8 +633,7 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
 	}
 
 	/* Scanout position query not supported? Should not happen. */
-	if (!dev->driver->get_scanout_position ||
-	    !crtc->helper_private->get_scanout_position) {
+	if (!crtc->helper_private->get_scanout_position) {
 		DRM_ERROR("Called from CRTC w/o get_scanout_position()!?\n");
 		return false;
 	}
@@ -666,17 +665,9 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
 		 * Get vertical and horizontal scanout position vpos, hpos,
 		 * and bounding timestamps stime, etime, pre/post query.
 		 */
-		if (crtc->helper_private->get_scanout_position) {
-			vbl_status =
-				crtc->helper_private->get_scanout_position(
+		vbl_status = crtc->helper_private->get_scanout_position(
 					crtc, in_vblank_irq, &vpos, &hpos,
 					&stime, &etime, mode);
-		} else {
-			vbl_status =
-				dev->driver->get_scanout_position(
-					dev, pipe, in_vblank_irq, &vpos,
-					&hpos, &stime, &etime, mode);
-		}
 
 		/* Return as no-op if scanout query unsupported or failed. */
 		if (!vbl_status) {
diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
index d0049e5786fc..b704e252f3b2 100644
--- a/include/drm/drm_drv.h
+++ b/include/drm/drm_drv.h
@@ -318,58 +318,6 @@ struct drm_driver {
 	 */
 	void (*disable_vblank) (struct drm_device *dev, unsigned int pipe);
 
-	/**
-	 * @get_scanout_position:
-	 *
-	 * Called by vblank timestamping code.
-	 *
-	 * Returns the current display scanout position from a crtc, and an
-	 * optional accurate ktime_get() timestamp of when position was
-	 * measured. Note that this is a helper callback which is only used if a
-	 * driver uses drm_calc_vbltimestamp_from_scanoutpos() for the
-	 * @get_vblank_timestamp callback.
-	 *
-	 * Parameters:
-	 *
-	 * dev:
-	 *     DRM device.
-	 * pipe:
-	 *     Id of the crtc to query.
-	 * in_vblank_irq:
-	 *     True when called from drm_crtc_handle_vblank().  Some drivers
-	 *     need to apply some workarounds for gpu-specific vblank irq quirks
-	 *     if flag is set.
-	 * vpos:
-	 *     Target location for current vertical scanout position.
-	 * hpos:
-	 *     Target location for current horizontal scanout position.
-	 * stime:
-	 *     Target location for timestamp taken immediately before
-	 *     scanout position query. Can be NULL to skip timestamp.
-	 * etime:
-	 *     Target location for timestamp taken immediately after
-	 *     scanout position query. Can be NULL to skip timestamp.
-	 * mode:
-	 *     Current display timings.
-	 *
-	 * Returns vpos as a positive number while in active scanout area.
-	 * Returns vpos as a negative number inside vblank, counting the number
-	 * of scanlines to go until end of vblank, e.g., -1 means "one scanline
-	 * until start of active scanout / end of vblank."
-	 *
-	 * Returns:
-	 *
-	 * True on success, false if a reliable scanout position counter could
-	 * not be read out.
-	 *
-	 * This is deprecated and should not be used by new drivers.
-	 * Use &drm_crtc_helper_funcs.get_scanout_position instead.
-	 */
-	bool (*get_scanout_position) (struct drm_device *dev, unsigned int pipe,
-				      bool in_vblank_irq, int *vpos, int *hpos,
-				      ktime_t *stime, ktime_t *etime,
-				      const struct drm_display_mode *mode);
-
 	/**
 	 * @get_vblank_timestamp:
 	 *
-- 
2.24.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [Intel-gfx] [PATCH 09/23] drm: Remove struct drm_driver.get_scanout_position()
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

All users of struct drm_driver.get_scanout_position() have been
covnerted to the respective CRTC helper function. Remove the callback
from struct drm_driver.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/drm_vblank.c | 13 ++-------
 include/drm/drm_drv.h        | 52 ------------------------------------
 2 files changed, 2 insertions(+), 63 deletions(-)

diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
index c12f0b333e14..b84065911d69 100644
--- a/drivers/gpu/drm/drm_vblank.c
+++ b/drivers/gpu/drm/drm_vblank.c
@@ -633,8 +633,7 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
 	}
 
 	/* Scanout position query not supported? Should not happen. */
-	if (!dev->driver->get_scanout_position ||
-	    !crtc->helper_private->get_scanout_position) {
+	if (!crtc->helper_private->get_scanout_position) {
 		DRM_ERROR("Called from CRTC w/o get_scanout_position()!?\n");
 		return false;
 	}
@@ -666,17 +665,9 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
 		 * Get vertical and horizontal scanout position vpos, hpos,
 		 * and bounding timestamps stime, etime, pre/post query.
 		 */
-		if (crtc->helper_private->get_scanout_position) {
-			vbl_status =
-				crtc->helper_private->get_scanout_position(
+		vbl_status = crtc->helper_private->get_scanout_position(
 					crtc, in_vblank_irq, &vpos, &hpos,
 					&stime, &etime, mode);
-		} else {
-			vbl_status =
-				dev->driver->get_scanout_position(
-					dev, pipe, in_vblank_irq, &vpos,
-					&hpos, &stime, &etime, mode);
-		}
 
 		/* Return as no-op if scanout query unsupported or failed. */
 		if (!vbl_status) {
diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
index d0049e5786fc..b704e252f3b2 100644
--- a/include/drm/drm_drv.h
+++ b/include/drm/drm_drv.h
@@ -318,58 +318,6 @@ struct drm_driver {
 	 */
 	void (*disable_vblank) (struct drm_device *dev, unsigned int pipe);
 
-	/**
-	 * @get_scanout_position:
-	 *
-	 * Called by vblank timestamping code.
-	 *
-	 * Returns the current display scanout position from a crtc, and an
-	 * optional accurate ktime_get() timestamp of when position was
-	 * measured. Note that this is a helper callback which is only used if a
-	 * driver uses drm_calc_vbltimestamp_from_scanoutpos() for the
-	 * @get_vblank_timestamp callback.
-	 *
-	 * Parameters:
-	 *
-	 * dev:
-	 *     DRM device.
-	 * pipe:
-	 *     Id of the crtc to query.
-	 * in_vblank_irq:
-	 *     True when called from drm_crtc_handle_vblank().  Some drivers
-	 *     need to apply some workarounds for gpu-specific vblank irq quirks
-	 *     if flag is set.
-	 * vpos:
-	 *     Target location for current vertical scanout position.
-	 * hpos:
-	 *     Target location for current horizontal scanout position.
-	 * stime:
-	 *     Target location for timestamp taken immediately before
-	 *     scanout position query. Can be NULL to skip timestamp.
-	 * etime:
-	 *     Target location for timestamp taken immediately after
-	 *     scanout position query. Can be NULL to skip timestamp.
-	 * mode:
-	 *     Current display timings.
-	 *
-	 * Returns vpos as a positive number while in active scanout area.
-	 * Returns vpos as a negative number inside vblank, counting the number
-	 * of scanlines to go until end of vblank, e.g., -1 means "one scanline
-	 * until start of active scanout / end of vblank."
-	 *
-	 * Returns:
-	 *
-	 * True on success, false if a reliable scanout position counter could
-	 * not be read out.
-	 *
-	 * This is deprecated and should not be used by new drivers.
-	 * Use &drm_crtc_helper_funcs.get_scanout_position instead.
-	 */
-	bool (*get_scanout_position) (struct drm_device *dev, unsigned int pipe,
-				      bool in_vblank_irq, int *vpos, int *hpos,
-				      ktime_t *stime, ktime_t *etime,
-				      const struct drm_display_mode *mode);
-
 	/**
 	 * @get_vblank_timestamp:
 	 *
-- 
2.24.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 09/23] drm: Remove struct drm_driver.get_scanout_position()
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

All users of struct drm_driver.get_scanout_position() have been
covnerted to the respective CRTC helper function. Remove the callback
from struct drm_driver.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/drm_vblank.c | 13 ++-------
 include/drm/drm_drv.h        | 52 ------------------------------------
 2 files changed, 2 insertions(+), 63 deletions(-)

diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
index c12f0b333e14..b84065911d69 100644
--- a/drivers/gpu/drm/drm_vblank.c
+++ b/drivers/gpu/drm/drm_vblank.c
@@ -633,8 +633,7 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
 	}
 
 	/* Scanout position query not supported? Should not happen. */
-	if (!dev->driver->get_scanout_position ||
-	    !crtc->helper_private->get_scanout_position) {
+	if (!crtc->helper_private->get_scanout_position) {
 		DRM_ERROR("Called from CRTC w/o get_scanout_position()!?\n");
 		return false;
 	}
@@ -666,17 +665,9 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
 		 * Get vertical and horizontal scanout position vpos, hpos,
 		 * and bounding timestamps stime, etime, pre/post query.
 		 */
-		if (crtc->helper_private->get_scanout_position) {
-			vbl_status =
-				crtc->helper_private->get_scanout_position(
+		vbl_status = crtc->helper_private->get_scanout_position(
 					crtc, in_vblank_irq, &vpos, &hpos,
 					&stime, &etime, mode);
-		} else {
-			vbl_status =
-				dev->driver->get_scanout_position(
-					dev, pipe, in_vblank_irq, &vpos,
-					&hpos, &stime, &etime, mode);
-		}
 
 		/* Return as no-op if scanout query unsupported or failed. */
 		if (!vbl_status) {
diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
index d0049e5786fc..b704e252f3b2 100644
--- a/include/drm/drm_drv.h
+++ b/include/drm/drm_drv.h
@@ -318,58 +318,6 @@ struct drm_driver {
 	 */
 	void (*disable_vblank) (struct drm_device *dev, unsigned int pipe);
 
-	/**
-	 * @get_scanout_position:
-	 *
-	 * Called by vblank timestamping code.
-	 *
-	 * Returns the current display scanout position from a crtc, and an
-	 * optional accurate ktime_get() timestamp of when position was
-	 * measured. Note that this is a helper callback which is only used if a
-	 * driver uses drm_calc_vbltimestamp_from_scanoutpos() for the
-	 * @get_vblank_timestamp callback.
-	 *
-	 * Parameters:
-	 *
-	 * dev:
-	 *     DRM device.
-	 * pipe:
-	 *     Id of the crtc to query.
-	 * in_vblank_irq:
-	 *     True when called from drm_crtc_handle_vblank().  Some drivers
-	 *     need to apply some workarounds for gpu-specific vblank irq quirks
-	 *     if flag is set.
-	 * vpos:
-	 *     Target location for current vertical scanout position.
-	 * hpos:
-	 *     Target location for current horizontal scanout position.
-	 * stime:
-	 *     Target location for timestamp taken immediately before
-	 *     scanout position query. Can be NULL to skip timestamp.
-	 * etime:
-	 *     Target location for timestamp taken immediately after
-	 *     scanout position query. Can be NULL to skip timestamp.
-	 * mode:
-	 *     Current display timings.
-	 *
-	 * Returns vpos as a positive number while in active scanout area.
-	 * Returns vpos as a negative number inside vblank, counting the number
-	 * of scanlines to go until end of vblank, e.g., -1 means "one scanline
-	 * until start of active scanout / end of vblank."
-	 *
-	 * Returns:
-	 *
-	 * True on success, false if a reliable scanout position counter could
-	 * not be read out.
-	 *
-	 * This is deprecated and should not be used by new drivers.
-	 * Use &drm_crtc_helper_funcs.get_scanout_position instead.
-	 */
-	bool (*get_scanout_position) (struct drm_device *dev, unsigned int pipe,
-				      bool in_vblank_irq, int *vpos, int *hpos,
-				      ktime_t *stime, ktime_t *etime,
-				      const struct drm_display_mode *mode);
-
 	/**
 	 * @get_vblank_timestamp:
 	 *
-- 
2.24.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 10/23] drm: Evaluate struct drm_device.vblank_disable_immediate on each use
  2020-01-10  9:21 ` Thomas Zimmermann
  (?)
  (?)
@ 2020-01-10  9:21   ` Thomas Zimmermann
  -1 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: dri-devel, amd-gfx, intel-gfx, linux-arm-msm, freedreno, nouveau,
	Thomas Zimmermann

VBLANK interrupts can be disabled immediately or with a delay, where the
latter is the default. The former option can be selected by setting
get_vblank_timestamp, and enabling vblank_disable_immediate in struct
drm_device.

The setup is only evaluated once when DRM initializes VBLANKs. Evaluating
the settings on each use of vblank_disable_immediate will allow for easy
integration of CRTC VBLANK functions.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/drm_vblank.c | 31 ++++++++++++++-----------------
 1 file changed, 14 insertions(+), 17 deletions(-)

diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
index b84065911d69..cbe8f3009df5 100644
--- a/drivers/gpu/drm/drm_vblank.c
+++ b/drivers/gpu/drm/drm_vblank.c
@@ -481,19 +481,6 @@ int drm_vblank_init(struct drm_device *dev, unsigned int num_crtcs)
 
 	DRM_INFO("Supports vblank timestamp caching Rev 2 (21.10.2013).\n");
 
-	/* Driver specific high-precision vblank timestamping supported? */
-	if (dev->driver->get_vblank_timestamp)
-		DRM_INFO("Driver supports precise vblank timestamp query.\n");
-	else
-		DRM_INFO("No driver support for vblank timestamp query.\n");
-
-	/* Must have precise timestamping for reliable vblank instant disable */
-	if (dev->vblank_disable_immediate && !dev->driver->get_vblank_timestamp) {
-		dev->vblank_disable_immediate = false;
-		DRM_INFO("Setting vblank_disable_immediate to false because "
-			 "get_vblank_timestamp == NULL\n");
-	}
-
 	return 0;
 
 err:
@@ -1061,6 +1048,15 @@ int drm_crtc_vblank_get(struct drm_crtc *crtc)
 }
 EXPORT_SYMBOL(drm_crtc_vblank_get);
 
+static bool __vblank_disable_immediate(struct drm_device *dev, unsigned int pipe)
+{
+	if (!dev->vblank_disable_immediate)
+		return false;
+	if (!dev->driver->get_vblank_timestamp)
+		return false;
+	return true;
+}
+
 static void drm_vblank_put(struct drm_device *dev, unsigned int pipe)
 {
 	struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
@@ -1077,7 +1073,7 @@ static void drm_vblank_put(struct drm_device *dev, unsigned int pipe)
 			return;
 		else if (drm_vblank_offdelay < 0)
 			vblank_disable_fn(&vblank->disable_timer);
-		else if (!dev->vblank_disable_immediate)
+		else if (__vblank_disable_immediate(dev, pipe))
 			mod_timer(&vblank->disable_timer,
 				  jiffies + ((drm_vblank_offdelay * HZ)/1000));
 	}
@@ -1654,7 +1650,7 @@ int drm_wait_vblank_ioctl(struct drm_device *dev, void *data,
 	/* If the counter is currently enabled and accurate, short-circuit
 	 * queries to return the cached timestamp of the last vblank.
 	 */
-	if (dev->vblank_disable_immediate &&
+	if (__vblank_disable_immediate(dev, pipe) &&
 	    drm_wait_vblank_is_query(vblwait) &&
 	    READ_ONCE(vblank->enabled)) {
 		drm_wait_vblank_reply(dev, pipe, &vblwait->reply);
@@ -1811,7 +1807,7 @@ bool drm_handle_vblank(struct drm_device *dev, unsigned int pipe)
 	 * been signaled. The disable has to be last (after
 	 * drm_handle_vblank_events) so that the timestamp is always accurate.
 	 */
-	disable_irq = (dev->vblank_disable_immediate &&
+	disable_irq = (__vblank_disable_immediate(dev, pipe) &&
 		       drm_vblank_offdelay > 0 &&
 		       !atomic_read(&vblank->refcount));
 
@@ -1884,7 +1880,8 @@ int drm_crtc_get_sequence_ioctl(struct drm_device *dev, void *data,
 	pipe = drm_crtc_index(crtc);
 
 	vblank = &dev->vblank[pipe];
-	vblank_enabled = dev->vblank_disable_immediate && READ_ONCE(vblank->enabled);
+	vblank_enabled = __vblank_disable_immediate(dev, pipe) &&
+			 READ_ONCE(vblank->enabled);
 
 	if (!vblank_enabled) {
 		ret = drm_crtc_vblank_get(crtc);
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 10/23] drm: Evaluate struct drm_device.vblank_disable_immediate on each use
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

VBLANK interrupts can be disabled immediately or with a delay, where the
latter is the default. The former option can be selected by setting
get_vblank_timestamp, and enabling vblank_disable_immediate in struct
drm_device.

The setup is only evaluated once when DRM initializes VBLANKs. Evaluating
the settings on each use of vblank_disable_immediate will allow for easy
integration of CRTC VBLANK functions.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/drm_vblank.c | 31 ++++++++++++++-----------------
 1 file changed, 14 insertions(+), 17 deletions(-)

diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
index b84065911d69..cbe8f3009df5 100644
--- a/drivers/gpu/drm/drm_vblank.c
+++ b/drivers/gpu/drm/drm_vblank.c
@@ -481,19 +481,6 @@ int drm_vblank_init(struct drm_device *dev, unsigned int num_crtcs)
 
 	DRM_INFO("Supports vblank timestamp caching Rev 2 (21.10.2013).\n");
 
-	/* Driver specific high-precision vblank timestamping supported? */
-	if (dev->driver->get_vblank_timestamp)
-		DRM_INFO("Driver supports precise vblank timestamp query.\n");
-	else
-		DRM_INFO("No driver support for vblank timestamp query.\n");
-
-	/* Must have precise timestamping for reliable vblank instant disable */
-	if (dev->vblank_disable_immediate && !dev->driver->get_vblank_timestamp) {
-		dev->vblank_disable_immediate = false;
-		DRM_INFO("Setting vblank_disable_immediate to false because "
-			 "get_vblank_timestamp == NULL\n");
-	}
-
 	return 0;
 
 err:
@@ -1061,6 +1048,15 @@ int drm_crtc_vblank_get(struct drm_crtc *crtc)
 }
 EXPORT_SYMBOL(drm_crtc_vblank_get);
 
+static bool __vblank_disable_immediate(struct drm_device *dev, unsigned int pipe)
+{
+	if (!dev->vblank_disable_immediate)
+		return false;
+	if (!dev->driver->get_vblank_timestamp)
+		return false;
+	return true;
+}
+
 static void drm_vblank_put(struct drm_device *dev, unsigned int pipe)
 {
 	struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
@@ -1077,7 +1073,7 @@ static void drm_vblank_put(struct drm_device *dev, unsigned int pipe)
 			return;
 		else if (drm_vblank_offdelay < 0)
 			vblank_disable_fn(&vblank->disable_timer);
-		else if (!dev->vblank_disable_immediate)
+		else if (__vblank_disable_immediate(dev, pipe))
 			mod_timer(&vblank->disable_timer,
 				  jiffies + ((drm_vblank_offdelay * HZ)/1000));
 	}
@@ -1654,7 +1650,7 @@ int drm_wait_vblank_ioctl(struct drm_device *dev, void *data,
 	/* If the counter is currently enabled and accurate, short-circuit
 	 * queries to return the cached timestamp of the last vblank.
 	 */
-	if (dev->vblank_disable_immediate &&
+	if (__vblank_disable_immediate(dev, pipe) &&
 	    drm_wait_vblank_is_query(vblwait) &&
 	    READ_ONCE(vblank->enabled)) {
 		drm_wait_vblank_reply(dev, pipe, &vblwait->reply);
@@ -1811,7 +1807,7 @@ bool drm_handle_vblank(struct drm_device *dev, unsigned int pipe)
 	 * been signaled. The disable has to be last (after
 	 * drm_handle_vblank_events) so that the timestamp is always accurate.
 	 */
-	disable_irq = (dev->vblank_disable_immediate &&
+	disable_irq = (__vblank_disable_immediate(dev, pipe) &&
 		       drm_vblank_offdelay > 0 &&
 		       !atomic_read(&vblank->refcount));
 
@@ -1884,7 +1880,8 @@ int drm_crtc_get_sequence_ioctl(struct drm_device *dev, void *data,
 	pipe = drm_crtc_index(crtc);
 
 	vblank = &dev->vblank[pipe];
-	vblank_enabled = dev->vblank_disable_immediate && READ_ONCE(vblank->enabled);
+	vblank_enabled = __vblank_disable_immediate(dev, pipe) &&
+			 READ_ONCE(vblank->enabled);
 
 	if (!vblank_enabled) {
 		ret = drm_crtc_vblank_get(crtc);
-- 
2.24.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [Intel-gfx] [PATCH 10/23] drm: Evaluate struct drm_device.vblank_disable_immediate on each use
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

VBLANK interrupts can be disabled immediately or with a delay, where the
latter is the default. The former option can be selected by setting
get_vblank_timestamp, and enabling vblank_disable_immediate in struct
drm_device.

The setup is only evaluated once when DRM initializes VBLANKs. Evaluating
the settings on each use of vblank_disable_immediate will allow for easy
integration of CRTC VBLANK functions.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/drm_vblank.c | 31 ++++++++++++++-----------------
 1 file changed, 14 insertions(+), 17 deletions(-)

diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
index b84065911d69..cbe8f3009df5 100644
--- a/drivers/gpu/drm/drm_vblank.c
+++ b/drivers/gpu/drm/drm_vblank.c
@@ -481,19 +481,6 @@ int drm_vblank_init(struct drm_device *dev, unsigned int num_crtcs)
 
 	DRM_INFO("Supports vblank timestamp caching Rev 2 (21.10.2013).\n");
 
-	/* Driver specific high-precision vblank timestamping supported? */
-	if (dev->driver->get_vblank_timestamp)
-		DRM_INFO("Driver supports precise vblank timestamp query.\n");
-	else
-		DRM_INFO("No driver support for vblank timestamp query.\n");
-
-	/* Must have precise timestamping for reliable vblank instant disable */
-	if (dev->vblank_disable_immediate && !dev->driver->get_vblank_timestamp) {
-		dev->vblank_disable_immediate = false;
-		DRM_INFO("Setting vblank_disable_immediate to false because "
-			 "get_vblank_timestamp == NULL\n");
-	}
-
 	return 0;
 
 err:
@@ -1061,6 +1048,15 @@ int drm_crtc_vblank_get(struct drm_crtc *crtc)
 }
 EXPORT_SYMBOL(drm_crtc_vblank_get);
 
+static bool __vblank_disable_immediate(struct drm_device *dev, unsigned int pipe)
+{
+	if (!dev->vblank_disable_immediate)
+		return false;
+	if (!dev->driver->get_vblank_timestamp)
+		return false;
+	return true;
+}
+
 static void drm_vblank_put(struct drm_device *dev, unsigned int pipe)
 {
 	struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
@@ -1077,7 +1073,7 @@ static void drm_vblank_put(struct drm_device *dev, unsigned int pipe)
 			return;
 		else if (drm_vblank_offdelay < 0)
 			vblank_disable_fn(&vblank->disable_timer);
-		else if (!dev->vblank_disable_immediate)
+		else if (__vblank_disable_immediate(dev, pipe))
 			mod_timer(&vblank->disable_timer,
 				  jiffies + ((drm_vblank_offdelay * HZ)/1000));
 	}
@@ -1654,7 +1650,7 @@ int drm_wait_vblank_ioctl(struct drm_device *dev, void *data,
 	/* If the counter is currently enabled and accurate, short-circuit
 	 * queries to return the cached timestamp of the last vblank.
 	 */
-	if (dev->vblank_disable_immediate &&
+	if (__vblank_disable_immediate(dev, pipe) &&
 	    drm_wait_vblank_is_query(vblwait) &&
 	    READ_ONCE(vblank->enabled)) {
 		drm_wait_vblank_reply(dev, pipe, &vblwait->reply);
@@ -1811,7 +1807,7 @@ bool drm_handle_vblank(struct drm_device *dev, unsigned int pipe)
 	 * been signaled. The disable has to be last (after
 	 * drm_handle_vblank_events) so that the timestamp is always accurate.
 	 */
-	disable_irq = (dev->vblank_disable_immediate &&
+	disable_irq = (__vblank_disable_immediate(dev, pipe) &&
 		       drm_vblank_offdelay > 0 &&
 		       !atomic_read(&vblank->refcount));
 
@@ -1884,7 +1880,8 @@ int drm_crtc_get_sequence_ioctl(struct drm_device *dev, void *data,
 	pipe = drm_crtc_index(crtc);
 
 	vblank = &dev->vblank[pipe];
-	vblank_enabled = dev->vblank_disable_immediate && READ_ONCE(vblank->enabled);
+	vblank_enabled = __vblank_disable_immediate(dev, pipe) &&
+			 READ_ONCE(vblank->enabled);
 
 	if (!vblank_enabled) {
 		ret = drm_crtc_vblank_get(crtc);
-- 
2.24.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 10/23] drm: Evaluate struct drm_device.vblank_disable_immediate on each use
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

VBLANK interrupts can be disabled immediately or with a delay, where the
latter is the default. The former option can be selected by setting
get_vblank_timestamp, and enabling vblank_disable_immediate in struct
drm_device.

The setup is only evaluated once when DRM initializes VBLANKs. Evaluating
the settings on each use of vblank_disable_immediate will allow for easy
integration of CRTC VBLANK functions.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/drm_vblank.c | 31 ++++++++++++++-----------------
 1 file changed, 14 insertions(+), 17 deletions(-)

diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
index b84065911d69..cbe8f3009df5 100644
--- a/drivers/gpu/drm/drm_vblank.c
+++ b/drivers/gpu/drm/drm_vblank.c
@@ -481,19 +481,6 @@ int drm_vblank_init(struct drm_device *dev, unsigned int num_crtcs)
 
 	DRM_INFO("Supports vblank timestamp caching Rev 2 (21.10.2013).\n");
 
-	/* Driver specific high-precision vblank timestamping supported? */
-	if (dev->driver->get_vblank_timestamp)
-		DRM_INFO("Driver supports precise vblank timestamp query.\n");
-	else
-		DRM_INFO("No driver support for vblank timestamp query.\n");
-
-	/* Must have precise timestamping for reliable vblank instant disable */
-	if (dev->vblank_disable_immediate && !dev->driver->get_vblank_timestamp) {
-		dev->vblank_disable_immediate = false;
-		DRM_INFO("Setting vblank_disable_immediate to false because "
-			 "get_vblank_timestamp == NULL\n");
-	}
-
 	return 0;
 
 err:
@@ -1061,6 +1048,15 @@ int drm_crtc_vblank_get(struct drm_crtc *crtc)
 }
 EXPORT_SYMBOL(drm_crtc_vblank_get);
 
+static bool __vblank_disable_immediate(struct drm_device *dev, unsigned int pipe)
+{
+	if (!dev->vblank_disable_immediate)
+		return false;
+	if (!dev->driver->get_vblank_timestamp)
+		return false;
+	return true;
+}
+
 static void drm_vblank_put(struct drm_device *dev, unsigned int pipe)
 {
 	struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
@@ -1077,7 +1073,7 @@ static void drm_vblank_put(struct drm_device *dev, unsigned int pipe)
 			return;
 		else if (drm_vblank_offdelay < 0)
 			vblank_disable_fn(&vblank->disable_timer);
-		else if (!dev->vblank_disable_immediate)
+		else if (__vblank_disable_immediate(dev, pipe))
 			mod_timer(&vblank->disable_timer,
 				  jiffies + ((drm_vblank_offdelay * HZ)/1000));
 	}
@@ -1654,7 +1650,7 @@ int drm_wait_vblank_ioctl(struct drm_device *dev, void *data,
 	/* If the counter is currently enabled and accurate, short-circuit
 	 * queries to return the cached timestamp of the last vblank.
 	 */
-	if (dev->vblank_disable_immediate &&
+	if (__vblank_disable_immediate(dev, pipe) &&
 	    drm_wait_vblank_is_query(vblwait) &&
 	    READ_ONCE(vblank->enabled)) {
 		drm_wait_vblank_reply(dev, pipe, &vblwait->reply);
@@ -1811,7 +1807,7 @@ bool drm_handle_vblank(struct drm_device *dev, unsigned int pipe)
 	 * been signaled. The disable has to be last (after
 	 * drm_handle_vblank_events) so that the timestamp is always accurate.
 	 */
-	disable_irq = (dev->vblank_disable_immediate &&
+	disable_irq = (__vblank_disable_immediate(dev, pipe) &&
 		       drm_vblank_offdelay > 0 &&
 		       !atomic_read(&vblank->refcount));
 
@@ -1884,7 +1880,8 @@ int drm_crtc_get_sequence_ioctl(struct drm_device *dev, void *data,
 	pipe = drm_crtc_index(crtc);
 
 	vblank = &dev->vblank[pipe];
-	vblank_enabled = dev->vblank_disable_immediate && READ_ONCE(vblank->enabled);
+	vblank_enabled = __vblank_disable_immediate(dev, pipe) &&
+			 READ_ONCE(vblank->enabled);
 
 	if (!vblank_enabled) {
 		ret = drm_crtc_vblank_get(crtc);
-- 
2.24.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 11/23] drm: Add get_vblank_timestamp() to struct drm_crtc_funcs
  2020-01-10  9:21 ` Thomas Zimmermann
  (?)
  (?)
@ 2020-01-10  9:21   ` Thomas Zimmermann
  -1 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: dri-devel, amd-gfx, intel-gfx, linux-arm-msm, freedreno, nouveau,
	Thomas Zimmermann

The callback get_vblank_timestamp() is currently located in struct
drm_driver, but really belongs into struct drm_crtc_funcs. Add an
equivalent there. Driver will be converted in separate patches.

The default implementation is drm_calc_vbltimestamp_from_scanoutpos().
The patch adds drm_crtc_calc_vbltimestamp_from_scanoutpos(), which is
an implementation for the CRTC callback.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/drm_vblank.c             | 83 +++++++++++++++++++++---
 include/drm/drm_crtc.h                   | 41 ++++++++++++
 include/drm/drm_modeset_helper_vtables.h |  2 +-
 include/drm/drm_vblank.h                 |  4 ++
 4 files changed, 120 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
index cbe8f3009df5..7cf436a4b908 100644
--- a/drivers/gpu/drm/drm_vblank.c
+++ b/drivers/gpu/drm/drm_vblank.c
@@ -333,7 +333,9 @@ u64 drm_crtc_accurate_vblank_count(struct drm_crtc *crtc)
 	u64 vblank;
 	unsigned long flags;
 
-	WARN_ONCE(drm_debug_enabled(DRM_UT_VBL) && !dev->driver->get_vblank_timestamp,
+	WARN_ONCE(drm_debug_enabled(DRM_UT_VBL) &&
+		  !crtc->funcs->get_vblank_timestamp &&
+		  !dev->driver->get_vblank_timestamp,
 		  "This function requires support for accurate vblank timestamps.");
 
 	spin_lock_irqsave(&dev->vblank_time_lock, flags);
@@ -563,6 +565,50 @@ void drm_calc_timestamping_constants(struct drm_crtc *crtc,
 }
 EXPORT_SYMBOL(drm_calc_timestamping_constants);
 
+/**
+ * drm_crtc_calc_vbltimestamp_from_scanoutpos - precise vblank timestamp helper
+ * @crtc: CRTC whose vblank timestamp to retrieve
+ * @max_error: Desired maximum allowable error in timestamps (nanosecs)
+ *             On return contains true maximum error of timestamp
+ * @vblank_time: Pointer to time which should receive the timestamp
+ * @in_vblank_irq:
+ *     True when called from drm_crtc_handle_vblank().  Some drivers
+ *     need to apply some workarounds for gpu-specific vblank irq quirks
+ *     if flag is set.
+ *
+ * Implements calculation of exact vblank timestamps from given drm_display_mode
+ * timings and current video scanout position of a CRTC. This can be directly
+ * used as the &drm_crtc_funcs.get_vblank_timestamp implementation of a kms
+ * driver if &drm_crtc_helper_funcs.get_scanout_position is implemented.
+ *
+ * The current implementation only handles standard video modes. For double scan
+ * and interlaced modes the driver is supposed to adjust the hardware mode
+ * (taken from &drm_crtc_state.adjusted mode for atomic modeset drivers) to
+ * match the scanout position reported.
+ *
+ * Note that atomic drivers must call drm_calc_timestamping_constants() before
+ * enabling a CRTC. The atomic helpers already take care of that in
+ * drm_atomic_helper_update_legacy_modeset_state().
+ *
+ * Returns:
+ *
+ * Returns true on success, and false on failure, i.e. when no accurate
+ * timestamp could be acquired.
+ */
+bool drm_crtc_calc_vbltimestamp_from_scanoutpos(struct drm_crtc *crtc,
+						int *max_error,
+						ktime_t *vblank_time,
+						bool in_vblank_irq)
+{
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
+
+	return drm_calc_vbltimestamp_from_scanoutpos(dev, pipe, max_error,
+						     vblank_time,
+						     in_vblank_irq);
+}
+EXPORT_SYMBOL(drm_crtc_calc_vbltimestamp_from_scanoutpos);
+
 /**
  * drm_calc_vbltimestamp_from_scanoutpos - precise vblank timestamp helper
  * @dev: DRM device
@@ -577,8 +623,8 @@ EXPORT_SYMBOL(drm_calc_timestamping_constants);
  *
  * Implements calculation of exact vblank timestamps from given drm_display_mode
  * timings and current video scanout position of a CRTC. This can be directly
- * used as the &drm_driver.get_vblank_timestamp implementation of a kms driver
- * if &drm_crtc_helper_funcs.get_scanout_position is implemented.
+ * used as the &drm_crtc_funcs.get_vblank_timestamp implementation of a kms
+ * driver if &drm_crtc_helper_funcs.get_scanout_position is implemented.
  *
  * The current implementation only handles standard video modes. For double scan
  * and interlaced modes the driver is supposed to adjust the hardware mode
@@ -733,15 +779,22 @@ static bool
 drm_get_last_vbltimestamp(struct drm_device *dev, unsigned int pipe,
 			  ktime_t *tvblank, bool in_vblank_irq)
 {
+	struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe);
 	bool ret = false;
 
 	/* Define requested maximum error on timestamps (nanoseconds). */
 	int max_error = (int) drm_timestamp_precision * 1000;
 
 	/* Query driver if possible and precision timestamping enabled. */
-	if (dev->driver->get_vblank_timestamp && (max_error > 0))
+	if (crtc->funcs->get_vblank_timestamp && (max_error > 0)) {
+		struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe);
+
+		ret = crtc->funcs->get_vblank_timestamp(crtc, &max_error,
+							tvblank, in_vblank_irq);
+	} else if (dev->driver->get_vblank_timestamp && (max_error > 0)) {
 		ret = dev->driver->get_vblank_timestamp(dev, pipe, &max_error,
 							tvblank, in_vblank_irq);
+	}
 
 	/* GPU high precision timestamp query unsupported or failed.
 	 * Return current monotonic/gettimeofday timestamp as best estimate.
@@ -1050,11 +1103,19 @@ EXPORT_SYMBOL(drm_crtc_vblank_get);
 
 static bool __vblank_disable_immediate(struct drm_device *dev, unsigned int pipe)
 {
+	struct drm_crtc *crtc;
+
 	if (!dev->vblank_disable_immediate)
 		return false;
-	if (!dev->driver->get_vblank_timestamp)
-		return false;
-	return true;
+
+	crtc = drm_crtc_from_index(dev, pipe);
+	if (crtc && crtc->funcs->get_vblank_timestamp)
+		return true;
+
+	if (dev->driver->get_vblank_timestamp)
+		return true;
+
+	return false;
 }
 
 static void drm_vblank_put(struct drm_device *dev, unsigned int pipe)
@@ -1733,9 +1794,11 @@ int drm_wait_vblank_ioctl(struct drm_device *dev, void *data,
 
 static void drm_handle_vblank_events(struct drm_device *dev, unsigned int pipe)
 {
+	struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe);
 	struct drm_pending_vblank_event *e, *t;
 	ktime_t now;
 	u64 seq;
+	bool high_prec;
 
 	assert_spin_locked(&dev->event_lock);
 
@@ -1755,8 +1818,10 @@ static void drm_handle_vblank_events(struct drm_device *dev, unsigned int pipe)
 		send_vblank_event(dev, e, seq, now);
 	}
 
-	trace_drm_vblank_event(pipe, seq, now,
-			dev->driver->get_vblank_timestamp != NULL);
+	high_prec = crtc->funcs->get_vblank_timestamp ||
+		    dev->driver->get_vblank_timestamp;
+
+	trace_drm_vblank_event(pipe, seq, now, high_prec);
 }
 
 /**
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 5e9b15a0e8c5..2caad975f415 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -867,6 +867,47 @@ struct drm_crtc_funcs {
 	 * new drivers as the replacement of &drm_driver.disable_vblank hook.
 	 */
 	void (*disable_vblank)(struct drm_crtc *crtc);
+
+	/**
+	 * @get_vblank_timestamp:
+	 *
+	 * Called by drm_get_last_vbltimestamp(). Should return a precise
+	 * timestamp when the most recent vblank interval ended or will end.
+	 *
+	 * Specifically, the timestamp in @vblank_time should correspond as
+	 * closely as possible to the time when the first video scanline of
+	 * the video frame after the end of vblank will start scanning out,
+	 * the time immediately after end of the vblank interval. If the
+	 * @crtc is currently inside vblank, this will be a time in the future.
+	 * If the @crtc is currently scanning out a frame, this will be the
+	 * past start time of the current scanout. This is meant to adhere
+	 * to the OpenML OML_sync_control extension specification.
+	 *
+	 * Parameters:
+	 *
+	 * crtc:
+	 *     CRTC for which timestamp should be returned.
+	 * max_error:
+	 *     Maximum allowable timestamp error in nanoseconds.
+	 *     Implementation should strive to provide timestamp
+	 *     with an error of at most max_error nanoseconds.
+	 *     Returns true upper bound on error for timestamp.
+	 * vblank_time:
+	 *     Target location for returned vblank timestamp.
+	 * in_vblank_irq:
+	 *     True when called from drm_crtc_handle_vblank().  Some drivers
+	 *     need to apply some workarounds for gpu-specific vblank irq quirks
+	 *     if flag is set.
+	 *
+	 * Returns:
+	 *
+	 * True on success, false on failure, which means the core should
+	 * fallback to a simple timestamp taken in drm_crtc_handle_vblank().
+	 */
+	bool (*get_vblank_timestamp)(struct drm_crtc *crtc,
+				     int *max_error,
+				     ktime_t *vblank_time,
+				     bool in_vblank_irq);
 };
 
 /**
diff --git a/include/drm/drm_modeset_helper_vtables.h b/include/drm/drm_modeset_helper_vtables.h
index e398512bfd5f..d735f7088a10 100644
--- a/include/drm/drm_modeset_helper_vtables.h
+++ b/include/drm/drm_modeset_helper_vtables.h
@@ -460,7 +460,7 @@ struct drm_crtc_helper_funcs {
 	 * optional accurate ktime_get() timestamp of when the position was
 	 * measured. Note that this is a helper callback which is only used
 	 * if a driver uses drm_calc_vbltimestamp_from_scanoutpos() for the
-	 * @drm_driver.get_vblank_timestamp callback.
+	 * @drm_crtc_funcs.get_vblank_timestamp callback.
 	 *
 	 * Parameters:
 	 *
diff --git a/include/drm/drm_vblank.h b/include/drm/drm_vblank.h
index c16c44052b3d..cdc567c83805 100644
--- a/include/drm/drm_vblank.h
+++ b/include/drm/drm_vblank.h
@@ -233,6 +233,10 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
 					   unsigned int pipe, int *max_error,
 					   ktime_t *vblank_time,
 					   bool in_vblank_irq);
+bool drm_crtc_calc_vbltimestamp_from_scanoutpos(struct drm_crtc *crtc,
+						int *max_error,
+						ktime_t *vblank_time,
+						bool in_vblank_irq);
 void drm_calc_timestamping_constants(struct drm_crtc *crtc,
 				     const struct drm_display_mode *mode);
 wait_queue_head_t *drm_crtc_vblank_waitqueue(struct drm_crtc *crtc);
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 11/23] drm: Add get_vblank_timestamp() to struct drm_crtc_funcs
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

The callback get_vblank_timestamp() is currently located in struct
drm_driver, but really belongs into struct drm_crtc_funcs. Add an
equivalent there. Driver will be converted in separate patches.

The default implementation is drm_calc_vbltimestamp_from_scanoutpos().
The patch adds drm_crtc_calc_vbltimestamp_from_scanoutpos(), which is
an implementation for the CRTC callback.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/drm_vblank.c             | 83 +++++++++++++++++++++---
 include/drm/drm_crtc.h                   | 41 ++++++++++++
 include/drm/drm_modeset_helper_vtables.h |  2 +-
 include/drm/drm_vblank.h                 |  4 ++
 4 files changed, 120 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
index cbe8f3009df5..7cf436a4b908 100644
--- a/drivers/gpu/drm/drm_vblank.c
+++ b/drivers/gpu/drm/drm_vblank.c
@@ -333,7 +333,9 @@ u64 drm_crtc_accurate_vblank_count(struct drm_crtc *crtc)
 	u64 vblank;
 	unsigned long flags;
 
-	WARN_ONCE(drm_debug_enabled(DRM_UT_VBL) && !dev->driver->get_vblank_timestamp,
+	WARN_ONCE(drm_debug_enabled(DRM_UT_VBL) &&
+		  !crtc->funcs->get_vblank_timestamp &&
+		  !dev->driver->get_vblank_timestamp,
 		  "This function requires support for accurate vblank timestamps.");
 
 	spin_lock_irqsave(&dev->vblank_time_lock, flags);
@@ -563,6 +565,50 @@ void drm_calc_timestamping_constants(struct drm_crtc *crtc,
 }
 EXPORT_SYMBOL(drm_calc_timestamping_constants);
 
+/**
+ * drm_crtc_calc_vbltimestamp_from_scanoutpos - precise vblank timestamp helper
+ * @crtc: CRTC whose vblank timestamp to retrieve
+ * @max_error: Desired maximum allowable error in timestamps (nanosecs)
+ *             On return contains true maximum error of timestamp
+ * @vblank_time: Pointer to time which should receive the timestamp
+ * @in_vblank_irq:
+ *     True when called from drm_crtc_handle_vblank().  Some drivers
+ *     need to apply some workarounds for gpu-specific vblank irq quirks
+ *     if flag is set.
+ *
+ * Implements calculation of exact vblank timestamps from given drm_display_mode
+ * timings and current video scanout position of a CRTC. This can be directly
+ * used as the &drm_crtc_funcs.get_vblank_timestamp implementation of a kms
+ * driver if &drm_crtc_helper_funcs.get_scanout_position is implemented.
+ *
+ * The current implementation only handles standard video modes. For double scan
+ * and interlaced modes the driver is supposed to adjust the hardware mode
+ * (taken from &drm_crtc_state.adjusted mode for atomic modeset drivers) to
+ * match the scanout position reported.
+ *
+ * Note that atomic drivers must call drm_calc_timestamping_constants() before
+ * enabling a CRTC. The atomic helpers already take care of that in
+ * drm_atomic_helper_update_legacy_modeset_state().
+ *
+ * Returns:
+ *
+ * Returns true on success, and false on failure, i.e. when no accurate
+ * timestamp could be acquired.
+ */
+bool drm_crtc_calc_vbltimestamp_from_scanoutpos(struct drm_crtc *crtc,
+						int *max_error,
+						ktime_t *vblank_time,
+						bool in_vblank_irq)
+{
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
+
+	return drm_calc_vbltimestamp_from_scanoutpos(dev, pipe, max_error,
+						     vblank_time,
+						     in_vblank_irq);
+}
+EXPORT_SYMBOL(drm_crtc_calc_vbltimestamp_from_scanoutpos);
+
 /**
  * drm_calc_vbltimestamp_from_scanoutpos - precise vblank timestamp helper
  * @dev: DRM device
@@ -577,8 +623,8 @@ EXPORT_SYMBOL(drm_calc_timestamping_constants);
  *
  * Implements calculation of exact vblank timestamps from given drm_display_mode
  * timings and current video scanout position of a CRTC. This can be directly
- * used as the &drm_driver.get_vblank_timestamp implementation of a kms driver
- * if &drm_crtc_helper_funcs.get_scanout_position is implemented.
+ * used as the &drm_crtc_funcs.get_vblank_timestamp implementation of a kms
+ * driver if &drm_crtc_helper_funcs.get_scanout_position is implemented.
  *
  * The current implementation only handles standard video modes. For double scan
  * and interlaced modes the driver is supposed to adjust the hardware mode
@@ -733,15 +779,22 @@ static bool
 drm_get_last_vbltimestamp(struct drm_device *dev, unsigned int pipe,
 			  ktime_t *tvblank, bool in_vblank_irq)
 {
+	struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe);
 	bool ret = false;
 
 	/* Define requested maximum error on timestamps (nanoseconds). */
 	int max_error = (int) drm_timestamp_precision * 1000;
 
 	/* Query driver if possible and precision timestamping enabled. */
-	if (dev->driver->get_vblank_timestamp && (max_error > 0))
+	if (crtc->funcs->get_vblank_timestamp && (max_error > 0)) {
+		struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe);
+
+		ret = crtc->funcs->get_vblank_timestamp(crtc, &max_error,
+							tvblank, in_vblank_irq);
+	} else if (dev->driver->get_vblank_timestamp && (max_error > 0)) {
 		ret = dev->driver->get_vblank_timestamp(dev, pipe, &max_error,
 							tvblank, in_vblank_irq);
+	}
 
 	/* GPU high precision timestamp query unsupported or failed.
 	 * Return current monotonic/gettimeofday timestamp as best estimate.
@@ -1050,11 +1103,19 @@ EXPORT_SYMBOL(drm_crtc_vblank_get);
 
 static bool __vblank_disable_immediate(struct drm_device *dev, unsigned int pipe)
 {
+	struct drm_crtc *crtc;
+
 	if (!dev->vblank_disable_immediate)
 		return false;
-	if (!dev->driver->get_vblank_timestamp)
-		return false;
-	return true;
+
+	crtc = drm_crtc_from_index(dev, pipe);
+	if (crtc && crtc->funcs->get_vblank_timestamp)
+		return true;
+
+	if (dev->driver->get_vblank_timestamp)
+		return true;
+
+	return false;
 }
 
 static void drm_vblank_put(struct drm_device *dev, unsigned int pipe)
@@ -1733,9 +1794,11 @@ int drm_wait_vblank_ioctl(struct drm_device *dev, void *data,
 
 static void drm_handle_vblank_events(struct drm_device *dev, unsigned int pipe)
 {
+	struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe);
 	struct drm_pending_vblank_event *e, *t;
 	ktime_t now;
 	u64 seq;
+	bool high_prec;
 
 	assert_spin_locked(&dev->event_lock);
 
@@ -1755,8 +1818,10 @@ static void drm_handle_vblank_events(struct drm_device *dev, unsigned int pipe)
 		send_vblank_event(dev, e, seq, now);
 	}
 
-	trace_drm_vblank_event(pipe, seq, now,
-			dev->driver->get_vblank_timestamp != NULL);
+	high_prec = crtc->funcs->get_vblank_timestamp ||
+		    dev->driver->get_vblank_timestamp;
+
+	trace_drm_vblank_event(pipe, seq, now, high_prec);
 }
 
 /**
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 5e9b15a0e8c5..2caad975f415 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -867,6 +867,47 @@ struct drm_crtc_funcs {
 	 * new drivers as the replacement of &drm_driver.disable_vblank hook.
 	 */
 	void (*disable_vblank)(struct drm_crtc *crtc);
+
+	/**
+	 * @get_vblank_timestamp:
+	 *
+	 * Called by drm_get_last_vbltimestamp(). Should return a precise
+	 * timestamp when the most recent vblank interval ended or will end.
+	 *
+	 * Specifically, the timestamp in @vblank_time should correspond as
+	 * closely as possible to the time when the first video scanline of
+	 * the video frame after the end of vblank will start scanning out,
+	 * the time immediately after end of the vblank interval. If the
+	 * @crtc is currently inside vblank, this will be a time in the future.
+	 * If the @crtc is currently scanning out a frame, this will be the
+	 * past start time of the current scanout. This is meant to adhere
+	 * to the OpenML OML_sync_control extension specification.
+	 *
+	 * Parameters:
+	 *
+	 * crtc:
+	 *     CRTC for which timestamp should be returned.
+	 * max_error:
+	 *     Maximum allowable timestamp error in nanoseconds.
+	 *     Implementation should strive to provide timestamp
+	 *     with an error of at most max_error nanoseconds.
+	 *     Returns true upper bound on error for timestamp.
+	 * vblank_time:
+	 *     Target location for returned vblank timestamp.
+	 * in_vblank_irq:
+	 *     True when called from drm_crtc_handle_vblank().  Some drivers
+	 *     need to apply some workarounds for gpu-specific vblank irq quirks
+	 *     if flag is set.
+	 *
+	 * Returns:
+	 *
+	 * True on success, false on failure, which means the core should
+	 * fallback to a simple timestamp taken in drm_crtc_handle_vblank().
+	 */
+	bool (*get_vblank_timestamp)(struct drm_crtc *crtc,
+				     int *max_error,
+				     ktime_t *vblank_time,
+				     bool in_vblank_irq);
 };
 
 /**
diff --git a/include/drm/drm_modeset_helper_vtables.h b/include/drm/drm_modeset_helper_vtables.h
index e398512bfd5f..d735f7088a10 100644
--- a/include/drm/drm_modeset_helper_vtables.h
+++ b/include/drm/drm_modeset_helper_vtables.h
@@ -460,7 +460,7 @@ struct drm_crtc_helper_funcs {
 	 * optional accurate ktime_get() timestamp of when the position was
 	 * measured. Note that this is a helper callback which is only used
 	 * if a driver uses drm_calc_vbltimestamp_from_scanoutpos() for the
-	 * @drm_driver.get_vblank_timestamp callback.
+	 * @drm_crtc_funcs.get_vblank_timestamp callback.
 	 *
 	 * Parameters:
 	 *
diff --git a/include/drm/drm_vblank.h b/include/drm/drm_vblank.h
index c16c44052b3d..cdc567c83805 100644
--- a/include/drm/drm_vblank.h
+++ b/include/drm/drm_vblank.h
@@ -233,6 +233,10 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
 					   unsigned int pipe, int *max_error,
 					   ktime_t *vblank_time,
 					   bool in_vblank_irq);
+bool drm_crtc_calc_vbltimestamp_from_scanoutpos(struct drm_crtc *crtc,
+						int *max_error,
+						ktime_t *vblank_time,
+						bool in_vblank_irq);
 void drm_calc_timestamping_constants(struct drm_crtc *crtc,
 				     const struct drm_display_mode *mode);
 wait_queue_head_t *drm_crtc_vblank_waitqueue(struct drm_crtc *crtc);
-- 
2.24.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [Intel-gfx] [PATCH 11/23] drm: Add get_vblank_timestamp() to struct drm_crtc_funcs
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

The callback get_vblank_timestamp() is currently located in struct
drm_driver, but really belongs into struct drm_crtc_funcs. Add an
equivalent there. Driver will be converted in separate patches.

The default implementation is drm_calc_vbltimestamp_from_scanoutpos().
The patch adds drm_crtc_calc_vbltimestamp_from_scanoutpos(), which is
an implementation for the CRTC callback.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/drm_vblank.c             | 83 +++++++++++++++++++++---
 include/drm/drm_crtc.h                   | 41 ++++++++++++
 include/drm/drm_modeset_helper_vtables.h |  2 +-
 include/drm/drm_vblank.h                 |  4 ++
 4 files changed, 120 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
index cbe8f3009df5..7cf436a4b908 100644
--- a/drivers/gpu/drm/drm_vblank.c
+++ b/drivers/gpu/drm/drm_vblank.c
@@ -333,7 +333,9 @@ u64 drm_crtc_accurate_vblank_count(struct drm_crtc *crtc)
 	u64 vblank;
 	unsigned long flags;
 
-	WARN_ONCE(drm_debug_enabled(DRM_UT_VBL) && !dev->driver->get_vblank_timestamp,
+	WARN_ONCE(drm_debug_enabled(DRM_UT_VBL) &&
+		  !crtc->funcs->get_vblank_timestamp &&
+		  !dev->driver->get_vblank_timestamp,
 		  "This function requires support for accurate vblank timestamps.");
 
 	spin_lock_irqsave(&dev->vblank_time_lock, flags);
@@ -563,6 +565,50 @@ void drm_calc_timestamping_constants(struct drm_crtc *crtc,
 }
 EXPORT_SYMBOL(drm_calc_timestamping_constants);
 
+/**
+ * drm_crtc_calc_vbltimestamp_from_scanoutpos - precise vblank timestamp helper
+ * @crtc: CRTC whose vblank timestamp to retrieve
+ * @max_error: Desired maximum allowable error in timestamps (nanosecs)
+ *             On return contains true maximum error of timestamp
+ * @vblank_time: Pointer to time which should receive the timestamp
+ * @in_vblank_irq:
+ *     True when called from drm_crtc_handle_vblank().  Some drivers
+ *     need to apply some workarounds for gpu-specific vblank irq quirks
+ *     if flag is set.
+ *
+ * Implements calculation of exact vblank timestamps from given drm_display_mode
+ * timings and current video scanout position of a CRTC. This can be directly
+ * used as the &drm_crtc_funcs.get_vblank_timestamp implementation of a kms
+ * driver if &drm_crtc_helper_funcs.get_scanout_position is implemented.
+ *
+ * The current implementation only handles standard video modes. For double scan
+ * and interlaced modes the driver is supposed to adjust the hardware mode
+ * (taken from &drm_crtc_state.adjusted mode for atomic modeset drivers) to
+ * match the scanout position reported.
+ *
+ * Note that atomic drivers must call drm_calc_timestamping_constants() before
+ * enabling a CRTC. The atomic helpers already take care of that in
+ * drm_atomic_helper_update_legacy_modeset_state().
+ *
+ * Returns:
+ *
+ * Returns true on success, and false on failure, i.e. when no accurate
+ * timestamp could be acquired.
+ */
+bool drm_crtc_calc_vbltimestamp_from_scanoutpos(struct drm_crtc *crtc,
+						int *max_error,
+						ktime_t *vblank_time,
+						bool in_vblank_irq)
+{
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
+
+	return drm_calc_vbltimestamp_from_scanoutpos(dev, pipe, max_error,
+						     vblank_time,
+						     in_vblank_irq);
+}
+EXPORT_SYMBOL(drm_crtc_calc_vbltimestamp_from_scanoutpos);
+
 /**
  * drm_calc_vbltimestamp_from_scanoutpos - precise vblank timestamp helper
  * @dev: DRM device
@@ -577,8 +623,8 @@ EXPORT_SYMBOL(drm_calc_timestamping_constants);
  *
  * Implements calculation of exact vblank timestamps from given drm_display_mode
  * timings and current video scanout position of a CRTC. This can be directly
- * used as the &drm_driver.get_vblank_timestamp implementation of a kms driver
- * if &drm_crtc_helper_funcs.get_scanout_position is implemented.
+ * used as the &drm_crtc_funcs.get_vblank_timestamp implementation of a kms
+ * driver if &drm_crtc_helper_funcs.get_scanout_position is implemented.
  *
  * The current implementation only handles standard video modes. For double scan
  * and interlaced modes the driver is supposed to adjust the hardware mode
@@ -733,15 +779,22 @@ static bool
 drm_get_last_vbltimestamp(struct drm_device *dev, unsigned int pipe,
 			  ktime_t *tvblank, bool in_vblank_irq)
 {
+	struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe);
 	bool ret = false;
 
 	/* Define requested maximum error on timestamps (nanoseconds). */
 	int max_error = (int) drm_timestamp_precision * 1000;
 
 	/* Query driver if possible and precision timestamping enabled. */
-	if (dev->driver->get_vblank_timestamp && (max_error > 0))
+	if (crtc->funcs->get_vblank_timestamp && (max_error > 0)) {
+		struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe);
+
+		ret = crtc->funcs->get_vblank_timestamp(crtc, &max_error,
+							tvblank, in_vblank_irq);
+	} else if (dev->driver->get_vblank_timestamp && (max_error > 0)) {
 		ret = dev->driver->get_vblank_timestamp(dev, pipe, &max_error,
 							tvblank, in_vblank_irq);
+	}
 
 	/* GPU high precision timestamp query unsupported or failed.
 	 * Return current monotonic/gettimeofday timestamp as best estimate.
@@ -1050,11 +1103,19 @@ EXPORT_SYMBOL(drm_crtc_vblank_get);
 
 static bool __vblank_disable_immediate(struct drm_device *dev, unsigned int pipe)
 {
+	struct drm_crtc *crtc;
+
 	if (!dev->vblank_disable_immediate)
 		return false;
-	if (!dev->driver->get_vblank_timestamp)
-		return false;
-	return true;
+
+	crtc = drm_crtc_from_index(dev, pipe);
+	if (crtc && crtc->funcs->get_vblank_timestamp)
+		return true;
+
+	if (dev->driver->get_vblank_timestamp)
+		return true;
+
+	return false;
 }
 
 static void drm_vblank_put(struct drm_device *dev, unsigned int pipe)
@@ -1733,9 +1794,11 @@ int drm_wait_vblank_ioctl(struct drm_device *dev, void *data,
 
 static void drm_handle_vblank_events(struct drm_device *dev, unsigned int pipe)
 {
+	struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe);
 	struct drm_pending_vblank_event *e, *t;
 	ktime_t now;
 	u64 seq;
+	bool high_prec;
 
 	assert_spin_locked(&dev->event_lock);
 
@@ -1755,8 +1818,10 @@ static void drm_handle_vblank_events(struct drm_device *dev, unsigned int pipe)
 		send_vblank_event(dev, e, seq, now);
 	}
 
-	trace_drm_vblank_event(pipe, seq, now,
-			dev->driver->get_vblank_timestamp != NULL);
+	high_prec = crtc->funcs->get_vblank_timestamp ||
+		    dev->driver->get_vblank_timestamp;
+
+	trace_drm_vblank_event(pipe, seq, now, high_prec);
 }
 
 /**
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 5e9b15a0e8c5..2caad975f415 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -867,6 +867,47 @@ struct drm_crtc_funcs {
 	 * new drivers as the replacement of &drm_driver.disable_vblank hook.
 	 */
 	void (*disable_vblank)(struct drm_crtc *crtc);
+
+	/**
+	 * @get_vblank_timestamp:
+	 *
+	 * Called by drm_get_last_vbltimestamp(). Should return a precise
+	 * timestamp when the most recent vblank interval ended or will end.
+	 *
+	 * Specifically, the timestamp in @vblank_time should correspond as
+	 * closely as possible to the time when the first video scanline of
+	 * the video frame after the end of vblank will start scanning out,
+	 * the time immediately after end of the vblank interval. If the
+	 * @crtc is currently inside vblank, this will be a time in the future.
+	 * If the @crtc is currently scanning out a frame, this will be the
+	 * past start time of the current scanout. This is meant to adhere
+	 * to the OpenML OML_sync_control extension specification.
+	 *
+	 * Parameters:
+	 *
+	 * crtc:
+	 *     CRTC for which timestamp should be returned.
+	 * max_error:
+	 *     Maximum allowable timestamp error in nanoseconds.
+	 *     Implementation should strive to provide timestamp
+	 *     with an error of at most max_error nanoseconds.
+	 *     Returns true upper bound on error for timestamp.
+	 * vblank_time:
+	 *     Target location for returned vblank timestamp.
+	 * in_vblank_irq:
+	 *     True when called from drm_crtc_handle_vblank().  Some drivers
+	 *     need to apply some workarounds for gpu-specific vblank irq quirks
+	 *     if flag is set.
+	 *
+	 * Returns:
+	 *
+	 * True on success, false on failure, which means the core should
+	 * fallback to a simple timestamp taken in drm_crtc_handle_vblank().
+	 */
+	bool (*get_vblank_timestamp)(struct drm_crtc *crtc,
+				     int *max_error,
+				     ktime_t *vblank_time,
+				     bool in_vblank_irq);
 };
 
 /**
diff --git a/include/drm/drm_modeset_helper_vtables.h b/include/drm/drm_modeset_helper_vtables.h
index e398512bfd5f..d735f7088a10 100644
--- a/include/drm/drm_modeset_helper_vtables.h
+++ b/include/drm/drm_modeset_helper_vtables.h
@@ -460,7 +460,7 @@ struct drm_crtc_helper_funcs {
 	 * optional accurate ktime_get() timestamp of when the position was
 	 * measured. Note that this is a helper callback which is only used
 	 * if a driver uses drm_calc_vbltimestamp_from_scanoutpos() for the
-	 * @drm_driver.get_vblank_timestamp callback.
+	 * @drm_crtc_funcs.get_vblank_timestamp callback.
 	 *
 	 * Parameters:
 	 *
diff --git a/include/drm/drm_vblank.h b/include/drm/drm_vblank.h
index c16c44052b3d..cdc567c83805 100644
--- a/include/drm/drm_vblank.h
+++ b/include/drm/drm_vblank.h
@@ -233,6 +233,10 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
 					   unsigned int pipe, int *max_error,
 					   ktime_t *vblank_time,
 					   bool in_vblank_irq);
+bool drm_crtc_calc_vbltimestamp_from_scanoutpos(struct drm_crtc *crtc,
+						int *max_error,
+						ktime_t *vblank_time,
+						bool in_vblank_irq);
 void drm_calc_timestamping_constants(struct drm_crtc *crtc,
 				     const struct drm_display_mode *mode);
 wait_queue_head_t *drm_crtc_vblank_waitqueue(struct drm_crtc *crtc);
-- 
2.24.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 11/23] drm: Add get_vblank_timestamp() to struct drm_crtc_funcs
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

The callback get_vblank_timestamp() is currently located in struct
drm_driver, but really belongs into struct drm_crtc_funcs. Add an
equivalent there. Driver will be converted in separate patches.

The default implementation is drm_calc_vbltimestamp_from_scanoutpos().
The patch adds drm_crtc_calc_vbltimestamp_from_scanoutpos(), which is
an implementation for the CRTC callback.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/drm_vblank.c             | 83 +++++++++++++++++++++---
 include/drm/drm_crtc.h                   | 41 ++++++++++++
 include/drm/drm_modeset_helper_vtables.h |  2 +-
 include/drm/drm_vblank.h                 |  4 ++
 4 files changed, 120 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
index cbe8f3009df5..7cf436a4b908 100644
--- a/drivers/gpu/drm/drm_vblank.c
+++ b/drivers/gpu/drm/drm_vblank.c
@@ -333,7 +333,9 @@ u64 drm_crtc_accurate_vblank_count(struct drm_crtc *crtc)
 	u64 vblank;
 	unsigned long flags;
 
-	WARN_ONCE(drm_debug_enabled(DRM_UT_VBL) && !dev->driver->get_vblank_timestamp,
+	WARN_ONCE(drm_debug_enabled(DRM_UT_VBL) &&
+		  !crtc->funcs->get_vblank_timestamp &&
+		  !dev->driver->get_vblank_timestamp,
 		  "This function requires support for accurate vblank timestamps.");
 
 	spin_lock_irqsave(&dev->vblank_time_lock, flags);
@@ -563,6 +565,50 @@ void drm_calc_timestamping_constants(struct drm_crtc *crtc,
 }
 EXPORT_SYMBOL(drm_calc_timestamping_constants);
 
+/**
+ * drm_crtc_calc_vbltimestamp_from_scanoutpos - precise vblank timestamp helper
+ * @crtc: CRTC whose vblank timestamp to retrieve
+ * @max_error: Desired maximum allowable error in timestamps (nanosecs)
+ *             On return contains true maximum error of timestamp
+ * @vblank_time: Pointer to time which should receive the timestamp
+ * @in_vblank_irq:
+ *     True when called from drm_crtc_handle_vblank().  Some drivers
+ *     need to apply some workarounds for gpu-specific vblank irq quirks
+ *     if flag is set.
+ *
+ * Implements calculation of exact vblank timestamps from given drm_display_mode
+ * timings and current video scanout position of a CRTC. This can be directly
+ * used as the &drm_crtc_funcs.get_vblank_timestamp implementation of a kms
+ * driver if &drm_crtc_helper_funcs.get_scanout_position is implemented.
+ *
+ * The current implementation only handles standard video modes. For double scan
+ * and interlaced modes the driver is supposed to adjust the hardware mode
+ * (taken from &drm_crtc_state.adjusted mode for atomic modeset drivers) to
+ * match the scanout position reported.
+ *
+ * Note that atomic drivers must call drm_calc_timestamping_constants() before
+ * enabling a CRTC. The atomic helpers already take care of that in
+ * drm_atomic_helper_update_legacy_modeset_state().
+ *
+ * Returns:
+ *
+ * Returns true on success, and false on failure, i.e. when no accurate
+ * timestamp could be acquired.
+ */
+bool drm_crtc_calc_vbltimestamp_from_scanoutpos(struct drm_crtc *crtc,
+						int *max_error,
+						ktime_t *vblank_time,
+						bool in_vblank_irq)
+{
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
+
+	return drm_calc_vbltimestamp_from_scanoutpos(dev, pipe, max_error,
+						     vblank_time,
+						     in_vblank_irq);
+}
+EXPORT_SYMBOL(drm_crtc_calc_vbltimestamp_from_scanoutpos);
+
 /**
  * drm_calc_vbltimestamp_from_scanoutpos - precise vblank timestamp helper
  * @dev: DRM device
@@ -577,8 +623,8 @@ EXPORT_SYMBOL(drm_calc_timestamping_constants);
  *
  * Implements calculation of exact vblank timestamps from given drm_display_mode
  * timings and current video scanout position of a CRTC. This can be directly
- * used as the &drm_driver.get_vblank_timestamp implementation of a kms driver
- * if &drm_crtc_helper_funcs.get_scanout_position is implemented.
+ * used as the &drm_crtc_funcs.get_vblank_timestamp implementation of a kms
+ * driver if &drm_crtc_helper_funcs.get_scanout_position is implemented.
  *
  * The current implementation only handles standard video modes. For double scan
  * and interlaced modes the driver is supposed to adjust the hardware mode
@@ -733,15 +779,22 @@ static bool
 drm_get_last_vbltimestamp(struct drm_device *dev, unsigned int pipe,
 			  ktime_t *tvblank, bool in_vblank_irq)
 {
+	struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe);
 	bool ret = false;
 
 	/* Define requested maximum error on timestamps (nanoseconds). */
 	int max_error = (int) drm_timestamp_precision * 1000;
 
 	/* Query driver if possible and precision timestamping enabled. */
-	if (dev->driver->get_vblank_timestamp && (max_error > 0))
+	if (crtc->funcs->get_vblank_timestamp && (max_error > 0)) {
+		struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe);
+
+		ret = crtc->funcs->get_vblank_timestamp(crtc, &max_error,
+							tvblank, in_vblank_irq);
+	} else if (dev->driver->get_vblank_timestamp && (max_error > 0)) {
 		ret = dev->driver->get_vblank_timestamp(dev, pipe, &max_error,
 							tvblank, in_vblank_irq);
+	}
 
 	/* GPU high precision timestamp query unsupported or failed.
 	 * Return current monotonic/gettimeofday timestamp as best estimate.
@@ -1050,11 +1103,19 @@ EXPORT_SYMBOL(drm_crtc_vblank_get);
 
 static bool __vblank_disable_immediate(struct drm_device *dev, unsigned int pipe)
 {
+	struct drm_crtc *crtc;
+
 	if (!dev->vblank_disable_immediate)
 		return false;
-	if (!dev->driver->get_vblank_timestamp)
-		return false;
-	return true;
+
+	crtc = drm_crtc_from_index(dev, pipe);
+	if (crtc && crtc->funcs->get_vblank_timestamp)
+		return true;
+
+	if (dev->driver->get_vblank_timestamp)
+		return true;
+
+	return false;
 }
 
 static void drm_vblank_put(struct drm_device *dev, unsigned int pipe)
@@ -1733,9 +1794,11 @@ int drm_wait_vblank_ioctl(struct drm_device *dev, void *data,
 
 static void drm_handle_vblank_events(struct drm_device *dev, unsigned int pipe)
 {
+	struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe);
 	struct drm_pending_vblank_event *e, *t;
 	ktime_t now;
 	u64 seq;
+	bool high_prec;
 
 	assert_spin_locked(&dev->event_lock);
 
@@ -1755,8 +1818,10 @@ static void drm_handle_vblank_events(struct drm_device *dev, unsigned int pipe)
 		send_vblank_event(dev, e, seq, now);
 	}
 
-	trace_drm_vblank_event(pipe, seq, now,
-			dev->driver->get_vblank_timestamp != NULL);
+	high_prec = crtc->funcs->get_vblank_timestamp ||
+		    dev->driver->get_vblank_timestamp;
+
+	trace_drm_vblank_event(pipe, seq, now, high_prec);
 }
 
 /**
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 5e9b15a0e8c5..2caad975f415 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -867,6 +867,47 @@ struct drm_crtc_funcs {
 	 * new drivers as the replacement of &drm_driver.disable_vblank hook.
 	 */
 	void (*disable_vblank)(struct drm_crtc *crtc);
+
+	/**
+	 * @get_vblank_timestamp:
+	 *
+	 * Called by drm_get_last_vbltimestamp(). Should return a precise
+	 * timestamp when the most recent vblank interval ended or will end.
+	 *
+	 * Specifically, the timestamp in @vblank_time should correspond as
+	 * closely as possible to the time when the first video scanline of
+	 * the video frame after the end of vblank will start scanning out,
+	 * the time immediately after end of the vblank interval. If the
+	 * @crtc is currently inside vblank, this will be a time in the future.
+	 * If the @crtc is currently scanning out a frame, this will be the
+	 * past start time of the current scanout. This is meant to adhere
+	 * to the OpenML OML_sync_control extension specification.
+	 *
+	 * Parameters:
+	 *
+	 * crtc:
+	 *     CRTC for which timestamp should be returned.
+	 * max_error:
+	 *     Maximum allowable timestamp error in nanoseconds.
+	 *     Implementation should strive to provide timestamp
+	 *     with an error of at most max_error nanoseconds.
+	 *     Returns true upper bound on error for timestamp.
+	 * vblank_time:
+	 *     Target location for returned vblank timestamp.
+	 * in_vblank_irq:
+	 *     True when called from drm_crtc_handle_vblank().  Some drivers
+	 *     need to apply some workarounds for gpu-specific vblank irq quirks
+	 *     if flag is set.
+	 *
+	 * Returns:
+	 *
+	 * True on success, false on failure, which means the core should
+	 * fallback to a simple timestamp taken in drm_crtc_handle_vblank().
+	 */
+	bool (*get_vblank_timestamp)(struct drm_crtc *crtc,
+				     int *max_error,
+				     ktime_t *vblank_time,
+				     bool in_vblank_irq);
 };
 
 /**
diff --git a/include/drm/drm_modeset_helper_vtables.h b/include/drm/drm_modeset_helper_vtables.h
index e398512bfd5f..d735f7088a10 100644
--- a/include/drm/drm_modeset_helper_vtables.h
+++ b/include/drm/drm_modeset_helper_vtables.h
@@ -460,7 +460,7 @@ struct drm_crtc_helper_funcs {
 	 * optional accurate ktime_get() timestamp of when the position was
 	 * measured. Note that this is a helper callback which is only used
 	 * if a driver uses drm_calc_vbltimestamp_from_scanoutpos() for the
-	 * @drm_driver.get_vblank_timestamp callback.
+	 * @drm_crtc_funcs.get_vblank_timestamp callback.
 	 *
 	 * Parameters:
 	 *
diff --git a/include/drm/drm_vblank.h b/include/drm/drm_vblank.h
index c16c44052b3d..cdc567c83805 100644
--- a/include/drm/drm_vblank.h
+++ b/include/drm/drm_vblank.h
@@ -233,6 +233,10 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
 					   unsigned int pipe, int *max_error,
 					   ktime_t *vblank_time,
 					   bool in_vblank_irq);
+bool drm_crtc_calc_vbltimestamp_from_scanoutpos(struct drm_crtc *crtc,
+						int *max_error,
+						ktime_t *vblank_time,
+						bool in_vblank_irq);
 void drm_calc_timestamping_constants(struct drm_crtc *crtc,
 				     const struct drm_display_mode *mode);
 wait_queue_head_t *drm_crtc_vblank_waitqueue(struct drm_crtc *crtc);
-- 
2.24.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 12/23] drm/amdgpu: Convert to CRTC VBLANK callbacks
  2020-01-10  9:21 ` Thomas Zimmermann
                     ` (2 preceding siblings ...)
  (?)
@ 2020-01-10  9:21   ` Thomas Zimmermann
  -1 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: dri-devel, amd-gfx, intel-gfx, linux-arm-msm, freedreno, nouveau,
	Thomas Zimmermann

VBLANK callbacks in struct drm_driver are deprecated in favor of
their equivalents in struct drm_crtc_funcs. Convert amdgpu over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h           |  3 +++
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c       |  4 ----
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c       | 24 +++++++++++++++++++
 drivers/gpu/drm/amd/amdgpu/dce_v10_0.c        |  4 ++++
 drivers/gpu/drm/amd/amdgpu/dce_v11_0.c        |  4 ++++
 drivers/gpu/drm/amd/amdgpu/dce_v6_0.c         |  4 ++++
 drivers/gpu/drm/amd/amdgpu/dce_v8_0.c         |  4 ++++
 drivers/gpu/drm/amd/amdgpu/dce_virtual.c      |  4 ++++
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  2 ++
 9 files changed, 49 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
index 81a531b652aa..c1262ab588c9 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -1197,6 +1197,9 @@ int amdgpu_device_resume(struct drm_device *dev, bool fbcon);
 u32 amdgpu_get_vblank_counter_kms(struct drm_device *dev, unsigned int pipe);
 int amdgpu_enable_vblank_kms(struct drm_device *dev, unsigned int pipe);
 void amdgpu_disable_vblank_kms(struct drm_device *dev, unsigned int pipe);
+u32 amdgpu_crtc_get_vblank_counter(struct drm_crtc *crtc);
+int amdgpu_crtc_enable_vblank(struct drm_crtc *crtc);
+void amdgpu_crtc_disable_vblank(struct drm_crtc *crtc);
 long amdgpu_kms_compat_ioctl(struct file *filp, unsigned int cmd,
 			     unsigned long arg);
 
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index 0749285dd1c7..9baa1ddf8693 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -1377,10 +1377,6 @@ static struct drm_driver kms_driver = {
 	.postclose = amdgpu_driver_postclose_kms,
 	.lastclose = amdgpu_driver_lastclose_kms,
 	.unload = amdgpu_driver_unload_kms,
-	.get_vblank_counter = amdgpu_get_vblank_counter_kms,
-	.enable_vblank = amdgpu_enable_vblank_kms,
-	.disable_vblank = amdgpu_disable_vblank_kms,
-	.get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
 	.irq_handler = amdgpu_irq_handler,
 	.ioctls = amdgpu_ioctls_kms,
 	.gem_free_object_unlocked = amdgpu_gem_object_free,
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
index 60591dbc2097..efe4671fb032 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
@@ -1174,6 +1174,14 @@ u32 amdgpu_get_vblank_counter_kms(struct drm_device *dev, unsigned int pipe)
 	return count;
 }
 
+u32 amdgpu_crtc_get_vblank_counter(struct drm_crtc *crtc)
+{
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
+
+	return amdgpu_get_vblank_counter_kms(dev, pipe);
+}
+
 /**
  * amdgpu_enable_vblank_kms - enable vblank interrupt
  *
@@ -1191,6 +1199,14 @@ int amdgpu_enable_vblank_kms(struct drm_device *dev, unsigned int pipe)
 	return amdgpu_irq_get(adev, &adev->crtc_irq, idx);
 }
 
+int amdgpu_crtc_enable_vblank(struct drm_crtc *crtc)
+{
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
+
+	return amdgpu_enable_vblank_kms(dev, pipe);
+}
+
 /**
  * amdgpu_disable_vblank_kms - disable vblank interrupt
  *
@@ -1207,6 +1223,14 @@ void amdgpu_disable_vblank_kms(struct drm_device *dev, unsigned int pipe)
 	amdgpu_irq_put(adev, &adev->crtc_irq, idx);
 }
 
+void amdgpu_crtc_disable_vblank(struct drm_crtc *crtc)
+{
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
+
+	amdgpu_disable_vblank_kms(dev, pipe);
+}
+
 const struct drm_ioctl_desc amdgpu_ioctls_kms[] = {
 	DRM_IOCTL_DEF_DRV(AMDGPU_GEM_CREATE, amdgpu_gem_create_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
 	DRM_IOCTL_DEF_DRV(AMDGPU_CTX, amdgpu_ctx_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
index bdc1e0f036d4..8e62f46f0bfd 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
@@ -2494,6 +2494,10 @@ static const struct drm_crtc_funcs dce_v10_0_crtc_funcs = {
 	.set_config = amdgpu_display_crtc_set_config,
 	.destroy = dce_v10_0_crtc_destroy,
 	.page_flip_target = amdgpu_display_crtc_page_flip_target,
+	.get_vblank_counter = amdgpu_crtc_get_vblank_counter,
+	.enable_vblank = amdgpu_crtc_enable_vblank,
+	.disable_vblank = amdgpu_crtc_disable_vblank,
+	.get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
 };
 
 static void dce_v10_0_crtc_dpms(struct drm_crtc *crtc, int mode)
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
index 0319da5f7bf9..9e37e4a78403 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
@@ -2573,6 +2573,10 @@ static const struct drm_crtc_funcs dce_v11_0_crtc_funcs = {
 	.set_config = amdgpu_display_crtc_set_config,
 	.destroy = dce_v11_0_crtc_destroy,
 	.page_flip_target = amdgpu_display_crtc_page_flip_target,
+	.get_vblank_counter = amdgpu_crtc_get_vblank_counter,
+	.enable_vblank = amdgpu_crtc_enable_vblank,
+	.disable_vblank = amdgpu_crtc_disable_vblank,
+	.get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
 };
 
 static void dce_v11_0_crtc_dpms(struct drm_crtc *crtc, int mode)
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
index 78642c3b14fc..2d4c99d3b352 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
@@ -2388,6 +2388,10 @@ static const struct drm_crtc_funcs dce_v6_0_crtc_funcs = {
 	.set_config = amdgpu_display_crtc_set_config,
 	.destroy = dce_v6_0_crtc_destroy,
 	.page_flip_target = amdgpu_display_crtc_page_flip_target,
+	.get_vblank_counter = amdgpu_crtc_get_vblank_counter,
+	.enable_vblank = amdgpu_crtc_enable_vblank,
+	.disable_vblank = amdgpu_crtc_disable_vblank,
+	.get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
 };
 
 static void dce_v6_0_crtc_dpms(struct drm_crtc *crtc, int mode)
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
index 1e8d4975435a..cd51fd155349 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
@@ -2395,6 +2395,10 @@ static const struct drm_crtc_funcs dce_v8_0_crtc_funcs = {
 	.set_config = amdgpu_display_crtc_set_config,
 	.destroy = dce_v8_0_crtc_destroy,
 	.page_flip_target = amdgpu_display_crtc_page_flip_target,
+	.get_vblank_counter = amdgpu_crtc_get_vblank_counter,
+	.enable_vblank = amdgpu_crtc_enable_vblank,
+	.disable_vblank = amdgpu_crtc_disable_vblank,
+	.get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
 };
 
 static void dce_v8_0_crtc_dpms(struct drm_crtc *crtc, int mode)
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
index 4b2f915aba47..53c260deb384 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
@@ -123,6 +123,10 @@ static const struct drm_crtc_funcs dce_virtual_crtc_funcs = {
 	.set_config = amdgpu_display_crtc_set_config,
 	.destroy = dce_virtual_crtc_destroy,
 	.page_flip_target = amdgpu_display_crtc_page_flip_target,
+	.get_vblank_counter = amdgpu_crtc_get_vblank_counter,
+	.enable_vblank = amdgpu_crtc_enable_vblank,
+	.disable_vblank = amdgpu_crtc_disable_vblank,
+	.get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
 };
 
 static void dce_virtual_crtc_dpms(struct drm_crtc *crtc, int mode)
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 39c5cf242c1b..0c51c4dd8c46 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -4214,8 +4214,10 @@ static const struct drm_crtc_funcs amdgpu_dm_crtc_funcs = {
 	.set_crc_source = amdgpu_dm_crtc_set_crc_source,
 	.verify_crc_source = amdgpu_dm_crtc_verify_crc_source,
 	.get_crc_sources = amdgpu_dm_crtc_get_crc_sources,
+	.get_vblank_counter = amdgpu_crtc_get_vblank_counter,
 	.enable_vblank = dm_enable_vblank,
 	.disable_vblank = dm_disable_vblank,
+	.get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
 };
 
 static enum drm_connector_status
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 12/23] drm/amdgpu: Convert to CRTC VBLANK callbacks
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

VBLANK callbacks in struct drm_driver are deprecated in favor of
their equivalents in struct drm_crtc_funcs. Convert amdgpu over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h           |  3 +++
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c       |  4 ----
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c       | 24 +++++++++++++++++++
 drivers/gpu/drm/amd/amdgpu/dce_v10_0.c        |  4 ++++
 drivers/gpu/drm/amd/amdgpu/dce_v11_0.c        |  4 ++++
 drivers/gpu/drm/amd/amdgpu/dce_v6_0.c         |  4 ++++
 drivers/gpu/drm/amd/amdgpu/dce_v8_0.c         |  4 ++++
 drivers/gpu/drm/amd/amdgpu/dce_virtual.c      |  4 ++++
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  2 ++
 9 files changed, 49 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
index 81a531b652aa..c1262ab588c9 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -1197,6 +1197,9 @@ int amdgpu_device_resume(struct drm_device *dev, bool fbcon);
 u32 amdgpu_get_vblank_counter_kms(struct drm_device *dev, unsigned int pipe);
 int amdgpu_enable_vblank_kms(struct drm_device *dev, unsigned int pipe);
 void amdgpu_disable_vblank_kms(struct drm_device *dev, unsigned int pipe);
+u32 amdgpu_crtc_get_vblank_counter(struct drm_crtc *crtc);
+int amdgpu_crtc_enable_vblank(struct drm_crtc *crtc);
+void amdgpu_crtc_disable_vblank(struct drm_crtc *crtc);
 long amdgpu_kms_compat_ioctl(struct file *filp, unsigned int cmd,
 			     unsigned long arg);
 
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index 0749285dd1c7..9baa1ddf8693 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -1377,10 +1377,6 @@ static struct drm_driver kms_driver = {
 	.postclose = amdgpu_driver_postclose_kms,
 	.lastclose = amdgpu_driver_lastclose_kms,
 	.unload = amdgpu_driver_unload_kms,
-	.get_vblank_counter = amdgpu_get_vblank_counter_kms,
-	.enable_vblank = amdgpu_enable_vblank_kms,
-	.disable_vblank = amdgpu_disable_vblank_kms,
-	.get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
 	.irq_handler = amdgpu_irq_handler,
 	.ioctls = amdgpu_ioctls_kms,
 	.gem_free_object_unlocked = amdgpu_gem_object_free,
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
index 60591dbc2097..efe4671fb032 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
@@ -1174,6 +1174,14 @@ u32 amdgpu_get_vblank_counter_kms(struct drm_device *dev, unsigned int pipe)
 	return count;
 }
 
+u32 amdgpu_crtc_get_vblank_counter(struct drm_crtc *crtc)
+{
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
+
+	return amdgpu_get_vblank_counter_kms(dev, pipe);
+}
+
 /**
  * amdgpu_enable_vblank_kms - enable vblank interrupt
  *
@@ -1191,6 +1199,14 @@ int amdgpu_enable_vblank_kms(struct drm_device *dev, unsigned int pipe)
 	return amdgpu_irq_get(adev, &adev->crtc_irq, idx);
 }
 
+int amdgpu_crtc_enable_vblank(struct drm_crtc *crtc)
+{
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
+
+	return amdgpu_enable_vblank_kms(dev, pipe);
+}
+
 /**
  * amdgpu_disable_vblank_kms - disable vblank interrupt
  *
@@ -1207,6 +1223,14 @@ void amdgpu_disable_vblank_kms(struct drm_device *dev, unsigned int pipe)
 	amdgpu_irq_put(adev, &adev->crtc_irq, idx);
 }
 
+void amdgpu_crtc_disable_vblank(struct drm_crtc *crtc)
+{
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
+
+	amdgpu_disable_vblank_kms(dev, pipe);
+}
+
 const struct drm_ioctl_desc amdgpu_ioctls_kms[] = {
 	DRM_IOCTL_DEF_DRV(AMDGPU_GEM_CREATE, amdgpu_gem_create_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
 	DRM_IOCTL_DEF_DRV(AMDGPU_CTX, amdgpu_ctx_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
index bdc1e0f036d4..8e62f46f0bfd 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
@@ -2494,6 +2494,10 @@ static const struct drm_crtc_funcs dce_v10_0_crtc_funcs = {
 	.set_config = amdgpu_display_crtc_set_config,
 	.destroy = dce_v10_0_crtc_destroy,
 	.page_flip_target = amdgpu_display_crtc_page_flip_target,
+	.get_vblank_counter = amdgpu_crtc_get_vblank_counter,
+	.enable_vblank = amdgpu_crtc_enable_vblank,
+	.disable_vblank = amdgpu_crtc_disable_vblank,
+	.get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
 };
 
 static void dce_v10_0_crtc_dpms(struct drm_crtc *crtc, int mode)
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
index 0319da5f7bf9..9e37e4a78403 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
@@ -2573,6 +2573,10 @@ static const struct drm_crtc_funcs dce_v11_0_crtc_funcs = {
 	.set_config = amdgpu_display_crtc_set_config,
 	.destroy = dce_v11_0_crtc_destroy,
 	.page_flip_target = amdgpu_display_crtc_page_flip_target,
+	.get_vblank_counter = amdgpu_crtc_get_vblank_counter,
+	.enable_vblank = amdgpu_crtc_enable_vblank,
+	.disable_vblank = amdgpu_crtc_disable_vblank,
+	.get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
 };
 
 static void dce_v11_0_crtc_dpms(struct drm_crtc *crtc, int mode)
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
index 78642c3b14fc..2d4c99d3b352 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
@@ -2388,6 +2388,10 @@ static const struct drm_crtc_funcs dce_v6_0_crtc_funcs = {
 	.set_config = amdgpu_display_crtc_set_config,
 	.destroy = dce_v6_0_crtc_destroy,
 	.page_flip_target = amdgpu_display_crtc_page_flip_target,
+	.get_vblank_counter = amdgpu_crtc_get_vblank_counter,
+	.enable_vblank = amdgpu_crtc_enable_vblank,
+	.disable_vblank = amdgpu_crtc_disable_vblank,
+	.get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
 };
 
 static void dce_v6_0_crtc_dpms(struct drm_crtc *crtc, int mode)
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
index 1e8d4975435a..cd51fd155349 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
@@ -2395,6 +2395,10 @@ static const struct drm_crtc_funcs dce_v8_0_crtc_funcs = {
 	.set_config = amdgpu_display_crtc_set_config,
 	.destroy = dce_v8_0_crtc_destroy,
 	.page_flip_target = amdgpu_display_crtc_page_flip_target,
+	.get_vblank_counter = amdgpu_crtc_get_vblank_counter,
+	.enable_vblank = amdgpu_crtc_enable_vblank,
+	.disable_vblank = amdgpu_crtc_disable_vblank,
+	.get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
 };
 
 static void dce_v8_0_crtc_dpms(struct drm_crtc *crtc, int mode)
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
index 4b2f915aba47..53c260deb384 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
@@ -123,6 +123,10 @@ static const struct drm_crtc_funcs dce_virtual_crtc_funcs = {
 	.set_config = amdgpu_display_crtc_set_config,
 	.destroy = dce_virtual_crtc_destroy,
 	.page_flip_target = amdgpu_display_crtc_page_flip_target,
+	.get_vblank_counter = amdgpu_crtc_get_vblank_counter,
+	.enable_vblank = amdgpu_crtc_enable_vblank,
+	.disable_vblank = amdgpu_crtc_disable_vblank,
+	.get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
 };
 
 static void dce_virtual_crtc_dpms(struct drm_crtc *crtc, int mode)
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 39c5cf242c1b..0c51c4dd8c46 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -4214,8 +4214,10 @@ static const struct drm_crtc_funcs amdgpu_dm_crtc_funcs = {
 	.set_crc_source = amdgpu_dm_crtc_set_crc_source,
 	.verify_crc_source = amdgpu_dm_crtc_verify_crc_source,
 	.get_crc_sources = amdgpu_dm_crtc_get_crc_sources,
+	.get_vblank_counter = amdgpu_crtc_get_vblank_counter,
 	.enable_vblank = dm_enable_vblank,
 	.disable_vblank = dm_disable_vblank,
+	.get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
 };
 
 static enum drm_connector_status
-- 
2.24.1

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 12/23] drm/amdgpu: Convert to CRTC VBLANK callbacks
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

VBLANK callbacks in struct drm_driver are deprecated in favor of
their equivalents in struct drm_crtc_funcs. Convert amdgpu over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h           |  3 +++
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c       |  4 ----
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c       | 24 +++++++++++++++++++
 drivers/gpu/drm/amd/amdgpu/dce_v10_0.c        |  4 ++++
 drivers/gpu/drm/amd/amdgpu/dce_v11_0.c        |  4 ++++
 drivers/gpu/drm/amd/amdgpu/dce_v6_0.c         |  4 ++++
 drivers/gpu/drm/amd/amdgpu/dce_v8_0.c         |  4 ++++
 drivers/gpu/drm/amd/amdgpu/dce_virtual.c      |  4 ++++
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  2 ++
 9 files changed, 49 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
index 81a531b652aa..c1262ab588c9 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -1197,6 +1197,9 @@ int amdgpu_device_resume(struct drm_device *dev, bool fbcon);
 u32 amdgpu_get_vblank_counter_kms(struct drm_device *dev, unsigned int pipe);
 int amdgpu_enable_vblank_kms(struct drm_device *dev, unsigned int pipe);
 void amdgpu_disable_vblank_kms(struct drm_device *dev, unsigned int pipe);
+u32 amdgpu_crtc_get_vblank_counter(struct drm_crtc *crtc);
+int amdgpu_crtc_enable_vblank(struct drm_crtc *crtc);
+void amdgpu_crtc_disable_vblank(struct drm_crtc *crtc);
 long amdgpu_kms_compat_ioctl(struct file *filp, unsigned int cmd,
 			     unsigned long arg);
 
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index 0749285dd1c7..9baa1ddf8693 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -1377,10 +1377,6 @@ static struct drm_driver kms_driver = {
 	.postclose = amdgpu_driver_postclose_kms,
 	.lastclose = amdgpu_driver_lastclose_kms,
 	.unload = amdgpu_driver_unload_kms,
-	.get_vblank_counter = amdgpu_get_vblank_counter_kms,
-	.enable_vblank = amdgpu_enable_vblank_kms,
-	.disable_vblank = amdgpu_disable_vblank_kms,
-	.get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
 	.irq_handler = amdgpu_irq_handler,
 	.ioctls = amdgpu_ioctls_kms,
 	.gem_free_object_unlocked = amdgpu_gem_object_free,
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
index 60591dbc2097..efe4671fb032 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
@@ -1174,6 +1174,14 @@ u32 amdgpu_get_vblank_counter_kms(struct drm_device *dev, unsigned int pipe)
 	return count;
 }
 
+u32 amdgpu_crtc_get_vblank_counter(struct drm_crtc *crtc)
+{
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
+
+	return amdgpu_get_vblank_counter_kms(dev, pipe);
+}
+
 /**
  * amdgpu_enable_vblank_kms - enable vblank interrupt
  *
@@ -1191,6 +1199,14 @@ int amdgpu_enable_vblank_kms(struct drm_device *dev, unsigned int pipe)
 	return amdgpu_irq_get(adev, &adev->crtc_irq, idx);
 }
 
+int amdgpu_crtc_enable_vblank(struct drm_crtc *crtc)
+{
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
+
+	return amdgpu_enable_vblank_kms(dev, pipe);
+}
+
 /**
  * amdgpu_disable_vblank_kms - disable vblank interrupt
  *
@@ -1207,6 +1223,14 @@ void amdgpu_disable_vblank_kms(struct drm_device *dev, unsigned int pipe)
 	amdgpu_irq_put(adev, &adev->crtc_irq, idx);
 }
 
+void amdgpu_crtc_disable_vblank(struct drm_crtc *crtc)
+{
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
+
+	amdgpu_disable_vblank_kms(dev, pipe);
+}
+
 const struct drm_ioctl_desc amdgpu_ioctls_kms[] = {
 	DRM_IOCTL_DEF_DRV(AMDGPU_GEM_CREATE, amdgpu_gem_create_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
 	DRM_IOCTL_DEF_DRV(AMDGPU_CTX, amdgpu_ctx_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
index bdc1e0f036d4..8e62f46f0bfd 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
@@ -2494,6 +2494,10 @@ static const struct drm_crtc_funcs dce_v10_0_crtc_funcs = {
 	.set_config = amdgpu_display_crtc_set_config,
 	.destroy = dce_v10_0_crtc_destroy,
 	.page_flip_target = amdgpu_display_crtc_page_flip_target,
+	.get_vblank_counter = amdgpu_crtc_get_vblank_counter,
+	.enable_vblank = amdgpu_crtc_enable_vblank,
+	.disable_vblank = amdgpu_crtc_disable_vblank,
+	.get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
 };
 
 static void dce_v10_0_crtc_dpms(struct drm_crtc *crtc, int mode)
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
index 0319da5f7bf9..9e37e4a78403 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
@@ -2573,6 +2573,10 @@ static const struct drm_crtc_funcs dce_v11_0_crtc_funcs = {
 	.set_config = amdgpu_display_crtc_set_config,
 	.destroy = dce_v11_0_crtc_destroy,
 	.page_flip_target = amdgpu_display_crtc_page_flip_target,
+	.get_vblank_counter = amdgpu_crtc_get_vblank_counter,
+	.enable_vblank = amdgpu_crtc_enable_vblank,
+	.disable_vblank = amdgpu_crtc_disable_vblank,
+	.get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
 };
 
 static void dce_v11_0_crtc_dpms(struct drm_crtc *crtc, int mode)
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
index 78642c3b14fc..2d4c99d3b352 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
@@ -2388,6 +2388,10 @@ static const struct drm_crtc_funcs dce_v6_0_crtc_funcs = {
 	.set_config = amdgpu_display_crtc_set_config,
 	.destroy = dce_v6_0_crtc_destroy,
 	.page_flip_target = amdgpu_display_crtc_page_flip_target,
+	.get_vblank_counter = amdgpu_crtc_get_vblank_counter,
+	.enable_vblank = amdgpu_crtc_enable_vblank,
+	.disable_vblank = amdgpu_crtc_disable_vblank,
+	.get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
 };
 
 static void dce_v6_0_crtc_dpms(struct drm_crtc *crtc, int mode)
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
index 1e8d4975435a..cd51fd155349 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
@@ -2395,6 +2395,10 @@ static const struct drm_crtc_funcs dce_v8_0_crtc_funcs = {
 	.set_config = amdgpu_display_crtc_set_config,
 	.destroy = dce_v8_0_crtc_destroy,
 	.page_flip_target = amdgpu_display_crtc_page_flip_target,
+	.get_vblank_counter = amdgpu_crtc_get_vblank_counter,
+	.enable_vblank = amdgpu_crtc_enable_vblank,
+	.disable_vblank = amdgpu_crtc_disable_vblank,
+	.get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
 };
 
 static void dce_v8_0_crtc_dpms(struct drm_crtc *crtc, int mode)
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
index 4b2f915aba47..53c260deb384 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
@@ -123,6 +123,10 @@ static const struct drm_crtc_funcs dce_virtual_crtc_funcs = {
 	.set_config = amdgpu_display_crtc_set_config,
 	.destroy = dce_virtual_crtc_destroy,
 	.page_flip_target = amdgpu_display_crtc_page_flip_target,
+	.get_vblank_counter = amdgpu_crtc_get_vblank_counter,
+	.enable_vblank = amdgpu_crtc_enable_vblank,
+	.disable_vblank = amdgpu_crtc_disable_vblank,
+	.get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
 };
 
 static void dce_virtual_crtc_dpms(struct drm_crtc *crtc, int mode)
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 39c5cf242c1b..0c51c4dd8c46 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -4214,8 +4214,10 @@ static const struct drm_crtc_funcs amdgpu_dm_crtc_funcs = {
 	.set_crc_source = amdgpu_dm_crtc_set_crc_source,
 	.verify_crc_source = amdgpu_dm_crtc_verify_crc_source,
 	.get_crc_sources = amdgpu_dm_crtc_get_crc_sources,
+	.get_vblank_counter = amdgpu_crtc_get_vblank_counter,
 	.enable_vblank = dm_enable_vblank,
 	.disable_vblank = dm_disable_vblank,
+	.get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
 };
 
 static enum drm_connector_status
-- 
2.24.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [Intel-gfx] [PATCH 12/23] drm/amdgpu: Convert to CRTC VBLANK callbacks
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

VBLANK callbacks in struct drm_driver are deprecated in favor of
their equivalents in struct drm_crtc_funcs. Convert amdgpu over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h           |  3 +++
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c       |  4 ----
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c       | 24 +++++++++++++++++++
 drivers/gpu/drm/amd/amdgpu/dce_v10_0.c        |  4 ++++
 drivers/gpu/drm/amd/amdgpu/dce_v11_0.c        |  4 ++++
 drivers/gpu/drm/amd/amdgpu/dce_v6_0.c         |  4 ++++
 drivers/gpu/drm/amd/amdgpu/dce_v8_0.c         |  4 ++++
 drivers/gpu/drm/amd/amdgpu/dce_virtual.c      |  4 ++++
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  2 ++
 9 files changed, 49 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
index 81a531b652aa..c1262ab588c9 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -1197,6 +1197,9 @@ int amdgpu_device_resume(struct drm_device *dev, bool fbcon);
 u32 amdgpu_get_vblank_counter_kms(struct drm_device *dev, unsigned int pipe);
 int amdgpu_enable_vblank_kms(struct drm_device *dev, unsigned int pipe);
 void amdgpu_disable_vblank_kms(struct drm_device *dev, unsigned int pipe);
+u32 amdgpu_crtc_get_vblank_counter(struct drm_crtc *crtc);
+int amdgpu_crtc_enable_vblank(struct drm_crtc *crtc);
+void amdgpu_crtc_disable_vblank(struct drm_crtc *crtc);
 long amdgpu_kms_compat_ioctl(struct file *filp, unsigned int cmd,
 			     unsigned long arg);
 
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index 0749285dd1c7..9baa1ddf8693 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -1377,10 +1377,6 @@ static struct drm_driver kms_driver = {
 	.postclose = amdgpu_driver_postclose_kms,
 	.lastclose = amdgpu_driver_lastclose_kms,
 	.unload = amdgpu_driver_unload_kms,
-	.get_vblank_counter = amdgpu_get_vblank_counter_kms,
-	.enable_vblank = amdgpu_enable_vblank_kms,
-	.disable_vblank = amdgpu_disable_vblank_kms,
-	.get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
 	.irq_handler = amdgpu_irq_handler,
 	.ioctls = amdgpu_ioctls_kms,
 	.gem_free_object_unlocked = amdgpu_gem_object_free,
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
index 60591dbc2097..efe4671fb032 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
@@ -1174,6 +1174,14 @@ u32 amdgpu_get_vblank_counter_kms(struct drm_device *dev, unsigned int pipe)
 	return count;
 }
 
+u32 amdgpu_crtc_get_vblank_counter(struct drm_crtc *crtc)
+{
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
+
+	return amdgpu_get_vblank_counter_kms(dev, pipe);
+}
+
 /**
  * amdgpu_enable_vblank_kms - enable vblank interrupt
  *
@@ -1191,6 +1199,14 @@ int amdgpu_enable_vblank_kms(struct drm_device *dev, unsigned int pipe)
 	return amdgpu_irq_get(adev, &adev->crtc_irq, idx);
 }
 
+int amdgpu_crtc_enable_vblank(struct drm_crtc *crtc)
+{
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
+
+	return amdgpu_enable_vblank_kms(dev, pipe);
+}
+
 /**
  * amdgpu_disable_vblank_kms - disable vblank interrupt
  *
@@ -1207,6 +1223,14 @@ void amdgpu_disable_vblank_kms(struct drm_device *dev, unsigned int pipe)
 	amdgpu_irq_put(adev, &adev->crtc_irq, idx);
 }
 
+void amdgpu_crtc_disable_vblank(struct drm_crtc *crtc)
+{
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
+
+	amdgpu_disable_vblank_kms(dev, pipe);
+}
+
 const struct drm_ioctl_desc amdgpu_ioctls_kms[] = {
 	DRM_IOCTL_DEF_DRV(AMDGPU_GEM_CREATE, amdgpu_gem_create_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
 	DRM_IOCTL_DEF_DRV(AMDGPU_CTX, amdgpu_ctx_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
index bdc1e0f036d4..8e62f46f0bfd 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
@@ -2494,6 +2494,10 @@ static const struct drm_crtc_funcs dce_v10_0_crtc_funcs = {
 	.set_config = amdgpu_display_crtc_set_config,
 	.destroy = dce_v10_0_crtc_destroy,
 	.page_flip_target = amdgpu_display_crtc_page_flip_target,
+	.get_vblank_counter = amdgpu_crtc_get_vblank_counter,
+	.enable_vblank = amdgpu_crtc_enable_vblank,
+	.disable_vblank = amdgpu_crtc_disable_vblank,
+	.get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
 };
 
 static void dce_v10_0_crtc_dpms(struct drm_crtc *crtc, int mode)
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
index 0319da5f7bf9..9e37e4a78403 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
@@ -2573,6 +2573,10 @@ static const struct drm_crtc_funcs dce_v11_0_crtc_funcs = {
 	.set_config = amdgpu_display_crtc_set_config,
 	.destroy = dce_v11_0_crtc_destroy,
 	.page_flip_target = amdgpu_display_crtc_page_flip_target,
+	.get_vblank_counter = amdgpu_crtc_get_vblank_counter,
+	.enable_vblank = amdgpu_crtc_enable_vblank,
+	.disable_vblank = amdgpu_crtc_disable_vblank,
+	.get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
 };
 
 static void dce_v11_0_crtc_dpms(struct drm_crtc *crtc, int mode)
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
index 78642c3b14fc..2d4c99d3b352 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
@@ -2388,6 +2388,10 @@ static const struct drm_crtc_funcs dce_v6_0_crtc_funcs = {
 	.set_config = amdgpu_display_crtc_set_config,
 	.destroy = dce_v6_0_crtc_destroy,
 	.page_flip_target = amdgpu_display_crtc_page_flip_target,
+	.get_vblank_counter = amdgpu_crtc_get_vblank_counter,
+	.enable_vblank = amdgpu_crtc_enable_vblank,
+	.disable_vblank = amdgpu_crtc_disable_vblank,
+	.get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
 };
 
 static void dce_v6_0_crtc_dpms(struct drm_crtc *crtc, int mode)
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
index 1e8d4975435a..cd51fd155349 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
@@ -2395,6 +2395,10 @@ static const struct drm_crtc_funcs dce_v8_0_crtc_funcs = {
 	.set_config = amdgpu_display_crtc_set_config,
 	.destroy = dce_v8_0_crtc_destroy,
 	.page_flip_target = amdgpu_display_crtc_page_flip_target,
+	.get_vblank_counter = amdgpu_crtc_get_vblank_counter,
+	.enable_vblank = amdgpu_crtc_enable_vblank,
+	.disable_vblank = amdgpu_crtc_disable_vblank,
+	.get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
 };
 
 static void dce_v8_0_crtc_dpms(struct drm_crtc *crtc, int mode)
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
index 4b2f915aba47..53c260deb384 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
@@ -123,6 +123,10 @@ static const struct drm_crtc_funcs dce_virtual_crtc_funcs = {
 	.set_config = amdgpu_display_crtc_set_config,
 	.destroy = dce_virtual_crtc_destroy,
 	.page_flip_target = amdgpu_display_crtc_page_flip_target,
+	.get_vblank_counter = amdgpu_crtc_get_vblank_counter,
+	.enable_vblank = amdgpu_crtc_enable_vblank,
+	.disable_vblank = amdgpu_crtc_disable_vblank,
+	.get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
 };
 
 static void dce_virtual_crtc_dpms(struct drm_crtc *crtc, int mode)
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 39c5cf242c1b..0c51c4dd8c46 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -4214,8 +4214,10 @@ static const struct drm_crtc_funcs amdgpu_dm_crtc_funcs = {
 	.set_crc_source = amdgpu_dm_crtc_set_crc_source,
 	.verify_crc_source = amdgpu_dm_crtc_verify_crc_source,
 	.get_crc_sources = amdgpu_dm_crtc_get_crc_sources,
+	.get_vblank_counter = amdgpu_crtc_get_vblank_counter,
 	.enable_vblank = dm_enable_vblank,
 	.disable_vblank = dm_disable_vblank,
+	.get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
 };
 
 static enum drm_connector_status
-- 
2.24.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 12/23] drm/amdgpu: Convert to CRTC VBLANK callbacks
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

VBLANK callbacks in struct drm_driver are deprecated in favor of
their equivalents in struct drm_crtc_funcs. Convert amdgpu over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h           |  3 +++
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c       |  4 ----
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c       | 24 +++++++++++++++++++
 drivers/gpu/drm/amd/amdgpu/dce_v10_0.c        |  4 ++++
 drivers/gpu/drm/amd/amdgpu/dce_v11_0.c        |  4 ++++
 drivers/gpu/drm/amd/amdgpu/dce_v6_0.c         |  4 ++++
 drivers/gpu/drm/amd/amdgpu/dce_v8_0.c         |  4 ++++
 drivers/gpu/drm/amd/amdgpu/dce_virtual.c      |  4 ++++
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  2 ++
 9 files changed, 49 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
index 81a531b652aa..c1262ab588c9 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -1197,6 +1197,9 @@ int amdgpu_device_resume(struct drm_device *dev, bool fbcon);
 u32 amdgpu_get_vblank_counter_kms(struct drm_device *dev, unsigned int pipe);
 int amdgpu_enable_vblank_kms(struct drm_device *dev, unsigned int pipe);
 void amdgpu_disable_vblank_kms(struct drm_device *dev, unsigned int pipe);
+u32 amdgpu_crtc_get_vblank_counter(struct drm_crtc *crtc);
+int amdgpu_crtc_enable_vblank(struct drm_crtc *crtc);
+void amdgpu_crtc_disable_vblank(struct drm_crtc *crtc);
 long amdgpu_kms_compat_ioctl(struct file *filp, unsigned int cmd,
 			     unsigned long arg);
 
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index 0749285dd1c7..9baa1ddf8693 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -1377,10 +1377,6 @@ static struct drm_driver kms_driver = {
 	.postclose = amdgpu_driver_postclose_kms,
 	.lastclose = amdgpu_driver_lastclose_kms,
 	.unload = amdgpu_driver_unload_kms,
-	.get_vblank_counter = amdgpu_get_vblank_counter_kms,
-	.enable_vblank = amdgpu_enable_vblank_kms,
-	.disable_vblank = amdgpu_disable_vblank_kms,
-	.get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
 	.irq_handler = amdgpu_irq_handler,
 	.ioctls = amdgpu_ioctls_kms,
 	.gem_free_object_unlocked = amdgpu_gem_object_free,
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
index 60591dbc2097..efe4671fb032 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
@@ -1174,6 +1174,14 @@ u32 amdgpu_get_vblank_counter_kms(struct drm_device *dev, unsigned int pipe)
 	return count;
 }
 
+u32 amdgpu_crtc_get_vblank_counter(struct drm_crtc *crtc)
+{
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
+
+	return amdgpu_get_vblank_counter_kms(dev, pipe);
+}
+
 /**
  * amdgpu_enable_vblank_kms - enable vblank interrupt
  *
@@ -1191,6 +1199,14 @@ int amdgpu_enable_vblank_kms(struct drm_device *dev, unsigned int pipe)
 	return amdgpu_irq_get(adev, &adev->crtc_irq, idx);
 }
 
+int amdgpu_crtc_enable_vblank(struct drm_crtc *crtc)
+{
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
+
+	return amdgpu_enable_vblank_kms(dev, pipe);
+}
+
 /**
  * amdgpu_disable_vblank_kms - disable vblank interrupt
  *
@@ -1207,6 +1223,14 @@ void amdgpu_disable_vblank_kms(struct drm_device *dev, unsigned int pipe)
 	amdgpu_irq_put(adev, &adev->crtc_irq, idx);
 }
 
+void amdgpu_crtc_disable_vblank(struct drm_crtc *crtc)
+{
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
+
+	amdgpu_disable_vblank_kms(dev, pipe);
+}
+
 const struct drm_ioctl_desc amdgpu_ioctls_kms[] = {
 	DRM_IOCTL_DEF_DRV(AMDGPU_GEM_CREATE, amdgpu_gem_create_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
 	DRM_IOCTL_DEF_DRV(AMDGPU_CTX, amdgpu_ctx_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
index bdc1e0f036d4..8e62f46f0bfd 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
@@ -2494,6 +2494,10 @@ static const struct drm_crtc_funcs dce_v10_0_crtc_funcs = {
 	.set_config = amdgpu_display_crtc_set_config,
 	.destroy = dce_v10_0_crtc_destroy,
 	.page_flip_target = amdgpu_display_crtc_page_flip_target,
+	.get_vblank_counter = amdgpu_crtc_get_vblank_counter,
+	.enable_vblank = amdgpu_crtc_enable_vblank,
+	.disable_vblank = amdgpu_crtc_disable_vblank,
+	.get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
 };
 
 static void dce_v10_0_crtc_dpms(struct drm_crtc *crtc, int mode)
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
index 0319da5f7bf9..9e37e4a78403 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
@@ -2573,6 +2573,10 @@ static const struct drm_crtc_funcs dce_v11_0_crtc_funcs = {
 	.set_config = amdgpu_display_crtc_set_config,
 	.destroy = dce_v11_0_crtc_destroy,
 	.page_flip_target = amdgpu_display_crtc_page_flip_target,
+	.get_vblank_counter = amdgpu_crtc_get_vblank_counter,
+	.enable_vblank = amdgpu_crtc_enable_vblank,
+	.disable_vblank = amdgpu_crtc_disable_vblank,
+	.get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
 };
 
 static void dce_v11_0_crtc_dpms(struct drm_crtc *crtc, int mode)
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
index 78642c3b14fc..2d4c99d3b352 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
@@ -2388,6 +2388,10 @@ static const struct drm_crtc_funcs dce_v6_0_crtc_funcs = {
 	.set_config = amdgpu_display_crtc_set_config,
 	.destroy = dce_v6_0_crtc_destroy,
 	.page_flip_target = amdgpu_display_crtc_page_flip_target,
+	.get_vblank_counter = amdgpu_crtc_get_vblank_counter,
+	.enable_vblank = amdgpu_crtc_enable_vblank,
+	.disable_vblank = amdgpu_crtc_disable_vblank,
+	.get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
 };
 
 static void dce_v6_0_crtc_dpms(struct drm_crtc *crtc, int mode)
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
index 1e8d4975435a..cd51fd155349 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
@@ -2395,6 +2395,10 @@ static const struct drm_crtc_funcs dce_v8_0_crtc_funcs = {
 	.set_config = amdgpu_display_crtc_set_config,
 	.destroy = dce_v8_0_crtc_destroy,
 	.page_flip_target = amdgpu_display_crtc_page_flip_target,
+	.get_vblank_counter = amdgpu_crtc_get_vblank_counter,
+	.enable_vblank = amdgpu_crtc_enable_vblank,
+	.disable_vblank = amdgpu_crtc_disable_vblank,
+	.get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
 };
 
 static void dce_v8_0_crtc_dpms(struct drm_crtc *crtc, int mode)
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
index 4b2f915aba47..53c260deb384 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
@@ -123,6 +123,10 @@ static const struct drm_crtc_funcs dce_virtual_crtc_funcs = {
 	.set_config = amdgpu_display_crtc_set_config,
 	.destroy = dce_virtual_crtc_destroy,
 	.page_flip_target = amdgpu_display_crtc_page_flip_target,
+	.get_vblank_counter = amdgpu_crtc_get_vblank_counter,
+	.enable_vblank = amdgpu_crtc_enable_vblank,
+	.disable_vblank = amdgpu_crtc_disable_vblank,
+	.get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
 };
 
 static void dce_virtual_crtc_dpms(struct drm_crtc *crtc, int mode)
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 39c5cf242c1b..0c51c4dd8c46 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -4214,8 +4214,10 @@ static const struct drm_crtc_funcs amdgpu_dm_crtc_funcs = {
 	.set_crc_source = amdgpu_dm_crtc_set_crc_source,
 	.verify_crc_source = amdgpu_dm_crtc_verify_crc_source,
 	.get_crc_sources = amdgpu_dm_crtc_get_crc_sources,
+	.get_vblank_counter = amdgpu_crtc_get_vblank_counter,
 	.enable_vblank = dm_enable_vblank,
 	.disable_vblank = dm_disable_vblank,
+	.get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
 };
 
 static enum drm_connector_status
-- 
2.24.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 13/23] drm/gma500: Convert to CRTC VBLANK callbacks
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: dri-devel, amd-gfx, intel-gfx, linux-arm-msm, freedreno, nouveau,
	Thomas Zimmermann

VBLANK callbacks in struct drm_driver are deprecated in favor of
their equivalents in struct drm_crtc_funcs. Convert gma500 over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 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 ++++---
 6 files changed, 22 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/gma500/cdv_intel_display.c b/drivers/gpu/drm/gma500/cdv_intel_display.c
index 1ed854f498b7..686385a66167 100644
--- a/drivers/gpu/drm/gma500/cdv_intel_display.c
+++ b/drivers/gpu/drm/gma500/cdv_intel_display.c
@@ -977,6 +977,9 @@ const struct drm_crtc_funcs cdv_intel_crtc_funcs = {
 	.set_config = gma_crtc_set_config,
 	.destroy = gma_crtc_destroy,
 	.page_flip = gma_crtc_page_flip,
+	.enable_vblank = psb_enable_vblank,
+	.disable_vblank = psb_disable_vblank,
+	.get_vblank_counter = psb_get_vblank_counter,
 };
 
 const struct gma_clock_funcs cdv_clock_funcs = {
diff --git a/drivers/gpu/drm/gma500/psb_drv.c b/drivers/gpu/drm/gma500/psb_drv.c
index 52591416f8fe..36cb292fdebe 100644
--- a/drivers/gpu/drm/gma500/psb_drv.c
+++ b/drivers/gpu/drm/gma500/psb_drv.c
@@ -363,7 +363,6 @@ static int psb_driver_load(struct drm_device *dev, unsigned long flags)
 	drm_irq_install(dev, dev->pdev->irq);
 
 	dev->max_vblank_count = 0xffffff; /* only 24 bits of frame count */
-	dev->driver->get_vblank_counter = psb_get_vblank_counter;
 
 	psb_modeset_init(dev);
 	psb_fbdev_init(dev);
@@ -507,9 +506,6 @@ static struct drm_driver driver = {
 	.irq_postinstall = psb_irq_postinstall,
 	.irq_uninstall = psb_irq_uninstall,
 	.irq_handler = psb_irq_handler,
-	.enable_vblank = psb_enable_vblank,
-	.disable_vblank = psb_disable_vblank,
-	.get_vblank_counter = psb_get_vblank_counter,
 
 	.gem_free_object = psb_gem_free_object,
 	.gem_vm_ops = &psb_gem_vm_ops,
diff --git a/drivers/gpu/drm/gma500/psb_drv.h b/drivers/gpu/drm/gma500/psb_drv.h
index 3d4ef3071d45..956926341316 100644
--- a/drivers/gpu/drm/gma500/psb_drv.h
+++ b/drivers/gpu/drm/gma500/psb_drv.h
@@ -681,15 +681,15 @@ extern void psb_irq_turn_off_dpst(struct drm_device *dev);
 extern void psb_irq_uninstall_islands(struct drm_device *dev, int hw_islands);
 extern int psb_vblank_wait2(struct drm_device *dev, unsigned int *sequence);
 extern int psb_vblank_wait(struct drm_device *dev, unsigned int *sequence);
-extern int psb_enable_vblank(struct drm_device *dev, unsigned int pipe);
-extern void psb_disable_vblank(struct drm_device *dev, unsigned int pipe);
+extern int psb_enable_vblank(struct drm_crtc *crtc);
+extern void psb_disable_vblank(struct drm_crtc *crtc);
 void
 psb_enable_pipestat(struct drm_psb_private *dev_priv, int pipe, u32 mask);
 
 void
 psb_disable_pipestat(struct drm_psb_private *dev_priv, int pipe, u32 mask);
 
-extern u32 psb_get_vblank_counter(struct drm_device *dev, unsigned int pipe);
+extern u32 psb_get_vblank_counter(struct drm_crtc *crtc);
 
 /* framebuffer.c */
 extern int psbfb_probed(struct drm_device *dev);
diff --git a/drivers/gpu/drm/gma500/psb_intel_display.c b/drivers/gpu/drm/gma500/psb_intel_display.c
index fed3b563e62e..531c5485be17 100644
--- a/drivers/gpu/drm/gma500/psb_intel_display.c
+++ b/drivers/gpu/drm/gma500/psb_intel_display.c
@@ -433,6 +433,9 @@ const struct drm_crtc_funcs psb_intel_crtc_funcs = {
 	.set_config = gma_crtc_set_config,
 	.destroy = gma_crtc_destroy,
 	.page_flip = gma_crtc_page_flip,
+	.enable_vblank = psb_enable_vblank,
+	.disable_vblank = psb_disable_vblank,
+	.get_vblank_counter = psb_get_vblank_counter,
 };
 
 const struct gma_clock_funcs psb_clock_funcs = {
diff --git a/drivers/gpu/drm/gma500/psb_irq.c b/drivers/gpu/drm/gma500/psb_irq.c
index 40a37e400b02..7ec031d28dc0 100644
--- a/drivers/gpu/drm/gma500/psb_irq.c
+++ b/drivers/gpu/drm/gma500/psb_irq.c
@@ -507,8 +507,10 @@ int psb_irq_disable_dpst(struct drm_device *dev)
 /*
  * It is used to enable VBLANK interrupt
  */
-int psb_enable_vblank(struct drm_device *dev, unsigned int pipe)
+int psb_enable_vblank(struct drm_crtc *crtc)
 {
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
 	struct drm_psb_private *dev_priv = dev->dev_private;
 	unsigned long irqflags;
 	uint32_t reg_val = 0;
@@ -546,8 +548,10 @@ int psb_enable_vblank(struct drm_device *dev, unsigned int pipe)
 /*
  * It is used to disable VBLANK interrupt
  */
-void psb_disable_vblank(struct drm_device *dev, unsigned int pipe)
+void psb_disable_vblank(struct drm_crtc *crtc)
 {
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
 	struct drm_psb_private *dev_priv = dev->dev_private;
 	unsigned long irqflags;
 
@@ -619,8 +623,10 @@ void mdfld_disable_te(struct drm_device *dev, int pipe)
 /* Called from drm generic code, passed a 'crtc', which
  * we use as a pipe index
  */
-u32 psb_get_vblank_counter(struct drm_device *dev, unsigned int pipe)
+u32 psb_get_vblank_counter(struct drm_crtc *crtc)
 {
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
 	uint32_t high_frame = PIPEAFRAMEHIGH;
 	uint32_t low_frame = PIPEAFRAMEPIXEL;
 	uint32_t pipeconf_reg = PIPEACONF;
diff --git a/drivers/gpu/drm/gma500/psb_irq.h b/drivers/gpu/drm/gma500/psb_irq.h
index 58fd502e3b9d..4f73998848d1 100644
--- a/drivers/gpu/drm/gma500/psb_irq.h
+++ b/drivers/gpu/drm/gma500/psb_irq.h
@@ -12,6 +12,7 @@
 #ifndef _PSB_IRQ_H_
 #define _PSB_IRQ_H_
 
+struct drm_crtc;
 struct drm_device;
 
 bool sysirq_init(struct drm_device *dev);
@@ -26,9 +27,9 @@ int psb_irq_enable_dpst(struct drm_device *dev);
 int psb_irq_disable_dpst(struct drm_device *dev);
 void psb_irq_turn_on_dpst(struct drm_device *dev);
 void psb_irq_turn_off_dpst(struct drm_device *dev);
-int  psb_enable_vblank(struct drm_device *dev, unsigned int pipe);
-void psb_disable_vblank(struct drm_device *dev, unsigned int pipe);
-u32  psb_get_vblank_counter(struct drm_device *dev, unsigned int pipe);
+int  psb_enable_vblank(struct drm_crtc *crtc);
+void psb_disable_vblank(struct drm_crtc *crtc);
+u32  psb_get_vblank_counter(struct drm_crtc *crtc);
 
 int mdfld_enable_te(struct drm_device *dev, int pipe);
 void mdfld_disable_te(struct drm_device *dev, int pipe);
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 13/23] drm/gma500: Convert to CRTC VBLANK callbacks
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied-cv59FeDIM0c, daniel-/w4YWyX8dFk,
	alexander.deucher-5C7GfCeVMHo, christian.koenig-5C7GfCeVMHo,
	David1.Zhou-5C7GfCeVMHo,
	maarten.lankhorst-VuQAYsv1563Yd54FQh9/CA,
	patrik.r.jakobsson-Re5JQEeQqe8AvxtiuMwx3w,
	robdclark-Re5JQEeQqe8AvxtiuMwx3w, sean-p7yTbzM4H96eqtR555YLDQ,
	benjamin.gaignard-QSEj5FYQhm4dnm+yROfE0A,
	vincent.abriou-qxv4g6HH51o, yannick.fertre-qxv4g6HH51o,
	philippe.cornu-qxv4g6HH51o,
	mcoquelin.stm32-Re5JQEeQqe8AvxtiuMwx3w,
	alexandre.torgue-qxv4g6HH51o, eric-WhKQ6XTQaPysTnJN9+BGXg,
	rodrigosiqueiramelo-Re5JQEeQqe8AvxtiuMwx3w,
	hamohammed.sa-Re5JQEeQqe8AvxtiuMwx3w,
	linux-graphics-maintainer-pghWNbHTmq7QT0dZR+AlfA,
	thellstrom-pghWNbHTmq7QT0dZR+AlfA,
	bskeggs-H+wXaHxf7aLQT0dZR+AlfA, harry.wentland-5C7GfCeVMHo,
	sunpeng.li-5C7GfCeVMHo, jani.nikula-VuQAYsv1563Yd54FQh9/CA,
	joonas.lahtinen-VuQAYsv1563Yd54FQh9/CA,
	rodrigo.vivi-ral2JQCrhuEAvxtiuMwx3w
  Cc: linux-arm-msm-u79uwXL29TY76Z2rM5mHXA,
	intel-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Thomas Zimmermann,
	nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

VBLANK callbacks in struct drm_driver are deprecated in favor of
their equivalents in struct drm_crtc_funcs. Convert gma500 over.

Signed-off-by: Thomas Zimmermann <tzimmermann-l3A5Bk7waGM@public.gmane.org>
---
 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 ++++---
 6 files changed, 22 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/gma500/cdv_intel_display.c b/drivers/gpu/drm/gma500/cdv_intel_display.c
index 1ed854f498b7..686385a66167 100644
--- a/drivers/gpu/drm/gma500/cdv_intel_display.c
+++ b/drivers/gpu/drm/gma500/cdv_intel_display.c
@@ -977,6 +977,9 @@ const struct drm_crtc_funcs cdv_intel_crtc_funcs = {
 	.set_config = gma_crtc_set_config,
 	.destroy = gma_crtc_destroy,
 	.page_flip = gma_crtc_page_flip,
+	.enable_vblank = psb_enable_vblank,
+	.disable_vblank = psb_disable_vblank,
+	.get_vblank_counter = psb_get_vblank_counter,
 };
 
 const struct gma_clock_funcs cdv_clock_funcs = {
diff --git a/drivers/gpu/drm/gma500/psb_drv.c b/drivers/gpu/drm/gma500/psb_drv.c
index 52591416f8fe..36cb292fdebe 100644
--- a/drivers/gpu/drm/gma500/psb_drv.c
+++ b/drivers/gpu/drm/gma500/psb_drv.c
@@ -363,7 +363,6 @@ static int psb_driver_load(struct drm_device *dev, unsigned long flags)
 	drm_irq_install(dev, dev->pdev->irq);
 
 	dev->max_vblank_count = 0xffffff; /* only 24 bits of frame count */
-	dev->driver->get_vblank_counter = psb_get_vblank_counter;
 
 	psb_modeset_init(dev);
 	psb_fbdev_init(dev);
@@ -507,9 +506,6 @@ static struct drm_driver driver = {
 	.irq_postinstall = psb_irq_postinstall,
 	.irq_uninstall = psb_irq_uninstall,
 	.irq_handler = psb_irq_handler,
-	.enable_vblank = psb_enable_vblank,
-	.disable_vblank = psb_disable_vblank,
-	.get_vblank_counter = psb_get_vblank_counter,
 
 	.gem_free_object = psb_gem_free_object,
 	.gem_vm_ops = &psb_gem_vm_ops,
diff --git a/drivers/gpu/drm/gma500/psb_drv.h b/drivers/gpu/drm/gma500/psb_drv.h
index 3d4ef3071d45..956926341316 100644
--- a/drivers/gpu/drm/gma500/psb_drv.h
+++ b/drivers/gpu/drm/gma500/psb_drv.h
@@ -681,15 +681,15 @@ extern void psb_irq_turn_off_dpst(struct drm_device *dev);
 extern void psb_irq_uninstall_islands(struct drm_device *dev, int hw_islands);
 extern int psb_vblank_wait2(struct drm_device *dev, unsigned int *sequence);
 extern int psb_vblank_wait(struct drm_device *dev, unsigned int *sequence);
-extern int psb_enable_vblank(struct drm_device *dev, unsigned int pipe);
-extern void psb_disable_vblank(struct drm_device *dev, unsigned int pipe);
+extern int psb_enable_vblank(struct drm_crtc *crtc);
+extern void psb_disable_vblank(struct drm_crtc *crtc);
 void
 psb_enable_pipestat(struct drm_psb_private *dev_priv, int pipe, u32 mask);
 
 void
 psb_disable_pipestat(struct drm_psb_private *dev_priv, int pipe, u32 mask);
 
-extern u32 psb_get_vblank_counter(struct drm_device *dev, unsigned int pipe);
+extern u32 psb_get_vblank_counter(struct drm_crtc *crtc);
 
 /* framebuffer.c */
 extern int psbfb_probed(struct drm_device *dev);
diff --git a/drivers/gpu/drm/gma500/psb_intel_display.c b/drivers/gpu/drm/gma500/psb_intel_display.c
index fed3b563e62e..531c5485be17 100644
--- a/drivers/gpu/drm/gma500/psb_intel_display.c
+++ b/drivers/gpu/drm/gma500/psb_intel_display.c
@@ -433,6 +433,9 @@ const struct drm_crtc_funcs psb_intel_crtc_funcs = {
 	.set_config = gma_crtc_set_config,
 	.destroy = gma_crtc_destroy,
 	.page_flip = gma_crtc_page_flip,
+	.enable_vblank = psb_enable_vblank,
+	.disable_vblank = psb_disable_vblank,
+	.get_vblank_counter = psb_get_vblank_counter,
 };
 
 const struct gma_clock_funcs psb_clock_funcs = {
diff --git a/drivers/gpu/drm/gma500/psb_irq.c b/drivers/gpu/drm/gma500/psb_irq.c
index 40a37e400b02..7ec031d28dc0 100644
--- a/drivers/gpu/drm/gma500/psb_irq.c
+++ b/drivers/gpu/drm/gma500/psb_irq.c
@@ -507,8 +507,10 @@ int psb_irq_disable_dpst(struct drm_device *dev)
 /*
  * It is used to enable VBLANK interrupt
  */
-int psb_enable_vblank(struct drm_device *dev, unsigned int pipe)
+int psb_enable_vblank(struct drm_crtc *crtc)
 {
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
 	struct drm_psb_private *dev_priv = dev->dev_private;
 	unsigned long irqflags;
 	uint32_t reg_val = 0;
@@ -546,8 +548,10 @@ int psb_enable_vblank(struct drm_device *dev, unsigned int pipe)
 /*
  * It is used to disable VBLANK interrupt
  */
-void psb_disable_vblank(struct drm_device *dev, unsigned int pipe)
+void psb_disable_vblank(struct drm_crtc *crtc)
 {
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
 	struct drm_psb_private *dev_priv = dev->dev_private;
 	unsigned long irqflags;
 
@@ -619,8 +623,10 @@ void mdfld_disable_te(struct drm_device *dev, int pipe)
 /* Called from drm generic code, passed a 'crtc', which
  * we use as a pipe index
  */
-u32 psb_get_vblank_counter(struct drm_device *dev, unsigned int pipe)
+u32 psb_get_vblank_counter(struct drm_crtc *crtc)
 {
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
 	uint32_t high_frame = PIPEAFRAMEHIGH;
 	uint32_t low_frame = PIPEAFRAMEPIXEL;
 	uint32_t pipeconf_reg = PIPEACONF;
diff --git a/drivers/gpu/drm/gma500/psb_irq.h b/drivers/gpu/drm/gma500/psb_irq.h
index 58fd502e3b9d..4f73998848d1 100644
--- a/drivers/gpu/drm/gma500/psb_irq.h
+++ b/drivers/gpu/drm/gma500/psb_irq.h
@@ -12,6 +12,7 @@
 #ifndef _PSB_IRQ_H_
 #define _PSB_IRQ_H_
 
+struct drm_crtc;
 struct drm_device;
 
 bool sysirq_init(struct drm_device *dev);
@@ -26,9 +27,9 @@ int psb_irq_enable_dpst(struct drm_device *dev);
 int psb_irq_disable_dpst(struct drm_device *dev);
 void psb_irq_turn_on_dpst(struct drm_device *dev);
 void psb_irq_turn_off_dpst(struct drm_device *dev);
-int  psb_enable_vblank(struct drm_device *dev, unsigned int pipe);
-void psb_disable_vblank(struct drm_device *dev, unsigned int pipe);
-u32  psb_get_vblank_counter(struct drm_device *dev, unsigned int pipe);
+int  psb_enable_vblank(struct drm_crtc *crtc);
+void psb_disable_vblank(struct drm_crtc *crtc);
+u32  psb_get_vblank_counter(struct drm_crtc *crtc);
 
 int mdfld_enable_te(struct drm_device *dev, int pipe);
 void mdfld_disable_te(struct drm_device *dev, int pipe);
-- 
2.24.1

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 13/23] drm/gma500: Convert to CRTC VBLANK callbacks
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

VBLANK callbacks in struct drm_driver are deprecated in favor of
their equivalents in struct drm_crtc_funcs. Convert gma500 over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 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 ++++---
 6 files changed, 22 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/gma500/cdv_intel_display.c b/drivers/gpu/drm/gma500/cdv_intel_display.c
index 1ed854f498b7..686385a66167 100644
--- a/drivers/gpu/drm/gma500/cdv_intel_display.c
+++ b/drivers/gpu/drm/gma500/cdv_intel_display.c
@@ -977,6 +977,9 @@ const struct drm_crtc_funcs cdv_intel_crtc_funcs = {
 	.set_config = gma_crtc_set_config,
 	.destroy = gma_crtc_destroy,
 	.page_flip = gma_crtc_page_flip,
+	.enable_vblank = psb_enable_vblank,
+	.disable_vblank = psb_disable_vblank,
+	.get_vblank_counter = psb_get_vblank_counter,
 };
 
 const struct gma_clock_funcs cdv_clock_funcs = {
diff --git a/drivers/gpu/drm/gma500/psb_drv.c b/drivers/gpu/drm/gma500/psb_drv.c
index 52591416f8fe..36cb292fdebe 100644
--- a/drivers/gpu/drm/gma500/psb_drv.c
+++ b/drivers/gpu/drm/gma500/psb_drv.c
@@ -363,7 +363,6 @@ static int psb_driver_load(struct drm_device *dev, unsigned long flags)
 	drm_irq_install(dev, dev->pdev->irq);
 
 	dev->max_vblank_count = 0xffffff; /* only 24 bits of frame count */
-	dev->driver->get_vblank_counter = psb_get_vblank_counter;
 
 	psb_modeset_init(dev);
 	psb_fbdev_init(dev);
@@ -507,9 +506,6 @@ static struct drm_driver driver = {
 	.irq_postinstall = psb_irq_postinstall,
 	.irq_uninstall = psb_irq_uninstall,
 	.irq_handler = psb_irq_handler,
-	.enable_vblank = psb_enable_vblank,
-	.disable_vblank = psb_disable_vblank,
-	.get_vblank_counter = psb_get_vblank_counter,
 
 	.gem_free_object = psb_gem_free_object,
 	.gem_vm_ops = &psb_gem_vm_ops,
diff --git a/drivers/gpu/drm/gma500/psb_drv.h b/drivers/gpu/drm/gma500/psb_drv.h
index 3d4ef3071d45..956926341316 100644
--- a/drivers/gpu/drm/gma500/psb_drv.h
+++ b/drivers/gpu/drm/gma500/psb_drv.h
@@ -681,15 +681,15 @@ extern void psb_irq_turn_off_dpst(struct drm_device *dev);
 extern void psb_irq_uninstall_islands(struct drm_device *dev, int hw_islands);
 extern int psb_vblank_wait2(struct drm_device *dev, unsigned int *sequence);
 extern int psb_vblank_wait(struct drm_device *dev, unsigned int *sequence);
-extern int psb_enable_vblank(struct drm_device *dev, unsigned int pipe);
-extern void psb_disable_vblank(struct drm_device *dev, unsigned int pipe);
+extern int psb_enable_vblank(struct drm_crtc *crtc);
+extern void psb_disable_vblank(struct drm_crtc *crtc);
 void
 psb_enable_pipestat(struct drm_psb_private *dev_priv, int pipe, u32 mask);
 
 void
 psb_disable_pipestat(struct drm_psb_private *dev_priv, int pipe, u32 mask);
 
-extern u32 psb_get_vblank_counter(struct drm_device *dev, unsigned int pipe);
+extern u32 psb_get_vblank_counter(struct drm_crtc *crtc);
 
 /* framebuffer.c */
 extern int psbfb_probed(struct drm_device *dev);
diff --git a/drivers/gpu/drm/gma500/psb_intel_display.c b/drivers/gpu/drm/gma500/psb_intel_display.c
index fed3b563e62e..531c5485be17 100644
--- a/drivers/gpu/drm/gma500/psb_intel_display.c
+++ b/drivers/gpu/drm/gma500/psb_intel_display.c
@@ -433,6 +433,9 @@ const struct drm_crtc_funcs psb_intel_crtc_funcs = {
 	.set_config = gma_crtc_set_config,
 	.destroy = gma_crtc_destroy,
 	.page_flip = gma_crtc_page_flip,
+	.enable_vblank = psb_enable_vblank,
+	.disable_vblank = psb_disable_vblank,
+	.get_vblank_counter = psb_get_vblank_counter,
 };
 
 const struct gma_clock_funcs psb_clock_funcs = {
diff --git a/drivers/gpu/drm/gma500/psb_irq.c b/drivers/gpu/drm/gma500/psb_irq.c
index 40a37e400b02..7ec031d28dc0 100644
--- a/drivers/gpu/drm/gma500/psb_irq.c
+++ b/drivers/gpu/drm/gma500/psb_irq.c
@@ -507,8 +507,10 @@ int psb_irq_disable_dpst(struct drm_device *dev)
 /*
  * It is used to enable VBLANK interrupt
  */
-int psb_enable_vblank(struct drm_device *dev, unsigned int pipe)
+int psb_enable_vblank(struct drm_crtc *crtc)
 {
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
 	struct drm_psb_private *dev_priv = dev->dev_private;
 	unsigned long irqflags;
 	uint32_t reg_val = 0;
@@ -546,8 +548,10 @@ int psb_enable_vblank(struct drm_device *dev, unsigned int pipe)
 /*
  * It is used to disable VBLANK interrupt
  */
-void psb_disable_vblank(struct drm_device *dev, unsigned int pipe)
+void psb_disable_vblank(struct drm_crtc *crtc)
 {
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
 	struct drm_psb_private *dev_priv = dev->dev_private;
 	unsigned long irqflags;
 
@@ -619,8 +623,10 @@ void mdfld_disable_te(struct drm_device *dev, int pipe)
 /* Called from drm generic code, passed a 'crtc', which
  * we use as a pipe index
  */
-u32 psb_get_vblank_counter(struct drm_device *dev, unsigned int pipe)
+u32 psb_get_vblank_counter(struct drm_crtc *crtc)
 {
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
 	uint32_t high_frame = PIPEAFRAMEHIGH;
 	uint32_t low_frame = PIPEAFRAMEPIXEL;
 	uint32_t pipeconf_reg = PIPEACONF;
diff --git a/drivers/gpu/drm/gma500/psb_irq.h b/drivers/gpu/drm/gma500/psb_irq.h
index 58fd502e3b9d..4f73998848d1 100644
--- a/drivers/gpu/drm/gma500/psb_irq.h
+++ b/drivers/gpu/drm/gma500/psb_irq.h
@@ -12,6 +12,7 @@
 #ifndef _PSB_IRQ_H_
 #define _PSB_IRQ_H_
 
+struct drm_crtc;
 struct drm_device;
 
 bool sysirq_init(struct drm_device *dev);
@@ -26,9 +27,9 @@ int psb_irq_enable_dpst(struct drm_device *dev);
 int psb_irq_disable_dpst(struct drm_device *dev);
 void psb_irq_turn_on_dpst(struct drm_device *dev);
 void psb_irq_turn_off_dpst(struct drm_device *dev);
-int  psb_enable_vblank(struct drm_device *dev, unsigned int pipe);
-void psb_disable_vblank(struct drm_device *dev, unsigned int pipe);
-u32  psb_get_vblank_counter(struct drm_device *dev, unsigned int pipe);
+int  psb_enable_vblank(struct drm_crtc *crtc);
+void psb_disable_vblank(struct drm_crtc *crtc);
+u32  psb_get_vblank_counter(struct drm_crtc *crtc);
 
 int mdfld_enable_te(struct drm_device *dev, int pipe);
 void mdfld_disable_te(struct drm_device *dev, int pipe);
-- 
2.24.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [Intel-gfx] [PATCH 13/23] drm/gma500: Convert to CRTC VBLANK callbacks
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

VBLANK callbacks in struct drm_driver are deprecated in favor of
their equivalents in struct drm_crtc_funcs. Convert gma500 over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 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 ++++---
 6 files changed, 22 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/gma500/cdv_intel_display.c b/drivers/gpu/drm/gma500/cdv_intel_display.c
index 1ed854f498b7..686385a66167 100644
--- a/drivers/gpu/drm/gma500/cdv_intel_display.c
+++ b/drivers/gpu/drm/gma500/cdv_intel_display.c
@@ -977,6 +977,9 @@ const struct drm_crtc_funcs cdv_intel_crtc_funcs = {
 	.set_config = gma_crtc_set_config,
 	.destroy = gma_crtc_destroy,
 	.page_flip = gma_crtc_page_flip,
+	.enable_vblank = psb_enable_vblank,
+	.disable_vblank = psb_disable_vblank,
+	.get_vblank_counter = psb_get_vblank_counter,
 };
 
 const struct gma_clock_funcs cdv_clock_funcs = {
diff --git a/drivers/gpu/drm/gma500/psb_drv.c b/drivers/gpu/drm/gma500/psb_drv.c
index 52591416f8fe..36cb292fdebe 100644
--- a/drivers/gpu/drm/gma500/psb_drv.c
+++ b/drivers/gpu/drm/gma500/psb_drv.c
@@ -363,7 +363,6 @@ static int psb_driver_load(struct drm_device *dev, unsigned long flags)
 	drm_irq_install(dev, dev->pdev->irq);
 
 	dev->max_vblank_count = 0xffffff; /* only 24 bits of frame count */
-	dev->driver->get_vblank_counter = psb_get_vblank_counter;
 
 	psb_modeset_init(dev);
 	psb_fbdev_init(dev);
@@ -507,9 +506,6 @@ static struct drm_driver driver = {
 	.irq_postinstall = psb_irq_postinstall,
 	.irq_uninstall = psb_irq_uninstall,
 	.irq_handler = psb_irq_handler,
-	.enable_vblank = psb_enable_vblank,
-	.disable_vblank = psb_disable_vblank,
-	.get_vblank_counter = psb_get_vblank_counter,
 
 	.gem_free_object = psb_gem_free_object,
 	.gem_vm_ops = &psb_gem_vm_ops,
diff --git a/drivers/gpu/drm/gma500/psb_drv.h b/drivers/gpu/drm/gma500/psb_drv.h
index 3d4ef3071d45..956926341316 100644
--- a/drivers/gpu/drm/gma500/psb_drv.h
+++ b/drivers/gpu/drm/gma500/psb_drv.h
@@ -681,15 +681,15 @@ extern void psb_irq_turn_off_dpst(struct drm_device *dev);
 extern void psb_irq_uninstall_islands(struct drm_device *dev, int hw_islands);
 extern int psb_vblank_wait2(struct drm_device *dev, unsigned int *sequence);
 extern int psb_vblank_wait(struct drm_device *dev, unsigned int *sequence);
-extern int psb_enable_vblank(struct drm_device *dev, unsigned int pipe);
-extern void psb_disable_vblank(struct drm_device *dev, unsigned int pipe);
+extern int psb_enable_vblank(struct drm_crtc *crtc);
+extern void psb_disable_vblank(struct drm_crtc *crtc);
 void
 psb_enable_pipestat(struct drm_psb_private *dev_priv, int pipe, u32 mask);
 
 void
 psb_disable_pipestat(struct drm_psb_private *dev_priv, int pipe, u32 mask);
 
-extern u32 psb_get_vblank_counter(struct drm_device *dev, unsigned int pipe);
+extern u32 psb_get_vblank_counter(struct drm_crtc *crtc);
 
 /* framebuffer.c */
 extern int psbfb_probed(struct drm_device *dev);
diff --git a/drivers/gpu/drm/gma500/psb_intel_display.c b/drivers/gpu/drm/gma500/psb_intel_display.c
index fed3b563e62e..531c5485be17 100644
--- a/drivers/gpu/drm/gma500/psb_intel_display.c
+++ b/drivers/gpu/drm/gma500/psb_intel_display.c
@@ -433,6 +433,9 @@ const struct drm_crtc_funcs psb_intel_crtc_funcs = {
 	.set_config = gma_crtc_set_config,
 	.destroy = gma_crtc_destroy,
 	.page_flip = gma_crtc_page_flip,
+	.enable_vblank = psb_enable_vblank,
+	.disable_vblank = psb_disable_vblank,
+	.get_vblank_counter = psb_get_vblank_counter,
 };
 
 const struct gma_clock_funcs psb_clock_funcs = {
diff --git a/drivers/gpu/drm/gma500/psb_irq.c b/drivers/gpu/drm/gma500/psb_irq.c
index 40a37e400b02..7ec031d28dc0 100644
--- a/drivers/gpu/drm/gma500/psb_irq.c
+++ b/drivers/gpu/drm/gma500/psb_irq.c
@@ -507,8 +507,10 @@ int psb_irq_disable_dpst(struct drm_device *dev)
 /*
  * It is used to enable VBLANK interrupt
  */
-int psb_enable_vblank(struct drm_device *dev, unsigned int pipe)
+int psb_enable_vblank(struct drm_crtc *crtc)
 {
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
 	struct drm_psb_private *dev_priv = dev->dev_private;
 	unsigned long irqflags;
 	uint32_t reg_val = 0;
@@ -546,8 +548,10 @@ int psb_enable_vblank(struct drm_device *dev, unsigned int pipe)
 /*
  * It is used to disable VBLANK interrupt
  */
-void psb_disable_vblank(struct drm_device *dev, unsigned int pipe)
+void psb_disable_vblank(struct drm_crtc *crtc)
 {
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
 	struct drm_psb_private *dev_priv = dev->dev_private;
 	unsigned long irqflags;
 
@@ -619,8 +623,10 @@ void mdfld_disable_te(struct drm_device *dev, int pipe)
 /* Called from drm generic code, passed a 'crtc', which
  * we use as a pipe index
  */
-u32 psb_get_vblank_counter(struct drm_device *dev, unsigned int pipe)
+u32 psb_get_vblank_counter(struct drm_crtc *crtc)
 {
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
 	uint32_t high_frame = PIPEAFRAMEHIGH;
 	uint32_t low_frame = PIPEAFRAMEPIXEL;
 	uint32_t pipeconf_reg = PIPEACONF;
diff --git a/drivers/gpu/drm/gma500/psb_irq.h b/drivers/gpu/drm/gma500/psb_irq.h
index 58fd502e3b9d..4f73998848d1 100644
--- a/drivers/gpu/drm/gma500/psb_irq.h
+++ b/drivers/gpu/drm/gma500/psb_irq.h
@@ -12,6 +12,7 @@
 #ifndef _PSB_IRQ_H_
 #define _PSB_IRQ_H_
 
+struct drm_crtc;
 struct drm_device;
 
 bool sysirq_init(struct drm_device *dev);
@@ -26,9 +27,9 @@ int psb_irq_enable_dpst(struct drm_device *dev);
 int psb_irq_disable_dpst(struct drm_device *dev);
 void psb_irq_turn_on_dpst(struct drm_device *dev);
 void psb_irq_turn_off_dpst(struct drm_device *dev);
-int  psb_enable_vblank(struct drm_device *dev, unsigned int pipe);
-void psb_disable_vblank(struct drm_device *dev, unsigned int pipe);
-u32  psb_get_vblank_counter(struct drm_device *dev, unsigned int pipe);
+int  psb_enable_vblank(struct drm_crtc *crtc);
+void psb_disable_vblank(struct drm_crtc *crtc);
+u32  psb_get_vblank_counter(struct drm_crtc *crtc);
 
 int mdfld_enable_te(struct drm_device *dev, int pipe);
 void mdfld_disable_te(struct drm_device *dev, int pipe);
-- 
2.24.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 13/23] drm/gma500: Convert to CRTC VBLANK callbacks
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

VBLANK callbacks in struct drm_driver are deprecated in favor of
their equivalents in struct drm_crtc_funcs. Convert gma500 over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 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 ++++---
 6 files changed, 22 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/gma500/cdv_intel_display.c b/drivers/gpu/drm/gma500/cdv_intel_display.c
index 1ed854f498b7..686385a66167 100644
--- a/drivers/gpu/drm/gma500/cdv_intel_display.c
+++ b/drivers/gpu/drm/gma500/cdv_intel_display.c
@@ -977,6 +977,9 @@ const struct drm_crtc_funcs cdv_intel_crtc_funcs = {
 	.set_config = gma_crtc_set_config,
 	.destroy = gma_crtc_destroy,
 	.page_flip = gma_crtc_page_flip,
+	.enable_vblank = psb_enable_vblank,
+	.disable_vblank = psb_disable_vblank,
+	.get_vblank_counter = psb_get_vblank_counter,
 };
 
 const struct gma_clock_funcs cdv_clock_funcs = {
diff --git a/drivers/gpu/drm/gma500/psb_drv.c b/drivers/gpu/drm/gma500/psb_drv.c
index 52591416f8fe..36cb292fdebe 100644
--- a/drivers/gpu/drm/gma500/psb_drv.c
+++ b/drivers/gpu/drm/gma500/psb_drv.c
@@ -363,7 +363,6 @@ static int psb_driver_load(struct drm_device *dev, unsigned long flags)
 	drm_irq_install(dev, dev->pdev->irq);
 
 	dev->max_vblank_count = 0xffffff; /* only 24 bits of frame count */
-	dev->driver->get_vblank_counter = psb_get_vblank_counter;
 
 	psb_modeset_init(dev);
 	psb_fbdev_init(dev);
@@ -507,9 +506,6 @@ static struct drm_driver driver = {
 	.irq_postinstall = psb_irq_postinstall,
 	.irq_uninstall = psb_irq_uninstall,
 	.irq_handler = psb_irq_handler,
-	.enable_vblank = psb_enable_vblank,
-	.disable_vblank = psb_disable_vblank,
-	.get_vblank_counter = psb_get_vblank_counter,
 
 	.gem_free_object = psb_gem_free_object,
 	.gem_vm_ops = &psb_gem_vm_ops,
diff --git a/drivers/gpu/drm/gma500/psb_drv.h b/drivers/gpu/drm/gma500/psb_drv.h
index 3d4ef3071d45..956926341316 100644
--- a/drivers/gpu/drm/gma500/psb_drv.h
+++ b/drivers/gpu/drm/gma500/psb_drv.h
@@ -681,15 +681,15 @@ extern void psb_irq_turn_off_dpst(struct drm_device *dev);
 extern void psb_irq_uninstall_islands(struct drm_device *dev, int hw_islands);
 extern int psb_vblank_wait2(struct drm_device *dev, unsigned int *sequence);
 extern int psb_vblank_wait(struct drm_device *dev, unsigned int *sequence);
-extern int psb_enable_vblank(struct drm_device *dev, unsigned int pipe);
-extern void psb_disable_vblank(struct drm_device *dev, unsigned int pipe);
+extern int psb_enable_vblank(struct drm_crtc *crtc);
+extern void psb_disable_vblank(struct drm_crtc *crtc);
 void
 psb_enable_pipestat(struct drm_psb_private *dev_priv, int pipe, u32 mask);
 
 void
 psb_disable_pipestat(struct drm_psb_private *dev_priv, int pipe, u32 mask);
 
-extern u32 psb_get_vblank_counter(struct drm_device *dev, unsigned int pipe);
+extern u32 psb_get_vblank_counter(struct drm_crtc *crtc);
 
 /* framebuffer.c */
 extern int psbfb_probed(struct drm_device *dev);
diff --git a/drivers/gpu/drm/gma500/psb_intel_display.c b/drivers/gpu/drm/gma500/psb_intel_display.c
index fed3b563e62e..531c5485be17 100644
--- a/drivers/gpu/drm/gma500/psb_intel_display.c
+++ b/drivers/gpu/drm/gma500/psb_intel_display.c
@@ -433,6 +433,9 @@ const struct drm_crtc_funcs psb_intel_crtc_funcs = {
 	.set_config = gma_crtc_set_config,
 	.destroy = gma_crtc_destroy,
 	.page_flip = gma_crtc_page_flip,
+	.enable_vblank = psb_enable_vblank,
+	.disable_vblank = psb_disable_vblank,
+	.get_vblank_counter = psb_get_vblank_counter,
 };
 
 const struct gma_clock_funcs psb_clock_funcs = {
diff --git a/drivers/gpu/drm/gma500/psb_irq.c b/drivers/gpu/drm/gma500/psb_irq.c
index 40a37e400b02..7ec031d28dc0 100644
--- a/drivers/gpu/drm/gma500/psb_irq.c
+++ b/drivers/gpu/drm/gma500/psb_irq.c
@@ -507,8 +507,10 @@ int psb_irq_disable_dpst(struct drm_device *dev)
 /*
  * It is used to enable VBLANK interrupt
  */
-int psb_enable_vblank(struct drm_device *dev, unsigned int pipe)
+int psb_enable_vblank(struct drm_crtc *crtc)
 {
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
 	struct drm_psb_private *dev_priv = dev->dev_private;
 	unsigned long irqflags;
 	uint32_t reg_val = 0;
@@ -546,8 +548,10 @@ int psb_enable_vblank(struct drm_device *dev, unsigned int pipe)
 /*
  * It is used to disable VBLANK interrupt
  */
-void psb_disable_vblank(struct drm_device *dev, unsigned int pipe)
+void psb_disable_vblank(struct drm_crtc *crtc)
 {
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
 	struct drm_psb_private *dev_priv = dev->dev_private;
 	unsigned long irqflags;
 
@@ -619,8 +623,10 @@ void mdfld_disable_te(struct drm_device *dev, int pipe)
 /* Called from drm generic code, passed a 'crtc', which
  * we use as a pipe index
  */
-u32 psb_get_vblank_counter(struct drm_device *dev, unsigned int pipe)
+u32 psb_get_vblank_counter(struct drm_crtc *crtc)
 {
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
 	uint32_t high_frame = PIPEAFRAMEHIGH;
 	uint32_t low_frame = PIPEAFRAMEPIXEL;
 	uint32_t pipeconf_reg = PIPEACONF;
diff --git a/drivers/gpu/drm/gma500/psb_irq.h b/drivers/gpu/drm/gma500/psb_irq.h
index 58fd502e3b9d..4f73998848d1 100644
--- a/drivers/gpu/drm/gma500/psb_irq.h
+++ b/drivers/gpu/drm/gma500/psb_irq.h
@@ -12,6 +12,7 @@
 #ifndef _PSB_IRQ_H_
 #define _PSB_IRQ_H_
 
+struct drm_crtc;
 struct drm_device;
 
 bool sysirq_init(struct drm_device *dev);
@@ -26,9 +27,9 @@ int psb_irq_enable_dpst(struct drm_device *dev);
 int psb_irq_disable_dpst(struct drm_device *dev);
 void psb_irq_turn_on_dpst(struct drm_device *dev);
 void psb_irq_turn_off_dpst(struct drm_device *dev);
-int  psb_enable_vblank(struct drm_device *dev, unsigned int pipe);
-void psb_disable_vblank(struct drm_device *dev, unsigned int pipe);
-u32  psb_get_vblank_counter(struct drm_device *dev, unsigned int pipe);
+int  psb_enable_vblank(struct drm_crtc *crtc);
+void psb_disable_vblank(struct drm_crtc *crtc);
+u32  psb_get_vblank_counter(struct drm_crtc *crtc);
 
 int mdfld_enable_te(struct drm_device *dev, int pipe);
 void mdfld_disable_te(struct drm_device *dev, int pipe);
-- 
2.24.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 14/23] drm/i915: Convert to CRTC VBLANK callbacks
  2020-01-10  9:21 ` Thomas Zimmermann
  (?)
  (?)
@ 2020-01-10  9:21   ` Thomas Zimmermann
  -1 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: dri-devel, amd-gfx, intel-gfx, linux-arm-msm, freedreno, nouveau,
	Thomas Zimmermann

VBLANK callbacks in struct drm_driver are deprecated in favor of
their equivalents in struct drm_crtc_funcs. Convert i915 over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/i915/display/intel_display.c |  7 +++++++
 drivers/gpu/drm/i915/i915_drv.c              |  2 --
 drivers/gpu/drm/i915/i915_irq.c              | 13 +++----------
 drivers/gpu/drm/i915/i915_irq.h              |  3 +--
 4 files changed, 11 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index da5266e76738..515788698298 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -16227,6 +16227,7 @@ static const struct drm_crtc_funcs bdw_crtc_funcs = {
 	.get_vblank_counter = g4x_get_vblank_counter,
 	.enable_vblank = bdw_enable_vblank,
 	.disable_vblank = bdw_disable_vblank,
+	.get_vblank_timestamp = i915_calc_vbltimestamp_from_scanoutpos,
 };
 
 static const struct drm_crtc_funcs ilk_crtc_funcs = {
@@ -16235,6 +16236,7 @@ static const struct drm_crtc_funcs ilk_crtc_funcs = {
 	.get_vblank_counter = g4x_get_vblank_counter,
 	.enable_vblank = ilk_enable_vblank,
 	.disable_vblank = ilk_disable_vblank,
+	.get_vblank_timestamp = i915_calc_vbltimestamp_from_scanoutpos,
 };
 
 static const struct drm_crtc_funcs g4x_crtc_funcs = {
@@ -16243,6 +16245,7 @@ static const struct drm_crtc_funcs g4x_crtc_funcs = {
 	.get_vblank_counter = g4x_get_vblank_counter,
 	.enable_vblank = i965_enable_vblank,
 	.disable_vblank = i965_disable_vblank,
+	.get_vblank_timestamp = i915_calc_vbltimestamp_from_scanoutpos,
 };
 
 static const struct drm_crtc_funcs i965_crtc_funcs = {
@@ -16251,6 +16254,7 @@ static const struct drm_crtc_funcs i965_crtc_funcs = {
 	.get_vblank_counter = i915_get_vblank_counter,
 	.enable_vblank = i965_enable_vblank,
 	.disable_vblank = i965_disable_vblank,
+	.get_vblank_timestamp = i915_calc_vbltimestamp_from_scanoutpos,
 };
 
 static const struct drm_crtc_funcs i915gm_crtc_funcs = {
@@ -16259,6 +16263,7 @@ static const struct drm_crtc_funcs i915gm_crtc_funcs = {
 	.get_vblank_counter = i915_get_vblank_counter,
 	.enable_vblank = i915gm_enable_vblank,
 	.disable_vblank = i915gm_disable_vblank,
+	.get_vblank_timestamp = i915_calc_vbltimestamp_from_scanoutpos,
 };
 
 static const struct drm_crtc_funcs i915_crtc_funcs = {
@@ -16267,6 +16272,7 @@ static const struct drm_crtc_funcs i915_crtc_funcs = {
 	.get_vblank_counter = i915_get_vblank_counter,
 	.enable_vblank = i8xx_enable_vblank,
 	.disable_vblank = i8xx_disable_vblank,
+	.get_vblank_timestamp = i915_calc_vbltimestamp_from_scanoutpos,
 };
 
 static const struct drm_crtc_funcs i8xx_crtc_funcs = {
@@ -16275,6 +16281,7 @@ static const struct drm_crtc_funcs i8xx_crtc_funcs = {
 	/* no hw vblank counter */
 	.enable_vblank = i8xx_enable_vblank,
 	.disable_vblank = i8xx_disable_vblank,
+	.get_vblank_timestamp = i915_calc_vbltimestamp_from_scanoutpos,
 };
 
 static struct intel_crtc *intel_crtc_alloc(void)
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 4a0a7fb85c53..30b9ba136a81 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -2769,8 +2769,6 @@ static struct drm_driver driver = {
 	.gem_prime_export = i915_gem_prime_export,
 	.gem_prime_import = i915_gem_prime_import,
 
-	.get_vblank_timestamp = i915_calc_vbltimestamp_from_scanoutpos,
-
 	.dumb_create = i915_gem_dumb_create,
 	.dumb_map_offset = i915_gem_dumb_mmap_offset,
 
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index 99d0c3b0feae..dbbbdff8fa89 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -885,28 +885,21 @@ static bool i915_get_crtc_scanoutpos(struct drm_device *dev,
 	return true;
 }
 
-bool i915_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
-					    unsigned int pipe,
+bool i915_calc_vbltimestamp_from_scanoutpos(struct drm_crtc *crtc,
 					    int *max_error,
 					    ktime_t *vblank_time,
 					    bool in_vblank_irq)
 {
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
 	struct timespec64 ts_etime, ts_vblank_time;
 	ktime_t stime, etime;
 	bool vbl_status;
-	struct drm_crtc *crtc;
 	const struct drm_display_mode *mode;
 	struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
 	int vpos, hpos, i;
 	int delta_ns, duration_ns;
 
-	crtc = drm_crtc_from_index(dev, pipe);
-
-	if (pipe >= dev->num_crtcs || !crtc) {
-		DRM_ERROR("Invalid crtc %u\n", pipe);
-		return false;
-	}
-
 	if (drm_drv_uses_atomic_modeset(dev))
 		mode = &vblank->hwmode;
 	else
diff --git a/drivers/gpu/drm/i915/i915_irq.h b/drivers/gpu/drm/i915/i915_irq.h
index 5f7b133ce721..756577a7a384 100644
--- a/drivers/gpu/drm/i915/i915_irq.h
+++ b/drivers/gpu/drm/i915/i915_irq.h
@@ -101,8 +101,7 @@ void gen8_irq_power_well_post_enable(struct drm_i915_private *dev_priv,
 void gen8_irq_power_well_pre_disable(struct drm_i915_private *dev_priv,
 				     u8 pipe_mask);
 
-bool i915_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
-					    unsigned int pipe,
+bool i915_calc_vbltimestamp_from_scanoutpos(struct drm_crtc *crtc,
 					    int *max_error,
 					    ktime_t *vblank_time,
 					    bool in_vblank_irq);
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 14/23] drm/i915: Convert to CRTC VBLANK callbacks
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

VBLANK callbacks in struct drm_driver are deprecated in favor of
their equivalents in struct drm_crtc_funcs. Convert i915 over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/i915/display/intel_display.c |  7 +++++++
 drivers/gpu/drm/i915/i915_drv.c              |  2 --
 drivers/gpu/drm/i915/i915_irq.c              | 13 +++----------
 drivers/gpu/drm/i915/i915_irq.h              |  3 +--
 4 files changed, 11 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index da5266e76738..515788698298 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -16227,6 +16227,7 @@ static const struct drm_crtc_funcs bdw_crtc_funcs = {
 	.get_vblank_counter = g4x_get_vblank_counter,
 	.enable_vblank = bdw_enable_vblank,
 	.disable_vblank = bdw_disable_vblank,
+	.get_vblank_timestamp = i915_calc_vbltimestamp_from_scanoutpos,
 };
 
 static const struct drm_crtc_funcs ilk_crtc_funcs = {
@@ -16235,6 +16236,7 @@ static const struct drm_crtc_funcs ilk_crtc_funcs = {
 	.get_vblank_counter = g4x_get_vblank_counter,
 	.enable_vblank = ilk_enable_vblank,
 	.disable_vblank = ilk_disable_vblank,
+	.get_vblank_timestamp = i915_calc_vbltimestamp_from_scanoutpos,
 };
 
 static const struct drm_crtc_funcs g4x_crtc_funcs = {
@@ -16243,6 +16245,7 @@ static const struct drm_crtc_funcs g4x_crtc_funcs = {
 	.get_vblank_counter = g4x_get_vblank_counter,
 	.enable_vblank = i965_enable_vblank,
 	.disable_vblank = i965_disable_vblank,
+	.get_vblank_timestamp = i915_calc_vbltimestamp_from_scanoutpos,
 };
 
 static const struct drm_crtc_funcs i965_crtc_funcs = {
@@ -16251,6 +16254,7 @@ static const struct drm_crtc_funcs i965_crtc_funcs = {
 	.get_vblank_counter = i915_get_vblank_counter,
 	.enable_vblank = i965_enable_vblank,
 	.disable_vblank = i965_disable_vblank,
+	.get_vblank_timestamp = i915_calc_vbltimestamp_from_scanoutpos,
 };
 
 static const struct drm_crtc_funcs i915gm_crtc_funcs = {
@@ -16259,6 +16263,7 @@ static const struct drm_crtc_funcs i915gm_crtc_funcs = {
 	.get_vblank_counter = i915_get_vblank_counter,
 	.enable_vblank = i915gm_enable_vblank,
 	.disable_vblank = i915gm_disable_vblank,
+	.get_vblank_timestamp = i915_calc_vbltimestamp_from_scanoutpos,
 };
 
 static const struct drm_crtc_funcs i915_crtc_funcs = {
@@ -16267,6 +16272,7 @@ static const struct drm_crtc_funcs i915_crtc_funcs = {
 	.get_vblank_counter = i915_get_vblank_counter,
 	.enable_vblank = i8xx_enable_vblank,
 	.disable_vblank = i8xx_disable_vblank,
+	.get_vblank_timestamp = i915_calc_vbltimestamp_from_scanoutpos,
 };
 
 static const struct drm_crtc_funcs i8xx_crtc_funcs = {
@@ -16275,6 +16281,7 @@ static const struct drm_crtc_funcs i8xx_crtc_funcs = {
 	/* no hw vblank counter */
 	.enable_vblank = i8xx_enable_vblank,
 	.disable_vblank = i8xx_disable_vblank,
+	.get_vblank_timestamp = i915_calc_vbltimestamp_from_scanoutpos,
 };
 
 static struct intel_crtc *intel_crtc_alloc(void)
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 4a0a7fb85c53..30b9ba136a81 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -2769,8 +2769,6 @@ static struct drm_driver driver = {
 	.gem_prime_export = i915_gem_prime_export,
 	.gem_prime_import = i915_gem_prime_import,
 
-	.get_vblank_timestamp = i915_calc_vbltimestamp_from_scanoutpos,
-
 	.dumb_create = i915_gem_dumb_create,
 	.dumb_map_offset = i915_gem_dumb_mmap_offset,
 
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index 99d0c3b0feae..dbbbdff8fa89 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -885,28 +885,21 @@ static bool i915_get_crtc_scanoutpos(struct drm_device *dev,
 	return true;
 }
 
-bool i915_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
-					    unsigned int pipe,
+bool i915_calc_vbltimestamp_from_scanoutpos(struct drm_crtc *crtc,
 					    int *max_error,
 					    ktime_t *vblank_time,
 					    bool in_vblank_irq)
 {
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
 	struct timespec64 ts_etime, ts_vblank_time;
 	ktime_t stime, etime;
 	bool vbl_status;
-	struct drm_crtc *crtc;
 	const struct drm_display_mode *mode;
 	struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
 	int vpos, hpos, i;
 	int delta_ns, duration_ns;
 
-	crtc = drm_crtc_from_index(dev, pipe);
-
-	if (pipe >= dev->num_crtcs || !crtc) {
-		DRM_ERROR("Invalid crtc %u\n", pipe);
-		return false;
-	}
-
 	if (drm_drv_uses_atomic_modeset(dev))
 		mode = &vblank->hwmode;
 	else
diff --git a/drivers/gpu/drm/i915/i915_irq.h b/drivers/gpu/drm/i915/i915_irq.h
index 5f7b133ce721..756577a7a384 100644
--- a/drivers/gpu/drm/i915/i915_irq.h
+++ b/drivers/gpu/drm/i915/i915_irq.h
@@ -101,8 +101,7 @@ void gen8_irq_power_well_post_enable(struct drm_i915_private *dev_priv,
 void gen8_irq_power_well_pre_disable(struct drm_i915_private *dev_priv,
 				     u8 pipe_mask);
 
-bool i915_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
-					    unsigned int pipe,
+bool i915_calc_vbltimestamp_from_scanoutpos(struct drm_crtc *crtc,
 					    int *max_error,
 					    ktime_t *vblank_time,
 					    bool in_vblank_irq);
-- 
2.24.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [Intel-gfx] [PATCH 14/23] drm/i915: Convert to CRTC VBLANK callbacks
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

VBLANK callbacks in struct drm_driver are deprecated in favor of
their equivalents in struct drm_crtc_funcs. Convert i915 over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/i915/display/intel_display.c |  7 +++++++
 drivers/gpu/drm/i915/i915_drv.c              |  2 --
 drivers/gpu/drm/i915/i915_irq.c              | 13 +++----------
 drivers/gpu/drm/i915/i915_irq.h              |  3 +--
 4 files changed, 11 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index da5266e76738..515788698298 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -16227,6 +16227,7 @@ static const struct drm_crtc_funcs bdw_crtc_funcs = {
 	.get_vblank_counter = g4x_get_vblank_counter,
 	.enable_vblank = bdw_enable_vblank,
 	.disable_vblank = bdw_disable_vblank,
+	.get_vblank_timestamp = i915_calc_vbltimestamp_from_scanoutpos,
 };
 
 static const struct drm_crtc_funcs ilk_crtc_funcs = {
@@ -16235,6 +16236,7 @@ static const struct drm_crtc_funcs ilk_crtc_funcs = {
 	.get_vblank_counter = g4x_get_vblank_counter,
 	.enable_vblank = ilk_enable_vblank,
 	.disable_vblank = ilk_disable_vblank,
+	.get_vblank_timestamp = i915_calc_vbltimestamp_from_scanoutpos,
 };
 
 static const struct drm_crtc_funcs g4x_crtc_funcs = {
@@ -16243,6 +16245,7 @@ static const struct drm_crtc_funcs g4x_crtc_funcs = {
 	.get_vblank_counter = g4x_get_vblank_counter,
 	.enable_vblank = i965_enable_vblank,
 	.disable_vblank = i965_disable_vblank,
+	.get_vblank_timestamp = i915_calc_vbltimestamp_from_scanoutpos,
 };
 
 static const struct drm_crtc_funcs i965_crtc_funcs = {
@@ -16251,6 +16254,7 @@ static const struct drm_crtc_funcs i965_crtc_funcs = {
 	.get_vblank_counter = i915_get_vblank_counter,
 	.enable_vblank = i965_enable_vblank,
 	.disable_vblank = i965_disable_vblank,
+	.get_vblank_timestamp = i915_calc_vbltimestamp_from_scanoutpos,
 };
 
 static const struct drm_crtc_funcs i915gm_crtc_funcs = {
@@ -16259,6 +16263,7 @@ static const struct drm_crtc_funcs i915gm_crtc_funcs = {
 	.get_vblank_counter = i915_get_vblank_counter,
 	.enable_vblank = i915gm_enable_vblank,
 	.disable_vblank = i915gm_disable_vblank,
+	.get_vblank_timestamp = i915_calc_vbltimestamp_from_scanoutpos,
 };
 
 static const struct drm_crtc_funcs i915_crtc_funcs = {
@@ -16267,6 +16272,7 @@ static const struct drm_crtc_funcs i915_crtc_funcs = {
 	.get_vblank_counter = i915_get_vblank_counter,
 	.enable_vblank = i8xx_enable_vblank,
 	.disable_vblank = i8xx_disable_vblank,
+	.get_vblank_timestamp = i915_calc_vbltimestamp_from_scanoutpos,
 };
 
 static const struct drm_crtc_funcs i8xx_crtc_funcs = {
@@ -16275,6 +16281,7 @@ static const struct drm_crtc_funcs i8xx_crtc_funcs = {
 	/* no hw vblank counter */
 	.enable_vblank = i8xx_enable_vblank,
 	.disable_vblank = i8xx_disable_vblank,
+	.get_vblank_timestamp = i915_calc_vbltimestamp_from_scanoutpos,
 };
 
 static struct intel_crtc *intel_crtc_alloc(void)
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 4a0a7fb85c53..30b9ba136a81 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -2769,8 +2769,6 @@ static struct drm_driver driver = {
 	.gem_prime_export = i915_gem_prime_export,
 	.gem_prime_import = i915_gem_prime_import,
 
-	.get_vblank_timestamp = i915_calc_vbltimestamp_from_scanoutpos,
-
 	.dumb_create = i915_gem_dumb_create,
 	.dumb_map_offset = i915_gem_dumb_mmap_offset,
 
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index 99d0c3b0feae..dbbbdff8fa89 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -885,28 +885,21 @@ static bool i915_get_crtc_scanoutpos(struct drm_device *dev,
 	return true;
 }
 
-bool i915_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
-					    unsigned int pipe,
+bool i915_calc_vbltimestamp_from_scanoutpos(struct drm_crtc *crtc,
 					    int *max_error,
 					    ktime_t *vblank_time,
 					    bool in_vblank_irq)
 {
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
 	struct timespec64 ts_etime, ts_vblank_time;
 	ktime_t stime, etime;
 	bool vbl_status;
-	struct drm_crtc *crtc;
 	const struct drm_display_mode *mode;
 	struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
 	int vpos, hpos, i;
 	int delta_ns, duration_ns;
 
-	crtc = drm_crtc_from_index(dev, pipe);
-
-	if (pipe >= dev->num_crtcs || !crtc) {
-		DRM_ERROR("Invalid crtc %u\n", pipe);
-		return false;
-	}
-
 	if (drm_drv_uses_atomic_modeset(dev))
 		mode = &vblank->hwmode;
 	else
diff --git a/drivers/gpu/drm/i915/i915_irq.h b/drivers/gpu/drm/i915/i915_irq.h
index 5f7b133ce721..756577a7a384 100644
--- a/drivers/gpu/drm/i915/i915_irq.h
+++ b/drivers/gpu/drm/i915/i915_irq.h
@@ -101,8 +101,7 @@ void gen8_irq_power_well_post_enable(struct drm_i915_private *dev_priv,
 void gen8_irq_power_well_pre_disable(struct drm_i915_private *dev_priv,
 				     u8 pipe_mask);
 
-bool i915_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
-					    unsigned int pipe,
+bool i915_calc_vbltimestamp_from_scanoutpos(struct drm_crtc *crtc,
 					    int *max_error,
 					    ktime_t *vblank_time,
 					    bool in_vblank_irq);
-- 
2.24.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 14/23] drm/i915: Convert to CRTC VBLANK callbacks
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

VBLANK callbacks in struct drm_driver are deprecated in favor of
their equivalents in struct drm_crtc_funcs. Convert i915 over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/i915/display/intel_display.c |  7 +++++++
 drivers/gpu/drm/i915/i915_drv.c              |  2 --
 drivers/gpu/drm/i915/i915_irq.c              | 13 +++----------
 drivers/gpu/drm/i915/i915_irq.h              |  3 +--
 4 files changed, 11 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index da5266e76738..515788698298 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -16227,6 +16227,7 @@ static const struct drm_crtc_funcs bdw_crtc_funcs = {
 	.get_vblank_counter = g4x_get_vblank_counter,
 	.enable_vblank = bdw_enable_vblank,
 	.disable_vblank = bdw_disable_vblank,
+	.get_vblank_timestamp = i915_calc_vbltimestamp_from_scanoutpos,
 };
 
 static const struct drm_crtc_funcs ilk_crtc_funcs = {
@@ -16235,6 +16236,7 @@ static const struct drm_crtc_funcs ilk_crtc_funcs = {
 	.get_vblank_counter = g4x_get_vblank_counter,
 	.enable_vblank = ilk_enable_vblank,
 	.disable_vblank = ilk_disable_vblank,
+	.get_vblank_timestamp = i915_calc_vbltimestamp_from_scanoutpos,
 };
 
 static const struct drm_crtc_funcs g4x_crtc_funcs = {
@@ -16243,6 +16245,7 @@ static const struct drm_crtc_funcs g4x_crtc_funcs = {
 	.get_vblank_counter = g4x_get_vblank_counter,
 	.enable_vblank = i965_enable_vblank,
 	.disable_vblank = i965_disable_vblank,
+	.get_vblank_timestamp = i915_calc_vbltimestamp_from_scanoutpos,
 };
 
 static const struct drm_crtc_funcs i965_crtc_funcs = {
@@ -16251,6 +16254,7 @@ static const struct drm_crtc_funcs i965_crtc_funcs = {
 	.get_vblank_counter = i915_get_vblank_counter,
 	.enable_vblank = i965_enable_vblank,
 	.disable_vblank = i965_disable_vblank,
+	.get_vblank_timestamp = i915_calc_vbltimestamp_from_scanoutpos,
 };
 
 static const struct drm_crtc_funcs i915gm_crtc_funcs = {
@@ -16259,6 +16263,7 @@ static const struct drm_crtc_funcs i915gm_crtc_funcs = {
 	.get_vblank_counter = i915_get_vblank_counter,
 	.enable_vblank = i915gm_enable_vblank,
 	.disable_vblank = i915gm_disable_vblank,
+	.get_vblank_timestamp = i915_calc_vbltimestamp_from_scanoutpos,
 };
 
 static const struct drm_crtc_funcs i915_crtc_funcs = {
@@ -16267,6 +16272,7 @@ static const struct drm_crtc_funcs i915_crtc_funcs = {
 	.get_vblank_counter = i915_get_vblank_counter,
 	.enable_vblank = i8xx_enable_vblank,
 	.disable_vblank = i8xx_disable_vblank,
+	.get_vblank_timestamp = i915_calc_vbltimestamp_from_scanoutpos,
 };
 
 static const struct drm_crtc_funcs i8xx_crtc_funcs = {
@@ -16275,6 +16281,7 @@ static const struct drm_crtc_funcs i8xx_crtc_funcs = {
 	/* no hw vblank counter */
 	.enable_vblank = i8xx_enable_vblank,
 	.disable_vblank = i8xx_disable_vblank,
+	.get_vblank_timestamp = i915_calc_vbltimestamp_from_scanoutpos,
 };
 
 static struct intel_crtc *intel_crtc_alloc(void)
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 4a0a7fb85c53..30b9ba136a81 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -2769,8 +2769,6 @@ static struct drm_driver driver = {
 	.gem_prime_export = i915_gem_prime_export,
 	.gem_prime_import = i915_gem_prime_import,
 
-	.get_vblank_timestamp = i915_calc_vbltimestamp_from_scanoutpos,
-
 	.dumb_create = i915_gem_dumb_create,
 	.dumb_map_offset = i915_gem_dumb_mmap_offset,
 
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index 99d0c3b0feae..dbbbdff8fa89 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -885,28 +885,21 @@ static bool i915_get_crtc_scanoutpos(struct drm_device *dev,
 	return true;
 }
 
-bool i915_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
-					    unsigned int pipe,
+bool i915_calc_vbltimestamp_from_scanoutpos(struct drm_crtc *crtc,
 					    int *max_error,
 					    ktime_t *vblank_time,
 					    bool in_vblank_irq)
 {
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
 	struct timespec64 ts_etime, ts_vblank_time;
 	ktime_t stime, etime;
 	bool vbl_status;
-	struct drm_crtc *crtc;
 	const struct drm_display_mode *mode;
 	struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
 	int vpos, hpos, i;
 	int delta_ns, duration_ns;
 
-	crtc = drm_crtc_from_index(dev, pipe);
-
-	if (pipe >= dev->num_crtcs || !crtc) {
-		DRM_ERROR("Invalid crtc %u\n", pipe);
-		return false;
-	}
-
 	if (drm_drv_uses_atomic_modeset(dev))
 		mode = &vblank->hwmode;
 	else
diff --git a/drivers/gpu/drm/i915/i915_irq.h b/drivers/gpu/drm/i915/i915_irq.h
index 5f7b133ce721..756577a7a384 100644
--- a/drivers/gpu/drm/i915/i915_irq.h
+++ b/drivers/gpu/drm/i915/i915_irq.h
@@ -101,8 +101,7 @@ void gen8_irq_power_well_post_enable(struct drm_i915_private *dev_priv,
 void gen8_irq_power_well_pre_disable(struct drm_i915_private *dev_priv,
 				     u8 pipe_mask);
 
-bool i915_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
-					    unsigned int pipe,
+bool i915_calc_vbltimestamp_from_scanoutpos(struct drm_crtc *crtc,
 					    int *max_error,
 					    ktime_t *vblank_time,
 					    bool in_vblank_irq);
-- 
2.24.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 15/23] drm/msm: Convert to CRTC VBLANK callbacks
  2020-01-10  9:21 ` Thomas Zimmermann
                     ` (2 preceding siblings ...)
  (?)
@ 2020-01-10  9:21   ` Thomas Zimmermann
  -1 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: dri-devel, amd-gfx, intel-gfx, linux-arm-msm, freedreno, nouveau,
	Thomas Zimmermann

VBLANK callbacks in struct drm_driver are deprecated in favor of
their equivalents in struct drm_crtc_funcs. Convert msm over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 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 | 15 ++++++++++
 drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c  | 34 -----------------------
 drivers/gpu/drm/msm/msm_drv.c             | 10 ++++---
 drivers/gpu/drm/msm/msm_drv.h             |  3 ++
 6 files changed, 28 insertions(+), 38 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
index f197dce54576..b177d5052c5e 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
@@ -1281,6 +1281,8 @@ static const struct drm_crtc_funcs dpu_crtc_funcs = {
 	.atomic_destroy_state = dpu_crtc_destroy_state,
 	.late_register = dpu_crtc_late_register,
 	.early_unregister = dpu_crtc_early_unregister,
+	.enable_vblank  = msm_crtc_enable_vblank,
+	.disable_vblank = msm_crtc_disable_vblank,
 };
 
 static const struct drm_crtc_helper_funcs dpu_crtc_helper_funcs = {
diff --git a/drivers/gpu/drm/msm/disp/mdp4/mdp4_crtc.c b/drivers/gpu/drm/msm/disp/mdp4/mdp4_crtc.c
index f34dca5d4532..c9239b07fe4f 100644
--- a/drivers/gpu/drm/msm/disp/mdp4/mdp4_crtc.c
+++ b/drivers/gpu/drm/msm/disp/mdp4/mdp4_crtc.c
@@ -481,6 +481,8 @@ static const struct drm_crtc_funcs mdp4_crtc_funcs = {
 	.reset = drm_atomic_helper_crtc_reset,
 	.atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
 	.atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
+	.enable_vblank  = msm_crtc_enable_vblank,
+	.disable_vblank = msm_crtc_disable_vblank,
 };
 
 static const struct drm_crtc_helper_funcs mdp4_crtc_helper_funcs = {
diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
index 4decf19847a8..70c326d330f6 100644
--- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
+++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
@@ -471,6 +471,17 @@ static bool mdp5_crtc_get_scanout_position(struct drm_crtc *crtc,
 	return true;
 }
 
+static u32 mdp5_crtc_get_vblank_counter(struct drm_crtc *crtc)
+{
+	struct drm_encoder *encoder;
+
+	encoder = get_encoder_from_crtc(crtc);
+	if (!encoder)
+		return 0;
+
+	return mdp5_encoder_get_framecount(encoder);
+}
+
 static void mdp5_crtc_atomic_disable(struct drm_crtc *crtc,
 				     struct drm_crtc_state *old_state)
 {
@@ -1120,6 +1131,10 @@ static const struct drm_crtc_funcs mdp5_crtc_funcs = {
 	.cursor_set = mdp5_crtc_cursor_set,
 	.cursor_move = mdp5_crtc_cursor_move,
 	.atomic_print_state = mdp5_crtc_atomic_print_state,
+	.get_vblank_counter = mdp5_crtc_get_vblank_counter,
+	.enable_vblank  = msm_crtc_enable_vblank,
+	.disable_vblank = msm_crtc_disable_vblank,
+	.get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
 };
 
 static const struct drm_crtc_helper_funcs mdp5_crtc_helper_funcs = {
diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
index 8b72ac44ce55..6650f478b226 100644
--- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
+++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
@@ -583,38 +583,6 @@ static int get_clk(struct platform_device *pdev, struct clk **clkp,
 	return 0;
 }
 
-static struct drm_encoder *get_encoder_from_crtc(struct drm_crtc *crtc)
-{
-	struct drm_device *dev = crtc->dev;
-	struct drm_encoder *encoder;
-
-	drm_for_each_encoder(encoder, dev)
-		if (encoder->crtc == crtc)
-			return encoder;
-
-	return NULL;
-}
-
-static u32 mdp5_get_vblank_counter(struct drm_device *dev, unsigned int pipe)
-{
-	struct msm_drm_private *priv = dev->dev_private;
-	struct drm_crtc *crtc;
-	struct drm_encoder *encoder;
-
-	if (pipe >= priv->num_crtcs)
-		return 0;
-
-	crtc = priv->crtcs[pipe];
-	if (!crtc)
-		return 0;
-
-	encoder = get_encoder_from_crtc(crtc);
-	if (!encoder)
-		return 0;
-
-	return mdp5_encoder_get_framecount(encoder);
-}
-
 struct msm_kms *mdp5_kms_init(struct drm_device *dev)
 {
 	struct msm_drm_private *priv = dev->dev_private;
@@ -702,8 +670,6 @@ struct msm_kms *mdp5_kms_init(struct drm_device *dev)
 	dev->mode_config.max_width = 0xffff;
 	dev->mode_config.max_height = 0xffff;
 
-	dev->driver->get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos;
-	dev->driver->get_vblank_counter = mdp5_get_vblank_counter;
 	dev->max_vblank_count = 0; /* max_vblank_count is set on each CRTC */
 	dev->vblank_disable_immediate = true;
 
diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
index c84f0a8b3f2c..c5e044136fe5 100644
--- a/drivers/gpu/drm/msm/msm_drv.c
+++ b/drivers/gpu/drm/msm/msm_drv.c
@@ -660,8 +660,10 @@ static void msm_irq_uninstall(struct drm_device *dev)
 	kms->funcs->irq_uninstall(kms);
 }
 
-static int msm_enable_vblank(struct drm_device *dev, unsigned int pipe)
+int msm_crtc_enable_vblank(struct drm_crtc *crtc)
 {
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
 	struct msm_drm_private *priv = dev->dev_private;
 	struct msm_kms *kms = priv->kms;
 	if (!kms)
@@ -670,8 +672,10 @@ static int msm_enable_vblank(struct drm_device *dev, unsigned int pipe)
 	return vblank_ctrl_queue_work(priv, pipe, true);
 }
 
-static void msm_disable_vblank(struct drm_device *dev, unsigned int pipe)
+void msm_crtc_disable_vblank(struct drm_crtc *crtc)
 {
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
 	struct msm_drm_private *priv = dev->dev_private;
 	struct msm_kms *kms = priv->kms;
 	if (!kms)
@@ -996,8 +1000,6 @@ static struct drm_driver msm_driver = {
 	.irq_preinstall     = msm_irq_preinstall,
 	.irq_postinstall    = msm_irq_postinstall,
 	.irq_uninstall      = msm_irq_uninstall,
-	.enable_vblank      = msm_enable_vblank,
-	.disable_vblank     = msm_disable_vblank,
 	.gem_free_object_unlocked = msm_gem_free_object,
 	.gem_vm_ops         = &vm_ops,
 	.dumb_create        = msm_gem_dumb_create,
diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h
index 71547e756e29..108625cd553d 100644
--- a/drivers/gpu/drm/msm/msm_drv.h
+++ b/drivers/gpu/drm/msm/msm_drv.h
@@ -232,6 +232,9 @@ struct drm_atomic_state *msm_atomic_state_alloc(struct drm_device *dev);
 void msm_atomic_state_clear(struct drm_atomic_state *state);
 void msm_atomic_state_free(struct drm_atomic_state *state);
 
+int msm_crtc_enable_vblank(struct drm_crtc *crtc);
+void msm_crtc_disable_vblank(struct drm_crtc *crtc);
+
 int msm_gem_init_vma(struct msm_gem_address_space *aspace,
 		struct msm_gem_vma *vma, int npages);
 void msm_gem_purge_vma(struct msm_gem_address_space *aspace,
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 15/23] drm/msm: Convert to CRTC VBLANK callbacks
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

VBLANK callbacks in struct drm_driver are deprecated in favor of
their equivalents in struct drm_crtc_funcs. Convert msm over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 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 | 15 ++++++++++
 drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c  | 34 -----------------------
 drivers/gpu/drm/msm/msm_drv.c             | 10 ++++---
 drivers/gpu/drm/msm/msm_drv.h             |  3 ++
 6 files changed, 28 insertions(+), 38 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
index f197dce54576..b177d5052c5e 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
@@ -1281,6 +1281,8 @@ static const struct drm_crtc_funcs dpu_crtc_funcs = {
 	.atomic_destroy_state = dpu_crtc_destroy_state,
 	.late_register = dpu_crtc_late_register,
 	.early_unregister = dpu_crtc_early_unregister,
+	.enable_vblank  = msm_crtc_enable_vblank,
+	.disable_vblank = msm_crtc_disable_vblank,
 };
 
 static const struct drm_crtc_helper_funcs dpu_crtc_helper_funcs = {
diff --git a/drivers/gpu/drm/msm/disp/mdp4/mdp4_crtc.c b/drivers/gpu/drm/msm/disp/mdp4/mdp4_crtc.c
index f34dca5d4532..c9239b07fe4f 100644
--- a/drivers/gpu/drm/msm/disp/mdp4/mdp4_crtc.c
+++ b/drivers/gpu/drm/msm/disp/mdp4/mdp4_crtc.c
@@ -481,6 +481,8 @@ static const struct drm_crtc_funcs mdp4_crtc_funcs = {
 	.reset = drm_atomic_helper_crtc_reset,
 	.atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
 	.atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
+	.enable_vblank  = msm_crtc_enable_vblank,
+	.disable_vblank = msm_crtc_disable_vblank,
 };
 
 static const struct drm_crtc_helper_funcs mdp4_crtc_helper_funcs = {
diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
index 4decf19847a8..70c326d330f6 100644
--- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
+++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
@@ -471,6 +471,17 @@ static bool mdp5_crtc_get_scanout_position(struct drm_crtc *crtc,
 	return true;
 }
 
+static u32 mdp5_crtc_get_vblank_counter(struct drm_crtc *crtc)
+{
+	struct drm_encoder *encoder;
+
+	encoder = get_encoder_from_crtc(crtc);
+	if (!encoder)
+		return 0;
+
+	return mdp5_encoder_get_framecount(encoder);
+}
+
 static void mdp5_crtc_atomic_disable(struct drm_crtc *crtc,
 				     struct drm_crtc_state *old_state)
 {
@@ -1120,6 +1131,10 @@ static const struct drm_crtc_funcs mdp5_crtc_funcs = {
 	.cursor_set = mdp5_crtc_cursor_set,
 	.cursor_move = mdp5_crtc_cursor_move,
 	.atomic_print_state = mdp5_crtc_atomic_print_state,
+	.get_vblank_counter = mdp5_crtc_get_vblank_counter,
+	.enable_vblank  = msm_crtc_enable_vblank,
+	.disable_vblank = msm_crtc_disable_vblank,
+	.get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
 };
 
 static const struct drm_crtc_helper_funcs mdp5_crtc_helper_funcs = {
diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
index 8b72ac44ce55..6650f478b226 100644
--- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
+++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
@@ -583,38 +583,6 @@ static int get_clk(struct platform_device *pdev, struct clk **clkp,
 	return 0;
 }
 
-static struct drm_encoder *get_encoder_from_crtc(struct drm_crtc *crtc)
-{
-	struct drm_device *dev = crtc->dev;
-	struct drm_encoder *encoder;
-
-	drm_for_each_encoder(encoder, dev)
-		if (encoder->crtc == crtc)
-			return encoder;
-
-	return NULL;
-}
-
-static u32 mdp5_get_vblank_counter(struct drm_device *dev, unsigned int pipe)
-{
-	struct msm_drm_private *priv = dev->dev_private;
-	struct drm_crtc *crtc;
-	struct drm_encoder *encoder;
-
-	if (pipe >= priv->num_crtcs)
-		return 0;
-
-	crtc = priv->crtcs[pipe];
-	if (!crtc)
-		return 0;
-
-	encoder = get_encoder_from_crtc(crtc);
-	if (!encoder)
-		return 0;
-
-	return mdp5_encoder_get_framecount(encoder);
-}
-
 struct msm_kms *mdp5_kms_init(struct drm_device *dev)
 {
 	struct msm_drm_private *priv = dev->dev_private;
@@ -702,8 +670,6 @@ struct msm_kms *mdp5_kms_init(struct drm_device *dev)
 	dev->mode_config.max_width = 0xffff;
 	dev->mode_config.max_height = 0xffff;
 
-	dev->driver->get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos;
-	dev->driver->get_vblank_counter = mdp5_get_vblank_counter;
 	dev->max_vblank_count = 0; /* max_vblank_count is set on each CRTC */
 	dev->vblank_disable_immediate = true;
 
diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
index c84f0a8b3f2c..c5e044136fe5 100644
--- a/drivers/gpu/drm/msm/msm_drv.c
+++ b/drivers/gpu/drm/msm/msm_drv.c
@@ -660,8 +660,10 @@ static void msm_irq_uninstall(struct drm_device *dev)
 	kms->funcs->irq_uninstall(kms);
 }
 
-static int msm_enable_vblank(struct drm_device *dev, unsigned int pipe)
+int msm_crtc_enable_vblank(struct drm_crtc *crtc)
 {
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
 	struct msm_drm_private *priv = dev->dev_private;
 	struct msm_kms *kms = priv->kms;
 	if (!kms)
@@ -670,8 +672,10 @@ static int msm_enable_vblank(struct drm_device *dev, unsigned int pipe)
 	return vblank_ctrl_queue_work(priv, pipe, true);
 }
 
-static void msm_disable_vblank(struct drm_device *dev, unsigned int pipe)
+void msm_crtc_disable_vblank(struct drm_crtc *crtc)
 {
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
 	struct msm_drm_private *priv = dev->dev_private;
 	struct msm_kms *kms = priv->kms;
 	if (!kms)
@@ -996,8 +1000,6 @@ static struct drm_driver msm_driver = {
 	.irq_preinstall     = msm_irq_preinstall,
 	.irq_postinstall    = msm_irq_postinstall,
 	.irq_uninstall      = msm_irq_uninstall,
-	.enable_vblank      = msm_enable_vblank,
-	.disable_vblank     = msm_disable_vblank,
 	.gem_free_object_unlocked = msm_gem_free_object,
 	.gem_vm_ops         = &vm_ops,
 	.dumb_create        = msm_gem_dumb_create,
diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h
index 71547e756e29..108625cd553d 100644
--- a/drivers/gpu/drm/msm/msm_drv.h
+++ b/drivers/gpu/drm/msm/msm_drv.h
@@ -232,6 +232,9 @@ struct drm_atomic_state *msm_atomic_state_alloc(struct drm_device *dev);
 void msm_atomic_state_clear(struct drm_atomic_state *state);
 void msm_atomic_state_free(struct drm_atomic_state *state);
 
+int msm_crtc_enable_vblank(struct drm_crtc *crtc);
+void msm_crtc_disable_vblank(struct drm_crtc *crtc);
+
 int msm_gem_init_vma(struct msm_gem_address_space *aspace,
 		struct msm_gem_vma *vma, int npages);
 void msm_gem_purge_vma(struct msm_gem_address_space *aspace,
-- 
2.24.1

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 15/23] drm/msm: Convert to CRTC VBLANK callbacks
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

VBLANK callbacks in struct drm_driver are deprecated in favor of
their equivalents in struct drm_crtc_funcs. Convert msm over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 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 | 15 ++++++++++
 drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c  | 34 -----------------------
 drivers/gpu/drm/msm/msm_drv.c             | 10 ++++---
 drivers/gpu/drm/msm/msm_drv.h             |  3 ++
 6 files changed, 28 insertions(+), 38 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
index f197dce54576..b177d5052c5e 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
@@ -1281,6 +1281,8 @@ static const struct drm_crtc_funcs dpu_crtc_funcs = {
 	.atomic_destroy_state = dpu_crtc_destroy_state,
 	.late_register = dpu_crtc_late_register,
 	.early_unregister = dpu_crtc_early_unregister,
+	.enable_vblank  = msm_crtc_enable_vblank,
+	.disable_vblank = msm_crtc_disable_vblank,
 };
 
 static const struct drm_crtc_helper_funcs dpu_crtc_helper_funcs = {
diff --git a/drivers/gpu/drm/msm/disp/mdp4/mdp4_crtc.c b/drivers/gpu/drm/msm/disp/mdp4/mdp4_crtc.c
index f34dca5d4532..c9239b07fe4f 100644
--- a/drivers/gpu/drm/msm/disp/mdp4/mdp4_crtc.c
+++ b/drivers/gpu/drm/msm/disp/mdp4/mdp4_crtc.c
@@ -481,6 +481,8 @@ static const struct drm_crtc_funcs mdp4_crtc_funcs = {
 	.reset = drm_atomic_helper_crtc_reset,
 	.atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
 	.atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
+	.enable_vblank  = msm_crtc_enable_vblank,
+	.disable_vblank = msm_crtc_disable_vblank,
 };
 
 static const struct drm_crtc_helper_funcs mdp4_crtc_helper_funcs = {
diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
index 4decf19847a8..70c326d330f6 100644
--- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
+++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
@@ -471,6 +471,17 @@ static bool mdp5_crtc_get_scanout_position(struct drm_crtc *crtc,
 	return true;
 }
 
+static u32 mdp5_crtc_get_vblank_counter(struct drm_crtc *crtc)
+{
+	struct drm_encoder *encoder;
+
+	encoder = get_encoder_from_crtc(crtc);
+	if (!encoder)
+		return 0;
+
+	return mdp5_encoder_get_framecount(encoder);
+}
+
 static void mdp5_crtc_atomic_disable(struct drm_crtc *crtc,
 				     struct drm_crtc_state *old_state)
 {
@@ -1120,6 +1131,10 @@ static const struct drm_crtc_funcs mdp5_crtc_funcs = {
 	.cursor_set = mdp5_crtc_cursor_set,
 	.cursor_move = mdp5_crtc_cursor_move,
 	.atomic_print_state = mdp5_crtc_atomic_print_state,
+	.get_vblank_counter = mdp5_crtc_get_vblank_counter,
+	.enable_vblank  = msm_crtc_enable_vblank,
+	.disable_vblank = msm_crtc_disable_vblank,
+	.get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
 };
 
 static const struct drm_crtc_helper_funcs mdp5_crtc_helper_funcs = {
diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
index 8b72ac44ce55..6650f478b226 100644
--- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
+++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
@@ -583,38 +583,6 @@ static int get_clk(struct platform_device *pdev, struct clk **clkp,
 	return 0;
 }
 
-static struct drm_encoder *get_encoder_from_crtc(struct drm_crtc *crtc)
-{
-	struct drm_device *dev = crtc->dev;
-	struct drm_encoder *encoder;
-
-	drm_for_each_encoder(encoder, dev)
-		if (encoder->crtc == crtc)
-			return encoder;
-
-	return NULL;
-}
-
-static u32 mdp5_get_vblank_counter(struct drm_device *dev, unsigned int pipe)
-{
-	struct msm_drm_private *priv = dev->dev_private;
-	struct drm_crtc *crtc;
-	struct drm_encoder *encoder;
-
-	if (pipe >= priv->num_crtcs)
-		return 0;
-
-	crtc = priv->crtcs[pipe];
-	if (!crtc)
-		return 0;
-
-	encoder = get_encoder_from_crtc(crtc);
-	if (!encoder)
-		return 0;
-
-	return mdp5_encoder_get_framecount(encoder);
-}
-
 struct msm_kms *mdp5_kms_init(struct drm_device *dev)
 {
 	struct msm_drm_private *priv = dev->dev_private;
@@ -702,8 +670,6 @@ struct msm_kms *mdp5_kms_init(struct drm_device *dev)
 	dev->mode_config.max_width = 0xffff;
 	dev->mode_config.max_height = 0xffff;
 
-	dev->driver->get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos;
-	dev->driver->get_vblank_counter = mdp5_get_vblank_counter;
 	dev->max_vblank_count = 0; /* max_vblank_count is set on each CRTC */
 	dev->vblank_disable_immediate = true;
 
diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
index c84f0a8b3f2c..c5e044136fe5 100644
--- a/drivers/gpu/drm/msm/msm_drv.c
+++ b/drivers/gpu/drm/msm/msm_drv.c
@@ -660,8 +660,10 @@ static void msm_irq_uninstall(struct drm_device *dev)
 	kms->funcs->irq_uninstall(kms);
 }
 
-static int msm_enable_vblank(struct drm_device *dev, unsigned int pipe)
+int msm_crtc_enable_vblank(struct drm_crtc *crtc)
 {
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
 	struct msm_drm_private *priv = dev->dev_private;
 	struct msm_kms *kms = priv->kms;
 	if (!kms)
@@ -670,8 +672,10 @@ static int msm_enable_vblank(struct drm_device *dev, unsigned int pipe)
 	return vblank_ctrl_queue_work(priv, pipe, true);
 }
 
-static void msm_disable_vblank(struct drm_device *dev, unsigned int pipe)
+void msm_crtc_disable_vblank(struct drm_crtc *crtc)
 {
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
 	struct msm_drm_private *priv = dev->dev_private;
 	struct msm_kms *kms = priv->kms;
 	if (!kms)
@@ -996,8 +1000,6 @@ static struct drm_driver msm_driver = {
 	.irq_preinstall     = msm_irq_preinstall,
 	.irq_postinstall    = msm_irq_postinstall,
 	.irq_uninstall      = msm_irq_uninstall,
-	.enable_vblank      = msm_enable_vblank,
-	.disable_vblank     = msm_disable_vblank,
 	.gem_free_object_unlocked = msm_gem_free_object,
 	.gem_vm_ops         = &vm_ops,
 	.dumb_create        = msm_gem_dumb_create,
diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h
index 71547e756e29..108625cd553d 100644
--- a/drivers/gpu/drm/msm/msm_drv.h
+++ b/drivers/gpu/drm/msm/msm_drv.h
@@ -232,6 +232,9 @@ struct drm_atomic_state *msm_atomic_state_alloc(struct drm_device *dev);
 void msm_atomic_state_clear(struct drm_atomic_state *state);
 void msm_atomic_state_free(struct drm_atomic_state *state);
 
+int msm_crtc_enable_vblank(struct drm_crtc *crtc);
+void msm_crtc_disable_vblank(struct drm_crtc *crtc);
+
 int msm_gem_init_vma(struct msm_gem_address_space *aspace,
 		struct msm_gem_vma *vma, int npages);
 void msm_gem_purge_vma(struct msm_gem_address_space *aspace,
-- 
2.24.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [Intel-gfx] [PATCH 15/23] drm/msm: Convert to CRTC VBLANK callbacks
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

VBLANK callbacks in struct drm_driver are deprecated in favor of
their equivalents in struct drm_crtc_funcs. Convert msm over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 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 | 15 ++++++++++
 drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c  | 34 -----------------------
 drivers/gpu/drm/msm/msm_drv.c             | 10 ++++---
 drivers/gpu/drm/msm/msm_drv.h             |  3 ++
 6 files changed, 28 insertions(+), 38 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
index f197dce54576..b177d5052c5e 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
@@ -1281,6 +1281,8 @@ static const struct drm_crtc_funcs dpu_crtc_funcs = {
 	.atomic_destroy_state = dpu_crtc_destroy_state,
 	.late_register = dpu_crtc_late_register,
 	.early_unregister = dpu_crtc_early_unregister,
+	.enable_vblank  = msm_crtc_enable_vblank,
+	.disable_vblank = msm_crtc_disable_vblank,
 };
 
 static const struct drm_crtc_helper_funcs dpu_crtc_helper_funcs = {
diff --git a/drivers/gpu/drm/msm/disp/mdp4/mdp4_crtc.c b/drivers/gpu/drm/msm/disp/mdp4/mdp4_crtc.c
index f34dca5d4532..c9239b07fe4f 100644
--- a/drivers/gpu/drm/msm/disp/mdp4/mdp4_crtc.c
+++ b/drivers/gpu/drm/msm/disp/mdp4/mdp4_crtc.c
@@ -481,6 +481,8 @@ static const struct drm_crtc_funcs mdp4_crtc_funcs = {
 	.reset = drm_atomic_helper_crtc_reset,
 	.atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
 	.atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
+	.enable_vblank  = msm_crtc_enable_vblank,
+	.disable_vblank = msm_crtc_disable_vblank,
 };
 
 static const struct drm_crtc_helper_funcs mdp4_crtc_helper_funcs = {
diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
index 4decf19847a8..70c326d330f6 100644
--- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
+++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
@@ -471,6 +471,17 @@ static bool mdp5_crtc_get_scanout_position(struct drm_crtc *crtc,
 	return true;
 }
 
+static u32 mdp5_crtc_get_vblank_counter(struct drm_crtc *crtc)
+{
+	struct drm_encoder *encoder;
+
+	encoder = get_encoder_from_crtc(crtc);
+	if (!encoder)
+		return 0;
+
+	return mdp5_encoder_get_framecount(encoder);
+}
+
 static void mdp5_crtc_atomic_disable(struct drm_crtc *crtc,
 				     struct drm_crtc_state *old_state)
 {
@@ -1120,6 +1131,10 @@ static const struct drm_crtc_funcs mdp5_crtc_funcs = {
 	.cursor_set = mdp5_crtc_cursor_set,
 	.cursor_move = mdp5_crtc_cursor_move,
 	.atomic_print_state = mdp5_crtc_atomic_print_state,
+	.get_vblank_counter = mdp5_crtc_get_vblank_counter,
+	.enable_vblank  = msm_crtc_enable_vblank,
+	.disable_vblank = msm_crtc_disable_vblank,
+	.get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
 };
 
 static const struct drm_crtc_helper_funcs mdp5_crtc_helper_funcs = {
diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
index 8b72ac44ce55..6650f478b226 100644
--- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
+++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
@@ -583,38 +583,6 @@ static int get_clk(struct platform_device *pdev, struct clk **clkp,
 	return 0;
 }
 
-static struct drm_encoder *get_encoder_from_crtc(struct drm_crtc *crtc)
-{
-	struct drm_device *dev = crtc->dev;
-	struct drm_encoder *encoder;
-
-	drm_for_each_encoder(encoder, dev)
-		if (encoder->crtc == crtc)
-			return encoder;
-
-	return NULL;
-}
-
-static u32 mdp5_get_vblank_counter(struct drm_device *dev, unsigned int pipe)
-{
-	struct msm_drm_private *priv = dev->dev_private;
-	struct drm_crtc *crtc;
-	struct drm_encoder *encoder;
-
-	if (pipe >= priv->num_crtcs)
-		return 0;
-
-	crtc = priv->crtcs[pipe];
-	if (!crtc)
-		return 0;
-
-	encoder = get_encoder_from_crtc(crtc);
-	if (!encoder)
-		return 0;
-
-	return mdp5_encoder_get_framecount(encoder);
-}
-
 struct msm_kms *mdp5_kms_init(struct drm_device *dev)
 {
 	struct msm_drm_private *priv = dev->dev_private;
@@ -702,8 +670,6 @@ struct msm_kms *mdp5_kms_init(struct drm_device *dev)
 	dev->mode_config.max_width = 0xffff;
 	dev->mode_config.max_height = 0xffff;
 
-	dev->driver->get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos;
-	dev->driver->get_vblank_counter = mdp5_get_vblank_counter;
 	dev->max_vblank_count = 0; /* max_vblank_count is set on each CRTC */
 	dev->vblank_disable_immediate = true;
 
diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
index c84f0a8b3f2c..c5e044136fe5 100644
--- a/drivers/gpu/drm/msm/msm_drv.c
+++ b/drivers/gpu/drm/msm/msm_drv.c
@@ -660,8 +660,10 @@ static void msm_irq_uninstall(struct drm_device *dev)
 	kms->funcs->irq_uninstall(kms);
 }
 
-static int msm_enable_vblank(struct drm_device *dev, unsigned int pipe)
+int msm_crtc_enable_vblank(struct drm_crtc *crtc)
 {
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
 	struct msm_drm_private *priv = dev->dev_private;
 	struct msm_kms *kms = priv->kms;
 	if (!kms)
@@ -670,8 +672,10 @@ static int msm_enable_vblank(struct drm_device *dev, unsigned int pipe)
 	return vblank_ctrl_queue_work(priv, pipe, true);
 }
 
-static void msm_disable_vblank(struct drm_device *dev, unsigned int pipe)
+void msm_crtc_disable_vblank(struct drm_crtc *crtc)
 {
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
 	struct msm_drm_private *priv = dev->dev_private;
 	struct msm_kms *kms = priv->kms;
 	if (!kms)
@@ -996,8 +1000,6 @@ static struct drm_driver msm_driver = {
 	.irq_preinstall     = msm_irq_preinstall,
 	.irq_postinstall    = msm_irq_postinstall,
 	.irq_uninstall      = msm_irq_uninstall,
-	.enable_vblank      = msm_enable_vblank,
-	.disable_vblank     = msm_disable_vblank,
 	.gem_free_object_unlocked = msm_gem_free_object,
 	.gem_vm_ops         = &vm_ops,
 	.dumb_create        = msm_gem_dumb_create,
diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h
index 71547e756e29..108625cd553d 100644
--- a/drivers/gpu/drm/msm/msm_drv.h
+++ b/drivers/gpu/drm/msm/msm_drv.h
@@ -232,6 +232,9 @@ struct drm_atomic_state *msm_atomic_state_alloc(struct drm_device *dev);
 void msm_atomic_state_clear(struct drm_atomic_state *state);
 void msm_atomic_state_free(struct drm_atomic_state *state);
 
+int msm_crtc_enable_vblank(struct drm_crtc *crtc);
+void msm_crtc_disable_vblank(struct drm_crtc *crtc);
+
 int msm_gem_init_vma(struct msm_gem_address_space *aspace,
 		struct msm_gem_vma *vma, int npages);
 void msm_gem_purge_vma(struct msm_gem_address_space *aspace,
-- 
2.24.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 15/23] drm/msm: Convert to CRTC VBLANK callbacks
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

VBLANK callbacks in struct drm_driver are deprecated in favor of
their equivalents in struct drm_crtc_funcs. Convert msm over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 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 | 15 ++++++++++
 drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c  | 34 -----------------------
 drivers/gpu/drm/msm/msm_drv.c             | 10 ++++---
 drivers/gpu/drm/msm/msm_drv.h             |  3 ++
 6 files changed, 28 insertions(+), 38 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
index f197dce54576..b177d5052c5e 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
@@ -1281,6 +1281,8 @@ static const struct drm_crtc_funcs dpu_crtc_funcs = {
 	.atomic_destroy_state = dpu_crtc_destroy_state,
 	.late_register = dpu_crtc_late_register,
 	.early_unregister = dpu_crtc_early_unregister,
+	.enable_vblank  = msm_crtc_enable_vblank,
+	.disable_vblank = msm_crtc_disable_vblank,
 };
 
 static const struct drm_crtc_helper_funcs dpu_crtc_helper_funcs = {
diff --git a/drivers/gpu/drm/msm/disp/mdp4/mdp4_crtc.c b/drivers/gpu/drm/msm/disp/mdp4/mdp4_crtc.c
index f34dca5d4532..c9239b07fe4f 100644
--- a/drivers/gpu/drm/msm/disp/mdp4/mdp4_crtc.c
+++ b/drivers/gpu/drm/msm/disp/mdp4/mdp4_crtc.c
@@ -481,6 +481,8 @@ static const struct drm_crtc_funcs mdp4_crtc_funcs = {
 	.reset = drm_atomic_helper_crtc_reset,
 	.atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
 	.atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
+	.enable_vblank  = msm_crtc_enable_vblank,
+	.disable_vblank = msm_crtc_disable_vblank,
 };
 
 static const struct drm_crtc_helper_funcs mdp4_crtc_helper_funcs = {
diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
index 4decf19847a8..70c326d330f6 100644
--- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
+++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
@@ -471,6 +471,17 @@ static bool mdp5_crtc_get_scanout_position(struct drm_crtc *crtc,
 	return true;
 }
 
+static u32 mdp5_crtc_get_vblank_counter(struct drm_crtc *crtc)
+{
+	struct drm_encoder *encoder;
+
+	encoder = get_encoder_from_crtc(crtc);
+	if (!encoder)
+		return 0;
+
+	return mdp5_encoder_get_framecount(encoder);
+}
+
 static void mdp5_crtc_atomic_disable(struct drm_crtc *crtc,
 				     struct drm_crtc_state *old_state)
 {
@@ -1120,6 +1131,10 @@ static const struct drm_crtc_funcs mdp5_crtc_funcs = {
 	.cursor_set = mdp5_crtc_cursor_set,
 	.cursor_move = mdp5_crtc_cursor_move,
 	.atomic_print_state = mdp5_crtc_atomic_print_state,
+	.get_vblank_counter = mdp5_crtc_get_vblank_counter,
+	.enable_vblank  = msm_crtc_enable_vblank,
+	.disable_vblank = msm_crtc_disable_vblank,
+	.get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
 };
 
 static const struct drm_crtc_helper_funcs mdp5_crtc_helper_funcs = {
diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
index 8b72ac44ce55..6650f478b226 100644
--- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
+++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
@@ -583,38 +583,6 @@ static int get_clk(struct platform_device *pdev, struct clk **clkp,
 	return 0;
 }
 
-static struct drm_encoder *get_encoder_from_crtc(struct drm_crtc *crtc)
-{
-	struct drm_device *dev = crtc->dev;
-	struct drm_encoder *encoder;
-
-	drm_for_each_encoder(encoder, dev)
-		if (encoder->crtc == crtc)
-			return encoder;
-
-	return NULL;
-}
-
-static u32 mdp5_get_vblank_counter(struct drm_device *dev, unsigned int pipe)
-{
-	struct msm_drm_private *priv = dev->dev_private;
-	struct drm_crtc *crtc;
-	struct drm_encoder *encoder;
-
-	if (pipe >= priv->num_crtcs)
-		return 0;
-
-	crtc = priv->crtcs[pipe];
-	if (!crtc)
-		return 0;
-
-	encoder = get_encoder_from_crtc(crtc);
-	if (!encoder)
-		return 0;
-
-	return mdp5_encoder_get_framecount(encoder);
-}
-
 struct msm_kms *mdp5_kms_init(struct drm_device *dev)
 {
 	struct msm_drm_private *priv = dev->dev_private;
@@ -702,8 +670,6 @@ struct msm_kms *mdp5_kms_init(struct drm_device *dev)
 	dev->mode_config.max_width = 0xffff;
 	dev->mode_config.max_height = 0xffff;
 
-	dev->driver->get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos;
-	dev->driver->get_vblank_counter = mdp5_get_vblank_counter;
 	dev->max_vblank_count = 0; /* max_vblank_count is set on each CRTC */
 	dev->vblank_disable_immediate = true;
 
diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
index c84f0a8b3f2c..c5e044136fe5 100644
--- a/drivers/gpu/drm/msm/msm_drv.c
+++ b/drivers/gpu/drm/msm/msm_drv.c
@@ -660,8 +660,10 @@ static void msm_irq_uninstall(struct drm_device *dev)
 	kms->funcs->irq_uninstall(kms);
 }
 
-static int msm_enable_vblank(struct drm_device *dev, unsigned int pipe)
+int msm_crtc_enable_vblank(struct drm_crtc *crtc)
 {
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
 	struct msm_drm_private *priv = dev->dev_private;
 	struct msm_kms *kms = priv->kms;
 	if (!kms)
@@ -670,8 +672,10 @@ static int msm_enable_vblank(struct drm_device *dev, unsigned int pipe)
 	return vblank_ctrl_queue_work(priv, pipe, true);
 }
 
-static void msm_disable_vblank(struct drm_device *dev, unsigned int pipe)
+void msm_crtc_disable_vblank(struct drm_crtc *crtc)
 {
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
 	struct msm_drm_private *priv = dev->dev_private;
 	struct msm_kms *kms = priv->kms;
 	if (!kms)
@@ -996,8 +1000,6 @@ static struct drm_driver msm_driver = {
 	.irq_preinstall     = msm_irq_preinstall,
 	.irq_postinstall    = msm_irq_postinstall,
 	.irq_uninstall      = msm_irq_uninstall,
-	.enable_vblank      = msm_enable_vblank,
-	.disable_vblank     = msm_disable_vblank,
 	.gem_free_object_unlocked = msm_gem_free_object,
 	.gem_vm_ops         = &vm_ops,
 	.dumb_create        = msm_gem_dumb_create,
diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h
index 71547e756e29..108625cd553d 100644
--- a/drivers/gpu/drm/msm/msm_drv.h
+++ b/drivers/gpu/drm/msm/msm_drv.h
@@ -232,6 +232,9 @@ struct drm_atomic_state *msm_atomic_state_alloc(struct drm_device *dev);
 void msm_atomic_state_clear(struct drm_atomic_state *state);
 void msm_atomic_state_free(struct drm_atomic_state *state);
 
+int msm_crtc_enable_vblank(struct drm_crtc *crtc);
+void msm_crtc_disable_vblank(struct drm_crtc *crtc);
+
 int msm_gem_init_vma(struct msm_gem_address_space *aspace,
 		struct msm_gem_vma *vma, int npages);
 void msm_gem_purge_vma(struct msm_gem_address_space *aspace,
-- 
2.24.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 16/23] drm/nouveau: Convert to CRTC VBLANK callbacks
  2020-01-10  9:21 ` Thomas Zimmermann
  (?)
  (?)
@ 2020-01-10  9:21   ` Thomas Zimmermann
  -1 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: dri-devel, amd-gfx, intel-gfx, linux-arm-msm, freedreno, nouveau,
	Thomas Zimmermann

VBLANK callbacks in struct drm_driver are deprecated in favor of
their equivalents in struct drm_crtc_funcs. Convert nouvean over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/nouveau/dispnv04/crtc.c   |  3 +++
 drivers/gpu/drm/nouveau/dispnv50/head.c   |  4 ++++
 drivers/gpu/drm/nouveau/nouveau_display.c | 14 ++------------
 drivers/gpu/drm/nouveau/nouveau_display.h |  4 ++--
 drivers/gpu/drm/nouveau/nouveau_drm.c     |  4 ----
 5 files changed, 11 insertions(+), 18 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/dispnv04/crtc.c b/drivers/gpu/drm/nouveau/dispnv04/crtc.c
index 17e9d1c078a0..4a4122a1c057 100644
--- a/drivers/gpu/drm/nouveau/dispnv04/crtc.c
+++ b/drivers/gpu/drm/nouveau/dispnv04/crtc.c
@@ -1248,6 +1248,9 @@ static const struct drm_crtc_funcs nv04_crtc_funcs = {
 	.set_config = drm_crtc_helper_set_config,
 	.page_flip = nv04_crtc_page_flip,
 	.destroy = nv_crtc_destroy,
+	.enable_vblank = nouveau_display_vblank_enable,
+	.disable_vblank = nouveau_display_vblank_disable,
+	.get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
 };
 
 static const struct drm_crtc_helper_funcs nv04_crtc_helper_funcs = {
diff --git a/drivers/gpu/drm/nouveau/dispnv50/head.c b/drivers/gpu/drm/nouveau/dispnv50/head.c
index 1354d19d9a18..a6b7416ca270 100644
--- a/drivers/gpu/drm/nouveau/dispnv50/head.c
+++ b/drivers/gpu/drm/nouveau/dispnv50/head.c
@@ -29,6 +29,7 @@
 
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_crtc_helper.h>
+#include <drm/drm_vblank.h>
 #include "nouveau_connector.h"
 void
 nv50_head_flush_clr(struct nv50_head *head,
@@ -472,6 +473,9 @@ nv50_head_func = {
 	.page_flip = drm_atomic_helper_page_flip,
 	.atomic_duplicate_state = nv50_head_atomic_duplicate_state,
 	.atomic_destroy_state = nv50_head_atomic_destroy_state,
+	.enable_vblank = nouveau_display_vblank_enable,
+	.disable_vblank = nouveau_display_vblank_disable,
+	.get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
 };
 
 int
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c
index 86f99dc8fcef..700817dc4fa0 100644
--- a/drivers/gpu/drm/nouveau/nouveau_display.c
+++ b/drivers/gpu/drm/nouveau/nouveau_display.c
@@ -54,15 +54,10 @@ nouveau_display_vblank_handler(struct nvif_notify *notify)
 }
 
 int
-nouveau_display_vblank_enable(struct drm_device *dev, unsigned int pipe)
+nouveau_display_vblank_enable(struct drm_crtc *crtc)
 {
-	struct drm_crtc *crtc;
 	struct nouveau_crtc *nv_crtc;
 
-	crtc = drm_crtc_from_index(dev, pipe);
-	if (!crtc)
-		return -EINVAL;
-
 	nv_crtc = nouveau_crtc(crtc);
 	nvif_notify_get(&nv_crtc->vblank);
 
@@ -70,15 +65,10 @@ nouveau_display_vblank_enable(struct drm_device *dev, unsigned int pipe)
 }
 
 void
-nouveau_display_vblank_disable(struct drm_device *dev, unsigned int pipe)
+nouveau_display_vblank_disable(struct drm_crtc *crtc)
 {
-	struct drm_crtc *crtc;
 	struct nouveau_crtc *nv_crtc;
 
-	crtc = drm_crtc_from_index(dev, pipe);
-	if (!crtc)
-		return;
-
 	nv_crtc = nouveau_crtc(crtc);
 	nvif_notify_put(&nv_crtc->vblank);
 }
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.h b/drivers/gpu/drm/nouveau/nouveau_display.h
index 71e2af693f7f..71c7048948f3 100644
--- a/drivers/gpu/drm/nouveau/nouveau_display.h
+++ b/drivers/gpu/drm/nouveau/nouveau_display.h
@@ -61,8 +61,8 @@ int  nouveau_display_init(struct drm_device *dev, bool resume, bool runtime);
 void nouveau_display_fini(struct drm_device *dev, bool suspend, bool runtime);
 int  nouveau_display_suspend(struct drm_device *dev, bool runtime);
 void nouveau_display_resume(struct drm_device *dev, bool runtime);
-int  nouveau_display_vblank_enable(struct drm_device *, unsigned int);
-void nouveau_display_vblank_disable(struct drm_device *, unsigned int);
+int  nouveau_display_vblank_enable(struct drm_crtc *);
+void nouveau_display_vblank_disable(struct drm_crtc *);
 bool  nouveau_display_scanoutpos(struct drm_crtc *,
 				 bool, int *, int *, ktime_t *,
 				 ktime_t *, const struct drm_display_mode *);
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c
index 9fb38a018240..0003343014ce 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
@@ -1121,10 +1121,6 @@ driver_stub = {
 	.debugfs_init = nouveau_drm_debugfs_init,
 #endif
 
-	.enable_vblank = nouveau_display_vblank_enable,
-	.disable_vblank = nouveau_display_vblank_disable,
-	.get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
-
 	.ioctls = nouveau_ioctls,
 	.num_ioctls = ARRAY_SIZE(nouveau_ioctls),
 	.fops = &nouveau_driver_fops,
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 16/23] drm/nouveau: Convert to CRTC VBLANK callbacks
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

VBLANK callbacks in struct drm_driver are deprecated in favor of
their equivalents in struct drm_crtc_funcs. Convert nouvean over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/nouveau/dispnv04/crtc.c   |  3 +++
 drivers/gpu/drm/nouveau/dispnv50/head.c   |  4 ++++
 drivers/gpu/drm/nouveau/nouveau_display.c | 14 ++------------
 drivers/gpu/drm/nouveau/nouveau_display.h |  4 ++--
 drivers/gpu/drm/nouveau/nouveau_drm.c     |  4 ----
 5 files changed, 11 insertions(+), 18 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/dispnv04/crtc.c b/drivers/gpu/drm/nouveau/dispnv04/crtc.c
index 17e9d1c078a0..4a4122a1c057 100644
--- a/drivers/gpu/drm/nouveau/dispnv04/crtc.c
+++ b/drivers/gpu/drm/nouveau/dispnv04/crtc.c
@@ -1248,6 +1248,9 @@ static const struct drm_crtc_funcs nv04_crtc_funcs = {
 	.set_config = drm_crtc_helper_set_config,
 	.page_flip = nv04_crtc_page_flip,
 	.destroy = nv_crtc_destroy,
+	.enable_vblank = nouveau_display_vblank_enable,
+	.disable_vblank = nouveau_display_vblank_disable,
+	.get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
 };
 
 static const struct drm_crtc_helper_funcs nv04_crtc_helper_funcs = {
diff --git a/drivers/gpu/drm/nouveau/dispnv50/head.c b/drivers/gpu/drm/nouveau/dispnv50/head.c
index 1354d19d9a18..a6b7416ca270 100644
--- a/drivers/gpu/drm/nouveau/dispnv50/head.c
+++ b/drivers/gpu/drm/nouveau/dispnv50/head.c
@@ -29,6 +29,7 @@
 
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_crtc_helper.h>
+#include <drm/drm_vblank.h>
 #include "nouveau_connector.h"
 void
 nv50_head_flush_clr(struct nv50_head *head,
@@ -472,6 +473,9 @@ nv50_head_func = {
 	.page_flip = drm_atomic_helper_page_flip,
 	.atomic_duplicate_state = nv50_head_atomic_duplicate_state,
 	.atomic_destroy_state = nv50_head_atomic_destroy_state,
+	.enable_vblank = nouveau_display_vblank_enable,
+	.disable_vblank = nouveau_display_vblank_disable,
+	.get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
 };
 
 int
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c
index 86f99dc8fcef..700817dc4fa0 100644
--- a/drivers/gpu/drm/nouveau/nouveau_display.c
+++ b/drivers/gpu/drm/nouveau/nouveau_display.c
@@ -54,15 +54,10 @@ nouveau_display_vblank_handler(struct nvif_notify *notify)
 }
 
 int
-nouveau_display_vblank_enable(struct drm_device *dev, unsigned int pipe)
+nouveau_display_vblank_enable(struct drm_crtc *crtc)
 {
-	struct drm_crtc *crtc;
 	struct nouveau_crtc *nv_crtc;
 
-	crtc = drm_crtc_from_index(dev, pipe);
-	if (!crtc)
-		return -EINVAL;
-
 	nv_crtc = nouveau_crtc(crtc);
 	nvif_notify_get(&nv_crtc->vblank);
 
@@ -70,15 +65,10 @@ nouveau_display_vblank_enable(struct drm_device *dev, unsigned int pipe)
 }
 
 void
-nouveau_display_vblank_disable(struct drm_device *dev, unsigned int pipe)
+nouveau_display_vblank_disable(struct drm_crtc *crtc)
 {
-	struct drm_crtc *crtc;
 	struct nouveau_crtc *nv_crtc;
 
-	crtc = drm_crtc_from_index(dev, pipe);
-	if (!crtc)
-		return;
-
 	nv_crtc = nouveau_crtc(crtc);
 	nvif_notify_put(&nv_crtc->vblank);
 }
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.h b/drivers/gpu/drm/nouveau/nouveau_display.h
index 71e2af693f7f..71c7048948f3 100644
--- a/drivers/gpu/drm/nouveau/nouveau_display.h
+++ b/drivers/gpu/drm/nouveau/nouveau_display.h
@@ -61,8 +61,8 @@ int  nouveau_display_init(struct drm_device *dev, bool resume, bool runtime);
 void nouveau_display_fini(struct drm_device *dev, bool suspend, bool runtime);
 int  nouveau_display_suspend(struct drm_device *dev, bool runtime);
 void nouveau_display_resume(struct drm_device *dev, bool runtime);
-int  nouveau_display_vblank_enable(struct drm_device *, unsigned int);
-void nouveau_display_vblank_disable(struct drm_device *, unsigned int);
+int  nouveau_display_vblank_enable(struct drm_crtc *);
+void nouveau_display_vblank_disable(struct drm_crtc *);
 bool  nouveau_display_scanoutpos(struct drm_crtc *,
 				 bool, int *, int *, ktime_t *,
 				 ktime_t *, const struct drm_display_mode *);
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c
index 9fb38a018240..0003343014ce 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
@@ -1121,10 +1121,6 @@ driver_stub = {
 	.debugfs_init = nouveau_drm_debugfs_init,
 #endif
 
-	.enable_vblank = nouveau_display_vblank_enable,
-	.disable_vblank = nouveau_display_vblank_disable,
-	.get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
-
 	.ioctls = nouveau_ioctls,
 	.num_ioctls = ARRAY_SIZE(nouveau_ioctls),
 	.fops = &nouveau_driver_fops,
-- 
2.24.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [Intel-gfx] [PATCH 16/23] drm/nouveau: Convert to CRTC VBLANK callbacks
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

VBLANK callbacks in struct drm_driver are deprecated in favor of
their equivalents in struct drm_crtc_funcs. Convert nouvean over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/nouveau/dispnv04/crtc.c   |  3 +++
 drivers/gpu/drm/nouveau/dispnv50/head.c   |  4 ++++
 drivers/gpu/drm/nouveau/nouveau_display.c | 14 ++------------
 drivers/gpu/drm/nouveau/nouveau_display.h |  4 ++--
 drivers/gpu/drm/nouveau/nouveau_drm.c     |  4 ----
 5 files changed, 11 insertions(+), 18 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/dispnv04/crtc.c b/drivers/gpu/drm/nouveau/dispnv04/crtc.c
index 17e9d1c078a0..4a4122a1c057 100644
--- a/drivers/gpu/drm/nouveau/dispnv04/crtc.c
+++ b/drivers/gpu/drm/nouveau/dispnv04/crtc.c
@@ -1248,6 +1248,9 @@ static const struct drm_crtc_funcs nv04_crtc_funcs = {
 	.set_config = drm_crtc_helper_set_config,
 	.page_flip = nv04_crtc_page_flip,
 	.destroy = nv_crtc_destroy,
+	.enable_vblank = nouveau_display_vblank_enable,
+	.disable_vblank = nouveau_display_vblank_disable,
+	.get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
 };
 
 static const struct drm_crtc_helper_funcs nv04_crtc_helper_funcs = {
diff --git a/drivers/gpu/drm/nouveau/dispnv50/head.c b/drivers/gpu/drm/nouveau/dispnv50/head.c
index 1354d19d9a18..a6b7416ca270 100644
--- a/drivers/gpu/drm/nouveau/dispnv50/head.c
+++ b/drivers/gpu/drm/nouveau/dispnv50/head.c
@@ -29,6 +29,7 @@
 
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_crtc_helper.h>
+#include <drm/drm_vblank.h>
 #include "nouveau_connector.h"
 void
 nv50_head_flush_clr(struct nv50_head *head,
@@ -472,6 +473,9 @@ nv50_head_func = {
 	.page_flip = drm_atomic_helper_page_flip,
 	.atomic_duplicate_state = nv50_head_atomic_duplicate_state,
 	.atomic_destroy_state = nv50_head_atomic_destroy_state,
+	.enable_vblank = nouveau_display_vblank_enable,
+	.disable_vblank = nouveau_display_vblank_disable,
+	.get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
 };
 
 int
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c
index 86f99dc8fcef..700817dc4fa0 100644
--- a/drivers/gpu/drm/nouveau/nouveau_display.c
+++ b/drivers/gpu/drm/nouveau/nouveau_display.c
@@ -54,15 +54,10 @@ nouveau_display_vblank_handler(struct nvif_notify *notify)
 }
 
 int
-nouveau_display_vblank_enable(struct drm_device *dev, unsigned int pipe)
+nouveau_display_vblank_enable(struct drm_crtc *crtc)
 {
-	struct drm_crtc *crtc;
 	struct nouveau_crtc *nv_crtc;
 
-	crtc = drm_crtc_from_index(dev, pipe);
-	if (!crtc)
-		return -EINVAL;
-
 	nv_crtc = nouveau_crtc(crtc);
 	nvif_notify_get(&nv_crtc->vblank);
 
@@ -70,15 +65,10 @@ nouveau_display_vblank_enable(struct drm_device *dev, unsigned int pipe)
 }
 
 void
-nouveau_display_vblank_disable(struct drm_device *dev, unsigned int pipe)
+nouveau_display_vblank_disable(struct drm_crtc *crtc)
 {
-	struct drm_crtc *crtc;
 	struct nouveau_crtc *nv_crtc;
 
-	crtc = drm_crtc_from_index(dev, pipe);
-	if (!crtc)
-		return;
-
 	nv_crtc = nouveau_crtc(crtc);
 	nvif_notify_put(&nv_crtc->vblank);
 }
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.h b/drivers/gpu/drm/nouveau/nouveau_display.h
index 71e2af693f7f..71c7048948f3 100644
--- a/drivers/gpu/drm/nouveau/nouveau_display.h
+++ b/drivers/gpu/drm/nouveau/nouveau_display.h
@@ -61,8 +61,8 @@ int  nouveau_display_init(struct drm_device *dev, bool resume, bool runtime);
 void nouveau_display_fini(struct drm_device *dev, bool suspend, bool runtime);
 int  nouveau_display_suspend(struct drm_device *dev, bool runtime);
 void nouveau_display_resume(struct drm_device *dev, bool runtime);
-int  nouveau_display_vblank_enable(struct drm_device *, unsigned int);
-void nouveau_display_vblank_disable(struct drm_device *, unsigned int);
+int  nouveau_display_vblank_enable(struct drm_crtc *);
+void nouveau_display_vblank_disable(struct drm_crtc *);
 bool  nouveau_display_scanoutpos(struct drm_crtc *,
 				 bool, int *, int *, ktime_t *,
 				 ktime_t *, const struct drm_display_mode *);
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c
index 9fb38a018240..0003343014ce 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
@@ -1121,10 +1121,6 @@ driver_stub = {
 	.debugfs_init = nouveau_drm_debugfs_init,
 #endif
 
-	.enable_vblank = nouveau_display_vblank_enable,
-	.disable_vblank = nouveau_display_vblank_disable,
-	.get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
-
 	.ioctls = nouveau_ioctls,
 	.num_ioctls = ARRAY_SIZE(nouveau_ioctls),
 	.fops = &nouveau_driver_fops,
-- 
2.24.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 16/23] drm/nouveau: Convert to CRTC VBLANK callbacks
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

VBLANK callbacks in struct drm_driver are deprecated in favor of
their equivalents in struct drm_crtc_funcs. Convert nouvean over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/nouveau/dispnv04/crtc.c   |  3 +++
 drivers/gpu/drm/nouveau/dispnv50/head.c   |  4 ++++
 drivers/gpu/drm/nouveau/nouveau_display.c | 14 ++------------
 drivers/gpu/drm/nouveau/nouveau_display.h |  4 ++--
 drivers/gpu/drm/nouveau/nouveau_drm.c     |  4 ----
 5 files changed, 11 insertions(+), 18 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/dispnv04/crtc.c b/drivers/gpu/drm/nouveau/dispnv04/crtc.c
index 17e9d1c078a0..4a4122a1c057 100644
--- a/drivers/gpu/drm/nouveau/dispnv04/crtc.c
+++ b/drivers/gpu/drm/nouveau/dispnv04/crtc.c
@@ -1248,6 +1248,9 @@ static const struct drm_crtc_funcs nv04_crtc_funcs = {
 	.set_config = drm_crtc_helper_set_config,
 	.page_flip = nv04_crtc_page_flip,
 	.destroy = nv_crtc_destroy,
+	.enable_vblank = nouveau_display_vblank_enable,
+	.disable_vblank = nouveau_display_vblank_disable,
+	.get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
 };
 
 static const struct drm_crtc_helper_funcs nv04_crtc_helper_funcs = {
diff --git a/drivers/gpu/drm/nouveau/dispnv50/head.c b/drivers/gpu/drm/nouveau/dispnv50/head.c
index 1354d19d9a18..a6b7416ca270 100644
--- a/drivers/gpu/drm/nouveau/dispnv50/head.c
+++ b/drivers/gpu/drm/nouveau/dispnv50/head.c
@@ -29,6 +29,7 @@
 
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_crtc_helper.h>
+#include <drm/drm_vblank.h>
 #include "nouveau_connector.h"
 void
 nv50_head_flush_clr(struct nv50_head *head,
@@ -472,6 +473,9 @@ nv50_head_func = {
 	.page_flip = drm_atomic_helper_page_flip,
 	.atomic_duplicate_state = nv50_head_atomic_duplicate_state,
 	.atomic_destroy_state = nv50_head_atomic_destroy_state,
+	.enable_vblank = nouveau_display_vblank_enable,
+	.disable_vblank = nouveau_display_vblank_disable,
+	.get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
 };
 
 int
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c
index 86f99dc8fcef..700817dc4fa0 100644
--- a/drivers/gpu/drm/nouveau/nouveau_display.c
+++ b/drivers/gpu/drm/nouveau/nouveau_display.c
@@ -54,15 +54,10 @@ nouveau_display_vblank_handler(struct nvif_notify *notify)
 }
 
 int
-nouveau_display_vblank_enable(struct drm_device *dev, unsigned int pipe)
+nouveau_display_vblank_enable(struct drm_crtc *crtc)
 {
-	struct drm_crtc *crtc;
 	struct nouveau_crtc *nv_crtc;
 
-	crtc = drm_crtc_from_index(dev, pipe);
-	if (!crtc)
-		return -EINVAL;
-
 	nv_crtc = nouveau_crtc(crtc);
 	nvif_notify_get(&nv_crtc->vblank);
 
@@ -70,15 +65,10 @@ nouveau_display_vblank_enable(struct drm_device *dev, unsigned int pipe)
 }
 
 void
-nouveau_display_vblank_disable(struct drm_device *dev, unsigned int pipe)
+nouveau_display_vblank_disable(struct drm_crtc *crtc)
 {
-	struct drm_crtc *crtc;
 	struct nouveau_crtc *nv_crtc;
 
-	crtc = drm_crtc_from_index(dev, pipe);
-	if (!crtc)
-		return;
-
 	nv_crtc = nouveau_crtc(crtc);
 	nvif_notify_put(&nv_crtc->vblank);
 }
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.h b/drivers/gpu/drm/nouveau/nouveau_display.h
index 71e2af693f7f..71c7048948f3 100644
--- a/drivers/gpu/drm/nouveau/nouveau_display.h
+++ b/drivers/gpu/drm/nouveau/nouveau_display.h
@@ -61,8 +61,8 @@ int  nouveau_display_init(struct drm_device *dev, bool resume, bool runtime);
 void nouveau_display_fini(struct drm_device *dev, bool suspend, bool runtime);
 int  nouveau_display_suspend(struct drm_device *dev, bool runtime);
 void nouveau_display_resume(struct drm_device *dev, bool runtime);
-int  nouveau_display_vblank_enable(struct drm_device *, unsigned int);
-void nouveau_display_vblank_disable(struct drm_device *, unsigned int);
+int  nouveau_display_vblank_enable(struct drm_crtc *);
+void nouveau_display_vblank_disable(struct drm_crtc *);
 bool  nouveau_display_scanoutpos(struct drm_crtc *,
 				 bool, int *, int *, ktime_t *,
 				 ktime_t *, const struct drm_display_mode *);
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c
index 9fb38a018240..0003343014ce 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
@@ -1121,10 +1121,6 @@ driver_stub = {
 	.debugfs_init = nouveau_drm_debugfs_init,
 #endif
 
-	.enable_vblank = nouveau_display_vblank_enable,
-	.disable_vblank = nouveau_display_vblank_disable,
-	.get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
-
 	.ioctls = nouveau_ioctls,
 	.num_ioctls = ARRAY_SIZE(nouveau_ioctls),
 	.fops = &nouveau_driver_fops,
-- 
2.24.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 17/23] drm/radeon: Convert to CRTC VBLANK callbacks
  2020-01-10  9:21 ` Thomas Zimmermann
  (?)
  (?)
@ 2020-01-10  9:21   ` Thomas Zimmermann
  -1 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: dri-devel, amd-gfx, intel-gfx, linux-arm-msm, freedreno, nouveau,
	Thomas Zimmermann

VBLANK callbacks in struct drm_driver are deprecated in favor of
their equivalents in struct drm_crtc_funcs. Convert radeon over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/radeon/radeon_display.c | 12 ++++++++--
 drivers/gpu/drm/radeon/radeon_drv.c     |  7 ------
 drivers/gpu/drm/radeon/radeon_kms.c     | 29 ++++++++++++++-----------
 3 files changed, 26 insertions(+), 22 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
index 7187158b9963..9116975b6eb9 100644
--- a/drivers/gpu/drm/radeon/radeon_display.c
+++ b/drivers/gpu/drm/radeon/radeon_display.c
@@ -45,6 +45,10 @@
 #include "atom.h"
 #include "radeon.h"
 
+u32 radeon_get_vblank_counter_kms(struct drm_crtc *crtc);
+int radeon_enable_vblank_kms(struct drm_crtc *crtc);
+void radeon_disable_vblank_kms(struct drm_crtc *crtc);
+
 static void avivo_crtc_load_lut(struct drm_crtc *crtc)
 {
 	struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc);
@@ -458,7 +462,7 @@ static void radeon_flip_work_func(struct work_struct *__work)
 		(DRM_SCANOUTPOS_VALID | DRM_SCANOUTPOS_IN_VBLANK) &&
 		(!ASIC_IS_AVIVO(rdev) ||
 		((int) (work->target_vblank -
-		dev->driver->get_vblank_counter(dev, work->crtc_id)) > 0)))
+		crtc->funcs->get_vblank_counter(crtc)) > 0)))
 		usleep_range(1000, 2000);
 
 	/* We borrow the event spin lock for protecting flip_status */
@@ -574,7 +578,7 @@ static int radeon_crtc_page_flip_target(struct drm_crtc *crtc,
 	}
 	work->base = base;
 	work->target_vblank = target - (uint32_t)drm_crtc_vblank_count(crtc) +
-		dev->driver->get_vblank_counter(dev, work->crtc_id);
+		crtc->funcs->get_vblank_counter(crtc);
 
 	/* We borrow the event spin lock for protecting flip_work */
 	spin_lock_irqsave(&crtc->dev->event_lock, flags);
@@ -666,6 +670,10 @@ static const struct drm_crtc_funcs radeon_crtc_funcs = {
 	.set_config = radeon_crtc_set_config,
 	.destroy = radeon_crtc_destroy,
 	.page_flip_target = radeon_crtc_page_flip_target,
+	.get_vblank_counter = radeon_get_vblank_counter_kms,
+	.enable_vblank = radeon_enable_vblank_kms,
+	.disable_vblank = radeon_disable_vblank_kms,
+	.get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
 };
 
 static void radeon_crtc_init(struct drm_device *dev, int index)
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
index 1f597f166bff..49ce2e7d5f9e 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -119,9 +119,6 @@ void radeon_driver_postclose_kms(struct drm_device *dev,
 int radeon_suspend_kms(struct drm_device *dev, bool suspend,
 		       bool fbcon, bool freeze);
 int radeon_resume_kms(struct drm_device *dev, bool resume, bool fbcon);
-u32 radeon_get_vblank_counter_kms(struct drm_device *dev, unsigned int pipe);
-int radeon_enable_vblank_kms(struct drm_device *dev, unsigned int pipe);
-void radeon_disable_vblank_kms(struct drm_device *dev, unsigned int pipe);
 void radeon_driver_irq_preinstall_kms(struct drm_device *dev);
 int radeon_driver_irq_postinstall_kms(struct drm_device *dev);
 void radeon_driver_irq_uninstall_kms(struct drm_device *dev);
@@ -571,10 +568,6 @@ static struct drm_driver kms_driver = {
 	.postclose = radeon_driver_postclose_kms,
 	.lastclose = radeon_driver_lastclose_kms,
 	.unload = radeon_driver_unload_kms,
-	.get_vblank_counter = radeon_get_vblank_counter_kms,
-	.enable_vblank = radeon_enable_vblank_kms,
-	.disable_vblank = radeon_disable_vblank_kms,
-	.get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
 	.irq_preinstall = radeon_driver_irq_preinstall_kms,
 	.irq_postinstall = radeon_driver_irq_postinstall_kms,
 	.irq_uninstall = radeon_driver_irq_uninstall_kms,
diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c
index d24f23a81656..cab891f86dc0 100644
--- a/drivers/gpu/drm/radeon/radeon_kms.c
+++ b/drivers/gpu/drm/radeon/radeon_kms.c
@@ -739,14 +739,15 @@ void radeon_driver_postclose_kms(struct drm_device *dev,
 /**
  * radeon_get_vblank_counter_kms - get frame count
  *
- * @dev: drm dev pointer
- * @pipe: crtc to get the frame count from
+ * @crtc: crtc to get the frame count from
  *
  * Gets the frame count on the requested crtc (all asics).
  * Returns frame count on success, -EINVAL on failure.
  */
-u32 radeon_get_vblank_counter_kms(struct drm_device *dev, unsigned int pipe)
+u32 radeon_get_vblank_counter_kms(struct drm_crtc *crtc)
 {
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
 	int vpos, hpos, stat;
 	u32 count;
 	struct radeon_device *rdev = dev->dev_private;
@@ -808,25 +809,26 @@ u32 radeon_get_vblank_counter_kms(struct drm_device *dev, unsigned int pipe)
 /**
  * radeon_enable_vblank_kms - enable vblank interrupt
  *
- * @dev: drm dev pointer
  * @crtc: crtc to enable vblank interrupt for
  *
  * Enable the interrupt on the requested crtc (all asics).
  * Returns 0 on success, -EINVAL on failure.
  */
-int radeon_enable_vblank_kms(struct drm_device *dev, int crtc)
+int radeon_enable_vblank_kms(struct drm_crtc *crtc)
 {
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
 	struct radeon_device *rdev = dev->dev_private;
 	unsigned long irqflags;
 	int r;
 
-	if (crtc < 0 || crtc >= rdev->num_crtc) {
-		DRM_ERROR("Invalid crtc %d\n", crtc);
+	if (pipe < 0 || pipe >= rdev->num_crtc) {
+		DRM_ERROR("Invalid crtc %d\n", pipe);
 		return -EINVAL;
 	}
 
 	spin_lock_irqsave(&rdev->irq.lock, irqflags);
-	rdev->irq.crtc_vblank_int[crtc] = true;
+	rdev->irq.crtc_vblank_int[pipe] = true;
 	r = radeon_irq_set(rdev);
 	spin_unlock_irqrestore(&rdev->irq.lock, irqflags);
 	return r;
@@ -835,23 +837,24 @@ int radeon_enable_vblank_kms(struct drm_device *dev, int crtc)
 /**
  * radeon_disable_vblank_kms - disable vblank interrupt
  *
- * @dev: drm dev pointer
  * @crtc: crtc to disable vblank interrupt for
  *
  * Disable the interrupt on the requested crtc (all asics).
  */
-void radeon_disable_vblank_kms(struct drm_device *dev, int crtc)
+void radeon_disable_vblank_kms(struct drm_crtc *crtc)
 {
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
 	struct radeon_device *rdev = dev->dev_private;
 	unsigned long irqflags;
 
-	if (crtc < 0 || crtc >= rdev->num_crtc) {
-		DRM_ERROR("Invalid crtc %d\n", crtc);
+	if (pipe < 0 || pipe >= rdev->num_crtc) {
+		DRM_ERROR("Invalid crtc %d\n", pipe);
 		return;
 	}
 
 	spin_lock_irqsave(&rdev->irq.lock, irqflags);
-	rdev->irq.crtc_vblank_int[crtc] = false;
+	rdev->irq.crtc_vblank_int[pipe] = false;
 	radeon_irq_set(rdev);
 	spin_unlock_irqrestore(&rdev->irq.lock, irqflags);
 }
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 17/23] drm/radeon: Convert to CRTC VBLANK callbacks
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

VBLANK callbacks in struct drm_driver are deprecated in favor of
their equivalents in struct drm_crtc_funcs. Convert radeon over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/radeon/radeon_display.c | 12 ++++++++--
 drivers/gpu/drm/radeon/radeon_drv.c     |  7 ------
 drivers/gpu/drm/radeon/radeon_kms.c     | 29 ++++++++++++++-----------
 3 files changed, 26 insertions(+), 22 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
index 7187158b9963..9116975b6eb9 100644
--- a/drivers/gpu/drm/radeon/radeon_display.c
+++ b/drivers/gpu/drm/radeon/radeon_display.c
@@ -45,6 +45,10 @@
 #include "atom.h"
 #include "radeon.h"
 
+u32 radeon_get_vblank_counter_kms(struct drm_crtc *crtc);
+int radeon_enable_vblank_kms(struct drm_crtc *crtc);
+void radeon_disable_vblank_kms(struct drm_crtc *crtc);
+
 static void avivo_crtc_load_lut(struct drm_crtc *crtc)
 {
 	struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc);
@@ -458,7 +462,7 @@ static void radeon_flip_work_func(struct work_struct *__work)
 		(DRM_SCANOUTPOS_VALID | DRM_SCANOUTPOS_IN_VBLANK) &&
 		(!ASIC_IS_AVIVO(rdev) ||
 		((int) (work->target_vblank -
-		dev->driver->get_vblank_counter(dev, work->crtc_id)) > 0)))
+		crtc->funcs->get_vblank_counter(crtc)) > 0)))
 		usleep_range(1000, 2000);
 
 	/* We borrow the event spin lock for protecting flip_status */
@@ -574,7 +578,7 @@ static int radeon_crtc_page_flip_target(struct drm_crtc *crtc,
 	}
 	work->base = base;
 	work->target_vblank = target - (uint32_t)drm_crtc_vblank_count(crtc) +
-		dev->driver->get_vblank_counter(dev, work->crtc_id);
+		crtc->funcs->get_vblank_counter(crtc);
 
 	/* We borrow the event spin lock for protecting flip_work */
 	spin_lock_irqsave(&crtc->dev->event_lock, flags);
@@ -666,6 +670,10 @@ static const struct drm_crtc_funcs radeon_crtc_funcs = {
 	.set_config = radeon_crtc_set_config,
 	.destroy = radeon_crtc_destroy,
 	.page_flip_target = radeon_crtc_page_flip_target,
+	.get_vblank_counter = radeon_get_vblank_counter_kms,
+	.enable_vblank = radeon_enable_vblank_kms,
+	.disable_vblank = radeon_disable_vblank_kms,
+	.get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
 };
 
 static void radeon_crtc_init(struct drm_device *dev, int index)
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
index 1f597f166bff..49ce2e7d5f9e 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -119,9 +119,6 @@ void radeon_driver_postclose_kms(struct drm_device *dev,
 int radeon_suspend_kms(struct drm_device *dev, bool suspend,
 		       bool fbcon, bool freeze);
 int radeon_resume_kms(struct drm_device *dev, bool resume, bool fbcon);
-u32 radeon_get_vblank_counter_kms(struct drm_device *dev, unsigned int pipe);
-int radeon_enable_vblank_kms(struct drm_device *dev, unsigned int pipe);
-void radeon_disable_vblank_kms(struct drm_device *dev, unsigned int pipe);
 void radeon_driver_irq_preinstall_kms(struct drm_device *dev);
 int radeon_driver_irq_postinstall_kms(struct drm_device *dev);
 void radeon_driver_irq_uninstall_kms(struct drm_device *dev);
@@ -571,10 +568,6 @@ static struct drm_driver kms_driver = {
 	.postclose = radeon_driver_postclose_kms,
 	.lastclose = radeon_driver_lastclose_kms,
 	.unload = radeon_driver_unload_kms,
-	.get_vblank_counter = radeon_get_vblank_counter_kms,
-	.enable_vblank = radeon_enable_vblank_kms,
-	.disable_vblank = radeon_disable_vblank_kms,
-	.get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
 	.irq_preinstall = radeon_driver_irq_preinstall_kms,
 	.irq_postinstall = radeon_driver_irq_postinstall_kms,
 	.irq_uninstall = radeon_driver_irq_uninstall_kms,
diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c
index d24f23a81656..cab891f86dc0 100644
--- a/drivers/gpu/drm/radeon/radeon_kms.c
+++ b/drivers/gpu/drm/radeon/radeon_kms.c
@@ -739,14 +739,15 @@ void radeon_driver_postclose_kms(struct drm_device *dev,
 /**
  * radeon_get_vblank_counter_kms - get frame count
  *
- * @dev: drm dev pointer
- * @pipe: crtc to get the frame count from
+ * @crtc: crtc to get the frame count from
  *
  * Gets the frame count on the requested crtc (all asics).
  * Returns frame count on success, -EINVAL on failure.
  */
-u32 radeon_get_vblank_counter_kms(struct drm_device *dev, unsigned int pipe)
+u32 radeon_get_vblank_counter_kms(struct drm_crtc *crtc)
 {
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
 	int vpos, hpos, stat;
 	u32 count;
 	struct radeon_device *rdev = dev->dev_private;
@@ -808,25 +809,26 @@ u32 radeon_get_vblank_counter_kms(struct drm_device *dev, unsigned int pipe)
 /**
  * radeon_enable_vblank_kms - enable vblank interrupt
  *
- * @dev: drm dev pointer
  * @crtc: crtc to enable vblank interrupt for
  *
  * Enable the interrupt on the requested crtc (all asics).
  * Returns 0 on success, -EINVAL on failure.
  */
-int radeon_enable_vblank_kms(struct drm_device *dev, int crtc)
+int radeon_enable_vblank_kms(struct drm_crtc *crtc)
 {
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
 	struct radeon_device *rdev = dev->dev_private;
 	unsigned long irqflags;
 	int r;
 
-	if (crtc < 0 || crtc >= rdev->num_crtc) {
-		DRM_ERROR("Invalid crtc %d\n", crtc);
+	if (pipe < 0 || pipe >= rdev->num_crtc) {
+		DRM_ERROR("Invalid crtc %d\n", pipe);
 		return -EINVAL;
 	}
 
 	spin_lock_irqsave(&rdev->irq.lock, irqflags);
-	rdev->irq.crtc_vblank_int[crtc] = true;
+	rdev->irq.crtc_vblank_int[pipe] = true;
 	r = radeon_irq_set(rdev);
 	spin_unlock_irqrestore(&rdev->irq.lock, irqflags);
 	return r;
@@ -835,23 +837,24 @@ int radeon_enable_vblank_kms(struct drm_device *dev, int crtc)
 /**
  * radeon_disable_vblank_kms - disable vblank interrupt
  *
- * @dev: drm dev pointer
  * @crtc: crtc to disable vblank interrupt for
  *
  * Disable the interrupt on the requested crtc (all asics).
  */
-void radeon_disable_vblank_kms(struct drm_device *dev, int crtc)
+void radeon_disable_vblank_kms(struct drm_crtc *crtc)
 {
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
 	struct radeon_device *rdev = dev->dev_private;
 	unsigned long irqflags;
 
-	if (crtc < 0 || crtc >= rdev->num_crtc) {
-		DRM_ERROR("Invalid crtc %d\n", crtc);
+	if (pipe < 0 || pipe >= rdev->num_crtc) {
+		DRM_ERROR("Invalid crtc %d\n", pipe);
 		return;
 	}
 
 	spin_lock_irqsave(&rdev->irq.lock, irqflags);
-	rdev->irq.crtc_vblank_int[crtc] = false;
+	rdev->irq.crtc_vblank_int[pipe] = false;
 	radeon_irq_set(rdev);
 	spin_unlock_irqrestore(&rdev->irq.lock, irqflags);
 }
-- 
2.24.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [Intel-gfx] [PATCH 17/23] drm/radeon: Convert to CRTC VBLANK callbacks
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

VBLANK callbacks in struct drm_driver are deprecated in favor of
their equivalents in struct drm_crtc_funcs. Convert radeon over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/radeon/radeon_display.c | 12 ++++++++--
 drivers/gpu/drm/radeon/radeon_drv.c     |  7 ------
 drivers/gpu/drm/radeon/radeon_kms.c     | 29 ++++++++++++++-----------
 3 files changed, 26 insertions(+), 22 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
index 7187158b9963..9116975b6eb9 100644
--- a/drivers/gpu/drm/radeon/radeon_display.c
+++ b/drivers/gpu/drm/radeon/radeon_display.c
@@ -45,6 +45,10 @@
 #include "atom.h"
 #include "radeon.h"
 
+u32 radeon_get_vblank_counter_kms(struct drm_crtc *crtc);
+int radeon_enable_vblank_kms(struct drm_crtc *crtc);
+void radeon_disable_vblank_kms(struct drm_crtc *crtc);
+
 static void avivo_crtc_load_lut(struct drm_crtc *crtc)
 {
 	struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc);
@@ -458,7 +462,7 @@ static void radeon_flip_work_func(struct work_struct *__work)
 		(DRM_SCANOUTPOS_VALID | DRM_SCANOUTPOS_IN_VBLANK) &&
 		(!ASIC_IS_AVIVO(rdev) ||
 		((int) (work->target_vblank -
-		dev->driver->get_vblank_counter(dev, work->crtc_id)) > 0)))
+		crtc->funcs->get_vblank_counter(crtc)) > 0)))
 		usleep_range(1000, 2000);
 
 	/* We borrow the event spin lock for protecting flip_status */
@@ -574,7 +578,7 @@ static int radeon_crtc_page_flip_target(struct drm_crtc *crtc,
 	}
 	work->base = base;
 	work->target_vblank = target - (uint32_t)drm_crtc_vblank_count(crtc) +
-		dev->driver->get_vblank_counter(dev, work->crtc_id);
+		crtc->funcs->get_vblank_counter(crtc);
 
 	/* We borrow the event spin lock for protecting flip_work */
 	spin_lock_irqsave(&crtc->dev->event_lock, flags);
@@ -666,6 +670,10 @@ static const struct drm_crtc_funcs radeon_crtc_funcs = {
 	.set_config = radeon_crtc_set_config,
 	.destroy = radeon_crtc_destroy,
 	.page_flip_target = radeon_crtc_page_flip_target,
+	.get_vblank_counter = radeon_get_vblank_counter_kms,
+	.enable_vblank = radeon_enable_vblank_kms,
+	.disable_vblank = radeon_disable_vblank_kms,
+	.get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
 };
 
 static void radeon_crtc_init(struct drm_device *dev, int index)
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
index 1f597f166bff..49ce2e7d5f9e 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -119,9 +119,6 @@ void radeon_driver_postclose_kms(struct drm_device *dev,
 int radeon_suspend_kms(struct drm_device *dev, bool suspend,
 		       bool fbcon, bool freeze);
 int radeon_resume_kms(struct drm_device *dev, bool resume, bool fbcon);
-u32 radeon_get_vblank_counter_kms(struct drm_device *dev, unsigned int pipe);
-int radeon_enable_vblank_kms(struct drm_device *dev, unsigned int pipe);
-void radeon_disable_vblank_kms(struct drm_device *dev, unsigned int pipe);
 void radeon_driver_irq_preinstall_kms(struct drm_device *dev);
 int radeon_driver_irq_postinstall_kms(struct drm_device *dev);
 void radeon_driver_irq_uninstall_kms(struct drm_device *dev);
@@ -571,10 +568,6 @@ static struct drm_driver kms_driver = {
 	.postclose = radeon_driver_postclose_kms,
 	.lastclose = radeon_driver_lastclose_kms,
 	.unload = radeon_driver_unload_kms,
-	.get_vblank_counter = radeon_get_vblank_counter_kms,
-	.enable_vblank = radeon_enable_vblank_kms,
-	.disable_vblank = radeon_disable_vblank_kms,
-	.get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
 	.irq_preinstall = radeon_driver_irq_preinstall_kms,
 	.irq_postinstall = radeon_driver_irq_postinstall_kms,
 	.irq_uninstall = radeon_driver_irq_uninstall_kms,
diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c
index d24f23a81656..cab891f86dc0 100644
--- a/drivers/gpu/drm/radeon/radeon_kms.c
+++ b/drivers/gpu/drm/radeon/radeon_kms.c
@@ -739,14 +739,15 @@ void radeon_driver_postclose_kms(struct drm_device *dev,
 /**
  * radeon_get_vblank_counter_kms - get frame count
  *
- * @dev: drm dev pointer
- * @pipe: crtc to get the frame count from
+ * @crtc: crtc to get the frame count from
  *
  * Gets the frame count on the requested crtc (all asics).
  * Returns frame count on success, -EINVAL on failure.
  */
-u32 radeon_get_vblank_counter_kms(struct drm_device *dev, unsigned int pipe)
+u32 radeon_get_vblank_counter_kms(struct drm_crtc *crtc)
 {
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
 	int vpos, hpos, stat;
 	u32 count;
 	struct radeon_device *rdev = dev->dev_private;
@@ -808,25 +809,26 @@ u32 radeon_get_vblank_counter_kms(struct drm_device *dev, unsigned int pipe)
 /**
  * radeon_enable_vblank_kms - enable vblank interrupt
  *
- * @dev: drm dev pointer
  * @crtc: crtc to enable vblank interrupt for
  *
  * Enable the interrupt on the requested crtc (all asics).
  * Returns 0 on success, -EINVAL on failure.
  */
-int radeon_enable_vblank_kms(struct drm_device *dev, int crtc)
+int radeon_enable_vblank_kms(struct drm_crtc *crtc)
 {
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
 	struct radeon_device *rdev = dev->dev_private;
 	unsigned long irqflags;
 	int r;
 
-	if (crtc < 0 || crtc >= rdev->num_crtc) {
-		DRM_ERROR("Invalid crtc %d\n", crtc);
+	if (pipe < 0 || pipe >= rdev->num_crtc) {
+		DRM_ERROR("Invalid crtc %d\n", pipe);
 		return -EINVAL;
 	}
 
 	spin_lock_irqsave(&rdev->irq.lock, irqflags);
-	rdev->irq.crtc_vblank_int[crtc] = true;
+	rdev->irq.crtc_vblank_int[pipe] = true;
 	r = radeon_irq_set(rdev);
 	spin_unlock_irqrestore(&rdev->irq.lock, irqflags);
 	return r;
@@ -835,23 +837,24 @@ int radeon_enable_vblank_kms(struct drm_device *dev, int crtc)
 /**
  * radeon_disable_vblank_kms - disable vblank interrupt
  *
- * @dev: drm dev pointer
  * @crtc: crtc to disable vblank interrupt for
  *
  * Disable the interrupt on the requested crtc (all asics).
  */
-void radeon_disable_vblank_kms(struct drm_device *dev, int crtc)
+void radeon_disable_vblank_kms(struct drm_crtc *crtc)
 {
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
 	struct radeon_device *rdev = dev->dev_private;
 	unsigned long irqflags;
 
-	if (crtc < 0 || crtc >= rdev->num_crtc) {
-		DRM_ERROR("Invalid crtc %d\n", crtc);
+	if (pipe < 0 || pipe >= rdev->num_crtc) {
+		DRM_ERROR("Invalid crtc %d\n", pipe);
 		return;
 	}
 
 	spin_lock_irqsave(&rdev->irq.lock, irqflags);
-	rdev->irq.crtc_vblank_int[crtc] = false;
+	rdev->irq.crtc_vblank_int[pipe] = false;
 	radeon_irq_set(rdev);
 	spin_unlock_irqrestore(&rdev->irq.lock, irqflags);
 }
-- 
2.24.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 17/23] drm/radeon: Convert to CRTC VBLANK callbacks
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

VBLANK callbacks in struct drm_driver are deprecated in favor of
their equivalents in struct drm_crtc_funcs. Convert radeon over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/radeon/radeon_display.c | 12 ++++++++--
 drivers/gpu/drm/radeon/radeon_drv.c     |  7 ------
 drivers/gpu/drm/radeon/radeon_kms.c     | 29 ++++++++++++++-----------
 3 files changed, 26 insertions(+), 22 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
index 7187158b9963..9116975b6eb9 100644
--- a/drivers/gpu/drm/radeon/radeon_display.c
+++ b/drivers/gpu/drm/radeon/radeon_display.c
@@ -45,6 +45,10 @@
 #include "atom.h"
 #include "radeon.h"
 
+u32 radeon_get_vblank_counter_kms(struct drm_crtc *crtc);
+int radeon_enable_vblank_kms(struct drm_crtc *crtc);
+void radeon_disable_vblank_kms(struct drm_crtc *crtc);
+
 static void avivo_crtc_load_lut(struct drm_crtc *crtc)
 {
 	struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc);
@@ -458,7 +462,7 @@ static void radeon_flip_work_func(struct work_struct *__work)
 		(DRM_SCANOUTPOS_VALID | DRM_SCANOUTPOS_IN_VBLANK) &&
 		(!ASIC_IS_AVIVO(rdev) ||
 		((int) (work->target_vblank -
-		dev->driver->get_vblank_counter(dev, work->crtc_id)) > 0)))
+		crtc->funcs->get_vblank_counter(crtc)) > 0)))
 		usleep_range(1000, 2000);
 
 	/* We borrow the event spin lock for protecting flip_status */
@@ -574,7 +578,7 @@ static int radeon_crtc_page_flip_target(struct drm_crtc *crtc,
 	}
 	work->base = base;
 	work->target_vblank = target - (uint32_t)drm_crtc_vblank_count(crtc) +
-		dev->driver->get_vblank_counter(dev, work->crtc_id);
+		crtc->funcs->get_vblank_counter(crtc);
 
 	/* We borrow the event spin lock for protecting flip_work */
 	spin_lock_irqsave(&crtc->dev->event_lock, flags);
@@ -666,6 +670,10 @@ static const struct drm_crtc_funcs radeon_crtc_funcs = {
 	.set_config = radeon_crtc_set_config,
 	.destroy = radeon_crtc_destroy,
 	.page_flip_target = radeon_crtc_page_flip_target,
+	.get_vblank_counter = radeon_get_vblank_counter_kms,
+	.enable_vblank = radeon_enable_vblank_kms,
+	.disable_vblank = radeon_disable_vblank_kms,
+	.get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
 };
 
 static void radeon_crtc_init(struct drm_device *dev, int index)
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
index 1f597f166bff..49ce2e7d5f9e 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -119,9 +119,6 @@ void radeon_driver_postclose_kms(struct drm_device *dev,
 int radeon_suspend_kms(struct drm_device *dev, bool suspend,
 		       bool fbcon, bool freeze);
 int radeon_resume_kms(struct drm_device *dev, bool resume, bool fbcon);
-u32 radeon_get_vblank_counter_kms(struct drm_device *dev, unsigned int pipe);
-int radeon_enable_vblank_kms(struct drm_device *dev, unsigned int pipe);
-void radeon_disable_vblank_kms(struct drm_device *dev, unsigned int pipe);
 void radeon_driver_irq_preinstall_kms(struct drm_device *dev);
 int radeon_driver_irq_postinstall_kms(struct drm_device *dev);
 void radeon_driver_irq_uninstall_kms(struct drm_device *dev);
@@ -571,10 +568,6 @@ static struct drm_driver kms_driver = {
 	.postclose = radeon_driver_postclose_kms,
 	.lastclose = radeon_driver_lastclose_kms,
 	.unload = radeon_driver_unload_kms,
-	.get_vblank_counter = radeon_get_vblank_counter_kms,
-	.enable_vblank = radeon_enable_vblank_kms,
-	.disable_vblank = radeon_disable_vblank_kms,
-	.get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
 	.irq_preinstall = radeon_driver_irq_preinstall_kms,
 	.irq_postinstall = radeon_driver_irq_postinstall_kms,
 	.irq_uninstall = radeon_driver_irq_uninstall_kms,
diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c
index d24f23a81656..cab891f86dc0 100644
--- a/drivers/gpu/drm/radeon/radeon_kms.c
+++ b/drivers/gpu/drm/radeon/radeon_kms.c
@@ -739,14 +739,15 @@ void radeon_driver_postclose_kms(struct drm_device *dev,
 /**
  * radeon_get_vblank_counter_kms - get frame count
  *
- * @dev: drm dev pointer
- * @pipe: crtc to get the frame count from
+ * @crtc: crtc to get the frame count from
  *
  * Gets the frame count on the requested crtc (all asics).
  * Returns frame count on success, -EINVAL on failure.
  */
-u32 radeon_get_vblank_counter_kms(struct drm_device *dev, unsigned int pipe)
+u32 radeon_get_vblank_counter_kms(struct drm_crtc *crtc)
 {
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
 	int vpos, hpos, stat;
 	u32 count;
 	struct radeon_device *rdev = dev->dev_private;
@@ -808,25 +809,26 @@ u32 radeon_get_vblank_counter_kms(struct drm_device *dev, unsigned int pipe)
 /**
  * radeon_enable_vblank_kms - enable vblank interrupt
  *
- * @dev: drm dev pointer
  * @crtc: crtc to enable vblank interrupt for
  *
  * Enable the interrupt on the requested crtc (all asics).
  * Returns 0 on success, -EINVAL on failure.
  */
-int radeon_enable_vblank_kms(struct drm_device *dev, int crtc)
+int radeon_enable_vblank_kms(struct drm_crtc *crtc)
 {
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
 	struct radeon_device *rdev = dev->dev_private;
 	unsigned long irqflags;
 	int r;
 
-	if (crtc < 0 || crtc >= rdev->num_crtc) {
-		DRM_ERROR("Invalid crtc %d\n", crtc);
+	if (pipe < 0 || pipe >= rdev->num_crtc) {
+		DRM_ERROR("Invalid crtc %d\n", pipe);
 		return -EINVAL;
 	}
 
 	spin_lock_irqsave(&rdev->irq.lock, irqflags);
-	rdev->irq.crtc_vblank_int[crtc] = true;
+	rdev->irq.crtc_vblank_int[pipe] = true;
 	r = radeon_irq_set(rdev);
 	spin_unlock_irqrestore(&rdev->irq.lock, irqflags);
 	return r;
@@ -835,23 +837,24 @@ int radeon_enable_vblank_kms(struct drm_device *dev, int crtc)
 /**
  * radeon_disable_vblank_kms - disable vblank interrupt
  *
- * @dev: drm dev pointer
  * @crtc: crtc to disable vblank interrupt for
  *
  * Disable the interrupt on the requested crtc (all asics).
  */
-void radeon_disable_vblank_kms(struct drm_device *dev, int crtc)
+void radeon_disable_vblank_kms(struct drm_crtc *crtc)
 {
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
 	struct radeon_device *rdev = dev->dev_private;
 	unsigned long irqflags;
 
-	if (crtc < 0 || crtc >= rdev->num_crtc) {
-		DRM_ERROR("Invalid crtc %d\n", crtc);
+	if (pipe < 0 || pipe >= rdev->num_crtc) {
+		DRM_ERROR("Invalid crtc %d\n", pipe);
 		return;
 	}
 
 	spin_lock_irqsave(&rdev->irq.lock, irqflags);
-	rdev->irq.crtc_vblank_int[crtc] = false;
+	rdev->irq.crtc_vblank_int[pipe] = false;
 	radeon_irq_set(rdev);
 	spin_unlock_irqrestore(&rdev->irq.lock, irqflags);
 }
-- 
2.24.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 18/23] drm/sti: Convert to CRTC VBLANK callbacks
  2020-01-10  9:21 ` Thomas Zimmermann
  (?)
  (?)
@ 2020-01-10  9:21   ` Thomas Zimmermann
  -1 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: dri-devel, amd-gfx, intel-gfx, linux-arm-msm, freedreno, nouveau,
	Thomas Zimmermann

VBLANK callbacks in struct drm_driver are deprecated in favor of
their equivalents in struct drm_crtc_funcs. Convert sti over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/sti/sti_crtc.c | 11 ++++++++---
 drivers/gpu/drm/sti/sti_crtc.h |  2 --
 drivers/gpu/drm/sti/sti_drv.c  |  3 ---
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/sti/sti_crtc.c b/drivers/gpu/drm/sti/sti_crtc.c
index dc64fbfc4e61..49e6cb8f5836 100644
--- a/drivers/gpu/drm/sti/sti_crtc.c
+++ b/drivers/gpu/drm/sti/sti_crtc.c
@@ -279,12 +279,13 @@ int sti_crtc_vblank_cb(struct notifier_block *nb,
 	return 0;
 }
 
-int sti_crtc_enable_vblank(struct drm_device *dev, unsigned int pipe)
+static int sti_crtc_enable_vblank(struct drm_crtc *crtc)
 {
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
 	struct sti_private *dev_priv = dev->dev_private;
 	struct sti_compositor *compo = dev_priv->compo;
 	struct notifier_block *vtg_vblank_nb = &compo->vtg_vblank_nb[pipe];
-	struct drm_crtc *crtc = &compo->mixer[pipe]->drm_crtc;
 	struct sti_vtg *vtg = compo->vtg[pipe];
 
 	DRM_DEBUG_DRIVER("\n");
@@ -297,8 +298,10 @@ int sti_crtc_enable_vblank(struct drm_device *dev, unsigned int pipe)
 	return 0;
 }
 
-void sti_crtc_disable_vblank(struct drm_device *drm_dev, unsigned int pipe)
+static void sti_crtc_disable_vblank(struct drm_crtc *crtc)
 {
+	struct drm_device *drm_dev = crtc->dev;
+	unsigned int pipe = crtc->index;
 	struct sti_private *priv = drm_dev->dev_private;
 	struct sti_compositor *compo = priv->compo;
 	struct notifier_block *vtg_vblank_nb = &compo->vtg_vblank_nb[pipe];
@@ -330,6 +333,8 @@ static const struct drm_crtc_funcs sti_crtc_funcs = {
 	.atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
 	.atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
 	.late_register = sti_crtc_late_register,
+	.enable_vblank = sti_crtc_enable_vblank,
+	.disable_vblank = sti_crtc_disable_vblank,
 };
 
 bool sti_crtc_is_main(struct drm_crtc *crtc)
diff --git a/drivers/gpu/drm/sti/sti_crtc.h b/drivers/gpu/drm/sti/sti_crtc.h
index df489ab14e2b..1132b4586712 100644
--- a/drivers/gpu/drm/sti/sti_crtc.h
+++ b/drivers/gpu/drm/sti/sti_crtc.h
@@ -15,8 +15,6 @@ struct sti_mixer;
 
 int sti_crtc_init(struct drm_device *drm_dev, struct sti_mixer *mixer,
 		  struct drm_plane *primary, struct drm_plane *cursor);
-int sti_crtc_enable_vblank(struct drm_device *dev, unsigned int pipe);
-void sti_crtc_disable_vblank(struct drm_device *dev, unsigned int pipe);
 int sti_crtc_vblank_cb(struct notifier_block *nb,
 		       unsigned long event, void *data);
 bool sti_crtc_is_main(struct drm_crtc *drm_crtc);
diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c
index a39fc36f815b..8e30001bf545 100644
--- a/drivers/gpu/drm/sti/sti_drv.c
+++ b/drivers/gpu/drm/sti/sti_drv.c
@@ -146,9 +146,6 @@ static struct drm_driver sti_driver = {
 	.dumb_create = drm_gem_cma_dumb_create,
 	.fops = &sti_driver_fops,
 
-	.enable_vblank = sti_crtc_enable_vblank,
-	.disable_vblank = sti_crtc_disable_vblank,
-
 	.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
 	.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
 	.gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table,
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 18/23] drm/sti: Convert to CRTC VBLANK callbacks
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

VBLANK callbacks in struct drm_driver are deprecated in favor of
their equivalents in struct drm_crtc_funcs. Convert sti over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/sti/sti_crtc.c | 11 ++++++++---
 drivers/gpu/drm/sti/sti_crtc.h |  2 --
 drivers/gpu/drm/sti/sti_drv.c  |  3 ---
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/sti/sti_crtc.c b/drivers/gpu/drm/sti/sti_crtc.c
index dc64fbfc4e61..49e6cb8f5836 100644
--- a/drivers/gpu/drm/sti/sti_crtc.c
+++ b/drivers/gpu/drm/sti/sti_crtc.c
@@ -279,12 +279,13 @@ int sti_crtc_vblank_cb(struct notifier_block *nb,
 	return 0;
 }
 
-int sti_crtc_enable_vblank(struct drm_device *dev, unsigned int pipe)
+static int sti_crtc_enable_vblank(struct drm_crtc *crtc)
 {
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
 	struct sti_private *dev_priv = dev->dev_private;
 	struct sti_compositor *compo = dev_priv->compo;
 	struct notifier_block *vtg_vblank_nb = &compo->vtg_vblank_nb[pipe];
-	struct drm_crtc *crtc = &compo->mixer[pipe]->drm_crtc;
 	struct sti_vtg *vtg = compo->vtg[pipe];
 
 	DRM_DEBUG_DRIVER("\n");
@@ -297,8 +298,10 @@ int sti_crtc_enable_vblank(struct drm_device *dev, unsigned int pipe)
 	return 0;
 }
 
-void sti_crtc_disable_vblank(struct drm_device *drm_dev, unsigned int pipe)
+static void sti_crtc_disable_vblank(struct drm_crtc *crtc)
 {
+	struct drm_device *drm_dev = crtc->dev;
+	unsigned int pipe = crtc->index;
 	struct sti_private *priv = drm_dev->dev_private;
 	struct sti_compositor *compo = priv->compo;
 	struct notifier_block *vtg_vblank_nb = &compo->vtg_vblank_nb[pipe];
@@ -330,6 +333,8 @@ static const struct drm_crtc_funcs sti_crtc_funcs = {
 	.atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
 	.atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
 	.late_register = sti_crtc_late_register,
+	.enable_vblank = sti_crtc_enable_vblank,
+	.disable_vblank = sti_crtc_disable_vblank,
 };
 
 bool sti_crtc_is_main(struct drm_crtc *crtc)
diff --git a/drivers/gpu/drm/sti/sti_crtc.h b/drivers/gpu/drm/sti/sti_crtc.h
index df489ab14e2b..1132b4586712 100644
--- a/drivers/gpu/drm/sti/sti_crtc.h
+++ b/drivers/gpu/drm/sti/sti_crtc.h
@@ -15,8 +15,6 @@ struct sti_mixer;
 
 int sti_crtc_init(struct drm_device *drm_dev, struct sti_mixer *mixer,
 		  struct drm_plane *primary, struct drm_plane *cursor);
-int sti_crtc_enable_vblank(struct drm_device *dev, unsigned int pipe);
-void sti_crtc_disable_vblank(struct drm_device *dev, unsigned int pipe);
 int sti_crtc_vblank_cb(struct notifier_block *nb,
 		       unsigned long event, void *data);
 bool sti_crtc_is_main(struct drm_crtc *drm_crtc);
diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c
index a39fc36f815b..8e30001bf545 100644
--- a/drivers/gpu/drm/sti/sti_drv.c
+++ b/drivers/gpu/drm/sti/sti_drv.c
@@ -146,9 +146,6 @@ static struct drm_driver sti_driver = {
 	.dumb_create = drm_gem_cma_dumb_create,
 	.fops = &sti_driver_fops,
 
-	.enable_vblank = sti_crtc_enable_vblank,
-	.disable_vblank = sti_crtc_disable_vblank,
-
 	.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
 	.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
 	.gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table,
-- 
2.24.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [Intel-gfx] [PATCH 18/23] drm/sti: Convert to CRTC VBLANK callbacks
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

VBLANK callbacks in struct drm_driver are deprecated in favor of
their equivalents in struct drm_crtc_funcs. Convert sti over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/sti/sti_crtc.c | 11 ++++++++---
 drivers/gpu/drm/sti/sti_crtc.h |  2 --
 drivers/gpu/drm/sti/sti_drv.c  |  3 ---
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/sti/sti_crtc.c b/drivers/gpu/drm/sti/sti_crtc.c
index dc64fbfc4e61..49e6cb8f5836 100644
--- a/drivers/gpu/drm/sti/sti_crtc.c
+++ b/drivers/gpu/drm/sti/sti_crtc.c
@@ -279,12 +279,13 @@ int sti_crtc_vblank_cb(struct notifier_block *nb,
 	return 0;
 }
 
-int sti_crtc_enable_vblank(struct drm_device *dev, unsigned int pipe)
+static int sti_crtc_enable_vblank(struct drm_crtc *crtc)
 {
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
 	struct sti_private *dev_priv = dev->dev_private;
 	struct sti_compositor *compo = dev_priv->compo;
 	struct notifier_block *vtg_vblank_nb = &compo->vtg_vblank_nb[pipe];
-	struct drm_crtc *crtc = &compo->mixer[pipe]->drm_crtc;
 	struct sti_vtg *vtg = compo->vtg[pipe];
 
 	DRM_DEBUG_DRIVER("\n");
@@ -297,8 +298,10 @@ int sti_crtc_enable_vblank(struct drm_device *dev, unsigned int pipe)
 	return 0;
 }
 
-void sti_crtc_disable_vblank(struct drm_device *drm_dev, unsigned int pipe)
+static void sti_crtc_disable_vblank(struct drm_crtc *crtc)
 {
+	struct drm_device *drm_dev = crtc->dev;
+	unsigned int pipe = crtc->index;
 	struct sti_private *priv = drm_dev->dev_private;
 	struct sti_compositor *compo = priv->compo;
 	struct notifier_block *vtg_vblank_nb = &compo->vtg_vblank_nb[pipe];
@@ -330,6 +333,8 @@ static const struct drm_crtc_funcs sti_crtc_funcs = {
 	.atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
 	.atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
 	.late_register = sti_crtc_late_register,
+	.enable_vblank = sti_crtc_enable_vblank,
+	.disable_vblank = sti_crtc_disable_vblank,
 };
 
 bool sti_crtc_is_main(struct drm_crtc *crtc)
diff --git a/drivers/gpu/drm/sti/sti_crtc.h b/drivers/gpu/drm/sti/sti_crtc.h
index df489ab14e2b..1132b4586712 100644
--- a/drivers/gpu/drm/sti/sti_crtc.h
+++ b/drivers/gpu/drm/sti/sti_crtc.h
@@ -15,8 +15,6 @@ struct sti_mixer;
 
 int sti_crtc_init(struct drm_device *drm_dev, struct sti_mixer *mixer,
 		  struct drm_plane *primary, struct drm_plane *cursor);
-int sti_crtc_enable_vblank(struct drm_device *dev, unsigned int pipe);
-void sti_crtc_disable_vblank(struct drm_device *dev, unsigned int pipe);
 int sti_crtc_vblank_cb(struct notifier_block *nb,
 		       unsigned long event, void *data);
 bool sti_crtc_is_main(struct drm_crtc *drm_crtc);
diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c
index a39fc36f815b..8e30001bf545 100644
--- a/drivers/gpu/drm/sti/sti_drv.c
+++ b/drivers/gpu/drm/sti/sti_drv.c
@@ -146,9 +146,6 @@ static struct drm_driver sti_driver = {
 	.dumb_create = drm_gem_cma_dumb_create,
 	.fops = &sti_driver_fops,
 
-	.enable_vblank = sti_crtc_enable_vblank,
-	.disable_vblank = sti_crtc_disable_vblank,
-
 	.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
 	.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
 	.gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table,
-- 
2.24.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 18/23] drm/sti: Convert to CRTC VBLANK callbacks
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

VBLANK callbacks in struct drm_driver are deprecated in favor of
their equivalents in struct drm_crtc_funcs. Convert sti over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/sti/sti_crtc.c | 11 ++++++++---
 drivers/gpu/drm/sti/sti_crtc.h |  2 --
 drivers/gpu/drm/sti/sti_drv.c  |  3 ---
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/sti/sti_crtc.c b/drivers/gpu/drm/sti/sti_crtc.c
index dc64fbfc4e61..49e6cb8f5836 100644
--- a/drivers/gpu/drm/sti/sti_crtc.c
+++ b/drivers/gpu/drm/sti/sti_crtc.c
@@ -279,12 +279,13 @@ int sti_crtc_vblank_cb(struct notifier_block *nb,
 	return 0;
 }
 
-int sti_crtc_enable_vblank(struct drm_device *dev, unsigned int pipe)
+static int sti_crtc_enable_vblank(struct drm_crtc *crtc)
 {
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
 	struct sti_private *dev_priv = dev->dev_private;
 	struct sti_compositor *compo = dev_priv->compo;
 	struct notifier_block *vtg_vblank_nb = &compo->vtg_vblank_nb[pipe];
-	struct drm_crtc *crtc = &compo->mixer[pipe]->drm_crtc;
 	struct sti_vtg *vtg = compo->vtg[pipe];
 
 	DRM_DEBUG_DRIVER("\n");
@@ -297,8 +298,10 @@ int sti_crtc_enable_vblank(struct drm_device *dev, unsigned int pipe)
 	return 0;
 }
 
-void sti_crtc_disable_vblank(struct drm_device *drm_dev, unsigned int pipe)
+static void sti_crtc_disable_vblank(struct drm_crtc *crtc)
 {
+	struct drm_device *drm_dev = crtc->dev;
+	unsigned int pipe = crtc->index;
 	struct sti_private *priv = drm_dev->dev_private;
 	struct sti_compositor *compo = priv->compo;
 	struct notifier_block *vtg_vblank_nb = &compo->vtg_vblank_nb[pipe];
@@ -330,6 +333,8 @@ static const struct drm_crtc_funcs sti_crtc_funcs = {
 	.atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
 	.atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
 	.late_register = sti_crtc_late_register,
+	.enable_vblank = sti_crtc_enable_vblank,
+	.disable_vblank = sti_crtc_disable_vblank,
 };
 
 bool sti_crtc_is_main(struct drm_crtc *crtc)
diff --git a/drivers/gpu/drm/sti/sti_crtc.h b/drivers/gpu/drm/sti/sti_crtc.h
index df489ab14e2b..1132b4586712 100644
--- a/drivers/gpu/drm/sti/sti_crtc.h
+++ b/drivers/gpu/drm/sti/sti_crtc.h
@@ -15,8 +15,6 @@ struct sti_mixer;
 
 int sti_crtc_init(struct drm_device *drm_dev, struct sti_mixer *mixer,
 		  struct drm_plane *primary, struct drm_plane *cursor);
-int sti_crtc_enable_vblank(struct drm_device *dev, unsigned int pipe);
-void sti_crtc_disable_vblank(struct drm_device *dev, unsigned int pipe);
 int sti_crtc_vblank_cb(struct notifier_block *nb,
 		       unsigned long event, void *data);
 bool sti_crtc_is_main(struct drm_crtc *drm_crtc);
diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c
index a39fc36f815b..8e30001bf545 100644
--- a/drivers/gpu/drm/sti/sti_drv.c
+++ b/drivers/gpu/drm/sti/sti_drv.c
@@ -146,9 +146,6 @@ static struct drm_driver sti_driver = {
 	.dumb_create = drm_gem_cma_dumb_create,
 	.fops = &sti_driver_fops,
 
-	.enable_vblank = sti_crtc_enable_vblank,
-	.disable_vblank = sti_crtc_disable_vblank,
-
 	.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
 	.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
 	.gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table,
-- 
2.24.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 19/23] drm/stm: Convert to CRTC VBLANK callbacks
  2020-01-10  9:21 ` Thomas Zimmermann
  (?)
  (?)
@ 2020-01-10  9:21   ` Thomas Zimmermann
  -1 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: dri-devel, amd-gfx, intel-gfx, linux-arm-msm, freedreno, nouveau,
	Thomas Zimmermann

VBLANK callbacks in struct drm_driver are deprecated in favor of
their equivalents in struct drm_crtc_funcs. Convert stm over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/stm/drv.c  | 1 -
 drivers/gpu/drm/stm/ltdc.c | 1 +
 2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/stm/drv.c b/drivers/gpu/drm/stm/drv.c
index 486985604109..ea9fcbdc68b3 100644
--- a/drivers/gpu/drm/stm/drv.c
+++ b/drivers/gpu/drm/stm/drv.c
@@ -72,7 +72,6 @@ static struct drm_driver drv_driver = {
 	.gem_prime_vmap = drm_gem_cma_prime_vmap,
 	.gem_prime_vunmap = drm_gem_cma_prime_vunmap,
 	.gem_prime_mmap = drm_gem_cma_prime_mmap,
-	.get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
 };
 
 static int drv_load(struct drm_device *ddev)
diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
index 8b6d1a2252e3..4fe9b033de1b 100644
--- a/drivers/gpu/drm/stm/ltdc.c
+++ b/drivers/gpu/drm/stm/ltdc.c
@@ -722,6 +722,7 @@ static const struct drm_crtc_funcs ltdc_crtc_funcs = {
 	.atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
 	.enable_vblank = ltdc_crtc_enable_vblank,
 	.disable_vblank = ltdc_crtc_disable_vblank,
+	.get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
 	.gamma_set = drm_atomic_helper_legacy_gamma_set,
 };
 
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 19/23] drm/stm: Convert to CRTC VBLANK callbacks
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

VBLANK callbacks in struct drm_driver are deprecated in favor of
their equivalents in struct drm_crtc_funcs. Convert stm over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/stm/drv.c  | 1 -
 drivers/gpu/drm/stm/ltdc.c | 1 +
 2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/stm/drv.c b/drivers/gpu/drm/stm/drv.c
index 486985604109..ea9fcbdc68b3 100644
--- a/drivers/gpu/drm/stm/drv.c
+++ b/drivers/gpu/drm/stm/drv.c
@@ -72,7 +72,6 @@ static struct drm_driver drv_driver = {
 	.gem_prime_vmap = drm_gem_cma_prime_vmap,
 	.gem_prime_vunmap = drm_gem_cma_prime_vunmap,
 	.gem_prime_mmap = drm_gem_cma_prime_mmap,
-	.get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
 };
 
 static int drv_load(struct drm_device *ddev)
diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
index 8b6d1a2252e3..4fe9b033de1b 100644
--- a/drivers/gpu/drm/stm/ltdc.c
+++ b/drivers/gpu/drm/stm/ltdc.c
@@ -722,6 +722,7 @@ static const struct drm_crtc_funcs ltdc_crtc_funcs = {
 	.atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
 	.enable_vblank = ltdc_crtc_enable_vblank,
 	.disable_vblank = ltdc_crtc_disable_vblank,
+	.get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
 	.gamma_set = drm_atomic_helper_legacy_gamma_set,
 };
 
-- 
2.24.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [Intel-gfx] [PATCH 19/23] drm/stm: Convert to CRTC VBLANK callbacks
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

VBLANK callbacks in struct drm_driver are deprecated in favor of
their equivalents in struct drm_crtc_funcs. Convert stm over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/stm/drv.c  | 1 -
 drivers/gpu/drm/stm/ltdc.c | 1 +
 2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/stm/drv.c b/drivers/gpu/drm/stm/drv.c
index 486985604109..ea9fcbdc68b3 100644
--- a/drivers/gpu/drm/stm/drv.c
+++ b/drivers/gpu/drm/stm/drv.c
@@ -72,7 +72,6 @@ static struct drm_driver drv_driver = {
 	.gem_prime_vmap = drm_gem_cma_prime_vmap,
 	.gem_prime_vunmap = drm_gem_cma_prime_vunmap,
 	.gem_prime_mmap = drm_gem_cma_prime_mmap,
-	.get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
 };
 
 static int drv_load(struct drm_device *ddev)
diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
index 8b6d1a2252e3..4fe9b033de1b 100644
--- a/drivers/gpu/drm/stm/ltdc.c
+++ b/drivers/gpu/drm/stm/ltdc.c
@@ -722,6 +722,7 @@ static const struct drm_crtc_funcs ltdc_crtc_funcs = {
 	.atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
 	.enable_vblank = ltdc_crtc_enable_vblank,
 	.disable_vblank = ltdc_crtc_disable_vblank,
+	.get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
 	.gamma_set = drm_atomic_helper_legacy_gamma_set,
 };
 
-- 
2.24.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 19/23] drm/stm: Convert to CRTC VBLANK callbacks
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

VBLANK callbacks in struct drm_driver are deprecated in favor of
their equivalents in struct drm_crtc_funcs. Convert stm over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/stm/drv.c  | 1 -
 drivers/gpu/drm/stm/ltdc.c | 1 +
 2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/stm/drv.c b/drivers/gpu/drm/stm/drv.c
index 486985604109..ea9fcbdc68b3 100644
--- a/drivers/gpu/drm/stm/drv.c
+++ b/drivers/gpu/drm/stm/drv.c
@@ -72,7 +72,6 @@ static struct drm_driver drv_driver = {
 	.gem_prime_vmap = drm_gem_cma_prime_vmap,
 	.gem_prime_vunmap = drm_gem_cma_prime_vunmap,
 	.gem_prime_mmap = drm_gem_cma_prime_mmap,
-	.get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
 };
 
 static int drv_load(struct drm_device *ddev)
diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
index 8b6d1a2252e3..4fe9b033de1b 100644
--- a/drivers/gpu/drm/stm/ltdc.c
+++ b/drivers/gpu/drm/stm/ltdc.c
@@ -722,6 +722,7 @@ static const struct drm_crtc_funcs ltdc_crtc_funcs = {
 	.atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
 	.enable_vblank = ltdc_crtc_enable_vblank,
 	.disable_vblank = ltdc_crtc_disable_vblank,
+	.get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
 	.gamma_set = drm_atomic_helper_legacy_gamma_set,
 };
 
-- 
2.24.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 20/23] drm/vc4: Convert to CRTC VBLANK callbacks
  2020-01-10  9:21 ` Thomas Zimmermann
  (?)
  (?)
@ 2020-01-10  9:21   ` Thomas Zimmermann
  -1 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: dri-devel, amd-gfx, intel-gfx, linux-arm-msm, freedreno, nouveau,
	Thomas Zimmermann

VBLANK callbacks in struct drm_driver are deprecated in favor of
their equivalents in struct drm_crtc_funcs. Convert vc4 over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/vc4/vc4_crtc.c | 1 +
 drivers/gpu/drm/vc4/vc4_drv.c  | 2 --
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c
index f1e7597ea17e..e4081634648d 100644
--- a/drivers/gpu/drm/vc4/vc4_crtc.c
+++ b/drivers/gpu/drm/vc4/vc4_crtc.c
@@ -1031,6 +1031,7 @@ static const struct drm_crtc_funcs vc4_crtc_funcs = {
 	.gamma_set = drm_atomic_helper_legacy_gamma_set,
 	.enable_vblank = vc4_enable_vblank,
 	.disable_vblank = vc4_disable_vblank,
+	.get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
 };
 
 static const struct drm_crtc_helper_funcs vc4_crtc_helper_funcs = {
diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c
index e6982a7b0c5e..76f93b662766 100644
--- a/drivers/gpu/drm/vc4/vc4_drv.c
+++ b/drivers/gpu/drm/vc4/vc4_drv.c
@@ -190,8 +190,6 @@ static struct drm_driver vc4_drm_driver = {
 	.irq_postinstall = vc4_irq_postinstall,
 	.irq_uninstall = vc4_irq_uninstall,
 
-	.get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
-
 #if defined(CONFIG_DEBUG_FS)
 	.debugfs_init = vc4_debugfs_init,
 #endif
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 20/23] drm/vc4: Convert to CRTC VBLANK callbacks
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

VBLANK callbacks in struct drm_driver are deprecated in favor of
their equivalents in struct drm_crtc_funcs. Convert vc4 over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/vc4/vc4_crtc.c | 1 +
 drivers/gpu/drm/vc4/vc4_drv.c  | 2 --
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c
index f1e7597ea17e..e4081634648d 100644
--- a/drivers/gpu/drm/vc4/vc4_crtc.c
+++ b/drivers/gpu/drm/vc4/vc4_crtc.c
@@ -1031,6 +1031,7 @@ static const struct drm_crtc_funcs vc4_crtc_funcs = {
 	.gamma_set = drm_atomic_helper_legacy_gamma_set,
 	.enable_vblank = vc4_enable_vblank,
 	.disable_vblank = vc4_disable_vblank,
+	.get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
 };
 
 static const struct drm_crtc_helper_funcs vc4_crtc_helper_funcs = {
diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c
index e6982a7b0c5e..76f93b662766 100644
--- a/drivers/gpu/drm/vc4/vc4_drv.c
+++ b/drivers/gpu/drm/vc4/vc4_drv.c
@@ -190,8 +190,6 @@ static struct drm_driver vc4_drm_driver = {
 	.irq_postinstall = vc4_irq_postinstall,
 	.irq_uninstall = vc4_irq_uninstall,
 
-	.get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
-
 #if defined(CONFIG_DEBUG_FS)
 	.debugfs_init = vc4_debugfs_init,
 #endif
-- 
2.24.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [Intel-gfx] [PATCH 20/23] drm/vc4: Convert to CRTC VBLANK callbacks
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

VBLANK callbacks in struct drm_driver are deprecated in favor of
their equivalents in struct drm_crtc_funcs. Convert vc4 over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/vc4/vc4_crtc.c | 1 +
 drivers/gpu/drm/vc4/vc4_drv.c  | 2 --
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c
index f1e7597ea17e..e4081634648d 100644
--- a/drivers/gpu/drm/vc4/vc4_crtc.c
+++ b/drivers/gpu/drm/vc4/vc4_crtc.c
@@ -1031,6 +1031,7 @@ static const struct drm_crtc_funcs vc4_crtc_funcs = {
 	.gamma_set = drm_atomic_helper_legacy_gamma_set,
 	.enable_vblank = vc4_enable_vblank,
 	.disable_vblank = vc4_disable_vblank,
+	.get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
 };
 
 static const struct drm_crtc_helper_funcs vc4_crtc_helper_funcs = {
diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c
index e6982a7b0c5e..76f93b662766 100644
--- a/drivers/gpu/drm/vc4/vc4_drv.c
+++ b/drivers/gpu/drm/vc4/vc4_drv.c
@@ -190,8 +190,6 @@ static struct drm_driver vc4_drm_driver = {
 	.irq_postinstall = vc4_irq_postinstall,
 	.irq_uninstall = vc4_irq_uninstall,
 
-	.get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
-
 #if defined(CONFIG_DEBUG_FS)
 	.debugfs_init = vc4_debugfs_init,
 #endif
-- 
2.24.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 20/23] drm/vc4: Convert to CRTC VBLANK callbacks
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

VBLANK callbacks in struct drm_driver are deprecated in favor of
their equivalents in struct drm_crtc_funcs. Convert vc4 over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/vc4/vc4_crtc.c | 1 +
 drivers/gpu/drm/vc4/vc4_drv.c  | 2 --
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c
index f1e7597ea17e..e4081634648d 100644
--- a/drivers/gpu/drm/vc4/vc4_crtc.c
+++ b/drivers/gpu/drm/vc4/vc4_crtc.c
@@ -1031,6 +1031,7 @@ static const struct drm_crtc_funcs vc4_crtc_funcs = {
 	.gamma_set = drm_atomic_helper_legacy_gamma_set,
 	.enable_vblank = vc4_enable_vblank,
 	.disable_vblank = vc4_disable_vblank,
+	.get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
 };
 
 static const struct drm_crtc_helper_funcs vc4_crtc_helper_funcs = {
diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c
index e6982a7b0c5e..76f93b662766 100644
--- a/drivers/gpu/drm/vc4/vc4_drv.c
+++ b/drivers/gpu/drm/vc4/vc4_drv.c
@@ -190,8 +190,6 @@ static struct drm_driver vc4_drm_driver = {
 	.irq_postinstall = vc4_irq_postinstall,
 	.irq_uninstall = vc4_irq_uninstall,
 
-	.get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
-
 #if defined(CONFIG_DEBUG_FS)
 	.debugfs_init = vc4_debugfs_init,
 #endif
-- 
2.24.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 21/23] drm/vkms: Convert to CRTC VBLANK callbacks
  2020-01-10  9:21 ` Thomas Zimmermann
  (?)
  (?)
@ 2020-01-10  9:21   ` Thomas Zimmermann
  -1 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: dri-devel, amd-gfx, intel-gfx, linux-arm-msm, freedreno, nouveau,
	Thomas Zimmermann

VBLANK callbacks in struct drm_driver are deprecated in favor of
their equivalents in struct drm_crtc_funcs. Convert vkms over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/vkms/vkms_crtc.c | 9 ++++++---
 drivers/gpu/drm/vkms/vkms_drv.c  | 1 -
 drivers/gpu/drm/vkms/vkms_drv.h  | 4 ----
 3 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/vkms/vkms_crtc.c b/drivers/gpu/drm/vkms/vkms_crtc.c
index 74f703b8d22a..ac85e17428f8 100644
--- a/drivers/gpu/drm/vkms/vkms_crtc.c
+++ b/drivers/gpu/drm/vkms/vkms_crtc.c
@@ -76,10 +76,12 @@ static void vkms_disable_vblank(struct drm_crtc *crtc)
 	hrtimer_cancel(&out->vblank_hrtimer);
 }
 
-bool vkms_get_vblank_timestamp(struct drm_device *dev, unsigned int pipe,
-			       int *max_error, ktime_t *vblank_time,
-			       bool in_vblank_irq)
+static bool vkms_get_vblank_timestamp(struct drm_crtc *crtc,
+				      int *max_error, ktime_t *vblank_time,
+				      bool in_vblank_irq)
 {
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
 	struct vkms_device *vkmsdev = drm_device_to_vkms_device(dev);
 	struct vkms_output *output = &vkmsdev->output;
 	struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
@@ -154,6 +156,7 @@ static const struct drm_crtc_funcs vkms_crtc_funcs = {
 	.atomic_destroy_state   = vkms_atomic_crtc_destroy_state,
 	.enable_vblank		= vkms_enable_vblank,
 	.disable_vblank		= vkms_disable_vblank,
+	.get_vblank_timestamp	= vkms_get_vblank_timestamp,
 	.get_crc_sources	= vkms_get_crc_sources,
 	.set_crc_source		= vkms_set_crc_source,
 	.verify_crc_source	= vkms_verify_crc_source,
diff --git a/drivers/gpu/drm/vkms/vkms_drv.c b/drivers/gpu/drm/vkms/vkms_drv.c
index 25bd7519295f..860de052e820 100644
--- a/drivers/gpu/drm/vkms/vkms_drv.c
+++ b/drivers/gpu/drm/vkms/vkms_drv.c
@@ -103,7 +103,6 @@ static struct drm_driver vkms_driver = {
 	.dumb_create		= vkms_dumb_create,
 	.gem_vm_ops		= &vkms_gem_vm_ops,
 	.gem_free_object_unlocked = vkms_gem_free_object,
-	.get_vblank_timestamp	= vkms_get_vblank_timestamp,
 	.prime_fd_to_handle	= drm_gem_prime_fd_to_handle,
 	.gem_prime_import_sg_table = vkms_prime_import_sg_table,
 
diff --git a/drivers/gpu/drm/vkms/vkms_drv.h b/drivers/gpu/drm/vkms/vkms_drv.h
index 7d52e24564db..eda04ffba7b1 100644
--- a/drivers/gpu/drm/vkms/vkms_drv.h
+++ b/drivers/gpu/drm/vkms/vkms_drv.h
@@ -111,10 +111,6 @@ struct vkms_gem_object {
 int vkms_crtc_init(struct drm_device *dev, struct drm_crtc *crtc,
 		   struct drm_plane *primary, struct drm_plane *cursor);
 
-bool vkms_get_vblank_timestamp(struct drm_device *dev, unsigned int pipe,
-			       int *max_error, ktime_t *vblank_time,
-			       bool in_vblank_irq);
-
 int vkms_output_init(struct vkms_device *vkmsdev, int index);
 
 struct drm_plane *vkms_plane_init(struct vkms_device *vkmsdev,
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 21/23] drm/vkms: Convert to CRTC VBLANK callbacks
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

VBLANK callbacks in struct drm_driver are deprecated in favor of
their equivalents in struct drm_crtc_funcs. Convert vkms over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/vkms/vkms_crtc.c | 9 ++++++---
 drivers/gpu/drm/vkms/vkms_drv.c  | 1 -
 drivers/gpu/drm/vkms/vkms_drv.h  | 4 ----
 3 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/vkms/vkms_crtc.c b/drivers/gpu/drm/vkms/vkms_crtc.c
index 74f703b8d22a..ac85e17428f8 100644
--- a/drivers/gpu/drm/vkms/vkms_crtc.c
+++ b/drivers/gpu/drm/vkms/vkms_crtc.c
@@ -76,10 +76,12 @@ static void vkms_disable_vblank(struct drm_crtc *crtc)
 	hrtimer_cancel(&out->vblank_hrtimer);
 }
 
-bool vkms_get_vblank_timestamp(struct drm_device *dev, unsigned int pipe,
-			       int *max_error, ktime_t *vblank_time,
-			       bool in_vblank_irq)
+static bool vkms_get_vblank_timestamp(struct drm_crtc *crtc,
+				      int *max_error, ktime_t *vblank_time,
+				      bool in_vblank_irq)
 {
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
 	struct vkms_device *vkmsdev = drm_device_to_vkms_device(dev);
 	struct vkms_output *output = &vkmsdev->output;
 	struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
@@ -154,6 +156,7 @@ static const struct drm_crtc_funcs vkms_crtc_funcs = {
 	.atomic_destroy_state   = vkms_atomic_crtc_destroy_state,
 	.enable_vblank		= vkms_enable_vblank,
 	.disable_vblank		= vkms_disable_vblank,
+	.get_vblank_timestamp	= vkms_get_vblank_timestamp,
 	.get_crc_sources	= vkms_get_crc_sources,
 	.set_crc_source		= vkms_set_crc_source,
 	.verify_crc_source	= vkms_verify_crc_source,
diff --git a/drivers/gpu/drm/vkms/vkms_drv.c b/drivers/gpu/drm/vkms/vkms_drv.c
index 25bd7519295f..860de052e820 100644
--- a/drivers/gpu/drm/vkms/vkms_drv.c
+++ b/drivers/gpu/drm/vkms/vkms_drv.c
@@ -103,7 +103,6 @@ static struct drm_driver vkms_driver = {
 	.dumb_create		= vkms_dumb_create,
 	.gem_vm_ops		= &vkms_gem_vm_ops,
 	.gem_free_object_unlocked = vkms_gem_free_object,
-	.get_vblank_timestamp	= vkms_get_vblank_timestamp,
 	.prime_fd_to_handle	= drm_gem_prime_fd_to_handle,
 	.gem_prime_import_sg_table = vkms_prime_import_sg_table,
 
diff --git a/drivers/gpu/drm/vkms/vkms_drv.h b/drivers/gpu/drm/vkms/vkms_drv.h
index 7d52e24564db..eda04ffba7b1 100644
--- a/drivers/gpu/drm/vkms/vkms_drv.h
+++ b/drivers/gpu/drm/vkms/vkms_drv.h
@@ -111,10 +111,6 @@ struct vkms_gem_object {
 int vkms_crtc_init(struct drm_device *dev, struct drm_crtc *crtc,
 		   struct drm_plane *primary, struct drm_plane *cursor);
 
-bool vkms_get_vblank_timestamp(struct drm_device *dev, unsigned int pipe,
-			       int *max_error, ktime_t *vblank_time,
-			       bool in_vblank_irq);
-
 int vkms_output_init(struct vkms_device *vkmsdev, int index);
 
 struct drm_plane *vkms_plane_init(struct vkms_device *vkmsdev,
-- 
2.24.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [Intel-gfx] [PATCH 21/23] drm/vkms: Convert to CRTC VBLANK callbacks
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

VBLANK callbacks in struct drm_driver are deprecated in favor of
their equivalents in struct drm_crtc_funcs. Convert vkms over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/vkms/vkms_crtc.c | 9 ++++++---
 drivers/gpu/drm/vkms/vkms_drv.c  | 1 -
 drivers/gpu/drm/vkms/vkms_drv.h  | 4 ----
 3 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/vkms/vkms_crtc.c b/drivers/gpu/drm/vkms/vkms_crtc.c
index 74f703b8d22a..ac85e17428f8 100644
--- a/drivers/gpu/drm/vkms/vkms_crtc.c
+++ b/drivers/gpu/drm/vkms/vkms_crtc.c
@@ -76,10 +76,12 @@ static void vkms_disable_vblank(struct drm_crtc *crtc)
 	hrtimer_cancel(&out->vblank_hrtimer);
 }
 
-bool vkms_get_vblank_timestamp(struct drm_device *dev, unsigned int pipe,
-			       int *max_error, ktime_t *vblank_time,
-			       bool in_vblank_irq)
+static bool vkms_get_vblank_timestamp(struct drm_crtc *crtc,
+				      int *max_error, ktime_t *vblank_time,
+				      bool in_vblank_irq)
 {
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
 	struct vkms_device *vkmsdev = drm_device_to_vkms_device(dev);
 	struct vkms_output *output = &vkmsdev->output;
 	struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
@@ -154,6 +156,7 @@ static const struct drm_crtc_funcs vkms_crtc_funcs = {
 	.atomic_destroy_state   = vkms_atomic_crtc_destroy_state,
 	.enable_vblank		= vkms_enable_vblank,
 	.disable_vblank		= vkms_disable_vblank,
+	.get_vblank_timestamp	= vkms_get_vblank_timestamp,
 	.get_crc_sources	= vkms_get_crc_sources,
 	.set_crc_source		= vkms_set_crc_source,
 	.verify_crc_source	= vkms_verify_crc_source,
diff --git a/drivers/gpu/drm/vkms/vkms_drv.c b/drivers/gpu/drm/vkms/vkms_drv.c
index 25bd7519295f..860de052e820 100644
--- a/drivers/gpu/drm/vkms/vkms_drv.c
+++ b/drivers/gpu/drm/vkms/vkms_drv.c
@@ -103,7 +103,6 @@ static struct drm_driver vkms_driver = {
 	.dumb_create		= vkms_dumb_create,
 	.gem_vm_ops		= &vkms_gem_vm_ops,
 	.gem_free_object_unlocked = vkms_gem_free_object,
-	.get_vblank_timestamp	= vkms_get_vblank_timestamp,
 	.prime_fd_to_handle	= drm_gem_prime_fd_to_handle,
 	.gem_prime_import_sg_table = vkms_prime_import_sg_table,
 
diff --git a/drivers/gpu/drm/vkms/vkms_drv.h b/drivers/gpu/drm/vkms/vkms_drv.h
index 7d52e24564db..eda04ffba7b1 100644
--- a/drivers/gpu/drm/vkms/vkms_drv.h
+++ b/drivers/gpu/drm/vkms/vkms_drv.h
@@ -111,10 +111,6 @@ struct vkms_gem_object {
 int vkms_crtc_init(struct drm_device *dev, struct drm_crtc *crtc,
 		   struct drm_plane *primary, struct drm_plane *cursor);
 
-bool vkms_get_vblank_timestamp(struct drm_device *dev, unsigned int pipe,
-			       int *max_error, ktime_t *vblank_time,
-			       bool in_vblank_irq);
-
 int vkms_output_init(struct vkms_device *vkmsdev, int index);
 
 struct drm_plane *vkms_plane_init(struct vkms_device *vkmsdev,
-- 
2.24.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 21/23] drm/vkms: Convert to CRTC VBLANK callbacks
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

VBLANK callbacks in struct drm_driver are deprecated in favor of
their equivalents in struct drm_crtc_funcs. Convert vkms over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/vkms/vkms_crtc.c | 9 ++++++---
 drivers/gpu/drm/vkms/vkms_drv.c  | 1 -
 drivers/gpu/drm/vkms/vkms_drv.h  | 4 ----
 3 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/vkms/vkms_crtc.c b/drivers/gpu/drm/vkms/vkms_crtc.c
index 74f703b8d22a..ac85e17428f8 100644
--- a/drivers/gpu/drm/vkms/vkms_crtc.c
+++ b/drivers/gpu/drm/vkms/vkms_crtc.c
@@ -76,10 +76,12 @@ static void vkms_disable_vblank(struct drm_crtc *crtc)
 	hrtimer_cancel(&out->vblank_hrtimer);
 }
 
-bool vkms_get_vblank_timestamp(struct drm_device *dev, unsigned int pipe,
-			       int *max_error, ktime_t *vblank_time,
-			       bool in_vblank_irq)
+static bool vkms_get_vblank_timestamp(struct drm_crtc *crtc,
+				      int *max_error, ktime_t *vblank_time,
+				      bool in_vblank_irq)
 {
+	struct drm_device *dev = crtc->dev;
+	unsigned int pipe = crtc->index;
 	struct vkms_device *vkmsdev = drm_device_to_vkms_device(dev);
 	struct vkms_output *output = &vkmsdev->output;
 	struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
@@ -154,6 +156,7 @@ static const struct drm_crtc_funcs vkms_crtc_funcs = {
 	.atomic_destroy_state   = vkms_atomic_crtc_destroy_state,
 	.enable_vblank		= vkms_enable_vblank,
 	.disable_vblank		= vkms_disable_vblank,
+	.get_vblank_timestamp	= vkms_get_vblank_timestamp,
 	.get_crc_sources	= vkms_get_crc_sources,
 	.set_crc_source		= vkms_set_crc_source,
 	.verify_crc_source	= vkms_verify_crc_source,
diff --git a/drivers/gpu/drm/vkms/vkms_drv.c b/drivers/gpu/drm/vkms/vkms_drv.c
index 25bd7519295f..860de052e820 100644
--- a/drivers/gpu/drm/vkms/vkms_drv.c
+++ b/drivers/gpu/drm/vkms/vkms_drv.c
@@ -103,7 +103,6 @@ static struct drm_driver vkms_driver = {
 	.dumb_create		= vkms_dumb_create,
 	.gem_vm_ops		= &vkms_gem_vm_ops,
 	.gem_free_object_unlocked = vkms_gem_free_object,
-	.get_vblank_timestamp	= vkms_get_vblank_timestamp,
 	.prime_fd_to_handle	= drm_gem_prime_fd_to_handle,
 	.gem_prime_import_sg_table = vkms_prime_import_sg_table,
 
diff --git a/drivers/gpu/drm/vkms/vkms_drv.h b/drivers/gpu/drm/vkms/vkms_drv.h
index 7d52e24564db..eda04ffba7b1 100644
--- a/drivers/gpu/drm/vkms/vkms_drv.h
+++ b/drivers/gpu/drm/vkms/vkms_drv.h
@@ -111,10 +111,6 @@ struct vkms_gem_object {
 int vkms_crtc_init(struct drm_device *dev, struct drm_crtc *crtc,
 		   struct drm_plane *primary, struct drm_plane *cursor);
 
-bool vkms_get_vblank_timestamp(struct drm_device *dev, unsigned int pipe,
-			       int *max_error, ktime_t *vblank_time,
-			       bool in_vblank_irq);
-
 int vkms_output_init(struct vkms_device *vkmsdev, int index);
 
 struct drm_plane *vkms_plane_init(struct vkms_device *vkmsdev,
-- 
2.24.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 22/23] drm/vmwgfx: Convert to CRTC VBLANK callbacks
  2020-01-10  9:21 ` Thomas Zimmermann
  (?)
  (?)
@ 2020-01-10  9:21   ` Thomas Zimmermann
  -1 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: dri-devel, amd-gfx, intel-gfx, linux-arm-msm, freedreno, nouveau,
	Thomas Zimmermann

VBLANK callbacks in struct drm_driver are deprecated in favor of
their equivalents in struct drm_crtc_funcs. Convert vmwgfx over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.c  | 5 +----
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.h  | 6 +++---
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c  | 8 ++++----
 drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c  | 3 +++
 drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c | 5 ++++-
 drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c | 3 +++
 6 files changed, 18 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
index e962048f65d2..f5ab04468522 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
@@ -1329,7 +1329,7 @@ static int vmw_pm_freeze(struct device *kdev)
 
 	vmw_fence_fifo_down(dev_priv->fman);
 	__vmw_svga_disable(dev_priv);
-	
+
 	vmw_release_device_late(dev_priv);
 	return 0;
 }
@@ -1393,9 +1393,6 @@ static struct drm_driver driver = {
 	DRIVER_MODESET | DRIVER_RENDER | DRIVER_ATOMIC,
 	.load = vmw_driver_load,
 	.unload = vmw_driver_unload,
-	.get_vblank_counter = vmw_get_vblank_counter,
-	.enable_vblank = vmw_enable_vblank,
-	.disable_vblank = vmw_disable_vblank,
 	.ioctls = vmw_ioctls,
 	.num_ioctls = ARRAY_SIZE(vmw_ioctls),
 	.master_set = vmw_master_set,
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
index a31e726d6d71..845b3b8c29ca 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
@@ -1100,9 +1100,9 @@ int vmw_kms_write_svga(struct vmw_private *vmw_priv,
 bool vmw_kms_validate_mode_vram(struct vmw_private *dev_priv,
 				uint32_t pitch,
 				uint32_t height);
-u32 vmw_get_vblank_counter(struct drm_device *dev, unsigned int pipe);
-int vmw_enable_vblank(struct drm_device *dev, unsigned int pipe);
-void vmw_disable_vblank(struct drm_device *dev, unsigned int pipe);
+u32 vmw_get_vblank_counter(struct drm_crtc *crtc);
+int vmw_enable_vblank(struct drm_crtc *crtc);
+void vmw_disable_vblank(struct drm_crtc *crtc);
 int vmw_kms_present(struct vmw_private *dev_priv,
 		    struct drm_file *file_priv,
 		    struct vmw_framebuffer *vfb,
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
index f47d5710cc95..9f0fee62904a 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
@@ -1991,7 +1991,7 @@ bool vmw_kms_validate_mode_vram(struct vmw_private *dev_priv,
 /**
  * Function called by DRM code called with vbl_lock held.
  */
-u32 vmw_get_vblank_counter(struct drm_device *dev, unsigned int pipe)
+u32 vmw_get_vblank_counter(struct drm_crtc *crtc)
 {
 	return 0;
 }
@@ -1999,7 +1999,7 @@ u32 vmw_get_vblank_counter(struct drm_device *dev, unsigned int pipe)
 /**
  * Function called by DRM code called with vbl_lock held.
  */
-int vmw_enable_vblank(struct drm_device *dev, unsigned int pipe)
+int vmw_enable_vblank(struct drm_crtc *crtc)
 {
 	return -EINVAL;
 }
@@ -2007,7 +2007,7 @@ int vmw_enable_vblank(struct drm_device *dev, unsigned int pipe)
 /**
  * Function called by DRM code called with vbl_lock held.
  */
-void vmw_disable_vblank(struct drm_device *dev, unsigned int pipe)
+void vmw_disable_vblank(struct drm_crtc *crtc)
 {
 }
 
@@ -2088,7 +2088,7 @@ static int vmw_du_update_layout(struct vmw_private *dev_priv,
 	drm_modeset_drop_locks(&ctx);
 	drm_modeset_acquire_fini(&ctx);
 	mutex_unlock(&dev->mode_config.mutex);
- 
+
 	return 0;
 }
 
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c b/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
index 5702219ec38f..16dafff5cab1 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
@@ -236,6 +236,9 @@ static const struct drm_crtc_funcs vmw_legacy_crtc_funcs = {
 	.atomic_duplicate_state = vmw_du_crtc_duplicate_state,
 	.atomic_destroy_state = vmw_du_crtc_destroy_state,
 	.set_config = drm_atomic_helper_set_config,
+	.get_vblank_counter = vmw_get_vblank_counter,
+	.enable_vblank = vmw_enable_vblank,
+	.disable_vblank = vmw_disable_vblank,
 };
 
 
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c b/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c
index e5a283263211..207a4053e769 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c
@@ -319,6 +319,9 @@ static const struct drm_crtc_funcs vmw_screen_object_crtc_funcs = {
 	.atomic_destroy_state = vmw_du_crtc_destroy_state,
 	.set_config = drm_atomic_helper_set_config,
 	.page_flip = drm_atomic_helper_page_flip,
+	.get_vblank_counter = vmw_get_vblank_counter,
+	.enable_vblank = vmw_enable_vblank,
+	.disable_vblank = vmw_disable_vblank,
 };
 
 /*
@@ -1388,6 +1391,6 @@ int vmw_kms_sou_readback(struct vmw_private *dev_priv,
 	vmw_validation_revert(&val_ctx);
 out_unref:
 	vmw_validation_unref_lists(&val_ctx);
-	
+
 	return ret;
 }
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c b/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c
index 41a96fb49835..570687a1a327 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c
@@ -916,6 +916,9 @@ static const struct drm_crtc_funcs vmw_stdu_crtc_funcs = {
 	.atomic_destroy_state = vmw_du_crtc_destroy_state,
 	.set_config = drm_atomic_helper_set_config,
 	.page_flip = drm_atomic_helper_page_flip,
+	.get_vblank_counter = vmw_get_vblank_counter,
+	.enable_vblank = vmw_enable_vblank,
+	.disable_vblank = vmw_disable_vblank,
 };
 
 
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 22/23] drm/vmwgfx: Convert to CRTC VBLANK callbacks
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

VBLANK callbacks in struct drm_driver are deprecated in favor of
their equivalents in struct drm_crtc_funcs. Convert vmwgfx over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.c  | 5 +----
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.h  | 6 +++---
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c  | 8 ++++----
 drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c  | 3 +++
 drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c | 5 ++++-
 drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c | 3 +++
 6 files changed, 18 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
index e962048f65d2..f5ab04468522 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
@@ -1329,7 +1329,7 @@ static int vmw_pm_freeze(struct device *kdev)
 
 	vmw_fence_fifo_down(dev_priv->fman);
 	__vmw_svga_disable(dev_priv);
-	
+
 	vmw_release_device_late(dev_priv);
 	return 0;
 }
@@ -1393,9 +1393,6 @@ static struct drm_driver driver = {
 	DRIVER_MODESET | DRIVER_RENDER | DRIVER_ATOMIC,
 	.load = vmw_driver_load,
 	.unload = vmw_driver_unload,
-	.get_vblank_counter = vmw_get_vblank_counter,
-	.enable_vblank = vmw_enable_vblank,
-	.disable_vblank = vmw_disable_vblank,
 	.ioctls = vmw_ioctls,
 	.num_ioctls = ARRAY_SIZE(vmw_ioctls),
 	.master_set = vmw_master_set,
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
index a31e726d6d71..845b3b8c29ca 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
@@ -1100,9 +1100,9 @@ int vmw_kms_write_svga(struct vmw_private *vmw_priv,
 bool vmw_kms_validate_mode_vram(struct vmw_private *dev_priv,
 				uint32_t pitch,
 				uint32_t height);
-u32 vmw_get_vblank_counter(struct drm_device *dev, unsigned int pipe);
-int vmw_enable_vblank(struct drm_device *dev, unsigned int pipe);
-void vmw_disable_vblank(struct drm_device *dev, unsigned int pipe);
+u32 vmw_get_vblank_counter(struct drm_crtc *crtc);
+int vmw_enable_vblank(struct drm_crtc *crtc);
+void vmw_disable_vblank(struct drm_crtc *crtc);
 int vmw_kms_present(struct vmw_private *dev_priv,
 		    struct drm_file *file_priv,
 		    struct vmw_framebuffer *vfb,
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
index f47d5710cc95..9f0fee62904a 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
@@ -1991,7 +1991,7 @@ bool vmw_kms_validate_mode_vram(struct vmw_private *dev_priv,
 /**
  * Function called by DRM code called with vbl_lock held.
  */
-u32 vmw_get_vblank_counter(struct drm_device *dev, unsigned int pipe)
+u32 vmw_get_vblank_counter(struct drm_crtc *crtc)
 {
 	return 0;
 }
@@ -1999,7 +1999,7 @@ u32 vmw_get_vblank_counter(struct drm_device *dev, unsigned int pipe)
 /**
  * Function called by DRM code called with vbl_lock held.
  */
-int vmw_enable_vblank(struct drm_device *dev, unsigned int pipe)
+int vmw_enable_vblank(struct drm_crtc *crtc)
 {
 	return -EINVAL;
 }
@@ -2007,7 +2007,7 @@ int vmw_enable_vblank(struct drm_device *dev, unsigned int pipe)
 /**
  * Function called by DRM code called with vbl_lock held.
  */
-void vmw_disable_vblank(struct drm_device *dev, unsigned int pipe)
+void vmw_disable_vblank(struct drm_crtc *crtc)
 {
 }
 
@@ -2088,7 +2088,7 @@ static int vmw_du_update_layout(struct vmw_private *dev_priv,
 	drm_modeset_drop_locks(&ctx);
 	drm_modeset_acquire_fini(&ctx);
 	mutex_unlock(&dev->mode_config.mutex);
- 
+
 	return 0;
 }
 
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c b/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
index 5702219ec38f..16dafff5cab1 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
@@ -236,6 +236,9 @@ static const struct drm_crtc_funcs vmw_legacy_crtc_funcs = {
 	.atomic_duplicate_state = vmw_du_crtc_duplicate_state,
 	.atomic_destroy_state = vmw_du_crtc_destroy_state,
 	.set_config = drm_atomic_helper_set_config,
+	.get_vblank_counter = vmw_get_vblank_counter,
+	.enable_vblank = vmw_enable_vblank,
+	.disable_vblank = vmw_disable_vblank,
 };
 
 
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c b/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c
index e5a283263211..207a4053e769 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c
@@ -319,6 +319,9 @@ static const struct drm_crtc_funcs vmw_screen_object_crtc_funcs = {
 	.atomic_destroy_state = vmw_du_crtc_destroy_state,
 	.set_config = drm_atomic_helper_set_config,
 	.page_flip = drm_atomic_helper_page_flip,
+	.get_vblank_counter = vmw_get_vblank_counter,
+	.enable_vblank = vmw_enable_vblank,
+	.disable_vblank = vmw_disable_vblank,
 };
 
 /*
@@ -1388,6 +1391,6 @@ int vmw_kms_sou_readback(struct vmw_private *dev_priv,
 	vmw_validation_revert(&val_ctx);
 out_unref:
 	vmw_validation_unref_lists(&val_ctx);
-	
+
 	return ret;
 }
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c b/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c
index 41a96fb49835..570687a1a327 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c
@@ -916,6 +916,9 @@ static const struct drm_crtc_funcs vmw_stdu_crtc_funcs = {
 	.atomic_destroy_state = vmw_du_crtc_destroy_state,
 	.set_config = drm_atomic_helper_set_config,
 	.page_flip = drm_atomic_helper_page_flip,
+	.get_vblank_counter = vmw_get_vblank_counter,
+	.enable_vblank = vmw_enable_vblank,
+	.disable_vblank = vmw_disable_vblank,
 };
 
 
-- 
2.24.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [Intel-gfx] [PATCH 22/23] drm/vmwgfx: Convert to CRTC VBLANK callbacks
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

VBLANK callbacks in struct drm_driver are deprecated in favor of
their equivalents in struct drm_crtc_funcs. Convert vmwgfx over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.c  | 5 +----
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.h  | 6 +++---
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c  | 8 ++++----
 drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c  | 3 +++
 drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c | 5 ++++-
 drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c | 3 +++
 6 files changed, 18 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
index e962048f65d2..f5ab04468522 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
@@ -1329,7 +1329,7 @@ static int vmw_pm_freeze(struct device *kdev)
 
 	vmw_fence_fifo_down(dev_priv->fman);
 	__vmw_svga_disable(dev_priv);
-	
+
 	vmw_release_device_late(dev_priv);
 	return 0;
 }
@@ -1393,9 +1393,6 @@ static struct drm_driver driver = {
 	DRIVER_MODESET | DRIVER_RENDER | DRIVER_ATOMIC,
 	.load = vmw_driver_load,
 	.unload = vmw_driver_unload,
-	.get_vblank_counter = vmw_get_vblank_counter,
-	.enable_vblank = vmw_enable_vblank,
-	.disable_vblank = vmw_disable_vblank,
 	.ioctls = vmw_ioctls,
 	.num_ioctls = ARRAY_SIZE(vmw_ioctls),
 	.master_set = vmw_master_set,
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
index a31e726d6d71..845b3b8c29ca 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
@@ -1100,9 +1100,9 @@ int vmw_kms_write_svga(struct vmw_private *vmw_priv,
 bool vmw_kms_validate_mode_vram(struct vmw_private *dev_priv,
 				uint32_t pitch,
 				uint32_t height);
-u32 vmw_get_vblank_counter(struct drm_device *dev, unsigned int pipe);
-int vmw_enable_vblank(struct drm_device *dev, unsigned int pipe);
-void vmw_disable_vblank(struct drm_device *dev, unsigned int pipe);
+u32 vmw_get_vblank_counter(struct drm_crtc *crtc);
+int vmw_enable_vblank(struct drm_crtc *crtc);
+void vmw_disable_vblank(struct drm_crtc *crtc);
 int vmw_kms_present(struct vmw_private *dev_priv,
 		    struct drm_file *file_priv,
 		    struct vmw_framebuffer *vfb,
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
index f47d5710cc95..9f0fee62904a 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
@@ -1991,7 +1991,7 @@ bool vmw_kms_validate_mode_vram(struct vmw_private *dev_priv,
 /**
  * Function called by DRM code called with vbl_lock held.
  */
-u32 vmw_get_vblank_counter(struct drm_device *dev, unsigned int pipe)
+u32 vmw_get_vblank_counter(struct drm_crtc *crtc)
 {
 	return 0;
 }
@@ -1999,7 +1999,7 @@ u32 vmw_get_vblank_counter(struct drm_device *dev, unsigned int pipe)
 /**
  * Function called by DRM code called with vbl_lock held.
  */
-int vmw_enable_vblank(struct drm_device *dev, unsigned int pipe)
+int vmw_enable_vblank(struct drm_crtc *crtc)
 {
 	return -EINVAL;
 }
@@ -2007,7 +2007,7 @@ int vmw_enable_vblank(struct drm_device *dev, unsigned int pipe)
 /**
  * Function called by DRM code called with vbl_lock held.
  */
-void vmw_disable_vblank(struct drm_device *dev, unsigned int pipe)
+void vmw_disable_vblank(struct drm_crtc *crtc)
 {
 }
 
@@ -2088,7 +2088,7 @@ static int vmw_du_update_layout(struct vmw_private *dev_priv,
 	drm_modeset_drop_locks(&ctx);
 	drm_modeset_acquire_fini(&ctx);
 	mutex_unlock(&dev->mode_config.mutex);
- 
+
 	return 0;
 }
 
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c b/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
index 5702219ec38f..16dafff5cab1 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
@@ -236,6 +236,9 @@ static const struct drm_crtc_funcs vmw_legacy_crtc_funcs = {
 	.atomic_duplicate_state = vmw_du_crtc_duplicate_state,
 	.atomic_destroy_state = vmw_du_crtc_destroy_state,
 	.set_config = drm_atomic_helper_set_config,
+	.get_vblank_counter = vmw_get_vblank_counter,
+	.enable_vblank = vmw_enable_vblank,
+	.disable_vblank = vmw_disable_vblank,
 };
 
 
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c b/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c
index e5a283263211..207a4053e769 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c
@@ -319,6 +319,9 @@ static const struct drm_crtc_funcs vmw_screen_object_crtc_funcs = {
 	.atomic_destroy_state = vmw_du_crtc_destroy_state,
 	.set_config = drm_atomic_helper_set_config,
 	.page_flip = drm_atomic_helper_page_flip,
+	.get_vblank_counter = vmw_get_vblank_counter,
+	.enable_vblank = vmw_enable_vblank,
+	.disable_vblank = vmw_disable_vblank,
 };
 
 /*
@@ -1388,6 +1391,6 @@ int vmw_kms_sou_readback(struct vmw_private *dev_priv,
 	vmw_validation_revert(&val_ctx);
 out_unref:
 	vmw_validation_unref_lists(&val_ctx);
-	
+
 	return ret;
 }
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c b/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c
index 41a96fb49835..570687a1a327 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c
@@ -916,6 +916,9 @@ static const struct drm_crtc_funcs vmw_stdu_crtc_funcs = {
 	.atomic_destroy_state = vmw_du_crtc_destroy_state,
 	.set_config = drm_atomic_helper_set_config,
 	.page_flip = drm_atomic_helper_page_flip,
+	.get_vblank_counter = vmw_get_vblank_counter,
+	.enable_vblank = vmw_enable_vblank,
+	.disable_vblank = vmw_disable_vblank,
 };
 
 
-- 
2.24.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 22/23] drm/vmwgfx: Convert to CRTC VBLANK callbacks
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

VBLANK callbacks in struct drm_driver are deprecated in favor of
their equivalents in struct drm_crtc_funcs. Convert vmwgfx over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.c  | 5 +----
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.h  | 6 +++---
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c  | 8 ++++----
 drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c  | 3 +++
 drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c | 5 ++++-
 drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c | 3 +++
 6 files changed, 18 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
index e962048f65d2..f5ab04468522 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
@@ -1329,7 +1329,7 @@ static int vmw_pm_freeze(struct device *kdev)
 
 	vmw_fence_fifo_down(dev_priv->fman);
 	__vmw_svga_disable(dev_priv);
-	
+
 	vmw_release_device_late(dev_priv);
 	return 0;
 }
@@ -1393,9 +1393,6 @@ static struct drm_driver driver = {
 	DRIVER_MODESET | DRIVER_RENDER | DRIVER_ATOMIC,
 	.load = vmw_driver_load,
 	.unload = vmw_driver_unload,
-	.get_vblank_counter = vmw_get_vblank_counter,
-	.enable_vblank = vmw_enable_vblank,
-	.disable_vblank = vmw_disable_vblank,
 	.ioctls = vmw_ioctls,
 	.num_ioctls = ARRAY_SIZE(vmw_ioctls),
 	.master_set = vmw_master_set,
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
index a31e726d6d71..845b3b8c29ca 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
@@ -1100,9 +1100,9 @@ int vmw_kms_write_svga(struct vmw_private *vmw_priv,
 bool vmw_kms_validate_mode_vram(struct vmw_private *dev_priv,
 				uint32_t pitch,
 				uint32_t height);
-u32 vmw_get_vblank_counter(struct drm_device *dev, unsigned int pipe);
-int vmw_enable_vblank(struct drm_device *dev, unsigned int pipe);
-void vmw_disable_vblank(struct drm_device *dev, unsigned int pipe);
+u32 vmw_get_vblank_counter(struct drm_crtc *crtc);
+int vmw_enable_vblank(struct drm_crtc *crtc);
+void vmw_disable_vblank(struct drm_crtc *crtc);
 int vmw_kms_present(struct vmw_private *dev_priv,
 		    struct drm_file *file_priv,
 		    struct vmw_framebuffer *vfb,
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
index f47d5710cc95..9f0fee62904a 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
@@ -1991,7 +1991,7 @@ bool vmw_kms_validate_mode_vram(struct vmw_private *dev_priv,
 /**
  * Function called by DRM code called with vbl_lock held.
  */
-u32 vmw_get_vblank_counter(struct drm_device *dev, unsigned int pipe)
+u32 vmw_get_vblank_counter(struct drm_crtc *crtc)
 {
 	return 0;
 }
@@ -1999,7 +1999,7 @@ u32 vmw_get_vblank_counter(struct drm_device *dev, unsigned int pipe)
 /**
  * Function called by DRM code called with vbl_lock held.
  */
-int vmw_enable_vblank(struct drm_device *dev, unsigned int pipe)
+int vmw_enable_vblank(struct drm_crtc *crtc)
 {
 	return -EINVAL;
 }
@@ -2007,7 +2007,7 @@ int vmw_enable_vblank(struct drm_device *dev, unsigned int pipe)
 /**
  * Function called by DRM code called with vbl_lock held.
  */
-void vmw_disable_vblank(struct drm_device *dev, unsigned int pipe)
+void vmw_disable_vblank(struct drm_crtc *crtc)
 {
 }
 
@@ -2088,7 +2088,7 @@ static int vmw_du_update_layout(struct vmw_private *dev_priv,
 	drm_modeset_drop_locks(&ctx);
 	drm_modeset_acquire_fini(&ctx);
 	mutex_unlock(&dev->mode_config.mutex);
- 
+
 	return 0;
 }
 
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c b/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
index 5702219ec38f..16dafff5cab1 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
@@ -236,6 +236,9 @@ static const struct drm_crtc_funcs vmw_legacy_crtc_funcs = {
 	.atomic_duplicate_state = vmw_du_crtc_duplicate_state,
 	.atomic_destroy_state = vmw_du_crtc_destroy_state,
 	.set_config = drm_atomic_helper_set_config,
+	.get_vblank_counter = vmw_get_vblank_counter,
+	.enable_vblank = vmw_enable_vblank,
+	.disable_vblank = vmw_disable_vblank,
 };
 
 
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c b/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c
index e5a283263211..207a4053e769 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c
@@ -319,6 +319,9 @@ static const struct drm_crtc_funcs vmw_screen_object_crtc_funcs = {
 	.atomic_destroy_state = vmw_du_crtc_destroy_state,
 	.set_config = drm_atomic_helper_set_config,
 	.page_flip = drm_atomic_helper_page_flip,
+	.get_vblank_counter = vmw_get_vblank_counter,
+	.enable_vblank = vmw_enable_vblank,
+	.disable_vblank = vmw_disable_vblank,
 };
 
 /*
@@ -1388,6 +1391,6 @@ int vmw_kms_sou_readback(struct vmw_private *dev_priv,
 	vmw_validation_revert(&val_ctx);
 out_unref:
 	vmw_validation_unref_lists(&val_ctx);
-	
+
 	return ret;
 }
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c b/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c
index 41a96fb49835..570687a1a327 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c
@@ -916,6 +916,9 @@ static const struct drm_crtc_funcs vmw_stdu_crtc_funcs = {
 	.atomic_destroy_state = vmw_du_crtc_destroy_state,
 	.set_config = drm_atomic_helper_set_config,
 	.page_flip = drm_atomic_helper_page_flip,
+	.get_vblank_counter = vmw_get_vblank_counter,
+	.enable_vblank = vmw_enable_vblank,
+	.disable_vblank = vmw_disable_vblank,
 };
 
 
-- 
2.24.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 23/23] drm: Cleanup VBLANK callbacks in struct drm_driver
  2020-01-10  9:21 ` Thomas Zimmermann
  (?)
  (?)
@ 2020-01-10  9:21   ` Thomas Zimmermann
  -1 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: dri-devel, amd-gfx, intel-gfx, linux-arm-msm, freedreno, nouveau,
	Thomas Zimmermann

All non-legacy users of VBLANK functions in struct drm_driver have been
converted to use the respective interfaces in struct drm_crtc_funcs. The
remaining users of VBLANK callbacks in struct drm_driver are legacy drivers
with userspace modesetting.

There are no users left of get_vblank_timestamp(), so the callback is
being removed. The other VBLANK callbacks are being moved to the legacy
section at the end of struct drm_driver.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/drm_vblank.c |  39 +++++---------
 include/drm/drm_drv.h        | 101 ++---------------------------------
 2 files changed, 17 insertions(+), 123 deletions(-)

diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
index 7cf436a4b908..ceff68474d4d 100644
--- a/drivers/gpu/drm/drm_vblank.c
+++ b/drivers/gpu/drm/drm_vblank.c
@@ -138,10 +138,9 @@ static u32 __get_vblank_counter(struct drm_device *dev, unsigned int pipe)
 
 		if (crtc->funcs->get_vblank_counter)
 			return crtc->funcs->get_vblank_counter(crtc);
-	}
-
-	if (dev->driver->get_vblank_counter)
+	} else if (dev->driver->get_vblank_counter) {
 		return dev->driver->get_vblank_counter(dev, pipe);
+	}
 
 	return drm_vblank_no_hw_counter(dev, pipe);
 }
@@ -334,8 +333,7 @@ u64 drm_crtc_accurate_vblank_count(struct drm_crtc *crtc)
 	unsigned long flags;
 
 	WARN_ONCE(drm_debug_enabled(DRM_UT_VBL) &&
-		  !crtc->funcs->get_vblank_timestamp &&
-		  !dev->driver->get_vblank_timestamp,
+		  !crtc->funcs->get_vblank_timestamp,
 		  "This function requires support for accurate vblank timestamps.");
 
 	spin_lock_irqsave(&dev->vblank_time_lock, flags);
@@ -357,13 +355,11 @@ static void __disable_vblank(struct drm_device *dev, unsigned int pipe)
 		if (WARN_ON(!crtc))
 			return;
 
-		if (crtc->funcs->disable_vblank) {
+		if (crtc->funcs->disable_vblank)
 			crtc->funcs->disable_vblank(crtc);
-			return;
-		}
+	} else {
+		dev->driver->disable_vblank(dev, pipe);
 	}
-
-	dev->driver->disable_vblank(dev, pipe);
 }
 
 /*
@@ -791,9 +787,6 @@ drm_get_last_vbltimestamp(struct drm_device *dev, unsigned int pipe,
 
 		ret = crtc->funcs->get_vblank_timestamp(crtc, &max_error,
 							tvblank, in_vblank_irq);
-	} else if (dev->driver->get_vblank_timestamp && (max_error > 0)) {
-		ret = dev->driver->get_vblank_timestamp(dev, pipe, &max_error,
-							tvblank, in_vblank_irq);
 	}
 
 	/* GPU high precision timestamp query unsupported or failed.
@@ -1016,9 +1009,11 @@ static int __enable_vblank(struct drm_device *dev, unsigned int pipe)
 
 		if (crtc->funcs->enable_vblank)
 			return crtc->funcs->enable_vblank(crtc);
+	} else if (dev->driver->enable_vblank) {
+		return dev->driver->enable_vblank(dev, pipe);
 	}
 
-	return dev->driver->enable_vblank(dev, pipe);
+	return -EINVAL;
 }
 
 static int drm_vblank_enable(struct drm_device *dev, unsigned int pipe)
@@ -1109,13 +1104,10 @@ static bool __vblank_disable_immediate(struct drm_device *dev, unsigned int pipe
 		return false;
 
 	crtc = drm_crtc_from_index(dev, pipe);
-	if (crtc && crtc->funcs->get_vblank_timestamp)
-		return true;
-
-	if (dev->driver->get_vblank_timestamp)
-		return true;
+	if (!crtc || !crtc->funcs->get_vblank_timestamp)
+		return false;
 
-	return false;
+	return true;
 }
 
 static void drm_vblank_put(struct drm_device *dev, unsigned int pipe)
@@ -1798,7 +1790,6 @@ static void drm_handle_vblank_events(struct drm_device *dev, unsigned int pipe)
 	struct drm_pending_vblank_event *e, *t;
 	ktime_t now;
 	u64 seq;
-	bool high_prec;
 
 	assert_spin_locked(&dev->event_lock);
 
@@ -1818,10 +1809,8 @@ static void drm_handle_vblank_events(struct drm_device *dev, unsigned int pipe)
 		send_vblank_event(dev, e, seq, now);
 	}
 
-	high_prec = crtc->funcs->get_vblank_timestamp ||
-		    dev->driver->get_vblank_timestamp;
-
-	trace_drm_vblank_event(pipe, seq, now, high_prec);
+	trace_drm_vblank_event(pipe, seq, now,
+			       crtc->funcs->get_vblank_timestamp != NULL);
 }
 
 /**
diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
index b704e252f3b2..e290b3aca6eb 100644
--- a/include/drm/drm_drv.h
+++ b/include/drm/drm_drv.h
@@ -268,104 +268,6 @@ struct drm_driver {
 	 */
 	void (*release) (struct drm_device *);
 
-	/**
-	 * @get_vblank_counter:
-	 *
-	 * Driver callback for fetching a raw hardware vblank counter for the
-	 * CRTC specified with the pipe argument.  If a device doesn't have a
-	 * hardware counter, the driver can simply leave the hook as NULL.
-	 * The DRM core will account for missed vblank events while interrupts
-	 * where disabled based on system timestamps.
-	 *
-	 * Wraparound handling and loss of events due to modesetting is dealt
-	 * with in the DRM core code, as long as drivers call
-	 * drm_crtc_vblank_off() and drm_crtc_vblank_on() when disabling or
-	 * enabling a CRTC.
-	 *
-	 * This is deprecated and should not be used by new drivers.
-	 * Use &drm_crtc_funcs.get_vblank_counter instead.
-	 *
-	 * Returns:
-	 *
-	 * Raw vblank counter value.
-	 */
-	u32 (*get_vblank_counter) (struct drm_device *dev, unsigned int pipe);
-
-	/**
-	 * @enable_vblank:
-	 *
-	 * Enable vblank interrupts for the CRTC specified with the pipe
-	 * argument.
-	 *
-	 * This is deprecated and should not be used by new drivers.
-	 * Use &drm_crtc_funcs.enable_vblank instead.
-	 *
-	 * Returns:
-	 *
-	 * Zero on success, appropriate errno if the given @crtc's vblank
-	 * interrupt cannot be enabled.
-	 */
-	int (*enable_vblank) (struct drm_device *dev, unsigned int pipe);
-
-	/**
-	 * @disable_vblank:
-	 *
-	 * Disable vblank interrupts for the CRTC specified with the pipe
-	 * argument.
-	 *
-	 * This is deprecated and should not be used by new drivers.
-	 * Use &drm_crtc_funcs.disable_vblank instead.
-	 */
-	void (*disable_vblank) (struct drm_device *dev, unsigned int pipe);
-
-	/**
-	 * @get_vblank_timestamp:
-	 *
-	 * Called by drm_get_last_vbltimestamp(). Should return a precise
-	 * timestamp when the most recent VBLANK interval ended or will end.
-	 *
-	 * Specifically, the timestamp in @vblank_time should correspond as
-	 * closely as possible to the time when the first video scanline of
-	 * the video frame after the end of VBLANK will start scanning out,
-	 * the time immediately after end of the VBLANK interval. If the
-	 * @crtc is currently inside VBLANK, this will be a time in the future.
-	 * If the @crtc is currently scanning out a frame, this will be the
-	 * past start time of the current scanout. This is meant to adhere
-	 * to the OpenML OML_sync_control extension specification.
-	 *
-	 * Paramters:
-	 *
-	 * dev:
-	 *     dev DRM device handle.
-	 * pipe:
-	 *     crtc for which timestamp should be returned.
-	 * max_error:
-	 *     Maximum allowable timestamp error in nanoseconds.
-	 *     Implementation should strive to provide timestamp
-	 *     with an error of at most max_error nanoseconds.
-	 *     Returns true upper bound on error for timestamp.
-	 * vblank_time:
-	 *     Target location for returned vblank timestamp.
-	 * in_vblank_irq:
-	 *     True when called from drm_crtc_handle_vblank().  Some drivers
-	 *     need to apply some workarounds for gpu-specific vblank irq quirks
-	 *     if flag is set.
-	 *
-	 * Returns:
-	 *
-	 * True on success, false on failure, which means the core should
-	 * fallback to a simple timestamp taken in drm_crtc_handle_vblank().
-	 *
-	 * FIXME:
-	 *
-	 * We should move this hook to &struct drm_crtc_funcs like all the other
-	 * vblank hooks.
-	 */
-	bool (*get_vblank_timestamp) (struct drm_device *dev, unsigned int pipe,
-				     int *max_error,
-				     ktime_t *vblank_time,
-				     bool in_vblank_irq);
-
 	/**
 	 * @irq_handler:
 	 *
@@ -720,6 +622,9 @@ struct drm_driver {
 	int (*dma_ioctl) (struct drm_device *dev, void *data, struct drm_file *file_priv);
 	int (*dma_quiescent) (struct drm_device *);
 	int (*context_dtor) (struct drm_device *dev, int context);
+	u32 (*get_vblank_counter)(struct drm_device *dev, unsigned int pipe);
+	int (*enable_vblank)(struct drm_device *dev, unsigned int pipe);
+	void (*disable_vblank)(struct drm_device *dev, unsigned int pipe);
 	int dev_priv_size;
 };
 
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 23/23] drm: Cleanup VBLANK callbacks in struct drm_driver
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

All non-legacy users of VBLANK functions in struct drm_driver have been
converted to use the respective interfaces in struct drm_crtc_funcs. The
remaining users of VBLANK callbacks in struct drm_driver are legacy drivers
with userspace modesetting.

There are no users left of get_vblank_timestamp(), so the callback is
being removed. The other VBLANK callbacks are being moved to the legacy
section at the end of struct drm_driver.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/drm_vblank.c |  39 +++++---------
 include/drm/drm_drv.h        | 101 ++---------------------------------
 2 files changed, 17 insertions(+), 123 deletions(-)

diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
index 7cf436a4b908..ceff68474d4d 100644
--- a/drivers/gpu/drm/drm_vblank.c
+++ b/drivers/gpu/drm/drm_vblank.c
@@ -138,10 +138,9 @@ static u32 __get_vblank_counter(struct drm_device *dev, unsigned int pipe)
 
 		if (crtc->funcs->get_vblank_counter)
 			return crtc->funcs->get_vblank_counter(crtc);
-	}
-
-	if (dev->driver->get_vblank_counter)
+	} else if (dev->driver->get_vblank_counter) {
 		return dev->driver->get_vblank_counter(dev, pipe);
+	}
 
 	return drm_vblank_no_hw_counter(dev, pipe);
 }
@@ -334,8 +333,7 @@ u64 drm_crtc_accurate_vblank_count(struct drm_crtc *crtc)
 	unsigned long flags;
 
 	WARN_ONCE(drm_debug_enabled(DRM_UT_VBL) &&
-		  !crtc->funcs->get_vblank_timestamp &&
-		  !dev->driver->get_vblank_timestamp,
+		  !crtc->funcs->get_vblank_timestamp,
 		  "This function requires support for accurate vblank timestamps.");
 
 	spin_lock_irqsave(&dev->vblank_time_lock, flags);
@@ -357,13 +355,11 @@ static void __disable_vblank(struct drm_device *dev, unsigned int pipe)
 		if (WARN_ON(!crtc))
 			return;
 
-		if (crtc->funcs->disable_vblank) {
+		if (crtc->funcs->disable_vblank)
 			crtc->funcs->disable_vblank(crtc);
-			return;
-		}
+	} else {
+		dev->driver->disable_vblank(dev, pipe);
 	}
-
-	dev->driver->disable_vblank(dev, pipe);
 }
 
 /*
@@ -791,9 +787,6 @@ drm_get_last_vbltimestamp(struct drm_device *dev, unsigned int pipe,
 
 		ret = crtc->funcs->get_vblank_timestamp(crtc, &max_error,
 							tvblank, in_vblank_irq);
-	} else if (dev->driver->get_vblank_timestamp && (max_error > 0)) {
-		ret = dev->driver->get_vblank_timestamp(dev, pipe, &max_error,
-							tvblank, in_vblank_irq);
 	}
 
 	/* GPU high precision timestamp query unsupported or failed.
@@ -1016,9 +1009,11 @@ static int __enable_vblank(struct drm_device *dev, unsigned int pipe)
 
 		if (crtc->funcs->enable_vblank)
 			return crtc->funcs->enable_vblank(crtc);
+	} else if (dev->driver->enable_vblank) {
+		return dev->driver->enable_vblank(dev, pipe);
 	}
 
-	return dev->driver->enable_vblank(dev, pipe);
+	return -EINVAL;
 }
 
 static int drm_vblank_enable(struct drm_device *dev, unsigned int pipe)
@@ -1109,13 +1104,10 @@ static bool __vblank_disable_immediate(struct drm_device *dev, unsigned int pipe
 		return false;
 
 	crtc = drm_crtc_from_index(dev, pipe);
-	if (crtc && crtc->funcs->get_vblank_timestamp)
-		return true;
-
-	if (dev->driver->get_vblank_timestamp)
-		return true;
+	if (!crtc || !crtc->funcs->get_vblank_timestamp)
+		return false;
 
-	return false;
+	return true;
 }
 
 static void drm_vblank_put(struct drm_device *dev, unsigned int pipe)
@@ -1798,7 +1790,6 @@ static void drm_handle_vblank_events(struct drm_device *dev, unsigned int pipe)
 	struct drm_pending_vblank_event *e, *t;
 	ktime_t now;
 	u64 seq;
-	bool high_prec;
 
 	assert_spin_locked(&dev->event_lock);
 
@@ -1818,10 +1809,8 @@ static void drm_handle_vblank_events(struct drm_device *dev, unsigned int pipe)
 		send_vblank_event(dev, e, seq, now);
 	}
 
-	high_prec = crtc->funcs->get_vblank_timestamp ||
-		    dev->driver->get_vblank_timestamp;
-
-	trace_drm_vblank_event(pipe, seq, now, high_prec);
+	trace_drm_vblank_event(pipe, seq, now,
+			       crtc->funcs->get_vblank_timestamp != NULL);
 }
 
 /**
diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
index b704e252f3b2..e290b3aca6eb 100644
--- a/include/drm/drm_drv.h
+++ b/include/drm/drm_drv.h
@@ -268,104 +268,6 @@ struct drm_driver {
 	 */
 	void (*release) (struct drm_device *);
 
-	/**
-	 * @get_vblank_counter:
-	 *
-	 * Driver callback for fetching a raw hardware vblank counter for the
-	 * CRTC specified with the pipe argument.  If a device doesn't have a
-	 * hardware counter, the driver can simply leave the hook as NULL.
-	 * The DRM core will account for missed vblank events while interrupts
-	 * where disabled based on system timestamps.
-	 *
-	 * Wraparound handling and loss of events due to modesetting is dealt
-	 * with in the DRM core code, as long as drivers call
-	 * drm_crtc_vblank_off() and drm_crtc_vblank_on() when disabling or
-	 * enabling a CRTC.
-	 *
-	 * This is deprecated and should not be used by new drivers.
-	 * Use &drm_crtc_funcs.get_vblank_counter instead.
-	 *
-	 * Returns:
-	 *
-	 * Raw vblank counter value.
-	 */
-	u32 (*get_vblank_counter) (struct drm_device *dev, unsigned int pipe);
-
-	/**
-	 * @enable_vblank:
-	 *
-	 * Enable vblank interrupts for the CRTC specified with the pipe
-	 * argument.
-	 *
-	 * This is deprecated and should not be used by new drivers.
-	 * Use &drm_crtc_funcs.enable_vblank instead.
-	 *
-	 * Returns:
-	 *
-	 * Zero on success, appropriate errno if the given @crtc's vblank
-	 * interrupt cannot be enabled.
-	 */
-	int (*enable_vblank) (struct drm_device *dev, unsigned int pipe);
-
-	/**
-	 * @disable_vblank:
-	 *
-	 * Disable vblank interrupts for the CRTC specified with the pipe
-	 * argument.
-	 *
-	 * This is deprecated and should not be used by new drivers.
-	 * Use &drm_crtc_funcs.disable_vblank instead.
-	 */
-	void (*disable_vblank) (struct drm_device *dev, unsigned int pipe);
-
-	/**
-	 * @get_vblank_timestamp:
-	 *
-	 * Called by drm_get_last_vbltimestamp(). Should return a precise
-	 * timestamp when the most recent VBLANK interval ended or will end.
-	 *
-	 * Specifically, the timestamp in @vblank_time should correspond as
-	 * closely as possible to the time when the first video scanline of
-	 * the video frame after the end of VBLANK will start scanning out,
-	 * the time immediately after end of the VBLANK interval. If the
-	 * @crtc is currently inside VBLANK, this will be a time in the future.
-	 * If the @crtc is currently scanning out a frame, this will be the
-	 * past start time of the current scanout. This is meant to adhere
-	 * to the OpenML OML_sync_control extension specification.
-	 *
-	 * Paramters:
-	 *
-	 * dev:
-	 *     dev DRM device handle.
-	 * pipe:
-	 *     crtc for which timestamp should be returned.
-	 * max_error:
-	 *     Maximum allowable timestamp error in nanoseconds.
-	 *     Implementation should strive to provide timestamp
-	 *     with an error of at most max_error nanoseconds.
-	 *     Returns true upper bound on error for timestamp.
-	 * vblank_time:
-	 *     Target location for returned vblank timestamp.
-	 * in_vblank_irq:
-	 *     True when called from drm_crtc_handle_vblank().  Some drivers
-	 *     need to apply some workarounds for gpu-specific vblank irq quirks
-	 *     if flag is set.
-	 *
-	 * Returns:
-	 *
-	 * True on success, false on failure, which means the core should
-	 * fallback to a simple timestamp taken in drm_crtc_handle_vblank().
-	 *
-	 * FIXME:
-	 *
-	 * We should move this hook to &struct drm_crtc_funcs like all the other
-	 * vblank hooks.
-	 */
-	bool (*get_vblank_timestamp) (struct drm_device *dev, unsigned int pipe,
-				     int *max_error,
-				     ktime_t *vblank_time,
-				     bool in_vblank_irq);
-
 	/**
 	 * @irq_handler:
 	 *
@@ -720,6 +622,9 @@ struct drm_driver {
 	int (*dma_ioctl) (struct drm_device *dev, void *data, struct drm_file *file_priv);
 	int (*dma_quiescent) (struct drm_device *);
 	int (*context_dtor) (struct drm_device *dev, int context);
+	u32 (*get_vblank_counter)(struct drm_device *dev, unsigned int pipe);
+	int (*enable_vblank)(struct drm_device *dev, unsigned int pipe);
+	void (*disable_vblank)(struct drm_device *dev, unsigned int pipe);
 	int dev_priv_size;
 };
 
-- 
2.24.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [Intel-gfx] [PATCH 23/23] drm: Cleanup VBLANK callbacks in struct drm_driver
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

All non-legacy users of VBLANK functions in struct drm_driver have been
converted to use the respective interfaces in struct drm_crtc_funcs. The
remaining users of VBLANK callbacks in struct drm_driver are legacy drivers
with userspace modesetting.

There are no users left of get_vblank_timestamp(), so the callback is
being removed. The other VBLANK callbacks are being moved to the legacy
section at the end of struct drm_driver.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/drm_vblank.c |  39 +++++---------
 include/drm/drm_drv.h        | 101 ++---------------------------------
 2 files changed, 17 insertions(+), 123 deletions(-)

diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
index 7cf436a4b908..ceff68474d4d 100644
--- a/drivers/gpu/drm/drm_vblank.c
+++ b/drivers/gpu/drm/drm_vblank.c
@@ -138,10 +138,9 @@ static u32 __get_vblank_counter(struct drm_device *dev, unsigned int pipe)
 
 		if (crtc->funcs->get_vblank_counter)
 			return crtc->funcs->get_vblank_counter(crtc);
-	}
-
-	if (dev->driver->get_vblank_counter)
+	} else if (dev->driver->get_vblank_counter) {
 		return dev->driver->get_vblank_counter(dev, pipe);
+	}
 
 	return drm_vblank_no_hw_counter(dev, pipe);
 }
@@ -334,8 +333,7 @@ u64 drm_crtc_accurate_vblank_count(struct drm_crtc *crtc)
 	unsigned long flags;
 
 	WARN_ONCE(drm_debug_enabled(DRM_UT_VBL) &&
-		  !crtc->funcs->get_vblank_timestamp &&
-		  !dev->driver->get_vblank_timestamp,
+		  !crtc->funcs->get_vblank_timestamp,
 		  "This function requires support for accurate vblank timestamps.");
 
 	spin_lock_irqsave(&dev->vblank_time_lock, flags);
@@ -357,13 +355,11 @@ static void __disable_vblank(struct drm_device *dev, unsigned int pipe)
 		if (WARN_ON(!crtc))
 			return;
 
-		if (crtc->funcs->disable_vblank) {
+		if (crtc->funcs->disable_vblank)
 			crtc->funcs->disable_vblank(crtc);
-			return;
-		}
+	} else {
+		dev->driver->disable_vblank(dev, pipe);
 	}
-
-	dev->driver->disable_vblank(dev, pipe);
 }
 
 /*
@@ -791,9 +787,6 @@ drm_get_last_vbltimestamp(struct drm_device *dev, unsigned int pipe,
 
 		ret = crtc->funcs->get_vblank_timestamp(crtc, &max_error,
 							tvblank, in_vblank_irq);
-	} else if (dev->driver->get_vblank_timestamp && (max_error > 0)) {
-		ret = dev->driver->get_vblank_timestamp(dev, pipe, &max_error,
-							tvblank, in_vblank_irq);
 	}
 
 	/* GPU high precision timestamp query unsupported or failed.
@@ -1016,9 +1009,11 @@ static int __enable_vblank(struct drm_device *dev, unsigned int pipe)
 
 		if (crtc->funcs->enable_vblank)
 			return crtc->funcs->enable_vblank(crtc);
+	} else if (dev->driver->enable_vblank) {
+		return dev->driver->enable_vblank(dev, pipe);
 	}
 
-	return dev->driver->enable_vblank(dev, pipe);
+	return -EINVAL;
 }
 
 static int drm_vblank_enable(struct drm_device *dev, unsigned int pipe)
@@ -1109,13 +1104,10 @@ static bool __vblank_disable_immediate(struct drm_device *dev, unsigned int pipe
 		return false;
 
 	crtc = drm_crtc_from_index(dev, pipe);
-	if (crtc && crtc->funcs->get_vblank_timestamp)
-		return true;
-
-	if (dev->driver->get_vblank_timestamp)
-		return true;
+	if (!crtc || !crtc->funcs->get_vblank_timestamp)
+		return false;
 
-	return false;
+	return true;
 }
 
 static void drm_vblank_put(struct drm_device *dev, unsigned int pipe)
@@ -1798,7 +1790,6 @@ static void drm_handle_vblank_events(struct drm_device *dev, unsigned int pipe)
 	struct drm_pending_vblank_event *e, *t;
 	ktime_t now;
 	u64 seq;
-	bool high_prec;
 
 	assert_spin_locked(&dev->event_lock);
 
@@ -1818,10 +1809,8 @@ static void drm_handle_vblank_events(struct drm_device *dev, unsigned int pipe)
 		send_vblank_event(dev, e, seq, now);
 	}
 
-	high_prec = crtc->funcs->get_vblank_timestamp ||
-		    dev->driver->get_vblank_timestamp;
-
-	trace_drm_vblank_event(pipe, seq, now, high_prec);
+	trace_drm_vblank_event(pipe, seq, now,
+			       crtc->funcs->get_vblank_timestamp != NULL);
 }
 
 /**
diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
index b704e252f3b2..e290b3aca6eb 100644
--- a/include/drm/drm_drv.h
+++ b/include/drm/drm_drv.h
@@ -268,104 +268,6 @@ struct drm_driver {
 	 */
 	void (*release) (struct drm_device *);
 
-	/**
-	 * @get_vblank_counter:
-	 *
-	 * Driver callback for fetching a raw hardware vblank counter for the
-	 * CRTC specified with the pipe argument.  If a device doesn't have a
-	 * hardware counter, the driver can simply leave the hook as NULL.
-	 * The DRM core will account for missed vblank events while interrupts
-	 * where disabled based on system timestamps.
-	 *
-	 * Wraparound handling and loss of events due to modesetting is dealt
-	 * with in the DRM core code, as long as drivers call
-	 * drm_crtc_vblank_off() and drm_crtc_vblank_on() when disabling or
-	 * enabling a CRTC.
-	 *
-	 * This is deprecated and should not be used by new drivers.
-	 * Use &drm_crtc_funcs.get_vblank_counter instead.
-	 *
-	 * Returns:
-	 *
-	 * Raw vblank counter value.
-	 */
-	u32 (*get_vblank_counter) (struct drm_device *dev, unsigned int pipe);
-
-	/**
-	 * @enable_vblank:
-	 *
-	 * Enable vblank interrupts for the CRTC specified with the pipe
-	 * argument.
-	 *
-	 * This is deprecated and should not be used by new drivers.
-	 * Use &drm_crtc_funcs.enable_vblank instead.
-	 *
-	 * Returns:
-	 *
-	 * Zero on success, appropriate errno if the given @crtc's vblank
-	 * interrupt cannot be enabled.
-	 */
-	int (*enable_vblank) (struct drm_device *dev, unsigned int pipe);
-
-	/**
-	 * @disable_vblank:
-	 *
-	 * Disable vblank interrupts for the CRTC specified with the pipe
-	 * argument.
-	 *
-	 * This is deprecated and should not be used by new drivers.
-	 * Use &drm_crtc_funcs.disable_vblank instead.
-	 */
-	void (*disable_vblank) (struct drm_device *dev, unsigned int pipe);
-
-	/**
-	 * @get_vblank_timestamp:
-	 *
-	 * Called by drm_get_last_vbltimestamp(). Should return a precise
-	 * timestamp when the most recent VBLANK interval ended or will end.
-	 *
-	 * Specifically, the timestamp in @vblank_time should correspond as
-	 * closely as possible to the time when the first video scanline of
-	 * the video frame after the end of VBLANK will start scanning out,
-	 * the time immediately after end of the VBLANK interval. If the
-	 * @crtc is currently inside VBLANK, this will be a time in the future.
-	 * If the @crtc is currently scanning out a frame, this will be the
-	 * past start time of the current scanout. This is meant to adhere
-	 * to the OpenML OML_sync_control extension specification.
-	 *
-	 * Paramters:
-	 *
-	 * dev:
-	 *     dev DRM device handle.
-	 * pipe:
-	 *     crtc for which timestamp should be returned.
-	 * max_error:
-	 *     Maximum allowable timestamp error in nanoseconds.
-	 *     Implementation should strive to provide timestamp
-	 *     with an error of at most max_error nanoseconds.
-	 *     Returns true upper bound on error for timestamp.
-	 * vblank_time:
-	 *     Target location for returned vblank timestamp.
-	 * in_vblank_irq:
-	 *     True when called from drm_crtc_handle_vblank().  Some drivers
-	 *     need to apply some workarounds for gpu-specific vblank irq quirks
-	 *     if flag is set.
-	 *
-	 * Returns:
-	 *
-	 * True on success, false on failure, which means the core should
-	 * fallback to a simple timestamp taken in drm_crtc_handle_vblank().
-	 *
-	 * FIXME:
-	 *
-	 * We should move this hook to &struct drm_crtc_funcs like all the other
-	 * vblank hooks.
-	 */
-	bool (*get_vblank_timestamp) (struct drm_device *dev, unsigned int pipe,
-				     int *max_error,
-				     ktime_t *vblank_time,
-				     bool in_vblank_irq);
-
 	/**
 	 * @irq_handler:
 	 *
@@ -720,6 +622,9 @@ struct drm_driver {
 	int (*dma_ioctl) (struct drm_device *dev, void *data, struct drm_file *file_priv);
 	int (*dma_quiescent) (struct drm_device *);
 	int (*context_dtor) (struct drm_device *dev, int context);
+	u32 (*get_vblank_counter)(struct drm_device *dev, unsigned int pipe);
+	int (*enable_vblank)(struct drm_device *dev, unsigned int pipe);
+	void (*disable_vblank)(struct drm_device *dev, unsigned int pipe);
 	int dev_priv_size;
 };
 
-- 
2.24.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [PATCH 23/23] drm: Cleanup VBLANK callbacks in struct drm_driver
@ 2020-01-10  9:21   ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10  9:21 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

All non-legacy users of VBLANK functions in struct drm_driver have been
converted to use the respective interfaces in struct drm_crtc_funcs. The
remaining users of VBLANK callbacks in struct drm_driver are legacy drivers
with userspace modesetting.

There are no users left of get_vblank_timestamp(), so the callback is
being removed. The other VBLANK callbacks are being moved to the legacy
section at the end of struct drm_driver.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/drm_vblank.c |  39 +++++---------
 include/drm/drm_drv.h        | 101 ++---------------------------------
 2 files changed, 17 insertions(+), 123 deletions(-)

diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
index 7cf436a4b908..ceff68474d4d 100644
--- a/drivers/gpu/drm/drm_vblank.c
+++ b/drivers/gpu/drm/drm_vblank.c
@@ -138,10 +138,9 @@ static u32 __get_vblank_counter(struct drm_device *dev, unsigned int pipe)
 
 		if (crtc->funcs->get_vblank_counter)
 			return crtc->funcs->get_vblank_counter(crtc);
-	}
-
-	if (dev->driver->get_vblank_counter)
+	} else if (dev->driver->get_vblank_counter) {
 		return dev->driver->get_vblank_counter(dev, pipe);
+	}
 
 	return drm_vblank_no_hw_counter(dev, pipe);
 }
@@ -334,8 +333,7 @@ u64 drm_crtc_accurate_vblank_count(struct drm_crtc *crtc)
 	unsigned long flags;
 
 	WARN_ONCE(drm_debug_enabled(DRM_UT_VBL) &&
-		  !crtc->funcs->get_vblank_timestamp &&
-		  !dev->driver->get_vblank_timestamp,
+		  !crtc->funcs->get_vblank_timestamp,
 		  "This function requires support for accurate vblank timestamps.");
 
 	spin_lock_irqsave(&dev->vblank_time_lock, flags);
@@ -357,13 +355,11 @@ static void __disable_vblank(struct drm_device *dev, unsigned int pipe)
 		if (WARN_ON(!crtc))
 			return;
 
-		if (crtc->funcs->disable_vblank) {
+		if (crtc->funcs->disable_vblank)
 			crtc->funcs->disable_vblank(crtc);
-			return;
-		}
+	} else {
+		dev->driver->disable_vblank(dev, pipe);
 	}
-
-	dev->driver->disable_vblank(dev, pipe);
 }
 
 /*
@@ -791,9 +787,6 @@ drm_get_last_vbltimestamp(struct drm_device *dev, unsigned int pipe,
 
 		ret = crtc->funcs->get_vblank_timestamp(crtc, &max_error,
 							tvblank, in_vblank_irq);
-	} else if (dev->driver->get_vblank_timestamp && (max_error > 0)) {
-		ret = dev->driver->get_vblank_timestamp(dev, pipe, &max_error,
-							tvblank, in_vblank_irq);
 	}
 
 	/* GPU high precision timestamp query unsupported or failed.
@@ -1016,9 +1009,11 @@ static int __enable_vblank(struct drm_device *dev, unsigned int pipe)
 
 		if (crtc->funcs->enable_vblank)
 			return crtc->funcs->enable_vblank(crtc);
+	} else if (dev->driver->enable_vblank) {
+		return dev->driver->enable_vblank(dev, pipe);
 	}
 
-	return dev->driver->enable_vblank(dev, pipe);
+	return -EINVAL;
 }
 
 static int drm_vblank_enable(struct drm_device *dev, unsigned int pipe)
@@ -1109,13 +1104,10 @@ static bool __vblank_disable_immediate(struct drm_device *dev, unsigned int pipe
 		return false;
 
 	crtc = drm_crtc_from_index(dev, pipe);
-	if (crtc && crtc->funcs->get_vblank_timestamp)
-		return true;
-
-	if (dev->driver->get_vblank_timestamp)
-		return true;
+	if (!crtc || !crtc->funcs->get_vblank_timestamp)
+		return false;
 
-	return false;
+	return true;
 }
 
 static void drm_vblank_put(struct drm_device *dev, unsigned int pipe)
@@ -1798,7 +1790,6 @@ static void drm_handle_vblank_events(struct drm_device *dev, unsigned int pipe)
 	struct drm_pending_vblank_event *e, *t;
 	ktime_t now;
 	u64 seq;
-	bool high_prec;
 
 	assert_spin_locked(&dev->event_lock);
 
@@ -1818,10 +1809,8 @@ static void drm_handle_vblank_events(struct drm_device *dev, unsigned int pipe)
 		send_vblank_event(dev, e, seq, now);
 	}
 
-	high_prec = crtc->funcs->get_vblank_timestamp ||
-		    dev->driver->get_vblank_timestamp;
-
-	trace_drm_vblank_event(pipe, seq, now, high_prec);
+	trace_drm_vblank_event(pipe, seq, now,
+			       crtc->funcs->get_vblank_timestamp != NULL);
 }
 
 /**
diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
index b704e252f3b2..e290b3aca6eb 100644
--- a/include/drm/drm_drv.h
+++ b/include/drm/drm_drv.h
@@ -268,104 +268,6 @@ struct drm_driver {
 	 */
 	void (*release) (struct drm_device *);
 
-	/**
-	 * @get_vblank_counter:
-	 *
-	 * Driver callback for fetching a raw hardware vblank counter for the
-	 * CRTC specified with the pipe argument.  If a device doesn't have a
-	 * hardware counter, the driver can simply leave the hook as NULL.
-	 * The DRM core will account for missed vblank events while interrupts
-	 * where disabled based on system timestamps.
-	 *
-	 * Wraparound handling and loss of events due to modesetting is dealt
-	 * with in the DRM core code, as long as drivers call
-	 * drm_crtc_vblank_off() and drm_crtc_vblank_on() when disabling or
-	 * enabling a CRTC.
-	 *
-	 * This is deprecated and should not be used by new drivers.
-	 * Use &drm_crtc_funcs.get_vblank_counter instead.
-	 *
-	 * Returns:
-	 *
-	 * Raw vblank counter value.
-	 */
-	u32 (*get_vblank_counter) (struct drm_device *dev, unsigned int pipe);
-
-	/**
-	 * @enable_vblank:
-	 *
-	 * Enable vblank interrupts for the CRTC specified with the pipe
-	 * argument.
-	 *
-	 * This is deprecated and should not be used by new drivers.
-	 * Use &drm_crtc_funcs.enable_vblank instead.
-	 *
-	 * Returns:
-	 *
-	 * Zero on success, appropriate errno if the given @crtc's vblank
-	 * interrupt cannot be enabled.
-	 */
-	int (*enable_vblank) (struct drm_device *dev, unsigned int pipe);
-
-	/**
-	 * @disable_vblank:
-	 *
-	 * Disable vblank interrupts for the CRTC specified with the pipe
-	 * argument.
-	 *
-	 * This is deprecated and should not be used by new drivers.
-	 * Use &drm_crtc_funcs.disable_vblank instead.
-	 */
-	void (*disable_vblank) (struct drm_device *dev, unsigned int pipe);
-
-	/**
-	 * @get_vblank_timestamp:
-	 *
-	 * Called by drm_get_last_vbltimestamp(). Should return a precise
-	 * timestamp when the most recent VBLANK interval ended or will end.
-	 *
-	 * Specifically, the timestamp in @vblank_time should correspond as
-	 * closely as possible to the time when the first video scanline of
-	 * the video frame after the end of VBLANK will start scanning out,
-	 * the time immediately after end of the VBLANK interval. If the
-	 * @crtc is currently inside VBLANK, this will be a time in the future.
-	 * If the @crtc is currently scanning out a frame, this will be the
-	 * past start time of the current scanout. This is meant to adhere
-	 * to the OpenML OML_sync_control extension specification.
-	 *
-	 * Paramters:
-	 *
-	 * dev:
-	 *     dev DRM device handle.
-	 * pipe:
-	 *     crtc for which timestamp should be returned.
-	 * max_error:
-	 *     Maximum allowable timestamp error in nanoseconds.
-	 *     Implementation should strive to provide timestamp
-	 *     with an error of at most max_error nanoseconds.
-	 *     Returns true upper bound on error for timestamp.
-	 * vblank_time:
-	 *     Target location for returned vblank timestamp.
-	 * in_vblank_irq:
-	 *     True when called from drm_crtc_handle_vblank().  Some drivers
-	 *     need to apply some workarounds for gpu-specific vblank irq quirks
-	 *     if flag is set.
-	 *
-	 * Returns:
-	 *
-	 * True on success, false on failure, which means the core should
-	 * fallback to a simple timestamp taken in drm_crtc_handle_vblank().
-	 *
-	 * FIXME:
-	 *
-	 * We should move this hook to &struct drm_crtc_funcs like all the other
-	 * vblank hooks.
-	 */
-	bool (*get_vblank_timestamp) (struct drm_device *dev, unsigned int pipe,
-				     int *max_error,
-				     ktime_t *vblank_time,
-				     bool in_vblank_irq);
-
 	/**
 	 * @irq_handler:
 	 *
@@ -720,6 +622,9 @@ struct drm_driver {
 	int (*dma_ioctl) (struct drm_device *dev, void *data, struct drm_file *file_priv);
 	int (*dma_quiescent) (struct drm_device *);
 	int (*context_dtor) (struct drm_device *dev, int context);
+	u32 (*get_vblank_counter)(struct drm_device *dev, unsigned int pipe);
+	int (*enable_vblank)(struct drm_device *dev, unsigned int pipe);
+	void (*disable_vblank)(struct drm_device *dev, unsigned int pipe);
 	int dev_priv_size;
 };
 
-- 
2.24.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm: Clean up VBLANK callbacks in struct drm_driver
  2020-01-10  9:21 ` Thomas Zimmermann
                   ` (26 preceding siblings ...)
  (?)
@ 2020-01-10  9:40 ` Patchwork
  -1 siblings, 0 replies; 217+ messages in thread
From: Patchwork @ 2020-01-10  9:40 UTC (permalink / raw)
  To: Thomas Zimmermann; +Cc: intel-gfx

== Series Details ==

Series: drm: Clean up VBLANK callbacks in struct drm_driver
URL   : https://patchwork.freedesktop.org/series/71873/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
30f2cd6c8fad drm: Add get_scanout_position() to struct drm_crtc_helper_funcs
-:58: CHECK:OPEN_ENDED_LINE: Lines should not end with a '('
#58: FILE: drivers/gpu/drm/drm_vblank.c:671:
+				crtc->helper_private->get_scanout_position(

-:63: CHECK:OPEN_ENDED_LINE: Lines should not end with a '('
#63: FILE: drivers/gpu/drm/drm_vblank.c:676:
+				dev->driver->get_scanout_position(

total: 0 errors, 0 warnings, 2 checks, 114 lines checked
62a0fc25c2ed drm/amdgpu: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
-:23: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis
#23: FILE: drivers/gpu/drm/amd/amdgpu/amdgpu_display.c:919:
+bool amdgpu_crtc_get_scanout_position(struct drm_crtc *crtc,
+			bool in_vblank_irq, int *vpos,

-:71: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis
#71: FILE: drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h:616:
+bool amdgpu_crtc_get_scanout_position(struct drm_crtc *crtc,
+			bool in_vblank_irq, int *vpos,

total: 0 errors, 0 warnings, 2 checks, 93 lines checked
daf9deab4b37 drm/i915: Don't use struct drm_driver.get_scanout_position()
-:135: CHECK:SPACING: spaces preferred around that '/' (ctx:VxV)
#135: FILE: drivers/gpu/drm/i915/i915_irq.c:958:
+			  pipe, duration_ns/1000, *max_error/1000, i);
 			                   ^

-:135: CHECK:SPACING: spaces preferred around that '/' (ctx:VxV)
#135: FILE: drivers/gpu/drm/i915/i915_irq.c:958:
+			  pipe, duration_ns/1000, *max_error/1000, i);
 			                                    ^

total: 0 errors, 0 warnings, 2 checks, 159 lines checked
cc4157b82402 drm/nouveau: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
-:75: WARNING:FUNCTION_ARGUMENTS: function definition argument 'struct drm_crtc *' should also have an identifier name
#75: FILE: drivers/gpu/drm/nouveau/nouveau_display.h:66:
+bool  nouveau_display_scanoutpos(struct drm_crtc *,

-:75: WARNING:FUNCTION_ARGUMENTS: function definition argument 'bool' should also have an identifier name
#75: FILE: drivers/gpu/drm/nouveau/nouveau_display.h:66:
+bool  nouveau_display_scanoutpos(struct drm_crtc *,

-:75: WARNING:FUNCTION_ARGUMENTS: function definition argument 'int *' should also have an identifier name
#75: FILE: drivers/gpu/drm/nouveau/nouveau_display.h:66:
+bool  nouveau_display_scanoutpos(struct drm_crtc *,

-:75: WARNING:FUNCTION_ARGUMENTS: function definition argument 'int *' should also have an identifier name
#75: FILE: drivers/gpu/drm/nouveau/nouveau_display.h:66:
+bool  nouveau_display_scanoutpos(struct drm_crtc *,

-:75: WARNING:FUNCTION_ARGUMENTS: function definition argument 'ktime_t *' should also have an identifier name
#75: FILE: drivers/gpu/drm/nouveau/nouveau_display.h:66:
+bool  nouveau_display_scanoutpos(struct drm_crtc *,

-:75: WARNING:FUNCTION_ARGUMENTS: function definition argument 'ktime_t *' should also have an identifier name
#75: FILE: drivers/gpu/drm/nouveau/nouveau_display.h:66:
+bool  nouveau_display_scanoutpos(struct drm_crtc *,

-:75: WARNING:FUNCTION_ARGUMENTS: function definition argument 'const struct drm_display_mode *' should also have an identifier name
#75: FILE: drivers/gpu/drm/nouveau/nouveau_display.h:66:
+bool  nouveau_display_scanoutpos(struct drm_crtc *,

total: 0 errors, 7 warnings, 0 checks, 53 lines checked
78fac3c06e60 drm/radeon: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
-:97: CHECK:AVOID_EXTERNS: extern prototypes should be avoided in .h files
#97: FILE: drivers/gpu/drm/radeon/radeon_mode.h:884:
+extern bool radeon_get_crtc_scanout_position(struct drm_crtc *crtc,

total: 0 errors, 0 warnings, 1 checks, 67 lines checked
7aa032e1e5eb drm/msm: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
-:43: CHECK:LINE_SPACING: Please don't use multiple blank lines
#43: FILE: drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c:430:
+
+

total: 0 errors, 0 warnings, 1 checks, 152 lines checked
450559e9416c drm/vc4: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
47676fe9e9da drm/stm: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
4fb79c555089 drm: Remove struct drm_driver.get_scanout_position()
-:33: CHECK:OPEN_ENDED_LINE: Lines should not end with a '('
#33: FILE: drivers/gpu/drm/drm_vblank.c:668:
+		vbl_status = crtc->helper_private->get_scanout_position(

total: 0 errors, 0 warnings, 1 checks, 85 lines checked
cbfbe29f84f9 drm: Evaluate struct drm_device.vblank_disable_immediate on each use
115af48b3a62 drm: Add get_vblank_timestamp() to struct drm_crtc_funcs
-:105: CHECK:UNNECESSARY_PARENTHESES: Unnecessary parentheses around 'max_error > 0'
#105: FILE: drivers/gpu/drm/drm_vblank.c:789:
+	if (crtc->funcs->get_vblank_timestamp && (max_error > 0)) {

total: 0 errors, 0 warnings, 1 checks, 203 lines checked
585dc3993334 drm/amdgpu: Convert to CRTC VBLANK callbacks
dbf1b08fc990 drm/gma500: Convert to CRTC VBLANK callbacks
-:57: CHECK:AVOID_EXTERNS: extern prototypes should be avoided in .h files
#57: FILE: drivers/gpu/drm/gma500/psb_drv.h:684:
+extern int psb_enable_vblank(struct drm_crtc *crtc);

-:58: CHECK:AVOID_EXTERNS: extern prototypes should be avoided in .h files
#58: FILE: drivers/gpu/drm/gma500/psb_drv.h:685:
+extern void psb_disable_vblank(struct drm_crtc *crtc);

-:66: CHECK:AVOID_EXTERNS: extern prototypes should be avoided in .h files
#66: FILE: drivers/gpu/drm/gma500/psb_drv.h:692:
+extern u32 psb_get_vblank_counter(struct drm_crtc *crtc);

total: 0 errors, 0 warnings, 3 checks, 104 lines checked
c7747dd915c1 drm/i915: Convert to CRTC VBLANK callbacks
9f3580b11e21 drm/msm: Convert to CRTC VBLANK callbacks
172a0bc8d942 drm/nouveau: Convert to CRTC VBLANK callbacks
-:95: WARNING:FUNCTION_ARGUMENTS: function definition argument 'struct drm_crtc *' should also have an identifier name
#95: FILE: drivers/gpu/drm/nouveau/nouveau_display.h:64:
+int  nouveau_display_vblank_enable(struct drm_crtc *);

-:96: WARNING:FUNCTION_ARGUMENTS: function definition argument 'struct drm_crtc *' should also have an identifier name
#96: FILE: drivers/gpu/drm/nouveau/nouveau_display.h:65:
+void nouveau_display_vblank_disable(struct drm_crtc *);

total: 0 errors, 2 warnings, 0 checks, 77 lines checked
a88d8ab0a3a3 drm/radeon: Convert to CRTC VBLANK callbacks
-:20: WARNING:AVOID_EXTERNS: externs should be avoided in .c files
#20: FILE: drivers/gpu/drm/radeon/radeon_display.c:49:
+int radeon_enable_vblank_kms(struct drm_crtc *crtc);

-:21: WARNING:AVOID_EXTERNS: externs should be avoided in .c files
#21: FILE: drivers/gpu/drm/radeon/radeon_display.c:50:
+void radeon_disable_vblank_kms(struct drm_crtc *crtc);

total: 0 errors, 2 warnings, 0 checks, 133 lines checked
086db47a9d9b drm/sti: Convert to CRTC VBLANK callbacks
525588523ac7 drm/stm: Convert to CRTC VBLANK callbacks
3cfb12b0e696 drm/vc4: Convert to CRTC VBLANK callbacks
903a2a016c51 drm/vkms: Convert to CRTC VBLANK callbacks
84acced102ba drm/vmwgfx: Convert to CRTC VBLANK callbacks
dadf262439d8 drm: Cleanup VBLANK callbacks in struct drm_driver
-:118: CHECK:COMPARISON_TO_NULL: Comparison to NULL could be written "crtc->funcs->get_vblank_timestamp"
#118: FILE: drivers/gpu/drm/drm_vblank.c:1813:
+			       crtc->funcs->get_vblank_timestamp != NULL);

total: 0 errors, 0 warnings, 1 checks, 206 lines checked

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 217+ messages in thread

* [Intel-gfx] ✗ Fi.CI.SPARSE: warning for drm: Clean up VBLANK callbacks in struct drm_driver
  2020-01-10  9:21 ` Thomas Zimmermann
                   ` (27 preceding siblings ...)
  (?)
@ 2020-01-10  9:49 ` Patchwork
  -1 siblings, 0 replies; 217+ messages in thread
From: Patchwork @ 2020-01-10  9:49 UTC (permalink / raw)
  To: Thomas Zimmermann; +Cc: intel-gfx

== Series Details ==

Series: drm: Clean up VBLANK callbacks in struct drm_driver
URL   : https://patchwork.freedesktop.org/series/71873/
State : warning

== Summary ==

$ dim sparse origin/drm-tip
Sparse version: v0.6.0
Commit: drm: Add get_scanout_position() to struct drm_crtc_helper_funcs
Okay!

Commit: drm/amdgpu: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
-drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:4937:6: warning: symbol 'dm_drm_plane_destroy_state' was not declared. Should it be static?
+drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:4938:6: warning: symbol 'dm_drm_plane_destroy_state' was not declared. Should it be static?
-drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:8232:6: warning: symbol 'amdgpu_dm_psr_enable' was not declared. Should it be static?
+drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:8233:6: warning: symbol 'amdgpu_dm_psr_enable' was not declared. Should it be static?

Commit: drm/i915: Don't use struct drm_driver.get_scanout_position()
Okay!

Commit: drm/nouveau: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
Okay!

Commit: drm/radeon: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
Okay!

Commit: drm/msm: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
Okay!

Commit: drm/vc4: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
Okay!

Commit: drm/stm: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
Okay!

Commit: drm: Remove struct drm_driver.get_scanout_position()
Okay!

Commit: drm: Evaluate struct drm_device.vblank_disable_immediate on each use
Okay!

Commit: drm: Add get_vblank_timestamp() to struct drm_crtc_funcs
Okay!

Commit: drm/amdgpu: Convert to CRTC VBLANK callbacks
-drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:4938:6: warning: symbol 'dm_drm_plane_destroy_state' was not declared. Should it be static?
+drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:4940:6: warning: symbol 'dm_drm_plane_destroy_state' was not declared. Should it be static?
-drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:8233:6: warning: symbol 'amdgpu_dm_psr_enable' was not declared. Should it be static?
+drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:8235:6: warning: symbol 'amdgpu_dm_psr_enable' was not declared. Should it be static?

Commit: drm/gma500: Convert to CRTC VBLANK callbacks
Okay!

Commit: drm/i915: Convert to CRTC VBLANK callbacks
Okay!

Commit: drm/msm: Convert to CRTC VBLANK callbacks
Okay!

Commit: drm/nouveau: Convert to CRTC VBLANK callbacks
Okay!

Commit: drm/radeon: Convert to CRTC VBLANK callbacks
Okay!

Commit: drm/sti: Convert to CRTC VBLANK callbacks
Okay!

Commit: drm/stm: Convert to CRTC VBLANK callbacks
Okay!

Commit: drm/vc4: Convert to CRTC VBLANK callbacks
Okay!

Commit: drm/vkms: Convert to CRTC VBLANK callbacks
Okay!

Commit: drm/vmwgfx: Convert to CRTC VBLANK callbacks
Okay!

Commit: drm: Cleanup VBLANK callbacks in struct drm_driver
Okay!

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 217+ messages in thread

* [Intel-gfx] ✓ Fi.CI.BAT: success for drm: Clean up VBLANK callbacks in struct drm_driver
  2020-01-10  9:21 ` Thomas Zimmermann
                   ` (28 preceding siblings ...)
  (?)
@ 2020-01-10 10:09 ` Patchwork
  -1 siblings, 0 replies; 217+ messages in thread
From: Patchwork @ 2020-01-10 10:09 UTC (permalink / raw)
  To: Thomas Zimmermann; +Cc: intel-gfx

== Series Details ==

Series: drm: Clean up VBLANK callbacks in struct drm_driver
URL   : https://patchwork.freedesktop.org/series/71873/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_7715 -> Patchwork_16048
====================================================

Summary
-------

  **SUCCESS**

  No regressions found.

  External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16048/index.html

Known issues
------------

  Here are the changes found in Patchwork_16048 that come from known issues:

### IGT changes ###

#### Issues hit ####

  * igt@gem_exec_suspend@basic-s0:
    - fi-skl-6700k2:      [PASS][1] -> [INCOMPLETE][2] ([i915#198])
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7715/fi-skl-6700k2/igt@gem_exec_suspend@basic-s0.html
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16048/fi-skl-6700k2/igt@gem_exec_suspend@basic-s0.html

  * igt@i915_module_load@reload-with-fault-injection:
    - fi-bxt-dsi:         [PASS][3] -> [DMESG-WARN][4] ([i915#889])
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7715/fi-bxt-dsi/igt@i915_module_load@reload-with-fault-injection.html
   [4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16048/fi-bxt-dsi/igt@i915_module_load@reload-with-fault-injection.html
    - fi-kbl-x1275:       [PASS][5] -> [INCOMPLETE][6] ([i915#879])
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7715/fi-kbl-x1275/igt@i915_module_load@reload-with-fault-injection.html
   [6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16048/fi-kbl-x1275/igt@i915_module_load@reload-with-fault-injection.html

  * igt@i915_pm_rpm@module-reload:
    - fi-hsw-4770:        [PASS][7] -> [INCOMPLETE][8] ([i915#151])
   [7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7715/fi-hsw-4770/igt@i915_pm_rpm@module-reload.html
   [8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16048/fi-hsw-4770/igt@i915_pm_rpm@module-reload.html

  * igt@i915_selftest@live_blt:
    - fi-hsw-4770r:       [PASS][9] -> [DMESG-FAIL][10] ([i915#563])
   [9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7715/fi-hsw-4770r/igt@i915_selftest@live_blt.html
   [10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16048/fi-hsw-4770r/igt@i915_selftest@live_blt.html
    - fi-hsw-peppy:       [PASS][11] -> [DMESG-FAIL][12] ([i915#553] / [i915#725])
   [11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7715/fi-hsw-peppy/igt@i915_selftest@live_blt.html
   [12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16048/fi-hsw-peppy/igt@i915_selftest@live_blt.html

  
#### Possible fixes ####

  * igt@i915_pm_rpm@module-reload:
    - fi-skl-6770hq:      [FAIL][13] ([i915#178]) -> [PASS][14]
   [13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7715/fi-skl-6770hq/igt@i915_pm_rpm@module-reload.html
   [14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16048/fi-skl-6770hq/igt@i915_pm_rpm@module-reload.html

  * igt@i915_selftest@live_execlists:
    - fi-kbl-soraka:      [DMESG-FAIL][15] ([i915#656]) -> [PASS][16]
   [15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7715/fi-kbl-soraka/igt@i915_selftest@live_execlists.html
   [16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16048/fi-kbl-soraka/igt@i915_selftest@live_execlists.html

  * igt@i915_selftest@live_gem_contexts:
    - fi-hsw-peppy:       [DMESG-FAIL][17] ([i915#722]) -> [PASS][18]
   [17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7715/fi-hsw-peppy/igt@i915_selftest@live_gem_contexts.html
   [18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16048/fi-hsw-peppy/igt@i915_selftest@live_gem_contexts.html

  
  [i915#151]: https://gitlab.freedesktop.org/drm/intel/issues/151
  [i915#178]: https://gitlab.freedesktop.org/drm/intel/issues/178
  [i915#198]: https://gitlab.freedesktop.org/drm/intel/issues/198
  [i915#553]: https://gitlab.freedesktop.org/drm/intel/issues/553
  [i915#563]: https://gitlab.freedesktop.org/drm/intel/issues/563
  [i915#656]: https://gitlab.freedesktop.org/drm/intel/issues/656
  [i915#722]: https://gitlab.freedesktop.org/drm/intel/issues/722
  [i915#725]: https://gitlab.freedesktop.org/drm/intel/issues/725
  [i915#879]: https://gitlab.freedesktop.org/drm/intel/issues/879
  [i915#889]: https://gitlab.freedesktop.org/drm/intel/issues/889


Participating hosts (44 -> 39)
------------------------------

  Additional (8): fi-byt-j1900 fi-glk-dsi fi-kbl-guc fi-kbl-8809g fi-elk-e7500 fi-kbl-7560u fi-tgl-y fi-bsw-nick 
  Missing    (13): fi-ehl-1 fi-bdw-5557u fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-snb-2520m fi-kbl-7500u fi-ctg-p8600 fi-whl-u fi-skl-lmem fi-byt-n2820 fi-byt-clapper fi-kbl-r 


Build changes
-------------

  * CI: CI-20190529 -> None
  * Linux: CI_DRM_7715 -> Patchwork_16048

  CI-20190529: 20190529
  CI_DRM_7715: 337449c74a6745cf1d9d60c41f170d31a291f0c0 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGT_5359: 28451bcec2245dcc1fd0eb1d4c76335b2b4f97a5 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  Patchwork_16048: dadf262439d81673a98e649029a16118347446f7 @ git://anongit.freedesktop.org/gfx-ci/linux


== Linux commits ==

dadf262439d8 drm: Cleanup VBLANK callbacks in struct drm_driver
84acced102ba drm/vmwgfx: Convert to CRTC VBLANK callbacks
903a2a016c51 drm/vkms: Convert to CRTC VBLANK callbacks
3cfb12b0e696 drm/vc4: Convert to CRTC VBLANK callbacks
525588523ac7 drm/stm: Convert to CRTC VBLANK callbacks
086db47a9d9b drm/sti: Convert to CRTC VBLANK callbacks
a88d8ab0a3a3 drm/radeon: Convert to CRTC VBLANK callbacks
172a0bc8d942 drm/nouveau: Convert to CRTC VBLANK callbacks
9f3580b11e21 drm/msm: Convert to CRTC VBLANK callbacks
c7747dd915c1 drm/i915: Convert to CRTC VBLANK callbacks
dbf1b08fc990 drm/gma500: Convert to CRTC VBLANK callbacks
585dc3993334 drm/amdgpu: Convert to CRTC VBLANK callbacks
115af48b3a62 drm: Add get_vblank_timestamp() to struct drm_crtc_funcs
cbfbe29f84f9 drm: Evaluate struct drm_device.vblank_disable_immediate on each use
4fb79c555089 drm: Remove struct drm_driver.get_scanout_position()
47676fe9e9da drm/stm: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
450559e9416c drm/vc4: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
7aa032e1e5eb drm/msm: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
78fac3c06e60 drm/radeon: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
cc4157b82402 drm/nouveau: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
daf9deab4b37 drm/i915: Don't use struct drm_driver.get_scanout_position()
62a0fc25c2ed drm/amdgpu: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
30f2cd6c8fad drm: Add get_scanout_position() to struct drm_crtc_helper_funcs

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16048/index.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [PATCH 01/23] drm: Add get_scanout_position() to struct drm_crtc_helper_funcs
@ 2020-01-10 10:24     ` Jani Nikula
  0 siblings, 0 replies; 217+ messages in thread
From: Jani Nikula @ 2020-01-10 10:24 UTC (permalink / raw)
  To: Thomas Zimmermann, airlied, daniel, alexander.deucher,
	christian.koenig, David1.Zhou, maarten.lankhorst,
	patrik.r.jakobsson, robdclark, sean, benjamin.gaignard,
	vincent.abriou, yannick.fertre, philippe.cornu, mcoquelin.stm32,
	alexandre.torgue, eric, rodrigosiqueiramelo, hamohammed.sa,
	linux-graphics-maintainer, thellstrom, bskeggs, harry.wentland,
	sunpeng.li, joonas.lahtinen, rodrigo.vivi
  Cc: dri-devel, amd-gfx, intel-gfx, linux-arm-msm, freedreno, nouveau,
	Thomas Zimmermann

On Fri, 10 Jan 2020, Thomas Zimmermann <tzimmermann@suse.de> wrote:
> The new callback get_scanout_position() reads the current location of
> the scanout process. The operation is currentyl located in struct
> drm_driver, but really belongs to the CRTC. Drivers will be converted
> in separate patches.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
>  drivers/gpu/drm/drm_vblank.c             | 24 ++++++++----
>  include/drm/drm_drv.h                    |  7 +---
>  include/drm/drm_modeset_helper_vtables.h | 47 ++++++++++++++++++++++++
>  3 files changed, 65 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
> index 1659b13b178c..c12f0b333e14 100644
> --- a/drivers/gpu/drm/drm_vblank.c
> +++ b/drivers/gpu/drm/drm_vblank.c
> @@ -30,6 +30,7 @@
>  #include <drm/drm_crtc.h>
>  #include <drm/drm_drv.h>
>  #include <drm/drm_framebuffer.h>
> +#include <drm/drm_modeset_helper_vtables.h>
>  #include <drm/drm_print.h>
>  #include <drm/drm_vblank.h>
>  
> @@ -590,7 +591,7 @@ EXPORT_SYMBOL(drm_calc_timestamping_constants);
>   * Implements calculation of exact vblank timestamps from given drm_display_mode
>   * timings and current video scanout position of a CRTC. This can be directly
>   * used as the &drm_driver.get_vblank_timestamp implementation of a kms driver
> - * if &drm_driver.get_scanout_position is implemented.
> + * if &drm_crtc_helper_funcs.get_scanout_position is implemented.
>   *
>   * The current implementation only handles standard video modes. For double scan
>   * and interlaced modes the driver is supposed to adjust the hardware mode
> @@ -632,8 +633,9 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
>  	}
>  
>  	/* Scanout position query not supported? Should not happen. */
> -	if (!dev->driver->get_scanout_position) {
> -		DRM_ERROR("Called from driver w/o get_scanout_position()!?\n");
> +	if (!dev->driver->get_scanout_position ||
> +	    !crtc->helper_private->get_scanout_position) {

ITYM s/||/&&/

BR,
Jani.


> +		DRM_ERROR("Called from CRTC w/o get_scanout_position()!?\n");
>  		return false;
>  	}
>  
> @@ -664,11 +666,17 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
>  		 * Get vertical and horizontal scanout position vpos, hpos,
>  		 * and bounding timestamps stime, etime, pre/post query.
>  		 */
> -		vbl_status = dev->driver->get_scanout_position(dev, pipe,
> -							       in_vblank_irq,
> -							       &vpos, &hpos,
> -							       &stime, &etime,
> -							       mode);
> +		if (crtc->helper_private->get_scanout_position) {
> +			vbl_status =
> +				crtc->helper_private->get_scanout_position(
> +					crtc, in_vblank_irq, &vpos, &hpos,
> +					&stime, &etime, mode);
> +		} else {
> +			vbl_status =
> +				dev->driver->get_scanout_position(
> +					dev, pipe, in_vblank_irq, &vpos,
> +					&hpos, &stime, &etime, mode);
> +		}
>  
>  		/* Return as no-op if scanout query unsupported or failed. */
>  		if (!vbl_status) {
> diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
> index cf13470810a5..d0049e5786fc 100644
> --- a/include/drm/drm_drv.h
> +++ b/include/drm/drm_drv.h
> @@ -362,11 +362,8 @@ struct drm_driver {
>  	 * True on success, false if a reliable scanout position counter could
>  	 * not be read out.
>  	 *
> -	 * FIXME:
> -	 *
> -	 * Since this is a helper to implement @get_vblank_timestamp, we should
> -	 * move it to &struct drm_crtc_helper_funcs, like all the other
> -	 * helper-internal hooks.
> +	 * This is deprecated and should not be used by new drivers.
> +	 * Use &drm_crtc_helper_funcs.get_scanout_position instead.
>  	 */
>  	bool (*get_scanout_position) (struct drm_device *dev, unsigned int pipe,
>  				      bool in_vblank_irq, int *vpos, int *hpos,
> diff --git a/include/drm/drm_modeset_helper_vtables.h b/include/drm/drm_modeset_helper_vtables.h
> index 5a87f1bd7a3f..e398512bfd5f 100644
> --- a/include/drm/drm_modeset_helper_vtables.h
> +++ b/include/drm/drm_modeset_helper_vtables.h
> @@ -450,6 +450,53 @@ struct drm_crtc_helper_funcs {
>  	 */
>  	void (*atomic_disable)(struct drm_crtc *crtc,
>  			       struct drm_crtc_state *old_crtc_state);
> +
> +	/**
> +	 * @get_scanout_position:
> +	 *
> +	 * Called by vblank timestamping code.
> +	 *
> +	 * Returns the current display scanout position from a CRTC and an
> +	 * optional accurate ktime_get() timestamp of when the position was
> +	 * measured. Note that this is a helper callback which is only used
> +	 * if a driver uses drm_calc_vbltimestamp_from_scanoutpos() for the
> +	 * @drm_driver.get_vblank_timestamp callback.
> +	 *
> +	 * Parameters:
> +	 *
> +	 * crtc:
> +	 *     The CRTC.
> +	 * in_vblank_irq:
> +	 *     True when called from drm_crtc_handle_vblank(). Some drivers
> +	 *     need to apply some workarounds for gpu-specific vblank irq
> +	 *     quirks if the flag is set.
> +	 * vpos:
> +	 *     Target location for current vertical scanout position.
> +	 * hpos:
> +	 *     Target location for current horizontal scanout position.
> +	 * stime:
> +	 *     Target location for timestamp taken immediately before
> +	 *     scanout position query. Can be NULL to skip timestamp.
> +	 * etime:
> +	 *     Target location for timestamp taken immediately after
> +	 *     scanout position query. Can be NULL to skip timestamp.
> +	 * mode:
> +	 *     Current display timings.
> +	 *
> +	 * Returns vpos as a positive number while in active scanout area.
> +	 * Returns vpos as a negative number inside vblank, counting the number
> +	 * of scanlines to go until end of vblank, e.g., -1 means "one scanline
> +	 * until start of active scanout / end of vblank."
> +	 *
> +	 * Returns:
> +	 *
> +	 * True on success, false if a reliable scanout position counter could
> +	 * not be read out.
> +	 */
> +	bool (*get_scanout_position)(struct drm_crtc *crtc,
> +				     bool in_vblank_irq, int *vpos, int *hpos,
> +				     ktime_t *stime, ktime_t *etime,
> +				     const struct drm_display_mode *mode);
>  };
>  
>  /**

-- 
Jani Nikula, Intel Open Source Graphics Center

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [PATCH 01/23] drm: Add get_scanout_position() to struct drm_crtc_helper_funcs
@ 2020-01-10 10:24     ` Jani Nikula
  0 siblings, 0 replies; 217+ messages in thread
From: Jani Nikula @ 2020-01-10 10:24 UTC (permalink / raw)
  To: airlied-cv59FeDIM0c, daniel-/w4YWyX8dFk,
	alexander.deucher-5C7GfCeVMHo, christian.koenig-5C7GfCeVMHo,
	David1.Zhou-5C7GfCeVMHo,
	maarten.lankhorst-VuQAYsv1563Yd54FQh9/CA,
	patrik.r.jakobsson-Re5JQEeQqe8AvxtiuMwx3w,
	robdclark-Re5JQEeQqe8AvxtiuMwx3w, sean-p7yTbzM4H96eqtR555YLDQ,
	benjamin.gaignard-QSEj5FYQhm4dnm+yROfE0A,
	vincent.abriou-qxv4g6HH51o, yannick.fertre-qxv4g6HH51o,
	philippe.cornu-qxv4g6HH51o,
	mcoquelin.stm32-Re5JQEeQqe8AvxtiuMwx3w,
	alexandre.torgue-qxv4g6HH51o, eric-WhKQ6XTQaPysTnJN9+BGXg,
	rodrigosiqueiramelo-Re5JQEeQqe8AvxtiuMwx3w,
	hamohammed.sa-Re5JQEeQqe8AvxtiuMwx3w,
	linux-graphics-maintainer-pghWNbHTmq7QT0dZR+AlfA,
	thellstrom-pghWNbHTmq7QT0dZR+AlfA,
	bskeggs-H+wXaHxf7aLQT0dZR+AlfA, harry.wentland-5C7GfCeVMHo,
	sunpeng.li-5C7GfCeVMHo, joonas.lahtinen-VuQAYsv1563Yd54FQh9/CA,
	rodrigo.vivi-ral2JQCrhuEAvxtiuMwx3w
  Cc: linux-arm-msm-u79uwXL29TY76Z2rM5mHXA,
	intel-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Thomas Zimmermann,
	nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

On Fri, 10 Jan 2020, Thomas Zimmermann <tzimmermann-l3A5Bk7waGM@public.gmane.org> wrote:
> The new callback get_scanout_position() reads the current location of
> the scanout process. The operation is currentyl located in struct
> drm_driver, but really belongs to the CRTC. Drivers will be converted
> in separate patches.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann-l3A5Bk7waGM@public.gmane.org>
> ---
>  drivers/gpu/drm/drm_vblank.c             | 24 ++++++++----
>  include/drm/drm_drv.h                    |  7 +---
>  include/drm/drm_modeset_helper_vtables.h | 47 ++++++++++++++++++++++++
>  3 files changed, 65 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
> index 1659b13b178c..c12f0b333e14 100644
> --- a/drivers/gpu/drm/drm_vblank.c
> +++ b/drivers/gpu/drm/drm_vblank.c
> @@ -30,6 +30,7 @@
>  #include <drm/drm_crtc.h>
>  #include <drm/drm_drv.h>
>  #include <drm/drm_framebuffer.h>
> +#include <drm/drm_modeset_helper_vtables.h>
>  #include <drm/drm_print.h>
>  #include <drm/drm_vblank.h>
>  
> @@ -590,7 +591,7 @@ EXPORT_SYMBOL(drm_calc_timestamping_constants);
>   * Implements calculation of exact vblank timestamps from given drm_display_mode
>   * timings and current video scanout position of a CRTC. This can be directly
>   * used as the &drm_driver.get_vblank_timestamp implementation of a kms driver
> - * if &drm_driver.get_scanout_position is implemented.
> + * if &drm_crtc_helper_funcs.get_scanout_position is implemented.
>   *
>   * The current implementation only handles standard video modes. For double scan
>   * and interlaced modes the driver is supposed to adjust the hardware mode
> @@ -632,8 +633,9 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
>  	}
>  
>  	/* Scanout position query not supported? Should not happen. */
> -	if (!dev->driver->get_scanout_position) {
> -		DRM_ERROR("Called from driver w/o get_scanout_position()!?\n");
> +	if (!dev->driver->get_scanout_position ||
> +	    !crtc->helper_private->get_scanout_position) {

ITYM s/||/&&/

BR,
Jani.


> +		DRM_ERROR("Called from CRTC w/o get_scanout_position()!?\n");
>  		return false;
>  	}
>  
> @@ -664,11 +666,17 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
>  		 * Get vertical and horizontal scanout position vpos, hpos,
>  		 * and bounding timestamps stime, etime, pre/post query.
>  		 */
> -		vbl_status = dev->driver->get_scanout_position(dev, pipe,
> -							       in_vblank_irq,
> -							       &vpos, &hpos,
> -							       &stime, &etime,
> -							       mode);
> +		if (crtc->helper_private->get_scanout_position) {
> +			vbl_status =
> +				crtc->helper_private->get_scanout_position(
> +					crtc, in_vblank_irq, &vpos, &hpos,
> +					&stime, &etime, mode);
> +		} else {
> +			vbl_status =
> +				dev->driver->get_scanout_position(
> +					dev, pipe, in_vblank_irq, &vpos,
> +					&hpos, &stime, &etime, mode);
> +		}
>  
>  		/* Return as no-op if scanout query unsupported or failed. */
>  		if (!vbl_status) {
> diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
> index cf13470810a5..d0049e5786fc 100644
> --- a/include/drm/drm_drv.h
> +++ b/include/drm/drm_drv.h
> @@ -362,11 +362,8 @@ struct drm_driver {
>  	 * True on success, false if a reliable scanout position counter could
>  	 * not be read out.
>  	 *
> -	 * FIXME:
> -	 *
> -	 * Since this is a helper to implement @get_vblank_timestamp, we should
> -	 * move it to &struct drm_crtc_helper_funcs, like all the other
> -	 * helper-internal hooks.
> +	 * This is deprecated and should not be used by new drivers.
> +	 * Use &drm_crtc_helper_funcs.get_scanout_position instead.
>  	 */
>  	bool (*get_scanout_position) (struct drm_device *dev, unsigned int pipe,
>  				      bool in_vblank_irq, int *vpos, int *hpos,
> diff --git a/include/drm/drm_modeset_helper_vtables.h b/include/drm/drm_modeset_helper_vtables.h
> index 5a87f1bd7a3f..e398512bfd5f 100644
> --- a/include/drm/drm_modeset_helper_vtables.h
> +++ b/include/drm/drm_modeset_helper_vtables.h
> @@ -450,6 +450,53 @@ struct drm_crtc_helper_funcs {
>  	 */
>  	void (*atomic_disable)(struct drm_crtc *crtc,
>  			       struct drm_crtc_state *old_crtc_state);
> +
> +	/**
> +	 * @get_scanout_position:
> +	 *
> +	 * Called by vblank timestamping code.
> +	 *
> +	 * Returns the current display scanout position from a CRTC and an
> +	 * optional accurate ktime_get() timestamp of when the position was
> +	 * measured. Note that this is a helper callback which is only used
> +	 * if a driver uses drm_calc_vbltimestamp_from_scanoutpos() for the
> +	 * @drm_driver.get_vblank_timestamp callback.
> +	 *
> +	 * Parameters:
> +	 *
> +	 * crtc:
> +	 *     The CRTC.
> +	 * in_vblank_irq:
> +	 *     True when called from drm_crtc_handle_vblank(). Some drivers
> +	 *     need to apply some workarounds for gpu-specific vblank irq
> +	 *     quirks if the flag is set.
> +	 * vpos:
> +	 *     Target location for current vertical scanout position.
> +	 * hpos:
> +	 *     Target location for current horizontal scanout position.
> +	 * stime:
> +	 *     Target location for timestamp taken immediately before
> +	 *     scanout position query. Can be NULL to skip timestamp.
> +	 * etime:
> +	 *     Target location for timestamp taken immediately after
> +	 *     scanout position query. Can be NULL to skip timestamp.
> +	 * mode:
> +	 *     Current display timings.
> +	 *
> +	 * Returns vpos as a positive number while in active scanout area.
> +	 * Returns vpos as a negative number inside vblank, counting the number
> +	 * of scanlines to go until end of vblank, e.g., -1 means "one scanline
> +	 * until start of active scanout / end of vblank."
> +	 *
> +	 * Returns:
> +	 *
> +	 * True on success, false if a reliable scanout position counter could
> +	 * not be read out.
> +	 */
> +	bool (*get_scanout_position)(struct drm_crtc *crtc,
> +				     bool in_vblank_irq, int *vpos, int *hpos,
> +				     ktime_t *stime, ktime_t *etime,
> +				     const struct drm_display_mode *mode);
>  };
>  
>  /**

-- 
Jani Nikula, Intel Open Source Graphics Center

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [PATCH 01/23] drm: Add get_scanout_position() to struct drm_crtc_helper_funcs
@ 2020-01-10 10:24     ` Jani Nikula
  0 siblings, 0 replies; 217+ messages in thread
From: Jani Nikula @ 2020-01-10 10:24 UTC (permalink / raw)
  To: Thomas Zimmermann, airlied, daniel, alexander.deucher,
	christian.koenig, David1.Zhou, maarten.lankhorst,
	patrik.r.jakobsson, robdclark, sean, benjamin.gaignard,
	vincent.abriou, yannick.fertre, philippe.cornu, mcoquelin.stm32,
	alexandre.torgue, eric, rodrigosiqueiramelo, hamohammed.sa,
	linux-graphics-maintainer, thellstrom, bskeggs, harry.wentland,
	sunpeng.li, joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

On Fri, 10 Jan 2020, Thomas Zimmermann <tzimmermann@suse.de> wrote:
> The new callback get_scanout_position() reads the current location of
> the scanout process. The operation is currentyl located in struct
> drm_driver, but really belongs to the CRTC. Drivers will be converted
> in separate patches.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
>  drivers/gpu/drm/drm_vblank.c             | 24 ++++++++----
>  include/drm/drm_drv.h                    |  7 +---
>  include/drm/drm_modeset_helper_vtables.h | 47 ++++++++++++++++++++++++
>  3 files changed, 65 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
> index 1659b13b178c..c12f0b333e14 100644
> --- a/drivers/gpu/drm/drm_vblank.c
> +++ b/drivers/gpu/drm/drm_vblank.c
> @@ -30,6 +30,7 @@
>  #include <drm/drm_crtc.h>
>  #include <drm/drm_drv.h>
>  #include <drm/drm_framebuffer.h>
> +#include <drm/drm_modeset_helper_vtables.h>
>  #include <drm/drm_print.h>
>  #include <drm/drm_vblank.h>
>  
> @@ -590,7 +591,7 @@ EXPORT_SYMBOL(drm_calc_timestamping_constants);
>   * Implements calculation of exact vblank timestamps from given drm_display_mode
>   * timings and current video scanout position of a CRTC. This can be directly
>   * used as the &drm_driver.get_vblank_timestamp implementation of a kms driver
> - * if &drm_driver.get_scanout_position is implemented.
> + * if &drm_crtc_helper_funcs.get_scanout_position is implemented.
>   *
>   * The current implementation only handles standard video modes. For double scan
>   * and interlaced modes the driver is supposed to adjust the hardware mode
> @@ -632,8 +633,9 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
>  	}
>  
>  	/* Scanout position query not supported? Should not happen. */
> -	if (!dev->driver->get_scanout_position) {
> -		DRM_ERROR("Called from driver w/o get_scanout_position()!?\n");
> +	if (!dev->driver->get_scanout_position ||
> +	    !crtc->helper_private->get_scanout_position) {

ITYM s/||/&&/

BR,
Jani.


> +		DRM_ERROR("Called from CRTC w/o get_scanout_position()!?\n");
>  		return false;
>  	}
>  
> @@ -664,11 +666,17 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
>  		 * Get vertical and horizontal scanout position vpos, hpos,
>  		 * and bounding timestamps stime, etime, pre/post query.
>  		 */
> -		vbl_status = dev->driver->get_scanout_position(dev, pipe,
> -							       in_vblank_irq,
> -							       &vpos, &hpos,
> -							       &stime, &etime,
> -							       mode);
> +		if (crtc->helper_private->get_scanout_position) {
> +			vbl_status =
> +				crtc->helper_private->get_scanout_position(
> +					crtc, in_vblank_irq, &vpos, &hpos,
> +					&stime, &etime, mode);
> +		} else {
> +			vbl_status =
> +				dev->driver->get_scanout_position(
> +					dev, pipe, in_vblank_irq, &vpos,
> +					&hpos, &stime, &etime, mode);
> +		}
>  
>  		/* Return as no-op if scanout query unsupported or failed. */
>  		if (!vbl_status) {
> diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
> index cf13470810a5..d0049e5786fc 100644
> --- a/include/drm/drm_drv.h
> +++ b/include/drm/drm_drv.h
> @@ -362,11 +362,8 @@ struct drm_driver {
>  	 * True on success, false if a reliable scanout position counter could
>  	 * not be read out.
>  	 *
> -	 * FIXME:
> -	 *
> -	 * Since this is a helper to implement @get_vblank_timestamp, we should
> -	 * move it to &struct drm_crtc_helper_funcs, like all the other
> -	 * helper-internal hooks.
> +	 * This is deprecated and should not be used by new drivers.
> +	 * Use &drm_crtc_helper_funcs.get_scanout_position instead.
>  	 */
>  	bool (*get_scanout_position) (struct drm_device *dev, unsigned int pipe,
>  				      bool in_vblank_irq, int *vpos, int *hpos,
> diff --git a/include/drm/drm_modeset_helper_vtables.h b/include/drm/drm_modeset_helper_vtables.h
> index 5a87f1bd7a3f..e398512bfd5f 100644
> --- a/include/drm/drm_modeset_helper_vtables.h
> +++ b/include/drm/drm_modeset_helper_vtables.h
> @@ -450,6 +450,53 @@ struct drm_crtc_helper_funcs {
>  	 */
>  	void (*atomic_disable)(struct drm_crtc *crtc,
>  			       struct drm_crtc_state *old_crtc_state);
> +
> +	/**
> +	 * @get_scanout_position:
> +	 *
> +	 * Called by vblank timestamping code.
> +	 *
> +	 * Returns the current display scanout position from a CRTC and an
> +	 * optional accurate ktime_get() timestamp of when the position was
> +	 * measured. Note that this is a helper callback which is only used
> +	 * if a driver uses drm_calc_vbltimestamp_from_scanoutpos() for the
> +	 * @drm_driver.get_vblank_timestamp callback.
> +	 *
> +	 * Parameters:
> +	 *
> +	 * crtc:
> +	 *     The CRTC.
> +	 * in_vblank_irq:
> +	 *     True when called from drm_crtc_handle_vblank(). Some drivers
> +	 *     need to apply some workarounds for gpu-specific vblank irq
> +	 *     quirks if the flag is set.
> +	 * vpos:
> +	 *     Target location for current vertical scanout position.
> +	 * hpos:
> +	 *     Target location for current horizontal scanout position.
> +	 * stime:
> +	 *     Target location for timestamp taken immediately before
> +	 *     scanout position query. Can be NULL to skip timestamp.
> +	 * etime:
> +	 *     Target location for timestamp taken immediately after
> +	 *     scanout position query. Can be NULL to skip timestamp.
> +	 * mode:
> +	 *     Current display timings.
> +	 *
> +	 * Returns vpos as a positive number while in active scanout area.
> +	 * Returns vpos as a negative number inside vblank, counting the number
> +	 * of scanlines to go until end of vblank, e.g., -1 means "one scanline
> +	 * until start of active scanout / end of vblank."
> +	 *
> +	 * Returns:
> +	 *
> +	 * True on success, false if a reliable scanout position counter could
> +	 * not be read out.
> +	 */
> +	bool (*get_scanout_position)(struct drm_crtc *crtc,
> +				     bool in_vblank_irq, int *vpos, int *hpos,
> +				     ktime_t *stime, ktime_t *etime,
> +				     const struct drm_display_mode *mode);
>  };
>  
>  /**

-- 
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [Intel-gfx] [PATCH 01/23] drm: Add get_scanout_position() to struct drm_crtc_helper_funcs
@ 2020-01-10 10:24     ` Jani Nikula
  0 siblings, 0 replies; 217+ messages in thread
From: Jani Nikula @ 2020-01-10 10:24 UTC (permalink / raw)
  To: Thomas Zimmermann, airlied, daniel, alexander.deucher,
	christian.koenig, David1.Zhou, maarten.lankhorst,
	patrik.r.jakobsson, robdclark, sean, benjamin.gaignard,
	vincent.abriou, yannick.fertre, philippe.cornu, mcoquelin.stm32,
	alexandre.torgue, eric, rodrigosiqueiramelo, hamohammed.sa,
	linux-graphics-maintainer, thellstrom, bskeggs, harry.wentland,
	sunpeng.li, joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

On Fri, 10 Jan 2020, Thomas Zimmermann <tzimmermann@suse.de> wrote:
> The new callback get_scanout_position() reads the current location of
> the scanout process. The operation is currentyl located in struct
> drm_driver, but really belongs to the CRTC. Drivers will be converted
> in separate patches.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
>  drivers/gpu/drm/drm_vblank.c             | 24 ++++++++----
>  include/drm/drm_drv.h                    |  7 +---
>  include/drm/drm_modeset_helper_vtables.h | 47 ++++++++++++++++++++++++
>  3 files changed, 65 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
> index 1659b13b178c..c12f0b333e14 100644
> --- a/drivers/gpu/drm/drm_vblank.c
> +++ b/drivers/gpu/drm/drm_vblank.c
> @@ -30,6 +30,7 @@
>  #include <drm/drm_crtc.h>
>  #include <drm/drm_drv.h>
>  #include <drm/drm_framebuffer.h>
> +#include <drm/drm_modeset_helper_vtables.h>
>  #include <drm/drm_print.h>
>  #include <drm/drm_vblank.h>
>  
> @@ -590,7 +591,7 @@ EXPORT_SYMBOL(drm_calc_timestamping_constants);
>   * Implements calculation of exact vblank timestamps from given drm_display_mode
>   * timings and current video scanout position of a CRTC. This can be directly
>   * used as the &drm_driver.get_vblank_timestamp implementation of a kms driver
> - * if &drm_driver.get_scanout_position is implemented.
> + * if &drm_crtc_helper_funcs.get_scanout_position is implemented.
>   *
>   * The current implementation only handles standard video modes. For double scan
>   * and interlaced modes the driver is supposed to adjust the hardware mode
> @@ -632,8 +633,9 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
>  	}
>  
>  	/* Scanout position query not supported? Should not happen. */
> -	if (!dev->driver->get_scanout_position) {
> -		DRM_ERROR("Called from driver w/o get_scanout_position()!?\n");
> +	if (!dev->driver->get_scanout_position ||
> +	    !crtc->helper_private->get_scanout_position) {

ITYM s/||/&&/

BR,
Jani.


> +		DRM_ERROR("Called from CRTC w/o get_scanout_position()!?\n");
>  		return false;
>  	}
>  
> @@ -664,11 +666,17 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
>  		 * Get vertical and horizontal scanout position vpos, hpos,
>  		 * and bounding timestamps stime, etime, pre/post query.
>  		 */
> -		vbl_status = dev->driver->get_scanout_position(dev, pipe,
> -							       in_vblank_irq,
> -							       &vpos, &hpos,
> -							       &stime, &etime,
> -							       mode);
> +		if (crtc->helper_private->get_scanout_position) {
> +			vbl_status =
> +				crtc->helper_private->get_scanout_position(
> +					crtc, in_vblank_irq, &vpos, &hpos,
> +					&stime, &etime, mode);
> +		} else {
> +			vbl_status =
> +				dev->driver->get_scanout_position(
> +					dev, pipe, in_vblank_irq, &vpos,
> +					&hpos, &stime, &etime, mode);
> +		}
>  
>  		/* Return as no-op if scanout query unsupported or failed. */
>  		if (!vbl_status) {
> diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
> index cf13470810a5..d0049e5786fc 100644
> --- a/include/drm/drm_drv.h
> +++ b/include/drm/drm_drv.h
> @@ -362,11 +362,8 @@ struct drm_driver {
>  	 * True on success, false if a reliable scanout position counter could
>  	 * not be read out.
>  	 *
> -	 * FIXME:
> -	 *
> -	 * Since this is a helper to implement @get_vblank_timestamp, we should
> -	 * move it to &struct drm_crtc_helper_funcs, like all the other
> -	 * helper-internal hooks.
> +	 * This is deprecated and should not be used by new drivers.
> +	 * Use &drm_crtc_helper_funcs.get_scanout_position instead.
>  	 */
>  	bool (*get_scanout_position) (struct drm_device *dev, unsigned int pipe,
>  				      bool in_vblank_irq, int *vpos, int *hpos,
> diff --git a/include/drm/drm_modeset_helper_vtables.h b/include/drm/drm_modeset_helper_vtables.h
> index 5a87f1bd7a3f..e398512bfd5f 100644
> --- a/include/drm/drm_modeset_helper_vtables.h
> +++ b/include/drm/drm_modeset_helper_vtables.h
> @@ -450,6 +450,53 @@ struct drm_crtc_helper_funcs {
>  	 */
>  	void (*atomic_disable)(struct drm_crtc *crtc,
>  			       struct drm_crtc_state *old_crtc_state);
> +
> +	/**
> +	 * @get_scanout_position:
> +	 *
> +	 * Called by vblank timestamping code.
> +	 *
> +	 * Returns the current display scanout position from a CRTC and an
> +	 * optional accurate ktime_get() timestamp of when the position was
> +	 * measured. Note that this is a helper callback which is only used
> +	 * if a driver uses drm_calc_vbltimestamp_from_scanoutpos() for the
> +	 * @drm_driver.get_vblank_timestamp callback.
> +	 *
> +	 * Parameters:
> +	 *
> +	 * crtc:
> +	 *     The CRTC.
> +	 * in_vblank_irq:
> +	 *     True when called from drm_crtc_handle_vblank(). Some drivers
> +	 *     need to apply some workarounds for gpu-specific vblank irq
> +	 *     quirks if the flag is set.
> +	 * vpos:
> +	 *     Target location for current vertical scanout position.
> +	 * hpos:
> +	 *     Target location for current horizontal scanout position.
> +	 * stime:
> +	 *     Target location for timestamp taken immediately before
> +	 *     scanout position query. Can be NULL to skip timestamp.
> +	 * etime:
> +	 *     Target location for timestamp taken immediately after
> +	 *     scanout position query. Can be NULL to skip timestamp.
> +	 * mode:
> +	 *     Current display timings.
> +	 *
> +	 * Returns vpos as a positive number while in active scanout area.
> +	 * Returns vpos as a negative number inside vblank, counting the number
> +	 * of scanlines to go until end of vblank, e.g., -1 means "one scanline
> +	 * until start of active scanout / end of vblank."
> +	 *
> +	 * Returns:
> +	 *
> +	 * True on success, false if a reliable scanout position counter could
> +	 * not be read out.
> +	 */
> +	bool (*get_scanout_position)(struct drm_crtc *crtc,
> +				     bool in_vblank_irq, int *vpos, int *hpos,
> +				     ktime_t *stime, ktime_t *etime,
> +				     const struct drm_display_mode *mode);
>  };
>  
>  /**

-- 
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [PATCH 01/23] drm: Add get_scanout_position() to struct drm_crtc_helper_funcs
@ 2020-01-10 10:24     ` Jani Nikula
  0 siblings, 0 replies; 217+ messages in thread
From: Jani Nikula @ 2020-01-10 10:24 UTC (permalink / raw)
  To: Thomas Zimmermann, airlied, daniel, alexander.deucher,
	christian.koenig, David1.Zhou, maarten.lankhorst,
	patrik.r.jakobsson, robdclark, sean, benjamin.gaignard,
	vincent.abriou, yannick.fertre, philippe.cornu, mcoquelin.stm32,
	alexandre.torgue, eric, rodrigosiqueiramelo, hamohammed.sa,
	linux-graphics-maintainer, thellstrom, bskeggs, harry.wentland,
	sunpeng.li, joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

On Fri, 10 Jan 2020, Thomas Zimmermann <tzimmermann@suse.de> wrote:
> The new callback get_scanout_position() reads the current location of
> the scanout process. The operation is currentyl located in struct
> drm_driver, but really belongs to the CRTC. Drivers will be converted
> in separate patches.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
>  drivers/gpu/drm/drm_vblank.c             | 24 ++++++++----
>  include/drm/drm_drv.h                    |  7 +---
>  include/drm/drm_modeset_helper_vtables.h | 47 ++++++++++++++++++++++++
>  3 files changed, 65 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
> index 1659b13b178c..c12f0b333e14 100644
> --- a/drivers/gpu/drm/drm_vblank.c
> +++ b/drivers/gpu/drm/drm_vblank.c
> @@ -30,6 +30,7 @@
>  #include <drm/drm_crtc.h>
>  #include <drm/drm_drv.h>
>  #include <drm/drm_framebuffer.h>
> +#include <drm/drm_modeset_helper_vtables.h>
>  #include <drm/drm_print.h>
>  #include <drm/drm_vblank.h>
>  
> @@ -590,7 +591,7 @@ EXPORT_SYMBOL(drm_calc_timestamping_constants);
>   * Implements calculation of exact vblank timestamps from given drm_display_mode
>   * timings and current video scanout position of a CRTC. This can be directly
>   * used as the &drm_driver.get_vblank_timestamp implementation of a kms driver
> - * if &drm_driver.get_scanout_position is implemented.
> + * if &drm_crtc_helper_funcs.get_scanout_position is implemented.
>   *
>   * The current implementation only handles standard video modes. For double scan
>   * and interlaced modes the driver is supposed to adjust the hardware mode
> @@ -632,8 +633,9 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
>  	}
>  
>  	/* Scanout position query not supported? Should not happen. */
> -	if (!dev->driver->get_scanout_position) {
> -		DRM_ERROR("Called from driver w/o get_scanout_position()!?\n");
> +	if (!dev->driver->get_scanout_position ||
> +	    !crtc->helper_private->get_scanout_position) {

ITYM s/||/&&/

BR,
Jani.


> +		DRM_ERROR("Called from CRTC w/o get_scanout_position()!?\n");
>  		return false;
>  	}
>  
> @@ -664,11 +666,17 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
>  		 * Get vertical and horizontal scanout position vpos, hpos,
>  		 * and bounding timestamps stime, etime, pre/post query.
>  		 */
> -		vbl_status = dev->driver->get_scanout_position(dev, pipe,
> -							       in_vblank_irq,
> -							       &vpos, &hpos,
> -							       &stime, &etime,
> -							       mode);
> +		if (crtc->helper_private->get_scanout_position) {
> +			vbl_status =
> +				crtc->helper_private->get_scanout_position(
> +					crtc, in_vblank_irq, &vpos, &hpos,
> +					&stime, &etime, mode);
> +		} else {
> +			vbl_status =
> +				dev->driver->get_scanout_position(
> +					dev, pipe, in_vblank_irq, &vpos,
> +					&hpos, &stime, &etime, mode);
> +		}
>  
>  		/* Return as no-op if scanout query unsupported or failed. */
>  		if (!vbl_status) {
> diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
> index cf13470810a5..d0049e5786fc 100644
> --- a/include/drm/drm_drv.h
> +++ b/include/drm/drm_drv.h
> @@ -362,11 +362,8 @@ struct drm_driver {
>  	 * True on success, false if a reliable scanout position counter could
>  	 * not be read out.
>  	 *
> -	 * FIXME:
> -	 *
> -	 * Since this is a helper to implement @get_vblank_timestamp, we should
> -	 * move it to &struct drm_crtc_helper_funcs, like all the other
> -	 * helper-internal hooks.
> +	 * This is deprecated and should not be used by new drivers.
> +	 * Use &drm_crtc_helper_funcs.get_scanout_position instead.
>  	 */
>  	bool (*get_scanout_position) (struct drm_device *dev, unsigned int pipe,
>  				      bool in_vblank_irq, int *vpos, int *hpos,
> diff --git a/include/drm/drm_modeset_helper_vtables.h b/include/drm/drm_modeset_helper_vtables.h
> index 5a87f1bd7a3f..e398512bfd5f 100644
> --- a/include/drm/drm_modeset_helper_vtables.h
> +++ b/include/drm/drm_modeset_helper_vtables.h
> @@ -450,6 +450,53 @@ struct drm_crtc_helper_funcs {
>  	 */
>  	void (*atomic_disable)(struct drm_crtc *crtc,
>  			       struct drm_crtc_state *old_crtc_state);
> +
> +	/**
> +	 * @get_scanout_position:
> +	 *
> +	 * Called by vblank timestamping code.
> +	 *
> +	 * Returns the current display scanout position from a CRTC and an
> +	 * optional accurate ktime_get() timestamp of when the position was
> +	 * measured. Note that this is a helper callback which is only used
> +	 * if a driver uses drm_calc_vbltimestamp_from_scanoutpos() for the
> +	 * @drm_driver.get_vblank_timestamp callback.
> +	 *
> +	 * Parameters:
> +	 *
> +	 * crtc:
> +	 *     The CRTC.
> +	 * in_vblank_irq:
> +	 *     True when called from drm_crtc_handle_vblank(). Some drivers
> +	 *     need to apply some workarounds for gpu-specific vblank irq
> +	 *     quirks if the flag is set.
> +	 * vpos:
> +	 *     Target location for current vertical scanout position.
> +	 * hpos:
> +	 *     Target location for current horizontal scanout position.
> +	 * stime:
> +	 *     Target location for timestamp taken immediately before
> +	 *     scanout position query. Can be NULL to skip timestamp.
> +	 * etime:
> +	 *     Target location for timestamp taken immediately after
> +	 *     scanout position query. Can be NULL to skip timestamp.
> +	 * mode:
> +	 *     Current display timings.
> +	 *
> +	 * Returns vpos as a positive number while in active scanout area.
> +	 * Returns vpos as a negative number inside vblank, counting the number
> +	 * of scanlines to go until end of vblank, e.g., -1 means "one scanline
> +	 * until start of active scanout / end of vblank."
> +	 *
> +	 * Returns:
> +	 *
> +	 * True on success, false if a reliable scanout position counter could
> +	 * not be read out.
> +	 */
> +	bool (*get_scanout_position)(struct drm_crtc *crtc,
> +				     bool in_vblank_irq, int *vpos, int *hpos,
> +				     ktime_t *stime, ktime_t *etime,
> +				     const struct drm_display_mode *mode);
>  };
>  
>  /**

-- 
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [PATCH 03/23] drm/i915: Don't use struct drm_driver.get_scanout_position()
  2020-01-10  9:21   ` Thomas Zimmermann
                       ` (2 preceding siblings ...)
  (?)
@ 2020-01-10 11:59     ` Jani Nikula
  -1 siblings, 0 replies; 217+ messages in thread
From: Jani Nikula @ 2020-01-10 11:59 UTC (permalink / raw)
  To: Thomas Zimmermann, airlied, daniel, alexander.deucher,
	christian.koenig, David1.Zhou, maarten.lankhorst,
	patrik.r.jakobsson, robdclark, sean, benjamin.gaignard,
	vincent.abriou, yannick.fertre, philippe.cornu, mcoquelin.stm32,
	alexandre.torgue, eric, rodrigosiqueiramelo, hamohammed.sa,
	linux-graphics-maintainer, thellstrom, bskeggs, harry.wentland,
	sunpeng.li, joonas.lahtinen, rodrigo.vivi
  Cc: dri-devel, amd-gfx, intel-gfx, linux-arm-msm, freedreno, nouveau,
	Thomas Zimmermann

On Fri, 10 Jan 2020, Thomas Zimmermann <tzimmermann@suse.de> wrote:
> The callback struct drm_driver.get_scanout_position() is deprecated in
> favor of struct drm_crtc_helper_funcs.get_scanout_position().
>
> i915 doesn't use CRTC helpers. The patch duplicates the caller
> drm_calc_vbltimestamp_from_scanoutpos() for i915, such that the callback
> function is not needed.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
>  drivers/gpu/drm/i915/i915_drv.c |   3 +-
>  drivers/gpu/drm/i915/i915_irq.c | 117 ++++++++++++++++++++++++++++++--
>  drivers/gpu/drm/i915/i915_irq.h |   9 +--
>  3 files changed, 119 insertions(+), 10 deletions(-)

Not really enthusiastic about the diffstat in a "cleanup" series.

I wonder if you could add a generic helper version of
drm_calc_vbltimestamp_from_scanoutpos where you pass the
get_scanout_position function as a parameter. Both
drm_calc_vbltimestamp_from_scanoutpos and the new
i915_calc_vbltimestamp_from_scanoutpos would then be fairly thin
wrappers passing in the relevant get_scanout_position function.

This would reduce the almost identical duplication of the function in
i915.

BR,
Jani.

>
> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> index f7385abdd74b..4a0a7fb85c53 100644
> --- a/drivers/gpu/drm/i915/i915_drv.c
> +++ b/drivers/gpu/drm/i915/i915_drv.c
> @@ -2769,8 +2769,7 @@ static struct drm_driver driver = {
>  	.gem_prime_export = i915_gem_prime_export,
>  	.gem_prime_import = i915_gem_prime_import,
>  
> -	.get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
> -	.get_scanout_position = i915_get_crtc_scanoutpos,
> +	.get_vblank_timestamp = i915_calc_vbltimestamp_from_scanoutpos,
>  
>  	.dumb_create = i915_gem_dumb_create,
>  	.dumb_map_offset = i915_gem_dumb_mmap_offset,
> diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
> index afc6aad9bf8c..99d0c3b0feae 100644
> --- a/drivers/gpu/drm/i915/i915_irq.c
> +++ b/drivers/gpu/drm/i915/i915_irq.c
> @@ -52,6 +52,11 @@
>  #include "i915_trace.h"
>  #include "intel_pm.h"
>  
> +/* Retry timestamp calculation up to 3 times to satisfy
> + * drm_timestamp_precision before giving up.
> + */
> +#define I915_TIMESTAMP_MAXRETRIES 3
> +
>  /**
>   * DOC: interrupt handling
>   *
> @@ -762,10 +767,11 @@ static int __intel_get_crtc_scanline(struct intel_crtc *crtc)
>  	return (position + crtc->scanline_offset) % vtotal;
>  }
>  
> -bool i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int index,
> -			      bool in_vblank_irq, int *vpos, int *hpos,
> -			      ktime_t *stime, ktime_t *etime,
> -			      const struct drm_display_mode *mode)
> +static bool i915_get_crtc_scanoutpos(struct drm_device *dev,
> +				     unsigned int index, bool in_vblank_irq,
> +				     int *vpos, int *hpos,
> +				     ktime_t *stime, ktime_t *etime,
> +				     const struct drm_display_mode *mode)
>  {
>  	struct drm_i915_private *dev_priv = to_i915(dev);
>  	struct intel_crtc *crtc = to_intel_crtc(drm_crtc_from_index(dev, index));
> @@ -879,6 +885,109 @@ bool i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int index,
>  	return true;
>  }
>  
> +bool i915_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
> +					    unsigned int pipe,
> +					    int *max_error,
> +					    ktime_t *vblank_time,
> +					    bool in_vblank_irq)
> +{
> +	struct timespec64 ts_etime, ts_vblank_time;
> +	ktime_t stime, etime;
> +	bool vbl_status;
> +	struct drm_crtc *crtc;
> +	const struct drm_display_mode *mode;
> +	struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
> +	int vpos, hpos, i;
> +	int delta_ns, duration_ns;
> +
> +	crtc = drm_crtc_from_index(dev, pipe);
> +
> +	if (pipe >= dev->num_crtcs || !crtc) {
> +		DRM_ERROR("Invalid crtc %u\n", pipe);
> +		return false;
> +	}
> +
> +	if (drm_drv_uses_atomic_modeset(dev))
> +		mode = &vblank->hwmode;
> +	else
> +		mode = &crtc->hwmode;
> +
> +	/* If mode timing undefined, just return as no-op:
> +	 * Happens during initial modesetting of a crtc.
> +	 */
> +	if (mode->crtc_clock == 0) {
> +		DRM_DEBUG("crtc %u: Noop due to uninitialized mode.\n", pipe);
> +		WARN_ON_ONCE(drm_drv_uses_atomic_modeset(dev));
> +
> +		return false;
> +	}
> +
> +	/* Get current scanout position with system timestamp.
> +	 * Repeat query up to DRM_TIMESTAMP_MAXRETRIES times
> +	 * if single query takes longer than max_error nanoseconds.
> +	 *
> +	 * This guarantees a tight bound on maximum error if
> +	 * code gets preempted or delayed for some reason.
> +	 */
> +	for (i = 0; i < I915_TIMESTAMP_MAXRETRIES; i++) {
> +		/*
> +		 * Get vertical and horizontal scanout position vpos, hpos,
> +		 * and bounding timestamps stime, etime, pre/post query.
> +		 */
> +		vbl_status = i915_get_crtc_scanoutpos(dev, pipe, in_vblank_irq,
> +						      &vpos, &hpos, &stime,
> +						      &etime, mode);
> +		/* Return as no-op if scanout query unsupported or failed. */
> +		if (!vbl_status) {
> +			DRM_DEBUG("crtc %u : scanoutpos query failed.\n",
> +				  pipe);
> +			return false;
> +		}
> +
> +		/* Compute uncertainty in timestamp of scanout position query. */
> +		duration_ns = ktime_to_ns(etime) - ktime_to_ns(stime);
> +
> +		/* Accept result with <  max_error nsecs timing uncertainty. */
> +		if (duration_ns <= *max_error)
> +			break;
> +	}
> +
> +	/* Noisy system timing? */
> +	if (i == I915_TIMESTAMP_MAXRETRIES) {
> +		DRM_DEBUG("crtc %u: Noisy timestamp %d us > %d us [%d reps].\n",
> +			  pipe, duration_ns/1000, *max_error/1000, i);
> +	}
> +
> +	/* Return upper bound of timestamp precision error. */
> +	*max_error = duration_ns;
> +
> +	/* Convert scanout position into elapsed time at raw_time query
> +	 * since start of scanout at first display scanline. delta_ns
> +	 * can be negative if start of scanout hasn't happened yet.
> +	 */
> +	delta_ns = div_s64(1000000LL * (vpos * mode->crtc_htotal + hpos),
> +			   mode->crtc_clock);
> +
> +	/* Subtract time delta from raw timestamp to get final
> +	 * vblank_time timestamp for end of vblank.
> +	 */
> +	*vblank_time = ktime_sub_ns(etime, delta_ns);
> +
> +	if (!drm_debug_enabled(DRM_UT_VBL))
> +		return true;
> +
> +	ts_etime = ktime_to_timespec64(etime);
> +	ts_vblank_time = ktime_to_timespec64(*vblank_time);
> +
> +	DRM_DEBUG_VBL("crtc %u : v p(%d,%d)@ %lld.%06ld -> %lld.%06ld [e %d us, %d rep]\n",
> +		      pipe, hpos, vpos,
> +		      (u64)ts_etime.tv_sec, ts_etime.tv_nsec / 1000,
> +		      (u64)ts_vblank_time.tv_sec, ts_vblank_time.tv_nsec / 1000,
> +		      duration_ns / 1000, i);
> +
> +	return true;
> +}
> +
>  int intel_get_crtc_scanline(struct intel_crtc *crtc)
>  {
>  	struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
> diff --git a/drivers/gpu/drm/i915/i915_irq.h b/drivers/gpu/drm/i915/i915_irq.h
> index 812c47a9c2d6..5f7b133ce721 100644
> --- a/drivers/gpu/drm/i915/i915_irq.h
> +++ b/drivers/gpu/drm/i915/i915_irq.h
> @@ -101,10 +101,11 @@ void gen8_irq_power_well_post_enable(struct drm_i915_private *dev_priv,
>  void gen8_irq_power_well_pre_disable(struct drm_i915_private *dev_priv,
>  				     u8 pipe_mask);
>  
> -bool i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe,
> -			      bool in_vblank_irq, int *vpos, int *hpos,
> -			      ktime_t *stime, ktime_t *etime,
> -			      const struct drm_display_mode *mode);
> +bool i915_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
> +					    unsigned int pipe,
> +					    int *max_error,
> +					    ktime_t *vblank_time,
> +					    bool in_vblank_irq);
>  
>  u32 i915_get_vblank_counter(struct drm_crtc *crtc);
>  u32 g4x_get_vblank_counter(struct drm_crtc *crtc);

-- 
Jani Nikula, Intel Open Source Graphics Center

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [PATCH 03/23] drm/i915: Don't use struct drm_driver.get_scanout_position()
@ 2020-01-10 11:59     ` Jani Nikula
  0 siblings, 0 replies; 217+ messages in thread
From: Jani Nikula @ 2020-01-10 11:59 UTC (permalink / raw)
  To: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, joonas.lahtinen,
	rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

On Fri, 10 Jan 2020, Thomas Zimmermann <tzimmermann@suse.de> wrote:
> The callback struct drm_driver.get_scanout_position() is deprecated in
> favor of struct drm_crtc_helper_funcs.get_scanout_position().
>
> i915 doesn't use CRTC helpers. The patch duplicates the caller
> drm_calc_vbltimestamp_from_scanoutpos() for i915, such that the callback
> function is not needed.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
>  drivers/gpu/drm/i915/i915_drv.c |   3 +-
>  drivers/gpu/drm/i915/i915_irq.c | 117 ++++++++++++++++++++++++++++++--
>  drivers/gpu/drm/i915/i915_irq.h |   9 +--
>  3 files changed, 119 insertions(+), 10 deletions(-)

Not really enthusiastic about the diffstat in a "cleanup" series.

I wonder if you could add a generic helper version of
drm_calc_vbltimestamp_from_scanoutpos where you pass the
get_scanout_position function as a parameter. Both
drm_calc_vbltimestamp_from_scanoutpos and the new
i915_calc_vbltimestamp_from_scanoutpos would then be fairly thin
wrappers passing in the relevant get_scanout_position function.

This would reduce the almost identical duplication of the function in
i915.

BR,
Jani.

>
> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> index f7385abdd74b..4a0a7fb85c53 100644
> --- a/drivers/gpu/drm/i915/i915_drv.c
> +++ b/drivers/gpu/drm/i915/i915_drv.c
> @@ -2769,8 +2769,7 @@ static struct drm_driver driver = {
>  	.gem_prime_export = i915_gem_prime_export,
>  	.gem_prime_import = i915_gem_prime_import,
>  
> -	.get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
> -	.get_scanout_position = i915_get_crtc_scanoutpos,
> +	.get_vblank_timestamp = i915_calc_vbltimestamp_from_scanoutpos,
>  
>  	.dumb_create = i915_gem_dumb_create,
>  	.dumb_map_offset = i915_gem_dumb_mmap_offset,
> diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
> index afc6aad9bf8c..99d0c3b0feae 100644
> --- a/drivers/gpu/drm/i915/i915_irq.c
> +++ b/drivers/gpu/drm/i915/i915_irq.c
> @@ -52,6 +52,11 @@
>  #include "i915_trace.h"
>  #include "intel_pm.h"
>  
> +/* Retry timestamp calculation up to 3 times to satisfy
> + * drm_timestamp_precision before giving up.
> + */
> +#define I915_TIMESTAMP_MAXRETRIES 3
> +
>  /**
>   * DOC: interrupt handling
>   *
> @@ -762,10 +767,11 @@ static int __intel_get_crtc_scanline(struct intel_crtc *crtc)
>  	return (position + crtc->scanline_offset) % vtotal;
>  }
>  
> -bool i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int index,
> -			      bool in_vblank_irq, int *vpos, int *hpos,
> -			      ktime_t *stime, ktime_t *etime,
> -			      const struct drm_display_mode *mode)
> +static bool i915_get_crtc_scanoutpos(struct drm_device *dev,
> +				     unsigned int index, bool in_vblank_irq,
> +				     int *vpos, int *hpos,
> +				     ktime_t *stime, ktime_t *etime,
> +				     const struct drm_display_mode *mode)
>  {
>  	struct drm_i915_private *dev_priv = to_i915(dev);
>  	struct intel_crtc *crtc = to_intel_crtc(drm_crtc_from_index(dev, index));
> @@ -879,6 +885,109 @@ bool i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int index,
>  	return true;
>  }
>  
> +bool i915_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
> +					    unsigned int pipe,
> +					    int *max_error,
> +					    ktime_t *vblank_time,
> +					    bool in_vblank_irq)
> +{
> +	struct timespec64 ts_etime, ts_vblank_time;
> +	ktime_t stime, etime;
> +	bool vbl_status;
> +	struct drm_crtc *crtc;
> +	const struct drm_display_mode *mode;
> +	struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
> +	int vpos, hpos, i;
> +	int delta_ns, duration_ns;
> +
> +	crtc = drm_crtc_from_index(dev, pipe);
> +
> +	if (pipe >= dev->num_crtcs || !crtc) {
> +		DRM_ERROR("Invalid crtc %u\n", pipe);
> +		return false;
> +	}
> +
> +	if (drm_drv_uses_atomic_modeset(dev))
> +		mode = &vblank->hwmode;
> +	else
> +		mode = &crtc->hwmode;
> +
> +	/* If mode timing undefined, just return as no-op:
> +	 * Happens during initial modesetting of a crtc.
> +	 */
> +	if (mode->crtc_clock == 0) {
> +		DRM_DEBUG("crtc %u: Noop due to uninitialized mode.\n", pipe);
> +		WARN_ON_ONCE(drm_drv_uses_atomic_modeset(dev));
> +
> +		return false;
> +	}
> +
> +	/* Get current scanout position with system timestamp.
> +	 * Repeat query up to DRM_TIMESTAMP_MAXRETRIES times
> +	 * if single query takes longer than max_error nanoseconds.
> +	 *
> +	 * This guarantees a tight bound on maximum error if
> +	 * code gets preempted or delayed for some reason.
> +	 */
> +	for (i = 0; i < I915_TIMESTAMP_MAXRETRIES; i++) {
> +		/*
> +		 * Get vertical and horizontal scanout position vpos, hpos,
> +		 * and bounding timestamps stime, etime, pre/post query.
> +		 */
> +		vbl_status = i915_get_crtc_scanoutpos(dev, pipe, in_vblank_irq,
> +						      &vpos, &hpos, &stime,
> +						      &etime, mode);
> +		/* Return as no-op if scanout query unsupported or failed. */
> +		if (!vbl_status) {
> +			DRM_DEBUG("crtc %u : scanoutpos query failed.\n",
> +				  pipe);
> +			return false;
> +		}
> +
> +		/* Compute uncertainty in timestamp of scanout position query. */
> +		duration_ns = ktime_to_ns(etime) - ktime_to_ns(stime);
> +
> +		/* Accept result with <  max_error nsecs timing uncertainty. */
> +		if (duration_ns <= *max_error)
> +			break;
> +	}
> +
> +	/* Noisy system timing? */
> +	if (i == I915_TIMESTAMP_MAXRETRIES) {
> +		DRM_DEBUG("crtc %u: Noisy timestamp %d us > %d us [%d reps].\n",
> +			  pipe, duration_ns/1000, *max_error/1000, i);
> +	}
> +
> +	/* Return upper bound of timestamp precision error. */
> +	*max_error = duration_ns;
> +
> +	/* Convert scanout position into elapsed time at raw_time query
> +	 * since start of scanout at first display scanline. delta_ns
> +	 * can be negative if start of scanout hasn't happened yet.
> +	 */
> +	delta_ns = div_s64(1000000LL * (vpos * mode->crtc_htotal + hpos),
> +			   mode->crtc_clock);
> +
> +	/* Subtract time delta from raw timestamp to get final
> +	 * vblank_time timestamp for end of vblank.
> +	 */
> +	*vblank_time = ktime_sub_ns(etime, delta_ns);
> +
> +	if (!drm_debug_enabled(DRM_UT_VBL))
> +		return true;
> +
> +	ts_etime = ktime_to_timespec64(etime);
> +	ts_vblank_time = ktime_to_timespec64(*vblank_time);
> +
> +	DRM_DEBUG_VBL("crtc %u : v p(%d,%d)@ %lld.%06ld -> %lld.%06ld [e %d us, %d rep]\n",
> +		      pipe, hpos, vpos,
> +		      (u64)ts_etime.tv_sec, ts_etime.tv_nsec / 1000,
> +		      (u64)ts_vblank_time.tv_sec, ts_vblank_time.tv_nsec / 1000,
> +		      duration_ns / 1000, i);
> +
> +	return true;
> +}
> +
>  int intel_get_crtc_scanline(struct intel_crtc *crtc)
>  {
>  	struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
> diff --git a/drivers/gpu/drm/i915/i915_irq.h b/drivers/gpu/drm/i915/i915_irq.h
> index 812c47a9c2d6..5f7b133ce721 100644
> --- a/drivers/gpu/drm/i915/i915_irq.h
> +++ b/drivers/gpu/drm/i915/i915_irq.h
> @@ -101,10 +101,11 @@ void gen8_irq_power_well_post_enable(struct drm_i915_private *dev_priv,
>  void gen8_irq_power_well_pre_disable(struct drm_i915_private *dev_priv,
>  				     u8 pipe_mask);
>  
> -bool i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe,
> -			      bool in_vblank_irq, int *vpos, int *hpos,
> -			      ktime_t *stime, ktime_t *etime,
> -			      const struct drm_display_mode *mode);
> +bool i915_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
> +					    unsigned int pipe,
> +					    int *max_error,
> +					    ktime_t *vblank_time,
> +					    bool in_vblank_irq);
>  
>  u32 i915_get_vblank_counter(struct drm_crtc *crtc);
>  u32 g4x_get_vblank_counter(struct drm_crtc *crtc);

-- 
Jani Nikula, Intel Open Source Graphics Center

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [PATCH 03/23] drm/i915: Don't use struct drm_driver.get_scanout_position()
@ 2020-01-10 11:59     ` Jani Nikula
  0 siblings, 0 replies; 217+ messages in thread
From: Jani Nikula @ 2020-01-10 11:59 UTC (permalink / raw)
  To: Thomas Zimmermann, airlied, daniel, alexander.deucher,
	christian.koenig, David1.Zhou, maarten.lankhorst,
	patrik.r.jakobsson, robdclark, sean, benjamin.gaignard,
	vincent.abriou, yannick.fertre, philippe.cornu, mcoquelin.stm32,
	alexandre.torgue, eric, rodrigosiqueiramelo, hamohammed.sa,
	linux-graphics-maintainer, thellstrom, bskeggs, harry.wentland,
	sunpeng.li, joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

On Fri, 10 Jan 2020, Thomas Zimmermann <tzimmermann@suse.de> wrote:
> The callback struct drm_driver.get_scanout_position() is deprecated in
> favor of struct drm_crtc_helper_funcs.get_scanout_position().
>
> i915 doesn't use CRTC helpers. The patch duplicates the caller
> drm_calc_vbltimestamp_from_scanoutpos() for i915, such that the callback
> function is not needed.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
>  drivers/gpu/drm/i915/i915_drv.c |   3 +-
>  drivers/gpu/drm/i915/i915_irq.c | 117 ++++++++++++++++++++++++++++++--
>  drivers/gpu/drm/i915/i915_irq.h |   9 +--
>  3 files changed, 119 insertions(+), 10 deletions(-)

Not really enthusiastic about the diffstat in a "cleanup" series.

I wonder if you could add a generic helper version of
drm_calc_vbltimestamp_from_scanoutpos where you pass the
get_scanout_position function as a parameter. Both
drm_calc_vbltimestamp_from_scanoutpos and the new
i915_calc_vbltimestamp_from_scanoutpos would then be fairly thin
wrappers passing in the relevant get_scanout_position function.

This would reduce the almost identical duplication of the function in
i915.

BR,
Jani.

>
> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> index f7385abdd74b..4a0a7fb85c53 100644
> --- a/drivers/gpu/drm/i915/i915_drv.c
> +++ b/drivers/gpu/drm/i915/i915_drv.c
> @@ -2769,8 +2769,7 @@ static struct drm_driver driver = {
>  	.gem_prime_export = i915_gem_prime_export,
>  	.gem_prime_import = i915_gem_prime_import,
>  
> -	.get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
> -	.get_scanout_position = i915_get_crtc_scanoutpos,
> +	.get_vblank_timestamp = i915_calc_vbltimestamp_from_scanoutpos,
>  
>  	.dumb_create = i915_gem_dumb_create,
>  	.dumb_map_offset = i915_gem_dumb_mmap_offset,
> diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
> index afc6aad9bf8c..99d0c3b0feae 100644
> --- a/drivers/gpu/drm/i915/i915_irq.c
> +++ b/drivers/gpu/drm/i915/i915_irq.c
> @@ -52,6 +52,11 @@
>  #include "i915_trace.h"
>  #include "intel_pm.h"
>  
> +/* Retry timestamp calculation up to 3 times to satisfy
> + * drm_timestamp_precision before giving up.
> + */
> +#define I915_TIMESTAMP_MAXRETRIES 3
> +
>  /**
>   * DOC: interrupt handling
>   *
> @@ -762,10 +767,11 @@ static int __intel_get_crtc_scanline(struct intel_crtc *crtc)
>  	return (position + crtc->scanline_offset) % vtotal;
>  }
>  
> -bool i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int index,
> -			      bool in_vblank_irq, int *vpos, int *hpos,
> -			      ktime_t *stime, ktime_t *etime,
> -			      const struct drm_display_mode *mode)
> +static bool i915_get_crtc_scanoutpos(struct drm_device *dev,
> +				     unsigned int index, bool in_vblank_irq,
> +				     int *vpos, int *hpos,
> +				     ktime_t *stime, ktime_t *etime,
> +				     const struct drm_display_mode *mode)
>  {
>  	struct drm_i915_private *dev_priv = to_i915(dev);
>  	struct intel_crtc *crtc = to_intel_crtc(drm_crtc_from_index(dev, index));
> @@ -879,6 +885,109 @@ bool i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int index,
>  	return true;
>  }
>  
> +bool i915_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
> +					    unsigned int pipe,
> +					    int *max_error,
> +					    ktime_t *vblank_time,
> +					    bool in_vblank_irq)
> +{
> +	struct timespec64 ts_etime, ts_vblank_time;
> +	ktime_t stime, etime;
> +	bool vbl_status;
> +	struct drm_crtc *crtc;
> +	const struct drm_display_mode *mode;
> +	struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
> +	int vpos, hpos, i;
> +	int delta_ns, duration_ns;
> +
> +	crtc = drm_crtc_from_index(dev, pipe);
> +
> +	if (pipe >= dev->num_crtcs || !crtc) {
> +		DRM_ERROR("Invalid crtc %u\n", pipe);
> +		return false;
> +	}
> +
> +	if (drm_drv_uses_atomic_modeset(dev))
> +		mode = &vblank->hwmode;
> +	else
> +		mode = &crtc->hwmode;
> +
> +	/* If mode timing undefined, just return as no-op:
> +	 * Happens during initial modesetting of a crtc.
> +	 */
> +	if (mode->crtc_clock == 0) {
> +		DRM_DEBUG("crtc %u: Noop due to uninitialized mode.\n", pipe);
> +		WARN_ON_ONCE(drm_drv_uses_atomic_modeset(dev));
> +
> +		return false;
> +	}
> +
> +	/* Get current scanout position with system timestamp.
> +	 * Repeat query up to DRM_TIMESTAMP_MAXRETRIES times
> +	 * if single query takes longer than max_error nanoseconds.
> +	 *
> +	 * This guarantees a tight bound on maximum error if
> +	 * code gets preempted or delayed for some reason.
> +	 */
> +	for (i = 0; i < I915_TIMESTAMP_MAXRETRIES; i++) {
> +		/*
> +		 * Get vertical and horizontal scanout position vpos, hpos,
> +		 * and bounding timestamps stime, etime, pre/post query.
> +		 */
> +		vbl_status = i915_get_crtc_scanoutpos(dev, pipe, in_vblank_irq,
> +						      &vpos, &hpos, &stime,
> +						      &etime, mode);
> +		/* Return as no-op if scanout query unsupported or failed. */
> +		if (!vbl_status) {
> +			DRM_DEBUG("crtc %u : scanoutpos query failed.\n",
> +				  pipe);
> +			return false;
> +		}
> +
> +		/* Compute uncertainty in timestamp of scanout position query. */
> +		duration_ns = ktime_to_ns(etime) - ktime_to_ns(stime);
> +
> +		/* Accept result with <  max_error nsecs timing uncertainty. */
> +		if (duration_ns <= *max_error)
> +			break;
> +	}
> +
> +	/* Noisy system timing? */
> +	if (i == I915_TIMESTAMP_MAXRETRIES) {
> +		DRM_DEBUG("crtc %u: Noisy timestamp %d us > %d us [%d reps].\n",
> +			  pipe, duration_ns/1000, *max_error/1000, i);
> +	}
> +
> +	/* Return upper bound of timestamp precision error. */
> +	*max_error = duration_ns;
> +
> +	/* Convert scanout position into elapsed time at raw_time query
> +	 * since start of scanout at first display scanline. delta_ns
> +	 * can be negative if start of scanout hasn't happened yet.
> +	 */
> +	delta_ns = div_s64(1000000LL * (vpos * mode->crtc_htotal + hpos),
> +			   mode->crtc_clock);
> +
> +	/* Subtract time delta from raw timestamp to get final
> +	 * vblank_time timestamp for end of vblank.
> +	 */
> +	*vblank_time = ktime_sub_ns(etime, delta_ns);
> +
> +	if (!drm_debug_enabled(DRM_UT_VBL))
> +		return true;
> +
> +	ts_etime = ktime_to_timespec64(etime);
> +	ts_vblank_time = ktime_to_timespec64(*vblank_time);
> +
> +	DRM_DEBUG_VBL("crtc %u : v p(%d,%d)@ %lld.%06ld -> %lld.%06ld [e %d us, %d rep]\n",
> +		      pipe, hpos, vpos,
> +		      (u64)ts_etime.tv_sec, ts_etime.tv_nsec / 1000,
> +		      (u64)ts_vblank_time.tv_sec, ts_vblank_time.tv_nsec / 1000,
> +		      duration_ns / 1000, i);
> +
> +	return true;
> +}
> +
>  int intel_get_crtc_scanline(struct intel_crtc *crtc)
>  {
>  	struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
> diff --git a/drivers/gpu/drm/i915/i915_irq.h b/drivers/gpu/drm/i915/i915_irq.h
> index 812c47a9c2d6..5f7b133ce721 100644
> --- a/drivers/gpu/drm/i915/i915_irq.h
> +++ b/drivers/gpu/drm/i915/i915_irq.h
> @@ -101,10 +101,11 @@ void gen8_irq_power_well_post_enable(struct drm_i915_private *dev_priv,
>  void gen8_irq_power_well_pre_disable(struct drm_i915_private *dev_priv,
>  				     u8 pipe_mask);
>  
> -bool i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe,
> -			      bool in_vblank_irq, int *vpos, int *hpos,
> -			      ktime_t *stime, ktime_t *etime,
> -			      const struct drm_display_mode *mode);
> +bool i915_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
> +					    unsigned int pipe,
> +					    int *max_error,
> +					    ktime_t *vblank_time,
> +					    bool in_vblank_irq);
>  
>  u32 i915_get_vblank_counter(struct drm_crtc *crtc);
>  u32 g4x_get_vblank_counter(struct drm_crtc *crtc);

-- 
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [Intel-gfx] [PATCH 03/23] drm/i915: Don't use struct drm_driver.get_scanout_position()
@ 2020-01-10 11:59     ` Jani Nikula
  0 siblings, 0 replies; 217+ messages in thread
From: Jani Nikula @ 2020-01-10 11:59 UTC (permalink / raw)
  To: Thomas Zimmermann, airlied, daniel, alexander.deucher,
	christian.koenig, David1.Zhou, maarten.lankhorst,
	patrik.r.jakobsson, robdclark, sean, benjamin.gaignard,
	vincent.abriou, yannick.fertre, philippe.cornu, mcoquelin.stm32,
	alexandre.torgue, eric, rodrigosiqueiramelo, hamohammed.sa,
	linux-graphics-maintainer, thellstrom, bskeggs, harry.wentland,
	sunpeng.li, joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

On Fri, 10 Jan 2020, Thomas Zimmermann <tzimmermann@suse.de> wrote:
> The callback struct drm_driver.get_scanout_position() is deprecated in
> favor of struct drm_crtc_helper_funcs.get_scanout_position().
>
> i915 doesn't use CRTC helpers. The patch duplicates the caller
> drm_calc_vbltimestamp_from_scanoutpos() for i915, such that the callback
> function is not needed.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
>  drivers/gpu/drm/i915/i915_drv.c |   3 +-
>  drivers/gpu/drm/i915/i915_irq.c | 117 ++++++++++++++++++++++++++++++--
>  drivers/gpu/drm/i915/i915_irq.h |   9 +--
>  3 files changed, 119 insertions(+), 10 deletions(-)

Not really enthusiastic about the diffstat in a "cleanup" series.

I wonder if you could add a generic helper version of
drm_calc_vbltimestamp_from_scanoutpos where you pass the
get_scanout_position function as a parameter. Both
drm_calc_vbltimestamp_from_scanoutpos and the new
i915_calc_vbltimestamp_from_scanoutpos would then be fairly thin
wrappers passing in the relevant get_scanout_position function.

This would reduce the almost identical duplication of the function in
i915.

BR,
Jani.

>
> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> index f7385abdd74b..4a0a7fb85c53 100644
> --- a/drivers/gpu/drm/i915/i915_drv.c
> +++ b/drivers/gpu/drm/i915/i915_drv.c
> @@ -2769,8 +2769,7 @@ static struct drm_driver driver = {
>  	.gem_prime_export = i915_gem_prime_export,
>  	.gem_prime_import = i915_gem_prime_import,
>  
> -	.get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
> -	.get_scanout_position = i915_get_crtc_scanoutpos,
> +	.get_vblank_timestamp = i915_calc_vbltimestamp_from_scanoutpos,
>  
>  	.dumb_create = i915_gem_dumb_create,
>  	.dumb_map_offset = i915_gem_dumb_mmap_offset,
> diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
> index afc6aad9bf8c..99d0c3b0feae 100644
> --- a/drivers/gpu/drm/i915/i915_irq.c
> +++ b/drivers/gpu/drm/i915/i915_irq.c
> @@ -52,6 +52,11 @@
>  #include "i915_trace.h"
>  #include "intel_pm.h"
>  
> +/* Retry timestamp calculation up to 3 times to satisfy
> + * drm_timestamp_precision before giving up.
> + */
> +#define I915_TIMESTAMP_MAXRETRIES 3
> +
>  /**
>   * DOC: interrupt handling
>   *
> @@ -762,10 +767,11 @@ static int __intel_get_crtc_scanline(struct intel_crtc *crtc)
>  	return (position + crtc->scanline_offset) % vtotal;
>  }
>  
> -bool i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int index,
> -			      bool in_vblank_irq, int *vpos, int *hpos,
> -			      ktime_t *stime, ktime_t *etime,
> -			      const struct drm_display_mode *mode)
> +static bool i915_get_crtc_scanoutpos(struct drm_device *dev,
> +				     unsigned int index, bool in_vblank_irq,
> +				     int *vpos, int *hpos,
> +				     ktime_t *stime, ktime_t *etime,
> +				     const struct drm_display_mode *mode)
>  {
>  	struct drm_i915_private *dev_priv = to_i915(dev);
>  	struct intel_crtc *crtc = to_intel_crtc(drm_crtc_from_index(dev, index));
> @@ -879,6 +885,109 @@ bool i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int index,
>  	return true;
>  }
>  
> +bool i915_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
> +					    unsigned int pipe,
> +					    int *max_error,
> +					    ktime_t *vblank_time,
> +					    bool in_vblank_irq)
> +{
> +	struct timespec64 ts_etime, ts_vblank_time;
> +	ktime_t stime, etime;
> +	bool vbl_status;
> +	struct drm_crtc *crtc;
> +	const struct drm_display_mode *mode;
> +	struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
> +	int vpos, hpos, i;
> +	int delta_ns, duration_ns;
> +
> +	crtc = drm_crtc_from_index(dev, pipe);
> +
> +	if (pipe >= dev->num_crtcs || !crtc) {
> +		DRM_ERROR("Invalid crtc %u\n", pipe);
> +		return false;
> +	}
> +
> +	if (drm_drv_uses_atomic_modeset(dev))
> +		mode = &vblank->hwmode;
> +	else
> +		mode = &crtc->hwmode;
> +
> +	/* If mode timing undefined, just return as no-op:
> +	 * Happens during initial modesetting of a crtc.
> +	 */
> +	if (mode->crtc_clock == 0) {
> +		DRM_DEBUG("crtc %u: Noop due to uninitialized mode.\n", pipe);
> +		WARN_ON_ONCE(drm_drv_uses_atomic_modeset(dev));
> +
> +		return false;
> +	}
> +
> +	/* Get current scanout position with system timestamp.
> +	 * Repeat query up to DRM_TIMESTAMP_MAXRETRIES times
> +	 * if single query takes longer than max_error nanoseconds.
> +	 *
> +	 * This guarantees a tight bound on maximum error if
> +	 * code gets preempted or delayed for some reason.
> +	 */
> +	for (i = 0; i < I915_TIMESTAMP_MAXRETRIES; i++) {
> +		/*
> +		 * Get vertical and horizontal scanout position vpos, hpos,
> +		 * and bounding timestamps stime, etime, pre/post query.
> +		 */
> +		vbl_status = i915_get_crtc_scanoutpos(dev, pipe, in_vblank_irq,
> +						      &vpos, &hpos, &stime,
> +						      &etime, mode);
> +		/* Return as no-op if scanout query unsupported or failed. */
> +		if (!vbl_status) {
> +			DRM_DEBUG("crtc %u : scanoutpos query failed.\n",
> +				  pipe);
> +			return false;
> +		}
> +
> +		/* Compute uncertainty in timestamp of scanout position query. */
> +		duration_ns = ktime_to_ns(etime) - ktime_to_ns(stime);
> +
> +		/* Accept result with <  max_error nsecs timing uncertainty. */
> +		if (duration_ns <= *max_error)
> +			break;
> +	}
> +
> +	/* Noisy system timing? */
> +	if (i == I915_TIMESTAMP_MAXRETRIES) {
> +		DRM_DEBUG("crtc %u: Noisy timestamp %d us > %d us [%d reps].\n",
> +			  pipe, duration_ns/1000, *max_error/1000, i);
> +	}
> +
> +	/* Return upper bound of timestamp precision error. */
> +	*max_error = duration_ns;
> +
> +	/* Convert scanout position into elapsed time at raw_time query
> +	 * since start of scanout at first display scanline. delta_ns
> +	 * can be negative if start of scanout hasn't happened yet.
> +	 */
> +	delta_ns = div_s64(1000000LL * (vpos * mode->crtc_htotal + hpos),
> +			   mode->crtc_clock);
> +
> +	/* Subtract time delta from raw timestamp to get final
> +	 * vblank_time timestamp for end of vblank.
> +	 */
> +	*vblank_time = ktime_sub_ns(etime, delta_ns);
> +
> +	if (!drm_debug_enabled(DRM_UT_VBL))
> +		return true;
> +
> +	ts_etime = ktime_to_timespec64(etime);
> +	ts_vblank_time = ktime_to_timespec64(*vblank_time);
> +
> +	DRM_DEBUG_VBL("crtc %u : v p(%d,%d)@ %lld.%06ld -> %lld.%06ld [e %d us, %d rep]\n",
> +		      pipe, hpos, vpos,
> +		      (u64)ts_etime.tv_sec, ts_etime.tv_nsec / 1000,
> +		      (u64)ts_vblank_time.tv_sec, ts_vblank_time.tv_nsec / 1000,
> +		      duration_ns / 1000, i);
> +
> +	return true;
> +}
> +
>  int intel_get_crtc_scanline(struct intel_crtc *crtc)
>  {
>  	struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
> diff --git a/drivers/gpu/drm/i915/i915_irq.h b/drivers/gpu/drm/i915/i915_irq.h
> index 812c47a9c2d6..5f7b133ce721 100644
> --- a/drivers/gpu/drm/i915/i915_irq.h
> +++ b/drivers/gpu/drm/i915/i915_irq.h
> @@ -101,10 +101,11 @@ void gen8_irq_power_well_post_enable(struct drm_i915_private *dev_priv,
>  void gen8_irq_power_well_pre_disable(struct drm_i915_private *dev_priv,
>  				     u8 pipe_mask);
>  
> -bool i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe,
> -			      bool in_vblank_irq, int *vpos, int *hpos,
> -			      ktime_t *stime, ktime_t *etime,
> -			      const struct drm_display_mode *mode);
> +bool i915_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
> +					    unsigned int pipe,
> +					    int *max_error,
> +					    ktime_t *vblank_time,
> +					    bool in_vblank_irq);
>  
>  u32 i915_get_vblank_counter(struct drm_crtc *crtc);
>  u32 g4x_get_vblank_counter(struct drm_crtc *crtc);

-- 
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [PATCH 03/23] drm/i915: Don't use struct drm_driver.get_scanout_position()
@ 2020-01-10 11:59     ` Jani Nikula
  0 siblings, 0 replies; 217+ messages in thread
From: Jani Nikula @ 2020-01-10 11:59 UTC (permalink / raw)
  To: Thomas Zimmermann, airlied, daniel, alexander.deucher,
	christian.koenig, David1.Zhou, maarten.lankhorst,
	patrik.r.jakobsson, robdclark, sean, benjamin.gaignard,
	vincent.abriou, yannick.fertre, philippe.cornu, mcoquelin.stm32,
	alexandre.torgue, eric, rodrigosiqueiramelo, hamohammed.sa,
	linux-graphics-maintainer, thellstrom, bskeggs, harry.wentland,
	sunpeng.li, joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, Thomas Zimmermann,
	nouveau, freedreno

On Fri, 10 Jan 2020, Thomas Zimmermann <tzimmermann@suse.de> wrote:
> The callback struct drm_driver.get_scanout_position() is deprecated in
> favor of struct drm_crtc_helper_funcs.get_scanout_position().
>
> i915 doesn't use CRTC helpers. The patch duplicates the caller
> drm_calc_vbltimestamp_from_scanoutpos() for i915, such that the callback
> function is not needed.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
>  drivers/gpu/drm/i915/i915_drv.c |   3 +-
>  drivers/gpu/drm/i915/i915_irq.c | 117 ++++++++++++++++++++++++++++++--
>  drivers/gpu/drm/i915/i915_irq.h |   9 +--
>  3 files changed, 119 insertions(+), 10 deletions(-)

Not really enthusiastic about the diffstat in a "cleanup" series.

I wonder if you could add a generic helper version of
drm_calc_vbltimestamp_from_scanoutpos where you pass the
get_scanout_position function as a parameter. Both
drm_calc_vbltimestamp_from_scanoutpos and the new
i915_calc_vbltimestamp_from_scanoutpos would then be fairly thin
wrappers passing in the relevant get_scanout_position function.

This would reduce the almost identical duplication of the function in
i915.

BR,
Jani.

>
> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> index f7385abdd74b..4a0a7fb85c53 100644
> --- a/drivers/gpu/drm/i915/i915_drv.c
> +++ b/drivers/gpu/drm/i915/i915_drv.c
> @@ -2769,8 +2769,7 @@ static struct drm_driver driver = {
>  	.gem_prime_export = i915_gem_prime_export,
>  	.gem_prime_import = i915_gem_prime_import,
>  
> -	.get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
> -	.get_scanout_position = i915_get_crtc_scanoutpos,
> +	.get_vblank_timestamp = i915_calc_vbltimestamp_from_scanoutpos,
>  
>  	.dumb_create = i915_gem_dumb_create,
>  	.dumb_map_offset = i915_gem_dumb_mmap_offset,
> diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
> index afc6aad9bf8c..99d0c3b0feae 100644
> --- a/drivers/gpu/drm/i915/i915_irq.c
> +++ b/drivers/gpu/drm/i915/i915_irq.c
> @@ -52,6 +52,11 @@
>  #include "i915_trace.h"
>  #include "intel_pm.h"
>  
> +/* Retry timestamp calculation up to 3 times to satisfy
> + * drm_timestamp_precision before giving up.
> + */
> +#define I915_TIMESTAMP_MAXRETRIES 3
> +
>  /**
>   * DOC: interrupt handling
>   *
> @@ -762,10 +767,11 @@ static int __intel_get_crtc_scanline(struct intel_crtc *crtc)
>  	return (position + crtc->scanline_offset) % vtotal;
>  }
>  
> -bool i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int index,
> -			      bool in_vblank_irq, int *vpos, int *hpos,
> -			      ktime_t *stime, ktime_t *etime,
> -			      const struct drm_display_mode *mode)
> +static bool i915_get_crtc_scanoutpos(struct drm_device *dev,
> +				     unsigned int index, bool in_vblank_irq,
> +				     int *vpos, int *hpos,
> +				     ktime_t *stime, ktime_t *etime,
> +				     const struct drm_display_mode *mode)
>  {
>  	struct drm_i915_private *dev_priv = to_i915(dev);
>  	struct intel_crtc *crtc = to_intel_crtc(drm_crtc_from_index(dev, index));
> @@ -879,6 +885,109 @@ bool i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int index,
>  	return true;
>  }
>  
> +bool i915_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
> +					    unsigned int pipe,
> +					    int *max_error,
> +					    ktime_t *vblank_time,
> +					    bool in_vblank_irq)
> +{
> +	struct timespec64 ts_etime, ts_vblank_time;
> +	ktime_t stime, etime;
> +	bool vbl_status;
> +	struct drm_crtc *crtc;
> +	const struct drm_display_mode *mode;
> +	struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
> +	int vpos, hpos, i;
> +	int delta_ns, duration_ns;
> +
> +	crtc = drm_crtc_from_index(dev, pipe);
> +
> +	if (pipe >= dev->num_crtcs || !crtc) {
> +		DRM_ERROR("Invalid crtc %u\n", pipe);
> +		return false;
> +	}
> +
> +	if (drm_drv_uses_atomic_modeset(dev))
> +		mode = &vblank->hwmode;
> +	else
> +		mode = &crtc->hwmode;
> +
> +	/* If mode timing undefined, just return as no-op:
> +	 * Happens during initial modesetting of a crtc.
> +	 */
> +	if (mode->crtc_clock == 0) {
> +		DRM_DEBUG("crtc %u: Noop due to uninitialized mode.\n", pipe);
> +		WARN_ON_ONCE(drm_drv_uses_atomic_modeset(dev));
> +
> +		return false;
> +	}
> +
> +	/* Get current scanout position with system timestamp.
> +	 * Repeat query up to DRM_TIMESTAMP_MAXRETRIES times
> +	 * if single query takes longer than max_error nanoseconds.
> +	 *
> +	 * This guarantees a tight bound on maximum error if
> +	 * code gets preempted or delayed for some reason.
> +	 */
> +	for (i = 0; i < I915_TIMESTAMP_MAXRETRIES; i++) {
> +		/*
> +		 * Get vertical and horizontal scanout position vpos, hpos,
> +		 * and bounding timestamps stime, etime, pre/post query.
> +		 */
> +		vbl_status = i915_get_crtc_scanoutpos(dev, pipe, in_vblank_irq,
> +						      &vpos, &hpos, &stime,
> +						      &etime, mode);
> +		/* Return as no-op if scanout query unsupported or failed. */
> +		if (!vbl_status) {
> +			DRM_DEBUG("crtc %u : scanoutpos query failed.\n",
> +				  pipe);
> +			return false;
> +		}
> +
> +		/* Compute uncertainty in timestamp of scanout position query. */
> +		duration_ns = ktime_to_ns(etime) - ktime_to_ns(stime);
> +
> +		/* Accept result with <  max_error nsecs timing uncertainty. */
> +		if (duration_ns <= *max_error)
> +			break;
> +	}
> +
> +	/* Noisy system timing? */
> +	if (i == I915_TIMESTAMP_MAXRETRIES) {
> +		DRM_DEBUG("crtc %u: Noisy timestamp %d us > %d us [%d reps].\n",
> +			  pipe, duration_ns/1000, *max_error/1000, i);
> +	}
> +
> +	/* Return upper bound of timestamp precision error. */
> +	*max_error = duration_ns;
> +
> +	/* Convert scanout position into elapsed time at raw_time query
> +	 * since start of scanout at first display scanline. delta_ns
> +	 * can be negative if start of scanout hasn't happened yet.
> +	 */
> +	delta_ns = div_s64(1000000LL * (vpos * mode->crtc_htotal + hpos),
> +			   mode->crtc_clock);
> +
> +	/* Subtract time delta from raw timestamp to get final
> +	 * vblank_time timestamp for end of vblank.
> +	 */
> +	*vblank_time = ktime_sub_ns(etime, delta_ns);
> +
> +	if (!drm_debug_enabled(DRM_UT_VBL))
> +		return true;
> +
> +	ts_etime = ktime_to_timespec64(etime);
> +	ts_vblank_time = ktime_to_timespec64(*vblank_time);
> +
> +	DRM_DEBUG_VBL("crtc %u : v p(%d,%d)@ %lld.%06ld -> %lld.%06ld [e %d us, %d rep]\n",
> +		      pipe, hpos, vpos,
> +		      (u64)ts_etime.tv_sec, ts_etime.tv_nsec / 1000,
> +		      (u64)ts_vblank_time.tv_sec, ts_vblank_time.tv_nsec / 1000,
> +		      duration_ns / 1000, i);
> +
> +	return true;
> +}
> +
>  int intel_get_crtc_scanline(struct intel_crtc *crtc)
>  {
>  	struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
> diff --git a/drivers/gpu/drm/i915/i915_irq.h b/drivers/gpu/drm/i915/i915_irq.h
> index 812c47a9c2d6..5f7b133ce721 100644
> --- a/drivers/gpu/drm/i915/i915_irq.h
> +++ b/drivers/gpu/drm/i915/i915_irq.h
> @@ -101,10 +101,11 @@ void gen8_irq_power_well_post_enable(struct drm_i915_private *dev_priv,
>  void gen8_irq_power_well_pre_disable(struct drm_i915_private *dev_priv,
>  				     u8 pipe_mask);
>  
> -bool i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe,
> -			      bool in_vblank_irq, int *vpos, int *hpos,
> -			      ktime_t *stime, ktime_t *etime,
> -			      const struct drm_display_mode *mode);
> +bool i915_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
> +					    unsigned int pipe,
> +					    int *max_error,
> +					    ktime_t *vblank_time,
> +					    bool in_vblank_irq);
>  
>  u32 i915_get_vblank_counter(struct drm_crtc *crtc);
>  u32 g4x_get_vblank_counter(struct drm_crtc *crtc);

-- 
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [PATCH 03/23] drm/i915: Don't use struct drm_driver.get_scanout_position()
  2020-01-10 11:59     ` Jani Nikula
                         ` (2 preceding siblings ...)
  (?)
@ 2020-01-10 12:04       ` Thomas Zimmermann
  -1 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10 12:04 UTC (permalink / raw)
  To: Jani Nikula, airlied, daniel, alexander.deucher,
	christian.koenig, David1.Zhou, maarten.lankhorst,
	patrik.r.jakobsson, robdclark, sean, benjamin.gaignard,
	vincent.abriou, yannick.fertre, philippe.cornu, mcoquelin.stm32,
	alexandre.torgue, eric, rodrigosiqueiramelo, hamohammed.sa,
	linux-graphics-maintainer, thellstrom, bskeggs, harry.wentland,
	sunpeng.li, joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, nouveau, freedreno


[-- Attachment #1.1: Type: text/plain, Size: 8443 bytes --]

Hi

Am 10.01.20 um 12:59 schrieb Jani Nikula:
> On Fri, 10 Jan 2020, Thomas Zimmermann <tzimmermann@suse.de> wrote:
>> The callback struct drm_driver.get_scanout_position() is deprecated in
>> favor of struct drm_crtc_helper_funcs.get_scanout_position().
>>
>> i915 doesn't use CRTC helpers. The patch duplicates the caller
>> drm_calc_vbltimestamp_from_scanoutpos() for i915, such that the callback
>> function is not needed.
>>
>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>> ---
>>  drivers/gpu/drm/i915/i915_drv.c |   3 +-
>>  drivers/gpu/drm/i915/i915_irq.c | 117 ++++++++++++++++++++++++++++++--
>>  drivers/gpu/drm/i915/i915_irq.h |   9 +--
>>  3 files changed, 119 insertions(+), 10 deletions(-)
> 
> Not really enthusiastic about the diffstat in a "cleanup" series.

Well, the cleanup is about the content of drm_driver :)

> 
> I wonder if you could add a generic helper version of
> drm_calc_vbltimestamp_from_scanoutpos where you pass the
> get_scanout_position function as a parameter. Both
> drm_calc_vbltimestamp_from_scanoutpos and the new
> i915_calc_vbltimestamp_from_scanoutpos would then be fairly thin
> wrappers passing in the relevant get_scanout_position function.

Of course. Will be in v2 of the series.

Best regards
Thomas

> 
> This would reduce the almost identical duplication of the function in
> i915.
> 
> BR,
> Jani.
> 
>>
>> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
>> index f7385abdd74b..4a0a7fb85c53 100644
>> --- a/drivers/gpu/drm/i915/i915_drv.c
>> +++ b/drivers/gpu/drm/i915/i915_drv.c
>> @@ -2769,8 +2769,7 @@ static struct drm_driver driver = {
>>  	.gem_prime_export = i915_gem_prime_export,
>>  	.gem_prime_import = i915_gem_prime_import,
>>  
>> -	.get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
>> -	.get_scanout_position = i915_get_crtc_scanoutpos,
>> +	.get_vblank_timestamp = i915_calc_vbltimestamp_from_scanoutpos,
>>  
>>  	.dumb_create = i915_gem_dumb_create,
>>  	.dumb_map_offset = i915_gem_dumb_mmap_offset,
>> diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
>> index afc6aad9bf8c..99d0c3b0feae 100644
>> --- a/drivers/gpu/drm/i915/i915_irq.c
>> +++ b/drivers/gpu/drm/i915/i915_irq.c
>> @@ -52,6 +52,11 @@
>>  #include "i915_trace.h"
>>  #include "intel_pm.h"
>>  
>> +/* Retry timestamp calculation up to 3 times to satisfy
>> + * drm_timestamp_precision before giving up.
>> + */
>> +#define I915_TIMESTAMP_MAXRETRIES 3
>> +
>>  /**
>>   * DOC: interrupt handling
>>   *
>> @@ -762,10 +767,11 @@ static int __intel_get_crtc_scanline(struct intel_crtc *crtc)
>>  	return (position + crtc->scanline_offset) % vtotal;
>>  }
>>  
>> -bool i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int index,
>> -			      bool in_vblank_irq, int *vpos, int *hpos,
>> -			      ktime_t *stime, ktime_t *etime,
>> -			      const struct drm_display_mode *mode)
>> +static bool i915_get_crtc_scanoutpos(struct drm_device *dev,
>> +				     unsigned int index, bool in_vblank_irq,
>> +				     int *vpos, int *hpos,
>> +				     ktime_t *stime, ktime_t *etime,
>> +				     const struct drm_display_mode *mode)
>>  {
>>  	struct drm_i915_private *dev_priv = to_i915(dev);
>>  	struct intel_crtc *crtc = to_intel_crtc(drm_crtc_from_index(dev, index));
>> @@ -879,6 +885,109 @@ bool i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int index,
>>  	return true;
>>  }
>>  
>> +bool i915_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
>> +					    unsigned int pipe,
>> +					    int *max_error,
>> +					    ktime_t *vblank_time,
>> +					    bool in_vblank_irq)
>> +{
>> +	struct timespec64 ts_etime, ts_vblank_time;
>> +	ktime_t stime, etime;
>> +	bool vbl_status;
>> +	struct drm_crtc *crtc;
>> +	const struct drm_display_mode *mode;
>> +	struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
>> +	int vpos, hpos, i;
>> +	int delta_ns, duration_ns;
>> +
>> +	crtc = drm_crtc_from_index(dev, pipe);
>> +
>> +	if (pipe >= dev->num_crtcs || !crtc) {
>> +		DRM_ERROR("Invalid crtc %u\n", pipe);
>> +		return false;
>> +	}
>> +
>> +	if (drm_drv_uses_atomic_modeset(dev))
>> +		mode = &vblank->hwmode;
>> +	else
>> +		mode = &crtc->hwmode;
>> +
>> +	/* If mode timing undefined, just return as no-op:
>> +	 * Happens during initial modesetting of a crtc.
>> +	 */
>> +	if (mode->crtc_clock == 0) {
>> +		DRM_DEBUG("crtc %u: Noop due to uninitialized mode.\n", pipe);
>> +		WARN_ON_ONCE(drm_drv_uses_atomic_modeset(dev));
>> +
>> +		return false;
>> +	}
>> +
>> +	/* Get current scanout position with system timestamp.
>> +	 * Repeat query up to DRM_TIMESTAMP_MAXRETRIES times
>> +	 * if single query takes longer than max_error nanoseconds.
>> +	 *
>> +	 * This guarantees a tight bound on maximum error if
>> +	 * code gets preempted or delayed for some reason.
>> +	 */
>> +	for (i = 0; i < I915_TIMESTAMP_MAXRETRIES; i++) {
>> +		/*
>> +		 * Get vertical and horizontal scanout position vpos, hpos,
>> +		 * and bounding timestamps stime, etime, pre/post query.
>> +		 */
>> +		vbl_status = i915_get_crtc_scanoutpos(dev, pipe, in_vblank_irq,
>> +						      &vpos, &hpos, &stime,
>> +						      &etime, mode);
>> +		/* Return as no-op if scanout query unsupported or failed. */
>> +		if (!vbl_status) {
>> +			DRM_DEBUG("crtc %u : scanoutpos query failed.\n",
>> +				  pipe);
>> +			return false;
>> +		}
>> +
>> +		/* Compute uncertainty in timestamp of scanout position query. */
>> +		duration_ns = ktime_to_ns(etime) - ktime_to_ns(stime);
>> +
>> +		/* Accept result with <  max_error nsecs timing uncertainty. */
>> +		if (duration_ns <= *max_error)
>> +			break;
>> +	}
>> +
>> +	/* Noisy system timing? */
>> +	if (i == I915_TIMESTAMP_MAXRETRIES) {
>> +		DRM_DEBUG("crtc %u: Noisy timestamp %d us > %d us [%d reps].\n",
>> +			  pipe, duration_ns/1000, *max_error/1000, i);
>> +	}
>> +
>> +	/* Return upper bound of timestamp precision error. */
>> +	*max_error = duration_ns;
>> +
>> +	/* Convert scanout position into elapsed time at raw_time query
>> +	 * since start of scanout at first display scanline. delta_ns
>> +	 * can be negative if start of scanout hasn't happened yet.
>> +	 */
>> +	delta_ns = div_s64(1000000LL * (vpos * mode->crtc_htotal + hpos),
>> +			   mode->crtc_clock);
>> +
>> +	/* Subtract time delta from raw timestamp to get final
>> +	 * vblank_time timestamp for end of vblank.
>> +	 */
>> +	*vblank_time = ktime_sub_ns(etime, delta_ns);
>> +
>> +	if (!drm_debug_enabled(DRM_UT_VBL))
>> +		return true;
>> +
>> +	ts_etime = ktime_to_timespec64(etime);
>> +	ts_vblank_time = ktime_to_timespec64(*vblank_time);
>> +
>> +	DRM_DEBUG_VBL("crtc %u : v p(%d,%d)@ %lld.%06ld -> %lld.%06ld [e %d us, %d rep]\n",
>> +		      pipe, hpos, vpos,
>> +		      (u64)ts_etime.tv_sec, ts_etime.tv_nsec / 1000,
>> +		      (u64)ts_vblank_time.tv_sec, ts_vblank_time.tv_nsec / 1000,
>> +		      duration_ns / 1000, i);
>> +
>> +	return true;
>> +}
>> +
>>  int intel_get_crtc_scanline(struct intel_crtc *crtc)
>>  {
>>  	struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
>> diff --git a/drivers/gpu/drm/i915/i915_irq.h b/drivers/gpu/drm/i915/i915_irq.h
>> index 812c47a9c2d6..5f7b133ce721 100644
>> --- a/drivers/gpu/drm/i915/i915_irq.h
>> +++ b/drivers/gpu/drm/i915/i915_irq.h
>> @@ -101,10 +101,11 @@ void gen8_irq_power_well_post_enable(struct drm_i915_private *dev_priv,
>>  void gen8_irq_power_well_pre_disable(struct drm_i915_private *dev_priv,
>>  				     u8 pipe_mask);
>>  
>> -bool i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe,
>> -			      bool in_vblank_irq, int *vpos, int *hpos,
>> -			      ktime_t *stime, ktime_t *etime,
>> -			      const struct drm_display_mode *mode);
>> +bool i915_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
>> +					    unsigned int pipe,
>> +					    int *max_error,
>> +					    ktime_t *vblank_time,
>> +					    bool in_vblank_irq);
>>  
>>  u32 i915_get_vblank_counter(struct drm_crtc *crtc);
>>  u32 g4x_get_vblank_counter(struct drm_crtc *crtc);
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [PATCH 03/23] drm/i915: Don't use struct drm_driver.get_scanout_position()
@ 2020-01-10 12:04       ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10 12:04 UTC (permalink / raw)
  To: Jani Nikula, airlied, daniel, alexander.deucher,
	christian.koenig, David1.Zhou, maarten.lankhorst,
	patrik.r.jakobsson, robdclark, sean, benjamin.gaignard,
	vincent.abriou, yannick.fertre, philippe.cornu, mcoquelin.stm32,
	alexandre.torgue, eric, rodrigosiqueiramelo, hamohammed.sa,
	linux-graphics-maintainer, thellstrom, bskeggs, harry.wentland,
	sunpeng.li, joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, dri-devel, amd-gfx, nouveau, freedreno


[-- Attachment #1.1.1: Type: text/plain, Size: 8443 bytes --]

Hi

Am 10.01.20 um 12:59 schrieb Jani Nikula:
> On Fri, 10 Jan 2020, Thomas Zimmermann <tzimmermann@suse.de> wrote:
>> The callback struct drm_driver.get_scanout_position() is deprecated in
>> favor of struct drm_crtc_helper_funcs.get_scanout_position().
>>
>> i915 doesn't use CRTC helpers. The patch duplicates the caller
>> drm_calc_vbltimestamp_from_scanoutpos() for i915, such that the callback
>> function is not needed.
>>
>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>> ---
>>  drivers/gpu/drm/i915/i915_drv.c |   3 +-
>>  drivers/gpu/drm/i915/i915_irq.c | 117 ++++++++++++++++++++++++++++++--
>>  drivers/gpu/drm/i915/i915_irq.h |   9 +--
>>  3 files changed, 119 insertions(+), 10 deletions(-)
> 
> Not really enthusiastic about the diffstat in a "cleanup" series.

Well, the cleanup is about the content of drm_driver :)

> 
> I wonder if you could add a generic helper version of
> drm_calc_vbltimestamp_from_scanoutpos where you pass the
> get_scanout_position function as a parameter. Both
> drm_calc_vbltimestamp_from_scanoutpos and the new
> i915_calc_vbltimestamp_from_scanoutpos would then be fairly thin
> wrappers passing in the relevant get_scanout_position function.

Of course. Will be in v2 of the series.

Best regards
Thomas

> 
> This would reduce the almost identical duplication of the function in
> i915.
> 
> BR,
> Jani.
> 
>>
>> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
>> index f7385abdd74b..4a0a7fb85c53 100644
>> --- a/drivers/gpu/drm/i915/i915_drv.c
>> +++ b/drivers/gpu/drm/i915/i915_drv.c
>> @@ -2769,8 +2769,7 @@ static struct drm_driver driver = {
>>  	.gem_prime_export = i915_gem_prime_export,
>>  	.gem_prime_import = i915_gem_prime_import,
>>  
>> -	.get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
>> -	.get_scanout_position = i915_get_crtc_scanoutpos,
>> +	.get_vblank_timestamp = i915_calc_vbltimestamp_from_scanoutpos,
>>  
>>  	.dumb_create = i915_gem_dumb_create,
>>  	.dumb_map_offset = i915_gem_dumb_mmap_offset,
>> diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
>> index afc6aad9bf8c..99d0c3b0feae 100644
>> --- a/drivers/gpu/drm/i915/i915_irq.c
>> +++ b/drivers/gpu/drm/i915/i915_irq.c
>> @@ -52,6 +52,11 @@
>>  #include "i915_trace.h"
>>  #include "intel_pm.h"
>>  
>> +/* Retry timestamp calculation up to 3 times to satisfy
>> + * drm_timestamp_precision before giving up.
>> + */
>> +#define I915_TIMESTAMP_MAXRETRIES 3
>> +
>>  /**
>>   * DOC: interrupt handling
>>   *
>> @@ -762,10 +767,11 @@ static int __intel_get_crtc_scanline(struct intel_crtc *crtc)
>>  	return (position + crtc->scanline_offset) % vtotal;
>>  }
>>  
>> -bool i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int index,
>> -			      bool in_vblank_irq, int *vpos, int *hpos,
>> -			      ktime_t *stime, ktime_t *etime,
>> -			      const struct drm_display_mode *mode)
>> +static bool i915_get_crtc_scanoutpos(struct drm_device *dev,
>> +				     unsigned int index, bool in_vblank_irq,
>> +				     int *vpos, int *hpos,
>> +				     ktime_t *stime, ktime_t *etime,
>> +				     const struct drm_display_mode *mode)
>>  {
>>  	struct drm_i915_private *dev_priv = to_i915(dev);
>>  	struct intel_crtc *crtc = to_intel_crtc(drm_crtc_from_index(dev, index));
>> @@ -879,6 +885,109 @@ bool i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int index,
>>  	return true;
>>  }
>>  
>> +bool i915_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
>> +					    unsigned int pipe,
>> +					    int *max_error,
>> +					    ktime_t *vblank_time,
>> +					    bool in_vblank_irq)
>> +{
>> +	struct timespec64 ts_etime, ts_vblank_time;
>> +	ktime_t stime, etime;
>> +	bool vbl_status;
>> +	struct drm_crtc *crtc;
>> +	const struct drm_display_mode *mode;
>> +	struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
>> +	int vpos, hpos, i;
>> +	int delta_ns, duration_ns;
>> +
>> +	crtc = drm_crtc_from_index(dev, pipe);
>> +
>> +	if (pipe >= dev->num_crtcs || !crtc) {
>> +		DRM_ERROR("Invalid crtc %u\n", pipe);
>> +		return false;
>> +	}
>> +
>> +	if (drm_drv_uses_atomic_modeset(dev))
>> +		mode = &vblank->hwmode;
>> +	else
>> +		mode = &crtc->hwmode;
>> +
>> +	/* If mode timing undefined, just return as no-op:
>> +	 * Happens during initial modesetting of a crtc.
>> +	 */
>> +	if (mode->crtc_clock == 0) {
>> +		DRM_DEBUG("crtc %u: Noop due to uninitialized mode.\n", pipe);
>> +		WARN_ON_ONCE(drm_drv_uses_atomic_modeset(dev));
>> +
>> +		return false;
>> +	}
>> +
>> +	/* Get current scanout position with system timestamp.
>> +	 * Repeat query up to DRM_TIMESTAMP_MAXRETRIES times
>> +	 * if single query takes longer than max_error nanoseconds.
>> +	 *
>> +	 * This guarantees a tight bound on maximum error if
>> +	 * code gets preempted or delayed for some reason.
>> +	 */
>> +	for (i = 0; i < I915_TIMESTAMP_MAXRETRIES; i++) {
>> +		/*
>> +		 * Get vertical and horizontal scanout position vpos, hpos,
>> +		 * and bounding timestamps stime, etime, pre/post query.
>> +		 */
>> +		vbl_status = i915_get_crtc_scanoutpos(dev, pipe, in_vblank_irq,
>> +						      &vpos, &hpos, &stime,
>> +						      &etime, mode);
>> +		/* Return as no-op if scanout query unsupported or failed. */
>> +		if (!vbl_status) {
>> +			DRM_DEBUG("crtc %u : scanoutpos query failed.\n",
>> +				  pipe);
>> +			return false;
>> +		}
>> +
>> +		/* Compute uncertainty in timestamp of scanout position query. */
>> +		duration_ns = ktime_to_ns(etime) - ktime_to_ns(stime);
>> +
>> +		/* Accept result with <  max_error nsecs timing uncertainty. */
>> +		if (duration_ns <= *max_error)
>> +			break;
>> +	}
>> +
>> +	/* Noisy system timing? */
>> +	if (i == I915_TIMESTAMP_MAXRETRIES) {
>> +		DRM_DEBUG("crtc %u: Noisy timestamp %d us > %d us [%d reps].\n",
>> +			  pipe, duration_ns/1000, *max_error/1000, i);
>> +	}
>> +
>> +	/* Return upper bound of timestamp precision error. */
>> +	*max_error = duration_ns;
>> +
>> +	/* Convert scanout position into elapsed time at raw_time query
>> +	 * since start of scanout at first display scanline. delta_ns
>> +	 * can be negative if start of scanout hasn't happened yet.
>> +	 */
>> +	delta_ns = div_s64(1000000LL * (vpos * mode->crtc_htotal + hpos),
>> +			   mode->crtc_clock);
>> +
>> +	/* Subtract time delta from raw timestamp to get final
>> +	 * vblank_time timestamp for end of vblank.
>> +	 */
>> +	*vblank_time = ktime_sub_ns(etime, delta_ns);
>> +
>> +	if (!drm_debug_enabled(DRM_UT_VBL))
>> +		return true;
>> +
>> +	ts_etime = ktime_to_timespec64(etime);
>> +	ts_vblank_time = ktime_to_timespec64(*vblank_time);
>> +
>> +	DRM_DEBUG_VBL("crtc %u : v p(%d,%d)@ %lld.%06ld -> %lld.%06ld [e %d us, %d rep]\n",
>> +		      pipe, hpos, vpos,
>> +		      (u64)ts_etime.tv_sec, ts_etime.tv_nsec / 1000,
>> +		      (u64)ts_vblank_time.tv_sec, ts_vblank_time.tv_nsec / 1000,
>> +		      duration_ns / 1000, i);
>> +
>> +	return true;
>> +}
>> +
>>  int intel_get_crtc_scanline(struct intel_crtc *crtc)
>>  {
>>  	struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
>> diff --git a/drivers/gpu/drm/i915/i915_irq.h b/drivers/gpu/drm/i915/i915_irq.h
>> index 812c47a9c2d6..5f7b133ce721 100644
>> --- a/drivers/gpu/drm/i915/i915_irq.h
>> +++ b/drivers/gpu/drm/i915/i915_irq.h
>> @@ -101,10 +101,11 @@ void gen8_irq_power_well_post_enable(struct drm_i915_private *dev_priv,
>>  void gen8_irq_power_well_pre_disable(struct drm_i915_private *dev_priv,
>>  				     u8 pipe_mask);
>>  
>> -bool i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe,
>> -			      bool in_vblank_irq, int *vpos, int *hpos,
>> -			      ktime_t *stime, ktime_t *etime,
>> -			      const struct drm_display_mode *mode);
>> +bool i915_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
>> +					    unsigned int pipe,
>> +					    int *max_error,
>> +					    ktime_t *vblank_time,
>> +					    bool in_vblank_irq);
>>  
>>  u32 i915_get_vblank_counter(struct drm_crtc *crtc);
>>  u32 g4x_get_vblank_counter(struct drm_crtc *crtc);
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [PATCH 03/23] drm/i915: Don't use struct drm_driver.get_scanout_position()
@ 2020-01-10 12:04       ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10 12:04 UTC (permalink / raw)
  To: Jani Nikula, airlied, daniel, alexander.deucher,
	christian.koenig, David1.Zhou, maarten.lankhorst,
	patrik.r.jakobsson, robdclark, sean, benjamin.gaignard,
	vincent.abriou, yannick.fertre, philippe.cornu, mcoquelin.stm32,
	alexandre.torgue, eric, rodrigosiqueiramelo, hamohammed.sa,
	linux-graphics-maintainer, thellstrom, bskeggs, harry.wentland,
	sunpeng.li, joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, dri-devel, amd-gfx, nouveau, freedreno


[-- Attachment #1.1.1: Type: text/plain, Size: 8443 bytes --]

Hi

Am 10.01.20 um 12:59 schrieb Jani Nikula:
> On Fri, 10 Jan 2020, Thomas Zimmermann <tzimmermann@suse.de> wrote:
>> The callback struct drm_driver.get_scanout_position() is deprecated in
>> favor of struct drm_crtc_helper_funcs.get_scanout_position().
>>
>> i915 doesn't use CRTC helpers. The patch duplicates the caller
>> drm_calc_vbltimestamp_from_scanoutpos() for i915, such that the callback
>> function is not needed.
>>
>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>> ---
>>  drivers/gpu/drm/i915/i915_drv.c |   3 +-
>>  drivers/gpu/drm/i915/i915_irq.c | 117 ++++++++++++++++++++++++++++++--
>>  drivers/gpu/drm/i915/i915_irq.h |   9 +--
>>  3 files changed, 119 insertions(+), 10 deletions(-)
> 
> Not really enthusiastic about the diffstat in a "cleanup" series.

Well, the cleanup is about the content of drm_driver :)

> 
> I wonder if you could add a generic helper version of
> drm_calc_vbltimestamp_from_scanoutpos where you pass the
> get_scanout_position function as a parameter. Both
> drm_calc_vbltimestamp_from_scanoutpos and the new
> i915_calc_vbltimestamp_from_scanoutpos would then be fairly thin
> wrappers passing in the relevant get_scanout_position function.

Of course. Will be in v2 of the series.

Best regards
Thomas

> 
> This would reduce the almost identical duplication of the function in
> i915.
> 
> BR,
> Jani.
> 
>>
>> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
>> index f7385abdd74b..4a0a7fb85c53 100644
>> --- a/drivers/gpu/drm/i915/i915_drv.c
>> +++ b/drivers/gpu/drm/i915/i915_drv.c
>> @@ -2769,8 +2769,7 @@ static struct drm_driver driver = {
>>  	.gem_prime_export = i915_gem_prime_export,
>>  	.gem_prime_import = i915_gem_prime_import,
>>  
>> -	.get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
>> -	.get_scanout_position = i915_get_crtc_scanoutpos,
>> +	.get_vblank_timestamp = i915_calc_vbltimestamp_from_scanoutpos,
>>  
>>  	.dumb_create = i915_gem_dumb_create,
>>  	.dumb_map_offset = i915_gem_dumb_mmap_offset,
>> diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
>> index afc6aad9bf8c..99d0c3b0feae 100644
>> --- a/drivers/gpu/drm/i915/i915_irq.c
>> +++ b/drivers/gpu/drm/i915/i915_irq.c
>> @@ -52,6 +52,11 @@
>>  #include "i915_trace.h"
>>  #include "intel_pm.h"
>>  
>> +/* Retry timestamp calculation up to 3 times to satisfy
>> + * drm_timestamp_precision before giving up.
>> + */
>> +#define I915_TIMESTAMP_MAXRETRIES 3
>> +
>>  /**
>>   * DOC: interrupt handling
>>   *
>> @@ -762,10 +767,11 @@ static int __intel_get_crtc_scanline(struct intel_crtc *crtc)
>>  	return (position + crtc->scanline_offset) % vtotal;
>>  }
>>  
>> -bool i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int index,
>> -			      bool in_vblank_irq, int *vpos, int *hpos,
>> -			      ktime_t *stime, ktime_t *etime,
>> -			      const struct drm_display_mode *mode)
>> +static bool i915_get_crtc_scanoutpos(struct drm_device *dev,
>> +				     unsigned int index, bool in_vblank_irq,
>> +				     int *vpos, int *hpos,
>> +				     ktime_t *stime, ktime_t *etime,
>> +				     const struct drm_display_mode *mode)
>>  {
>>  	struct drm_i915_private *dev_priv = to_i915(dev);
>>  	struct intel_crtc *crtc = to_intel_crtc(drm_crtc_from_index(dev, index));
>> @@ -879,6 +885,109 @@ bool i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int index,
>>  	return true;
>>  }
>>  
>> +bool i915_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
>> +					    unsigned int pipe,
>> +					    int *max_error,
>> +					    ktime_t *vblank_time,
>> +					    bool in_vblank_irq)
>> +{
>> +	struct timespec64 ts_etime, ts_vblank_time;
>> +	ktime_t stime, etime;
>> +	bool vbl_status;
>> +	struct drm_crtc *crtc;
>> +	const struct drm_display_mode *mode;
>> +	struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
>> +	int vpos, hpos, i;
>> +	int delta_ns, duration_ns;
>> +
>> +	crtc = drm_crtc_from_index(dev, pipe);
>> +
>> +	if (pipe >= dev->num_crtcs || !crtc) {
>> +		DRM_ERROR("Invalid crtc %u\n", pipe);
>> +		return false;
>> +	}
>> +
>> +	if (drm_drv_uses_atomic_modeset(dev))
>> +		mode = &vblank->hwmode;
>> +	else
>> +		mode = &crtc->hwmode;
>> +
>> +	/* If mode timing undefined, just return as no-op:
>> +	 * Happens during initial modesetting of a crtc.
>> +	 */
>> +	if (mode->crtc_clock == 0) {
>> +		DRM_DEBUG("crtc %u: Noop due to uninitialized mode.\n", pipe);
>> +		WARN_ON_ONCE(drm_drv_uses_atomic_modeset(dev));
>> +
>> +		return false;
>> +	}
>> +
>> +	/* Get current scanout position with system timestamp.
>> +	 * Repeat query up to DRM_TIMESTAMP_MAXRETRIES times
>> +	 * if single query takes longer than max_error nanoseconds.
>> +	 *
>> +	 * This guarantees a tight bound on maximum error if
>> +	 * code gets preempted or delayed for some reason.
>> +	 */
>> +	for (i = 0; i < I915_TIMESTAMP_MAXRETRIES; i++) {
>> +		/*
>> +		 * Get vertical and horizontal scanout position vpos, hpos,
>> +		 * and bounding timestamps stime, etime, pre/post query.
>> +		 */
>> +		vbl_status = i915_get_crtc_scanoutpos(dev, pipe, in_vblank_irq,
>> +						      &vpos, &hpos, &stime,
>> +						      &etime, mode);
>> +		/* Return as no-op if scanout query unsupported or failed. */
>> +		if (!vbl_status) {
>> +			DRM_DEBUG("crtc %u : scanoutpos query failed.\n",
>> +				  pipe);
>> +			return false;
>> +		}
>> +
>> +		/* Compute uncertainty in timestamp of scanout position query. */
>> +		duration_ns = ktime_to_ns(etime) - ktime_to_ns(stime);
>> +
>> +		/* Accept result with <  max_error nsecs timing uncertainty. */
>> +		if (duration_ns <= *max_error)
>> +			break;
>> +	}
>> +
>> +	/* Noisy system timing? */
>> +	if (i == I915_TIMESTAMP_MAXRETRIES) {
>> +		DRM_DEBUG("crtc %u: Noisy timestamp %d us > %d us [%d reps].\n",
>> +			  pipe, duration_ns/1000, *max_error/1000, i);
>> +	}
>> +
>> +	/* Return upper bound of timestamp precision error. */
>> +	*max_error = duration_ns;
>> +
>> +	/* Convert scanout position into elapsed time at raw_time query
>> +	 * since start of scanout at first display scanline. delta_ns
>> +	 * can be negative if start of scanout hasn't happened yet.
>> +	 */
>> +	delta_ns = div_s64(1000000LL * (vpos * mode->crtc_htotal + hpos),
>> +			   mode->crtc_clock);
>> +
>> +	/* Subtract time delta from raw timestamp to get final
>> +	 * vblank_time timestamp for end of vblank.
>> +	 */
>> +	*vblank_time = ktime_sub_ns(etime, delta_ns);
>> +
>> +	if (!drm_debug_enabled(DRM_UT_VBL))
>> +		return true;
>> +
>> +	ts_etime = ktime_to_timespec64(etime);
>> +	ts_vblank_time = ktime_to_timespec64(*vblank_time);
>> +
>> +	DRM_DEBUG_VBL("crtc %u : v p(%d,%d)@ %lld.%06ld -> %lld.%06ld [e %d us, %d rep]\n",
>> +		      pipe, hpos, vpos,
>> +		      (u64)ts_etime.tv_sec, ts_etime.tv_nsec / 1000,
>> +		      (u64)ts_vblank_time.tv_sec, ts_vblank_time.tv_nsec / 1000,
>> +		      duration_ns / 1000, i);
>> +
>> +	return true;
>> +}
>> +
>>  int intel_get_crtc_scanline(struct intel_crtc *crtc)
>>  {
>>  	struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
>> diff --git a/drivers/gpu/drm/i915/i915_irq.h b/drivers/gpu/drm/i915/i915_irq.h
>> index 812c47a9c2d6..5f7b133ce721 100644
>> --- a/drivers/gpu/drm/i915/i915_irq.h
>> +++ b/drivers/gpu/drm/i915/i915_irq.h
>> @@ -101,10 +101,11 @@ void gen8_irq_power_well_post_enable(struct drm_i915_private *dev_priv,
>>  void gen8_irq_power_well_pre_disable(struct drm_i915_private *dev_priv,
>>  				     u8 pipe_mask);
>>  
>> -bool i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe,
>> -			      bool in_vblank_irq, int *vpos, int *hpos,
>> -			      ktime_t *stime, ktime_t *etime,
>> -			      const struct drm_display_mode *mode);
>> +bool i915_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
>> +					    unsigned int pipe,
>> +					    int *max_error,
>> +					    ktime_t *vblank_time,
>> +					    bool in_vblank_irq);
>>  
>>  u32 i915_get_vblank_counter(struct drm_crtc *crtc);
>>  u32 g4x_get_vblank_counter(struct drm_crtc *crtc);
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [Intel-gfx] [PATCH 03/23] drm/i915: Don't use struct drm_driver.get_scanout_position()
@ 2020-01-10 12:04       ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10 12:04 UTC (permalink / raw)
  To: Jani Nikula, airlied, daniel, alexander.deucher,
	christian.koenig, David1.Zhou, maarten.lankhorst,
	patrik.r.jakobsson, robdclark, sean, benjamin.gaignard,
	vincent.abriou, yannick.fertre, philippe.cornu, mcoquelin.stm32,
	alexandre.torgue, eric, rodrigosiqueiramelo, hamohammed.sa,
	linux-graphics-maintainer, thellstrom, bskeggs, harry.wentland,
	sunpeng.li, joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, dri-devel, amd-gfx, nouveau, freedreno


[-- Attachment #1.1.1: Type: text/plain, Size: 8443 bytes --]

Hi

Am 10.01.20 um 12:59 schrieb Jani Nikula:
> On Fri, 10 Jan 2020, Thomas Zimmermann <tzimmermann@suse.de> wrote:
>> The callback struct drm_driver.get_scanout_position() is deprecated in
>> favor of struct drm_crtc_helper_funcs.get_scanout_position().
>>
>> i915 doesn't use CRTC helpers. The patch duplicates the caller
>> drm_calc_vbltimestamp_from_scanoutpos() for i915, such that the callback
>> function is not needed.
>>
>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>> ---
>>  drivers/gpu/drm/i915/i915_drv.c |   3 +-
>>  drivers/gpu/drm/i915/i915_irq.c | 117 ++++++++++++++++++++++++++++++--
>>  drivers/gpu/drm/i915/i915_irq.h |   9 +--
>>  3 files changed, 119 insertions(+), 10 deletions(-)
> 
> Not really enthusiastic about the diffstat in a "cleanup" series.

Well, the cleanup is about the content of drm_driver :)

> 
> I wonder if you could add a generic helper version of
> drm_calc_vbltimestamp_from_scanoutpos where you pass the
> get_scanout_position function as a parameter. Both
> drm_calc_vbltimestamp_from_scanoutpos and the new
> i915_calc_vbltimestamp_from_scanoutpos would then be fairly thin
> wrappers passing in the relevant get_scanout_position function.

Of course. Will be in v2 of the series.

Best regards
Thomas

> 
> This would reduce the almost identical duplication of the function in
> i915.
> 
> BR,
> Jani.
> 
>>
>> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
>> index f7385abdd74b..4a0a7fb85c53 100644
>> --- a/drivers/gpu/drm/i915/i915_drv.c
>> +++ b/drivers/gpu/drm/i915/i915_drv.c
>> @@ -2769,8 +2769,7 @@ static struct drm_driver driver = {
>>  	.gem_prime_export = i915_gem_prime_export,
>>  	.gem_prime_import = i915_gem_prime_import,
>>  
>> -	.get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
>> -	.get_scanout_position = i915_get_crtc_scanoutpos,
>> +	.get_vblank_timestamp = i915_calc_vbltimestamp_from_scanoutpos,
>>  
>>  	.dumb_create = i915_gem_dumb_create,
>>  	.dumb_map_offset = i915_gem_dumb_mmap_offset,
>> diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
>> index afc6aad9bf8c..99d0c3b0feae 100644
>> --- a/drivers/gpu/drm/i915/i915_irq.c
>> +++ b/drivers/gpu/drm/i915/i915_irq.c
>> @@ -52,6 +52,11 @@
>>  #include "i915_trace.h"
>>  #include "intel_pm.h"
>>  
>> +/* Retry timestamp calculation up to 3 times to satisfy
>> + * drm_timestamp_precision before giving up.
>> + */
>> +#define I915_TIMESTAMP_MAXRETRIES 3
>> +
>>  /**
>>   * DOC: interrupt handling
>>   *
>> @@ -762,10 +767,11 @@ static int __intel_get_crtc_scanline(struct intel_crtc *crtc)
>>  	return (position + crtc->scanline_offset) % vtotal;
>>  }
>>  
>> -bool i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int index,
>> -			      bool in_vblank_irq, int *vpos, int *hpos,
>> -			      ktime_t *stime, ktime_t *etime,
>> -			      const struct drm_display_mode *mode)
>> +static bool i915_get_crtc_scanoutpos(struct drm_device *dev,
>> +				     unsigned int index, bool in_vblank_irq,
>> +				     int *vpos, int *hpos,
>> +				     ktime_t *stime, ktime_t *etime,
>> +				     const struct drm_display_mode *mode)
>>  {
>>  	struct drm_i915_private *dev_priv = to_i915(dev);
>>  	struct intel_crtc *crtc = to_intel_crtc(drm_crtc_from_index(dev, index));
>> @@ -879,6 +885,109 @@ bool i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int index,
>>  	return true;
>>  }
>>  
>> +bool i915_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
>> +					    unsigned int pipe,
>> +					    int *max_error,
>> +					    ktime_t *vblank_time,
>> +					    bool in_vblank_irq)
>> +{
>> +	struct timespec64 ts_etime, ts_vblank_time;
>> +	ktime_t stime, etime;
>> +	bool vbl_status;
>> +	struct drm_crtc *crtc;
>> +	const struct drm_display_mode *mode;
>> +	struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
>> +	int vpos, hpos, i;
>> +	int delta_ns, duration_ns;
>> +
>> +	crtc = drm_crtc_from_index(dev, pipe);
>> +
>> +	if (pipe >= dev->num_crtcs || !crtc) {
>> +		DRM_ERROR("Invalid crtc %u\n", pipe);
>> +		return false;
>> +	}
>> +
>> +	if (drm_drv_uses_atomic_modeset(dev))
>> +		mode = &vblank->hwmode;
>> +	else
>> +		mode = &crtc->hwmode;
>> +
>> +	/* If mode timing undefined, just return as no-op:
>> +	 * Happens during initial modesetting of a crtc.
>> +	 */
>> +	if (mode->crtc_clock == 0) {
>> +		DRM_DEBUG("crtc %u: Noop due to uninitialized mode.\n", pipe);
>> +		WARN_ON_ONCE(drm_drv_uses_atomic_modeset(dev));
>> +
>> +		return false;
>> +	}
>> +
>> +	/* Get current scanout position with system timestamp.
>> +	 * Repeat query up to DRM_TIMESTAMP_MAXRETRIES times
>> +	 * if single query takes longer than max_error nanoseconds.
>> +	 *
>> +	 * This guarantees a tight bound on maximum error if
>> +	 * code gets preempted or delayed for some reason.
>> +	 */
>> +	for (i = 0; i < I915_TIMESTAMP_MAXRETRIES; i++) {
>> +		/*
>> +		 * Get vertical and horizontal scanout position vpos, hpos,
>> +		 * and bounding timestamps stime, etime, pre/post query.
>> +		 */
>> +		vbl_status = i915_get_crtc_scanoutpos(dev, pipe, in_vblank_irq,
>> +						      &vpos, &hpos, &stime,
>> +						      &etime, mode);
>> +		/* Return as no-op if scanout query unsupported or failed. */
>> +		if (!vbl_status) {
>> +			DRM_DEBUG("crtc %u : scanoutpos query failed.\n",
>> +				  pipe);
>> +			return false;
>> +		}
>> +
>> +		/* Compute uncertainty in timestamp of scanout position query. */
>> +		duration_ns = ktime_to_ns(etime) - ktime_to_ns(stime);
>> +
>> +		/* Accept result with <  max_error nsecs timing uncertainty. */
>> +		if (duration_ns <= *max_error)
>> +			break;
>> +	}
>> +
>> +	/* Noisy system timing? */
>> +	if (i == I915_TIMESTAMP_MAXRETRIES) {
>> +		DRM_DEBUG("crtc %u: Noisy timestamp %d us > %d us [%d reps].\n",
>> +			  pipe, duration_ns/1000, *max_error/1000, i);
>> +	}
>> +
>> +	/* Return upper bound of timestamp precision error. */
>> +	*max_error = duration_ns;
>> +
>> +	/* Convert scanout position into elapsed time at raw_time query
>> +	 * since start of scanout at first display scanline. delta_ns
>> +	 * can be negative if start of scanout hasn't happened yet.
>> +	 */
>> +	delta_ns = div_s64(1000000LL * (vpos * mode->crtc_htotal + hpos),
>> +			   mode->crtc_clock);
>> +
>> +	/* Subtract time delta from raw timestamp to get final
>> +	 * vblank_time timestamp for end of vblank.
>> +	 */
>> +	*vblank_time = ktime_sub_ns(etime, delta_ns);
>> +
>> +	if (!drm_debug_enabled(DRM_UT_VBL))
>> +		return true;
>> +
>> +	ts_etime = ktime_to_timespec64(etime);
>> +	ts_vblank_time = ktime_to_timespec64(*vblank_time);
>> +
>> +	DRM_DEBUG_VBL("crtc %u : v p(%d,%d)@ %lld.%06ld -> %lld.%06ld [e %d us, %d rep]\n",
>> +		      pipe, hpos, vpos,
>> +		      (u64)ts_etime.tv_sec, ts_etime.tv_nsec / 1000,
>> +		      (u64)ts_vblank_time.tv_sec, ts_vblank_time.tv_nsec / 1000,
>> +		      duration_ns / 1000, i);
>> +
>> +	return true;
>> +}
>> +
>>  int intel_get_crtc_scanline(struct intel_crtc *crtc)
>>  {
>>  	struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
>> diff --git a/drivers/gpu/drm/i915/i915_irq.h b/drivers/gpu/drm/i915/i915_irq.h
>> index 812c47a9c2d6..5f7b133ce721 100644
>> --- a/drivers/gpu/drm/i915/i915_irq.h
>> +++ b/drivers/gpu/drm/i915/i915_irq.h
>> @@ -101,10 +101,11 @@ void gen8_irq_power_well_post_enable(struct drm_i915_private *dev_priv,
>>  void gen8_irq_power_well_pre_disable(struct drm_i915_private *dev_priv,
>>  				     u8 pipe_mask);
>>  
>> -bool i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe,
>> -			      bool in_vblank_irq, int *vpos, int *hpos,
>> -			      ktime_t *stime, ktime_t *etime,
>> -			      const struct drm_display_mode *mode);
>> +bool i915_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
>> +					    unsigned int pipe,
>> +					    int *max_error,
>> +					    ktime_t *vblank_time,
>> +					    bool in_vblank_irq);
>>  
>>  u32 i915_get_vblank_counter(struct drm_crtc *crtc);
>>  u32 g4x_get_vblank_counter(struct drm_crtc *crtc);
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [PATCH 03/23] drm/i915: Don't use struct drm_driver.get_scanout_position()
@ 2020-01-10 12:04       ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-10 12:04 UTC (permalink / raw)
  To: Jani Nikula, airlied, daniel, alexander.deucher,
	christian.koenig, David1.Zhou, maarten.lankhorst,
	patrik.r.jakobsson, robdclark, sean, benjamin.gaignard,
	vincent.abriou, yannick.fertre, philippe.cornu, mcoquelin.stm32,
	alexandre.torgue, eric, rodrigosiqueiramelo, hamohammed.sa,
	linux-graphics-maintainer, thellstrom, bskeggs, harry.wentland,
	sunpeng.li, joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, dri-devel, amd-gfx, nouveau, freedreno


[-- Attachment #1.1.1: Type: text/plain, Size: 8443 bytes --]

Hi

Am 10.01.20 um 12:59 schrieb Jani Nikula:
> On Fri, 10 Jan 2020, Thomas Zimmermann <tzimmermann@suse.de> wrote:
>> The callback struct drm_driver.get_scanout_position() is deprecated in
>> favor of struct drm_crtc_helper_funcs.get_scanout_position().
>>
>> i915 doesn't use CRTC helpers. The patch duplicates the caller
>> drm_calc_vbltimestamp_from_scanoutpos() for i915, such that the callback
>> function is not needed.
>>
>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>> ---
>>  drivers/gpu/drm/i915/i915_drv.c |   3 +-
>>  drivers/gpu/drm/i915/i915_irq.c | 117 ++++++++++++++++++++++++++++++--
>>  drivers/gpu/drm/i915/i915_irq.h |   9 +--
>>  3 files changed, 119 insertions(+), 10 deletions(-)
> 
> Not really enthusiastic about the diffstat in a "cleanup" series.

Well, the cleanup is about the content of drm_driver :)

> 
> I wonder if you could add a generic helper version of
> drm_calc_vbltimestamp_from_scanoutpos where you pass the
> get_scanout_position function as a parameter. Both
> drm_calc_vbltimestamp_from_scanoutpos and the new
> i915_calc_vbltimestamp_from_scanoutpos would then be fairly thin
> wrappers passing in the relevant get_scanout_position function.

Of course. Will be in v2 of the series.

Best regards
Thomas

> 
> This would reduce the almost identical duplication of the function in
> i915.
> 
> BR,
> Jani.
> 
>>
>> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
>> index f7385abdd74b..4a0a7fb85c53 100644
>> --- a/drivers/gpu/drm/i915/i915_drv.c
>> +++ b/drivers/gpu/drm/i915/i915_drv.c
>> @@ -2769,8 +2769,7 @@ static struct drm_driver driver = {
>>  	.gem_prime_export = i915_gem_prime_export,
>>  	.gem_prime_import = i915_gem_prime_import,
>>  
>> -	.get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
>> -	.get_scanout_position = i915_get_crtc_scanoutpos,
>> +	.get_vblank_timestamp = i915_calc_vbltimestamp_from_scanoutpos,
>>  
>>  	.dumb_create = i915_gem_dumb_create,
>>  	.dumb_map_offset = i915_gem_dumb_mmap_offset,
>> diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
>> index afc6aad9bf8c..99d0c3b0feae 100644
>> --- a/drivers/gpu/drm/i915/i915_irq.c
>> +++ b/drivers/gpu/drm/i915/i915_irq.c
>> @@ -52,6 +52,11 @@
>>  #include "i915_trace.h"
>>  #include "intel_pm.h"
>>  
>> +/* Retry timestamp calculation up to 3 times to satisfy
>> + * drm_timestamp_precision before giving up.
>> + */
>> +#define I915_TIMESTAMP_MAXRETRIES 3
>> +
>>  /**
>>   * DOC: interrupt handling
>>   *
>> @@ -762,10 +767,11 @@ static int __intel_get_crtc_scanline(struct intel_crtc *crtc)
>>  	return (position + crtc->scanline_offset) % vtotal;
>>  }
>>  
>> -bool i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int index,
>> -			      bool in_vblank_irq, int *vpos, int *hpos,
>> -			      ktime_t *stime, ktime_t *etime,
>> -			      const struct drm_display_mode *mode)
>> +static bool i915_get_crtc_scanoutpos(struct drm_device *dev,
>> +				     unsigned int index, bool in_vblank_irq,
>> +				     int *vpos, int *hpos,
>> +				     ktime_t *stime, ktime_t *etime,
>> +				     const struct drm_display_mode *mode)
>>  {
>>  	struct drm_i915_private *dev_priv = to_i915(dev);
>>  	struct intel_crtc *crtc = to_intel_crtc(drm_crtc_from_index(dev, index));
>> @@ -879,6 +885,109 @@ bool i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int index,
>>  	return true;
>>  }
>>  
>> +bool i915_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
>> +					    unsigned int pipe,
>> +					    int *max_error,
>> +					    ktime_t *vblank_time,
>> +					    bool in_vblank_irq)
>> +{
>> +	struct timespec64 ts_etime, ts_vblank_time;
>> +	ktime_t stime, etime;
>> +	bool vbl_status;
>> +	struct drm_crtc *crtc;
>> +	const struct drm_display_mode *mode;
>> +	struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
>> +	int vpos, hpos, i;
>> +	int delta_ns, duration_ns;
>> +
>> +	crtc = drm_crtc_from_index(dev, pipe);
>> +
>> +	if (pipe >= dev->num_crtcs || !crtc) {
>> +		DRM_ERROR("Invalid crtc %u\n", pipe);
>> +		return false;
>> +	}
>> +
>> +	if (drm_drv_uses_atomic_modeset(dev))
>> +		mode = &vblank->hwmode;
>> +	else
>> +		mode = &crtc->hwmode;
>> +
>> +	/* If mode timing undefined, just return as no-op:
>> +	 * Happens during initial modesetting of a crtc.
>> +	 */
>> +	if (mode->crtc_clock == 0) {
>> +		DRM_DEBUG("crtc %u: Noop due to uninitialized mode.\n", pipe);
>> +		WARN_ON_ONCE(drm_drv_uses_atomic_modeset(dev));
>> +
>> +		return false;
>> +	}
>> +
>> +	/* Get current scanout position with system timestamp.
>> +	 * Repeat query up to DRM_TIMESTAMP_MAXRETRIES times
>> +	 * if single query takes longer than max_error nanoseconds.
>> +	 *
>> +	 * This guarantees a tight bound on maximum error if
>> +	 * code gets preempted or delayed for some reason.
>> +	 */
>> +	for (i = 0; i < I915_TIMESTAMP_MAXRETRIES; i++) {
>> +		/*
>> +		 * Get vertical and horizontal scanout position vpos, hpos,
>> +		 * and bounding timestamps stime, etime, pre/post query.
>> +		 */
>> +		vbl_status = i915_get_crtc_scanoutpos(dev, pipe, in_vblank_irq,
>> +						      &vpos, &hpos, &stime,
>> +						      &etime, mode);
>> +		/* Return as no-op if scanout query unsupported or failed. */
>> +		if (!vbl_status) {
>> +			DRM_DEBUG("crtc %u : scanoutpos query failed.\n",
>> +				  pipe);
>> +			return false;
>> +		}
>> +
>> +		/* Compute uncertainty in timestamp of scanout position query. */
>> +		duration_ns = ktime_to_ns(etime) - ktime_to_ns(stime);
>> +
>> +		/* Accept result with <  max_error nsecs timing uncertainty. */
>> +		if (duration_ns <= *max_error)
>> +			break;
>> +	}
>> +
>> +	/* Noisy system timing? */
>> +	if (i == I915_TIMESTAMP_MAXRETRIES) {
>> +		DRM_DEBUG("crtc %u: Noisy timestamp %d us > %d us [%d reps].\n",
>> +			  pipe, duration_ns/1000, *max_error/1000, i);
>> +	}
>> +
>> +	/* Return upper bound of timestamp precision error. */
>> +	*max_error = duration_ns;
>> +
>> +	/* Convert scanout position into elapsed time at raw_time query
>> +	 * since start of scanout at first display scanline. delta_ns
>> +	 * can be negative if start of scanout hasn't happened yet.
>> +	 */
>> +	delta_ns = div_s64(1000000LL * (vpos * mode->crtc_htotal + hpos),
>> +			   mode->crtc_clock);
>> +
>> +	/* Subtract time delta from raw timestamp to get final
>> +	 * vblank_time timestamp for end of vblank.
>> +	 */
>> +	*vblank_time = ktime_sub_ns(etime, delta_ns);
>> +
>> +	if (!drm_debug_enabled(DRM_UT_VBL))
>> +		return true;
>> +
>> +	ts_etime = ktime_to_timespec64(etime);
>> +	ts_vblank_time = ktime_to_timespec64(*vblank_time);
>> +
>> +	DRM_DEBUG_VBL("crtc %u : v p(%d,%d)@ %lld.%06ld -> %lld.%06ld [e %d us, %d rep]\n",
>> +		      pipe, hpos, vpos,
>> +		      (u64)ts_etime.tv_sec, ts_etime.tv_nsec / 1000,
>> +		      (u64)ts_vblank_time.tv_sec, ts_vblank_time.tv_nsec / 1000,
>> +		      duration_ns / 1000, i);
>> +
>> +	return true;
>> +}
>> +
>>  int intel_get_crtc_scanline(struct intel_crtc *crtc)
>>  {
>>  	struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
>> diff --git a/drivers/gpu/drm/i915/i915_irq.h b/drivers/gpu/drm/i915/i915_irq.h
>> index 812c47a9c2d6..5f7b133ce721 100644
>> --- a/drivers/gpu/drm/i915/i915_irq.h
>> +++ b/drivers/gpu/drm/i915/i915_irq.h
>> @@ -101,10 +101,11 @@ void gen8_irq_power_well_post_enable(struct drm_i915_private *dev_priv,
>>  void gen8_irq_power_well_pre_disable(struct drm_i915_private *dev_priv,
>>  				     u8 pipe_mask);
>>  
>> -bool i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe,
>> -			      bool in_vblank_irq, int *vpos, int *hpos,
>> -			      ktime_t *stime, ktime_t *etime,
>> -			      const struct drm_display_mode *mode);
>> +bool i915_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
>> +					    unsigned int pipe,
>> +					    int *max_error,
>> +					    ktime_t *vblank_time,
>> +					    bool in_vblank_irq);
>>  
>>  u32 i915_get_vblank_counter(struct drm_crtc *crtc);
>>  u32 g4x_get_vblank_counter(struct drm_crtc *crtc);
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [PATCH 18/23] drm/sti: Convert to CRTC VBLANK callbacks
  2020-01-10  9:21   ` Thomas Zimmermann
                       ` (2 preceding siblings ...)
  (?)
@ 2020-01-10 13:38     ` Benjamin Gaignard
  -1 siblings, 0 replies; 217+ messages in thread
From: Benjamin Gaignard @ 2020-01-10 13:38 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: David Airlie, Daniel Vetter, Alex Deucher, Christian König,
	David Zhou, Maarten Lankhorst, patrik.r.jakobsson, Rob Clark,
	Sean Paul, Vincent Abriou, Yannick Fertre, Philippe Cornu,
	Maxime Coquelin, Alexandre Torgue, Eric Anholt, Rodrigo Siqueira,
	hamohammed.sa, linux-graphics-maintainer, Thomas Hellstrom,
	bskeggs, Harry Wentland, sunpeng.li, Jani Nikula,
	Joonas Lahtinen, Rodrigo Vivi, ML dri-devel, amd-gfx,
	Intel Graphics Development, linux-arm-msm, freedreno, nouveau

Le ven. 10 janv. 2020 à 10:21, Thomas Zimmermann <tzimmermann@suse.de> a écrit :
>
> VBLANK callbacks in struct drm_driver are deprecated in favor of
> their equivalents in struct drm_crtc_funcs. Convert sti over.
>

Hi Thomas,

Since you remove the last calls to sti_crtc functions from sti_drv.c I
think that the include could also be removed.

Anyway that looks for me:
Acked-by: Benjamin Gaignard <benjamin.gaignard@linaor.org>

Thanks,
Benjamin

> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
>  drivers/gpu/drm/sti/sti_crtc.c | 11 ++++++++---
>  drivers/gpu/drm/sti/sti_crtc.h |  2 --
>  drivers/gpu/drm/sti/sti_drv.c  |  3 ---
>  3 files changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/sti/sti_crtc.c b/drivers/gpu/drm/sti/sti_crtc.c
> index dc64fbfc4e61..49e6cb8f5836 100644
> --- a/drivers/gpu/drm/sti/sti_crtc.c
> +++ b/drivers/gpu/drm/sti/sti_crtc.c
> @@ -279,12 +279,13 @@ int sti_crtc_vblank_cb(struct notifier_block *nb,
>         return 0;
>  }
>
> -int sti_crtc_enable_vblank(struct drm_device *dev, unsigned int pipe)
> +static int sti_crtc_enable_vblank(struct drm_crtc *crtc)
>  {
> +       struct drm_device *dev = crtc->dev;
> +       unsigned int pipe = crtc->index;
>         struct sti_private *dev_priv = dev->dev_private;
>         struct sti_compositor *compo = dev_priv->compo;
>         struct notifier_block *vtg_vblank_nb = &compo->vtg_vblank_nb[pipe];
> -       struct drm_crtc *crtc = &compo->mixer[pipe]->drm_crtc;
>         struct sti_vtg *vtg = compo->vtg[pipe];
>
>         DRM_DEBUG_DRIVER("\n");
> @@ -297,8 +298,10 @@ int sti_crtc_enable_vblank(struct drm_device *dev, unsigned int pipe)
>         return 0;
>  }
>
> -void sti_crtc_disable_vblank(struct drm_device *drm_dev, unsigned int pipe)
> +static void sti_crtc_disable_vblank(struct drm_crtc *crtc)
>  {
> +       struct drm_device *drm_dev = crtc->dev;
> +       unsigned int pipe = crtc->index;
>         struct sti_private *priv = drm_dev->dev_private;
>         struct sti_compositor *compo = priv->compo;
>         struct notifier_block *vtg_vblank_nb = &compo->vtg_vblank_nb[pipe];
> @@ -330,6 +333,8 @@ static const struct drm_crtc_funcs sti_crtc_funcs = {
>         .atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
>         .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
>         .late_register = sti_crtc_late_register,
> +       .enable_vblank = sti_crtc_enable_vblank,
> +       .disable_vblank = sti_crtc_disable_vblank,
>  };
>
>  bool sti_crtc_is_main(struct drm_crtc *crtc)
> diff --git a/drivers/gpu/drm/sti/sti_crtc.h b/drivers/gpu/drm/sti/sti_crtc.h
> index df489ab14e2b..1132b4586712 100644
> --- a/drivers/gpu/drm/sti/sti_crtc.h
> +++ b/drivers/gpu/drm/sti/sti_crtc.h
> @@ -15,8 +15,6 @@ struct sti_mixer;
>
>  int sti_crtc_init(struct drm_device *drm_dev, struct sti_mixer *mixer,
>                   struct drm_plane *primary, struct drm_plane *cursor);
> -int sti_crtc_enable_vblank(struct drm_device *dev, unsigned int pipe);
> -void sti_crtc_disable_vblank(struct drm_device *dev, unsigned int pipe);
>  int sti_crtc_vblank_cb(struct notifier_block *nb,
>                        unsigned long event, void *data);
>  bool sti_crtc_is_main(struct drm_crtc *drm_crtc);
> diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c
> index a39fc36f815b..8e30001bf545 100644
> --- a/drivers/gpu/drm/sti/sti_drv.c
> +++ b/drivers/gpu/drm/sti/sti_drv.c
> @@ -146,9 +146,6 @@ static struct drm_driver sti_driver = {
>         .dumb_create = drm_gem_cma_dumb_create,
>         .fops = &sti_driver_fops,
>
> -       .enable_vblank = sti_crtc_enable_vblank,
> -       .disable_vblank = sti_crtc_disable_vblank,
> -
>         .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
>         .prime_fd_to_handle = drm_gem_prime_fd_to_handle,
>         .gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table,
> --
> 2.24.1
>

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [PATCH 18/23] drm/sti: Convert to CRTC VBLANK callbacks
@ 2020-01-10 13:38     ` Benjamin Gaignard
  0 siblings, 0 replies; 217+ messages in thread
From: Benjamin Gaignard @ 2020-01-10 13:38 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: David Airlie, Daniel Vetter, Alex Deucher, Christian König,
	David Zhou, Maarten Lankhorst, patrik.r.jakobsson, Rob Clark,
	Sean Paul, Vincent Abriou, Yannick Fertre, Philippe Cornu,
	Maxime Coquelin, Alexandre Torgue, Eric Anholt, Rodrigo Siqueira,
	hamohammed.sa, linux-graphics-maintainer, Thomas Hellstrom,
	bskeggs

Le ven. 10 janv. 2020 à 10:21, Thomas Zimmermann <tzimmermann@suse.de> a écrit :
>
> VBLANK callbacks in struct drm_driver are deprecated in favor of
> their equivalents in struct drm_crtc_funcs. Convert sti over.
>

Hi Thomas,

Since you remove the last calls to sti_crtc functions from sti_drv.c I
think that the include could also be removed.

Anyway that looks for me:
Acked-by: Benjamin Gaignard <benjamin.gaignard@linaor.org>

Thanks,
Benjamin

> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
>  drivers/gpu/drm/sti/sti_crtc.c | 11 ++++++++---
>  drivers/gpu/drm/sti/sti_crtc.h |  2 --
>  drivers/gpu/drm/sti/sti_drv.c  |  3 ---
>  3 files changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/sti/sti_crtc.c b/drivers/gpu/drm/sti/sti_crtc.c
> index dc64fbfc4e61..49e6cb8f5836 100644
> --- a/drivers/gpu/drm/sti/sti_crtc.c
> +++ b/drivers/gpu/drm/sti/sti_crtc.c
> @@ -279,12 +279,13 @@ int sti_crtc_vblank_cb(struct notifier_block *nb,
>         return 0;
>  }
>
> -int sti_crtc_enable_vblank(struct drm_device *dev, unsigned int pipe)
> +static int sti_crtc_enable_vblank(struct drm_crtc *crtc)
>  {
> +       struct drm_device *dev = crtc->dev;
> +       unsigned int pipe = crtc->index;
>         struct sti_private *dev_priv = dev->dev_private;
>         struct sti_compositor *compo = dev_priv->compo;
>         struct notifier_block *vtg_vblank_nb = &compo->vtg_vblank_nb[pipe];
> -       struct drm_crtc *crtc = &compo->mixer[pipe]->drm_crtc;
>         struct sti_vtg *vtg = compo->vtg[pipe];
>
>         DRM_DEBUG_DRIVER("\n");
> @@ -297,8 +298,10 @@ int sti_crtc_enable_vblank(struct drm_device *dev, unsigned int pipe)
>         return 0;
>  }
>
> -void sti_crtc_disable_vblank(struct drm_device *drm_dev, unsigned int pipe)
> +static void sti_crtc_disable_vblank(struct drm_crtc *crtc)
>  {
> +       struct drm_device *drm_dev = crtc->dev;
> +       unsigned int pipe = crtc->index;
>         struct sti_private *priv = drm_dev->dev_private;
>         struct sti_compositor *compo = priv->compo;
>         struct notifier_block *vtg_vblank_nb = &compo->vtg_vblank_nb[pipe];
> @@ -330,6 +333,8 @@ static const struct drm_crtc_funcs sti_crtc_funcs = {
>         .atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
>         .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
>         .late_register = sti_crtc_late_register,
> +       .enable_vblank = sti_crtc_enable_vblank,
> +       .disable_vblank = sti_crtc_disable_vblank,
>  };
>
>  bool sti_crtc_is_main(struct drm_crtc *crtc)
> diff --git a/drivers/gpu/drm/sti/sti_crtc.h b/drivers/gpu/drm/sti/sti_crtc.h
> index df489ab14e2b..1132b4586712 100644
> --- a/drivers/gpu/drm/sti/sti_crtc.h
> +++ b/drivers/gpu/drm/sti/sti_crtc.h
> @@ -15,8 +15,6 @@ struct sti_mixer;
>
>  int sti_crtc_init(struct drm_device *drm_dev, struct sti_mixer *mixer,
>                   struct drm_plane *primary, struct drm_plane *cursor);
> -int sti_crtc_enable_vblank(struct drm_device *dev, unsigned int pipe);
> -void sti_crtc_disable_vblank(struct drm_device *dev, unsigned int pipe);
>  int sti_crtc_vblank_cb(struct notifier_block *nb,
>                        unsigned long event, void *data);
>  bool sti_crtc_is_main(struct drm_crtc *drm_crtc);
> diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c
> index a39fc36f815b..8e30001bf545 100644
> --- a/drivers/gpu/drm/sti/sti_drv.c
> +++ b/drivers/gpu/drm/sti/sti_drv.c
> @@ -146,9 +146,6 @@ static struct drm_driver sti_driver = {
>         .dumb_create = drm_gem_cma_dumb_create,
>         .fops = &sti_driver_fops,
>
> -       .enable_vblank = sti_crtc_enable_vblank,
> -       .disable_vblank = sti_crtc_disable_vblank,
> -
>         .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
>         .prime_fd_to_handle = drm_gem_prime_fd_to_handle,
>         .gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table,
> --
> 2.24.1
>

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [PATCH 18/23] drm/sti: Convert to CRTC VBLANK callbacks
@ 2020-01-10 13:38     ` Benjamin Gaignard
  0 siblings, 0 replies; 217+ messages in thread
From: Benjamin Gaignard @ 2020-01-10 13:38 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: hamohammed.sa, David Airlie, nouveau, ML dri-devel, amd-gfx,
	Alexandre Torgue, Thomas Hellstrom, Sean Paul,
	linux-graphics-maintainer, bskeggs, sunpeng.li, linux-arm-msm,
	Intel Graphics Development, Rodrigo Vivi, Vincent Abriou,
	Rodrigo Siqueira, Philippe Cornu, Yannick Fertre,
	Maxime Coquelin, Alex Deucher, freedreno, Christian König

Le ven. 10 janv. 2020 à 10:21, Thomas Zimmermann <tzimmermann@suse.de> a écrit :
>
> VBLANK callbacks in struct drm_driver are deprecated in favor of
> their equivalents in struct drm_crtc_funcs. Convert sti over.
>

Hi Thomas,

Since you remove the last calls to sti_crtc functions from sti_drv.c I
think that the include could also be removed.

Anyway that looks for me:
Acked-by: Benjamin Gaignard <benjamin.gaignard@linaor.org>

Thanks,
Benjamin

> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
>  drivers/gpu/drm/sti/sti_crtc.c | 11 ++++++++---
>  drivers/gpu/drm/sti/sti_crtc.h |  2 --
>  drivers/gpu/drm/sti/sti_drv.c  |  3 ---
>  3 files changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/sti/sti_crtc.c b/drivers/gpu/drm/sti/sti_crtc.c
> index dc64fbfc4e61..49e6cb8f5836 100644
> --- a/drivers/gpu/drm/sti/sti_crtc.c
> +++ b/drivers/gpu/drm/sti/sti_crtc.c
> @@ -279,12 +279,13 @@ int sti_crtc_vblank_cb(struct notifier_block *nb,
>         return 0;
>  }
>
> -int sti_crtc_enable_vblank(struct drm_device *dev, unsigned int pipe)
> +static int sti_crtc_enable_vblank(struct drm_crtc *crtc)
>  {
> +       struct drm_device *dev = crtc->dev;
> +       unsigned int pipe = crtc->index;
>         struct sti_private *dev_priv = dev->dev_private;
>         struct sti_compositor *compo = dev_priv->compo;
>         struct notifier_block *vtg_vblank_nb = &compo->vtg_vblank_nb[pipe];
> -       struct drm_crtc *crtc = &compo->mixer[pipe]->drm_crtc;
>         struct sti_vtg *vtg = compo->vtg[pipe];
>
>         DRM_DEBUG_DRIVER("\n");
> @@ -297,8 +298,10 @@ int sti_crtc_enable_vblank(struct drm_device *dev, unsigned int pipe)
>         return 0;
>  }
>
> -void sti_crtc_disable_vblank(struct drm_device *drm_dev, unsigned int pipe)
> +static void sti_crtc_disable_vblank(struct drm_crtc *crtc)
>  {
> +       struct drm_device *drm_dev = crtc->dev;
> +       unsigned int pipe = crtc->index;
>         struct sti_private *priv = drm_dev->dev_private;
>         struct sti_compositor *compo = priv->compo;
>         struct notifier_block *vtg_vblank_nb = &compo->vtg_vblank_nb[pipe];
> @@ -330,6 +333,8 @@ static const struct drm_crtc_funcs sti_crtc_funcs = {
>         .atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
>         .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
>         .late_register = sti_crtc_late_register,
> +       .enable_vblank = sti_crtc_enable_vblank,
> +       .disable_vblank = sti_crtc_disable_vblank,
>  };
>
>  bool sti_crtc_is_main(struct drm_crtc *crtc)
> diff --git a/drivers/gpu/drm/sti/sti_crtc.h b/drivers/gpu/drm/sti/sti_crtc.h
> index df489ab14e2b..1132b4586712 100644
> --- a/drivers/gpu/drm/sti/sti_crtc.h
> +++ b/drivers/gpu/drm/sti/sti_crtc.h
> @@ -15,8 +15,6 @@ struct sti_mixer;
>
>  int sti_crtc_init(struct drm_device *drm_dev, struct sti_mixer *mixer,
>                   struct drm_plane *primary, struct drm_plane *cursor);
> -int sti_crtc_enable_vblank(struct drm_device *dev, unsigned int pipe);
> -void sti_crtc_disable_vblank(struct drm_device *dev, unsigned int pipe);
>  int sti_crtc_vblank_cb(struct notifier_block *nb,
>                        unsigned long event, void *data);
>  bool sti_crtc_is_main(struct drm_crtc *drm_crtc);
> diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c
> index a39fc36f815b..8e30001bf545 100644
> --- a/drivers/gpu/drm/sti/sti_drv.c
> +++ b/drivers/gpu/drm/sti/sti_drv.c
> @@ -146,9 +146,6 @@ static struct drm_driver sti_driver = {
>         .dumb_create = drm_gem_cma_dumb_create,
>         .fops = &sti_driver_fops,
>
> -       .enable_vblank = sti_crtc_enable_vblank,
> -       .disable_vblank = sti_crtc_disable_vblank,
> -
>         .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
>         .prime_fd_to_handle = drm_gem_prime_fd_to_handle,
>         .gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table,
> --
> 2.24.1
>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [Intel-gfx] [PATCH 18/23] drm/sti: Convert to CRTC VBLANK callbacks
@ 2020-01-10 13:38     ` Benjamin Gaignard
  0 siblings, 0 replies; 217+ messages in thread
From: Benjamin Gaignard @ 2020-01-10 13:38 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: hamohammed.sa, David Airlie, nouveau, ML dri-devel, Eric Anholt,
	amd-gfx, Alexandre Torgue, David Zhou, Thomas Hellstrom,
	linux-graphics-maintainer, bskeggs, Harry Wentland, sunpeng.li,
	linux-arm-msm, Intel Graphics Development, Vincent Abriou,
	Rodrigo Siqueira, Philippe Cornu, Yannick Fertre,
	Maxime Coquelin, Alex Deucher, freedreno, Christian König

Le ven. 10 janv. 2020 à 10:21, Thomas Zimmermann <tzimmermann@suse.de> a écrit :
>
> VBLANK callbacks in struct drm_driver are deprecated in favor of
> their equivalents in struct drm_crtc_funcs. Convert sti over.
>

Hi Thomas,

Since you remove the last calls to sti_crtc functions from sti_drv.c I
think that the include could also be removed.

Anyway that looks for me:
Acked-by: Benjamin Gaignard <benjamin.gaignard@linaor.org>

Thanks,
Benjamin

> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
>  drivers/gpu/drm/sti/sti_crtc.c | 11 ++++++++---
>  drivers/gpu/drm/sti/sti_crtc.h |  2 --
>  drivers/gpu/drm/sti/sti_drv.c  |  3 ---
>  3 files changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/sti/sti_crtc.c b/drivers/gpu/drm/sti/sti_crtc.c
> index dc64fbfc4e61..49e6cb8f5836 100644
> --- a/drivers/gpu/drm/sti/sti_crtc.c
> +++ b/drivers/gpu/drm/sti/sti_crtc.c
> @@ -279,12 +279,13 @@ int sti_crtc_vblank_cb(struct notifier_block *nb,
>         return 0;
>  }
>
> -int sti_crtc_enable_vblank(struct drm_device *dev, unsigned int pipe)
> +static int sti_crtc_enable_vblank(struct drm_crtc *crtc)
>  {
> +       struct drm_device *dev = crtc->dev;
> +       unsigned int pipe = crtc->index;
>         struct sti_private *dev_priv = dev->dev_private;
>         struct sti_compositor *compo = dev_priv->compo;
>         struct notifier_block *vtg_vblank_nb = &compo->vtg_vblank_nb[pipe];
> -       struct drm_crtc *crtc = &compo->mixer[pipe]->drm_crtc;
>         struct sti_vtg *vtg = compo->vtg[pipe];
>
>         DRM_DEBUG_DRIVER("\n");
> @@ -297,8 +298,10 @@ int sti_crtc_enable_vblank(struct drm_device *dev, unsigned int pipe)
>         return 0;
>  }
>
> -void sti_crtc_disable_vblank(struct drm_device *drm_dev, unsigned int pipe)
> +static void sti_crtc_disable_vblank(struct drm_crtc *crtc)
>  {
> +       struct drm_device *drm_dev = crtc->dev;
> +       unsigned int pipe = crtc->index;
>         struct sti_private *priv = drm_dev->dev_private;
>         struct sti_compositor *compo = priv->compo;
>         struct notifier_block *vtg_vblank_nb = &compo->vtg_vblank_nb[pipe];
> @@ -330,6 +333,8 @@ static const struct drm_crtc_funcs sti_crtc_funcs = {
>         .atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
>         .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
>         .late_register = sti_crtc_late_register,
> +       .enable_vblank = sti_crtc_enable_vblank,
> +       .disable_vblank = sti_crtc_disable_vblank,
>  };
>
>  bool sti_crtc_is_main(struct drm_crtc *crtc)
> diff --git a/drivers/gpu/drm/sti/sti_crtc.h b/drivers/gpu/drm/sti/sti_crtc.h
> index df489ab14e2b..1132b4586712 100644
> --- a/drivers/gpu/drm/sti/sti_crtc.h
> +++ b/drivers/gpu/drm/sti/sti_crtc.h
> @@ -15,8 +15,6 @@ struct sti_mixer;
>
>  int sti_crtc_init(struct drm_device *drm_dev, struct sti_mixer *mixer,
>                   struct drm_plane *primary, struct drm_plane *cursor);
> -int sti_crtc_enable_vblank(struct drm_device *dev, unsigned int pipe);
> -void sti_crtc_disable_vblank(struct drm_device *dev, unsigned int pipe);
>  int sti_crtc_vblank_cb(struct notifier_block *nb,
>                        unsigned long event, void *data);
>  bool sti_crtc_is_main(struct drm_crtc *drm_crtc);
> diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c
> index a39fc36f815b..8e30001bf545 100644
> --- a/drivers/gpu/drm/sti/sti_drv.c
> +++ b/drivers/gpu/drm/sti/sti_drv.c
> @@ -146,9 +146,6 @@ static struct drm_driver sti_driver = {
>         .dumb_create = drm_gem_cma_dumb_create,
>         .fops = &sti_driver_fops,
>
> -       .enable_vblank = sti_crtc_enable_vblank,
> -       .disable_vblank = sti_crtc_disable_vblank,
> -
>         .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
>         .prime_fd_to_handle = drm_gem_prime_fd_to_handle,
>         .gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table,
> --
> 2.24.1
>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [PATCH 18/23] drm/sti: Convert to CRTC VBLANK callbacks
@ 2020-01-10 13:38     ` Benjamin Gaignard
  0 siblings, 0 replies; 217+ messages in thread
From: Benjamin Gaignard @ 2020-01-10 13:38 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: hamohammed.sa, David Airlie, nouveau, Joonas Lahtinen,
	ML dri-devel, Eric Anholt, amd-gfx, Alexandre Torgue, David Zhou,
	Thomas Hellstrom, Sean Paul, patrik.r.jakobsson,
	linux-graphics-maintainer, bskeggs, Harry Wentland,
	Daniel Vetter, sunpeng.li, linux-arm-msm,
	Intel Graphics Development, Maarten Lankhorst, Jani Nikula,
	Rodrigo Vivi, Vincent Abriou, Rodrigo Siqueira, Philippe Cornu,
	Yannick Fertre, Rob Clark, Maxime Coquelin, Alex Deucher,
	freedreno, Christian König

Le ven. 10 janv. 2020 à 10:21, Thomas Zimmermann <tzimmermann@suse.de> a écrit :
>
> VBLANK callbacks in struct drm_driver are deprecated in favor of
> their equivalents in struct drm_crtc_funcs. Convert sti over.
>

Hi Thomas,

Since you remove the last calls to sti_crtc functions from sti_drv.c I
think that the include could also be removed.

Anyway that looks for me:
Acked-by: Benjamin Gaignard <benjamin.gaignard@linaor.org>

Thanks,
Benjamin

> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
>  drivers/gpu/drm/sti/sti_crtc.c | 11 ++++++++---
>  drivers/gpu/drm/sti/sti_crtc.h |  2 --
>  drivers/gpu/drm/sti/sti_drv.c  |  3 ---
>  3 files changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/sti/sti_crtc.c b/drivers/gpu/drm/sti/sti_crtc.c
> index dc64fbfc4e61..49e6cb8f5836 100644
> --- a/drivers/gpu/drm/sti/sti_crtc.c
> +++ b/drivers/gpu/drm/sti/sti_crtc.c
> @@ -279,12 +279,13 @@ int sti_crtc_vblank_cb(struct notifier_block *nb,
>         return 0;
>  }
>
> -int sti_crtc_enable_vblank(struct drm_device *dev, unsigned int pipe)
> +static int sti_crtc_enable_vblank(struct drm_crtc *crtc)
>  {
> +       struct drm_device *dev = crtc->dev;
> +       unsigned int pipe = crtc->index;
>         struct sti_private *dev_priv = dev->dev_private;
>         struct sti_compositor *compo = dev_priv->compo;
>         struct notifier_block *vtg_vblank_nb = &compo->vtg_vblank_nb[pipe];
> -       struct drm_crtc *crtc = &compo->mixer[pipe]->drm_crtc;
>         struct sti_vtg *vtg = compo->vtg[pipe];
>
>         DRM_DEBUG_DRIVER("\n");
> @@ -297,8 +298,10 @@ int sti_crtc_enable_vblank(struct drm_device *dev, unsigned int pipe)
>         return 0;
>  }
>
> -void sti_crtc_disable_vblank(struct drm_device *drm_dev, unsigned int pipe)
> +static void sti_crtc_disable_vblank(struct drm_crtc *crtc)
>  {
> +       struct drm_device *drm_dev = crtc->dev;
> +       unsigned int pipe = crtc->index;
>         struct sti_private *priv = drm_dev->dev_private;
>         struct sti_compositor *compo = priv->compo;
>         struct notifier_block *vtg_vblank_nb = &compo->vtg_vblank_nb[pipe];
> @@ -330,6 +333,8 @@ static const struct drm_crtc_funcs sti_crtc_funcs = {
>         .atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
>         .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
>         .late_register = sti_crtc_late_register,
> +       .enable_vblank = sti_crtc_enable_vblank,
> +       .disable_vblank = sti_crtc_disable_vblank,
>  };
>
>  bool sti_crtc_is_main(struct drm_crtc *crtc)
> diff --git a/drivers/gpu/drm/sti/sti_crtc.h b/drivers/gpu/drm/sti/sti_crtc.h
> index df489ab14e2b..1132b4586712 100644
> --- a/drivers/gpu/drm/sti/sti_crtc.h
> +++ b/drivers/gpu/drm/sti/sti_crtc.h
> @@ -15,8 +15,6 @@ struct sti_mixer;
>
>  int sti_crtc_init(struct drm_device *drm_dev, struct sti_mixer *mixer,
>                   struct drm_plane *primary, struct drm_plane *cursor);
> -int sti_crtc_enable_vblank(struct drm_device *dev, unsigned int pipe);
> -void sti_crtc_disable_vblank(struct drm_device *dev, unsigned int pipe);
>  int sti_crtc_vblank_cb(struct notifier_block *nb,
>                        unsigned long event, void *data);
>  bool sti_crtc_is_main(struct drm_crtc *drm_crtc);
> diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c
> index a39fc36f815b..8e30001bf545 100644
> --- a/drivers/gpu/drm/sti/sti_drv.c
> +++ b/drivers/gpu/drm/sti/sti_drv.c
> @@ -146,9 +146,6 @@ static struct drm_driver sti_driver = {
>         .dumb_create = drm_gem_cma_dumb_create,
>         .fops = &sti_driver_fops,
>
> -       .enable_vblank = sti_crtc_enable_vblank,
> -       .disable_vblank = sti_crtc_disable_vblank,
> -
>         .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
>         .prime_fd_to_handle = drm_gem_prime_fd_to_handle,
>         .gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table,
> --
> 2.24.1
>
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [PATCH 03/23] drm/i915: Don't use struct drm_driver.get_scanout_position()
  2020-01-10 12:04       ` Thomas Zimmermann
                           ` (2 preceding siblings ...)
  (?)
@ 2020-01-10 13:56         ` Jani Nikula
  -1 siblings, 0 replies; 217+ messages in thread
From: Jani Nikula @ 2020-01-10 13:56 UTC (permalink / raw)
  To: Thomas Zimmermann, airlied, daniel, alexander.deucher,
	christian.koenig, David1.Zhou, maarten.lankhorst,
	patrik.r.jakobsson, robdclark, sean, benjamin.gaignard,
	vincent.abriou, yannick.fertre, philippe.cornu, mcoquelin.stm32,
	alexandre.torgue, eric, rodrigosiqueiramelo, hamohammed.sa,
	linux-graphics-maintainer, thellstrom, bskeggs, harry.wentland,
	sunpeng.li, joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, nouveau, freedreno,
	Ville Syrjälä

On Fri, 10 Jan 2020, Thomas Zimmermann <tzimmermann@suse.de> wrote:
> Hi
>
> Am 10.01.20 um 12:59 schrieb Jani Nikula:
>> On Fri, 10 Jan 2020, Thomas Zimmermann <tzimmermann@suse.de> wrote:
>>> The callback struct drm_driver.get_scanout_position() is deprecated in
>>> favor of struct drm_crtc_helper_funcs.get_scanout_position().
>>>
>>> i915 doesn't use CRTC helpers. The patch duplicates the caller
>>> drm_calc_vbltimestamp_from_scanoutpos() for i915, such that the callback
>>> function is not needed.
>>>
>>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>>> ---
>>>  drivers/gpu/drm/i915/i915_drv.c |   3 +-
>>>  drivers/gpu/drm/i915/i915_irq.c | 117 ++++++++++++++++++++++++++++++--
>>>  drivers/gpu/drm/i915/i915_irq.h |   9 +--
>>>  3 files changed, 119 insertions(+), 10 deletions(-)
>> 
>> Not really enthusiastic about the diffstat in a "cleanup" series.
>
> Well, the cleanup is about the content of drm_driver :)
>
>> 
>> I wonder if you could add a generic helper version of
>> drm_calc_vbltimestamp_from_scanoutpos where you pass the
>> get_scanout_position function as a parameter. Both
>> drm_calc_vbltimestamp_from_scanoutpos and the new
>> i915_calc_vbltimestamp_from_scanoutpos would then be fairly thin
>> wrappers passing in the relevant get_scanout_position function.
>
> Of course. Will be in v2 of the series.

Please give Ville (Cc'd) a moment before sending v2 in case he wants to
chime in on this.

Thanks,
Jani.


>
> Best regards
> Thomas
>
>> 
>> This would reduce the almost identical duplication of the function in
>> i915.
>> 
>> BR,
>> Jani.
>> 
>>>
>>> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
>>> index f7385abdd74b..4a0a7fb85c53 100644
>>> --- a/drivers/gpu/drm/i915/i915_drv.c
>>> +++ b/drivers/gpu/drm/i915/i915_drv.c
>>> @@ -2769,8 +2769,7 @@ static struct drm_driver driver = {
>>>  	.gem_prime_export = i915_gem_prime_export,
>>>  	.gem_prime_import = i915_gem_prime_import,
>>>  
>>> -	.get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
>>> -	.get_scanout_position = i915_get_crtc_scanoutpos,
>>> +	.get_vblank_timestamp = i915_calc_vbltimestamp_from_scanoutpos,
>>>  
>>>  	.dumb_create = i915_gem_dumb_create,
>>>  	.dumb_map_offset = i915_gem_dumb_mmap_offset,
>>> diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
>>> index afc6aad9bf8c..99d0c3b0feae 100644
>>> --- a/drivers/gpu/drm/i915/i915_irq.c
>>> +++ b/drivers/gpu/drm/i915/i915_irq.c
>>> @@ -52,6 +52,11 @@
>>>  #include "i915_trace.h"
>>>  #include "intel_pm.h"
>>>  
>>> +/* Retry timestamp calculation up to 3 times to satisfy
>>> + * drm_timestamp_precision before giving up.
>>> + */
>>> +#define I915_TIMESTAMP_MAXRETRIES 3
>>> +
>>>  /**
>>>   * DOC: interrupt handling
>>>   *
>>> @@ -762,10 +767,11 @@ static int __intel_get_crtc_scanline(struct intel_crtc *crtc)
>>>  	return (position + crtc->scanline_offset) % vtotal;
>>>  }
>>>  
>>> -bool i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int index,
>>> -			      bool in_vblank_irq, int *vpos, int *hpos,
>>> -			      ktime_t *stime, ktime_t *etime,
>>> -			      const struct drm_display_mode *mode)
>>> +static bool i915_get_crtc_scanoutpos(struct drm_device *dev,
>>> +				     unsigned int index, bool in_vblank_irq,
>>> +				     int *vpos, int *hpos,
>>> +				     ktime_t *stime, ktime_t *etime,
>>> +				     const struct drm_display_mode *mode)
>>>  {
>>>  	struct drm_i915_private *dev_priv = to_i915(dev);
>>>  	struct intel_crtc *crtc = to_intel_crtc(drm_crtc_from_index(dev, index));
>>> @@ -879,6 +885,109 @@ bool i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int index,
>>>  	return true;
>>>  }
>>>  
>>> +bool i915_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
>>> +					    unsigned int pipe,
>>> +					    int *max_error,
>>> +					    ktime_t *vblank_time,
>>> +					    bool in_vblank_irq)
>>> +{
>>> +	struct timespec64 ts_etime, ts_vblank_time;
>>> +	ktime_t stime, etime;
>>> +	bool vbl_status;
>>> +	struct drm_crtc *crtc;
>>> +	const struct drm_display_mode *mode;
>>> +	struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
>>> +	int vpos, hpos, i;
>>> +	int delta_ns, duration_ns;
>>> +
>>> +	crtc = drm_crtc_from_index(dev, pipe);
>>> +
>>> +	if (pipe >= dev->num_crtcs || !crtc) {
>>> +		DRM_ERROR("Invalid crtc %u\n", pipe);
>>> +		return false;
>>> +	}
>>> +
>>> +	if (drm_drv_uses_atomic_modeset(dev))
>>> +		mode = &vblank->hwmode;
>>> +	else
>>> +		mode = &crtc->hwmode;
>>> +
>>> +	/* If mode timing undefined, just return as no-op:
>>> +	 * Happens during initial modesetting of a crtc.
>>> +	 */
>>> +	if (mode->crtc_clock == 0) {
>>> +		DRM_DEBUG("crtc %u: Noop due to uninitialized mode.\n", pipe);
>>> +		WARN_ON_ONCE(drm_drv_uses_atomic_modeset(dev));
>>> +
>>> +		return false;
>>> +	}
>>> +
>>> +	/* Get current scanout position with system timestamp.
>>> +	 * Repeat query up to DRM_TIMESTAMP_MAXRETRIES times
>>> +	 * if single query takes longer than max_error nanoseconds.
>>> +	 *
>>> +	 * This guarantees a tight bound on maximum error if
>>> +	 * code gets preempted or delayed for some reason.
>>> +	 */
>>> +	for (i = 0; i < I915_TIMESTAMP_MAXRETRIES; i++) {
>>> +		/*
>>> +		 * Get vertical and horizontal scanout position vpos, hpos,
>>> +		 * and bounding timestamps stime, etime, pre/post query.
>>> +		 */
>>> +		vbl_status = i915_get_crtc_scanoutpos(dev, pipe, in_vblank_irq,
>>> +						      &vpos, &hpos, &stime,
>>> +						      &etime, mode);
>>> +		/* Return as no-op if scanout query unsupported or failed. */
>>> +		if (!vbl_status) {
>>> +			DRM_DEBUG("crtc %u : scanoutpos query failed.\n",
>>> +				  pipe);
>>> +			return false;
>>> +		}
>>> +
>>> +		/* Compute uncertainty in timestamp of scanout position query. */
>>> +		duration_ns = ktime_to_ns(etime) - ktime_to_ns(stime);
>>> +
>>> +		/* Accept result with <  max_error nsecs timing uncertainty. */
>>> +		if (duration_ns <= *max_error)
>>> +			break;
>>> +	}
>>> +
>>> +	/* Noisy system timing? */
>>> +	if (i == I915_TIMESTAMP_MAXRETRIES) {
>>> +		DRM_DEBUG("crtc %u: Noisy timestamp %d us > %d us [%d reps].\n",
>>> +			  pipe, duration_ns/1000, *max_error/1000, i);
>>> +	}
>>> +
>>> +	/* Return upper bound of timestamp precision error. */
>>> +	*max_error = duration_ns;
>>> +
>>> +	/* Convert scanout position into elapsed time at raw_time query
>>> +	 * since start of scanout at first display scanline. delta_ns
>>> +	 * can be negative if start of scanout hasn't happened yet.
>>> +	 */
>>> +	delta_ns = div_s64(1000000LL * (vpos * mode->crtc_htotal + hpos),
>>> +			   mode->crtc_clock);
>>> +
>>> +	/* Subtract time delta from raw timestamp to get final
>>> +	 * vblank_time timestamp for end of vblank.
>>> +	 */
>>> +	*vblank_time = ktime_sub_ns(etime, delta_ns);
>>> +
>>> +	if (!drm_debug_enabled(DRM_UT_VBL))
>>> +		return true;
>>> +
>>> +	ts_etime = ktime_to_timespec64(etime);
>>> +	ts_vblank_time = ktime_to_timespec64(*vblank_time);
>>> +
>>> +	DRM_DEBUG_VBL("crtc %u : v p(%d,%d)@ %lld.%06ld -> %lld.%06ld [e %d us, %d rep]\n",
>>> +		      pipe, hpos, vpos,
>>> +		      (u64)ts_etime.tv_sec, ts_etime.tv_nsec / 1000,
>>> +		      (u64)ts_vblank_time.tv_sec, ts_vblank_time.tv_nsec / 1000,
>>> +		      duration_ns / 1000, i);
>>> +
>>> +	return true;
>>> +}
>>> +
>>>  int intel_get_crtc_scanline(struct intel_crtc *crtc)
>>>  {
>>>  	struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
>>> diff --git a/drivers/gpu/drm/i915/i915_irq.h b/drivers/gpu/drm/i915/i915_irq.h
>>> index 812c47a9c2d6..5f7b133ce721 100644
>>> --- a/drivers/gpu/drm/i915/i915_irq.h
>>> +++ b/drivers/gpu/drm/i915/i915_irq.h
>>> @@ -101,10 +101,11 @@ void gen8_irq_power_well_post_enable(struct drm_i915_private *dev_priv,
>>>  void gen8_irq_power_well_pre_disable(struct drm_i915_private *dev_priv,
>>>  				     u8 pipe_mask);
>>>  
>>> -bool i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe,
>>> -			      bool in_vblank_irq, int *vpos, int *hpos,
>>> -			      ktime_t *stime, ktime_t *etime,
>>> -			      const struct drm_display_mode *mode);
>>> +bool i915_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
>>> +					    unsigned int pipe,
>>> +					    int *max_error,
>>> +					    ktime_t *vblank_time,
>>> +					    bool in_vblank_irq);
>>>  
>>>  u32 i915_get_vblank_counter(struct drm_crtc *crtc);
>>>  u32 g4x_get_vblank_counter(struct drm_crtc *crtc);
>> 

-- 
Jani Nikula, Intel Open Source Graphics Center

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [PATCH 03/23] drm/i915: Don't use struct drm_driver.get_scanout_position()
@ 2020-01-10 13:56         ` Jani Nikula
  0 siblings, 0 replies; 217+ messages in thread
From: Jani Nikula @ 2020-01-10 13:56 UTC (permalink / raw)
  To: Thomas Zimmermann, airlied, daniel, alexander.deucher,
	christian.koenig, David1.Zhou, maarten.lankhorst,
	patrik.r.jakobsson, robdclark, sean, benjamin.gaignard,
	vincent.abriou, yannick.fertre, philippe.cornu, mcoquelin.stm32,
	alexandre.torgue, eric, rodrigosiqueiramelo, hamohammed.sa,
	linux-graphics-maintainer, thellstrom, bskeggs, harry.wentland,
	sunpeng.li, joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, dri-devel, amd-gfx, nouveau, freedreno

On Fri, 10 Jan 2020, Thomas Zimmermann <tzimmermann@suse.de> wrote:
> Hi
>
> Am 10.01.20 um 12:59 schrieb Jani Nikula:
>> On Fri, 10 Jan 2020, Thomas Zimmermann <tzimmermann@suse.de> wrote:
>>> The callback struct drm_driver.get_scanout_position() is deprecated in
>>> favor of struct drm_crtc_helper_funcs.get_scanout_position().
>>>
>>> i915 doesn't use CRTC helpers. The patch duplicates the caller
>>> drm_calc_vbltimestamp_from_scanoutpos() for i915, such that the callback
>>> function is not needed.
>>>
>>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>>> ---
>>>  drivers/gpu/drm/i915/i915_drv.c |   3 +-
>>>  drivers/gpu/drm/i915/i915_irq.c | 117 ++++++++++++++++++++++++++++++--
>>>  drivers/gpu/drm/i915/i915_irq.h |   9 +--
>>>  3 files changed, 119 insertions(+), 10 deletions(-)
>> 
>> Not really enthusiastic about the diffstat in a "cleanup" series.
>
> Well, the cleanup is about the content of drm_driver :)
>
>> 
>> I wonder if you could add a generic helper version of
>> drm_calc_vbltimestamp_from_scanoutpos where you pass the
>> get_scanout_position function as a parameter. Both
>> drm_calc_vbltimestamp_from_scanoutpos and the new
>> i915_calc_vbltimestamp_from_scanoutpos would then be fairly thin
>> wrappers passing in the relevant get_scanout_position function.
>
> Of course. Will be in v2 of the series.

Please give Ville (Cc'd) a moment before sending v2 in case he wants to
chime in on this.

Thanks,
Jani.


>
> Best regards
> Thomas
>
>> 
>> This would reduce the almost identical duplication of the function in
>> i915.
>> 
>> BR,
>> Jani.
>> 
>>>
>>> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
>>> index f7385abdd74b..4a0a7fb85c53 100644
>>> --- a/drivers/gpu/drm/i915/i915_drv.c
>>> +++ b/drivers/gpu/drm/i915/i915_drv.c
>>> @@ -2769,8 +2769,7 @@ static struct drm_driver driver = {
>>>  	.gem_prime_export = i915_gem_prime_export,
>>>  	.gem_prime_import = i915_gem_prime_import,
>>>  
>>> -	.get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
>>> -	.get_scanout_position = i915_get_crtc_scanoutpos,
>>> +	.get_vblank_timestamp = i915_calc_vbltimestamp_from_scanoutpos,
>>>  
>>>  	.dumb_create = i915_gem_dumb_create,
>>>  	.dumb_map_offset = i915_gem_dumb_mmap_offset,
>>> diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
>>> index afc6aad9bf8c..99d0c3b0feae 100644
>>> --- a/drivers/gpu/drm/i915/i915_irq.c
>>> +++ b/drivers/gpu/drm/i915/i915_irq.c
>>> @@ -52,6 +52,11 @@
>>>  #include "i915_trace.h"
>>>  #include "intel_pm.h"
>>>  
>>> +/* Retry timestamp calculation up to 3 times to satisfy
>>> + * drm_timestamp_precision before giving up.
>>> + */
>>> +#define I915_TIMESTAMP_MAXRETRIES 3
>>> +
>>>  /**
>>>   * DOC: interrupt handling
>>>   *
>>> @@ -762,10 +767,11 @@ static int __intel_get_crtc_scanline(struct intel_crtc *crtc)
>>>  	return (position + crtc->scanline_offset) % vtotal;
>>>  }
>>>  
>>> -bool i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int index,
>>> -			      bool in_vblank_irq, int *vpos, int *hpos,
>>> -			      ktime_t *stime, ktime_t *etime,
>>> -			      const struct drm_display_mode *mode)
>>> +static bool i915_get_crtc_scanoutpos(struct drm_device *dev,
>>> +				     unsigned int index, bool in_vblank_irq,
>>> +				     int *vpos, int *hpos,
>>> +				     ktime_t *stime, ktime_t *etime,
>>> +				     const struct drm_display_mode *mode)
>>>  {
>>>  	struct drm_i915_private *dev_priv = to_i915(dev);
>>>  	struct intel_crtc *crtc = to_intel_crtc(drm_crtc_from_index(dev, index));
>>> @@ -879,6 +885,109 @@ bool i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int index,
>>>  	return true;
>>>  }
>>>  
>>> +bool i915_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
>>> +					    unsigned int pipe,
>>> +					    int *max_error,
>>> +					    ktime_t *vblank_time,
>>> +					    bool in_vblank_irq)
>>> +{
>>> +	struct timespec64 ts_etime, ts_vblank_time;
>>> +	ktime_t stime, etime;
>>> +	bool vbl_status;
>>> +	struct drm_crtc *crtc;
>>> +	const struct drm_display_mode *mode;
>>> +	struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
>>> +	int vpos, hpos, i;
>>> +	int delta_ns, duration_ns;
>>> +
>>> +	crtc = drm_crtc_from_index(dev, pipe);
>>> +
>>> +	if (pipe >= dev->num_crtcs || !crtc) {
>>> +		DRM_ERROR("Invalid crtc %u\n", pipe);
>>> +		return false;
>>> +	}
>>> +
>>> +	if (drm_drv_uses_atomic_modeset(dev))
>>> +		mode = &vblank->hwmode;
>>> +	else
>>> +		mode = &crtc->hwmode;
>>> +
>>> +	/* If mode timing undefined, just return as no-op:
>>> +	 * Happens during initial modesetting of a crtc.
>>> +	 */
>>> +	if (mode->crtc_clock == 0) {
>>> +		DRM_DEBUG("crtc %u: Noop due to uninitialized mode.\n", pipe);
>>> +		WARN_ON_ONCE(drm_drv_uses_atomic_modeset(dev));
>>> +
>>> +		return false;
>>> +	}
>>> +
>>> +	/* Get current scanout position with system timestamp.
>>> +	 * Repeat query up to DRM_TIMESTAMP_MAXRETRIES times
>>> +	 * if single query takes longer than max_error nanoseconds.
>>> +	 *
>>> +	 * This guarantees a tight bound on maximum error if
>>> +	 * code gets preempted or delayed for some reason.
>>> +	 */
>>> +	for (i = 0; i < I915_TIMESTAMP_MAXRETRIES; i++) {
>>> +		/*
>>> +		 * Get vertical and horizontal scanout position vpos, hpos,
>>> +		 * and bounding timestamps stime, etime, pre/post query.
>>> +		 */
>>> +		vbl_status = i915_get_crtc_scanoutpos(dev, pipe, in_vblank_irq,
>>> +						      &vpos, &hpos, &stime,
>>> +						      &etime, mode);
>>> +		/* Return as no-op if scanout query unsupported or failed. */
>>> +		if (!vbl_status) {
>>> +			DRM_DEBUG("crtc %u : scanoutpos query failed.\n",
>>> +				  pipe);
>>> +			return false;
>>> +		}
>>> +
>>> +		/* Compute uncertainty in timestamp of scanout position query. */
>>> +		duration_ns = ktime_to_ns(etime) - ktime_to_ns(stime);
>>> +
>>> +		/* Accept result with <  max_error nsecs timing uncertainty. */
>>> +		if (duration_ns <= *max_error)
>>> +			break;
>>> +	}
>>> +
>>> +	/* Noisy system timing? */
>>> +	if (i == I915_TIMESTAMP_MAXRETRIES) {
>>> +		DRM_DEBUG("crtc %u: Noisy timestamp %d us > %d us [%d reps].\n",
>>> +			  pipe, duration_ns/1000, *max_error/1000, i);
>>> +	}
>>> +
>>> +	/* Return upper bound of timestamp precision error. */
>>> +	*max_error = duration_ns;
>>> +
>>> +	/* Convert scanout position into elapsed time at raw_time query
>>> +	 * since start of scanout at first display scanline. delta_ns
>>> +	 * can be negative if start of scanout hasn't happened yet.
>>> +	 */
>>> +	delta_ns = div_s64(1000000LL * (vpos * mode->crtc_htotal + hpos),
>>> +			   mode->crtc_clock);
>>> +
>>> +	/* Subtract time delta from raw timestamp to get final
>>> +	 * vblank_time timestamp for end of vblank.
>>> +	 */
>>> +	*vblank_time = ktime_sub_ns(etime, delta_ns);
>>> +
>>> +	if (!drm_debug_enabled(DRM_UT_VBL))
>>> +		return true;
>>> +
>>> +	ts_etime = ktime_to_timespec64(etime);
>>> +	ts_vblank_time = ktime_to_timespec64(*vblank_time);
>>> +
>>> +	DRM_DEBUG_VBL("crtc %u : v p(%d,%d)@ %lld.%06ld -> %lld.%06ld [e %d us, %d rep]\n",
>>> +		      pipe, hpos, vpos,
>>> +		      (u64)ts_etime.tv_sec, ts_etime.tv_nsec / 1000,
>>> +		      (u64)ts_vblank_time.tv_sec, ts_vblank_time.tv_nsec / 1000,
>>> +		      duration_ns / 1000, i);
>>> +
>>> +	return true;
>>> +}
>>> +
>>>  int intel_get_crtc_scanline(struct intel_crtc *crtc)
>>>  {
>>>  	struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
>>> diff --git a/drivers/gpu/drm/i915/i915_irq.h b/drivers/gpu/drm/i915/i915_irq.h
>>> index 812c47a9c2d6..5f7b133ce721 100644
>>> --- a/drivers/gpu/drm/i915/i915_irq.h
>>> +++ b/drivers/gpu/drm/i915/i915_irq.h
>>> @@ -101,10 +101,11 @@ void gen8_irq_power_well_post_enable(struct drm_i915_private *dev_priv,
>>>  void gen8_irq_power_well_pre_disable(struct drm_i915_private *dev_priv,
>>>  				     u8 pipe_mask);
>>>  
>>> -bool i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe,
>>> -			      bool in_vblank_irq, int *vpos, int *hpos,
>>> -			      ktime_t *stime, ktime_t *etime,
>>> -			      const struct drm_display_mode *mode);
>>> +bool i915_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
>>> +					    unsigned int pipe,
>>> +					    int *max_error,
>>> +					    ktime_t *vblank_time,
>>> +					    bool in_vblank_irq);
>>>  
>>>  u32 i915_get_vblank_counter(struct drm_crtc *crtc);
>>>  u32 g4x_get_vblank_counter(struct drm_crtc *crtc);
>> 

-- 
Jani Nikula, Intel Open Source Graphics Center

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [PATCH 03/23] drm/i915: Don't use struct drm_driver.get_scanout_position()
@ 2020-01-10 13:56         ` Jani Nikula
  0 siblings, 0 replies; 217+ messages in thread
From: Jani Nikula @ 2020-01-10 13:56 UTC (permalink / raw)
  To: Thomas Zimmermann, airlied, daniel, alexander.deucher,
	christian.koenig, David1.Zhou, maarten.lankhorst,
	patrik.r.jakobsson, robdclark, sean, benjamin.gaignard,
	vincent.abriou, yannick.fertre, philippe.cornu, mcoquelin.stm32,
	alexandre.torgue, eric, rodrigosiqueiramelo, hamohammed.sa,
	linux-graphics-maintainer, thellstrom, bskeggs, harry.wentland,
	sunpeng.li, joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, dri-devel, amd-gfx, nouveau, freedreno

On Fri, 10 Jan 2020, Thomas Zimmermann <tzimmermann@suse.de> wrote:
> Hi
>
> Am 10.01.20 um 12:59 schrieb Jani Nikula:
>> On Fri, 10 Jan 2020, Thomas Zimmermann <tzimmermann@suse.de> wrote:
>>> The callback struct drm_driver.get_scanout_position() is deprecated in
>>> favor of struct drm_crtc_helper_funcs.get_scanout_position().
>>>
>>> i915 doesn't use CRTC helpers. The patch duplicates the caller
>>> drm_calc_vbltimestamp_from_scanoutpos() for i915, such that the callback
>>> function is not needed.
>>>
>>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>>> ---
>>>  drivers/gpu/drm/i915/i915_drv.c |   3 +-
>>>  drivers/gpu/drm/i915/i915_irq.c | 117 ++++++++++++++++++++++++++++++--
>>>  drivers/gpu/drm/i915/i915_irq.h |   9 +--
>>>  3 files changed, 119 insertions(+), 10 deletions(-)
>> 
>> Not really enthusiastic about the diffstat in a "cleanup" series.
>
> Well, the cleanup is about the content of drm_driver :)
>
>> 
>> I wonder if you could add a generic helper version of
>> drm_calc_vbltimestamp_from_scanoutpos where you pass the
>> get_scanout_position function as a parameter. Both
>> drm_calc_vbltimestamp_from_scanoutpos and the new
>> i915_calc_vbltimestamp_from_scanoutpos would then be fairly thin
>> wrappers passing in the relevant get_scanout_position function.
>
> Of course. Will be in v2 of the series.

Please give Ville (Cc'd) a moment before sending v2 in case he wants to
chime in on this.

Thanks,
Jani.


>
> Best regards
> Thomas
>
>> 
>> This would reduce the almost identical duplication of the function in
>> i915.
>> 
>> BR,
>> Jani.
>> 
>>>
>>> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
>>> index f7385abdd74b..4a0a7fb85c53 100644
>>> --- a/drivers/gpu/drm/i915/i915_drv.c
>>> +++ b/drivers/gpu/drm/i915/i915_drv.c
>>> @@ -2769,8 +2769,7 @@ static struct drm_driver driver = {
>>>  	.gem_prime_export = i915_gem_prime_export,
>>>  	.gem_prime_import = i915_gem_prime_import,
>>>  
>>> -	.get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
>>> -	.get_scanout_position = i915_get_crtc_scanoutpos,
>>> +	.get_vblank_timestamp = i915_calc_vbltimestamp_from_scanoutpos,
>>>  
>>>  	.dumb_create = i915_gem_dumb_create,
>>>  	.dumb_map_offset = i915_gem_dumb_mmap_offset,
>>> diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
>>> index afc6aad9bf8c..99d0c3b0feae 100644
>>> --- a/drivers/gpu/drm/i915/i915_irq.c
>>> +++ b/drivers/gpu/drm/i915/i915_irq.c
>>> @@ -52,6 +52,11 @@
>>>  #include "i915_trace.h"
>>>  #include "intel_pm.h"
>>>  
>>> +/* Retry timestamp calculation up to 3 times to satisfy
>>> + * drm_timestamp_precision before giving up.
>>> + */
>>> +#define I915_TIMESTAMP_MAXRETRIES 3
>>> +
>>>  /**
>>>   * DOC: interrupt handling
>>>   *
>>> @@ -762,10 +767,11 @@ static int __intel_get_crtc_scanline(struct intel_crtc *crtc)
>>>  	return (position + crtc->scanline_offset) % vtotal;
>>>  }
>>>  
>>> -bool i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int index,
>>> -			      bool in_vblank_irq, int *vpos, int *hpos,
>>> -			      ktime_t *stime, ktime_t *etime,
>>> -			      const struct drm_display_mode *mode)
>>> +static bool i915_get_crtc_scanoutpos(struct drm_device *dev,
>>> +				     unsigned int index, bool in_vblank_irq,
>>> +				     int *vpos, int *hpos,
>>> +				     ktime_t *stime, ktime_t *etime,
>>> +				     const struct drm_display_mode *mode)
>>>  {
>>>  	struct drm_i915_private *dev_priv = to_i915(dev);
>>>  	struct intel_crtc *crtc = to_intel_crtc(drm_crtc_from_index(dev, index));
>>> @@ -879,6 +885,109 @@ bool i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int index,
>>>  	return true;
>>>  }
>>>  
>>> +bool i915_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
>>> +					    unsigned int pipe,
>>> +					    int *max_error,
>>> +					    ktime_t *vblank_time,
>>> +					    bool in_vblank_irq)
>>> +{
>>> +	struct timespec64 ts_etime, ts_vblank_time;
>>> +	ktime_t stime, etime;
>>> +	bool vbl_status;
>>> +	struct drm_crtc *crtc;
>>> +	const struct drm_display_mode *mode;
>>> +	struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
>>> +	int vpos, hpos, i;
>>> +	int delta_ns, duration_ns;
>>> +
>>> +	crtc = drm_crtc_from_index(dev, pipe);
>>> +
>>> +	if (pipe >= dev->num_crtcs || !crtc) {
>>> +		DRM_ERROR("Invalid crtc %u\n", pipe);
>>> +		return false;
>>> +	}
>>> +
>>> +	if (drm_drv_uses_atomic_modeset(dev))
>>> +		mode = &vblank->hwmode;
>>> +	else
>>> +		mode = &crtc->hwmode;
>>> +
>>> +	/* If mode timing undefined, just return as no-op:
>>> +	 * Happens during initial modesetting of a crtc.
>>> +	 */
>>> +	if (mode->crtc_clock == 0) {
>>> +		DRM_DEBUG("crtc %u: Noop due to uninitialized mode.\n", pipe);
>>> +		WARN_ON_ONCE(drm_drv_uses_atomic_modeset(dev));
>>> +
>>> +		return false;
>>> +	}
>>> +
>>> +	/* Get current scanout position with system timestamp.
>>> +	 * Repeat query up to DRM_TIMESTAMP_MAXRETRIES times
>>> +	 * if single query takes longer than max_error nanoseconds.
>>> +	 *
>>> +	 * This guarantees a tight bound on maximum error if
>>> +	 * code gets preempted or delayed for some reason.
>>> +	 */
>>> +	for (i = 0; i < I915_TIMESTAMP_MAXRETRIES; i++) {
>>> +		/*
>>> +		 * Get vertical and horizontal scanout position vpos, hpos,
>>> +		 * and bounding timestamps stime, etime, pre/post query.
>>> +		 */
>>> +		vbl_status = i915_get_crtc_scanoutpos(dev, pipe, in_vblank_irq,
>>> +						      &vpos, &hpos, &stime,
>>> +						      &etime, mode);
>>> +		/* Return as no-op if scanout query unsupported or failed. */
>>> +		if (!vbl_status) {
>>> +			DRM_DEBUG("crtc %u : scanoutpos query failed.\n",
>>> +				  pipe);
>>> +			return false;
>>> +		}
>>> +
>>> +		/* Compute uncertainty in timestamp of scanout position query. */
>>> +		duration_ns = ktime_to_ns(etime) - ktime_to_ns(stime);
>>> +
>>> +		/* Accept result with <  max_error nsecs timing uncertainty. */
>>> +		if (duration_ns <= *max_error)
>>> +			break;
>>> +	}
>>> +
>>> +	/* Noisy system timing? */
>>> +	if (i == I915_TIMESTAMP_MAXRETRIES) {
>>> +		DRM_DEBUG("crtc %u: Noisy timestamp %d us > %d us [%d reps].\n",
>>> +			  pipe, duration_ns/1000, *max_error/1000, i);
>>> +	}
>>> +
>>> +	/* Return upper bound of timestamp precision error. */
>>> +	*max_error = duration_ns;
>>> +
>>> +	/* Convert scanout position into elapsed time at raw_time query
>>> +	 * since start of scanout at first display scanline. delta_ns
>>> +	 * can be negative if start of scanout hasn't happened yet.
>>> +	 */
>>> +	delta_ns = div_s64(1000000LL * (vpos * mode->crtc_htotal + hpos),
>>> +			   mode->crtc_clock);
>>> +
>>> +	/* Subtract time delta from raw timestamp to get final
>>> +	 * vblank_time timestamp for end of vblank.
>>> +	 */
>>> +	*vblank_time = ktime_sub_ns(etime, delta_ns);
>>> +
>>> +	if (!drm_debug_enabled(DRM_UT_VBL))
>>> +		return true;
>>> +
>>> +	ts_etime = ktime_to_timespec64(etime);
>>> +	ts_vblank_time = ktime_to_timespec64(*vblank_time);
>>> +
>>> +	DRM_DEBUG_VBL("crtc %u : v p(%d,%d)@ %lld.%06ld -> %lld.%06ld [e %d us, %d rep]\n",
>>> +		      pipe, hpos, vpos,
>>> +		      (u64)ts_etime.tv_sec, ts_etime.tv_nsec / 1000,
>>> +		      (u64)ts_vblank_time.tv_sec, ts_vblank_time.tv_nsec / 1000,
>>> +		      duration_ns / 1000, i);
>>> +
>>> +	return true;
>>> +}
>>> +
>>>  int intel_get_crtc_scanline(struct intel_crtc *crtc)
>>>  {
>>>  	struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
>>> diff --git a/drivers/gpu/drm/i915/i915_irq.h b/drivers/gpu/drm/i915/i915_irq.h
>>> index 812c47a9c2d6..5f7b133ce721 100644
>>> --- a/drivers/gpu/drm/i915/i915_irq.h
>>> +++ b/drivers/gpu/drm/i915/i915_irq.h
>>> @@ -101,10 +101,11 @@ void gen8_irq_power_well_post_enable(struct drm_i915_private *dev_priv,
>>>  void gen8_irq_power_well_pre_disable(struct drm_i915_private *dev_priv,
>>>  				     u8 pipe_mask);
>>>  
>>> -bool i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe,
>>> -			      bool in_vblank_irq, int *vpos, int *hpos,
>>> -			      ktime_t *stime, ktime_t *etime,
>>> -			      const struct drm_display_mode *mode);
>>> +bool i915_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
>>> +					    unsigned int pipe,
>>> +					    int *max_error,
>>> +					    ktime_t *vblank_time,
>>> +					    bool in_vblank_irq);
>>>  
>>>  u32 i915_get_vblank_counter(struct drm_crtc *crtc);
>>>  u32 g4x_get_vblank_counter(struct drm_crtc *crtc);
>> 

-- 
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [Intel-gfx] [PATCH 03/23] drm/i915: Don't use struct drm_driver.get_scanout_position()
@ 2020-01-10 13:56         ` Jani Nikula
  0 siblings, 0 replies; 217+ messages in thread
From: Jani Nikula @ 2020-01-10 13:56 UTC (permalink / raw)
  To: Thomas Zimmermann, airlied, daniel, alexander.deucher,
	christian.koenig, David1.Zhou, maarten.lankhorst,
	patrik.r.jakobsson, robdclark, sean, benjamin.gaignard,
	vincent.abriou, yannick.fertre, philippe.cornu, mcoquelin.stm32,
	alexandre.torgue, eric, rodrigosiqueiramelo, hamohammed.sa,
	linux-graphics-maintainer, thellstrom, bskeggs, harry.wentland,
	sunpeng.li, joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, dri-devel, amd-gfx, nouveau, freedreno

On Fri, 10 Jan 2020, Thomas Zimmermann <tzimmermann@suse.de> wrote:
> Hi
>
> Am 10.01.20 um 12:59 schrieb Jani Nikula:
>> On Fri, 10 Jan 2020, Thomas Zimmermann <tzimmermann@suse.de> wrote:
>>> The callback struct drm_driver.get_scanout_position() is deprecated in
>>> favor of struct drm_crtc_helper_funcs.get_scanout_position().
>>>
>>> i915 doesn't use CRTC helpers. The patch duplicates the caller
>>> drm_calc_vbltimestamp_from_scanoutpos() for i915, such that the callback
>>> function is not needed.
>>>
>>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>>> ---
>>>  drivers/gpu/drm/i915/i915_drv.c |   3 +-
>>>  drivers/gpu/drm/i915/i915_irq.c | 117 ++++++++++++++++++++++++++++++--
>>>  drivers/gpu/drm/i915/i915_irq.h |   9 +--
>>>  3 files changed, 119 insertions(+), 10 deletions(-)
>> 
>> Not really enthusiastic about the diffstat in a "cleanup" series.
>
> Well, the cleanup is about the content of drm_driver :)
>
>> 
>> I wonder if you could add a generic helper version of
>> drm_calc_vbltimestamp_from_scanoutpos where you pass the
>> get_scanout_position function as a parameter. Both
>> drm_calc_vbltimestamp_from_scanoutpos and the new
>> i915_calc_vbltimestamp_from_scanoutpos would then be fairly thin
>> wrappers passing in the relevant get_scanout_position function.
>
> Of course. Will be in v2 of the series.

Please give Ville (Cc'd) a moment before sending v2 in case he wants to
chime in on this.

Thanks,
Jani.


>
> Best regards
> Thomas
>
>> 
>> This would reduce the almost identical duplication of the function in
>> i915.
>> 
>> BR,
>> Jani.
>> 
>>>
>>> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
>>> index f7385abdd74b..4a0a7fb85c53 100644
>>> --- a/drivers/gpu/drm/i915/i915_drv.c
>>> +++ b/drivers/gpu/drm/i915/i915_drv.c
>>> @@ -2769,8 +2769,7 @@ static struct drm_driver driver = {
>>>  	.gem_prime_export = i915_gem_prime_export,
>>>  	.gem_prime_import = i915_gem_prime_import,
>>>  
>>> -	.get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
>>> -	.get_scanout_position = i915_get_crtc_scanoutpos,
>>> +	.get_vblank_timestamp = i915_calc_vbltimestamp_from_scanoutpos,
>>>  
>>>  	.dumb_create = i915_gem_dumb_create,
>>>  	.dumb_map_offset = i915_gem_dumb_mmap_offset,
>>> diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
>>> index afc6aad9bf8c..99d0c3b0feae 100644
>>> --- a/drivers/gpu/drm/i915/i915_irq.c
>>> +++ b/drivers/gpu/drm/i915/i915_irq.c
>>> @@ -52,6 +52,11 @@
>>>  #include "i915_trace.h"
>>>  #include "intel_pm.h"
>>>  
>>> +/* Retry timestamp calculation up to 3 times to satisfy
>>> + * drm_timestamp_precision before giving up.
>>> + */
>>> +#define I915_TIMESTAMP_MAXRETRIES 3
>>> +
>>>  /**
>>>   * DOC: interrupt handling
>>>   *
>>> @@ -762,10 +767,11 @@ static int __intel_get_crtc_scanline(struct intel_crtc *crtc)
>>>  	return (position + crtc->scanline_offset) % vtotal;
>>>  }
>>>  
>>> -bool i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int index,
>>> -			      bool in_vblank_irq, int *vpos, int *hpos,
>>> -			      ktime_t *stime, ktime_t *etime,
>>> -			      const struct drm_display_mode *mode)
>>> +static bool i915_get_crtc_scanoutpos(struct drm_device *dev,
>>> +				     unsigned int index, bool in_vblank_irq,
>>> +				     int *vpos, int *hpos,
>>> +				     ktime_t *stime, ktime_t *etime,
>>> +				     const struct drm_display_mode *mode)
>>>  {
>>>  	struct drm_i915_private *dev_priv = to_i915(dev);
>>>  	struct intel_crtc *crtc = to_intel_crtc(drm_crtc_from_index(dev, index));
>>> @@ -879,6 +885,109 @@ bool i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int index,
>>>  	return true;
>>>  }
>>>  
>>> +bool i915_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
>>> +					    unsigned int pipe,
>>> +					    int *max_error,
>>> +					    ktime_t *vblank_time,
>>> +					    bool in_vblank_irq)
>>> +{
>>> +	struct timespec64 ts_etime, ts_vblank_time;
>>> +	ktime_t stime, etime;
>>> +	bool vbl_status;
>>> +	struct drm_crtc *crtc;
>>> +	const struct drm_display_mode *mode;
>>> +	struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
>>> +	int vpos, hpos, i;
>>> +	int delta_ns, duration_ns;
>>> +
>>> +	crtc = drm_crtc_from_index(dev, pipe);
>>> +
>>> +	if (pipe >= dev->num_crtcs || !crtc) {
>>> +		DRM_ERROR("Invalid crtc %u\n", pipe);
>>> +		return false;
>>> +	}
>>> +
>>> +	if (drm_drv_uses_atomic_modeset(dev))
>>> +		mode = &vblank->hwmode;
>>> +	else
>>> +		mode = &crtc->hwmode;
>>> +
>>> +	/* If mode timing undefined, just return as no-op:
>>> +	 * Happens during initial modesetting of a crtc.
>>> +	 */
>>> +	if (mode->crtc_clock == 0) {
>>> +		DRM_DEBUG("crtc %u: Noop due to uninitialized mode.\n", pipe);
>>> +		WARN_ON_ONCE(drm_drv_uses_atomic_modeset(dev));
>>> +
>>> +		return false;
>>> +	}
>>> +
>>> +	/* Get current scanout position with system timestamp.
>>> +	 * Repeat query up to DRM_TIMESTAMP_MAXRETRIES times
>>> +	 * if single query takes longer than max_error nanoseconds.
>>> +	 *
>>> +	 * This guarantees a tight bound on maximum error if
>>> +	 * code gets preempted or delayed for some reason.
>>> +	 */
>>> +	for (i = 0; i < I915_TIMESTAMP_MAXRETRIES; i++) {
>>> +		/*
>>> +		 * Get vertical and horizontal scanout position vpos, hpos,
>>> +		 * and bounding timestamps stime, etime, pre/post query.
>>> +		 */
>>> +		vbl_status = i915_get_crtc_scanoutpos(dev, pipe, in_vblank_irq,
>>> +						      &vpos, &hpos, &stime,
>>> +						      &etime, mode);
>>> +		/* Return as no-op if scanout query unsupported or failed. */
>>> +		if (!vbl_status) {
>>> +			DRM_DEBUG("crtc %u : scanoutpos query failed.\n",
>>> +				  pipe);
>>> +			return false;
>>> +		}
>>> +
>>> +		/* Compute uncertainty in timestamp of scanout position query. */
>>> +		duration_ns = ktime_to_ns(etime) - ktime_to_ns(stime);
>>> +
>>> +		/* Accept result with <  max_error nsecs timing uncertainty. */
>>> +		if (duration_ns <= *max_error)
>>> +			break;
>>> +	}
>>> +
>>> +	/* Noisy system timing? */
>>> +	if (i == I915_TIMESTAMP_MAXRETRIES) {
>>> +		DRM_DEBUG("crtc %u: Noisy timestamp %d us > %d us [%d reps].\n",
>>> +			  pipe, duration_ns/1000, *max_error/1000, i);
>>> +	}
>>> +
>>> +	/* Return upper bound of timestamp precision error. */
>>> +	*max_error = duration_ns;
>>> +
>>> +	/* Convert scanout position into elapsed time at raw_time query
>>> +	 * since start of scanout at first display scanline. delta_ns
>>> +	 * can be negative if start of scanout hasn't happened yet.
>>> +	 */
>>> +	delta_ns = div_s64(1000000LL * (vpos * mode->crtc_htotal + hpos),
>>> +			   mode->crtc_clock);
>>> +
>>> +	/* Subtract time delta from raw timestamp to get final
>>> +	 * vblank_time timestamp for end of vblank.
>>> +	 */
>>> +	*vblank_time = ktime_sub_ns(etime, delta_ns);
>>> +
>>> +	if (!drm_debug_enabled(DRM_UT_VBL))
>>> +		return true;
>>> +
>>> +	ts_etime = ktime_to_timespec64(etime);
>>> +	ts_vblank_time = ktime_to_timespec64(*vblank_time);
>>> +
>>> +	DRM_DEBUG_VBL("crtc %u : v p(%d,%d)@ %lld.%06ld -> %lld.%06ld [e %d us, %d rep]\n",
>>> +		      pipe, hpos, vpos,
>>> +		      (u64)ts_etime.tv_sec, ts_etime.tv_nsec / 1000,
>>> +		      (u64)ts_vblank_time.tv_sec, ts_vblank_time.tv_nsec / 1000,
>>> +		      duration_ns / 1000, i);
>>> +
>>> +	return true;
>>> +}
>>> +
>>>  int intel_get_crtc_scanline(struct intel_crtc *crtc)
>>>  {
>>>  	struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
>>> diff --git a/drivers/gpu/drm/i915/i915_irq.h b/drivers/gpu/drm/i915/i915_irq.h
>>> index 812c47a9c2d6..5f7b133ce721 100644
>>> --- a/drivers/gpu/drm/i915/i915_irq.h
>>> +++ b/drivers/gpu/drm/i915/i915_irq.h
>>> @@ -101,10 +101,11 @@ void gen8_irq_power_well_post_enable(struct drm_i915_private *dev_priv,
>>>  void gen8_irq_power_well_pre_disable(struct drm_i915_private *dev_priv,
>>>  				     u8 pipe_mask);
>>>  
>>> -bool i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe,
>>> -			      bool in_vblank_irq, int *vpos, int *hpos,
>>> -			      ktime_t *stime, ktime_t *etime,
>>> -			      const struct drm_display_mode *mode);
>>> +bool i915_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
>>> +					    unsigned int pipe,
>>> +					    int *max_error,
>>> +					    ktime_t *vblank_time,
>>> +					    bool in_vblank_irq);
>>>  
>>>  u32 i915_get_vblank_counter(struct drm_crtc *crtc);
>>>  u32 g4x_get_vblank_counter(struct drm_crtc *crtc);
>> 

-- 
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [PATCH 03/23] drm/i915: Don't use struct drm_driver.get_scanout_position()
@ 2020-01-10 13:56         ` Jani Nikula
  0 siblings, 0 replies; 217+ messages in thread
From: Jani Nikula @ 2020-01-10 13:56 UTC (permalink / raw)
  To: Thomas Zimmermann, airlied, daniel, alexander.deucher,
	christian.koenig, David1.Zhou, maarten.lankhorst,
	patrik.r.jakobsson, robdclark, sean, benjamin.gaignard,
	vincent.abriou, yannick.fertre, philippe.cornu, mcoquelin.stm32,
	alexandre.torgue, eric, rodrigosiqueiramelo, hamohammed.sa,
	linux-graphics-maintainer, thellstrom, bskeggs, harry.wentland,
	sunpeng.li, joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, dri-devel, amd-gfx, nouveau, freedreno,
	Ville Syrjälä

On Fri, 10 Jan 2020, Thomas Zimmermann <tzimmermann@suse.de> wrote:
> Hi
>
> Am 10.01.20 um 12:59 schrieb Jani Nikula:
>> On Fri, 10 Jan 2020, Thomas Zimmermann <tzimmermann@suse.de> wrote:
>>> The callback struct drm_driver.get_scanout_position() is deprecated in
>>> favor of struct drm_crtc_helper_funcs.get_scanout_position().
>>>
>>> i915 doesn't use CRTC helpers. The patch duplicates the caller
>>> drm_calc_vbltimestamp_from_scanoutpos() for i915, such that the callback
>>> function is not needed.
>>>
>>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>>> ---
>>>  drivers/gpu/drm/i915/i915_drv.c |   3 +-
>>>  drivers/gpu/drm/i915/i915_irq.c | 117 ++++++++++++++++++++++++++++++--
>>>  drivers/gpu/drm/i915/i915_irq.h |   9 +--
>>>  3 files changed, 119 insertions(+), 10 deletions(-)
>> 
>> Not really enthusiastic about the diffstat in a "cleanup" series.
>
> Well, the cleanup is about the content of drm_driver :)
>
>> 
>> I wonder if you could add a generic helper version of
>> drm_calc_vbltimestamp_from_scanoutpos where you pass the
>> get_scanout_position function as a parameter. Both
>> drm_calc_vbltimestamp_from_scanoutpos and the new
>> i915_calc_vbltimestamp_from_scanoutpos would then be fairly thin
>> wrappers passing in the relevant get_scanout_position function.
>
> Of course. Will be in v2 of the series.

Please give Ville (Cc'd) a moment before sending v2 in case he wants to
chime in on this.

Thanks,
Jani.


>
> Best regards
> Thomas
>
>> 
>> This would reduce the almost identical duplication of the function in
>> i915.
>> 
>> BR,
>> Jani.
>> 
>>>
>>> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
>>> index f7385abdd74b..4a0a7fb85c53 100644
>>> --- a/drivers/gpu/drm/i915/i915_drv.c
>>> +++ b/drivers/gpu/drm/i915/i915_drv.c
>>> @@ -2769,8 +2769,7 @@ static struct drm_driver driver = {
>>>  	.gem_prime_export = i915_gem_prime_export,
>>>  	.gem_prime_import = i915_gem_prime_import,
>>>  
>>> -	.get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
>>> -	.get_scanout_position = i915_get_crtc_scanoutpos,
>>> +	.get_vblank_timestamp = i915_calc_vbltimestamp_from_scanoutpos,
>>>  
>>>  	.dumb_create = i915_gem_dumb_create,
>>>  	.dumb_map_offset = i915_gem_dumb_mmap_offset,
>>> diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
>>> index afc6aad9bf8c..99d0c3b0feae 100644
>>> --- a/drivers/gpu/drm/i915/i915_irq.c
>>> +++ b/drivers/gpu/drm/i915/i915_irq.c
>>> @@ -52,6 +52,11 @@
>>>  #include "i915_trace.h"
>>>  #include "intel_pm.h"
>>>  
>>> +/* Retry timestamp calculation up to 3 times to satisfy
>>> + * drm_timestamp_precision before giving up.
>>> + */
>>> +#define I915_TIMESTAMP_MAXRETRIES 3
>>> +
>>>  /**
>>>   * DOC: interrupt handling
>>>   *
>>> @@ -762,10 +767,11 @@ static int __intel_get_crtc_scanline(struct intel_crtc *crtc)
>>>  	return (position + crtc->scanline_offset) % vtotal;
>>>  }
>>>  
>>> -bool i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int index,
>>> -			      bool in_vblank_irq, int *vpos, int *hpos,
>>> -			      ktime_t *stime, ktime_t *etime,
>>> -			      const struct drm_display_mode *mode)
>>> +static bool i915_get_crtc_scanoutpos(struct drm_device *dev,
>>> +				     unsigned int index, bool in_vblank_irq,
>>> +				     int *vpos, int *hpos,
>>> +				     ktime_t *stime, ktime_t *etime,
>>> +				     const struct drm_display_mode *mode)
>>>  {
>>>  	struct drm_i915_private *dev_priv = to_i915(dev);
>>>  	struct intel_crtc *crtc = to_intel_crtc(drm_crtc_from_index(dev, index));
>>> @@ -879,6 +885,109 @@ bool i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int index,
>>>  	return true;
>>>  }
>>>  
>>> +bool i915_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
>>> +					    unsigned int pipe,
>>> +					    int *max_error,
>>> +					    ktime_t *vblank_time,
>>> +					    bool in_vblank_irq)
>>> +{
>>> +	struct timespec64 ts_etime, ts_vblank_time;
>>> +	ktime_t stime, etime;
>>> +	bool vbl_status;
>>> +	struct drm_crtc *crtc;
>>> +	const struct drm_display_mode *mode;
>>> +	struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
>>> +	int vpos, hpos, i;
>>> +	int delta_ns, duration_ns;
>>> +
>>> +	crtc = drm_crtc_from_index(dev, pipe);
>>> +
>>> +	if (pipe >= dev->num_crtcs || !crtc) {
>>> +		DRM_ERROR("Invalid crtc %u\n", pipe);
>>> +		return false;
>>> +	}
>>> +
>>> +	if (drm_drv_uses_atomic_modeset(dev))
>>> +		mode = &vblank->hwmode;
>>> +	else
>>> +		mode = &crtc->hwmode;
>>> +
>>> +	/* If mode timing undefined, just return as no-op:
>>> +	 * Happens during initial modesetting of a crtc.
>>> +	 */
>>> +	if (mode->crtc_clock == 0) {
>>> +		DRM_DEBUG("crtc %u: Noop due to uninitialized mode.\n", pipe);
>>> +		WARN_ON_ONCE(drm_drv_uses_atomic_modeset(dev));
>>> +
>>> +		return false;
>>> +	}
>>> +
>>> +	/* Get current scanout position with system timestamp.
>>> +	 * Repeat query up to DRM_TIMESTAMP_MAXRETRIES times
>>> +	 * if single query takes longer than max_error nanoseconds.
>>> +	 *
>>> +	 * This guarantees a tight bound on maximum error if
>>> +	 * code gets preempted or delayed for some reason.
>>> +	 */
>>> +	for (i = 0; i < I915_TIMESTAMP_MAXRETRIES; i++) {
>>> +		/*
>>> +		 * Get vertical and horizontal scanout position vpos, hpos,
>>> +		 * and bounding timestamps stime, etime, pre/post query.
>>> +		 */
>>> +		vbl_status = i915_get_crtc_scanoutpos(dev, pipe, in_vblank_irq,
>>> +						      &vpos, &hpos, &stime,
>>> +						      &etime, mode);
>>> +		/* Return as no-op if scanout query unsupported or failed. */
>>> +		if (!vbl_status) {
>>> +			DRM_DEBUG("crtc %u : scanoutpos query failed.\n",
>>> +				  pipe);
>>> +			return false;
>>> +		}
>>> +
>>> +		/* Compute uncertainty in timestamp of scanout position query. */
>>> +		duration_ns = ktime_to_ns(etime) - ktime_to_ns(stime);
>>> +
>>> +		/* Accept result with <  max_error nsecs timing uncertainty. */
>>> +		if (duration_ns <= *max_error)
>>> +			break;
>>> +	}
>>> +
>>> +	/* Noisy system timing? */
>>> +	if (i == I915_TIMESTAMP_MAXRETRIES) {
>>> +		DRM_DEBUG("crtc %u: Noisy timestamp %d us > %d us [%d reps].\n",
>>> +			  pipe, duration_ns/1000, *max_error/1000, i);
>>> +	}
>>> +
>>> +	/* Return upper bound of timestamp precision error. */
>>> +	*max_error = duration_ns;
>>> +
>>> +	/* Convert scanout position into elapsed time at raw_time query
>>> +	 * since start of scanout at first display scanline. delta_ns
>>> +	 * can be negative if start of scanout hasn't happened yet.
>>> +	 */
>>> +	delta_ns = div_s64(1000000LL * (vpos * mode->crtc_htotal + hpos),
>>> +			   mode->crtc_clock);
>>> +
>>> +	/* Subtract time delta from raw timestamp to get final
>>> +	 * vblank_time timestamp for end of vblank.
>>> +	 */
>>> +	*vblank_time = ktime_sub_ns(etime, delta_ns);
>>> +
>>> +	if (!drm_debug_enabled(DRM_UT_VBL))
>>> +		return true;
>>> +
>>> +	ts_etime = ktime_to_timespec64(etime);
>>> +	ts_vblank_time = ktime_to_timespec64(*vblank_time);
>>> +
>>> +	DRM_DEBUG_VBL("crtc %u : v p(%d,%d)@ %lld.%06ld -> %lld.%06ld [e %d us, %d rep]\n",
>>> +		      pipe, hpos, vpos,
>>> +		      (u64)ts_etime.tv_sec, ts_etime.tv_nsec / 1000,
>>> +		      (u64)ts_vblank_time.tv_sec, ts_vblank_time.tv_nsec / 1000,
>>> +		      duration_ns / 1000, i);
>>> +
>>> +	return true;
>>> +}
>>> +
>>>  int intel_get_crtc_scanline(struct intel_crtc *crtc)
>>>  {
>>>  	struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
>>> diff --git a/drivers/gpu/drm/i915/i915_irq.h b/drivers/gpu/drm/i915/i915_irq.h
>>> index 812c47a9c2d6..5f7b133ce721 100644
>>> --- a/drivers/gpu/drm/i915/i915_irq.h
>>> +++ b/drivers/gpu/drm/i915/i915_irq.h
>>> @@ -101,10 +101,11 @@ void gen8_irq_power_well_post_enable(struct drm_i915_private *dev_priv,
>>>  void gen8_irq_power_well_pre_disable(struct drm_i915_private *dev_priv,
>>>  				     u8 pipe_mask);
>>>  
>>> -bool i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe,
>>> -			      bool in_vblank_irq, int *vpos, int *hpos,
>>> -			      ktime_t *stime, ktime_t *etime,
>>> -			      const struct drm_display_mode *mode);
>>> +bool i915_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
>>> +					    unsigned int pipe,
>>> +					    int *max_error,
>>> +					    ktime_t *vblank_time,
>>> +					    bool in_vblank_irq);
>>>  
>>>  u32 i915_get_vblank_counter(struct drm_crtc *crtc);
>>>  u32 g4x_get_vblank_counter(struct drm_crtc *crtc);
>> 

-- 
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [PATCH 03/23] drm/i915: Don't use struct drm_driver.get_scanout_position()
  2020-01-10 13:56         ` Jani Nikula
                             ` (2 preceding siblings ...)
  (?)
@ 2020-01-10 15:25           ` Ville Syrjälä
  -1 siblings, 0 replies; 217+ messages in thread
From: Ville Syrjälä @ 2020-01-10 15:25 UTC (permalink / raw)
  To: Jani Nikula
  Cc: Thomas Zimmermann, airlied, daniel, alexander.deucher,
	christian.koenig, David1.Zhou, maarten.lankhorst,
	patrik.r.jakobsson, robdclark, sean, benjamin.gaignard,
	vincent.abriou, yannick.fertre, philippe.cornu, mcoquelin.stm32,
	alexandre.torgue, eric, rodrigosiqueiramelo, hamohammed.sa,
	linux-graphics-maintainer, thellstrom, bskeggs, harry.wentland,
	sunpeng.li, joonas.lahtinen, rodrigo.vivi, linux-arm-msm,
	intel-gfx, amd-gfx, dri-devel, nouveau, freedreno

On Fri, Jan 10, 2020 at 03:56:06PM +0200, Jani Nikula wrote:
> On Fri, 10 Jan 2020, Thomas Zimmermann <tzimmermann@suse.de> wrote:
> > Hi
> >
> > Am 10.01.20 um 12:59 schrieb Jani Nikula:
> >> On Fri, 10 Jan 2020, Thomas Zimmermann <tzimmermann@suse.de> wrote:
> >>> The callback struct drm_driver.get_scanout_position() is deprecated in
> >>> favor of struct drm_crtc_helper_funcs.get_scanout_position().
> >>>
> >>> i915 doesn't use CRTC helpers. The patch duplicates the caller
> >>> drm_calc_vbltimestamp_from_scanoutpos() for i915, such that the callback
> >>> function is not needed.
> >>>
> >>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> >>> ---
> >>>  drivers/gpu/drm/i915/i915_drv.c |   3 +-
> >>>  drivers/gpu/drm/i915/i915_irq.c | 117 ++++++++++++++++++++++++++++++--
> >>>  drivers/gpu/drm/i915/i915_irq.h |   9 +--
> >>>  3 files changed, 119 insertions(+), 10 deletions(-)
> >> 
> >> Not really enthusiastic about the diffstat in a "cleanup" series.
> >
> > Well, the cleanup is about the content of drm_driver :)
> >
> >> 
> >> I wonder if you could add a generic helper version of
> >> drm_calc_vbltimestamp_from_scanoutpos where you pass the
> >> get_scanout_position function as a parameter. Both
> >> drm_calc_vbltimestamp_from_scanoutpos and the new
> >> i915_calc_vbltimestamp_from_scanoutpos would then be fairly thin
> >> wrappers passing in the relevant get_scanout_position function.
> >
> > Of course. Will be in v2 of the series.
> 
> Please give Ville (Cc'd) a moment before sending v2 in case he wants to
> chime in on this.

Passing the function pointer was one option I considered for this a while
back. Can't remeber what other solutions I condsidered. But I guess I
didn't like any of them enough to make an actual patch.

-- 
Ville Syrjälä
Intel

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [PATCH 03/23] drm/i915: Don't use struct drm_driver.get_scanout_position()
@ 2020-01-10 15:25           ` Ville Syrjälä
  0 siblings, 0 replies; 217+ messages in thread
From: Ville Syrjälä @ 2020-01-10 15:25 UTC (permalink / raw)
  To: Jani Nikula
  Cc: hamohammed.sa, airlied, nouveau, dri-devel, eric, amd-gfx,
	benjamin.gaignard, alexandre.torgue, David1.Zhou, thellstrom,
	linux-graphics-maintainer, bskeggs, harry.wentland, sunpeng.li,
	linux-arm-msm, intel-gfx, vincent.abriou, mcoquelin.stm32,
	rodrigosiqueiramelo, philippe.cornu, yannick.fertre,
	Thomas Zimmermann, alexander.deucher, freedreno,
	christian.koenig

On Fri, Jan 10, 2020 at 03:56:06PM +0200, Jani Nikula wrote:
> On Fri, 10 Jan 2020, Thomas Zimmermann <tzimmermann@suse.de> wrote:
> > Hi
> >
> > Am 10.01.20 um 12:59 schrieb Jani Nikula:
> >> On Fri, 10 Jan 2020, Thomas Zimmermann <tzimmermann@suse.de> wrote:
> >>> The callback struct drm_driver.get_scanout_position() is deprecated in
> >>> favor of struct drm_crtc_helper_funcs.get_scanout_position().
> >>>
> >>> i915 doesn't use CRTC helpers. The patch duplicates the caller
> >>> drm_calc_vbltimestamp_from_scanoutpos() for i915, such that the callback
> >>> function is not needed.
> >>>
> >>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> >>> ---
> >>>  drivers/gpu/drm/i915/i915_drv.c |   3 +-
> >>>  drivers/gpu/drm/i915/i915_irq.c | 117 ++++++++++++++++++++++++++++++--
> >>>  drivers/gpu/drm/i915/i915_irq.h |   9 +--
> >>>  3 files changed, 119 insertions(+), 10 deletions(-)
> >> 
> >> Not really enthusiastic about the diffstat in a "cleanup" series.
> >
> > Well, the cleanup is about the content of drm_driver :)
> >
> >> 
> >> I wonder if you could add a generic helper version of
> >> drm_calc_vbltimestamp_from_scanoutpos where you pass the
> >> get_scanout_position function as a parameter. Both
> >> drm_calc_vbltimestamp_from_scanoutpos and the new
> >> i915_calc_vbltimestamp_from_scanoutpos would then be fairly thin
> >> wrappers passing in the relevant get_scanout_position function.
> >
> > Of course. Will be in v2 of the series.
> 
> Please give Ville (Cc'd) a moment before sending v2 in case he wants to
> chime in on this.

Passing the function pointer was one option I considered for this a while
back. Can't remeber what other solutions I condsidered. But I guess I
didn't like any of them enough to make an actual patch.

-- 
Ville Syrjälä
Intel

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [PATCH 03/23] drm/i915: Don't use struct drm_driver.get_scanout_position()
@ 2020-01-10 15:25           ` Ville Syrjälä
  0 siblings, 0 replies; 217+ messages in thread
From: Ville Syrjälä @ 2020-01-10 15:25 UTC (permalink / raw)
  To: Jani Nikula
  Cc: hamohammed.sa, airlied, nouveau, dri-devel, amd-gfx,
	alexandre.torgue, thellstrom, sean, linux-graphics-maintainer,
	bskeggs, sunpeng.li, linux-arm-msm, intel-gfx, rodrigo.vivi,
	vincent.abriou, mcoquelin.stm32, rodrigosiqueiramelo,
	philippe.cornu, yannick.fertre, Thomas Zimmermann,
	alexander.deucher, freedreno, christian.koenig

On Fri, Jan 10, 2020 at 03:56:06PM +0200, Jani Nikula wrote:
> On Fri, 10 Jan 2020, Thomas Zimmermann <tzimmermann@suse.de> wrote:
> > Hi
> >
> > Am 10.01.20 um 12:59 schrieb Jani Nikula:
> >> On Fri, 10 Jan 2020, Thomas Zimmermann <tzimmermann@suse.de> wrote:
> >>> The callback struct drm_driver.get_scanout_position() is deprecated in
> >>> favor of struct drm_crtc_helper_funcs.get_scanout_position().
> >>>
> >>> i915 doesn't use CRTC helpers. The patch duplicates the caller
> >>> drm_calc_vbltimestamp_from_scanoutpos() for i915, such that the callback
> >>> function is not needed.
> >>>
> >>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> >>> ---
> >>>  drivers/gpu/drm/i915/i915_drv.c |   3 +-
> >>>  drivers/gpu/drm/i915/i915_irq.c | 117 ++++++++++++++++++++++++++++++--
> >>>  drivers/gpu/drm/i915/i915_irq.h |   9 +--
> >>>  3 files changed, 119 insertions(+), 10 deletions(-)
> >> 
> >> Not really enthusiastic about the diffstat in a "cleanup" series.
> >
> > Well, the cleanup is about the content of drm_driver :)
> >
> >> 
> >> I wonder if you could add a generic helper version of
> >> drm_calc_vbltimestamp_from_scanoutpos where you pass the
> >> get_scanout_position function as a parameter. Both
> >> drm_calc_vbltimestamp_from_scanoutpos and the new
> >> i915_calc_vbltimestamp_from_scanoutpos would then be fairly thin
> >> wrappers passing in the relevant get_scanout_position function.
> >
> > Of course. Will be in v2 of the series.
> 
> Please give Ville (Cc'd) a moment before sending v2 in case he wants to
> chime in on this.

Passing the function pointer was one option I considered for this a while
back. Can't remeber what other solutions I condsidered. But I guess I
didn't like any of them enough to make an actual patch.

-- 
Ville Syrjälä
Intel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [Intel-gfx] [PATCH 03/23] drm/i915: Don't use struct drm_driver.get_scanout_position()
@ 2020-01-10 15:25           ` Ville Syrjälä
  0 siblings, 0 replies; 217+ messages in thread
From: Ville Syrjälä @ 2020-01-10 15:25 UTC (permalink / raw)
  To: Jani Nikula
  Cc: hamohammed.sa, airlied, nouveau, dri-devel, eric, amd-gfx,
	benjamin.gaignard, alexandre.torgue, David1.Zhou, thellstrom,
	linux-graphics-maintainer, bskeggs, harry.wentland, sunpeng.li,
	linux-arm-msm, intel-gfx, vincent.abriou, mcoquelin.stm32,
	rodrigosiqueiramelo, philippe.cornu, yannick.fertre,
	Thomas Zimmermann, alexander.deucher, freedreno,
	christian.koenig

On Fri, Jan 10, 2020 at 03:56:06PM +0200, Jani Nikula wrote:
> On Fri, 10 Jan 2020, Thomas Zimmermann <tzimmermann@suse.de> wrote:
> > Hi
> >
> > Am 10.01.20 um 12:59 schrieb Jani Nikula:
> >> On Fri, 10 Jan 2020, Thomas Zimmermann <tzimmermann@suse.de> wrote:
> >>> The callback struct drm_driver.get_scanout_position() is deprecated in
> >>> favor of struct drm_crtc_helper_funcs.get_scanout_position().
> >>>
> >>> i915 doesn't use CRTC helpers. The patch duplicates the caller
> >>> drm_calc_vbltimestamp_from_scanoutpos() for i915, such that the callback
> >>> function is not needed.
> >>>
> >>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> >>> ---
> >>>  drivers/gpu/drm/i915/i915_drv.c |   3 +-
> >>>  drivers/gpu/drm/i915/i915_irq.c | 117 ++++++++++++++++++++++++++++++--
> >>>  drivers/gpu/drm/i915/i915_irq.h |   9 +--
> >>>  3 files changed, 119 insertions(+), 10 deletions(-)
> >> 
> >> Not really enthusiastic about the diffstat in a "cleanup" series.
> >
> > Well, the cleanup is about the content of drm_driver :)
> >
> >> 
> >> I wonder if you could add a generic helper version of
> >> drm_calc_vbltimestamp_from_scanoutpos where you pass the
> >> get_scanout_position function as a parameter. Both
> >> drm_calc_vbltimestamp_from_scanoutpos and the new
> >> i915_calc_vbltimestamp_from_scanoutpos would then be fairly thin
> >> wrappers passing in the relevant get_scanout_position function.
> >
> > Of course. Will be in v2 of the series.
> 
> Please give Ville (Cc'd) a moment before sending v2 in case he wants to
> chime in on this.

Passing the function pointer was one option I considered for this a while
back. Can't remeber what other solutions I condsidered. But I guess I
didn't like any of them enough to make an actual patch.

-- 
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [PATCH 03/23] drm/i915: Don't use struct drm_driver.get_scanout_position()
@ 2020-01-10 15:25           ` Ville Syrjälä
  0 siblings, 0 replies; 217+ messages in thread
From: Ville Syrjälä @ 2020-01-10 15:25 UTC (permalink / raw)
  To: Jani Nikula
  Cc: hamohammed.sa, airlied, nouveau, joonas.lahtinen, dri-devel,
	eric, amd-gfx, benjamin.gaignard, alexandre.torgue, David1.Zhou,
	thellstrom, sean, patrik.r.jakobsson, linux-graphics-maintainer,
	bskeggs, harry.wentland, daniel, sunpeng.li, linux-arm-msm,
	intel-gfx, maarten.lankhorst, rodrigo.vivi, vincent.abriou,
	mcoquelin.stm32, rodrigosiqueiramelo, philippe.cornu,
	yannick.fertre, robdclark, Thomas Zimmermann, alexander.deucher,
	freedreno, christian.koenig

On Fri, Jan 10, 2020 at 03:56:06PM +0200, Jani Nikula wrote:
> On Fri, 10 Jan 2020, Thomas Zimmermann <tzimmermann@suse.de> wrote:
> > Hi
> >
> > Am 10.01.20 um 12:59 schrieb Jani Nikula:
> >> On Fri, 10 Jan 2020, Thomas Zimmermann <tzimmermann@suse.de> wrote:
> >>> The callback struct drm_driver.get_scanout_position() is deprecated in
> >>> favor of struct drm_crtc_helper_funcs.get_scanout_position().
> >>>
> >>> i915 doesn't use CRTC helpers. The patch duplicates the caller
> >>> drm_calc_vbltimestamp_from_scanoutpos() for i915, such that the callback
> >>> function is not needed.
> >>>
> >>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> >>> ---
> >>>  drivers/gpu/drm/i915/i915_drv.c |   3 +-
> >>>  drivers/gpu/drm/i915/i915_irq.c | 117 ++++++++++++++++++++++++++++++--
> >>>  drivers/gpu/drm/i915/i915_irq.h |   9 +--
> >>>  3 files changed, 119 insertions(+), 10 deletions(-)
> >> 
> >> Not really enthusiastic about the diffstat in a "cleanup" series.
> >
> > Well, the cleanup is about the content of drm_driver :)
> >
> >> 
> >> I wonder if you could add a generic helper version of
> >> drm_calc_vbltimestamp_from_scanoutpos where you pass the
> >> get_scanout_position function as a parameter. Both
> >> drm_calc_vbltimestamp_from_scanoutpos and the new
> >> i915_calc_vbltimestamp_from_scanoutpos would then be fairly thin
> >> wrappers passing in the relevant get_scanout_position function.
> >
> > Of course. Will be in v2 of the series.
> 
> Please give Ville (Cc'd) a moment before sending v2 in case he wants to
> chime in on this.

Passing the function pointer was one option I considered for this a while
back. Can't remeber what other solutions I condsidered. But I guess I
didn't like any of them enough to make an actual patch.

-- 
Ville Syrjälä
Intel
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [PATCH 23/23] drm: Cleanup VBLANK callbacks in struct drm_driver
@ 2020-01-12 22:53     ` Daniel Vetter
  0 siblings, 0 replies; 217+ messages in thread
From: Daniel Vetter @ 2020-01-12 22:53 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi, dri-devel, amd-gfx, intel-gfx,
	linux-arm-msm, freedreno, nouveau

On Fri, Jan 10, 2020 at 10:21:27AM +0100, Thomas Zimmermann wrote:
> All non-legacy users of VBLANK functions in struct drm_driver have been
> converted to use the respective interfaces in struct drm_crtc_funcs. The
> remaining users of VBLANK callbacks in struct drm_driver are legacy drivers
> with userspace modesetting.
> 
> There are no users left of get_vblank_timestamp(), so the callback is
> being removed. The other VBLANK callbacks are being moved to the legacy
> section at the end of struct drm_driver.
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>

I think sprinkling some WARN_ON (in drm_dev_register or wherever) if new
drivers try to use the legacy hooks would be really nice. Experience says
someone is going to copypaste this stuff around forever otherwise.

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

> ---
>  drivers/gpu/drm/drm_vblank.c |  39 +++++---------
>  include/drm/drm_drv.h        | 101 ++---------------------------------
>  2 files changed, 17 insertions(+), 123 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
> index 7cf436a4b908..ceff68474d4d 100644
> --- a/drivers/gpu/drm/drm_vblank.c
> +++ b/drivers/gpu/drm/drm_vblank.c
> @@ -138,10 +138,9 @@ static u32 __get_vblank_counter(struct drm_device *dev, unsigned int pipe)
>  
>  		if (crtc->funcs->get_vblank_counter)
>  			return crtc->funcs->get_vblank_counter(crtc);
> -	}
> -
> -	if (dev->driver->get_vblank_counter)
> +	} else if (dev->driver->get_vblank_counter) {
>  		return dev->driver->get_vblank_counter(dev, pipe);
> +	}
>  
>  	return drm_vblank_no_hw_counter(dev, pipe);
>  }
> @@ -334,8 +333,7 @@ u64 drm_crtc_accurate_vblank_count(struct drm_crtc *crtc)
>  	unsigned long flags;
>  
>  	WARN_ONCE(drm_debug_enabled(DRM_UT_VBL) &&
> -		  !crtc->funcs->get_vblank_timestamp &&
> -		  !dev->driver->get_vblank_timestamp,
> +		  !crtc->funcs->get_vblank_timestamp,
>  		  "This function requires support for accurate vblank timestamps.");
>  
>  	spin_lock_irqsave(&dev->vblank_time_lock, flags);
> @@ -357,13 +355,11 @@ static void __disable_vblank(struct drm_device *dev, unsigned int pipe)
>  		if (WARN_ON(!crtc))
>  			return;
>  
> -		if (crtc->funcs->disable_vblank) {
> +		if (crtc->funcs->disable_vblank)
>  			crtc->funcs->disable_vblank(crtc);
> -			return;
> -		}
> +	} else {
> +		dev->driver->disable_vblank(dev, pipe);
>  	}
> -
> -	dev->driver->disable_vblank(dev, pipe);
>  }
>  
>  /*
> @@ -791,9 +787,6 @@ drm_get_last_vbltimestamp(struct drm_device *dev, unsigned int pipe,
>  
>  		ret = crtc->funcs->get_vblank_timestamp(crtc, &max_error,
>  							tvblank, in_vblank_irq);
> -	} else if (dev->driver->get_vblank_timestamp && (max_error > 0)) {
> -		ret = dev->driver->get_vblank_timestamp(dev, pipe, &max_error,
> -							tvblank, in_vblank_irq);
>  	}
>  
>  	/* GPU high precision timestamp query unsupported or failed.
> @@ -1016,9 +1009,11 @@ static int __enable_vblank(struct drm_device *dev, unsigned int pipe)
>  
>  		if (crtc->funcs->enable_vblank)
>  			return crtc->funcs->enable_vblank(crtc);
> +	} else if (dev->driver->enable_vblank) {
> +		return dev->driver->enable_vblank(dev, pipe);
>  	}
>  
> -	return dev->driver->enable_vblank(dev, pipe);
> +	return -EINVAL;
>  }
>  
>  static int drm_vblank_enable(struct drm_device *dev, unsigned int pipe)
> @@ -1109,13 +1104,10 @@ static bool __vblank_disable_immediate(struct drm_device *dev, unsigned int pipe
>  		return false;
>  
>  	crtc = drm_crtc_from_index(dev, pipe);
> -	if (crtc && crtc->funcs->get_vblank_timestamp)
> -		return true;
> -
> -	if (dev->driver->get_vblank_timestamp)
> -		return true;
> +	if (!crtc || !crtc->funcs->get_vblank_timestamp)
> +		return false;
>  
> -	return false;
> +	return true;
>  }
>  
>  static void drm_vblank_put(struct drm_device *dev, unsigned int pipe)
> @@ -1798,7 +1790,6 @@ static void drm_handle_vblank_events(struct drm_device *dev, unsigned int pipe)
>  	struct drm_pending_vblank_event *e, *t;
>  	ktime_t now;
>  	u64 seq;
> -	bool high_prec;
>  
>  	assert_spin_locked(&dev->event_lock);
>  
> @@ -1818,10 +1809,8 @@ static void drm_handle_vblank_events(struct drm_device *dev, unsigned int pipe)
>  		send_vblank_event(dev, e, seq, now);
>  	}
>  
> -	high_prec = crtc->funcs->get_vblank_timestamp ||
> -		    dev->driver->get_vblank_timestamp;
> -
> -	trace_drm_vblank_event(pipe, seq, now, high_prec);
> +	trace_drm_vblank_event(pipe, seq, now,
> +			       crtc->funcs->get_vblank_timestamp != NULL);
>  }
>  
>  /**
> diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
> index b704e252f3b2..e290b3aca6eb 100644
> --- a/include/drm/drm_drv.h
> +++ b/include/drm/drm_drv.h
> @@ -268,104 +268,6 @@ struct drm_driver {
>  	 */
>  	void (*release) (struct drm_device *);
>  
> -	/**
> -	 * @get_vblank_counter:
> -	 *
> -	 * Driver callback for fetching a raw hardware vblank counter for the
> -	 * CRTC specified with the pipe argument.  If a device doesn't have a
> -	 * hardware counter, the driver can simply leave the hook as NULL.
> -	 * The DRM core will account for missed vblank events while interrupts
> -	 * where disabled based on system timestamps.
> -	 *
> -	 * Wraparound handling and loss of events due to modesetting is dealt
> -	 * with in the DRM core code, as long as drivers call
> -	 * drm_crtc_vblank_off() and drm_crtc_vblank_on() when disabling or
> -	 * enabling a CRTC.
> -	 *
> -	 * This is deprecated and should not be used by new drivers.
> -	 * Use &drm_crtc_funcs.get_vblank_counter instead.
> -	 *
> -	 * Returns:
> -	 *
> -	 * Raw vblank counter value.
> -	 */
> -	u32 (*get_vblank_counter) (struct drm_device *dev, unsigned int pipe);
> -
> -	/**
> -	 * @enable_vblank:
> -	 *
> -	 * Enable vblank interrupts for the CRTC specified with the pipe
> -	 * argument.
> -	 *
> -	 * This is deprecated and should not be used by new drivers.
> -	 * Use &drm_crtc_funcs.enable_vblank instead.
> -	 *
> -	 * Returns:
> -	 *
> -	 * Zero on success, appropriate errno if the given @crtc's vblank
> -	 * interrupt cannot be enabled.
> -	 */
> -	int (*enable_vblank) (struct drm_device *dev, unsigned int pipe);
> -
> -	/**
> -	 * @disable_vblank:
> -	 *
> -	 * Disable vblank interrupts for the CRTC specified with the pipe
> -	 * argument.
> -	 *
> -	 * This is deprecated and should not be used by new drivers.
> -	 * Use &drm_crtc_funcs.disable_vblank instead.
> -	 */
> -	void (*disable_vblank) (struct drm_device *dev, unsigned int pipe);
> -
> -	/**
> -	 * @get_vblank_timestamp:
> -	 *
> -	 * Called by drm_get_last_vbltimestamp(). Should return a precise
> -	 * timestamp when the most recent VBLANK interval ended or will end.
> -	 *
> -	 * Specifically, the timestamp in @vblank_time should correspond as
> -	 * closely as possible to the time when the first video scanline of
> -	 * the video frame after the end of VBLANK will start scanning out,
> -	 * the time immediately after end of the VBLANK interval. If the
> -	 * @crtc is currently inside VBLANK, this will be a time in the future.
> -	 * If the @crtc is currently scanning out a frame, this will be the
> -	 * past start time of the current scanout. This is meant to adhere
> -	 * to the OpenML OML_sync_control extension specification.
> -	 *
> -	 * Paramters:
> -	 *
> -	 * dev:
> -	 *     dev DRM device handle.
> -	 * pipe:
> -	 *     crtc for which timestamp should be returned.
> -	 * max_error:
> -	 *     Maximum allowable timestamp error in nanoseconds.
> -	 *     Implementation should strive to provide timestamp
> -	 *     with an error of at most max_error nanoseconds.
> -	 *     Returns true upper bound on error for timestamp.
> -	 * vblank_time:
> -	 *     Target location for returned vblank timestamp.
> -	 * in_vblank_irq:
> -	 *     True when called from drm_crtc_handle_vblank().  Some drivers
> -	 *     need to apply some workarounds for gpu-specific vblank irq quirks
> -	 *     if flag is set.
> -	 *
> -	 * Returns:
> -	 *
> -	 * True on success, false on failure, which means the core should
> -	 * fallback to a simple timestamp taken in drm_crtc_handle_vblank().
> -	 *
> -	 * FIXME:
> -	 *
> -	 * We should move this hook to &struct drm_crtc_funcs like all the other
> -	 * vblank hooks.
> -	 */
> -	bool (*get_vblank_timestamp) (struct drm_device *dev, unsigned int pipe,
> -				     int *max_error,
> -				     ktime_t *vblank_time,
> -				     bool in_vblank_irq);
> -
>  	/**
>  	 * @irq_handler:
>  	 *
> @@ -720,6 +622,9 @@ struct drm_driver {
>  	int (*dma_ioctl) (struct drm_device *dev, void *data, struct drm_file *file_priv);
>  	int (*dma_quiescent) (struct drm_device *);
>  	int (*context_dtor) (struct drm_device *dev, int context);
> +	u32 (*get_vblank_counter)(struct drm_device *dev, unsigned int pipe);
> +	int (*enable_vblank)(struct drm_device *dev, unsigned int pipe);
> +	void (*disable_vblank)(struct drm_device *dev, unsigned int pipe);
>  	int dev_priv_size;
>  };
>  
> -- 
> 2.24.1
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [PATCH 23/23] drm: Cleanup VBLANK callbacks in struct drm_driver
@ 2020-01-12 22:53     ` Daniel Vetter
  0 siblings, 0 replies; 217+ messages in thread
From: Daniel Vetter @ 2020-01-12 22:53 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: hamohammed.sa-Re5JQEeQqe8AvxtiuMwx3w, airlied-cv59FeDIM0c,
	nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	joonas.lahtinen-VuQAYsv1563Yd54FQh9/CA,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	eric-WhKQ6XTQaPysTnJN9+BGXg,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	benjamin.gaignard-QSEj5FYQhm4dnm+yROfE0A,
	alexandre.torgue-qxv4g6HH51o, David1.Zhou-5C7GfCeVMHo,
	thellstrom-pghWNbHTmq7QT0dZR+AlfA, sean-p7yTbzM4H96eqtR555YLDQ,
	patrik.r.jakobsson-Re5JQEeQqe8AvxtiuMwx3w,
	linux-graphics-maintainer-pghWNbHTmq7QT0dZR+AlfA,
	bskeggs-H+wXaHxf7aLQT0dZR+AlfA, harry.wentland-5C7GfCeVMHo,
	mcoquelin.stm32-Re5JQEeQqe8AvxtiuMwx3w, sunpeng.li-5C7GfCeVMHo,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA,
	intel-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	maarten.lankhorst-VuQAYsv1563Yd54FQh9/CA,
	jani.nikula-VuQAYsv1563Yd54FQh9/CA,
	rodrigo.vivi-ral2JQCrhuEAvxtiuMwx3w, vincent.abriou-qxv4g6HH51o,
	rodrigosiqueiramelo-Re5JQEeQqe8AvxtiuMwx3w,
	philippe.cornu-qxv4g6HH51o, yannick.fertre-qxv4g6HH51o,
	robdclark-Re5JQEeQqe8AvxtiuMwx3w, daniel-/w4YWyX8dFk,
	alexander.deucher-5C7GfCeVMHo,
	freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	christian.koenig-5C7GfCeVMHo

On Fri, Jan 10, 2020 at 10:21:27AM +0100, Thomas Zimmermann wrote:
> All non-legacy users of VBLANK functions in struct drm_driver have been
> converted to use the respective interfaces in struct drm_crtc_funcs. The
> remaining users of VBLANK callbacks in struct drm_driver are legacy drivers
> with userspace modesetting.
> 
> There are no users left of get_vblank_timestamp(), so the callback is
> being removed. The other VBLANK callbacks are being moved to the legacy
> section at the end of struct drm_driver.
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann-l3A5Bk7waGM@public.gmane.org>

I think sprinkling some WARN_ON (in drm_dev_register or wherever) if new
drivers try to use the legacy hooks would be really nice. Experience says
someone is going to copypaste this stuff around forever otherwise.

Reviewed-by: Daniel Vetter <daniel.vetter-/w4YWyX8dFk@public.gmane.org>

> ---
>  drivers/gpu/drm/drm_vblank.c |  39 +++++---------
>  include/drm/drm_drv.h        | 101 ++---------------------------------
>  2 files changed, 17 insertions(+), 123 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
> index 7cf436a4b908..ceff68474d4d 100644
> --- a/drivers/gpu/drm/drm_vblank.c
> +++ b/drivers/gpu/drm/drm_vblank.c
> @@ -138,10 +138,9 @@ static u32 __get_vblank_counter(struct drm_device *dev, unsigned int pipe)
>  
>  		if (crtc->funcs->get_vblank_counter)
>  			return crtc->funcs->get_vblank_counter(crtc);
> -	}
> -
> -	if (dev->driver->get_vblank_counter)
> +	} else if (dev->driver->get_vblank_counter) {
>  		return dev->driver->get_vblank_counter(dev, pipe);
> +	}
>  
>  	return drm_vblank_no_hw_counter(dev, pipe);
>  }
> @@ -334,8 +333,7 @@ u64 drm_crtc_accurate_vblank_count(struct drm_crtc *crtc)
>  	unsigned long flags;
>  
>  	WARN_ONCE(drm_debug_enabled(DRM_UT_VBL) &&
> -		  !crtc->funcs->get_vblank_timestamp &&
> -		  !dev->driver->get_vblank_timestamp,
> +		  !crtc->funcs->get_vblank_timestamp,
>  		  "This function requires support for accurate vblank timestamps.");
>  
>  	spin_lock_irqsave(&dev->vblank_time_lock, flags);
> @@ -357,13 +355,11 @@ static void __disable_vblank(struct drm_device *dev, unsigned int pipe)
>  		if (WARN_ON(!crtc))
>  			return;
>  
> -		if (crtc->funcs->disable_vblank) {
> +		if (crtc->funcs->disable_vblank)
>  			crtc->funcs->disable_vblank(crtc);
> -			return;
> -		}
> +	} else {
> +		dev->driver->disable_vblank(dev, pipe);
>  	}
> -
> -	dev->driver->disable_vblank(dev, pipe);
>  }
>  
>  /*
> @@ -791,9 +787,6 @@ drm_get_last_vbltimestamp(struct drm_device *dev, unsigned int pipe,
>  
>  		ret = crtc->funcs->get_vblank_timestamp(crtc, &max_error,
>  							tvblank, in_vblank_irq);
> -	} else if (dev->driver->get_vblank_timestamp && (max_error > 0)) {
> -		ret = dev->driver->get_vblank_timestamp(dev, pipe, &max_error,
> -							tvblank, in_vblank_irq);
>  	}
>  
>  	/* GPU high precision timestamp query unsupported or failed.
> @@ -1016,9 +1009,11 @@ static int __enable_vblank(struct drm_device *dev, unsigned int pipe)
>  
>  		if (crtc->funcs->enable_vblank)
>  			return crtc->funcs->enable_vblank(crtc);
> +	} else if (dev->driver->enable_vblank) {
> +		return dev->driver->enable_vblank(dev, pipe);
>  	}
>  
> -	return dev->driver->enable_vblank(dev, pipe);
> +	return -EINVAL;
>  }
>  
>  static int drm_vblank_enable(struct drm_device *dev, unsigned int pipe)
> @@ -1109,13 +1104,10 @@ static bool __vblank_disable_immediate(struct drm_device *dev, unsigned int pipe
>  		return false;
>  
>  	crtc = drm_crtc_from_index(dev, pipe);
> -	if (crtc && crtc->funcs->get_vblank_timestamp)
> -		return true;
> -
> -	if (dev->driver->get_vblank_timestamp)
> -		return true;
> +	if (!crtc || !crtc->funcs->get_vblank_timestamp)
> +		return false;
>  
> -	return false;
> +	return true;
>  }
>  
>  static void drm_vblank_put(struct drm_device *dev, unsigned int pipe)
> @@ -1798,7 +1790,6 @@ static void drm_handle_vblank_events(struct drm_device *dev, unsigned int pipe)
>  	struct drm_pending_vblank_event *e, *t;
>  	ktime_t now;
>  	u64 seq;
> -	bool high_prec;
>  
>  	assert_spin_locked(&dev->event_lock);
>  
> @@ -1818,10 +1809,8 @@ static void drm_handle_vblank_events(struct drm_device *dev, unsigned int pipe)
>  		send_vblank_event(dev, e, seq, now);
>  	}
>  
> -	high_prec = crtc->funcs->get_vblank_timestamp ||
> -		    dev->driver->get_vblank_timestamp;
> -
> -	trace_drm_vblank_event(pipe, seq, now, high_prec);
> +	trace_drm_vblank_event(pipe, seq, now,
> +			       crtc->funcs->get_vblank_timestamp != NULL);
>  }
>  
>  /**
> diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
> index b704e252f3b2..e290b3aca6eb 100644
> --- a/include/drm/drm_drv.h
> +++ b/include/drm/drm_drv.h
> @@ -268,104 +268,6 @@ struct drm_driver {
>  	 */
>  	void (*release) (struct drm_device *);
>  
> -	/**
> -	 * @get_vblank_counter:
> -	 *
> -	 * Driver callback for fetching a raw hardware vblank counter for the
> -	 * CRTC specified with the pipe argument.  If a device doesn't have a
> -	 * hardware counter, the driver can simply leave the hook as NULL.
> -	 * The DRM core will account for missed vblank events while interrupts
> -	 * where disabled based on system timestamps.
> -	 *
> -	 * Wraparound handling and loss of events due to modesetting is dealt
> -	 * with in the DRM core code, as long as drivers call
> -	 * drm_crtc_vblank_off() and drm_crtc_vblank_on() when disabling or
> -	 * enabling a CRTC.
> -	 *
> -	 * This is deprecated and should not be used by new drivers.
> -	 * Use &drm_crtc_funcs.get_vblank_counter instead.
> -	 *
> -	 * Returns:
> -	 *
> -	 * Raw vblank counter value.
> -	 */
> -	u32 (*get_vblank_counter) (struct drm_device *dev, unsigned int pipe);
> -
> -	/**
> -	 * @enable_vblank:
> -	 *
> -	 * Enable vblank interrupts for the CRTC specified with the pipe
> -	 * argument.
> -	 *
> -	 * This is deprecated and should not be used by new drivers.
> -	 * Use &drm_crtc_funcs.enable_vblank instead.
> -	 *
> -	 * Returns:
> -	 *
> -	 * Zero on success, appropriate errno if the given @crtc's vblank
> -	 * interrupt cannot be enabled.
> -	 */
> -	int (*enable_vblank) (struct drm_device *dev, unsigned int pipe);
> -
> -	/**
> -	 * @disable_vblank:
> -	 *
> -	 * Disable vblank interrupts for the CRTC specified with the pipe
> -	 * argument.
> -	 *
> -	 * This is deprecated and should not be used by new drivers.
> -	 * Use &drm_crtc_funcs.disable_vblank instead.
> -	 */
> -	void (*disable_vblank) (struct drm_device *dev, unsigned int pipe);
> -
> -	/**
> -	 * @get_vblank_timestamp:
> -	 *
> -	 * Called by drm_get_last_vbltimestamp(). Should return a precise
> -	 * timestamp when the most recent VBLANK interval ended or will end.
> -	 *
> -	 * Specifically, the timestamp in @vblank_time should correspond as
> -	 * closely as possible to the time when the first video scanline of
> -	 * the video frame after the end of VBLANK will start scanning out,
> -	 * the time immediately after end of the VBLANK interval. If the
> -	 * @crtc is currently inside VBLANK, this will be a time in the future.
> -	 * If the @crtc is currently scanning out a frame, this will be the
> -	 * past start time of the current scanout. This is meant to adhere
> -	 * to the OpenML OML_sync_control extension specification.
> -	 *
> -	 * Paramters:
> -	 *
> -	 * dev:
> -	 *     dev DRM device handle.
> -	 * pipe:
> -	 *     crtc for which timestamp should be returned.
> -	 * max_error:
> -	 *     Maximum allowable timestamp error in nanoseconds.
> -	 *     Implementation should strive to provide timestamp
> -	 *     with an error of at most max_error nanoseconds.
> -	 *     Returns true upper bound on error for timestamp.
> -	 * vblank_time:
> -	 *     Target location for returned vblank timestamp.
> -	 * in_vblank_irq:
> -	 *     True when called from drm_crtc_handle_vblank().  Some drivers
> -	 *     need to apply some workarounds for gpu-specific vblank irq quirks
> -	 *     if flag is set.
> -	 *
> -	 * Returns:
> -	 *
> -	 * True on success, false on failure, which means the core should
> -	 * fallback to a simple timestamp taken in drm_crtc_handle_vblank().
> -	 *
> -	 * FIXME:
> -	 *
> -	 * We should move this hook to &struct drm_crtc_funcs like all the other
> -	 * vblank hooks.
> -	 */
> -	bool (*get_vblank_timestamp) (struct drm_device *dev, unsigned int pipe,
> -				     int *max_error,
> -				     ktime_t *vblank_time,
> -				     bool in_vblank_irq);
> -
>  	/**
>  	 * @irq_handler:
>  	 *
> @@ -720,6 +622,9 @@ struct drm_driver {
>  	int (*dma_ioctl) (struct drm_device *dev, void *data, struct drm_file *file_priv);
>  	int (*dma_quiescent) (struct drm_device *);
>  	int (*context_dtor) (struct drm_device *dev, int context);
> +	u32 (*get_vblank_counter)(struct drm_device *dev, unsigned int pipe);
> +	int (*enable_vblank)(struct drm_device *dev, unsigned int pipe);
> +	void (*disable_vblank)(struct drm_device *dev, unsigned int pipe);
>  	int dev_priv_size;
>  };
>  
> -- 
> 2.24.1
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [PATCH 23/23] drm: Cleanup VBLANK callbacks in struct drm_driver
@ 2020-01-12 22:53     ` Daniel Vetter
  0 siblings, 0 replies; 217+ messages in thread
From: Daniel Vetter @ 2020-01-12 22:53 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: hamohammed.sa, airlied, nouveau, dri-devel, amd-gfx,
	alexandre.torgue, thellstrom, sean, linux-graphics-maintainer,
	bskeggs, mcoquelin.stm32, sunpeng.li, linux-arm-msm, intel-gfx,
	rodrigo.vivi, vincent.abriou, rodrigosiqueiramelo,
	philippe.cornu, yannick.fertre, alexander.deucher, freedreno,
	christian.koenig

On Fri, Jan 10, 2020 at 10:21:27AM +0100, Thomas Zimmermann wrote:
> All non-legacy users of VBLANK functions in struct drm_driver have been
> converted to use the respective interfaces in struct drm_crtc_funcs. The
> remaining users of VBLANK callbacks in struct drm_driver are legacy drivers
> with userspace modesetting.
> 
> There are no users left of get_vblank_timestamp(), so the callback is
> being removed. The other VBLANK callbacks are being moved to the legacy
> section at the end of struct drm_driver.
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>

I think sprinkling some WARN_ON (in drm_dev_register or wherever) if new
drivers try to use the legacy hooks would be really nice. Experience says
someone is going to copypaste this stuff around forever otherwise.

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

> ---
>  drivers/gpu/drm/drm_vblank.c |  39 +++++---------
>  include/drm/drm_drv.h        | 101 ++---------------------------------
>  2 files changed, 17 insertions(+), 123 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
> index 7cf436a4b908..ceff68474d4d 100644
> --- a/drivers/gpu/drm/drm_vblank.c
> +++ b/drivers/gpu/drm/drm_vblank.c
> @@ -138,10 +138,9 @@ static u32 __get_vblank_counter(struct drm_device *dev, unsigned int pipe)
>  
>  		if (crtc->funcs->get_vblank_counter)
>  			return crtc->funcs->get_vblank_counter(crtc);
> -	}
> -
> -	if (dev->driver->get_vblank_counter)
> +	} else if (dev->driver->get_vblank_counter) {
>  		return dev->driver->get_vblank_counter(dev, pipe);
> +	}
>  
>  	return drm_vblank_no_hw_counter(dev, pipe);
>  }
> @@ -334,8 +333,7 @@ u64 drm_crtc_accurate_vblank_count(struct drm_crtc *crtc)
>  	unsigned long flags;
>  
>  	WARN_ONCE(drm_debug_enabled(DRM_UT_VBL) &&
> -		  !crtc->funcs->get_vblank_timestamp &&
> -		  !dev->driver->get_vblank_timestamp,
> +		  !crtc->funcs->get_vblank_timestamp,
>  		  "This function requires support for accurate vblank timestamps.");
>  
>  	spin_lock_irqsave(&dev->vblank_time_lock, flags);
> @@ -357,13 +355,11 @@ static void __disable_vblank(struct drm_device *dev, unsigned int pipe)
>  		if (WARN_ON(!crtc))
>  			return;
>  
> -		if (crtc->funcs->disable_vblank) {
> +		if (crtc->funcs->disable_vblank)
>  			crtc->funcs->disable_vblank(crtc);
> -			return;
> -		}
> +	} else {
> +		dev->driver->disable_vblank(dev, pipe);
>  	}
> -
> -	dev->driver->disable_vblank(dev, pipe);
>  }
>  
>  /*
> @@ -791,9 +787,6 @@ drm_get_last_vbltimestamp(struct drm_device *dev, unsigned int pipe,
>  
>  		ret = crtc->funcs->get_vblank_timestamp(crtc, &max_error,
>  							tvblank, in_vblank_irq);
> -	} else if (dev->driver->get_vblank_timestamp && (max_error > 0)) {
> -		ret = dev->driver->get_vblank_timestamp(dev, pipe, &max_error,
> -							tvblank, in_vblank_irq);
>  	}
>  
>  	/* GPU high precision timestamp query unsupported or failed.
> @@ -1016,9 +1009,11 @@ static int __enable_vblank(struct drm_device *dev, unsigned int pipe)
>  
>  		if (crtc->funcs->enable_vblank)
>  			return crtc->funcs->enable_vblank(crtc);
> +	} else if (dev->driver->enable_vblank) {
> +		return dev->driver->enable_vblank(dev, pipe);
>  	}
>  
> -	return dev->driver->enable_vblank(dev, pipe);
> +	return -EINVAL;
>  }
>  
>  static int drm_vblank_enable(struct drm_device *dev, unsigned int pipe)
> @@ -1109,13 +1104,10 @@ static bool __vblank_disable_immediate(struct drm_device *dev, unsigned int pipe
>  		return false;
>  
>  	crtc = drm_crtc_from_index(dev, pipe);
> -	if (crtc && crtc->funcs->get_vblank_timestamp)
> -		return true;
> -
> -	if (dev->driver->get_vblank_timestamp)
> -		return true;
> +	if (!crtc || !crtc->funcs->get_vblank_timestamp)
> +		return false;
>  
> -	return false;
> +	return true;
>  }
>  
>  static void drm_vblank_put(struct drm_device *dev, unsigned int pipe)
> @@ -1798,7 +1790,6 @@ static void drm_handle_vblank_events(struct drm_device *dev, unsigned int pipe)
>  	struct drm_pending_vblank_event *e, *t;
>  	ktime_t now;
>  	u64 seq;
> -	bool high_prec;
>  
>  	assert_spin_locked(&dev->event_lock);
>  
> @@ -1818,10 +1809,8 @@ static void drm_handle_vblank_events(struct drm_device *dev, unsigned int pipe)
>  		send_vblank_event(dev, e, seq, now);
>  	}
>  
> -	high_prec = crtc->funcs->get_vblank_timestamp ||
> -		    dev->driver->get_vblank_timestamp;
> -
> -	trace_drm_vblank_event(pipe, seq, now, high_prec);
> +	trace_drm_vblank_event(pipe, seq, now,
> +			       crtc->funcs->get_vblank_timestamp != NULL);
>  }
>  
>  /**
> diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
> index b704e252f3b2..e290b3aca6eb 100644
> --- a/include/drm/drm_drv.h
> +++ b/include/drm/drm_drv.h
> @@ -268,104 +268,6 @@ struct drm_driver {
>  	 */
>  	void (*release) (struct drm_device *);
>  
> -	/**
> -	 * @get_vblank_counter:
> -	 *
> -	 * Driver callback for fetching a raw hardware vblank counter for the
> -	 * CRTC specified with the pipe argument.  If a device doesn't have a
> -	 * hardware counter, the driver can simply leave the hook as NULL.
> -	 * The DRM core will account for missed vblank events while interrupts
> -	 * where disabled based on system timestamps.
> -	 *
> -	 * Wraparound handling and loss of events due to modesetting is dealt
> -	 * with in the DRM core code, as long as drivers call
> -	 * drm_crtc_vblank_off() and drm_crtc_vblank_on() when disabling or
> -	 * enabling a CRTC.
> -	 *
> -	 * This is deprecated and should not be used by new drivers.
> -	 * Use &drm_crtc_funcs.get_vblank_counter instead.
> -	 *
> -	 * Returns:
> -	 *
> -	 * Raw vblank counter value.
> -	 */
> -	u32 (*get_vblank_counter) (struct drm_device *dev, unsigned int pipe);
> -
> -	/**
> -	 * @enable_vblank:
> -	 *
> -	 * Enable vblank interrupts for the CRTC specified with the pipe
> -	 * argument.
> -	 *
> -	 * This is deprecated and should not be used by new drivers.
> -	 * Use &drm_crtc_funcs.enable_vblank instead.
> -	 *
> -	 * Returns:
> -	 *
> -	 * Zero on success, appropriate errno if the given @crtc's vblank
> -	 * interrupt cannot be enabled.
> -	 */
> -	int (*enable_vblank) (struct drm_device *dev, unsigned int pipe);
> -
> -	/**
> -	 * @disable_vblank:
> -	 *
> -	 * Disable vblank interrupts for the CRTC specified with the pipe
> -	 * argument.
> -	 *
> -	 * This is deprecated and should not be used by new drivers.
> -	 * Use &drm_crtc_funcs.disable_vblank instead.
> -	 */
> -	void (*disable_vblank) (struct drm_device *dev, unsigned int pipe);
> -
> -	/**
> -	 * @get_vblank_timestamp:
> -	 *
> -	 * Called by drm_get_last_vbltimestamp(). Should return a precise
> -	 * timestamp when the most recent VBLANK interval ended or will end.
> -	 *
> -	 * Specifically, the timestamp in @vblank_time should correspond as
> -	 * closely as possible to the time when the first video scanline of
> -	 * the video frame after the end of VBLANK will start scanning out,
> -	 * the time immediately after end of the VBLANK interval. If the
> -	 * @crtc is currently inside VBLANK, this will be a time in the future.
> -	 * If the @crtc is currently scanning out a frame, this will be the
> -	 * past start time of the current scanout. This is meant to adhere
> -	 * to the OpenML OML_sync_control extension specification.
> -	 *
> -	 * Paramters:
> -	 *
> -	 * dev:
> -	 *     dev DRM device handle.
> -	 * pipe:
> -	 *     crtc for which timestamp should be returned.
> -	 * max_error:
> -	 *     Maximum allowable timestamp error in nanoseconds.
> -	 *     Implementation should strive to provide timestamp
> -	 *     with an error of at most max_error nanoseconds.
> -	 *     Returns true upper bound on error for timestamp.
> -	 * vblank_time:
> -	 *     Target location for returned vblank timestamp.
> -	 * in_vblank_irq:
> -	 *     True when called from drm_crtc_handle_vblank().  Some drivers
> -	 *     need to apply some workarounds for gpu-specific vblank irq quirks
> -	 *     if flag is set.
> -	 *
> -	 * Returns:
> -	 *
> -	 * True on success, false on failure, which means the core should
> -	 * fallback to a simple timestamp taken in drm_crtc_handle_vblank().
> -	 *
> -	 * FIXME:
> -	 *
> -	 * We should move this hook to &struct drm_crtc_funcs like all the other
> -	 * vblank hooks.
> -	 */
> -	bool (*get_vblank_timestamp) (struct drm_device *dev, unsigned int pipe,
> -				     int *max_error,
> -				     ktime_t *vblank_time,
> -				     bool in_vblank_irq);
> -
>  	/**
>  	 * @irq_handler:
>  	 *
> @@ -720,6 +622,9 @@ struct drm_driver {
>  	int (*dma_ioctl) (struct drm_device *dev, void *data, struct drm_file *file_priv);
>  	int (*dma_quiescent) (struct drm_device *);
>  	int (*context_dtor) (struct drm_device *dev, int context);
> +	u32 (*get_vblank_counter)(struct drm_device *dev, unsigned int pipe);
> +	int (*enable_vblank)(struct drm_device *dev, unsigned int pipe);
> +	void (*disable_vblank)(struct drm_device *dev, unsigned int pipe);
>  	int dev_priv_size;
>  };
>  
> -- 
> 2.24.1
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [Intel-gfx] [PATCH 23/23] drm: Cleanup VBLANK callbacks in struct drm_driver
@ 2020-01-12 22:53     ` Daniel Vetter
  0 siblings, 0 replies; 217+ messages in thread
From: Daniel Vetter @ 2020-01-12 22:53 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: hamohammed.sa, airlied, nouveau, dri-devel, eric, amd-gfx,
	benjamin.gaignard, alexandre.torgue, David1.Zhou, thellstrom,
	linux-graphics-maintainer, bskeggs, harry.wentland,
	mcoquelin.stm32, sunpeng.li, linux-arm-msm, intel-gfx,
	vincent.abriou, rodrigosiqueiramelo, philippe.cornu,
	yannick.fertre, alexander.deucher, freedreno, christian.koenig

On Fri, Jan 10, 2020 at 10:21:27AM +0100, Thomas Zimmermann wrote:
> All non-legacy users of VBLANK functions in struct drm_driver have been
> converted to use the respective interfaces in struct drm_crtc_funcs. The
> remaining users of VBLANK callbacks in struct drm_driver are legacy drivers
> with userspace modesetting.
> 
> There are no users left of get_vblank_timestamp(), so the callback is
> being removed. The other VBLANK callbacks are being moved to the legacy
> section at the end of struct drm_driver.
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>

I think sprinkling some WARN_ON (in drm_dev_register or wherever) if new
drivers try to use the legacy hooks would be really nice. Experience says
someone is going to copypaste this stuff around forever otherwise.

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

> ---
>  drivers/gpu/drm/drm_vblank.c |  39 +++++---------
>  include/drm/drm_drv.h        | 101 ++---------------------------------
>  2 files changed, 17 insertions(+), 123 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
> index 7cf436a4b908..ceff68474d4d 100644
> --- a/drivers/gpu/drm/drm_vblank.c
> +++ b/drivers/gpu/drm/drm_vblank.c
> @@ -138,10 +138,9 @@ static u32 __get_vblank_counter(struct drm_device *dev, unsigned int pipe)
>  
>  		if (crtc->funcs->get_vblank_counter)
>  			return crtc->funcs->get_vblank_counter(crtc);
> -	}
> -
> -	if (dev->driver->get_vblank_counter)
> +	} else if (dev->driver->get_vblank_counter) {
>  		return dev->driver->get_vblank_counter(dev, pipe);
> +	}
>  
>  	return drm_vblank_no_hw_counter(dev, pipe);
>  }
> @@ -334,8 +333,7 @@ u64 drm_crtc_accurate_vblank_count(struct drm_crtc *crtc)
>  	unsigned long flags;
>  
>  	WARN_ONCE(drm_debug_enabled(DRM_UT_VBL) &&
> -		  !crtc->funcs->get_vblank_timestamp &&
> -		  !dev->driver->get_vblank_timestamp,
> +		  !crtc->funcs->get_vblank_timestamp,
>  		  "This function requires support for accurate vblank timestamps.");
>  
>  	spin_lock_irqsave(&dev->vblank_time_lock, flags);
> @@ -357,13 +355,11 @@ static void __disable_vblank(struct drm_device *dev, unsigned int pipe)
>  		if (WARN_ON(!crtc))
>  			return;
>  
> -		if (crtc->funcs->disable_vblank) {
> +		if (crtc->funcs->disable_vblank)
>  			crtc->funcs->disable_vblank(crtc);
> -			return;
> -		}
> +	} else {
> +		dev->driver->disable_vblank(dev, pipe);
>  	}
> -
> -	dev->driver->disable_vblank(dev, pipe);
>  }
>  
>  /*
> @@ -791,9 +787,6 @@ drm_get_last_vbltimestamp(struct drm_device *dev, unsigned int pipe,
>  
>  		ret = crtc->funcs->get_vblank_timestamp(crtc, &max_error,
>  							tvblank, in_vblank_irq);
> -	} else if (dev->driver->get_vblank_timestamp && (max_error > 0)) {
> -		ret = dev->driver->get_vblank_timestamp(dev, pipe, &max_error,
> -							tvblank, in_vblank_irq);
>  	}
>  
>  	/* GPU high precision timestamp query unsupported or failed.
> @@ -1016,9 +1009,11 @@ static int __enable_vblank(struct drm_device *dev, unsigned int pipe)
>  
>  		if (crtc->funcs->enable_vblank)
>  			return crtc->funcs->enable_vblank(crtc);
> +	} else if (dev->driver->enable_vblank) {
> +		return dev->driver->enable_vblank(dev, pipe);
>  	}
>  
> -	return dev->driver->enable_vblank(dev, pipe);
> +	return -EINVAL;
>  }
>  
>  static int drm_vblank_enable(struct drm_device *dev, unsigned int pipe)
> @@ -1109,13 +1104,10 @@ static bool __vblank_disable_immediate(struct drm_device *dev, unsigned int pipe
>  		return false;
>  
>  	crtc = drm_crtc_from_index(dev, pipe);
> -	if (crtc && crtc->funcs->get_vblank_timestamp)
> -		return true;
> -
> -	if (dev->driver->get_vblank_timestamp)
> -		return true;
> +	if (!crtc || !crtc->funcs->get_vblank_timestamp)
> +		return false;
>  
> -	return false;
> +	return true;
>  }
>  
>  static void drm_vblank_put(struct drm_device *dev, unsigned int pipe)
> @@ -1798,7 +1790,6 @@ static void drm_handle_vblank_events(struct drm_device *dev, unsigned int pipe)
>  	struct drm_pending_vblank_event *e, *t;
>  	ktime_t now;
>  	u64 seq;
> -	bool high_prec;
>  
>  	assert_spin_locked(&dev->event_lock);
>  
> @@ -1818,10 +1809,8 @@ static void drm_handle_vblank_events(struct drm_device *dev, unsigned int pipe)
>  		send_vblank_event(dev, e, seq, now);
>  	}
>  
> -	high_prec = crtc->funcs->get_vblank_timestamp ||
> -		    dev->driver->get_vblank_timestamp;
> -
> -	trace_drm_vblank_event(pipe, seq, now, high_prec);
> +	trace_drm_vblank_event(pipe, seq, now,
> +			       crtc->funcs->get_vblank_timestamp != NULL);
>  }
>  
>  /**
> diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
> index b704e252f3b2..e290b3aca6eb 100644
> --- a/include/drm/drm_drv.h
> +++ b/include/drm/drm_drv.h
> @@ -268,104 +268,6 @@ struct drm_driver {
>  	 */
>  	void (*release) (struct drm_device *);
>  
> -	/**
> -	 * @get_vblank_counter:
> -	 *
> -	 * Driver callback for fetching a raw hardware vblank counter for the
> -	 * CRTC specified with the pipe argument.  If a device doesn't have a
> -	 * hardware counter, the driver can simply leave the hook as NULL.
> -	 * The DRM core will account for missed vblank events while interrupts
> -	 * where disabled based on system timestamps.
> -	 *
> -	 * Wraparound handling and loss of events due to modesetting is dealt
> -	 * with in the DRM core code, as long as drivers call
> -	 * drm_crtc_vblank_off() and drm_crtc_vblank_on() when disabling or
> -	 * enabling a CRTC.
> -	 *
> -	 * This is deprecated and should not be used by new drivers.
> -	 * Use &drm_crtc_funcs.get_vblank_counter instead.
> -	 *
> -	 * Returns:
> -	 *
> -	 * Raw vblank counter value.
> -	 */
> -	u32 (*get_vblank_counter) (struct drm_device *dev, unsigned int pipe);
> -
> -	/**
> -	 * @enable_vblank:
> -	 *
> -	 * Enable vblank interrupts for the CRTC specified with the pipe
> -	 * argument.
> -	 *
> -	 * This is deprecated and should not be used by new drivers.
> -	 * Use &drm_crtc_funcs.enable_vblank instead.
> -	 *
> -	 * Returns:
> -	 *
> -	 * Zero on success, appropriate errno if the given @crtc's vblank
> -	 * interrupt cannot be enabled.
> -	 */
> -	int (*enable_vblank) (struct drm_device *dev, unsigned int pipe);
> -
> -	/**
> -	 * @disable_vblank:
> -	 *
> -	 * Disable vblank interrupts for the CRTC specified with the pipe
> -	 * argument.
> -	 *
> -	 * This is deprecated and should not be used by new drivers.
> -	 * Use &drm_crtc_funcs.disable_vblank instead.
> -	 */
> -	void (*disable_vblank) (struct drm_device *dev, unsigned int pipe);
> -
> -	/**
> -	 * @get_vblank_timestamp:
> -	 *
> -	 * Called by drm_get_last_vbltimestamp(). Should return a precise
> -	 * timestamp when the most recent VBLANK interval ended or will end.
> -	 *
> -	 * Specifically, the timestamp in @vblank_time should correspond as
> -	 * closely as possible to the time when the first video scanline of
> -	 * the video frame after the end of VBLANK will start scanning out,
> -	 * the time immediately after end of the VBLANK interval. If the
> -	 * @crtc is currently inside VBLANK, this will be a time in the future.
> -	 * If the @crtc is currently scanning out a frame, this will be the
> -	 * past start time of the current scanout. This is meant to adhere
> -	 * to the OpenML OML_sync_control extension specification.
> -	 *
> -	 * Paramters:
> -	 *
> -	 * dev:
> -	 *     dev DRM device handle.
> -	 * pipe:
> -	 *     crtc for which timestamp should be returned.
> -	 * max_error:
> -	 *     Maximum allowable timestamp error in nanoseconds.
> -	 *     Implementation should strive to provide timestamp
> -	 *     with an error of at most max_error nanoseconds.
> -	 *     Returns true upper bound on error for timestamp.
> -	 * vblank_time:
> -	 *     Target location for returned vblank timestamp.
> -	 * in_vblank_irq:
> -	 *     True when called from drm_crtc_handle_vblank().  Some drivers
> -	 *     need to apply some workarounds for gpu-specific vblank irq quirks
> -	 *     if flag is set.
> -	 *
> -	 * Returns:
> -	 *
> -	 * True on success, false on failure, which means the core should
> -	 * fallback to a simple timestamp taken in drm_crtc_handle_vblank().
> -	 *
> -	 * FIXME:
> -	 *
> -	 * We should move this hook to &struct drm_crtc_funcs like all the other
> -	 * vblank hooks.
> -	 */
> -	bool (*get_vblank_timestamp) (struct drm_device *dev, unsigned int pipe,
> -				     int *max_error,
> -				     ktime_t *vblank_time,
> -				     bool in_vblank_irq);
> -
>  	/**
>  	 * @irq_handler:
>  	 *
> @@ -720,6 +622,9 @@ struct drm_driver {
>  	int (*dma_ioctl) (struct drm_device *dev, void *data, struct drm_file *file_priv);
>  	int (*dma_quiescent) (struct drm_device *);
>  	int (*context_dtor) (struct drm_device *dev, int context);
> +	u32 (*get_vblank_counter)(struct drm_device *dev, unsigned int pipe);
> +	int (*enable_vblank)(struct drm_device *dev, unsigned int pipe);
> +	void (*disable_vblank)(struct drm_device *dev, unsigned int pipe);
>  	int dev_priv_size;
>  };
>  
> -- 
> 2.24.1
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [PATCH 23/23] drm: Cleanup VBLANK callbacks in struct drm_driver
@ 2020-01-12 22:53     ` Daniel Vetter
  0 siblings, 0 replies; 217+ messages in thread
From: Daniel Vetter @ 2020-01-12 22:53 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: hamohammed.sa, airlied, nouveau, joonas.lahtinen, dri-devel,
	eric, amd-gfx, benjamin.gaignard, alexandre.torgue, David1.Zhou,
	thellstrom, sean, patrik.r.jakobsson, linux-graphics-maintainer,
	bskeggs, harry.wentland, mcoquelin.stm32, sunpeng.li,
	linux-arm-msm, intel-gfx, maarten.lankhorst, jani.nikula,
	rodrigo.vivi, vincent.abriou, rodrigosiqueiramelo,
	philippe.cornu, yannick.fertre, robdclark, daniel,
	alexander.deucher, freedreno, christian.koenig

On Fri, Jan 10, 2020 at 10:21:27AM +0100, Thomas Zimmermann wrote:
> All non-legacy users of VBLANK functions in struct drm_driver have been
> converted to use the respective interfaces in struct drm_crtc_funcs. The
> remaining users of VBLANK callbacks in struct drm_driver are legacy drivers
> with userspace modesetting.
> 
> There are no users left of get_vblank_timestamp(), so the callback is
> being removed. The other VBLANK callbacks are being moved to the legacy
> section at the end of struct drm_driver.
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>

I think sprinkling some WARN_ON (in drm_dev_register or wherever) if new
drivers try to use the legacy hooks would be really nice. Experience says
someone is going to copypaste this stuff around forever otherwise.

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

> ---
>  drivers/gpu/drm/drm_vblank.c |  39 +++++---------
>  include/drm/drm_drv.h        | 101 ++---------------------------------
>  2 files changed, 17 insertions(+), 123 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
> index 7cf436a4b908..ceff68474d4d 100644
> --- a/drivers/gpu/drm/drm_vblank.c
> +++ b/drivers/gpu/drm/drm_vblank.c
> @@ -138,10 +138,9 @@ static u32 __get_vblank_counter(struct drm_device *dev, unsigned int pipe)
>  
>  		if (crtc->funcs->get_vblank_counter)
>  			return crtc->funcs->get_vblank_counter(crtc);
> -	}
> -
> -	if (dev->driver->get_vblank_counter)
> +	} else if (dev->driver->get_vblank_counter) {
>  		return dev->driver->get_vblank_counter(dev, pipe);
> +	}
>  
>  	return drm_vblank_no_hw_counter(dev, pipe);
>  }
> @@ -334,8 +333,7 @@ u64 drm_crtc_accurate_vblank_count(struct drm_crtc *crtc)
>  	unsigned long flags;
>  
>  	WARN_ONCE(drm_debug_enabled(DRM_UT_VBL) &&
> -		  !crtc->funcs->get_vblank_timestamp &&
> -		  !dev->driver->get_vblank_timestamp,
> +		  !crtc->funcs->get_vblank_timestamp,
>  		  "This function requires support for accurate vblank timestamps.");
>  
>  	spin_lock_irqsave(&dev->vblank_time_lock, flags);
> @@ -357,13 +355,11 @@ static void __disable_vblank(struct drm_device *dev, unsigned int pipe)
>  		if (WARN_ON(!crtc))
>  			return;
>  
> -		if (crtc->funcs->disable_vblank) {
> +		if (crtc->funcs->disable_vblank)
>  			crtc->funcs->disable_vblank(crtc);
> -			return;
> -		}
> +	} else {
> +		dev->driver->disable_vblank(dev, pipe);
>  	}
> -
> -	dev->driver->disable_vblank(dev, pipe);
>  }
>  
>  /*
> @@ -791,9 +787,6 @@ drm_get_last_vbltimestamp(struct drm_device *dev, unsigned int pipe,
>  
>  		ret = crtc->funcs->get_vblank_timestamp(crtc, &max_error,
>  							tvblank, in_vblank_irq);
> -	} else if (dev->driver->get_vblank_timestamp && (max_error > 0)) {
> -		ret = dev->driver->get_vblank_timestamp(dev, pipe, &max_error,
> -							tvblank, in_vblank_irq);
>  	}
>  
>  	/* GPU high precision timestamp query unsupported or failed.
> @@ -1016,9 +1009,11 @@ static int __enable_vblank(struct drm_device *dev, unsigned int pipe)
>  
>  		if (crtc->funcs->enable_vblank)
>  			return crtc->funcs->enable_vblank(crtc);
> +	} else if (dev->driver->enable_vblank) {
> +		return dev->driver->enable_vblank(dev, pipe);
>  	}
>  
> -	return dev->driver->enable_vblank(dev, pipe);
> +	return -EINVAL;
>  }
>  
>  static int drm_vblank_enable(struct drm_device *dev, unsigned int pipe)
> @@ -1109,13 +1104,10 @@ static bool __vblank_disable_immediate(struct drm_device *dev, unsigned int pipe
>  		return false;
>  
>  	crtc = drm_crtc_from_index(dev, pipe);
> -	if (crtc && crtc->funcs->get_vblank_timestamp)
> -		return true;
> -
> -	if (dev->driver->get_vblank_timestamp)
> -		return true;
> +	if (!crtc || !crtc->funcs->get_vblank_timestamp)
> +		return false;
>  
> -	return false;
> +	return true;
>  }
>  
>  static void drm_vblank_put(struct drm_device *dev, unsigned int pipe)
> @@ -1798,7 +1790,6 @@ static void drm_handle_vblank_events(struct drm_device *dev, unsigned int pipe)
>  	struct drm_pending_vblank_event *e, *t;
>  	ktime_t now;
>  	u64 seq;
> -	bool high_prec;
>  
>  	assert_spin_locked(&dev->event_lock);
>  
> @@ -1818,10 +1809,8 @@ static void drm_handle_vblank_events(struct drm_device *dev, unsigned int pipe)
>  		send_vblank_event(dev, e, seq, now);
>  	}
>  
> -	high_prec = crtc->funcs->get_vblank_timestamp ||
> -		    dev->driver->get_vblank_timestamp;
> -
> -	trace_drm_vblank_event(pipe, seq, now, high_prec);
> +	trace_drm_vblank_event(pipe, seq, now,
> +			       crtc->funcs->get_vblank_timestamp != NULL);
>  }
>  
>  /**
> diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
> index b704e252f3b2..e290b3aca6eb 100644
> --- a/include/drm/drm_drv.h
> +++ b/include/drm/drm_drv.h
> @@ -268,104 +268,6 @@ struct drm_driver {
>  	 */
>  	void (*release) (struct drm_device *);
>  
> -	/**
> -	 * @get_vblank_counter:
> -	 *
> -	 * Driver callback for fetching a raw hardware vblank counter for the
> -	 * CRTC specified with the pipe argument.  If a device doesn't have a
> -	 * hardware counter, the driver can simply leave the hook as NULL.
> -	 * The DRM core will account for missed vblank events while interrupts
> -	 * where disabled based on system timestamps.
> -	 *
> -	 * Wraparound handling and loss of events due to modesetting is dealt
> -	 * with in the DRM core code, as long as drivers call
> -	 * drm_crtc_vblank_off() and drm_crtc_vblank_on() when disabling or
> -	 * enabling a CRTC.
> -	 *
> -	 * This is deprecated and should not be used by new drivers.
> -	 * Use &drm_crtc_funcs.get_vblank_counter instead.
> -	 *
> -	 * Returns:
> -	 *
> -	 * Raw vblank counter value.
> -	 */
> -	u32 (*get_vblank_counter) (struct drm_device *dev, unsigned int pipe);
> -
> -	/**
> -	 * @enable_vblank:
> -	 *
> -	 * Enable vblank interrupts for the CRTC specified with the pipe
> -	 * argument.
> -	 *
> -	 * This is deprecated and should not be used by new drivers.
> -	 * Use &drm_crtc_funcs.enable_vblank instead.
> -	 *
> -	 * Returns:
> -	 *
> -	 * Zero on success, appropriate errno if the given @crtc's vblank
> -	 * interrupt cannot be enabled.
> -	 */
> -	int (*enable_vblank) (struct drm_device *dev, unsigned int pipe);
> -
> -	/**
> -	 * @disable_vblank:
> -	 *
> -	 * Disable vblank interrupts for the CRTC specified with the pipe
> -	 * argument.
> -	 *
> -	 * This is deprecated and should not be used by new drivers.
> -	 * Use &drm_crtc_funcs.disable_vblank instead.
> -	 */
> -	void (*disable_vblank) (struct drm_device *dev, unsigned int pipe);
> -
> -	/**
> -	 * @get_vblank_timestamp:
> -	 *
> -	 * Called by drm_get_last_vbltimestamp(). Should return a precise
> -	 * timestamp when the most recent VBLANK interval ended or will end.
> -	 *
> -	 * Specifically, the timestamp in @vblank_time should correspond as
> -	 * closely as possible to the time when the first video scanline of
> -	 * the video frame after the end of VBLANK will start scanning out,
> -	 * the time immediately after end of the VBLANK interval. If the
> -	 * @crtc is currently inside VBLANK, this will be a time in the future.
> -	 * If the @crtc is currently scanning out a frame, this will be the
> -	 * past start time of the current scanout. This is meant to adhere
> -	 * to the OpenML OML_sync_control extension specification.
> -	 *
> -	 * Paramters:
> -	 *
> -	 * dev:
> -	 *     dev DRM device handle.
> -	 * pipe:
> -	 *     crtc for which timestamp should be returned.
> -	 * max_error:
> -	 *     Maximum allowable timestamp error in nanoseconds.
> -	 *     Implementation should strive to provide timestamp
> -	 *     with an error of at most max_error nanoseconds.
> -	 *     Returns true upper bound on error for timestamp.
> -	 * vblank_time:
> -	 *     Target location for returned vblank timestamp.
> -	 * in_vblank_irq:
> -	 *     True when called from drm_crtc_handle_vblank().  Some drivers
> -	 *     need to apply some workarounds for gpu-specific vblank irq quirks
> -	 *     if flag is set.
> -	 *
> -	 * Returns:
> -	 *
> -	 * True on success, false on failure, which means the core should
> -	 * fallback to a simple timestamp taken in drm_crtc_handle_vblank().
> -	 *
> -	 * FIXME:
> -	 *
> -	 * We should move this hook to &struct drm_crtc_funcs like all the other
> -	 * vblank hooks.
> -	 */
> -	bool (*get_vblank_timestamp) (struct drm_device *dev, unsigned int pipe,
> -				     int *max_error,
> -				     ktime_t *vblank_time,
> -				     bool in_vblank_irq);
> -
>  	/**
>  	 * @irq_handler:
>  	 *
> @@ -720,6 +622,9 @@ struct drm_driver {
>  	int (*dma_ioctl) (struct drm_device *dev, void *data, struct drm_file *file_priv);
>  	int (*dma_quiescent) (struct drm_device *);
>  	int (*context_dtor) (struct drm_device *dev, int context);
> +	u32 (*get_vblank_counter)(struct drm_device *dev, unsigned int pipe);
> +	int (*enable_vblank)(struct drm_device *dev, unsigned int pipe);
> +	void (*disable_vblank)(struct drm_device *dev, unsigned int pipe);
>  	int dev_priv_size;
>  };
>  
> -- 
> 2.24.1
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [PATCH 23/23] drm: Cleanup VBLANK callbacks in struct drm_driver
  2020-01-12 22:53     ` Daniel Vetter
                         ` (2 preceding siblings ...)
  (?)
@ 2020-01-12 22:54       ` Daniel Vetter
  -1 siblings, 0 replies; 217+ messages in thread
From: Daniel Vetter @ 2020-01-12 22:54 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, maarten.lankhorst, patrik.r.jakobsson, robdclark,
	sean, benjamin.gaignard, vincent.abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, eric,
	rodrigosiqueiramelo, hamohammed.sa, linux-graphics-maintainer,
	thellstrom, bskeggs, harry.wentland, sunpeng.li, jani.nikula,
	joonas.lahtinen, rodrigo.vivi, dri-devel, amd-gfx, intel-gfx,
	linux-arm-msm, freedreno, nouveau

On Sun, Jan 12, 2020 at 11:53:12PM +0100, Daniel Vetter wrote:
> On Fri, Jan 10, 2020 at 10:21:27AM +0100, Thomas Zimmermann wrote:
> > All non-legacy users of VBLANK functions in struct drm_driver have been
> > converted to use the respective interfaces in struct drm_crtc_funcs. The
> > remaining users of VBLANK callbacks in struct drm_driver are legacy drivers
> > with userspace modesetting.
> > 
> > There are no users left of get_vblank_timestamp(), so the callback is
> > being removed. The other VBLANK callbacks are being moved to the legacy
> > section at the end of struct drm_driver.
> > 
> > Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> 
> I think sprinkling some WARN_ON (in drm_dev_register or wherever) if new
> drivers try to use the legacy hooks would be really nice. Experience says
> someone is going to copypaste this stuff around forever otherwise.

I meant to add: As a follow-up patch.
-Daniel

> 
> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> 
> > ---
> >  drivers/gpu/drm/drm_vblank.c |  39 +++++---------
> >  include/drm/drm_drv.h        | 101 ++---------------------------------
> >  2 files changed, 17 insertions(+), 123 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
> > index 7cf436a4b908..ceff68474d4d 100644
> > --- a/drivers/gpu/drm/drm_vblank.c
> > +++ b/drivers/gpu/drm/drm_vblank.c
> > @@ -138,10 +138,9 @@ static u32 __get_vblank_counter(struct drm_device *dev, unsigned int pipe)
> >  
> >  		if (crtc->funcs->get_vblank_counter)
> >  			return crtc->funcs->get_vblank_counter(crtc);
> > -	}
> > -
> > -	if (dev->driver->get_vblank_counter)
> > +	} else if (dev->driver->get_vblank_counter) {
> >  		return dev->driver->get_vblank_counter(dev, pipe);
> > +	}
> >  
> >  	return drm_vblank_no_hw_counter(dev, pipe);
> >  }
> > @@ -334,8 +333,7 @@ u64 drm_crtc_accurate_vblank_count(struct drm_crtc *crtc)
> >  	unsigned long flags;
> >  
> >  	WARN_ONCE(drm_debug_enabled(DRM_UT_VBL) &&
> > -		  !crtc->funcs->get_vblank_timestamp &&
> > -		  !dev->driver->get_vblank_timestamp,
> > +		  !crtc->funcs->get_vblank_timestamp,
> >  		  "This function requires support for accurate vblank timestamps.");
> >  
> >  	spin_lock_irqsave(&dev->vblank_time_lock, flags);
> > @@ -357,13 +355,11 @@ static void __disable_vblank(struct drm_device *dev, unsigned int pipe)
> >  		if (WARN_ON(!crtc))
> >  			return;
> >  
> > -		if (crtc->funcs->disable_vblank) {
> > +		if (crtc->funcs->disable_vblank)
> >  			crtc->funcs->disable_vblank(crtc);
> > -			return;
> > -		}
> > +	} else {
> > +		dev->driver->disable_vblank(dev, pipe);
> >  	}
> > -
> > -	dev->driver->disable_vblank(dev, pipe);
> >  }
> >  
> >  /*
> > @@ -791,9 +787,6 @@ drm_get_last_vbltimestamp(struct drm_device *dev, unsigned int pipe,
> >  
> >  		ret = crtc->funcs->get_vblank_timestamp(crtc, &max_error,
> >  							tvblank, in_vblank_irq);
> > -	} else if (dev->driver->get_vblank_timestamp && (max_error > 0)) {
> > -		ret = dev->driver->get_vblank_timestamp(dev, pipe, &max_error,
> > -							tvblank, in_vblank_irq);
> >  	}
> >  
> >  	/* GPU high precision timestamp query unsupported or failed.
> > @@ -1016,9 +1009,11 @@ static int __enable_vblank(struct drm_device *dev, unsigned int pipe)
> >  
> >  		if (crtc->funcs->enable_vblank)
> >  			return crtc->funcs->enable_vblank(crtc);
> > +	} else if (dev->driver->enable_vblank) {
> > +		return dev->driver->enable_vblank(dev, pipe);
> >  	}
> >  
> > -	return dev->driver->enable_vblank(dev, pipe);
> > +	return -EINVAL;
> >  }
> >  
> >  static int drm_vblank_enable(struct drm_device *dev, unsigned int pipe)
> > @@ -1109,13 +1104,10 @@ static bool __vblank_disable_immediate(struct drm_device *dev, unsigned int pipe
> >  		return false;
> >  
> >  	crtc = drm_crtc_from_index(dev, pipe);
> > -	if (crtc && crtc->funcs->get_vblank_timestamp)
> > -		return true;
> > -
> > -	if (dev->driver->get_vblank_timestamp)
> > -		return true;
> > +	if (!crtc || !crtc->funcs->get_vblank_timestamp)
> > +		return false;
> >  
> > -	return false;
> > +	return true;
> >  }
> >  
> >  static void drm_vblank_put(struct drm_device *dev, unsigned int pipe)
> > @@ -1798,7 +1790,6 @@ static void drm_handle_vblank_events(struct drm_device *dev, unsigned int pipe)
> >  	struct drm_pending_vblank_event *e, *t;
> >  	ktime_t now;
> >  	u64 seq;
> > -	bool high_prec;
> >  
> >  	assert_spin_locked(&dev->event_lock);
> >  
> > @@ -1818,10 +1809,8 @@ static void drm_handle_vblank_events(struct drm_device *dev, unsigned int pipe)
> >  		send_vblank_event(dev, e, seq, now);
> >  	}
> >  
> > -	high_prec = crtc->funcs->get_vblank_timestamp ||
> > -		    dev->driver->get_vblank_timestamp;
> > -
> > -	trace_drm_vblank_event(pipe, seq, now, high_prec);
> > +	trace_drm_vblank_event(pipe, seq, now,
> > +			       crtc->funcs->get_vblank_timestamp != NULL);
> >  }
> >  
> >  /**
> > diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
> > index b704e252f3b2..e290b3aca6eb 100644
> > --- a/include/drm/drm_drv.h
> > +++ b/include/drm/drm_drv.h
> > @@ -268,104 +268,6 @@ struct drm_driver {
> >  	 */
> >  	void (*release) (struct drm_device *);
> >  
> > -	/**
> > -	 * @get_vblank_counter:
> > -	 *
> > -	 * Driver callback for fetching a raw hardware vblank counter for the
> > -	 * CRTC specified with the pipe argument.  If a device doesn't have a
> > -	 * hardware counter, the driver can simply leave the hook as NULL.
> > -	 * The DRM core will account for missed vblank events while interrupts
> > -	 * where disabled based on system timestamps.
> > -	 *
> > -	 * Wraparound handling and loss of events due to modesetting is dealt
> > -	 * with in the DRM core code, as long as drivers call
> > -	 * drm_crtc_vblank_off() and drm_crtc_vblank_on() when disabling or
> > -	 * enabling a CRTC.
> > -	 *
> > -	 * This is deprecated and should not be used by new drivers.
> > -	 * Use &drm_crtc_funcs.get_vblank_counter instead.
> > -	 *
> > -	 * Returns:
> > -	 *
> > -	 * Raw vblank counter value.
> > -	 */
> > -	u32 (*get_vblank_counter) (struct drm_device *dev, unsigned int pipe);
> > -
> > -	/**
> > -	 * @enable_vblank:
> > -	 *
> > -	 * Enable vblank interrupts for the CRTC specified with the pipe
> > -	 * argument.
> > -	 *
> > -	 * This is deprecated and should not be used by new drivers.
> > -	 * Use &drm_crtc_funcs.enable_vblank instead.
> > -	 *
> > -	 * Returns:
> > -	 *
> > -	 * Zero on success, appropriate errno if the given @crtc's vblank
> > -	 * interrupt cannot be enabled.
> > -	 */
> > -	int (*enable_vblank) (struct drm_device *dev, unsigned int pipe);
> > -
> > -	/**
> > -	 * @disable_vblank:
> > -	 *
> > -	 * Disable vblank interrupts for the CRTC specified with the pipe
> > -	 * argument.
> > -	 *
> > -	 * This is deprecated and should not be used by new drivers.
> > -	 * Use &drm_crtc_funcs.disable_vblank instead.
> > -	 */
> > -	void (*disable_vblank) (struct drm_device *dev, unsigned int pipe);
> > -
> > -	/**
> > -	 * @get_vblank_timestamp:
> > -	 *
> > -	 * Called by drm_get_last_vbltimestamp(). Should return a precise
> > -	 * timestamp when the most recent VBLANK interval ended or will end.
> > -	 *
> > -	 * Specifically, the timestamp in @vblank_time should correspond as
> > -	 * closely as possible to the time when the first video scanline of
> > -	 * the video frame after the end of VBLANK will start scanning out,
> > -	 * the time immediately after end of the VBLANK interval. If the
> > -	 * @crtc is currently inside VBLANK, this will be a time in the future.
> > -	 * If the @crtc is currently scanning out a frame, this will be the
> > -	 * past start time of the current scanout. This is meant to adhere
> > -	 * to the OpenML OML_sync_control extension specification.
> > -	 *
> > -	 * Paramters:
> > -	 *
> > -	 * dev:
> > -	 *     dev DRM device handle.
> > -	 * pipe:
> > -	 *     crtc for which timestamp should be returned.
> > -	 * max_error:
> > -	 *     Maximum allowable timestamp error in nanoseconds.
> > -	 *     Implementation should strive to provide timestamp
> > -	 *     with an error of at most max_error nanoseconds.
> > -	 *     Returns true upper bound on error for timestamp.
> > -	 * vblank_time:
> > -	 *     Target location for returned vblank timestamp.
> > -	 * in_vblank_irq:
> > -	 *     True when called from drm_crtc_handle_vblank().  Some drivers
> > -	 *     need to apply some workarounds for gpu-specific vblank irq quirks
> > -	 *     if flag is set.
> > -	 *
> > -	 * Returns:
> > -	 *
> > -	 * True on success, false on failure, which means the core should
> > -	 * fallback to a simple timestamp taken in drm_crtc_handle_vblank().
> > -	 *
> > -	 * FIXME:
> > -	 *
> > -	 * We should move this hook to &struct drm_crtc_funcs like all the other
> > -	 * vblank hooks.
> > -	 */
> > -	bool (*get_vblank_timestamp) (struct drm_device *dev, unsigned int pipe,
> > -				     int *max_error,
> > -				     ktime_t *vblank_time,
> > -				     bool in_vblank_irq);
> > -
> >  	/**
> >  	 * @irq_handler:
> >  	 *
> > @@ -720,6 +622,9 @@ struct drm_driver {
> >  	int (*dma_ioctl) (struct drm_device *dev, void *data, struct drm_file *file_priv);
> >  	int (*dma_quiescent) (struct drm_device *);
> >  	int (*context_dtor) (struct drm_device *dev, int context);
> > +	u32 (*get_vblank_counter)(struct drm_device *dev, unsigned int pipe);
> > +	int (*enable_vblank)(struct drm_device *dev, unsigned int pipe);
> > +	void (*disable_vblank)(struct drm_device *dev, unsigned int pipe);
> >  	int dev_priv_size;
> >  };
> >  
> > -- 
> > 2.24.1
> > 
> 
> -- 
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [PATCH 23/23] drm: Cleanup VBLANK callbacks in struct drm_driver
@ 2020-01-12 22:54       ` Daniel Vetter
  0 siblings, 0 replies; 217+ messages in thread
From: Daniel Vetter @ 2020-01-12 22:54 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: hamohammed.sa, airlied, nouveau, dri-devel, amd-gfx,
	alexandre.torgue, thellstrom, sean, linux-graphics-maintainer,
	bskeggs, mcoquelin.stm32, sunpeng.li, linux-arm-msm, intel-gfx,
	rodrigo.vivi, vincent.abriou, rodrigosiqueiramelo,
	philippe.cornu, yannick.fertre, alexander.deucher, freedreno,
	christian.koenig

On Sun, Jan 12, 2020 at 11:53:12PM +0100, Daniel Vetter wrote:
> On Fri, Jan 10, 2020 at 10:21:27AM +0100, Thomas Zimmermann wrote:
> > All non-legacy users of VBLANK functions in struct drm_driver have been
> > converted to use the respective interfaces in struct drm_crtc_funcs. The
> > remaining users of VBLANK callbacks in struct drm_driver are legacy drivers
> > with userspace modesetting.
> > 
> > There are no users left of get_vblank_timestamp(), so the callback is
> > being removed. The other VBLANK callbacks are being moved to the legacy
> > section at the end of struct drm_driver.
> > 
> > Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> 
> I think sprinkling some WARN_ON (in drm_dev_register or wherever) if new
> drivers try to use the legacy hooks would be really nice. Experience says
> someone is going to copypaste this stuff around forever otherwise.

I meant to add: As a follow-up patch.
-Daniel

> 
> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> 
> > ---
> >  drivers/gpu/drm/drm_vblank.c |  39 +++++---------
> >  include/drm/drm_drv.h        | 101 ++---------------------------------
> >  2 files changed, 17 insertions(+), 123 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
> > index 7cf436a4b908..ceff68474d4d 100644
> > --- a/drivers/gpu/drm/drm_vblank.c
> > +++ b/drivers/gpu/drm/drm_vblank.c
> > @@ -138,10 +138,9 @@ static u32 __get_vblank_counter(struct drm_device *dev, unsigned int pipe)
> >  
> >  		if (crtc->funcs->get_vblank_counter)
> >  			return crtc->funcs->get_vblank_counter(crtc);
> > -	}
> > -
> > -	if (dev->driver->get_vblank_counter)
> > +	} else if (dev->driver->get_vblank_counter) {
> >  		return dev->driver->get_vblank_counter(dev, pipe);
> > +	}
> >  
> >  	return drm_vblank_no_hw_counter(dev, pipe);
> >  }
> > @@ -334,8 +333,7 @@ u64 drm_crtc_accurate_vblank_count(struct drm_crtc *crtc)
> >  	unsigned long flags;
> >  
> >  	WARN_ONCE(drm_debug_enabled(DRM_UT_VBL) &&
> > -		  !crtc->funcs->get_vblank_timestamp &&
> > -		  !dev->driver->get_vblank_timestamp,
> > +		  !crtc->funcs->get_vblank_timestamp,
> >  		  "This function requires support for accurate vblank timestamps.");
> >  
> >  	spin_lock_irqsave(&dev->vblank_time_lock, flags);
> > @@ -357,13 +355,11 @@ static void __disable_vblank(struct drm_device *dev, unsigned int pipe)
> >  		if (WARN_ON(!crtc))
> >  			return;
> >  
> > -		if (crtc->funcs->disable_vblank) {
> > +		if (crtc->funcs->disable_vblank)
> >  			crtc->funcs->disable_vblank(crtc);
> > -			return;
> > -		}
> > +	} else {
> > +		dev->driver->disable_vblank(dev, pipe);
> >  	}
> > -
> > -	dev->driver->disable_vblank(dev, pipe);
> >  }
> >  
> >  /*
> > @@ -791,9 +787,6 @@ drm_get_last_vbltimestamp(struct drm_device *dev, unsigned int pipe,
> >  
> >  		ret = crtc->funcs->get_vblank_timestamp(crtc, &max_error,
> >  							tvblank, in_vblank_irq);
> > -	} else if (dev->driver->get_vblank_timestamp && (max_error > 0)) {
> > -		ret = dev->driver->get_vblank_timestamp(dev, pipe, &max_error,
> > -							tvblank, in_vblank_irq);
> >  	}
> >  
> >  	/* GPU high precision timestamp query unsupported or failed.
> > @@ -1016,9 +1009,11 @@ static int __enable_vblank(struct drm_device *dev, unsigned int pipe)
> >  
> >  		if (crtc->funcs->enable_vblank)
> >  			return crtc->funcs->enable_vblank(crtc);
> > +	} else if (dev->driver->enable_vblank) {
> > +		return dev->driver->enable_vblank(dev, pipe);
> >  	}
> >  
> > -	return dev->driver->enable_vblank(dev, pipe);
> > +	return -EINVAL;
> >  }
> >  
> >  static int drm_vblank_enable(struct drm_device *dev, unsigned int pipe)
> > @@ -1109,13 +1104,10 @@ static bool __vblank_disable_immediate(struct drm_device *dev, unsigned int pipe
> >  		return false;
> >  
> >  	crtc = drm_crtc_from_index(dev, pipe);
> > -	if (crtc && crtc->funcs->get_vblank_timestamp)
> > -		return true;
> > -
> > -	if (dev->driver->get_vblank_timestamp)
> > -		return true;
> > +	if (!crtc || !crtc->funcs->get_vblank_timestamp)
> > +		return false;
> >  
> > -	return false;
> > +	return true;
> >  }
> >  
> >  static void drm_vblank_put(struct drm_device *dev, unsigned int pipe)
> > @@ -1798,7 +1790,6 @@ static void drm_handle_vblank_events(struct drm_device *dev, unsigned int pipe)
> >  	struct drm_pending_vblank_event *e, *t;
> >  	ktime_t now;
> >  	u64 seq;
> > -	bool high_prec;
> >  
> >  	assert_spin_locked(&dev->event_lock);
> >  
> > @@ -1818,10 +1809,8 @@ static void drm_handle_vblank_events(struct drm_device *dev, unsigned int pipe)
> >  		send_vblank_event(dev, e, seq, now);
> >  	}
> >  
> > -	high_prec = crtc->funcs->get_vblank_timestamp ||
> > -		    dev->driver->get_vblank_timestamp;
> > -
> > -	trace_drm_vblank_event(pipe, seq, now, high_prec);
> > +	trace_drm_vblank_event(pipe, seq, now,
> > +			       crtc->funcs->get_vblank_timestamp != NULL);
> >  }
> >  
> >  /**
> > diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
> > index b704e252f3b2..e290b3aca6eb 100644
> > --- a/include/drm/drm_drv.h
> > +++ b/include/drm/drm_drv.h
> > @@ -268,104 +268,6 @@ struct drm_driver {
> >  	 */
> >  	void (*release) (struct drm_device *);
> >  
> > -	/**
> > -	 * @get_vblank_counter:
> > -	 *
> > -	 * Driver callback for fetching a raw hardware vblank counter for the
> > -	 * CRTC specified with the pipe argument.  If a device doesn't have a
> > -	 * hardware counter, the driver can simply leave the hook as NULL.
> > -	 * The DRM core will account for missed vblank events while interrupts
> > -	 * where disabled based on system timestamps.
> > -	 *
> > -	 * Wraparound handling and loss of events due to modesetting is dealt
> > -	 * with in the DRM core code, as long as drivers call
> > -	 * drm_crtc_vblank_off() and drm_crtc_vblank_on() when disabling or
> > -	 * enabling a CRTC.
> > -	 *
> > -	 * This is deprecated and should not be used by new drivers.
> > -	 * Use &drm_crtc_funcs.get_vblank_counter instead.
> > -	 *
> > -	 * Returns:
> > -	 *
> > -	 * Raw vblank counter value.
> > -	 */
> > -	u32 (*get_vblank_counter) (struct drm_device *dev, unsigned int pipe);
> > -
> > -	/**
> > -	 * @enable_vblank:
> > -	 *
> > -	 * Enable vblank interrupts for the CRTC specified with the pipe
> > -	 * argument.
> > -	 *
> > -	 * This is deprecated and should not be used by new drivers.
> > -	 * Use &drm_crtc_funcs.enable_vblank instead.
> > -	 *
> > -	 * Returns:
> > -	 *
> > -	 * Zero on success, appropriate errno if the given @crtc's vblank
> > -	 * interrupt cannot be enabled.
> > -	 */
> > -	int (*enable_vblank) (struct drm_device *dev, unsigned int pipe);
> > -
> > -	/**
> > -	 * @disable_vblank:
> > -	 *
> > -	 * Disable vblank interrupts for the CRTC specified with the pipe
> > -	 * argument.
> > -	 *
> > -	 * This is deprecated and should not be used by new drivers.
> > -	 * Use &drm_crtc_funcs.disable_vblank instead.
> > -	 */
> > -	void (*disable_vblank) (struct drm_device *dev, unsigned int pipe);
> > -
> > -	/**
> > -	 * @get_vblank_timestamp:
> > -	 *
> > -	 * Called by drm_get_last_vbltimestamp(). Should return a precise
> > -	 * timestamp when the most recent VBLANK interval ended or will end.
> > -	 *
> > -	 * Specifically, the timestamp in @vblank_time should correspond as
> > -	 * closely as possible to the time when the first video scanline of
> > -	 * the video frame after the end of VBLANK will start scanning out,
> > -	 * the time immediately after end of the VBLANK interval. If the
> > -	 * @crtc is currently inside VBLANK, this will be a time in the future.
> > -	 * If the @crtc is currently scanning out a frame, this will be the
> > -	 * past start time of the current scanout. This is meant to adhere
> > -	 * to the OpenML OML_sync_control extension specification.
> > -	 *
> > -	 * Paramters:
> > -	 *
> > -	 * dev:
> > -	 *     dev DRM device handle.
> > -	 * pipe:
> > -	 *     crtc for which timestamp should be returned.
> > -	 * max_error:
> > -	 *     Maximum allowable timestamp error in nanoseconds.
> > -	 *     Implementation should strive to provide timestamp
> > -	 *     with an error of at most max_error nanoseconds.
> > -	 *     Returns true upper bound on error for timestamp.
> > -	 * vblank_time:
> > -	 *     Target location for returned vblank timestamp.
> > -	 * in_vblank_irq:
> > -	 *     True when called from drm_crtc_handle_vblank().  Some drivers
> > -	 *     need to apply some workarounds for gpu-specific vblank irq quirks
> > -	 *     if flag is set.
> > -	 *
> > -	 * Returns:
> > -	 *
> > -	 * True on success, false on failure, which means the core should
> > -	 * fallback to a simple timestamp taken in drm_crtc_handle_vblank().
> > -	 *
> > -	 * FIXME:
> > -	 *
> > -	 * We should move this hook to &struct drm_crtc_funcs like all the other
> > -	 * vblank hooks.
> > -	 */
> > -	bool (*get_vblank_timestamp) (struct drm_device *dev, unsigned int pipe,
> > -				     int *max_error,
> > -				     ktime_t *vblank_time,
> > -				     bool in_vblank_irq);
> > -
> >  	/**
> >  	 * @irq_handler:
> >  	 *
> > @@ -720,6 +622,9 @@ struct drm_driver {
> >  	int (*dma_ioctl) (struct drm_device *dev, void *data, struct drm_file *file_priv);
> >  	int (*dma_quiescent) (struct drm_device *);
> >  	int (*context_dtor) (struct drm_device *dev, int context);
> > +	u32 (*get_vblank_counter)(struct drm_device *dev, unsigned int pipe);
> > +	int (*enable_vblank)(struct drm_device *dev, unsigned int pipe);
> > +	void (*disable_vblank)(struct drm_device *dev, unsigned int pipe);
> >  	int dev_priv_size;
> >  };
> >  
> > -- 
> > 2.24.1
> > 
> 
> -- 
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [PATCH 23/23] drm: Cleanup VBLANK callbacks in struct drm_driver
@ 2020-01-12 22:54       ` Daniel Vetter
  0 siblings, 0 replies; 217+ messages in thread
From: Daniel Vetter @ 2020-01-12 22:54 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: hamohammed.sa, airlied, nouveau, dri-devel, amd-gfx,
	alexandre.torgue, thellstrom, sean, linux-graphics-maintainer,
	bskeggs, mcoquelin.stm32, sunpeng.li, linux-arm-msm, intel-gfx,
	rodrigo.vivi, vincent.abriou, rodrigosiqueiramelo,
	philippe.cornu, yannick.fertre, alexander.deucher, freedreno,
	christian.koenig

On Sun, Jan 12, 2020 at 11:53:12PM +0100, Daniel Vetter wrote:
> On Fri, Jan 10, 2020 at 10:21:27AM +0100, Thomas Zimmermann wrote:
> > All non-legacy users of VBLANK functions in struct drm_driver have been
> > converted to use the respective interfaces in struct drm_crtc_funcs. The
> > remaining users of VBLANK callbacks in struct drm_driver are legacy drivers
> > with userspace modesetting.
> > 
> > There are no users left of get_vblank_timestamp(), so the callback is
> > being removed. The other VBLANK callbacks are being moved to the legacy
> > section at the end of struct drm_driver.
> > 
> > Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> 
> I think sprinkling some WARN_ON (in drm_dev_register or wherever) if new
> drivers try to use the legacy hooks would be really nice. Experience says
> someone is going to copypaste this stuff around forever otherwise.

I meant to add: As a follow-up patch.
-Daniel

> 
> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> 
> > ---
> >  drivers/gpu/drm/drm_vblank.c |  39 +++++---------
> >  include/drm/drm_drv.h        | 101 ++---------------------------------
> >  2 files changed, 17 insertions(+), 123 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
> > index 7cf436a4b908..ceff68474d4d 100644
> > --- a/drivers/gpu/drm/drm_vblank.c
> > +++ b/drivers/gpu/drm/drm_vblank.c
> > @@ -138,10 +138,9 @@ static u32 __get_vblank_counter(struct drm_device *dev, unsigned int pipe)
> >  
> >  		if (crtc->funcs->get_vblank_counter)
> >  			return crtc->funcs->get_vblank_counter(crtc);
> > -	}
> > -
> > -	if (dev->driver->get_vblank_counter)
> > +	} else if (dev->driver->get_vblank_counter) {
> >  		return dev->driver->get_vblank_counter(dev, pipe);
> > +	}
> >  
> >  	return drm_vblank_no_hw_counter(dev, pipe);
> >  }
> > @@ -334,8 +333,7 @@ u64 drm_crtc_accurate_vblank_count(struct drm_crtc *crtc)
> >  	unsigned long flags;
> >  
> >  	WARN_ONCE(drm_debug_enabled(DRM_UT_VBL) &&
> > -		  !crtc->funcs->get_vblank_timestamp &&
> > -		  !dev->driver->get_vblank_timestamp,
> > +		  !crtc->funcs->get_vblank_timestamp,
> >  		  "This function requires support for accurate vblank timestamps.");
> >  
> >  	spin_lock_irqsave(&dev->vblank_time_lock, flags);
> > @@ -357,13 +355,11 @@ static void __disable_vblank(struct drm_device *dev, unsigned int pipe)
> >  		if (WARN_ON(!crtc))
> >  			return;
> >  
> > -		if (crtc->funcs->disable_vblank) {
> > +		if (crtc->funcs->disable_vblank)
> >  			crtc->funcs->disable_vblank(crtc);
> > -			return;
> > -		}
> > +	} else {
> > +		dev->driver->disable_vblank(dev, pipe);
> >  	}
> > -
> > -	dev->driver->disable_vblank(dev, pipe);
> >  }
> >  
> >  /*
> > @@ -791,9 +787,6 @@ drm_get_last_vbltimestamp(struct drm_device *dev, unsigned int pipe,
> >  
> >  		ret = crtc->funcs->get_vblank_timestamp(crtc, &max_error,
> >  							tvblank, in_vblank_irq);
> > -	} else if (dev->driver->get_vblank_timestamp && (max_error > 0)) {
> > -		ret = dev->driver->get_vblank_timestamp(dev, pipe, &max_error,
> > -							tvblank, in_vblank_irq);
> >  	}
> >  
> >  	/* GPU high precision timestamp query unsupported or failed.
> > @@ -1016,9 +1009,11 @@ static int __enable_vblank(struct drm_device *dev, unsigned int pipe)
> >  
> >  		if (crtc->funcs->enable_vblank)
> >  			return crtc->funcs->enable_vblank(crtc);
> > +	} else if (dev->driver->enable_vblank) {
> > +		return dev->driver->enable_vblank(dev, pipe);
> >  	}
> >  
> > -	return dev->driver->enable_vblank(dev, pipe);
> > +	return -EINVAL;
> >  }
> >  
> >  static int drm_vblank_enable(struct drm_device *dev, unsigned int pipe)
> > @@ -1109,13 +1104,10 @@ static bool __vblank_disable_immediate(struct drm_device *dev, unsigned int pipe
> >  		return false;
> >  
> >  	crtc = drm_crtc_from_index(dev, pipe);
> > -	if (crtc && crtc->funcs->get_vblank_timestamp)
> > -		return true;
> > -
> > -	if (dev->driver->get_vblank_timestamp)
> > -		return true;
> > +	if (!crtc || !crtc->funcs->get_vblank_timestamp)
> > +		return false;
> >  
> > -	return false;
> > +	return true;
> >  }
> >  
> >  static void drm_vblank_put(struct drm_device *dev, unsigned int pipe)
> > @@ -1798,7 +1790,6 @@ static void drm_handle_vblank_events(struct drm_device *dev, unsigned int pipe)
> >  	struct drm_pending_vblank_event *e, *t;
> >  	ktime_t now;
> >  	u64 seq;
> > -	bool high_prec;
> >  
> >  	assert_spin_locked(&dev->event_lock);
> >  
> > @@ -1818,10 +1809,8 @@ static void drm_handle_vblank_events(struct drm_device *dev, unsigned int pipe)
> >  		send_vblank_event(dev, e, seq, now);
> >  	}
> >  
> > -	high_prec = crtc->funcs->get_vblank_timestamp ||
> > -		    dev->driver->get_vblank_timestamp;
> > -
> > -	trace_drm_vblank_event(pipe, seq, now, high_prec);
> > +	trace_drm_vblank_event(pipe, seq, now,
> > +			       crtc->funcs->get_vblank_timestamp != NULL);
> >  }
> >  
> >  /**
> > diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
> > index b704e252f3b2..e290b3aca6eb 100644
> > --- a/include/drm/drm_drv.h
> > +++ b/include/drm/drm_drv.h
> > @@ -268,104 +268,6 @@ struct drm_driver {
> >  	 */
> >  	void (*release) (struct drm_device *);
> >  
> > -	/**
> > -	 * @get_vblank_counter:
> > -	 *
> > -	 * Driver callback for fetching a raw hardware vblank counter for the
> > -	 * CRTC specified with the pipe argument.  If a device doesn't have a
> > -	 * hardware counter, the driver can simply leave the hook as NULL.
> > -	 * The DRM core will account for missed vblank events while interrupts
> > -	 * where disabled based on system timestamps.
> > -	 *
> > -	 * Wraparound handling and loss of events due to modesetting is dealt
> > -	 * with in the DRM core code, as long as drivers call
> > -	 * drm_crtc_vblank_off() and drm_crtc_vblank_on() when disabling or
> > -	 * enabling a CRTC.
> > -	 *
> > -	 * This is deprecated and should not be used by new drivers.
> > -	 * Use &drm_crtc_funcs.get_vblank_counter instead.
> > -	 *
> > -	 * Returns:
> > -	 *
> > -	 * Raw vblank counter value.
> > -	 */
> > -	u32 (*get_vblank_counter) (struct drm_device *dev, unsigned int pipe);
> > -
> > -	/**
> > -	 * @enable_vblank:
> > -	 *
> > -	 * Enable vblank interrupts for the CRTC specified with the pipe
> > -	 * argument.
> > -	 *
> > -	 * This is deprecated and should not be used by new drivers.
> > -	 * Use &drm_crtc_funcs.enable_vblank instead.
> > -	 *
> > -	 * Returns:
> > -	 *
> > -	 * Zero on success, appropriate errno if the given @crtc's vblank
> > -	 * interrupt cannot be enabled.
> > -	 */
> > -	int (*enable_vblank) (struct drm_device *dev, unsigned int pipe);
> > -
> > -	/**
> > -	 * @disable_vblank:
> > -	 *
> > -	 * Disable vblank interrupts for the CRTC specified with the pipe
> > -	 * argument.
> > -	 *
> > -	 * This is deprecated and should not be used by new drivers.
> > -	 * Use &drm_crtc_funcs.disable_vblank instead.
> > -	 */
> > -	void (*disable_vblank) (struct drm_device *dev, unsigned int pipe);
> > -
> > -	/**
> > -	 * @get_vblank_timestamp:
> > -	 *
> > -	 * Called by drm_get_last_vbltimestamp(). Should return a precise
> > -	 * timestamp when the most recent VBLANK interval ended or will end.
> > -	 *
> > -	 * Specifically, the timestamp in @vblank_time should correspond as
> > -	 * closely as possible to the time when the first video scanline of
> > -	 * the video frame after the end of VBLANK will start scanning out,
> > -	 * the time immediately after end of the VBLANK interval. If the
> > -	 * @crtc is currently inside VBLANK, this will be a time in the future.
> > -	 * If the @crtc is currently scanning out a frame, this will be the
> > -	 * past start time of the current scanout. This is meant to adhere
> > -	 * to the OpenML OML_sync_control extension specification.
> > -	 *
> > -	 * Paramters:
> > -	 *
> > -	 * dev:
> > -	 *     dev DRM device handle.
> > -	 * pipe:
> > -	 *     crtc for which timestamp should be returned.
> > -	 * max_error:
> > -	 *     Maximum allowable timestamp error in nanoseconds.
> > -	 *     Implementation should strive to provide timestamp
> > -	 *     with an error of at most max_error nanoseconds.
> > -	 *     Returns true upper bound on error for timestamp.
> > -	 * vblank_time:
> > -	 *     Target location for returned vblank timestamp.
> > -	 * in_vblank_irq:
> > -	 *     True when called from drm_crtc_handle_vblank().  Some drivers
> > -	 *     need to apply some workarounds for gpu-specific vblank irq quirks
> > -	 *     if flag is set.
> > -	 *
> > -	 * Returns:
> > -	 *
> > -	 * True on success, false on failure, which means the core should
> > -	 * fallback to a simple timestamp taken in drm_crtc_handle_vblank().
> > -	 *
> > -	 * FIXME:
> > -	 *
> > -	 * We should move this hook to &struct drm_crtc_funcs like all the other
> > -	 * vblank hooks.
> > -	 */
> > -	bool (*get_vblank_timestamp) (struct drm_device *dev, unsigned int pipe,
> > -				     int *max_error,
> > -				     ktime_t *vblank_time,
> > -				     bool in_vblank_irq);
> > -
> >  	/**
> >  	 * @irq_handler:
> >  	 *
> > @@ -720,6 +622,9 @@ struct drm_driver {
> >  	int (*dma_ioctl) (struct drm_device *dev, void *data, struct drm_file *file_priv);
> >  	int (*dma_quiescent) (struct drm_device *);
> >  	int (*context_dtor) (struct drm_device *dev, int context);
> > +	u32 (*get_vblank_counter)(struct drm_device *dev, unsigned int pipe);
> > +	int (*enable_vblank)(struct drm_device *dev, unsigned int pipe);
> > +	void (*disable_vblank)(struct drm_device *dev, unsigned int pipe);
> >  	int dev_priv_size;
> >  };
> >  
> > -- 
> > 2.24.1
> > 
> 
> -- 
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [Intel-gfx] [PATCH 23/23] drm: Cleanup VBLANK callbacks in struct drm_driver
@ 2020-01-12 22:54       ` Daniel Vetter
  0 siblings, 0 replies; 217+ messages in thread
From: Daniel Vetter @ 2020-01-12 22:54 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: hamohammed.sa, airlied, nouveau, dri-devel, eric, amd-gfx,
	benjamin.gaignard, alexandre.torgue, David1.Zhou, thellstrom,
	linux-graphics-maintainer, bskeggs, harry.wentland,
	mcoquelin.stm32, sunpeng.li, linux-arm-msm, intel-gfx,
	vincent.abriou, rodrigosiqueiramelo, philippe.cornu,
	yannick.fertre, alexander.deucher, freedreno, christian.koenig

On Sun, Jan 12, 2020 at 11:53:12PM +0100, Daniel Vetter wrote:
> On Fri, Jan 10, 2020 at 10:21:27AM +0100, Thomas Zimmermann wrote:
> > All non-legacy users of VBLANK functions in struct drm_driver have been
> > converted to use the respective interfaces in struct drm_crtc_funcs. The
> > remaining users of VBLANK callbacks in struct drm_driver are legacy drivers
> > with userspace modesetting.
> > 
> > There are no users left of get_vblank_timestamp(), so the callback is
> > being removed. The other VBLANK callbacks are being moved to the legacy
> > section at the end of struct drm_driver.
> > 
> > Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> 
> I think sprinkling some WARN_ON (in drm_dev_register or wherever) if new
> drivers try to use the legacy hooks would be really nice. Experience says
> someone is going to copypaste this stuff around forever otherwise.

I meant to add: As a follow-up patch.
-Daniel

> 
> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> 
> > ---
> >  drivers/gpu/drm/drm_vblank.c |  39 +++++---------
> >  include/drm/drm_drv.h        | 101 ++---------------------------------
> >  2 files changed, 17 insertions(+), 123 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
> > index 7cf436a4b908..ceff68474d4d 100644
> > --- a/drivers/gpu/drm/drm_vblank.c
> > +++ b/drivers/gpu/drm/drm_vblank.c
> > @@ -138,10 +138,9 @@ static u32 __get_vblank_counter(struct drm_device *dev, unsigned int pipe)
> >  
> >  		if (crtc->funcs->get_vblank_counter)
> >  			return crtc->funcs->get_vblank_counter(crtc);
> > -	}
> > -
> > -	if (dev->driver->get_vblank_counter)
> > +	} else if (dev->driver->get_vblank_counter) {
> >  		return dev->driver->get_vblank_counter(dev, pipe);
> > +	}
> >  
> >  	return drm_vblank_no_hw_counter(dev, pipe);
> >  }
> > @@ -334,8 +333,7 @@ u64 drm_crtc_accurate_vblank_count(struct drm_crtc *crtc)
> >  	unsigned long flags;
> >  
> >  	WARN_ONCE(drm_debug_enabled(DRM_UT_VBL) &&
> > -		  !crtc->funcs->get_vblank_timestamp &&
> > -		  !dev->driver->get_vblank_timestamp,
> > +		  !crtc->funcs->get_vblank_timestamp,
> >  		  "This function requires support for accurate vblank timestamps.");
> >  
> >  	spin_lock_irqsave(&dev->vblank_time_lock, flags);
> > @@ -357,13 +355,11 @@ static void __disable_vblank(struct drm_device *dev, unsigned int pipe)
> >  		if (WARN_ON(!crtc))
> >  			return;
> >  
> > -		if (crtc->funcs->disable_vblank) {
> > +		if (crtc->funcs->disable_vblank)
> >  			crtc->funcs->disable_vblank(crtc);
> > -			return;
> > -		}
> > +	} else {
> > +		dev->driver->disable_vblank(dev, pipe);
> >  	}
> > -
> > -	dev->driver->disable_vblank(dev, pipe);
> >  }
> >  
> >  /*
> > @@ -791,9 +787,6 @@ drm_get_last_vbltimestamp(struct drm_device *dev, unsigned int pipe,
> >  
> >  		ret = crtc->funcs->get_vblank_timestamp(crtc, &max_error,
> >  							tvblank, in_vblank_irq);
> > -	} else if (dev->driver->get_vblank_timestamp && (max_error > 0)) {
> > -		ret = dev->driver->get_vblank_timestamp(dev, pipe, &max_error,
> > -							tvblank, in_vblank_irq);
> >  	}
> >  
> >  	/* GPU high precision timestamp query unsupported or failed.
> > @@ -1016,9 +1009,11 @@ static int __enable_vblank(struct drm_device *dev, unsigned int pipe)
> >  
> >  		if (crtc->funcs->enable_vblank)
> >  			return crtc->funcs->enable_vblank(crtc);
> > +	} else if (dev->driver->enable_vblank) {
> > +		return dev->driver->enable_vblank(dev, pipe);
> >  	}
> >  
> > -	return dev->driver->enable_vblank(dev, pipe);
> > +	return -EINVAL;
> >  }
> >  
> >  static int drm_vblank_enable(struct drm_device *dev, unsigned int pipe)
> > @@ -1109,13 +1104,10 @@ static bool __vblank_disable_immediate(struct drm_device *dev, unsigned int pipe
> >  		return false;
> >  
> >  	crtc = drm_crtc_from_index(dev, pipe);
> > -	if (crtc && crtc->funcs->get_vblank_timestamp)
> > -		return true;
> > -
> > -	if (dev->driver->get_vblank_timestamp)
> > -		return true;
> > +	if (!crtc || !crtc->funcs->get_vblank_timestamp)
> > +		return false;
> >  
> > -	return false;
> > +	return true;
> >  }
> >  
> >  static void drm_vblank_put(struct drm_device *dev, unsigned int pipe)
> > @@ -1798,7 +1790,6 @@ static void drm_handle_vblank_events(struct drm_device *dev, unsigned int pipe)
> >  	struct drm_pending_vblank_event *e, *t;
> >  	ktime_t now;
> >  	u64 seq;
> > -	bool high_prec;
> >  
> >  	assert_spin_locked(&dev->event_lock);
> >  
> > @@ -1818,10 +1809,8 @@ static void drm_handle_vblank_events(struct drm_device *dev, unsigned int pipe)
> >  		send_vblank_event(dev, e, seq, now);
> >  	}
> >  
> > -	high_prec = crtc->funcs->get_vblank_timestamp ||
> > -		    dev->driver->get_vblank_timestamp;
> > -
> > -	trace_drm_vblank_event(pipe, seq, now, high_prec);
> > +	trace_drm_vblank_event(pipe, seq, now,
> > +			       crtc->funcs->get_vblank_timestamp != NULL);
> >  }
> >  
> >  /**
> > diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
> > index b704e252f3b2..e290b3aca6eb 100644
> > --- a/include/drm/drm_drv.h
> > +++ b/include/drm/drm_drv.h
> > @@ -268,104 +268,6 @@ struct drm_driver {
> >  	 */
> >  	void (*release) (struct drm_device *);
> >  
> > -	/**
> > -	 * @get_vblank_counter:
> > -	 *
> > -	 * Driver callback for fetching a raw hardware vblank counter for the
> > -	 * CRTC specified with the pipe argument.  If a device doesn't have a
> > -	 * hardware counter, the driver can simply leave the hook as NULL.
> > -	 * The DRM core will account for missed vblank events while interrupts
> > -	 * where disabled based on system timestamps.
> > -	 *
> > -	 * Wraparound handling and loss of events due to modesetting is dealt
> > -	 * with in the DRM core code, as long as drivers call
> > -	 * drm_crtc_vblank_off() and drm_crtc_vblank_on() when disabling or
> > -	 * enabling a CRTC.
> > -	 *
> > -	 * This is deprecated and should not be used by new drivers.
> > -	 * Use &drm_crtc_funcs.get_vblank_counter instead.
> > -	 *
> > -	 * Returns:
> > -	 *
> > -	 * Raw vblank counter value.
> > -	 */
> > -	u32 (*get_vblank_counter) (struct drm_device *dev, unsigned int pipe);
> > -
> > -	/**
> > -	 * @enable_vblank:
> > -	 *
> > -	 * Enable vblank interrupts for the CRTC specified with the pipe
> > -	 * argument.
> > -	 *
> > -	 * This is deprecated and should not be used by new drivers.
> > -	 * Use &drm_crtc_funcs.enable_vblank instead.
> > -	 *
> > -	 * Returns:
> > -	 *
> > -	 * Zero on success, appropriate errno if the given @crtc's vblank
> > -	 * interrupt cannot be enabled.
> > -	 */
> > -	int (*enable_vblank) (struct drm_device *dev, unsigned int pipe);
> > -
> > -	/**
> > -	 * @disable_vblank:
> > -	 *
> > -	 * Disable vblank interrupts for the CRTC specified with the pipe
> > -	 * argument.
> > -	 *
> > -	 * This is deprecated and should not be used by new drivers.
> > -	 * Use &drm_crtc_funcs.disable_vblank instead.
> > -	 */
> > -	void (*disable_vblank) (struct drm_device *dev, unsigned int pipe);
> > -
> > -	/**
> > -	 * @get_vblank_timestamp:
> > -	 *
> > -	 * Called by drm_get_last_vbltimestamp(). Should return a precise
> > -	 * timestamp when the most recent VBLANK interval ended or will end.
> > -	 *
> > -	 * Specifically, the timestamp in @vblank_time should correspond as
> > -	 * closely as possible to the time when the first video scanline of
> > -	 * the video frame after the end of VBLANK will start scanning out,
> > -	 * the time immediately after end of the VBLANK interval. If the
> > -	 * @crtc is currently inside VBLANK, this will be a time in the future.
> > -	 * If the @crtc is currently scanning out a frame, this will be the
> > -	 * past start time of the current scanout. This is meant to adhere
> > -	 * to the OpenML OML_sync_control extension specification.
> > -	 *
> > -	 * Paramters:
> > -	 *
> > -	 * dev:
> > -	 *     dev DRM device handle.
> > -	 * pipe:
> > -	 *     crtc for which timestamp should be returned.
> > -	 * max_error:
> > -	 *     Maximum allowable timestamp error in nanoseconds.
> > -	 *     Implementation should strive to provide timestamp
> > -	 *     with an error of at most max_error nanoseconds.
> > -	 *     Returns true upper bound on error for timestamp.
> > -	 * vblank_time:
> > -	 *     Target location for returned vblank timestamp.
> > -	 * in_vblank_irq:
> > -	 *     True when called from drm_crtc_handle_vblank().  Some drivers
> > -	 *     need to apply some workarounds for gpu-specific vblank irq quirks
> > -	 *     if flag is set.
> > -	 *
> > -	 * Returns:
> > -	 *
> > -	 * True on success, false on failure, which means the core should
> > -	 * fallback to a simple timestamp taken in drm_crtc_handle_vblank().
> > -	 *
> > -	 * FIXME:
> > -	 *
> > -	 * We should move this hook to &struct drm_crtc_funcs like all the other
> > -	 * vblank hooks.
> > -	 */
> > -	bool (*get_vblank_timestamp) (struct drm_device *dev, unsigned int pipe,
> > -				     int *max_error,
> > -				     ktime_t *vblank_time,
> > -				     bool in_vblank_irq);
> > -
> >  	/**
> >  	 * @irq_handler:
> >  	 *
> > @@ -720,6 +622,9 @@ struct drm_driver {
> >  	int (*dma_ioctl) (struct drm_device *dev, void *data, struct drm_file *file_priv);
> >  	int (*dma_quiescent) (struct drm_device *);
> >  	int (*context_dtor) (struct drm_device *dev, int context);
> > +	u32 (*get_vblank_counter)(struct drm_device *dev, unsigned int pipe);
> > +	int (*enable_vblank)(struct drm_device *dev, unsigned int pipe);
> > +	void (*disable_vblank)(struct drm_device *dev, unsigned int pipe);
> >  	int dev_priv_size;
> >  };
> >  
> > -- 
> > 2.24.1
> > 
> 
> -- 
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [PATCH 23/23] drm: Cleanup VBLANK callbacks in struct drm_driver
@ 2020-01-12 22:54       ` Daniel Vetter
  0 siblings, 0 replies; 217+ messages in thread
From: Daniel Vetter @ 2020-01-12 22:54 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: hamohammed.sa, airlied, nouveau, joonas.lahtinen, dri-devel,
	eric, amd-gfx, benjamin.gaignard, alexandre.torgue, David1.Zhou,
	thellstrom, sean, patrik.r.jakobsson, linux-graphics-maintainer,
	bskeggs, harry.wentland, mcoquelin.stm32, sunpeng.li,
	linux-arm-msm, intel-gfx, maarten.lankhorst, jani.nikula,
	rodrigo.vivi, vincent.abriou, rodrigosiqueiramelo,
	philippe.cornu, yannick.fertre, robdclark, daniel,
	alexander.deucher, freedreno, christian.koenig

On Sun, Jan 12, 2020 at 11:53:12PM +0100, Daniel Vetter wrote:
> On Fri, Jan 10, 2020 at 10:21:27AM +0100, Thomas Zimmermann wrote:
> > All non-legacy users of VBLANK functions in struct drm_driver have been
> > converted to use the respective interfaces in struct drm_crtc_funcs. The
> > remaining users of VBLANK callbacks in struct drm_driver are legacy drivers
> > with userspace modesetting.
> > 
> > There are no users left of get_vblank_timestamp(), so the callback is
> > being removed. The other VBLANK callbacks are being moved to the legacy
> > section at the end of struct drm_driver.
> > 
> > Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> 
> I think sprinkling some WARN_ON (in drm_dev_register or wherever) if new
> drivers try to use the legacy hooks would be really nice. Experience says
> someone is going to copypaste this stuff around forever otherwise.

I meant to add: As a follow-up patch.
-Daniel

> 
> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> 
> > ---
> >  drivers/gpu/drm/drm_vblank.c |  39 +++++---------
> >  include/drm/drm_drv.h        | 101 ++---------------------------------
> >  2 files changed, 17 insertions(+), 123 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
> > index 7cf436a4b908..ceff68474d4d 100644
> > --- a/drivers/gpu/drm/drm_vblank.c
> > +++ b/drivers/gpu/drm/drm_vblank.c
> > @@ -138,10 +138,9 @@ static u32 __get_vblank_counter(struct drm_device *dev, unsigned int pipe)
> >  
> >  		if (crtc->funcs->get_vblank_counter)
> >  			return crtc->funcs->get_vblank_counter(crtc);
> > -	}
> > -
> > -	if (dev->driver->get_vblank_counter)
> > +	} else if (dev->driver->get_vblank_counter) {
> >  		return dev->driver->get_vblank_counter(dev, pipe);
> > +	}
> >  
> >  	return drm_vblank_no_hw_counter(dev, pipe);
> >  }
> > @@ -334,8 +333,7 @@ u64 drm_crtc_accurate_vblank_count(struct drm_crtc *crtc)
> >  	unsigned long flags;
> >  
> >  	WARN_ONCE(drm_debug_enabled(DRM_UT_VBL) &&
> > -		  !crtc->funcs->get_vblank_timestamp &&
> > -		  !dev->driver->get_vblank_timestamp,
> > +		  !crtc->funcs->get_vblank_timestamp,
> >  		  "This function requires support for accurate vblank timestamps.");
> >  
> >  	spin_lock_irqsave(&dev->vblank_time_lock, flags);
> > @@ -357,13 +355,11 @@ static void __disable_vblank(struct drm_device *dev, unsigned int pipe)
> >  		if (WARN_ON(!crtc))
> >  			return;
> >  
> > -		if (crtc->funcs->disable_vblank) {
> > +		if (crtc->funcs->disable_vblank)
> >  			crtc->funcs->disable_vblank(crtc);
> > -			return;
> > -		}
> > +	} else {
> > +		dev->driver->disable_vblank(dev, pipe);
> >  	}
> > -
> > -	dev->driver->disable_vblank(dev, pipe);
> >  }
> >  
> >  /*
> > @@ -791,9 +787,6 @@ drm_get_last_vbltimestamp(struct drm_device *dev, unsigned int pipe,
> >  
> >  		ret = crtc->funcs->get_vblank_timestamp(crtc, &max_error,
> >  							tvblank, in_vblank_irq);
> > -	} else if (dev->driver->get_vblank_timestamp && (max_error > 0)) {
> > -		ret = dev->driver->get_vblank_timestamp(dev, pipe, &max_error,
> > -							tvblank, in_vblank_irq);
> >  	}
> >  
> >  	/* GPU high precision timestamp query unsupported or failed.
> > @@ -1016,9 +1009,11 @@ static int __enable_vblank(struct drm_device *dev, unsigned int pipe)
> >  
> >  		if (crtc->funcs->enable_vblank)
> >  			return crtc->funcs->enable_vblank(crtc);
> > +	} else if (dev->driver->enable_vblank) {
> > +		return dev->driver->enable_vblank(dev, pipe);
> >  	}
> >  
> > -	return dev->driver->enable_vblank(dev, pipe);
> > +	return -EINVAL;
> >  }
> >  
> >  static int drm_vblank_enable(struct drm_device *dev, unsigned int pipe)
> > @@ -1109,13 +1104,10 @@ static bool __vblank_disable_immediate(struct drm_device *dev, unsigned int pipe
> >  		return false;
> >  
> >  	crtc = drm_crtc_from_index(dev, pipe);
> > -	if (crtc && crtc->funcs->get_vblank_timestamp)
> > -		return true;
> > -
> > -	if (dev->driver->get_vblank_timestamp)
> > -		return true;
> > +	if (!crtc || !crtc->funcs->get_vblank_timestamp)
> > +		return false;
> >  
> > -	return false;
> > +	return true;
> >  }
> >  
> >  static void drm_vblank_put(struct drm_device *dev, unsigned int pipe)
> > @@ -1798,7 +1790,6 @@ static void drm_handle_vblank_events(struct drm_device *dev, unsigned int pipe)
> >  	struct drm_pending_vblank_event *e, *t;
> >  	ktime_t now;
> >  	u64 seq;
> > -	bool high_prec;
> >  
> >  	assert_spin_locked(&dev->event_lock);
> >  
> > @@ -1818,10 +1809,8 @@ static void drm_handle_vblank_events(struct drm_device *dev, unsigned int pipe)
> >  		send_vblank_event(dev, e, seq, now);
> >  	}
> >  
> > -	high_prec = crtc->funcs->get_vblank_timestamp ||
> > -		    dev->driver->get_vblank_timestamp;
> > -
> > -	trace_drm_vblank_event(pipe, seq, now, high_prec);
> > +	trace_drm_vblank_event(pipe, seq, now,
> > +			       crtc->funcs->get_vblank_timestamp != NULL);
> >  }
> >  
> >  /**
> > diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
> > index b704e252f3b2..e290b3aca6eb 100644
> > --- a/include/drm/drm_drv.h
> > +++ b/include/drm/drm_drv.h
> > @@ -268,104 +268,6 @@ struct drm_driver {
> >  	 */
> >  	void (*release) (struct drm_device *);
> >  
> > -	/**
> > -	 * @get_vblank_counter:
> > -	 *
> > -	 * Driver callback for fetching a raw hardware vblank counter for the
> > -	 * CRTC specified with the pipe argument.  If a device doesn't have a
> > -	 * hardware counter, the driver can simply leave the hook as NULL.
> > -	 * The DRM core will account for missed vblank events while interrupts
> > -	 * where disabled based on system timestamps.
> > -	 *
> > -	 * Wraparound handling and loss of events due to modesetting is dealt
> > -	 * with in the DRM core code, as long as drivers call
> > -	 * drm_crtc_vblank_off() and drm_crtc_vblank_on() when disabling or
> > -	 * enabling a CRTC.
> > -	 *
> > -	 * This is deprecated and should not be used by new drivers.
> > -	 * Use &drm_crtc_funcs.get_vblank_counter instead.
> > -	 *
> > -	 * Returns:
> > -	 *
> > -	 * Raw vblank counter value.
> > -	 */
> > -	u32 (*get_vblank_counter) (struct drm_device *dev, unsigned int pipe);
> > -
> > -	/**
> > -	 * @enable_vblank:
> > -	 *
> > -	 * Enable vblank interrupts for the CRTC specified with the pipe
> > -	 * argument.
> > -	 *
> > -	 * This is deprecated and should not be used by new drivers.
> > -	 * Use &drm_crtc_funcs.enable_vblank instead.
> > -	 *
> > -	 * Returns:
> > -	 *
> > -	 * Zero on success, appropriate errno if the given @crtc's vblank
> > -	 * interrupt cannot be enabled.
> > -	 */
> > -	int (*enable_vblank) (struct drm_device *dev, unsigned int pipe);
> > -
> > -	/**
> > -	 * @disable_vblank:
> > -	 *
> > -	 * Disable vblank interrupts for the CRTC specified with the pipe
> > -	 * argument.
> > -	 *
> > -	 * This is deprecated and should not be used by new drivers.
> > -	 * Use &drm_crtc_funcs.disable_vblank instead.
> > -	 */
> > -	void (*disable_vblank) (struct drm_device *dev, unsigned int pipe);
> > -
> > -	/**
> > -	 * @get_vblank_timestamp:
> > -	 *
> > -	 * Called by drm_get_last_vbltimestamp(). Should return a precise
> > -	 * timestamp when the most recent VBLANK interval ended or will end.
> > -	 *
> > -	 * Specifically, the timestamp in @vblank_time should correspond as
> > -	 * closely as possible to the time when the first video scanline of
> > -	 * the video frame after the end of VBLANK will start scanning out,
> > -	 * the time immediately after end of the VBLANK interval. If the
> > -	 * @crtc is currently inside VBLANK, this will be a time in the future.
> > -	 * If the @crtc is currently scanning out a frame, this will be the
> > -	 * past start time of the current scanout. This is meant to adhere
> > -	 * to the OpenML OML_sync_control extension specification.
> > -	 *
> > -	 * Paramters:
> > -	 *
> > -	 * dev:
> > -	 *     dev DRM device handle.
> > -	 * pipe:
> > -	 *     crtc for which timestamp should be returned.
> > -	 * max_error:
> > -	 *     Maximum allowable timestamp error in nanoseconds.
> > -	 *     Implementation should strive to provide timestamp
> > -	 *     with an error of at most max_error nanoseconds.
> > -	 *     Returns true upper bound on error for timestamp.
> > -	 * vblank_time:
> > -	 *     Target location for returned vblank timestamp.
> > -	 * in_vblank_irq:
> > -	 *     True when called from drm_crtc_handle_vblank().  Some drivers
> > -	 *     need to apply some workarounds for gpu-specific vblank irq quirks
> > -	 *     if flag is set.
> > -	 *
> > -	 * Returns:
> > -	 *
> > -	 * True on success, false on failure, which means the core should
> > -	 * fallback to a simple timestamp taken in drm_crtc_handle_vblank().
> > -	 *
> > -	 * FIXME:
> > -	 *
> > -	 * We should move this hook to &struct drm_crtc_funcs like all the other
> > -	 * vblank hooks.
> > -	 */
> > -	bool (*get_vblank_timestamp) (struct drm_device *dev, unsigned int pipe,
> > -				     int *max_error,
> > -				     ktime_t *vblank_time,
> > -				     bool in_vblank_irq);
> > -
> >  	/**
> >  	 * @irq_handler:
> >  	 *
> > @@ -720,6 +622,9 @@ struct drm_driver {
> >  	int (*dma_ioctl) (struct drm_device *dev, void *data, struct drm_file *file_priv);
> >  	int (*dma_quiescent) (struct drm_device *);
> >  	int (*context_dtor) (struct drm_device *dev, int context);
> > +	u32 (*get_vblank_counter)(struct drm_device *dev, unsigned int pipe);
> > +	int (*enable_vblank)(struct drm_device *dev, unsigned int pipe);
> > +	void (*disable_vblank)(struct drm_device *dev, unsigned int pipe);
> >  	int dev_priv_size;
> >  };
> >  
> > -- 
> > 2.24.1
> > 
> 
> -- 
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 217+ messages in thread

* [Intel-gfx] ✓ Fi.CI.IGT: success for drm: Clean up VBLANK callbacks in struct drm_driver
  2020-01-10  9:21 ` Thomas Zimmermann
                   ` (29 preceding siblings ...)
  (?)
@ 2020-01-13 12:57 ` Patchwork
  -1 siblings, 0 replies; 217+ messages in thread
From: Patchwork @ 2020-01-13 12:57 UTC (permalink / raw)
  To: Thomas Zimmermann; +Cc: intel-gfx

== Series Details ==

Series: drm: Clean up VBLANK callbacks in struct drm_driver
URL   : https://patchwork.freedesktop.org/series/71873/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_7715_full -> Patchwork_16048_full
====================================================

Summary
-------

  **SUCCESS**

  No regressions found.

  

Known issues
------------

  Here are the changes found in Patchwork_16048_full that come from known issues:

### IGT changes ###

#### Issues hit ####

  * igt@gem_ctx_persistence@vcs1-mixed-process:
    - shard-iclb:         [PASS][1] -> [SKIP][2] ([fdo#109276] / [fdo#112080]) +2 similar issues
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7715/shard-iclb2/igt@gem_ctx_persistence@vcs1-mixed-process.html
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16048/shard-iclb3/igt@gem_ctx_persistence@vcs1-mixed-process.html

  * igt@gem_ctx_shared@q-smoketest-blt:
    - shard-tglb:         [PASS][3] -> [INCOMPLETE][4] ([fdo#111735])
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7715/shard-tglb1/igt@gem_ctx_shared@q-smoketest-blt.html
   [4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16048/shard-tglb6/igt@gem_ctx_shared@q-smoketest-blt.html

  * igt@gem_exec_create@basic:
    - shard-tglb:         [PASS][5] -> [INCOMPLETE][6] ([fdo#111736] / [i915#472])
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7715/shard-tglb5/igt@gem_exec_create@basic.html
   [6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16048/shard-tglb6/igt@gem_exec_create@basic.html

  * igt@gem_exec_schedule@pi-common-bsd:
    - shard-iclb:         [PASS][7] -> [SKIP][8] ([i915#677])
   [7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7715/shard-iclb7/igt@gem_exec_schedule@pi-common-bsd.html
   [8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16048/shard-iclb2/igt@gem_exec_schedule@pi-common-bsd.html

  * igt@gem_exec_schedule@preempt-bsd:
    - shard-iclb:         [PASS][9] -> [SKIP][10] ([fdo#112146]) +3 similar issues
   [9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7715/shard-iclb8/igt@gem_exec_schedule@preempt-bsd.html
   [10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16048/shard-iclb2/igt@gem_exec_schedule@preempt-bsd.html

  * igt@gem_exec_schedule@preempt-queue-chain-blt:
    - shard-tglb:         [PASS][11] -> [INCOMPLETE][12] ([fdo#111606] / [fdo#111677] / [i915#472])
   [11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7715/shard-tglb2/igt@gem_exec_schedule@preempt-queue-chain-blt.html
   [12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16048/shard-tglb3/igt@gem_exec_schedule@preempt-queue-chain-blt.html

  * igt@gem_exec_schedule@smoketest-all:
    - shard-tglb:         [PASS][13] -> [INCOMPLETE][14] ([i915#463] / [i915#472])
   [13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7715/shard-tglb5/igt@gem_exec_schedule@smoketest-all.html
   [14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16048/shard-tglb5/igt@gem_exec_schedule@smoketest-all.html

  * igt@gem_exec_suspend@basic-s0:
    - shard-tglb:         [PASS][15] -> [INCOMPLETE][16] ([i915#472]) +3 similar issues
   [15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7715/shard-tglb2/igt@gem_exec_suspend@basic-s0.html
   [16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16048/shard-tglb6/igt@gem_exec_suspend@basic-s0.html

  * igt@i915_pm_rps@waitboost:
    - shard-iclb:         [PASS][17] -> [FAIL][18] ([i915#413])
   [17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7715/shard-iclb5/igt@i915_pm_rps@waitboost.html
   [18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16048/shard-iclb7/igt@i915_pm_rps@waitboost.html

  * igt@kms_flip@2x-flip-vs-expired-vblank-interruptible:
    - shard-glk:          [PASS][19] -> [FAIL][20] ([i915#79])
   [19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7715/shard-glk8/igt@kms_flip@2x-flip-vs-expired-vblank-interruptible.html
   [20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16048/shard-glk3/igt@kms_flip@2x-flip-vs-expired-vblank-interruptible.html

  * igt@kms_flip@flip-vs-expired-vblank:
    - shard-skl:          [PASS][21] -> [FAIL][22] ([i915#79])
   [21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7715/shard-skl6/igt@kms_flip@flip-vs-expired-vblank.html
   [22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16048/shard-skl5/igt@kms_flip@flip-vs-expired-vblank.html

  * igt@kms_frontbuffer_tracking@fbcpsr-rgb565-draw-render:
    - shard-tglb:         [PASS][23] -> [FAIL][24] ([i915#49]) +1 similar issue
   [23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7715/shard-tglb5/igt@kms_frontbuffer_tracking@fbcpsr-rgb565-draw-render.html
   [24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16048/shard-tglb4/igt@kms_frontbuffer_tracking@fbcpsr-rgb565-draw-render.html

  * igt@kms_pipe_crc_basic@suspend-read-crc-pipe-c:
    - shard-kbl:          [PASS][25] -> [DMESG-WARN][26] ([i915#180])
   [25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7715/shard-kbl3/igt@kms_pipe_crc_basic@suspend-read-crc-pipe-c.html
   [26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16048/shard-kbl4/igt@kms_pipe_crc_basic@suspend-read-crc-pipe-c.html

  * igt@kms_plane_alpha_blend@pipe-a-constant-alpha-min:
    - shard-skl:          [PASS][27] -> [FAIL][28] ([fdo#108145])
   [27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7715/shard-skl10/igt@kms_plane_alpha_blend@pipe-a-constant-alpha-min.html
   [28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16048/shard-skl9/igt@kms_plane_alpha_blend@pipe-a-constant-alpha-min.html

  * igt@kms_plane_alpha_blend@pipe-c-coverage-7efc:
    - shard-skl:          [PASS][29] -> [FAIL][30] ([fdo#108145] / [i915#265]) +1 similar issue
   [29]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7715/shard-skl7/igt@kms_plane_alpha_blend@pipe-c-coverage-7efc.html
   [30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16048/shard-skl3/igt@kms_plane_alpha_blend@pipe-c-coverage-7efc.html

  * igt@kms_psr@psr2_primary_page_flip:
    - shard-iclb:         [PASS][31] -> [SKIP][32] ([fdo#109441]) +2 similar issues
   [31]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7715/shard-iclb2/igt@kms_psr@psr2_primary_page_flip.html
   [32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16048/shard-iclb3/igt@kms_psr@psr2_primary_page_flip.html

  * igt@perf_pmu@init-sema-vcs1:
    - shard-iclb:         [PASS][33] -> [SKIP][34] ([fdo#112080]) +4 similar issues
   [33]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7715/shard-iclb4/igt@perf_pmu@init-sema-vcs1.html
   [34]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16048/shard-iclb6/igt@perf_pmu@init-sema-vcs1.html

  * igt@prime_busy@after-bsd2:
    - shard-iclb:         [PASS][35] -> [SKIP][36] ([fdo#109276]) +13 similar issues
   [35]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7715/shard-iclb4/igt@prime_busy@after-bsd2.html
   [36]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16048/shard-iclb6/igt@prime_busy@after-bsd2.html

  
#### Possible fixes ####

  * igt@gem_ctx_isolation@rcs0-s3:
    - shard-kbl:          [DMESG-WARN][37] ([i915#180]) -> [PASS][38] +7 similar issues
   [37]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7715/shard-kbl7/igt@gem_ctx_isolation@rcs0-s3.html
   [38]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16048/shard-kbl6/igt@gem_ctx_isolation@rcs0-s3.html

  * igt@gem_ctx_persistence@vcs1-queued:
    - shard-iclb:         [SKIP][39] ([fdo#109276] / [fdo#112080]) -> [PASS][40] +1 similar issue
   [39]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7715/shard-iclb7/igt@gem_ctx_persistence@vcs1-queued.html
   [40]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16048/shard-iclb2/igt@gem_ctx_persistence@vcs1-queued.html

  * igt@gem_ctx_shared@exec-single-timeline-bsd:
    - shard-iclb:         [SKIP][41] ([fdo#110841]) -> [PASS][42]
   [41]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7715/shard-iclb2/igt@gem_ctx_shared@exec-single-timeline-bsd.html
   [42]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16048/shard-iclb6/igt@gem_ctx_shared@exec-single-timeline-bsd.html

  * igt@gem_exec_schedule@out-order-bsd2:
    - shard-iclb:         [SKIP][43] ([fdo#109276]) -> [PASS][44] +3 similar issues
   [43]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7715/shard-iclb6/igt@gem_exec_schedule@out-order-bsd2.html
   [44]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16048/shard-iclb4/igt@gem_exec_schedule@out-order-bsd2.html

  * igt@gem_exec_schedule@preempt-queue-vebox:
    - shard-tglb:         [INCOMPLETE][45] ([fdo#111677] / [i915#472]) -> [PASS][46]
   [45]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7715/shard-tglb6/igt@gem_exec_schedule@preempt-queue-vebox.html
   [46]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16048/shard-tglb1/igt@gem_exec_schedule@preempt-queue-vebox.html

  * igt@gem_exec_schedule@reorder-wide-bsd:
    - shard-iclb:         [SKIP][47] ([fdo#112146]) -> [PASS][48] +3 similar issues
   [47]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7715/shard-iclb4/igt@gem_exec_schedule@reorder-wide-bsd.html
   [48]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16048/shard-iclb6/igt@gem_exec_schedule@reorder-wide-bsd.html

  * igt@gem_exec_schedule@smoketest-bsd1:
    - shard-tglb:         [INCOMPLETE][49] ([i915#463] / [i915#472]) -> [PASS][50]
   [49]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7715/shard-tglb3/igt@gem_exec_schedule@smoketest-bsd1.html
   [50]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16048/shard-tglb1/igt@gem_exec_schedule@smoketest-bsd1.html

  * igt@gem_exec_schedule@smoketest-vebox:
    - shard-tglb:         [INCOMPLETE][51] ([i915#472] / [i915#707]) -> [PASS][52]
   [51]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7715/shard-tglb3/igt@gem_exec_schedule@smoketest-vebox.html
   [52]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16048/shard-tglb7/igt@gem_exec_schedule@smoketest-vebox.html

  * igt@i915_selftest@live_requests:
    - shard-tglb:         [INCOMPLETE][53] ([i915#472]) -> [PASS][54]
   [53]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7715/shard-tglb4/igt@i915_selftest@live_requests.html
   [54]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16048/shard-tglb5/igt@i915_selftest@live_requests.html

  * igt@kms_cursor_crc@pipe-a-cursor-suspend:
    - shard-iclb:         [INCOMPLETE][55] ([i915#140]) -> [PASS][56] +1 similar issue
   [55]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7715/shard-iclb6/igt@kms_cursor_crc@pipe-a-cursor-suspend.html
   [56]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16048/shard-iclb4/igt@kms_cursor_crc@pipe-a-cursor-suspend.html

  * igt@kms_pipe_crc_basic@suspend-read-crc-pipe-c:
    - shard-apl:          [DMESG-WARN][57] ([i915#180]) -> [PASS][58] +2 similar issues
   [57]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7715/shard-apl6/igt@kms_pipe_crc_basic@suspend-read-crc-pipe-c.html
   [58]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16048/shard-apl6/igt@kms_pipe_crc_basic@suspend-read-crc-pipe-c.html

  * igt@kms_psr@psr2_suspend:
    - shard-iclb:         [SKIP][59] ([fdo#109441]) -> [PASS][60] +3 similar issues
   [59]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7715/shard-iclb5/igt@kms_psr@psr2_suspend.html
   [60]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16048/shard-iclb2/igt@kms_psr@psr2_suspend.html

  * igt@perf@oa-exponents:
    - shard-tglb:         [INCOMPLETE][61] ([i915#472] / [i915#807]) -> [PASS][62]
   [61]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7715/shard-tglb4/igt@perf@oa-exponents.html
   [62]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16048/shard-tglb1/igt@perf@oa-exponents.html

  * igt@perf_pmu@busy-no-semaphores-vcs1:
    - shard-iclb:         [SKIP][63] ([fdo#112080]) -> [PASS][64] +5 similar issues
   [63]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7715/shard-iclb8/igt@perf_pmu@busy-no-semaphores-vcs1.html
   [64]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16048/shard-iclb2/igt@perf_pmu@busy-no-semaphores-vcs1.html

  * igt@prime_vgem@sync-render:
    - shard-apl:          [INCOMPLETE][65] ([fdo#103927] / [i915#409]) -> [PASS][66]
   [65]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7715/shard-apl7/igt@prime_vgem@sync-render.html
   [66]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16048/shard-apl6/igt@prime_vgem@sync-render.html

  
#### Warnings ####

  * igt@gem_ctx_isolation@vcs1-nonpriv-switch:
    - shard-iclb:         [SKIP][67] ([fdo#109276] / [fdo#112080]) -> [FAIL][68] ([IGT#28])
   [67]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7715/shard-iclb7/igt@gem_ctx_isolation@vcs1-nonpriv-switch.html
   [68]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16048/shard-iclb2/igt@gem_ctx_isolation@vcs1-nonpriv-switch.html

  * igt@gem_exec_nop@basic-parallel:
    - shard-tglb:         [INCOMPLETE][69] ([CI#80] / [i915#472]) -> [INCOMPLETE][70] ([i915#472])
   [69]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7715/shard-tglb5/igt@gem_exec_nop@basic-parallel.html
   [70]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16048/shard-tglb6/igt@gem_exec_nop@basic-parallel.html

  * igt@i915_pm_rpm@pc8-residency:
    - shard-snb:          [SKIP][71] ([fdo#109271]) -> [INCOMPLETE][72] ([i915#82])
   [71]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7715/shard-snb4/igt@i915_pm_rpm@pc8-residency.html
   [72]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16048/shard-snb2/igt@i915_pm_rpm@pc8-residency.html

  * igt@kms_ccs@pipe-c-crc-primary-rotation-180:
    - shard-tglb:         [DMESG-FAIL][73] ([i915#402]) -> [DMESG-WARN][74] ([i915#402])
   [73]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7715/shard-tglb1/igt@kms_ccs@pipe-c-crc-primary-rotation-180.html
   [74]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16048/shard-tglb5/igt@kms_ccs@pipe-c-crc-primary-rotation-180.html

  * igt@kms_cursor_crc@pipe-c-cursor-128x128-offscreen:
    - shard-snb:          [SKIP][75] ([CI#80] / [fdo#109271]) -> [SKIP][76] ([fdo#109271])
   [75]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7715/shard-snb2/igt@kms_cursor_crc@pipe-c-cursor-128x128-offscreen.html
   [76]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16048/shard-snb4/igt@kms_cursor_crc@pipe-c-cursor-128x128-offscreen.html

  
  [CI#80]: https://gitlab.freedesktop.org/gfx-ci/i915-infra/issues/80
  [IGT#28]: https://gitlab.freedesktop.org/drm/igt-gpu-tools/issues/28
  [fdo#103927]: https://bugs.freedesktop.org/show_bug.cgi?id=103927
  [fdo#108145]: https://bugs.freedesktop.org/show_bug.cgi?id=108145
  [fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
  [fdo#109276]: https://bugs.freedesktop.org/show_bug.cgi?id=109276
  [fdo#109441]: https://bugs.freedesktop.org/show_bug.cgi?id=109441
  [fdo#110841]: https://bugs.freedesktop.org/show_bug.cgi?id=110841
  [fdo#111606]: https://bugs.freedesktop.org/show_bug.cgi?id=111606
  [fdo#111677]: https://bugs.freedesktop.org/show_bug.cgi?id=111677
  [fdo#111735]: https://bugs.freedesktop.org/show_bug.cgi?id=111735
  [fdo#111736]: https://bugs.freedesktop.org/show_bug.cgi?id=111736
  [fdo#112080]: https://bugs.freedesktop.org/show_bug.cgi?id=112080
  [fdo#112146]: https://bugs.freedesktop.org/show_bug.cgi?id=112146
  [i915#140]: https://gitlab.freedesktop.org/drm/intel/issues/140
  [i915#180]: https://gitlab.freedesktop.org/drm/intel/issues/180
  [i915#265]: https://gitlab.freedesktop.org/drm/intel/issues/265
  [i915#402]: https://gitlab.freedesktop.org/drm/intel/issues/402
  [i915#409]: https://gitlab.freedesktop.org/drm/intel/issues/409
  [i915#413]: https://gitlab.freedesktop.org/drm/intel/issues/413
  [i915#463]: https://gitlab.freedesktop.org/drm/intel/issues/463
  [i915#472]: https://gitlab.freedesktop.org/drm/intel/issues/472
  [i915#49]: https://gitlab.freedesktop.org/drm/intel/issues/49
  [i915#677]: https://gitlab.freedesktop.org/drm/intel/issues/677
  [i915#707]: https://gitlab.freedesktop.org/drm/intel/issues/707
  [i915#79]: https://gitlab.freedesktop.org/drm/intel/issues/79
  [i915#807]: https://gitlab.freedesktop.org/drm/intel/issues/807
  [i915#82]: https://gitlab.freedesktop.org/drm/intel/issues/82


Participating hosts (11 -> 11)
------------------------------

  No changes in participating hosts


Build changes
-------------

  * CI: CI-20190529 -> None
  * Linux: CI_DRM_7715 -> Patchwork_16048

  CI-20190529: 20190529
  CI_DRM_7715: 337449c74a6745cf1d9d60c41f170d31a291f0c0 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGT_5359: 28451bcec2245dcc1fd0eb1d4c76335b2b4f97a5 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  Patchwork_16048: dadf262439d81673a98e649029a16118347446f7 @ git://anongit.freedesktop.org/gfx-ci/linux
  piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16048/index.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [PATCH 02/23] drm/amdgpu: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
@ 2020-01-13 18:52     ` Alex Deucher
  0 siblings, 0 replies; 217+ messages in thread
From: Alex Deucher @ 2020-01-13 18:52 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: Dave Airlie, Daniel Vetter, Deucher, Alexander, Christian Koenig,
	Chunming Zhou, Maarten Lankhorst, Patrik Jakobsson, Rob Clark,
	Sean Paul, Benjamin Gaignard, Vincent Abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, Eric Anholt,
	rodrigosiqueiramelo, hamohammed.sa, VMware Graphics,
	Thomas Hellstrom, Ben Skeggs, Wentland, Harry, Leo (Sunpeng) Li,
	Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, linux-arm-msm,
	Intel Graphics Development, amd-gfx list,
	Maling list - DRI developers, nouveau, freedreno

On Fri, Jan 10, 2020 at 4:21 AM Thomas Zimmermann <tzimmermann@suse.de> wrote:
>
> The callback struct drm_driver.get_scanout_position() is deprecated in
> favor of struct drm_crtc_helper_funcs.get_scanout_position(). Convert
> amdgpu over.
>

I would prefer to just change the signature of
amdgpu_display_get_crtc_scanoutpos() to match the new API rather than
wrapping it again.

Alex

> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_display.c       | 12 ++++++++++++
>  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c           | 11 -----------
>  drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h          |  5 +++++
>  drivers/gpu/drm/amd/amdgpu/dce_v10_0.c            |  1 +
>  drivers/gpu/drm/amd/amdgpu/dce_v11_0.c            |  1 +
>  drivers/gpu/drm/amd/amdgpu/dce_v6_0.c             |  1 +
>  drivers/gpu/drm/amd/amdgpu/dce_v8_0.c             |  1 +
>  drivers/gpu/drm/amd/amdgpu/dce_virtual.c          |  1 +
>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  3 ++-
>  9 files changed, 24 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> index 4e699071d144..a1e769d4417d 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> @@ -914,3 +914,15 @@ int amdgpu_display_crtc_idx_to_irq_type(struct amdgpu_device *adev, int crtc)
>                 return AMDGPU_CRTC_IRQ_NONE;
>         }
>  }
> +
> +bool amdgpu_crtc_get_scanout_position(struct drm_crtc *crtc,
> +                       bool in_vblank_irq, int *vpos,
> +                       int *hpos, ktime_t *stime, ktime_t *etime,
> +                       const struct drm_display_mode *mode)
> +{
> +       struct drm_device *dev = crtc->dev;
> +       unsigned int pipe = crtc->index;
> +
> +       return amdgpu_display_get_crtc_scanoutpos(dev, pipe, 0, vpos, hpos,
> +                                                 stime, etime, mode);
> +}
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> index 3f6f14ce1511..0749285dd1c7 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> @@ -1367,16 +1367,6 @@ int amdgpu_file_to_fpriv(struct file *filp, struct amdgpu_fpriv **fpriv)
>         return 0;
>  }
>
> -static bool
> -amdgpu_get_crtc_scanout_position(struct drm_device *dev, unsigned int pipe,
> -                                bool in_vblank_irq, int *vpos, int *hpos,
> -                                ktime_t *stime, ktime_t *etime,
> -                                const struct drm_display_mode *mode)
> -{
> -       return amdgpu_display_get_crtc_scanoutpos(dev, pipe, 0, vpos, hpos,
> -                                                 stime, etime, mode);
> -}
> -
>  static struct drm_driver kms_driver = {
>         .driver_features =
>             DRIVER_USE_AGP | DRIVER_ATOMIC |
> @@ -1391,7 +1381,6 @@ static struct drm_driver kms_driver = {
>         .enable_vblank = amdgpu_enable_vblank_kms,
>         .disable_vblank = amdgpu_disable_vblank_kms,
>         .get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
> -       .get_scanout_position = amdgpu_get_crtc_scanout_position,
>         .irq_handler = amdgpu_irq_handler,
>         .ioctls = amdgpu_ioctls_kms,
>         .gem_free_object_unlocked = amdgpu_gem_object_free,
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
> index eb9975f4decb..37ba07e2feb5 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
> @@ -612,6 +612,11 @@ void amdgpu_panel_mode_fixup(struct drm_encoder *encoder,
>                              struct drm_display_mode *adjusted_mode);
>  int amdgpu_display_crtc_idx_to_irq_type(struct amdgpu_device *adev, int crtc);
>
> +bool amdgpu_crtc_get_scanout_position(struct drm_crtc *crtc,
> +                       bool in_vblank_irq, int *vpos,
> +                       int *hpos, ktime_t *stime, ktime_t *etime,
> +                       const struct drm_display_mode *mode);
> +
>  /* fbdev layer */
>  int amdgpu_fbdev_init(struct amdgpu_device *adev);
>  void amdgpu_fbdev_fini(struct amdgpu_device *adev);
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> index 40d2ac723dd6..bdc1e0f036d4 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> @@ -2685,6 +2685,7 @@ static const struct drm_crtc_helper_funcs dce_v10_0_crtc_helper_funcs = {
>         .prepare = dce_v10_0_crtc_prepare,
>         .commit = dce_v10_0_crtc_commit,
>         .disable = dce_v10_0_crtc_disable,
> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>  };
>
>  static int dce_v10_0_crtc_init(struct amdgpu_device *adev, int index)
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> index 898ef72d423c..0319da5f7bf9 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> @@ -2793,6 +2793,7 @@ static const struct drm_crtc_helper_funcs dce_v11_0_crtc_helper_funcs = {
>         .prepare = dce_v11_0_crtc_prepare,
>         .commit = dce_v11_0_crtc_commit,
>         .disable = dce_v11_0_crtc_disable,
> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>  };
>
>  static int dce_v11_0_crtc_init(struct amdgpu_device *adev, int index)
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> index db15a112becc..78642c3b14fc 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> @@ -2575,6 +2575,7 @@ static const struct drm_crtc_helper_funcs dce_v6_0_crtc_helper_funcs = {
>         .prepare = dce_v6_0_crtc_prepare,
>         .commit = dce_v6_0_crtc_commit,
>         .disable = dce_v6_0_crtc_disable,
> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>  };
>
>  static int dce_v6_0_crtc_init(struct amdgpu_device *adev, int index)
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> index f06c9022c1fd..1e8d4975435a 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> @@ -2593,6 +2593,7 @@ static const struct drm_crtc_helper_funcs dce_v8_0_crtc_helper_funcs = {
>         .prepare = dce_v8_0_crtc_prepare,
>         .commit = dce_v8_0_crtc_commit,
>         .disable = dce_v8_0_crtc_disable,
> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>  };
>
>  static int dce_v8_0_crtc_init(struct amdgpu_device *adev, int index)
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
> index e4f94863332c..4b2f915aba47 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
> @@ -218,6 +218,7 @@ static const struct drm_crtc_helper_funcs dce_virtual_crtc_helper_funcs = {
>         .prepare = dce_virtual_crtc_prepare,
>         .commit = dce_virtual_crtc_commit,
>         .disable = dce_virtual_crtc_disable,
> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>  };
>
>  static int dce_virtual_crtc_init(struct amdgpu_device *adev, int index)
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index f2db400a3920..39c5cf242c1b 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -4821,7 +4821,8 @@ static bool dm_crtc_helper_mode_fixup(struct drm_crtc *crtc,
>  static const struct drm_crtc_helper_funcs amdgpu_dm_crtc_helper_funcs = {
>         .disable = dm_crtc_helper_disable,
>         .atomic_check = dm_crtc_helper_atomic_check,
> -       .mode_fixup = dm_crtc_helper_mode_fixup
> +       .mode_fixup = dm_crtc_helper_mode_fixup,
> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>  };
>
>  static void dm_encoder_helper_disable(struct drm_encoder *encoder)
> --
> 2.24.1
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [PATCH 02/23] drm/amdgpu: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
@ 2020-01-13 18:52     ` Alex Deucher
  0 siblings, 0 replies; 217+ messages in thread
From: Alex Deucher @ 2020-01-13 18:52 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: hamohammed.sa-Re5JQEeQqe8AvxtiuMwx3w, Dave Airlie, nouveau,
	Joonas Lahtinen, Maling list - DRI developers, Eric Anholt,
	amd-gfx list, Benjamin Gaignard, alexandre.torgue-qxv4g6HH51o,
	Chunming Zhou, Thomas Hellstrom, Sean Paul, Patrik Jakobsson,
	VMware Graphics, Ben Skeggs, Wentland, Harry,
	mcoquelin.stm32-Re5JQEeQqe8AvxtiuMwx3w, Leo (Sunpeng) Li,
	linux-arm-msm, Intel Graphics Development, Maarten Lankhorst

On Fri, Jan 10, 2020 at 4:21 AM Thomas Zimmermann <tzimmermann-l3A5Bk7waGM@public.gmane.org> wrote:
>
> The callback struct drm_driver.get_scanout_position() is deprecated in
> favor of struct drm_crtc_helper_funcs.get_scanout_position(). Convert
> amdgpu over.
>

I would prefer to just change the signature of
amdgpu_display_get_crtc_scanoutpos() to match the new API rather than
wrapping it again.

Alex

> Signed-off-by: Thomas Zimmermann <tzimmermann-l3A5Bk7waGM@public.gmane.org>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_display.c       | 12 ++++++++++++
>  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c           | 11 -----------
>  drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h          |  5 +++++
>  drivers/gpu/drm/amd/amdgpu/dce_v10_0.c            |  1 +
>  drivers/gpu/drm/amd/amdgpu/dce_v11_0.c            |  1 +
>  drivers/gpu/drm/amd/amdgpu/dce_v6_0.c             |  1 +
>  drivers/gpu/drm/amd/amdgpu/dce_v8_0.c             |  1 +
>  drivers/gpu/drm/amd/amdgpu/dce_virtual.c          |  1 +
>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  3 ++-
>  9 files changed, 24 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> index 4e699071d144..a1e769d4417d 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> @@ -914,3 +914,15 @@ int amdgpu_display_crtc_idx_to_irq_type(struct amdgpu_device *adev, int crtc)
>                 return AMDGPU_CRTC_IRQ_NONE;
>         }
>  }
> +
> +bool amdgpu_crtc_get_scanout_position(struct drm_crtc *crtc,
> +                       bool in_vblank_irq, int *vpos,
> +                       int *hpos, ktime_t *stime, ktime_t *etime,
> +                       const struct drm_display_mode *mode)
> +{
> +       struct drm_device *dev = crtc->dev;
> +       unsigned int pipe = crtc->index;
> +
> +       return amdgpu_display_get_crtc_scanoutpos(dev, pipe, 0, vpos, hpos,
> +                                                 stime, etime, mode);
> +}
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> index 3f6f14ce1511..0749285dd1c7 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> @@ -1367,16 +1367,6 @@ int amdgpu_file_to_fpriv(struct file *filp, struct amdgpu_fpriv **fpriv)
>         return 0;
>  }
>
> -static bool
> -amdgpu_get_crtc_scanout_position(struct drm_device *dev, unsigned int pipe,
> -                                bool in_vblank_irq, int *vpos, int *hpos,
> -                                ktime_t *stime, ktime_t *etime,
> -                                const struct drm_display_mode *mode)
> -{
> -       return amdgpu_display_get_crtc_scanoutpos(dev, pipe, 0, vpos, hpos,
> -                                                 stime, etime, mode);
> -}
> -
>  static struct drm_driver kms_driver = {
>         .driver_features =
>             DRIVER_USE_AGP | DRIVER_ATOMIC |
> @@ -1391,7 +1381,6 @@ static struct drm_driver kms_driver = {
>         .enable_vblank = amdgpu_enable_vblank_kms,
>         .disable_vblank = amdgpu_disable_vblank_kms,
>         .get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
> -       .get_scanout_position = amdgpu_get_crtc_scanout_position,
>         .irq_handler = amdgpu_irq_handler,
>         .ioctls = amdgpu_ioctls_kms,
>         .gem_free_object_unlocked = amdgpu_gem_object_free,
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
> index eb9975f4decb..37ba07e2feb5 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
> @@ -612,6 +612,11 @@ void amdgpu_panel_mode_fixup(struct drm_encoder *encoder,
>                              struct drm_display_mode *adjusted_mode);
>  int amdgpu_display_crtc_idx_to_irq_type(struct amdgpu_device *adev, int crtc);
>
> +bool amdgpu_crtc_get_scanout_position(struct drm_crtc *crtc,
> +                       bool in_vblank_irq, int *vpos,
> +                       int *hpos, ktime_t *stime, ktime_t *etime,
> +                       const struct drm_display_mode *mode);
> +
>  /* fbdev layer */
>  int amdgpu_fbdev_init(struct amdgpu_device *adev);
>  void amdgpu_fbdev_fini(struct amdgpu_device *adev);
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> index 40d2ac723dd6..bdc1e0f036d4 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> @@ -2685,6 +2685,7 @@ static const struct drm_crtc_helper_funcs dce_v10_0_crtc_helper_funcs = {
>         .prepare = dce_v10_0_crtc_prepare,
>         .commit = dce_v10_0_crtc_commit,
>         .disable = dce_v10_0_crtc_disable,
> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>  };
>
>  static int dce_v10_0_crtc_init(struct amdgpu_device *adev, int index)
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> index 898ef72d423c..0319da5f7bf9 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> @@ -2793,6 +2793,7 @@ static const struct drm_crtc_helper_funcs dce_v11_0_crtc_helper_funcs = {
>         .prepare = dce_v11_0_crtc_prepare,
>         .commit = dce_v11_0_crtc_commit,
>         .disable = dce_v11_0_crtc_disable,
> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>  };
>
>  static int dce_v11_0_crtc_init(struct amdgpu_device *adev, int index)
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> index db15a112becc..78642c3b14fc 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> @@ -2575,6 +2575,7 @@ static const struct drm_crtc_helper_funcs dce_v6_0_crtc_helper_funcs = {
>         .prepare = dce_v6_0_crtc_prepare,
>         .commit = dce_v6_0_crtc_commit,
>         .disable = dce_v6_0_crtc_disable,
> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>  };
>
>  static int dce_v6_0_crtc_init(struct amdgpu_device *adev, int index)
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> index f06c9022c1fd..1e8d4975435a 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> @@ -2593,6 +2593,7 @@ static const struct drm_crtc_helper_funcs dce_v8_0_crtc_helper_funcs = {
>         .prepare = dce_v8_0_crtc_prepare,
>         .commit = dce_v8_0_crtc_commit,
>         .disable = dce_v8_0_crtc_disable,
> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>  };
>
>  static int dce_v8_0_crtc_init(struct amdgpu_device *adev, int index)
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
> index e4f94863332c..4b2f915aba47 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
> @@ -218,6 +218,7 @@ static const struct drm_crtc_helper_funcs dce_virtual_crtc_helper_funcs = {
>         .prepare = dce_virtual_crtc_prepare,
>         .commit = dce_virtual_crtc_commit,
>         .disable = dce_virtual_crtc_disable,
> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>  };
>
>  static int dce_virtual_crtc_init(struct amdgpu_device *adev, int index)
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index f2db400a3920..39c5cf242c1b 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -4821,7 +4821,8 @@ static bool dm_crtc_helper_mode_fixup(struct drm_crtc *crtc,
>  static const struct drm_crtc_helper_funcs amdgpu_dm_crtc_helper_funcs = {
>         .disable = dm_crtc_helper_disable,
>         .atomic_check = dm_crtc_helper_atomic_check,
> -       .mode_fixup = dm_crtc_helper_mode_fixup
> +       .mode_fixup = dm_crtc_helper_mode_fixup,
> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>  };
>
>  static void dm_encoder_helper_disable(struct drm_encoder *encoder)
> --
> 2.24.1
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [PATCH 02/23] drm/amdgpu: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
@ 2020-01-13 18:52     ` Alex Deucher
  0 siblings, 0 replies; 217+ messages in thread
From: Alex Deucher @ 2020-01-13 18:52 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: hamohammed.sa, Dave Airlie, nouveau,
	Maling list - DRI developers, amd-gfx list, alexandre.torgue,
	Thomas Hellstrom, Sean Paul, VMware Graphics, Ben Skeggs,
	mcoquelin.stm32, Leo (Sunpeng) Li, linux-arm-msm,
	Intel Graphics Development, Rodrigo Vivi, Vincent Abriou,
	rodrigosiqueiramelo, philippe.cornu, yannick.fertre, Deucher,
	Alexander, freedreno, Christian Koenig

On Fri, Jan 10, 2020 at 4:21 AM Thomas Zimmermann <tzimmermann@suse.de> wrote:
>
> The callback struct drm_driver.get_scanout_position() is deprecated in
> favor of struct drm_crtc_helper_funcs.get_scanout_position(). Convert
> amdgpu over.
>

I would prefer to just change the signature of
amdgpu_display_get_crtc_scanoutpos() to match the new API rather than
wrapping it again.

Alex

> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_display.c       | 12 ++++++++++++
>  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c           | 11 -----------
>  drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h          |  5 +++++
>  drivers/gpu/drm/amd/amdgpu/dce_v10_0.c            |  1 +
>  drivers/gpu/drm/amd/amdgpu/dce_v11_0.c            |  1 +
>  drivers/gpu/drm/amd/amdgpu/dce_v6_0.c             |  1 +
>  drivers/gpu/drm/amd/amdgpu/dce_v8_0.c             |  1 +
>  drivers/gpu/drm/amd/amdgpu/dce_virtual.c          |  1 +
>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  3 ++-
>  9 files changed, 24 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> index 4e699071d144..a1e769d4417d 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> @@ -914,3 +914,15 @@ int amdgpu_display_crtc_idx_to_irq_type(struct amdgpu_device *adev, int crtc)
>                 return AMDGPU_CRTC_IRQ_NONE;
>         }
>  }
> +
> +bool amdgpu_crtc_get_scanout_position(struct drm_crtc *crtc,
> +                       bool in_vblank_irq, int *vpos,
> +                       int *hpos, ktime_t *stime, ktime_t *etime,
> +                       const struct drm_display_mode *mode)
> +{
> +       struct drm_device *dev = crtc->dev;
> +       unsigned int pipe = crtc->index;
> +
> +       return amdgpu_display_get_crtc_scanoutpos(dev, pipe, 0, vpos, hpos,
> +                                                 stime, etime, mode);
> +}
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> index 3f6f14ce1511..0749285dd1c7 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> @@ -1367,16 +1367,6 @@ int amdgpu_file_to_fpriv(struct file *filp, struct amdgpu_fpriv **fpriv)
>         return 0;
>  }
>
> -static bool
> -amdgpu_get_crtc_scanout_position(struct drm_device *dev, unsigned int pipe,
> -                                bool in_vblank_irq, int *vpos, int *hpos,
> -                                ktime_t *stime, ktime_t *etime,
> -                                const struct drm_display_mode *mode)
> -{
> -       return amdgpu_display_get_crtc_scanoutpos(dev, pipe, 0, vpos, hpos,
> -                                                 stime, etime, mode);
> -}
> -
>  static struct drm_driver kms_driver = {
>         .driver_features =
>             DRIVER_USE_AGP | DRIVER_ATOMIC |
> @@ -1391,7 +1381,6 @@ static struct drm_driver kms_driver = {
>         .enable_vblank = amdgpu_enable_vblank_kms,
>         .disable_vblank = amdgpu_disable_vblank_kms,
>         .get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
> -       .get_scanout_position = amdgpu_get_crtc_scanout_position,
>         .irq_handler = amdgpu_irq_handler,
>         .ioctls = amdgpu_ioctls_kms,
>         .gem_free_object_unlocked = amdgpu_gem_object_free,
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
> index eb9975f4decb..37ba07e2feb5 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
> @@ -612,6 +612,11 @@ void amdgpu_panel_mode_fixup(struct drm_encoder *encoder,
>                              struct drm_display_mode *adjusted_mode);
>  int amdgpu_display_crtc_idx_to_irq_type(struct amdgpu_device *adev, int crtc);
>
> +bool amdgpu_crtc_get_scanout_position(struct drm_crtc *crtc,
> +                       bool in_vblank_irq, int *vpos,
> +                       int *hpos, ktime_t *stime, ktime_t *etime,
> +                       const struct drm_display_mode *mode);
> +
>  /* fbdev layer */
>  int amdgpu_fbdev_init(struct amdgpu_device *adev);
>  void amdgpu_fbdev_fini(struct amdgpu_device *adev);
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> index 40d2ac723dd6..bdc1e0f036d4 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> @@ -2685,6 +2685,7 @@ static const struct drm_crtc_helper_funcs dce_v10_0_crtc_helper_funcs = {
>         .prepare = dce_v10_0_crtc_prepare,
>         .commit = dce_v10_0_crtc_commit,
>         .disable = dce_v10_0_crtc_disable,
> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>  };
>
>  static int dce_v10_0_crtc_init(struct amdgpu_device *adev, int index)
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> index 898ef72d423c..0319da5f7bf9 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> @@ -2793,6 +2793,7 @@ static const struct drm_crtc_helper_funcs dce_v11_0_crtc_helper_funcs = {
>         .prepare = dce_v11_0_crtc_prepare,
>         .commit = dce_v11_0_crtc_commit,
>         .disable = dce_v11_0_crtc_disable,
> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>  };
>
>  static int dce_v11_0_crtc_init(struct amdgpu_device *adev, int index)
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> index db15a112becc..78642c3b14fc 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> @@ -2575,6 +2575,7 @@ static const struct drm_crtc_helper_funcs dce_v6_0_crtc_helper_funcs = {
>         .prepare = dce_v6_0_crtc_prepare,
>         .commit = dce_v6_0_crtc_commit,
>         .disable = dce_v6_0_crtc_disable,
> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>  };
>
>  static int dce_v6_0_crtc_init(struct amdgpu_device *adev, int index)
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> index f06c9022c1fd..1e8d4975435a 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> @@ -2593,6 +2593,7 @@ static const struct drm_crtc_helper_funcs dce_v8_0_crtc_helper_funcs = {
>         .prepare = dce_v8_0_crtc_prepare,
>         .commit = dce_v8_0_crtc_commit,
>         .disable = dce_v8_0_crtc_disable,
> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>  };
>
>  static int dce_v8_0_crtc_init(struct amdgpu_device *adev, int index)
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
> index e4f94863332c..4b2f915aba47 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
> @@ -218,6 +218,7 @@ static const struct drm_crtc_helper_funcs dce_virtual_crtc_helper_funcs = {
>         .prepare = dce_virtual_crtc_prepare,
>         .commit = dce_virtual_crtc_commit,
>         .disable = dce_virtual_crtc_disable,
> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>  };
>
>  static int dce_virtual_crtc_init(struct amdgpu_device *adev, int index)
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index f2db400a3920..39c5cf242c1b 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -4821,7 +4821,8 @@ static bool dm_crtc_helper_mode_fixup(struct drm_crtc *crtc,
>  static const struct drm_crtc_helper_funcs amdgpu_dm_crtc_helper_funcs = {
>         .disable = dm_crtc_helper_disable,
>         .atomic_check = dm_crtc_helper_atomic_check,
> -       .mode_fixup = dm_crtc_helper_mode_fixup
> +       .mode_fixup = dm_crtc_helper_mode_fixup,
> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>  };
>
>  static void dm_encoder_helper_disable(struct drm_encoder *encoder)
> --
> 2.24.1
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [Intel-gfx] [PATCH 02/23] drm/amdgpu: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
@ 2020-01-13 18:52     ` Alex Deucher
  0 siblings, 0 replies; 217+ messages in thread
From: Alex Deucher @ 2020-01-13 18:52 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: hamohammed.sa, Dave Airlie, nouveau,
	Maling list - DRI developers, Eric Anholt, amd-gfx list,
	Benjamin Gaignard, alexandre.torgue, Chunming Zhou,
	Thomas Hellstrom, VMware Graphics, Ben Skeggs, Wentland, Harry,
	mcoquelin.stm32, Leo (Sunpeng) Li, linux-arm-msm,
	Intel Graphics Development, Vincent Abriou, rodrigosiqueiramelo,
	philippe.cornu, yannick.fertre, Deucher, Alexander, freedreno,
	Christian Koenig

On Fri, Jan 10, 2020 at 4:21 AM Thomas Zimmermann <tzimmermann@suse.de> wrote:
>
> The callback struct drm_driver.get_scanout_position() is deprecated in
> favor of struct drm_crtc_helper_funcs.get_scanout_position(). Convert
> amdgpu over.
>

I would prefer to just change the signature of
amdgpu_display_get_crtc_scanoutpos() to match the new API rather than
wrapping it again.

Alex

> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_display.c       | 12 ++++++++++++
>  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c           | 11 -----------
>  drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h          |  5 +++++
>  drivers/gpu/drm/amd/amdgpu/dce_v10_0.c            |  1 +
>  drivers/gpu/drm/amd/amdgpu/dce_v11_0.c            |  1 +
>  drivers/gpu/drm/amd/amdgpu/dce_v6_0.c             |  1 +
>  drivers/gpu/drm/amd/amdgpu/dce_v8_0.c             |  1 +
>  drivers/gpu/drm/amd/amdgpu/dce_virtual.c          |  1 +
>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  3 ++-
>  9 files changed, 24 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> index 4e699071d144..a1e769d4417d 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> @@ -914,3 +914,15 @@ int amdgpu_display_crtc_idx_to_irq_type(struct amdgpu_device *adev, int crtc)
>                 return AMDGPU_CRTC_IRQ_NONE;
>         }
>  }
> +
> +bool amdgpu_crtc_get_scanout_position(struct drm_crtc *crtc,
> +                       bool in_vblank_irq, int *vpos,
> +                       int *hpos, ktime_t *stime, ktime_t *etime,
> +                       const struct drm_display_mode *mode)
> +{
> +       struct drm_device *dev = crtc->dev;
> +       unsigned int pipe = crtc->index;
> +
> +       return amdgpu_display_get_crtc_scanoutpos(dev, pipe, 0, vpos, hpos,
> +                                                 stime, etime, mode);
> +}
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> index 3f6f14ce1511..0749285dd1c7 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> @@ -1367,16 +1367,6 @@ int amdgpu_file_to_fpriv(struct file *filp, struct amdgpu_fpriv **fpriv)
>         return 0;
>  }
>
> -static bool
> -amdgpu_get_crtc_scanout_position(struct drm_device *dev, unsigned int pipe,
> -                                bool in_vblank_irq, int *vpos, int *hpos,
> -                                ktime_t *stime, ktime_t *etime,
> -                                const struct drm_display_mode *mode)
> -{
> -       return amdgpu_display_get_crtc_scanoutpos(dev, pipe, 0, vpos, hpos,
> -                                                 stime, etime, mode);
> -}
> -
>  static struct drm_driver kms_driver = {
>         .driver_features =
>             DRIVER_USE_AGP | DRIVER_ATOMIC |
> @@ -1391,7 +1381,6 @@ static struct drm_driver kms_driver = {
>         .enable_vblank = amdgpu_enable_vblank_kms,
>         .disable_vblank = amdgpu_disable_vblank_kms,
>         .get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
> -       .get_scanout_position = amdgpu_get_crtc_scanout_position,
>         .irq_handler = amdgpu_irq_handler,
>         .ioctls = amdgpu_ioctls_kms,
>         .gem_free_object_unlocked = amdgpu_gem_object_free,
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
> index eb9975f4decb..37ba07e2feb5 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
> @@ -612,6 +612,11 @@ void amdgpu_panel_mode_fixup(struct drm_encoder *encoder,
>                              struct drm_display_mode *adjusted_mode);
>  int amdgpu_display_crtc_idx_to_irq_type(struct amdgpu_device *adev, int crtc);
>
> +bool amdgpu_crtc_get_scanout_position(struct drm_crtc *crtc,
> +                       bool in_vblank_irq, int *vpos,
> +                       int *hpos, ktime_t *stime, ktime_t *etime,
> +                       const struct drm_display_mode *mode);
> +
>  /* fbdev layer */
>  int amdgpu_fbdev_init(struct amdgpu_device *adev);
>  void amdgpu_fbdev_fini(struct amdgpu_device *adev);
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> index 40d2ac723dd6..bdc1e0f036d4 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> @@ -2685,6 +2685,7 @@ static const struct drm_crtc_helper_funcs dce_v10_0_crtc_helper_funcs = {
>         .prepare = dce_v10_0_crtc_prepare,
>         .commit = dce_v10_0_crtc_commit,
>         .disable = dce_v10_0_crtc_disable,
> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>  };
>
>  static int dce_v10_0_crtc_init(struct amdgpu_device *adev, int index)
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> index 898ef72d423c..0319da5f7bf9 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> @@ -2793,6 +2793,7 @@ static const struct drm_crtc_helper_funcs dce_v11_0_crtc_helper_funcs = {
>         .prepare = dce_v11_0_crtc_prepare,
>         .commit = dce_v11_0_crtc_commit,
>         .disable = dce_v11_0_crtc_disable,
> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>  };
>
>  static int dce_v11_0_crtc_init(struct amdgpu_device *adev, int index)
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> index db15a112becc..78642c3b14fc 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> @@ -2575,6 +2575,7 @@ static const struct drm_crtc_helper_funcs dce_v6_0_crtc_helper_funcs = {
>         .prepare = dce_v6_0_crtc_prepare,
>         .commit = dce_v6_0_crtc_commit,
>         .disable = dce_v6_0_crtc_disable,
> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>  };
>
>  static int dce_v6_0_crtc_init(struct amdgpu_device *adev, int index)
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> index f06c9022c1fd..1e8d4975435a 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> @@ -2593,6 +2593,7 @@ static const struct drm_crtc_helper_funcs dce_v8_0_crtc_helper_funcs = {
>         .prepare = dce_v8_0_crtc_prepare,
>         .commit = dce_v8_0_crtc_commit,
>         .disable = dce_v8_0_crtc_disable,
> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>  };
>
>  static int dce_v8_0_crtc_init(struct amdgpu_device *adev, int index)
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
> index e4f94863332c..4b2f915aba47 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
> @@ -218,6 +218,7 @@ static const struct drm_crtc_helper_funcs dce_virtual_crtc_helper_funcs = {
>         .prepare = dce_virtual_crtc_prepare,
>         .commit = dce_virtual_crtc_commit,
>         .disable = dce_virtual_crtc_disable,
> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>  };
>
>  static int dce_virtual_crtc_init(struct amdgpu_device *adev, int index)
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index f2db400a3920..39c5cf242c1b 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -4821,7 +4821,8 @@ static bool dm_crtc_helper_mode_fixup(struct drm_crtc *crtc,
>  static const struct drm_crtc_helper_funcs amdgpu_dm_crtc_helper_funcs = {
>         .disable = dm_crtc_helper_disable,
>         .atomic_check = dm_crtc_helper_atomic_check,
> -       .mode_fixup = dm_crtc_helper_mode_fixup
> +       .mode_fixup = dm_crtc_helper_mode_fixup,
> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>  };
>
>  static void dm_encoder_helper_disable(struct drm_encoder *encoder)
> --
> 2.24.1
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [PATCH 02/23] drm/amdgpu: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
@ 2020-01-13 18:52     ` Alex Deucher
  0 siblings, 0 replies; 217+ messages in thread
From: Alex Deucher @ 2020-01-13 18:52 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: hamohammed.sa, Dave Airlie, nouveau, Joonas Lahtinen,
	Maling list - DRI developers, Eric Anholt, amd-gfx list,
	Benjamin Gaignard, alexandre.torgue, Chunming Zhou,
	Thomas Hellstrom, Sean Paul, Patrik Jakobsson, VMware Graphics,
	Ben Skeggs, Wentland, Harry, mcoquelin.stm32, Leo (Sunpeng) Li,
	linux-arm-msm, Intel Graphics Development, Maarten Lankhorst,
	Jani Nikula, Rodrigo Vivi, Vincent Abriou, rodrigosiqueiramelo,
	philippe.cornu, yannick.fertre, Rob Clark, Daniel Vetter,
	Deucher, Alexander, freedreno, Christian Koenig

On Fri, Jan 10, 2020 at 4:21 AM Thomas Zimmermann <tzimmermann@suse.de> wrote:
>
> The callback struct drm_driver.get_scanout_position() is deprecated in
> favor of struct drm_crtc_helper_funcs.get_scanout_position(). Convert
> amdgpu over.
>

I would prefer to just change the signature of
amdgpu_display_get_crtc_scanoutpos() to match the new API rather than
wrapping it again.

Alex

> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_display.c       | 12 ++++++++++++
>  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c           | 11 -----------
>  drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h          |  5 +++++
>  drivers/gpu/drm/amd/amdgpu/dce_v10_0.c            |  1 +
>  drivers/gpu/drm/amd/amdgpu/dce_v11_0.c            |  1 +
>  drivers/gpu/drm/amd/amdgpu/dce_v6_0.c             |  1 +
>  drivers/gpu/drm/amd/amdgpu/dce_v8_0.c             |  1 +
>  drivers/gpu/drm/amd/amdgpu/dce_virtual.c          |  1 +
>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  3 ++-
>  9 files changed, 24 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> index 4e699071d144..a1e769d4417d 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> @@ -914,3 +914,15 @@ int amdgpu_display_crtc_idx_to_irq_type(struct amdgpu_device *adev, int crtc)
>                 return AMDGPU_CRTC_IRQ_NONE;
>         }
>  }
> +
> +bool amdgpu_crtc_get_scanout_position(struct drm_crtc *crtc,
> +                       bool in_vblank_irq, int *vpos,
> +                       int *hpos, ktime_t *stime, ktime_t *etime,
> +                       const struct drm_display_mode *mode)
> +{
> +       struct drm_device *dev = crtc->dev;
> +       unsigned int pipe = crtc->index;
> +
> +       return amdgpu_display_get_crtc_scanoutpos(dev, pipe, 0, vpos, hpos,
> +                                                 stime, etime, mode);
> +}
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> index 3f6f14ce1511..0749285dd1c7 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> @@ -1367,16 +1367,6 @@ int amdgpu_file_to_fpriv(struct file *filp, struct amdgpu_fpriv **fpriv)
>         return 0;
>  }
>
> -static bool
> -amdgpu_get_crtc_scanout_position(struct drm_device *dev, unsigned int pipe,
> -                                bool in_vblank_irq, int *vpos, int *hpos,
> -                                ktime_t *stime, ktime_t *etime,
> -                                const struct drm_display_mode *mode)
> -{
> -       return amdgpu_display_get_crtc_scanoutpos(dev, pipe, 0, vpos, hpos,
> -                                                 stime, etime, mode);
> -}
> -
>  static struct drm_driver kms_driver = {
>         .driver_features =
>             DRIVER_USE_AGP | DRIVER_ATOMIC |
> @@ -1391,7 +1381,6 @@ static struct drm_driver kms_driver = {
>         .enable_vblank = amdgpu_enable_vblank_kms,
>         .disable_vblank = amdgpu_disable_vblank_kms,
>         .get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
> -       .get_scanout_position = amdgpu_get_crtc_scanout_position,
>         .irq_handler = amdgpu_irq_handler,
>         .ioctls = amdgpu_ioctls_kms,
>         .gem_free_object_unlocked = amdgpu_gem_object_free,
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
> index eb9975f4decb..37ba07e2feb5 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
> @@ -612,6 +612,11 @@ void amdgpu_panel_mode_fixup(struct drm_encoder *encoder,
>                              struct drm_display_mode *adjusted_mode);
>  int amdgpu_display_crtc_idx_to_irq_type(struct amdgpu_device *adev, int crtc);
>
> +bool amdgpu_crtc_get_scanout_position(struct drm_crtc *crtc,
> +                       bool in_vblank_irq, int *vpos,
> +                       int *hpos, ktime_t *stime, ktime_t *etime,
> +                       const struct drm_display_mode *mode);
> +
>  /* fbdev layer */
>  int amdgpu_fbdev_init(struct amdgpu_device *adev);
>  void amdgpu_fbdev_fini(struct amdgpu_device *adev);
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> index 40d2ac723dd6..bdc1e0f036d4 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> @@ -2685,6 +2685,7 @@ static const struct drm_crtc_helper_funcs dce_v10_0_crtc_helper_funcs = {
>         .prepare = dce_v10_0_crtc_prepare,
>         .commit = dce_v10_0_crtc_commit,
>         .disable = dce_v10_0_crtc_disable,
> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>  };
>
>  static int dce_v10_0_crtc_init(struct amdgpu_device *adev, int index)
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> index 898ef72d423c..0319da5f7bf9 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> @@ -2793,6 +2793,7 @@ static const struct drm_crtc_helper_funcs dce_v11_0_crtc_helper_funcs = {
>         .prepare = dce_v11_0_crtc_prepare,
>         .commit = dce_v11_0_crtc_commit,
>         .disable = dce_v11_0_crtc_disable,
> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>  };
>
>  static int dce_v11_0_crtc_init(struct amdgpu_device *adev, int index)
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> index db15a112becc..78642c3b14fc 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> @@ -2575,6 +2575,7 @@ static const struct drm_crtc_helper_funcs dce_v6_0_crtc_helper_funcs = {
>         .prepare = dce_v6_0_crtc_prepare,
>         .commit = dce_v6_0_crtc_commit,
>         .disable = dce_v6_0_crtc_disable,
> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>  };
>
>  static int dce_v6_0_crtc_init(struct amdgpu_device *adev, int index)
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> index f06c9022c1fd..1e8d4975435a 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> @@ -2593,6 +2593,7 @@ static const struct drm_crtc_helper_funcs dce_v8_0_crtc_helper_funcs = {
>         .prepare = dce_v8_0_crtc_prepare,
>         .commit = dce_v8_0_crtc_commit,
>         .disable = dce_v8_0_crtc_disable,
> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>  };
>
>  static int dce_v8_0_crtc_init(struct amdgpu_device *adev, int index)
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
> index e4f94863332c..4b2f915aba47 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
> @@ -218,6 +218,7 @@ static const struct drm_crtc_helper_funcs dce_virtual_crtc_helper_funcs = {
>         .prepare = dce_virtual_crtc_prepare,
>         .commit = dce_virtual_crtc_commit,
>         .disable = dce_virtual_crtc_disable,
> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>  };
>
>  static int dce_virtual_crtc_init(struct amdgpu_device *adev, int index)
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index f2db400a3920..39c5cf242c1b 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -4821,7 +4821,8 @@ static bool dm_crtc_helper_mode_fixup(struct drm_crtc *crtc,
>  static const struct drm_crtc_helper_funcs amdgpu_dm_crtc_helper_funcs = {
>         .disable = dm_crtc_helper_disable,
>         .atomic_check = dm_crtc_helper_atomic_check,
> -       .mode_fixup = dm_crtc_helper_mode_fixup
> +       .mode_fixup = dm_crtc_helper_mode_fixup,
> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>  };
>
>  static void dm_encoder_helper_disable(struct drm_encoder *encoder)
> --
> 2.24.1
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [PATCH 05/23] drm/radeon: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
@ 2020-01-13 18:53     ` Alex Deucher
  0 siblings, 0 replies; 217+ messages in thread
From: Alex Deucher @ 2020-01-13 18:53 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: Dave Airlie, Daniel Vetter, Deucher, Alexander, Christian Koenig,
	Chunming Zhou, Maarten Lankhorst, Patrik Jakobsson, Rob Clark,
	Sean Paul, Benjamin Gaignard, Vincent Abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, Eric Anholt,
	rodrigosiqueiramelo, hamohammed.sa, VMware Graphics,
	Thomas Hellstrom, Ben Skeggs, Wentland, Harry, Leo (Sunpeng) Li,
	Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, linux-arm-msm,
	Intel Graphics Development, amd-gfx list,
	Maling list - DRI developers, nouveau, freedreno

On Fri, Jan 10, 2020 at 4:22 AM Thomas Zimmermann <tzimmermann@suse.de> wrote:
>
> The callback struct drm_driver.get_scanout_position() is deprecated in
> favor of struct drm_crtc_helper_funcs.get_scanout_position(). Convert
> radeon over.
>

I'd prefer to just change the signature of
radeon_get_crtc_scanoutpos() to match the new API.

Alex

> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
>  drivers/gpu/drm/radeon/atombios_crtc.c      |  1 +
>  drivers/gpu/drm/radeon/radeon_display.c     | 13 +++++++++++++
>  drivers/gpu/drm/radeon/radeon_drv.c         | 11 -----------
>  drivers/gpu/drm/radeon/radeon_legacy_crtc.c |  3 ++-
>  drivers/gpu/drm/radeon/radeon_mode.h        |  6 ++++++
>  5 files changed, 22 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c
> index da2c9e295408..447d74b78f19 100644
> --- a/drivers/gpu/drm/radeon/atombios_crtc.c
> +++ b/drivers/gpu/drm/radeon/atombios_crtc.c
> @@ -2232,6 +2232,7 @@ static const struct drm_crtc_helper_funcs atombios_helper_funcs = {
>         .prepare = atombios_crtc_prepare,
>         .commit = atombios_crtc_commit,
>         .disable = atombios_crtc_disable,
> +       .get_scanout_position = radeon_get_crtc_scanout_position,
>  };
>
>  void radeon_atombios_init_crtc(struct drm_device *dev,
> diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
> index 962575e27cde..7187158b9963 100644
> --- a/drivers/gpu/drm/radeon/radeon_display.c
> +++ b/drivers/gpu/drm/radeon/radeon_display.c
> @@ -1978,3 +1978,16 @@ int radeon_get_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe,
>
>         return ret;
>  }
> +
> +bool
> +radeon_get_crtc_scanout_position(struct drm_crtc *crtc,
> +                                bool in_vblank_irq, int *vpos, int *hpos,
> +                                ktime_t *stime, ktime_t *etime,
> +                                const struct drm_display_mode *mode)
> +{
> +       struct drm_device *dev = crtc->dev;
> +       unsigned int pipe = crtc->index;
> +
> +       return radeon_get_crtc_scanoutpos(dev, pipe, 0, vpos, hpos,
> +                                         stime, etime, mode);
> +}
> diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
> index fd74e2611185..1f597f166bff 100644
> --- a/drivers/gpu/drm/radeon/radeon_drv.c
> +++ b/drivers/gpu/drm/radeon/radeon_drv.c
> @@ -563,16 +563,6 @@ static const struct file_operations radeon_driver_kms_fops = {
>  #endif
>  };
>
> -static bool
> -radeon_get_crtc_scanout_position(struct drm_device *dev, unsigned int pipe,
> -                                bool in_vblank_irq, int *vpos, int *hpos,
> -                                ktime_t *stime, ktime_t *etime,
> -                                const struct drm_display_mode *mode)
> -{
> -       return radeon_get_crtc_scanoutpos(dev, pipe, 0, vpos, hpos,
> -                                         stime, etime, mode);
> -}
> -
>  static struct drm_driver kms_driver = {
>         .driver_features =
>             DRIVER_USE_AGP | DRIVER_GEM | DRIVER_RENDER,
> @@ -585,7 +575,6 @@ static struct drm_driver kms_driver = {
>         .enable_vblank = radeon_enable_vblank_kms,
>         .disable_vblank = radeon_disable_vblank_kms,
>         .get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
> -       .get_scanout_position = radeon_get_crtc_scanout_position,
>         .irq_preinstall = radeon_driver_irq_preinstall_kms,
>         .irq_postinstall = radeon_driver_irq_postinstall_kms,
>         .irq_uninstall = radeon_driver_irq_uninstall_kms,
> diff --git a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
> index a1985a552794..8817fd033cd0 100644
> --- a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
> +++ b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
> @@ -1111,7 +1111,8 @@ static const struct drm_crtc_helper_funcs legacy_helper_funcs = {
>         .mode_set_base_atomic = radeon_crtc_set_base_atomic,
>         .prepare = radeon_crtc_prepare,
>         .commit = radeon_crtc_commit,
> -       .disable = radeon_crtc_disable
> +       .disable = radeon_crtc_disable,
> +       .get_scanout_position = radeon_get_crtc_scanout_position,
>  };
>
>
> diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h
> index fd470d6bf3f4..06c4c527d376 100644
> --- a/drivers/gpu/drm/radeon/radeon_mode.h
> +++ b/drivers/gpu/drm/radeon/radeon_mode.h
> @@ -881,6 +881,12 @@ extern int radeon_get_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe,
>                                       ktime_t *stime, ktime_t *etime,
>                                       const struct drm_display_mode *mode);
>
> +extern bool radeon_get_crtc_scanout_position(struct drm_crtc *crtc,
> +                                            bool in_vblank_irq, int *vpos,
> +                                            int *hpos, ktime_t *stime,
> +                                            ktime_t *etime,
> +                                            const struct drm_display_mode *mode);
> +
>  extern bool radeon_combios_check_hardcoded_edid(struct radeon_device *rdev);
>  extern struct edid *
>  radeon_bios_get_hardcoded_edid(struct radeon_device *rdev);
> --
> 2.24.1
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [PATCH 05/23] drm/radeon: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
@ 2020-01-13 18:53     ` Alex Deucher
  0 siblings, 0 replies; 217+ messages in thread
From: Alex Deucher @ 2020-01-13 18:53 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: hamohammed.sa-Re5JQEeQqe8AvxtiuMwx3w, Dave Airlie, nouveau,
	Joonas Lahtinen, Maling list - DRI developers, Eric Anholt,
	amd-gfx list, Benjamin Gaignard, alexandre.torgue-qxv4g6HH51o,
	Chunming Zhou, Thomas Hellstrom, Sean Paul, Patrik Jakobsson,
	VMware Graphics, Ben Skeggs, Wentland, Harry,
	mcoquelin.stm32-Re5JQEeQqe8AvxtiuMwx3w, Leo (Sunpeng) Li,
	linux-arm-msm, Intel Graphics Development, Maarten Lankhorst

On Fri, Jan 10, 2020 at 4:22 AM Thomas Zimmermann <tzimmermann-l3A5Bk7waGM@public.gmane.org> wrote:
>
> The callback struct drm_driver.get_scanout_position() is deprecated in
> favor of struct drm_crtc_helper_funcs.get_scanout_position(). Convert
> radeon over.
>

I'd prefer to just change the signature of
radeon_get_crtc_scanoutpos() to match the new API.

Alex

> Signed-off-by: Thomas Zimmermann <tzimmermann-l3A5Bk7waGM@public.gmane.org>
> ---
>  drivers/gpu/drm/radeon/atombios_crtc.c      |  1 +
>  drivers/gpu/drm/radeon/radeon_display.c     | 13 +++++++++++++
>  drivers/gpu/drm/radeon/radeon_drv.c         | 11 -----------
>  drivers/gpu/drm/radeon/radeon_legacy_crtc.c |  3 ++-
>  drivers/gpu/drm/radeon/radeon_mode.h        |  6 ++++++
>  5 files changed, 22 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c
> index da2c9e295408..447d74b78f19 100644
> --- a/drivers/gpu/drm/radeon/atombios_crtc.c
> +++ b/drivers/gpu/drm/radeon/atombios_crtc.c
> @@ -2232,6 +2232,7 @@ static const struct drm_crtc_helper_funcs atombios_helper_funcs = {
>         .prepare = atombios_crtc_prepare,
>         .commit = atombios_crtc_commit,
>         .disable = atombios_crtc_disable,
> +       .get_scanout_position = radeon_get_crtc_scanout_position,
>  };
>
>  void radeon_atombios_init_crtc(struct drm_device *dev,
> diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
> index 962575e27cde..7187158b9963 100644
> --- a/drivers/gpu/drm/radeon/radeon_display.c
> +++ b/drivers/gpu/drm/radeon/radeon_display.c
> @@ -1978,3 +1978,16 @@ int radeon_get_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe,
>
>         return ret;
>  }
> +
> +bool
> +radeon_get_crtc_scanout_position(struct drm_crtc *crtc,
> +                                bool in_vblank_irq, int *vpos, int *hpos,
> +                                ktime_t *stime, ktime_t *etime,
> +                                const struct drm_display_mode *mode)
> +{
> +       struct drm_device *dev = crtc->dev;
> +       unsigned int pipe = crtc->index;
> +
> +       return radeon_get_crtc_scanoutpos(dev, pipe, 0, vpos, hpos,
> +                                         stime, etime, mode);
> +}
> diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
> index fd74e2611185..1f597f166bff 100644
> --- a/drivers/gpu/drm/radeon/radeon_drv.c
> +++ b/drivers/gpu/drm/radeon/radeon_drv.c
> @@ -563,16 +563,6 @@ static const struct file_operations radeon_driver_kms_fops = {
>  #endif
>  };
>
> -static bool
> -radeon_get_crtc_scanout_position(struct drm_device *dev, unsigned int pipe,
> -                                bool in_vblank_irq, int *vpos, int *hpos,
> -                                ktime_t *stime, ktime_t *etime,
> -                                const struct drm_display_mode *mode)
> -{
> -       return radeon_get_crtc_scanoutpos(dev, pipe, 0, vpos, hpos,
> -                                         stime, etime, mode);
> -}
> -
>  static struct drm_driver kms_driver = {
>         .driver_features =
>             DRIVER_USE_AGP | DRIVER_GEM | DRIVER_RENDER,
> @@ -585,7 +575,6 @@ static struct drm_driver kms_driver = {
>         .enable_vblank = radeon_enable_vblank_kms,
>         .disable_vblank = radeon_disable_vblank_kms,
>         .get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
> -       .get_scanout_position = radeon_get_crtc_scanout_position,
>         .irq_preinstall = radeon_driver_irq_preinstall_kms,
>         .irq_postinstall = radeon_driver_irq_postinstall_kms,
>         .irq_uninstall = radeon_driver_irq_uninstall_kms,
> diff --git a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
> index a1985a552794..8817fd033cd0 100644
> --- a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
> +++ b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
> @@ -1111,7 +1111,8 @@ static const struct drm_crtc_helper_funcs legacy_helper_funcs = {
>         .mode_set_base_atomic = radeon_crtc_set_base_atomic,
>         .prepare = radeon_crtc_prepare,
>         .commit = radeon_crtc_commit,
> -       .disable = radeon_crtc_disable
> +       .disable = radeon_crtc_disable,
> +       .get_scanout_position = radeon_get_crtc_scanout_position,
>  };
>
>
> diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h
> index fd470d6bf3f4..06c4c527d376 100644
> --- a/drivers/gpu/drm/radeon/radeon_mode.h
> +++ b/drivers/gpu/drm/radeon/radeon_mode.h
> @@ -881,6 +881,12 @@ extern int radeon_get_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe,
>                                       ktime_t *stime, ktime_t *etime,
>                                       const struct drm_display_mode *mode);
>
> +extern bool radeon_get_crtc_scanout_position(struct drm_crtc *crtc,
> +                                            bool in_vblank_irq, int *vpos,
> +                                            int *hpos, ktime_t *stime,
> +                                            ktime_t *etime,
> +                                            const struct drm_display_mode *mode);
> +
>  extern bool radeon_combios_check_hardcoded_edid(struct radeon_device *rdev);
>  extern struct edid *
>  radeon_bios_get_hardcoded_edid(struct radeon_device *rdev);
> --
> 2.24.1
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [PATCH 05/23] drm/radeon: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
@ 2020-01-13 18:53     ` Alex Deucher
  0 siblings, 0 replies; 217+ messages in thread
From: Alex Deucher @ 2020-01-13 18:53 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: hamohammed.sa, Dave Airlie, nouveau,
	Maling list - DRI developers, amd-gfx list, alexandre.torgue,
	Thomas Hellstrom, Sean Paul, VMware Graphics, Ben Skeggs,
	mcoquelin.stm32, Leo (Sunpeng) Li, linux-arm-msm,
	Intel Graphics Development, Rodrigo Vivi, Vincent Abriou,
	rodrigosiqueiramelo, philippe.cornu, yannick.fertre, Deucher,
	Alexander, freedreno, Christian Koenig

On Fri, Jan 10, 2020 at 4:22 AM Thomas Zimmermann <tzimmermann@suse.de> wrote:
>
> The callback struct drm_driver.get_scanout_position() is deprecated in
> favor of struct drm_crtc_helper_funcs.get_scanout_position(). Convert
> radeon over.
>

I'd prefer to just change the signature of
radeon_get_crtc_scanoutpos() to match the new API.

Alex

> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
>  drivers/gpu/drm/radeon/atombios_crtc.c      |  1 +
>  drivers/gpu/drm/radeon/radeon_display.c     | 13 +++++++++++++
>  drivers/gpu/drm/radeon/radeon_drv.c         | 11 -----------
>  drivers/gpu/drm/radeon/radeon_legacy_crtc.c |  3 ++-
>  drivers/gpu/drm/radeon/radeon_mode.h        |  6 ++++++
>  5 files changed, 22 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c
> index da2c9e295408..447d74b78f19 100644
> --- a/drivers/gpu/drm/radeon/atombios_crtc.c
> +++ b/drivers/gpu/drm/radeon/atombios_crtc.c
> @@ -2232,6 +2232,7 @@ static const struct drm_crtc_helper_funcs atombios_helper_funcs = {
>         .prepare = atombios_crtc_prepare,
>         .commit = atombios_crtc_commit,
>         .disable = atombios_crtc_disable,
> +       .get_scanout_position = radeon_get_crtc_scanout_position,
>  };
>
>  void radeon_atombios_init_crtc(struct drm_device *dev,
> diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
> index 962575e27cde..7187158b9963 100644
> --- a/drivers/gpu/drm/radeon/radeon_display.c
> +++ b/drivers/gpu/drm/radeon/radeon_display.c
> @@ -1978,3 +1978,16 @@ int radeon_get_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe,
>
>         return ret;
>  }
> +
> +bool
> +radeon_get_crtc_scanout_position(struct drm_crtc *crtc,
> +                                bool in_vblank_irq, int *vpos, int *hpos,
> +                                ktime_t *stime, ktime_t *etime,
> +                                const struct drm_display_mode *mode)
> +{
> +       struct drm_device *dev = crtc->dev;
> +       unsigned int pipe = crtc->index;
> +
> +       return radeon_get_crtc_scanoutpos(dev, pipe, 0, vpos, hpos,
> +                                         stime, etime, mode);
> +}
> diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
> index fd74e2611185..1f597f166bff 100644
> --- a/drivers/gpu/drm/radeon/radeon_drv.c
> +++ b/drivers/gpu/drm/radeon/radeon_drv.c
> @@ -563,16 +563,6 @@ static const struct file_operations radeon_driver_kms_fops = {
>  #endif
>  };
>
> -static bool
> -radeon_get_crtc_scanout_position(struct drm_device *dev, unsigned int pipe,
> -                                bool in_vblank_irq, int *vpos, int *hpos,
> -                                ktime_t *stime, ktime_t *etime,
> -                                const struct drm_display_mode *mode)
> -{
> -       return radeon_get_crtc_scanoutpos(dev, pipe, 0, vpos, hpos,
> -                                         stime, etime, mode);
> -}
> -
>  static struct drm_driver kms_driver = {
>         .driver_features =
>             DRIVER_USE_AGP | DRIVER_GEM | DRIVER_RENDER,
> @@ -585,7 +575,6 @@ static struct drm_driver kms_driver = {
>         .enable_vblank = radeon_enable_vblank_kms,
>         .disable_vblank = radeon_disable_vblank_kms,
>         .get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
> -       .get_scanout_position = radeon_get_crtc_scanout_position,
>         .irq_preinstall = radeon_driver_irq_preinstall_kms,
>         .irq_postinstall = radeon_driver_irq_postinstall_kms,
>         .irq_uninstall = radeon_driver_irq_uninstall_kms,
> diff --git a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
> index a1985a552794..8817fd033cd0 100644
> --- a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
> +++ b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
> @@ -1111,7 +1111,8 @@ static const struct drm_crtc_helper_funcs legacy_helper_funcs = {
>         .mode_set_base_atomic = radeon_crtc_set_base_atomic,
>         .prepare = radeon_crtc_prepare,
>         .commit = radeon_crtc_commit,
> -       .disable = radeon_crtc_disable
> +       .disable = radeon_crtc_disable,
> +       .get_scanout_position = radeon_get_crtc_scanout_position,
>  };
>
>
> diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h
> index fd470d6bf3f4..06c4c527d376 100644
> --- a/drivers/gpu/drm/radeon/radeon_mode.h
> +++ b/drivers/gpu/drm/radeon/radeon_mode.h
> @@ -881,6 +881,12 @@ extern int radeon_get_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe,
>                                       ktime_t *stime, ktime_t *etime,
>                                       const struct drm_display_mode *mode);
>
> +extern bool radeon_get_crtc_scanout_position(struct drm_crtc *crtc,
> +                                            bool in_vblank_irq, int *vpos,
> +                                            int *hpos, ktime_t *stime,
> +                                            ktime_t *etime,
> +                                            const struct drm_display_mode *mode);
> +
>  extern bool radeon_combios_check_hardcoded_edid(struct radeon_device *rdev);
>  extern struct edid *
>  radeon_bios_get_hardcoded_edid(struct radeon_device *rdev);
> --
> 2.24.1
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [Intel-gfx] [PATCH 05/23] drm/radeon: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
@ 2020-01-13 18:53     ` Alex Deucher
  0 siblings, 0 replies; 217+ messages in thread
From: Alex Deucher @ 2020-01-13 18:53 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: hamohammed.sa, Dave Airlie, nouveau,
	Maling list - DRI developers, Eric Anholt, amd-gfx list,
	Benjamin Gaignard, alexandre.torgue, Chunming Zhou,
	Thomas Hellstrom, VMware Graphics, Ben Skeggs, Wentland, Harry,
	mcoquelin.stm32, Leo (Sunpeng) Li, linux-arm-msm,
	Intel Graphics Development, Vincent Abriou, rodrigosiqueiramelo,
	philippe.cornu, yannick.fertre, Deucher, Alexander, freedreno,
	Christian Koenig

On Fri, Jan 10, 2020 at 4:22 AM Thomas Zimmermann <tzimmermann@suse.de> wrote:
>
> The callback struct drm_driver.get_scanout_position() is deprecated in
> favor of struct drm_crtc_helper_funcs.get_scanout_position(). Convert
> radeon over.
>

I'd prefer to just change the signature of
radeon_get_crtc_scanoutpos() to match the new API.

Alex

> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
>  drivers/gpu/drm/radeon/atombios_crtc.c      |  1 +
>  drivers/gpu/drm/radeon/radeon_display.c     | 13 +++++++++++++
>  drivers/gpu/drm/radeon/radeon_drv.c         | 11 -----------
>  drivers/gpu/drm/radeon/radeon_legacy_crtc.c |  3 ++-
>  drivers/gpu/drm/radeon/radeon_mode.h        |  6 ++++++
>  5 files changed, 22 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c
> index da2c9e295408..447d74b78f19 100644
> --- a/drivers/gpu/drm/radeon/atombios_crtc.c
> +++ b/drivers/gpu/drm/radeon/atombios_crtc.c
> @@ -2232,6 +2232,7 @@ static const struct drm_crtc_helper_funcs atombios_helper_funcs = {
>         .prepare = atombios_crtc_prepare,
>         .commit = atombios_crtc_commit,
>         .disable = atombios_crtc_disable,
> +       .get_scanout_position = radeon_get_crtc_scanout_position,
>  };
>
>  void radeon_atombios_init_crtc(struct drm_device *dev,
> diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
> index 962575e27cde..7187158b9963 100644
> --- a/drivers/gpu/drm/radeon/radeon_display.c
> +++ b/drivers/gpu/drm/radeon/radeon_display.c
> @@ -1978,3 +1978,16 @@ int radeon_get_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe,
>
>         return ret;
>  }
> +
> +bool
> +radeon_get_crtc_scanout_position(struct drm_crtc *crtc,
> +                                bool in_vblank_irq, int *vpos, int *hpos,
> +                                ktime_t *stime, ktime_t *etime,
> +                                const struct drm_display_mode *mode)
> +{
> +       struct drm_device *dev = crtc->dev;
> +       unsigned int pipe = crtc->index;
> +
> +       return radeon_get_crtc_scanoutpos(dev, pipe, 0, vpos, hpos,
> +                                         stime, etime, mode);
> +}
> diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
> index fd74e2611185..1f597f166bff 100644
> --- a/drivers/gpu/drm/radeon/radeon_drv.c
> +++ b/drivers/gpu/drm/radeon/radeon_drv.c
> @@ -563,16 +563,6 @@ static const struct file_operations radeon_driver_kms_fops = {
>  #endif
>  };
>
> -static bool
> -radeon_get_crtc_scanout_position(struct drm_device *dev, unsigned int pipe,
> -                                bool in_vblank_irq, int *vpos, int *hpos,
> -                                ktime_t *stime, ktime_t *etime,
> -                                const struct drm_display_mode *mode)
> -{
> -       return radeon_get_crtc_scanoutpos(dev, pipe, 0, vpos, hpos,
> -                                         stime, etime, mode);
> -}
> -
>  static struct drm_driver kms_driver = {
>         .driver_features =
>             DRIVER_USE_AGP | DRIVER_GEM | DRIVER_RENDER,
> @@ -585,7 +575,6 @@ static struct drm_driver kms_driver = {
>         .enable_vblank = radeon_enable_vblank_kms,
>         .disable_vblank = radeon_disable_vblank_kms,
>         .get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
> -       .get_scanout_position = radeon_get_crtc_scanout_position,
>         .irq_preinstall = radeon_driver_irq_preinstall_kms,
>         .irq_postinstall = radeon_driver_irq_postinstall_kms,
>         .irq_uninstall = radeon_driver_irq_uninstall_kms,
> diff --git a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
> index a1985a552794..8817fd033cd0 100644
> --- a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
> +++ b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
> @@ -1111,7 +1111,8 @@ static const struct drm_crtc_helper_funcs legacy_helper_funcs = {
>         .mode_set_base_atomic = radeon_crtc_set_base_atomic,
>         .prepare = radeon_crtc_prepare,
>         .commit = radeon_crtc_commit,
> -       .disable = radeon_crtc_disable
> +       .disable = radeon_crtc_disable,
> +       .get_scanout_position = radeon_get_crtc_scanout_position,
>  };
>
>
> diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h
> index fd470d6bf3f4..06c4c527d376 100644
> --- a/drivers/gpu/drm/radeon/radeon_mode.h
> +++ b/drivers/gpu/drm/radeon/radeon_mode.h
> @@ -881,6 +881,12 @@ extern int radeon_get_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe,
>                                       ktime_t *stime, ktime_t *etime,
>                                       const struct drm_display_mode *mode);
>
> +extern bool radeon_get_crtc_scanout_position(struct drm_crtc *crtc,
> +                                            bool in_vblank_irq, int *vpos,
> +                                            int *hpos, ktime_t *stime,
> +                                            ktime_t *etime,
> +                                            const struct drm_display_mode *mode);
> +
>  extern bool radeon_combios_check_hardcoded_edid(struct radeon_device *rdev);
>  extern struct edid *
>  radeon_bios_get_hardcoded_edid(struct radeon_device *rdev);
> --
> 2.24.1
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [PATCH 05/23] drm/radeon: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
@ 2020-01-13 18:53     ` Alex Deucher
  0 siblings, 0 replies; 217+ messages in thread
From: Alex Deucher @ 2020-01-13 18:53 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: hamohammed.sa, Dave Airlie, nouveau, Joonas Lahtinen,
	Maling list - DRI developers, Eric Anholt, amd-gfx list,
	Benjamin Gaignard, alexandre.torgue, Chunming Zhou,
	Thomas Hellstrom, Sean Paul, Patrik Jakobsson, VMware Graphics,
	Ben Skeggs, Wentland, Harry, mcoquelin.stm32, Leo (Sunpeng) Li,
	linux-arm-msm, Intel Graphics Development, Maarten Lankhorst,
	Jani Nikula, Rodrigo Vivi, Vincent Abriou, rodrigosiqueiramelo,
	philippe.cornu, yannick.fertre, Rob Clark, Daniel Vetter,
	Deucher, Alexander, freedreno, Christian Koenig

On Fri, Jan 10, 2020 at 4:22 AM Thomas Zimmermann <tzimmermann@suse.de> wrote:
>
> The callback struct drm_driver.get_scanout_position() is deprecated in
> favor of struct drm_crtc_helper_funcs.get_scanout_position(). Convert
> radeon over.
>

I'd prefer to just change the signature of
radeon_get_crtc_scanoutpos() to match the new API.

Alex

> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
>  drivers/gpu/drm/radeon/atombios_crtc.c      |  1 +
>  drivers/gpu/drm/radeon/radeon_display.c     | 13 +++++++++++++
>  drivers/gpu/drm/radeon/radeon_drv.c         | 11 -----------
>  drivers/gpu/drm/radeon/radeon_legacy_crtc.c |  3 ++-
>  drivers/gpu/drm/radeon/radeon_mode.h        |  6 ++++++
>  5 files changed, 22 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c
> index da2c9e295408..447d74b78f19 100644
> --- a/drivers/gpu/drm/radeon/atombios_crtc.c
> +++ b/drivers/gpu/drm/radeon/atombios_crtc.c
> @@ -2232,6 +2232,7 @@ static const struct drm_crtc_helper_funcs atombios_helper_funcs = {
>         .prepare = atombios_crtc_prepare,
>         .commit = atombios_crtc_commit,
>         .disable = atombios_crtc_disable,
> +       .get_scanout_position = radeon_get_crtc_scanout_position,
>  };
>
>  void radeon_atombios_init_crtc(struct drm_device *dev,
> diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
> index 962575e27cde..7187158b9963 100644
> --- a/drivers/gpu/drm/radeon/radeon_display.c
> +++ b/drivers/gpu/drm/radeon/radeon_display.c
> @@ -1978,3 +1978,16 @@ int radeon_get_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe,
>
>         return ret;
>  }
> +
> +bool
> +radeon_get_crtc_scanout_position(struct drm_crtc *crtc,
> +                                bool in_vblank_irq, int *vpos, int *hpos,
> +                                ktime_t *stime, ktime_t *etime,
> +                                const struct drm_display_mode *mode)
> +{
> +       struct drm_device *dev = crtc->dev;
> +       unsigned int pipe = crtc->index;
> +
> +       return radeon_get_crtc_scanoutpos(dev, pipe, 0, vpos, hpos,
> +                                         stime, etime, mode);
> +}
> diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
> index fd74e2611185..1f597f166bff 100644
> --- a/drivers/gpu/drm/radeon/radeon_drv.c
> +++ b/drivers/gpu/drm/radeon/radeon_drv.c
> @@ -563,16 +563,6 @@ static const struct file_operations radeon_driver_kms_fops = {
>  #endif
>  };
>
> -static bool
> -radeon_get_crtc_scanout_position(struct drm_device *dev, unsigned int pipe,
> -                                bool in_vblank_irq, int *vpos, int *hpos,
> -                                ktime_t *stime, ktime_t *etime,
> -                                const struct drm_display_mode *mode)
> -{
> -       return radeon_get_crtc_scanoutpos(dev, pipe, 0, vpos, hpos,
> -                                         stime, etime, mode);
> -}
> -
>  static struct drm_driver kms_driver = {
>         .driver_features =
>             DRIVER_USE_AGP | DRIVER_GEM | DRIVER_RENDER,
> @@ -585,7 +575,6 @@ static struct drm_driver kms_driver = {
>         .enable_vblank = radeon_enable_vblank_kms,
>         .disable_vblank = radeon_disable_vblank_kms,
>         .get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
> -       .get_scanout_position = radeon_get_crtc_scanout_position,
>         .irq_preinstall = radeon_driver_irq_preinstall_kms,
>         .irq_postinstall = radeon_driver_irq_postinstall_kms,
>         .irq_uninstall = radeon_driver_irq_uninstall_kms,
> diff --git a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
> index a1985a552794..8817fd033cd0 100644
> --- a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
> +++ b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
> @@ -1111,7 +1111,8 @@ static const struct drm_crtc_helper_funcs legacy_helper_funcs = {
>         .mode_set_base_atomic = radeon_crtc_set_base_atomic,
>         .prepare = radeon_crtc_prepare,
>         .commit = radeon_crtc_commit,
> -       .disable = radeon_crtc_disable
> +       .disable = radeon_crtc_disable,
> +       .get_scanout_position = radeon_get_crtc_scanout_position,
>  };
>
>
> diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h
> index fd470d6bf3f4..06c4c527d376 100644
> --- a/drivers/gpu/drm/radeon/radeon_mode.h
> +++ b/drivers/gpu/drm/radeon/radeon_mode.h
> @@ -881,6 +881,12 @@ extern int radeon_get_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe,
>                                       ktime_t *stime, ktime_t *etime,
>                                       const struct drm_display_mode *mode);
>
> +extern bool radeon_get_crtc_scanout_position(struct drm_crtc *crtc,
> +                                            bool in_vblank_irq, int *vpos,
> +                                            int *hpos, ktime_t *stime,
> +                                            ktime_t *etime,
> +                                            const struct drm_display_mode *mode);
> +
>  extern bool radeon_combios_check_hardcoded_edid(struct radeon_device *rdev);
>  extern struct edid *
>  radeon_bios_get_hardcoded_edid(struct radeon_device *rdev);
> --
> 2.24.1
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [PATCH 12/23] drm/amdgpu: Convert to CRTC VBLANK callbacks
@ 2020-01-13 19:00     ` Alex Deucher
  0 siblings, 0 replies; 217+ messages in thread
From: Alex Deucher @ 2020-01-13 19:00 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: Dave Airlie, Daniel Vetter, Deucher, Alexander, Christian Koenig,
	Chunming Zhou, Maarten Lankhorst, Patrik Jakobsson, Rob Clark,
	Sean Paul, Benjamin Gaignard, Vincent Abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, Eric Anholt,
	rodrigosiqueiramelo, hamohammed.sa, VMware Graphics,
	Thomas Hellstrom, Ben Skeggs, Wentland, Harry, Leo (Sunpeng) Li,
	Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, linux-arm-msm,
	Intel Graphics Development, amd-gfx list,
	Maling list - DRI developers, nouveau, freedreno

On Fri, Jan 10, 2020 at 4:22 AM Thomas Zimmermann <tzimmermann@suse.de> wrote:
>
> VBLANK callbacks in struct drm_driver are deprecated in favor of
> their equivalents in struct drm_crtc_funcs. Convert amdgpu over.

I think I'd prefer to just update the signatures of the relevant
functions rather than wrapping them.

Alex

>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu.h           |  3 +++
>  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c       |  4 ----
>  drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c       | 24 +++++++++++++++++++
>  drivers/gpu/drm/amd/amdgpu/dce_v10_0.c        |  4 ++++
>  drivers/gpu/drm/amd/amdgpu/dce_v11_0.c        |  4 ++++
>  drivers/gpu/drm/amd/amdgpu/dce_v6_0.c         |  4 ++++
>  drivers/gpu/drm/amd/amdgpu/dce_v8_0.c         |  4 ++++
>  drivers/gpu/drm/amd/amdgpu/dce_virtual.c      |  4 ++++
>  .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  2 ++
>  9 files changed, 49 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> index 81a531b652aa..c1262ab588c9 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> @@ -1197,6 +1197,9 @@ int amdgpu_device_resume(struct drm_device *dev, bool fbcon);
>  u32 amdgpu_get_vblank_counter_kms(struct drm_device *dev, unsigned int pipe);
>  int amdgpu_enable_vblank_kms(struct drm_device *dev, unsigned int pipe);
>  void amdgpu_disable_vblank_kms(struct drm_device *dev, unsigned int pipe);
> +u32 amdgpu_crtc_get_vblank_counter(struct drm_crtc *crtc);
> +int amdgpu_crtc_enable_vblank(struct drm_crtc *crtc);
> +void amdgpu_crtc_disable_vblank(struct drm_crtc *crtc);
>  long amdgpu_kms_compat_ioctl(struct file *filp, unsigned int cmd,
>                              unsigned long arg);
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> index 0749285dd1c7..9baa1ddf8693 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> @@ -1377,10 +1377,6 @@ static struct drm_driver kms_driver = {
>         .postclose = amdgpu_driver_postclose_kms,
>         .lastclose = amdgpu_driver_lastclose_kms,
>         .unload = amdgpu_driver_unload_kms,
> -       .get_vblank_counter = amdgpu_get_vblank_counter_kms,
> -       .enable_vblank = amdgpu_enable_vblank_kms,
> -       .disable_vblank = amdgpu_disable_vblank_kms,
> -       .get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
>         .irq_handler = amdgpu_irq_handler,
>         .ioctls = amdgpu_ioctls_kms,
>         .gem_free_object_unlocked = amdgpu_gem_object_free,
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> index 60591dbc2097..efe4671fb032 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> @@ -1174,6 +1174,14 @@ u32 amdgpu_get_vblank_counter_kms(struct drm_device *dev, unsigned int pipe)
>         return count;
>  }
>
> +u32 amdgpu_crtc_get_vblank_counter(struct drm_crtc *crtc)
> +{
> +       struct drm_device *dev = crtc->dev;
> +       unsigned int pipe = crtc->index;
> +
> +       return amdgpu_get_vblank_counter_kms(dev, pipe);
> +}
> +
>  /**
>   * amdgpu_enable_vblank_kms - enable vblank interrupt
>   *
> @@ -1191,6 +1199,14 @@ int amdgpu_enable_vblank_kms(struct drm_device *dev, unsigned int pipe)
>         return amdgpu_irq_get(adev, &adev->crtc_irq, idx);
>  }
>
> +int amdgpu_crtc_enable_vblank(struct drm_crtc *crtc)
> +{
> +       struct drm_device *dev = crtc->dev;
> +       unsigned int pipe = crtc->index;
> +
> +       return amdgpu_enable_vblank_kms(dev, pipe);
> +}
> +
>  /**
>   * amdgpu_disable_vblank_kms - disable vblank interrupt
>   *
> @@ -1207,6 +1223,14 @@ void amdgpu_disable_vblank_kms(struct drm_device *dev, unsigned int pipe)
>         amdgpu_irq_put(adev, &adev->crtc_irq, idx);
>  }
>
> +void amdgpu_crtc_disable_vblank(struct drm_crtc *crtc)
> +{
> +       struct drm_device *dev = crtc->dev;
> +       unsigned int pipe = crtc->index;
> +
> +       amdgpu_disable_vblank_kms(dev, pipe);
> +}
> +
>  const struct drm_ioctl_desc amdgpu_ioctls_kms[] = {
>         DRM_IOCTL_DEF_DRV(AMDGPU_GEM_CREATE, amdgpu_gem_create_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
>         DRM_IOCTL_DEF_DRV(AMDGPU_CTX, amdgpu_ctx_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> index bdc1e0f036d4..8e62f46f0bfd 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> @@ -2494,6 +2494,10 @@ static const struct drm_crtc_funcs dce_v10_0_crtc_funcs = {
>         .set_config = amdgpu_display_crtc_set_config,
>         .destroy = dce_v10_0_crtc_destroy,
>         .page_flip_target = amdgpu_display_crtc_page_flip_target,
> +       .get_vblank_counter = amdgpu_crtc_get_vblank_counter,
> +       .enable_vblank = amdgpu_crtc_enable_vblank,
> +       .disable_vblank = amdgpu_crtc_disable_vblank,
> +       .get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
>  };
>
>  static void dce_v10_0_crtc_dpms(struct drm_crtc *crtc, int mode)
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> index 0319da5f7bf9..9e37e4a78403 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> @@ -2573,6 +2573,10 @@ static const struct drm_crtc_funcs dce_v11_0_crtc_funcs = {
>         .set_config = amdgpu_display_crtc_set_config,
>         .destroy = dce_v11_0_crtc_destroy,
>         .page_flip_target = amdgpu_display_crtc_page_flip_target,
> +       .get_vblank_counter = amdgpu_crtc_get_vblank_counter,
> +       .enable_vblank = amdgpu_crtc_enable_vblank,
> +       .disable_vblank = amdgpu_crtc_disable_vblank,
> +       .get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
>  };
>
>  static void dce_v11_0_crtc_dpms(struct drm_crtc *crtc, int mode)
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> index 78642c3b14fc..2d4c99d3b352 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> @@ -2388,6 +2388,10 @@ static const struct drm_crtc_funcs dce_v6_0_crtc_funcs = {
>         .set_config = amdgpu_display_crtc_set_config,
>         .destroy = dce_v6_0_crtc_destroy,
>         .page_flip_target = amdgpu_display_crtc_page_flip_target,
> +       .get_vblank_counter = amdgpu_crtc_get_vblank_counter,
> +       .enable_vblank = amdgpu_crtc_enable_vblank,
> +       .disable_vblank = amdgpu_crtc_disable_vblank,
> +       .get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
>  };
>
>  static void dce_v6_0_crtc_dpms(struct drm_crtc *crtc, int mode)
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> index 1e8d4975435a..cd51fd155349 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> @@ -2395,6 +2395,10 @@ static const struct drm_crtc_funcs dce_v8_0_crtc_funcs = {
>         .set_config = amdgpu_display_crtc_set_config,
>         .destroy = dce_v8_0_crtc_destroy,
>         .page_flip_target = amdgpu_display_crtc_page_flip_target,
> +       .get_vblank_counter = amdgpu_crtc_get_vblank_counter,
> +       .enable_vblank = amdgpu_crtc_enable_vblank,
> +       .disable_vblank = amdgpu_crtc_disable_vblank,
> +       .get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
>  };
>
>  static void dce_v8_0_crtc_dpms(struct drm_crtc *crtc, int mode)
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
> index 4b2f915aba47..53c260deb384 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
> @@ -123,6 +123,10 @@ static const struct drm_crtc_funcs dce_virtual_crtc_funcs = {
>         .set_config = amdgpu_display_crtc_set_config,
>         .destroy = dce_virtual_crtc_destroy,
>         .page_flip_target = amdgpu_display_crtc_page_flip_target,
> +       .get_vblank_counter = amdgpu_crtc_get_vblank_counter,
> +       .enable_vblank = amdgpu_crtc_enable_vblank,
> +       .disable_vblank = amdgpu_crtc_disable_vblank,
> +       .get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
>  };
>
>  static void dce_virtual_crtc_dpms(struct drm_crtc *crtc, int mode)
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index 39c5cf242c1b..0c51c4dd8c46 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -4214,8 +4214,10 @@ static const struct drm_crtc_funcs amdgpu_dm_crtc_funcs = {
>         .set_crc_source = amdgpu_dm_crtc_set_crc_source,
>         .verify_crc_source = amdgpu_dm_crtc_verify_crc_source,
>         .get_crc_sources = amdgpu_dm_crtc_get_crc_sources,
> +       .get_vblank_counter = amdgpu_crtc_get_vblank_counter,
>         .enable_vblank = dm_enable_vblank,
>         .disable_vblank = dm_disable_vblank,
> +       .get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
>  };
>
>  static enum drm_connector_status
> --
> 2.24.1
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [PATCH 12/23] drm/amdgpu: Convert to CRTC VBLANK callbacks
@ 2020-01-13 19:00     ` Alex Deucher
  0 siblings, 0 replies; 217+ messages in thread
From: Alex Deucher @ 2020-01-13 19:00 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: hamohammed.sa-Re5JQEeQqe8AvxtiuMwx3w, Dave Airlie, nouveau,
	Joonas Lahtinen, Maling list - DRI developers, Eric Anholt,
	amd-gfx list, Benjamin Gaignard, alexandre.torgue-qxv4g6HH51o,
	Chunming Zhou, Thomas Hellstrom, Sean Paul, Patrik Jakobsson,
	VMware Graphics, Ben Skeggs, Wentland, Harry,
	mcoquelin.stm32-Re5JQEeQqe8AvxtiuMwx3w, Leo (Sunpeng) Li,
	linux-arm-msm, Intel Graphics Development, Maarten Lankhorst

On Fri, Jan 10, 2020 at 4:22 AM Thomas Zimmermann <tzimmermann-l3A5Bk7waGM@public.gmane.org> wrote:
>
> VBLANK callbacks in struct drm_driver are deprecated in favor of
> their equivalents in struct drm_crtc_funcs. Convert amdgpu over.

I think I'd prefer to just update the signatures of the relevant
functions rather than wrapping them.

Alex

>
> Signed-off-by: Thomas Zimmermann <tzimmermann-l3A5Bk7waGM@public.gmane.org>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu.h           |  3 +++
>  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c       |  4 ----
>  drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c       | 24 +++++++++++++++++++
>  drivers/gpu/drm/amd/amdgpu/dce_v10_0.c        |  4 ++++
>  drivers/gpu/drm/amd/amdgpu/dce_v11_0.c        |  4 ++++
>  drivers/gpu/drm/amd/amdgpu/dce_v6_0.c         |  4 ++++
>  drivers/gpu/drm/amd/amdgpu/dce_v8_0.c         |  4 ++++
>  drivers/gpu/drm/amd/amdgpu/dce_virtual.c      |  4 ++++
>  .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  2 ++
>  9 files changed, 49 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> index 81a531b652aa..c1262ab588c9 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> @@ -1197,6 +1197,9 @@ int amdgpu_device_resume(struct drm_device *dev, bool fbcon);
>  u32 amdgpu_get_vblank_counter_kms(struct drm_device *dev, unsigned int pipe);
>  int amdgpu_enable_vblank_kms(struct drm_device *dev, unsigned int pipe);
>  void amdgpu_disable_vblank_kms(struct drm_device *dev, unsigned int pipe);
> +u32 amdgpu_crtc_get_vblank_counter(struct drm_crtc *crtc);
> +int amdgpu_crtc_enable_vblank(struct drm_crtc *crtc);
> +void amdgpu_crtc_disable_vblank(struct drm_crtc *crtc);
>  long amdgpu_kms_compat_ioctl(struct file *filp, unsigned int cmd,
>                              unsigned long arg);
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> index 0749285dd1c7..9baa1ddf8693 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> @@ -1377,10 +1377,6 @@ static struct drm_driver kms_driver = {
>         .postclose = amdgpu_driver_postclose_kms,
>         .lastclose = amdgpu_driver_lastclose_kms,
>         .unload = amdgpu_driver_unload_kms,
> -       .get_vblank_counter = amdgpu_get_vblank_counter_kms,
> -       .enable_vblank = amdgpu_enable_vblank_kms,
> -       .disable_vblank = amdgpu_disable_vblank_kms,
> -       .get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
>         .irq_handler = amdgpu_irq_handler,
>         .ioctls = amdgpu_ioctls_kms,
>         .gem_free_object_unlocked = amdgpu_gem_object_free,
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> index 60591dbc2097..efe4671fb032 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> @@ -1174,6 +1174,14 @@ u32 amdgpu_get_vblank_counter_kms(struct drm_device *dev, unsigned int pipe)
>         return count;
>  }
>
> +u32 amdgpu_crtc_get_vblank_counter(struct drm_crtc *crtc)
> +{
> +       struct drm_device *dev = crtc->dev;
> +       unsigned int pipe = crtc->index;
> +
> +       return amdgpu_get_vblank_counter_kms(dev, pipe);
> +}
> +
>  /**
>   * amdgpu_enable_vblank_kms - enable vblank interrupt
>   *
> @@ -1191,6 +1199,14 @@ int amdgpu_enable_vblank_kms(struct drm_device *dev, unsigned int pipe)
>         return amdgpu_irq_get(adev, &adev->crtc_irq, idx);
>  }
>
> +int amdgpu_crtc_enable_vblank(struct drm_crtc *crtc)
> +{
> +       struct drm_device *dev = crtc->dev;
> +       unsigned int pipe = crtc->index;
> +
> +       return amdgpu_enable_vblank_kms(dev, pipe);
> +}
> +
>  /**
>   * amdgpu_disable_vblank_kms - disable vblank interrupt
>   *
> @@ -1207,6 +1223,14 @@ void amdgpu_disable_vblank_kms(struct drm_device *dev, unsigned int pipe)
>         amdgpu_irq_put(adev, &adev->crtc_irq, idx);
>  }
>
> +void amdgpu_crtc_disable_vblank(struct drm_crtc *crtc)
> +{
> +       struct drm_device *dev = crtc->dev;
> +       unsigned int pipe = crtc->index;
> +
> +       amdgpu_disable_vblank_kms(dev, pipe);
> +}
> +
>  const struct drm_ioctl_desc amdgpu_ioctls_kms[] = {
>         DRM_IOCTL_DEF_DRV(AMDGPU_GEM_CREATE, amdgpu_gem_create_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
>         DRM_IOCTL_DEF_DRV(AMDGPU_CTX, amdgpu_ctx_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> index bdc1e0f036d4..8e62f46f0bfd 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> @@ -2494,6 +2494,10 @@ static const struct drm_crtc_funcs dce_v10_0_crtc_funcs = {
>         .set_config = amdgpu_display_crtc_set_config,
>         .destroy = dce_v10_0_crtc_destroy,
>         .page_flip_target = amdgpu_display_crtc_page_flip_target,
> +       .get_vblank_counter = amdgpu_crtc_get_vblank_counter,
> +       .enable_vblank = amdgpu_crtc_enable_vblank,
> +       .disable_vblank = amdgpu_crtc_disable_vblank,
> +       .get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
>  };
>
>  static void dce_v10_0_crtc_dpms(struct drm_crtc *crtc, int mode)
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> index 0319da5f7bf9..9e37e4a78403 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> @@ -2573,6 +2573,10 @@ static const struct drm_crtc_funcs dce_v11_0_crtc_funcs = {
>         .set_config = amdgpu_display_crtc_set_config,
>         .destroy = dce_v11_0_crtc_destroy,
>         .page_flip_target = amdgpu_display_crtc_page_flip_target,
> +       .get_vblank_counter = amdgpu_crtc_get_vblank_counter,
> +       .enable_vblank = amdgpu_crtc_enable_vblank,
> +       .disable_vblank = amdgpu_crtc_disable_vblank,
> +       .get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
>  };
>
>  static void dce_v11_0_crtc_dpms(struct drm_crtc *crtc, int mode)
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> index 78642c3b14fc..2d4c99d3b352 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> @@ -2388,6 +2388,10 @@ static const struct drm_crtc_funcs dce_v6_0_crtc_funcs = {
>         .set_config = amdgpu_display_crtc_set_config,
>         .destroy = dce_v6_0_crtc_destroy,
>         .page_flip_target = amdgpu_display_crtc_page_flip_target,
> +       .get_vblank_counter = amdgpu_crtc_get_vblank_counter,
> +       .enable_vblank = amdgpu_crtc_enable_vblank,
> +       .disable_vblank = amdgpu_crtc_disable_vblank,
> +       .get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
>  };
>
>  static void dce_v6_0_crtc_dpms(struct drm_crtc *crtc, int mode)
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> index 1e8d4975435a..cd51fd155349 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> @@ -2395,6 +2395,10 @@ static const struct drm_crtc_funcs dce_v8_0_crtc_funcs = {
>         .set_config = amdgpu_display_crtc_set_config,
>         .destroy = dce_v8_0_crtc_destroy,
>         .page_flip_target = amdgpu_display_crtc_page_flip_target,
> +       .get_vblank_counter = amdgpu_crtc_get_vblank_counter,
> +       .enable_vblank = amdgpu_crtc_enable_vblank,
> +       .disable_vblank = amdgpu_crtc_disable_vblank,
> +       .get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
>  };
>
>  static void dce_v8_0_crtc_dpms(struct drm_crtc *crtc, int mode)
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
> index 4b2f915aba47..53c260deb384 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
> @@ -123,6 +123,10 @@ static const struct drm_crtc_funcs dce_virtual_crtc_funcs = {
>         .set_config = amdgpu_display_crtc_set_config,
>         .destroy = dce_virtual_crtc_destroy,
>         .page_flip_target = amdgpu_display_crtc_page_flip_target,
> +       .get_vblank_counter = amdgpu_crtc_get_vblank_counter,
> +       .enable_vblank = amdgpu_crtc_enable_vblank,
> +       .disable_vblank = amdgpu_crtc_disable_vblank,
> +       .get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
>  };
>
>  static void dce_virtual_crtc_dpms(struct drm_crtc *crtc, int mode)
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index 39c5cf242c1b..0c51c4dd8c46 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -4214,8 +4214,10 @@ static const struct drm_crtc_funcs amdgpu_dm_crtc_funcs = {
>         .set_crc_source = amdgpu_dm_crtc_set_crc_source,
>         .verify_crc_source = amdgpu_dm_crtc_verify_crc_source,
>         .get_crc_sources = amdgpu_dm_crtc_get_crc_sources,
> +       .get_vblank_counter = amdgpu_crtc_get_vblank_counter,
>         .enable_vblank = dm_enable_vblank,
>         .disable_vblank = dm_disable_vblank,
> +       .get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
>  };
>
>  static enum drm_connector_status
> --
> 2.24.1
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [PATCH 12/23] drm/amdgpu: Convert to CRTC VBLANK callbacks
@ 2020-01-13 19:00     ` Alex Deucher
  0 siblings, 0 replies; 217+ messages in thread
From: Alex Deucher @ 2020-01-13 19:00 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: hamohammed.sa, Dave Airlie, nouveau,
	Maling list - DRI developers, amd-gfx list, alexandre.torgue,
	Thomas Hellstrom, Sean Paul, VMware Graphics, Ben Skeggs,
	mcoquelin.stm32, Leo (Sunpeng) Li, linux-arm-msm,
	Intel Graphics Development, Rodrigo Vivi, Vincent Abriou,
	rodrigosiqueiramelo, philippe.cornu, yannick.fertre, Deucher,
	Alexander, freedreno, Christian Koenig

On Fri, Jan 10, 2020 at 4:22 AM Thomas Zimmermann <tzimmermann@suse.de> wrote:
>
> VBLANK callbacks in struct drm_driver are deprecated in favor of
> their equivalents in struct drm_crtc_funcs. Convert amdgpu over.

I think I'd prefer to just update the signatures of the relevant
functions rather than wrapping them.

Alex

>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu.h           |  3 +++
>  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c       |  4 ----
>  drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c       | 24 +++++++++++++++++++
>  drivers/gpu/drm/amd/amdgpu/dce_v10_0.c        |  4 ++++
>  drivers/gpu/drm/amd/amdgpu/dce_v11_0.c        |  4 ++++
>  drivers/gpu/drm/amd/amdgpu/dce_v6_0.c         |  4 ++++
>  drivers/gpu/drm/amd/amdgpu/dce_v8_0.c         |  4 ++++
>  drivers/gpu/drm/amd/amdgpu/dce_virtual.c      |  4 ++++
>  .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  2 ++
>  9 files changed, 49 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> index 81a531b652aa..c1262ab588c9 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> @@ -1197,6 +1197,9 @@ int amdgpu_device_resume(struct drm_device *dev, bool fbcon);
>  u32 amdgpu_get_vblank_counter_kms(struct drm_device *dev, unsigned int pipe);
>  int amdgpu_enable_vblank_kms(struct drm_device *dev, unsigned int pipe);
>  void amdgpu_disable_vblank_kms(struct drm_device *dev, unsigned int pipe);
> +u32 amdgpu_crtc_get_vblank_counter(struct drm_crtc *crtc);
> +int amdgpu_crtc_enable_vblank(struct drm_crtc *crtc);
> +void amdgpu_crtc_disable_vblank(struct drm_crtc *crtc);
>  long amdgpu_kms_compat_ioctl(struct file *filp, unsigned int cmd,
>                              unsigned long arg);
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> index 0749285dd1c7..9baa1ddf8693 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> @@ -1377,10 +1377,6 @@ static struct drm_driver kms_driver = {
>         .postclose = amdgpu_driver_postclose_kms,
>         .lastclose = amdgpu_driver_lastclose_kms,
>         .unload = amdgpu_driver_unload_kms,
> -       .get_vblank_counter = amdgpu_get_vblank_counter_kms,
> -       .enable_vblank = amdgpu_enable_vblank_kms,
> -       .disable_vblank = amdgpu_disable_vblank_kms,
> -       .get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
>         .irq_handler = amdgpu_irq_handler,
>         .ioctls = amdgpu_ioctls_kms,
>         .gem_free_object_unlocked = amdgpu_gem_object_free,
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> index 60591dbc2097..efe4671fb032 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> @@ -1174,6 +1174,14 @@ u32 amdgpu_get_vblank_counter_kms(struct drm_device *dev, unsigned int pipe)
>         return count;
>  }
>
> +u32 amdgpu_crtc_get_vblank_counter(struct drm_crtc *crtc)
> +{
> +       struct drm_device *dev = crtc->dev;
> +       unsigned int pipe = crtc->index;
> +
> +       return amdgpu_get_vblank_counter_kms(dev, pipe);
> +}
> +
>  /**
>   * amdgpu_enable_vblank_kms - enable vblank interrupt
>   *
> @@ -1191,6 +1199,14 @@ int amdgpu_enable_vblank_kms(struct drm_device *dev, unsigned int pipe)
>         return amdgpu_irq_get(adev, &adev->crtc_irq, idx);
>  }
>
> +int amdgpu_crtc_enable_vblank(struct drm_crtc *crtc)
> +{
> +       struct drm_device *dev = crtc->dev;
> +       unsigned int pipe = crtc->index;
> +
> +       return amdgpu_enable_vblank_kms(dev, pipe);
> +}
> +
>  /**
>   * amdgpu_disable_vblank_kms - disable vblank interrupt
>   *
> @@ -1207,6 +1223,14 @@ void amdgpu_disable_vblank_kms(struct drm_device *dev, unsigned int pipe)
>         amdgpu_irq_put(adev, &adev->crtc_irq, idx);
>  }
>
> +void amdgpu_crtc_disable_vblank(struct drm_crtc *crtc)
> +{
> +       struct drm_device *dev = crtc->dev;
> +       unsigned int pipe = crtc->index;
> +
> +       amdgpu_disable_vblank_kms(dev, pipe);
> +}
> +
>  const struct drm_ioctl_desc amdgpu_ioctls_kms[] = {
>         DRM_IOCTL_DEF_DRV(AMDGPU_GEM_CREATE, amdgpu_gem_create_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
>         DRM_IOCTL_DEF_DRV(AMDGPU_CTX, amdgpu_ctx_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> index bdc1e0f036d4..8e62f46f0bfd 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> @@ -2494,6 +2494,10 @@ static const struct drm_crtc_funcs dce_v10_0_crtc_funcs = {
>         .set_config = amdgpu_display_crtc_set_config,
>         .destroy = dce_v10_0_crtc_destroy,
>         .page_flip_target = amdgpu_display_crtc_page_flip_target,
> +       .get_vblank_counter = amdgpu_crtc_get_vblank_counter,
> +       .enable_vblank = amdgpu_crtc_enable_vblank,
> +       .disable_vblank = amdgpu_crtc_disable_vblank,
> +       .get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
>  };
>
>  static void dce_v10_0_crtc_dpms(struct drm_crtc *crtc, int mode)
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> index 0319da5f7bf9..9e37e4a78403 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> @@ -2573,6 +2573,10 @@ static const struct drm_crtc_funcs dce_v11_0_crtc_funcs = {
>         .set_config = amdgpu_display_crtc_set_config,
>         .destroy = dce_v11_0_crtc_destroy,
>         .page_flip_target = amdgpu_display_crtc_page_flip_target,
> +       .get_vblank_counter = amdgpu_crtc_get_vblank_counter,
> +       .enable_vblank = amdgpu_crtc_enable_vblank,
> +       .disable_vblank = amdgpu_crtc_disable_vblank,
> +       .get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
>  };
>
>  static void dce_v11_0_crtc_dpms(struct drm_crtc *crtc, int mode)
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> index 78642c3b14fc..2d4c99d3b352 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> @@ -2388,6 +2388,10 @@ static const struct drm_crtc_funcs dce_v6_0_crtc_funcs = {
>         .set_config = amdgpu_display_crtc_set_config,
>         .destroy = dce_v6_0_crtc_destroy,
>         .page_flip_target = amdgpu_display_crtc_page_flip_target,
> +       .get_vblank_counter = amdgpu_crtc_get_vblank_counter,
> +       .enable_vblank = amdgpu_crtc_enable_vblank,
> +       .disable_vblank = amdgpu_crtc_disable_vblank,
> +       .get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
>  };
>
>  static void dce_v6_0_crtc_dpms(struct drm_crtc *crtc, int mode)
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> index 1e8d4975435a..cd51fd155349 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> @@ -2395,6 +2395,10 @@ static const struct drm_crtc_funcs dce_v8_0_crtc_funcs = {
>         .set_config = amdgpu_display_crtc_set_config,
>         .destroy = dce_v8_0_crtc_destroy,
>         .page_flip_target = amdgpu_display_crtc_page_flip_target,
> +       .get_vblank_counter = amdgpu_crtc_get_vblank_counter,
> +       .enable_vblank = amdgpu_crtc_enable_vblank,
> +       .disable_vblank = amdgpu_crtc_disable_vblank,
> +       .get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
>  };
>
>  static void dce_v8_0_crtc_dpms(struct drm_crtc *crtc, int mode)
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
> index 4b2f915aba47..53c260deb384 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
> @@ -123,6 +123,10 @@ static const struct drm_crtc_funcs dce_virtual_crtc_funcs = {
>         .set_config = amdgpu_display_crtc_set_config,
>         .destroy = dce_virtual_crtc_destroy,
>         .page_flip_target = amdgpu_display_crtc_page_flip_target,
> +       .get_vblank_counter = amdgpu_crtc_get_vblank_counter,
> +       .enable_vblank = amdgpu_crtc_enable_vblank,
> +       .disable_vblank = amdgpu_crtc_disable_vblank,
> +       .get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
>  };
>
>  static void dce_virtual_crtc_dpms(struct drm_crtc *crtc, int mode)
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index 39c5cf242c1b..0c51c4dd8c46 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -4214,8 +4214,10 @@ static const struct drm_crtc_funcs amdgpu_dm_crtc_funcs = {
>         .set_crc_source = amdgpu_dm_crtc_set_crc_source,
>         .verify_crc_source = amdgpu_dm_crtc_verify_crc_source,
>         .get_crc_sources = amdgpu_dm_crtc_get_crc_sources,
> +       .get_vblank_counter = amdgpu_crtc_get_vblank_counter,
>         .enable_vblank = dm_enable_vblank,
>         .disable_vblank = dm_disable_vblank,
> +       .get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
>  };
>
>  static enum drm_connector_status
> --
> 2.24.1
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [Intel-gfx] [PATCH 12/23] drm/amdgpu: Convert to CRTC VBLANK callbacks
@ 2020-01-13 19:00     ` Alex Deucher
  0 siblings, 0 replies; 217+ messages in thread
From: Alex Deucher @ 2020-01-13 19:00 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: hamohammed.sa, Dave Airlie, nouveau,
	Maling list - DRI developers, Eric Anholt, amd-gfx list,
	Benjamin Gaignard, alexandre.torgue, Chunming Zhou,
	Thomas Hellstrom, VMware Graphics, Ben Skeggs, Wentland, Harry,
	mcoquelin.stm32, Leo (Sunpeng) Li, linux-arm-msm,
	Intel Graphics Development, Vincent Abriou, rodrigosiqueiramelo,
	philippe.cornu, yannick.fertre, Deucher, Alexander, freedreno,
	Christian Koenig

On Fri, Jan 10, 2020 at 4:22 AM Thomas Zimmermann <tzimmermann@suse.de> wrote:
>
> VBLANK callbacks in struct drm_driver are deprecated in favor of
> their equivalents in struct drm_crtc_funcs. Convert amdgpu over.

I think I'd prefer to just update the signatures of the relevant
functions rather than wrapping them.

Alex

>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu.h           |  3 +++
>  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c       |  4 ----
>  drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c       | 24 +++++++++++++++++++
>  drivers/gpu/drm/amd/amdgpu/dce_v10_0.c        |  4 ++++
>  drivers/gpu/drm/amd/amdgpu/dce_v11_0.c        |  4 ++++
>  drivers/gpu/drm/amd/amdgpu/dce_v6_0.c         |  4 ++++
>  drivers/gpu/drm/amd/amdgpu/dce_v8_0.c         |  4 ++++
>  drivers/gpu/drm/amd/amdgpu/dce_virtual.c      |  4 ++++
>  .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  2 ++
>  9 files changed, 49 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> index 81a531b652aa..c1262ab588c9 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> @@ -1197,6 +1197,9 @@ int amdgpu_device_resume(struct drm_device *dev, bool fbcon);
>  u32 amdgpu_get_vblank_counter_kms(struct drm_device *dev, unsigned int pipe);
>  int amdgpu_enable_vblank_kms(struct drm_device *dev, unsigned int pipe);
>  void amdgpu_disable_vblank_kms(struct drm_device *dev, unsigned int pipe);
> +u32 amdgpu_crtc_get_vblank_counter(struct drm_crtc *crtc);
> +int amdgpu_crtc_enable_vblank(struct drm_crtc *crtc);
> +void amdgpu_crtc_disable_vblank(struct drm_crtc *crtc);
>  long amdgpu_kms_compat_ioctl(struct file *filp, unsigned int cmd,
>                              unsigned long arg);
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> index 0749285dd1c7..9baa1ddf8693 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> @@ -1377,10 +1377,6 @@ static struct drm_driver kms_driver = {
>         .postclose = amdgpu_driver_postclose_kms,
>         .lastclose = amdgpu_driver_lastclose_kms,
>         .unload = amdgpu_driver_unload_kms,
> -       .get_vblank_counter = amdgpu_get_vblank_counter_kms,
> -       .enable_vblank = amdgpu_enable_vblank_kms,
> -       .disable_vblank = amdgpu_disable_vblank_kms,
> -       .get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
>         .irq_handler = amdgpu_irq_handler,
>         .ioctls = amdgpu_ioctls_kms,
>         .gem_free_object_unlocked = amdgpu_gem_object_free,
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> index 60591dbc2097..efe4671fb032 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> @@ -1174,6 +1174,14 @@ u32 amdgpu_get_vblank_counter_kms(struct drm_device *dev, unsigned int pipe)
>         return count;
>  }
>
> +u32 amdgpu_crtc_get_vblank_counter(struct drm_crtc *crtc)
> +{
> +       struct drm_device *dev = crtc->dev;
> +       unsigned int pipe = crtc->index;
> +
> +       return amdgpu_get_vblank_counter_kms(dev, pipe);
> +}
> +
>  /**
>   * amdgpu_enable_vblank_kms - enable vblank interrupt
>   *
> @@ -1191,6 +1199,14 @@ int amdgpu_enable_vblank_kms(struct drm_device *dev, unsigned int pipe)
>         return amdgpu_irq_get(adev, &adev->crtc_irq, idx);
>  }
>
> +int amdgpu_crtc_enable_vblank(struct drm_crtc *crtc)
> +{
> +       struct drm_device *dev = crtc->dev;
> +       unsigned int pipe = crtc->index;
> +
> +       return amdgpu_enable_vblank_kms(dev, pipe);
> +}
> +
>  /**
>   * amdgpu_disable_vblank_kms - disable vblank interrupt
>   *
> @@ -1207,6 +1223,14 @@ void amdgpu_disable_vblank_kms(struct drm_device *dev, unsigned int pipe)
>         amdgpu_irq_put(adev, &adev->crtc_irq, idx);
>  }
>
> +void amdgpu_crtc_disable_vblank(struct drm_crtc *crtc)
> +{
> +       struct drm_device *dev = crtc->dev;
> +       unsigned int pipe = crtc->index;
> +
> +       amdgpu_disable_vblank_kms(dev, pipe);
> +}
> +
>  const struct drm_ioctl_desc amdgpu_ioctls_kms[] = {
>         DRM_IOCTL_DEF_DRV(AMDGPU_GEM_CREATE, amdgpu_gem_create_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
>         DRM_IOCTL_DEF_DRV(AMDGPU_CTX, amdgpu_ctx_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> index bdc1e0f036d4..8e62f46f0bfd 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> @@ -2494,6 +2494,10 @@ static const struct drm_crtc_funcs dce_v10_0_crtc_funcs = {
>         .set_config = amdgpu_display_crtc_set_config,
>         .destroy = dce_v10_0_crtc_destroy,
>         .page_flip_target = amdgpu_display_crtc_page_flip_target,
> +       .get_vblank_counter = amdgpu_crtc_get_vblank_counter,
> +       .enable_vblank = amdgpu_crtc_enable_vblank,
> +       .disable_vblank = amdgpu_crtc_disable_vblank,
> +       .get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
>  };
>
>  static void dce_v10_0_crtc_dpms(struct drm_crtc *crtc, int mode)
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> index 0319da5f7bf9..9e37e4a78403 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> @@ -2573,6 +2573,10 @@ static const struct drm_crtc_funcs dce_v11_0_crtc_funcs = {
>         .set_config = amdgpu_display_crtc_set_config,
>         .destroy = dce_v11_0_crtc_destroy,
>         .page_flip_target = amdgpu_display_crtc_page_flip_target,
> +       .get_vblank_counter = amdgpu_crtc_get_vblank_counter,
> +       .enable_vblank = amdgpu_crtc_enable_vblank,
> +       .disable_vblank = amdgpu_crtc_disable_vblank,
> +       .get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
>  };
>
>  static void dce_v11_0_crtc_dpms(struct drm_crtc *crtc, int mode)
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> index 78642c3b14fc..2d4c99d3b352 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> @@ -2388,6 +2388,10 @@ static const struct drm_crtc_funcs dce_v6_0_crtc_funcs = {
>         .set_config = amdgpu_display_crtc_set_config,
>         .destroy = dce_v6_0_crtc_destroy,
>         .page_flip_target = amdgpu_display_crtc_page_flip_target,
> +       .get_vblank_counter = amdgpu_crtc_get_vblank_counter,
> +       .enable_vblank = amdgpu_crtc_enable_vblank,
> +       .disable_vblank = amdgpu_crtc_disable_vblank,
> +       .get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
>  };
>
>  static void dce_v6_0_crtc_dpms(struct drm_crtc *crtc, int mode)
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> index 1e8d4975435a..cd51fd155349 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> @@ -2395,6 +2395,10 @@ static const struct drm_crtc_funcs dce_v8_0_crtc_funcs = {
>         .set_config = amdgpu_display_crtc_set_config,
>         .destroy = dce_v8_0_crtc_destroy,
>         .page_flip_target = amdgpu_display_crtc_page_flip_target,
> +       .get_vblank_counter = amdgpu_crtc_get_vblank_counter,
> +       .enable_vblank = amdgpu_crtc_enable_vblank,
> +       .disable_vblank = amdgpu_crtc_disable_vblank,
> +       .get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
>  };
>
>  static void dce_v8_0_crtc_dpms(struct drm_crtc *crtc, int mode)
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
> index 4b2f915aba47..53c260deb384 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
> @@ -123,6 +123,10 @@ static const struct drm_crtc_funcs dce_virtual_crtc_funcs = {
>         .set_config = amdgpu_display_crtc_set_config,
>         .destroy = dce_virtual_crtc_destroy,
>         .page_flip_target = amdgpu_display_crtc_page_flip_target,
> +       .get_vblank_counter = amdgpu_crtc_get_vblank_counter,
> +       .enable_vblank = amdgpu_crtc_enable_vblank,
> +       .disable_vblank = amdgpu_crtc_disable_vblank,
> +       .get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
>  };
>
>  static void dce_virtual_crtc_dpms(struct drm_crtc *crtc, int mode)
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index 39c5cf242c1b..0c51c4dd8c46 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -4214,8 +4214,10 @@ static const struct drm_crtc_funcs amdgpu_dm_crtc_funcs = {
>         .set_crc_source = amdgpu_dm_crtc_set_crc_source,
>         .verify_crc_source = amdgpu_dm_crtc_verify_crc_source,
>         .get_crc_sources = amdgpu_dm_crtc_get_crc_sources,
> +       .get_vblank_counter = amdgpu_crtc_get_vblank_counter,
>         .enable_vblank = dm_enable_vblank,
>         .disable_vblank = dm_disable_vblank,
> +       .get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
>  };
>
>  static enum drm_connector_status
> --
> 2.24.1
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [PATCH 12/23] drm/amdgpu: Convert to CRTC VBLANK callbacks
@ 2020-01-13 19:00     ` Alex Deucher
  0 siblings, 0 replies; 217+ messages in thread
From: Alex Deucher @ 2020-01-13 19:00 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: hamohammed.sa, Dave Airlie, nouveau, Joonas Lahtinen,
	Maling list - DRI developers, Eric Anholt, amd-gfx list,
	Benjamin Gaignard, alexandre.torgue, Chunming Zhou,
	Thomas Hellstrom, Sean Paul, Patrik Jakobsson, VMware Graphics,
	Ben Skeggs, Wentland, Harry, mcoquelin.stm32, Leo (Sunpeng) Li,
	linux-arm-msm, Intel Graphics Development, Maarten Lankhorst,
	Jani Nikula, Rodrigo Vivi, Vincent Abriou, rodrigosiqueiramelo,
	philippe.cornu, yannick.fertre, Rob Clark, Daniel Vetter,
	Deucher, Alexander, freedreno, Christian Koenig

On Fri, Jan 10, 2020 at 4:22 AM Thomas Zimmermann <tzimmermann@suse.de> wrote:
>
> VBLANK callbacks in struct drm_driver are deprecated in favor of
> their equivalents in struct drm_crtc_funcs. Convert amdgpu over.

I think I'd prefer to just update the signatures of the relevant
functions rather than wrapping them.

Alex

>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu.h           |  3 +++
>  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c       |  4 ----
>  drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c       | 24 +++++++++++++++++++
>  drivers/gpu/drm/amd/amdgpu/dce_v10_0.c        |  4 ++++
>  drivers/gpu/drm/amd/amdgpu/dce_v11_0.c        |  4 ++++
>  drivers/gpu/drm/amd/amdgpu/dce_v6_0.c         |  4 ++++
>  drivers/gpu/drm/amd/amdgpu/dce_v8_0.c         |  4 ++++
>  drivers/gpu/drm/amd/amdgpu/dce_virtual.c      |  4 ++++
>  .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  2 ++
>  9 files changed, 49 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> index 81a531b652aa..c1262ab588c9 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> @@ -1197,6 +1197,9 @@ int amdgpu_device_resume(struct drm_device *dev, bool fbcon);
>  u32 amdgpu_get_vblank_counter_kms(struct drm_device *dev, unsigned int pipe);
>  int amdgpu_enable_vblank_kms(struct drm_device *dev, unsigned int pipe);
>  void amdgpu_disable_vblank_kms(struct drm_device *dev, unsigned int pipe);
> +u32 amdgpu_crtc_get_vblank_counter(struct drm_crtc *crtc);
> +int amdgpu_crtc_enable_vblank(struct drm_crtc *crtc);
> +void amdgpu_crtc_disable_vblank(struct drm_crtc *crtc);
>  long amdgpu_kms_compat_ioctl(struct file *filp, unsigned int cmd,
>                              unsigned long arg);
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> index 0749285dd1c7..9baa1ddf8693 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> @@ -1377,10 +1377,6 @@ static struct drm_driver kms_driver = {
>         .postclose = amdgpu_driver_postclose_kms,
>         .lastclose = amdgpu_driver_lastclose_kms,
>         .unload = amdgpu_driver_unload_kms,
> -       .get_vblank_counter = amdgpu_get_vblank_counter_kms,
> -       .enable_vblank = amdgpu_enable_vblank_kms,
> -       .disable_vblank = amdgpu_disable_vblank_kms,
> -       .get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
>         .irq_handler = amdgpu_irq_handler,
>         .ioctls = amdgpu_ioctls_kms,
>         .gem_free_object_unlocked = amdgpu_gem_object_free,
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> index 60591dbc2097..efe4671fb032 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> @@ -1174,6 +1174,14 @@ u32 amdgpu_get_vblank_counter_kms(struct drm_device *dev, unsigned int pipe)
>         return count;
>  }
>
> +u32 amdgpu_crtc_get_vblank_counter(struct drm_crtc *crtc)
> +{
> +       struct drm_device *dev = crtc->dev;
> +       unsigned int pipe = crtc->index;
> +
> +       return amdgpu_get_vblank_counter_kms(dev, pipe);
> +}
> +
>  /**
>   * amdgpu_enable_vblank_kms - enable vblank interrupt
>   *
> @@ -1191,6 +1199,14 @@ int amdgpu_enable_vblank_kms(struct drm_device *dev, unsigned int pipe)
>         return amdgpu_irq_get(adev, &adev->crtc_irq, idx);
>  }
>
> +int amdgpu_crtc_enable_vblank(struct drm_crtc *crtc)
> +{
> +       struct drm_device *dev = crtc->dev;
> +       unsigned int pipe = crtc->index;
> +
> +       return amdgpu_enable_vblank_kms(dev, pipe);
> +}
> +
>  /**
>   * amdgpu_disable_vblank_kms - disable vblank interrupt
>   *
> @@ -1207,6 +1223,14 @@ void amdgpu_disable_vblank_kms(struct drm_device *dev, unsigned int pipe)
>         amdgpu_irq_put(adev, &adev->crtc_irq, idx);
>  }
>
> +void amdgpu_crtc_disable_vblank(struct drm_crtc *crtc)
> +{
> +       struct drm_device *dev = crtc->dev;
> +       unsigned int pipe = crtc->index;
> +
> +       amdgpu_disable_vblank_kms(dev, pipe);
> +}
> +
>  const struct drm_ioctl_desc amdgpu_ioctls_kms[] = {
>         DRM_IOCTL_DEF_DRV(AMDGPU_GEM_CREATE, amdgpu_gem_create_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
>         DRM_IOCTL_DEF_DRV(AMDGPU_CTX, amdgpu_ctx_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> index bdc1e0f036d4..8e62f46f0bfd 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> @@ -2494,6 +2494,10 @@ static const struct drm_crtc_funcs dce_v10_0_crtc_funcs = {
>         .set_config = amdgpu_display_crtc_set_config,
>         .destroy = dce_v10_0_crtc_destroy,
>         .page_flip_target = amdgpu_display_crtc_page_flip_target,
> +       .get_vblank_counter = amdgpu_crtc_get_vblank_counter,
> +       .enable_vblank = amdgpu_crtc_enable_vblank,
> +       .disable_vblank = amdgpu_crtc_disable_vblank,
> +       .get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
>  };
>
>  static void dce_v10_0_crtc_dpms(struct drm_crtc *crtc, int mode)
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> index 0319da5f7bf9..9e37e4a78403 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> @@ -2573,6 +2573,10 @@ static const struct drm_crtc_funcs dce_v11_0_crtc_funcs = {
>         .set_config = amdgpu_display_crtc_set_config,
>         .destroy = dce_v11_0_crtc_destroy,
>         .page_flip_target = amdgpu_display_crtc_page_flip_target,
> +       .get_vblank_counter = amdgpu_crtc_get_vblank_counter,
> +       .enable_vblank = amdgpu_crtc_enable_vblank,
> +       .disable_vblank = amdgpu_crtc_disable_vblank,
> +       .get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
>  };
>
>  static void dce_v11_0_crtc_dpms(struct drm_crtc *crtc, int mode)
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> index 78642c3b14fc..2d4c99d3b352 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> @@ -2388,6 +2388,10 @@ static const struct drm_crtc_funcs dce_v6_0_crtc_funcs = {
>         .set_config = amdgpu_display_crtc_set_config,
>         .destroy = dce_v6_0_crtc_destroy,
>         .page_flip_target = amdgpu_display_crtc_page_flip_target,
> +       .get_vblank_counter = amdgpu_crtc_get_vblank_counter,
> +       .enable_vblank = amdgpu_crtc_enable_vblank,
> +       .disable_vblank = amdgpu_crtc_disable_vblank,
> +       .get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
>  };
>
>  static void dce_v6_0_crtc_dpms(struct drm_crtc *crtc, int mode)
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> index 1e8d4975435a..cd51fd155349 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> @@ -2395,6 +2395,10 @@ static const struct drm_crtc_funcs dce_v8_0_crtc_funcs = {
>         .set_config = amdgpu_display_crtc_set_config,
>         .destroy = dce_v8_0_crtc_destroy,
>         .page_flip_target = amdgpu_display_crtc_page_flip_target,
> +       .get_vblank_counter = amdgpu_crtc_get_vblank_counter,
> +       .enable_vblank = amdgpu_crtc_enable_vblank,
> +       .disable_vblank = amdgpu_crtc_disable_vblank,
> +       .get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
>  };
>
>  static void dce_v8_0_crtc_dpms(struct drm_crtc *crtc, int mode)
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
> index 4b2f915aba47..53c260deb384 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
> @@ -123,6 +123,10 @@ static const struct drm_crtc_funcs dce_virtual_crtc_funcs = {
>         .set_config = amdgpu_display_crtc_set_config,
>         .destroy = dce_virtual_crtc_destroy,
>         .page_flip_target = amdgpu_display_crtc_page_flip_target,
> +       .get_vblank_counter = amdgpu_crtc_get_vblank_counter,
> +       .enable_vblank = amdgpu_crtc_enable_vblank,
> +       .disable_vblank = amdgpu_crtc_disable_vblank,
> +       .get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
>  };
>
>  static void dce_virtual_crtc_dpms(struct drm_crtc *crtc, int mode)
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index 39c5cf242c1b..0c51c4dd8c46 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -4214,8 +4214,10 @@ static const struct drm_crtc_funcs amdgpu_dm_crtc_funcs = {
>         .set_crc_source = amdgpu_dm_crtc_set_crc_source,
>         .verify_crc_source = amdgpu_dm_crtc_verify_crc_source,
>         .get_crc_sources = amdgpu_dm_crtc_get_crc_sources,
> +       .get_vblank_counter = amdgpu_crtc_get_vblank_counter,
>         .enable_vblank = dm_enable_vblank,
>         .disable_vblank = dm_disable_vblank,
> +       .get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
>  };
>
>  static enum drm_connector_status
> --
> 2.24.1
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [PATCH 17/23] drm/radeon: Convert to CRTC VBLANK callbacks
  2020-01-10  9:21   ` Thomas Zimmermann
                       ` (2 preceding siblings ...)
  (?)
@ 2020-01-13 19:02     ` Alex Deucher
  -1 siblings, 0 replies; 217+ messages in thread
From: Alex Deucher @ 2020-01-13 19:02 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: Dave Airlie, Daniel Vetter, Deucher, Alexander, Christian Koenig,
	Chunming Zhou, Maarten Lankhorst, Patrik Jakobsson, Rob Clark,
	Sean Paul, Benjamin Gaignard, Vincent Abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, Eric Anholt,
	rodrigosiqueiramelo, hamohammed.sa, VMware Graphics,
	Thomas Hellstrom, Ben Skeggs, Wentland, Harry, Leo (Sunpeng) Li,
	Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, linux-arm-msm,
	Intel Graphics Development, amd-gfx list,
	Maling list - DRI developers, nouveau, freedreno

On Fri, Jan 10, 2020 at 4:22 AM Thomas Zimmermann <tzimmermann@suse.de> wrote:
>
> VBLANK callbacks in struct drm_driver are deprecated in favor of
> their equivalents in struct drm_crtc_funcs. Convert radeon over.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

> ---
>  drivers/gpu/drm/radeon/radeon_display.c | 12 ++++++++--
>  drivers/gpu/drm/radeon/radeon_drv.c     |  7 ------
>  drivers/gpu/drm/radeon/radeon_kms.c     | 29 ++++++++++++++-----------
>  3 files changed, 26 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
> index 7187158b9963..9116975b6eb9 100644
> --- a/drivers/gpu/drm/radeon/radeon_display.c
> +++ b/drivers/gpu/drm/radeon/radeon_display.c
> @@ -45,6 +45,10 @@
>  #include "atom.h"
>  #include "radeon.h"
>
> +u32 radeon_get_vblank_counter_kms(struct drm_crtc *crtc);
> +int radeon_enable_vblank_kms(struct drm_crtc *crtc);
> +void radeon_disable_vblank_kms(struct drm_crtc *crtc);
> +
>  static void avivo_crtc_load_lut(struct drm_crtc *crtc)
>  {
>         struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc);
> @@ -458,7 +462,7 @@ static void radeon_flip_work_func(struct work_struct *__work)
>                 (DRM_SCANOUTPOS_VALID | DRM_SCANOUTPOS_IN_VBLANK) &&
>                 (!ASIC_IS_AVIVO(rdev) ||
>                 ((int) (work->target_vblank -
> -               dev->driver->get_vblank_counter(dev, work->crtc_id)) > 0)))
> +               crtc->funcs->get_vblank_counter(crtc)) > 0)))
>                 usleep_range(1000, 2000);
>
>         /* We borrow the event spin lock for protecting flip_status */
> @@ -574,7 +578,7 @@ static int radeon_crtc_page_flip_target(struct drm_crtc *crtc,
>         }
>         work->base = base;
>         work->target_vblank = target - (uint32_t)drm_crtc_vblank_count(crtc) +
> -               dev->driver->get_vblank_counter(dev, work->crtc_id);
> +               crtc->funcs->get_vblank_counter(crtc);
>
>         /* We borrow the event spin lock for protecting flip_work */
>         spin_lock_irqsave(&crtc->dev->event_lock, flags);
> @@ -666,6 +670,10 @@ static const struct drm_crtc_funcs radeon_crtc_funcs = {
>         .set_config = radeon_crtc_set_config,
>         .destroy = radeon_crtc_destroy,
>         .page_flip_target = radeon_crtc_page_flip_target,
> +       .get_vblank_counter = radeon_get_vblank_counter_kms,
> +       .enable_vblank = radeon_enable_vblank_kms,
> +       .disable_vblank = radeon_disable_vblank_kms,
> +       .get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
>  };
>
>  static void radeon_crtc_init(struct drm_device *dev, int index)
> diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
> index 1f597f166bff..49ce2e7d5f9e 100644
> --- a/drivers/gpu/drm/radeon/radeon_drv.c
> +++ b/drivers/gpu/drm/radeon/radeon_drv.c
> @@ -119,9 +119,6 @@ void radeon_driver_postclose_kms(struct drm_device *dev,
>  int radeon_suspend_kms(struct drm_device *dev, bool suspend,
>                        bool fbcon, bool freeze);
>  int radeon_resume_kms(struct drm_device *dev, bool resume, bool fbcon);
> -u32 radeon_get_vblank_counter_kms(struct drm_device *dev, unsigned int pipe);
> -int radeon_enable_vblank_kms(struct drm_device *dev, unsigned int pipe);
> -void radeon_disable_vblank_kms(struct drm_device *dev, unsigned int pipe);
>  void radeon_driver_irq_preinstall_kms(struct drm_device *dev);
>  int radeon_driver_irq_postinstall_kms(struct drm_device *dev);
>  void radeon_driver_irq_uninstall_kms(struct drm_device *dev);
> @@ -571,10 +568,6 @@ static struct drm_driver kms_driver = {
>         .postclose = radeon_driver_postclose_kms,
>         .lastclose = radeon_driver_lastclose_kms,
>         .unload = radeon_driver_unload_kms,
> -       .get_vblank_counter = radeon_get_vblank_counter_kms,
> -       .enable_vblank = radeon_enable_vblank_kms,
> -       .disable_vblank = radeon_disable_vblank_kms,
> -       .get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
>         .irq_preinstall = radeon_driver_irq_preinstall_kms,
>         .irq_postinstall = radeon_driver_irq_postinstall_kms,
>         .irq_uninstall = radeon_driver_irq_uninstall_kms,
> diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c
> index d24f23a81656..cab891f86dc0 100644
> --- a/drivers/gpu/drm/radeon/radeon_kms.c
> +++ b/drivers/gpu/drm/radeon/radeon_kms.c
> @@ -739,14 +739,15 @@ void radeon_driver_postclose_kms(struct drm_device *dev,
>  /**
>   * radeon_get_vblank_counter_kms - get frame count
>   *
> - * @dev: drm dev pointer
> - * @pipe: crtc to get the frame count from
> + * @crtc: crtc to get the frame count from
>   *
>   * Gets the frame count on the requested crtc (all asics).
>   * Returns frame count on success, -EINVAL on failure.
>   */
> -u32 radeon_get_vblank_counter_kms(struct drm_device *dev, unsigned int pipe)
> +u32 radeon_get_vblank_counter_kms(struct drm_crtc *crtc)
>  {
> +       struct drm_device *dev = crtc->dev;
> +       unsigned int pipe = crtc->index;
>         int vpos, hpos, stat;
>         u32 count;
>         struct radeon_device *rdev = dev->dev_private;
> @@ -808,25 +809,26 @@ u32 radeon_get_vblank_counter_kms(struct drm_device *dev, unsigned int pipe)
>  /**
>   * radeon_enable_vblank_kms - enable vblank interrupt
>   *
> - * @dev: drm dev pointer
>   * @crtc: crtc to enable vblank interrupt for
>   *
>   * Enable the interrupt on the requested crtc (all asics).
>   * Returns 0 on success, -EINVAL on failure.
>   */
> -int radeon_enable_vblank_kms(struct drm_device *dev, int crtc)
> +int radeon_enable_vblank_kms(struct drm_crtc *crtc)
>  {
> +       struct drm_device *dev = crtc->dev;
> +       unsigned int pipe = crtc->index;
>         struct radeon_device *rdev = dev->dev_private;
>         unsigned long irqflags;
>         int r;
>
> -       if (crtc < 0 || crtc >= rdev->num_crtc) {
> -               DRM_ERROR("Invalid crtc %d\n", crtc);
> +       if (pipe < 0 || pipe >= rdev->num_crtc) {
> +               DRM_ERROR("Invalid crtc %d\n", pipe);
>                 return -EINVAL;
>         }
>
>         spin_lock_irqsave(&rdev->irq.lock, irqflags);
> -       rdev->irq.crtc_vblank_int[crtc] = true;
> +       rdev->irq.crtc_vblank_int[pipe] = true;
>         r = radeon_irq_set(rdev);
>         spin_unlock_irqrestore(&rdev->irq.lock, irqflags);
>         return r;
> @@ -835,23 +837,24 @@ int radeon_enable_vblank_kms(struct drm_device *dev, int crtc)
>  /**
>   * radeon_disable_vblank_kms - disable vblank interrupt
>   *
> - * @dev: drm dev pointer
>   * @crtc: crtc to disable vblank interrupt for
>   *
>   * Disable the interrupt on the requested crtc (all asics).
>   */
> -void radeon_disable_vblank_kms(struct drm_device *dev, int crtc)
> +void radeon_disable_vblank_kms(struct drm_crtc *crtc)
>  {
> +       struct drm_device *dev = crtc->dev;
> +       unsigned int pipe = crtc->index;
>         struct radeon_device *rdev = dev->dev_private;
>         unsigned long irqflags;
>
> -       if (crtc < 0 || crtc >= rdev->num_crtc) {
> -               DRM_ERROR("Invalid crtc %d\n", crtc);
> +       if (pipe < 0 || pipe >= rdev->num_crtc) {
> +               DRM_ERROR("Invalid crtc %d\n", pipe);
>                 return;
>         }
>
>         spin_lock_irqsave(&rdev->irq.lock, irqflags);
> -       rdev->irq.crtc_vblank_int[crtc] = false;
> +       rdev->irq.crtc_vblank_int[pipe] = false;
>         radeon_irq_set(rdev);
>         spin_unlock_irqrestore(&rdev->irq.lock, irqflags);
>  }
> --
> 2.24.1
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [PATCH 17/23] drm/radeon: Convert to CRTC VBLANK callbacks
@ 2020-01-13 19:02     ` Alex Deucher
  0 siblings, 0 replies; 217+ messages in thread
From: Alex Deucher @ 2020-01-13 19:02 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: hamohammed.sa, Dave Airlie, nouveau,
	Maling list - DRI developers, amd-gfx list, alexandre.torgue,
	Thomas Hellstrom, Sean Paul, VMware Graphics, Ben Skeggs,
	mcoquelin.stm32, Leo (Sunpeng) Li, linux-arm-msm,
	Intel Graphics Development, Rodrigo Vivi, Vincent Abriou,
	rodrigosiqueiramelo, philippe.cornu, yannick.fertre, Deucher,
	Alexander, freedreno, Christian Koenig

On Fri, Jan 10, 2020 at 4:22 AM Thomas Zimmermann <tzimmermann@suse.de> wrote:
>
> VBLANK callbacks in struct drm_driver are deprecated in favor of
> their equivalents in struct drm_crtc_funcs. Convert radeon over.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

> ---
>  drivers/gpu/drm/radeon/radeon_display.c | 12 ++++++++--
>  drivers/gpu/drm/radeon/radeon_drv.c     |  7 ------
>  drivers/gpu/drm/radeon/radeon_kms.c     | 29 ++++++++++++++-----------
>  3 files changed, 26 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
> index 7187158b9963..9116975b6eb9 100644
> --- a/drivers/gpu/drm/radeon/radeon_display.c
> +++ b/drivers/gpu/drm/radeon/radeon_display.c
> @@ -45,6 +45,10 @@
>  #include "atom.h"
>  #include "radeon.h"
>
> +u32 radeon_get_vblank_counter_kms(struct drm_crtc *crtc);
> +int radeon_enable_vblank_kms(struct drm_crtc *crtc);
> +void radeon_disable_vblank_kms(struct drm_crtc *crtc);
> +
>  static void avivo_crtc_load_lut(struct drm_crtc *crtc)
>  {
>         struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc);
> @@ -458,7 +462,7 @@ static void radeon_flip_work_func(struct work_struct *__work)
>                 (DRM_SCANOUTPOS_VALID | DRM_SCANOUTPOS_IN_VBLANK) &&
>                 (!ASIC_IS_AVIVO(rdev) ||
>                 ((int) (work->target_vblank -
> -               dev->driver->get_vblank_counter(dev, work->crtc_id)) > 0)))
> +               crtc->funcs->get_vblank_counter(crtc)) > 0)))
>                 usleep_range(1000, 2000);
>
>         /* We borrow the event spin lock for protecting flip_status */
> @@ -574,7 +578,7 @@ static int radeon_crtc_page_flip_target(struct drm_crtc *crtc,
>         }
>         work->base = base;
>         work->target_vblank = target - (uint32_t)drm_crtc_vblank_count(crtc) +
> -               dev->driver->get_vblank_counter(dev, work->crtc_id);
> +               crtc->funcs->get_vblank_counter(crtc);
>
>         /* We borrow the event spin lock for protecting flip_work */
>         spin_lock_irqsave(&crtc->dev->event_lock, flags);
> @@ -666,6 +670,10 @@ static const struct drm_crtc_funcs radeon_crtc_funcs = {
>         .set_config = radeon_crtc_set_config,
>         .destroy = radeon_crtc_destroy,
>         .page_flip_target = radeon_crtc_page_flip_target,
> +       .get_vblank_counter = radeon_get_vblank_counter_kms,
> +       .enable_vblank = radeon_enable_vblank_kms,
> +       .disable_vblank = radeon_disable_vblank_kms,
> +       .get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
>  };
>
>  static void radeon_crtc_init(struct drm_device *dev, int index)
> diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
> index 1f597f166bff..49ce2e7d5f9e 100644
> --- a/drivers/gpu/drm/radeon/radeon_drv.c
> +++ b/drivers/gpu/drm/radeon/radeon_drv.c
> @@ -119,9 +119,6 @@ void radeon_driver_postclose_kms(struct drm_device *dev,
>  int radeon_suspend_kms(struct drm_device *dev, bool suspend,
>                        bool fbcon, bool freeze);
>  int radeon_resume_kms(struct drm_device *dev, bool resume, bool fbcon);
> -u32 radeon_get_vblank_counter_kms(struct drm_device *dev, unsigned int pipe);
> -int radeon_enable_vblank_kms(struct drm_device *dev, unsigned int pipe);
> -void radeon_disable_vblank_kms(struct drm_device *dev, unsigned int pipe);
>  void radeon_driver_irq_preinstall_kms(struct drm_device *dev);
>  int radeon_driver_irq_postinstall_kms(struct drm_device *dev);
>  void radeon_driver_irq_uninstall_kms(struct drm_device *dev);
> @@ -571,10 +568,6 @@ static struct drm_driver kms_driver = {
>         .postclose = radeon_driver_postclose_kms,
>         .lastclose = radeon_driver_lastclose_kms,
>         .unload = radeon_driver_unload_kms,
> -       .get_vblank_counter = radeon_get_vblank_counter_kms,
> -       .enable_vblank = radeon_enable_vblank_kms,
> -       .disable_vblank = radeon_disable_vblank_kms,
> -       .get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
>         .irq_preinstall = radeon_driver_irq_preinstall_kms,
>         .irq_postinstall = radeon_driver_irq_postinstall_kms,
>         .irq_uninstall = radeon_driver_irq_uninstall_kms,
> diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c
> index d24f23a81656..cab891f86dc0 100644
> --- a/drivers/gpu/drm/radeon/radeon_kms.c
> +++ b/drivers/gpu/drm/radeon/radeon_kms.c
> @@ -739,14 +739,15 @@ void radeon_driver_postclose_kms(struct drm_device *dev,
>  /**
>   * radeon_get_vblank_counter_kms - get frame count
>   *
> - * @dev: drm dev pointer
> - * @pipe: crtc to get the frame count from
> + * @crtc: crtc to get the frame count from
>   *
>   * Gets the frame count on the requested crtc (all asics).
>   * Returns frame count on success, -EINVAL on failure.
>   */
> -u32 radeon_get_vblank_counter_kms(struct drm_device *dev, unsigned int pipe)
> +u32 radeon_get_vblank_counter_kms(struct drm_crtc *crtc)
>  {
> +       struct drm_device *dev = crtc->dev;
> +       unsigned int pipe = crtc->index;
>         int vpos, hpos, stat;
>         u32 count;
>         struct radeon_device *rdev = dev->dev_private;
> @@ -808,25 +809,26 @@ u32 radeon_get_vblank_counter_kms(struct drm_device *dev, unsigned int pipe)
>  /**
>   * radeon_enable_vblank_kms - enable vblank interrupt
>   *
> - * @dev: drm dev pointer
>   * @crtc: crtc to enable vblank interrupt for
>   *
>   * Enable the interrupt on the requested crtc (all asics).
>   * Returns 0 on success, -EINVAL on failure.
>   */
> -int radeon_enable_vblank_kms(struct drm_device *dev, int crtc)
> +int radeon_enable_vblank_kms(struct drm_crtc *crtc)
>  {
> +       struct drm_device *dev = crtc->dev;
> +       unsigned int pipe = crtc->index;
>         struct radeon_device *rdev = dev->dev_private;
>         unsigned long irqflags;
>         int r;
>
> -       if (crtc < 0 || crtc >= rdev->num_crtc) {
> -               DRM_ERROR("Invalid crtc %d\n", crtc);
> +       if (pipe < 0 || pipe >= rdev->num_crtc) {
> +               DRM_ERROR("Invalid crtc %d\n", pipe);
>                 return -EINVAL;
>         }
>
>         spin_lock_irqsave(&rdev->irq.lock, irqflags);
> -       rdev->irq.crtc_vblank_int[crtc] = true;
> +       rdev->irq.crtc_vblank_int[pipe] = true;
>         r = radeon_irq_set(rdev);
>         spin_unlock_irqrestore(&rdev->irq.lock, irqflags);
>         return r;
> @@ -835,23 +837,24 @@ int radeon_enable_vblank_kms(struct drm_device *dev, int crtc)
>  /**
>   * radeon_disable_vblank_kms - disable vblank interrupt
>   *
> - * @dev: drm dev pointer
>   * @crtc: crtc to disable vblank interrupt for
>   *
>   * Disable the interrupt on the requested crtc (all asics).
>   */
> -void radeon_disable_vblank_kms(struct drm_device *dev, int crtc)
> +void radeon_disable_vblank_kms(struct drm_crtc *crtc)
>  {
> +       struct drm_device *dev = crtc->dev;
> +       unsigned int pipe = crtc->index;
>         struct radeon_device *rdev = dev->dev_private;
>         unsigned long irqflags;
>
> -       if (crtc < 0 || crtc >= rdev->num_crtc) {
> -               DRM_ERROR("Invalid crtc %d\n", crtc);
> +       if (pipe < 0 || pipe >= rdev->num_crtc) {
> +               DRM_ERROR("Invalid crtc %d\n", pipe);
>                 return;
>         }
>
>         spin_lock_irqsave(&rdev->irq.lock, irqflags);
> -       rdev->irq.crtc_vblank_int[crtc] = false;
> +       rdev->irq.crtc_vblank_int[pipe] = false;
>         radeon_irq_set(rdev);
>         spin_unlock_irqrestore(&rdev->irq.lock, irqflags);
>  }
> --
> 2.24.1
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [PATCH 17/23] drm/radeon: Convert to CRTC VBLANK callbacks
@ 2020-01-13 19:02     ` Alex Deucher
  0 siblings, 0 replies; 217+ messages in thread
From: Alex Deucher @ 2020-01-13 19:02 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: hamohammed.sa, Dave Airlie, nouveau,
	Maling list - DRI developers, amd-gfx list, alexandre.torgue,
	Thomas Hellstrom, Sean Paul, VMware Graphics, Ben Skeggs,
	mcoquelin.stm32, Leo (Sunpeng) Li, linux-arm-msm,
	Intel Graphics Development, Rodrigo Vivi, Vincent Abriou,
	rodrigosiqueiramelo, philippe.cornu, yannick.fertre, Deucher,
	Alexander, freedreno, Christian Koenig

On Fri, Jan 10, 2020 at 4:22 AM Thomas Zimmermann <tzimmermann@suse.de> wrote:
>
> VBLANK callbacks in struct drm_driver are deprecated in favor of
> their equivalents in struct drm_crtc_funcs. Convert radeon over.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

> ---
>  drivers/gpu/drm/radeon/radeon_display.c | 12 ++++++++--
>  drivers/gpu/drm/radeon/radeon_drv.c     |  7 ------
>  drivers/gpu/drm/radeon/radeon_kms.c     | 29 ++++++++++++++-----------
>  3 files changed, 26 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
> index 7187158b9963..9116975b6eb9 100644
> --- a/drivers/gpu/drm/radeon/radeon_display.c
> +++ b/drivers/gpu/drm/radeon/radeon_display.c
> @@ -45,6 +45,10 @@
>  #include "atom.h"
>  #include "radeon.h"
>
> +u32 radeon_get_vblank_counter_kms(struct drm_crtc *crtc);
> +int radeon_enable_vblank_kms(struct drm_crtc *crtc);
> +void radeon_disable_vblank_kms(struct drm_crtc *crtc);
> +
>  static void avivo_crtc_load_lut(struct drm_crtc *crtc)
>  {
>         struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc);
> @@ -458,7 +462,7 @@ static void radeon_flip_work_func(struct work_struct *__work)
>                 (DRM_SCANOUTPOS_VALID | DRM_SCANOUTPOS_IN_VBLANK) &&
>                 (!ASIC_IS_AVIVO(rdev) ||
>                 ((int) (work->target_vblank -
> -               dev->driver->get_vblank_counter(dev, work->crtc_id)) > 0)))
> +               crtc->funcs->get_vblank_counter(crtc)) > 0)))
>                 usleep_range(1000, 2000);
>
>         /* We borrow the event spin lock for protecting flip_status */
> @@ -574,7 +578,7 @@ static int radeon_crtc_page_flip_target(struct drm_crtc *crtc,
>         }
>         work->base = base;
>         work->target_vblank = target - (uint32_t)drm_crtc_vblank_count(crtc) +
> -               dev->driver->get_vblank_counter(dev, work->crtc_id);
> +               crtc->funcs->get_vblank_counter(crtc);
>
>         /* We borrow the event spin lock for protecting flip_work */
>         spin_lock_irqsave(&crtc->dev->event_lock, flags);
> @@ -666,6 +670,10 @@ static const struct drm_crtc_funcs radeon_crtc_funcs = {
>         .set_config = radeon_crtc_set_config,
>         .destroy = radeon_crtc_destroy,
>         .page_flip_target = radeon_crtc_page_flip_target,
> +       .get_vblank_counter = radeon_get_vblank_counter_kms,
> +       .enable_vblank = radeon_enable_vblank_kms,
> +       .disable_vblank = radeon_disable_vblank_kms,
> +       .get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
>  };
>
>  static void radeon_crtc_init(struct drm_device *dev, int index)
> diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
> index 1f597f166bff..49ce2e7d5f9e 100644
> --- a/drivers/gpu/drm/radeon/radeon_drv.c
> +++ b/drivers/gpu/drm/radeon/radeon_drv.c
> @@ -119,9 +119,6 @@ void radeon_driver_postclose_kms(struct drm_device *dev,
>  int radeon_suspend_kms(struct drm_device *dev, bool suspend,
>                        bool fbcon, bool freeze);
>  int radeon_resume_kms(struct drm_device *dev, bool resume, bool fbcon);
> -u32 radeon_get_vblank_counter_kms(struct drm_device *dev, unsigned int pipe);
> -int radeon_enable_vblank_kms(struct drm_device *dev, unsigned int pipe);
> -void radeon_disable_vblank_kms(struct drm_device *dev, unsigned int pipe);
>  void radeon_driver_irq_preinstall_kms(struct drm_device *dev);
>  int radeon_driver_irq_postinstall_kms(struct drm_device *dev);
>  void radeon_driver_irq_uninstall_kms(struct drm_device *dev);
> @@ -571,10 +568,6 @@ static struct drm_driver kms_driver = {
>         .postclose = radeon_driver_postclose_kms,
>         .lastclose = radeon_driver_lastclose_kms,
>         .unload = radeon_driver_unload_kms,
> -       .get_vblank_counter = radeon_get_vblank_counter_kms,
> -       .enable_vblank = radeon_enable_vblank_kms,
> -       .disable_vblank = radeon_disable_vblank_kms,
> -       .get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
>         .irq_preinstall = radeon_driver_irq_preinstall_kms,
>         .irq_postinstall = radeon_driver_irq_postinstall_kms,
>         .irq_uninstall = radeon_driver_irq_uninstall_kms,
> diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c
> index d24f23a81656..cab891f86dc0 100644
> --- a/drivers/gpu/drm/radeon/radeon_kms.c
> +++ b/drivers/gpu/drm/radeon/radeon_kms.c
> @@ -739,14 +739,15 @@ void radeon_driver_postclose_kms(struct drm_device *dev,
>  /**
>   * radeon_get_vblank_counter_kms - get frame count
>   *
> - * @dev: drm dev pointer
> - * @pipe: crtc to get the frame count from
> + * @crtc: crtc to get the frame count from
>   *
>   * Gets the frame count on the requested crtc (all asics).
>   * Returns frame count on success, -EINVAL on failure.
>   */
> -u32 radeon_get_vblank_counter_kms(struct drm_device *dev, unsigned int pipe)
> +u32 radeon_get_vblank_counter_kms(struct drm_crtc *crtc)
>  {
> +       struct drm_device *dev = crtc->dev;
> +       unsigned int pipe = crtc->index;
>         int vpos, hpos, stat;
>         u32 count;
>         struct radeon_device *rdev = dev->dev_private;
> @@ -808,25 +809,26 @@ u32 radeon_get_vblank_counter_kms(struct drm_device *dev, unsigned int pipe)
>  /**
>   * radeon_enable_vblank_kms - enable vblank interrupt
>   *
> - * @dev: drm dev pointer
>   * @crtc: crtc to enable vblank interrupt for
>   *
>   * Enable the interrupt on the requested crtc (all asics).
>   * Returns 0 on success, -EINVAL on failure.
>   */
> -int radeon_enable_vblank_kms(struct drm_device *dev, int crtc)
> +int radeon_enable_vblank_kms(struct drm_crtc *crtc)
>  {
> +       struct drm_device *dev = crtc->dev;
> +       unsigned int pipe = crtc->index;
>         struct radeon_device *rdev = dev->dev_private;
>         unsigned long irqflags;
>         int r;
>
> -       if (crtc < 0 || crtc >= rdev->num_crtc) {
> -               DRM_ERROR("Invalid crtc %d\n", crtc);
> +       if (pipe < 0 || pipe >= rdev->num_crtc) {
> +               DRM_ERROR("Invalid crtc %d\n", pipe);
>                 return -EINVAL;
>         }
>
>         spin_lock_irqsave(&rdev->irq.lock, irqflags);
> -       rdev->irq.crtc_vblank_int[crtc] = true;
> +       rdev->irq.crtc_vblank_int[pipe] = true;
>         r = radeon_irq_set(rdev);
>         spin_unlock_irqrestore(&rdev->irq.lock, irqflags);
>         return r;
> @@ -835,23 +837,24 @@ int radeon_enable_vblank_kms(struct drm_device *dev, int crtc)
>  /**
>   * radeon_disable_vblank_kms - disable vblank interrupt
>   *
> - * @dev: drm dev pointer
>   * @crtc: crtc to disable vblank interrupt for
>   *
>   * Disable the interrupt on the requested crtc (all asics).
>   */
> -void radeon_disable_vblank_kms(struct drm_device *dev, int crtc)
> +void radeon_disable_vblank_kms(struct drm_crtc *crtc)
>  {
> +       struct drm_device *dev = crtc->dev;
> +       unsigned int pipe = crtc->index;
>         struct radeon_device *rdev = dev->dev_private;
>         unsigned long irqflags;
>
> -       if (crtc < 0 || crtc >= rdev->num_crtc) {
> -               DRM_ERROR("Invalid crtc %d\n", crtc);
> +       if (pipe < 0 || pipe >= rdev->num_crtc) {
> +               DRM_ERROR("Invalid crtc %d\n", pipe);
>                 return;
>         }
>
>         spin_lock_irqsave(&rdev->irq.lock, irqflags);
> -       rdev->irq.crtc_vblank_int[crtc] = false;
> +       rdev->irq.crtc_vblank_int[pipe] = false;
>         radeon_irq_set(rdev);
>         spin_unlock_irqrestore(&rdev->irq.lock, irqflags);
>  }
> --
> 2.24.1
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [Intel-gfx] [PATCH 17/23] drm/radeon: Convert to CRTC VBLANK callbacks
@ 2020-01-13 19:02     ` Alex Deucher
  0 siblings, 0 replies; 217+ messages in thread
From: Alex Deucher @ 2020-01-13 19:02 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: hamohammed.sa, Dave Airlie, nouveau,
	Maling list - DRI developers, Eric Anholt, amd-gfx list,
	Benjamin Gaignard, alexandre.torgue, Chunming Zhou,
	Thomas Hellstrom, VMware Graphics, Ben Skeggs, Wentland, Harry,
	mcoquelin.stm32, Leo (Sunpeng) Li, linux-arm-msm,
	Intel Graphics Development, Vincent Abriou, rodrigosiqueiramelo,
	philippe.cornu, yannick.fertre, Deucher, Alexander, freedreno,
	Christian Koenig

On Fri, Jan 10, 2020 at 4:22 AM Thomas Zimmermann <tzimmermann@suse.de> wrote:
>
> VBLANK callbacks in struct drm_driver are deprecated in favor of
> their equivalents in struct drm_crtc_funcs. Convert radeon over.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

> ---
>  drivers/gpu/drm/radeon/radeon_display.c | 12 ++++++++--
>  drivers/gpu/drm/radeon/radeon_drv.c     |  7 ------
>  drivers/gpu/drm/radeon/radeon_kms.c     | 29 ++++++++++++++-----------
>  3 files changed, 26 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
> index 7187158b9963..9116975b6eb9 100644
> --- a/drivers/gpu/drm/radeon/radeon_display.c
> +++ b/drivers/gpu/drm/radeon/radeon_display.c
> @@ -45,6 +45,10 @@
>  #include "atom.h"
>  #include "radeon.h"
>
> +u32 radeon_get_vblank_counter_kms(struct drm_crtc *crtc);
> +int radeon_enable_vblank_kms(struct drm_crtc *crtc);
> +void radeon_disable_vblank_kms(struct drm_crtc *crtc);
> +
>  static void avivo_crtc_load_lut(struct drm_crtc *crtc)
>  {
>         struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc);
> @@ -458,7 +462,7 @@ static void radeon_flip_work_func(struct work_struct *__work)
>                 (DRM_SCANOUTPOS_VALID | DRM_SCANOUTPOS_IN_VBLANK) &&
>                 (!ASIC_IS_AVIVO(rdev) ||
>                 ((int) (work->target_vblank -
> -               dev->driver->get_vblank_counter(dev, work->crtc_id)) > 0)))
> +               crtc->funcs->get_vblank_counter(crtc)) > 0)))
>                 usleep_range(1000, 2000);
>
>         /* We borrow the event spin lock for protecting flip_status */
> @@ -574,7 +578,7 @@ static int radeon_crtc_page_flip_target(struct drm_crtc *crtc,
>         }
>         work->base = base;
>         work->target_vblank = target - (uint32_t)drm_crtc_vblank_count(crtc) +
> -               dev->driver->get_vblank_counter(dev, work->crtc_id);
> +               crtc->funcs->get_vblank_counter(crtc);
>
>         /* We borrow the event spin lock for protecting flip_work */
>         spin_lock_irqsave(&crtc->dev->event_lock, flags);
> @@ -666,6 +670,10 @@ static const struct drm_crtc_funcs radeon_crtc_funcs = {
>         .set_config = radeon_crtc_set_config,
>         .destroy = radeon_crtc_destroy,
>         .page_flip_target = radeon_crtc_page_flip_target,
> +       .get_vblank_counter = radeon_get_vblank_counter_kms,
> +       .enable_vblank = radeon_enable_vblank_kms,
> +       .disable_vblank = radeon_disable_vblank_kms,
> +       .get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
>  };
>
>  static void radeon_crtc_init(struct drm_device *dev, int index)
> diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
> index 1f597f166bff..49ce2e7d5f9e 100644
> --- a/drivers/gpu/drm/radeon/radeon_drv.c
> +++ b/drivers/gpu/drm/radeon/radeon_drv.c
> @@ -119,9 +119,6 @@ void radeon_driver_postclose_kms(struct drm_device *dev,
>  int radeon_suspend_kms(struct drm_device *dev, bool suspend,
>                        bool fbcon, bool freeze);
>  int radeon_resume_kms(struct drm_device *dev, bool resume, bool fbcon);
> -u32 radeon_get_vblank_counter_kms(struct drm_device *dev, unsigned int pipe);
> -int radeon_enable_vblank_kms(struct drm_device *dev, unsigned int pipe);
> -void radeon_disable_vblank_kms(struct drm_device *dev, unsigned int pipe);
>  void radeon_driver_irq_preinstall_kms(struct drm_device *dev);
>  int radeon_driver_irq_postinstall_kms(struct drm_device *dev);
>  void radeon_driver_irq_uninstall_kms(struct drm_device *dev);
> @@ -571,10 +568,6 @@ static struct drm_driver kms_driver = {
>         .postclose = radeon_driver_postclose_kms,
>         .lastclose = radeon_driver_lastclose_kms,
>         .unload = radeon_driver_unload_kms,
> -       .get_vblank_counter = radeon_get_vblank_counter_kms,
> -       .enable_vblank = radeon_enable_vblank_kms,
> -       .disable_vblank = radeon_disable_vblank_kms,
> -       .get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
>         .irq_preinstall = radeon_driver_irq_preinstall_kms,
>         .irq_postinstall = radeon_driver_irq_postinstall_kms,
>         .irq_uninstall = radeon_driver_irq_uninstall_kms,
> diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c
> index d24f23a81656..cab891f86dc0 100644
> --- a/drivers/gpu/drm/radeon/radeon_kms.c
> +++ b/drivers/gpu/drm/radeon/radeon_kms.c
> @@ -739,14 +739,15 @@ void radeon_driver_postclose_kms(struct drm_device *dev,
>  /**
>   * radeon_get_vblank_counter_kms - get frame count
>   *
> - * @dev: drm dev pointer
> - * @pipe: crtc to get the frame count from
> + * @crtc: crtc to get the frame count from
>   *
>   * Gets the frame count on the requested crtc (all asics).
>   * Returns frame count on success, -EINVAL on failure.
>   */
> -u32 radeon_get_vblank_counter_kms(struct drm_device *dev, unsigned int pipe)
> +u32 radeon_get_vblank_counter_kms(struct drm_crtc *crtc)
>  {
> +       struct drm_device *dev = crtc->dev;
> +       unsigned int pipe = crtc->index;
>         int vpos, hpos, stat;
>         u32 count;
>         struct radeon_device *rdev = dev->dev_private;
> @@ -808,25 +809,26 @@ u32 radeon_get_vblank_counter_kms(struct drm_device *dev, unsigned int pipe)
>  /**
>   * radeon_enable_vblank_kms - enable vblank interrupt
>   *
> - * @dev: drm dev pointer
>   * @crtc: crtc to enable vblank interrupt for
>   *
>   * Enable the interrupt on the requested crtc (all asics).
>   * Returns 0 on success, -EINVAL on failure.
>   */
> -int radeon_enable_vblank_kms(struct drm_device *dev, int crtc)
> +int radeon_enable_vblank_kms(struct drm_crtc *crtc)
>  {
> +       struct drm_device *dev = crtc->dev;
> +       unsigned int pipe = crtc->index;
>         struct radeon_device *rdev = dev->dev_private;
>         unsigned long irqflags;
>         int r;
>
> -       if (crtc < 0 || crtc >= rdev->num_crtc) {
> -               DRM_ERROR("Invalid crtc %d\n", crtc);
> +       if (pipe < 0 || pipe >= rdev->num_crtc) {
> +               DRM_ERROR("Invalid crtc %d\n", pipe);
>                 return -EINVAL;
>         }
>
>         spin_lock_irqsave(&rdev->irq.lock, irqflags);
> -       rdev->irq.crtc_vblank_int[crtc] = true;
> +       rdev->irq.crtc_vblank_int[pipe] = true;
>         r = radeon_irq_set(rdev);
>         spin_unlock_irqrestore(&rdev->irq.lock, irqflags);
>         return r;
> @@ -835,23 +837,24 @@ int radeon_enable_vblank_kms(struct drm_device *dev, int crtc)
>  /**
>   * radeon_disable_vblank_kms - disable vblank interrupt
>   *
> - * @dev: drm dev pointer
>   * @crtc: crtc to disable vblank interrupt for
>   *
>   * Disable the interrupt on the requested crtc (all asics).
>   */
> -void radeon_disable_vblank_kms(struct drm_device *dev, int crtc)
> +void radeon_disable_vblank_kms(struct drm_crtc *crtc)
>  {
> +       struct drm_device *dev = crtc->dev;
> +       unsigned int pipe = crtc->index;
>         struct radeon_device *rdev = dev->dev_private;
>         unsigned long irqflags;
>
> -       if (crtc < 0 || crtc >= rdev->num_crtc) {
> -               DRM_ERROR("Invalid crtc %d\n", crtc);
> +       if (pipe < 0 || pipe >= rdev->num_crtc) {
> +               DRM_ERROR("Invalid crtc %d\n", pipe);
>                 return;
>         }
>
>         spin_lock_irqsave(&rdev->irq.lock, irqflags);
> -       rdev->irq.crtc_vblank_int[crtc] = false;
> +       rdev->irq.crtc_vblank_int[pipe] = false;
>         radeon_irq_set(rdev);
>         spin_unlock_irqrestore(&rdev->irq.lock, irqflags);
>  }
> --
> 2.24.1
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [PATCH 17/23] drm/radeon: Convert to CRTC VBLANK callbacks
@ 2020-01-13 19:02     ` Alex Deucher
  0 siblings, 0 replies; 217+ messages in thread
From: Alex Deucher @ 2020-01-13 19:02 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: hamohammed.sa, Dave Airlie, nouveau, Joonas Lahtinen,
	Maling list - DRI developers, Eric Anholt, amd-gfx list,
	Benjamin Gaignard, alexandre.torgue, Chunming Zhou,
	Thomas Hellstrom, Sean Paul, Patrik Jakobsson, VMware Graphics,
	Ben Skeggs, Wentland, Harry, mcoquelin.stm32, Leo (Sunpeng) Li,
	linux-arm-msm, Intel Graphics Development, Maarten Lankhorst,
	Jani Nikula, Rodrigo Vivi, Vincent Abriou, rodrigosiqueiramelo,
	philippe.cornu, yannick.fertre, Rob Clark, Daniel Vetter,
	Deucher, Alexander, freedreno, Christian Koenig

On Fri, Jan 10, 2020 at 4:22 AM Thomas Zimmermann <tzimmermann@suse.de> wrote:
>
> VBLANK callbacks in struct drm_driver are deprecated in favor of
> their equivalents in struct drm_crtc_funcs. Convert radeon over.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

> ---
>  drivers/gpu/drm/radeon/radeon_display.c | 12 ++++++++--
>  drivers/gpu/drm/radeon/radeon_drv.c     |  7 ------
>  drivers/gpu/drm/radeon/radeon_kms.c     | 29 ++++++++++++++-----------
>  3 files changed, 26 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
> index 7187158b9963..9116975b6eb9 100644
> --- a/drivers/gpu/drm/radeon/radeon_display.c
> +++ b/drivers/gpu/drm/radeon/radeon_display.c
> @@ -45,6 +45,10 @@
>  #include "atom.h"
>  #include "radeon.h"
>
> +u32 radeon_get_vblank_counter_kms(struct drm_crtc *crtc);
> +int radeon_enable_vblank_kms(struct drm_crtc *crtc);
> +void radeon_disable_vblank_kms(struct drm_crtc *crtc);
> +
>  static void avivo_crtc_load_lut(struct drm_crtc *crtc)
>  {
>         struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc);
> @@ -458,7 +462,7 @@ static void radeon_flip_work_func(struct work_struct *__work)
>                 (DRM_SCANOUTPOS_VALID | DRM_SCANOUTPOS_IN_VBLANK) &&
>                 (!ASIC_IS_AVIVO(rdev) ||
>                 ((int) (work->target_vblank -
> -               dev->driver->get_vblank_counter(dev, work->crtc_id)) > 0)))
> +               crtc->funcs->get_vblank_counter(crtc)) > 0)))
>                 usleep_range(1000, 2000);
>
>         /* We borrow the event spin lock for protecting flip_status */
> @@ -574,7 +578,7 @@ static int radeon_crtc_page_flip_target(struct drm_crtc *crtc,
>         }
>         work->base = base;
>         work->target_vblank = target - (uint32_t)drm_crtc_vblank_count(crtc) +
> -               dev->driver->get_vblank_counter(dev, work->crtc_id);
> +               crtc->funcs->get_vblank_counter(crtc);
>
>         /* We borrow the event spin lock for protecting flip_work */
>         spin_lock_irqsave(&crtc->dev->event_lock, flags);
> @@ -666,6 +670,10 @@ static const struct drm_crtc_funcs radeon_crtc_funcs = {
>         .set_config = radeon_crtc_set_config,
>         .destroy = radeon_crtc_destroy,
>         .page_flip_target = radeon_crtc_page_flip_target,
> +       .get_vblank_counter = radeon_get_vblank_counter_kms,
> +       .enable_vblank = radeon_enable_vblank_kms,
> +       .disable_vblank = radeon_disable_vblank_kms,
> +       .get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
>  };
>
>  static void radeon_crtc_init(struct drm_device *dev, int index)
> diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
> index 1f597f166bff..49ce2e7d5f9e 100644
> --- a/drivers/gpu/drm/radeon/radeon_drv.c
> +++ b/drivers/gpu/drm/radeon/radeon_drv.c
> @@ -119,9 +119,6 @@ void radeon_driver_postclose_kms(struct drm_device *dev,
>  int radeon_suspend_kms(struct drm_device *dev, bool suspend,
>                        bool fbcon, bool freeze);
>  int radeon_resume_kms(struct drm_device *dev, bool resume, bool fbcon);
> -u32 radeon_get_vblank_counter_kms(struct drm_device *dev, unsigned int pipe);
> -int radeon_enable_vblank_kms(struct drm_device *dev, unsigned int pipe);
> -void radeon_disable_vblank_kms(struct drm_device *dev, unsigned int pipe);
>  void radeon_driver_irq_preinstall_kms(struct drm_device *dev);
>  int radeon_driver_irq_postinstall_kms(struct drm_device *dev);
>  void radeon_driver_irq_uninstall_kms(struct drm_device *dev);
> @@ -571,10 +568,6 @@ static struct drm_driver kms_driver = {
>         .postclose = radeon_driver_postclose_kms,
>         .lastclose = radeon_driver_lastclose_kms,
>         .unload = radeon_driver_unload_kms,
> -       .get_vblank_counter = radeon_get_vblank_counter_kms,
> -       .enable_vblank = radeon_enable_vblank_kms,
> -       .disable_vblank = radeon_disable_vblank_kms,
> -       .get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
>         .irq_preinstall = radeon_driver_irq_preinstall_kms,
>         .irq_postinstall = radeon_driver_irq_postinstall_kms,
>         .irq_uninstall = radeon_driver_irq_uninstall_kms,
> diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c
> index d24f23a81656..cab891f86dc0 100644
> --- a/drivers/gpu/drm/radeon/radeon_kms.c
> +++ b/drivers/gpu/drm/radeon/radeon_kms.c
> @@ -739,14 +739,15 @@ void radeon_driver_postclose_kms(struct drm_device *dev,
>  /**
>   * radeon_get_vblank_counter_kms - get frame count
>   *
> - * @dev: drm dev pointer
> - * @pipe: crtc to get the frame count from
> + * @crtc: crtc to get the frame count from
>   *
>   * Gets the frame count on the requested crtc (all asics).
>   * Returns frame count on success, -EINVAL on failure.
>   */
> -u32 radeon_get_vblank_counter_kms(struct drm_device *dev, unsigned int pipe)
> +u32 radeon_get_vblank_counter_kms(struct drm_crtc *crtc)
>  {
> +       struct drm_device *dev = crtc->dev;
> +       unsigned int pipe = crtc->index;
>         int vpos, hpos, stat;
>         u32 count;
>         struct radeon_device *rdev = dev->dev_private;
> @@ -808,25 +809,26 @@ u32 radeon_get_vblank_counter_kms(struct drm_device *dev, unsigned int pipe)
>  /**
>   * radeon_enable_vblank_kms - enable vblank interrupt
>   *
> - * @dev: drm dev pointer
>   * @crtc: crtc to enable vblank interrupt for
>   *
>   * Enable the interrupt on the requested crtc (all asics).
>   * Returns 0 on success, -EINVAL on failure.
>   */
> -int radeon_enable_vblank_kms(struct drm_device *dev, int crtc)
> +int radeon_enable_vblank_kms(struct drm_crtc *crtc)
>  {
> +       struct drm_device *dev = crtc->dev;
> +       unsigned int pipe = crtc->index;
>         struct radeon_device *rdev = dev->dev_private;
>         unsigned long irqflags;
>         int r;
>
> -       if (crtc < 0 || crtc >= rdev->num_crtc) {
> -               DRM_ERROR("Invalid crtc %d\n", crtc);
> +       if (pipe < 0 || pipe >= rdev->num_crtc) {
> +               DRM_ERROR("Invalid crtc %d\n", pipe);
>                 return -EINVAL;
>         }
>
>         spin_lock_irqsave(&rdev->irq.lock, irqflags);
> -       rdev->irq.crtc_vblank_int[crtc] = true;
> +       rdev->irq.crtc_vblank_int[pipe] = true;
>         r = radeon_irq_set(rdev);
>         spin_unlock_irqrestore(&rdev->irq.lock, irqflags);
>         return r;
> @@ -835,23 +837,24 @@ int radeon_enable_vblank_kms(struct drm_device *dev, int crtc)
>  /**
>   * radeon_disable_vblank_kms - disable vblank interrupt
>   *
> - * @dev: drm dev pointer
>   * @crtc: crtc to disable vblank interrupt for
>   *
>   * Disable the interrupt on the requested crtc (all asics).
>   */
> -void radeon_disable_vblank_kms(struct drm_device *dev, int crtc)
> +void radeon_disable_vblank_kms(struct drm_crtc *crtc)
>  {
> +       struct drm_device *dev = crtc->dev;
> +       unsigned int pipe = crtc->index;
>         struct radeon_device *rdev = dev->dev_private;
>         unsigned long irqflags;
>
> -       if (crtc < 0 || crtc >= rdev->num_crtc) {
> -               DRM_ERROR("Invalid crtc %d\n", crtc);
> +       if (pipe < 0 || pipe >= rdev->num_crtc) {
> +               DRM_ERROR("Invalid crtc %d\n", pipe);
>                 return;
>         }
>
>         spin_lock_irqsave(&rdev->irq.lock, irqflags);
> -       rdev->irq.crtc_vblank_int[crtc] = false;
> +       rdev->irq.crtc_vblank_int[pipe] = false;
>         radeon_irq_set(rdev);
>         spin_unlock_irqrestore(&rdev->irq.lock, irqflags);
>  }
> --
> 2.24.1
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [PATCH 02/23] drm/amdgpu: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
  2020-01-13 18:52     ` Alex Deucher
                         ` (2 preceding siblings ...)
  (?)
@ 2020-01-14  7:46       ` Thomas Zimmermann
  -1 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-14  7:46 UTC (permalink / raw)
  To: Alex Deucher
  Cc: Dave Airlie, Daniel Vetter, Deucher, Alexander, Christian Koenig,
	Chunming Zhou, Maarten Lankhorst, Patrik Jakobsson, Rob Clark,
	Sean Paul, Benjamin Gaignard, Vincent Abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, Eric Anholt,
	rodrigosiqueiramelo, hamohammed.sa, VMware Graphics,
	Thomas Hellstrom, Ben Skeggs, Wentland, Harry, Leo (Sunpeng) Li,
	Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, linux-arm-msm,
	Intel Graphics Development, amd-gfx list,
	Maling list - DRI developers, nouveau, freedreno


[-- Attachment #1.1: Type: text/plain, Size: 9038 bytes --]

Hi

Am 13.01.20 um 19:52 schrieb Alex Deucher:
> On Fri, Jan 10, 2020 at 4:21 AM Thomas Zimmermann <tzimmermann@suse.de> wrote:
>>
>> The callback struct drm_driver.get_scanout_position() is deprecated in
>> favor of struct drm_crtc_helper_funcs.get_scanout_position(). Convert
>> amdgpu over.
>>
> 
> I would prefer to just change the signature of
> amdgpu_display_get_crtc_scanoutpos() to match the new API rather than
> wrapping it again.

Will be fixed in v2. I wrapped these functions in amdgpu and radeon to
avoid changes to other, unreleted callers.

Best regards
Thomas

> 
> Alex
> 
>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>> ---
>>  drivers/gpu/drm/amd/amdgpu/amdgpu_display.c       | 12 ++++++++++++
>>  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c           | 11 -----------
>>  drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h          |  5 +++++
>>  drivers/gpu/drm/amd/amdgpu/dce_v10_0.c            |  1 +
>>  drivers/gpu/drm/amd/amdgpu/dce_v11_0.c            |  1 +
>>  drivers/gpu/drm/amd/amdgpu/dce_v6_0.c             |  1 +
>>  drivers/gpu/drm/amd/amdgpu/dce_v8_0.c             |  1 +
>>  drivers/gpu/drm/amd/amdgpu/dce_virtual.c          |  1 +
>>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  3 ++-
>>  9 files changed, 24 insertions(+), 12 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
>> index 4e699071d144..a1e769d4417d 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
>> @@ -914,3 +914,15 @@ int amdgpu_display_crtc_idx_to_irq_type(struct amdgpu_device *adev, int crtc)
>>                 return AMDGPU_CRTC_IRQ_NONE;
>>         }
>>  }
>> +
>> +bool amdgpu_crtc_get_scanout_position(struct drm_crtc *crtc,
>> +                       bool in_vblank_irq, int *vpos,
>> +                       int *hpos, ktime_t *stime, ktime_t *etime,
>> +                       const struct drm_display_mode *mode)
>> +{
>> +       struct drm_device *dev = crtc->dev;
>> +       unsigned int pipe = crtc->index;
>> +
>> +       return amdgpu_display_get_crtc_scanoutpos(dev, pipe, 0, vpos, hpos,
>> +                                                 stime, etime, mode);
>> +}
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
>> index 3f6f14ce1511..0749285dd1c7 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
>> @@ -1367,16 +1367,6 @@ int amdgpu_file_to_fpriv(struct file *filp, struct amdgpu_fpriv **fpriv)
>>         return 0;
>>  }
>>
>> -static bool
>> -amdgpu_get_crtc_scanout_position(struct drm_device *dev, unsigned int pipe,
>> -                                bool in_vblank_irq, int *vpos, int *hpos,
>> -                                ktime_t *stime, ktime_t *etime,
>> -                                const struct drm_display_mode *mode)
>> -{
>> -       return amdgpu_display_get_crtc_scanoutpos(dev, pipe, 0, vpos, hpos,
>> -                                                 stime, etime, mode);
>> -}
>> -
>>  static struct drm_driver kms_driver = {
>>         .driver_features =
>>             DRIVER_USE_AGP | DRIVER_ATOMIC |
>> @@ -1391,7 +1381,6 @@ static struct drm_driver kms_driver = {
>>         .enable_vblank = amdgpu_enable_vblank_kms,
>>         .disable_vblank = amdgpu_disable_vblank_kms,
>>         .get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
>> -       .get_scanout_position = amdgpu_get_crtc_scanout_position,
>>         .irq_handler = amdgpu_irq_handler,
>>         .ioctls = amdgpu_ioctls_kms,
>>         .gem_free_object_unlocked = amdgpu_gem_object_free,
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
>> index eb9975f4decb..37ba07e2feb5 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
>> @@ -612,6 +612,11 @@ void amdgpu_panel_mode_fixup(struct drm_encoder *encoder,
>>                              struct drm_display_mode *adjusted_mode);
>>  int amdgpu_display_crtc_idx_to_irq_type(struct amdgpu_device *adev, int crtc);
>>
>> +bool amdgpu_crtc_get_scanout_position(struct drm_crtc *crtc,
>> +                       bool in_vblank_irq, int *vpos,
>> +                       int *hpos, ktime_t *stime, ktime_t *etime,
>> +                       const struct drm_display_mode *mode);
>> +
>>  /* fbdev layer */
>>  int amdgpu_fbdev_init(struct amdgpu_device *adev);
>>  void amdgpu_fbdev_fini(struct amdgpu_device *adev);
>> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
>> index 40d2ac723dd6..bdc1e0f036d4 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
>> @@ -2685,6 +2685,7 @@ static const struct drm_crtc_helper_funcs dce_v10_0_crtc_helper_funcs = {
>>         .prepare = dce_v10_0_crtc_prepare,
>>         .commit = dce_v10_0_crtc_commit,
>>         .disable = dce_v10_0_crtc_disable,
>> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>>  };
>>
>>  static int dce_v10_0_crtc_init(struct amdgpu_device *adev, int index)
>> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
>> index 898ef72d423c..0319da5f7bf9 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
>> @@ -2793,6 +2793,7 @@ static const struct drm_crtc_helper_funcs dce_v11_0_crtc_helper_funcs = {
>>         .prepare = dce_v11_0_crtc_prepare,
>>         .commit = dce_v11_0_crtc_commit,
>>         .disable = dce_v11_0_crtc_disable,
>> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>>  };
>>
>>  static int dce_v11_0_crtc_init(struct amdgpu_device *adev, int index)
>> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
>> index db15a112becc..78642c3b14fc 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
>> @@ -2575,6 +2575,7 @@ static const struct drm_crtc_helper_funcs dce_v6_0_crtc_helper_funcs = {
>>         .prepare = dce_v6_0_crtc_prepare,
>>         .commit = dce_v6_0_crtc_commit,
>>         .disable = dce_v6_0_crtc_disable,
>> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>>  };
>>
>>  static int dce_v6_0_crtc_init(struct amdgpu_device *adev, int index)
>> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
>> index f06c9022c1fd..1e8d4975435a 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
>> @@ -2593,6 +2593,7 @@ static const struct drm_crtc_helper_funcs dce_v8_0_crtc_helper_funcs = {
>>         .prepare = dce_v8_0_crtc_prepare,
>>         .commit = dce_v8_0_crtc_commit,
>>         .disable = dce_v8_0_crtc_disable,
>> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>>  };
>>
>>  static int dce_v8_0_crtc_init(struct amdgpu_device *adev, int index)
>> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
>> index e4f94863332c..4b2f915aba47 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
>> @@ -218,6 +218,7 @@ static const struct drm_crtc_helper_funcs dce_virtual_crtc_helper_funcs = {
>>         .prepare = dce_virtual_crtc_prepare,
>>         .commit = dce_virtual_crtc_commit,
>>         .disable = dce_virtual_crtc_disable,
>> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>>  };
>>
>>  static int dce_virtual_crtc_init(struct amdgpu_device *adev, int index)
>> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> index f2db400a3920..39c5cf242c1b 100644
>> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> @@ -4821,7 +4821,8 @@ static bool dm_crtc_helper_mode_fixup(struct drm_crtc *crtc,
>>  static const struct drm_crtc_helper_funcs amdgpu_dm_crtc_helper_funcs = {
>>         .disable = dm_crtc_helper_disable,
>>         .atomic_check = dm_crtc_helper_atomic_check,
>> -       .mode_fixup = dm_crtc_helper_mode_fixup
>> +       .mode_fixup = dm_crtc_helper_mode_fixup,
>> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>>  };
>>
>>  static void dm_encoder_helper_disable(struct drm_encoder *encoder)
>> --
>> 2.24.1
>>
>> _______________________________________________
>> amd-gfx mailing list
>> amd-gfx@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/amd-gfx

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [PATCH 02/23] drm/amdgpu: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
@ 2020-01-14  7:46       ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-14  7:46 UTC (permalink / raw)
  To: Alex Deucher
  Cc: Dave Airlie, Daniel Vetter, Deucher, Alexander, Christian Koenig,
	Chunming Zhou, Maarten Lankhorst, Patrik Jakobsson, Rob Clark,
	Sean Paul, Benjamin Gaignard, Vincent Abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, Eric Anholt,
	rodrigosiqueiramelo, hamohammed.sa, VMware Graphics,
	Thomas Hellstrom, Ben Skeggs, Wentla


[-- Attachment #1.1: Type: text/plain, Size: 9038 bytes --]

Hi

Am 13.01.20 um 19:52 schrieb Alex Deucher:
> On Fri, Jan 10, 2020 at 4:21 AM Thomas Zimmermann <tzimmermann@suse.de> wrote:
>>
>> The callback struct drm_driver.get_scanout_position() is deprecated in
>> favor of struct drm_crtc_helper_funcs.get_scanout_position(). Convert
>> amdgpu over.
>>
> 
> I would prefer to just change the signature of
> amdgpu_display_get_crtc_scanoutpos() to match the new API rather than
> wrapping it again.

Will be fixed in v2. I wrapped these functions in amdgpu and radeon to
avoid changes to other, unreleted callers.

Best regards
Thomas

> 
> Alex
> 
>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>> ---
>>  drivers/gpu/drm/amd/amdgpu/amdgpu_display.c       | 12 ++++++++++++
>>  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c           | 11 -----------
>>  drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h          |  5 +++++
>>  drivers/gpu/drm/amd/amdgpu/dce_v10_0.c            |  1 +
>>  drivers/gpu/drm/amd/amdgpu/dce_v11_0.c            |  1 +
>>  drivers/gpu/drm/amd/amdgpu/dce_v6_0.c             |  1 +
>>  drivers/gpu/drm/amd/amdgpu/dce_v8_0.c             |  1 +
>>  drivers/gpu/drm/amd/amdgpu/dce_virtual.c          |  1 +
>>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  3 ++-
>>  9 files changed, 24 insertions(+), 12 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
>> index 4e699071d144..a1e769d4417d 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
>> @@ -914,3 +914,15 @@ int amdgpu_display_crtc_idx_to_irq_type(struct amdgpu_device *adev, int crtc)
>>                 return AMDGPU_CRTC_IRQ_NONE;
>>         }
>>  }
>> +
>> +bool amdgpu_crtc_get_scanout_position(struct drm_crtc *crtc,
>> +                       bool in_vblank_irq, int *vpos,
>> +                       int *hpos, ktime_t *stime, ktime_t *etime,
>> +                       const struct drm_display_mode *mode)
>> +{
>> +       struct drm_device *dev = crtc->dev;
>> +       unsigned int pipe = crtc->index;
>> +
>> +       return amdgpu_display_get_crtc_scanoutpos(dev, pipe, 0, vpos, hpos,
>> +                                                 stime, etime, mode);
>> +}
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
>> index 3f6f14ce1511..0749285dd1c7 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
>> @@ -1367,16 +1367,6 @@ int amdgpu_file_to_fpriv(struct file *filp, struct amdgpu_fpriv **fpriv)
>>         return 0;
>>  }
>>
>> -static bool
>> -amdgpu_get_crtc_scanout_position(struct drm_device *dev, unsigned int pipe,
>> -                                bool in_vblank_irq, int *vpos, int *hpos,
>> -                                ktime_t *stime, ktime_t *etime,
>> -                                const struct drm_display_mode *mode)
>> -{
>> -       return amdgpu_display_get_crtc_scanoutpos(dev, pipe, 0, vpos, hpos,
>> -                                                 stime, etime, mode);
>> -}
>> -
>>  static struct drm_driver kms_driver = {
>>         .driver_features =
>>             DRIVER_USE_AGP | DRIVER_ATOMIC |
>> @@ -1391,7 +1381,6 @@ static struct drm_driver kms_driver = {
>>         .enable_vblank = amdgpu_enable_vblank_kms,
>>         .disable_vblank = amdgpu_disable_vblank_kms,
>>         .get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
>> -       .get_scanout_position = amdgpu_get_crtc_scanout_position,
>>         .irq_handler = amdgpu_irq_handler,
>>         .ioctls = amdgpu_ioctls_kms,
>>         .gem_free_object_unlocked = amdgpu_gem_object_free,
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
>> index eb9975f4decb..37ba07e2feb5 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
>> @@ -612,6 +612,11 @@ void amdgpu_panel_mode_fixup(struct drm_encoder *encoder,
>>                              struct drm_display_mode *adjusted_mode);
>>  int amdgpu_display_crtc_idx_to_irq_type(struct amdgpu_device *adev, int crtc);
>>
>> +bool amdgpu_crtc_get_scanout_position(struct drm_crtc *crtc,
>> +                       bool in_vblank_irq, int *vpos,
>> +                       int *hpos, ktime_t *stime, ktime_t *etime,
>> +                       const struct drm_display_mode *mode);
>> +
>>  /* fbdev layer */
>>  int amdgpu_fbdev_init(struct amdgpu_device *adev);
>>  void amdgpu_fbdev_fini(struct amdgpu_device *adev);
>> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
>> index 40d2ac723dd6..bdc1e0f036d4 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
>> @@ -2685,6 +2685,7 @@ static const struct drm_crtc_helper_funcs dce_v10_0_crtc_helper_funcs = {
>>         .prepare = dce_v10_0_crtc_prepare,
>>         .commit = dce_v10_0_crtc_commit,
>>         .disable = dce_v10_0_crtc_disable,
>> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>>  };
>>
>>  static int dce_v10_0_crtc_init(struct amdgpu_device *adev, int index)
>> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
>> index 898ef72d423c..0319da5f7bf9 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
>> @@ -2793,6 +2793,7 @@ static const struct drm_crtc_helper_funcs dce_v11_0_crtc_helper_funcs = {
>>         .prepare = dce_v11_0_crtc_prepare,
>>         .commit = dce_v11_0_crtc_commit,
>>         .disable = dce_v11_0_crtc_disable,
>> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>>  };
>>
>>  static int dce_v11_0_crtc_init(struct amdgpu_device *adev, int index)
>> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
>> index db15a112becc..78642c3b14fc 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
>> @@ -2575,6 +2575,7 @@ static const struct drm_crtc_helper_funcs dce_v6_0_crtc_helper_funcs = {
>>         .prepare = dce_v6_0_crtc_prepare,
>>         .commit = dce_v6_0_crtc_commit,
>>         .disable = dce_v6_0_crtc_disable,
>> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>>  };
>>
>>  static int dce_v6_0_crtc_init(struct amdgpu_device *adev, int index)
>> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
>> index f06c9022c1fd..1e8d4975435a 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
>> @@ -2593,6 +2593,7 @@ static const struct drm_crtc_helper_funcs dce_v8_0_crtc_helper_funcs = {
>>         .prepare = dce_v8_0_crtc_prepare,
>>         .commit = dce_v8_0_crtc_commit,
>>         .disable = dce_v8_0_crtc_disable,
>> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>>  };
>>
>>  static int dce_v8_0_crtc_init(struct amdgpu_device *adev, int index)
>> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
>> index e4f94863332c..4b2f915aba47 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
>> @@ -218,6 +218,7 @@ static const struct drm_crtc_helper_funcs dce_virtual_crtc_helper_funcs = {
>>         .prepare = dce_virtual_crtc_prepare,
>>         .commit = dce_virtual_crtc_commit,
>>         .disable = dce_virtual_crtc_disable,
>> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>>  };
>>
>>  static int dce_virtual_crtc_init(struct amdgpu_device *adev, int index)
>> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> index f2db400a3920..39c5cf242c1b 100644
>> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> @@ -4821,7 +4821,8 @@ static bool dm_crtc_helper_mode_fixup(struct drm_crtc *crtc,
>>  static const struct drm_crtc_helper_funcs amdgpu_dm_crtc_helper_funcs = {
>>         .disable = dm_crtc_helper_disable,
>>         .atomic_check = dm_crtc_helper_atomic_check,
>> -       .mode_fixup = dm_crtc_helper_mode_fixup
>> +       .mode_fixup = dm_crtc_helper_mode_fixup,
>> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>>  };
>>
>>  static void dm_encoder_helper_disable(struct drm_encoder *encoder)
>> --
>> 2.24.1
>>
>> _______________________________________________
>> amd-gfx mailing list
>> amd-gfx@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/amd-gfx

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [PATCH 02/23] drm/amdgpu: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
@ 2020-01-14  7:46       ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-14  7:46 UTC (permalink / raw)
  To: Alex Deucher
  Cc: hamohammed.sa, Dave Airlie, nouveau,
	Maling list - DRI developers, amd-gfx list, alexandre.torgue,
	Thomas Hellstrom, Sean Paul, VMware Graphics, Ben Skeggs,
	mcoquelin.stm32, Leo (Sunpeng) Li, linux-arm-msm,
	Intel Graphics Development, Rodrigo Vivi, Vincent Abriou,
	rodrigosiqueiramelo, philippe.cornu, yannick.fertre, Deucher,
	Alexander, freedreno, Christian Koenig


[-- Attachment #1.1.1: Type: text/plain, Size: 9038 bytes --]

Hi

Am 13.01.20 um 19:52 schrieb Alex Deucher:
> On Fri, Jan 10, 2020 at 4:21 AM Thomas Zimmermann <tzimmermann@suse.de> wrote:
>>
>> The callback struct drm_driver.get_scanout_position() is deprecated in
>> favor of struct drm_crtc_helper_funcs.get_scanout_position(). Convert
>> amdgpu over.
>>
> 
> I would prefer to just change the signature of
> amdgpu_display_get_crtc_scanoutpos() to match the new API rather than
> wrapping it again.

Will be fixed in v2. I wrapped these functions in amdgpu and radeon to
avoid changes to other, unreleted callers.

Best regards
Thomas

> 
> Alex
> 
>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>> ---
>>  drivers/gpu/drm/amd/amdgpu/amdgpu_display.c       | 12 ++++++++++++
>>  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c           | 11 -----------
>>  drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h          |  5 +++++
>>  drivers/gpu/drm/amd/amdgpu/dce_v10_0.c            |  1 +
>>  drivers/gpu/drm/amd/amdgpu/dce_v11_0.c            |  1 +
>>  drivers/gpu/drm/amd/amdgpu/dce_v6_0.c             |  1 +
>>  drivers/gpu/drm/amd/amdgpu/dce_v8_0.c             |  1 +
>>  drivers/gpu/drm/amd/amdgpu/dce_virtual.c          |  1 +
>>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  3 ++-
>>  9 files changed, 24 insertions(+), 12 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
>> index 4e699071d144..a1e769d4417d 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
>> @@ -914,3 +914,15 @@ int amdgpu_display_crtc_idx_to_irq_type(struct amdgpu_device *adev, int crtc)
>>                 return AMDGPU_CRTC_IRQ_NONE;
>>         }
>>  }
>> +
>> +bool amdgpu_crtc_get_scanout_position(struct drm_crtc *crtc,
>> +                       bool in_vblank_irq, int *vpos,
>> +                       int *hpos, ktime_t *stime, ktime_t *etime,
>> +                       const struct drm_display_mode *mode)
>> +{
>> +       struct drm_device *dev = crtc->dev;
>> +       unsigned int pipe = crtc->index;
>> +
>> +       return amdgpu_display_get_crtc_scanoutpos(dev, pipe, 0, vpos, hpos,
>> +                                                 stime, etime, mode);
>> +}
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
>> index 3f6f14ce1511..0749285dd1c7 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
>> @@ -1367,16 +1367,6 @@ int amdgpu_file_to_fpriv(struct file *filp, struct amdgpu_fpriv **fpriv)
>>         return 0;
>>  }
>>
>> -static bool
>> -amdgpu_get_crtc_scanout_position(struct drm_device *dev, unsigned int pipe,
>> -                                bool in_vblank_irq, int *vpos, int *hpos,
>> -                                ktime_t *stime, ktime_t *etime,
>> -                                const struct drm_display_mode *mode)
>> -{
>> -       return amdgpu_display_get_crtc_scanoutpos(dev, pipe, 0, vpos, hpos,
>> -                                                 stime, etime, mode);
>> -}
>> -
>>  static struct drm_driver kms_driver = {
>>         .driver_features =
>>             DRIVER_USE_AGP | DRIVER_ATOMIC |
>> @@ -1391,7 +1381,6 @@ static struct drm_driver kms_driver = {
>>         .enable_vblank = amdgpu_enable_vblank_kms,
>>         .disable_vblank = amdgpu_disable_vblank_kms,
>>         .get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
>> -       .get_scanout_position = amdgpu_get_crtc_scanout_position,
>>         .irq_handler = amdgpu_irq_handler,
>>         .ioctls = amdgpu_ioctls_kms,
>>         .gem_free_object_unlocked = amdgpu_gem_object_free,
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
>> index eb9975f4decb..37ba07e2feb5 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
>> @@ -612,6 +612,11 @@ void amdgpu_panel_mode_fixup(struct drm_encoder *encoder,
>>                              struct drm_display_mode *adjusted_mode);
>>  int amdgpu_display_crtc_idx_to_irq_type(struct amdgpu_device *adev, int crtc);
>>
>> +bool amdgpu_crtc_get_scanout_position(struct drm_crtc *crtc,
>> +                       bool in_vblank_irq, int *vpos,
>> +                       int *hpos, ktime_t *stime, ktime_t *etime,
>> +                       const struct drm_display_mode *mode);
>> +
>>  /* fbdev layer */
>>  int amdgpu_fbdev_init(struct amdgpu_device *adev);
>>  void amdgpu_fbdev_fini(struct amdgpu_device *adev);
>> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
>> index 40d2ac723dd6..bdc1e0f036d4 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
>> @@ -2685,6 +2685,7 @@ static const struct drm_crtc_helper_funcs dce_v10_0_crtc_helper_funcs = {
>>         .prepare = dce_v10_0_crtc_prepare,
>>         .commit = dce_v10_0_crtc_commit,
>>         .disable = dce_v10_0_crtc_disable,
>> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>>  };
>>
>>  static int dce_v10_0_crtc_init(struct amdgpu_device *adev, int index)
>> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
>> index 898ef72d423c..0319da5f7bf9 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
>> @@ -2793,6 +2793,7 @@ static const struct drm_crtc_helper_funcs dce_v11_0_crtc_helper_funcs = {
>>         .prepare = dce_v11_0_crtc_prepare,
>>         .commit = dce_v11_0_crtc_commit,
>>         .disable = dce_v11_0_crtc_disable,
>> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>>  };
>>
>>  static int dce_v11_0_crtc_init(struct amdgpu_device *adev, int index)
>> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
>> index db15a112becc..78642c3b14fc 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
>> @@ -2575,6 +2575,7 @@ static const struct drm_crtc_helper_funcs dce_v6_0_crtc_helper_funcs = {
>>         .prepare = dce_v6_0_crtc_prepare,
>>         .commit = dce_v6_0_crtc_commit,
>>         .disable = dce_v6_0_crtc_disable,
>> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>>  };
>>
>>  static int dce_v6_0_crtc_init(struct amdgpu_device *adev, int index)
>> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
>> index f06c9022c1fd..1e8d4975435a 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
>> @@ -2593,6 +2593,7 @@ static const struct drm_crtc_helper_funcs dce_v8_0_crtc_helper_funcs = {
>>         .prepare = dce_v8_0_crtc_prepare,
>>         .commit = dce_v8_0_crtc_commit,
>>         .disable = dce_v8_0_crtc_disable,
>> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>>  };
>>
>>  static int dce_v8_0_crtc_init(struct amdgpu_device *adev, int index)
>> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
>> index e4f94863332c..4b2f915aba47 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
>> @@ -218,6 +218,7 @@ static const struct drm_crtc_helper_funcs dce_virtual_crtc_helper_funcs = {
>>         .prepare = dce_virtual_crtc_prepare,
>>         .commit = dce_virtual_crtc_commit,
>>         .disable = dce_virtual_crtc_disable,
>> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>>  };
>>
>>  static int dce_virtual_crtc_init(struct amdgpu_device *adev, int index)
>> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> index f2db400a3920..39c5cf242c1b 100644
>> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> @@ -4821,7 +4821,8 @@ static bool dm_crtc_helper_mode_fixup(struct drm_crtc *crtc,
>>  static const struct drm_crtc_helper_funcs amdgpu_dm_crtc_helper_funcs = {
>>         .disable = dm_crtc_helper_disable,
>>         .atomic_check = dm_crtc_helper_atomic_check,
>> -       .mode_fixup = dm_crtc_helper_mode_fixup
>> +       .mode_fixup = dm_crtc_helper_mode_fixup,
>> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>>  };
>>
>>  static void dm_encoder_helper_disable(struct drm_encoder *encoder)
>> --
>> 2.24.1
>>
>> _______________________________________________
>> amd-gfx mailing list
>> amd-gfx@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/amd-gfx

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [Intel-gfx] [PATCH 02/23] drm/amdgpu: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
@ 2020-01-14  7:46       ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-14  7:46 UTC (permalink / raw)
  To: Alex Deucher
  Cc: hamohammed.sa, Dave Airlie, nouveau,
	Maling list - DRI developers, Eric Anholt, amd-gfx list,
	Benjamin Gaignard, alexandre.torgue, Chunming Zhou,
	Thomas Hellstrom, VMware Graphics, Ben Skeggs, Wentland, Harry,
	mcoquelin.stm32, Leo (Sunpeng) Li, linux-arm-msm,
	Intel Graphics Development, Vincent Abriou, rodrigosiqueiramelo,
	philippe.cornu, yannick.fertre, Deucher, Alexander, freedreno,
	Christian Koenig


[-- Attachment #1.1.1: Type: text/plain, Size: 9038 bytes --]

Hi

Am 13.01.20 um 19:52 schrieb Alex Deucher:
> On Fri, Jan 10, 2020 at 4:21 AM Thomas Zimmermann <tzimmermann@suse.de> wrote:
>>
>> The callback struct drm_driver.get_scanout_position() is deprecated in
>> favor of struct drm_crtc_helper_funcs.get_scanout_position(). Convert
>> amdgpu over.
>>
> 
> I would prefer to just change the signature of
> amdgpu_display_get_crtc_scanoutpos() to match the new API rather than
> wrapping it again.

Will be fixed in v2. I wrapped these functions in amdgpu and radeon to
avoid changes to other, unreleted callers.

Best regards
Thomas

> 
> Alex
> 
>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>> ---
>>  drivers/gpu/drm/amd/amdgpu/amdgpu_display.c       | 12 ++++++++++++
>>  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c           | 11 -----------
>>  drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h          |  5 +++++
>>  drivers/gpu/drm/amd/amdgpu/dce_v10_0.c            |  1 +
>>  drivers/gpu/drm/amd/amdgpu/dce_v11_0.c            |  1 +
>>  drivers/gpu/drm/amd/amdgpu/dce_v6_0.c             |  1 +
>>  drivers/gpu/drm/amd/amdgpu/dce_v8_0.c             |  1 +
>>  drivers/gpu/drm/amd/amdgpu/dce_virtual.c          |  1 +
>>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  3 ++-
>>  9 files changed, 24 insertions(+), 12 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
>> index 4e699071d144..a1e769d4417d 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
>> @@ -914,3 +914,15 @@ int amdgpu_display_crtc_idx_to_irq_type(struct amdgpu_device *adev, int crtc)
>>                 return AMDGPU_CRTC_IRQ_NONE;
>>         }
>>  }
>> +
>> +bool amdgpu_crtc_get_scanout_position(struct drm_crtc *crtc,
>> +                       bool in_vblank_irq, int *vpos,
>> +                       int *hpos, ktime_t *stime, ktime_t *etime,
>> +                       const struct drm_display_mode *mode)
>> +{
>> +       struct drm_device *dev = crtc->dev;
>> +       unsigned int pipe = crtc->index;
>> +
>> +       return amdgpu_display_get_crtc_scanoutpos(dev, pipe, 0, vpos, hpos,
>> +                                                 stime, etime, mode);
>> +}
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
>> index 3f6f14ce1511..0749285dd1c7 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
>> @@ -1367,16 +1367,6 @@ int amdgpu_file_to_fpriv(struct file *filp, struct amdgpu_fpriv **fpriv)
>>         return 0;
>>  }
>>
>> -static bool
>> -amdgpu_get_crtc_scanout_position(struct drm_device *dev, unsigned int pipe,
>> -                                bool in_vblank_irq, int *vpos, int *hpos,
>> -                                ktime_t *stime, ktime_t *etime,
>> -                                const struct drm_display_mode *mode)
>> -{
>> -       return amdgpu_display_get_crtc_scanoutpos(dev, pipe, 0, vpos, hpos,
>> -                                                 stime, etime, mode);
>> -}
>> -
>>  static struct drm_driver kms_driver = {
>>         .driver_features =
>>             DRIVER_USE_AGP | DRIVER_ATOMIC |
>> @@ -1391,7 +1381,6 @@ static struct drm_driver kms_driver = {
>>         .enable_vblank = amdgpu_enable_vblank_kms,
>>         .disable_vblank = amdgpu_disable_vblank_kms,
>>         .get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
>> -       .get_scanout_position = amdgpu_get_crtc_scanout_position,
>>         .irq_handler = amdgpu_irq_handler,
>>         .ioctls = amdgpu_ioctls_kms,
>>         .gem_free_object_unlocked = amdgpu_gem_object_free,
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
>> index eb9975f4decb..37ba07e2feb5 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
>> @@ -612,6 +612,11 @@ void amdgpu_panel_mode_fixup(struct drm_encoder *encoder,
>>                              struct drm_display_mode *adjusted_mode);
>>  int amdgpu_display_crtc_idx_to_irq_type(struct amdgpu_device *adev, int crtc);
>>
>> +bool amdgpu_crtc_get_scanout_position(struct drm_crtc *crtc,
>> +                       bool in_vblank_irq, int *vpos,
>> +                       int *hpos, ktime_t *stime, ktime_t *etime,
>> +                       const struct drm_display_mode *mode);
>> +
>>  /* fbdev layer */
>>  int amdgpu_fbdev_init(struct amdgpu_device *adev);
>>  void amdgpu_fbdev_fini(struct amdgpu_device *adev);
>> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
>> index 40d2ac723dd6..bdc1e0f036d4 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
>> @@ -2685,6 +2685,7 @@ static const struct drm_crtc_helper_funcs dce_v10_0_crtc_helper_funcs = {
>>         .prepare = dce_v10_0_crtc_prepare,
>>         .commit = dce_v10_0_crtc_commit,
>>         .disable = dce_v10_0_crtc_disable,
>> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>>  };
>>
>>  static int dce_v10_0_crtc_init(struct amdgpu_device *adev, int index)
>> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
>> index 898ef72d423c..0319da5f7bf9 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
>> @@ -2793,6 +2793,7 @@ static const struct drm_crtc_helper_funcs dce_v11_0_crtc_helper_funcs = {
>>         .prepare = dce_v11_0_crtc_prepare,
>>         .commit = dce_v11_0_crtc_commit,
>>         .disable = dce_v11_0_crtc_disable,
>> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>>  };
>>
>>  static int dce_v11_0_crtc_init(struct amdgpu_device *adev, int index)
>> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
>> index db15a112becc..78642c3b14fc 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
>> @@ -2575,6 +2575,7 @@ static const struct drm_crtc_helper_funcs dce_v6_0_crtc_helper_funcs = {
>>         .prepare = dce_v6_0_crtc_prepare,
>>         .commit = dce_v6_0_crtc_commit,
>>         .disable = dce_v6_0_crtc_disable,
>> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>>  };
>>
>>  static int dce_v6_0_crtc_init(struct amdgpu_device *adev, int index)
>> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
>> index f06c9022c1fd..1e8d4975435a 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
>> @@ -2593,6 +2593,7 @@ static const struct drm_crtc_helper_funcs dce_v8_0_crtc_helper_funcs = {
>>         .prepare = dce_v8_0_crtc_prepare,
>>         .commit = dce_v8_0_crtc_commit,
>>         .disable = dce_v8_0_crtc_disable,
>> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>>  };
>>
>>  static int dce_v8_0_crtc_init(struct amdgpu_device *adev, int index)
>> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
>> index e4f94863332c..4b2f915aba47 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
>> @@ -218,6 +218,7 @@ static const struct drm_crtc_helper_funcs dce_virtual_crtc_helper_funcs = {
>>         .prepare = dce_virtual_crtc_prepare,
>>         .commit = dce_virtual_crtc_commit,
>>         .disable = dce_virtual_crtc_disable,
>> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>>  };
>>
>>  static int dce_virtual_crtc_init(struct amdgpu_device *adev, int index)
>> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> index f2db400a3920..39c5cf242c1b 100644
>> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> @@ -4821,7 +4821,8 @@ static bool dm_crtc_helper_mode_fixup(struct drm_crtc *crtc,
>>  static const struct drm_crtc_helper_funcs amdgpu_dm_crtc_helper_funcs = {
>>         .disable = dm_crtc_helper_disable,
>>         .atomic_check = dm_crtc_helper_atomic_check,
>> -       .mode_fixup = dm_crtc_helper_mode_fixup
>> +       .mode_fixup = dm_crtc_helper_mode_fixup,
>> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>>  };
>>
>>  static void dm_encoder_helper_disable(struct drm_encoder *encoder)
>> --
>> 2.24.1
>>
>> _______________________________________________
>> amd-gfx mailing list
>> amd-gfx@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/amd-gfx

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [PATCH 02/23] drm/amdgpu: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
@ 2020-01-14  7:46       ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-14  7:46 UTC (permalink / raw)
  To: Alex Deucher
  Cc: hamohammed.sa, Dave Airlie, nouveau, Joonas Lahtinen,
	Maling list - DRI developers, Eric Anholt, amd-gfx list,
	Benjamin Gaignard, alexandre.torgue, Chunming Zhou,
	Thomas Hellstrom, Sean Paul, Patrik Jakobsson, VMware Graphics,
	Ben Skeggs, Wentland, Harry, mcoquelin.stm32, Leo (Sunpeng) Li,
	linux-arm-msm, Intel Graphics Development, Maarten Lankhorst,
	Jani Nikula, Rodrigo Vivi, Vincent Abriou, rodrigosiqueiramelo,
	philippe.cornu, yannick.fertre, Rob Clark, Daniel Vetter,
	Deucher, Alexander, freedreno, Christian Koenig


[-- Attachment #1.1.1: Type: text/plain, Size: 9038 bytes --]

Hi

Am 13.01.20 um 19:52 schrieb Alex Deucher:
> On Fri, Jan 10, 2020 at 4:21 AM Thomas Zimmermann <tzimmermann@suse.de> wrote:
>>
>> The callback struct drm_driver.get_scanout_position() is deprecated in
>> favor of struct drm_crtc_helper_funcs.get_scanout_position(). Convert
>> amdgpu over.
>>
> 
> I would prefer to just change the signature of
> amdgpu_display_get_crtc_scanoutpos() to match the new API rather than
> wrapping it again.

Will be fixed in v2. I wrapped these functions in amdgpu and radeon to
avoid changes to other, unreleted callers.

Best regards
Thomas

> 
> Alex
> 
>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>> ---
>>  drivers/gpu/drm/amd/amdgpu/amdgpu_display.c       | 12 ++++++++++++
>>  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c           | 11 -----------
>>  drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h          |  5 +++++
>>  drivers/gpu/drm/amd/amdgpu/dce_v10_0.c            |  1 +
>>  drivers/gpu/drm/amd/amdgpu/dce_v11_0.c            |  1 +
>>  drivers/gpu/drm/amd/amdgpu/dce_v6_0.c             |  1 +
>>  drivers/gpu/drm/amd/amdgpu/dce_v8_0.c             |  1 +
>>  drivers/gpu/drm/amd/amdgpu/dce_virtual.c          |  1 +
>>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  3 ++-
>>  9 files changed, 24 insertions(+), 12 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
>> index 4e699071d144..a1e769d4417d 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
>> @@ -914,3 +914,15 @@ int amdgpu_display_crtc_idx_to_irq_type(struct amdgpu_device *adev, int crtc)
>>                 return AMDGPU_CRTC_IRQ_NONE;
>>         }
>>  }
>> +
>> +bool amdgpu_crtc_get_scanout_position(struct drm_crtc *crtc,
>> +                       bool in_vblank_irq, int *vpos,
>> +                       int *hpos, ktime_t *stime, ktime_t *etime,
>> +                       const struct drm_display_mode *mode)
>> +{
>> +       struct drm_device *dev = crtc->dev;
>> +       unsigned int pipe = crtc->index;
>> +
>> +       return amdgpu_display_get_crtc_scanoutpos(dev, pipe, 0, vpos, hpos,
>> +                                                 stime, etime, mode);
>> +}
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
>> index 3f6f14ce1511..0749285dd1c7 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
>> @@ -1367,16 +1367,6 @@ int amdgpu_file_to_fpriv(struct file *filp, struct amdgpu_fpriv **fpriv)
>>         return 0;
>>  }
>>
>> -static bool
>> -amdgpu_get_crtc_scanout_position(struct drm_device *dev, unsigned int pipe,
>> -                                bool in_vblank_irq, int *vpos, int *hpos,
>> -                                ktime_t *stime, ktime_t *etime,
>> -                                const struct drm_display_mode *mode)
>> -{
>> -       return amdgpu_display_get_crtc_scanoutpos(dev, pipe, 0, vpos, hpos,
>> -                                                 stime, etime, mode);
>> -}
>> -
>>  static struct drm_driver kms_driver = {
>>         .driver_features =
>>             DRIVER_USE_AGP | DRIVER_ATOMIC |
>> @@ -1391,7 +1381,6 @@ static struct drm_driver kms_driver = {
>>         .enable_vblank = amdgpu_enable_vblank_kms,
>>         .disable_vblank = amdgpu_disable_vblank_kms,
>>         .get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
>> -       .get_scanout_position = amdgpu_get_crtc_scanout_position,
>>         .irq_handler = amdgpu_irq_handler,
>>         .ioctls = amdgpu_ioctls_kms,
>>         .gem_free_object_unlocked = amdgpu_gem_object_free,
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
>> index eb9975f4decb..37ba07e2feb5 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
>> @@ -612,6 +612,11 @@ void amdgpu_panel_mode_fixup(struct drm_encoder *encoder,
>>                              struct drm_display_mode *adjusted_mode);
>>  int amdgpu_display_crtc_idx_to_irq_type(struct amdgpu_device *adev, int crtc);
>>
>> +bool amdgpu_crtc_get_scanout_position(struct drm_crtc *crtc,
>> +                       bool in_vblank_irq, int *vpos,
>> +                       int *hpos, ktime_t *stime, ktime_t *etime,
>> +                       const struct drm_display_mode *mode);
>> +
>>  /* fbdev layer */
>>  int amdgpu_fbdev_init(struct amdgpu_device *adev);
>>  void amdgpu_fbdev_fini(struct amdgpu_device *adev);
>> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
>> index 40d2ac723dd6..bdc1e0f036d4 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
>> @@ -2685,6 +2685,7 @@ static const struct drm_crtc_helper_funcs dce_v10_0_crtc_helper_funcs = {
>>         .prepare = dce_v10_0_crtc_prepare,
>>         .commit = dce_v10_0_crtc_commit,
>>         .disable = dce_v10_0_crtc_disable,
>> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>>  };
>>
>>  static int dce_v10_0_crtc_init(struct amdgpu_device *adev, int index)
>> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
>> index 898ef72d423c..0319da5f7bf9 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
>> @@ -2793,6 +2793,7 @@ static const struct drm_crtc_helper_funcs dce_v11_0_crtc_helper_funcs = {
>>         .prepare = dce_v11_0_crtc_prepare,
>>         .commit = dce_v11_0_crtc_commit,
>>         .disable = dce_v11_0_crtc_disable,
>> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>>  };
>>
>>  static int dce_v11_0_crtc_init(struct amdgpu_device *adev, int index)
>> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
>> index db15a112becc..78642c3b14fc 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
>> @@ -2575,6 +2575,7 @@ static const struct drm_crtc_helper_funcs dce_v6_0_crtc_helper_funcs = {
>>         .prepare = dce_v6_0_crtc_prepare,
>>         .commit = dce_v6_0_crtc_commit,
>>         .disable = dce_v6_0_crtc_disable,
>> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>>  };
>>
>>  static int dce_v6_0_crtc_init(struct amdgpu_device *adev, int index)
>> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
>> index f06c9022c1fd..1e8d4975435a 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
>> @@ -2593,6 +2593,7 @@ static const struct drm_crtc_helper_funcs dce_v8_0_crtc_helper_funcs = {
>>         .prepare = dce_v8_0_crtc_prepare,
>>         .commit = dce_v8_0_crtc_commit,
>>         .disable = dce_v8_0_crtc_disable,
>> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>>  };
>>
>>  static int dce_v8_0_crtc_init(struct amdgpu_device *adev, int index)
>> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
>> index e4f94863332c..4b2f915aba47 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
>> @@ -218,6 +218,7 @@ static const struct drm_crtc_helper_funcs dce_virtual_crtc_helper_funcs = {
>>         .prepare = dce_virtual_crtc_prepare,
>>         .commit = dce_virtual_crtc_commit,
>>         .disable = dce_virtual_crtc_disable,
>> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>>  };
>>
>>  static int dce_virtual_crtc_init(struct amdgpu_device *adev, int index)
>> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> index f2db400a3920..39c5cf242c1b 100644
>> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> @@ -4821,7 +4821,8 @@ static bool dm_crtc_helper_mode_fixup(struct drm_crtc *crtc,
>>  static const struct drm_crtc_helper_funcs amdgpu_dm_crtc_helper_funcs = {
>>         .disable = dm_crtc_helper_disable,
>>         .atomic_check = dm_crtc_helper_atomic_check,
>> -       .mode_fixup = dm_crtc_helper_mode_fixup
>> +       .mode_fixup = dm_crtc_helper_mode_fixup,
>> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>>  };
>>
>>  static void dm_encoder_helper_disable(struct drm_encoder *encoder)
>> --
>> 2.24.1
>>
>> _______________________________________________
>> amd-gfx mailing list
>> amd-gfx@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/amd-gfx

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [PATCH 23/23] drm: Cleanup VBLANK callbacks in struct drm_driver
  2020-01-12 22:53     ` Daniel Vetter
  (?)
  (?)
@ 2020-01-14 13:48       ` Thomas Zimmermann
  -1 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-14 13:48 UTC (permalink / raw)
  To: Daniel Vetter
  Cc: hamohammed.sa, airlied, nouveau, dri-devel, amd-gfx,
	alexandre.torgue, thellstrom, sean, linux-graphics-maintainer,
	bskeggs, mcoquelin.stm32, sunpeng.li, linux-arm-msm, intel-gfx,
	rodrigo.vivi, vincent.abriou, rodrigosiqueiramelo,
	philippe.cornu, yannick.fertre, alexander.deucher, freedreno,
	christian.koenig


[-- Attachment #1.1: Type: text/plain, Size: 9997 bytes --]

Hi

Am 12.01.20 um 23:53 schrieb Daniel Vetter:
> On Fri, Jan 10, 2020 at 10:21:27AM +0100, Thomas Zimmermann wrote:
>> All non-legacy users of VBLANK functions in struct drm_driver have been
>> converted to use the respective interfaces in struct drm_crtc_funcs. The
>> remaining users of VBLANK callbacks in struct drm_driver are legacy drivers
>> with userspace modesetting.
>>
>> There are no users left of get_vblank_timestamp(), so the callback is
>> being removed. The other VBLANK callbacks are being moved to the legacy
>> section at the end of struct drm_driver.
>>
>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> 
> I think sprinkling some WARN_ON (in drm_dev_register or wherever) if new
> drivers try to use the legacy hooks would be really nice. Experience says
> someone is going to copypaste this stuff around forever otherwise.

I've been thinking about moving these fields to separate structures, say
struct drm_legacy_device and struct drm_legacy_driver. Those would be
allocated for legacy drivers and KMS drivers would never see them
(except for their forward declaration).

Best regards
Thomas

> 
> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> 
>> ---
>>  drivers/gpu/drm/drm_vblank.c |  39 +++++---------
>>  include/drm/drm_drv.h        | 101 ++---------------------------------
>>  2 files changed, 17 insertions(+), 123 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
>> index 7cf436a4b908..ceff68474d4d 100644
>> --- a/drivers/gpu/drm/drm_vblank.c
>> +++ b/drivers/gpu/drm/drm_vblank.c
>> @@ -138,10 +138,9 @@ static u32 __get_vblank_counter(struct drm_device *dev, unsigned int pipe)
>>  
>>  		if (crtc->funcs->get_vblank_counter)
>>  			return crtc->funcs->get_vblank_counter(crtc);
>> -	}
>> -
>> -	if (dev->driver->get_vblank_counter)
>> +	} else if (dev->driver->get_vblank_counter) {
>>  		return dev->driver->get_vblank_counter(dev, pipe);
>> +	}
>>  
>>  	return drm_vblank_no_hw_counter(dev, pipe);
>>  }
>> @@ -334,8 +333,7 @@ u64 drm_crtc_accurate_vblank_count(struct drm_crtc *crtc)
>>  	unsigned long flags;
>>  
>>  	WARN_ONCE(drm_debug_enabled(DRM_UT_VBL) &&
>> -		  !crtc->funcs->get_vblank_timestamp &&
>> -		  !dev->driver->get_vblank_timestamp,
>> +		  !crtc->funcs->get_vblank_timestamp,
>>  		  "This function requires support for accurate vblank timestamps.");
>>  
>>  	spin_lock_irqsave(&dev->vblank_time_lock, flags);
>> @@ -357,13 +355,11 @@ static void __disable_vblank(struct drm_device *dev, unsigned int pipe)
>>  		if (WARN_ON(!crtc))
>>  			return;
>>  
>> -		if (crtc->funcs->disable_vblank) {
>> +		if (crtc->funcs->disable_vblank)
>>  			crtc->funcs->disable_vblank(crtc);
>> -			return;
>> -		}
>> +	} else {
>> +		dev->driver->disable_vblank(dev, pipe);
>>  	}
>> -
>> -	dev->driver->disable_vblank(dev, pipe);
>>  }
>>  
>>  /*
>> @@ -791,9 +787,6 @@ drm_get_last_vbltimestamp(struct drm_device *dev, unsigned int pipe,
>>  
>>  		ret = crtc->funcs->get_vblank_timestamp(crtc, &max_error,
>>  							tvblank, in_vblank_irq);
>> -	} else if (dev->driver->get_vblank_timestamp && (max_error > 0)) {
>> -		ret = dev->driver->get_vblank_timestamp(dev, pipe, &max_error,
>> -							tvblank, in_vblank_irq);
>>  	}
>>  
>>  	/* GPU high precision timestamp query unsupported or failed.
>> @@ -1016,9 +1009,11 @@ static int __enable_vblank(struct drm_device *dev, unsigned int pipe)
>>  
>>  		if (crtc->funcs->enable_vblank)
>>  			return crtc->funcs->enable_vblank(crtc);
>> +	} else if (dev->driver->enable_vblank) {
>> +		return dev->driver->enable_vblank(dev, pipe);
>>  	}
>>  
>> -	return dev->driver->enable_vblank(dev, pipe);
>> +	return -EINVAL;
>>  }
>>  
>>  static int drm_vblank_enable(struct drm_device *dev, unsigned int pipe)
>> @@ -1109,13 +1104,10 @@ static bool __vblank_disable_immediate(struct drm_device *dev, unsigned int pipe
>>  		return false;
>>  
>>  	crtc = drm_crtc_from_index(dev, pipe);
>> -	if (crtc && crtc->funcs->get_vblank_timestamp)
>> -		return true;
>> -
>> -	if (dev->driver->get_vblank_timestamp)
>> -		return true;
>> +	if (!crtc || !crtc->funcs->get_vblank_timestamp)
>> +		return false;
>>  
>> -	return false;
>> +	return true;
>>  }
>>  
>>  static void drm_vblank_put(struct drm_device *dev, unsigned int pipe)
>> @@ -1798,7 +1790,6 @@ static void drm_handle_vblank_events(struct drm_device *dev, unsigned int pipe)
>>  	struct drm_pending_vblank_event *e, *t;
>>  	ktime_t now;
>>  	u64 seq;
>> -	bool high_prec;
>>  
>>  	assert_spin_locked(&dev->event_lock);
>>  
>> @@ -1818,10 +1809,8 @@ static void drm_handle_vblank_events(struct drm_device *dev, unsigned int pipe)
>>  		send_vblank_event(dev, e, seq, now);
>>  	}
>>  
>> -	high_prec = crtc->funcs->get_vblank_timestamp ||
>> -		    dev->driver->get_vblank_timestamp;
>> -
>> -	trace_drm_vblank_event(pipe, seq, now, high_prec);
>> +	trace_drm_vblank_event(pipe, seq, now,
>> +			       crtc->funcs->get_vblank_timestamp != NULL);
>>  }
>>  
>>  /**
>> diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
>> index b704e252f3b2..e290b3aca6eb 100644
>> --- a/include/drm/drm_drv.h
>> +++ b/include/drm/drm_drv.h
>> @@ -268,104 +268,6 @@ struct drm_driver {
>>  	 */
>>  	void (*release) (struct drm_device *);
>>  
>> -	/**
>> -	 * @get_vblank_counter:
>> -	 *
>> -	 * Driver callback for fetching a raw hardware vblank counter for the
>> -	 * CRTC specified with the pipe argument.  If a device doesn't have a
>> -	 * hardware counter, the driver can simply leave the hook as NULL.
>> -	 * The DRM core will account for missed vblank events while interrupts
>> -	 * where disabled based on system timestamps.
>> -	 *
>> -	 * Wraparound handling and loss of events due to modesetting is dealt
>> -	 * with in the DRM core code, as long as drivers call
>> -	 * drm_crtc_vblank_off() and drm_crtc_vblank_on() when disabling or
>> -	 * enabling a CRTC.
>> -	 *
>> -	 * This is deprecated and should not be used by new drivers.
>> -	 * Use &drm_crtc_funcs.get_vblank_counter instead.
>> -	 *
>> -	 * Returns:
>> -	 *
>> -	 * Raw vblank counter value.
>> -	 */
>> -	u32 (*get_vblank_counter) (struct drm_device *dev, unsigned int pipe);
>> -
>> -	/**
>> -	 * @enable_vblank:
>> -	 *
>> -	 * Enable vblank interrupts for the CRTC specified with the pipe
>> -	 * argument.
>> -	 *
>> -	 * This is deprecated and should not be used by new drivers.
>> -	 * Use &drm_crtc_funcs.enable_vblank instead.
>> -	 *
>> -	 * Returns:
>> -	 *
>> -	 * Zero on success, appropriate errno if the given @crtc's vblank
>> -	 * interrupt cannot be enabled.
>> -	 */
>> -	int (*enable_vblank) (struct drm_device *dev, unsigned int pipe);
>> -
>> -	/**
>> -	 * @disable_vblank:
>> -	 *
>> -	 * Disable vblank interrupts for the CRTC specified with the pipe
>> -	 * argument.
>> -	 *
>> -	 * This is deprecated and should not be used by new drivers.
>> -	 * Use &drm_crtc_funcs.disable_vblank instead.
>> -	 */
>> -	void (*disable_vblank) (struct drm_device *dev, unsigned int pipe);
>> -
>> -	/**
>> -	 * @get_vblank_timestamp:
>> -	 *
>> -	 * Called by drm_get_last_vbltimestamp(). Should return a precise
>> -	 * timestamp when the most recent VBLANK interval ended or will end.
>> -	 *
>> -	 * Specifically, the timestamp in @vblank_time should correspond as
>> -	 * closely as possible to the time when the first video scanline of
>> -	 * the video frame after the end of VBLANK will start scanning out,
>> -	 * the time immediately after end of the VBLANK interval. If the
>> -	 * @crtc is currently inside VBLANK, this will be a time in the future.
>> -	 * If the @crtc is currently scanning out a frame, this will be the
>> -	 * past start time of the current scanout. This is meant to adhere
>> -	 * to the OpenML OML_sync_control extension specification.
>> -	 *
>> -	 * Paramters:
>> -	 *
>> -	 * dev:
>> -	 *     dev DRM device handle.
>> -	 * pipe:
>> -	 *     crtc for which timestamp should be returned.
>> -	 * max_error:
>> -	 *     Maximum allowable timestamp error in nanoseconds.
>> -	 *     Implementation should strive to provide timestamp
>> -	 *     with an error of at most max_error nanoseconds.
>> -	 *     Returns true upper bound on error for timestamp.
>> -	 * vblank_time:
>> -	 *     Target location for returned vblank timestamp.
>> -	 * in_vblank_irq:
>> -	 *     True when called from drm_crtc_handle_vblank().  Some drivers
>> -	 *     need to apply some workarounds for gpu-specific vblank irq quirks
>> -	 *     if flag is set.
>> -	 *
>> -	 * Returns:
>> -	 *
>> -	 * True on success, false on failure, which means the core should
>> -	 * fallback to a simple timestamp taken in drm_crtc_handle_vblank().
>> -	 *
>> -	 * FIXME:
>> -	 *
>> -	 * We should move this hook to &struct drm_crtc_funcs like all the other
>> -	 * vblank hooks.
>> -	 */
>> -	bool (*get_vblank_timestamp) (struct drm_device *dev, unsigned int pipe,
>> -				     int *max_error,
>> -				     ktime_t *vblank_time,
>> -				     bool in_vblank_irq);
>> -
>>  	/**
>>  	 * @irq_handler:
>>  	 *
>> @@ -720,6 +622,9 @@ struct drm_driver {
>>  	int (*dma_ioctl) (struct drm_device *dev, void *data, struct drm_file *file_priv);
>>  	int (*dma_quiescent) (struct drm_device *);
>>  	int (*context_dtor) (struct drm_device *dev, int context);
>> +	u32 (*get_vblank_counter)(struct drm_device *dev, unsigned int pipe);
>> +	int (*enable_vblank)(struct drm_device *dev, unsigned int pipe);
>> +	void (*disable_vblank)(struct drm_device *dev, unsigned int pipe);
>>  	int dev_priv_size;
>>  };
>>  
>> -- 
>> 2.24.1
>>
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [PATCH 23/23] drm: Cleanup VBLANK callbacks in struct drm_driver
@ 2020-01-14 13:48       ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-14 13:48 UTC (permalink / raw)
  To: Daniel Vetter
  Cc: hamohammed.sa, airlied, nouveau, dri-devel, thellstrom, sean,
	amd-gfx, linux-graphics-maintainer, bskeggs, alexandre.torgue,
	sunpeng.li, linux-arm-msm, intel-gfx, rodrigo.vivi,
	vincent.abriou, rodrigosiqueiramelo, philippe.cornu,
	yannick.fertre, mcoquelin.stm32, alexander.deucher, freedreno,
	christian.koenig


[-- Attachment #1.1.1: Type: text/plain, Size: 9997 bytes --]

Hi

Am 12.01.20 um 23:53 schrieb Daniel Vetter:
> On Fri, Jan 10, 2020 at 10:21:27AM +0100, Thomas Zimmermann wrote:
>> All non-legacy users of VBLANK functions in struct drm_driver have been
>> converted to use the respective interfaces in struct drm_crtc_funcs. The
>> remaining users of VBLANK callbacks in struct drm_driver are legacy drivers
>> with userspace modesetting.
>>
>> There are no users left of get_vblank_timestamp(), so the callback is
>> being removed. The other VBLANK callbacks are being moved to the legacy
>> section at the end of struct drm_driver.
>>
>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> 
> I think sprinkling some WARN_ON (in drm_dev_register or wherever) if new
> drivers try to use the legacy hooks would be really nice. Experience says
> someone is going to copypaste this stuff around forever otherwise.

I've been thinking about moving these fields to separate structures, say
struct drm_legacy_device and struct drm_legacy_driver. Those would be
allocated for legacy drivers and KMS drivers would never see them
(except for their forward declaration).

Best regards
Thomas

> 
> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> 
>> ---
>>  drivers/gpu/drm/drm_vblank.c |  39 +++++---------
>>  include/drm/drm_drv.h        | 101 ++---------------------------------
>>  2 files changed, 17 insertions(+), 123 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
>> index 7cf436a4b908..ceff68474d4d 100644
>> --- a/drivers/gpu/drm/drm_vblank.c
>> +++ b/drivers/gpu/drm/drm_vblank.c
>> @@ -138,10 +138,9 @@ static u32 __get_vblank_counter(struct drm_device *dev, unsigned int pipe)
>>  
>>  		if (crtc->funcs->get_vblank_counter)
>>  			return crtc->funcs->get_vblank_counter(crtc);
>> -	}
>> -
>> -	if (dev->driver->get_vblank_counter)
>> +	} else if (dev->driver->get_vblank_counter) {
>>  		return dev->driver->get_vblank_counter(dev, pipe);
>> +	}
>>  
>>  	return drm_vblank_no_hw_counter(dev, pipe);
>>  }
>> @@ -334,8 +333,7 @@ u64 drm_crtc_accurate_vblank_count(struct drm_crtc *crtc)
>>  	unsigned long flags;
>>  
>>  	WARN_ONCE(drm_debug_enabled(DRM_UT_VBL) &&
>> -		  !crtc->funcs->get_vblank_timestamp &&
>> -		  !dev->driver->get_vblank_timestamp,
>> +		  !crtc->funcs->get_vblank_timestamp,
>>  		  "This function requires support for accurate vblank timestamps.");
>>  
>>  	spin_lock_irqsave(&dev->vblank_time_lock, flags);
>> @@ -357,13 +355,11 @@ static void __disable_vblank(struct drm_device *dev, unsigned int pipe)
>>  		if (WARN_ON(!crtc))
>>  			return;
>>  
>> -		if (crtc->funcs->disable_vblank) {
>> +		if (crtc->funcs->disable_vblank)
>>  			crtc->funcs->disable_vblank(crtc);
>> -			return;
>> -		}
>> +	} else {
>> +		dev->driver->disable_vblank(dev, pipe);
>>  	}
>> -
>> -	dev->driver->disable_vblank(dev, pipe);
>>  }
>>  
>>  /*
>> @@ -791,9 +787,6 @@ drm_get_last_vbltimestamp(struct drm_device *dev, unsigned int pipe,
>>  
>>  		ret = crtc->funcs->get_vblank_timestamp(crtc, &max_error,
>>  							tvblank, in_vblank_irq);
>> -	} else if (dev->driver->get_vblank_timestamp && (max_error > 0)) {
>> -		ret = dev->driver->get_vblank_timestamp(dev, pipe, &max_error,
>> -							tvblank, in_vblank_irq);
>>  	}
>>  
>>  	/* GPU high precision timestamp query unsupported or failed.
>> @@ -1016,9 +1009,11 @@ static int __enable_vblank(struct drm_device *dev, unsigned int pipe)
>>  
>>  		if (crtc->funcs->enable_vblank)
>>  			return crtc->funcs->enable_vblank(crtc);
>> +	} else if (dev->driver->enable_vblank) {
>> +		return dev->driver->enable_vblank(dev, pipe);
>>  	}
>>  
>> -	return dev->driver->enable_vblank(dev, pipe);
>> +	return -EINVAL;
>>  }
>>  
>>  static int drm_vblank_enable(struct drm_device *dev, unsigned int pipe)
>> @@ -1109,13 +1104,10 @@ static bool __vblank_disable_immediate(struct drm_device *dev, unsigned int pipe
>>  		return false;
>>  
>>  	crtc = drm_crtc_from_index(dev, pipe);
>> -	if (crtc && crtc->funcs->get_vblank_timestamp)
>> -		return true;
>> -
>> -	if (dev->driver->get_vblank_timestamp)
>> -		return true;
>> +	if (!crtc || !crtc->funcs->get_vblank_timestamp)
>> +		return false;
>>  
>> -	return false;
>> +	return true;
>>  }
>>  
>>  static void drm_vblank_put(struct drm_device *dev, unsigned int pipe)
>> @@ -1798,7 +1790,6 @@ static void drm_handle_vblank_events(struct drm_device *dev, unsigned int pipe)
>>  	struct drm_pending_vblank_event *e, *t;
>>  	ktime_t now;
>>  	u64 seq;
>> -	bool high_prec;
>>  
>>  	assert_spin_locked(&dev->event_lock);
>>  
>> @@ -1818,10 +1809,8 @@ static void drm_handle_vblank_events(struct drm_device *dev, unsigned int pipe)
>>  		send_vblank_event(dev, e, seq, now);
>>  	}
>>  
>> -	high_prec = crtc->funcs->get_vblank_timestamp ||
>> -		    dev->driver->get_vblank_timestamp;
>> -
>> -	trace_drm_vblank_event(pipe, seq, now, high_prec);
>> +	trace_drm_vblank_event(pipe, seq, now,
>> +			       crtc->funcs->get_vblank_timestamp != NULL);
>>  }
>>  
>>  /**
>> diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
>> index b704e252f3b2..e290b3aca6eb 100644
>> --- a/include/drm/drm_drv.h
>> +++ b/include/drm/drm_drv.h
>> @@ -268,104 +268,6 @@ struct drm_driver {
>>  	 */
>>  	void (*release) (struct drm_device *);
>>  
>> -	/**
>> -	 * @get_vblank_counter:
>> -	 *
>> -	 * Driver callback for fetching a raw hardware vblank counter for the
>> -	 * CRTC specified with the pipe argument.  If a device doesn't have a
>> -	 * hardware counter, the driver can simply leave the hook as NULL.
>> -	 * The DRM core will account for missed vblank events while interrupts
>> -	 * where disabled based on system timestamps.
>> -	 *
>> -	 * Wraparound handling and loss of events due to modesetting is dealt
>> -	 * with in the DRM core code, as long as drivers call
>> -	 * drm_crtc_vblank_off() and drm_crtc_vblank_on() when disabling or
>> -	 * enabling a CRTC.
>> -	 *
>> -	 * This is deprecated and should not be used by new drivers.
>> -	 * Use &drm_crtc_funcs.get_vblank_counter instead.
>> -	 *
>> -	 * Returns:
>> -	 *
>> -	 * Raw vblank counter value.
>> -	 */
>> -	u32 (*get_vblank_counter) (struct drm_device *dev, unsigned int pipe);
>> -
>> -	/**
>> -	 * @enable_vblank:
>> -	 *
>> -	 * Enable vblank interrupts for the CRTC specified with the pipe
>> -	 * argument.
>> -	 *
>> -	 * This is deprecated and should not be used by new drivers.
>> -	 * Use &drm_crtc_funcs.enable_vblank instead.
>> -	 *
>> -	 * Returns:
>> -	 *
>> -	 * Zero on success, appropriate errno if the given @crtc's vblank
>> -	 * interrupt cannot be enabled.
>> -	 */
>> -	int (*enable_vblank) (struct drm_device *dev, unsigned int pipe);
>> -
>> -	/**
>> -	 * @disable_vblank:
>> -	 *
>> -	 * Disable vblank interrupts for the CRTC specified with the pipe
>> -	 * argument.
>> -	 *
>> -	 * This is deprecated and should not be used by new drivers.
>> -	 * Use &drm_crtc_funcs.disable_vblank instead.
>> -	 */
>> -	void (*disable_vblank) (struct drm_device *dev, unsigned int pipe);
>> -
>> -	/**
>> -	 * @get_vblank_timestamp:
>> -	 *
>> -	 * Called by drm_get_last_vbltimestamp(). Should return a precise
>> -	 * timestamp when the most recent VBLANK interval ended or will end.
>> -	 *
>> -	 * Specifically, the timestamp in @vblank_time should correspond as
>> -	 * closely as possible to the time when the first video scanline of
>> -	 * the video frame after the end of VBLANK will start scanning out,
>> -	 * the time immediately after end of the VBLANK interval. If the
>> -	 * @crtc is currently inside VBLANK, this will be a time in the future.
>> -	 * If the @crtc is currently scanning out a frame, this will be the
>> -	 * past start time of the current scanout. This is meant to adhere
>> -	 * to the OpenML OML_sync_control extension specification.
>> -	 *
>> -	 * Paramters:
>> -	 *
>> -	 * dev:
>> -	 *     dev DRM device handle.
>> -	 * pipe:
>> -	 *     crtc for which timestamp should be returned.
>> -	 * max_error:
>> -	 *     Maximum allowable timestamp error in nanoseconds.
>> -	 *     Implementation should strive to provide timestamp
>> -	 *     with an error of at most max_error nanoseconds.
>> -	 *     Returns true upper bound on error for timestamp.
>> -	 * vblank_time:
>> -	 *     Target location for returned vblank timestamp.
>> -	 * in_vblank_irq:
>> -	 *     True when called from drm_crtc_handle_vblank().  Some drivers
>> -	 *     need to apply some workarounds for gpu-specific vblank irq quirks
>> -	 *     if flag is set.
>> -	 *
>> -	 * Returns:
>> -	 *
>> -	 * True on success, false on failure, which means the core should
>> -	 * fallback to a simple timestamp taken in drm_crtc_handle_vblank().
>> -	 *
>> -	 * FIXME:
>> -	 *
>> -	 * We should move this hook to &struct drm_crtc_funcs like all the other
>> -	 * vblank hooks.
>> -	 */
>> -	bool (*get_vblank_timestamp) (struct drm_device *dev, unsigned int pipe,
>> -				     int *max_error,
>> -				     ktime_t *vblank_time,
>> -				     bool in_vblank_irq);
>> -
>>  	/**
>>  	 * @irq_handler:
>>  	 *
>> @@ -720,6 +622,9 @@ struct drm_driver {
>>  	int (*dma_ioctl) (struct drm_device *dev, void *data, struct drm_file *file_priv);
>>  	int (*dma_quiescent) (struct drm_device *);
>>  	int (*context_dtor) (struct drm_device *dev, int context);
>> +	u32 (*get_vblank_counter)(struct drm_device *dev, unsigned int pipe);
>> +	int (*enable_vblank)(struct drm_device *dev, unsigned int pipe);
>> +	void (*disable_vblank)(struct drm_device *dev, unsigned int pipe);
>>  	int dev_priv_size;
>>  };
>>  
>> -- 
>> 2.24.1
>>
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [Intel-gfx] [PATCH 23/23] drm: Cleanup VBLANK callbacks in struct drm_driver
@ 2020-01-14 13:48       ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-14 13:48 UTC (permalink / raw)
  To: Daniel Vetter
  Cc: hamohammed.sa, airlied, nouveau, dri-devel, thellstrom, amd-gfx,
	linux-graphics-maintainer, bskeggs, alexandre.torgue, sunpeng.li,
	linux-arm-msm, intel-gfx, vincent.abriou, rodrigosiqueiramelo,
	philippe.cornu, yannick.fertre, mcoquelin.stm32,
	alexander.deucher, freedreno, christian.koenig


[-- Attachment #1.1.1: Type: text/plain, Size: 9997 bytes --]

Hi

Am 12.01.20 um 23:53 schrieb Daniel Vetter:
> On Fri, Jan 10, 2020 at 10:21:27AM +0100, Thomas Zimmermann wrote:
>> All non-legacy users of VBLANK functions in struct drm_driver have been
>> converted to use the respective interfaces in struct drm_crtc_funcs. The
>> remaining users of VBLANK callbacks in struct drm_driver are legacy drivers
>> with userspace modesetting.
>>
>> There are no users left of get_vblank_timestamp(), so the callback is
>> being removed. The other VBLANK callbacks are being moved to the legacy
>> section at the end of struct drm_driver.
>>
>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> 
> I think sprinkling some WARN_ON (in drm_dev_register or wherever) if new
> drivers try to use the legacy hooks would be really nice. Experience says
> someone is going to copypaste this stuff around forever otherwise.

I've been thinking about moving these fields to separate structures, say
struct drm_legacy_device and struct drm_legacy_driver. Those would be
allocated for legacy drivers and KMS drivers would never see them
(except for their forward declaration).

Best regards
Thomas

> 
> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> 
>> ---
>>  drivers/gpu/drm/drm_vblank.c |  39 +++++---------
>>  include/drm/drm_drv.h        | 101 ++---------------------------------
>>  2 files changed, 17 insertions(+), 123 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
>> index 7cf436a4b908..ceff68474d4d 100644
>> --- a/drivers/gpu/drm/drm_vblank.c
>> +++ b/drivers/gpu/drm/drm_vblank.c
>> @@ -138,10 +138,9 @@ static u32 __get_vblank_counter(struct drm_device *dev, unsigned int pipe)
>>  
>>  		if (crtc->funcs->get_vblank_counter)
>>  			return crtc->funcs->get_vblank_counter(crtc);
>> -	}
>> -
>> -	if (dev->driver->get_vblank_counter)
>> +	} else if (dev->driver->get_vblank_counter) {
>>  		return dev->driver->get_vblank_counter(dev, pipe);
>> +	}
>>  
>>  	return drm_vblank_no_hw_counter(dev, pipe);
>>  }
>> @@ -334,8 +333,7 @@ u64 drm_crtc_accurate_vblank_count(struct drm_crtc *crtc)
>>  	unsigned long flags;
>>  
>>  	WARN_ONCE(drm_debug_enabled(DRM_UT_VBL) &&
>> -		  !crtc->funcs->get_vblank_timestamp &&
>> -		  !dev->driver->get_vblank_timestamp,
>> +		  !crtc->funcs->get_vblank_timestamp,
>>  		  "This function requires support for accurate vblank timestamps.");
>>  
>>  	spin_lock_irqsave(&dev->vblank_time_lock, flags);
>> @@ -357,13 +355,11 @@ static void __disable_vblank(struct drm_device *dev, unsigned int pipe)
>>  		if (WARN_ON(!crtc))
>>  			return;
>>  
>> -		if (crtc->funcs->disable_vblank) {
>> +		if (crtc->funcs->disable_vblank)
>>  			crtc->funcs->disable_vblank(crtc);
>> -			return;
>> -		}
>> +	} else {
>> +		dev->driver->disable_vblank(dev, pipe);
>>  	}
>> -
>> -	dev->driver->disable_vblank(dev, pipe);
>>  }
>>  
>>  /*
>> @@ -791,9 +787,6 @@ drm_get_last_vbltimestamp(struct drm_device *dev, unsigned int pipe,
>>  
>>  		ret = crtc->funcs->get_vblank_timestamp(crtc, &max_error,
>>  							tvblank, in_vblank_irq);
>> -	} else if (dev->driver->get_vblank_timestamp && (max_error > 0)) {
>> -		ret = dev->driver->get_vblank_timestamp(dev, pipe, &max_error,
>> -							tvblank, in_vblank_irq);
>>  	}
>>  
>>  	/* GPU high precision timestamp query unsupported or failed.
>> @@ -1016,9 +1009,11 @@ static int __enable_vblank(struct drm_device *dev, unsigned int pipe)
>>  
>>  		if (crtc->funcs->enable_vblank)
>>  			return crtc->funcs->enable_vblank(crtc);
>> +	} else if (dev->driver->enable_vblank) {
>> +		return dev->driver->enable_vblank(dev, pipe);
>>  	}
>>  
>> -	return dev->driver->enable_vblank(dev, pipe);
>> +	return -EINVAL;
>>  }
>>  
>>  static int drm_vblank_enable(struct drm_device *dev, unsigned int pipe)
>> @@ -1109,13 +1104,10 @@ static bool __vblank_disable_immediate(struct drm_device *dev, unsigned int pipe
>>  		return false;
>>  
>>  	crtc = drm_crtc_from_index(dev, pipe);
>> -	if (crtc && crtc->funcs->get_vblank_timestamp)
>> -		return true;
>> -
>> -	if (dev->driver->get_vblank_timestamp)
>> -		return true;
>> +	if (!crtc || !crtc->funcs->get_vblank_timestamp)
>> +		return false;
>>  
>> -	return false;
>> +	return true;
>>  }
>>  
>>  static void drm_vblank_put(struct drm_device *dev, unsigned int pipe)
>> @@ -1798,7 +1790,6 @@ static void drm_handle_vblank_events(struct drm_device *dev, unsigned int pipe)
>>  	struct drm_pending_vblank_event *e, *t;
>>  	ktime_t now;
>>  	u64 seq;
>> -	bool high_prec;
>>  
>>  	assert_spin_locked(&dev->event_lock);
>>  
>> @@ -1818,10 +1809,8 @@ static void drm_handle_vblank_events(struct drm_device *dev, unsigned int pipe)
>>  		send_vblank_event(dev, e, seq, now);
>>  	}
>>  
>> -	high_prec = crtc->funcs->get_vblank_timestamp ||
>> -		    dev->driver->get_vblank_timestamp;
>> -
>> -	trace_drm_vblank_event(pipe, seq, now, high_prec);
>> +	trace_drm_vblank_event(pipe, seq, now,
>> +			       crtc->funcs->get_vblank_timestamp != NULL);
>>  }
>>  
>>  /**
>> diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
>> index b704e252f3b2..e290b3aca6eb 100644
>> --- a/include/drm/drm_drv.h
>> +++ b/include/drm/drm_drv.h
>> @@ -268,104 +268,6 @@ struct drm_driver {
>>  	 */
>>  	void (*release) (struct drm_device *);
>>  
>> -	/**
>> -	 * @get_vblank_counter:
>> -	 *
>> -	 * Driver callback for fetching a raw hardware vblank counter for the
>> -	 * CRTC specified with the pipe argument.  If a device doesn't have a
>> -	 * hardware counter, the driver can simply leave the hook as NULL.
>> -	 * The DRM core will account for missed vblank events while interrupts
>> -	 * where disabled based on system timestamps.
>> -	 *
>> -	 * Wraparound handling and loss of events due to modesetting is dealt
>> -	 * with in the DRM core code, as long as drivers call
>> -	 * drm_crtc_vblank_off() and drm_crtc_vblank_on() when disabling or
>> -	 * enabling a CRTC.
>> -	 *
>> -	 * This is deprecated and should not be used by new drivers.
>> -	 * Use &drm_crtc_funcs.get_vblank_counter instead.
>> -	 *
>> -	 * Returns:
>> -	 *
>> -	 * Raw vblank counter value.
>> -	 */
>> -	u32 (*get_vblank_counter) (struct drm_device *dev, unsigned int pipe);
>> -
>> -	/**
>> -	 * @enable_vblank:
>> -	 *
>> -	 * Enable vblank interrupts for the CRTC specified with the pipe
>> -	 * argument.
>> -	 *
>> -	 * This is deprecated and should not be used by new drivers.
>> -	 * Use &drm_crtc_funcs.enable_vblank instead.
>> -	 *
>> -	 * Returns:
>> -	 *
>> -	 * Zero on success, appropriate errno if the given @crtc's vblank
>> -	 * interrupt cannot be enabled.
>> -	 */
>> -	int (*enable_vblank) (struct drm_device *dev, unsigned int pipe);
>> -
>> -	/**
>> -	 * @disable_vblank:
>> -	 *
>> -	 * Disable vblank interrupts for the CRTC specified with the pipe
>> -	 * argument.
>> -	 *
>> -	 * This is deprecated and should not be used by new drivers.
>> -	 * Use &drm_crtc_funcs.disable_vblank instead.
>> -	 */
>> -	void (*disable_vblank) (struct drm_device *dev, unsigned int pipe);
>> -
>> -	/**
>> -	 * @get_vblank_timestamp:
>> -	 *
>> -	 * Called by drm_get_last_vbltimestamp(). Should return a precise
>> -	 * timestamp when the most recent VBLANK interval ended or will end.
>> -	 *
>> -	 * Specifically, the timestamp in @vblank_time should correspond as
>> -	 * closely as possible to the time when the first video scanline of
>> -	 * the video frame after the end of VBLANK will start scanning out,
>> -	 * the time immediately after end of the VBLANK interval. If the
>> -	 * @crtc is currently inside VBLANK, this will be a time in the future.
>> -	 * If the @crtc is currently scanning out a frame, this will be the
>> -	 * past start time of the current scanout. This is meant to adhere
>> -	 * to the OpenML OML_sync_control extension specification.
>> -	 *
>> -	 * Paramters:
>> -	 *
>> -	 * dev:
>> -	 *     dev DRM device handle.
>> -	 * pipe:
>> -	 *     crtc for which timestamp should be returned.
>> -	 * max_error:
>> -	 *     Maximum allowable timestamp error in nanoseconds.
>> -	 *     Implementation should strive to provide timestamp
>> -	 *     with an error of at most max_error nanoseconds.
>> -	 *     Returns true upper bound on error for timestamp.
>> -	 * vblank_time:
>> -	 *     Target location for returned vblank timestamp.
>> -	 * in_vblank_irq:
>> -	 *     True when called from drm_crtc_handle_vblank().  Some drivers
>> -	 *     need to apply some workarounds for gpu-specific vblank irq quirks
>> -	 *     if flag is set.
>> -	 *
>> -	 * Returns:
>> -	 *
>> -	 * True on success, false on failure, which means the core should
>> -	 * fallback to a simple timestamp taken in drm_crtc_handle_vblank().
>> -	 *
>> -	 * FIXME:
>> -	 *
>> -	 * We should move this hook to &struct drm_crtc_funcs like all the other
>> -	 * vblank hooks.
>> -	 */
>> -	bool (*get_vblank_timestamp) (struct drm_device *dev, unsigned int pipe,
>> -				     int *max_error,
>> -				     ktime_t *vblank_time,
>> -				     bool in_vblank_irq);
>> -
>>  	/**
>>  	 * @irq_handler:
>>  	 *
>> @@ -720,6 +622,9 @@ struct drm_driver {
>>  	int (*dma_ioctl) (struct drm_device *dev, void *data, struct drm_file *file_priv);
>>  	int (*dma_quiescent) (struct drm_device *);
>>  	int (*context_dtor) (struct drm_device *dev, int context);
>> +	u32 (*get_vblank_counter)(struct drm_device *dev, unsigned int pipe);
>> +	int (*enable_vblank)(struct drm_device *dev, unsigned int pipe);
>> +	void (*disable_vblank)(struct drm_device *dev, unsigned int pipe);
>>  	int dev_priv_size;
>>  };
>>  
>> -- 
>> 2.24.1
>>
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [PATCH 23/23] drm: Cleanup VBLANK callbacks in struct drm_driver
@ 2020-01-14 13:48       ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-14 13:48 UTC (permalink / raw)
  To: Daniel Vetter
  Cc: hamohammed.sa, airlied, nouveau, dri-devel, thellstrom, sean,
	amd-gfx, linux-graphics-maintainer, bskeggs, alexandre.torgue,
	sunpeng.li, linux-arm-msm, intel-gfx, rodrigo.vivi,
	vincent.abriou, rodrigosiqueiramelo, philippe.cornu,
	yannick.fertre, mcoquelin.stm32, alexander.deucher, freedreno,
	christian.koenig


[-- Attachment #1.1.1: Type: text/plain, Size: 9997 bytes --]

Hi

Am 12.01.20 um 23:53 schrieb Daniel Vetter:
> On Fri, Jan 10, 2020 at 10:21:27AM +0100, Thomas Zimmermann wrote:
>> All non-legacy users of VBLANK functions in struct drm_driver have been
>> converted to use the respective interfaces in struct drm_crtc_funcs. The
>> remaining users of VBLANK callbacks in struct drm_driver are legacy drivers
>> with userspace modesetting.
>>
>> There are no users left of get_vblank_timestamp(), so the callback is
>> being removed. The other VBLANK callbacks are being moved to the legacy
>> section at the end of struct drm_driver.
>>
>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> 
> I think sprinkling some WARN_ON (in drm_dev_register or wherever) if new
> drivers try to use the legacy hooks would be really nice. Experience says
> someone is going to copypaste this stuff around forever otherwise.

I've been thinking about moving these fields to separate structures, say
struct drm_legacy_device and struct drm_legacy_driver. Those would be
allocated for legacy drivers and KMS drivers would never see them
(except for their forward declaration).

Best regards
Thomas

> 
> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> 
>> ---
>>  drivers/gpu/drm/drm_vblank.c |  39 +++++---------
>>  include/drm/drm_drv.h        | 101 ++---------------------------------
>>  2 files changed, 17 insertions(+), 123 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
>> index 7cf436a4b908..ceff68474d4d 100644
>> --- a/drivers/gpu/drm/drm_vblank.c
>> +++ b/drivers/gpu/drm/drm_vblank.c
>> @@ -138,10 +138,9 @@ static u32 __get_vblank_counter(struct drm_device *dev, unsigned int pipe)
>>  
>>  		if (crtc->funcs->get_vblank_counter)
>>  			return crtc->funcs->get_vblank_counter(crtc);
>> -	}
>> -
>> -	if (dev->driver->get_vblank_counter)
>> +	} else if (dev->driver->get_vblank_counter) {
>>  		return dev->driver->get_vblank_counter(dev, pipe);
>> +	}
>>  
>>  	return drm_vblank_no_hw_counter(dev, pipe);
>>  }
>> @@ -334,8 +333,7 @@ u64 drm_crtc_accurate_vblank_count(struct drm_crtc *crtc)
>>  	unsigned long flags;
>>  
>>  	WARN_ONCE(drm_debug_enabled(DRM_UT_VBL) &&
>> -		  !crtc->funcs->get_vblank_timestamp &&
>> -		  !dev->driver->get_vblank_timestamp,
>> +		  !crtc->funcs->get_vblank_timestamp,
>>  		  "This function requires support for accurate vblank timestamps.");
>>  
>>  	spin_lock_irqsave(&dev->vblank_time_lock, flags);
>> @@ -357,13 +355,11 @@ static void __disable_vblank(struct drm_device *dev, unsigned int pipe)
>>  		if (WARN_ON(!crtc))
>>  			return;
>>  
>> -		if (crtc->funcs->disable_vblank) {
>> +		if (crtc->funcs->disable_vblank)
>>  			crtc->funcs->disable_vblank(crtc);
>> -			return;
>> -		}
>> +	} else {
>> +		dev->driver->disable_vblank(dev, pipe);
>>  	}
>> -
>> -	dev->driver->disable_vblank(dev, pipe);
>>  }
>>  
>>  /*
>> @@ -791,9 +787,6 @@ drm_get_last_vbltimestamp(struct drm_device *dev, unsigned int pipe,
>>  
>>  		ret = crtc->funcs->get_vblank_timestamp(crtc, &max_error,
>>  							tvblank, in_vblank_irq);
>> -	} else if (dev->driver->get_vblank_timestamp && (max_error > 0)) {
>> -		ret = dev->driver->get_vblank_timestamp(dev, pipe, &max_error,
>> -							tvblank, in_vblank_irq);
>>  	}
>>  
>>  	/* GPU high precision timestamp query unsupported or failed.
>> @@ -1016,9 +1009,11 @@ static int __enable_vblank(struct drm_device *dev, unsigned int pipe)
>>  
>>  		if (crtc->funcs->enable_vblank)
>>  			return crtc->funcs->enable_vblank(crtc);
>> +	} else if (dev->driver->enable_vblank) {
>> +		return dev->driver->enable_vblank(dev, pipe);
>>  	}
>>  
>> -	return dev->driver->enable_vblank(dev, pipe);
>> +	return -EINVAL;
>>  }
>>  
>>  static int drm_vblank_enable(struct drm_device *dev, unsigned int pipe)
>> @@ -1109,13 +1104,10 @@ static bool __vblank_disable_immediate(struct drm_device *dev, unsigned int pipe
>>  		return false;
>>  
>>  	crtc = drm_crtc_from_index(dev, pipe);
>> -	if (crtc && crtc->funcs->get_vblank_timestamp)
>> -		return true;
>> -
>> -	if (dev->driver->get_vblank_timestamp)
>> -		return true;
>> +	if (!crtc || !crtc->funcs->get_vblank_timestamp)
>> +		return false;
>>  
>> -	return false;
>> +	return true;
>>  }
>>  
>>  static void drm_vblank_put(struct drm_device *dev, unsigned int pipe)
>> @@ -1798,7 +1790,6 @@ static void drm_handle_vblank_events(struct drm_device *dev, unsigned int pipe)
>>  	struct drm_pending_vblank_event *e, *t;
>>  	ktime_t now;
>>  	u64 seq;
>> -	bool high_prec;
>>  
>>  	assert_spin_locked(&dev->event_lock);
>>  
>> @@ -1818,10 +1809,8 @@ static void drm_handle_vblank_events(struct drm_device *dev, unsigned int pipe)
>>  		send_vblank_event(dev, e, seq, now);
>>  	}
>>  
>> -	high_prec = crtc->funcs->get_vblank_timestamp ||
>> -		    dev->driver->get_vblank_timestamp;
>> -
>> -	trace_drm_vblank_event(pipe, seq, now, high_prec);
>> +	trace_drm_vblank_event(pipe, seq, now,
>> +			       crtc->funcs->get_vblank_timestamp != NULL);
>>  }
>>  
>>  /**
>> diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
>> index b704e252f3b2..e290b3aca6eb 100644
>> --- a/include/drm/drm_drv.h
>> +++ b/include/drm/drm_drv.h
>> @@ -268,104 +268,6 @@ struct drm_driver {
>>  	 */
>>  	void (*release) (struct drm_device *);
>>  
>> -	/**
>> -	 * @get_vblank_counter:
>> -	 *
>> -	 * Driver callback for fetching a raw hardware vblank counter for the
>> -	 * CRTC specified with the pipe argument.  If a device doesn't have a
>> -	 * hardware counter, the driver can simply leave the hook as NULL.
>> -	 * The DRM core will account for missed vblank events while interrupts
>> -	 * where disabled based on system timestamps.
>> -	 *
>> -	 * Wraparound handling and loss of events due to modesetting is dealt
>> -	 * with in the DRM core code, as long as drivers call
>> -	 * drm_crtc_vblank_off() and drm_crtc_vblank_on() when disabling or
>> -	 * enabling a CRTC.
>> -	 *
>> -	 * This is deprecated and should not be used by new drivers.
>> -	 * Use &drm_crtc_funcs.get_vblank_counter instead.
>> -	 *
>> -	 * Returns:
>> -	 *
>> -	 * Raw vblank counter value.
>> -	 */
>> -	u32 (*get_vblank_counter) (struct drm_device *dev, unsigned int pipe);
>> -
>> -	/**
>> -	 * @enable_vblank:
>> -	 *
>> -	 * Enable vblank interrupts for the CRTC specified with the pipe
>> -	 * argument.
>> -	 *
>> -	 * This is deprecated and should not be used by new drivers.
>> -	 * Use &drm_crtc_funcs.enable_vblank instead.
>> -	 *
>> -	 * Returns:
>> -	 *
>> -	 * Zero on success, appropriate errno if the given @crtc's vblank
>> -	 * interrupt cannot be enabled.
>> -	 */
>> -	int (*enable_vblank) (struct drm_device *dev, unsigned int pipe);
>> -
>> -	/**
>> -	 * @disable_vblank:
>> -	 *
>> -	 * Disable vblank interrupts for the CRTC specified with the pipe
>> -	 * argument.
>> -	 *
>> -	 * This is deprecated and should not be used by new drivers.
>> -	 * Use &drm_crtc_funcs.disable_vblank instead.
>> -	 */
>> -	void (*disable_vblank) (struct drm_device *dev, unsigned int pipe);
>> -
>> -	/**
>> -	 * @get_vblank_timestamp:
>> -	 *
>> -	 * Called by drm_get_last_vbltimestamp(). Should return a precise
>> -	 * timestamp when the most recent VBLANK interval ended or will end.
>> -	 *
>> -	 * Specifically, the timestamp in @vblank_time should correspond as
>> -	 * closely as possible to the time when the first video scanline of
>> -	 * the video frame after the end of VBLANK will start scanning out,
>> -	 * the time immediately after end of the VBLANK interval. If the
>> -	 * @crtc is currently inside VBLANK, this will be a time in the future.
>> -	 * If the @crtc is currently scanning out a frame, this will be the
>> -	 * past start time of the current scanout. This is meant to adhere
>> -	 * to the OpenML OML_sync_control extension specification.
>> -	 *
>> -	 * Paramters:
>> -	 *
>> -	 * dev:
>> -	 *     dev DRM device handle.
>> -	 * pipe:
>> -	 *     crtc for which timestamp should be returned.
>> -	 * max_error:
>> -	 *     Maximum allowable timestamp error in nanoseconds.
>> -	 *     Implementation should strive to provide timestamp
>> -	 *     with an error of at most max_error nanoseconds.
>> -	 *     Returns true upper bound on error for timestamp.
>> -	 * vblank_time:
>> -	 *     Target location for returned vblank timestamp.
>> -	 * in_vblank_irq:
>> -	 *     True when called from drm_crtc_handle_vblank().  Some drivers
>> -	 *     need to apply some workarounds for gpu-specific vblank irq quirks
>> -	 *     if flag is set.
>> -	 *
>> -	 * Returns:
>> -	 *
>> -	 * True on success, false on failure, which means the core should
>> -	 * fallback to a simple timestamp taken in drm_crtc_handle_vblank().
>> -	 *
>> -	 * FIXME:
>> -	 *
>> -	 * We should move this hook to &struct drm_crtc_funcs like all the other
>> -	 * vblank hooks.
>> -	 */
>> -	bool (*get_vblank_timestamp) (struct drm_device *dev, unsigned int pipe,
>> -				     int *max_error,
>> -				     ktime_t *vblank_time,
>> -				     bool in_vblank_irq);
>> -
>>  	/**
>>  	 * @irq_handler:
>>  	 *
>> @@ -720,6 +622,9 @@ struct drm_driver {
>>  	int (*dma_ioctl) (struct drm_device *dev, void *data, struct drm_file *file_priv);
>>  	int (*dma_quiescent) (struct drm_device *);
>>  	int (*context_dtor) (struct drm_device *dev, int context);
>> +	u32 (*get_vblank_counter)(struct drm_device *dev, unsigned int pipe);
>> +	int (*enable_vblank)(struct drm_device *dev, unsigned int pipe);
>> +	void (*disable_vblank)(struct drm_device *dev, unsigned int pipe);
>>  	int dev_priv_size;
>>  };
>>  
>> -- 
>> 2.24.1
>>
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [PATCH 01/23] drm: Add get_scanout_position() to struct drm_crtc_helper_funcs
  2020-01-10  9:21   ` Thomas Zimmermann
  (?)
  (?)
@ 2020-01-14 15:31     ` Yannick FERTRE
  -1 siblings, 0 replies; 217+ messages in thread
From: Yannick FERTRE @ 2020-01-14 15:31 UTC (permalink / raw)
  To: Thomas Zimmermann, airlied, daniel, alexander.deucher,
	christian.koenig, David1.Zhou, maarten.lankhorst,
	patrik.r.jakobsson, robdclark, sean, benjamin.gaignard,
	Vincent ABRIOU, Philippe CORNU, mcoquelin.stm32,
	Alexandre TORGUE, eric, rodrigosiqueiramelo,
	hamohammed.sa@gmail.com
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, nouveau, freedreno


[-- Attachment #1.1: Type: text/plain, Size: 7097 bytes --]

Thanks for the patch.

Tested-by: Yannick Fertré <yannick.fertre@st.com><mailto:yannick.fertre@st.com>

BR
Yannick Fertré


On 1/10/20 10:21 AM, Thomas Zimmermann wrote:

The new callback get_scanout_position() reads the current location of
the scanout process. The operation is currentyl located in struct
drm_driver, but really belongs to the CRTC. Drivers will be converted
in separate patches.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de><mailto:tzimmermann@suse.de>
---
 drivers/gpu/drm/drm_vblank.c             | 24 ++++++++----
 include/drm/drm_drv.h                    |  7 +---
 include/drm/drm_modeset_helper_vtables.h | 47 ++++++++++++++++++++++++
 3 files changed, 65 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
index 1659b13b178c..c12f0b333e14 100644
--- a/drivers/gpu/drm/drm_vblank.c
+++ b/drivers/gpu/drm/drm_vblank.c
@@ -30,6 +30,7 @@
 #include <drm/drm_crtc.h>
 #include <drm/drm_drv.h>
 #include <drm/drm_framebuffer.h>
+#include <drm/drm_modeset_helper_vtables.h>
 #include <drm/drm_print.h>
 #include <drm/drm_vblank.h>

@@ -590,7 +591,7 @@ EXPORT_SYMBOL(drm_calc_timestamping_constants);
  * Implements calculation of exact vblank timestamps from given drm_display_mode
  * timings and current video scanout position of a CRTC. This can be directly
  * used as the &drm_driver.get_vblank_timestamp implementation of a kms driver
- * if &drm_driver.get_scanout_position is implemented.
+ * if &drm_crtc_helper_funcs.get_scanout_position is implemented.
  *
  * The current implementation only handles standard video modes. For double scan
  * and interlaced modes the driver is supposed to adjust the hardware mode
@@ -632,8 +633,9 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
        }

        /* Scanout position query not supported? Should not happen. */
-       if (!dev->driver->get_scanout_position) {
-               DRM_ERROR("Called from driver w/o get_scanout_position()!?\n");
+       if (!dev->driver->get_scanout_position ||
+           !crtc->helper_private->get_scanout_position) {
+               DRM_ERROR("Called from CRTC w/o get_scanout_position()!?\n");
                return false;
        }

@@ -664,11 +666,17 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
                 * Get vertical and horizontal scanout position vpos, hpos,
                 * and bounding timestamps stime, etime, pre/post query.
                 */
-               vbl_status = dev->driver->get_scanout_position(dev, pipe,
-                                                              in_vblank_irq,
-                                                              &vpos, &hpos,
-                                                              &stime, &etime,
-                                                              mode);
+               if (crtc->helper_private->get_scanout_position) {
+                       vbl_status =
+                               crtc->helper_private->get_scanout_position(
+                                       crtc, in_vblank_irq, &vpos, &hpos,
+                                       &stime, &etime, mode);
+               } else {
+                       vbl_status =
+                               dev->driver->get_scanout_position(
+                                       dev, pipe, in_vblank_irq, &vpos,
+                                       &hpos, &stime, &etime, mode);
+               }

                /* Return as no-op if scanout query unsupported or failed. */
                if (!vbl_status) {
diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
index cf13470810a5..d0049e5786fc 100644
--- a/include/drm/drm_drv.h
+++ b/include/drm/drm_drv.h
@@ -362,11 +362,8 @@ struct drm_driver {
         * True on success, false if a reliable scanout position counter could
         * not be read out.
         *
-        * FIXME:
-        *
-        * Since this is a helper to implement @get_vblank_timestamp, we should
-        * move it to &struct drm_crtc_helper_funcs, like all the other
-        * helper-internal hooks.
+        * This is deprecated and should not be used by new drivers.
+        * Use &drm_crtc_helper_funcs.get_scanout_position instead.
         */
        bool (*get_scanout_position) (struct drm_device *dev, unsigned int pipe,
                                      bool in_vblank_irq, int *vpos, int *hpos,
diff --git a/include/drm/drm_modeset_helper_vtables.h b/include/drm/drm_modeset_helper_vtables.h
index 5a87f1bd7a3f..e398512bfd5f 100644
--- a/include/drm/drm_modeset_helper_vtables.h
+++ b/include/drm/drm_modeset_helper_vtables.h
@@ -450,6 +450,53 @@ struct drm_crtc_helper_funcs {
         */
        void (*atomic_disable)(struct drm_crtc *crtc,
                               struct drm_crtc_state *old_crtc_state);
+
+       /**
+        * @get_scanout_position:
+        *
+        * Called by vblank timestamping code.
+        *
+        * Returns the current display scanout position from a CRTC and an
+        * optional accurate ktime_get() timestamp of when the position was
+        * measured. Note that this is a helper callback which is only used
+        * if a driver uses drm_calc_vbltimestamp_from_scanoutpos() for the
+        * @drm_driver.get_vblank_timestamp callback.
+        *
+        * Parameters:
+        *
+        * crtc:
+        *     The CRTC.
+        * in_vblank_irq:
+        *     True when called from drm_crtc_handle_vblank(). Some drivers
+        *     need to apply some workarounds for gpu-specific vblank irq
+        *     quirks if the flag is set.
+        * vpos:
+        *     Target location for current vertical scanout position.
+        * hpos:
+        *     Target location for current horizontal scanout position.
+        * stime:
+        *     Target location for timestamp taken immediately before
+        *     scanout position query. Can be NULL to skip timestamp.
+        * etime:
+        *     Target location for timestamp taken immediately after
+        *     scanout position query. Can be NULL to skip timestamp.
+        * mode:
+        *     Current display timings.
+        *
+        * Returns vpos as a positive number while in active scanout area.
+        * Returns vpos as a negative number inside vblank, counting the number
+        * of scanlines to go until end of vblank, e.g., -1 means "one scanline
+        * until start of active scanout / end of vblank."
+        *
+        * Returns:
+        *
+        * True on success, false if a reliable scanout position counter could
+        * not be read out.
+        */
+       bool (*get_scanout_position)(struct drm_crtc *crtc,
+                                    bool in_vblank_irq, int *vpos, int *hpos,
+                                    ktime_t *stime, ktime_t *etime,
+                                    const struct drm_display_mode *mode);
 };

 /**



[-- Attachment #1.2: Type: text/html, Size: 7096 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* Re: [PATCH 01/23] drm: Add get_scanout_position() to struct drm_crtc_helper_funcs
@ 2020-01-14 15:31     ` Yannick FERTRE
  0 siblings, 0 replies; 217+ messages in thread
From: Yannick FERTRE @ 2020-01-14 15:31 UTC (permalink / raw)
  To: Thomas Zimmermann, airlied, daniel, alexander.deucher,
	christian.koenig, David1.Zhou, maarten.lankhorst,
	patrik.r.jakobsson, robdclark, sean, benjamin.gaignard,
	Vincent ABRIOU, Philippe CORNU, mcoquelin.stm32,
	Alexandre TORGUE, eric, rodrigosiqueiramelo, hamohammed.sa,
	linux-graphics-maintainer, thellstrom, bskeggs, harry.wentland,
	sunpeng.li, jani.nikula, joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, nouveau, freedreno


[-- Attachment #1.1: Type: text/plain, Size: 7097 bytes --]

Thanks for the patch.

Tested-by: Yannick Fertré <yannick.fertre@st.com><mailto:yannick.fertre@st.com>

BR
Yannick Fertré


On 1/10/20 10:21 AM, Thomas Zimmermann wrote:

The new callback get_scanout_position() reads the current location of
the scanout process. The operation is currentyl located in struct
drm_driver, but really belongs to the CRTC. Drivers will be converted
in separate patches.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de><mailto:tzimmermann@suse.de>
---
 drivers/gpu/drm/drm_vblank.c             | 24 ++++++++----
 include/drm/drm_drv.h                    |  7 +---
 include/drm/drm_modeset_helper_vtables.h | 47 ++++++++++++++++++++++++
 3 files changed, 65 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
index 1659b13b178c..c12f0b333e14 100644
--- a/drivers/gpu/drm/drm_vblank.c
+++ b/drivers/gpu/drm/drm_vblank.c
@@ -30,6 +30,7 @@
 #include <drm/drm_crtc.h>
 #include <drm/drm_drv.h>
 #include <drm/drm_framebuffer.h>
+#include <drm/drm_modeset_helper_vtables.h>
 #include <drm/drm_print.h>
 #include <drm/drm_vblank.h>

@@ -590,7 +591,7 @@ EXPORT_SYMBOL(drm_calc_timestamping_constants);
  * Implements calculation of exact vblank timestamps from given drm_display_mode
  * timings and current video scanout position of a CRTC. This can be directly
  * used as the &drm_driver.get_vblank_timestamp implementation of a kms driver
- * if &drm_driver.get_scanout_position is implemented.
+ * if &drm_crtc_helper_funcs.get_scanout_position is implemented.
  *
  * The current implementation only handles standard video modes. For double scan
  * and interlaced modes the driver is supposed to adjust the hardware mode
@@ -632,8 +633,9 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
        }

        /* Scanout position query not supported? Should not happen. */
-       if (!dev->driver->get_scanout_position) {
-               DRM_ERROR("Called from driver w/o get_scanout_position()!?\n");
+       if (!dev->driver->get_scanout_position ||
+           !crtc->helper_private->get_scanout_position) {
+               DRM_ERROR("Called from CRTC w/o get_scanout_position()!?\n");
                return false;
        }

@@ -664,11 +666,17 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
                 * Get vertical and horizontal scanout position vpos, hpos,
                 * and bounding timestamps stime, etime, pre/post query.
                 */
-               vbl_status = dev->driver->get_scanout_position(dev, pipe,
-                                                              in_vblank_irq,
-                                                              &vpos, &hpos,
-                                                              &stime, &etime,
-                                                              mode);
+               if (crtc->helper_private->get_scanout_position) {
+                       vbl_status =
+                               crtc->helper_private->get_scanout_position(
+                                       crtc, in_vblank_irq, &vpos, &hpos,
+                                       &stime, &etime, mode);
+               } else {
+                       vbl_status =
+                               dev->driver->get_scanout_position(
+                                       dev, pipe, in_vblank_irq, &vpos,
+                                       &hpos, &stime, &etime, mode);
+               }

                /* Return as no-op if scanout query unsupported or failed. */
                if (!vbl_status) {
diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
index cf13470810a5..d0049e5786fc 100644
--- a/include/drm/drm_drv.h
+++ b/include/drm/drm_drv.h
@@ -362,11 +362,8 @@ struct drm_driver {
         * True on success, false if a reliable scanout position counter could
         * not be read out.
         *
-        * FIXME:
-        *
-        * Since this is a helper to implement @get_vblank_timestamp, we should
-        * move it to &struct drm_crtc_helper_funcs, like all the other
-        * helper-internal hooks.
+        * This is deprecated and should not be used by new drivers.
+        * Use &drm_crtc_helper_funcs.get_scanout_position instead.
         */
        bool (*get_scanout_position) (struct drm_device *dev, unsigned int pipe,
                                      bool in_vblank_irq, int *vpos, int *hpos,
diff --git a/include/drm/drm_modeset_helper_vtables.h b/include/drm/drm_modeset_helper_vtables.h
index 5a87f1bd7a3f..e398512bfd5f 100644
--- a/include/drm/drm_modeset_helper_vtables.h
+++ b/include/drm/drm_modeset_helper_vtables.h
@@ -450,6 +450,53 @@ struct drm_crtc_helper_funcs {
         */
        void (*atomic_disable)(struct drm_crtc *crtc,
                               struct drm_crtc_state *old_crtc_state);
+
+       /**
+        * @get_scanout_position:
+        *
+        * Called by vblank timestamping code.
+        *
+        * Returns the current display scanout position from a CRTC and an
+        * optional accurate ktime_get() timestamp of when the position was
+        * measured. Note that this is a helper callback which is only used
+        * if a driver uses drm_calc_vbltimestamp_from_scanoutpos() for the
+        * @drm_driver.get_vblank_timestamp callback.
+        *
+        * Parameters:
+        *
+        * crtc:
+        *     The CRTC.
+        * in_vblank_irq:
+        *     True when called from drm_crtc_handle_vblank(). Some drivers
+        *     need to apply some workarounds for gpu-specific vblank irq
+        *     quirks if the flag is set.
+        * vpos:
+        *     Target location for current vertical scanout position.
+        * hpos:
+        *     Target location for current horizontal scanout position.
+        * stime:
+        *     Target location for timestamp taken immediately before
+        *     scanout position query. Can be NULL to skip timestamp.
+        * etime:
+        *     Target location for timestamp taken immediately after
+        *     scanout position query. Can be NULL to skip timestamp.
+        * mode:
+        *     Current display timings.
+        *
+        * Returns vpos as a positive number while in active scanout area.
+        * Returns vpos as a negative number inside vblank, counting the number
+        * of scanlines to go until end of vblank, e.g., -1 means "one scanline
+        * until start of active scanout / end of vblank."
+        *
+        * Returns:
+        *
+        * True on success, false if a reliable scanout position counter could
+        * not be read out.
+        */
+       bool (*get_scanout_position)(struct drm_crtc *crtc,
+                                    bool in_vblank_irq, int *vpos, int *hpos,
+                                    ktime_t *stime, ktime_t *etime,
+                                    const struct drm_display_mode *mode);
 };

 /**



[-- Attachment #1.2: Type: text/html, Size: 7096 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* Re: [Intel-gfx] [PATCH 01/23] drm: Add get_scanout_position() to struct drm_crtc_helper_funcs
@ 2020-01-14 15:31     ` Yannick FERTRE
  0 siblings, 0 replies; 217+ messages in thread
From: Yannick FERTRE @ 2020-01-14 15:31 UTC (permalink / raw)
  To: Thomas Zimmermann, airlied, daniel, alexander.deucher,
	christian.koenig, David1.Zhou, maarten.lankhorst,
	patrik.r.jakobsson, robdclark, sean, benjamin.gaignard,
	Vincent ABRIOU, Philippe CORNU, mcoquelin.stm32,
	Alexandre TORGUE, eric, rodrigosiqueiramelo, hamohammed.sa,
	linux-graphics-maintainer, thellstrom, bskeggs, harry.wentland,
	sunpeng.li, jani.nikula, joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, nouveau, freedreno


[-- Attachment #1.1: Type: text/plain, Size: 7097 bytes --]

Thanks for the patch.

Tested-by: Yannick Fertré <yannick.fertre@st.com><mailto:yannick.fertre@st.com>

BR
Yannick Fertré


On 1/10/20 10:21 AM, Thomas Zimmermann wrote:

The new callback get_scanout_position() reads the current location of
the scanout process. The operation is currentyl located in struct
drm_driver, but really belongs to the CRTC. Drivers will be converted
in separate patches.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de><mailto:tzimmermann@suse.de>
---
 drivers/gpu/drm/drm_vblank.c             | 24 ++++++++----
 include/drm/drm_drv.h                    |  7 +---
 include/drm/drm_modeset_helper_vtables.h | 47 ++++++++++++++++++++++++
 3 files changed, 65 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
index 1659b13b178c..c12f0b333e14 100644
--- a/drivers/gpu/drm/drm_vblank.c
+++ b/drivers/gpu/drm/drm_vblank.c
@@ -30,6 +30,7 @@
 #include <drm/drm_crtc.h>
 #include <drm/drm_drv.h>
 #include <drm/drm_framebuffer.h>
+#include <drm/drm_modeset_helper_vtables.h>
 #include <drm/drm_print.h>
 #include <drm/drm_vblank.h>

@@ -590,7 +591,7 @@ EXPORT_SYMBOL(drm_calc_timestamping_constants);
  * Implements calculation of exact vblank timestamps from given drm_display_mode
  * timings and current video scanout position of a CRTC. This can be directly
  * used as the &drm_driver.get_vblank_timestamp implementation of a kms driver
- * if &drm_driver.get_scanout_position is implemented.
+ * if &drm_crtc_helper_funcs.get_scanout_position is implemented.
  *
  * The current implementation only handles standard video modes. For double scan
  * and interlaced modes the driver is supposed to adjust the hardware mode
@@ -632,8 +633,9 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
        }

        /* Scanout position query not supported? Should not happen. */
-       if (!dev->driver->get_scanout_position) {
-               DRM_ERROR("Called from driver w/o get_scanout_position()!?\n");
+       if (!dev->driver->get_scanout_position ||
+           !crtc->helper_private->get_scanout_position) {
+               DRM_ERROR("Called from CRTC w/o get_scanout_position()!?\n");
                return false;
        }

@@ -664,11 +666,17 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
                 * Get vertical and horizontal scanout position vpos, hpos,
                 * and bounding timestamps stime, etime, pre/post query.
                 */
-               vbl_status = dev->driver->get_scanout_position(dev, pipe,
-                                                              in_vblank_irq,
-                                                              &vpos, &hpos,
-                                                              &stime, &etime,
-                                                              mode);
+               if (crtc->helper_private->get_scanout_position) {
+                       vbl_status =
+                               crtc->helper_private->get_scanout_position(
+                                       crtc, in_vblank_irq, &vpos, &hpos,
+                                       &stime, &etime, mode);
+               } else {
+                       vbl_status =
+                               dev->driver->get_scanout_position(
+                                       dev, pipe, in_vblank_irq, &vpos,
+                                       &hpos, &stime, &etime, mode);
+               }

                /* Return as no-op if scanout query unsupported or failed. */
                if (!vbl_status) {
diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
index cf13470810a5..d0049e5786fc 100644
--- a/include/drm/drm_drv.h
+++ b/include/drm/drm_drv.h
@@ -362,11 +362,8 @@ struct drm_driver {
         * True on success, false if a reliable scanout position counter could
         * not be read out.
         *
-        * FIXME:
-        *
-        * Since this is a helper to implement @get_vblank_timestamp, we should
-        * move it to &struct drm_crtc_helper_funcs, like all the other
-        * helper-internal hooks.
+        * This is deprecated and should not be used by new drivers.
+        * Use &drm_crtc_helper_funcs.get_scanout_position instead.
         */
        bool (*get_scanout_position) (struct drm_device *dev, unsigned int pipe,
                                      bool in_vblank_irq, int *vpos, int *hpos,
diff --git a/include/drm/drm_modeset_helper_vtables.h b/include/drm/drm_modeset_helper_vtables.h
index 5a87f1bd7a3f..e398512bfd5f 100644
--- a/include/drm/drm_modeset_helper_vtables.h
+++ b/include/drm/drm_modeset_helper_vtables.h
@@ -450,6 +450,53 @@ struct drm_crtc_helper_funcs {
         */
        void (*atomic_disable)(struct drm_crtc *crtc,
                               struct drm_crtc_state *old_crtc_state);
+
+       /**
+        * @get_scanout_position:
+        *
+        * Called by vblank timestamping code.
+        *
+        * Returns the current display scanout position from a CRTC and an
+        * optional accurate ktime_get() timestamp of when the position was
+        * measured. Note that this is a helper callback which is only used
+        * if a driver uses drm_calc_vbltimestamp_from_scanoutpos() for the
+        * @drm_driver.get_vblank_timestamp callback.
+        *
+        * Parameters:
+        *
+        * crtc:
+        *     The CRTC.
+        * in_vblank_irq:
+        *     True when called from drm_crtc_handle_vblank(). Some drivers
+        *     need to apply some workarounds for gpu-specific vblank irq
+        *     quirks if the flag is set.
+        * vpos:
+        *     Target location for current vertical scanout position.
+        * hpos:
+        *     Target location for current horizontal scanout position.
+        * stime:
+        *     Target location for timestamp taken immediately before
+        *     scanout position query. Can be NULL to skip timestamp.
+        * etime:
+        *     Target location for timestamp taken immediately after
+        *     scanout position query. Can be NULL to skip timestamp.
+        * mode:
+        *     Current display timings.
+        *
+        * Returns vpos as a positive number while in active scanout area.
+        * Returns vpos as a negative number inside vblank, counting the number
+        * of scanlines to go until end of vblank, e.g., -1 means "one scanline
+        * until start of active scanout / end of vblank."
+        *
+        * Returns:
+        *
+        * True on success, false if a reliable scanout position counter could
+        * not be read out.
+        */
+       bool (*get_scanout_position)(struct drm_crtc *crtc,
+                                    bool in_vblank_irq, int *vpos, int *hpos,
+                                    ktime_t *stime, ktime_t *etime,
+                                    const struct drm_display_mode *mode);
 };

 /**



[-- Attachment #1.2: Type: text/html, Size: 7096 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* Re: [PATCH 01/23] drm: Add get_scanout_position() to struct drm_crtc_helper_funcs
@ 2020-01-14 15:31     ` Yannick FERTRE
  0 siblings, 0 replies; 217+ messages in thread
From: Yannick FERTRE @ 2020-01-14 15:31 UTC (permalink / raw)
  To: Thomas Zimmermann, airlied, daniel, alexander.deucher,
	christian.koenig, David1.Zhou, maarten.lankhorst,
	patrik.r.jakobsson, robdclark, sean, benjamin.gaignard,
	Vincent ABRIOU, Philippe CORNU, mcoquelin.stm32,
	Alexandre TORGUE, eric, rodrigosiqueiramelo, hamohammed.sa,
	linux-graphics-maintainer, thellstrom, bskeggs, harry.wentland,
	sunpeng.li, jani.nikula, joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, nouveau, freedreno


[-- Attachment #1.1: Type: text/plain, Size: 7097 bytes --]

Thanks for the patch.

Tested-by: Yannick Fertré <yannick.fertre@st.com><mailto:yannick.fertre@st.com>

BR
Yannick Fertré


On 1/10/20 10:21 AM, Thomas Zimmermann wrote:

The new callback get_scanout_position() reads the current location of
the scanout process. The operation is currentyl located in struct
drm_driver, but really belongs to the CRTC. Drivers will be converted
in separate patches.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de><mailto:tzimmermann@suse.de>
---
 drivers/gpu/drm/drm_vblank.c             | 24 ++++++++----
 include/drm/drm_drv.h                    |  7 +---
 include/drm/drm_modeset_helper_vtables.h | 47 ++++++++++++++++++++++++
 3 files changed, 65 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
index 1659b13b178c..c12f0b333e14 100644
--- a/drivers/gpu/drm/drm_vblank.c
+++ b/drivers/gpu/drm/drm_vblank.c
@@ -30,6 +30,7 @@
 #include <drm/drm_crtc.h>
 #include <drm/drm_drv.h>
 #include <drm/drm_framebuffer.h>
+#include <drm/drm_modeset_helper_vtables.h>
 #include <drm/drm_print.h>
 #include <drm/drm_vblank.h>

@@ -590,7 +591,7 @@ EXPORT_SYMBOL(drm_calc_timestamping_constants);
  * Implements calculation of exact vblank timestamps from given drm_display_mode
  * timings and current video scanout position of a CRTC. This can be directly
  * used as the &drm_driver.get_vblank_timestamp implementation of a kms driver
- * if &drm_driver.get_scanout_position is implemented.
+ * if &drm_crtc_helper_funcs.get_scanout_position is implemented.
  *
  * The current implementation only handles standard video modes. For double scan
  * and interlaced modes the driver is supposed to adjust the hardware mode
@@ -632,8 +633,9 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
        }

        /* Scanout position query not supported? Should not happen. */
-       if (!dev->driver->get_scanout_position) {
-               DRM_ERROR("Called from driver w/o get_scanout_position()!?\n");
+       if (!dev->driver->get_scanout_position ||
+           !crtc->helper_private->get_scanout_position) {
+               DRM_ERROR("Called from CRTC w/o get_scanout_position()!?\n");
                return false;
        }

@@ -664,11 +666,17 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
                 * Get vertical and horizontal scanout position vpos, hpos,
                 * and bounding timestamps stime, etime, pre/post query.
                 */
-               vbl_status = dev->driver->get_scanout_position(dev, pipe,
-                                                              in_vblank_irq,
-                                                              &vpos, &hpos,
-                                                              &stime, &etime,
-                                                              mode);
+               if (crtc->helper_private->get_scanout_position) {
+                       vbl_status =
+                               crtc->helper_private->get_scanout_position(
+                                       crtc, in_vblank_irq, &vpos, &hpos,
+                                       &stime, &etime, mode);
+               } else {
+                       vbl_status =
+                               dev->driver->get_scanout_position(
+                                       dev, pipe, in_vblank_irq, &vpos,
+                                       &hpos, &stime, &etime, mode);
+               }

                /* Return as no-op if scanout query unsupported or failed. */
                if (!vbl_status) {
diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
index cf13470810a5..d0049e5786fc 100644
--- a/include/drm/drm_drv.h
+++ b/include/drm/drm_drv.h
@@ -362,11 +362,8 @@ struct drm_driver {
         * True on success, false if a reliable scanout position counter could
         * not be read out.
         *
-        * FIXME:
-        *
-        * Since this is a helper to implement @get_vblank_timestamp, we should
-        * move it to &struct drm_crtc_helper_funcs, like all the other
-        * helper-internal hooks.
+        * This is deprecated and should not be used by new drivers.
+        * Use &drm_crtc_helper_funcs.get_scanout_position instead.
         */
        bool (*get_scanout_position) (struct drm_device *dev, unsigned int pipe,
                                      bool in_vblank_irq, int *vpos, int *hpos,
diff --git a/include/drm/drm_modeset_helper_vtables.h b/include/drm/drm_modeset_helper_vtables.h
index 5a87f1bd7a3f..e398512bfd5f 100644
--- a/include/drm/drm_modeset_helper_vtables.h
+++ b/include/drm/drm_modeset_helper_vtables.h
@@ -450,6 +450,53 @@ struct drm_crtc_helper_funcs {
         */
        void (*atomic_disable)(struct drm_crtc *crtc,
                               struct drm_crtc_state *old_crtc_state);
+
+       /**
+        * @get_scanout_position:
+        *
+        * Called by vblank timestamping code.
+        *
+        * Returns the current display scanout position from a CRTC and an
+        * optional accurate ktime_get() timestamp of when the position was
+        * measured. Note that this is a helper callback which is only used
+        * if a driver uses drm_calc_vbltimestamp_from_scanoutpos() for the
+        * @drm_driver.get_vblank_timestamp callback.
+        *
+        * Parameters:
+        *
+        * crtc:
+        *     The CRTC.
+        * in_vblank_irq:
+        *     True when called from drm_crtc_handle_vblank(). Some drivers
+        *     need to apply some workarounds for gpu-specific vblank irq
+        *     quirks if the flag is set.
+        * vpos:
+        *     Target location for current vertical scanout position.
+        * hpos:
+        *     Target location for current horizontal scanout position.
+        * stime:
+        *     Target location for timestamp taken immediately before
+        *     scanout position query. Can be NULL to skip timestamp.
+        * etime:
+        *     Target location for timestamp taken immediately after
+        *     scanout position query. Can be NULL to skip timestamp.
+        * mode:
+        *     Current display timings.
+        *
+        * Returns vpos as a positive number while in active scanout area.
+        * Returns vpos as a negative number inside vblank, counting the number
+        * of scanlines to go until end of vblank, e.g., -1 means "one scanline
+        * until start of active scanout / end of vblank."
+        *
+        * Returns:
+        *
+        * True on success, false if a reliable scanout position counter could
+        * not be read out.
+        */
+       bool (*get_scanout_position)(struct drm_crtc *crtc,
+                                    bool in_vblank_irq, int *vpos, int *hpos,
+                                    ktime_t *stime, ktime_t *etime,
+                                    const struct drm_display_mode *mode);
 };

 /**



[-- Attachment #1.2: Type: text/html, Size: 7096 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* Re: [PATCH 08/23] drm/stm: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
  2020-01-10  9:21   ` Thomas Zimmermann
  (?)
  (?)
@ 2020-01-14 15:31     ` Yannick FERTRE
  -1 siblings, 0 replies; 217+ messages in thread
From: Yannick FERTRE @ 2020-01-14 15:31 UTC (permalink / raw)
  To: Thomas Zimmermann, airlied, daniel, alexander.deucher,
	christian.koenig, David1.Zhou, maarten.lankhorst,
	patrik.r.jakobsson, robdclark, sean, benjamin.gaignard,
	Vincent ABRIOU, Philippe CORNU, mcoquelin.stm32,
	Alexandre TORGUE, eric, rodrigosiqueiramelo,
	hamohammed.sa@gmail.com
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, nouveau, freedreno


[-- Attachment #1.1: Type: text/plain, Size: 4872 bytes --]

Thanks for the patch.

Tested-by: Yannick Fertré <yannick.fertre@st.com><mailto:yannick.fertre@st.com>

BR
Yannick Fertré


On 1/10/20 10:21 AM, Thomas Zimmermann wrote:

The callback struct drm_driver.get_scanout_position() is deprecated in
favor of struct drm_crtc_helper_funcs.get_scanout_position(). Convert stm
over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de><mailto:tzimmermann@suse.de>
---
 drivers/gpu/drm/stm/drv.c  |  1 -
 drivers/gpu/drm/stm/ltdc.c | 65 ++++++++++++++++++++------------------
 drivers/gpu/drm/stm/ltdc.h |  5 ---
 3 files changed, 34 insertions(+), 37 deletions(-)

diff --git a/drivers/gpu/drm/stm/drv.c b/drivers/gpu/drm/stm/drv.c
index 5a9f9aca8bc2..486985604109 100644
--- a/drivers/gpu/drm/stm/drv.c
+++ b/drivers/gpu/drm/stm/drv.c
@@ -72,7 +72,6 @@ static struct drm_driver drv_driver = {
        .gem_prime_vmap = drm_gem_cma_prime_vmap,
        .gem_prime_vunmap = drm_gem_cma_prime_vunmap,
        .gem_prime_mmap = drm_gem_cma_prime_mmap,
-       .get_scanout_position = ltdc_crtc_scanoutpos,
        .get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
 };

diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
index c2815e8ae1da..8b6d1a2252e3 100644
--- a/drivers/gpu/drm/stm/ltdc.c
+++ b/drivers/gpu/drm/stm/ltdc.c
@@ -636,38 +636,13 @@ static void ltdc_crtc_atomic_flush(struct drm_crtc *crtc,
        }
 }

-static const struct drm_crtc_helper_funcs ltdc_crtc_helper_funcs = {
-       .mode_valid = ltdc_crtc_mode_valid,
-       .mode_fixup = ltdc_crtc_mode_fixup,
-       .mode_set_nofb = ltdc_crtc_mode_set_nofb,
-       .atomic_flush = ltdc_crtc_atomic_flush,
-       .atomic_enable = ltdc_crtc_atomic_enable,
-       .atomic_disable = ltdc_crtc_atomic_disable,
-};
-
-static int ltdc_crtc_enable_vblank(struct drm_crtc *crtc)
-{
-       struct ltdc_device *ldev = crtc_to_ltdc(crtc);
-
-       DRM_DEBUG_DRIVER("\n");
-       reg_set(ldev->regs, LTDC_IER, IER_LIE);
-
-       return 0;
-}
-
-static void ltdc_crtc_disable_vblank(struct drm_crtc *crtc)
-{
-       struct ltdc_device *ldev = crtc_to_ltdc(crtc);
-
-       DRM_DEBUG_DRIVER("\n");
-       reg_clear(ldev->regs, LTDC_IER, IER_LIE);
-}
-
-bool ltdc_crtc_scanoutpos(struct drm_device *ddev, unsigned int pipe,
-                         bool in_vblank_irq, int *vpos, int *hpos,
-                         ktime_t *stime, ktime_t *etime,
-                         const struct drm_display_mode *mode)
+static bool ltdc_crtc_get_scanout_position(struct drm_crtc *crtc,
+                                          bool in_vblank_irq,
+                                          int *vpos, int *hpos,
+                                          ktime_t *stime, ktime_t *etime,
+                                          const struct drm_display_mode *mode)
 {
+       struct drm_device *ddev = crtc->dev;
        struct ltdc_device *ldev = ddev->dev_private;
        int line, vactive_start, vactive_end, vtotal;

@@ -710,6 +685,34 @@ bool ltdc_crtc_scanoutpos(struct drm_device *ddev, unsigned int pipe,
        return true;
 }

+static const struct drm_crtc_helper_funcs ltdc_crtc_helper_funcs = {
+       .mode_valid = ltdc_crtc_mode_valid,
+       .mode_fixup = ltdc_crtc_mode_fixup,
+       .mode_set_nofb = ltdc_crtc_mode_set_nofb,
+       .atomic_flush = ltdc_crtc_atomic_flush,
+       .atomic_enable = ltdc_crtc_atomic_enable,
+       .atomic_disable = ltdc_crtc_atomic_disable,
+       .get_scanout_position = ltdc_crtc_get_scanout_position,
+};
+
+static int ltdc_crtc_enable_vblank(struct drm_crtc *crtc)
+{
+       struct ltdc_device *ldev = crtc_to_ltdc(crtc);
+
+       DRM_DEBUG_DRIVER("\n");
+       reg_set(ldev->regs, LTDC_IER, IER_LIE);
+
+       return 0;
+}
+
+static void ltdc_crtc_disable_vblank(struct drm_crtc *crtc)
+{
+       struct ltdc_device *ldev = crtc_to_ltdc(crtc);
+
+       DRM_DEBUG_DRIVER("\n");
+       reg_clear(ldev->regs, LTDC_IER, IER_LIE);
+}
+
 static const struct drm_crtc_funcs ltdc_crtc_funcs = {
        .destroy = drm_crtc_cleanup,
        .set_config = drm_atomic_helper_set_config,
diff --git a/drivers/gpu/drm/stm/ltdc.h b/drivers/gpu/drm/stm/ltdc.h
index a1ad0ae3b006..c5467d74e707 100644
--- a/drivers/gpu/drm/stm/ltdc.h
+++ b/drivers/gpu/drm/stm/ltdc.h
@@ -39,11 +39,6 @@ struct ltdc_device {
        struct drm_atomic_state *suspend_state;
 };

-bool ltdc_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe,
-                         bool in_vblank_irq, int *vpos, int *hpos,
-                         ktime_t *stime, ktime_t *etime,
-                         const struct drm_display_mode *mode);
-
 int ltdc_load(struct drm_device *ddev);
 void ltdc_unload(struct drm_device *ddev);
 void ltdc_suspend(struct drm_device *ddev);



[-- Attachment #1.2: Type: text/html, Size: 5161 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* Re: [PATCH 08/23] drm/stm: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
@ 2020-01-14 15:31     ` Yannick FERTRE
  0 siblings, 0 replies; 217+ messages in thread
From: Yannick FERTRE @ 2020-01-14 15:31 UTC (permalink / raw)
  To: Thomas Zimmermann, airlied, daniel, alexander.deucher,
	christian.koenig, David1.Zhou, maarten.lankhorst,
	patrik.r.jakobsson, robdclark, sean, benjamin.gaignard,
	Vincent ABRIOU, Philippe CORNU, mcoquelin.stm32,
	Alexandre TORGUE, eric, rodrigosiqueiramelo, hamohammed.sa,
	linux-graphics-maintainer, thellstrom, bskeggs, harry.wentland,
	sunpeng.li, jani.nikula, joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, nouveau, freedreno


[-- Attachment #1.1: Type: text/plain, Size: 4872 bytes --]

Thanks for the patch.

Tested-by: Yannick Fertré <yannick.fertre@st.com><mailto:yannick.fertre@st.com>

BR
Yannick Fertré


On 1/10/20 10:21 AM, Thomas Zimmermann wrote:

The callback struct drm_driver.get_scanout_position() is deprecated in
favor of struct drm_crtc_helper_funcs.get_scanout_position(). Convert stm
over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de><mailto:tzimmermann@suse.de>
---
 drivers/gpu/drm/stm/drv.c  |  1 -
 drivers/gpu/drm/stm/ltdc.c | 65 ++++++++++++++++++++------------------
 drivers/gpu/drm/stm/ltdc.h |  5 ---
 3 files changed, 34 insertions(+), 37 deletions(-)

diff --git a/drivers/gpu/drm/stm/drv.c b/drivers/gpu/drm/stm/drv.c
index 5a9f9aca8bc2..486985604109 100644
--- a/drivers/gpu/drm/stm/drv.c
+++ b/drivers/gpu/drm/stm/drv.c
@@ -72,7 +72,6 @@ static struct drm_driver drv_driver = {
        .gem_prime_vmap = drm_gem_cma_prime_vmap,
        .gem_prime_vunmap = drm_gem_cma_prime_vunmap,
        .gem_prime_mmap = drm_gem_cma_prime_mmap,
-       .get_scanout_position = ltdc_crtc_scanoutpos,
        .get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
 };

diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
index c2815e8ae1da..8b6d1a2252e3 100644
--- a/drivers/gpu/drm/stm/ltdc.c
+++ b/drivers/gpu/drm/stm/ltdc.c
@@ -636,38 +636,13 @@ static void ltdc_crtc_atomic_flush(struct drm_crtc *crtc,
        }
 }

-static const struct drm_crtc_helper_funcs ltdc_crtc_helper_funcs = {
-       .mode_valid = ltdc_crtc_mode_valid,
-       .mode_fixup = ltdc_crtc_mode_fixup,
-       .mode_set_nofb = ltdc_crtc_mode_set_nofb,
-       .atomic_flush = ltdc_crtc_atomic_flush,
-       .atomic_enable = ltdc_crtc_atomic_enable,
-       .atomic_disable = ltdc_crtc_atomic_disable,
-};
-
-static int ltdc_crtc_enable_vblank(struct drm_crtc *crtc)
-{
-       struct ltdc_device *ldev = crtc_to_ltdc(crtc);
-
-       DRM_DEBUG_DRIVER("\n");
-       reg_set(ldev->regs, LTDC_IER, IER_LIE);
-
-       return 0;
-}
-
-static void ltdc_crtc_disable_vblank(struct drm_crtc *crtc)
-{
-       struct ltdc_device *ldev = crtc_to_ltdc(crtc);
-
-       DRM_DEBUG_DRIVER("\n");
-       reg_clear(ldev->regs, LTDC_IER, IER_LIE);
-}
-
-bool ltdc_crtc_scanoutpos(struct drm_device *ddev, unsigned int pipe,
-                         bool in_vblank_irq, int *vpos, int *hpos,
-                         ktime_t *stime, ktime_t *etime,
-                         const struct drm_display_mode *mode)
+static bool ltdc_crtc_get_scanout_position(struct drm_crtc *crtc,
+                                          bool in_vblank_irq,
+                                          int *vpos, int *hpos,
+                                          ktime_t *stime, ktime_t *etime,
+                                          const struct drm_display_mode *mode)
 {
+       struct drm_device *ddev = crtc->dev;
        struct ltdc_device *ldev = ddev->dev_private;
        int line, vactive_start, vactive_end, vtotal;

@@ -710,6 +685,34 @@ bool ltdc_crtc_scanoutpos(struct drm_device *ddev, unsigned int pipe,
        return true;
 }

+static const struct drm_crtc_helper_funcs ltdc_crtc_helper_funcs = {
+       .mode_valid = ltdc_crtc_mode_valid,
+       .mode_fixup = ltdc_crtc_mode_fixup,
+       .mode_set_nofb = ltdc_crtc_mode_set_nofb,
+       .atomic_flush = ltdc_crtc_atomic_flush,
+       .atomic_enable = ltdc_crtc_atomic_enable,
+       .atomic_disable = ltdc_crtc_atomic_disable,
+       .get_scanout_position = ltdc_crtc_get_scanout_position,
+};
+
+static int ltdc_crtc_enable_vblank(struct drm_crtc *crtc)
+{
+       struct ltdc_device *ldev = crtc_to_ltdc(crtc);
+
+       DRM_DEBUG_DRIVER("\n");
+       reg_set(ldev->regs, LTDC_IER, IER_LIE);
+
+       return 0;
+}
+
+static void ltdc_crtc_disable_vblank(struct drm_crtc *crtc)
+{
+       struct ltdc_device *ldev = crtc_to_ltdc(crtc);
+
+       DRM_DEBUG_DRIVER("\n");
+       reg_clear(ldev->regs, LTDC_IER, IER_LIE);
+}
+
 static const struct drm_crtc_funcs ltdc_crtc_funcs = {
        .destroy = drm_crtc_cleanup,
        .set_config = drm_atomic_helper_set_config,
diff --git a/drivers/gpu/drm/stm/ltdc.h b/drivers/gpu/drm/stm/ltdc.h
index a1ad0ae3b006..c5467d74e707 100644
--- a/drivers/gpu/drm/stm/ltdc.h
+++ b/drivers/gpu/drm/stm/ltdc.h
@@ -39,11 +39,6 @@ struct ltdc_device {
        struct drm_atomic_state *suspend_state;
 };

-bool ltdc_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe,
-                         bool in_vblank_irq, int *vpos, int *hpos,
-                         ktime_t *stime, ktime_t *etime,
-                         const struct drm_display_mode *mode);
-
 int ltdc_load(struct drm_device *ddev);
 void ltdc_unload(struct drm_device *ddev);
 void ltdc_suspend(struct drm_device *ddev);



[-- Attachment #1.2: Type: text/html, Size: 5161 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* Re: [Intel-gfx] [PATCH 08/23] drm/stm: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
@ 2020-01-14 15:31     ` Yannick FERTRE
  0 siblings, 0 replies; 217+ messages in thread
From: Yannick FERTRE @ 2020-01-14 15:31 UTC (permalink / raw)
  To: Thomas Zimmermann, airlied, daniel, alexander.deucher,
	christian.koenig, David1.Zhou, maarten.lankhorst,
	patrik.r.jakobsson, robdclark, sean, benjamin.gaignard,
	Vincent ABRIOU, Philippe CORNU, mcoquelin.stm32,
	Alexandre TORGUE, eric, rodrigosiqueiramelo, hamohammed.sa,
	linux-graphics-maintainer, thellstrom, bskeggs, harry.wentland,
	sunpeng.li, jani.nikula, joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, nouveau, freedreno


[-- Attachment #1.1: Type: text/plain, Size: 4872 bytes --]

Thanks for the patch.

Tested-by: Yannick Fertré <yannick.fertre@st.com><mailto:yannick.fertre@st.com>

BR
Yannick Fertré


On 1/10/20 10:21 AM, Thomas Zimmermann wrote:

The callback struct drm_driver.get_scanout_position() is deprecated in
favor of struct drm_crtc_helper_funcs.get_scanout_position(). Convert stm
over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de><mailto:tzimmermann@suse.de>
---
 drivers/gpu/drm/stm/drv.c  |  1 -
 drivers/gpu/drm/stm/ltdc.c | 65 ++++++++++++++++++++------------------
 drivers/gpu/drm/stm/ltdc.h |  5 ---
 3 files changed, 34 insertions(+), 37 deletions(-)

diff --git a/drivers/gpu/drm/stm/drv.c b/drivers/gpu/drm/stm/drv.c
index 5a9f9aca8bc2..486985604109 100644
--- a/drivers/gpu/drm/stm/drv.c
+++ b/drivers/gpu/drm/stm/drv.c
@@ -72,7 +72,6 @@ static struct drm_driver drv_driver = {
        .gem_prime_vmap = drm_gem_cma_prime_vmap,
        .gem_prime_vunmap = drm_gem_cma_prime_vunmap,
        .gem_prime_mmap = drm_gem_cma_prime_mmap,
-       .get_scanout_position = ltdc_crtc_scanoutpos,
        .get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
 };

diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
index c2815e8ae1da..8b6d1a2252e3 100644
--- a/drivers/gpu/drm/stm/ltdc.c
+++ b/drivers/gpu/drm/stm/ltdc.c
@@ -636,38 +636,13 @@ static void ltdc_crtc_atomic_flush(struct drm_crtc *crtc,
        }
 }

-static const struct drm_crtc_helper_funcs ltdc_crtc_helper_funcs = {
-       .mode_valid = ltdc_crtc_mode_valid,
-       .mode_fixup = ltdc_crtc_mode_fixup,
-       .mode_set_nofb = ltdc_crtc_mode_set_nofb,
-       .atomic_flush = ltdc_crtc_atomic_flush,
-       .atomic_enable = ltdc_crtc_atomic_enable,
-       .atomic_disable = ltdc_crtc_atomic_disable,
-};
-
-static int ltdc_crtc_enable_vblank(struct drm_crtc *crtc)
-{
-       struct ltdc_device *ldev = crtc_to_ltdc(crtc);
-
-       DRM_DEBUG_DRIVER("\n");
-       reg_set(ldev->regs, LTDC_IER, IER_LIE);
-
-       return 0;
-}
-
-static void ltdc_crtc_disable_vblank(struct drm_crtc *crtc)
-{
-       struct ltdc_device *ldev = crtc_to_ltdc(crtc);
-
-       DRM_DEBUG_DRIVER("\n");
-       reg_clear(ldev->regs, LTDC_IER, IER_LIE);
-}
-
-bool ltdc_crtc_scanoutpos(struct drm_device *ddev, unsigned int pipe,
-                         bool in_vblank_irq, int *vpos, int *hpos,
-                         ktime_t *stime, ktime_t *etime,
-                         const struct drm_display_mode *mode)
+static bool ltdc_crtc_get_scanout_position(struct drm_crtc *crtc,
+                                          bool in_vblank_irq,
+                                          int *vpos, int *hpos,
+                                          ktime_t *stime, ktime_t *etime,
+                                          const struct drm_display_mode *mode)
 {
+       struct drm_device *ddev = crtc->dev;
        struct ltdc_device *ldev = ddev->dev_private;
        int line, vactive_start, vactive_end, vtotal;

@@ -710,6 +685,34 @@ bool ltdc_crtc_scanoutpos(struct drm_device *ddev, unsigned int pipe,
        return true;
 }

+static const struct drm_crtc_helper_funcs ltdc_crtc_helper_funcs = {
+       .mode_valid = ltdc_crtc_mode_valid,
+       .mode_fixup = ltdc_crtc_mode_fixup,
+       .mode_set_nofb = ltdc_crtc_mode_set_nofb,
+       .atomic_flush = ltdc_crtc_atomic_flush,
+       .atomic_enable = ltdc_crtc_atomic_enable,
+       .atomic_disable = ltdc_crtc_atomic_disable,
+       .get_scanout_position = ltdc_crtc_get_scanout_position,
+};
+
+static int ltdc_crtc_enable_vblank(struct drm_crtc *crtc)
+{
+       struct ltdc_device *ldev = crtc_to_ltdc(crtc);
+
+       DRM_DEBUG_DRIVER("\n");
+       reg_set(ldev->regs, LTDC_IER, IER_LIE);
+
+       return 0;
+}
+
+static void ltdc_crtc_disable_vblank(struct drm_crtc *crtc)
+{
+       struct ltdc_device *ldev = crtc_to_ltdc(crtc);
+
+       DRM_DEBUG_DRIVER("\n");
+       reg_clear(ldev->regs, LTDC_IER, IER_LIE);
+}
+
 static const struct drm_crtc_funcs ltdc_crtc_funcs = {
        .destroy = drm_crtc_cleanup,
        .set_config = drm_atomic_helper_set_config,
diff --git a/drivers/gpu/drm/stm/ltdc.h b/drivers/gpu/drm/stm/ltdc.h
index a1ad0ae3b006..c5467d74e707 100644
--- a/drivers/gpu/drm/stm/ltdc.h
+++ b/drivers/gpu/drm/stm/ltdc.h
@@ -39,11 +39,6 @@ struct ltdc_device {
        struct drm_atomic_state *suspend_state;
 };

-bool ltdc_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe,
-                         bool in_vblank_irq, int *vpos, int *hpos,
-                         ktime_t *stime, ktime_t *etime,
-                         const struct drm_display_mode *mode);
-
 int ltdc_load(struct drm_device *ddev);
 void ltdc_unload(struct drm_device *ddev);
 void ltdc_suspend(struct drm_device *ddev);



[-- Attachment #1.2: Type: text/html, Size: 5161 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* Re: [PATCH 08/23] drm/stm: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
@ 2020-01-14 15:31     ` Yannick FERTRE
  0 siblings, 0 replies; 217+ messages in thread
From: Yannick FERTRE @ 2020-01-14 15:31 UTC (permalink / raw)
  To: Thomas Zimmermann, airlied, daniel, alexander.deucher,
	christian.koenig, David1.Zhou, maarten.lankhorst,
	patrik.r.jakobsson, robdclark, sean, benjamin.gaignard,
	Vincent ABRIOU, Philippe CORNU, mcoquelin.stm32,
	Alexandre TORGUE, eric, rodrigosiqueiramelo, hamohammed.sa,
	linux-graphics-maintainer, thellstrom, bskeggs, harry.wentland,
	sunpeng.li, jani.nikula, joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, nouveau, freedreno


[-- Attachment #1.1: Type: text/plain, Size: 4872 bytes --]

Thanks for the patch.

Tested-by: Yannick Fertré <yannick.fertre@st.com><mailto:yannick.fertre@st.com>

BR
Yannick Fertré


On 1/10/20 10:21 AM, Thomas Zimmermann wrote:

The callback struct drm_driver.get_scanout_position() is deprecated in
favor of struct drm_crtc_helper_funcs.get_scanout_position(). Convert stm
over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de><mailto:tzimmermann@suse.de>
---
 drivers/gpu/drm/stm/drv.c  |  1 -
 drivers/gpu/drm/stm/ltdc.c | 65 ++++++++++++++++++++------------------
 drivers/gpu/drm/stm/ltdc.h |  5 ---
 3 files changed, 34 insertions(+), 37 deletions(-)

diff --git a/drivers/gpu/drm/stm/drv.c b/drivers/gpu/drm/stm/drv.c
index 5a9f9aca8bc2..486985604109 100644
--- a/drivers/gpu/drm/stm/drv.c
+++ b/drivers/gpu/drm/stm/drv.c
@@ -72,7 +72,6 @@ static struct drm_driver drv_driver = {
        .gem_prime_vmap = drm_gem_cma_prime_vmap,
        .gem_prime_vunmap = drm_gem_cma_prime_vunmap,
        .gem_prime_mmap = drm_gem_cma_prime_mmap,
-       .get_scanout_position = ltdc_crtc_scanoutpos,
        .get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
 };

diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
index c2815e8ae1da..8b6d1a2252e3 100644
--- a/drivers/gpu/drm/stm/ltdc.c
+++ b/drivers/gpu/drm/stm/ltdc.c
@@ -636,38 +636,13 @@ static void ltdc_crtc_atomic_flush(struct drm_crtc *crtc,
        }
 }

-static const struct drm_crtc_helper_funcs ltdc_crtc_helper_funcs = {
-       .mode_valid = ltdc_crtc_mode_valid,
-       .mode_fixup = ltdc_crtc_mode_fixup,
-       .mode_set_nofb = ltdc_crtc_mode_set_nofb,
-       .atomic_flush = ltdc_crtc_atomic_flush,
-       .atomic_enable = ltdc_crtc_atomic_enable,
-       .atomic_disable = ltdc_crtc_atomic_disable,
-};
-
-static int ltdc_crtc_enable_vblank(struct drm_crtc *crtc)
-{
-       struct ltdc_device *ldev = crtc_to_ltdc(crtc);
-
-       DRM_DEBUG_DRIVER("\n");
-       reg_set(ldev->regs, LTDC_IER, IER_LIE);
-
-       return 0;
-}
-
-static void ltdc_crtc_disable_vblank(struct drm_crtc *crtc)
-{
-       struct ltdc_device *ldev = crtc_to_ltdc(crtc);
-
-       DRM_DEBUG_DRIVER("\n");
-       reg_clear(ldev->regs, LTDC_IER, IER_LIE);
-}
-
-bool ltdc_crtc_scanoutpos(struct drm_device *ddev, unsigned int pipe,
-                         bool in_vblank_irq, int *vpos, int *hpos,
-                         ktime_t *stime, ktime_t *etime,
-                         const struct drm_display_mode *mode)
+static bool ltdc_crtc_get_scanout_position(struct drm_crtc *crtc,
+                                          bool in_vblank_irq,
+                                          int *vpos, int *hpos,
+                                          ktime_t *stime, ktime_t *etime,
+                                          const struct drm_display_mode *mode)
 {
+       struct drm_device *ddev = crtc->dev;
        struct ltdc_device *ldev = ddev->dev_private;
        int line, vactive_start, vactive_end, vtotal;

@@ -710,6 +685,34 @@ bool ltdc_crtc_scanoutpos(struct drm_device *ddev, unsigned int pipe,
        return true;
 }

+static const struct drm_crtc_helper_funcs ltdc_crtc_helper_funcs = {
+       .mode_valid = ltdc_crtc_mode_valid,
+       .mode_fixup = ltdc_crtc_mode_fixup,
+       .mode_set_nofb = ltdc_crtc_mode_set_nofb,
+       .atomic_flush = ltdc_crtc_atomic_flush,
+       .atomic_enable = ltdc_crtc_atomic_enable,
+       .atomic_disable = ltdc_crtc_atomic_disable,
+       .get_scanout_position = ltdc_crtc_get_scanout_position,
+};
+
+static int ltdc_crtc_enable_vblank(struct drm_crtc *crtc)
+{
+       struct ltdc_device *ldev = crtc_to_ltdc(crtc);
+
+       DRM_DEBUG_DRIVER("\n");
+       reg_set(ldev->regs, LTDC_IER, IER_LIE);
+
+       return 0;
+}
+
+static void ltdc_crtc_disable_vblank(struct drm_crtc *crtc)
+{
+       struct ltdc_device *ldev = crtc_to_ltdc(crtc);
+
+       DRM_DEBUG_DRIVER("\n");
+       reg_clear(ldev->regs, LTDC_IER, IER_LIE);
+}
+
 static const struct drm_crtc_funcs ltdc_crtc_funcs = {
        .destroy = drm_crtc_cleanup,
        .set_config = drm_atomic_helper_set_config,
diff --git a/drivers/gpu/drm/stm/ltdc.h b/drivers/gpu/drm/stm/ltdc.h
index a1ad0ae3b006..c5467d74e707 100644
--- a/drivers/gpu/drm/stm/ltdc.h
+++ b/drivers/gpu/drm/stm/ltdc.h
@@ -39,11 +39,6 @@ struct ltdc_device {
        struct drm_atomic_state *suspend_state;
 };

-bool ltdc_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe,
-                         bool in_vblank_irq, int *vpos, int *hpos,
-                         ktime_t *stime, ktime_t *etime,
-                         const struct drm_display_mode *mode);
-
 int ltdc_load(struct drm_device *ddev);
 void ltdc_unload(struct drm_device *ddev);
 void ltdc_suspend(struct drm_device *ddev);



[-- Attachment #1.2: Type: text/html, Size: 5161 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* Re: [PATCH 09/23] drm: Remove struct drm_driver.get_scanout_position()
  2020-01-10  9:21   ` Thomas Zimmermann
  (?)
  (?)
@ 2020-01-14 15:32     ` Yannick FERTRE
  -1 siblings, 0 replies; 217+ messages in thread
From: Yannick FERTRE @ 2020-01-14 15:32 UTC (permalink / raw)
  To: Thomas Zimmermann, airlied, daniel, alexander.deucher,
	christian.koenig, David1.Zhou, maarten.lankhorst,
	patrik.r.jakobsson, robdclark, sean, benjamin.gaignard,
	Vincent ABRIOU, Philippe CORNU, mcoquelin.stm32,
	Alexandre TORGUE, eric, rodrigosiqueiramelo,
	hamohammed.sa@gmail.com
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, nouveau, freedreno


[-- Attachment #1.1: Type: text/plain, Size: 5028 bytes --]

Thanks for the patch.

Tested-by: Yannick Fertré <yannick.fertre@st.com><mailto:yannick.fertre@st.com>

BR
Yannick Fertré


On 1/10/20 10:21 AM, Thomas Zimmermann wrote:

All users of struct drm_driver.get_scanout_position() have been
covnerted to the respective CRTC helper function. Remove the callback
from struct drm_driver.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de><mailto:tzimmermann@suse.de>
---
 drivers/gpu/drm/drm_vblank.c | 13 ++-------
 include/drm/drm_drv.h        | 52 ------------------------------------
 2 files changed, 2 insertions(+), 63 deletions(-)

diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
index c12f0b333e14..b84065911d69 100644
--- a/drivers/gpu/drm/drm_vblank.c
+++ b/drivers/gpu/drm/drm_vblank.c
@@ -633,8 +633,7 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
        }

        /* Scanout position query not supported? Should not happen. */
-       if (!dev->driver->get_scanout_position ||
-           !crtc->helper_private->get_scanout_position) {
+       if (!crtc->helper_private->get_scanout_position) {
                DRM_ERROR("Called from CRTC w/o get_scanout_position()!?\n");
                return false;
        }
@@ -666,17 +665,9 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
                 * Get vertical and horizontal scanout position vpos, hpos,
                 * and bounding timestamps stime, etime, pre/post query.
                 */
-               if (crtc->helper_private->get_scanout_position) {
-                       vbl_status =
-                               crtc->helper_private->get_scanout_position(
+               vbl_status = crtc->helper_private->get_scanout_position(
                                        crtc, in_vblank_irq, &vpos, &hpos,
                                        &stime, &etime, mode);
-               } else {
-                       vbl_status =
-                               dev->driver->get_scanout_position(
-                                       dev, pipe, in_vblank_irq, &vpos,
-                                       &hpos, &stime, &etime, mode);
-               }

                /* Return as no-op if scanout query unsupported or failed. */
                if (!vbl_status) {
diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
index d0049e5786fc..b704e252f3b2 100644
--- a/include/drm/drm_drv.h
+++ b/include/drm/drm_drv.h
@@ -318,58 +318,6 @@ struct drm_driver {
         */
        void (*disable_vblank) (struct drm_device *dev, unsigned int pipe);

-       /**
-        * @get_scanout_position:
-        *
-        * Called by vblank timestamping code.
-        *
-        * Returns the current display scanout position from a crtc, and an
-        * optional accurate ktime_get() timestamp of when position was
-        * measured. Note that this is a helper callback which is only used if a
-        * driver uses drm_calc_vbltimestamp_from_scanoutpos() for the
-        * @get_vblank_timestamp callback.
-        *
-        * Parameters:
-        *
-        * dev:
-        *     DRM device.
-        * pipe:
-        *     Id of the crtc to query.
-        * in_vblank_irq:
-        *     True when called from drm_crtc_handle_vblank().  Some drivers
-        *     need to apply some workarounds for gpu-specific vblank irq quirks
-        *     if flag is set.
-        * vpos:
-        *     Target location for current vertical scanout position.
-        * hpos:
-        *     Target location for current horizontal scanout position.
-        * stime:
-        *     Target location for timestamp taken immediately before
-        *     scanout position query. Can be NULL to skip timestamp.
-        * etime:
-        *     Target location for timestamp taken immediately after
-        *     scanout position query. Can be NULL to skip timestamp.
-        * mode:
-        *     Current display timings.
-        *
-        * Returns vpos as a positive number while in active scanout area.
-        * Returns vpos as a negative number inside vblank, counting the number
-        * of scanlines to go until end of vblank, e.g., -1 means "one scanline
-        * until start of active scanout / end of vblank."
-        *
-        * Returns:
-        *
-        * True on success, false if a reliable scanout position counter could
-        * not be read out.
-        *
-        * This is deprecated and should not be used by new drivers.
-        * Use &drm_crtc_helper_funcs.get_scanout_position instead.
-        */
-       bool (*get_scanout_position) (struct drm_device *dev, unsigned int pipe,
-                                     bool in_vblank_irq, int *vpos, int *hpos,
-                                     ktime_t *stime, ktime_t *etime,
-                                     const struct drm_display_mode *mode);
-
        /**
         * @get_vblank_timestamp:
         *



[-- Attachment #1.2: Type: text/html, Size: 4828 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* Re: [PATCH 09/23] drm: Remove struct drm_driver.get_scanout_position()
@ 2020-01-14 15:32     ` Yannick FERTRE
  0 siblings, 0 replies; 217+ messages in thread
From: Yannick FERTRE @ 2020-01-14 15:32 UTC (permalink / raw)
  To: Thomas Zimmermann, airlied, daniel, alexander.deucher,
	christian.koenig, David1.Zhou, maarten.lankhorst,
	patrik.r.jakobsson, robdclark, sean, benjamin.gaignard,
	Vincent ABRIOU, Philippe CORNU, mcoquelin.stm32,
	Alexandre TORGUE, eric, rodrigosiqueiramelo, hamohammed.sa,
	linux-graphics-maintainer, thellstrom, bskeggs, harry.wentland,
	sunpeng.li, jani.nikula, joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, nouveau, freedreno


[-- Attachment #1.1: Type: text/plain, Size: 5028 bytes --]

Thanks for the patch.

Tested-by: Yannick Fertré <yannick.fertre@st.com><mailto:yannick.fertre@st.com>

BR
Yannick Fertré


On 1/10/20 10:21 AM, Thomas Zimmermann wrote:

All users of struct drm_driver.get_scanout_position() have been
covnerted to the respective CRTC helper function. Remove the callback
from struct drm_driver.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de><mailto:tzimmermann@suse.de>
---
 drivers/gpu/drm/drm_vblank.c | 13 ++-------
 include/drm/drm_drv.h        | 52 ------------------------------------
 2 files changed, 2 insertions(+), 63 deletions(-)

diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
index c12f0b333e14..b84065911d69 100644
--- a/drivers/gpu/drm/drm_vblank.c
+++ b/drivers/gpu/drm/drm_vblank.c
@@ -633,8 +633,7 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
        }

        /* Scanout position query not supported? Should not happen. */
-       if (!dev->driver->get_scanout_position ||
-           !crtc->helper_private->get_scanout_position) {
+       if (!crtc->helper_private->get_scanout_position) {
                DRM_ERROR("Called from CRTC w/o get_scanout_position()!?\n");
                return false;
        }
@@ -666,17 +665,9 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
                 * Get vertical and horizontal scanout position vpos, hpos,
                 * and bounding timestamps stime, etime, pre/post query.
                 */
-               if (crtc->helper_private->get_scanout_position) {
-                       vbl_status =
-                               crtc->helper_private->get_scanout_position(
+               vbl_status = crtc->helper_private->get_scanout_position(
                                        crtc, in_vblank_irq, &vpos, &hpos,
                                        &stime, &etime, mode);
-               } else {
-                       vbl_status =
-                               dev->driver->get_scanout_position(
-                                       dev, pipe, in_vblank_irq, &vpos,
-                                       &hpos, &stime, &etime, mode);
-               }

                /* Return as no-op if scanout query unsupported or failed. */
                if (!vbl_status) {
diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
index d0049e5786fc..b704e252f3b2 100644
--- a/include/drm/drm_drv.h
+++ b/include/drm/drm_drv.h
@@ -318,58 +318,6 @@ struct drm_driver {
         */
        void (*disable_vblank) (struct drm_device *dev, unsigned int pipe);

-       /**
-        * @get_scanout_position:
-        *
-        * Called by vblank timestamping code.
-        *
-        * Returns the current display scanout position from a crtc, and an
-        * optional accurate ktime_get() timestamp of when position was
-        * measured. Note that this is a helper callback which is only used if a
-        * driver uses drm_calc_vbltimestamp_from_scanoutpos() for the
-        * @get_vblank_timestamp callback.
-        *
-        * Parameters:
-        *
-        * dev:
-        *     DRM device.
-        * pipe:
-        *     Id of the crtc to query.
-        * in_vblank_irq:
-        *     True when called from drm_crtc_handle_vblank().  Some drivers
-        *     need to apply some workarounds for gpu-specific vblank irq quirks
-        *     if flag is set.
-        * vpos:
-        *     Target location for current vertical scanout position.
-        * hpos:
-        *     Target location for current horizontal scanout position.
-        * stime:
-        *     Target location for timestamp taken immediately before
-        *     scanout position query. Can be NULL to skip timestamp.
-        * etime:
-        *     Target location for timestamp taken immediately after
-        *     scanout position query. Can be NULL to skip timestamp.
-        * mode:
-        *     Current display timings.
-        *
-        * Returns vpos as a positive number while in active scanout area.
-        * Returns vpos as a negative number inside vblank, counting the number
-        * of scanlines to go until end of vblank, e.g., -1 means "one scanline
-        * until start of active scanout / end of vblank."
-        *
-        * Returns:
-        *
-        * True on success, false if a reliable scanout position counter could
-        * not be read out.
-        *
-        * This is deprecated and should not be used by new drivers.
-        * Use &drm_crtc_helper_funcs.get_scanout_position instead.
-        */
-       bool (*get_scanout_position) (struct drm_device *dev, unsigned int pipe,
-                                     bool in_vblank_irq, int *vpos, int *hpos,
-                                     ktime_t *stime, ktime_t *etime,
-                                     const struct drm_display_mode *mode);
-
        /**
         * @get_vblank_timestamp:
         *



[-- Attachment #1.2: Type: text/html, Size: 4828 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* Re: [Intel-gfx] [PATCH 09/23] drm: Remove struct drm_driver.get_scanout_position()
@ 2020-01-14 15:32     ` Yannick FERTRE
  0 siblings, 0 replies; 217+ messages in thread
From: Yannick FERTRE @ 2020-01-14 15:32 UTC (permalink / raw)
  To: Thomas Zimmermann, airlied, daniel, alexander.deucher,
	christian.koenig, David1.Zhou, maarten.lankhorst,
	patrik.r.jakobsson, robdclark, sean, benjamin.gaignard,
	Vincent ABRIOU, Philippe CORNU, mcoquelin.stm32,
	Alexandre TORGUE, eric, rodrigosiqueiramelo, hamohammed.sa,
	linux-graphics-maintainer, thellstrom, bskeggs, harry.wentland,
	sunpeng.li, jani.nikula, joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, nouveau, freedreno


[-- Attachment #1.1: Type: text/plain, Size: 5028 bytes --]

Thanks for the patch.

Tested-by: Yannick Fertré <yannick.fertre@st.com><mailto:yannick.fertre@st.com>

BR
Yannick Fertré


On 1/10/20 10:21 AM, Thomas Zimmermann wrote:

All users of struct drm_driver.get_scanout_position() have been
covnerted to the respective CRTC helper function. Remove the callback
from struct drm_driver.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de><mailto:tzimmermann@suse.de>
---
 drivers/gpu/drm/drm_vblank.c | 13 ++-------
 include/drm/drm_drv.h        | 52 ------------------------------------
 2 files changed, 2 insertions(+), 63 deletions(-)

diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
index c12f0b333e14..b84065911d69 100644
--- a/drivers/gpu/drm/drm_vblank.c
+++ b/drivers/gpu/drm/drm_vblank.c
@@ -633,8 +633,7 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
        }

        /* Scanout position query not supported? Should not happen. */
-       if (!dev->driver->get_scanout_position ||
-           !crtc->helper_private->get_scanout_position) {
+       if (!crtc->helper_private->get_scanout_position) {
                DRM_ERROR("Called from CRTC w/o get_scanout_position()!?\n");
                return false;
        }
@@ -666,17 +665,9 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
                 * Get vertical and horizontal scanout position vpos, hpos,
                 * and bounding timestamps stime, etime, pre/post query.
                 */
-               if (crtc->helper_private->get_scanout_position) {
-                       vbl_status =
-                               crtc->helper_private->get_scanout_position(
+               vbl_status = crtc->helper_private->get_scanout_position(
                                        crtc, in_vblank_irq, &vpos, &hpos,
                                        &stime, &etime, mode);
-               } else {
-                       vbl_status =
-                               dev->driver->get_scanout_position(
-                                       dev, pipe, in_vblank_irq, &vpos,
-                                       &hpos, &stime, &etime, mode);
-               }

                /* Return as no-op if scanout query unsupported or failed. */
                if (!vbl_status) {
diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
index d0049e5786fc..b704e252f3b2 100644
--- a/include/drm/drm_drv.h
+++ b/include/drm/drm_drv.h
@@ -318,58 +318,6 @@ struct drm_driver {
         */
        void (*disable_vblank) (struct drm_device *dev, unsigned int pipe);

-       /**
-        * @get_scanout_position:
-        *
-        * Called by vblank timestamping code.
-        *
-        * Returns the current display scanout position from a crtc, and an
-        * optional accurate ktime_get() timestamp of when position was
-        * measured. Note that this is a helper callback which is only used if a
-        * driver uses drm_calc_vbltimestamp_from_scanoutpos() for the
-        * @get_vblank_timestamp callback.
-        *
-        * Parameters:
-        *
-        * dev:
-        *     DRM device.
-        * pipe:
-        *     Id of the crtc to query.
-        * in_vblank_irq:
-        *     True when called from drm_crtc_handle_vblank().  Some drivers
-        *     need to apply some workarounds for gpu-specific vblank irq quirks
-        *     if flag is set.
-        * vpos:
-        *     Target location for current vertical scanout position.
-        * hpos:
-        *     Target location for current horizontal scanout position.
-        * stime:
-        *     Target location for timestamp taken immediately before
-        *     scanout position query. Can be NULL to skip timestamp.
-        * etime:
-        *     Target location for timestamp taken immediately after
-        *     scanout position query. Can be NULL to skip timestamp.
-        * mode:
-        *     Current display timings.
-        *
-        * Returns vpos as a positive number while in active scanout area.
-        * Returns vpos as a negative number inside vblank, counting the number
-        * of scanlines to go until end of vblank, e.g., -1 means "one scanline
-        * until start of active scanout / end of vblank."
-        *
-        * Returns:
-        *
-        * True on success, false if a reliable scanout position counter could
-        * not be read out.
-        *
-        * This is deprecated and should not be used by new drivers.
-        * Use &drm_crtc_helper_funcs.get_scanout_position instead.
-        */
-       bool (*get_scanout_position) (struct drm_device *dev, unsigned int pipe,
-                                     bool in_vblank_irq, int *vpos, int *hpos,
-                                     ktime_t *stime, ktime_t *etime,
-                                     const struct drm_display_mode *mode);
-
        /**
         * @get_vblank_timestamp:
         *



[-- Attachment #1.2: Type: text/html, Size: 4828 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* Re: [PATCH 09/23] drm: Remove struct drm_driver.get_scanout_position()
@ 2020-01-14 15:32     ` Yannick FERTRE
  0 siblings, 0 replies; 217+ messages in thread
From: Yannick FERTRE @ 2020-01-14 15:32 UTC (permalink / raw)
  To: Thomas Zimmermann, airlied, daniel, alexander.deucher,
	christian.koenig, David1.Zhou, maarten.lankhorst,
	patrik.r.jakobsson, robdclark, sean, benjamin.gaignard,
	Vincent ABRIOU, Philippe CORNU, mcoquelin.stm32,
	Alexandre TORGUE, eric, rodrigosiqueiramelo, hamohammed.sa,
	linux-graphics-maintainer, thellstrom, bskeggs, harry.wentland,
	sunpeng.li, jani.nikula, joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, nouveau, freedreno


[-- Attachment #1.1: Type: text/plain, Size: 5028 bytes --]

Thanks for the patch.

Tested-by: Yannick Fertré <yannick.fertre@st.com><mailto:yannick.fertre@st.com>

BR
Yannick Fertré


On 1/10/20 10:21 AM, Thomas Zimmermann wrote:

All users of struct drm_driver.get_scanout_position() have been
covnerted to the respective CRTC helper function. Remove the callback
from struct drm_driver.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de><mailto:tzimmermann@suse.de>
---
 drivers/gpu/drm/drm_vblank.c | 13 ++-------
 include/drm/drm_drv.h        | 52 ------------------------------------
 2 files changed, 2 insertions(+), 63 deletions(-)

diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
index c12f0b333e14..b84065911d69 100644
--- a/drivers/gpu/drm/drm_vblank.c
+++ b/drivers/gpu/drm/drm_vblank.c
@@ -633,8 +633,7 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
        }

        /* Scanout position query not supported? Should not happen. */
-       if (!dev->driver->get_scanout_position ||
-           !crtc->helper_private->get_scanout_position) {
+       if (!crtc->helper_private->get_scanout_position) {
                DRM_ERROR("Called from CRTC w/o get_scanout_position()!?\n");
                return false;
        }
@@ -666,17 +665,9 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
                 * Get vertical and horizontal scanout position vpos, hpos,
                 * and bounding timestamps stime, etime, pre/post query.
                 */
-               if (crtc->helper_private->get_scanout_position) {
-                       vbl_status =
-                               crtc->helper_private->get_scanout_position(
+               vbl_status = crtc->helper_private->get_scanout_position(
                                        crtc, in_vblank_irq, &vpos, &hpos,
                                        &stime, &etime, mode);
-               } else {
-                       vbl_status =
-                               dev->driver->get_scanout_position(
-                                       dev, pipe, in_vblank_irq, &vpos,
-                                       &hpos, &stime, &etime, mode);
-               }

                /* Return as no-op if scanout query unsupported or failed. */
                if (!vbl_status) {
diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
index d0049e5786fc..b704e252f3b2 100644
--- a/include/drm/drm_drv.h
+++ b/include/drm/drm_drv.h
@@ -318,58 +318,6 @@ struct drm_driver {
         */
        void (*disable_vblank) (struct drm_device *dev, unsigned int pipe);

-       /**
-        * @get_scanout_position:
-        *
-        * Called by vblank timestamping code.
-        *
-        * Returns the current display scanout position from a crtc, and an
-        * optional accurate ktime_get() timestamp of when position was
-        * measured. Note that this is a helper callback which is only used if a
-        * driver uses drm_calc_vbltimestamp_from_scanoutpos() for the
-        * @get_vblank_timestamp callback.
-        *
-        * Parameters:
-        *
-        * dev:
-        *     DRM device.
-        * pipe:
-        *     Id of the crtc to query.
-        * in_vblank_irq:
-        *     True when called from drm_crtc_handle_vblank().  Some drivers
-        *     need to apply some workarounds for gpu-specific vblank irq quirks
-        *     if flag is set.
-        * vpos:
-        *     Target location for current vertical scanout position.
-        * hpos:
-        *     Target location for current horizontal scanout position.
-        * stime:
-        *     Target location for timestamp taken immediately before
-        *     scanout position query. Can be NULL to skip timestamp.
-        * etime:
-        *     Target location for timestamp taken immediately after
-        *     scanout position query. Can be NULL to skip timestamp.
-        * mode:
-        *     Current display timings.
-        *
-        * Returns vpos as a positive number while in active scanout area.
-        * Returns vpos as a negative number inside vblank, counting the number
-        * of scanlines to go until end of vblank, e.g., -1 means "one scanline
-        * until start of active scanout / end of vblank."
-        *
-        * Returns:
-        *
-        * True on success, false if a reliable scanout position counter could
-        * not be read out.
-        *
-        * This is deprecated and should not be used by new drivers.
-        * Use &drm_crtc_helper_funcs.get_scanout_position instead.
-        */
-       bool (*get_scanout_position) (struct drm_device *dev, unsigned int pipe,
-                                     bool in_vblank_irq, int *vpos, int *hpos,
-                                     ktime_t *stime, ktime_t *etime,
-                                     const struct drm_display_mode *mode);
-
        /**
         * @get_vblank_timestamp:
         *



[-- Attachment #1.2: Type: text/html, Size: 4828 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* Re: [PATCH 19/23] drm/stm: Convert to CRTC VBLANK callbacks
  2020-01-10  9:21   ` Thomas Zimmermann
  (?)
  (?)
@ 2020-01-14 15:32     ` Yannick FERTRE
  -1 siblings, 0 replies; 217+ messages in thread
From: Yannick FERTRE @ 2020-01-14 15:32 UTC (permalink / raw)
  To: Thomas Zimmermann, airlied, daniel, alexander.deucher,
	christian.koenig, David1.Zhou, maarten.lankhorst,
	patrik.r.jakobsson, robdclark, sean, benjamin.gaignard,
	Vincent ABRIOU, Philippe CORNU, mcoquelin.stm32,
	Alexandre TORGUE, eric, rodrigosiqueiramelo,
	hamohammed.sa@gmail.com
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, nouveau, freedreno


[-- Attachment #1.1: Type: text/plain, Size: 1617 bytes --]

Thanks for the patch.

Tested-by: Yannick Fertré <yannick.fertre@st.com><mailto:yannick.fertre@st.com>

BR
Yannick Fertré


On 1/10/20 10:21 AM, Thomas Zimmermann wrote:

VBLANK callbacks in struct drm_driver are deprecated in favor of
their equivalents in struct drm_crtc_funcs. Convert stm over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de><mailto:tzimmermann@suse.de>
---
 drivers/gpu/drm/stm/drv.c  | 1 -
 drivers/gpu/drm/stm/ltdc.c | 1 +
 2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/stm/drv.c b/drivers/gpu/drm/stm/drv.c
index 486985604109..ea9fcbdc68b3 100644
--- a/drivers/gpu/drm/stm/drv.c
+++ b/drivers/gpu/drm/stm/drv.c
@@ -72,7 +72,6 @@ static struct drm_driver drv_driver = {
        .gem_prime_vmap = drm_gem_cma_prime_vmap,
        .gem_prime_vunmap = drm_gem_cma_prime_vunmap,
        .gem_prime_mmap = drm_gem_cma_prime_mmap,
-       .get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
 };

 static int drv_load(struct drm_device *ddev)
diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
index 8b6d1a2252e3..4fe9b033de1b 100644
--- a/drivers/gpu/drm/stm/ltdc.c
+++ b/drivers/gpu/drm/stm/ltdc.c
@@ -722,6 +722,7 @@ static const struct drm_crtc_funcs ltdc_crtc_funcs = {
        .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
        .enable_vblank = ltdc_crtc_enable_vblank,
        .disable_vblank = ltdc_crtc_disable_vblank,
+       .get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
        .gamma_set = drm_atomic_helper_legacy_gamma_set,
 };




[-- Attachment #1.2: Type: text/html, Size: 2060 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* Re: [PATCH 19/23] drm/stm: Convert to CRTC VBLANK callbacks
@ 2020-01-14 15:32     ` Yannick FERTRE
  0 siblings, 0 replies; 217+ messages in thread
From: Yannick FERTRE @ 2020-01-14 15:32 UTC (permalink / raw)
  To: Thomas Zimmermann, airlied, daniel, alexander.deucher,
	christian.koenig, David1.Zhou, maarten.lankhorst,
	patrik.r.jakobsson, robdclark, sean, benjamin.gaignard,
	Vincent ABRIOU, Philippe CORNU, mcoquelin.stm32,
	Alexandre TORGUE, eric, rodrigosiqueiramelo, hamohammed.sa,
	linux-graphics-maintainer, thellstrom, bskeggs, harry.wentland,
	sunpeng.li, jani.nikula, joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, nouveau, freedreno


[-- Attachment #1.1: Type: text/plain, Size: 1617 bytes --]

Thanks for the patch.

Tested-by: Yannick Fertré <yannick.fertre@st.com><mailto:yannick.fertre@st.com>

BR
Yannick Fertré


On 1/10/20 10:21 AM, Thomas Zimmermann wrote:

VBLANK callbacks in struct drm_driver are deprecated in favor of
their equivalents in struct drm_crtc_funcs. Convert stm over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de><mailto:tzimmermann@suse.de>
---
 drivers/gpu/drm/stm/drv.c  | 1 -
 drivers/gpu/drm/stm/ltdc.c | 1 +
 2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/stm/drv.c b/drivers/gpu/drm/stm/drv.c
index 486985604109..ea9fcbdc68b3 100644
--- a/drivers/gpu/drm/stm/drv.c
+++ b/drivers/gpu/drm/stm/drv.c
@@ -72,7 +72,6 @@ static struct drm_driver drv_driver = {
        .gem_prime_vmap = drm_gem_cma_prime_vmap,
        .gem_prime_vunmap = drm_gem_cma_prime_vunmap,
        .gem_prime_mmap = drm_gem_cma_prime_mmap,
-       .get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
 };

 static int drv_load(struct drm_device *ddev)
diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
index 8b6d1a2252e3..4fe9b033de1b 100644
--- a/drivers/gpu/drm/stm/ltdc.c
+++ b/drivers/gpu/drm/stm/ltdc.c
@@ -722,6 +722,7 @@ static const struct drm_crtc_funcs ltdc_crtc_funcs = {
        .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
        .enable_vblank = ltdc_crtc_enable_vblank,
        .disable_vblank = ltdc_crtc_disable_vblank,
+       .get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
        .gamma_set = drm_atomic_helper_legacy_gamma_set,
 };




[-- Attachment #1.2: Type: text/html, Size: 2060 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* Re: [Intel-gfx] [PATCH 19/23] drm/stm: Convert to CRTC VBLANK callbacks
@ 2020-01-14 15:32     ` Yannick FERTRE
  0 siblings, 0 replies; 217+ messages in thread
From: Yannick FERTRE @ 2020-01-14 15:32 UTC (permalink / raw)
  To: Thomas Zimmermann, airlied, daniel, alexander.deucher,
	christian.koenig, David1.Zhou, maarten.lankhorst,
	patrik.r.jakobsson, robdclark, sean, benjamin.gaignard,
	Vincent ABRIOU, Philippe CORNU, mcoquelin.stm32,
	Alexandre TORGUE, eric, rodrigosiqueiramelo, hamohammed.sa,
	linux-graphics-maintainer, thellstrom, bskeggs, harry.wentland,
	sunpeng.li, jani.nikula, joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, nouveau, freedreno


[-- Attachment #1.1: Type: text/plain, Size: 1617 bytes --]

Thanks for the patch.

Tested-by: Yannick Fertré <yannick.fertre@st.com><mailto:yannick.fertre@st.com>

BR
Yannick Fertré


On 1/10/20 10:21 AM, Thomas Zimmermann wrote:

VBLANK callbacks in struct drm_driver are deprecated in favor of
their equivalents in struct drm_crtc_funcs. Convert stm over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de><mailto:tzimmermann@suse.de>
---
 drivers/gpu/drm/stm/drv.c  | 1 -
 drivers/gpu/drm/stm/ltdc.c | 1 +
 2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/stm/drv.c b/drivers/gpu/drm/stm/drv.c
index 486985604109..ea9fcbdc68b3 100644
--- a/drivers/gpu/drm/stm/drv.c
+++ b/drivers/gpu/drm/stm/drv.c
@@ -72,7 +72,6 @@ static struct drm_driver drv_driver = {
        .gem_prime_vmap = drm_gem_cma_prime_vmap,
        .gem_prime_vunmap = drm_gem_cma_prime_vunmap,
        .gem_prime_mmap = drm_gem_cma_prime_mmap,
-       .get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
 };

 static int drv_load(struct drm_device *ddev)
diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
index 8b6d1a2252e3..4fe9b033de1b 100644
--- a/drivers/gpu/drm/stm/ltdc.c
+++ b/drivers/gpu/drm/stm/ltdc.c
@@ -722,6 +722,7 @@ static const struct drm_crtc_funcs ltdc_crtc_funcs = {
        .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
        .enable_vblank = ltdc_crtc_enable_vblank,
        .disable_vblank = ltdc_crtc_disable_vblank,
+       .get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
        .gamma_set = drm_atomic_helper_legacy_gamma_set,
 };




[-- Attachment #1.2: Type: text/html, Size: 2060 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* Re: [PATCH 19/23] drm/stm: Convert to CRTC VBLANK callbacks
@ 2020-01-14 15:32     ` Yannick FERTRE
  0 siblings, 0 replies; 217+ messages in thread
From: Yannick FERTRE @ 2020-01-14 15:32 UTC (permalink / raw)
  To: Thomas Zimmermann, airlied, daniel, alexander.deucher,
	christian.koenig, David1.Zhou, maarten.lankhorst,
	patrik.r.jakobsson, robdclark, sean, benjamin.gaignard,
	Vincent ABRIOU, Philippe CORNU, mcoquelin.stm32,
	Alexandre TORGUE, eric, rodrigosiqueiramelo, hamohammed.sa,
	linux-graphics-maintainer, thellstrom, bskeggs, harry.wentland,
	sunpeng.li, jani.nikula, joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, nouveau, freedreno


[-- Attachment #1.1: Type: text/plain, Size: 1617 bytes --]

Thanks for the patch.

Tested-by: Yannick Fertré <yannick.fertre@st.com><mailto:yannick.fertre@st.com>

BR
Yannick Fertré


On 1/10/20 10:21 AM, Thomas Zimmermann wrote:

VBLANK callbacks in struct drm_driver are deprecated in favor of
their equivalents in struct drm_crtc_funcs. Convert stm over.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de><mailto:tzimmermann@suse.de>
---
 drivers/gpu/drm/stm/drv.c  | 1 -
 drivers/gpu/drm/stm/ltdc.c | 1 +
 2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/stm/drv.c b/drivers/gpu/drm/stm/drv.c
index 486985604109..ea9fcbdc68b3 100644
--- a/drivers/gpu/drm/stm/drv.c
+++ b/drivers/gpu/drm/stm/drv.c
@@ -72,7 +72,6 @@ static struct drm_driver drv_driver = {
        .gem_prime_vmap = drm_gem_cma_prime_vmap,
        .gem_prime_vunmap = drm_gem_cma_prime_vunmap,
        .gem_prime_mmap = drm_gem_cma_prime_mmap,
-       .get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
 };

 static int drv_load(struct drm_device *ddev)
diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
index 8b6d1a2252e3..4fe9b033de1b 100644
--- a/drivers/gpu/drm/stm/ltdc.c
+++ b/drivers/gpu/drm/stm/ltdc.c
@@ -722,6 +722,7 @@ static const struct drm_crtc_funcs ltdc_crtc_funcs = {
        .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
        .enable_vblank = ltdc_crtc_enable_vblank,
        .disable_vblank = ltdc_crtc_disable_vblank,
+       .get_vblank_timestamp = drm_crtc_calc_vbltimestamp_from_scanoutpos,
        .gamma_set = drm_atomic_helper_legacy_gamma_set,
 };




[-- Attachment #1.2: Type: text/html, Size: 2060 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* Re: [PATCH 23/23] drm: Cleanup VBLANK callbacks in struct drm_driver
  2020-01-10  9:21   ` Thomas Zimmermann
  (?)
  (?)
@ 2020-01-14 15:32     ` Yannick FERTRE
  -1 siblings, 0 replies; 217+ messages in thread
From: Yannick FERTRE @ 2020-01-14 15:32 UTC (permalink / raw)
  To: Thomas Zimmermann, airlied, daniel, alexander.deucher,
	christian.koenig, David1.Zhou, maarten.lankhorst,
	patrik.r.jakobsson, robdclark, sean, benjamin.gaignard,
	Vincent ABRIOU, Philippe CORNU, mcoquelin.stm32,
	Alexandre TORGUE, eric, rodrigosiqueiramelo,
	hamohammed.sa@gmail.com
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, nouveau, freedreno


[-- Attachment #1.1: Type: text/plain, Size: 9945 bytes --]

Thanks for the patch.

Tested-by: Yannick Fertré <yannick.fertre@st.com><mailto:yannick.fertre@st.com>

BR
Yannick Fertré


On 1/10/20 10:21 AM, Thomas Zimmermann wrote:

All non-legacy users of VBLANK functions in struct drm_driver have been
converted to use the respective interfaces in struct drm_crtc_funcs. The
remaining users of VBLANK callbacks in struct drm_driver are legacy drivers
with userspace modesetting.

There are no users left of get_vblank_timestamp(), so the callback is
being removed. The other VBLANK callbacks are being moved to the legacy
section at the end of struct drm_driver.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de><mailto:tzimmermann@suse.de>
---
 drivers/gpu/drm/drm_vblank.c |  39 +++++---------
 include/drm/drm_drv.h        | 101 ++---------------------------------
 2 files changed, 17 insertions(+), 123 deletions(-)

diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
index 7cf436a4b908..ceff68474d4d 100644
--- a/drivers/gpu/drm/drm_vblank.c
+++ b/drivers/gpu/drm/drm_vblank.c
@@ -138,10 +138,9 @@ static u32 __get_vblank_counter(struct drm_device *dev, unsigned int pipe)

                if (crtc->funcs->get_vblank_counter)
                        return crtc->funcs->get_vblank_counter(crtc);
-       }
-
-       if (dev->driver->get_vblank_counter)
+       } else if (dev->driver->get_vblank_counter) {
                return dev->driver->get_vblank_counter(dev, pipe);
+       }

        return drm_vblank_no_hw_counter(dev, pipe);
 }
@@ -334,8 +333,7 @@ u64 drm_crtc_accurate_vblank_count(struct drm_crtc *crtc)
        unsigned long flags;

        WARN_ONCE(drm_debug_enabled(DRM_UT_VBL) &&
-                 !crtc->funcs->get_vblank_timestamp &&
-                 !dev->driver->get_vblank_timestamp,
+                 !crtc->funcs->get_vblank_timestamp,
                  "This function requires support for accurate vblank timestamps.");

        spin_lock_irqsave(&dev->vblank_time_lock, flags);
@@ -357,13 +355,11 @@ static void __disable_vblank(struct drm_device *dev, unsigned int pipe)
                if (WARN_ON(!crtc))
                        return;

-               if (crtc->funcs->disable_vblank) {
+               if (crtc->funcs->disable_vblank)
                        crtc->funcs->disable_vblank(crtc);
-                       return;
-               }
+       } else {
+               dev->driver->disable_vblank(dev, pipe);
        }
-
-       dev->driver->disable_vblank(dev, pipe);
 }

 /*
@@ -791,9 +787,6 @@ drm_get_last_vbltimestamp(struct drm_device *dev, unsigned int pipe,

                ret = crtc->funcs->get_vblank_timestamp(crtc, &max_error,
                                                        tvblank, in_vblank_irq);
-       } else if (dev->driver->get_vblank_timestamp && (max_error > 0)) {
-               ret = dev->driver->get_vblank_timestamp(dev, pipe, &max_error,
-                                                       tvblank, in_vblank_irq);
        }

        /* GPU high precision timestamp query unsupported or failed.
@@ -1016,9 +1009,11 @@ static int __enable_vblank(struct drm_device *dev, unsigned int pipe)

                if (crtc->funcs->enable_vblank)
                        return crtc->funcs->enable_vblank(crtc);
+       } else if (dev->driver->enable_vblank) {
+               return dev->driver->enable_vblank(dev, pipe);
        }

-       return dev->driver->enable_vblank(dev, pipe);
+       return -EINVAL;
 }

 static int drm_vblank_enable(struct drm_device *dev, unsigned int pipe)
@@ -1109,13 +1104,10 @@ static bool __vblank_disable_immediate(struct drm_device *dev, unsigned int pipe
                return false;

        crtc = drm_crtc_from_index(dev, pipe);
-       if (crtc && crtc->funcs->get_vblank_timestamp)
-               return true;
-
-       if (dev->driver->get_vblank_timestamp)
-               return true;
+       if (!crtc || !crtc->funcs->get_vblank_timestamp)
+               return false;

-       return false;
+       return true;
 }

 static void drm_vblank_put(struct drm_device *dev, unsigned int pipe)
@@ -1798,7 +1790,6 @@ static void drm_handle_vblank_events(struct drm_device *dev, unsigned int pipe)
        struct drm_pending_vblank_event *e, *t;
        ktime_t now;
        u64 seq;
-       bool high_prec;

        assert_spin_locked(&dev->event_lock);

@@ -1818,10 +1809,8 @@ static void drm_handle_vblank_events(struct drm_device *dev, unsigned int pipe)
                send_vblank_event(dev, e, seq, now);
        }

-       high_prec = crtc->funcs->get_vblank_timestamp ||
-                   dev->driver->get_vblank_timestamp;
-
-       trace_drm_vblank_event(pipe, seq, now, high_prec);
+       trace_drm_vblank_event(pipe, seq, now,
+                              crtc->funcs->get_vblank_timestamp != NULL);
 }

 /**
diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
index b704e252f3b2..e290b3aca6eb 100644
--- a/include/drm/drm_drv.h
+++ b/include/drm/drm_drv.h
@@ -268,104 +268,6 @@ struct drm_driver {
         */
        void (*release) (struct drm_device *);

-       /**
-        * @get_vblank_counter:
-        *
-        * Driver callback for fetching a raw hardware vblank counter for the
-        * CRTC specified with the pipe argument.  If a device doesn't have a
-        * hardware counter, the driver can simply leave the hook as NULL.
-        * The DRM core will account for missed vblank events while interrupts
-        * where disabled based on system timestamps.
-        *
-        * Wraparound handling and loss of events due to modesetting is dealt
-        * with in the DRM core code, as long as drivers call
-        * drm_crtc_vblank_off() and drm_crtc_vblank_on() when disabling or
-        * enabling a CRTC.
-        *
-        * This is deprecated and should not be used by new drivers.
-        * Use &drm_crtc_funcs.get_vblank_counter instead.
-        *
-        * Returns:
-        *
-        * Raw vblank counter value.
-        */
-       u32 (*get_vblank_counter) (struct drm_device *dev, unsigned int pipe);
-
-       /**
-        * @enable_vblank:
-        *
-        * Enable vblank interrupts for the CRTC specified with the pipe
-        * argument.
-        *
-        * This is deprecated and should not be used by new drivers.
-        * Use &drm_crtc_funcs.enable_vblank instead.
-        *
-        * Returns:
-        *
-        * Zero on success, appropriate errno if the given @crtc's vblank
-        * interrupt cannot be enabled.
-        */
-       int (*enable_vblank) (struct drm_device *dev, unsigned int pipe);
-
-       /**
-        * @disable_vblank:
-        *
-        * Disable vblank interrupts for the CRTC specified with the pipe
-        * argument.
-        *
-        * This is deprecated and should not be used by new drivers.
-        * Use &drm_crtc_funcs.disable_vblank instead.
-        */
-       void (*disable_vblank) (struct drm_device *dev, unsigned int pipe);
-
-       /**
-        * @get_vblank_timestamp:
-        *
-        * Called by drm_get_last_vbltimestamp(). Should return a precise
-        * timestamp when the most recent VBLANK interval ended or will end.
-        *
-        * Specifically, the timestamp in @vblank_time should correspond as
-        * closely as possible to the time when the first video scanline of
-        * the video frame after the end of VBLANK will start scanning out,
-        * the time immediately after end of the VBLANK interval. If the
-        * @crtc is currently inside VBLANK, this will be a time in the future.
-        * If the @crtc is currently scanning out a frame, this will be the
-        * past start time of the current scanout. This is meant to adhere
-        * to the OpenML OML_sync_control extension specification.
-        *
-        * Paramters:
-        *
-        * dev:
-        *     dev DRM device handle.
-        * pipe:
-        *     crtc for which timestamp should be returned.
-        * max_error:
-        *     Maximum allowable timestamp error in nanoseconds.
-        *     Implementation should strive to provide timestamp
-        *     with an error of at most max_error nanoseconds.
-        *     Returns true upper bound on error for timestamp.
-        * vblank_time:
-        *     Target location for returned vblank timestamp.
-        * in_vblank_irq:
-        *     True when called from drm_crtc_handle_vblank().  Some drivers
-        *     need to apply some workarounds for gpu-specific vblank irq quirks
-        *     if flag is set.
-        *
-        * Returns:
-        *
-        * True on success, false on failure, which means the core should
-        * fallback to a simple timestamp taken in drm_crtc_handle_vblank().
-        *
-        * FIXME:
-        *
-        * We should move this hook to &struct drm_crtc_funcs like all the other
-        * vblank hooks.
-        */
-       bool (*get_vblank_timestamp) (struct drm_device *dev, unsigned int pipe,
-                                    int *max_error,
-                                    ktime_t *vblank_time,
-                                    bool in_vblank_irq);
-
        /**
         * @irq_handler:
         *
@@ -720,6 +622,9 @@ struct drm_driver {
        int (*dma_ioctl) (struct drm_device *dev, void *data, struct drm_file *file_priv);
        int (*dma_quiescent) (struct drm_device *);
        int (*context_dtor) (struct drm_device *dev, int context);
+       u32 (*get_vblank_counter)(struct drm_device *dev, unsigned int pipe);
+       int (*enable_vblank)(struct drm_device *dev, unsigned int pipe);
+       void (*disable_vblank)(struct drm_device *dev, unsigned int pipe);
        int dev_priv_size;
 };




[-- Attachment #1.2: Type: text/html, Size: 9439 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* Re: [PATCH 23/23] drm: Cleanup VBLANK callbacks in struct drm_driver
@ 2020-01-14 15:32     ` Yannick FERTRE
  0 siblings, 0 replies; 217+ messages in thread
From: Yannick FERTRE @ 2020-01-14 15:32 UTC (permalink / raw)
  To: Thomas Zimmermann, airlied, daniel, alexander.deucher,
	christian.koenig, David1.Zhou, maarten.lankhorst,
	patrik.r.jakobsson, robdclark, sean, benjamin.gaignard,
	Vincent ABRIOU, Philippe CORNU, mcoquelin.stm32,
	Alexandre TORGUE, eric, rodrigosiqueiramelo, hamohammed.sa,
	linux-graphics-maintainer, thellstrom, bskeggs, harry.wentland,
	sunpeng.li, jani.nikula, joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, nouveau, freedreno


[-- Attachment #1.1: Type: text/plain, Size: 9945 bytes --]

Thanks for the patch.

Tested-by: Yannick Fertré <yannick.fertre@st.com><mailto:yannick.fertre@st.com>

BR
Yannick Fertré


On 1/10/20 10:21 AM, Thomas Zimmermann wrote:

All non-legacy users of VBLANK functions in struct drm_driver have been
converted to use the respective interfaces in struct drm_crtc_funcs. The
remaining users of VBLANK callbacks in struct drm_driver are legacy drivers
with userspace modesetting.

There are no users left of get_vblank_timestamp(), so the callback is
being removed. The other VBLANK callbacks are being moved to the legacy
section at the end of struct drm_driver.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de><mailto:tzimmermann@suse.de>
---
 drivers/gpu/drm/drm_vblank.c |  39 +++++---------
 include/drm/drm_drv.h        | 101 ++---------------------------------
 2 files changed, 17 insertions(+), 123 deletions(-)

diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
index 7cf436a4b908..ceff68474d4d 100644
--- a/drivers/gpu/drm/drm_vblank.c
+++ b/drivers/gpu/drm/drm_vblank.c
@@ -138,10 +138,9 @@ static u32 __get_vblank_counter(struct drm_device *dev, unsigned int pipe)

                if (crtc->funcs->get_vblank_counter)
                        return crtc->funcs->get_vblank_counter(crtc);
-       }
-
-       if (dev->driver->get_vblank_counter)
+       } else if (dev->driver->get_vblank_counter) {
                return dev->driver->get_vblank_counter(dev, pipe);
+       }

        return drm_vblank_no_hw_counter(dev, pipe);
 }
@@ -334,8 +333,7 @@ u64 drm_crtc_accurate_vblank_count(struct drm_crtc *crtc)
        unsigned long flags;

        WARN_ONCE(drm_debug_enabled(DRM_UT_VBL) &&
-                 !crtc->funcs->get_vblank_timestamp &&
-                 !dev->driver->get_vblank_timestamp,
+                 !crtc->funcs->get_vblank_timestamp,
                  "This function requires support for accurate vblank timestamps.");

        spin_lock_irqsave(&dev->vblank_time_lock, flags);
@@ -357,13 +355,11 @@ static void __disable_vblank(struct drm_device *dev, unsigned int pipe)
                if (WARN_ON(!crtc))
                        return;

-               if (crtc->funcs->disable_vblank) {
+               if (crtc->funcs->disable_vblank)
                        crtc->funcs->disable_vblank(crtc);
-                       return;
-               }
+       } else {
+               dev->driver->disable_vblank(dev, pipe);
        }
-
-       dev->driver->disable_vblank(dev, pipe);
 }

 /*
@@ -791,9 +787,6 @@ drm_get_last_vbltimestamp(struct drm_device *dev, unsigned int pipe,

                ret = crtc->funcs->get_vblank_timestamp(crtc, &max_error,
                                                        tvblank, in_vblank_irq);
-       } else if (dev->driver->get_vblank_timestamp && (max_error > 0)) {
-               ret = dev->driver->get_vblank_timestamp(dev, pipe, &max_error,
-                                                       tvblank, in_vblank_irq);
        }

        /* GPU high precision timestamp query unsupported or failed.
@@ -1016,9 +1009,11 @@ static int __enable_vblank(struct drm_device *dev, unsigned int pipe)

                if (crtc->funcs->enable_vblank)
                        return crtc->funcs->enable_vblank(crtc);
+       } else if (dev->driver->enable_vblank) {
+               return dev->driver->enable_vblank(dev, pipe);
        }

-       return dev->driver->enable_vblank(dev, pipe);
+       return -EINVAL;
 }

 static int drm_vblank_enable(struct drm_device *dev, unsigned int pipe)
@@ -1109,13 +1104,10 @@ static bool __vblank_disable_immediate(struct drm_device *dev, unsigned int pipe
                return false;

        crtc = drm_crtc_from_index(dev, pipe);
-       if (crtc && crtc->funcs->get_vblank_timestamp)
-               return true;
-
-       if (dev->driver->get_vblank_timestamp)
-               return true;
+       if (!crtc || !crtc->funcs->get_vblank_timestamp)
+               return false;

-       return false;
+       return true;
 }

 static void drm_vblank_put(struct drm_device *dev, unsigned int pipe)
@@ -1798,7 +1790,6 @@ static void drm_handle_vblank_events(struct drm_device *dev, unsigned int pipe)
        struct drm_pending_vblank_event *e, *t;
        ktime_t now;
        u64 seq;
-       bool high_prec;

        assert_spin_locked(&dev->event_lock);

@@ -1818,10 +1809,8 @@ static void drm_handle_vblank_events(struct drm_device *dev, unsigned int pipe)
                send_vblank_event(dev, e, seq, now);
        }

-       high_prec = crtc->funcs->get_vblank_timestamp ||
-                   dev->driver->get_vblank_timestamp;
-
-       trace_drm_vblank_event(pipe, seq, now, high_prec);
+       trace_drm_vblank_event(pipe, seq, now,
+                              crtc->funcs->get_vblank_timestamp != NULL);
 }

 /**
diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
index b704e252f3b2..e290b3aca6eb 100644
--- a/include/drm/drm_drv.h
+++ b/include/drm/drm_drv.h
@@ -268,104 +268,6 @@ struct drm_driver {
         */
        void (*release) (struct drm_device *);

-       /**
-        * @get_vblank_counter:
-        *
-        * Driver callback for fetching a raw hardware vblank counter for the
-        * CRTC specified with the pipe argument.  If a device doesn't have a
-        * hardware counter, the driver can simply leave the hook as NULL.
-        * The DRM core will account for missed vblank events while interrupts
-        * where disabled based on system timestamps.
-        *
-        * Wraparound handling and loss of events due to modesetting is dealt
-        * with in the DRM core code, as long as drivers call
-        * drm_crtc_vblank_off() and drm_crtc_vblank_on() when disabling or
-        * enabling a CRTC.
-        *
-        * This is deprecated and should not be used by new drivers.
-        * Use &drm_crtc_funcs.get_vblank_counter instead.
-        *
-        * Returns:
-        *
-        * Raw vblank counter value.
-        */
-       u32 (*get_vblank_counter) (struct drm_device *dev, unsigned int pipe);
-
-       /**
-        * @enable_vblank:
-        *
-        * Enable vblank interrupts for the CRTC specified with the pipe
-        * argument.
-        *
-        * This is deprecated and should not be used by new drivers.
-        * Use &drm_crtc_funcs.enable_vblank instead.
-        *
-        * Returns:
-        *
-        * Zero on success, appropriate errno if the given @crtc's vblank
-        * interrupt cannot be enabled.
-        */
-       int (*enable_vblank) (struct drm_device *dev, unsigned int pipe);
-
-       /**
-        * @disable_vblank:
-        *
-        * Disable vblank interrupts for the CRTC specified with the pipe
-        * argument.
-        *
-        * This is deprecated and should not be used by new drivers.
-        * Use &drm_crtc_funcs.disable_vblank instead.
-        */
-       void (*disable_vblank) (struct drm_device *dev, unsigned int pipe);
-
-       /**
-        * @get_vblank_timestamp:
-        *
-        * Called by drm_get_last_vbltimestamp(). Should return a precise
-        * timestamp when the most recent VBLANK interval ended or will end.
-        *
-        * Specifically, the timestamp in @vblank_time should correspond as
-        * closely as possible to the time when the first video scanline of
-        * the video frame after the end of VBLANK will start scanning out,
-        * the time immediately after end of the VBLANK interval. If the
-        * @crtc is currently inside VBLANK, this will be a time in the future.
-        * If the @crtc is currently scanning out a frame, this will be the
-        * past start time of the current scanout. This is meant to adhere
-        * to the OpenML OML_sync_control extension specification.
-        *
-        * Paramters:
-        *
-        * dev:
-        *     dev DRM device handle.
-        * pipe:
-        *     crtc for which timestamp should be returned.
-        * max_error:
-        *     Maximum allowable timestamp error in nanoseconds.
-        *     Implementation should strive to provide timestamp
-        *     with an error of at most max_error nanoseconds.
-        *     Returns true upper bound on error for timestamp.
-        * vblank_time:
-        *     Target location for returned vblank timestamp.
-        * in_vblank_irq:
-        *     True when called from drm_crtc_handle_vblank().  Some drivers
-        *     need to apply some workarounds for gpu-specific vblank irq quirks
-        *     if flag is set.
-        *
-        * Returns:
-        *
-        * True on success, false on failure, which means the core should
-        * fallback to a simple timestamp taken in drm_crtc_handle_vblank().
-        *
-        * FIXME:
-        *
-        * We should move this hook to &struct drm_crtc_funcs like all the other
-        * vblank hooks.
-        */
-       bool (*get_vblank_timestamp) (struct drm_device *dev, unsigned int pipe,
-                                    int *max_error,
-                                    ktime_t *vblank_time,
-                                    bool in_vblank_irq);
-
        /**
         * @irq_handler:
         *
@@ -720,6 +622,9 @@ struct drm_driver {
        int (*dma_ioctl) (struct drm_device *dev, void *data, struct drm_file *file_priv);
        int (*dma_quiescent) (struct drm_device *);
        int (*context_dtor) (struct drm_device *dev, int context);
+       u32 (*get_vblank_counter)(struct drm_device *dev, unsigned int pipe);
+       int (*enable_vblank)(struct drm_device *dev, unsigned int pipe);
+       void (*disable_vblank)(struct drm_device *dev, unsigned int pipe);
        int dev_priv_size;
 };




[-- Attachment #1.2: Type: text/html, Size: 9439 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* Re: [Intel-gfx] [PATCH 23/23] drm: Cleanup VBLANK callbacks in struct drm_driver
@ 2020-01-14 15:32     ` Yannick FERTRE
  0 siblings, 0 replies; 217+ messages in thread
From: Yannick FERTRE @ 2020-01-14 15:32 UTC (permalink / raw)
  To: Thomas Zimmermann, airlied, daniel, alexander.deucher,
	christian.koenig, David1.Zhou, maarten.lankhorst,
	patrik.r.jakobsson, robdclark, sean, benjamin.gaignard,
	Vincent ABRIOU, Philippe CORNU, mcoquelin.stm32,
	Alexandre TORGUE, eric, rodrigosiqueiramelo, hamohammed.sa,
	linux-graphics-maintainer, thellstrom, bskeggs, harry.wentland,
	sunpeng.li, jani.nikula, joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, nouveau, freedreno


[-- Attachment #1.1: Type: text/plain, Size: 9945 bytes --]

Thanks for the patch.

Tested-by: Yannick Fertré <yannick.fertre@st.com><mailto:yannick.fertre@st.com>

BR
Yannick Fertré


On 1/10/20 10:21 AM, Thomas Zimmermann wrote:

All non-legacy users of VBLANK functions in struct drm_driver have been
converted to use the respective interfaces in struct drm_crtc_funcs. The
remaining users of VBLANK callbacks in struct drm_driver are legacy drivers
with userspace modesetting.

There are no users left of get_vblank_timestamp(), so the callback is
being removed. The other VBLANK callbacks are being moved to the legacy
section at the end of struct drm_driver.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de><mailto:tzimmermann@suse.de>
---
 drivers/gpu/drm/drm_vblank.c |  39 +++++---------
 include/drm/drm_drv.h        | 101 ++---------------------------------
 2 files changed, 17 insertions(+), 123 deletions(-)

diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
index 7cf436a4b908..ceff68474d4d 100644
--- a/drivers/gpu/drm/drm_vblank.c
+++ b/drivers/gpu/drm/drm_vblank.c
@@ -138,10 +138,9 @@ static u32 __get_vblank_counter(struct drm_device *dev, unsigned int pipe)

                if (crtc->funcs->get_vblank_counter)
                        return crtc->funcs->get_vblank_counter(crtc);
-       }
-
-       if (dev->driver->get_vblank_counter)
+       } else if (dev->driver->get_vblank_counter) {
                return dev->driver->get_vblank_counter(dev, pipe);
+       }

        return drm_vblank_no_hw_counter(dev, pipe);
 }
@@ -334,8 +333,7 @@ u64 drm_crtc_accurate_vblank_count(struct drm_crtc *crtc)
        unsigned long flags;

        WARN_ONCE(drm_debug_enabled(DRM_UT_VBL) &&
-                 !crtc->funcs->get_vblank_timestamp &&
-                 !dev->driver->get_vblank_timestamp,
+                 !crtc->funcs->get_vblank_timestamp,
                  "This function requires support for accurate vblank timestamps.");

        spin_lock_irqsave(&dev->vblank_time_lock, flags);
@@ -357,13 +355,11 @@ static void __disable_vblank(struct drm_device *dev, unsigned int pipe)
                if (WARN_ON(!crtc))
                        return;

-               if (crtc->funcs->disable_vblank) {
+               if (crtc->funcs->disable_vblank)
                        crtc->funcs->disable_vblank(crtc);
-                       return;
-               }
+       } else {
+               dev->driver->disable_vblank(dev, pipe);
        }
-
-       dev->driver->disable_vblank(dev, pipe);
 }

 /*
@@ -791,9 +787,6 @@ drm_get_last_vbltimestamp(struct drm_device *dev, unsigned int pipe,

                ret = crtc->funcs->get_vblank_timestamp(crtc, &max_error,
                                                        tvblank, in_vblank_irq);
-       } else if (dev->driver->get_vblank_timestamp && (max_error > 0)) {
-               ret = dev->driver->get_vblank_timestamp(dev, pipe, &max_error,
-                                                       tvblank, in_vblank_irq);
        }

        /* GPU high precision timestamp query unsupported or failed.
@@ -1016,9 +1009,11 @@ static int __enable_vblank(struct drm_device *dev, unsigned int pipe)

                if (crtc->funcs->enable_vblank)
                        return crtc->funcs->enable_vblank(crtc);
+       } else if (dev->driver->enable_vblank) {
+               return dev->driver->enable_vblank(dev, pipe);
        }

-       return dev->driver->enable_vblank(dev, pipe);
+       return -EINVAL;
 }

 static int drm_vblank_enable(struct drm_device *dev, unsigned int pipe)
@@ -1109,13 +1104,10 @@ static bool __vblank_disable_immediate(struct drm_device *dev, unsigned int pipe
                return false;

        crtc = drm_crtc_from_index(dev, pipe);
-       if (crtc && crtc->funcs->get_vblank_timestamp)
-               return true;
-
-       if (dev->driver->get_vblank_timestamp)
-               return true;
+       if (!crtc || !crtc->funcs->get_vblank_timestamp)
+               return false;

-       return false;
+       return true;
 }

 static void drm_vblank_put(struct drm_device *dev, unsigned int pipe)
@@ -1798,7 +1790,6 @@ static void drm_handle_vblank_events(struct drm_device *dev, unsigned int pipe)
        struct drm_pending_vblank_event *e, *t;
        ktime_t now;
        u64 seq;
-       bool high_prec;

        assert_spin_locked(&dev->event_lock);

@@ -1818,10 +1809,8 @@ static void drm_handle_vblank_events(struct drm_device *dev, unsigned int pipe)
                send_vblank_event(dev, e, seq, now);
        }

-       high_prec = crtc->funcs->get_vblank_timestamp ||
-                   dev->driver->get_vblank_timestamp;
-
-       trace_drm_vblank_event(pipe, seq, now, high_prec);
+       trace_drm_vblank_event(pipe, seq, now,
+                              crtc->funcs->get_vblank_timestamp != NULL);
 }

 /**
diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
index b704e252f3b2..e290b3aca6eb 100644
--- a/include/drm/drm_drv.h
+++ b/include/drm/drm_drv.h
@@ -268,104 +268,6 @@ struct drm_driver {
         */
        void (*release) (struct drm_device *);

-       /**
-        * @get_vblank_counter:
-        *
-        * Driver callback for fetching a raw hardware vblank counter for the
-        * CRTC specified with the pipe argument.  If a device doesn't have a
-        * hardware counter, the driver can simply leave the hook as NULL.
-        * The DRM core will account for missed vblank events while interrupts
-        * where disabled based on system timestamps.
-        *
-        * Wraparound handling and loss of events due to modesetting is dealt
-        * with in the DRM core code, as long as drivers call
-        * drm_crtc_vblank_off() and drm_crtc_vblank_on() when disabling or
-        * enabling a CRTC.
-        *
-        * This is deprecated and should not be used by new drivers.
-        * Use &drm_crtc_funcs.get_vblank_counter instead.
-        *
-        * Returns:
-        *
-        * Raw vblank counter value.
-        */
-       u32 (*get_vblank_counter) (struct drm_device *dev, unsigned int pipe);
-
-       /**
-        * @enable_vblank:
-        *
-        * Enable vblank interrupts for the CRTC specified with the pipe
-        * argument.
-        *
-        * This is deprecated and should not be used by new drivers.
-        * Use &drm_crtc_funcs.enable_vblank instead.
-        *
-        * Returns:
-        *
-        * Zero on success, appropriate errno if the given @crtc's vblank
-        * interrupt cannot be enabled.
-        */
-       int (*enable_vblank) (struct drm_device *dev, unsigned int pipe);
-
-       /**
-        * @disable_vblank:
-        *
-        * Disable vblank interrupts for the CRTC specified with the pipe
-        * argument.
-        *
-        * This is deprecated and should not be used by new drivers.
-        * Use &drm_crtc_funcs.disable_vblank instead.
-        */
-       void (*disable_vblank) (struct drm_device *dev, unsigned int pipe);
-
-       /**
-        * @get_vblank_timestamp:
-        *
-        * Called by drm_get_last_vbltimestamp(). Should return a precise
-        * timestamp when the most recent VBLANK interval ended or will end.
-        *
-        * Specifically, the timestamp in @vblank_time should correspond as
-        * closely as possible to the time when the first video scanline of
-        * the video frame after the end of VBLANK will start scanning out,
-        * the time immediately after end of the VBLANK interval. If the
-        * @crtc is currently inside VBLANK, this will be a time in the future.
-        * If the @crtc is currently scanning out a frame, this will be the
-        * past start time of the current scanout. This is meant to adhere
-        * to the OpenML OML_sync_control extension specification.
-        *
-        * Paramters:
-        *
-        * dev:
-        *     dev DRM device handle.
-        * pipe:
-        *     crtc for which timestamp should be returned.
-        * max_error:
-        *     Maximum allowable timestamp error in nanoseconds.
-        *     Implementation should strive to provide timestamp
-        *     with an error of at most max_error nanoseconds.
-        *     Returns true upper bound on error for timestamp.
-        * vblank_time:
-        *     Target location for returned vblank timestamp.
-        * in_vblank_irq:
-        *     True when called from drm_crtc_handle_vblank().  Some drivers
-        *     need to apply some workarounds for gpu-specific vblank irq quirks
-        *     if flag is set.
-        *
-        * Returns:
-        *
-        * True on success, false on failure, which means the core should
-        * fallback to a simple timestamp taken in drm_crtc_handle_vblank().
-        *
-        * FIXME:
-        *
-        * We should move this hook to &struct drm_crtc_funcs like all the other
-        * vblank hooks.
-        */
-       bool (*get_vblank_timestamp) (struct drm_device *dev, unsigned int pipe,
-                                    int *max_error,
-                                    ktime_t *vblank_time,
-                                    bool in_vblank_irq);
-
        /**
         * @irq_handler:
         *
@@ -720,6 +622,9 @@ struct drm_driver {
        int (*dma_ioctl) (struct drm_device *dev, void *data, struct drm_file *file_priv);
        int (*dma_quiescent) (struct drm_device *);
        int (*context_dtor) (struct drm_device *dev, int context);
+       u32 (*get_vblank_counter)(struct drm_device *dev, unsigned int pipe);
+       int (*enable_vblank)(struct drm_device *dev, unsigned int pipe);
+       void (*disable_vblank)(struct drm_device *dev, unsigned int pipe);
        int dev_priv_size;
 };




[-- Attachment #1.2: Type: text/html, Size: 9439 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* Re: [PATCH 23/23] drm: Cleanup VBLANK callbacks in struct drm_driver
@ 2020-01-14 15:32     ` Yannick FERTRE
  0 siblings, 0 replies; 217+ messages in thread
From: Yannick FERTRE @ 2020-01-14 15:32 UTC (permalink / raw)
  To: Thomas Zimmermann, airlied, daniel, alexander.deucher,
	christian.koenig, David1.Zhou, maarten.lankhorst,
	patrik.r.jakobsson, robdclark, sean, benjamin.gaignard,
	Vincent ABRIOU, Philippe CORNU, mcoquelin.stm32,
	Alexandre TORGUE, eric, rodrigosiqueiramelo, hamohammed.sa,
	linux-graphics-maintainer, thellstrom, bskeggs, harry.wentland,
	sunpeng.li, jani.nikula, joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, nouveau, freedreno


[-- Attachment #1.1: Type: text/plain, Size: 9945 bytes --]

Thanks for the patch.

Tested-by: Yannick Fertré <yannick.fertre@st.com><mailto:yannick.fertre@st.com>

BR
Yannick Fertré


On 1/10/20 10:21 AM, Thomas Zimmermann wrote:

All non-legacy users of VBLANK functions in struct drm_driver have been
converted to use the respective interfaces in struct drm_crtc_funcs. The
remaining users of VBLANK callbacks in struct drm_driver are legacy drivers
with userspace modesetting.

There are no users left of get_vblank_timestamp(), so the callback is
being removed. The other VBLANK callbacks are being moved to the legacy
section at the end of struct drm_driver.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de><mailto:tzimmermann@suse.de>
---
 drivers/gpu/drm/drm_vblank.c |  39 +++++---------
 include/drm/drm_drv.h        | 101 ++---------------------------------
 2 files changed, 17 insertions(+), 123 deletions(-)

diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
index 7cf436a4b908..ceff68474d4d 100644
--- a/drivers/gpu/drm/drm_vblank.c
+++ b/drivers/gpu/drm/drm_vblank.c
@@ -138,10 +138,9 @@ static u32 __get_vblank_counter(struct drm_device *dev, unsigned int pipe)

                if (crtc->funcs->get_vblank_counter)
                        return crtc->funcs->get_vblank_counter(crtc);
-       }
-
-       if (dev->driver->get_vblank_counter)
+       } else if (dev->driver->get_vblank_counter) {
                return dev->driver->get_vblank_counter(dev, pipe);
+       }

        return drm_vblank_no_hw_counter(dev, pipe);
 }
@@ -334,8 +333,7 @@ u64 drm_crtc_accurate_vblank_count(struct drm_crtc *crtc)
        unsigned long flags;

        WARN_ONCE(drm_debug_enabled(DRM_UT_VBL) &&
-                 !crtc->funcs->get_vblank_timestamp &&
-                 !dev->driver->get_vblank_timestamp,
+                 !crtc->funcs->get_vblank_timestamp,
                  "This function requires support for accurate vblank timestamps.");

        spin_lock_irqsave(&dev->vblank_time_lock, flags);
@@ -357,13 +355,11 @@ static void __disable_vblank(struct drm_device *dev, unsigned int pipe)
                if (WARN_ON(!crtc))
                        return;

-               if (crtc->funcs->disable_vblank) {
+               if (crtc->funcs->disable_vblank)
                        crtc->funcs->disable_vblank(crtc);
-                       return;
-               }
+       } else {
+               dev->driver->disable_vblank(dev, pipe);
        }
-
-       dev->driver->disable_vblank(dev, pipe);
 }

 /*
@@ -791,9 +787,6 @@ drm_get_last_vbltimestamp(struct drm_device *dev, unsigned int pipe,

                ret = crtc->funcs->get_vblank_timestamp(crtc, &max_error,
                                                        tvblank, in_vblank_irq);
-       } else if (dev->driver->get_vblank_timestamp && (max_error > 0)) {
-               ret = dev->driver->get_vblank_timestamp(dev, pipe, &max_error,
-                                                       tvblank, in_vblank_irq);
        }

        /* GPU high precision timestamp query unsupported or failed.
@@ -1016,9 +1009,11 @@ static int __enable_vblank(struct drm_device *dev, unsigned int pipe)

                if (crtc->funcs->enable_vblank)
                        return crtc->funcs->enable_vblank(crtc);
+       } else if (dev->driver->enable_vblank) {
+               return dev->driver->enable_vblank(dev, pipe);
        }

-       return dev->driver->enable_vblank(dev, pipe);
+       return -EINVAL;
 }

 static int drm_vblank_enable(struct drm_device *dev, unsigned int pipe)
@@ -1109,13 +1104,10 @@ static bool __vblank_disable_immediate(struct drm_device *dev, unsigned int pipe
                return false;

        crtc = drm_crtc_from_index(dev, pipe);
-       if (crtc && crtc->funcs->get_vblank_timestamp)
-               return true;
-
-       if (dev->driver->get_vblank_timestamp)
-               return true;
+       if (!crtc || !crtc->funcs->get_vblank_timestamp)
+               return false;

-       return false;
+       return true;
 }

 static void drm_vblank_put(struct drm_device *dev, unsigned int pipe)
@@ -1798,7 +1790,6 @@ static void drm_handle_vblank_events(struct drm_device *dev, unsigned int pipe)
        struct drm_pending_vblank_event *e, *t;
        ktime_t now;
        u64 seq;
-       bool high_prec;

        assert_spin_locked(&dev->event_lock);

@@ -1818,10 +1809,8 @@ static void drm_handle_vblank_events(struct drm_device *dev, unsigned int pipe)
                send_vblank_event(dev, e, seq, now);
        }

-       high_prec = crtc->funcs->get_vblank_timestamp ||
-                   dev->driver->get_vblank_timestamp;
-
-       trace_drm_vblank_event(pipe, seq, now, high_prec);
+       trace_drm_vblank_event(pipe, seq, now,
+                              crtc->funcs->get_vblank_timestamp != NULL);
 }

 /**
diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
index b704e252f3b2..e290b3aca6eb 100644
--- a/include/drm/drm_drv.h
+++ b/include/drm/drm_drv.h
@@ -268,104 +268,6 @@ struct drm_driver {
         */
        void (*release) (struct drm_device *);

-       /**
-        * @get_vblank_counter:
-        *
-        * Driver callback for fetching a raw hardware vblank counter for the
-        * CRTC specified with the pipe argument.  If a device doesn't have a
-        * hardware counter, the driver can simply leave the hook as NULL.
-        * The DRM core will account for missed vblank events while interrupts
-        * where disabled based on system timestamps.
-        *
-        * Wraparound handling and loss of events due to modesetting is dealt
-        * with in the DRM core code, as long as drivers call
-        * drm_crtc_vblank_off() and drm_crtc_vblank_on() when disabling or
-        * enabling a CRTC.
-        *
-        * This is deprecated and should not be used by new drivers.
-        * Use &drm_crtc_funcs.get_vblank_counter instead.
-        *
-        * Returns:
-        *
-        * Raw vblank counter value.
-        */
-       u32 (*get_vblank_counter) (struct drm_device *dev, unsigned int pipe);
-
-       /**
-        * @enable_vblank:
-        *
-        * Enable vblank interrupts for the CRTC specified with the pipe
-        * argument.
-        *
-        * This is deprecated and should not be used by new drivers.
-        * Use &drm_crtc_funcs.enable_vblank instead.
-        *
-        * Returns:
-        *
-        * Zero on success, appropriate errno if the given @crtc's vblank
-        * interrupt cannot be enabled.
-        */
-       int (*enable_vblank) (struct drm_device *dev, unsigned int pipe);
-
-       /**
-        * @disable_vblank:
-        *
-        * Disable vblank interrupts for the CRTC specified with the pipe
-        * argument.
-        *
-        * This is deprecated and should not be used by new drivers.
-        * Use &drm_crtc_funcs.disable_vblank instead.
-        */
-       void (*disable_vblank) (struct drm_device *dev, unsigned int pipe);
-
-       /**
-        * @get_vblank_timestamp:
-        *
-        * Called by drm_get_last_vbltimestamp(). Should return a precise
-        * timestamp when the most recent VBLANK interval ended or will end.
-        *
-        * Specifically, the timestamp in @vblank_time should correspond as
-        * closely as possible to the time when the first video scanline of
-        * the video frame after the end of VBLANK will start scanning out,
-        * the time immediately after end of the VBLANK interval. If the
-        * @crtc is currently inside VBLANK, this will be a time in the future.
-        * If the @crtc is currently scanning out a frame, this will be the
-        * past start time of the current scanout. This is meant to adhere
-        * to the OpenML OML_sync_control extension specification.
-        *
-        * Paramters:
-        *
-        * dev:
-        *     dev DRM device handle.
-        * pipe:
-        *     crtc for which timestamp should be returned.
-        * max_error:
-        *     Maximum allowable timestamp error in nanoseconds.
-        *     Implementation should strive to provide timestamp
-        *     with an error of at most max_error nanoseconds.
-        *     Returns true upper bound on error for timestamp.
-        * vblank_time:
-        *     Target location for returned vblank timestamp.
-        * in_vblank_irq:
-        *     True when called from drm_crtc_handle_vblank().  Some drivers
-        *     need to apply some workarounds for gpu-specific vblank irq quirks
-        *     if flag is set.
-        *
-        * Returns:
-        *
-        * True on success, false on failure, which means the core should
-        * fallback to a simple timestamp taken in drm_crtc_handle_vblank().
-        *
-        * FIXME:
-        *
-        * We should move this hook to &struct drm_crtc_funcs like all the other
-        * vblank hooks.
-        */
-       bool (*get_vblank_timestamp) (struct drm_device *dev, unsigned int pipe,
-                                    int *max_error,
-                                    ktime_t *vblank_time,
-                                    bool in_vblank_irq);
-
        /**
         * @irq_handler:
         *
@@ -720,6 +622,9 @@ struct drm_driver {
        int (*dma_ioctl) (struct drm_device *dev, void *data, struct drm_file *file_priv);
        int (*dma_quiescent) (struct drm_device *);
        int (*context_dtor) (struct drm_device *dev, int context);
+       u32 (*get_vblank_counter)(struct drm_device *dev, unsigned int pipe);
+       int (*enable_vblank)(struct drm_device *dev, unsigned int pipe);
+       void (*disable_vblank)(struct drm_device *dev, unsigned int pipe);
        int dev_priv_size;
 };




[-- Attachment #1.2: Type: text/html, Size: 9439 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 217+ messages in thread

* [Intel-gfx] ✗ Fi.CI.BUILD: failure for drm: Clean up VBLANK callbacks in struct drm_driver (rev6)
  2020-01-10  9:21 ` Thomas Zimmermann
                   ` (30 preceding siblings ...)
  (?)
@ 2020-01-14 18:09 ` Patchwork
  -1 siblings, 0 replies; 217+ messages in thread
From: Patchwork @ 2020-01-14 18:09 UTC (permalink / raw)
  To: Yannick FERTRE; +Cc: intel-gfx

== Series Details ==

Series: drm: Clean up VBLANK callbacks in struct drm_driver (rev6)
URL   : https://patchwork.freedesktop.org/series/71873/
State : failure

== Summary ==

Applying: drm: Add get_scanout_position() to struct drm_crtc_helper_funcs
error: corrupt patch at line 18
error: could not build fake ancestor
hint: Use 'git am --show-current-patch' to see the failed patch
Patch failed at 0001 drm: Add get_scanout_position() to struct drm_crtc_helper_funcs
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [PATCH 01/23] drm: Add get_scanout_position() to struct drm_crtc_helper_funcs
@ 2020-01-15  7:31       ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-15  7:31 UTC (permalink / raw)
  To: Yannick FERTRE, airlied, daniel, alexander.deucher,
	christian.koenig, David1.Zhou, maarten.lankhorst,
	patrik.r.jakobsson, robdclark, sean, benjamin.gaignard,
	Vincent ABRIOU, Philippe CORNU, mcoquelin.stm32,
	Alexandre TORGUE, eric, rodrigosiqueiramelo, hamohammed.sa,
	linux-graphics-maintainer, thellstrom, bskeggs, harry.wentland,
	sunpeng.li, jani.nikula, joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, amd-gfx, dri-devel, nouveau, freedreno


[-- Attachment #1.1: Type: text/plain, Size: 6906 bytes --]

Hi

Am 14.01.20 um 16:31 schrieb Yannick FERTRE:
> Thanks for the patch.
> 
> Tested-by: Yannick Fertré <yannick.fertre@st.com> 

Thanks for testing all these patches.

Best regards
Thomas

> 
> BR
> Yannick Fertré
> 
> 
> On 1/10/20 10:21 AM, Thomas Zimmermann wrote:
>> The new callback get_scanout_position() reads the current location of
>> the scanout process. The operation is currentyl located in struct
>> drm_driver, but really belongs to the CRTC. Drivers will be converted
>> in separate patches.
>>
>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>> ---
>>  drivers/gpu/drm/drm_vblank.c             | 24 ++++++++----
>>  include/drm/drm_drv.h                    |  7 +---
>>  include/drm/drm_modeset_helper_vtables.h | 47 ++++++++++++++++++++++++
>>  3 files changed, 65 insertions(+), 13 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
>> index 1659b13b178c..c12f0b333e14 100644
>> --- a/drivers/gpu/drm/drm_vblank.c
>> +++ b/drivers/gpu/drm/drm_vblank.c
>> @@ -30,6 +30,7 @@
>>  #include <drm/drm_crtc.h>
>>  #include <drm/drm_drv.h>
>>  #include <drm/drm_framebuffer.h>
>> +#include <drm/drm_modeset_helper_vtables.h>
>>  #include <drm/drm_print.h>
>>  #include <drm/drm_vblank.h>
>>  
>> @@ -590,7 +591,7 @@ EXPORT_SYMBOL(drm_calc_timestamping_constants);
>>   * Implements calculation of exact vblank timestamps from given drm_display_mode
>>   * timings and current video scanout position of a CRTC. This can be directly
>>   * used as the &drm_driver.get_vblank_timestamp implementation of a kms driver
>> - * if &drm_driver.get_scanout_position is implemented.
>> + * if &drm_crtc_helper_funcs.get_scanout_position is implemented.
>>   *
>>   * The current implementation only handles standard video modes. For double scan
>>   * and interlaced modes the driver is supposed to adjust the hardware mode
>> @@ -632,8 +633,9 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
>>  	}
>>  
>>  	/* Scanout position query not supported? Should not happen. */
>> -	if (!dev->driver->get_scanout_position) {
>> -		DRM_ERROR("Called from driver w/o get_scanout_position()!?\n");
>> +	if (!dev->driver->get_scanout_position ||
>> +	    !crtc->helper_private->get_scanout_position) {
>> +		DRM_ERROR("Called from CRTC w/o get_scanout_position()!?\n");
>>  		return false;
>>  	}
>>  
>> @@ -664,11 +666,17 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
>>  		 * Get vertical and horizontal scanout position vpos, hpos,
>>  		 * and bounding timestamps stime, etime, pre/post query.
>>  		 */
>> -		vbl_status = dev->driver->get_scanout_position(dev, pipe,
>> -							       in_vblank_irq,
>> -							       &vpos, &hpos,
>> -							       &stime, &etime,
>> -							       mode);
>> +		if (crtc->helper_private->get_scanout_position) {
>> +			vbl_status =
>> +				crtc->helper_private->get_scanout_position(
>> +					crtc, in_vblank_irq, &vpos, &hpos,
>> +					&stime, &etime, mode);
>> +		} else {
>> +			vbl_status =
>> +				dev->driver->get_scanout_position(
>> +					dev, pipe, in_vblank_irq, &vpos,
>> +					&hpos, &stime, &etime, mode);
>> +		}
>>  
>>  		/* Return as no-op if scanout query unsupported or failed. */
>>  		if (!vbl_status) {
>> diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
>> index cf13470810a5..d0049e5786fc 100644
>> --- a/include/drm/drm_drv.h
>> +++ b/include/drm/drm_drv.h
>> @@ -362,11 +362,8 @@ struct drm_driver {
>>  	 * True on success, false if a reliable scanout position counter could
>>  	 * not be read out.
>>  	 *
>> -	 * FIXME:
>> -	 *
>> -	 * Since this is a helper to implement @get_vblank_timestamp, we should
>> -	 * move it to &struct drm_crtc_helper_funcs, like all the other
>> -	 * helper-internal hooks.
>> +	 * This is deprecated and should not be used by new drivers.
>> +	 * Use &drm_crtc_helper_funcs.get_scanout_position instead.
>>  	 */
>>  	bool (*get_scanout_position) (struct drm_device *dev, unsigned int pipe,
>>  				      bool in_vblank_irq, int *vpos, int *hpos,
>> diff --git a/include/drm/drm_modeset_helper_vtables.h b/include/drm/drm_modeset_helper_vtables.h
>> index 5a87f1bd7a3f..e398512bfd5f 100644
>> --- a/include/drm/drm_modeset_helper_vtables.h
>> +++ b/include/drm/drm_modeset_helper_vtables.h
>> @@ -450,6 +450,53 @@ struct drm_crtc_helper_funcs {
>>  	 */
>>  	void (*atomic_disable)(struct drm_crtc *crtc,
>>  			       struct drm_crtc_state *old_crtc_state);
>> +
>> +	/**
>> +	 * @get_scanout_position:
>> +	 *
>> +	 * Called by vblank timestamping code.
>> +	 *
>> +	 * Returns the current display scanout position from a CRTC and an
>> +	 * optional accurate ktime_get() timestamp of when the position was
>> +	 * measured. Note that this is a helper callback which is only used
>> +	 * if a driver uses drm_calc_vbltimestamp_from_scanoutpos() for the
>> +	 * @drm_driver.get_vblank_timestamp callback.
>> +	 *
>> +	 * Parameters:
>> +	 *
>> +	 * crtc:
>> +	 *     The CRTC.
>> +	 * in_vblank_irq:
>> +	 *     True when called from drm_crtc_handle_vblank(). Some drivers
>> +	 *     need to apply some workarounds for gpu-specific vblank irq
>> +	 *     quirks if the flag is set.
>> +	 * vpos:
>> +	 *     Target location for current vertical scanout position.
>> +	 * hpos:
>> +	 *     Target location for current horizontal scanout position.
>> +	 * stime:
>> +	 *     Target location for timestamp taken immediately before
>> +	 *     scanout position query. Can be NULL to skip timestamp.
>> +	 * etime:
>> +	 *     Target location for timestamp taken immediately after
>> +	 *     scanout position query. Can be NULL to skip timestamp.
>> +	 * mode:
>> +	 *     Current display timings.
>> +	 *
>> +	 * Returns vpos as a positive number while in active scanout area.
>> +	 * Returns vpos as a negative number inside vblank, counting the number
>> +	 * of scanlines to go until end of vblank, e.g., -1 means "one scanline
>> +	 * until start of active scanout / end of vblank."
>> +	 *
>> +	 * Returns:
>> +	 *
>> +	 * True on success, false if a reliable scanout position counter could
>> +	 * not be read out.
>> +	 */
>> +	bool (*get_scanout_position)(struct drm_crtc *crtc,
>> +				     bool in_vblank_irq, int *vpos, int *hpos,
>> +				     ktime_t *stime, ktime_t *etime,
>> +				     const struct drm_display_mode *mode);
>>  };
>>  
>>  /**
> 
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [PATCH 01/23] drm: Add get_scanout_position() to struct drm_crtc_helper_funcs
@ 2020-01-15  7:31       ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-15  7:31 UTC (permalink / raw)
  To: Yannick FERTRE, airlied-cv59FeDIM0c, daniel-/w4YWyX8dFk,
	alexander.deucher-5C7GfCeVMHo, christian.koenig-5C7GfCeVMHo,
	David1.Zhou-5C7GfCeVMHo,
	maarten.lankhorst-VuQAYsv1563Yd54FQh9/CA,
	patrik.r.jakobsson-Re5JQEeQqe8AvxtiuMwx3w,
	robdclark-Re5JQEeQqe8AvxtiuMwx3w, sean-p7yTbzM4H96eqtR555YLDQ,
	benjamin.gaignard-QSEj5FYQhm4dnm+yROfE0A, Vincent ABRIOU,
	Philippe CORNU, mcoquelin.stm32-Re5JQEeQqe8AvxtiuMwx3w,
	Alexandre TORGUE, eric-WhKQ6XTQaPysTnJN9+BGXg,
	rodrigosiqueiramelo-Re5JQEeQqe8AvxtiuMwx3w,
	hamohammed.sa-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
  Cc: linux-arm-msm-u79uwXL29TY76Z2rM5mHXA,
	intel-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW


[-- Attachment #1.1.1: Type: text/plain, Size: 6977 bytes --]

Hi

Am 14.01.20 um 16:31 schrieb Yannick FERTRE:
> Thanks for the patch.
> 
> Tested-by: Yannick Fertré <yannick.fertre-qxv4g6HH51o@public.gmane.org> 

Thanks for testing all these patches.

Best regards
Thomas

> 
> BR
> Yannick Fertré
> 
> 
> On 1/10/20 10:21 AM, Thomas Zimmermann wrote:
>> The new callback get_scanout_position() reads the current location of
>> the scanout process. The operation is currentyl located in struct
>> drm_driver, but really belongs to the CRTC. Drivers will be converted
>> in separate patches.
>>
>> Signed-off-by: Thomas Zimmermann <tzimmermann-l3A5Bk7waGM@public.gmane.org>
>> ---
>>  drivers/gpu/drm/drm_vblank.c             | 24 ++++++++----
>>  include/drm/drm_drv.h                    |  7 +---
>>  include/drm/drm_modeset_helper_vtables.h | 47 ++++++++++++++++++++++++
>>  3 files changed, 65 insertions(+), 13 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
>> index 1659b13b178c..c12f0b333e14 100644
>> --- a/drivers/gpu/drm/drm_vblank.c
>> +++ b/drivers/gpu/drm/drm_vblank.c
>> @@ -30,6 +30,7 @@
>>  #include <drm/drm_crtc.h>
>>  #include <drm/drm_drv.h>
>>  #include <drm/drm_framebuffer.h>
>> +#include <drm/drm_modeset_helper_vtables.h>
>>  #include <drm/drm_print.h>
>>  #include <drm/drm_vblank.h>
>>  
>> @@ -590,7 +591,7 @@ EXPORT_SYMBOL(drm_calc_timestamping_constants);
>>   * Implements calculation of exact vblank timestamps from given drm_display_mode
>>   * timings and current video scanout position of a CRTC. This can be directly
>>   * used as the &drm_driver.get_vblank_timestamp implementation of a kms driver
>> - * if &drm_driver.get_scanout_position is implemented.
>> + * if &drm_crtc_helper_funcs.get_scanout_position is implemented.
>>   *
>>   * The current implementation only handles standard video modes. For double scan
>>   * and interlaced modes the driver is supposed to adjust the hardware mode
>> @@ -632,8 +633,9 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
>>  	}
>>  
>>  	/* Scanout position query not supported? Should not happen. */
>> -	if (!dev->driver->get_scanout_position) {
>> -		DRM_ERROR("Called from driver w/o get_scanout_position()!?\n");
>> +	if (!dev->driver->get_scanout_position ||
>> +	    !crtc->helper_private->get_scanout_position) {
>> +		DRM_ERROR("Called from CRTC w/o get_scanout_position()!?\n");
>>  		return false;
>>  	}
>>  
>> @@ -664,11 +666,17 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
>>  		 * Get vertical and horizontal scanout position vpos, hpos,
>>  		 * and bounding timestamps stime, etime, pre/post query.
>>  		 */
>> -		vbl_status = dev->driver->get_scanout_position(dev, pipe,
>> -							       in_vblank_irq,
>> -							       &vpos, &hpos,
>> -							       &stime, &etime,
>> -							       mode);
>> +		if (crtc->helper_private->get_scanout_position) {
>> +			vbl_status =
>> +				crtc->helper_private->get_scanout_position(
>> +					crtc, in_vblank_irq, &vpos, &hpos,
>> +					&stime, &etime, mode);
>> +		} else {
>> +			vbl_status =
>> +				dev->driver->get_scanout_position(
>> +					dev, pipe, in_vblank_irq, &vpos,
>> +					&hpos, &stime, &etime, mode);
>> +		}
>>  
>>  		/* Return as no-op if scanout query unsupported or failed. */
>>  		if (!vbl_status) {
>> diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
>> index cf13470810a5..d0049e5786fc 100644
>> --- a/include/drm/drm_drv.h
>> +++ b/include/drm/drm_drv.h
>> @@ -362,11 +362,8 @@ struct drm_driver {
>>  	 * True on success, false if a reliable scanout position counter could
>>  	 * not be read out.
>>  	 *
>> -	 * FIXME:
>> -	 *
>> -	 * Since this is a helper to implement @get_vblank_timestamp, we should
>> -	 * move it to &struct drm_crtc_helper_funcs, like all the other
>> -	 * helper-internal hooks.
>> +	 * This is deprecated and should not be used by new drivers.
>> +	 * Use &drm_crtc_helper_funcs.get_scanout_position instead.
>>  	 */
>>  	bool (*get_scanout_position) (struct drm_device *dev, unsigned int pipe,
>>  				      bool in_vblank_irq, int *vpos, int *hpos,
>> diff --git a/include/drm/drm_modeset_helper_vtables.h b/include/drm/drm_modeset_helper_vtables.h
>> index 5a87f1bd7a3f..e398512bfd5f 100644
>> --- a/include/drm/drm_modeset_helper_vtables.h
>> +++ b/include/drm/drm_modeset_helper_vtables.h
>> @@ -450,6 +450,53 @@ struct drm_crtc_helper_funcs {
>>  	 */
>>  	void (*atomic_disable)(struct drm_crtc *crtc,
>>  			       struct drm_crtc_state *old_crtc_state);
>> +
>> +	/**
>> +	 * @get_scanout_position:
>> +	 *
>> +	 * Called by vblank timestamping code.
>> +	 *
>> +	 * Returns the current display scanout position from a CRTC and an
>> +	 * optional accurate ktime_get() timestamp of when the position was
>> +	 * measured. Note that this is a helper callback which is only used
>> +	 * if a driver uses drm_calc_vbltimestamp_from_scanoutpos() for the
>> +	 * @drm_driver.get_vblank_timestamp callback.
>> +	 *
>> +	 * Parameters:
>> +	 *
>> +	 * crtc:
>> +	 *     The CRTC.
>> +	 * in_vblank_irq:
>> +	 *     True when called from drm_crtc_handle_vblank(). Some drivers
>> +	 *     need to apply some workarounds for gpu-specific vblank irq
>> +	 *     quirks if the flag is set.
>> +	 * vpos:
>> +	 *     Target location for current vertical scanout position.
>> +	 * hpos:
>> +	 *     Target location for current horizontal scanout position.
>> +	 * stime:
>> +	 *     Target location for timestamp taken immediately before
>> +	 *     scanout position query. Can be NULL to skip timestamp.
>> +	 * etime:
>> +	 *     Target location for timestamp taken immediately after
>> +	 *     scanout position query. Can be NULL to skip timestamp.
>> +	 * mode:
>> +	 *     Current display timings.
>> +	 *
>> +	 * Returns vpos as a positive number while in active scanout area.
>> +	 * Returns vpos as a negative number inside vblank, counting the number
>> +	 * of scanlines to go until end of vblank, e.g., -1 means "one scanline
>> +	 * until start of active scanout / end of vblank."
>> +	 *
>> +	 * Returns:
>> +	 *
>> +	 * True on success, false if a reliable scanout position counter could
>> +	 * not be read out.
>> +	 */
>> +	bool (*get_scanout_position)(struct drm_crtc *crtc,
>> +				     bool in_vblank_irq, int *vpos, int *hpos,
>> +				     ktime_t *stime, ktime_t *etime,
>> +				     const struct drm_display_mode *mode);
>>  };
>>  
>>  /**
> 
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 188 bytes --]

_______________________________________________
Freedreno mailing list
Freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
https://lists.freedesktop.org/mailman/listinfo/freedreno

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [PATCH 01/23] drm: Add get_scanout_position() to struct drm_crtc_helper_funcs
@ 2020-01-15  7:31       ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-15  7:31 UTC (permalink / raw)
  To: Yannick FERTRE, airlied, daniel, alexander.deucher,
	christian.koenig, David1.Zhou, maarten.lankhorst,
	patrik.r.jakobsson, robdclark, sean, benjamin.gaignard,
	Vincent ABRIOU, Philippe CORNU, mcoquelin.stm32,
	Alexandre TORGUE, eric, rodrigosiqueiramelo, hamohammed.sa,
	linux-graphics-maintainer, thellstrom, bskeggs, harry.wentland,
	sunpeng.li, jani.nikula, joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, dri-devel, amd-gfx, nouveau, freedreno


[-- Attachment #1.1.1: Type: text/plain, Size: 6906 bytes --]

Hi

Am 14.01.20 um 16:31 schrieb Yannick FERTRE:
> Thanks for the patch.
> 
> Tested-by: Yannick Fertré <yannick.fertre@st.com> 

Thanks for testing all these patches.

Best regards
Thomas

> 
> BR
> Yannick Fertré
> 
> 
> On 1/10/20 10:21 AM, Thomas Zimmermann wrote:
>> The new callback get_scanout_position() reads the current location of
>> the scanout process. The operation is currentyl located in struct
>> drm_driver, but really belongs to the CRTC. Drivers will be converted
>> in separate patches.
>>
>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>> ---
>>  drivers/gpu/drm/drm_vblank.c             | 24 ++++++++----
>>  include/drm/drm_drv.h                    |  7 +---
>>  include/drm/drm_modeset_helper_vtables.h | 47 ++++++++++++++++++++++++
>>  3 files changed, 65 insertions(+), 13 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
>> index 1659b13b178c..c12f0b333e14 100644
>> --- a/drivers/gpu/drm/drm_vblank.c
>> +++ b/drivers/gpu/drm/drm_vblank.c
>> @@ -30,6 +30,7 @@
>>  #include <drm/drm_crtc.h>
>>  #include <drm/drm_drv.h>
>>  #include <drm/drm_framebuffer.h>
>> +#include <drm/drm_modeset_helper_vtables.h>
>>  #include <drm/drm_print.h>
>>  #include <drm/drm_vblank.h>
>>  
>> @@ -590,7 +591,7 @@ EXPORT_SYMBOL(drm_calc_timestamping_constants);
>>   * Implements calculation of exact vblank timestamps from given drm_display_mode
>>   * timings and current video scanout position of a CRTC. This can be directly
>>   * used as the &drm_driver.get_vblank_timestamp implementation of a kms driver
>> - * if &drm_driver.get_scanout_position is implemented.
>> + * if &drm_crtc_helper_funcs.get_scanout_position is implemented.
>>   *
>>   * The current implementation only handles standard video modes. For double scan
>>   * and interlaced modes the driver is supposed to adjust the hardware mode
>> @@ -632,8 +633,9 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
>>  	}
>>  
>>  	/* Scanout position query not supported? Should not happen. */
>> -	if (!dev->driver->get_scanout_position) {
>> -		DRM_ERROR("Called from driver w/o get_scanout_position()!?\n");
>> +	if (!dev->driver->get_scanout_position ||
>> +	    !crtc->helper_private->get_scanout_position) {
>> +		DRM_ERROR("Called from CRTC w/o get_scanout_position()!?\n");
>>  		return false;
>>  	}
>>  
>> @@ -664,11 +666,17 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
>>  		 * Get vertical and horizontal scanout position vpos, hpos,
>>  		 * and bounding timestamps stime, etime, pre/post query.
>>  		 */
>> -		vbl_status = dev->driver->get_scanout_position(dev, pipe,
>> -							       in_vblank_irq,
>> -							       &vpos, &hpos,
>> -							       &stime, &etime,
>> -							       mode);
>> +		if (crtc->helper_private->get_scanout_position) {
>> +			vbl_status =
>> +				crtc->helper_private->get_scanout_position(
>> +					crtc, in_vblank_irq, &vpos, &hpos,
>> +					&stime, &etime, mode);
>> +		} else {
>> +			vbl_status =
>> +				dev->driver->get_scanout_position(
>> +					dev, pipe, in_vblank_irq, &vpos,
>> +					&hpos, &stime, &etime, mode);
>> +		}
>>  
>>  		/* Return as no-op if scanout query unsupported or failed. */
>>  		if (!vbl_status) {
>> diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
>> index cf13470810a5..d0049e5786fc 100644
>> --- a/include/drm/drm_drv.h
>> +++ b/include/drm/drm_drv.h
>> @@ -362,11 +362,8 @@ struct drm_driver {
>>  	 * True on success, false if a reliable scanout position counter could
>>  	 * not be read out.
>>  	 *
>> -	 * FIXME:
>> -	 *
>> -	 * Since this is a helper to implement @get_vblank_timestamp, we should
>> -	 * move it to &struct drm_crtc_helper_funcs, like all the other
>> -	 * helper-internal hooks.
>> +	 * This is deprecated and should not be used by new drivers.
>> +	 * Use &drm_crtc_helper_funcs.get_scanout_position instead.
>>  	 */
>>  	bool (*get_scanout_position) (struct drm_device *dev, unsigned int pipe,
>>  				      bool in_vblank_irq, int *vpos, int *hpos,
>> diff --git a/include/drm/drm_modeset_helper_vtables.h b/include/drm/drm_modeset_helper_vtables.h
>> index 5a87f1bd7a3f..e398512bfd5f 100644
>> --- a/include/drm/drm_modeset_helper_vtables.h
>> +++ b/include/drm/drm_modeset_helper_vtables.h
>> @@ -450,6 +450,53 @@ struct drm_crtc_helper_funcs {
>>  	 */
>>  	void (*atomic_disable)(struct drm_crtc *crtc,
>>  			       struct drm_crtc_state *old_crtc_state);
>> +
>> +	/**
>> +	 * @get_scanout_position:
>> +	 *
>> +	 * Called by vblank timestamping code.
>> +	 *
>> +	 * Returns the current display scanout position from a CRTC and an
>> +	 * optional accurate ktime_get() timestamp of when the position was
>> +	 * measured. Note that this is a helper callback which is only used
>> +	 * if a driver uses drm_calc_vbltimestamp_from_scanoutpos() for the
>> +	 * @drm_driver.get_vblank_timestamp callback.
>> +	 *
>> +	 * Parameters:
>> +	 *
>> +	 * crtc:
>> +	 *     The CRTC.
>> +	 * in_vblank_irq:
>> +	 *     True when called from drm_crtc_handle_vblank(). Some drivers
>> +	 *     need to apply some workarounds for gpu-specific vblank irq
>> +	 *     quirks if the flag is set.
>> +	 * vpos:
>> +	 *     Target location for current vertical scanout position.
>> +	 * hpos:
>> +	 *     Target location for current horizontal scanout position.
>> +	 * stime:
>> +	 *     Target location for timestamp taken immediately before
>> +	 *     scanout position query. Can be NULL to skip timestamp.
>> +	 * etime:
>> +	 *     Target location for timestamp taken immediately after
>> +	 *     scanout position query. Can be NULL to skip timestamp.
>> +	 * mode:
>> +	 *     Current display timings.
>> +	 *
>> +	 * Returns vpos as a positive number while in active scanout area.
>> +	 * Returns vpos as a negative number inside vblank, counting the number
>> +	 * of scanlines to go until end of vblank, e.g., -1 means "one scanline
>> +	 * until start of active scanout / end of vblank."
>> +	 *
>> +	 * Returns:
>> +	 *
>> +	 * True on success, false if a reliable scanout position counter could
>> +	 * not be read out.
>> +	 */
>> +	bool (*get_scanout_position)(struct drm_crtc *crtc,
>> +				     bool in_vblank_irq, int *vpos, int *hpos,
>> +				     ktime_t *stime, ktime_t *etime,
>> +				     const struct drm_display_mode *mode);
>>  };
>>  
>>  /**
> 
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [Intel-gfx] [PATCH 01/23] drm: Add get_scanout_position() to struct drm_crtc_helper_funcs
@ 2020-01-15  7:31       ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-15  7:31 UTC (permalink / raw)
  To: Yannick FERTRE, airlied, daniel, alexander.deucher,
	christian.koenig, David1.Zhou, maarten.lankhorst,
	patrik.r.jakobsson, robdclark, sean, benjamin.gaignard,
	Vincent ABRIOU, Philippe CORNU, mcoquelin.stm32,
	Alexandre TORGUE, eric, rodrigosiqueiramelo, hamohammed.sa,
	linux-graphics-maintainer, thellstrom, bskeggs, harry.wentland,
	sunpeng.li, jani.nikula, joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, dri-devel, amd-gfx, nouveau, freedreno


[-- Attachment #1.1.1: Type: text/plain, Size: 6906 bytes --]

Hi

Am 14.01.20 um 16:31 schrieb Yannick FERTRE:
> Thanks for the patch.
> 
> Tested-by: Yannick Fertré <yannick.fertre@st.com> 

Thanks for testing all these patches.

Best regards
Thomas

> 
> BR
> Yannick Fertré
> 
> 
> On 1/10/20 10:21 AM, Thomas Zimmermann wrote:
>> The new callback get_scanout_position() reads the current location of
>> the scanout process. The operation is currentyl located in struct
>> drm_driver, but really belongs to the CRTC. Drivers will be converted
>> in separate patches.
>>
>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>> ---
>>  drivers/gpu/drm/drm_vblank.c             | 24 ++++++++----
>>  include/drm/drm_drv.h                    |  7 +---
>>  include/drm/drm_modeset_helper_vtables.h | 47 ++++++++++++++++++++++++
>>  3 files changed, 65 insertions(+), 13 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
>> index 1659b13b178c..c12f0b333e14 100644
>> --- a/drivers/gpu/drm/drm_vblank.c
>> +++ b/drivers/gpu/drm/drm_vblank.c
>> @@ -30,6 +30,7 @@
>>  #include <drm/drm_crtc.h>
>>  #include <drm/drm_drv.h>
>>  #include <drm/drm_framebuffer.h>
>> +#include <drm/drm_modeset_helper_vtables.h>
>>  #include <drm/drm_print.h>
>>  #include <drm/drm_vblank.h>
>>  
>> @@ -590,7 +591,7 @@ EXPORT_SYMBOL(drm_calc_timestamping_constants);
>>   * Implements calculation of exact vblank timestamps from given drm_display_mode
>>   * timings and current video scanout position of a CRTC. This can be directly
>>   * used as the &drm_driver.get_vblank_timestamp implementation of a kms driver
>> - * if &drm_driver.get_scanout_position is implemented.
>> + * if &drm_crtc_helper_funcs.get_scanout_position is implemented.
>>   *
>>   * The current implementation only handles standard video modes. For double scan
>>   * and interlaced modes the driver is supposed to adjust the hardware mode
>> @@ -632,8 +633,9 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
>>  	}
>>  
>>  	/* Scanout position query not supported? Should not happen. */
>> -	if (!dev->driver->get_scanout_position) {
>> -		DRM_ERROR("Called from driver w/o get_scanout_position()!?\n");
>> +	if (!dev->driver->get_scanout_position ||
>> +	    !crtc->helper_private->get_scanout_position) {
>> +		DRM_ERROR("Called from CRTC w/o get_scanout_position()!?\n");
>>  		return false;
>>  	}
>>  
>> @@ -664,11 +666,17 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
>>  		 * Get vertical and horizontal scanout position vpos, hpos,
>>  		 * and bounding timestamps stime, etime, pre/post query.
>>  		 */
>> -		vbl_status = dev->driver->get_scanout_position(dev, pipe,
>> -							       in_vblank_irq,
>> -							       &vpos, &hpos,
>> -							       &stime, &etime,
>> -							       mode);
>> +		if (crtc->helper_private->get_scanout_position) {
>> +			vbl_status =
>> +				crtc->helper_private->get_scanout_position(
>> +					crtc, in_vblank_irq, &vpos, &hpos,
>> +					&stime, &etime, mode);
>> +		} else {
>> +			vbl_status =
>> +				dev->driver->get_scanout_position(
>> +					dev, pipe, in_vblank_irq, &vpos,
>> +					&hpos, &stime, &etime, mode);
>> +		}
>>  
>>  		/* Return as no-op if scanout query unsupported or failed. */
>>  		if (!vbl_status) {
>> diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
>> index cf13470810a5..d0049e5786fc 100644
>> --- a/include/drm/drm_drv.h
>> +++ b/include/drm/drm_drv.h
>> @@ -362,11 +362,8 @@ struct drm_driver {
>>  	 * True on success, false if a reliable scanout position counter could
>>  	 * not be read out.
>>  	 *
>> -	 * FIXME:
>> -	 *
>> -	 * Since this is a helper to implement @get_vblank_timestamp, we should
>> -	 * move it to &struct drm_crtc_helper_funcs, like all the other
>> -	 * helper-internal hooks.
>> +	 * This is deprecated and should not be used by new drivers.
>> +	 * Use &drm_crtc_helper_funcs.get_scanout_position instead.
>>  	 */
>>  	bool (*get_scanout_position) (struct drm_device *dev, unsigned int pipe,
>>  				      bool in_vblank_irq, int *vpos, int *hpos,
>> diff --git a/include/drm/drm_modeset_helper_vtables.h b/include/drm/drm_modeset_helper_vtables.h
>> index 5a87f1bd7a3f..e398512bfd5f 100644
>> --- a/include/drm/drm_modeset_helper_vtables.h
>> +++ b/include/drm/drm_modeset_helper_vtables.h
>> @@ -450,6 +450,53 @@ struct drm_crtc_helper_funcs {
>>  	 */
>>  	void (*atomic_disable)(struct drm_crtc *crtc,
>>  			       struct drm_crtc_state *old_crtc_state);
>> +
>> +	/**
>> +	 * @get_scanout_position:
>> +	 *
>> +	 * Called by vblank timestamping code.
>> +	 *
>> +	 * Returns the current display scanout position from a CRTC and an
>> +	 * optional accurate ktime_get() timestamp of when the position was
>> +	 * measured. Note that this is a helper callback which is only used
>> +	 * if a driver uses drm_calc_vbltimestamp_from_scanoutpos() for the
>> +	 * @drm_driver.get_vblank_timestamp callback.
>> +	 *
>> +	 * Parameters:
>> +	 *
>> +	 * crtc:
>> +	 *     The CRTC.
>> +	 * in_vblank_irq:
>> +	 *     True when called from drm_crtc_handle_vblank(). Some drivers
>> +	 *     need to apply some workarounds for gpu-specific vblank irq
>> +	 *     quirks if the flag is set.
>> +	 * vpos:
>> +	 *     Target location for current vertical scanout position.
>> +	 * hpos:
>> +	 *     Target location for current horizontal scanout position.
>> +	 * stime:
>> +	 *     Target location for timestamp taken immediately before
>> +	 *     scanout position query. Can be NULL to skip timestamp.
>> +	 * etime:
>> +	 *     Target location for timestamp taken immediately after
>> +	 *     scanout position query. Can be NULL to skip timestamp.
>> +	 * mode:
>> +	 *     Current display timings.
>> +	 *
>> +	 * Returns vpos as a positive number while in active scanout area.
>> +	 * Returns vpos as a negative number inside vblank, counting the number
>> +	 * of scanlines to go until end of vblank, e.g., -1 means "one scanline
>> +	 * until start of active scanout / end of vblank."
>> +	 *
>> +	 * Returns:
>> +	 *
>> +	 * True on success, false if a reliable scanout position counter could
>> +	 * not be read out.
>> +	 */
>> +	bool (*get_scanout_position)(struct drm_crtc *crtc,
>> +				     bool in_vblank_irq, int *vpos, int *hpos,
>> +				     ktime_t *stime, ktime_t *etime,
>> +				     const struct drm_display_mode *mode);
>>  };
>>  
>>  /**
> 
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [PATCH 01/23] drm: Add get_scanout_position() to struct drm_crtc_helper_funcs
@ 2020-01-15  7:31       ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-15  7:31 UTC (permalink / raw)
  To: Yannick FERTRE, airlied, daniel, alexander.deucher,
	christian.koenig, David1.Zhou, maarten.lankhorst,
	patrik.r.jakobsson, robdclark, sean, benjamin.gaignard,
	Vincent ABRIOU, Philippe CORNU, mcoquelin.stm32,
	Alexandre TORGUE, eric, rodrigosiqueiramelo, hamohammed.sa,
	linux-graphics-maintainer, thellstrom, bskeggs, harry.wentland,
	sunpeng.li, jani.nikula, joonas.lahtinen, rodrigo.vivi
  Cc: linux-arm-msm, intel-gfx, dri-devel, amd-gfx, nouveau, freedreno


[-- Attachment #1.1.1: Type: text/plain, Size: 6906 bytes --]

Hi

Am 14.01.20 um 16:31 schrieb Yannick FERTRE:
> Thanks for the patch.
> 
> Tested-by: Yannick Fertré <yannick.fertre@st.com> 

Thanks for testing all these patches.

Best regards
Thomas

> 
> BR
> Yannick Fertré
> 
> 
> On 1/10/20 10:21 AM, Thomas Zimmermann wrote:
>> The new callback get_scanout_position() reads the current location of
>> the scanout process. The operation is currentyl located in struct
>> drm_driver, but really belongs to the CRTC. Drivers will be converted
>> in separate patches.
>>
>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>> ---
>>  drivers/gpu/drm/drm_vblank.c             | 24 ++++++++----
>>  include/drm/drm_drv.h                    |  7 +---
>>  include/drm/drm_modeset_helper_vtables.h | 47 ++++++++++++++++++++++++
>>  3 files changed, 65 insertions(+), 13 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
>> index 1659b13b178c..c12f0b333e14 100644
>> --- a/drivers/gpu/drm/drm_vblank.c
>> +++ b/drivers/gpu/drm/drm_vblank.c
>> @@ -30,6 +30,7 @@
>>  #include <drm/drm_crtc.h>
>>  #include <drm/drm_drv.h>
>>  #include <drm/drm_framebuffer.h>
>> +#include <drm/drm_modeset_helper_vtables.h>
>>  #include <drm/drm_print.h>
>>  #include <drm/drm_vblank.h>
>>  
>> @@ -590,7 +591,7 @@ EXPORT_SYMBOL(drm_calc_timestamping_constants);
>>   * Implements calculation of exact vblank timestamps from given drm_display_mode
>>   * timings and current video scanout position of a CRTC. This can be directly
>>   * used as the &drm_driver.get_vblank_timestamp implementation of a kms driver
>> - * if &drm_driver.get_scanout_position is implemented.
>> + * if &drm_crtc_helper_funcs.get_scanout_position is implemented.
>>   *
>>   * The current implementation only handles standard video modes. For double scan
>>   * and interlaced modes the driver is supposed to adjust the hardware mode
>> @@ -632,8 +633,9 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
>>  	}
>>  
>>  	/* Scanout position query not supported? Should not happen. */
>> -	if (!dev->driver->get_scanout_position) {
>> -		DRM_ERROR("Called from driver w/o get_scanout_position()!?\n");
>> +	if (!dev->driver->get_scanout_position ||
>> +	    !crtc->helper_private->get_scanout_position) {
>> +		DRM_ERROR("Called from CRTC w/o get_scanout_position()!?\n");
>>  		return false;
>>  	}
>>  
>> @@ -664,11 +666,17 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
>>  		 * Get vertical and horizontal scanout position vpos, hpos,
>>  		 * and bounding timestamps stime, etime, pre/post query.
>>  		 */
>> -		vbl_status = dev->driver->get_scanout_position(dev, pipe,
>> -							       in_vblank_irq,
>> -							       &vpos, &hpos,
>> -							       &stime, &etime,
>> -							       mode);
>> +		if (crtc->helper_private->get_scanout_position) {
>> +			vbl_status =
>> +				crtc->helper_private->get_scanout_position(
>> +					crtc, in_vblank_irq, &vpos, &hpos,
>> +					&stime, &etime, mode);
>> +		} else {
>> +			vbl_status =
>> +				dev->driver->get_scanout_position(
>> +					dev, pipe, in_vblank_irq, &vpos,
>> +					&hpos, &stime, &etime, mode);
>> +		}
>>  
>>  		/* Return as no-op if scanout query unsupported or failed. */
>>  		if (!vbl_status) {
>> diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
>> index cf13470810a5..d0049e5786fc 100644
>> --- a/include/drm/drm_drv.h
>> +++ b/include/drm/drm_drv.h
>> @@ -362,11 +362,8 @@ struct drm_driver {
>>  	 * True on success, false if a reliable scanout position counter could
>>  	 * not be read out.
>>  	 *
>> -	 * FIXME:
>> -	 *
>> -	 * Since this is a helper to implement @get_vblank_timestamp, we should
>> -	 * move it to &struct drm_crtc_helper_funcs, like all the other
>> -	 * helper-internal hooks.
>> +	 * This is deprecated and should not be used by new drivers.
>> +	 * Use &drm_crtc_helper_funcs.get_scanout_position instead.
>>  	 */
>>  	bool (*get_scanout_position) (struct drm_device *dev, unsigned int pipe,
>>  				      bool in_vblank_irq, int *vpos, int *hpos,
>> diff --git a/include/drm/drm_modeset_helper_vtables.h b/include/drm/drm_modeset_helper_vtables.h
>> index 5a87f1bd7a3f..e398512bfd5f 100644
>> --- a/include/drm/drm_modeset_helper_vtables.h
>> +++ b/include/drm/drm_modeset_helper_vtables.h
>> @@ -450,6 +450,53 @@ struct drm_crtc_helper_funcs {
>>  	 */
>>  	void (*atomic_disable)(struct drm_crtc *crtc,
>>  			       struct drm_crtc_state *old_crtc_state);
>> +
>> +	/**
>> +	 * @get_scanout_position:
>> +	 *
>> +	 * Called by vblank timestamping code.
>> +	 *
>> +	 * Returns the current display scanout position from a CRTC and an
>> +	 * optional accurate ktime_get() timestamp of when the position was
>> +	 * measured. Note that this is a helper callback which is only used
>> +	 * if a driver uses drm_calc_vbltimestamp_from_scanoutpos() for the
>> +	 * @drm_driver.get_vblank_timestamp callback.
>> +	 *
>> +	 * Parameters:
>> +	 *
>> +	 * crtc:
>> +	 *     The CRTC.
>> +	 * in_vblank_irq:
>> +	 *     True when called from drm_crtc_handle_vblank(). Some drivers
>> +	 *     need to apply some workarounds for gpu-specific vblank irq
>> +	 *     quirks if the flag is set.
>> +	 * vpos:
>> +	 *     Target location for current vertical scanout position.
>> +	 * hpos:
>> +	 *     Target location for current horizontal scanout position.
>> +	 * stime:
>> +	 *     Target location for timestamp taken immediately before
>> +	 *     scanout position query. Can be NULL to skip timestamp.
>> +	 * etime:
>> +	 *     Target location for timestamp taken immediately after
>> +	 *     scanout position query. Can be NULL to skip timestamp.
>> +	 * mode:
>> +	 *     Current display timings.
>> +	 *
>> +	 * Returns vpos as a positive number while in active scanout area.
>> +	 * Returns vpos as a negative number inside vblank, counting the number
>> +	 * of scanlines to go until end of vblank, e.g., -1 means "one scanline
>> +	 * until start of active scanout / end of vblank."
>> +	 *
>> +	 * Returns:
>> +	 *
>> +	 * True on success, false if a reliable scanout position counter could
>> +	 * not be read out.
>> +	 */
>> +	bool (*get_scanout_position)(struct drm_crtc *crtc,
>> +				     bool in_vblank_irq, int *vpos, int *hpos,
>> +				     ktime_t *stime, ktime_t *etime,
>> +				     const struct drm_display_mode *mode);
>>  };
>>  
>>  /**
> 
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [PATCH 02/23] drm/amdgpu: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
  2020-01-13 18:52     ` Alex Deucher
                         ` (2 preceding siblings ...)
  (?)
@ 2020-01-15  9:41       ` Thomas Zimmermann
  -1 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-15  9:41 UTC (permalink / raw)
  To: Alex Deucher
  Cc: Dave Airlie, Daniel Vetter, Deucher, Alexander, Christian Koenig,
	Chunming Zhou, Maarten Lankhorst, Patrik Jakobsson, Rob Clark,
	Sean Paul, Benjamin Gaignard, Vincent Abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, Eric Anholt,
	rodrigosiqueiramelo, hamohammed.sa, VMware Graphics,
	Thomas Hellstrom, Ben Skeggs, Wentland, Harry, Leo (Sunpeng) Li,
	Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, linux-arm-msm,
	Intel Graphics Development, amd-gfx list,
	Maling list - DRI developers, nouveau, freedreno


[-- Attachment #1.1: Type: text/plain, Size: 9116 bytes --]

Hi

Am 13.01.20 um 19:52 schrieb Alex Deucher:
> On Fri, Jan 10, 2020 at 4:21 AM Thomas Zimmermann <tzimmermann@suse.de> wrote:
>>
>> The callback struct drm_driver.get_scanout_position() is deprecated in
>> favor of struct drm_crtc_helper_funcs.get_scanout_position(). Convert
>> amdgpu over.
>>
> 
> I would prefer to just change the signature of
> amdgpu_display_get_crtc_scanoutpos() to match the new API rather than
> wrapping it again.

While trying to adapt the siganture, I found that
amdgpu_display_get_crtc_scanoutpos() requires a flags argument that is
not mappable to the callback API. That wrapper function is necessary.

Best regards
Thomas

> 
> Alex
> 
>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>> ---
>>  drivers/gpu/drm/amd/amdgpu/amdgpu_display.c       | 12 ++++++++++++
>>  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c           | 11 -----------
>>  drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h          |  5 +++++
>>  drivers/gpu/drm/amd/amdgpu/dce_v10_0.c            |  1 +
>>  drivers/gpu/drm/amd/amdgpu/dce_v11_0.c            |  1 +
>>  drivers/gpu/drm/amd/amdgpu/dce_v6_0.c             |  1 +
>>  drivers/gpu/drm/amd/amdgpu/dce_v8_0.c             |  1 +
>>  drivers/gpu/drm/amd/amdgpu/dce_virtual.c          |  1 +
>>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  3 ++-
>>  9 files changed, 24 insertions(+), 12 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
>> index 4e699071d144..a1e769d4417d 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
>> @@ -914,3 +914,15 @@ int amdgpu_display_crtc_idx_to_irq_type(struct amdgpu_device *adev, int crtc)
>>                 return AMDGPU_CRTC_IRQ_NONE;
>>         }
>>  }
>> +
>> +bool amdgpu_crtc_get_scanout_position(struct drm_crtc *crtc,
>> +                       bool in_vblank_irq, int *vpos,
>> +                       int *hpos, ktime_t *stime, ktime_t *etime,
>> +                       const struct drm_display_mode *mode)
>> +{
>> +       struct drm_device *dev = crtc->dev;
>> +       unsigned int pipe = crtc->index;
>> +
>> +       return amdgpu_display_get_crtc_scanoutpos(dev, pipe, 0, vpos, hpos,
>> +                                                 stime, etime, mode);
>> +}
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
>> index 3f6f14ce1511..0749285dd1c7 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
>> @@ -1367,16 +1367,6 @@ int amdgpu_file_to_fpriv(struct file *filp, struct amdgpu_fpriv **fpriv)
>>         return 0;
>>  }
>>
>> -static bool
>> -amdgpu_get_crtc_scanout_position(struct drm_device *dev, unsigned int pipe,
>> -                                bool in_vblank_irq, int *vpos, int *hpos,
>> -                                ktime_t *stime, ktime_t *etime,
>> -                                const struct drm_display_mode *mode)
>> -{
>> -       return amdgpu_display_get_crtc_scanoutpos(dev, pipe, 0, vpos, hpos,
>> -                                                 stime, etime, mode);
>> -}
>> -
>>  static struct drm_driver kms_driver = {
>>         .driver_features =
>>             DRIVER_USE_AGP | DRIVER_ATOMIC |
>> @@ -1391,7 +1381,6 @@ static struct drm_driver kms_driver = {
>>         .enable_vblank = amdgpu_enable_vblank_kms,
>>         .disable_vblank = amdgpu_disable_vblank_kms,
>>         .get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
>> -       .get_scanout_position = amdgpu_get_crtc_scanout_position,
>>         .irq_handler = amdgpu_irq_handler,
>>         .ioctls = amdgpu_ioctls_kms,
>>         .gem_free_object_unlocked = amdgpu_gem_object_free,
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
>> index eb9975f4decb..37ba07e2feb5 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
>> @@ -612,6 +612,11 @@ void amdgpu_panel_mode_fixup(struct drm_encoder *encoder,
>>                              struct drm_display_mode *adjusted_mode);
>>  int amdgpu_display_crtc_idx_to_irq_type(struct amdgpu_device *adev, int crtc);
>>
>> +bool amdgpu_crtc_get_scanout_position(struct drm_crtc *crtc,
>> +                       bool in_vblank_irq, int *vpos,
>> +                       int *hpos, ktime_t *stime, ktime_t *etime,
>> +                       const struct drm_display_mode *mode);
>> +
>>  /* fbdev layer */
>>  int amdgpu_fbdev_init(struct amdgpu_device *adev);
>>  void amdgpu_fbdev_fini(struct amdgpu_device *adev);
>> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
>> index 40d2ac723dd6..bdc1e0f036d4 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
>> @@ -2685,6 +2685,7 @@ static const struct drm_crtc_helper_funcs dce_v10_0_crtc_helper_funcs = {
>>         .prepare = dce_v10_0_crtc_prepare,
>>         .commit = dce_v10_0_crtc_commit,
>>         .disable = dce_v10_0_crtc_disable,
>> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>>  };
>>
>>  static int dce_v10_0_crtc_init(struct amdgpu_device *adev, int index)
>> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
>> index 898ef72d423c..0319da5f7bf9 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
>> @@ -2793,6 +2793,7 @@ static const struct drm_crtc_helper_funcs dce_v11_0_crtc_helper_funcs = {
>>         .prepare = dce_v11_0_crtc_prepare,
>>         .commit = dce_v11_0_crtc_commit,
>>         .disable = dce_v11_0_crtc_disable,
>> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>>  };
>>
>>  static int dce_v11_0_crtc_init(struct amdgpu_device *adev, int index)
>> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
>> index db15a112becc..78642c3b14fc 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
>> @@ -2575,6 +2575,7 @@ static const struct drm_crtc_helper_funcs dce_v6_0_crtc_helper_funcs = {
>>         .prepare = dce_v6_0_crtc_prepare,
>>         .commit = dce_v6_0_crtc_commit,
>>         .disable = dce_v6_0_crtc_disable,
>> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>>  };
>>
>>  static int dce_v6_0_crtc_init(struct amdgpu_device *adev, int index)
>> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
>> index f06c9022c1fd..1e8d4975435a 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
>> @@ -2593,6 +2593,7 @@ static const struct drm_crtc_helper_funcs dce_v8_0_crtc_helper_funcs = {
>>         .prepare = dce_v8_0_crtc_prepare,
>>         .commit = dce_v8_0_crtc_commit,
>>         .disable = dce_v8_0_crtc_disable,
>> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>>  };
>>
>>  static int dce_v8_0_crtc_init(struct amdgpu_device *adev, int index)
>> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
>> index e4f94863332c..4b2f915aba47 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
>> @@ -218,6 +218,7 @@ static const struct drm_crtc_helper_funcs dce_virtual_crtc_helper_funcs = {
>>         .prepare = dce_virtual_crtc_prepare,
>>         .commit = dce_virtual_crtc_commit,
>>         .disable = dce_virtual_crtc_disable,
>> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>>  };
>>
>>  static int dce_virtual_crtc_init(struct amdgpu_device *adev, int index)
>> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> index f2db400a3920..39c5cf242c1b 100644
>> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> @@ -4821,7 +4821,8 @@ static bool dm_crtc_helper_mode_fixup(struct drm_crtc *crtc,
>>  static const struct drm_crtc_helper_funcs amdgpu_dm_crtc_helper_funcs = {
>>         .disable = dm_crtc_helper_disable,
>>         .atomic_check = dm_crtc_helper_atomic_check,
>> -       .mode_fixup = dm_crtc_helper_mode_fixup
>> +       .mode_fixup = dm_crtc_helper_mode_fixup,
>> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>>  };
>>
>>  static void dm_encoder_helper_disable(struct drm_encoder *encoder)
>> --
>> 2.24.1
>>
>> _______________________________________________
>> amd-gfx mailing list
>> amd-gfx@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/amd-gfx

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [PATCH 02/23] drm/amdgpu: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
@ 2020-01-15  9:41       ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-15  9:41 UTC (permalink / raw)
  To: Alex Deucher
  Cc: Dave Airlie, Daniel Vetter, Deucher, Alexander, Christian Koenig,
	Chunming Zhou, Maarten Lankhorst, Patrik Jakobsson, Rob Clark,
	Sean Paul, Benjamin Gaignard, Vincent Abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, Eric Anholt,
	rodrigosiqueiramelo, hamohammed.sa, VMware Graphics,
	Thomas Hellstrom, Ben Skeggs, Wentla


[-- Attachment #1.1: Type: text/plain, Size: 9116 bytes --]

Hi

Am 13.01.20 um 19:52 schrieb Alex Deucher:
> On Fri, Jan 10, 2020 at 4:21 AM Thomas Zimmermann <tzimmermann@suse.de> wrote:
>>
>> The callback struct drm_driver.get_scanout_position() is deprecated in
>> favor of struct drm_crtc_helper_funcs.get_scanout_position(). Convert
>> amdgpu over.
>>
> 
> I would prefer to just change the signature of
> amdgpu_display_get_crtc_scanoutpos() to match the new API rather than
> wrapping it again.

While trying to adapt the siganture, I found that
amdgpu_display_get_crtc_scanoutpos() requires a flags argument that is
not mappable to the callback API. That wrapper function is necessary.

Best regards
Thomas

> 
> Alex
> 
>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>> ---
>>  drivers/gpu/drm/amd/amdgpu/amdgpu_display.c       | 12 ++++++++++++
>>  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c           | 11 -----------
>>  drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h          |  5 +++++
>>  drivers/gpu/drm/amd/amdgpu/dce_v10_0.c            |  1 +
>>  drivers/gpu/drm/amd/amdgpu/dce_v11_0.c            |  1 +
>>  drivers/gpu/drm/amd/amdgpu/dce_v6_0.c             |  1 +
>>  drivers/gpu/drm/amd/amdgpu/dce_v8_0.c             |  1 +
>>  drivers/gpu/drm/amd/amdgpu/dce_virtual.c          |  1 +
>>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  3 ++-
>>  9 files changed, 24 insertions(+), 12 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
>> index 4e699071d144..a1e769d4417d 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
>> @@ -914,3 +914,15 @@ int amdgpu_display_crtc_idx_to_irq_type(struct amdgpu_device *adev, int crtc)
>>                 return AMDGPU_CRTC_IRQ_NONE;
>>         }
>>  }
>> +
>> +bool amdgpu_crtc_get_scanout_position(struct drm_crtc *crtc,
>> +                       bool in_vblank_irq, int *vpos,
>> +                       int *hpos, ktime_t *stime, ktime_t *etime,
>> +                       const struct drm_display_mode *mode)
>> +{
>> +       struct drm_device *dev = crtc->dev;
>> +       unsigned int pipe = crtc->index;
>> +
>> +       return amdgpu_display_get_crtc_scanoutpos(dev, pipe, 0, vpos, hpos,
>> +                                                 stime, etime, mode);
>> +}
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
>> index 3f6f14ce1511..0749285dd1c7 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
>> @@ -1367,16 +1367,6 @@ int amdgpu_file_to_fpriv(struct file *filp, struct amdgpu_fpriv **fpriv)
>>         return 0;
>>  }
>>
>> -static bool
>> -amdgpu_get_crtc_scanout_position(struct drm_device *dev, unsigned int pipe,
>> -                                bool in_vblank_irq, int *vpos, int *hpos,
>> -                                ktime_t *stime, ktime_t *etime,
>> -                                const struct drm_display_mode *mode)
>> -{
>> -       return amdgpu_display_get_crtc_scanoutpos(dev, pipe, 0, vpos, hpos,
>> -                                                 stime, etime, mode);
>> -}
>> -
>>  static struct drm_driver kms_driver = {
>>         .driver_features =
>>             DRIVER_USE_AGP | DRIVER_ATOMIC |
>> @@ -1391,7 +1381,6 @@ static struct drm_driver kms_driver = {
>>         .enable_vblank = amdgpu_enable_vblank_kms,
>>         .disable_vblank = amdgpu_disable_vblank_kms,
>>         .get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
>> -       .get_scanout_position = amdgpu_get_crtc_scanout_position,
>>         .irq_handler = amdgpu_irq_handler,
>>         .ioctls = amdgpu_ioctls_kms,
>>         .gem_free_object_unlocked = amdgpu_gem_object_free,
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
>> index eb9975f4decb..37ba07e2feb5 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
>> @@ -612,6 +612,11 @@ void amdgpu_panel_mode_fixup(struct drm_encoder *encoder,
>>                              struct drm_display_mode *adjusted_mode);
>>  int amdgpu_display_crtc_idx_to_irq_type(struct amdgpu_device *adev, int crtc);
>>
>> +bool amdgpu_crtc_get_scanout_position(struct drm_crtc *crtc,
>> +                       bool in_vblank_irq, int *vpos,
>> +                       int *hpos, ktime_t *stime, ktime_t *etime,
>> +                       const struct drm_display_mode *mode);
>> +
>>  /* fbdev layer */
>>  int amdgpu_fbdev_init(struct amdgpu_device *adev);
>>  void amdgpu_fbdev_fini(struct amdgpu_device *adev);
>> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
>> index 40d2ac723dd6..bdc1e0f036d4 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
>> @@ -2685,6 +2685,7 @@ static const struct drm_crtc_helper_funcs dce_v10_0_crtc_helper_funcs = {
>>         .prepare = dce_v10_0_crtc_prepare,
>>         .commit = dce_v10_0_crtc_commit,
>>         .disable = dce_v10_0_crtc_disable,
>> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>>  };
>>
>>  static int dce_v10_0_crtc_init(struct amdgpu_device *adev, int index)
>> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
>> index 898ef72d423c..0319da5f7bf9 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
>> @@ -2793,6 +2793,7 @@ static const struct drm_crtc_helper_funcs dce_v11_0_crtc_helper_funcs = {
>>         .prepare = dce_v11_0_crtc_prepare,
>>         .commit = dce_v11_0_crtc_commit,
>>         .disable = dce_v11_0_crtc_disable,
>> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>>  };
>>
>>  static int dce_v11_0_crtc_init(struct amdgpu_device *adev, int index)
>> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
>> index db15a112becc..78642c3b14fc 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
>> @@ -2575,6 +2575,7 @@ static const struct drm_crtc_helper_funcs dce_v6_0_crtc_helper_funcs = {
>>         .prepare = dce_v6_0_crtc_prepare,
>>         .commit = dce_v6_0_crtc_commit,
>>         .disable = dce_v6_0_crtc_disable,
>> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>>  };
>>
>>  static int dce_v6_0_crtc_init(struct amdgpu_device *adev, int index)
>> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
>> index f06c9022c1fd..1e8d4975435a 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
>> @@ -2593,6 +2593,7 @@ static const struct drm_crtc_helper_funcs dce_v8_0_crtc_helper_funcs = {
>>         .prepare = dce_v8_0_crtc_prepare,
>>         .commit = dce_v8_0_crtc_commit,
>>         .disable = dce_v8_0_crtc_disable,
>> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>>  };
>>
>>  static int dce_v8_0_crtc_init(struct amdgpu_device *adev, int index)
>> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
>> index e4f94863332c..4b2f915aba47 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
>> @@ -218,6 +218,7 @@ static const struct drm_crtc_helper_funcs dce_virtual_crtc_helper_funcs = {
>>         .prepare = dce_virtual_crtc_prepare,
>>         .commit = dce_virtual_crtc_commit,
>>         .disable = dce_virtual_crtc_disable,
>> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>>  };
>>
>>  static int dce_virtual_crtc_init(struct amdgpu_device *adev, int index)
>> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> index f2db400a3920..39c5cf242c1b 100644
>> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> @@ -4821,7 +4821,8 @@ static bool dm_crtc_helper_mode_fixup(struct drm_crtc *crtc,
>>  static const struct drm_crtc_helper_funcs amdgpu_dm_crtc_helper_funcs = {
>>         .disable = dm_crtc_helper_disable,
>>         .atomic_check = dm_crtc_helper_atomic_check,
>> -       .mode_fixup = dm_crtc_helper_mode_fixup
>> +       .mode_fixup = dm_crtc_helper_mode_fixup,
>> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>>  };
>>
>>  static void dm_encoder_helper_disable(struct drm_encoder *encoder)
>> --
>> 2.24.1
>>
>> _______________________________________________
>> amd-gfx mailing list
>> amd-gfx@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/amd-gfx

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [PATCH 02/23] drm/amdgpu: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
@ 2020-01-15  9:41       ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-15  9:41 UTC (permalink / raw)
  To: Alex Deucher
  Cc: hamohammed.sa, Dave Airlie, nouveau,
	Maling list - DRI developers, amd-gfx list, alexandre.torgue,
	Thomas Hellstrom, Sean Paul, VMware Graphics, Ben Skeggs,
	mcoquelin.stm32, Leo (Sunpeng) Li, linux-arm-msm,
	Intel Graphics Development, Rodrigo Vivi, Vincent Abriou,
	rodrigosiqueiramelo, philippe.cornu, yannick.fertre, Deucher,
	Alexander, freedreno, Christian Koenig


[-- Attachment #1.1.1: Type: text/plain, Size: 9116 bytes --]

Hi

Am 13.01.20 um 19:52 schrieb Alex Deucher:
> On Fri, Jan 10, 2020 at 4:21 AM Thomas Zimmermann <tzimmermann@suse.de> wrote:
>>
>> The callback struct drm_driver.get_scanout_position() is deprecated in
>> favor of struct drm_crtc_helper_funcs.get_scanout_position(). Convert
>> amdgpu over.
>>
> 
> I would prefer to just change the signature of
> amdgpu_display_get_crtc_scanoutpos() to match the new API rather than
> wrapping it again.

While trying to adapt the siganture, I found that
amdgpu_display_get_crtc_scanoutpos() requires a flags argument that is
not mappable to the callback API. That wrapper function is necessary.

Best regards
Thomas

> 
> Alex
> 
>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>> ---
>>  drivers/gpu/drm/amd/amdgpu/amdgpu_display.c       | 12 ++++++++++++
>>  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c           | 11 -----------
>>  drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h          |  5 +++++
>>  drivers/gpu/drm/amd/amdgpu/dce_v10_0.c            |  1 +
>>  drivers/gpu/drm/amd/amdgpu/dce_v11_0.c            |  1 +
>>  drivers/gpu/drm/amd/amdgpu/dce_v6_0.c             |  1 +
>>  drivers/gpu/drm/amd/amdgpu/dce_v8_0.c             |  1 +
>>  drivers/gpu/drm/amd/amdgpu/dce_virtual.c          |  1 +
>>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  3 ++-
>>  9 files changed, 24 insertions(+), 12 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
>> index 4e699071d144..a1e769d4417d 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
>> @@ -914,3 +914,15 @@ int amdgpu_display_crtc_idx_to_irq_type(struct amdgpu_device *adev, int crtc)
>>                 return AMDGPU_CRTC_IRQ_NONE;
>>         }
>>  }
>> +
>> +bool amdgpu_crtc_get_scanout_position(struct drm_crtc *crtc,
>> +                       bool in_vblank_irq, int *vpos,
>> +                       int *hpos, ktime_t *stime, ktime_t *etime,
>> +                       const struct drm_display_mode *mode)
>> +{
>> +       struct drm_device *dev = crtc->dev;
>> +       unsigned int pipe = crtc->index;
>> +
>> +       return amdgpu_display_get_crtc_scanoutpos(dev, pipe, 0, vpos, hpos,
>> +                                                 stime, etime, mode);
>> +}
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
>> index 3f6f14ce1511..0749285dd1c7 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
>> @@ -1367,16 +1367,6 @@ int amdgpu_file_to_fpriv(struct file *filp, struct amdgpu_fpriv **fpriv)
>>         return 0;
>>  }
>>
>> -static bool
>> -amdgpu_get_crtc_scanout_position(struct drm_device *dev, unsigned int pipe,
>> -                                bool in_vblank_irq, int *vpos, int *hpos,
>> -                                ktime_t *stime, ktime_t *etime,
>> -                                const struct drm_display_mode *mode)
>> -{
>> -       return amdgpu_display_get_crtc_scanoutpos(dev, pipe, 0, vpos, hpos,
>> -                                                 stime, etime, mode);
>> -}
>> -
>>  static struct drm_driver kms_driver = {
>>         .driver_features =
>>             DRIVER_USE_AGP | DRIVER_ATOMIC |
>> @@ -1391,7 +1381,6 @@ static struct drm_driver kms_driver = {
>>         .enable_vblank = amdgpu_enable_vblank_kms,
>>         .disable_vblank = amdgpu_disable_vblank_kms,
>>         .get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
>> -       .get_scanout_position = amdgpu_get_crtc_scanout_position,
>>         .irq_handler = amdgpu_irq_handler,
>>         .ioctls = amdgpu_ioctls_kms,
>>         .gem_free_object_unlocked = amdgpu_gem_object_free,
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
>> index eb9975f4decb..37ba07e2feb5 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
>> @@ -612,6 +612,11 @@ void amdgpu_panel_mode_fixup(struct drm_encoder *encoder,
>>                              struct drm_display_mode *adjusted_mode);
>>  int amdgpu_display_crtc_idx_to_irq_type(struct amdgpu_device *adev, int crtc);
>>
>> +bool amdgpu_crtc_get_scanout_position(struct drm_crtc *crtc,
>> +                       bool in_vblank_irq, int *vpos,
>> +                       int *hpos, ktime_t *stime, ktime_t *etime,
>> +                       const struct drm_display_mode *mode);
>> +
>>  /* fbdev layer */
>>  int amdgpu_fbdev_init(struct amdgpu_device *adev);
>>  void amdgpu_fbdev_fini(struct amdgpu_device *adev);
>> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
>> index 40d2ac723dd6..bdc1e0f036d4 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
>> @@ -2685,6 +2685,7 @@ static const struct drm_crtc_helper_funcs dce_v10_0_crtc_helper_funcs = {
>>         .prepare = dce_v10_0_crtc_prepare,
>>         .commit = dce_v10_0_crtc_commit,
>>         .disable = dce_v10_0_crtc_disable,
>> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>>  };
>>
>>  static int dce_v10_0_crtc_init(struct amdgpu_device *adev, int index)
>> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
>> index 898ef72d423c..0319da5f7bf9 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
>> @@ -2793,6 +2793,7 @@ static const struct drm_crtc_helper_funcs dce_v11_0_crtc_helper_funcs = {
>>         .prepare = dce_v11_0_crtc_prepare,
>>         .commit = dce_v11_0_crtc_commit,
>>         .disable = dce_v11_0_crtc_disable,
>> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>>  };
>>
>>  static int dce_v11_0_crtc_init(struct amdgpu_device *adev, int index)
>> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
>> index db15a112becc..78642c3b14fc 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
>> @@ -2575,6 +2575,7 @@ static const struct drm_crtc_helper_funcs dce_v6_0_crtc_helper_funcs = {
>>         .prepare = dce_v6_0_crtc_prepare,
>>         .commit = dce_v6_0_crtc_commit,
>>         .disable = dce_v6_0_crtc_disable,
>> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>>  };
>>
>>  static int dce_v6_0_crtc_init(struct amdgpu_device *adev, int index)
>> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
>> index f06c9022c1fd..1e8d4975435a 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
>> @@ -2593,6 +2593,7 @@ static const struct drm_crtc_helper_funcs dce_v8_0_crtc_helper_funcs = {
>>         .prepare = dce_v8_0_crtc_prepare,
>>         .commit = dce_v8_0_crtc_commit,
>>         .disable = dce_v8_0_crtc_disable,
>> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>>  };
>>
>>  static int dce_v8_0_crtc_init(struct amdgpu_device *adev, int index)
>> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
>> index e4f94863332c..4b2f915aba47 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
>> @@ -218,6 +218,7 @@ static const struct drm_crtc_helper_funcs dce_virtual_crtc_helper_funcs = {
>>         .prepare = dce_virtual_crtc_prepare,
>>         .commit = dce_virtual_crtc_commit,
>>         .disable = dce_virtual_crtc_disable,
>> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>>  };
>>
>>  static int dce_virtual_crtc_init(struct amdgpu_device *adev, int index)
>> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> index f2db400a3920..39c5cf242c1b 100644
>> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> @@ -4821,7 +4821,8 @@ static bool dm_crtc_helper_mode_fixup(struct drm_crtc *crtc,
>>  static const struct drm_crtc_helper_funcs amdgpu_dm_crtc_helper_funcs = {
>>         .disable = dm_crtc_helper_disable,
>>         .atomic_check = dm_crtc_helper_atomic_check,
>> -       .mode_fixup = dm_crtc_helper_mode_fixup
>> +       .mode_fixup = dm_crtc_helper_mode_fixup,
>> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>>  };
>>
>>  static void dm_encoder_helper_disable(struct drm_encoder *encoder)
>> --
>> 2.24.1
>>
>> _______________________________________________
>> amd-gfx mailing list
>> amd-gfx@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/amd-gfx

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [Intel-gfx] [PATCH 02/23] drm/amdgpu: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
@ 2020-01-15  9:41       ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-15  9:41 UTC (permalink / raw)
  To: Alex Deucher
  Cc: hamohammed.sa, Dave Airlie, nouveau,
	Maling list - DRI developers, Eric Anholt, amd-gfx list,
	Benjamin Gaignard, alexandre.torgue, Chunming Zhou,
	Thomas Hellstrom, VMware Graphics, Ben Skeggs, Wentland, Harry,
	mcoquelin.stm32, Leo (Sunpeng) Li, linux-arm-msm,
	Intel Graphics Development, Vincent Abriou, rodrigosiqueiramelo,
	philippe.cornu, yannick.fertre, Deucher, Alexander, freedreno,
	Christian Koenig


[-- Attachment #1.1.1: Type: text/plain, Size: 9116 bytes --]

Hi

Am 13.01.20 um 19:52 schrieb Alex Deucher:
> On Fri, Jan 10, 2020 at 4:21 AM Thomas Zimmermann <tzimmermann@suse.de> wrote:
>>
>> The callback struct drm_driver.get_scanout_position() is deprecated in
>> favor of struct drm_crtc_helper_funcs.get_scanout_position(). Convert
>> amdgpu over.
>>
> 
> I would prefer to just change the signature of
> amdgpu_display_get_crtc_scanoutpos() to match the new API rather than
> wrapping it again.

While trying to adapt the siganture, I found that
amdgpu_display_get_crtc_scanoutpos() requires a flags argument that is
not mappable to the callback API. That wrapper function is necessary.

Best regards
Thomas

> 
> Alex
> 
>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>> ---
>>  drivers/gpu/drm/amd/amdgpu/amdgpu_display.c       | 12 ++++++++++++
>>  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c           | 11 -----------
>>  drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h          |  5 +++++
>>  drivers/gpu/drm/amd/amdgpu/dce_v10_0.c            |  1 +
>>  drivers/gpu/drm/amd/amdgpu/dce_v11_0.c            |  1 +
>>  drivers/gpu/drm/amd/amdgpu/dce_v6_0.c             |  1 +
>>  drivers/gpu/drm/amd/amdgpu/dce_v8_0.c             |  1 +
>>  drivers/gpu/drm/amd/amdgpu/dce_virtual.c          |  1 +
>>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  3 ++-
>>  9 files changed, 24 insertions(+), 12 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
>> index 4e699071d144..a1e769d4417d 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
>> @@ -914,3 +914,15 @@ int amdgpu_display_crtc_idx_to_irq_type(struct amdgpu_device *adev, int crtc)
>>                 return AMDGPU_CRTC_IRQ_NONE;
>>         }
>>  }
>> +
>> +bool amdgpu_crtc_get_scanout_position(struct drm_crtc *crtc,
>> +                       bool in_vblank_irq, int *vpos,
>> +                       int *hpos, ktime_t *stime, ktime_t *etime,
>> +                       const struct drm_display_mode *mode)
>> +{
>> +       struct drm_device *dev = crtc->dev;
>> +       unsigned int pipe = crtc->index;
>> +
>> +       return amdgpu_display_get_crtc_scanoutpos(dev, pipe, 0, vpos, hpos,
>> +                                                 stime, etime, mode);
>> +}
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
>> index 3f6f14ce1511..0749285dd1c7 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
>> @@ -1367,16 +1367,6 @@ int amdgpu_file_to_fpriv(struct file *filp, struct amdgpu_fpriv **fpriv)
>>         return 0;
>>  }
>>
>> -static bool
>> -amdgpu_get_crtc_scanout_position(struct drm_device *dev, unsigned int pipe,
>> -                                bool in_vblank_irq, int *vpos, int *hpos,
>> -                                ktime_t *stime, ktime_t *etime,
>> -                                const struct drm_display_mode *mode)
>> -{
>> -       return amdgpu_display_get_crtc_scanoutpos(dev, pipe, 0, vpos, hpos,
>> -                                                 stime, etime, mode);
>> -}
>> -
>>  static struct drm_driver kms_driver = {
>>         .driver_features =
>>             DRIVER_USE_AGP | DRIVER_ATOMIC |
>> @@ -1391,7 +1381,6 @@ static struct drm_driver kms_driver = {
>>         .enable_vblank = amdgpu_enable_vblank_kms,
>>         .disable_vblank = amdgpu_disable_vblank_kms,
>>         .get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
>> -       .get_scanout_position = amdgpu_get_crtc_scanout_position,
>>         .irq_handler = amdgpu_irq_handler,
>>         .ioctls = amdgpu_ioctls_kms,
>>         .gem_free_object_unlocked = amdgpu_gem_object_free,
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
>> index eb9975f4decb..37ba07e2feb5 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
>> @@ -612,6 +612,11 @@ void amdgpu_panel_mode_fixup(struct drm_encoder *encoder,
>>                              struct drm_display_mode *adjusted_mode);
>>  int amdgpu_display_crtc_idx_to_irq_type(struct amdgpu_device *adev, int crtc);
>>
>> +bool amdgpu_crtc_get_scanout_position(struct drm_crtc *crtc,
>> +                       bool in_vblank_irq, int *vpos,
>> +                       int *hpos, ktime_t *stime, ktime_t *etime,
>> +                       const struct drm_display_mode *mode);
>> +
>>  /* fbdev layer */
>>  int amdgpu_fbdev_init(struct amdgpu_device *adev);
>>  void amdgpu_fbdev_fini(struct amdgpu_device *adev);
>> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
>> index 40d2ac723dd6..bdc1e0f036d4 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
>> @@ -2685,6 +2685,7 @@ static const struct drm_crtc_helper_funcs dce_v10_0_crtc_helper_funcs = {
>>         .prepare = dce_v10_0_crtc_prepare,
>>         .commit = dce_v10_0_crtc_commit,
>>         .disable = dce_v10_0_crtc_disable,
>> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>>  };
>>
>>  static int dce_v10_0_crtc_init(struct amdgpu_device *adev, int index)
>> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
>> index 898ef72d423c..0319da5f7bf9 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
>> @@ -2793,6 +2793,7 @@ static const struct drm_crtc_helper_funcs dce_v11_0_crtc_helper_funcs = {
>>         .prepare = dce_v11_0_crtc_prepare,
>>         .commit = dce_v11_0_crtc_commit,
>>         .disable = dce_v11_0_crtc_disable,
>> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>>  };
>>
>>  static int dce_v11_0_crtc_init(struct amdgpu_device *adev, int index)
>> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
>> index db15a112becc..78642c3b14fc 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
>> @@ -2575,6 +2575,7 @@ static const struct drm_crtc_helper_funcs dce_v6_0_crtc_helper_funcs = {
>>         .prepare = dce_v6_0_crtc_prepare,
>>         .commit = dce_v6_0_crtc_commit,
>>         .disable = dce_v6_0_crtc_disable,
>> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>>  };
>>
>>  static int dce_v6_0_crtc_init(struct amdgpu_device *adev, int index)
>> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
>> index f06c9022c1fd..1e8d4975435a 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
>> @@ -2593,6 +2593,7 @@ static const struct drm_crtc_helper_funcs dce_v8_0_crtc_helper_funcs = {
>>         .prepare = dce_v8_0_crtc_prepare,
>>         .commit = dce_v8_0_crtc_commit,
>>         .disable = dce_v8_0_crtc_disable,
>> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>>  };
>>
>>  static int dce_v8_0_crtc_init(struct amdgpu_device *adev, int index)
>> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
>> index e4f94863332c..4b2f915aba47 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
>> @@ -218,6 +218,7 @@ static const struct drm_crtc_helper_funcs dce_virtual_crtc_helper_funcs = {
>>         .prepare = dce_virtual_crtc_prepare,
>>         .commit = dce_virtual_crtc_commit,
>>         .disable = dce_virtual_crtc_disable,
>> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>>  };
>>
>>  static int dce_virtual_crtc_init(struct amdgpu_device *adev, int index)
>> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> index f2db400a3920..39c5cf242c1b 100644
>> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> @@ -4821,7 +4821,8 @@ static bool dm_crtc_helper_mode_fixup(struct drm_crtc *crtc,
>>  static const struct drm_crtc_helper_funcs amdgpu_dm_crtc_helper_funcs = {
>>         .disable = dm_crtc_helper_disable,
>>         .atomic_check = dm_crtc_helper_atomic_check,
>> -       .mode_fixup = dm_crtc_helper_mode_fixup
>> +       .mode_fixup = dm_crtc_helper_mode_fixup,
>> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>>  };
>>
>>  static void dm_encoder_helper_disable(struct drm_encoder *encoder)
>> --
>> 2.24.1
>>
>> _______________________________________________
>> amd-gfx mailing list
>> amd-gfx@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/amd-gfx

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [PATCH 02/23] drm/amdgpu: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
@ 2020-01-15  9:41       ` Thomas Zimmermann
  0 siblings, 0 replies; 217+ messages in thread
From: Thomas Zimmermann @ 2020-01-15  9:41 UTC (permalink / raw)
  To: Alex Deucher
  Cc: hamohammed.sa, Dave Airlie, nouveau, Joonas Lahtinen,
	Maling list - DRI developers, Eric Anholt, amd-gfx list,
	Benjamin Gaignard, alexandre.torgue, Chunming Zhou,
	Thomas Hellstrom, Sean Paul, Patrik Jakobsson, VMware Graphics,
	Ben Skeggs, Wentland, Harry, mcoquelin.stm32, Leo (Sunpeng) Li,
	linux-arm-msm, Intel Graphics Development, Maarten Lankhorst,
	Jani Nikula, Rodrigo Vivi, Vincent Abriou, rodrigosiqueiramelo,
	philippe.cornu, yannick.fertre, Rob Clark, Daniel Vetter,
	Deucher, Alexander, freedreno, Christian Koenig


[-- Attachment #1.1.1: Type: text/plain, Size: 9116 bytes --]

Hi

Am 13.01.20 um 19:52 schrieb Alex Deucher:
> On Fri, Jan 10, 2020 at 4:21 AM Thomas Zimmermann <tzimmermann@suse.de> wrote:
>>
>> The callback struct drm_driver.get_scanout_position() is deprecated in
>> favor of struct drm_crtc_helper_funcs.get_scanout_position(). Convert
>> amdgpu over.
>>
> 
> I would prefer to just change the signature of
> amdgpu_display_get_crtc_scanoutpos() to match the new API rather than
> wrapping it again.

While trying to adapt the siganture, I found that
amdgpu_display_get_crtc_scanoutpos() requires a flags argument that is
not mappable to the callback API. That wrapper function is necessary.

Best regards
Thomas

> 
> Alex
> 
>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>> ---
>>  drivers/gpu/drm/amd/amdgpu/amdgpu_display.c       | 12 ++++++++++++
>>  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c           | 11 -----------
>>  drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h          |  5 +++++
>>  drivers/gpu/drm/amd/amdgpu/dce_v10_0.c            |  1 +
>>  drivers/gpu/drm/amd/amdgpu/dce_v11_0.c            |  1 +
>>  drivers/gpu/drm/amd/amdgpu/dce_v6_0.c             |  1 +
>>  drivers/gpu/drm/amd/amdgpu/dce_v8_0.c             |  1 +
>>  drivers/gpu/drm/amd/amdgpu/dce_virtual.c          |  1 +
>>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  3 ++-
>>  9 files changed, 24 insertions(+), 12 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
>> index 4e699071d144..a1e769d4417d 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
>> @@ -914,3 +914,15 @@ int amdgpu_display_crtc_idx_to_irq_type(struct amdgpu_device *adev, int crtc)
>>                 return AMDGPU_CRTC_IRQ_NONE;
>>         }
>>  }
>> +
>> +bool amdgpu_crtc_get_scanout_position(struct drm_crtc *crtc,
>> +                       bool in_vblank_irq, int *vpos,
>> +                       int *hpos, ktime_t *stime, ktime_t *etime,
>> +                       const struct drm_display_mode *mode)
>> +{
>> +       struct drm_device *dev = crtc->dev;
>> +       unsigned int pipe = crtc->index;
>> +
>> +       return amdgpu_display_get_crtc_scanoutpos(dev, pipe, 0, vpos, hpos,
>> +                                                 stime, etime, mode);
>> +}
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
>> index 3f6f14ce1511..0749285dd1c7 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
>> @@ -1367,16 +1367,6 @@ int amdgpu_file_to_fpriv(struct file *filp, struct amdgpu_fpriv **fpriv)
>>         return 0;
>>  }
>>
>> -static bool
>> -amdgpu_get_crtc_scanout_position(struct drm_device *dev, unsigned int pipe,
>> -                                bool in_vblank_irq, int *vpos, int *hpos,
>> -                                ktime_t *stime, ktime_t *etime,
>> -                                const struct drm_display_mode *mode)
>> -{
>> -       return amdgpu_display_get_crtc_scanoutpos(dev, pipe, 0, vpos, hpos,
>> -                                                 stime, etime, mode);
>> -}
>> -
>>  static struct drm_driver kms_driver = {
>>         .driver_features =
>>             DRIVER_USE_AGP | DRIVER_ATOMIC |
>> @@ -1391,7 +1381,6 @@ static struct drm_driver kms_driver = {
>>         .enable_vblank = amdgpu_enable_vblank_kms,
>>         .disable_vblank = amdgpu_disable_vblank_kms,
>>         .get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
>> -       .get_scanout_position = amdgpu_get_crtc_scanout_position,
>>         .irq_handler = amdgpu_irq_handler,
>>         .ioctls = amdgpu_ioctls_kms,
>>         .gem_free_object_unlocked = amdgpu_gem_object_free,
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
>> index eb9975f4decb..37ba07e2feb5 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
>> @@ -612,6 +612,11 @@ void amdgpu_panel_mode_fixup(struct drm_encoder *encoder,
>>                              struct drm_display_mode *adjusted_mode);
>>  int amdgpu_display_crtc_idx_to_irq_type(struct amdgpu_device *adev, int crtc);
>>
>> +bool amdgpu_crtc_get_scanout_position(struct drm_crtc *crtc,
>> +                       bool in_vblank_irq, int *vpos,
>> +                       int *hpos, ktime_t *stime, ktime_t *etime,
>> +                       const struct drm_display_mode *mode);
>> +
>>  /* fbdev layer */
>>  int amdgpu_fbdev_init(struct amdgpu_device *adev);
>>  void amdgpu_fbdev_fini(struct amdgpu_device *adev);
>> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
>> index 40d2ac723dd6..bdc1e0f036d4 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
>> @@ -2685,6 +2685,7 @@ static const struct drm_crtc_helper_funcs dce_v10_0_crtc_helper_funcs = {
>>         .prepare = dce_v10_0_crtc_prepare,
>>         .commit = dce_v10_0_crtc_commit,
>>         .disable = dce_v10_0_crtc_disable,
>> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>>  };
>>
>>  static int dce_v10_0_crtc_init(struct amdgpu_device *adev, int index)
>> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
>> index 898ef72d423c..0319da5f7bf9 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
>> @@ -2793,6 +2793,7 @@ static const struct drm_crtc_helper_funcs dce_v11_0_crtc_helper_funcs = {
>>         .prepare = dce_v11_0_crtc_prepare,
>>         .commit = dce_v11_0_crtc_commit,
>>         .disable = dce_v11_0_crtc_disable,
>> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>>  };
>>
>>  static int dce_v11_0_crtc_init(struct amdgpu_device *adev, int index)
>> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
>> index db15a112becc..78642c3b14fc 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
>> @@ -2575,6 +2575,7 @@ static const struct drm_crtc_helper_funcs dce_v6_0_crtc_helper_funcs = {
>>         .prepare = dce_v6_0_crtc_prepare,
>>         .commit = dce_v6_0_crtc_commit,
>>         .disable = dce_v6_0_crtc_disable,
>> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>>  };
>>
>>  static int dce_v6_0_crtc_init(struct amdgpu_device *adev, int index)
>> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
>> index f06c9022c1fd..1e8d4975435a 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
>> @@ -2593,6 +2593,7 @@ static const struct drm_crtc_helper_funcs dce_v8_0_crtc_helper_funcs = {
>>         .prepare = dce_v8_0_crtc_prepare,
>>         .commit = dce_v8_0_crtc_commit,
>>         .disable = dce_v8_0_crtc_disable,
>> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>>  };
>>
>>  static int dce_v8_0_crtc_init(struct amdgpu_device *adev, int index)
>> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
>> index e4f94863332c..4b2f915aba47 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
>> @@ -218,6 +218,7 @@ static const struct drm_crtc_helper_funcs dce_virtual_crtc_helper_funcs = {
>>         .prepare = dce_virtual_crtc_prepare,
>>         .commit = dce_virtual_crtc_commit,
>>         .disable = dce_virtual_crtc_disable,
>> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>>  };
>>
>>  static int dce_virtual_crtc_init(struct amdgpu_device *adev, int index)
>> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> index f2db400a3920..39c5cf242c1b 100644
>> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> @@ -4821,7 +4821,8 @@ static bool dm_crtc_helper_mode_fixup(struct drm_crtc *crtc,
>>  static const struct drm_crtc_helper_funcs amdgpu_dm_crtc_helper_funcs = {
>>         .disable = dm_crtc_helper_disable,
>>         .atomic_check = dm_crtc_helper_atomic_check,
>> -       .mode_fixup = dm_crtc_helper_mode_fixup
>> +       .mode_fixup = dm_crtc_helper_mode_fixup,
>> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
>>  };
>>
>>  static void dm_encoder_helper_disable(struct drm_encoder *encoder)
>> --
>> 2.24.1
>>
>> _______________________________________________
>> amd-gfx mailing list
>> amd-gfx@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/amd-gfx

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [PATCH 02/23] drm/amdgpu: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
  2020-01-15  9:41       ` Thomas Zimmermann
                           ` (2 preceding siblings ...)
  (?)
@ 2020-01-15 16:35         ` Alex Deucher
  -1 siblings, 0 replies; 217+ messages in thread
From: Alex Deucher @ 2020-01-15 16:35 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: Dave Airlie, Daniel Vetter, Deucher, Alexander, Christian Koenig,
	Chunming Zhou, Maarten Lankhorst, Patrik Jakobsson, Rob Clark,
	Sean Paul, Benjamin Gaignard, Vincent Abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, Eric Anholt,
	rodrigosiqueiramelo, hamohammed.sa, VMware Graphics,
	Thomas Hellstrom, Ben Skeggs, Wentland, Harry, Leo (Sunpeng) Li,
	Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, linux-arm-msm,
	Intel Graphics Development, amd-gfx list,
	Maling list - DRI developers, nouveau, freedreno

On Wed, Jan 15, 2020 at 4:41 AM Thomas Zimmermann <tzimmermann@suse.de> wrote:
>
> Hi
>
> Am 13.01.20 um 19:52 schrieb Alex Deucher:
> > On Fri, Jan 10, 2020 at 4:21 AM Thomas Zimmermann <tzimmermann@suse.de> wrote:
> >>
> >> The callback struct drm_driver.get_scanout_position() is deprecated in
> >> favor of struct drm_crtc_helper_funcs.get_scanout_position(). Convert
> >> amdgpu over.
> >>
> >
> > I would prefer to just change the signature of
> > amdgpu_display_get_crtc_scanoutpos() to match the new API rather than
> > wrapping it again.
>
> While trying to adapt the siganture, I found that
> amdgpu_display_get_crtc_scanoutpos() requires a flags argument that is
> not mappable to the callback API. That wrapper function is necessary.
>

No worries.  We can clean them up later.  Wrapping is fine.

Alex

> Best regards
> Thomas
>
> >
> > Alex
> >
> >> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> >> ---
> >>  drivers/gpu/drm/amd/amdgpu/amdgpu_display.c       | 12 ++++++++++++
> >>  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c           | 11 -----------
> >>  drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h          |  5 +++++
> >>  drivers/gpu/drm/amd/amdgpu/dce_v10_0.c            |  1 +
> >>  drivers/gpu/drm/amd/amdgpu/dce_v11_0.c            |  1 +
> >>  drivers/gpu/drm/amd/amdgpu/dce_v6_0.c             |  1 +
> >>  drivers/gpu/drm/amd/amdgpu/dce_v8_0.c             |  1 +
> >>  drivers/gpu/drm/amd/amdgpu/dce_virtual.c          |  1 +
> >>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  3 ++-
> >>  9 files changed, 24 insertions(+), 12 deletions(-)
> >>
> >> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> >> index 4e699071d144..a1e769d4417d 100644
> >> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> >> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> >> @@ -914,3 +914,15 @@ int amdgpu_display_crtc_idx_to_irq_type(struct amdgpu_device *adev, int crtc)
> >>                 return AMDGPU_CRTC_IRQ_NONE;
> >>         }
> >>  }
> >> +
> >> +bool amdgpu_crtc_get_scanout_position(struct drm_crtc *crtc,
> >> +                       bool in_vblank_irq, int *vpos,
> >> +                       int *hpos, ktime_t *stime, ktime_t *etime,
> >> +                       const struct drm_display_mode *mode)
> >> +{
> >> +       struct drm_device *dev = crtc->dev;
> >> +       unsigned int pipe = crtc->index;
> >> +
> >> +       return amdgpu_display_get_crtc_scanoutpos(dev, pipe, 0, vpos, hpos,
> >> +                                                 stime, etime, mode);
> >> +}
> >> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> >> index 3f6f14ce1511..0749285dd1c7 100644
> >> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> >> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> >> @@ -1367,16 +1367,6 @@ int amdgpu_file_to_fpriv(struct file *filp, struct amdgpu_fpriv **fpriv)
> >>         return 0;
> >>  }
> >>
> >> -static bool
> >> -amdgpu_get_crtc_scanout_position(struct drm_device *dev, unsigned int pipe,
> >> -                                bool in_vblank_irq, int *vpos, int *hpos,
> >> -                                ktime_t *stime, ktime_t *etime,
> >> -                                const struct drm_display_mode *mode)
> >> -{
> >> -       return amdgpu_display_get_crtc_scanoutpos(dev, pipe, 0, vpos, hpos,
> >> -                                                 stime, etime, mode);
> >> -}
> >> -
> >>  static struct drm_driver kms_driver = {
> >>         .driver_features =
> >>             DRIVER_USE_AGP | DRIVER_ATOMIC |
> >> @@ -1391,7 +1381,6 @@ static struct drm_driver kms_driver = {
> >>         .enable_vblank = amdgpu_enable_vblank_kms,
> >>         .disable_vblank = amdgpu_disable_vblank_kms,
> >>         .get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
> >> -       .get_scanout_position = amdgpu_get_crtc_scanout_position,
> >>         .irq_handler = amdgpu_irq_handler,
> >>         .ioctls = amdgpu_ioctls_kms,
> >>         .gem_free_object_unlocked = amdgpu_gem_object_free,
> >> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
> >> index eb9975f4decb..37ba07e2feb5 100644
> >> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
> >> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
> >> @@ -612,6 +612,11 @@ void amdgpu_panel_mode_fixup(struct drm_encoder *encoder,
> >>                              struct drm_display_mode *adjusted_mode);
> >>  int amdgpu_display_crtc_idx_to_irq_type(struct amdgpu_device *adev, int crtc);
> >>
> >> +bool amdgpu_crtc_get_scanout_position(struct drm_crtc *crtc,
> >> +                       bool in_vblank_irq, int *vpos,
> >> +                       int *hpos, ktime_t *stime, ktime_t *etime,
> >> +                       const struct drm_display_mode *mode);
> >> +
> >>  /* fbdev layer */
> >>  int amdgpu_fbdev_init(struct amdgpu_device *adev);
> >>  void amdgpu_fbdev_fini(struct amdgpu_device *adev);
> >> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> >> index 40d2ac723dd6..bdc1e0f036d4 100644
> >> --- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> >> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> >> @@ -2685,6 +2685,7 @@ static const struct drm_crtc_helper_funcs dce_v10_0_crtc_helper_funcs = {
> >>         .prepare = dce_v10_0_crtc_prepare,
> >>         .commit = dce_v10_0_crtc_commit,
> >>         .disable = dce_v10_0_crtc_disable,
> >> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
> >>  };
> >>
> >>  static int dce_v10_0_crtc_init(struct amdgpu_device *adev, int index)
> >> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> >> index 898ef72d423c..0319da5f7bf9 100644
> >> --- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> >> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> >> @@ -2793,6 +2793,7 @@ static const struct drm_crtc_helper_funcs dce_v11_0_crtc_helper_funcs = {
> >>         .prepare = dce_v11_0_crtc_prepare,
> >>         .commit = dce_v11_0_crtc_commit,
> >>         .disable = dce_v11_0_crtc_disable,
> >> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
> >>  };
> >>
> >>  static int dce_v11_0_crtc_init(struct amdgpu_device *adev, int index)
> >> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> >> index db15a112becc..78642c3b14fc 100644
> >> --- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> >> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> >> @@ -2575,6 +2575,7 @@ static const struct drm_crtc_helper_funcs dce_v6_0_crtc_helper_funcs = {
> >>         .prepare = dce_v6_0_crtc_prepare,
> >>         .commit = dce_v6_0_crtc_commit,
> >>         .disable = dce_v6_0_crtc_disable,
> >> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
> >>  };
> >>
> >>  static int dce_v6_0_crtc_init(struct amdgpu_device *adev, int index)
> >> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> >> index f06c9022c1fd..1e8d4975435a 100644
> >> --- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> >> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> >> @@ -2593,6 +2593,7 @@ static const struct drm_crtc_helper_funcs dce_v8_0_crtc_helper_funcs = {
> >>         .prepare = dce_v8_0_crtc_prepare,
> >>         .commit = dce_v8_0_crtc_commit,
> >>         .disable = dce_v8_0_crtc_disable,
> >> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
> >>  };
> >>
> >>  static int dce_v8_0_crtc_init(struct amdgpu_device *adev, int index)
> >> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
> >> index e4f94863332c..4b2f915aba47 100644
> >> --- a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
> >> +++ b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
> >> @@ -218,6 +218,7 @@ static const struct drm_crtc_helper_funcs dce_virtual_crtc_helper_funcs = {
> >>         .prepare = dce_virtual_crtc_prepare,
> >>         .commit = dce_virtual_crtc_commit,
> >>         .disable = dce_virtual_crtc_disable,
> >> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
> >>  };
> >>
> >>  static int dce_virtual_crtc_init(struct amdgpu_device *adev, int index)
> >> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> >> index f2db400a3920..39c5cf242c1b 100644
> >> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> >> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> >> @@ -4821,7 +4821,8 @@ static bool dm_crtc_helper_mode_fixup(struct drm_crtc *crtc,
> >>  static const struct drm_crtc_helper_funcs amdgpu_dm_crtc_helper_funcs = {
> >>         .disable = dm_crtc_helper_disable,
> >>         .atomic_check = dm_crtc_helper_atomic_check,
> >> -       .mode_fixup = dm_crtc_helper_mode_fixup
> >> +       .mode_fixup = dm_crtc_helper_mode_fixup,
> >> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
> >>  };
> >>
> >>  static void dm_encoder_helper_disable(struct drm_encoder *encoder)
> >> --
> >> 2.24.1
> >>
> >> _______________________________________________
> >> amd-gfx mailing list
> >> amd-gfx@lists.freedesktop.org
> >> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
>
> --
> Thomas Zimmermann
> Graphics Driver Developer
> SUSE Software Solutions Germany GmbH
> Maxfeldstr. 5, 90409 Nürnberg, Germany
> (HRB 36809, AG Nürnberg)
> Geschäftsführer: Felix Imendörffer
>

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [PATCH 02/23] drm/amdgpu: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
@ 2020-01-15 16:35         ` Alex Deucher
  0 siblings, 0 replies; 217+ messages in thread
From: Alex Deucher @ 2020-01-15 16:35 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: Dave Airlie, Daniel Vetter, Deucher, Alexander, Christian Koenig,
	Chunming Zhou, Maarten Lankhorst, Patrik Jakobsson, Rob Clark,
	Sean Paul, Benjamin Gaignard, Vincent Abriou, yannick.fertre,
	philippe.cornu, mcoquelin.stm32, alexandre.torgue, Eric Anholt,
	rodrigosiqueiramelo, hamohammed.sa, VMware Graphics,
	Thomas Hellstrom, Ben Skeggs, Wentla

On Wed, Jan 15, 2020 at 4:41 AM Thomas Zimmermann <tzimmermann@suse.de> wrote:
>
> Hi
>
> Am 13.01.20 um 19:52 schrieb Alex Deucher:
> > On Fri, Jan 10, 2020 at 4:21 AM Thomas Zimmermann <tzimmermann@suse.de> wrote:
> >>
> >> The callback struct drm_driver.get_scanout_position() is deprecated in
> >> favor of struct drm_crtc_helper_funcs.get_scanout_position(). Convert
> >> amdgpu over.
> >>
> >
> > I would prefer to just change the signature of
> > amdgpu_display_get_crtc_scanoutpos() to match the new API rather than
> > wrapping it again.
>
> While trying to adapt the siganture, I found that
> amdgpu_display_get_crtc_scanoutpos() requires a flags argument that is
> not mappable to the callback API. That wrapper function is necessary.
>

No worries.  We can clean them up later.  Wrapping is fine.

Alex

> Best regards
> Thomas
>
> >
> > Alex
> >
> >> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> >> ---
> >>  drivers/gpu/drm/amd/amdgpu/amdgpu_display.c       | 12 ++++++++++++
> >>  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c           | 11 -----------
> >>  drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h          |  5 +++++
> >>  drivers/gpu/drm/amd/amdgpu/dce_v10_0.c            |  1 +
> >>  drivers/gpu/drm/amd/amdgpu/dce_v11_0.c            |  1 +
> >>  drivers/gpu/drm/amd/amdgpu/dce_v6_0.c             |  1 +
> >>  drivers/gpu/drm/amd/amdgpu/dce_v8_0.c             |  1 +
> >>  drivers/gpu/drm/amd/amdgpu/dce_virtual.c          |  1 +
> >>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  3 ++-
> >>  9 files changed, 24 insertions(+), 12 deletions(-)
> >>
> >> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> >> index 4e699071d144..a1e769d4417d 100644
> >> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> >> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> >> @@ -914,3 +914,15 @@ int amdgpu_display_crtc_idx_to_irq_type(struct amdgpu_device *adev, int crtc)
> >>                 return AMDGPU_CRTC_IRQ_NONE;
> >>         }
> >>  }
> >> +
> >> +bool amdgpu_crtc_get_scanout_position(struct drm_crtc *crtc,
> >> +                       bool in_vblank_irq, int *vpos,
> >> +                       int *hpos, ktime_t *stime, ktime_t *etime,
> >> +                       const struct drm_display_mode *mode)
> >> +{
> >> +       struct drm_device *dev = crtc->dev;
> >> +       unsigned int pipe = crtc->index;
> >> +
> >> +       return amdgpu_display_get_crtc_scanoutpos(dev, pipe, 0, vpos, hpos,
> >> +                                                 stime, etime, mode);
> >> +}
> >> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> >> index 3f6f14ce1511..0749285dd1c7 100644
> >> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> >> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> >> @@ -1367,16 +1367,6 @@ int amdgpu_file_to_fpriv(struct file *filp, struct amdgpu_fpriv **fpriv)
> >>         return 0;
> >>  }
> >>
> >> -static bool
> >> -amdgpu_get_crtc_scanout_position(struct drm_device *dev, unsigned int pipe,
> >> -                                bool in_vblank_irq, int *vpos, int *hpos,
> >> -                                ktime_t *stime, ktime_t *etime,
> >> -                                const struct drm_display_mode *mode)
> >> -{
> >> -       return amdgpu_display_get_crtc_scanoutpos(dev, pipe, 0, vpos, hpos,
> >> -                                                 stime, etime, mode);
> >> -}
> >> -
> >>  static struct drm_driver kms_driver = {
> >>         .driver_features =
> >>             DRIVER_USE_AGP | DRIVER_ATOMIC |
> >> @@ -1391,7 +1381,6 @@ static struct drm_driver kms_driver = {
> >>         .enable_vblank = amdgpu_enable_vblank_kms,
> >>         .disable_vblank = amdgpu_disable_vblank_kms,
> >>         .get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
> >> -       .get_scanout_position = amdgpu_get_crtc_scanout_position,
> >>         .irq_handler = amdgpu_irq_handler,
> >>         .ioctls = amdgpu_ioctls_kms,
> >>         .gem_free_object_unlocked = amdgpu_gem_object_free,
> >> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
> >> index eb9975f4decb..37ba07e2feb5 100644
> >> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
> >> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
> >> @@ -612,6 +612,11 @@ void amdgpu_panel_mode_fixup(struct drm_encoder *encoder,
> >>                              struct drm_display_mode *adjusted_mode);
> >>  int amdgpu_display_crtc_idx_to_irq_type(struct amdgpu_device *adev, int crtc);
> >>
> >> +bool amdgpu_crtc_get_scanout_position(struct drm_crtc *crtc,
> >> +                       bool in_vblank_irq, int *vpos,
> >> +                       int *hpos, ktime_t *stime, ktime_t *etime,
> >> +                       const struct drm_display_mode *mode);
> >> +
> >>  /* fbdev layer */
> >>  int amdgpu_fbdev_init(struct amdgpu_device *adev);
> >>  void amdgpu_fbdev_fini(struct amdgpu_device *adev);
> >> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> >> index 40d2ac723dd6..bdc1e0f036d4 100644
> >> --- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> >> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> >> @@ -2685,6 +2685,7 @@ static const struct drm_crtc_helper_funcs dce_v10_0_crtc_helper_funcs = {
> >>         .prepare = dce_v10_0_crtc_prepare,
> >>         .commit = dce_v10_0_crtc_commit,
> >>         .disable = dce_v10_0_crtc_disable,
> >> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
> >>  };
> >>
> >>  static int dce_v10_0_crtc_init(struct amdgpu_device *adev, int index)
> >> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> >> index 898ef72d423c..0319da5f7bf9 100644
> >> --- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> >> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> >> @@ -2793,6 +2793,7 @@ static const struct drm_crtc_helper_funcs dce_v11_0_crtc_helper_funcs = {
> >>         .prepare = dce_v11_0_crtc_prepare,
> >>         .commit = dce_v11_0_crtc_commit,
> >>         .disable = dce_v11_0_crtc_disable,
> >> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
> >>  };
> >>
> >>  static int dce_v11_0_crtc_init(struct amdgpu_device *adev, int index)
> >> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> >> index db15a112becc..78642c3b14fc 100644
> >> --- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> >> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> >> @@ -2575,6 +2575,7 @@ static const struct drm_crtc_helper_funcs dce_v6_0_crtc_helper_funcs = {
> >>         .prepare = dce_v6_0_crtc_prepare,
> >>         .commit = dce_v6_0_crtc_commit,
> >>         .disable = dce_v6_0_crtc_disable,
> >> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
> >>  };
> >>
> >>  static int dce_v6_0_crtc_init(struct amdgpu_device *adev, int index)
> >> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> >> index f06c9022c1fd..1e8d4975435a 100644
> >> --- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> >> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> >> @@ -2593,6 +2593,7 @@ static const struct drm_crtc_helper_funcs dce_v8_0_crtc_helper_funcs = {
> >>         .prepare = dce_v8_0_crtc_prepare,
> >>         .commit = dce_v8_0_crtc_commit,
> >>         .disable = dce_v8_0_crtc_disable,
> >> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
> >>  };
> >>
> >>  static int dce_v8_0_crtc_init(struct amdgpu_device *adev, int index)
> >> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
> >> index e4f94863332c..4b2f915aba47 100644
> >> --- a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
> >> +++ b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
> >> @@ -218,6 +218,7 @@ static const struct drm_crtc_helper_funcs dce_virtual_crtc_helper_funcs = {
> >>         .prepare = dce_virtual_crtc_prepare,
> >>         .commit = dce_virtual_crtc_commit,
> >>         .disable = dce_virtual_crtc_disable,
> >> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
> >>  };
> >>
> >>  static int dce_virtual_crtc_init(struct amdgpu_device *adev, int index)
> >> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> >> index f2db400a3920..39c5cf242c1b 100644
> >> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> >> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> >> @@ -4821,7 +4821,8 @@ static bool dm_crtc_helper_mode_fixup(struct drm_crtc *crtc,
> >>  static const struct drm_crtc_helper_funcs amdgpu_dm_crtc_helper_funcs = {
> >>         .disable = dm_crtc_helper_disable,
> >>         .atomic_check = dm_crtc_helper_atomic_check,
> >> -       .mode_fixup = dm_crtc_helper_mode_fixup
> >> +       .mode_fixup = dm_crtc_helper_mode_fixup,
> >> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
> >>  };
> >>
> >>  static void dm_encoder_helper_disable(struct drm_encoder *encoder)
> >> --
> >> 2.24.1
> >>
> >> _______________________________________________
> >> amd-gfx mailing list
> >> amd-gfx@lists.freedesktop.org
> >> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
>
> --
> Thomas Zimmermann
> Graphics Driver Developer
> SUSE Software Solutions Germany GmbH
> Maxfeldstr. 5, 90409 Nürnberg, Germany
> (HRB 36809, AG Nürnberg)
> Geschäftsführer: Felix Imendörffer
>

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [PATCH 02/23] drm/amdgpu: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
@ 2020-01-15 16:35         ` Alex Deucher
  0 siblings, 0 replies; 217+ messages in thread
From: Alex Deucher @ 2020-01-15 16:35 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: hamohammed.sa, Dave Airlie, nouveau,
	Maling list - DRI developers, amd-gfx list, alexandre.torgue,
	Thomas Hellstrom, Sean Paul, VMware Graphics, Ben Skeggs,
	mcoquelin.stm32, Leo (Sunpeng) Li, linux-arm-msm,
	Intel Graphics Development, Rodrigo Vivi, Vincent Abriou,
	rodrigosiqueiramelo, philippe.cornu, yannick.fertre, Deucher,
	Alexander, freedreno, Christian Koenig

On Wed, Jan 15, 2020 at 4:41 AM Thomas Zimmermann <tzimmermann@suse.de> wrote:
>
> Hi
>
> Am 13.01.20 um 19:52 schrieb Alex Deucher:
> > On Fri, Jan 10, 2020 at 4:21 AM Thomas Zimmermann <tzimmermann@suse.de> wrote:
> >>
> >> The callback struct drm_driver.get_scanout_position() is deprecated in
> >> favor of struct drm_crtc_helper_funcs.get_scanout_position(). Convert
> >> amdgpu over.
> >>
> >
> > I would prefer to just change the signature of
> > amdgpu_display_get_crtc_scanoutpos() to match the new API rather than
> > wrapping it again.
>
> While trying to adapt the siganture, I found that
> amdgpu_display_get_crtc_scanoutpos() requires a flags argument that is
> not mappable to the callback API. That wrapper function is necessary.
>

No worries.  We can clean them up later.  Wrapping is fine.

Alex

> Best regards
> Thomas
>
> >
> > Alex
> >
> >> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> >> ---
> >>  drivers/gpu/drm/amd/amdgpu/amdgpu_display.c       | 12 ++++++++++++
> >>  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c           | 11 -----------
> >>  drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h          |  5 +++++
> >>  drivers/gpu/drm/amd/amdgpu/dce_v10_0.c            |  1 +
> >>  drivers/gpu/drm/amd/amdgpu/dce_v11_0.c            |  1 +
> >>  drivers/gpu/drm/amd/amdgpu/dce_v6_0.c             |  1 +
> >>  drivers/gpu/drm/amd/amdgpu/dce_v8_0.c             |  1 +
> >>  drivers/gpu/drm/amd/amdgpu/dce_virtual.c          |  1 +
> >>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  3 ++-
> >>  9 files changed, 24 insertions(+), 12 deletions(-)
> >>
> >> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> >> index 4e699071d144..a1e769d4417d 100644
> >> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> >> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> >> @@ -914,3 +914,15 @@ int amdgpu_display_crtc_idx_to_irq_type(struct amdgpu_device *adev, int crtc)
> >>                 return AMDGPU_CRTC_IRQ_NONE;
> >>         }
> >>  }
> >> +
> >> +bool amdgpu_crtc_get_scanout_position(struct drm_crtc *crtc,
> >> +                       bool in_vblank_irq, int *vpos,
> >> +                       int *hpos, ktime_t *stime, ktime_t *etime,
> >> +                       const struct drm_display_mode *mode)
> >> +{
> >> +       struct drm_device *dev = crtc->dev;
> >> +       unsigned int pipe = crtc->index;
> >> +
> >> +       return amdgpu_display_get_crtc_scanoutpos(dev, pipe, 0, vpos, hpos,
> >> +                                                 stime, etime, mode);
> >> +}
> >> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> >> index 3f6f14ce1511..0749285dd1c7 100644
> >> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> >> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> >> @@ -1367,16 +1367,6 @@ int amdgpu_file_to_fpriv(struct file *filp, struct amdgpu_fpriv **fpriv)
> >>         return 0;
> >>  }
> >>
> >> -static bool
> >> -amdgpu_get_crtc_scanout_position(struct drm_device *dev, unsigned int pipe,
> >> -                                bool in_vblank_irq, int *vpos, int *hpos,
> >> -                                ktime_t *stime, ktime_t *etime,
> >> -                                const struct drm_display_mode *mode)
> >> -{
> >> -       return amdgpu_display_get_crtc_scanoutpos(dev, pipe, 0, vpos, hpos,
> >> -                                                 stime, etime, mode);
> >> -}
> >> -
> >>  static struct drm_driver kms_driver = {
> >>         .driver_features =
> >>             DRIVER_USE_AGP | DRIVER_ATOMIC |
> >> @@ -1391,7 +1381,6 @@ static struct drm_driver kms_driver = {
> >>         .enable_vblank = amdgpu_enable_vblank_kms,
> >>         .disable_vblank = amdgpu_disable_vblank_kms,
> >>         .get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
> >> -       .get_scanout_position = amdgpu_get_crtc_scanout_position,
> >>         .irq_handler = amdgpu_irq_handler,
> >>         .ioctls = amdgpu_ioctls_kms,
> >>         .gem_free_object_unlocked = amdgpu_gem_object_free,
> >> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
> >> index eb9975f4decb..37ba07e2feb5 100644
> >> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
> >> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
> >> @@ -612,6 +612,11 @@ void amdgpu_panel_mode_fixup(struct drm_encoder *encoder,
> >>                              struct drm_display_mode *adjusted_mode);
> >>  int amdgpu_display_crtc_idx_to_irq_type(struct amdgpu_device *adev, int crtc);
> >>
> >> +bool amdgpu_crtc_get_scanout_position(struct drm_crtc *crtc,
> >> +                       bool in_vblank_irq, int *vpos,
> >> +                       int *hpos, ktime_t *stime, ktime_t *etime,
> >> +                       const struct drm_display_mode *mode);
> >> +
> >>  /* fbdev layer */
> >>  int amdgpu_fbdev_init(struct amdgpu_device *adev);
> >>  void amdgpu_fbdev_fini(struct amdgpu_device *adev);
> >> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> >> index 40d2ac723dd6..bdc1e0f036d4 100644
> >> --- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> >> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> >> @@ -2685,6 +2685,7 @@ static const struct drm_crtc_helper_funcs dce_v10_0_crtc_helper_funcs = {
> >>         .prepare = dce_v10_0_crtc_prepare,
> >>         .commit = dce_v10_0_crtc_commit,
> >>         .disable = dce_v10_0_crtc_disable,
> >> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
> >>  };
> >>
> >>  static int dce_v10_0_crtc_init(struct amdgpu_device *adev, int index)
> >> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> >> index 898ef72d423c..0319da5f7bf9 100644
> >> --- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> >> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> >> @@ -2793,6 +2793,7 @@ static const struct drm_crtc_helper_funcs dce_v11_0_crtc_helper_funcs = {
> >>         .prepare = dce_v11_0_crtc_prepare,
> >>         .commit = dce_v11_0_crtc_commit,
> >>         .disable = dce_v11_0_crtc_disable,
> >> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
> >>  };
> >>
> >>  static int dce_v11_0_crtc_init(struct amdgpu_device *adev, int index)
> >> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> >> index db15a112becc..78642c3b14fc 100644
> >> --- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> >> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> >> @@ -2575,6 +2575,7 @@ static const struct drm_crtc_helper_funcs dce_v6_0_crtc_helper_funcs = {
> >>         .prepare = dce_v6_0_crtc_prepare,
> >>         .commit = dce_v6_0_crtc_commit,
> >>         .disable = dce_v6_0_crtc_disable,
> >> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
> >>  };
> >>
> >>  static int dce_v6_0_crtc_init(struct amdgpu_device *adev, int index)
> >> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> >> index f06c9022c1fd..1e8d4975435a 100644
> >> --- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> >> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> >> @@ -2593,6 +2593,7 @@ static const struct drm_crtc_helper_funcs dce_v8_0_crtc_helper_funcs = {
> >>         .prepare = dce_v8_0_crtc_prepare,
> >>         .commit = dce_v8_0_crtc_commit,
> >>         .disable = dce_v8_0_crtc_disable,
> >> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
> >>  };
> >>
> >>  static int dce_v8_0_crtc_init(struct amdgpu_device *adev, int index)
> >> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
> >> index e4f94863332c..4b2f915aba47 100644
> >> --- a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
> >> +++ b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
> >> @@ -218,6 +218,7 @@ static const struct drm_crtc_helper_funcs dce_virtual_crtc_helper_funcs = {
> >>         .prepare = dce_virtual_crtc_prepare,
> >>         .commit = dce_virtual_crtc_commit,
> >>         .disable = dce_virtual_crtc_disable,
> >> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
> >>  };
> >>
> >>  static int dce_virtual_crtc_init(struct amdgpu_device *adev, int index)
> >> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> >> index f2db400a3920..39c5cf242c1b 100644
> >> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> >> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> >> @@ -4821,7 +4821,8 @@ static bool dm_crtc_helper_mode_fixup(struct drm_crtc *crtc,
> >>  static const struct drm_crtc_helper_funcs amdgpu_dm_crtc_helper_funcs = {
> >>         .disable = dm_crtc_helper_disable,
> >>         .atomic_check = dm_crtc_helper_atomic_check,
> >> -       .mode_fixup = dm_crtc_helper_mode_fixup
> >> +       .mode_fixup = dm_crtc_helper_mode_fixup,
> >> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
> >>  };
> >>
> >>  static void dm_encoder_helper_disable(struct drm_encoder *encoder)
> >> --
> >> 2.24.1
> >>
> >> _______________________________________________
> >> amd-gfx mailing list
> >> amd-gfx@lists.freedesktop.org
> >> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
>
> --
> Thomas Zimmermann
> Graphics Driver Developer
> SUSE Software Solutions Germany GmbH
> Maxfeldstr. 5, 90409 Nürnberg, Germany
> (HRB 36809, AG Nürnberg)
> Geschäftsführer: Felix Imendörffer
>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [Intel-gfx] [PATCH 02/23] drm/amdgpu: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
@ 2020-01-15 16:35         ` Alex Deucher
  0 siblings, 0 replies; 217+ messages in thread
From: Alex Deucher @ 2020-01-15 16:35 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: hamohammed.sa, Dave Airlie, nouveau,
	Maling list - DRI developers, Eric Anholt, amd-gfx list,
	Benjamin Gaignard, alexandre.torgue, Chunming Zhou,
	Thomas Hellstrom, VMware Graphics, Ben Skeggs, Wentland, Harry,
	mcoquelin.stm32, Leo (Sunpeng) Li, linux-arm-msm,
	Intel Graphics Development, Vincent Abriou, rodrigosiqueiramelo,
	philippe.cornu, yannick.fertre, Deucher, Alexander, freedreno,
	Christian Koenig

On Wed, Jan 15, 2020 at 4:41 AM Thomas Zimmermann <tzimmermann@suse.de> wrote:
>
> Hi
>
> Am 13.01.20 um 19:52 schrieb Alex Deucher:
> > On Fri, Jan 10, 2020 at 4:21 AM Thomas Zimmermann <tzimmermann@suse.de> wrote:
> >>
> >> The callback struct drm_driver.get_scanout_position() is deprecated in
> >> favor of struct drm_crtc_helper_funcs.get_scanout_position(). Convert
> >> amdgpu over.
> >>
> >
> > I would prefer to just change the signature of
> > amdgpu_display_get_crtc_scanoutpos() to match the new API rather than
> > wrapping it again.
>
> While trying to adapt the siganture, I found that
> amdgpu_display_get_crtc_scanoutpos() requires a flags argument that is
> not mappable to the callback API. That wrapper function is necessary.
>

No worries.  We can clean them up later.  Wrapping is fine.

Alex

> Best regards
> Thomas
>
> >
> > Alex
> >
> >> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> >> ---
> >>  drivers/gpu/drm/amd/amdgpu/amdgpu_display.c       | 12 ++++++++++++
> >>  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c           | 11 -----------
> >>  drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h          |  5 +++++
> >>  drivers/gpu/drm/amd/amdgpu/dce_v10_0.c            |  1 +
> >>  drivers/gpu/drm/amd/amdgpu/dce_v11_0.c            |  1 +
> >>  drivers/gpu/drm/amd/amdgpu/dce_v6_0.c             |  1 +
> >>  drivers/gpu/drm/amd/amdgpu/dce_v8_0.c             |  1 +
> >>  drivers/gpu/drm/amd/amdgpu/dce_virtual.c          |  1 +
> >>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  3 ++-
> >>  9 files changed, 24 insertions(+), 12 deletions(-)
> >>
> >> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> >> index 4e699071d144..a1e769d4417d 100644
> >> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> >> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> >> @@ -914,3 +914,15 @@ int amdgpu_display_crtc_idx_to_irq_type(struct amdgpu_device *adev, int crtc)
> >>                 return AMDGPU_CRTC_IRQ_NONE;
> >>         }
> >>  }
> >> +
> >> +bool amdgpu_crtc_get_scanout_position(struct drm_crtc *crtc,
> >> +                       bool in_vblank_irq, int *vpos,
> >> +                       int *hpos, ktime_t *stime, ktime_t *etime,
> >> +                       const struct drm_display_mode *mode)
> >> +{
> >> +       struct drm_device *dev = crtc->dev;
> >> +       unsigned int pipe = crtc->index;
> >> +
> >> +       return amdgpu_display_get_crtc_scanoutpos(dev, pipe, 0, vpos, hpos,
> >> +                                                 stime, etime, mode);
> >> +}
> >> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> >> index 3f6f14ce1511..0749285dd1c7 100644
> >> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> >> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> >> @@ -1367,16 +1367,6 @@ int amdgpu_file_to_fpriv(struct file *filp, struct amdgpu_fpriv **fpriv)
> >>         return 0;
> >>  }
> >>
> >> -static bool
> >> -amdgpu_get_crtc_scanout_position(struct drm_device *dev, unsigned int pipe,
> >> -                                bool in_vblank_irq, int *vpos, int *hpos,
> >> -                                ktime_t *stime, ktime_t *etime,
> >> -                                const struct drm_display_mode *mode)
> >> -{
> >> -       return amdgpu_display_get_crtc_scanoutpos(dev, pipe, 0, vpos, hpos,
> >> -                                                 stime, etime, mode);
> >> -}
> >> -
> >>  static struct drm_driver kms_driver = {
> >>         .driver_features =
> >>             DRIVER_USE_AGP | DRIVER_ATOMIC |
> >> @@ -1391,7 +1381,6 @@ static struct drm_driver kms_driver = {
> >>         .enable_vblank = amdgpu_enable_vblank_kms,
> >>         .disable_vblank = amdgpu_disable_vblank_kms,
> >>         .get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
> >> -       .get_scanout_position = amdgpu_get_crtc_scanout_position,
> >>         .irq_handler = amdgpu_irq_handler,
> >>         .ioctls = amdgpu_ioctls_kms,
> >>         .gem_free_object_unlocked = amdgpu_gem_object_free,
> >> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
> >> index eb9975f4decb..37ba07e2feb5 100644
> >> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
> >> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
> >> @@ -612,6 +612,11 @@ void amdgpu_panel_mode_fixup(struct drm_encoder *encoder,
> >>                              struct drm_display_mode *adjusted_mode);
> >>  int amdgpu_display_crtc_idx_to_irq_type(struct amdgpu_device *adev, int crtc);
> >>
> >> +bool amdgpu_crtc_get_scanout_position(struct drm_crtc *crtc,
> >> +                       bool in_vblank_irq, int *vpos,
> >> +                       int *hpos, ktime_t *stime, ktime_t *etime,
> >> +                       const struct drm_display_mode *mode);
> >> +
> >>  /* fbdev layer */
> >>  int amdgpu_fbdev_init(struct amdgpu_device *adev);
> >>  void amdgpu_fbdev_fini(struct amdgpu_device *adev);
> >> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> >> index 40d2ac723dd6..bdc1e0f036d4 100644
> >> --- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> >> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> >> @@ -2685,6 +2685,7 @@ static const struct drm_crtc_helper_funcs dce_v10_0_crtc_helper_funcs = {
> >>         .prepare = dce_v10_0_crtc_prepare,
> >>         .commit = dce_v10_0_crtc_commit,
> >>         .disable = dce_v10_0_crtc_disable,
> >> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
> >>  };
> >>
> >>  static int dce_v10_0_crtc_init(struct amdgpu_device *adev, int index)
> >> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> >> index 898ef72d423c..0319da5f7bf9 100644
> >> --- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> >> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> >> @@ -2793,6 +2793,7 @@ static const struct drm_crtc_helper_funcs dce_v11_0_crtc_helper_funcs = {
> >>         .prepare = dce_v11_0_crtc_prepare,
> >>         .commit = dce_v11_0_crtc_commit,
> >>         .disable = dce_v11_0_crtc_disable,
> >> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
> >>  };
> >>
> >>  static int dce_v11_0_crtc_init(struct amdgpu_device *adev, int index)
> >> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> >> index db15a112becc..78642c3b14fc 100644
> >> --- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> >> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> >> @@ -2575,6 +2575,7 @@ static const struct drm_crtc_helper_funcs dce_v6_0_crtc_helper_funcs = {
> >>         .prepare = dce_v6_0_crtc_prepare,
> >>         .commit = dce_v6_0_crtc_commit,
> >>         .disable = dce_v6_0_crtc_disable,
> >> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
> >>  };
> >>
> >>  static int dce_v6_0_crtc_init(struct amdgpu_device *adev, int index)
> >> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> >> index f06c9022c1fd..1e8d4975435a 100644
> >> --- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> >> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> >> @@ -2593,6 +2593,7 @@ static const struct drm_crtc_helper_funcs dce_v8_0_crtc_helper_funcs = {
> >>         .prepare = dce_v8_0_crtc_prepare,
> >>         .commit = dce_v8_0_crtc_commit,
> >>         .disable = dce_v8_0_crtc_disable,
> >> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
> >>  };
> >>
> >>  static int dce_v8_0_crtc_init(struct amdgpu_device *adev, int index)
> >> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
> >> index e4f94863332c..4b2f915aba47 100644
> >> --- a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
> >> +++ b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
> >> @@ -218,6 +218,7 @@ static const struct drm_crtc_helper_funcs dce_virtual_crtc_helper_funcs = {
> >>         .prepare = dce_virtual_crtc_prepare,
> >>         .commit = dce_virtual_crtc_commit,
> >>         .disable = dce_virtual_crtc_disable,
> >> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
> >>  };
> >>
> >>  static int dce_virtual_crtc_init(struct amdgpu_device *adev, int index)
> >> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> >> index f2db400a3920..39c5cf242c1b 100644
> >> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> >> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> >> @@ -4821,7 +4821,8 @@ static bool dm_crtc_helper_mode_fixup(struct drm_crtc *crtc,
> >>  static const struct drm_crtc_helper_funcs amdgpu_dm_crtc_helper_funcs = {
> >>         .disable = dm_crtc_helper_disable,
> >>         .atomic_check = dm_crtc_helper_atomic_check,
> >> -       .mode_fixup = dm_crtc_helper_mode_fixup
> >> +       .mode_fixup = dm_crtc_helper_mode_fixup,
> >> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
> >>  };
> >>
> >>  static void dm_encoder_helper_disable(struct drm_encoder *encoder)
> >> --
> >> 2.24.1
> >>
> >> _______________________________________________
> >> amd-gfx mailing list
> >> amd-gfx@lists.freedesktop.org
> >> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
>
> --
> Thomas Zimmermann
> Graphics Driver Developer
> SUSE Software Solutions Germany GmbH
> Maxfeldstr. 5, 90409 Nürnberg, Germany
> (HRB 36809, AG Nürnberg)
> Geschäftsführer: Felix Imendörffer
>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 217+ messages in thread

* Re: [PATCH 02/23] drm/amdgpu: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
@ 2020-01-15 16:35         ` Alex Deucher
  0 siblings, 0 replies; 217+ messages in thread
From: Alex Deucher @ 2020-01-15 16:35 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: hamohammed.sa, Dave Airlie, nouveau, Joonas Lahtinen,
	Maling list - DRI developers, Eric Anholt, amd-gfx list,
	Benjamin Gaignard, alexandre.torgue, Chunming Zhou,
	Thomas Hellstrom, Sean Paul, Patrik Jakobsson, VMware Graphics,
	Ben Skeggs, Wentland, Harry, mcoquelin.stm32, Leo (Sunpeng) Li,
	linux-arm-msm, Intel Graphics Development, Maarten Lankhorst,
	Jani Nikula, Rodrigo Vivi, Vincent Abriou, rodrigosiqueiramelo,
	philippe.cornu, yannick.fertre, Rob Clark, Daniel Vetter,
	Deucher, Alexander, freedreno, Christian Koenig

On Wed, Jan 15, 2020 at 4:41 AM Thomas Zimmermann <tzimmermann@suse.de> wrote:
>
> Hi
>
> Am 13.01.20 um 19:52 schrieb Alex Deucher:
> > On Fri, Jan 10, 2020 at 4:21 AM Thomas Zimmermann <tzimmermann@suse.de> wrote:
> >>
> >> The callback struct drm_driver.get_scanout_position() is deprecated in
> >> favor of struct drm_crtc_helper_funcs.get_scanout_position(). Convert
> >> amdgpu over.
> >>
> >
> > I would prefer to just change the signature of
> > amdgpu_display_get_crtc_scanoutpos() to match the new API rather than
> > wrapping it again.
>
> While trying to adapt the siganture, I found that
> amdgpu_display_get_crtc_scanoutpos() requires a flags argument that is
> not mappable to the callback API. That wrapper function is necessary.
>

No worries.  We can clean them up later.  Wrapping is fine.

Alex

> Best regards
> Thomas
>
> >
> > Alex
> >
> >> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> >> ---
> >>  drivers/gpu/drm/amd/amdgpu/amdgpu_display.c       | 12 ++++++++++++
> >>  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c           | 11 -----------
> >>  drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h          |  5 +++++
> >>  drivers/gpu/drm/amd/amdgpu/dce_v10_0.c            |  1 +
> >>  drivers/gpu/drm/amd/amdgpu/dce_v11_0.c            |  1 +
> >>  drivers/gpu/drm/amd/amdgpu/dce_v6_0.c             |  1 +
> >>  drivers/gpu/drm/amd/amdgpu/dce_v8_0.c             |  1 +
> >>  drivers/gpu/drm/amd/amdgpu/dce_virtual.c          |  1 +
> >>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  3 ++-
> >>  9 files changed, 24 insertions(+), 12 deletions(-)
> >>
> >> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> >> index 4e699071d144..a1e769d4417d 100644
> >> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> >> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> >> @@ -914,3 +914,15 @@ int amdgpu_display_crtc_idx_to_irq_type(struct amdgpu_device *adev, int crtc)
> >>                 return AMDGPU_CRTC_IRQ_NONE;
> >>         }
> >>  }
> >> +
> >> +bool amdgpu_crtc_get_scanout_position(struct drm_crtc *crtc,
> >> +                       bool in_vblank_irq, int *vpos,
> >> +                       int *hpos, ktime_t *stime, ktime_t *etime,
> >> +                       const struct drm_display_mode *mode)
> >> +{
> >> +       struct drm_device *dev = crtc->dev;
> >> +       unsigned int pipe = crtc->index;
> >> +
> >> +       return amdgpu_display_get_crtc_scanoutpos(dev, pipe, 0, vpos, hpos,
> >> +                                                 stime, etime, mode);
> >> +}
> >> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> >> index 3f6f14ce1511..0749285dd1c7 100644
> >> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> >> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> >> @@ -1367,16 +1367,6 @@ int amdgpu_file_to_fpriv(struct file *filp, struct amdgpu_fpriv **fpriv)
> >>         return 0;
> >>  }
> >>
> >> -static bool
> >> -amdgpu_get_crtc_scanout_position(struct drm_device *dev, unsigned int pipe,
> >> -                                bool in_vblank_irq, int *vpos, int *hpos,
> >> -                                ktime_t *stime, ktime_t *etime,
> >> -                                const struct drm_display_mode *mode)
> >> -{
> >> -       return amdgpu_display_get_crtc_scanoutpos(dev, pipe, 0, vpos, hpos,
> >> -                                                 stime, etime, mode);
> >> -}
> >> -
> >>  static struct drm_driver kms_driver = {
> >>         .driver_features =
> >>             DRIVER_USE_AGP | DRIVER_ATOMIC |
> >> @@ -1391,7 +1381,6 @@ static struct drm_driver kms_driver = {
> >>         .enable_vblank = amdgpu_enable_vblank_kms,
> >>         .disable_vblank = amdgpu_disable_vblank_kms,
> >>         .get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
> >> -       .get_scanout_position = amdgpu_get_crtc_scanout_position,
> >>         .irq_handler = amdgpu_irq_handler,
> >>         .ioctls = amdgpu_ioctls_kms,
> >>         .gem_free_object_unlocked = amdgpu_gem_object_free,
> >> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
> >> index eb9975f4decb..37ba07e2feb5 100644
> >> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
> >> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
> >> @@ -612,6 +612,11 @@ void amdgpu_panel_mode_fixup(struct drm_encoder *encoder,
> >>                              struct drm_display_mode *adjusted_mode);
> >>  int amdgpu_display_crtc_idx_to_irq_type(struct amdgpu_device *adev, int crtc);
> >>
> >> +bool amdgpu_crtc_get_scanout_position(struct drm_crtc *crtc,
> >> +                       bool in_vblank_irq, int *vpos,
> >> +                       int *hpos, ktime_t *stime, ktime_t *etime,
> >> +                       const struct drm_display_mode *mode);
> >> +
> >>  /* fbdev layer */
> >>  int amdgpu_fbdev_init(struct amdgpu_device *adev);
> >>  void amdgpu_fbdev_fini(struct amdgpu_device *adev);
> >> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> >> index 40d2ac723dd6..bdc1e0f036d4 100644
> >> --- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> >> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> >> @@ -2685,6 +2685,7 @@ static const struct drm_crtc_helper_funcs dce_v10_0_crtc_helper_funcs = {
> >>         .prepare = dce_v10_0_crtc_prepare,
> >>         .commit = dce_v10_0_crtc_commit,
> >>         .disable = dce_v10_0_crtc_disable,
> >> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
> >>  };
> >>
> >>  static int dce_v10_0_crtc_init(struct amdgpu_device *adev, int index)
> >> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> >> index 898ef72d423c..0319da5f7bf9 100644
> >> --- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> >> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> >> @@ -2793,6 +2793,7 @@ static const struct drm_crtc_helper_funcs dce_v11_0_crtc_helper_funcs = {
> >>         .prepare = dce_v11_0_crtc_prepare,
> >>         .commit = dce_v11_0_crtc_commit,
> >>         .disable = dce_v11_0_crtc_disable,
> >> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
> >>  };
> >>
> >>  static int dce_v11_0_crtc_init(struct amdgpu_device *adev, int index)
> >> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> >> index db15a112becc..78642c3b14fc 100644
> >> --- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> >> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> >> @@ -2575,6 +2575,7 @@ static const struct drm_crtc_helper_funcs dce_v6_0_crtc_helper_funcs = {
> >>         .prepare = dce_v6_0_crtc_prepare,
> >>         .commit = dce_v6_0_crtc_commit,
> >>         .disable = dce_v6_0_crtc_disable,
> >> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
> >>  };
> >>
> >>  static int dce_v6_0_crtc_init(struct amdgpu_device *adev, int index)
> >> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> >> index f06c9022c1fd..1e8d4975435a 100644
> >> --- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> >> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> >> @@ -2593,6 +2593,7 @@ static const struct drm_crtc_helper_funcs dce_v8_0_crtc_helper_funcs = {
> >>         .prepare = dce_v8_0_crtc_prepare,
> >>         .commit = dce_v8_0_crtc_commit,
> >>         .disable = dce_v8_0_crtc_disable,
> >> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
> >>  };
> >>
> >>  static int dce_v8_0_crtc_init(struct amdgpu_device *adev, int index)
> >> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
> >> index e4f94863332c..4b2f915aba47 100644
> >> --- a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
> >> +++ b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
> >> @@ -218,6 +218,7 @@ static const struct drm_crtc_helper_funcs dce_virtual_crtc_helper_funcs = {
> >>         .prepare = dce_virtual_crtc_prepare,
> >>         .commit = dce_virtual_crtc_commit,
> >>         .disable = dce_virtual_crtc_disable,
> >> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
> >>  };
> >>
> >>  static int dce_virtual_crtc_init(struct amdgpu_device *adev, int index)
> >> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> >> index f2db400a3920..39c5cf242c1b 100644
> >> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> >> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> >> @@ -4821,7 +4821,8 @@ static bool dm_crtc_helper_mode_fixup(struct drm_crtc *crtc,
> >>  static const struct drm_crtc_helper_funcs amdgpu_dm_crtc_helper_funcs = {
> >>         .disable = dm_crtc_helper_disable,
> >>         .atomic_check = dm_crtc_helper_atomic_check,
> >> -       .mode_fixup = dm_crtc_helper_mode_fixup
> >> +       .mode_fixup = dm_crtc_helper_mode_fixup,
> >> +       .get_scanout_position = amdgpu_crtc_get_scanout_position,
> >>  };
> >>
> >>  static void dm_encoder_helper_disable(struct drm_encoder *encoder)
> >> --
> >> 2.24.1
> >>
> >> _______________________________________________
> >> amd-gfx mailing list
> >> amd-gfx@lists.freedesktop.org
> >> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
>
> --
> Thomas Zimmermann
> Graphics Driver Developer
> SUSE Software Solutions Germany GmbH
> Maxfeldstr. 5, 90409 Nürnberg, Germany
> (HRB 36809, AG Nürnberg)
> Geschäftsführer: Felix Imendörffer
>
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 217+ messages in thread

end of thread, other threads:[~2020-01-15 16:35 UTC | newest]

Thread overview: 217+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-10  9:21 [PATCH 00/23] drm: Clean up VBLANK callbacks in struct drm_driver Thomas Zimmermann
2020-01-10  9:21 ` Thomas Zimmermann
2020-01-10  9:21 ` [Intel-gfx] " Thomas Zimmermann
2020-01-10  9:21 ` Thomas Zimmermann
2020-01-10  9:21 ` Thomas Zimmermann
2020-01-10  9:21 ` [PATCH 01/23] drm: Add get_scanout_position() to struct drm_crtc_helper_funcs Thomas Zimmermann
2020-01-10  9:21   ` Thomas Zimmermann
2020-01-10  9:21   ` [Intel-gfx] " Thomas Zimmermann
2020-01-10  9:21   ` Thomas Zimmermann
2020-01-10  9:21   ` Thomas Zimmermann
2020-01-10 10:24   ` Jani Nikula
2020-01-10 10:24     ` Jani Nikula
2020-01-10 10:24     ` [Intel-gfx] " Jani Nikula
2020-01-10 10:24     ` Jani Nikula
2020-01-10 10:24     ` Jani Nikula
2020-01-14 15:31   ` Yannick FERTRE
2020-01-14 15:31     ` Yannick FERTRE
2020-01-14 15:31     ` [Intel-gfx] " Yannick FERTRE
2020-01-14 15:31     ` Yannick FERTRE
2020-01-15  7:31     ` Thomas Zimmermann
2020-01-15  7:31       ` Thomas Zimmermann
2020-01-15  7:31       ` [Intel-gfx] " Thomas Zimmermann
2020-01-15  7:31       ` Thomas Zimmermann
2020-01-15  7:31       ` Thomas Zimmermann
2020-01-10  9:21 ` [PATCH 02/23] drm/amdgpu: Convert to struct drm_crtc_helper_funcs.get_scanout_position() Thomas Zimmermann
2020-01-10  9:21   ` Thomas Zimmermann
2020-01-10  9:21   ` [Intel-gfx] " Thomas Zimmermann
2020-01-10  9:21   ` Thomas Zimmermann
2020-01-10  9:21   ` Thomas Zimmermann
2020-01-13 18:52   ` Alex Deucher
2020-01-13 18:52     ` Alex Deucher
2020-01-13 18:52     ` [Intel-gfx] " Alex Deucher
2020-01-13 18:52     ` Alex Deucher
2020-01-13 18:52     ` Alex Deucher
2020-01-14  7:46     ` Thomas Zimmermann
2020-01-14  7:46       ` Thomas Zimmermann
2020-01-14  7:46       ` [Intel-gfx] " Thomas Zimmermann
2020-01-14  7:46       ` Thomas Zimmermann
2020-01-14  7:46       ` Thomas Zimmermann
2020-01-15  9:41     ` Thomas Zimmermann
2020-01-15  9:41       ` Thomas Zimmermann
2020-01-15  9:41       ` [Intel-gfx] " Thomas Zimmermann
2020-01-15  9:41       ` Thomas Zimmermann
2020-01-15  9:41       ` Thomas Zimmermann
2020-01-15 16:35       ` Alex Deucher
2020-01-15 16:35         ` Alex Deucher
2020-01-15 16:35         ` [Intel-gfx] " Alex Deucher
2020-01-15 16:35         ` Alex Deucher
2020-01-15 16:35         ` Alex Deucher
2020-01-10  9:21 ` [PATCH 03/23] drm/i915: Don't use struct drm_driver.get_scanout_position() Thomas Zimmermann
2020-01-10  9:21   ` Thomas Zimmermann
2020-01-10  9:21   ` [Intel-gfx] " Thomas Zimmermann
2020-01-10  9:21   ` Thomas Zimmermann
2020-01-10  9:21   ` Thomas Zimmermann
2020-01-10 11:59   ` Jani Nikula
2020-01-10 11:59     ` Jani Nikula
2020-01-10 11:59     ` [Intel-gfx] " Jani Nikula
2020-01-10 11:59     ` Jani Nikula
2020-01-10 11:59     ` Jani Nikula
2020-01-10 12:04     ` Thomas Zimmermann
2020-01-10 12:04       ` Thomas Zimmermann
2020-01-10 12:04       ` [Intel-gfx] " Thomas Zimmermann
2020-01-10 12:04       ` Thomas Zimmermann
2020-01-10 12:04       ` Thomas Zimmermann
2020-01-10 13:56       ` Jani Nikula
2020-01-10 13:56         ` Jani Nikula
2020-01-10 13:56         ` [Intel-gfx] " Jani Nikula
2020-01-10 13:56         ` Jani Nikula
2020-01-10 13:56         ` Jani Nikula
2020-01-10 15:25         ` Ville Syrjälä
2020-01-10 15:25           ` Ville Syrjälä
2020-01-10 15:25           ` [Intel-gfx] " Ville Syrjälä
2020-01-10 15:25           ` Ville Syrjälä
2020-01-10 15:25           ` Ville Syrjälä
2020-01-10  9:21 ` [PATCH 04/23] drm/nouveau: Convert to struct drm_crtc_helper_funcs.get_scanout_position() Thomas Zimmermann
2020-01-10  9:21   ` Thomas Zimmermann
2020-01-10  9:21   ` [Intel-gfx] " Thomas Zimmermann
2020-01-10  9:21   ` Thomas Zimmermann
2020-01-10  9:21 ` [PATCH 05/23] drm/radeon: " Thomas Zimmermann
2020-01-10  9:21   ` Thomas Zimmermann
2020-01-10  9:21   ` [Intel-gfx] " Thomas Zimmermann
2020-01-10  9:21   ` Thomas Zimmermann
2020-01-10  9:21   ` Thomas Zimmermann
2020-01-13 18:53   ` Alex Deucher
2020-01-13 18:53     ` Alex Deucher
2020-01-13 18:53     ` [Intel-gfx] " Alex Deucher
2020-01-13 18:53     ` Alex Deucher
2020-01-13 18:53     ` Alex Deucher
2020-01-10  9:21 ` [PATCH 06/23] drm/msm: " Thomas Zimmermann
2020-01-10  9:21   ` Thomas Zimmermann
2020-01-10  9:21   ` [Intel-gfx] " Thomas Zimmermann
2020-01-10  9:21   ` Thomas Zimmermann
2020-01-10  9:21   ` Thomas Zimmermann
2020-01-10  9:21 ` [PATCH 07/23] drm/vc4: " Thomas Zimmermann
2020-01-10  9:21   ` Thomas Zimmermann
2020-01-10  9:21   ` [Intel-gfx] " Thomas Zimmermann
2020-01-10  9:21   ` Thomas Zimmermann
2020-01-10  9:21   ` Thomas Zimmermann
2020-01-10  9:21 ` [PATCH 08/23] drm/stm: " Thomas Zimmermann
2020-01-10  9:21   ` Thomas Zimmermann
2020-01-10  9:21   ` [Intel-gfx] " Thomas Zimmermann
2020-01-10  9:21   ` Thomas Zimmermann
2020-01-10  9:21   ` Thomas Zimmermann
2020-01-14 15:31   ` Yannick FERTRE
2020-01-14 15:31     ` Yannick FERTRE
2020-01-14 15:31     ` [Intel-gfx] " Yannick FERTRE
2020-01-14 15:31     ` Yannick FERTRE
2020-01-10  9:21 ` [PATCH 09/23] drm: Remove struct drm_driver.get_scanout_position() Thomas Zimmermann
2020-01-10  9:21   ` Thomas Zimmermann
2020-01-10  9:21   ` [Intel-gfx] " Thomas Zimmermann
2020-01-10  9:21   ` Thomas Zimmermann
2020-01-10  9:21   ` Thomas Zimmermann
2020-01-14 15:32   ` Yannick FERTRE
2020-01-14 15:32     ` Yannick FERTRE
2020-01-14 15:32     ` [Intel-gfx] " Yannick FERTRE
2020-01-14 15:32     ` Yannick FERTRE
2020-01-10  9:21 ` [PATCH 10/23] drm: Evaluate struct drm_device.vblank_disable_immediate on each use Thomas Zimmermann
2020-01-10  9:21   ` Thomas Zimmermann
2020-01-10  9:21   ` [Intel-gfx] " Thomas Zimmermann
2020-01-10  9:21   ` Thomas Zimmermann
2020-01-10  9:21 ` [PATCH 11/23] drm: Add get_vblank_timestamp() to struct drm_crtc_funcs Thomas Zimmermann
2020-01-10  9:21   ` Thomas Zimmermann
2020-01-10  9:21   ` [Intel-gfx] " Thomas Zimmermann
2020-01-10  9:21   ` Thomas Zimmermann
2020-01-10  9:21 ` [PATCH 12/23] drm/amdgpu: Convert to CRTC VBLANK callbacks Thomas Zimmermann
2020-01-10  9:21   ` Thomas Zimmermann
2020-01-10  9:21   ` [Intel-gfx] " Thomas Zimmermann
2020-01-10  9:21   ` Thomas Zimmermann
2020-01-10  9:21   ` Thomas Zimmermann
2020-01-13 19:00   ` Alex Deucher
2020-01-13 19:00     ` Alex Deucher
2020-01-13 19:00     ` [Intel-gfx] " Alex Deucher
2020-01-13 19:00     ` Alex Deucher
2020-01-13 19:00     ` Alex Deucher
2020-01-10  9:21 ` [PATCH 13/23] drm/gma500: " Thomas Zimmermann
2020-01-10  9:21   ` Thomas Zimmermann
2020-01-10  9:21   ` [Intel-gfx] " Thomas Zimmermann
2020-01-10  9:21   ` Thomas Zimmermann
2020-01-10  9:21   ` Thomas Zimmermann
2020-01-10  9:21 ` [PATCH 14/23] drm/i915: " Thomas Zimmermann
2020-01-10  9:21   ` Thomas Zimmermann
2020-01-10  9:21   ` [Intel-gfx] " Thomas Zimmermann
2020-01-10  9:21   ` Thomas Zimmermann
2020-01-10  9:21 ` [PATCH 15/23] drm/msm: " Thomas Zimmermann
2020-01-10  9:21   ` Thomas Zimmermann
2020-01-10  9:21   ` [Intel-gfx] " Thomas Zimmermann
2020-01-10  9:21   ` Thomas Zimmermann
2020-01-10  9:21   ` Thomas Zimmermann
2020-01-10  9:21 ` [PATCH 16/23] drm/nouveau: " Thomas Zimmermann
2020-01-10  9:21   ` Thomas Zimmermann
2020-01-10  9:21   ` [Intel-gfx] " Thomas Zimmermann
2020-01-10  9:21   ` Thomas Zimmermann
2020-01-10  9:21 ` [PATCH 17/23] drm/radeon: " Thomas Zimmermann
2020-01-10  9:21   ` Thomas Zimmermann
2020-01-10  9:21   ` [Intel-gfx] " Thomas Zimmermann
2020-01-10  9:21   ` Thomas Zimmermann
2020-01-13 19:02   ` Alex Deucher
2020-01-13 19:02     ` Alex Deucher
2020-01-13 19:02     ` [Intel-gfx] " Alex Deucher
2020-01-13 19:02     ` Alex Deucher
2020-01-13 19:02     ` Alex Deucher
2020-01-10  9:21 ` [PATCH 18/23] drm/sti: " Thomas Zimmermann
2020-01-10  9:21   ` Thomas Zimmermann
2020-01-10  9:21   ` [Intel-gfx] " Thomas Zimmermann
2020-01-10  9:21   ` Thomas Zimmermann
2020-01-10 13:38   ` Benjamin Gaignard
2020-01-10 13:38     ` Benjamin Gaignard
2020-01-10 13:38     ` [Intel-gfx] " Benjamin Gaignard
2020-01-10 13:38     ` Benjamin Gaignard
2020-01-10 13:38     ` Benjamin Gaignard
2020-01-10  9:21 ` [PATCH 19/23] drm/stm: " Thomas Zimmermann
2020-01-10  9:21   ` Thomas Zimmermann
2020-01-10  9:21   ` [Intel-gfx] " Thomas Zimmermann
2020-01-10  9:21   ` Thomas Zimmermann
2020-01-14 15:32   ` Yannick FERTRE
2020-01-14 15:32     ` Yannick FERTRE
2020-01-14 15:32     ` [Intel-gfx] " Yannick FERTRE
2020-01-14 15:32     ` Yannick FERTRE
2020-01-10  9:21 ` [PATCH 20/23] drm/vc4: " Thomas Zimmermann
2020-01-10  9:21   ` Thomas Zimmermann
2020-01-10  9:21   ` [Intel-gfx] " Thomas Zimmermann
2020-01-10  9:21   ` Thomas Zimmermann
2020-01-10  9:21 ` [PATCH 21/23] drm/vkms: " Thomas Zimmermann
2020-01-10  9:21   ` Thomas Zimmermann
2020-01-10  9:21   ` [Intel-gfx] " Thomas Zimmermann
2020-01-10  9:21   ` Thomas Zimmermann
2020-01-10  9:21 ` [PATCH 22/23] drm/vmwgfx: " Thomas Zimmermann
2020-01-10  9:21   ` Thomas Zimmermann
2020-01-10  9:21   ` [Intel-gfx] " Thomas Zimmermann
2020-01-10  9:21   ` Thomas Zimmermann
2020-01-10  9:21 ` [PATCH 23/23] drm: Cleanup VBLANK callbacks in struct drm_driver Thomas Zimmermann
2020-01-10  9:21   ` Thomas Zimmermann
2020-01-10  9:21   ` [Intel-gfx] " Thomas Zimmermann
2020-01-10  9:21   ` Thomas Zimmermann
2020-01-12 22:53   ` Daniel Vetter
2020-01-12 22:53     ` Daniel Vetter
2020-01-12 22:53     ` [Intel-gfx] " Daniel Vetter
2020-01-12 22:53     ` Daniel Vetter
2020-01-12 22:53     ` Daniel Vetter
2020-01-12 22:54     ` Daniel Vetter
2020-01-12 22:54       ` Daniel Vetter
2020-01-12 22:54       ` [Intel-gfx] " Daniel Vetter
2020-01-12 22:54       ` Daniel Vetter
2020-01-12 22:54       ` Daniel Vetter
2020-01-14 13:48     ` Thomas Zimmermann
2020-01-14 13:48       ` Thomas Zimmermann
2020-01-14 13:48       ` [Intel-gfx] " Thomas Zimmermann
2020-01-14 13:48       ` Thomas Zimmermann
2020-01-14 15:32   ` Yannick FERTRE
2020-01-14 15:32     ` Yannick FERTRE
2020-01-14 15:32     ` [Intel-gfx] " Yannick FERTRE
2020-01-14 15:32     ` Yannick FERTRE
2020-01-10  9:40 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm: Clean up " Patchwork
2020-01-10  9:49 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2020-01-10 10:09 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2020-01-13 12:57 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork
2020-01-14 18:09 ` [Intel-gfx] ✗ Fi.CI.BUILD: failure for drm: Clean up VBLANK callbacks in struct drm_driver (rev6) Patchwork

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.