drm: Add get_scanout_position() to struct drm_crtc_helper_funcs
The 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. v4: * 80-character line fixes 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() Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Tested-by: Yannick Fertré <yannick.fertre@st.com> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200123135943.24140-3-tzimmermann@suse.de
This commit is contained in:
@@ -239,4 +239,29 @@ 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
|
||||
|
Reference in New Issue
Block a user