From: Sean Paul <sean@poorly.run> To: Sam Ravnborg <sam@ravnborg.org> Cc: Sean Paul <sean@poorly.run>, dri-devel@lists.freedesktop.org, Zain Wang <wzz@rock-chips.com>, Jonathan Corbet <corbet@lwn.net>, David Airlie <airlied@linux.ie>, linux-doc@vger.kernel.org, Jose Souza <jose.souza@intel.com>, Tomasz Figa <tfiga@chromium.org>, Maxime Ripard <maxime.ripard@bootlin.com>, Sean Paul <seanpaul@chromium.org> Subject: Re: [PATCH v5 05/11] drm: Add helpers to kick off self refresh mode in drivers Date: Wed, 12 Jun 2019 10:19:26 -0400 [thread overview] Message-ID: <20190612141926.GE179831@art_vandelay> (raw) In-Reply-To: <20190611205645.GB18315@ravnborg.org> On Tue, Jun 11, 2019 at 10:56:45PM +0200, Sam Ravnborg wrote: > Hi Sean. > > Small things here and there. Did not stare at this long enough to > understand the code, but added some feedback anyway. Thanks for the comments, Sam, I'll send a revision shortly > > Sam > > /snip > > +static void drm_self_refresh_helper_entry_work(struct work_struct *work) > > +{ > > + struct drm_self_refresh_data *sr_data = container_of( > > + to_delayed_work(work), > > + struct drm_self_refresh_data, entry_work); > > + struct drm_crtc *crtc = sr_data->crtc; > > + struct drm_device *dev = crtc->dev; > > + struct drm_modeset_acquire_ctx ctx; > > + struct drm_atomic_state *state; > > + struct drm_connector *conn; > > + struct drm_connector_state *conn_state; > > + struct drm_crtc_state *crtc_state; > > + int i, ret; > This function is called from a workqueue. > Just wondering if this require any locking? Yes, it does. The locks are acquired in the various drm_atomic_get_*_state() function calls and dropped below in the out label (drm_modeset_drop_locks). > (Maybe I missed it, browsed the code without a detailed review) > > > + > > + drm_modeset_acquire_init(&ctx, 0); > > + > > + state = drm_atomic_state_alloc(dev); > > + if (!state) { > > + ret = -ENOMEM; > > + goto out; > > + } > > + > > +retry: > > + state->acquire_ctx = &ctx; > > + > > + crtc_state = drm_atomic_get_crtc_state(state, crtc); > > + if (IS_ERR(crtc_state)) { > > + ret = PTR_ERR(crtc_state); > > + goto out; > > + } > > + > > + if (!crtc_state->enable) > > + goto out; > > + > > + ret = drm_atomic_add_affected_connectors(state, crtc); > > + if (ret) > > + goto out; > > + > > + for_each_new_connector_in_state(state, conn, conn_state, i) { > > + if (!conn_state->self_refresh_aware) > > + goto out; > > + } > > + > > + crtc_state->active = false; > > + crtc_state->self_refresh_active = true; > > + > > + ret = drm_atomic_commit(state); > > + if (ret) > > + goto out; > > + > > +out: > > + if (ret == -EDEADLK) { > > + drm_atomic_state_clear(state); > > + ret = drm_modeset_backoff(&ctx); > > + if (!ret) > > + goto retry; > > + } > > + > > + drm_atomic_state_put(state); > > + drm_modeset_drop_locks(&ctx); > > + drm_modeset_acquire_fini(&ctx); > > +} > > + /snip -- Sean Paul, Software Engineer, Google / Chromium OS
WARNING: multiple messages have this Message-ID (diff)
From: Sean Paul <sean@poorly.run> To: Sam Ravnborg <sam@ravnborg.org> Cc: Zain Wang <wzz@rock-chips.com>, linux-doc@vger.kernel.org, David Airlie <airlied@linux.ie>, Jonathan Corbet <corbet@lwn.net>, dri-devel@lists.freedesktop.org, Tomasz Figa <tfiga@chromium.org>, Maxime Ripard <maxime.ripard@bootlin.com>, Sean Paul <seanpaul@chromium.org>, Jose Souza <jose.souza@intel.com>, Sean Paul <sean@poorly.run> Subject: Re: [PATCH v5 05/11] drm: Add helpers to kick off self refresh mode in drivers Date: Wed, 12 Jun 2019 10:19:26 -0400 [thread overview] Message-ID: <20190612141926.GE179831@art_vandelay> (raw) In-Reply-To: <20190611205645.GB18315@ravnborg.org> On Tue, Jun 11, 2019 at 10:56:45PM +0200, Sam Ravnborg wrote: > Hi Sean. > > Small things here and there. Did not stare at this long enough to > understand the code, but added some feedback anyway. Thanks for the comments, Sam, I'll send a revision shortly > > Sam > > /snip > > +static void drm_self_refresh_helper_entry_work(struct work_struct *work) > > +{ > > + struct drm_self_refresh_data *sr_data = container_of( > > + to_delayed_work(work), > > + struct drm_self_refresh_data, entry_work); > > + struct drm_crtc *crtc = sr_data->crtc; > > + struct drm_device *dev = crtc->dev; > > + struct drm_modeset_acquire_ctx ctx; > > + struct drm_atomic_state *state; > > + struct drm_connector *conn; > > + struct drm_connector_state *conn_state; > > + struct drm_crtc_state *crtc_state; > > + int i, ret; > This function is called from a workqueue. > Just wondering if this require any locking? Yes, it does. The locks are acquired in the various drm_atomic_get_*_state() function calls and dropped below in the out label (drm_modeset_drop_locks). > (Maybe I missed it, browsed the code without a detailed review) > > > + > > + drm_modeset_acquire_init(&ctx, 0); > > + > > + state = drm_atomic_state_alloc(dev); > > + if (!state) { > > + ret = -ENOMEM; > > + goto out; > > + } > > + > > +retry: > > + state->acquire_ctx = &ctx; > > + > > + crtc_state = drm_atomic_get_crtc_state(state, crtc); > > + if (IS_ERR(crtc_state)) { > > + ret = PTR_ERR(crtc_state); > > + goto out; > > + } > > + > > + if (!crtc_state->enable) > > + goto out; > > + > > + ret = drm_atomic_add_affected_connectors(state, crtc); > > + if (ret) > > + goto out; > > + > > + for_each_new_connector_in_state(state, conn, conn_state, i) { > > + if (!conn_state->self_refresh_aware) > > + goto out; > > + } > > + > > + crtc_state->active = false; > > + crtc_state->self_refresh_active = true; > > + > > + ret = drm_atomic_commit(state); > > + if (ret) > > + goto out; > > + > > +out: > > + if (ret == -EDEADLK) { > > + drm_atomic_state_clear(state); > > + ret = drm_modeset_backoff(&ctx); > > + if (!ret) > > + goto retry; > > + } > > + > > + drm_atomic_state_put(state); > > + drm_modeset_drop_locks(&ctx); > > + drm_modeset_acquire_fini(&ctx); > > +} > > + /snip -- Sean Paul, Software Engineer, Google / Chromium OS _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2019-06-12 14:19 UTC|newest] Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-06-11 16:08 [PATCH v5 00/11] drm: Add self refresh helpers Sean Paul 2019-06-11 16:08 ` [PATCH v5 01/11] drm: Add atomic variants of enable/disable to encoder helper funcs Sean Paul 2019-06-11 18:53 ` Sam Ravnborg 2019-06-11 20:22 ` Sean Paul 2019-06-11 20:49 ` [PATCH v6 " Sean Paul 2019-06-11 16:08 ` [PATCH v5 02/11] drm: Add drm_atomic_get_(old|new_connector_for_encoder() helpers Sean Paul 2019-06-11 18:57 ` Sam Ravnborg 2019-06-11 20:51 ` [PATCH v6 02/11] drm: Add drm_atomic_get_(old|new)_connector_for_encoder() helpers Sean Paul 2019-06-11 16:08 ` [PATCH v5 03/11] drm: Add atomic variants for bridge enable/disable Sean Paul 2019-06-11 16:08 ` [PATCH v5 04/11] drm: Convert connector_helper_funcs->atomic_check to accept drm_atomic_state Sean Paul 2019-06-11 16:08 ` Sean Paul 2019-06-11 17:58 ` Laurent Pinchart 2019-06-11 17:58 ` Laurent Pinchart 2019-06-11 16:08 ` [PATCH v5 05/11] drm: Add helpers to kick off self refresh mode in drivers Sean Paul 2019-06-11 16:08 ` Sean Paul 2019-06-11 20:56 ` Sam Ravnborg 2019-06-11 20:56 ` Sam Ravnborg 2019-06-12 14:19 ` Sean Paul [this message] 2019-06-12 14:19 ` Sean Paul 2019-06-12 14:50 ` [PATCH v6] " Sean Paul 2019-06-12 14:50 ` Sean Paul 2019-06-11 16:08 ` [PATCH v5 06/11] drm/rockchip: Use dirtyfb helper Sean Paul 2019-06-11 16:08 ` Sean Paul 2019-06-11 17:39 ` Daniel Vetter 2019-06-11 17:39 ` Daniel Vetter 2019-06-11 18:09 ` Sean Paul 2019-06-11 18:09 ` Sean Paul 2019-06-11 16:08 ` [PATCH v5 07/11] drm/rockchip: Check for fast link training before enabling psr Sean Paul 2019-07-25 18:08 ` Sean Paul 2019-07-25 18:39 ` Heiko Stuebner 2019-07-26 18:52 ` Sean Paul 2019-06-11 16:08 ` [PATCH v5 08/11] drm/rockchip: Use the helpers for PSR Sean Paul 2019-06-11 16:08 ` Sean Paul 2019-06-11 16:08 ` [PATCH v5 09/11] drm/rockchip: Use vop_win in vop_win_disable instead of vop_win_data Sean Paul 2019-06-11 16:08 ` Sean Paul 2019-06-11 16:08 ` [PATCH v5 10/11] drm/rockchip: Don't fully disable vop on self refresh Sean Paul 2019-06-11 16:08 ` Sean Paul 2019-06-11 16:08 ` [PATCH v5 11/11] drm/rockchip: Use drm_atomic_helper_commit_tail_rpm Sean Paul 2019-06-11 16:08 ` Sean Paul 2019-06-13 19:05 ` [PATCH v5 00/11] drm: Add self refresh helpers Sean Paul
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20190612141926.GE179831@art_vandelay \ --to=sean@poorly.run \ --cc=airlied@linux.ie \ --cc=corbet@lwn.net \ --cc=dri-devel@lists.freedesktop.org \ --cc=jose.souza@intel.com \ --cc=linux-doc@vger.kernel.org \ --cc=maxime.ripard@bootlin.com \ --cc=sam@ravnborg.org \ --cc=seanpaul@chromium.org \ --cc=tfiga@chromium.org \ --cc=wzz@rock-chips.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.