> Subject: [PATCH 1/8] drm/amd/display: use drmm_writeback_connector_init() > > Use drmm_plain_encoder_alloc() to allocate simple encoder and > drmm_writeback_connector_init() in order to initialize writeback connector > instance. > > Signed-off-by: Dmitry Baryshkov <dmitry.barysh...@oss.qualcomm.com>
I'll be sending a RFC version of code reworking the writeback structure to sit inside the drm_connector structure and see how that fares with everyone so that we can go ahead with the redesign LGTM, Reviewed-by: Suraj Kandpal <suraj.kand...@intel.com> > --- > drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 +- > drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_wb.c | 18 > +++++++++++++----- > 2 files changed, 14 insertions(+), 6 deletions(-) > > diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c > b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c > index > 096b23ad4845d365dad707deed4e3e84b1f9945d..a9948e8d67a6e9556d21090 > b5cdd101258d62480 100644 > --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c > +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c > @@ -10003,7 +10003,7 @@ static void dm_set_writeback(struct > amdgpu_display_manager *dm, > return; > } > > - acrtc = to_amdgpu_crtc(wb_conn->encoder.crtc); > + acrtc = to_amdgpu_crtc(crtc_state->base.crtc); > if (!acrtc) { > drm_err(adev_to_drm(adev), "no amdgpu_crtc found\n"); > kfree(wb_info); > diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_wb.c > b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_wb.c > index > d9527c05fc878ef6916782ff9fde847813938461..80c37487ca77c0494eaf769c5b9 > a3c53486aa52d 100644 > --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_wb.c > +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_wb.c > @@ -171,7 +171,6 @@ static const struct drm_encoder_helper_funcs > amdgpu_dm_wb_encoder_helper_funcs = > > static const struct drm_connector_funcs amdgpu_dm_wb_connector_funcs = { > .fill_modes = drm_helper_probe_single_connector_modes, > - .destroy = drm_connector_cleanup, > .reset = amdgpu_dm_connector_funcs_reset, > .atomic_duplicate_state = > amdgpu_dm_connector_atomic_duplicate_state, > .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, > @@ -190,17 +189,26 @@ int amdgpu_dm_wb_connector_init(struct > amdgpu_display_manager *dm, > struct dc *dc = dm->dc; > struct dc_link *link = dc_get_link_at_index(dc, link_index); > int res = 0; > + struct drm_encoder *encoder; > + > + encoder = drmm_plain_encoder_alloc(&dm->adev->ddev, NULL, > + DRM_MODE_ENCODER_VIRTUAL, > NULL); > + if (IS_ERR(encoder)) > + return PTR_ERR(encoder); > + > + drm_encoder_helper_add(encoder, > &amdgpu_dm_wb_encoder_helper_funcs); > + > + encoder->possible_crtcs = amdgpu_dm_get_encoder_crtc_mask(dm- > >adev); > > wbcon->link = link; > > drm_connector_helper_add(&wbcon->base.base, > &amdgpu_dm_wb_conn_helper_funcs); > > - res = drm_writeback_connector_init(&dm->adev->ddev, &wbcon- > >base, > + res = drmm_writeback_connector_init(&dm->adev->ddev, &wbcon- > >base, > > &amdgpu_dm_wb_connector_funcs, > - > &amdgpu_dm_wb_encoder_helper_funcs, > + encoder, > amdgpu_dm_wb_formats, > - > ARRAY_SIZE(amdgpu_dm_wb_formats), > - > amdgpu_dm_get_encoder_crtc_mask(dm->adev)); > + > ARRAY_SIZE(amdgpu_dm_wb_formats)); > > if (res) > return res; > > -- > 2.39.5