Re: [Freedreno] [PATCH v3 1/3] drm: allow real encoder to be passed for drm_writeback_connector
Hi Abhinav, Thank you for the patch. On Wed, Mar 16, 2022 at 11:48:16AM -0700, Abhinav Kumar wrote: > For some vendor driver implementations, display hardware can > be shared between the encoder used for writeback and the physical > display. > > In addition resources such as clocks and interrupts can > also be shared between writeback and the real encoder. > > To accommodate such vendor drivers and hardware, allow > real encoder to be passed for drm_writeback_connector using a new > drm_writeback_connector_init_with_encoder() API. The commit message doesn't match the commit. > In addition, to preserve the same call flows for the existing > users of drm_writeback_connector_init(), also allow passing > possible_crtcs as a parameter so that encoder can be initialized > with it. > > changes in v3: > - allow passing possible_crtcs for existing users of > drm_writeback_connector_init() > - squash the vendor changes into the same commit so > that each patch in the series can compile individually > > Co-developed-by: Kandpal Suraj > Signed-off-by: Abhinav Kumar > --- > .../drm/arm/display/komeda/komeda_wb_connector.c | 3 +- > drivers/gpu/drm/arm/malidp_mw.c| 5 +- > drivers/gpu/drm/drm_writeback.c| 103 > + > drivers/gpu/drm/rcar-du/rcar_du_writeback.c| 5 +- > drivers/gpu/drm/vc4/vc4_txp.c | 19 ++-- > drivers/gpu/drm/vkms/vkms_writeback.c | 3 +- > include/drm/drm_writeback.h| 22 - > 7 files changed, 103 insertions(+), 57 deletions(-) > > diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_wb_connector.c > b/drivers/gpu/drm/arm/display/komeda/komeda_wb_connector.c > index e465cc4..40774e6 100644 > --- a/drivers/gpu/drm/arm/display/komeda/komeda_wb_connector.c > +++ b/drivers/gpu/drm/arm/display/komeda/komeda_wb_connector.c > @@ -155,7 +155,6 @@ static int komeda_wb_connector_add(struct komeda_kms_dev > *kms, > kwb_conn->wb_layer = kcrtc->master->wb_layer; > > wb_conn = &kwb_conn->base; > - wb_conn->encoder.possible_crtcs = BIT(drm_crtc_index(&kcrtc->base)); > > formats = komeda_get_layer_fourcc_list(&mdev->fmt_tbl, > kwb_conn->wb_layer->layer_type, > @@ -164,7 +163,7 @@ static int komeda_wb_connector_add(struct komeda_kms_dev > *kms, > err = drm_writeback_connector_init(&kms->base, wb_conn, > &komeda_wb_connector_funcs, > &komeda_wb_encoder_helper_funcs, > -formats, n_formats); > +formats, n_formats, > BIT(drm_crtc_index(&kcrtc->base))); > komeda_put_fourcc_list(formats); > if (err) { > kfree(kwb_conn); > diff --git a/drivers/gpu/drm/arm/malidp_mw.c b/drivers/gpu/drm/arm/malidp_mw.c > index f5847a7..b882066 100644 > --- a/drivers/gpu/drm/arm/malidp_mw.c > +++ b/drivers/gpu/drm/arm/malidp_mw.c > @@ -208,11 +208,12 @@ int malidp_mw_connector_init(struct drm_device *drm) > struct malidp_drm *malidp = drm->dev_private; > u32 *formats; > int ret, n_formats; > + uint32_t possible_crtcs; > > if (!malidp->dev->hw->enable_memwrite) > return 0; > > - malidp->mw_connector.encoder.possible_crtcs = 1 << > drm_crtc_index(&malidp->crtc); > + possible_crtcs = 1 << drm_crtc_index(&malidp->crtc); > drm_connector_helper_add(&malidp->mw_connector.base, >&malidp_mw_connector_helper_funcs); > > @@ -223,7 +224,7 @@ int malidp_mw_connector_init(struct drm_device *drm) > ret = drm_writeback_connector_init(drm, &malidp->mw_connector, > &malidp_mw_connector_funcs, > &malidp_mw_encoder_helper_funcs, > -formats, n_formats); > +formats, n_formats, possible_crtcs); Do you need the local variable ? > kfree(formats); > if (ret) > return ret; > diff --git a/drivers/gpu/drm/drm_writeback.c b/drivers/gpu/drm/drm_writeback.c > index dccf4504..17c1471 100644 > --- a/drivers/gpu/drm/drm_writeback.c > +++ b/drivers/gpu/drm/drm_writeback.c > @@ -149,36 +149,15 @@ static const struct drm_encoder_funcs > drm_writeback_encoder_funcs = { > .destroy = drm_encoder_cleanup, > }; > > -/** > - * drm_writeback_connector_init - Initialize a writeback connector and its > properties > - * @dev: DRM device > - * @wb_connector: Writeback connector to initialize > - * @con_funcs: Connector funcs vtable > - * @enc_helper_funcs: Encoder helper funcs vtable to be used by the internal > encoder > - * @formats: Array of supported pixel formats for the writeback engine > - * @n_formats: Length of the formats array > - * > - * Th
Re: [Freedreno] [PATCH v3 1/3] drm: allow real encoder to be passed for drm_writeback_connector
Hi Laurent Thanks for the review. On 3/17/2022 1:51 AM, Laurent Pinchart wrote: Hi Abhinav, Thank you for the patch. On Wed, Mar 16, 2022 at 11:48:16AM -0700, Abhinav Kumar wrote: For some vendor driver implementations, display hardware can be shared between the encoder used for writeback and the physical display. In addition resources such as clocks and interrupts can also be shared between writeback and the real encoder. To accommodate such vendor drivers and hardware, allow real encoder to be passed for drm_writeback_connector using a new drm_writeback_connector_init_with_encoder() API. The commit message doesn't match the commit. Sorry, while splitting the change , I missed this part of the commit text. Will fix it up. In addition, to preserve the same call flows for the existing users of drm_writeback_connector_init(), also allow passing possible_crtcs as a parameter so that encoder can be initialized with it. changes in v3: - allow passing possible_crtcs for existing users of drm_writeback_connector_init() - squash the vendor changes into the same commit so that each patch in the series can compile individually Co-developed-by: Kandpal Suraj Signed-off-by: Abhinav Kumar --- .../drm/arm/display/komeda/komeda_wb_connector.c | 3 +- drivers/gpu/drm/arm/malidp_mw.c| 5 +- drivers/gpu/drm/drm_writeback.c| 103 + drivers/gpu/drm/rcar-du/rcar_du_writeback.c| 5 +- drivers/gpu/drm/vc4/vc4_txp.c | 19 ++-- drivers/gpu/drm/vkms/vkms_writeback.c | 3 +- include/drm/drm_writeback.h| 22 - 7 files changed, 103 insertions(+), 57 deletions(-) diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_wb_connector.c b/drivers/gpu/drm/arm/display/komeda/komeda_wb_connector.c index e465cc4..40774e6 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_wb_connector.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_wb_connector.c @@ -155,7 +155,6 @@ static int komeda_wb_connector_add(struct komeda_kms_dev *kms, kwb_conn->wb_layer = kcrtc->master->wb_layer; wb_conn = &kwb_conn->base; - wb_conn->encoder.possible_crtcs = BIT(drm_crtc_index(&kcrtc->base)); formats = komeda_get_layer_fourcc_list(&mdev->fmt_tbl, kwb_conn->wb_layer->layer_type, @@ -164,7 +163,7 @@ static int komeda_wb_connector_add(struct komeda_kms_dev *kms, err = drm_writeback_connector_init(&kms->base, wb_conn, &komeda_wb_connector_funcs, &komeda_wb_encoder_helper_funcs, - formats, n_formats); + formats, n_formats, BIT(drm_crtc_index(&kcrtc->base))); komeda_put_fourcc_list(formats); if (err) { kfree(kwb_conn); diff --git a/drivers/gpu/drm/arm/malidp_mw.c b/drivers/gpu/drm/arm/malidp_mw.c index f5847a7..b882066 100644 --- a/drivers/gpu/drm/arm/malidp_mw.c +++ b/drivers/gpu/drm/arm/malidp_mw.c @@ -208,11 +208,12 @@ int malidp_mw_connector_init(struct drm_device *drm) struct malidp_drm *malidp = drm->dev_private; u32 *formats; int ret, n_formats; + uint32_t possible_crtcs; if (!malidp->dev->hw->enable_memwrite) return 0; - malidp->mw_connector.encoder.possible_crtcs = 1 << drm_crtc_index(&malidp->crtc); + possible_crtcs = 1 << drm_crtc_index(&malidp->crtc); drm_connector_helper_add(&malidp->mw_connector.base, &malidp_mw_connector_helper_funcs); @@ -223,7 +224,7 @@ int malidp_mw_connector_init(struct drm_device *drm) ret = drm_writeback_connector_init(drm, &malidp->mw_connector, &malidp_mw_connector_funcs, &malidp_mw_encoder_helper_funcs, - formats, n_formats); + formats, n_formats, possible_crtcs); Do you need the local variable ? Yes, we can dtop this. I just used this instead of "1 << drm_crtc_index(&malidp->crtc)" to simplify it. No strong preference. kfree(formats); if (ret) return ret; diff --git a/drivers/gpu/drm/drm_writeback.c b/drivers/gpu/drm/drm_writeback.c index dccf4504..17c1471 100644 --- a/drivers/gpu/drm/drm_writeback.c +++ b/drivers/gpu/drm/drm_writeback.c @@ -149,36 +149,15 @@ static const struct drm_encoder_funcs drm_writeback_encoder_funcs = { .destroy = drm_encoder_cleanup, }; -/** - * drm_writeback_connector_init - Initialize a writeback connector and its properties - * @dev: DRM device - * @wb_connector: Writeback connector to initialize - * @con_funcs: Connector funcs vtable - * @enc_helper_funcs: Encoder helper funcs v
Re: [Freedreno] [PATCH v3 1/3] drm: allow real encoder to be passed for drm_writeback_connector
On Thu, Mar 17, 2022 at 10:26:38AM -0700, Abhinav Kumar wrote: > Hi Laurent > > Thanks for the review. > > On 3/17/2022 1:51 AM, Laurent Pinchart wrote: > > Hi Abhinav, > > > > Thank you for the patch. > > > > On Wed, Mar 16, 2022 at 11:48:16AM -0700, Abhinav Kumar wrote: > > > For some vendor driver implementations, display hardware can > > > be shared between the encoder used for writeback and the physical > > > display. > > > > > > In addition resources such as clocks and interrupts can > > > also be shared between writeback and the real encoder. > > > > > > To accommodate such vendor drivers and hardware, allow > > > real encoder to be passed for drm_writeback_connector using a new > > > drm_writeback_connector_init_with_encoder() API. > > > > The commit message doesn't match the commit. > Sorry, while splitting the change , I missed this part of the commit text. > Will fix it up. > > > > > In addition, to preserve the same call flows for the existing > > > users of drm_writeback_connector_init(), also allow passing > > > possible_crtcs as a parameter so that encoder can be initialized > > > with it. > > > > > > changes in v3: > > > - allow passing possible_crtcs for existing users of > > > drm_writeback_connector_init() > > > - squash the vendor changes into the same commit so > > > that each patch in the series can compile individually > > > > > > Co-developed-by: Kandpal Suraj > > > Signed-off-by: Abhinav Kumar > > > --- > > > .../drm/arm/display/komeda/komeda_wb_connector.c | 3 +- > > > drivers/gpu/drm/arm/malidp_mw.c| 5 +- > > > drivers/gpu/drm/drm_writeback.c| 103 > > > + > > > drivers/gpu/drm/rcar-du/rcar_du_writeback.c| 5 +- > > > drivers/gpu/drm/vc4/vc4_txp.c | 19 ++-- > > > drivers/gpu/drm/vkms/vkms_writeback.c | 3 +- > > > include/drm/drm_writeback.h| 22 - > > > 7 files changed, 103 insertions(+), 57 deletions(-) > > > > > > diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_wb_connector.c > > > b/drivers/gpu/drm/arm/display/komeda/komeda_wb_connector.c > > > index e465cc4..40774e6 100644 > > > --- a/drivers/gpu/drm/arm/display/komeda/komeda_wb_connector.c > > > +++ b/drivers/gpu/drm/arm/display/komeda/komeda_wb_connector.c > > > @@ -155,7 +155,6 @@ static int komeda_wb_connector_add(struct > > > komeda_kms_dev *kms, > > > kwb_conn->wb_layer = kcrtc->master->wb_layer; > > > wb_conn = &kwb_conn->base; > > > - wb_conn->encoder.possible_crtcs = BIT(drm_crtc_index(&kcrtc->base)); > > > formats = komeda_get_layer_fourcc_list(&mdev->fmt_tbl, > > > > > > kwb_conn->wb_layer->layer_type, > > > @@ -164,7 +163,7 @@ static int komeda_wb_connector_add(struct > > > komeda_kms_dev *kms, > > > err = drm_writeback_connector_init(&kms->base, wb_conn, > > > &komeda_wb_connector_funcs, > > > > > > &komeda_wb_encoder_helper_funcs, > > > -formats, n_formats); > > > +formats, n_formats, > > > BIT(drm_crtc_index(&kcrtc->base))); > > > komeda_put_fourcc_list(formats); > > > if (err) { > > > kfree(kwb_conn); > > > diff --git a/drivers/gpu/drm/arm/malidp_mw.c > > > b/drivers/gpu/drm/arm/malidp_mw.c > > > index f5847a7..b882066 100644 > > > --- a/drivers/gpu/drm/arm/malidp_mw.c > > > +++ b/drivers/gpu/drm/arm/malidp_mw.c > > > @@ -208,11 +208,12 @@ int malidp_mw_connector_init(struct drm_device *drm) > > > struct malidp_drm *malidp = drm->dev_private; > > > u32 *formats; > > > int ret, n_formats; > > > + uint32_t possible_crtcs; > > > if (!malidp->dev->hw->enable_memwrite) > > > return 0; > > > - malidp->mw_connector.encoder.possible_crtcs = 1 << > > > drm_crtc_index(&malidp->crtc); > > > + possible_crtcs = 1 << drm_crtc_index(&malidp->crtc); > > > drm_connector_helper_add(&malidp->mw_connector.base, > > >&malidp_mw_connector_helper_funcs); > > > @@ -223,7 +224,7 @@ int malidp_mw_connector_init(struct drm_device *drm) > > > ret = drm_writeback_connector_init(drm, &malidp->mw_connector, > > > &malidp_mw_connector_funcs, > > > > > > &malidp_mw_encoder_helper_funcs, > > > -formats, n_formats); > > > +formats, n_formats, possible_crtcs); > > > > Do you need the local variable ? > > Yes, we can dtop this. I just used this instead of "1 << > drm_crtc_index(&malidp->crtc)" to simplify it. > No strong preference. > > > > > > kfree(formats); > > > if (ret)
Re: [Freedreno] [PATCH v3 1/3] drm: allow real encoder to be passed for drm_writeback_connector
Hi Liviu On 3/21/2022 11:07 AM, Liviu Dudau wrote: On Thu, Mar 17, 2022 at 10:26:38AM -0700, Abhinav Kumar wrote: Hi Laurent Thanks for the review. On 3/17/2022 1:51 AM, Laurent Pinchart wrote: Hi Abhinav, Thank you for the patch. On Wed, Mar 16, 2022 at 11:48:16AM -0700, Abhinav Kumar wrote: For some vendor driver implementations, display hardware can be shared between the encoder used for writeback and the physical display. In addition resources such as clocks and interrupts can also be shared between writeback and the real encoder. To accommodate such vendor drivers and hardware, allow real encoder to be passed for drm_writeback_connector using a new drm_writeback_connector_init_with_encoder() API. The commit message doesn't match the commit. Sorry, while splitting the change , I missed this part of the commit text. Will fix it up. In addition, to preserve the same call flows for the existing users of drm_writeback_connector_init(), also allow passing possible_crtcs as a parameter so that encoder can be initialized with it. changes in v3: - allow passing possible_crtcs for existing users of drm_writeback_connector_init() - squash the vendor changes into the same commit so that each patch in the series can compile individually Co-developed-by: Kandpal Suraj Signed-off-by: Abhinav Kumar --- .../drm/arm/display/komeda/komeda_wb_connector.c | 3 +- drivers/gpu/drm/arm/malidp_mw.c| 5 +- drivers/gpu/drm/drm_writeback.c| 103 + drivers/gpu/drm/rcar-du/rcar_du_writeback.c| 5 +- drivers/gpu/drm/vc4/vc4_txp.c | 19 ++-- drivers/gpu/drm/vkms/vkms_writeback.c | 3 +- include/drm/drm_writeback.h| 22 - 7 files changed, 103 insertions(+), 57 deletions(-) diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_wb_connector.c b/drivers/gpu/drm/arm/display/komeda/komeda_wb_connector.c index e465cc4..40774e6 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_wb_connector.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_wb_connector.c @@ -155,7 +155,6 @@ static int komeda_wb_connector_add(struct komeda_kms_dev *kms, kwb_conn->wb_layer = kcrtc->master->wb_layer; wb_conn = &kwb_conn->base; - wb_conn->encoder.possible_crtcs = BIT(drm_crtc_index(&kcrtc->base)); formats = komeda_get_layer_fourcc_list(&mdev->fmt_tbl, kwb_conn->wb_layer->layer_type, @@ -164,7 +163,7 @@ static int komeda_wb_connector_add(struct komeda_kms_dev *kms, err = drm_writeback_connector_init(&kms->base, wb_conn, &komeda_wb_connector_funcs, &komeda_wb_encoder_helper_funcs, - formats, n_formats); + formats, n_formats, BIT(drm_crtc_index(&kcrtc->base))); komeda_put_fourcc_list(formats); if (err) { kfree(kwb_conn); diff --git a/drivers/gpu/drm/arm/malidp_mw.c b/drivers/gpu/drm/arm/malidp_mw.c index f5847a7..b882066 100644 --- a/drivers/gpu/drm/arm/malidp_mw.c +++ b/drivers/gpu/drm/arm/malidp_mw.c @@ -208,11 +208,12 @@ int malidp_mw_connector_init(struct drm_device *drm) struct malidp_drm *malidp = drm->dev_private; u32 *formats; int ret, n_formats; + uint32_t possible_crtcs; if (!malidp->dev->hw->enable_memwrite) return 0; - malidp->mw_connector.encoder.possible_crtcs = 1 << drm_crtc_index(&malidp->crtc); + possible_crtcs = 1 << drm_crtc_index(&malidp->crtc); drm_connector_helper_add(&malidp->mw_connector.base, &malidp_mw_connector_helper_funcs); @@ -223,7 +224,7 @@ int malidp_mw_connector_init(struct drm_device *drm) ret = drm_writeback_connector_init(drm, &malidp->mw_connector, &malidp_mw_connector_funcs, &malidp_mw_encoder_helper_funcs, - formats, n_formats); + formats, n_formats, possible_crtcs); Do you need the local variable ? Yes, we can dtop this. I just used this instead of "1 << drm_crtc_index(&malidp->crtc)" to simplify it. No strong preference. kfree(formats); if (ret) return ret; diff --git a/drivers/gpu/drm/drm_writeback.c b/drivers/gpu/drm/drm_writeback.c index dccf4504..17c1471 100644 --- a/drivers/gpu/drm/drm_writeback.c +++ b/drivers/gpu/drm/drm_writeback.c @@ -149,36 +149,15 @@ static const struct drm_encoder_funcs drm_writeback_encoder_funcs = { .destroy = drm_encoder_cleanup, }; -/** - * drm_writeback_connector_init - Initialize a writeback connector and its properties - * @dev: DRM device - * @wb_connec