All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Abhinav Kumar <quic_abhinavk@quicinc.com>
Cc: hamohammed.sa@gmail.com, suraj.kandpal@intel.com,
	emma@anholt.net, rodrigosiqueiramelo@gmail.com,
	jani.nikula@intel.com, liviu.dudau@arm.com,
	dri-devel@lists.freedesktop.org, swboyd@chromium.org,
	melissa.srw@gmail.com, nganji@codeaurora.org,
	seanpaul@chromium.org, dmitry.baryshkov@linaro.org,
	james.qian.wang@arm.com, quic_aravindh@quicinc.com,
	mihail.atanassov@arm.com, freedreno@lists.freedesktop.org
Subject: Re: [PATCH 5/6] drm/rcar_du: use drm_encoder pointer for drm_writeback_connector
Date: Sun, 13 Mar 2022 16:50:01 +0200	[thread overview]
Message-ID: <Yi4EmSDj04KdslxP@pendragon.ideasonboard.com> (raw)
In-Reply-To: <e31334cf-7e3b-e330-98af-545a07ebff33@quicinc.com>

Hi Abhinav

On Fri, Mar 11, 2022 at 09:47:17AM -0800, Abhinav Kumar wrote:
> On 3/10/2022 11:28 PM, Laurent Pinchart wrote:
> > On Thu, Mar 10, 2022 at 05:49:59PM -0800, Abhinav Kumar wrote:
> >> Make changes to rcar_du driver to start using drm_encoder pointer
> >> for drm_writeback_connector.
> >>
> >> Co-developed-by: Kandpal Suraj <suraj.kandpal@intel.com>
> >> Signed-off-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
> >> ---
> >>   drivers/gpu/drm/rcar-du/rcar_du_writeback.c | 3 ++-
> >>   1 file changed, 2 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_writeback.c b/drivers/gpu/drm/rcar-du/rcar_du_writeback.c
> >> index c79d125..03930ad 100644
> >> --- a/drivers/gpu/drm/rcar-du/rcar_du_writeback.c
> >> +++ b/drivers/gpu/drm/rcar-du/rcar_du_writeback.c
> >> @@ -200,7 +200,8 @@ int rcar_du_writeback_init(struct rcar_du_device *rcdu,
> >>   {
> >>   	struct drm_writeback_connector *wb_conn = &rcrtc->writeback;
> >>   
> >> -	wb_conn->encoder.possible_crtcs = 1 << drm_crtc_index(&rcrtc->crtc);
> >> +	wb_conn->encoder = kzalloc(sizeof(struct drm_encoder), GFP_KERNEL);
> > 
> > Where is this freed ?
> 
> You are right, this isnt. Looking more into this, it seems like moving 
> the allocation of encoder to drm_writeback.c for cases which dont pass a 
> real encoder is much better so that I will not have to add alloc() / 
> free() code for all the vendor driver changes which is what I originally 
> thought in my RFC but changed my mind because of below.

Yes, I think that would be better indeed. You could even skip the
dynamic allocation, you could have

	struct drm_encoder *encoder;
	struct drm_encoder internal_encoder;

in drm_writeback_connector, and set

	wb->encoder = &wb->internal_encoder;

when the user doesn't pass an encoder.

> >> +	wb_conn->encoder->possible_crtcs = 1 << drm_crtc_index(&rcrtc->crtc);
> 
> Do you think we can just move usage of wb_conn->encoder->possible_crtcs 
> just right after drm_writeback_connector_init() so that it wont crash?

How about adding a possible_crtcs argument to
drm_writeback_connector_init() (to cover existing use cases), and adding
a new drm_writeback_connector_init_with_encoder() that would get an
encoder pointer (and expect possible_crtcs, as well as all the other
appropriate encoder fields, having been initialized) ?

> 198 int rcar_du_writeback_init(struct rcar_du_device *rcdu,
> 199 			   struct rcar_du_crtc *rcrtc)
> 200 {
> 201 	struct drm_writeback_connector *wb_conn = &rcrtc->writeback;
> 202
> 203 	wb_conn->encoder.possible_crtcs = 1 << drm_crtc_index(&rcrtc->crtc);
> 204 	drm_connector_helper_add(&wb_conn->base,
> 205 				 &rcar_du_wb_conn_helper_funcs);
> 206
> 207 	return drm_writeback_connector_init(&rcdu->ddev, wb_conn,
> 208 					    &rcar_du_wb_conn_funcs,
> 209 					    &rcar_du_wb_enc_helper_funcs,
> 210 					    writeback_formats,
> 211 					    ARRAY_SIZE(writeback_formats));
> 212 }
> 
> >>   	drm_connector_helper_add(&wb_conn->base,
> >>   				 &rcar_du_wb_conn_helper_funcs);
> >>   

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2022-03-13 14:50 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-11  1:49 [PATCH 0/6] Allow drm_writeback_connector to accept pointer to drm_encoder Abhinav Kumar
2022-03-11  1:49 ` [PATCH 1/6] drm: allow real encoder to be passed for drm_writeback_connector Abhinav Kumar
2022-03-11  7:46   ` Dmitry Baryshkov
2022-03-11  8:05     ` Laurent Pinchart
2022-03-11 17:09       ` Abhinav Kumar
2022-03-11 18:11         ` Dmitry Baryshkov
2022-03-17 10:01       ` Daniel Vetter
2022-03-17 17:36         ` Abhinav Kumar
2022-03-11  1:49 ` [PATCH 2/6] drm/komeda: use drm_encoder pointer " Abhinav Kumar
2022-03-11  1:49 ` [PATCH 3/6] drm/vkms: " Abhinav Kumar
2022-03-11  1:49 ` [PATCH 4/6] drm/vc4: " Abhinav Kumar
2022-03-11  1:49 ` [PATCH 5/6] drm/rcar_du: " Abhinav Kumar
2022-03-11  7:28   ` Laurent Pinchart
2022-03-11 17:47     ` Abhinav Kumar
2022-03-13 14:50       ` Laurent Pinchart [this message]
2022-03-15 23:13         ` Abhinav Kumar
2022-03-11  1:50 ` [PATCH 6/6] drm/malidp: " Abhinav Kumar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Yi4EmSDj04KdslxP@pendragon.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=emma@anholt.net \
    --cc=freedreno@lists.freedesktop.org \
    --cc=hamohammed.sa@gmail.com \
    --cc=james.qian.wang@arm.com \
    --cc=jani.nikula@intel.com \
    --cc=liviu.dudau@arm.com \
    --cc=melissa.srw@gmail.com \
    --cc=mihail.atanassov@arm.com \
    --cc=nganji@codeaurora.org \
    --cc=quic_abhinavk@quicinc.com \
    --cc=quic_aravindh@quicinc.com \
    --cc=rodrigosiqueiramelo@gmail.com \
    --cc=seanpaul@chromium.org \
    --cc=suraj.kandpal@intel.com \
    --cc=swboyd@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.