Re: [PATCH RFC v3 2/6] drm/sprd: add Unisoc's drm kms master

From: Thomas Zimmermann
Date: Tue Feb 25 2020 - 02:38:56 EST


Hi

Am 23.02.20 um 05:26 schrieb tang pengchuan:
>
>
> On Sun, Feb 23, 2020 at 5:27 AM Sam Ravnborg <sam@xxxxxxxxxxxx
> <mailto:sam@xxxxxxxxxxxx>> wrote:
>
> Hi Kevin/tang.
>
> Thanks for the quick and detailed feedback.
> Your questions are addressed below.
>
> Â Â Â Â Sam
>
>
> > > > +static int sprd_drm_bind(struct device *dev)
> > > > +{
> > > > +Â Â Âstruct drm_device *drm;
> > > > +Â Â Âstruct sprd_drm *sprd;
> > > > +Â Â Âint err;
> > > > +
> > > > +Â Â Âdrm = drm_dev_alloc(&sprd_drm_drv, dev);
> > > > +Â Â Âif (IS_ERR(drm))
> > > > +Â Â Â Â Â Â Âreturn PTR_ERR(drm);
> > > You should embed drm_device in struct sprd_drm.
> > > See example code in drm/drm_drv.c
> > >
> > > This is what modern drm drivers do.
> > >
> > > I *think* you can drop the component framework if you do this.
> > >
> > I have read it(drm/drm_drv.c) carefully, if drop the component
> framework,
> > the whole our drm driver maybe need to redesign, so i still want
> to keep
> > current design.
> OK, fine.
>
> > > > +Â Â Âsprd_drm_mode_config_init(drm);
> > > > +
> > > > +Â Â Â/* bind and init sub drivers */
> > > > +Â Â Âerr = component_bind_all(drm->dev, drm);
> > > > +Â Â Âif (err) {
> > > > +Â Â Â Â Â Â ÂDRM_ERROR("failed to bind all component.\n");
> > > > +Â Â Â Â Â Â Âgoto err_dc_cleanup;
> > > > +Â Â Â}
> > > When you have a drm_device - which you do here.
> > > Then please use drm_err() and friends for error messages.
> > > Please verify all uses of DRM_XXX
> > >
> >Â Âmodern drm drivers need drm_xxx to replace DRM_XXX?
> Yes, use of DRM_XXX is deprecated - when you have a drm_device.
>
> > >
> > > > +Â Â Â/* with irq_enabled = true, we can use the vblank
> feature. */
> > > > +Â Â Âdrm->irq_enabled = true;
> > > I cannot see any irq being installed. This looks wrong.
> > >
> > Our display controller isr is been register on crtc
> driver(sprd_dpu.c), not
> > here.
>
> I think you just need to move this to next patch and then it is fine.
>
> Here is the advice given by Thomas Zimmermann, similar to the advice you
> gave.
> I have given thomas feedback about my questions, maybe thomas didn't see
> my email, so there is no reply.

I have been busy last week. Sorry for not getting back to you.

>
> But I've always been confused, because irq is initialized in drm driver
> for other guys, why not for me?

Do you have an example?

Best regards
Thomas

> Can you help to tell the reason in detail, looking forward to your answers.
>
> Thomas's suggestionï
> -------------------------------------------------------------------------------------------
>
> This line indicates the problem's design. The irq is initialized in the
> sub-device code, but the device state is set here. Instead both should
> be set in the same place.
>
>> +
>> +Â Â Â/* reset all the states of crtc/plane/encoder/connector */
>> +Â Â Âdrm_mode_config_reset(drm);
>> +
>> +Â Â Â/* init kms poll for handling hpd */
>> +Â Â Âdrm_kms_helper_poll_init(drm);
>
> Most of this function's code should be moved into the sub-device bind
> function.
>
> Here, maybe do:
>
> Â* allocate device structures
> Â* call component_bind_all()
> Â* on success, register device
>
> The sub-device function should then do
>
> Â* init modesetting, crtc, planes, etc.
> Â* do drm_mode_config_reset()
> Â* init vblanking
> Â* init the irq
> Â* do drm_kms_helper_poll_init()
>
> roughtly in that order. It makes sense to call drm_vblank_init() after
> drm_mode_config_reset(), as vblanking uses some of the mode-config fields.Â
> ------------------------------------------------------------------------------------------------------
>
>
> Â Â Â Â Sam
>
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@xxxxxxxxxxxxxxxxxxxxx
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
>

--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 NÃrnberg, Germany
(HRB 36809, AG NÃrnberg)
GeschÃftsfÃhrer: Felix ImendÃrffer

Attachment: signature.asc
Description: OpenPGP digital signature