drm/mediatek: Implement get_scanout_position for DSI
Subsystems (3)
PATCH 1/1 drm/mediatek: Implement get_scanout_position for DSI
From: Mark Yacoub <[email protected]>
[Why]
vblank timestamp needs GPU high precision timestamp query to avoid using the current monotonic/gettimeofday timestamp as best estimate.
[How]
Implement driver get_vblank_timestamp call which calls get_scanout_position which loops over the CRTC comps to find a component with get_scanout_position implemented. Implement get_scanout_position for DSI component.
Tested on: Jacuzzi (MT8183)
Fixes: igt@kms_flip expected frametime standard deviation to be lower than 0.05%
Suggested-by jason-jh.lin <[email protected]>
Signed-off-byL Mark Yacoub <[email protected]>
--- drivers/gpu/drm/mediatek/mtk_disp_drv.h | 4 ++ drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 48 ++++++++++++------ drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 1 + drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h | 18 +++++++ drivers/gpu/drm/mediatek/mtk_dsi.c | 55 +++++++++++++++++++++ 5 files changed, 112 insertions(+), 14 deletions(-)
drivers/gpu/drm/mediatek/mtk_disp_drv.h +4 -0
@@ -44,6 +44,10 @@ void mtk_dpi_stop(struct device *dev);void mtk_dsi_ddp_start (struct device *dev);void mtk_dsi_ddp_stop (struct device *dev); +bool mtk_dsi_get_scanout_position (struct device *dev,bool in_vblank_irq, +int *vpos,int *hpos,ktime_t *stime, +ktime_t *etime, +const struct drm_display_mode *mode);int mtk_gamma_clk_enable (struct device *dev);void mtk_gamma_clk_disable (struct device *dev);
drivers/gpu/drm/mediatek/mtk_drm_crtc.c +34 -14
59 lines not on this page · raw message
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +1 -0
@@ -252,6 +252,7 @@ static const struct mtk_ddp_comp_funcs ddp_dpi = {static const struct mtk_ddp_comp_funcs ddp_dsi = { .start = mtk_dsi_ddp_start, .stop = mtk_dsi_ddp_stop, + .get_scanout_position = mtk_dsi_get_scanout_position, };static const struct mtk_ddp_comp_funcs ddp_gamma = {
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h +18 -0
@@ -16,6 +16,7 @@ struct drm_crtc;struct drm_device ;struct mtk_plane_state ;struct drm_crtc_state ; +struct drm_display_mode ;enum mtk_ddp_comp_type {MTK_DISP_OVL ,
@@ -65,6 +66,10 @@ struct mtk_ddp_comp_funcs {void (*bgclr_in_off)(struct device *dev);void (*ctm_set)(struct device *dev,struct drm_crtc_state *state); +bool (*get_scanout_position)(struct device *dev,bool in_vblank_irq, +int *vpos,int *hpos,ktime_t *stime, +ktime_t *etime, +const struct drm_display_mode *mode); };struct mtk_ddp_comp {
@@ -184,6 +189,19 @@ static inline void mtk_ddp_ctm_set(struct mtk_ddp_comp *comp, comp->funcs->ctm_set (comp->dev, state); } +static inline bool mtk_ddp_comp_get_scanout_position ( +struct mtk_ddp_comp *comp,bool in_vblank_irq,int *vpos,int *hpos, +ktime_t *stime,ktime_t *etime,const struct drm_display_mode *mode) +{ +if (comp->funcs && comp->funcs->get_scanout_position) { +return comp->funcs->get_scanout_position (comp->dev, + in_vblank_irq, vpos, + hpos, stime, etime, + mode); + } +return false; +} +int mtk_ddp_comp_get_id (struct device_node *node,enum mtk_ddp_comp_type comp_type); unsigned int mtk_drm_find_possible_crtc_by_comp(struct drm_device *drm,
drivers/gpu/drm/mediatek/mtk_dsi.c +55 -0
73 lines not on this page · raw message
Signature · 1 line
2.34.0.rc2.393.gf8c9666880-goog