On Wed, Apr 05, 2023 at 09:35:45AM +0200, Javier Martinez Canillas wrote:
> 
> Hello Zack,
> 
> Thanks for your patch.
> 
> Zack Rusin <z...@kde.org> writes:
> 
> > From: Zack Rusin <za...@vmware.com>
> >
> > Many drivers (in particular all of the virtualized drivers) do not
> > implement vblank handling. Assuming vblank is always present
> > leads to crashes.
> >
> > Fix the crashes by making sure the device supports vblank before using
> > it.
> >
> 
> [...]
> 
> > diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
> > index 299fa2a19a90..6438aeb1c65f 100644
> > --- a/drivers/gpu/drm/drm_vblank.c
> > +++ b/drivers/gpu/drm/drm_vblank.c
> > @@ -997,12 +997,16 @@ int drm_crtc_next_vblank_start(struct drm_crtc *crtc, 
> > ktime_t *vblanktime)
> >  {
> >     unsigned int pipe = drm_crtc_index(crtc);
> >     struct drm_vblank_crtc *vblank = &crtc->dev->vblank[pipe];
> > -   struct drm_display_mode *mode = &vblank->hwmode;
> > +   struct drm_display_mode *mode;
> >     u64 vblank_start;
> >  
> > +   if (!drm_dev_has_vblank(crtc->dev))
> > +           return -EINVAL;
> > +
> >     if (!vblank->framedur_ns || !vblank->linedur_ns)
> >             return -EINVAL;
> >  
> > +   mode = &vblank->hwmode;
> >     if (!drm_crtc_get_last_vbltimestamp(crtc, vblanktime, false))
> >             return -EINVAL;
> >  
> 
> Rob already posted more or less the same fix:
> 
> https://lore.kernel.org/lkml/caf6aegsdt95-uakcv2+hdmlkd2xwfpen+fmudtrmc-ps7wb...@mail.gmail.com/T/

Yeah I pushed it to drm-misc-next yesterday, please check that works. Also
note that we still (in some cases at least where) need another fix to
handle the crtc on/off state transitions (but only for drivers which do
have vblank), I'll send that out asap.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

Reply via email to