Revert "drm/atomic-helper: Fix leak in disable_all"
Subsystems (3)
PATCH 1/6 Revert "drm/atomic-helper: Fix leak in disable_all"
From: Ville Syrjälä <[email protected]>
Currently we're leaking fbs on load detect on account of nothing setting up plane->old_fb for the drm_atomic_clean_old_fb() call in drm_atomic_helper_commit_duplicated_state(). Removing the drm_atomic_clean_old_fb() call seems like the right call to me here. This does mean we end up leaking something via drm_atomic_helper_shutdown() though, but we'll fix that up in a different way.
This reverts commit 49d70aeaeca8f62b72b7712ecd1e29619a445866.
--- drivers/gpu/drm/drm_atomic_helper.c | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-)
drivers/gpu/drm/drm_atomic_helper.c +2 -16
@@ -2914,7 +2914,6 @@ int drm_atomic_helper_disable_all(struct drm_device *dev,struct drm_plane *plane;struct drm_crtc_state *crtc_state;struct drm_crtc *crtc; -unsigned plane_mask =0 ;int ret, i; state =drm_atomic_state_alloc (dev);
@@ -2957,14 +2956,10 @@ int drm_atomic_helper_disable_all(struct drm_device *dev, goto free;drm_atomic_set_fb_for_plane (plane_state,NULL ); - plane_mask |=BIT (drm_plane_index (plane)); - plane->old_fb = plane->fb; } ret =drm_atomic_commit (state); free: -if (plane_mask) -drm_atomic_clean_old_fb (dev, plane_mask, ret);drm_atomic_state_put (state);return ret; }
@@ -3095,16 +3090,11 @@ int drm_atomic_helper_commit_duplicated_state(struct drm_atomic_state *state,struct drm_connector_state *new_conn_state;struct drm_crtc *crtc;struct drm_crtc_state *new_crtc_state; -unsigned plane_mask =0 ; -struct drm_device *dev = state->dev; -int ret; state->acquire_ctx = ctx; -for_each_new_plane_in_state (state, plane, new_plane_state, i) { - plane_mask |=BIT (drm_plane_index (plane)); +for_each_new_plane_in_state (state, plane, new_plane_state, i) state->planes[i].old_state = plane->state; - }for_each_new_crtc_in_state (state, crtc, new_crtc_state, i) state->crtcs[i].old_state = crtc->state;
@@ -3112,11 +3102,7 @@ int drm_atomic_helper_commit_duplicated_state(struct drm_atomic_state *state,for_each_new_connector_in_state (state, connector, new_conn_state, i) state->connectors[i].old_state = connector->state; - ret =drm_atomic_commit (state); -if (plane_mask) -drm_atomic_clean_old_fb (dev, plane_mask, ret); - -return ret; +return drm_atomic_commit (state); }EXPORT_SYMBOL (drm_atomic_helper_commit_duplicated_state);
Signature · 6 lines
2.16.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 2/6 drm/atomic-helper: Make drm_atomic_helper_disable_all() update the plane->fb pointers
From: Ville Syrjälä <[email protected]>
drm_atomic_helper_shutdown() needs to release the reference held by plane->fb, so we want to use drm_atomic_clean_old_fb() in drm_atomic_helper_disable_all(). However during suspend/resume, gpu reset and load detection we should probably leave that stuff alone, as otherwise we'd have to make sure we put them back again when we restore the duplicated state to the device. Seems simpler to me to not touch any of it anyway.
--- drivers/gpu/drm/drm_atomic_helper.c | 16 +++++++++++++--- drivers/gpu/drm/i915/intel_display.c | 2 +- include/drm/drm_atomic_helper.h | 3 ++- 3 files changed, 16 insertions(+), 5 deletions(-)
drivers/gpu/drm/drm_atomic_helper.c +13 -3
@@ -2885,6 +2885,7 @@ int __drm_atomic_helper_set_config(struct drm_mode_set *set,* drm_atomic_helper_disable_all - disable all currently active outputs * @dev: DRM device * @ctx: lock acquisition context +* @clean_old_fbs: update the plane->fb/old_fb pointers? * * Loops through all connectors, finding those that aren't turned off and then * turns them off by setting their DPMS mode to OFF and deactivating the CRTC
@@ -2905,7 +2906,8 @@ int __drm_atomic_helper_set_config(struct drm_mode_set *set,* drm_atomic_helper_shutdown(). */ int drm_atomic_helper_disable_all (struct drm_device *dev, -struct drm_modeset_acquire_ctx *ctx) +struct drm_modeset_acquire_ctx *ctx, +bool clean_old_fbs) {struct drm_atomic_state *state;struct drm_connector_state *conn_state;
@@ -2914,6 +2916,7 @@ int drm_atomic_helper_disable_all(struct drm_device *dev,struct drm_plane *plane;struct drm_crtc_state *crtc_state;struct drm_crtc *crtc; +unsigned int plane_mask =0 ;int ret, i; state =drm_atomic_state_alloc (dev);
@@ -2956,10 +2959,17 @@ int drm_atomic_helper_disable_all(struct drm_device *dev, goto free;drm_atomic_set_fb_for_plane (plane_state,NULL ); + +if (clean_old_fbs) { + plane->old_fb = plane->fb; + plane_mask |=BIT (drm_plane_index (plane)); + } } ret =drm_atomic_commit (state); free: +drm_atomic_clean_old_fb (dev, plane_mask, ret); +drm_atomic_state_put (state);return ret; }
@@ -2986,7 +2996,7 @@ void drm_atomic_helper_shutdown(struct drm_device *dev)while (1 ) { ret =drm_modeset_lock_all_ctx (dev, &ctx);if (!ret) - ret =drm_atomic_helper_disable_all (dev, &ctx); + ret =drm_atomic_helper_disable_all (dev, &ctx, true);if (ret != -EDEADLK )break ;
@@ -3046,7 +3056,7 @@ struct drm_atomic_state *drm_atomic_helper_suspend(struct drm_device *dev)if (IS_ERR (state)) goto unlock; - err =drm_atomic_helper_disable_all (dev, &ctx); + err =drm_atomic_helper_disable_all (dev, &ctx, false);if (err <0 ) {drm_atomic_state_put (state); state =ERR_PTR (err);
drivers/gpu/drm/i915/intel_display.c +1 -1
@@ -3716,7 +3716,7 @@ void intel_prepare_reset(struct drm_i915_private *dev_priv)return ; } - ret =drm_atomic_helper_disable_all (dev, ctx); + ret =drm_atomic_helper_disable_all (dev, ctx, false);if (ret) {DRM_ERROR ("Suspending crtc's failed with %i\n" , ret);drm_atomic_state_put (state);
include/drm/drm_atomic_helper.h +2 -1
@@ -122,7 +122,8 @@ int __drm_atomic_helper_set_config(struct drm_mode_set *set, struct drm_atomic_state *state);int drm_atomic_helper_disable_all (struct drm_device *dev, -struct drm_modeset_acquire_ctx *ctx); +struct drm_modeset_acquire_ctx *ctx, +bool clean_old_fbs);void drm_atomic_helper_shutdown (struct drm_device *dev);struct drm_atomic_state *drm_atomic_helper_suspend (struct drm_device *dev); int drm_atomic_helper_commit_duplicated_state(struct drm_atomic_state *state,
Signature · 6 lines
2.16.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 3/6 drm: Clear crtc->primary->crtc when disabling the crtc via setcrtc()
In reply to Ville SyrjalaFrom: Ville Syrjälä <[email protected]>
Keep the primary->crtc in sync with the state->crtc (also with primary->fb and state->fb) when disabling the crtc (and thus also the primary) via setcrtc().
--- drivers/gpu/drm/drm_crtc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_crtc.c +1 -1
@@ -471,7 +471,7 @@ static int __drm_mode_set_config_internal(struct drm_mode_set *set, ret = crtc->funcs->set_config (set, ctx);if (ret ==0 ) { - crtc->primary->crtc = crtc; + crtc->primary->crtc = fb ? crtc :NULL ; crtc->primary->fb = fb; }
Signature · 6 lines
2.16.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 4/6 drm/atomic-helper: WARN if legacy plane fb pointers are bogus when committing duplicated state
In reply to Ville SyrjalaFrom: Ville Syrjälä <[email protected]>
drm_atomic_helper_commit_duplicated_state() should only be called resume/reset/load_detect paths where plane->old_fb should always be NULL and plane->fb should be equal to the new_plane_state->fb. Assert that is indeed the case.
--- drivers/gpu/drm/drm_atomic_helper.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_atomic_helper.c +6 -1
@@ -3103,8 +3103,13 @@ int drm_atomic_helper_commit_duplicated_state(struct drm_atomic_state *state, state->acquire_ctx = ctx; -for_each_new_plane_in_state (state, plane, new_plane_state, i) +for_each_new_plane_in_state (state, plane, new_plane_state, i) { +WARN_ON (plane->crtc != new_plane_state->crtc); +WARN_ON (plane->fb != new_plane_state->fb); +WARN_ON (plane->old_fb); + state->planes[i].old_state = plane->state; + }for_each_new_crtc_in_state (state, crtc, new_crtc_state, i) state->crtcs[i].old_state = crtc->state;
Signature · 6 lines
2.16.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 5/6 drm/i915: Restore planes after load detection
In reply to Ville SyrjalaFrom: Ville Syrjälä <[email protected]>
Actually turn the planes back on after were done with the load detection.
--- drivers/gpu/drm/i915/intel_display.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/i915/intel_display.c +2 -0
@@ -9976,6 +9976,8 @@ int intel_get_load_detect_pipe(struct drm_connector *connector, ret =PTR_ERR_OR_ZERO (drm_atomic_get_connector_state (restore_state, connector));if (!ret) ret =PTR_ERR_OR_ZERO (drm_atomic_get_crtc_state (restore_state, crtc)); +if (!ret) + ret =drm_atomic_add_affected_planes (restore_state, crtc);if (ret) {DRM_DEBUG_KMS ("Failed to create a copy of old state to restore: %i\n" , ret); goto fail;
Signature · 6 lines
2.16.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 6/6 drm/i915: Make force_load_detect effective even w/ DMI quirks/hotplug
In reply to Ville SyrjalaFrom: Ville Syrjälä <[email protected]>
When doing forced load detection testing we should totally ignore any hotplug status for the connector. This is mostly relevant for machines where we already ignore the hotplug status based on the DMI quirks. On other machines we would currently skip the force load detection tests on account of the connector already being connected.
--- drivers/gpu/drm/i915/intel_crt.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/i915/intel_crt.c +6 -0
@@ -748,6 +748,11 @@ intel_crt_detect(struct drm_connector *connector, connector->base.id, connector->name, force); +if (i915_modparams.load_detect_test) { +intel_display_power_get (dev_priv, intel_encoder->power_domain); + goto load_detect; + } +/* Skip machines without VGA that falsely report hotplug events */ if (dmi_check_system (intel_spurious_crt_detect))return connector_status_disconnected;
@@ -781,6 +786,7 @@ intel_crt_detect(struct drm_connector *connector, goto out; } +load_detect:if (!force) { status = connector->status; goto out;
Signature · 6 lines
2.16.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.BAT: success for series starting with [1/6] Revert "drm/atomic-helper: Fix leak in disable_all"
In reply to Ville Syrjala== Series Details ==
== Series Details ==
Series: series starting with [1/6] Revert "drm/atomic-helper: Fix leak in disable_all"
URL : https://patchwork.freedesktop.org/series/40321/
State : success
== Summary ==
Series 40321v1 series starting with [1/6] Revert "drm/atomic-helper: Fix leak in disable_all"
https://patchwork.freedesktop.org/api/1.0/series/40321/revisions/1/mbox/
---- Possible new issues:
Test kms_pipe_crc_basic:
Subgroup suspend-read-crc-pipe-a:
incomplete -> PASS (fi-cfl-s2)---- Known issues:
Test debugfs_test:
Subgroup read_all_entries:
pass -> INCOMPLETE (fi-snb-2520m) fdo#103713fdo#103713 https://bugs.freedesktop.org/show_bug.cgi?id=103713
fi-bdw-5557u total:285 pass:264 dwarn:0 dfail:0 fail:0 skip:21 time:433s fi-bdw-gvtdvm total:285 pass:261 dwarn:0 dfail:0 fail:0 skip:24 time:443s fi-blb-e6850 total:285 pass:220 dwarn:1 dfail:0 fail:0 skip:64 time:380s fi-bsw-n3050 total:285 pass:239 dwarn:0 dfail:0 fail:0 skip:46 time:537s fi-bwr-2160 total:285 pass:180 dwarn:0 dfail:0 fail:0 skip:105 time:295s fi-bxt-dsi total:285 pass:255 dwarn:0 dfail:0 fail:0 skip:30 time:513s fi-bxt-j4205 total:285 pass:256 dwarn:0 dfail:0 fail:0 skip:29 time:516s fi-byt-j1900 total:285 pass:250 dwarn:0 dfail:0 fail:0 skip:35 time:513s fi-byt-n2820 total:285 pass:246 dwarn:0 dfail:0 fail:0 skip:39 time:503s fi-cfl-8700k total:285 pass:257 dwarn:0 dfail:0 fail:0 skip:28 time:410s fi-cfl-s2 total:285 pass:259 dwarn:0 dfail:0 fail:0 skip:26 time:581s fi-cfl-u total:285 pass:259 dwarn:0 dfail:0 fail:0 skip:26 time:511s fi-cnl-drrs total:285 pass:254 dwarn:3 dfail:0 fail:0 skip:28 time:514s fi-elk-e7500 total:285 pass:225 dwarn:1 dfail:0 fail:0 skip:59 time:428s fi-gdg-551 total:285 pass:177 dwarn:0 dfail:0 fail:0 skip:108 time:315s fi-glk-1 total:285 pass:257 dwarn:0 dfail:0 fail:0 skip:28 time:537s fi-hsw-4770 total:285 pass:258 dwarn:0 dfail:0 fail:0 skip:27 time:402s fi-ilk-650 total:285 pass:225 dwarn:0 dfail:0 fail:0 skip:60 time:418s fi-ivb-3520m total:285 pass:256 dwarn:0 dfail:0 fail:0 skip:29 time:476s fi-ivb-3770 total:285 pass:252 dwarn:0 dfail:0 fail:0 skip:33 time:429s fi-kbl-7500u total:285 pass:260 dwarn:1 dfail:0 fail:0 skip:24 time:475s fi-kbl-7567u total:285 pass:265 dwarn:0 dfail:0 fail:0 skip:20 time:463s fi-kbl-r total:285 pass:258 dwarn:0 dfail:0 fail:0 skip:27 time:516s fi-pnv-d510 total:285 pass:219 dwarn:1 dfail:0 fail:0 skip:65 time:654s fi-skl-6260u total:285 pass:265 dwarn:0 dfail:0 fail:0 skip:20 time:438s fi-skl-6600u total:285 pass:258 dwarn:0 dfail:0 fail:0 skip:27 time:529s fi-skl-6700hq total:285 pass:259 dwarn:0 dfail:0 fail:0 skip:26 time:541s fi-skl-6700k2 total:285 pass:261 dwarn:0 dfail:0 fail:0 skip:24 time:509s fi-skl-6770hq total:285 pass:265 dwarn:0 dfail:0 fail:0 skip:20 time:486s fi-skl-guc total:285 pass:257 dwarn:0 dfail:0 fail:0 skip:28 time:432s fi-snb-2520m total:3 pass:2 dwarn:0 dfail:0 fail:0 skip:0 fi-snb-2600 total:285 pass:245 dwarn:0 dfail:0 fail:0 skip:40 time:396s
9d737cebc219c821989021a3115424165ff7b052 drm-tip: 2018y-03m-20d-14h-56m-05s UTC integration manifest 95b86423fc4f drm/i915: Make force_load_detect effective even w/ DMI quirks/hotplug 56b731e7fdd5 drm/i915: Restore planes after load detection3b364706e59b drm/atomic-helper: WARN if legacy plane fb pointers are bogus when committing duplicated state 6684d9756315 drm: Clear crtc->primary->crtc when disabling the crtc via setcrtc() 019ce3e9a0b5 drm/atomic-helper: Make drm_atomic_helper_disable_all() update the plane->fb pointers f0b997ca5f2d Revert "drm/atomic-helper: Fix leak in disable_all"
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_8421/issues.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.IGT: success for series starting with [1/6] Revert "drm/atomic-helper: Fix leak in disable_all"
In reply to Ville Syrjala== Series Details ==
== Series Details ==
Series: series starting with [1/6] Revert "drm/atomic-helper: Fix leak in disable_all"
URL : https://patchwork.freedesktop.org/series/40321/
State : success
== Summary ==
---- Known issues:
Test kms_cursor_crc:
Subgroup cursor-256x256-suspend:
notrun -> INCOMPLETE (shard-hsw) fdo#103375 +1
Subgroup cursor-64x64-suspend:
pass -> INCOMPLETE (shard-hsw) fdo#103540
Test kms_flip:
Subgroup 2x-flip-vs-expired-vblank:
pass -> FAIL (shard-hsw) fdo#102887
Test kms_setmode:
Subgroup basic:
pass -> FAIL (shard-apl) fdo#99912
Test kms_vblank:
Subgroup pipe-b-ts-continuation-dpms-suspend:
incomplete -> PASS (shard-hsw) fdo#105054
Subgroup pipe-b-ts-continuation-suspend:
pass -> SKIP (shard-snb) fdo#105411fdo#103375 https://bugs.freedesktop.org/show_bug.cgi?id=103375
fdo#103540 https://bugs.freedesktop.org/show_bug.cgi?id=103540
fdo#102887 https://bugs.freedesktop.org/show_bug.cgi?id=102887
fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912
fdo#105054 https://bugs.freedesktop.org/show_bug.cgi?id=105054
fdo#105411 https://bugs.freedesktop.org/show_bug.cgi?id=105411
shard-apl total:3478 pass:1814 dwarn:1 dfail:0 fail:7 skip:1655 time:13044s shard-hsw total:3396 pass:1720 dwarn:1 dfail:0 fail:2 skip:1670 time:10630s shard-snb total:3478 pass:1356 dwarn:1 dfail:0 fail:3 skip:2118 time:7245s
Blacklisted hosts:
shard-kbl total:3434 pass:1910 dwarn:1 dfail:1 fail:9 skip:1512 time:9348s
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_8421/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 11 lines · Ville Syrjala
From: Ville Syrjälä <[email protected]>
Currently we're leaking fbs on load detect on account of nothing setting up
plane->old_fbfor thedrm_atomic_clean_old_fb()call indrm_atomic_helper_commit_duplicated_state(). Removing thedrm_atomic_clean_old_fb()call seems like the right call to me here. This does mean we end up leaking something viadrm_atomic_helper_shutdown()though, but we'll fix that up in a different way.This reverts commit
49d70aeaeca8f62b72b7712ecd1e29619a445866.
So the reason I went this way and not what you're suggesting in this patch series is that i915 is the one and only driver noodling around with load detect and gpu reset that needs this.
Imo it'd be better to fix up our load detect code to also set the old_fb stuff up correctly, and add at least a long-term task to todo.rst to get rid of all this. Inflicting a new parameter on all the other drives (like you do in patch 2) is imo the wrong way round - we have 31 other atomic drivers than i915.ko.
-Daniel
Quoted 76 lines
Cc Dave Airlie <[email protected]> (v1)Cc Maarten Lankhorst <[email protected]>Cc Daniel Vetter <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>--- drivers/gpu/drm/drm_atomic_helper.c | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-)drivers/gpu/drm/drm_atomic_helper.c +2
-16@@ -2914,7 +2914,6 @@ int drm_atomic_helper_disable_all(struct drm_device *dev,struct drm_plane *plane;struct drm_crtc_state *crtc_state;struct drm_crtc *crtc; -unsigned plane_mask =0 ;int ret, i; state =drm_atomic_state_alloc (dev);@@ -2957,14 +2956,10 @@ int drm_atomic_helper_disable_all(struct drm_device *dev, goto free;drm_atomic_set_fb_for_plane (plane_state,NULL ); - plane_mask |=BIT (drm_plane_index (plane)); - plane->old_fb = plane->fb; } ret =drm_atomic_commit (state); free: -if (plane_mask) -drm_atomic_clean_old_fb (dev, plane_mask, ret);drm_atomic_state_put (state);return ret; }@@ -3095,16 +3090,11 @@ int drm_atomic_helper_commit_duplicated_state(struct drm_atomic_state *state,struct drm_connector_state *new_conn_state;struct drm_crtc *crtc;struct drm_crtc_state *new_crtc_state; -unsigned plane_mask =0 ; -struct drm_device *dev = state->dev; -int ret; state->acquire_ctx = ctx; -for_each_new_plane_in_state (state, plane, new_plane_state, i) { - plane_mask |=BIT (drm_plane_index (plane)); +for_each_new_plane_in_state (state, plane, new_plane_state, i) state->planes[i].old_state = plane->state; - }for_each_new_crtc_in_state (state, crtc, new_crtc_state, i) state->crtcs[i].old_state = crtc->state;@@ -3112,11 +3102,7 @@ int drm_atomic_helper_commit_duplicated_state(struct drm_atomic_state *state,for_each_new_connector_in_state (state, connector, new_conn_state, i) state->connectors[i].old_state = connector->state; - ret =drm_atomic_commit (state); -if (plane_mask) -drm_atomic_clean_old_fb (dev, plane_mask, ret); - -return ret; +return drm_atomic_commit (state); }EXPORT_SYMBOL (drm_atomic_helper_commit_duplicated_state);Signature · 6 lines
2.16.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 11 lines · Daniel Vetter
Quoted 10 lines · Ville Syrjala
From: Ville Syrjälä <[email protected]>
Currently we're leaking fbs on load detect on account of nothing setting up
plane->old_fbfor thedrm_atomic_clean_old_fb()call indrm_atomic_helper_commit_duplicated_state(). Removing thedrm_atomic_clean_old_fb()call seems like the right call to me here. This does mean we end up leaking something viadrm_atomic_helper_shutdown()though, but we'll fix that up in a different way.
Quoted 8 lines
Quoted 1 line
This reverts commit
49d70aeaeca8f62b72b7712ecd1e29619a445866.So the reason I went this way and not what you're suggesting in this patch series is that i915 is the one and only driver noodling around with load detect and gpu reset that needs this.
Imo it'd be better to fix up our load detect code to also set the
old_fbstuff up correctly,
Feels a bit silly to just set plane->old_fb = plane->fb and immediately follow it up with inc(plane->fb)+dec(plane->old_fb) and old_fb=NULL.
Quoted 2 lines
and add at least a long-term task to
todo.rstto get rid of all this.
I have a series that stops using plane->fb/old_fb entirely on atomic drivers. That removes the entire clean_old_fbs() thing. Not sure all drivers are ready for that though. I think I'll post it as an rfc anyway.
Quoted 3 lines
Inflicting a new parameter on all the other drives (like
you do in patch 2) is imo the wrong way round - we have 31 other atomic drivers than i915.ko.
None of them use disable_all() directly.
But if we want to avoid the new parameter being visible too drivers I could just squash in:
drivers/gpu/drm/drm_atomic_helper.c +33 -30
@@ -2881,33 +2881,9 @@ int __drm_atomic_helper_set_config(struct drm_mode_set *set,return 0 ; } -/** -* drm_atomic_helper_disable_all - disable all currently active outputs -* @dev: DRM device -* @ctx: lock acquisition context -* @clean_old_fbs: update the plane->fb/old_fb pointers? -* -* Loops through all connectors, finding those that aren't turned off and then -* turns them off by setting their DPMS mode to OFF and deactivating the CRTC -* that they are connected to. -* -* This is used for example in suspend/resume to disable all currently active -* functions when suspending. If you just want to shut down everything at e.g. -* driver unload, look at drm_atomic_helper_shutdown(). -* -* Note that if callers haven't already acquired all modeset locks this might -* return -EDEADLK, which must be handled by calling drm_modeset_backoff(). -* -* Returns: -* 0 on success or a negative error code on failure. -* -* See also: -* drm_atomic_helper_suspend(), drm_atomic_helper_resume() and -* drm_atomic_helper_shutdown(). -*/ -int drm_atomic_helper_disable_all (struct drm_device *dev, -struct drm_modeset_acquire_ctx *ctx, -bool clean_old_fbs) +static int __drm_atomic_helper_disable_all (struct drm_device *dev, +struct drm_modeset_acquire_ctx *ctx, +bool clean_old_fbs) {struct drm_atomic_state *state;struct drm_connector_state *conn_state;
@@ -2973,7 +2949,34 @@ int drm_atomic_helper_disable_all(struct drm_device *dev,drm_atomic_state_put (state);return ret; } - +/** +* drm_atomic_helper_disable_all - disable all currently active outputs +* @dev: DRM device +* @ctx: lock acquisition context +* +* Loops through all connectors, finding those that aren't turned off and then +* turns them off by setting their DPMS mode to OFF and deactivating the CRTC +* that they are connected to. +* +* This is used for example in suspend/resume to disable all currently active +* functions when suspending. If you just want to shut down everything at e.g. +* driver unload, look at drm_atomic_helper_shutdown(). +* +* Note that if callers haven't already acquired all modeset locks this might +* return -EDEADLK, which must be handled by calling drm_modeset_backoff(). +* +* Returns: +* 0 on success or a negative error code on failure. +* +* See also: +* drm_atomic_helper_suspend(), drm_atomic_helper_resume() and +* drm_atomic_helper_shutdown(). +*/ +int drm_atomic_helper_disable_all (struct drm_device *dev, +struct drm_modeset_acquire_ctx *ctx) +{ +return __drm_atomic_helper_disable_all (dev, ctx, false); +}EXPORT_SYMBOL (drm_atomic_helper_disable_all);/**
@@ -2996,7 +2999,7 @@ void drm_atomic_helper_shutdown(struct drm_device *dev)while (1 ) { ret =drm_modeset_lock_all_ctx (dev, &ctx);if (!ret) - ret =drm_atomic_helper_disable_all (dev, &ctx, true); + ret =__drm_atomic_helper_disable_all (dev, &ctx, true);if (ret != -EDEADLK )break ;
@@ -3074,7 +3077,7 @@ struct drm_atomic_state *drm_atomic_helper_suspend(struct drm_device *dev) } } - err =drm_atomic_helper_disable_all (dev, &ctx, false); + err =drm_atomic_helper_disable_all (dev, &ctx);if (err <0 ) {drm_atomic_state_put (state); state =ERR_PTR (err);
drivers/gpu/drm/i915/intel_display.c +1 -1
@@ -3721,7 +3721,7 @@ void intel_prepare_reset(struct drm_i915_private *dev_priv)return ; } - ret =drm_atomic_helper_disable_all (dev, ctx, false); + ret =drm_atomic_helper_disable_all (dev, ctx);if (ret) {DRM_ERROR ("Suspending crtc's failed with %i\n" , ret);drm_atomic_state_put (state);
include/drm/drm_atomic_helper.h +1 -2
@@ -122,8 +122,7 @@ int __drm_atomic_helper_set_config(struct drm_mode_set *set, struct drm_atomic_state *state);int drm_atomic_helper_disable_all (struct drm_device *dev, -struct drm_modeset_acquire_ctx *ctx, -bool clean_old_fbs); +struct drm_modeset_acquire_ctx *ctx);void drm_atomic_helper_shutdown (struct drm_device *dev);struct drm_atomic_state *drm_atomic_helper_suspend (struct drm_device *dev); int drm_atomic_helper_commit_duplicated_state(struct drm_atomic_state *state,
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx