Plane transitional helper prototypes mismatch their methods
Ping.
Quoted 60 lines · Russell King - ARM Linux
Hi,
Currently, the transitional plane helpers have prototypes that do not have the
drm_modeset_acquire_ctxargument:int drm_plane_helper_update(struct
drm_plane*plane, structdrm_crtc*crtc,
structdrm_framebuffer*fb,
intcrtc_x, intcrtc_y,
unsigned intcrtc_w, unsigned intcrtc_h,uint32_tsrc_x,uint32_tsrc_y,uint32_tsrc_w,uint32_tsrc_h);
intdrm_plane_helper_disable(struct drm_plane *plane);However, the helper methods have this as the last argument:
int (*update_plane)(struct
drm_plane*plane,
structdrm_crtc*crtc, structdrm_framebuffer*fb, intcrtc_x, intcrtc_y,
unsigned intcrtc_w, unsigned intcrtc_h,uint32_tsrc_x,uint32_tsrc_y,uint32_tsrc_w,uint32_tsrc_h, structdrm_modeset_acquire_ctx*ctx);
int (*disable_plane)(structdrm_plane*plane,
structdrm_modeset_acquire_ctx*ctx);Are these transitional helpers supposed to be plugged into these methods directly? Looking back in the history, the following commit to i915 seems to suggest that they were designed to be plugged directly into these methods:
commit
ea2c67bb4affa84080c616920f3899f123786e56Author: Matt Roper <[email protected]> Date: Tue Dec 23 10:41:52 2014 -0800drm/i915: Move to atomic plane helpers (v9)
It seems easy to add this argument to
drm_plane_helper_update()as it has no current users, but thedrm_plane_helper_disable()transitional helper seems to be used extensively by what are otherwise fully atomic modeset drivers, despite being described as only a transitional helper.
drivers/gpu/drm/arm/hdlcd_crtc.c:drm_plane_helper_disable(plane);drivers/gpu/drm/msm/disp/mdp4/mdp4_plane.c:drm_plane_helper_disable(plane);drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c:drm_plane_helper_disable(plane);drivers/gpu/drm/arc/arcpgu_crtc.c: drm_plane_helper_disable(plane); drivers/gpu/drm/sti/sti_hqvdp.c: drm_plane_helper_disable(drm_plane); drivers/gpu/drm/sti/sti_gdp.c: drm_plane_helper_disable(drm_plane); drivers/gpu/drm/sti/sti_cursor.c: drm_plane_helper_disable(drm_plane); drivers/gpu/drm/vc4/vc4_plane.c: drm_plane_helper_disable(plane); drivers/gpu/drm/zte/zx_plane.c: drm_plane_helper_disable(plane);Are these drivers buggy using the transitional helper, which won't do anything but change the state of that single plane, leaving the CRTC, encoders, bridges, etc all active?
Signature · 3 lines
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line in suburbia: sync at 8.8Mbps down 630kbps up According to speedtest.net: 8.21Mbps down 510kbps up
Signature · 7 lines
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line in suburbia: sync at 8.8Mbps down 630kbps up According to speedtest.net: 8.21Mbps down 510kbps up _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 44 lines · Russell King - ARM Linux
Ping.
Quoted 41 lines · Russell King - ARM Linux
Hi,
Currently, the transitional plane helpers have prototypes that do not have the
drm_modeset_acquire_ctxargument:int drm_plane_helper_update(struct
drm_plane*plane, structdrm_crtc*crtc,
structdrm_framebuffer*fb,
intcrtc_x, intcrtc_y,
unsigned intcrtc_w, unsigned intcrtc_h,uint32_tsrc_x,uint32_tsrc_y,uint32_tsrc_w,uint32_tsrc_h);
intdrm_plane_helper_disable(struct drm_plane *plane);However, the helper methods have this as the last argument:
int (*update_plane)(struct
drm_plane*plane,
structdrm_crtc*crtc, structdrm_framebuffer*fb, intcrtc_x, intcrtc_y,
unsigned intcrtc_w, unsigned intcrtc_h,uint32_tsrc_x,uint32_tsrc_y,uint32_tsrc_w,uint32_tsrc_h, structdrm_modeset_acquire_ctx*ctx);
int (*disable_plane)(structdrm_plane*plane,
structdrm_modeset_acquire_ctx*ctx);Are these transitional helpers supposed to be plugged into these methods directly? Looking back in the history, the following commit to i915 seems to suggest that they were designed to be plugged directly into these methods:
commit
ea2c67bb4affa84080c616920f3899f123786e56Author: Matt Roper <[email protected]> Date: Tue Dec 23 10:41:52 2014 -0800drm/i915: Move to atomic plane helpers (v9)
It seems easy to add this argument to
drm_plane_helper_update()as it has no current users, but thedrm_plane_helper_disable()transitional helper seems to be used extensively by what are otherwise fully atomic modeset drivers, despite being described as only a transitional helper.
Yes, I forgotten to add the acquire_ctx to them to make them match up again. Upfront Acked-by: Daniel Vetter <[email protected]> on the patch to re-add that.
Quoted 10 lines
Quoted 10 lines
drivers/gpu/drm/arm/hdlcd_crtc.c:drm_plane_helper_disable(plane);drivers/gpu/drm/msm/disp/mdp4/mdp4_plane.c:drm_plane_helper_disable(plane);drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c:drm_plane_helper_disable(plane);drivers/gpu/drm/arc/arcpgu_crtc.c: drm_plane_helper_disable(plane); drivers/gpu/drm/sti/sti_hqvdp.c: drm_plane_helper_disable(drm_plane); drivers/gpu/drm/sti/sti_gdp.c: drm_plane_helper_disable(drm_plane); drivers/gpu/drm/sti/sti_cursor.c: drm_plane_helper_disable(drm_plane); drivers/gpu/drm/vc4/vc4_plane.c: drm_plane_helper_disable(plane); drivers/gpu/drm/zte/zx_plane.c: drm_plane_helper_disable(plane);
Quoted 3 lines
Quoted 3 lines
Are these drivers buggy using the transitional helper, which won't do anything but change the state of that single plane, leaving the CRTC, encoders, bridges, etc all active?
Yes that's all buggy usage. I've started sprinkling WARN_ON(drm_drv_uses_adomit_modeset) on such legacy functions, but drm_plane_helper_disable() is used a bit too much really.
It's all the same cargo-cult though in the plane->destroy hook. What drivers should do instead is:
- Shut down the hw before cleaning up their modeset objects using something like drm_atomic_helper_shutdown().
- Remove the drm_plane_helper_disable().
But for your patch to add the ctx argument everywhere I think just passing NULL is ok too. It's not going to make things worse :-) Since that patch needs to touch a bunch of drivers probably best if we get it landed through drm-misc-next.
-Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 11 lines · Daniel Vetter
Quoted 10 lines · Russell King - ARM Linux
Quoted 10 lines
drivers/gpu/drm/arm/hdlcd_crtc.c:drm_plane_helper_disable(plane);drivers/gpu/drm/msm/disp/mdp4/mdp4_plane.c:drm_plane_helper_disable(plane);drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c:drm_plane_helper_disable(plane);drivers/gpu/drm/arc/arcpgu_crtc.c: drm_plane_helper_disable(plane); drivers/gpu/drm/sti/sti_hqvdp.c: drm_plane_helper_disable(drm_plane); drivers/gpu/drm/sti/sti_gdp.c: drm_plane_helper_disable(drm_plane); drivers/gpu/drm/sti/sti_cursor.c: drm_plane_helper_disable(drm_plane); drivers/gpu/drm/vc4/vc4_plane.c: drm_plane_helper_disable(plane); drivers/gpu/drm/zte/zx_plane.c: drm_plane_helper_disable(plane);
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines
Are these drivers buggy using the transitional helper, which won't do anything but change the state of that single plane, leaving the CRTC, encoders, bridges, etc all active?
Yes that's all buggy usage. I've started sprinkling
WARN_ON(drm_drv_uses_adomit_modeset)on such legacy functions, butdrm_plane_helper_disable()is used a bit too much really.
However, isn't there a problem in doing that, as going through the transition process means you:
1. switch planes to use the plane transitional helpers
2. migrate crtc to mode_set_nofb()
3. migrate page_flip to use a transitional implementation
4. clean up to use the plane state for all properties
5. switch to atomic modeset by adding .atomic_check / .atomic_commit and DRIVER_ATOMIC flag
6. migrate away from transitional helpers
as separate stages - which means there's a brief period where you have the .atomic_commit method populated (and hence drm_drv_uses_atomic_modeset() returns true) but the transitional helpers are still being used.
I've found if you do (5) and (6) in one go, it becomes quite a large set of changes:
drivers/gpu/drm/armada/armada_crtc.c | 308 +------------------------------- drivers/gpu/drm/armada/armada_crtc.h | 20 --- drivers/gpu/drm/armada/armada_overlay.c | 175 ++++-------------- drivers/gpu/drm/armada/armada_plane.c | 4 +- 4 files changed, 36 insertions(+), 471 deletions(-)
Quoted 4 lines
It's all the same cargo-cult though in the
plane->destroyhook. What drivers should do instead is:
- Shut down the hw before cleaning up their modeset objects using something likedrm_atomic_helper_shutdown().
Hmm, that's something else I've missed in my conversion... thanks for pointing it out. ;)
Quoted 6 lines
- Remove the
drm_plane_helper_disable().But for your patch to add the ctx argument everywhere I think just passing NULL is ok too. It's not going to make things worse :-) Since that patch needs to touch a bunch of drivers probably best if we get it landed through drm-misc-next.
Ok, I've a commit for that - I just need to merge it with the one I already have adding the ctx argument, grab drm-misc-next and make sure it applies there... I'll try to get it out in shortly.
Signature · 7 lines
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line in suburbia: sync at 8.8Mbps down 630kbps up According to speedtest.net: 8.21Mbps down 510kbps up _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 35 lines · Russell King - ARM Linux
Quoted 11 lines · Daniel Vetter
Quoted 10 lines · Russell King - ARM Linux
Quoted 10 lines
drivers/gpu/drm/arm/hdlcd_crtc.c:drm_plane_helper_disable(plane);drivers/gpu/drm/msm/disp/mdp4/mdp4_plane.c:drm_plane_helper_disable(plane);drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c:drm_plane_helper_disable(plane);drivers/gpu/drm/arc/arcpgu_crtc.c: drm_plane_helper_disable(plane); drivers/gpu/drm/sti/sti_hqvdp.c: drm_plane_helper_disable(drm_plane); drivers/gpu/drm/sti/sti_gdp.c: drm_plane_helper_disable(drm_plane); drivers/gpu/drm/sti/sti_cursor.c: drm_plane_helper_disable(drm_plane); drivers/gpu/drm/vc4/vc4_plane.c: drm_plane_helper_disable(plane); drivers/gpu/drm/zte/zx_plane.c: drm_plane_helper_disable(plane);Quoted 7 lines
Quoted 3 lines
Quoted 3 lines
Are these drivers buggy using the transitional helper, which won't do anything but change the state of that single plane, leaving the CRTC, encoders, bridges, etc all active?
Yes that's all buggy usage. I've started sprinkling
WARN_ON(drm_drv_uses_adomit_modeset)on such legacy functions, butdrm_plane_helper_disable()is used a bit too much really.However, isn't there a problem in doing that, as going through the transition process means you:
1. switch planes to use the plane transitional helpers
2. migrate crtc tomode_set_nofb()
3. migratepage_flipto use a transitional implementation
4. clean up to use the plane state for all properties
5. switch to atomic modeset by adding .atomic_check / .atomic_commit andDRIVER_ATOMICflag
6. migrate away from transitional helpersas separate stages - which means there's a brief period where you have the .atomic_commit method populated (and hence
drm_drv_uses_atomic_modeset()returns true) but the transitional helpers are still being used.
Quoted 8 lines
I've found if you do (5) and (6) in one go, it becomes quite a large set of changes:
drivers/gpu/drm/armada/armada_crtc.c | 308 +------------------------------- drivers/gpu/drm/armada/armada_crtc.h | 20 --- drivers/gpu/drm/armada/armada_overlay.c | 175 ++++-------------- drivers/gpu/drm/armada/armada_plane.c | 4 +- 4 files changed, 36 insertions(+), 471 deletions(-)
Hm yeah that doesn't work. I'd say that's perhaps cleanup work for someone bored after armada atomic has landed.
I also think that after armada it probably makes sense to drop the transitional helpers. Anyone else trying to do a legacy2atomic conversion can dig them out of the git history and just carry them around in their driver for the transition. That also avoids the constant headaches of them breaking accidentally all the time. -Daniel
Quoted 23 lines
Quoted 4 lines
It's all the same cargo-cult though in the
plane->destroyhook. What drivers should do instead is:
- Shut down the hw before cleaning up their modeset objects using something likedrm_atomic_helper_shutdown().Hmm, that's something else I've missed in my conversion... thanks for pointing it out. ;)
Quoted 6 lines
- Remove the
drm_plane_helper_disable().But for your patch to add the ctx argument everywhere I think just passing NULL is ok too. It's not going to make things worse :-) Since that patch needs to touch a bunch of drivers probably best if we get it landed through drm-misc-next.
Ok, I've a commit for that - I just need to merge it with the one I already have adding the ctx argument, grab drm-misc-next and make sure it applies there... I'll try to get it out in shortly.
--
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 8.8Mbps down 630kbps up According to speedtest.net: 8.21Mbps down 510kbps up
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel