Message ID | 1486458995-31018-15-git-send-email-shawnguo@kernel.org |
---|---|
State | New |
Headers | show |
Series | Add vblank hooks to struct drm_crtc_funcs | expand |
On 02/07/2017 10:16 AM, Shawn Guo wrote: > From: Shawn Guo <shawn.guo@linaro.org> > > The vblank hooks in struct drm_driver are deprecated and only meant for > legacy drivers. For modern drivers with DRIVER_MODESET flag, the hooks > in struct drm_crtc_funcs should be used instead. > > Signed-off-by: Shawn Guo <shawn.guo@linaro.org> > Cc: Neil Armstrong <narmstrong@baylibre.com> > --- > drivers/gpu/drm/meson/meson_crtc.c | 22 ++++++++++++++++++++++ > drivers/gpu/drm/meson/meson_drv.c | 20 -------------------- > 2 files changed, 22 insertions(+), 20 deletions(-) > > diff --git a/drivers/gpu/drm/meson/meson_crtc.c b/drivers/gpu/drm/meson/meson_crtc.c > index 749770e5c65f..0fe49eccda65 100644 > --- a/drivers/gpu/drm/meson/meson_crtc.c > +++ b/drivers/gpu/drm/meson/meson_crtc.c > @@ -33,6 +33,7 @@ > > #include "meson_crtc.h" > #include "meson_plane.h" > +#include "meson_venc.h" > #include "meson_vpp.h" > #include "meson_viu.h" > #include "meson_registers.h" > @@ -48,6 +49,24 @@ struct meson_crtc { > > /* CRTC */ > > +static int meson_crtc_enable_vblank(struct drm_crtc *crtc) > +{ > + struct meson_crtc *meson_crtc = to_meson_crtc(crtc); > + struct meson_drm *priv = meson_crtc->priv; > + > + meson_venc_enable_vsync(priv); > + > + return 0; > +} > + > +static void meson_crtc_disable_vblank(struct drm_crtc *crtc) > +{ > + struct meson_crtc *meson_crtc = to_meson_crtc(crtc); > + struct meson_drm *priv = meson_crtc->priv; > + > + meson_venc_disable_vsync(priv); > +} > + > static const struct drm_crtc_funcs meson_crtc_funcs = { > .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state, > .atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state, > @@ -55,6 +74,9 @@ struct meson_crtc { > .page_flip = drm_atomic_helper_page_flip, > .reset = drm_atomic_helper_crtc_reset, > .set_config = drm_atomic_helper_set_config, > + .enable_vblank = meson_crtc_enable_vblank, > + .disable_vblank = meson_crtc_disable_vblank, > + > }; > > static void meson_crtc_enable(struct drm_crtc *crtc) > diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c > index c0a59889c45f..8d17d0e59cbe 100644 > --- a/drivers/gpu/drm/meson/meson_drv.c > +++ b/drivers/gpu/drm/meson/meson_drv.c > @@ -79,22 +79,6 @@ static void meson_fb_output_poll_changed(struct drm_device *dev) > .fb_create = drm_fb_cma_create, > }; > > -static int meson_enable_vblank(struct drm_device *dev, unsigned int crtc) > -{ > - struct meson_drm *priv = dev->dev_private; > - > - meson_venc_enable_vsync(priv); > - > - return 0; > -} > - > -static void meson_disable_vblank(struct drm_device *dev, unsigned int crtc) > -{ > - struct meson_drm *priv = dev->dev_private; > - > - meson_venc_disable_vsync(priv); > -} > - > static irqreturn_t meson_irq(int irq, void *arg) > { > struct drm_device *dev = arg; > @@ -126,10 +110,6 @@ static irqreturn_t meson_irq(int irq, void *arg) > DRIVER_MODESET | DRIVER_PRIME | > DRIVER_ATOMIC, > > - /* Vblank */ > - .enable_vblank = meson_enable_vblank, > - .disable_vblank = meson_disable_vblank, > - > /* IRQ */ > .irq_handler = meson_irq, > > Acked-by: Neil Armstrong <narmstrong@baylibre.com>
diff --git a/drivers/gpu/drm/meson/meson_crtc.c b/drivers/gpu/drm/meson/meson_crtc.c index 749770e5c65f..0fe49eccda65 100644 --- a/drivers/gpu/drm/meson/meson_crtc.c +++ b/drivers/gpu/drm/meson/meson_crtc.c @@ -33,6 +33,7 @@ #include "meson_crtc.h" #include "meson_plane.h" +#include "meson_venc.h" #include "meson_vpp.h" #include "meson_viu.h" #include "meson_registers.h" @@ -48,6 +49,24 @@ struct meson_crtc { /* CRTC */ +static int meson_crtc_enable_vblank(struct drm_crtc *crtc) +{ + struct meson_crtc *meson_crtc = to_meson_crtc(crtc); + struct meson_drm *priv = meson_crtc->priv; + + meson_venc_enable_vsync(priv); + + return 0; +} + +static void meson_crtc_disable_vblank(struct drm_crtc *crtc) +{ + struct meson_crtc *meson_crtc = to_meson_crtc(crtc); + struct meson_drm *priv = meson_crtc->priv; + + meson_venc_disable_vsync(priv); +} + static const struct drm_crtc_funcs meson_crtc_funcs = { .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state, .atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state, @@ -55,6 +74,9 @@ struct meson_crtc { .page_flip = drm_atomic_helper_page_flip, .reset = drm_atomic_helper_crtc_reset, .set_config = drm_atomic_helper_set_config, + .enable_vblank = meson_crtc_enable_vblank, + .disable_vblank = meson_crtc_disable_vblank, + }; static void meson_crtc_enable(struct drm_crtc *crtc) diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c index c0a59889c45f..8d17d0e59cbe 100644 --- a/drivers/gpu/drm/meson/meson_drv.c +++ b/drivers/gpu/drm/meson/meson_drv.c @@ -79,22 +79,6 @@ static void meson_fb_output_poll_changed(struct drm_device *dev) .fb_create = drm_fb_cma_create, }; -static int meson_enable_vblank(struct drm_device *dev, unsigned int crtc) -{ - struct meson_drm *priv = dev->dev_private; - - meson_venc_enable_vsync(priv); - - return 0; -} - -static void meson_disable_vblank(struct drm_device *dev, unsigned int crtc) -{ - struct meson_drm *priv = dev->dev_private; - - meson_venc_disable_vsync(priv); -} - static irqreturn_t meson_irq(int irq, void *arg) { struct drm_device *dev = arg; @@ -126,10 +110,6 @@ static irqreturn_t meson_irq(int irq, void *arg) DRIVER_MODESET | DRIVER_PRIME | DRIVER_ATOMIC, - /* Vblank */ - .enable_vblank = meson_enable_vblank, - .disable_vblank = meson_disable_vblank, - /* IRQ */ .irq_handler = meson_irq,