Hi,
If I use drm_atomic_helper_shutdown() when there's no framebuffer active, it works fine, but if there is, it fails to drop a reference and drm_mode_config_cleanup() complains that there are framebuffers left.
The difference between using drm_atomic_helper_shutdown() and not using it, is a fb put after the pipe is disabled (fb id = 33).
Using drm_atomic_helper_shutdown() on device-driver unbind:
[ 121.543588] [drm:drm_atomic_commit] committing d6c9bd80 [ 121.543648] [drm:drm_atomic_helper_commit_modeset_disables] disabling [ENCODER:30:None-30] [ 121.543671] [drm:drm_atomic_helper_commit_modeset_disables] disabling [CRTC:29:crtc-0] [ 121.543719] [drm:mipi_dbi_pipe_disable [mipi_dbi]] [ 121.543802] [drm:tinydrm_disable_backlight [tinydrm]] Backlight state: 0x0 -> 0x2 [ 121.543878] [drm:drm_atomic_state_default_clear] Clearing atomic state d6c9bd80 [ 121.543903] [drm:drm_mode_object_put] OBJ ID: 27 (5) [ 121.543920] [drm:drm_mode_object_put] OBJ ID: 27 (4) [ 121.543936] [drm:drm_mode_object_put] OBJ ID: 35 (1) [ 121.543982] [drm:drm_mode_object_put] OBJ ID: 33 (3) [ 121.543999] [drm:__drm_atomic_state_free] Freeing atomic state d6c9bd80
Not using drm_atomic_helper_shutdown() and just let it tear down when the last file handle is closed:
[ 72.021160] [drm:drm_atomic_commit] committing d6a48b40 [ 72.021235] [drm:drm_atomic_helper_commit_modeset_disables] disabling [ENCODER:30:None-30] [ 72.021257] [drm:drm_atomic_helper_commit_modeset_disables] disabling [CRTC:29:crtc-0] [ 72.021307] [drm:mipi_dbi_pipe_disable [mipi_dbi]] [ 72.021381] [drm:drm_mode_object_put] OBJ ID: 33 (3) [ 72.021401] [drm:drm_atomic_state_default_clear] Clearing atomic state d6a48b40 [ 72.021416] [drm:drm_mode_object_put] OBJ ID: 27 (3) [ 72.021431] [drm:drm_mode_object_put] OBJ ID: 27 (2) [ 72.021461] [drm:drm_mode_object_put] OBJ ID: 35 (1) [ 72.021489] [drm:drm_mode_object_put] OBJ ID: 33 (2) [ 72.021504] [drm:__drm_atomic_state_free] Freeing atomic state d6a48b40
More details:
Calling drm_atomic_helper_shutdown():
[ 121.543048] [drm:drm_atomic_state_init] Allocated atomic state d6c9bd80 [ 121.543106] [drm:drm_mode_object_get] OBJ ID: 35 (1) [ 121.543127] [drm:drm_atomic_get_crtc_state] Added [CRTC:29:crtc-0] d6db8400 state to d6c9bd80 [ 121.543142] [drm:drm_mode_object_put] OBJ ID: 35 (2) [ 121.543158] [drm:drm_atomic_set_mode_prop_for_crtc] Set [NOMODE] for CRTC state d6db8400 [ 121.543180] [drm:drm_mode_object_get] OBJ ID: 33 (3) [ 121.543198] [drm:drm_atomic_get_plane_state] Added [PLANE:28:plane-0] d6e5b180 state to d6c9bd80 [ 121.543234] [drm:drm_atomic_add_affected_connectors] Adding all current connectors for [CRTC:29:crtc-0] to d6c9bd80 [ 121.543262] [drm:drm_mode_object_get] OBJ ID: 27 (5) [ 121.543276] [drm:drm_mode_object_get] OBJ ID: 27 (6) [ 121.543294] [drm:drm_atomic_get_connector_state] Added [CONNECTOR:27:Virtual-1] d6e5b580 state to d6c9bd80 [ 121.543307] [drm:drm_mode_object_put] OBJ ID: 27 (7) [ 121.543337] [drm:drm_mode_object_put] OBJ ID: 27 (6) [ 121.543352] [drm:drm_atomic_set_crtc_for_connector] Link connector state d6e5b580 to [NOCRTC] [ 121.543367] [drm:drm_atomic_set_crtc_for_plane] Link plane state d6e5b180 to [NOCRTC] [ 121.543379] [drm:drm_atomic_set_fb_for_plane] Set [NOFB] for plane state d6e5b180 [ 121.543392] [drm:drm_mode_object_put] OBJ ID: 33 (4) [ 121.543405] [drm:drm_atomic_check_only] checking d6c9bd80 [ 121.543426] [drm:drm_atomic_helper_check_modeset] [CRTC:29:crtc-0] mode changed [ 121.543438] [drm:drm_atomic_helper_check_modeset] [CRTC:29:crtc-0] enable changed [ 121.543466] [drm:drm_atomic_helper_check_modeset] [CRTC:29:crtc-0] active changed [ 121.543483] [drm:drm_atomic_helper_check_modeset] Updating routing for [CONNECTOR:27:Virtual-1] [ 121.543495] [drm:drm_atomic_helper_check_modeset] Disabling [CONNECTOR:27:Virtual-1] [ 121.543512] [drm:drm_atomic_helper_check_modeset] [CRTC:29:crtc-0] needs all connectors, enable: n, active: n [ 121.543531] [drm:drm_atomic_add_affected_connectors] Adding all current connectors for [CRTC:29:crtc-0] to d6c9bd80 [ 121.543546] [drm:drm_mode_object_put] OBJ ID: 27 (6) [ 121.543588] [drm:drm_atomic_commit] committing d6c9bd80 [ 121.543648] [drm:drm_atomic_helper_commit_modeset_disables] disabling [ENCODER:30:None-30] [ 121.543671] [drm:drm_atomic_helper_commit_modeset_disables] disabling [CRTC:29:crtc-0] [ 121.543719] [drm:mipi_dbi_pipe_disable [mipi_dbi]] [ 121.543802] [drm:tinydrm_disable_backlight [tinydrm]] Backlight state: 0x0 -> 0x2 [ 121.543878] [drm:drm_atomic_state_default_clear] Clearing atomic state d6c9bd80 [ 121.543903] [drm:drm_mode_object_put] OBJ ID: 27 (5) [ 121.543920] [drm:drm_mode_object_put] OBJ ID: 27 (4) [ 121.543936] [drm:drm_mode_object_put] OBJ ID: 35 (1) [ 121.543982] [drm:drm_mode_object_put] OBJ ID: 33 (3) [ 121.543999] [drm:__drm_atomic_state_free] Freeing atomic state d6c9bd80
Not using drm_atomic_helper_shutdown():
[ 72.020447] [drm:drm_fb_helper_fb_destroy] [ 72.020554] [drm:drm_mode_object_put] OBJ ID: 27 (4) [ 72.020592] [drm:drm_mode_object_put] OBJ ID: 27 (3) [ 72.020629] [drm:drm_atomic_state_init] Allocated atomic state d6a48b40 [ 72.020659] [drm:drm_mode_object_get] OBJ ID: 33 (3) [ 72.020677] [drm:drm_atomic_get_plane_state] Added [PLANE:28:plane-0] d6aa7980 state to d6a48b40 [ 72.020716] [drm:drm_mode_object_get] OBJ ID: 35 (1) [ 72.020736] [drm:drm_atomic_get_crtc_state] Added [CRTC:29:crtc-0] d77a4800 state to d6a48b40 [ 72.020757] [drm:drm_atomic_add_affected_connectors] Adding all current connectors for [CRTC:29:crtc-0] to d6a48b40 [ 72.020784] [drm:drm_mode_object_get] OBJ ID: 27 (3) [ 72.020799] [drm:drm_mode_object_get] OBJ ID: 27 (4) [ 72.020816] [drm:drm_atomic_get_connector_state] Added [CONNECTOR:27:Virtual-1] d6aa7380 state to d6a48b40 [ 72.020846] [drm:drm_mode_object_put] OBJ ID: 27 (5) [ 72.020863] [drm:drm_mode_object_put] OBJ ID: 35 (2) [ 72.020877] [drm:drm_atomic_set_mode_for_crtc] Set [NOMODE] for CRTC state d77a4800 [ 72.020891] [drm:drm_atomic_set_fb_for_plane] Set [NOFB] for plane state d6aa7980 [ 72.020905] [drm:drm_mode_object_put] OBJ ID: 33 (4) [ 72.020918] [drm:drm_atomic_set_crtc_for_plane] Link plane state d6aa7980 to [NOCRTC] [ 72.020933] [drm:drm_mode_object_put] OBJ ID: 27 (4) [ 72.020962] [drm:drm_atomic_set_crtc_for_connector] Link connector state d6aa7380 to [NOCRTC] [ 72.020977] [drm:drm_atomic_check_only] checking d6a48b40 [ 72.020997] [drm:drm_atomic_helper_check_modeset] [CRTC:29:crtc-0] mode changed [ 72.021010] [drm:drm_atomic_helper_check_modeset] [CRTC:29:crtc-0] enable changed [ 72.021021] [drm:drm_atomic_helper_check_modeset] [CRTC:29:crtc-0] active changed [ 72.021036] [drm:drm_atomic_helper_check_modeset] Updating routing for [CONNECTOR:27:Virtual-1] [ 72.021048] [drm:drm_atomic_helper_check_modeset] Disabling [CONNECTOR:27:Virtual-1] [ 72.021066] [drm:drm_atomic_helper_check_modeset] [CRTC:29:crtc-0] needs all connectors, enable: n, active: n [ 72.021099] [drm:drm_atomic_add_affected_connectors] Adding all current connectors for [CRTC:29:crtc-0] to d6a48b40 [ 72.021116] [drm:drm_mode_object_put] OBJ ID: 27 (4) [ 72.021160] [drm:drm_atomic_commit] committing d6a48b40 [ 72.021235] [drm:drm_atomic_helper_commit_modeset_disables] disabling [ENCODER:30:None-30] [ 72.021257] [drm:drm_atomic_helper_commit_modeset_disables] disabling [CRTC:29:crtc-0] [ 72.021307] [drm:mipi_dbi_pipe_disable [mipi_dbi]] [ 72.021381] [drm:drm_mode_object_put] OBJ ID: 33 (3) [ 72.021401] [drm:drm_atomic_state_default_clear] Clearing atomic state d6a48b40 [ 72.021416] [drm:drm_mode_object_put] OBJ ID: 27 (3) [ 72.021431] [drm:drm_mode_object_put] OBJ ID: 27 (2) [ 72.021461] [drm:drm_mode_object_put] OBJ ID: 35 (1) [ 72.021489] [drm:drm_mode_object_put] OBJ ID: 33 (2) [ 72.021504] [drm:__drm_atomic_state_free] Freeing atomic state d6a48b40
Noralf.
On Mon, Aug 28, 2017 at 7:25 PM, Noralf Trønnes noralf@tronnes.org wrote:
Hi,
If I use drm_atomic_helper_shutdown() when there's no framebuffer active, it works fine, but if there is, it fails to drop a reference and drm_mode_config_cleanup() complains that there are framebuffers left.
The difference between using drm_atomic_helper_shutdown() and not using it, is a fb put after the pipe is disabled (fb id = 33).
Using drm_atomic_helper_shutdown() on device-driver unbind:
[ 121.543588] [drm:drm_atomic_commit] committing d6c9bd80 [ 121.543648] [drm:drm_atomic_helper_commit_modeset_disables] disabling [ENCODER:30:None-30] [ 121.543671] [drm:drm_atomic_helper_commit_modeset_disables] disabling [CRTC:29:crtc-0] [ 121.543719] [drm:mipi_dbi_pipe_disable [mipi_dbi]] [ 121.543802] [drm:tinydrm_disable_backlight [tinydrm]] Backlight state: 0x0 -> 0x2 [ 121.543878] [drm:drm_atomic_state_default_clear] Clearing atomic state d6c9bd80 [ 121.543903] [drm:drm_mode_object_put] OBJ ID: 27 (5) [ 121.543920] [drm:drm_mode_object_put] OBJ ID: 27 (4) [ 121.543936] [drm:drm_mode_object_put] OBJ ID: 35 (1) [ 121.543982] [drm:drm_mode_object_put] OBJ ID: 33 (3) [ 121.543999] [drm:__drm_atomic_state_free] Freeing atomic state d6c9bd80
Not using drm_atomic_helper_shutdown() and just let it tear down when the last file handle is closed:
[ 72.021160] [drm:drm_atomic_commit] committing d6a48b40 [ 72.021235] [drm:drm_atomic_helper_commit_modeset_disables] disabling [ENCODER:30:None-30] [ 72.021257] [drm:drm_atomic_helper_commit_modeset_disables] disabling [CRTC:29:crtc-0] [ 72.021307] [drm:mipi_dbi_pipe_disable [mipi_dbi]] [ 72.021381] [drm:drm_mode_object_put] OBJ ID: 33 (3) [ 72.021401] [drm:drm_atomic_state_default_clear] Clearing atomic state d6a48b40 [ 72.021416] [drm:drm_mode_object_put] OBJ ID: 27 (3) [ 72.021431] [drm:drm_mode_object_put] OBJ ID: 27 (2) [ 72.021461] [drm:drm_mode_object_put] OBJ ID: 35 (1) [ 72.021489] [drm:drm_mode_object_put] OBJ ID: 33 (2) [ 72.021504] [drm:__drm_atomic_state_free] Freeing atomic state d6a48b40
More details:
Calling drm_atomic_helper_shutdown():
[ 121.543048] [drm:drm_atomic_state_init] Allocated atomic state d6c9bd80 [ 121.543106] [drm:drm_mode_object_get] OBJ ID: 35 (1) [ 121.543127] [drm:drm_atomic_get_crtc_state] Added [CRTC:29:crtc-0] d6db8400 state to d6c9bd80 [ 121.543142] [drm:drm_mode_object_put] OBJ ID: 35 (2) [ 121.543158] [drm:drm_atomic_set_mode_prop_for_crtc] Set [NOMODE] for CRTC state d6db8400 [ 121.543180] [drm:drm_mode_object_get] OBJ ID: 33 (3) [ 121.543198] [drm:drm_atomic_get_plane_state] Added [PLANE:28:plane-0] d6e5b180 state to d6c9bd80 [ 121.543234] [drm:drm_atomic_add_affected_connectors] Adding all current connectors for [CRTC:29:crtc-0] to d6c9bd80 [ 121.543262] [drm:drm_mode_object_get] OBJ ID: 27 (5) [ 121.543276] [drm:drm_mode_object_get] OBJ ID: 27 (6) [ 121.543294] [drm:drm_atomic_get_connector_state] Added [CONNECTOR:27:Virtual-1] d6e5b580 state to d6c9bd80 [ 121.543307] [drm:drm_mode_object_put] OBJ ID: 27 (7) [ 121.543337] [drm:drm_mode_object_put] OBJ ID: 27 (6) [ 121.543352] [drm:drm_atomic_set_crtc_for_connector] Link connector state d6e5b580 to [NOCRTC] [ 121.543367] [drm:drm_atomic_set_crtc_for_plane] Link plane state d6e5b180 to [NOCRTC] [ 121.543379] [drm:drm_atomic_set_fb_for_plane] Set [NOFB] for plane state d6e5b180 [ 121.543392] [drm:drm_mode_object_put] OBJ ID: 33 (4) [ 121.543405] [drm:drm_atomic_check_only] checking d6c9bd80 [ 121.543426] [drm:drm_atomic_helper_check_modeset] [CRTC:29:crtc-0] mode changed [ 121.543438] [drm:drm_atomic_helper_check_modeset] [CRTC:29:crtc-0] enable changed [ 121.543466] [drm:drm_atomic_helper_check_modeset] [CRTC:29:crtc-0] active changed [ 121.543483] [drm:drm_atomic_helper_check_modeset] Updating routing for [CONNECTOR:27:Virtual-1] [ 121.543495] [drm:drm_atomic_helper_check_modeset] Disabling [CONNECTOR:27:Virtual-1] [ 121.543512] [drm:drm_atomic_helper_check_modeset] [CRTC:29:crtc-0] needs all connectors, enable: n, active: n [ 121.543531] [drm:drm_atomic_add_affected_connectors] Adding all current connectors for [CRTC:29:crtc-0] to d6c9bd80 [ 121.543546] [drm:drm_mode_object_put] OBJ ID: 27 (6) [ 121.543588] [drm:drm_atomic_commit] committing d6c9bd80 [ 121.543648] [drm:drm_atomic_helper_commit_modeset_disables] disabling [ENCODER:30:None-30] [ 121.543671] [drm:drm_atomic_helper_commit_modeset_disables] disabling [CRTC:29:crtc-0] [ 121.543719] [drm:mipi_dbi_pipe_disable [mipi_dbi]] [ 121.543802] [drm:tinydrm_disable_backlight [tinydrm]] Backlight state: 0x0 -> 0x2 [ 121.543878] [drm:drm_atomic_state_default_clear] Clearing atomic state d6c9bd80 [ 121.543903] [drm:drm_mode_object_put] OBJ ID: 27 (5) [ 121.543920] [drm:drm_mode_object_put] OBJ ID: 27 (4) [ 121.543936] [drm:drm_mode_object_put] OBJ ID: 35 (1) [ 121.543982] [drm:drm_mode_object_put] OBJ ID: 33 (3) [ 121.543999] [drm:__drm_atomic_state_free] Freeing atomic state d6c9bd80
Not using drm_atomic_helper_shutdown():
[ 72.020447] [drm:drm_fb_helper_fb_destroy]
I don't see your code, but from the logs it sound like you're replacing a call for this with the shutdown helper. That will ofcourse the references the fb helper holds. You need both calls to clean up everything in all cases. -Daniel
[ 72.020554] [drm:drm_mode_object_put] OBJ ID: 27 (4) [ 72.020592] [drm:drm_mode_object_put] OBJ ID: 27 (3) [ 72.020629] [drm:drm_atomic_state_init] Allocated atomic state d6a48b40 [ 72.020659] [drm:drm_mode_object_get] OBJ ID: 33 (3) [ 72.020677] [drm:drm_atomic_get_plane_state] Added [PLANE:28:plane-0] d6aa7980 state to d6a48b40 [ 72.020716] [drm:drm_mode_object_get] OBJ ID: 35 (1) [ 72.020736] [drm:drm_atomic_get_crtc_state] Added [CRTC:29:crtc-0] d77a4800 state to d6a48b40 [ 72.020757] [drm:drm_atomic_add_affected_connectors] Adding all current connectors for [CRTC:29:crtc-0] to d6a48b40 [ 72.020784] [drm:drm_mode_object_get] OBJ ID: 27 (3) [ 72.020799] [drm:drm_mode_object_get] OBJ ID: 27 (4) [ 72.020816] [drm:drm_atomic_get_connector_state] Added [CONNECTOR:27:Virtual-1] d6aa7380 state to d6a48b40 [ 72.020846] [drm:drm_mode_object_put] OBJ ID: 27 (5) [ 72.020863] [drm:drm_mode_object_put] OBJ ID: 35 (2) [ 72.020877] [drm:drm_atomic_set_mode_for_crtc] Set [NOMODE] for CRTC state d77a4800 [ 72.020891] [drm:drm_atomic_set_fb_for_plane] Set [NOFB] for plane state d6aa7980 [ 72.020905] [drm:drm_mode_object_put] OBJ ID: 33 (4) [ 72.020918] [drm:drm_atomic_set_crtc_for_plane] Link plane state d6aa7980 to [NOCRTC] [ 72.020933] [drm:drm_mode_object_put] OBJ ID: 27 (4) [ 72.020962] [drm:drm_atomic_set_crtc_for_connector] Link connector state d6aa7380 to [NOCRTC] [ 72.020977] [drm:drm_atomic_check_only] checking d6a48b40 [ 72.020997] [drm:drm_atomic_helper_check_modeset] [CRTC:29:crtc-0] mode changed [ 72.021010] [drm:drm_atomic_helper_check_modeset] [CRTC:29:crtc-0] enable changed [ 72.021021] [drm:drm_atomic_helper_check_modeset] [CRTC:29:crtc-0] active changed [ 72.021036] [drm:drm_atomic_helper_check_modeset] Updating routing for [CONNECTOR:27:Virtual-1] [ 72.021048] [drm:drm_atomic_helper_check_modeset] Disabling [CONNECTOR:27:Virtual-1] [ 72.021066] [drm:drm_atomic_helper_check_modeset] [CRTC:29:crtc-0] needs all connectors, enable: n, active: n [ 72.021099] [drm:drm_atomic_add_affected_connectors] Adding all current connectors for [CRTC:29:crtc-0] to d6a48b40 [ 72.021116] [drm:drm_mode_object_put] OBJ ID: 27 (4) [ 72.021160] [drm:drm_atomic_commit] committing d6a48b40 [ 72.021235] [drm:drm_atomic_helper_commit_modeset_disables] disabling [ENCODER:30:None-30] [ 72.021257] [drm:drm_atomic_helper_commit_modeset_disables] disabling [CRTC:29:crtc-0] [ 72.021307] [drm:mipi_dbi_pipe_disable [mipi_dbi]] [ 72.021381] [drm:drm_mode_object_put] OBJ ID: 33 (3) [ 72.021401] [drm:drm_atomic_state_default_clear] Clearing atomic state d6a48b40 [ 72.021416] [drm:drm_mode_object_put] OBJ ID: 27 (3) [ 72.021431] [drm:drm_mode_object_put] OBJ ID: 27 (2) [ 72.021461] [drm:drm_mode_object_put] OBJ ID: 35 (1) [ 72.021489] [drm:drm_mode_object_put] OBJ ID: 33 (2) [ 72.021504] [drm:__drm_atomic_state_free] Freeing atomic state d6a48b40
Noralf.
dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
On Mon, Aug 28, 2017 at 10:54 PM, Daniel Vetter daniel@ffwll.ch wrote:
I don't see your code, but from the logs it sound like you're replacing a call for this with the shutdown helper. That will ofcourse the references the fb helper holds. You need both calls to clean up everything in all cases.
Oops, that got mangled, I meant to write: Drop fb_destroy will fail to clean up the references the fb helper holds. -Daniel
dri-devel@lists.freedesktop.org