drm: Clean up VBLANK callbacks in struct drm_driver
Subsystems (16)
Thomas Zimmermann
maintainerv3 cover drm: Clean up VBLANK callbacks in struct drm_driver
VBLANK handlers in struct drm_driver are deprecated. Only legacy, non-KMS drivers are supposed to used them. DRM drivers with kernel modesetting are supposed to use VBLANK callbacks of the CRTC infrastructure.
This patchset converts all DRM drivers to CRTC VBLANK callbacks and cleans up struct drm_driver. The remaining VBLANK callbacks in struct drm_driver are only used by legacy drivers.
Patch 1 removes an additional setup step of vblank_disable_immediate in struct drm_device. This simplifies the integration of CRTC VBLANK callbacks in patch 3. If necessary, a future patch could move vblank_disable_immedate to struct drm_crtc, so that high-precision VBLANKs could be enabled on a per-CRTC basis.
Patches 2 and 3 prepare the DRM infrastructure. These patches add get_scanout_position() to struct drm_crtc_helper_funcs, get_vblank_timestamp() to struct drm_crtc_funcs, and add helpers for the new interfaces.
Patches 4 to 20 convert drivers over.
In patch 21, all VBLANK callbacks are removed from struct drm_driver, except for get_vblank_counter(), enable_vblank(), and disable_vblank(). These interfaces are moved to the legacy section at the end of the structure. Old helper code is now unused and being removed as well. Finally, patch 22 removes an older version of get_scanout_position() from the VBLANK interface.
To cover all affected drivers, I build the patchset in x86, x86-64, arm and aarch64. I smoke-tested amdgpu, gma500, i915, radeon and vc4 on respective hardware.
v3:
* refactor drm_calc_vbltimestamp_from_scanout_pos to share code with new helper (Villa, Jani)
* do more checks for crtc != NULL to cover non-KMS drivers (Ville)
* add function typedefs for readability (Ville)
v2:
* reorder patches so the i915 can be converted without duplicating helper code.
* merged cleanup patches
* changed VBLANK function signatures in amdgpu (Alex)
Thomas Zimmermann (22):
drm: Remove internal setup of struct
drm_device.vblank_disable_immediate
drm: Add get_scanout_position() to struct drm_crtc_helper_funcs
drm: Add get_vblank_timestamp() to struct drm_crtc_funcs drm/amdgpu: Convert to struct
drm_crtc_helper_funcs.get_scanout_position()
drm/amdgpu: Convert to CRTC VBLANK callbacks drm/gma500: Convert to CRTC VBLANK callbacks drm/i915: Convert to CRTC VBLANK callbacks drm/nouveau: Convert to struct
drm_crtc_helper_funcs.get_scanout_position()
drm/nouveau: Convert to CRTC VBLANK callbacks drm/radeon: Convert to struct
drm_crtc_helper_funcs.get_scanout_position()
drm/radeon: Convert to CRTC VBLANK callbacks
drm/msm: Convert to struct
drm_crtc_helper_funcs.get_scanout_position()
drm/msm: Convert to CRTC VBLANK callbacks
drm/stm: Convert to struct
drm_crtc_helper_funcs.get_scanout_position()
drm/stm: Convert to CRTC VBLANK callbacks
drm/sti: Convert to CRTC VBLANK callbacks
drm/vc4: Convert to struct
drm_crtc_helper_funcs.get_scanout_position()
drm/vc4: Convert to CRTC VBLANK callbacks
drm/vkms: Convert to CRTC VBLANK callbacks drm/vmwgfx: Convert to CRTC VBLANK callbacks
drm: Clean-up VBLANK-related callbacks in struct drm_driver
drm: Remove legacy version of get_scanout_position()
drivers/gpu/drm/amd/amdgpu/amdgpu.h | 6 +- drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 16 +- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 15 -- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 21 ++- drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h | 5 + drivers/gpu/drm/amd/amdgpu/dce_v10_0.c | 5 + drivers/gpu/drm/amd/amdgpu/dce_v11_0.c | 5 + drivers/gpu/drm/amd/amdgpu/dce_v6_0.c | 5 + drivers/gpu/drm/amd/amdgpu/dce_v8_0.c | 5 + drivers/gpu/drm/amd/amdgpu/dce_virtual.c | 5 + .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 13 +- drivers/gpu/drm/drm_vblank.c | 141 ++++++++++------ drivers/gpu/drm/gma500/cdv_intel_display.c | 3 + drivers/gpu/drm/gma500/psb_drv.c | 4 - drivers/gpu/drm/gma500/psb_drv.h | 6 +- drivers/gpu/drm/gma500/psb_intel_display.c | 3 + drivers/gpu/drm/gma500/psb_irq.c | 12 +- drivers/gpu/drm/gma500/psb_irq.h | 7 +- drivers/gpu/drm/i915/display/intel_display.c | 7 + drivers/gpu/drm/i915/i915_drv.c | 3 - drivers/gpu/drm/i915/i915_irq.c | 20 ++- drivers/gpu/drm/i915/i915_irq.h | 6 +- drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 2 + drivers/gpu/drm/msm/disp/mdp4/mdp4_crtc.c | 2 + drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c | 82 +++++++++ drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 95 ----------- drivers/gpu/drm/msm/msm_drv.c | 10 +- drivers/gpu/drm/msm/msm_drv.h | 3 + drivers/gpu/drm/nouveau/dispnv04/crtc.c | 4 + drivers/gpu/drm/nouveau/dispnv50/head.c | 5 + drivers/gpu/drm/nouveau/nouveau_display.c | 28 +--- drivers/gpu/drm/nouveau/nouveau_display.h | 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 | 4 - drivers/gpu/drm/stm/drv.c | 2 - drivers/gpu/drm/stm/ltdc.c | 66 ++++---- drivers/gpu/drm/stm/ltdc.h | 5 - drivers/gpu/drm/vc4/vc4_crtc.c | 13 +- drivers/gpu/drm/vc4/vc4_drv.c | 3 - drivers/gpu/drm/vc4/vc4_drv.h | 4 - drivers/gpu/drm/vkms/vkms_crtc.c | 9 +- drivers/gpu/drm/vkms/vkms_drv.c | 1 - drivers/gpu/drm/vkms/vkms_drv.h | 4 - drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 3 - drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 6 +- drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 6 +- drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c | 3 + drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c | 3 + drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c | 3 + include/drm/drm_crtc.h | 46 +++++- include/drm/drm_drv.h | 156 +----------------- include/drm/drm_modeset_helper_vtables.h | 47 ++++++ include/drm/drm_vblank.h | 34 +++- 61 files changed, 551 insertions(+), 517 deletions(-)
Thomas Zimmermann
maintainerPATCH v3 1/22 drm: Remove internal setup of struct drm_device.vblank_disable_immediate
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. Simplify the code in preparation of the removal of struct drm_device.get_vblank_timestamp.
v3:
* remove internal setup of vblank_disable_immediate
--- drivers/gpu/drm/drm_vblank.c | 13 ------------- 1 file changed, 13 deletions(-)
drivers/gpu/drm/drm_vblank.c +0 -13
@@ -480,19 +480,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:
Signature · 1 line
2.24.1
Thomas Zimmermann
maintainerPATCH v3 2/22 drm: Add get_scanout_position() to struct drm_crtc_helper_funcs
In reply to Thomas ZimmermannThe new callback get_scanout_position() reads the current location of the scanout process. The operation is currently located in struct drm_driver, but really belongs to the CRTC. Drivers will be converted in separate patches.
To help with the conversion, the timestamp calculation has been moved from drm_calc_vbltimestamp_from_scanoutpos() to drm_crtc_vblank_helper_get_vblank_timestamp_internal(). The helper function supports the new and old interface of get_scanout_position(). drm_calc_vbltimestamp_from_scanoutpos() remains as a wrapper around the new function.
Callback functions return the scanout position from the CRTC. The legacy version of the interface receives the device and pipe index, the modern version receives a pointer to the CRTC. We keep the legacy version until all drivers have been converted.
v3:
* refactor drm_calc_vbltimestamp_from_scanoutpos() to minimize code duplication
* define types for get_scanout_position() callbacks
v2:
* fix logical op in drm_calc_vbltimestamp_from_scanoutpos()
--- drivers/gpu/drm/drm_vblank.c | 101 +++++++++++++++++++---- include/drm/drm_drv.h | 7 +- include/drm/drm_modeset_helper_vtables.h | 47 +++++++++++ include/drm/drm_vblank.h | 22 +++++ 4 files changed, 154 insertions(+), 23 deletions(-)
drivers/gpu/drm/drm_vblank.c +83 -18
@@ -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>
@@ -577,7 +578,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
@@ -599,28 +600,85 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev, 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;if (!drm_core_check_feature (dev,DRIVER_MODESET ))return false; crtc =drm_crtc_from_index (dev, pipe); +if (!crtc) +return false; -if (pipe >= dev->num_crtcs || !crtc) { +return drm_crtc_vblank_helper_get_vblank_timestamp_internal (crtc, + max_error, + vblank_time, + in_vblank_irq, + crtc->helper_private->get_scanout_position, + dev->driver->get_scanout_position); +} +EXPORT_SYMBOL (drm_calc_vbltimestamp_from_scanoutpos); + +/** +* drm_crtc_vblank_helper_get_vblank_timestamp_internal - precise vblank +* timestamp helper +* @dev: DRM device +* @pipe: index of 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. +* @get_scanout_position: +* Callback function to retrieve the scanout position. See +* @struct drm_crtc_helper_funcs.get_scanout_position. +* @get_scanout_position_legacy: +* Callback function to retrieve the scanout position. See +* @struct drm_driver.get_scanout_position. +* +* Implements calculation of exact vblank timestamps from given drm_display_mode +* timings and current video scanout position of a CRTC. +* +* 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_vblank_helper_get_vblank_timestamp_internal ( +struct drm_crtc *crtc,int *max_error,ktime_t *vblank_time, +bool in_vblank_irq, +drm_vblank_get_scanout_position_func get_scanout_position, +drm_vblank_get_scanout_position_legacy_func get_scanout_position_legacy) +{ +struct drm_device *dev = crtc->dev; +unsigned int pipe = crtc->index; +struct drm_vblank_crtc *vblank = &dev->vblank[pipe]; +struct timespec64 ts_etime, ts_vblank_time; +ktime_t stime, etime; +bool vbl_status; +const struct drm_display_mode *mode; +int vpos, hpos, i; +int delta_ns, duration_ns; + +if (pipe >= dev->num_crtcs) {DRM_ERROR ("Invalid crtc %u\n" , pipe);return false; }/* 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 (!get_scanout_position && !get_scanout_position_legacy) { +DRM_ERROR ("Called from CRTC w/o get_scanout_position()!?\n" );return false; }
@@ -635,7 +693,6 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,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; }
@@ -651,11 +708,19 @@ 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 (get_scanout_position) { + vbl_status =get_scanout_position (crtc, + in_vblank_irq, + &vpos, &hpos, + &stime, &etime, + mode); + }else { + vbl_status =get_scanout_position_legacy (dev, pipe, + in_vblank_irq, + &vpos, &hpos, + &stime, &etime, + mode); + }/* Return as no-op if scanout query unsupported or failed. */ if (!vbl_status) {
@@ -707,7 +772,7 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,return true; } -EXPORT_SYMBOL (drm_calc_vbltimestamp_from_scanoutpos); +EXPORT_SYMBOL (drm_crtc_vblank_helper_get_vblank_timestamp_internal);/** * drm_get_last_vbltimestamp - retrieve raw timestamp for the most recent
include/drm/drm_drv.h +2 -5
@@ -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,
include/drm/drm_modeset_helper_vtables.h +47 -0
53 lines not on this page · raw message
include/drm/drm_vblank.h +22 -0
@@ -238,4 +238,26 @@ void drm_calc_timestamping_constants(struct drm_crtc *crtc,wait_queue_head_t *drm_crtc_vblank_waitqueue (struct drm_crtc *crtc);void drm_crtc_set_max_vblank_count (struct drm_crtc *crtc,u32 max_vblank_count); + +typedef bool (*drm_vblank_get_scanout_position_func )(struct drm_crtc *crtc, +bool in_vblank_irq, +int *vpos,int *hpos, +ktime_t *stime,ktime_t *etime, +const struct drm_display_mode *mode); + +typedef bool (*drm_vblank_get_scanout_position_legacy_func )(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 +drm_crtc_vblank_helper_get_vblank_timestamp_internal (struct drm_crtc *crtc, +int *max_error, +ktime_t *vblank_time, +bool in_vblank_irq, +drm_vblank_get_scanout_position_func get_scanout_position, +drm_vblank_get_scanout_position_legacy_func get_scanout_position_legacy); +#endif
Signature · 1 line
2.24.1
Thomas Zimmermann
maintainerPATCH v3 3/22 drm: Add get_vblank_timestamp() to struct drm_crtc_funcs
In reply to Thomas ZimmermannThe 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_vblank_helper_get_vblank_timestamp(), which is an implementation for the CRTC callback.
v3:
* use refactored timestamp calculation to minimize duplicated code
* do more checks for crtc != NULL to support legacy drivers
v2:
* rename helper to drm_crtc_vblank_helper_get_vblank_timestamp()
* replace drm_calc_vbltimestamp_from_scanoutpos() with drm_crtc_vblank_helper_get_vblank_timestamp() in docs
--- drivers/gpu/drm/drm_vblank.c | 74 +++++++++++++++++++++--- include/drm/drm_crtc.h | 46 ++++++++++++++- include/drm/drm_modeset_helper_vtables.h | 4 +- include/drm/drm_vblank.h | 16 +++-- 4 files changed, 123 insertions(+), 17 deletions(-)
drivers/gpu/drm/drm_vblank.c +65 -9
@@ -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);
@@ -511,9 +513,9 @@ EXPORT_SYMBOL(drm_crtc_vblank_waitqueue);* * Calculate and store various constants which are later needed by vblank and * swap-completion timestamping, e.g, by -* drm_calc_vbltimestamp_from_scanoutpos(). They are derived from CRTC's true -* scanout timing, so they take things like panel scaling or other adjustments -* into account. +* drm_crtc_vblank_helper_get_vblank_timestamp(). They are derived from +* CRTC's true scanout timing, so they take things like panel scaling or +* other adjustments into account. */ void drm_calc_timestamping_constants (struct drm_crtc *crtc,const struct drm_display_mode *mode)
@@ -577,8 +579,9 @@ 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 or +* &drm_driver.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
@@ -774,6 +777,48 @@ drm_crtc_vblank_helper_get_vblank_timestamp_internal( }EXPORT_SYMBOL (drm_crtc_vblank_helper_get_vblank_timestamp_internal); +/** +* drm_crtc_vblank_helper_get_vblank_timestamp - 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_vblank_helper_get_vblank_timestamp (struct drm_crtc *crtc, +int *max_error, +ktime_t *vblank_time, +bool in_vblank_irq) +{ +return drm_crtc_vblank_helper_get_vblank_timestamp_internal ( + crtc, max_error, vblank_time, in_vblank_irq, + crtc->helper_private->get_scanout_position,NULL ); +} +EXPORT_SYMBOL (drm_crtc_vblank_helper_get_vblank_timestamp); +/** * drm_get_last_vbltimestamp - retrieve raw timestamp for the most recent * vblank interval
@@ -799,15 +844,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 && 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.
@@ -1790,9 +1842,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);
@@ -1812,8 +1866,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 && crtc->funcs->get_vblank_timestamp || + dev->driver->get_vblank_timestamp; + +trace_drm_vblank_event (pipe, seq, now, high_prec); }/**
include/drm/drm_crtc.h +44 -2
61 lines not on this page · raw message
include/drm/drm_modeset_helper_vtables.h +2 -2
@@ -459,8 +459,8 @@ struct drm_crtc_helper_funcs {* 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. +* if a driver uses drm_crtc_vblank_helper_get_vblank_timestamp() +* for the @drm_crtc_funcs.get_vblank_timestamp callback. * * Parameters: *
include/drm/drm_vblank.h +12 -4
@@ -174,13 +174,13 @@ struct drm_vblank_crtc {unsigned int pipe;/** * @framedur_ns: Frame/Field duration in ns, used by -* drm_calc_vbltimestamp_from_scanoutpos() and computed by +* drm_crtc_vblank_helper_get_vblank_timestamp() and computed by * drm_calc_timestamping_constants(). */ int framedur_ns;/** * @linedur_ns: Line duration in ns, used by -* drm_calc_vbltimestamp_from_scanoutpos() and computed by +* drm_crtc_vblank_helper_get_vblank_timestamp() and computed by * drm_calc_timestamping_constants(). */ int linedur_ns;
@@ -190,8 +190,8 @@ struct drm_vblank_crtc {* * Cache of the current hardware display mode. Only valid when @enabled * is set. This is used by helpers like -* drm_calc_vbltimestamp_from_scanoutpos(). We can't just access the -* hardware mode by e.g. looking at &drm_crtc_state.adjusted_mode, +* drm_crtc_vblank_helper_get_vblank_timestamp(). We can't just access +* the hardware mode by e.g. looking at &drm_crtc_state.adjusted_mode, * because that one is really hard to get from interrupt context. */ struct drm_display_mode hwmode;
@@ -239,6 +239,10 @@ wait_queue_head_t *drm_crtc_vblank_waitqueue(struct drm_crtc *crtc);void drm_crtc_set_max_vblank_count (struct drm_crtc *crtc,u32 max_vblank_count); +/* +* Helpers for struct drm_crtc_funcs +*/ + typedef bool (*drm_vblank_get_scanout_position_func)(struct drm_crtc *crtc, bool in_vblank_irq, int *vpos, int *hpos,
@@ -259,5 +263,9 @@ drm_crtc_vblank_helper_get_vblank_timestamp_internal(struct drm_crtc *crtc,bool in_vblank_irq, drm_vblank_get_scanout_position_func get_scanout_position, drm_vblank_get_scanout_position_legacy_func get_scanout_position_legacy); +bool drm_crtc_vblank_helper_get_vblank_timestamp (struct drm_crtc *crtc, +int *max_error, +ktime_t *vblank_time, +bool in_vblank_irq);#endif
Signature · 1 line
2.24.1
Re: [Intel-gfx] [PATCH v3 03/22] drm: Add get_vblank_timestamp() to struct drm_crtc_funcs
Quoted 150 lines · Thomas Zimmermann
The callback
get_vblank_timestamp()is currently located in structdrm_driver, but really belongs into structdrm_crtc_funcs. Add an equivalent there. Driver will be converted in separate patches.The default implementation is
drm_calc_vbltimestamp_from_scanoutpos(). The patch addsdrm_crtc_vblank_helper_get_vblank_timestamp(), which is an implementation for the CRTC callback.v3:
* use refactored timestamp calculation to minimize duplicated code
* do more checks for crtc != NULL to support legacy drivers
v2:
* rename helper todrm_crtc_vblank_helper_get_vblank_timestamp()
* replacedrm_calc_vbltimestamp_from_scanoutpos()withdrm_crtc_vblank_helper_get_vblank_timestamp()in docsSigned-off-by Thomas Zimmermann <[email protected]>--- drivers/gpu/drm/drm_vblank.c | 74 +++++++++++++++++++++--- include/drm/drm_crtc.h | 46 ++++++++++++++- include/drm/drm_modeset_helper_vtables.h | 4 +- include/drm/drm_vblank.h | 16 +++-- 4 files changed, 123 insertions(+), 17 deletions(-)drivers/gpu/drm/drm_vblank.c +61
-7@@ -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);@@ -511,9 +513,9 @@ EXPORT_SYMBOL(drm_crtc_vblank_waitqueue);* * Calculate and store various constants which are later needed by vblank and * swap-completion timestamping, e.g, by -* drm_calc_vbltimestamp_from_scanoutpos(). They are derived from CRTC's true -* scanout timing, so they take things like panel scaling or other adjustments -* into account. +* drm_crtc_vblank_helper_get_vblank_timestamp(). They are derived from +* CRTC's true scanout timing, so they take things like panel scaling or +* other adjustments into account. */ void drm_calc_timestamping_constants (struct drm_crtc *crtc,const struct drm_display_mode *mode)@@ -577,8 +579,9 @@ 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 or +* &drm_driver.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 @@ -774,6 +777,48 @@ drm_crtc_vblank_helper_get_vblank_timestamp_internal( }EXPORT_SYMBOL (drm_crtc_vblank_helper_get_vblank_timestamp_internal); +/** +* drm_crtc_vblank_helper_get_vblank_timestamp - 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_vblank_helper_get_vblank_timestamp (struct drm_crtc *crtc, +int *max_error, +ktime_t *vblank_time, +bool in_vblank_irq) +{ +return drm_crtc_vblank_helper_get_vblank_timestamp_internal ( + crtc, max_error, vblank_time, in_vblank_irq, + crtc->helper_private->get_scanout_position,NULL ); +} +EXPORT_SYMBOL (drm_crtc_vblank_helper_get_vblank_timestamp); +/** * drm_get_last_vbltimestamp - retrieve raw timestamp for the most recent * vblank interval @@ -799,15 +844,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 && 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. @@ -1790,9 +1842,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);
drivers/gpu/drm/drm_vblank.c static void drm_handle_vblank_events(struct drm_device *dev, unsigned int pipe) · line 1870
Quoted 7 lines
drivers/gpu/drm/drm_vblank.c +2
-2@@ -1812,8 +1866,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 && crtc->funcs->get_vblank_timestamp || + dev->driver->get_vblank_timestamp;
I'm sure gcc will complain about the && vs. || here. Hmm, yeah looks like quite a few gcc/sparse/checkpatch warnings in this series.
With some of the more important warns fixed patches 1-3 are
Quoted 146 lines
drivers/gpu/drm/drm_vblank.c +2
-0+ +trace_drm_vblank_event (pipe, seq, now, high_prec); }/** include/drm/drm_crtc.h +44
-2@@ -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); };/** @@ -974,11 +1015,12 @@ struct drm_crtc {* Programmed mode in hw, after adjustments for encoders, crtc, panel * scaling etc. Should only be used by legacy drivers, for high * precision vblank timestamps in -* drm_calc_vbltimestamp_from_scanoutpos(). +* drm_crtc_vblank_helper_get_vblank_timestamp(). * * Note that atomic drivers should not use this, but instead use * &drm_crtc_state.adjusted_mode. And for high-precision timestamps -* drm_calc_vbltimestamp_from_scanoutpos() used &drm_vblank_crtc.hwmode, +* drm_crtc_vblank_helper_get_vblank_timestamp() used +* &drm_vblank_crtc.hwmode, * which is filled out by calling drm_calc_timestamping_constants(). */ struct drm_display_mode hwmode;include/drm/drm_modeset_helper_vtables.h +2
-2@@ -459,8 +459,8 @@ struct drm_crtc_helper_funcs {* 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. +* if a driver uses drm_crtc_vblank_helper_get_vblank_timestamp() +* for the @drm_crtc_funcs.get_vblank_timestamp callback. * * Parameters: * include/drm/drm_vblank.h +12
-4@@ -174,13 +174,13 @@ struct drm_vblank_crtc {unsigned int pipe;/** * @framedur_ns: Frame/Field duration in ns, used by -* drm_calc_vbltimestamp_from_scanoutpos() and computed by +* drm_crtc_vblank_helper_get_vblank_timestamp() and computed by * drm_calc_timestamping_constants(). */ int framedur_ns;/** * @linedur_ns: Line duration in ns, used by -* drm_calc_vbltimestamp_from_scanoutpos() and computed by +* drm_crtc_vblank_helper_get_vblank_timestamp() and computed by * drm_calc_timestamping_constants(). */ int linedur_ns;@@ -190,8 +190,8 @@ struct drm_vblank_crtc {* * Cache of the current hardware display mode. Only valid when @enabled * is set. This is used by helpers like -* drm_calc_vbltimestamp_from_scanoutpos(). We can't just access the -* hardware mode by e.g. looking at &drm_crtc_state.adjusted_mode, +* drm_crtc_vblank_helper_get_vblank_timestamp(). We can't just access +* the hardware mode by e.g. looking at &drm_crtc_state.adjusted_mode, * because that one is really hard to get from interrupt context. */ struct drm_display_mode hwmode;@@ -239,6 +239,10 @@ wait_queue_head_t *drm_crtc_vblank_waitqueue(struct drm_crtc *crtc);void drm_crtc_set_max_vblank_count (struct drm_crtc *crtc,u32 max_vblank_count); +/* +* Helpers for struct drm_crtc_funcs +*/ + typedef bool (*drm_vblank_get_scanout_position_func)(struct drm_crtc *crtc, bool in_vblank_irq, int *vpos, int *hpos,@@ -259,5 +263,9 @@ drm_crtc_vblank_helper_get_vblank_timestamp_internal(struct drm_crtc *crtc,bool in_vblank_irq, drm_vblank_get_scanout_position_func get_scanout_position, drm_vblank_get_scanout_position_legacy_func get_scanout_position_legacy); +bool drm_crtc_vblank_helper_get_vblank_timestamp (struct drm_crtc *crtc, +int *max_error, +ktime_t *vblank_time, +bool in_vblank_irq);#endif Signature · 6 lines
2.24.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Ville Syrjälä Intel
Thomas Zimmermann
maintainerPATCH v3 4/22 drm/amdgpu: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
In reply to Thomas ZimmermannThe callback struct drm_driver.get_scanout_position() is deprecated in favor of struct drm_crtc_helper_funcs.get_scanout_position(). Convert amdgpu over.
--- 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(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +12 -0
@@ -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); +}
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0 -11
@@ -1377,16 +1377,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 |
@@ -1402,7 +1392,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,
drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h +5 -0
@@ -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);
drivers/gpu/drm/amd/amdgpu/dce_v10_0.c +1 -0
@@ -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)
drivers/gpu/drm/amd/amdgpu/dce_v11_0.c +1 -0
@@ -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)
drivers/gpu/drm/amd/amdgpu/dce_v6_0.c +1 -0
@@ -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)
drivers/gpu/drm/amd/amdgpu/dce_v8_0.c +1 -0
@@ -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)
drivers/gpu/drm/amd/amdgpu/dce_virtual.c +1 -0
@@ -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)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +2 -1
@@ -4873,7 +4873,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)
Signature · 1 line
2.24.1
Thomas Zimmermann
maintainerPATCH v3 5/22 drm/amdgpu: Convert to CRTC VBLANK callbacks
In reply to Thomas ZimmermannVBLANK callbacks in struct drm_driver are deprecated in favor of their equivalents in struct drm_crtc_funcs. Convert amdgpu over.
v2:
* don't wrap existing functions; change signature instead
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 6 +++--- drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 4 ---- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 21 +++++++++++-------- 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 | 10 +++++---- 10 files changed, 43 insertions(+), 22 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +3 -3
@@ -1191,9 +1191,9 @@ void amdgpu_driver_postclose_kms(struct drm_device *dev,int amdgpu_device_ip_suspend (struct amdgpu_device *adev);int amdgpu_device_suspend (struct drm_device *dev,bool fbcon);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_get_vblank_counter_kms (struct drm_crtc *crtc); +int amdgpu_enable_vblank_kms (struct drm_crtc *crtc); +void amdgpu_disable_vblank_kms (struct drm_crtc *crtc);long amdgpu_kms_compat_ioctl (struct file *filp,unsigned int cmd,unsigned long arg);
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +2 -2
@@ -99,7 +99,7 @@ static void amdgpu_display_flip_work_func(struct work_struct *__work) & (DRM_SCANOUTPOS_VALID | DRM_SCANOUTPOS_IN_VBLANK)) == (DRM_SCANOUTPOS_VALID | DRM_SCANOUTPOS_IN_VBLANK) && (int)(work->target_vblank - - amdgpu_get_vblank_counter_kms(adev->ddev, amdgpu_crtc->crtc_id)) > 0) { + amdgpu_get_vblank_counter_kms(crtc)) > 0) {schedule_delayed_work (&work->flip_work,usecs_to_jiffies (1000 ));return ; }
@@ -219,7 +219,7 @@ int amdgpu_display_crtc_page_flip_target(struct drm_crtc *crtc,if (!adev->enable_virtual_display) work->base =amdgpu_bo_gpu_offset (new_abo); work->target_vblank = target - (uint32_t )drm_crtc_vblank_count (crtc) + -amdgpu_get_vblank_counter_kms (dev, work->crtc_id); +amdgpu_get_vblank_counter_kms (crtc);/* we borrow the event spin lock for protecting flip_wrok */ spin_lock_irqsave (&crtc->dev->event_lock, flags);
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0 -4
@@ -1388,10 +1388,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,
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +12 -9
@@ -1110,14 +1110,15 @@ void amdgpu_driver_postclose_kms(struct drm_device *dev,/** * amdgpu_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 amdgpu_get_vblank_counter_kms (struct drm_device *dev,unsigned int pipe) +u32 amdgpu_get_vblank_counter_kms (struct drm_crtc *crtc) { +struct drm_device *dev = crtc->dev; +unsigned int pipe = crtc->index;struct amdgpu_device *adev = dev->dev_private;int vpos, hpos, stat;u32 count;
@@ -1177,14 +1178,15 @@ u32 amdgpu_get_vblank_counter_kms(struct drm_device *dev, unsigned int pipe)/** * amdgpu_enable_vblank_kms - enable vblank interrupt * -* @dev: drm dev pointer -* @pipe: crtc to enable vblank interrupt for +* @crtc: crtc to enable vblank interrupt for * * Enable the interrupt on the requested crtc (all asics). * Returns 0 on success, -EINVAL on failure. */ -int amdgpu_enable_vblank_kms (struct drm_device *dev,unsigned int pipe) +int amdgpu_enable_vblank_kms (struct drm_crtc *crtc) { +struct drm_device *dev = crtc->dev; +unsigned int pipe = crtc->index;struct amdgpu_device *adev = dev->dev_private;int idx =amdgpu_display_crtc_idx_to_irq_type (adev, pipe);
@@ -1194,13 +1196,14 @@ int amdgpu_enable_vblank_kms(struct drm_device *dev, unsigned int pipe)/** * amdgpu_disable_vblank_kms - disable vblank interrupt * -* @dev: drm dev pointer -* @pipe: crtc to disable vblank interrupt for +* @crtc: crtc to disable vblank interrupt for * * Disable the interrupt on the requested crtc (all asics). */ -void amdgpu_disable_vblank_kms (struct drm_device *dev,unsigned int pipe) +void amdgpu_disable_vblank_kms (struct drm_crtc *crtc) { +struct drm_device *dev = crtc->dev; +unsigned int pipe = crtc->index;struct amdgpu_device *adev = dev->dev_private;int idx =amdgpu_display_crtc_idx_to_irq_type (adev, pipe);
drivers/gpu/drm/amd/amdgpu/dce_v10_0.c +4 -0
@@ -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_get_vblank_counter_kms, + .enable_vblank = amdgpu_enable_vblank_kms, + .disable_vblank = amdgpu_disable_vblank_kms, + .get_vblank_timestamp = drm_crtc_vblank_helper_get_vblank_timestamp, };static void dce_v10_0_crtc_dpms (struct drm_crtc *crtc,int mode)
drivers/gpu/drm/amd/amdgpu/dce_v11_0.c +4 -0
@@ -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_get_vblank_counter_kms, + .enable_vblank = amdgpu_enable_vblank_kms, + .disable_vblank = amdgpu_disable_vblank_kms, + .get_vblank_timestamp = drm_crtc_vblank_helper_get_vblank_timestamp, };static void dce_v11_0_crtc_dpms (struct drm_crtc *crtc,int mode)
drivers/gpu/drm/amd/amdgpu/dce_v6_0.c +4 -0
@@ -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_get_vblank_counter_kms, + .enable_vblank = amdgpu_enable_vblank_kms, + .disable_vblank = amdgpu_disable_vblank_kms, + .get_vblank_timestamp = drm_crtc_vblank_helper_get_vblank_timestamp, };static void dce_v6_0_crtc_dpms (struct drm_crtc *crtc,int mode)
drivers/gpu/drm/amd/amdgpu/dce_v8_0.c +4 -0
@@ -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_get_vblank_counter_kms, + .enable_vblank = amdgpu_enable_vblank_kms, + .disable_vblank = amdgpu_disable_vblank_kms, + .get_vblank_timestamp = drm_crtc_vblank_helper_get_vblank_timestamp, };static void dce_v8_0_crtc_dpms (struct drm_crtc *crtc,int mode)
drivers/gpu/drm/amd/amdgpu/dce_virtual.c +4 -0
@@ -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_get_vblank_counter_kms, + .enable_vblank = amdgpu_enable_vblank_kms, + .disable_vblank = amdgpu_disable_vblank_kms, + .get_vblank_timestamp = drm_crtc_vblank_helper_get_vblank_timestamp, };static void dce_virtual_crtc_dpms (struct drm_crtc *crtc,int mode)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +6 -4
@@ -383,8 +383,8 @@ static void dm_pflip_high_irq(void *interrupt_params)* of pageflip completion, so last_flip_vblank is the forbidden count * for queueing new pageflips if vsync + VRR is enabled. */ - amdgpu_crtc->last_flip_vblank =amdgpu_get_vblank_counter_kms (adev->ddev, - amdgpu_crtc->crtc_id); + amdgpu_crtc->last_flip_vblank = +amdgpu_get_vblank_counter_kms (&amdgpu_crtc->base); amdgpu_crtc->pflip_status =AMDGPU_FLIP_NONE ;spin_unlock_irqrestore (&adev->ddev->event_lock, flags);
@@ -4266,8 +4266,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_get_vblank_counter_kms, .enable_vblank = dm_enable_vblank, .disable_vblank = dm_disable_vblank, + .get_vblank_timestamp = drm_crtc_vblank_helper_get_vblank_timestamp, }; static enum drm_connector_status
@@ -6478,7 +6480,7 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,* clients using the GLX_OML_sync_control extension or * DRI3/Present extension with defined target_msc. */ - last_flip_vblank =amdgpu_get_vblank_counter_kms (dm->ddev, acrtc_attach->crtc_id); + last_flip_vblank =amdgpu_get_vblank_counter_kms (pcrtc); }else {/* For variable refresh rate mode only:
@@ -6507,7 +6509,7 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state, & (DRM_SCANOUTPOS_VALID | DRM_SCANOUTPOS_IN_VBLANK)) == (DRM_SCANOUTPOS_VALID | DRM_SCANOUTPOS_IN_VBLANK) && (int)(target_vblank - - amdgpu_get_vblank_counter_kms(dm->ddev, acrtc_attach->crtc_id)) > 0)) { + amdgpu_get_vblank_counter_kms(pcrtc)) > 0)) {usleep_range (1000 ,1100 ); }
Signature · 1 line
2.24.1
Thomas Zimmermann
maintainerPATCH v3 6/22 drm/gma500: Convert to CRTC VBLANK callbacks
In reply to Thomas ZimmermannVBLANK callbacks in struct drm_driver are deprecated in favor of their equivalents in struct drm_crtc_funcs. Convert gma500 over.
--- 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(-)
drivers/gpu/drm/gma500/cdv_intel_display.c +3 -0
@@ -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 = {
drivers/gpu/drm/gma500/psb_drv.c +0 -4
@@ -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,
drivers/gpu/drm/gma500/psb_drv.h +3 -3
@@ -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);
drivers/gpu/drm/gma500/psb_intel_display.c +3 -0
@@ -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 = {
drivers/gpu/drm/gma500/psb_irq.c +9 -3
@@ -506,8 +506,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 ;
@@ -545,8 +547,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;
@@ -618,8 +622,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 ;
drivers/gpu/drm/gma500/psb_irq.h +4 -3
@@ -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);
Signature · 1 line
2.24.1
Re: [PATCH v3 06/22] drm/gma500: Convert to CRTC VBLANK callbacks
Quoted 5 lines · Thomas Zimmermann
VBLANK callbacks in struct
drm_driverare deprecated in favor of their equivalents in structdrm_crtc_funcs. Convert gma500 over.Signed-off-by Thomas Zimmermann <[email protected]>
Looks good. For this patch:
Quoted 150 lines
--- 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(-)drivers/gpu/drm/gma500/cdv_intel_display.c +3
-0@@ -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 = {drivers/gpu/drm/gma500/psb_drv.c +0
-4@@ -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,drivers/gpu/drm/gma500/psb_drv.h +3
-3@@ -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);drivers/gpu/drm/gma500/psb_intel_display.c +3
-0@@ -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 = {drivers/gpu/drm/gma500/psb_irq.c +9
-3@@ -506,8 +506,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 ;@@ -545,8 +547,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;@@ -618,8 +622,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 ;drivers/gpu/drm/gma500/psb_irq.h +4
-4@@ -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
Thomas Zimmermann
maintainerPATCH v3 7/22 drm/i915: Convert to CRTC VBLANK callbacks
In reply to Thomas ZimmermannVBLANK callbacks in struct drm_driver are deprecated in favor of their equivalents in struct drm_crtc_funcs. Convert i915 over.
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. Instead pass i915's implementation of get_scanout_position() to DRM core's drm_crtc_vblank_helper_get_vblank_timestamp_internal().
v3:
* rename dcrtc to _crtc
* use intel_ prefix for i915_crtc_get_vblank_timestamp()
* update for drm_crtc_vblank_helper_get_vblank_timestamp_internal()
v2:
* use DRM's implementation of get_vblank_timestamp()
* simplify function names
--- drivers/gpu/drm/i915/display/intel_display.c | 7 +++++++ drivers/gpu/drm/i915/i915_drv.c | 3 --- drivers/gpu/drm/i915/i915_irq.c | 20 +++++++++++++++----- drivers/gpu/drm/i915/i915_irq.h | 6 ++---- 4 files changed, 24 insertions(+), 12 deletions(-)
drivers/gpu/drm/i915/display/intel_display.c +7 -0
@@ -16323,6 +16323,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 = intel_crtc_get_vblank_timestamp, };static const struct drm_crtc_funcs ilk_crtc_funcs = {
@@ -16331,6 +16332,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 = intel_crtc_get_vblank_timestamp, };static const struct drm_crtc_funcs g4x_crtc_funcs = {
@@ -16339,6 +16341,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 = intel_crtc_get_vblank_timestamp, };static const struct drm_crtc_funcs i965_crtc_funcs = {
@@ -16347,6 +16350,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 = intel_crtc_get_vblank_timestamp, };static const struct drm_crtc_funcs i915gm_crtc_funcs = {
@@ -16355,6 +16359,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 = intel_crtc_get_vblank_timestamp, };static const struct drm_crtc_funcs i915_crtc_funcs = {
@@ -16363,6 +16368,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 = intel_crtc_get_vblank_timestamp, };static const struct drm_crtc_funcs i8xx_crtc_funcs = {
@@ -16371,6 +16377,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 = intel_crtc_get_vblank_timestamp, };static struct intel_crtc *intel_crtc_alloc (void )
drivers/gpu/drm/i915/i915_drv.c +0 -3
@@ -2769,9 +2769,6 @@ 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, - .dumb_create = i915_gem_dumb_create, .dumb_map_offset = i915_gem_dumb_mmap_offset,
drivers/gpu/drm/i915/i915_irq.c +15 -5
@@ -762,13 +762,15 @@ 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_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 drm_i915_private *dev_priv =to_i915 (dev); -struct intel_crtc *crtc =to_intel_crtc (drm_crtc_from_index (dev, index)); +struct intel_crtc *crtc =to_intel_crtc (_crtc);enum pipe pipe = crtc->pipe;int position;int vbl_start, vbl_end, hsync_start, htotal, vtotal;
@@ -879,6 +881,14 @@ bool i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int index,return true; } +bool intel_crtc_get_vblank_timestamp (struct drm_crtc *crtc,int *max_error, +ktime_t *vblank_time,bool in_vblank_irq) +{ +return drm_crtc_vblank_helper_get_vblank_timestamp_internal ( + crtc, max_error, vblank_time, in_vblank_irq, + i915_get_crtc_scanoutpos,NULL ); +} +int intel_get_crtc_scanline (struct intel_crtc *crtc) {struct drm_i915_private *dev_priv =to_i915 (crtc->base.dev);
drivers/gpu/drm/i915/i915_irq.h +2 -4
@@ -101,10 +101,8 @@ 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 intel_crtc_get_vblank_timestamp (struct drm_crtc *crtc,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);
Signature · 1 line
2.24.1
Thomas Zimmermann
maintainerPATCH v3 8/22 drm/nouveau: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
In reply to Thomas ZimmermannThe callback struct drm_driver.get_scanout_position() is deprecated in favor of struct drm_crtc_helper_funcs.get_scanout_position(). Convert nouveau over.
--- 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(-)
drivers/gpu/drm/nouveau/dispnv04/crtc.c +1 -0
@@ -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[] = {
drivers/gpu/drm/nouveau/dispnv50/head.c +1 -0
@@ -413,6 +413,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
drivers/gpu/drm/nouveau/nouveau_display.c +3 -11
@@ -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
drivers/gpu/drm/nouveau/nouveau_display.h +1 -1
@@ -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 *);
drivers/gpu/drm/nouveau/nouveau_drm.c +0 -1
@@ -1122,7 +1122,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,
Signature · 1 line
2.24.1
Thomas Zimmermann
maintainerPATCH v3 9/22 drm/nouveau: Convert to CRTC VBLANK callbacks
In reply to Thomas ZimmermannVBLANK callbacks in struct drm_driver are deprecated in favor of their equivalents in struct drm_crtc_funcs. Convert nouvean over.
--- 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(-)
drivers/gpu/drm/nouveau/dispnv04/crtc.c +3 -0
@@ -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_vblank_helper_get_vblank_timestamp, };static const struct drm_crtc_helper_funcs nv04_crtc_helper_funcs = {
drivers/gpu/drm/nouveau/dispnv50/head.c +4 -0
@@ -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,
@@ -482,6 +483,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_vblank_helper_get_vblank_timestamp, }; struct nv50_head *
drivers/gpu/drm/nouveau/nouveau_display.c +2 -12
@@ -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); }
drivers/gpu/drm/nouveau/nouveau_display.h +2 -2
@@ -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 *);
drivers/gpu/drm/nouveau/nouveau_drm.c +0 -4
@@ -1120,10 +1120,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,
Signature · 1 line
2.24.1
Thomas Zimmermann
maintainerPATCH v3 10/22 drm/radeon: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
In reply to Thomas ZimmermannThe callback struct drm_driver.get_scanout_position() is deprecated in favor of struct drm_crtc_helper_funcs.get_scanout_position(). Convert radeon over.
--- 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(-)
drivers/gpu/drm/radeon/atombios_crtc.c +1 -0
@@ -2231,6 +2231,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,
drivers/gpu/drm/radeon/radeon_display.c +13 -0
@@ -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); +}
drivers/gpu/drm/radeon/radeon_drv.c +0 -11
@@ -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,
drivers/gpu/drm/radeon/radeon_legacy_crtc.c +2 -1
@@ -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, };
drivers/gpu/drm/radeon/radeon_mode.h +6 -0
@@ -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);
Signature · 1 line
2.24.1
Thomas Zimmermann
maintainerPATCH v3 11/22 drm/radeon: Convert to CRTC VBLANK callbacks
In reply to Thomas ZimmermannVBLANK callbacks in struct drm_driver are deprecated in favor of their equivalents in struct drm_crtc_funcs. Convert radeon over.
--- 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(-)
drivers/gpu/drm/radeon/radeon_display.c +10 -2
@@ -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_vblank_helper_get_vblank_timestamp, };static void radeon_crtc_init (struct drm_device *dev,int index)
drivers/gpu/drm/radeon/radeon_drv.c +0 -7
@@ -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,
drivers/gpu/drm/radeon/radeon_kms.c +16 -13
@@ -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); }
Signature · 1 line
2.24.1
Thomas Zimmermann
maintainerPATCH v3 12/22 drm/msm: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
In reply to Thomas ZimmermannThe callback struct drm_driver.get_scanout_position() is deprecated in favor of struct drm_crtc_helper_funcs.get_scanout_position(). Convert mem over.
--- 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(-)
drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c +67 -0
@@ -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)
drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c +0 -61
73 lines not on this page · raw message
Signature · 1 line
2.24.1
Thomas Zimmermann
maintainerPATCH v3 13/22 drm/msm: Convert to CRTC VBLANK callbacks
In reply to Thomas ZimmermannVBLANK callbacks in struct drm_driver are deprecated in favor of their equivalents in struct drm_crtc_funcs. Convert msm over.
--- 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(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +2 -0
@@ -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 = {
drivers/gpu/drm/msm/disp/mdp4/mdp4_crtc.c +2 -0
@@ -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 = {
drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c +15 -0
@@ -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_vblank_helper_get_vblank_timestamp, };static const struct drm_crtc_helper_funcs mdp5_crtc_helper_funcs = {
drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c +0 -34
@@ -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;
drivers/gpu/drm/msm/msm_drv.c +6 -4
@@ -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,
drivers/gpu/drm/msm/msm_drv.h +3 -0
@@ -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,
Signature · 1 line
2.24.1
Thomas Zimmermann
maintainerPATCH v3 14/22 drm/stm: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
In reply to Thomas ZimmermannThe callback struct drm_driver.get_scanout_position() is deprecated in favor of struct drm_crtc_helper_funcs.get_scanout_position(). Convert stm over.
--- 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(-)
drivers/gpu/drm/stm/drv.c +0 -1
@@ -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, };
drivers/gpu/drm/stm/ltdc.c +34 -31
78 lines not on this page · raw message
drivers/gpu/drm/stm/ltdc.h +0 -5
@@ -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);
Signature · 1 line
2.24.1
Thomas Zimmermann
maintainerPATCH v3 15/22 drm/stm: Convert to CRTC VBLANK callbacks
In reply to Thomas ZimmermannVBLANK callbacks in struct drm_driver are deprecated in favor of their equivalents in struct drm_crtc_funcs. Convert stm over.
--- drivers/gpu/drm/stm/drv.c | 1 - drivers/gpu/drm/stm/ltdc.c | 1 + 2 files changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/stm/drv.c +0 -1
@@ -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)
drivers/gpu/drm/stm/ltdc.c +1 -0
@@ -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_vblank_helper_get_vblank_timestamp, .gamma_set = drm_atomic_helper_legacy_gamma_set, };
Signature · 1 line
2.24.1
Thomas Zimmermann
maintainerPATCH v3 16/22 drm/sti: Convert to CRTC VBLANK callbacks
In reply to Thomas ZimmermannVBLANK callbacks in struct drm_driver are deprecated in favor of their equivalents in struct drm_crtc_funcs. Convert sti over.
v2:
* remove unnecessary include of sti_crtc.h from sti_drv.c
--- drivers/gpu/drm/sti/sti_crtc.c | 11 ++++++++--- drivers/gpu/drm/sti/sti_crtc.h | 2 -- drivers/gpu/drm/sti/sti_drv.c | 4 ---- 3 files changed, 8 insertions(+), 9 deletions(-)
drivers/gpu/drm/sti/sti_crtc.c +8 -3
@@ -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)
drivers/gpu/drm/sti/sti_crtc.h +0 -2
@@ -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);
drivers/gpu/drm/sti/sti_drv.c +0 -4
@@ -21,7 +21,6 @@#include <drm/drm_of.h> #include <drm/drm_probe_helper.h> -#include "sti_crtc.h" #include "sti_drv.h" #include "sti_plane.h"
@@ -146,9 +145,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,
Signature · 1 line
2.24.1
Thomas Zimmermann
maintainerPATCH v3 17/22 drm/vc4: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
In reply to Thomas ZimmermannThe callback struct drm_driver.get_scanout_position() is deprecated in favor of struct drm_crtc_helper_funcs.get_scanout_position(). Convert vc4 over.
--- 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(-)
drivers/gpu/drm/vc4/vc4_crtc.c +7 -5
@@ -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 = {
drivers/gpu/drm/vc4/vc4_drv.c +0 -1
@@ -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 )
drivers/gpu/drm/vc4/vc4_drv.h +0 -4
@@ -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,
Signature · 1 line
2.24.1
Thomas Zimmermann
maintainerPATCH v3 18/22 drm/vc4: Convert to CRTC VBLANK callbacks
In reply to Thomas ZimmermannVBLANK callbacks in struct drm_driver are deprecated in favor of their equivalents in struct drm_crtc_funcs. Convert vc4 over.
--- drivers/gpu/drm/vc4/vc4_crtc.c | 1 + drivers/gpu/drm/vc4/vc4_drv.c | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/vc4/vc4_crtc.c +1 -0
@@ -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_vblank_helper_get_vblank_timestamp, };static const struct drm_crtc_helper_funcs vc4_crtc_helper_funcs = {
drivers/gpu/drm/vc4/vc4_drv.c +0 -2
@@ -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
Signature · 1 line
2.24.1
Thomas Zimmermann
maintainerPATCH v3 19/22 drm/vkms: Convert to CRTC VBLANK callbacks
In reply to Thomas ZimmermannVBLANK callbacks in struct drm_driver are deprecated in favor of their equivalents in struct drm_crtc_funcs. Convert vkms over.
--- 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(-)
drivers/gpu/drm/vkms/vkms_crtc.c +6 -3
@@ -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,
drivers/gpu/drm/vkms/vkms_drv.c +0 -1
@@ -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,
drivers/gpu/drm/vkms/vkms_drv.h +0 -4
@@ -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,
Signature · 1 line
2.24.1
Thomas Zimmermann
maintainerPATCH v3 20/22 drm/vmwgfx: Convert to CRTC VBLANK callbacks
In reply to Thomas ZimmermannVBLANK callbacks in struct drm_driver are deprecated in favor of their equivalents in struct drm_crtc_funcs. Convert vmwgfx over.
v2:
* remove accidental whitespace fixes
--- drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 3 --- drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 6 +++--- drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 6 +++--- drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c | 3 +++ drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c | 3 +++ drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c | 3 +++ 6 files changed, 15 insertions(+), 9 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +0 -3
@@ -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,
drivers/gpu/drm/vmwgfx/vmwgfx_drv.h +3 -3
@@ -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,
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +3 -3
@@ -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) { }
drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c +3 -0
@@ -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, };
drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c +3 -0
@@ -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, };/*
drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c +3 -0
@@ -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, };
Signature · 1 line
2.24.1
Re: [PATCH v3 20/22] drm/vmwgfx: Convert to CRTC VBLANK callbacks
Quoted 7 lines · Thomas Zimmermann
VBLANK callbacks in struct
drm_driverare deprecated in favor of their equivalents in structdrm_crtc_funcs. Convert vmwgfx over.v2:
* remove accidental whitespace fixesSigned-off-by Thomas Zimmermann <[email protected]>
Quoted 9 lines
--- drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 3 --- drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 6 +++--- drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 6 +++--- drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c | 3 +++ drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c | 3 +++ drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c | 3 +++ 6 files changed, 15 insertions(+), 9 deletions(-)
Thomas Zimmermann
maintainerPATCH v3 21/22 drm: Clean-up VBLANK-related callbacks in struct drm_driver
In reply to Thomas ZimmermannAll 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.
All users of struct drm_driver.get_scanout_position() have been converted to the respective CRTC helper function. Remove the callback from struct drm_driver.
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.
Also removed is drm_calc_vbltimestamp_from_scanoutpos(). Callers of this function have been converted to use the CRTC instead.
v2:
* merge with removal of struct drm_driver.get_scanout_position()
* remove drm_calc_vbltimestamp_from_scanoutpos()
--- drivers/gpu/drm/drm_vblank.c | 86 +++----------------- include/drm/drm_drv.h | 153 +---------------------------------- include/drm/drm_vblank.h | 4 - 3 files changed, 14 insertions(+), 229 deletions(-)
drivers/gpu/drm/drm_vblank.c +11 -75
@@ -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); }/*
@@ -565,62 +561,6 @@ void drm_calc_timestamping_constants(struct drm_crtc *crtc, }EXPORT_SYMBOL (drm_calc_timestamping_constants); -/** -* drm_calc_vbltimestamp_from_scanoutpos - precise vblank timestamp helper -* @dev: DRM device -* @pipe: index of 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 or -* &drm_driver.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_calc_vbltimestamp_from_scanoutpos (struct drm_device *dev, -unsigned int pipe, -int *max_error, -ktime_t *vblank_time, -bool in_vblank_irq) -{ -struct drm_crtc *crtc; - -if (!drm_core_check_feature (dev,DRIVER_MODESET )) -return false; - - crtc =drm_crtc_from_index (dev, pipe); -if (!crtc) -return false; - -return drm_crtc_vblank_helper_get_vblank_timestamp_internal (crtc, - max_error, - vblank_time, - in_vblank_irq, - crtc->helper_private->get_scanout_position, - dev->driver->get_scanout_position); -} -EXPORT_SYMBOL (drm_calc_vbltimestamp_from_scanoutpos); -/** * drm_crtc_vblank_helper_get_vblank_timestamp_internal - precise vblank * timestamp helper
@@ -856,9 +796,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.
@@ -1081,9 +1018,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)
@@ -1846,7 +1785,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);
@@ -1866,10 +1804,8 @@ static void drm_handle_vblank_events(struct drm_device *dev, unsigned int pipe)send_vblank_event (dev, e, seq, now); } - high_prec = crtc && 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 && crtc->funcs->get_vblank_timestamp); }/**
include/drm/drm_drv.h +3 -150
165 lines not on this page · raw message
include/drm/drm_vblank.h +0 -4
@@ -229,10 +229,6 @@ u64 drm_crtc_accurate_vblank_count(struct drm_crtc *crtc);void drm_vblank_restore (struct drm_device *dev,unsigned int pipe);void drm_crtc_vblank_restore (struct drm_crtc *crtc); -bool drm_calc_vbltimestamp_from_scanoutpos (struct drm_device *dev, -unsigned int pipe,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);
Signature · 1 line
2.24.1
Thomas Zimmermann
maintainerPATCH v3 22/22 drm: Remove legacy version of get_scanout_position()
In reply to Thomas ZimmermannThe legacy version of get_scanout_position() was only useful while drivers still used drm_driver.get_scanout_position(). With no such drivers left, the related typedef and code can be removed
--- drivers/gpu/drm/drm_vblank.c | 27 +++++++-------------------- drivers/gpu/drm/i915/i915_irq.c | 2 +- include/drm/drm_vblank.h | 10 +--------- 3 files changed, 9 insertions(+), 30 deletions(-)
drivers/gpu/drm/drm_vblank.c +7 -20
@@ -576,9 +576,6 @@ EXPORT_SYMBOL(drm_calc_timestamping_constants);* @get_scanout_position: * Callback function to retrieve the scanout position. See * @struct drm_crtc_helper_funcs.get_scanout_position. -* @get_scanout_position_legacy: -* Callback function to retrieve the scanout position. See -* @struct drm_driver.get_scanout_position. * * Implements calculation of exact vblank timestamps from given drm_display_mode * timings and current video scanout position of a CRTC.
@@ -601,8 +598,7 @@ booldrm_crtc_vblank_helper_get_vblank_timestamp_internal ( struct drm_crtc *crtc, int *max_error, ktime_t *vblank_time, bool in_vblank_irq, - drm_vblank_get_scanout_position_func get_scanout_position, - drm_vblank_get_scanout_position_legacy_func get_scanout_position_legacy) + drm_vblank_get_scanout_position_func get_scanout_position) { struct drm_device *dev = crtc->dev;unsigned int pipe = crtc->index;
@@ -620,7 +616,7 @@ drm_crtc_vblank_helper_get_vblank_timestamp_internal( }/* Scanout position query not supported? Should not happen. */ -if (!get_scanout_position && !get_scanout_position_legacy) { +if (!get_scanout_position) {DRM_ERROR ("Called from CRTC w/o get_scanout_position()!?\n" );return false; }
@@ -651,19 +647,10 @@ drm_crtc_vblank_helper_get_vblank_timestamp_internal(* Get vertical and horizontal scanout position vpos, hpos, * and bounding timestamps stime, etime, pre/post query. */ -if (get_scanout_position) { - vbl_status =get_scanout_position (crtc, - in_vblank_irq, - &vpos, &hpos, - &stime, &etime, - mode); - }else { - vbl_status =get_scanout_position_legacy (dev, pipe, - in_vblank_irq, - &vpos, &hpos, - &stime, &etime, - mode); - } + vbl_status =get_scanout_position (crtc, in_vblank_irq, + &vpos, &hpos, + &stime, &etime, + mode);/* Return as no-op if scanout query unsupported or failed. */ if (!vbl_status) {
@@ -755,7 +742,7 @@ bool drm_crtc_vblank_helper_get_vblank_timestamp(struct drm_crtc *crtc, {return drm_crtc_vblank_helper_get_vblank_timestamp_internal ( crtc, max_error, vblank_time, in_vblank_irq, - crtc->helper_private->get_scanout_position,NULL ); + crtc->helper_private->get_scanout_position); }EXPORT_SYMBOL (drm_crtc_vblank_helper_get_vblank_timestamp);
drivers/gpu/drm/i915/i915_irq.c +1 -1
@@ -886,7 +886,7 @@ bool intel_crtc_get_vblank_timestamp(struct drm_crtc *crtc, int *max_error, {return drm_crtc_vblank_helper_get_vblank_timestamp_internal ( crtc, max_error, vblank_time, in_vblank_irq, - i915_get_crtc_scanoutpos,NULL ); + i915_get_crtc_scanoutpos); }int intel_get_crtc_scanline (struct intel_crtc *crtc)
include/drm/drm_vblank.h +1 -9
@@ -245,20 +245,12 @@ typedef bool (*drm_vblank_get_scanout_position_func)(struct drm_crtc *crtc, ktime_t *stime, ktime_t *etime, const struct drm_display_mode *mode); -typedef bool (*drm_vblank_get_scanout_position_legacy_func )(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 drm_crtc_vblank_helper_get_vblank_timestamp_internal (struct drm_crtc *crtc,int *max_error,ktime_t *vblank_time,bool in_vblank_irq, -drm_vblank_get_scanout_position_func get_scanout_position, -drm_vblank_get_scanout_position_legacy_func get_scanout_position_legacy); +drm_vblank_get_scanout_position_func get_scanout_position); bool drm_crtc_vblank_helper_get_vblank_timestamp(struct drm_crtc *crtc, int *max_error, ktime_t *vblank_time,
Signature · 1 line
2.24.1
Re: [PATCH v3 22/22] drm: Remove legacy version of get_scanout_position()
Quoted 5 lines · Thomas Zimmermann
The legacy version of
get_scanout_position()was only useful while drivers still useddrm_driver.get_scanout_position(). With no such drivers left, the related typedef and code can be removedSigned-off-by Thomas Zimmermann <[email protected]>
Quoted 118 lines
--- drivers/gpu/drm/drm_vblank.c | 27 +++++++-------------------- drivers/gpu/drm/i915/i915_irq.c | 2 +- include/drm/drm_vblank.h | 10 +--------- 3 files changed, 9 insertions(+), 30 deletions(-)drivers/gpu/drm/drm_vblank.c +7
-20@@ -576,9 +576,6 @@ EXPORT_SYMBOL(drm_calc_timestamping_constants);* @get_scanout_position: * Callback function to retrieve the scanout position. See * @struct drm_crtc_helper_funcs.get_scanout_position. -* @get_scanout_position_legacy: -* Callback function to retrieve the scanout position. See -* @struct drm_driver.get_scanout_position. * * Implements calculation of exact vblank timestamps from given drm_display_mode * timings and current video scanout position of a CRTC. @@ -601,8 +598,7 @@ booldrm_crtc_vblank_helper_get_vblank_timestamp_internal ( struct drm_crtc *crtc, int *max_error, ktime_t *vblank_time, bool in_vblank_irq, - drm_vblank_get_scanout_position_func get_scanout_position, - drm_vblank_get_scanout_position_legacy_func get_scanout_position_legacy) + drm_vblank_get_scanout_position_func get_scanout_position) { struct drm_device *dev = crtc->dev;unsigned int pipe = crtc->index;@@ -620,7 +616,7 @@ drm_crtc_vblank_helper_get_vblank_timestamp_internal( }/* Scanout position query not supported? Should not happen. */ -if (!get_scanout_position && !get_scanout_position_legacy) { +if (!get_scanout_position) {DRM_ERROR ("Called from CRTC w/o get_scanout_position()!?\n" );return false; }@@ -651,19 +647,10 @@ drm_crtc_vblank_helper_get_vblank_timestamp_internal(* Get vertical and horizontal scanout position vpos, hpos, * and bounding timestamps stime, etime, pre/post query. */ -if (get_scanout_position) { - vbl_status =get_scanout_position (crtc, - in_vblank_irq, - &vpos, &hpos, - &stime, &etime, - mode); - }else { - vbl_status =get_scanout_position_legacy (dev, pipe, - in_vblank_irq, - &vpos, &hpos, - &stime, &etime, - mode); - } + vbl_status =get_scanout_position (crtc, in_vblank_irq, + &vpos, &hpos, + &stime, &etime, + mode);/* Return as no-op if scanout query unsupported or failed. */ if (!vbl_status) {@@ -755,7 +742,7 @@ bool drm_crtc_vblank_helper_get_vblank_timestamp(struct drm_crtc *crtc, {return drm_crtc_vblank_helper_get_vblank_timestamp_internal ( crtc, max_error, vblank_time, in_vblank_irq, - crtc->helper_private->get_scanout_position,NULL ); + crtc->helper_private->get_scanout_position); }EXPORT_SYMBOL (drm_crtc_vblank_helper_get_vblank_timestamp);drivers/gpu/drm/i915/i915_irq.c +1
-1@@ -886,7 +886,7 @@ bool intel_crtc_get_vblank_timestamp(struct drm_crtc *crtc, int *max_error, {return drm_crtc_vblank_helper_get_vblank_timestamp_internal ( crtc, max_error, vblank_time, in_vblank_irq, - i915_get_crtc_scanoutpos,NULL ); + i915_get_crtc_scanoutpos); }int intel_get_crtc_scanline (struct intel_crtc *crtc)include/drm/drm_vblank.h +1
-9@@ -245,20 +245,12 @@ typedef bool (*drm_vblank_get_scanout_position_func)(struct drm_crtc *crtc, ktime_t *stime, ktime_t *etime, const struct drm_display_mode *mode); -typedef bool (*drm_vblank_get_scanout_position_legacy_func )(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 drm_crtc_vblank_helper_get_vblank_timestamp_internal (struct drm_crtc *crtc,int *max_error,ktime_t *vblank_time,bool in_vblank_irq, -drm_vblank_get_scanout_position_func get_scanout_position, -drm_vblank_get_scanout_position_legacy_func get_scanout_position_legacy); +drm_vblank_get_scanout_position_func get_scanout_position); bool drm_crtc_vblank_helper_get_vblank_timestamp(struct drm_crtc *crtc, int *max_error, ktime_t *vblank_time,Signature · 6 lines
2.24.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 2 lines
Ville Syrjälä Intel
Patchwork
CI[Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm: Clean up VBLANK callbacks in struct drm_driver (rev8)
In reply to Thomas Zimmermann== Series Details ==
== Series Details ==
Series: drm: Clean up VBLANK callbacks in struct drm_driver (rev8)
URL : https://patchwork.freedesktop.org/series/71873/
State : warning
== Summary ==
$ dim checkpatch origin/drm-tip 9ff81bf712fd drm: Remove internal setup of struct drm_device.vblank_disable_immediate c83894778e46 drm: Add get_scanout_position() to struct drm_crtc_helper_funcs -:83: WARNING:LONG_LINE: line over 100 characters #83: FILE: drivers/gpu/drm/drm_vblank.c:616: + crtc->helper_private->get_scanout_position,
-:84: WARNING:LONG_LINE: line over 100 characters
#84: FILE: drivers/gpu/drm/drm_vblank.c:617:
+ dev->driver->get_scanout_position);
-:125: CHECK:OPEN_ENDED_LINE: Lines should not end with a '(' #125: FILE: drivers/gpu/drm/drm_vblank.c:658:
+drm_crtc_vblank_helper_get_vblank_timestamp_internal(
-:299: WARNING:LONG_LINE: line over 100 characters #299: FILE: include/drm/drm_vblank.h:260:
+ drm_vblank_get_scanout_position_func get_scanout_position,
-:300: WARNING:LONG_LINE: line over 100 characters #300: FILE: include/drm/drm_vblank.h:261:
+ drm_vblank_get_scanout_position_legacy_func get_scanout_position_legacy);
total: 0 errors, 4 warnings, 1 checks, 241 lines checked 5be5473c0489 drm: Add get_vblank_timestamp() to struct drm_crtc_funcs -:104: CHECK:OPEN_ENDED_LINE: Lines should not end with a '(' #104: FILE: drivers/gpu/drm/drm_vblank.c:816:
+ return drm_crtc_vblank_helper_get_vblank_timestamp_internal(
total: 0 errors, 0 warnings, 1 checks, 242 lines checked415b65185cc9 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:929:
+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 62238b52f5ad drm/amdgpu: Convert to CRTC VBLANK callbacks 58dd8e07443b 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 09f7b2308ef5 drm/i915: Convert to CRTC VBLANK callbacks -:136: CHECK:OPEN_ENDED_LINE: Lines should not end with a '(' #136: FILE: drivers/gpu/drm/i915/i915_irq.c:887:
+ return drm_crtc_vblank_helper_get_vblank_timestamp_internal(
total: 0 errors, 0 warnings, 1 checks, 104 lines checked42922e924da6 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 checked609bd5e15846 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 checked97ac4623f4db 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 5126874a465c drm/radeon: Convert to CRTC VBLANK callbacks -:21: WARNING:AVOID_EXTERNS: externs should be avoided in .c files #21: FILE: drivers/gpu/drm/radeon/radeon_display.c:49:
+int radeon_enable_vblank_kms(struct drm_crtc *crtc);
-:22: WARNING:AVOID_EXTERNS: externs should be avoided in .c files #22: 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 checkeda2a551836901 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 checked582c54684002 drm/msm: Convert to CRTC VBLANK callbacksa9016521a16d drm/stm: Convert to struct drm_crtc_helper_funcs.get_scanout_position() 84b4fc193aa2 drm/stm: Convert to CRTC VBLANK callbacksdf86ce675e2a drm/sti: Convert to CRTC VBLANK callbacks578cb860b55c drm/vc4: Convert to struct drm_crtc_helper_funcs.get_scanout_position() 05e2648135b8 drm/vc4: Convert to CRTC VBLANK callbacks8f7b89e2e7f0 drm/vkms: Convert to CRTC VBLANK callbacks1d5b01bc601e drm/vmwgfx: Convert to CRTC VBLANK callbacks637a859efe2f drm: Clean-up VBLANK-related callbacks in struct drm_driver ea9e1d01e898 drm: Remove legacy version of get_scanout_position() -:113: WARNING:LONG_LINE: line over 100 characters
#113: FILE: include/drm/drm_vblank.h:253:
+ drm_vblank_get_scanout_position_func get_scanout_position);
total: 0 errors, 1 warnings, 0 checks, 86 lines checked
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI[Intel-gfx] ✗ Fi.CI.SPARSE: warning for drm: Clean up VBLANK callbacks in struct drm_driver (rev8)
In reply to Thomas Zimmermann== Series Details ==
== Series Details ==
Series: drm: Clean up VBLANK callbacks in struct drm_driver (rev8)
URL : https://patchwork.freedesktop.org/series/71873/
State : warning
== Summary ==
$ dim sparse origin/drm-tip Sparse version: v0.6.0 Commit: drm: Remove internal setup of struct drm_device.vblank_disable_immediate Okay!
Commit: drm: Add get_scanout_position() to struct drm_crtc_helper_funcs Okay!
Commit: drm: Add get_vblank_timestamp() to struct drm_crtc_funcs
+ ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+drivers/gpu/drm/drm_vblank.c:1869:19: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses] +drivers/gpu/drm/drm_vblank.c: In function ‘drm_handle_vblank_events’:
+ high_prec = crtc && crtc->funcs->get_vblank_timestamp ||
Commit: drm/amdgpu: Convert to struct drm_crtc_helper_funcs.get_scanout_position() -drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:5057: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:5058: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:8393: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:8397:50: warning: missing braces around initializer +drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:8394: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:8398:50: warning: missing braces around initializer
Commit: drm/amdgpu: Convert to CRTC VBLANK callbacks-drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:5058: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:5060: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:8394: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:8398:50: warning: missing braces around initializer +drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:8396: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:8400:50: warning: missing braces around initializer
Commit: drm/gma500: Convert to CRTC VBLANK callbacks Okay!
Commit: drm/i915: Convert to CRTC VBLANK callbacks Okay!
Commit: drm/nouveau: Convert to struct drm_crtc_helper_funcs.get_scanout_position() Okay!
Commit: drm/nouveau: Convert to CRTC VBLANK callbacks Okay!
Commit: drm/radeon: Convert to struct drm_crtc_helper_funcs.get_scanout_position() Okay!
Commit: drm/radeon: Convert to CRTC VBLANK callbacks Okay!
Commit: drm/msm: Convert to struct drm_crtc_helper_funcs.get_scanout_position() Okay!
Commit: drm/msm: Convert to CRTC VBLANK callbacks
Okay!
Commit: drm/stm: Convert to struct drm_crtc_helper_funcs.get_scanout_position() Okay!
Commit: drm/stm: Convert to CRTC VBLANK callbacks
Okay!
Commit: drm/sti: Convert to CRTC VBLANK callbacks
Okay!
Commit: drm/vc4: Convert to struct drm_crtc_helper_funcs.get_scanout_position() 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: Clean-up VBLANK-related callbacks in struct drm_driver
- ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-drivers/gpu/drm/drm_vblank.c: In function ‘drm_handle_vblank_events’:
- high_prec = crtc && crtc->funcs->get_vblank_timestamp || -O:drivers/gpu/drm/drm_vblank.c:1869:19: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
Commit: drm: Remove legacy version of get_scanout_position() Okay!
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Jani Nikula
maintainerRe: [Intel-gfx] ✗ Fi.CI.SPARSE: warning for drm: Clean up VBLANK callbacks in struct drm_driver (rev8)
Thomas, please fix the sparse/build warnings.
BR,
Jani.
Quoted 96 lines · Patchwork
== Series Details ==
Series: drm: Clean up VBLANK callbacks in struct
drm_driver(rev8)
URL : https://patchwork.freedesktop.org/series/71873/
State : warning== Summary ==
$ dim sparse origin/drm-tip Sparse version: v0.6.0 Commit: drm: Remove internal setup of struct drm_device.vblank_disable_immediate Okay!Commit: drm: Add
get_scanout_position()to structdrm_crtc_helper_funcsOkay!Commit: drm: Add
get_vblank_timestamp()to structdrm_crtc_funcs(quoted diff) +4
-0+ ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +drivers/gpu/drm/drm_vblank.c:1869:19: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses] +drivers/gpu/drm/drm_vblank.c: In function ‘drm_handle_vblank_events’: + high_prec = crtc && crtc->funcs->get_vblank_timestamp ||Commit: drm/amdgpu: Convert to struct
drm_crtc_helper_funcs.get_scanout_position()(quoted diff) +3
-3-drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:5057: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:5058: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:8393: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:8397:50: warning: missing braces around initializer +drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:8394: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:8398:50: warning: missing braces around initializerCommit: drm/amdgpu: Convert to CRTC VBLANK callbacks
(quoted diff) +3
-3-drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:5058: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:5060: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:8394: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:8398:50: warning: missing braces around initializer +drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:8396: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:8400:50: warning: missing braces around initializerCommit: drm/gma500: Convert to CRTC VBLANK callbacks Okay!
Commit: drm/i915: Convert to CRTC VBLANK callbacks Okay!
Commit: drm/nouveau: Convert to struct
drm_crtc_helper_funcs.get_scanout_position()Okay!Commit: drm/nouveau: Convert to CRTC VBLANK callbacks Okay!
Commit: drm/radeon: Convert to struct
drm_crtc_helper_funcs.get_scanout_position()Okay!Commit: drm/radeon: Convert to CRTC VBLANK callbacks Okay!
Commit: drm/msm: Convert to struct
drm_crtc_helper_funcs.get_scanout_position()Okay!Commit: drm/msm: Convert to CRTC VBLANK callbacks
Okay!Commit: drm/stm: Convert to struct
drm_crtc_helper_funcs.get_scanout_position()Okay!Commit: drm/stm: Convert to CRTC VBLANK callbacks
Okay!Commit: drm/sti: Convert to CRTC VBLANK callbacks
Okay!Commit: drm/vc4: Convert to struct
drm_crtc_helper_funcs.get_scanout_position()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: Clean-up VBLANK-related callbacks in struct
drm_driver(quoted diff) +0
-4- ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -drivers/gpu/drm/drm_vblank.c: In function ‘drm_handle_vblank_events’: - high_prec = crtc && crtc->funcs->get_vblank_timestamp || -O:drivers/gpu/drm/drm_vblank.c:1869:19: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]Commit: drm: Remove legacy version of
get_scanout_position()Okay!_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 5 lines
Jani Nikula, Intel Open Source Graphics Center _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Thomas Zimmermann
maintainerRe: [Intel-gfx] ✗ Fi.CI.SPARSE: warning for drm: Clean up VBLANK callbacks in struct drm_driver (rev8)
Hi
Am 21.01.20 um 10:25 schrieb Jani Nikula:
Quoted 21 lines
Thomas, please fix the sparse/build warnings.
BR,
Jani.Quoted 13 lines · Patchwork
== Series Details ==
Series: drm: Clean up VBLANK callbacks in struct
drm_driver(rev8)
URL : https://patchwork.freedesktop.org/series/71873/
State : warning== Summary ==
$ dim sparse origin/drm-tip Sparse version: v0.6.0 Commit: drm: Remove internal setup of struct drm_device.vblank_disable_immediate Okay!
Quoted 8 lines
Review
Quoted 8 lines
Commit: drm: Add
get_scanout_position()to structdrm_crtc_helper_funcsOkay!Commit: drm: Add
get_vblank_timestamp()to structdrm_crtc_funcs(quoted diff) +4
-0+ ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +drivers/gpu/drm/drm_vblank.c:1869:19: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses] +drivers/gpu/drm/drm_vblank.c: In function ‘drm_handle_vblank_events’: + high_prec = crtc && crtc->funcs->get_vblank_timestamp ||
Yeah, Ville also mentioned this. I'll change this code to something more readable.
Quoted 9 lines
Quoted 9 lines
Commit: drm/amdgpu: Convert to struct
drm_crtc_helper_funcs.get_scanout_position()(quoted diff) +3
-3-drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:5057: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:5058: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:8393: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:8397:50: warning: missing braces around initializer +drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:8394: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:8398:50: warning: missing braces around initializer
Quoted 7 lines
Review
Quoted 7 lines
Commit: drm/amdgpu: Convert to CRTC VBLANK callbacks
(quoted diff) +3
-3-drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:5058: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:5060: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:8394: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:8398:50: warning: missing braces around initializer +drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:8396: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:8400:50: warning: missing braces around initializer
Those are not my warnings, but I'll see if there's a simple fix that I can submit.
Best regards
Thomas
Quoted 60 lines
Quoted 59 lines
Commit: drm/gma500: Convert to CRTC VBLANK callbacks Okay!
Commit: drm/i915: Convert to CRTC VBLANK callbacks Okay!
Commit: drm/nouveau: Convert to struct
drm_crtc_helper_funcs.get_scanout_position()Okay!Commit: drm/nouveau: Convert to CRTC VBLANK callbacks Okay!
Commit: drm/radeon: Convert to struct
drm_crtc_helper_funcs.get_scanout_position()Okay!Commit: drm/radeon: Convert to CRTC VBLANK callbacks Okay!
Commit: drm/msm: Convert to struct
drm_crtc_helper_funcs.get_scanout_position()Okay!Commit: drm/msm: Convert to CRTC VBLANK callbacks
Okay!Commit: drm/stm: Convert to struct
drm_crtc_helper_funcs.get_scanout_position()Okay!Commit: drm/stm: Convert to CRTC VBLANK callbacks
Okay!Commit: drm/sti: Convert to CRTC VBLANK callbacks
Okay!Commit: drm/vc4: Convert to struct
drm_crtc_helper_funcs.get_scanout_position()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: Clean-up VBLANK-related callbacks in struct
drm_driver(quoted diff) +0
-4- ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -drivers/gpu/drm/drm_vblank.c: In function ‘drm_handle_vblank_events’: - high_prec = crtc && crtc->funcs->get_vblank_timestamp || -O:drivers/gpu/drm/drm_vblank.c:1869:19: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]Commit: drm: Remove legacy version of
get_scanout_position()Okay!_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Jani Nikula
maintainerRe: [Intel-gfx] ✗ Fi.CI.SPARSE: warning for drm: Clean up VBLANK callbacks in struct drm_driver (rev8)
Quoted 45 lines · Thomas Zimmermann
Hi
Am 21.01.20 um 10:25 schrieb Jani Nikula:
Quoted 21 lines
Thomas, please fix the sparse/build warnings.
BR,
Jani.Quoted 13 lines · Patchwork
== Series Details ==
Series: drm: Clean up VBLANK callbacks in struct
drm_driver(rev8)
URL : https://patchwork.freedesktop.org/series/71873/
State : warning== Summary ==
$ dim sparse origin/drm-tip Sparse version: v0.6.0 Commit: drm: Remove internal setup of struct drm_device.vblank_disable_immediate Okay!Quoted 8 lines
Review
Quoted 8 lines
Commit: drm: Add
get_scanout_position()to structdrm_crtc_helper_funcsOkay!Commit: drm: Add
get_vblank_timestamp()to structdrm_crtc_funcs(quoted diff) +4
-0+ ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +drivers/gpu/drm/drm_vblank.c:1869:19: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses] +drivers/gpu/drm/drm_vblank.c: In function ‘drm_handle_vblank_events’: + high_prec = crtc && crtc->funcs->get_vblank_timestamp ||Yeah, Ville also mentioned this. I'll change this code to something more readable.
Quoted 9 lines
Quoted 9 lines
Commit: drm/amdgpu: Convert to struct
drm_crtc_helper_funcs.get_scanout_position()(quoted diff) +3
-3-drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:5057: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:5058: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:8393: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:8397:50: warning: missing braces around initializer +drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:8394: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:8398:50: warning: missing braces around initializer
Quoted 10 lines
Quoted 7 lines
Review
Quoted 7 lines
Commit: drm/amdgpu: Convert to CRTC VBLANK callbacks
(quoted diff) +3
-3-drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:5058: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:5060: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:8394: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:8398:50: warning: missing braces around initializer +drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:8396: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:8400:50: warning: missing braces around initializerThose are not my warnings, but I'll see if there's a simple fix that I can submit.
Ah, right, they just change the line numbers a bit. You certainly don't need to fix that as part of this series.
BR,
Jani.
Quoted 64 lines
Best regards
ThomasQuoted 60 lines
Quoted 59 lines
Commit: drm/gma500: Convert to CRTC VBLANK callbacks Okay!
Commit: drm/i915: Convert to CRTC VBLANK callbacks Okay!
Commit: drm/nouveau: Convert to struct
drm_crtc_helper_funcs.get_scanout_position()Okay!Commit: drm/nouveau: Convert to CRTC VBLANK callbacks Okay!
Commit: drm/radeon: Convert to struct
drm_crtc_helper_funcs.get_scanout_position()Okay!Commit: drm/radeon: Convert to CRTC VBLANK callbacks Okay!
Commit: drm/msm: Convert to struct
drm_crtc_helper_funcs.get_scanout_position()Okay!Commit: drm/msm: Convert to CRTC VBLANK callbacks
Okay!Commit: drm/stm: Convert to struct
drm_crtc_helper_funcs.get_scanout_position()Okay!Commit: drm/stm: Convert to CRTC VBLANK callbacks
Okay!Commit: drm/sti: Convert to CRTC VBLANK callbacks
Okay!Commit: drm/vc4: Convert to struct
drm_crtc_helper_funcs.get_scanout_position()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: Clean-up VBLANK-related callbacks in struct
drm_driver(quoted diff) +0
-4- ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -drivers/gpu/drm/drm_vblank.c: In function ‘drm_handle_vblank_events’: - high_prec = crtc && crtc->funcs->get_vblank_timestamp || -O:drivers/gpu/drm/drm_vblank.c:1869:19: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]Commit: drm: Remove legacy version of
get_scanout_position()Okay!_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 5 lines
Jani Nikula, Intel Open Source Graphics Center _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI[Intel-gfx] ✗ Fi.CI.BAT: failure for drm: Clean up VBLANK callbacks in struct drm_driver (rev8)
In reply to Thomas Zimmermann== Series Details ==
== Series Details ==
Series: drm: Clean up VBLANK callbacks in struct drm_driver (rev8)
URL : https://patchwork.freedesktop.org/series/71873/
State : failure
== Summary ==
CI Bug Log - changes from CI_DRM_7777 -> Patchwork_16170
====================================================
Summary
-------
**FAILURE**
Serious unknown changes coming with Patchwork_16170 absolutely need to be verified manually.
If you think the reported changes have nothing to do with the changes introduced in Patchwork_16170, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.
External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16170/index.html
Possible new issues
-------------------
Here are the unknown changes that may have been introduced in Patchwork_16170:
### IGT changes ###
#### Possible regressions ####
* igt@i915_selftest@live_uncore:
- fi-cfl-8700k: [PASS][1] -> [INCOMPLETE][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7777/fi-cfl-8700k/igt@i915_selftest@live_uncore.html
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16170/fi-cfl-8700k/igt@i915_selftest@live_uncore.html
Known issues
------------
Here are the changes found in Patchwork_16170 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@gem_close_race@basic-threads:
- fi-byt-j1900: [PASS][3] -> [TIMEOUT][4] ([fdo#112271] / [i915#816])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7777/fi-byt-j1900/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16170/fi-byt-j1900/igt@[email protected]
* igt@gem_exec_suspend@basic-s0:
- fi-cml-s: [PASS][5] -> [FAIL][6] ([fdo#103375])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7777/fi-cml-s/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16170/fi-cml-s/igt@[email protected]
* igt@i915_module_load@reload-with-fault-injection:
- fi-bxt-dsi: [PASS][7] -> [INCOMPLETE][8] ([fdo#103927])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7777/fi-bxt-dsi/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16170/fi-bxt-dsi/igt@[email protected]
* igt@i915_pm_rpm@module-reload:
- fi-cfl-8700k: [PASS][9] -> [DMESG-WARN][10] ([i915#889]) +2 similar issues
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7777/fi-cfl-8700k/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16170/fi-cfl-8700k/igt@[email protected]
* igt@i915_selftest@live_blt:
- fi-hsw-4770r: [PASS][11] -> [DMESG-FAIL][12] ([i915#563])
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7777/fi-hsw-4770r/igt@i915_selftest@live_blt.html
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16170/fi-hsw-4770r/igt@i915_selftest@live_blt.html
#### Possible fixes ####
* igt@gem_exec_suspend@basic-s3:
- fi-cml-s: [DMESG-WARN][13] ([fdo#111764]) -> [PASS][14]
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7777/fi-cml-s/igt@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16170/fi-cml-s/igt@[email protected]
* igt@i915_selftest@live_blt:
- fi-byt-j1900: [DMESG-FAIL][15] ([i915#725]) -> [PASS][16]
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7777/fi-byt-j1900/igt@i915_selftest@live_blt.html
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16170/fi-byt-j1900/igt@i915_selftest@live_blt.html
- fi-hsw-4770: [DMESG-FAIL][17] ([i915#553] / [i915#725]) -> [PASS][18]
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7777/fi-hsw-4770/igt@i915_selftest@live_blt.html
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16170/fi-hsw-4770/igt@i915_selftest@live_blt.html
* igt@kms_chamelium@dp-edid-read:
- fi-icl-u2: [FAIL][19] ([fdo#109635] / [i915#217]) -> [PASS][20]
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7777/fi-icl-u2/igt@[email protected]
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16170/fi-icl-u2/igt@[email protected]
[fdo#103375]: https://bugs.freedesktop.org/show_bug.cgi?id=103375
[fdo#103927]: https://bugs.freedesktop.org/show_bug.cgi?id=103927
[fdo#109635]: https://bugs.freedesktop.org/show_bug.cgi?id=109635
[fdo#111764]: https://bugs.freedesktop.org/show_bug.cgi?id=111764
[fdo#112271]: https://bugs.freedesktop.org/show_bug.cgi?id=112271
[i915#217]: https://gitlab.freedesktop.org/drm/intel/issues/217
[i915#553]: https://gitlab.freedesktop.org/drm/intel/issues/553
[i915#563]: https://gitlab.freedesktop.org/drm/intel/issues/563
[i915#725]: https://gitlab.freedesktop.org/drm/intel/issues/725
[i915#816]: https://gitlab.freedesktop.org/drm/intel/issues/816
[i915#889]: https://gitlab.freedesktop.org/drm/intel/issues/889
Participating hosts (40 -> 37)
------------------------------
Additional (7): fi-kbl-soraka fi-snb-2520m fi-ilk-650 fi-elk-e7500 fi-skl-lmem fi-skl-6600u fi-snb-2600
Missing (10): fi-ilk-m540 fi-kbl-7560u fi-bdw-5557u fi-hsw-peppy fi-byt-squawks fi-bsw-cyan fi-gdg-551 fi-ivb-3770 fi-bsw-kefka fi-blb-e6850
Build changes
-------------
* CI: CI-20190529 -> None
* Linux: CI_DRM_7777 -> Patchwork_16170
CI-20190529: 20190529
CI_DRM_7777: 7d2e349542ee3d682a98cc12c3ebdd4677d00d71 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5372: 0d00a27fbbd4d4a77d24499ea9811e07e65eb0ac @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_16170: ea9e1d01e89826eb1492d5e8ac2b8893524d46eb @ git://anongit.freedesktop.org/gfx-ci/linux
== Linux commits ==
ea9e1d01e898 drm: Remove legacy version of get_scanout_position() 637a859efe2f drm: Clean-up VBLANK-related callbacks in struct drm_driver 1d5b01bc601e drm/vmwgfx: Convert to CRTC VBLANK callbacks8f7b89e2e7f0 drm/vkms: Convert to CRTC VBLANK callbacks05e2648135b8 drm/vc4: Convert to CRTC VBLANK callbacks578cb860b55c drm/vc4: Convert to struct drm_crtc_helper_funcs.get_scanout_position() df86ce675e2a drm/sti: Convert to CRTC VBLANK callbacks84b4fc193aa2 drm/stm: Convert to CRTC VBLANK callbacksa9016521a16d drm/stm: Convert to struct drm_crtc_helper_funcs.get_scanout_position() 582c54684002 drm/msm: Convert to CRTC VBLANK callbacksa2a551836901 drm/msm: Convert to struct drm_crtc_helper_funcs.get_scanout_position() 5126874a465c drm/radeon: Convert to CRTC VBLANK callbacks97ac4623f4db drm/radeon: Convert to struct drm_crtc_helper_funcs.get_scanout_position() 609bd5e15846 drm/nouveau: Convert to CRTC VBLANK callbacks42922e924da6 drm/nouveau: Convert to struct drm_crtc_helper_funcs.get_scanout_position() 09f7b2308ef5 drm/i915: Convert to CRTC VBLANK callbacks58dd8e07443b drm/gma500: Convert to CRTC VBLANK callbacks62238b52f5ad drm/amdgpu: Convert to CRTC VBLANK callbacks415b65185cc9 drm/amdgpu: Convert to struct drm_crtc_helper_funcs.get_scanout_position() 5be5473c0489 drm: Add get_vblank_timestamp() to struct drm_crtc_funcs c83894778e46 drm: Add get_scanout_position() to struct drm_crtc_helper_funcs 9ff81bf712fd drm: Remove internal setup of struct drm_device.vblank_disable_immediate
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16170/index.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx