On Mon, Aug 25, 2025 at 10:15:48PM +0800, Yongxing Mou wrote: > From: Abhinav Kumar <quic_abhin...@quicinc.com> > > dp_display caches the current display mode and then passes it onto > the panel to be used for programming the panel params. Remove this > two level passing and directly populate the panel's dp_display_mode > instead. > > Signed-off-by: Abhinav Kumar <quic_abhin...@quicinc.com> > Signed-off-by: Yongxing Mou <yongxing....@oss.qualcomm.com> > --- > drivers/gpu/drm/msm/dp/dp_display.c | 66 > ++++++++++++++----------------------- > 1 file changed, 24 insertions(+), 42 deletions(-) > > diff --git a/drivers/gpu/drm/msm/dp/dp_display.c > b/drivers/gpu/drm/msm/dp/dp_display.c > index > dadf31bc37763c4f07f68b76fbbe33fb77b20850..632a1191e4e48fecd7dbda2f6ec6b8ed0aeebc93 > 100644 > --- a/drivers/gpu/drm/msm/dp/dp_display.c > +++ b/drivers/gpu/drm/msm/dp/dp_display.c > @@ -60,7 +60,6 @@ struct msm_dp_display_private { > struct msm_dp_panel *panel; > struct msm_dp_ctrl *ctrl; > > - struct msm_dp_display_mode msm_dp_mode; > struct msm_dp msm_dp_display; > > /* wait for audio signaling */ > @@ -649,16 +648,29 @@ static int msm_dp_init_sub_modules(struct > msm_dp_display_private *dp) > } > > static int msm_dp_display_set_mode(struct msm_dp *msm_dp_display, > - struct msm_dp_display_mode *mode) > + const struct drm_display_mode *adjusted_mode, > + struct msm_dp_panel *msm_dp_panel) > { > - struct msm_dp_display_private *dp; > + u32 bpp; > > - dp = container_of(msm_dp_display, struct msm_dp_display_private, > msm_dp_display); > + drm_mode_copy(&msm_dp_panel->msm_dp_mode.drm_mode, adjusted_mode); > + > + if (msm_dp_display_check_video_test(msm_dp_display)) > + bpp = msm_dp_display_get_test_bpp(msm_dp_display); > + else > + bpp = msm_dp_panel->connector->display_info.bpc * 3; > + > + msm_dp_panel->msm_dp_mode.bpp = bpp ? bpp : 24; /* Default bpp */ > > - drm_mode_copy(&dp->panel->msm_dp_mode.drm_mode, &mode->drm_mode); > - dp->panel->msm_dp_mode.bpp = mode->bpp; > - dp->panel->msm_dp_mode.out_fmt_is_yuv_420 = mode->out_fmt_is_yuv_420; > - msm_dp_panel_init_panel_info(dp->panel); > + msm_dp_panel->msm_dp_mode.v_active_low = > + !!(adjusted_mode->flags & DRM_MODE_FLAG_NVSYNC); > + msm_dp_panel->msm_dp_mode.h_active_low = > + !!(adjusted_mode->flags & DRM_MODE_FLAG_NHSYNC); > + msm_dp_panel->msm_dp_mode.out_fmt_is_yuv_420 = > + drm_mode_is_420_only(&msm_dp_panel->connector->display_info, > adjusted_mode) && > + msm_dp_panel->vsc_sdp_supported; > + > + msm_dp_panel_init_panel_info(msm_dp_panel); > return 0; > } > > @@ -1328,7 +1340,7 @@ bool msm_dp_wide_bus_available(const struct msm_dp > *msm_dp_display) > > dp = container_of(msm_dp_display, struct msm_dp_display_private, > msm_dp_display); > > - if (dp->msm_dp_mode.out_fmt_is_yuv_420) > + if (dp->panel->msm_dp_mode.out_fmt_is_yuv_420) > return false; > > return dp->wide_bus_supported; > @@ -1389,10 +1401,6 @@ void msm_dp_bridge_atomic_enable(struct drm_bridge > *drm_bridge, > bool force_link_train = false; > > msm_dp_display = container_of(dp, struct msm_dp_display_private, > msm_dp_display); > - if (!msm_dp_display->msm_dp_mode.drm_mode.clock) { > - DRM_ERROR("invalid params\n"); > - return; > - } > > if (dp->is_edp) > msm_dp_hpd_plug_handle(msm_dp_display, 0); > @@ -1405,12 +1413,6 @@ void msm_dp_bridge_atomic_enable(struct drm_bridge > *drm_bridge, > if (msm_dp_display->link->sink_count == 0) > return; > > - rc = msm_dp_display_set_mode(dp, &msm_dp_display->msm_dp_mode);
Why is it being moved from atomic_enable? You can access crtc_state here and thus the adjusted_mode. The mode_set is clearly declared as deprecated. We should move moving code from that function rather than adding code to it. > - if (rc) { > - DRM_ERROR("Failed to perform a mode set, rc=%d\n", rc); > - return; > - } > - > if (dp->link_ready && !dp->power_on) { > msm_dp_display_host_phy_init(msm_dp_display); > force_link_train = true; > @@ -1479,31 +1481,11 @@ void msm_dp_bridge_mode_set(struct drm_bridge > *drm_bridge, > msm_dp_display = container_of(dp, struct msm_dp_display_private, > msm_dp_display); > msm_dp_panel = msm_dp_display->panel; > > - memset(&msm_dp_display->msm_dp_mode, 0x0, sizeof(struct > msm_dp_display_mode)); > - > - if (msm_dp_display_check_video_test(dp)) > - msm_dp_display->msm_dp_mode.bpp = > msm_dp_display_get_test_bpp(dp); > - else /* Default num_components per pixel = 3 */ > - msm_dp_display->msm_dp_mode.bpp = > dp->connector->display_info.bpc * 3; > - > - if (!msm_dp_display->msm_dp_mode.bpp) > - msm_dp_display->msm_dp_mode.bpp = 24; /* Default bpp */ > - > - drm_mode_copy(&msm_dp_display->msm_dp_mode.drm_mode, adjusted_mode); > - > - msm_dp_display->msm_dp_mode.v_active_low = > - !!(msm_dp_display->msm_dp_mode.drm_mode.flags & > DRM_MODE_FLAG_NVSYNC); > - > - msm_dp_display->msm_dp_mode.h_active_low = > - !!(msm_dp_display->msm_dp_mode.drm_mode.flags & > DRM_MODE_FLAG_NHSYNC); > - > - msm_dp_display->msm_dp_mode.out_fmt_is_yuv_420 = > - drm_mode_is_420_only(&dp->connector->display_info, > adjusted_mode) && > - msm_dp_panel->vsc_sdp_supported; > + msm_dp_display_set_mode(dp, adjusted_mode, msm_dp_panel); > > /* populate wide_bus_support to different layers */ > - msm_dp_display->ctrl->wide_bus_en = > - msm_dp_display->msm_dp_mode.out_fmt_is_yuv_420 ? false : > msm_dp_display->wide_bus_supported; > + msm_dp_display->ctrl->wide_bus_en = > msm_dp_panel->msm_dp_mode.out_fmt_is_yuv_420 ? > + false : msm_dp_display->wide_bus_supported; > } > > void msm_dp_bridge_hpd_enable(struct drm_bridge *bridge) > > -- > 2.34.1 > -- With best wishes Dmitry