Message ID | 20240627153638.8765-3-tzimmermann@suse.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | drm/ast: Untangle the chaos in mode setting | expand |
On 27/06/2024 17:27, Thomas Zimmermann wrote: > The CRTC's atomic flush function contains code to program the > display mode ot the AST DP chip. Move the code to the connector's > atomic_mode_set callback. The DRM atomic-modesetting code invoke > this callback as part of the atomic commit. Thanks, it looks good te me. Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com> > > Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> > --- > drivers/gpu/drm/ast/ast_mode.c | 17 ++++++++++++----- > 1 file changed, 12 insertions(+), 5 deletions(-) > > diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c > index 7f9f77b7ee73..421fcdad40e4 100644 > --- a/drivers/gpu/drm/ast/ast_mode.c > +++ b/drivers/gpu/drm/ast/ast_mode.c > @@ -1190,7 +1190,6 @@ ast_crtc_helper_atomic_flush(struct drm_crtc *crtc, > struct drm_device *dev = crtc->dev; > struct ast_device *ast = to_ast_device(dev); > struct ast_crtc_state *ast_crtc_state = to_ast_crtc_state(crtc_state); > - struct ast_vbios_mode_info *vbios_mode_info = &ast_crtc_state->vbios_mode_info; > > /* > * The gamma LUT has to be reloaded after changing the primary > @@ -1204,10 +1203,6 @@ ast_crtc_helper_atomic_flush(struct drm_crtc *crtc, > else > ast_crtc_set_gamma_linear(ast, ast_crtc_state->format); > } > - > - //Set Aspeed Display-Port > - if (ast->tx_chip_types & AST_TX_ASTDP_BIT) > - ast_dp_set_mode(crtc, vbios_mode_info); > } > > static void ast_crtc_helper_atomic_enable(struct drm_crtc *crtc, struct drm_atomic_state *state) > @@ -1635,6 +1630,17 @@ static const struct drm_encoder_funcs ast_astdp_encoder_funcs = { > .destroy = drm_encoder_cleanup, > }; > > +static void ast_astdp_encoder_helper_atomic_mode_set(struct drm_encoder *encoder, > + struct drm_crtc_state *crtc_state, > + struct drm_connector_state *conn_state) > +{ > + struct drm_crtc *crtc = crtc_state->crtc; > + struct ast_crtc_state *ast_crtc_state = to_ast_crtc_state(crtc_state); > + struct ast_vbios_mode_info *vbios_mode_info = &ast_crtc_state->vbios_mode_info; > + > + ast_dp_set_mode(crtc, vbios_mode_info); > +} > + > static void ast_astdp_encoder_helper_atomic_enable(struct drm_encoder *encoder, > struct drm_atomic_state *state) > { > @@ -1656,6 +1662,7 @@ static void ast_astdp_encoder_helper_atomic_disable(struct drm_encoder *encoder, > } > > static const struct drm_encoder_helper_funcs ast_astdp_encoder_helper_funcs = { > + .atomic_mode_set = ast_astdp_encoder_helper_atomic_mode_set, > .atomic_enable = ast_astdp_encoder_helper_atomic_enable, > .atomic_disable = ast_astdp_encoder_helper_atomic_disable, > };
diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c index 7f9f77b7ee73..421fcdad40e4 100644 --- a/drivers/gpu/drm/ast/ast_mode.c +++ b/drivers/gpu/drm/ast/ast_mode.c @@ -1190,7 +1190,6 @@ ast_crtc_helper_atomic_flush(struct drm_crtc *crtc, struct drm_device *dev = crtc->dev; struct ast_device *ast = to_ast_device(dev); struct ast_crtc_state *ast_crtc_state = to_ast_crtc_state(crtc_state); - struct ast_vbios_mode_info *vbios_mode_info = &ast_crtc_state->vbios_mode_info; /* * The gamma LUT has to be reloaded after changing the primary @@ -1204,10 +1203,6 @@ ast_crtc_helper_atomic_flush(struct drm_crtc *crtc, else ast_crtc_set_gamma_linear(ast, ast_crtc_state->format); } - - //Set Aspeed Display-Port - if (ast->tx_chip_types & AST_TX_ASTDP_BIT) - ast_dp_set_mode(crtc, vbios_mode_info); } static void ast_crtc_helper_atomic_enable(struct drm_crtc *crtc, struct drm_atomic_state *state) @@ -1635,6 +1630,17 @@ static const struct drm_encoder_funcs ast_astdp_encoder_funcs = { .destroy = drm_encoder_cleanup, }; +static void ast_astdp_encoder_helper_atomic_mode_set(struct drm_encoder *encoder, + struct drm_crtc_state *crtc_state, + struct drm_connector_state *conn_state) +{ + struct drm_crtc *crtc = crtc_state->crtc; + struct ast_crtc_state *ast_crtc_state = to_ast_crtc_state(crtc_state); + struct ast_vbios_mode_info *vbios_mode_info = &ast_crtc_state->vbios_mode_info; + + ast_dp_set_mode(crtc, vbios_mode_info); +} + static void ast_astdp_encoder_helper_atomic_enable(struct drm_encoder *encoder, struct drm_atomic_state *state) { @@ -1656,6 +1662,7 @@ static void ast_astdp_encoder_helper_atomic_disable(struct drm_encoder *encoder, } static const struct drm_encoder_helper_funcs ast_astdp_encoder_helper_funcs = { + .atomic_mode_set = ast_astdp_encoder_helper_atomic_mode_set, .atomic_enable = ast_astdp_encoder_helper_atomic_enable, .atomic_disable = ast_astdp_encoder_helper_atomic_disable, };
The CRTC's atomic flush function contains code to program the display mode ot the AST DP chip. Move the code to the connector's atomic_mode_set callback. The DRM atomic-modesetting code invoke this callback as part of the atomic commit. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> --- drivers/gpu/drm/ast/ast_mode.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)