From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
To: Daniel Vetter <daniel@ffwll.ch>
Cc: nouveau@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
Ben Skeggs <bskeggs@redhat.com>,
dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 15/16] drm/nouveau: Convert nouveau to use new iterator macros
Date: Thu, 13 Jul 2017 15:51:03 +0200 [thread overview]
Message-ID: <9c7ed6b0-f964-3269-239b-fa9e5cbc88e9@linux.intel.com> (raw)
In-Reply-To: <20170713123319.rtv7ec3zw7oca36n@phenom.ffwll.local>
Op 13-07-17 om 14:33 schreef Daniel Vetter:
> On Wed, Jul 12, 2017 at 10:13:43AM +0200, Maarten Lankhorst wrote:
>> Use the new atomic iterator macros, the old ones are about to be
>> removed. With the new macros, it's more easy to get old and new state so
>> get them from the macros instead of from obj->state.
>>
>> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
>> Cc: Ben Skeggs <bskeggs@redhat.com>
>> Cc: nouveau@lists.freedesktop.org
>> ---
>> drivers/gpu/drm/nouveau/nv50_display.c | 71 +++++++++++++++++-----------------
>> 1 file changed, 36 insertions(+), 35 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c
>> index 42a85c14aea0..b1ce8f1f58dc 100644
>> --- a/drivers/gpu/drm/nouveau/nv50_display.c
>> +++ b/drivers/gpu/drm/nouveau/nv50_display.c
>> @@ -2103,7 +2103,7 @@ nv50_head_atomic_check(struct drm_crtc *crtc, struct drm_crtc_state *state)
>>
>> NV_ATOMIC(drm, "%s atomic_check %d\n", crtc->name, asyh->state.active);
>> if (asyh->state.active) {
>> - for_each_connector_in_state(asyh->state.state, conn, conns, i) {
>> + for_each_new_connector_in_state(asyh->state.state, conn, conns, i) {
>> if (conns->crtc == crtc) {
>> asyc = nouveau_conn_atom(conns);
>> break;
>> @@ -3904,9 +3904,9 @@ static void
>> nv50_disp_atomic_commit_tail(struct drm_atomic_state *state)
>> {
>> struct drm_device *dev = state->dev;
>> - struct drm_crtc_state *crtc_state;
>> + struct drm_crtc_state *new_crtc_state;
>> struct drm_crtc *crtc;
>> - struct drm_plane_state *plane_state;
>> + struct drm_plane_state *new_plane_state;
>> struct drm_plane *plane;
>> struct nouveau_drm *drm = nouveau_drm(dev);
>> struct nv50_disp *disp = nv50_disp(dev);
>> @@ -3925,8 +3925,8 @@ nv50_disp_atomic_commit_tail(struct drm_atomic_state *state)
>> mutex_lock(&disp->mutex);
>>
>> /* Disable head(s). */
>> - for_each_crtc_in_state(state, crtc, crtc_state, i) {
>> - struct nv50_head_atom *asyh = nv50_head_atom(crtc->state);
>> + for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) {
>> + struct nv50_head_atom *asyh = nv50_head_atom(new_crtc_state);
>> struct nv50_head *head = nv50_head(crtc);
>>
>> NV_ATOMIC(drm, "%s: clr %04x (set %04x)\n", crtc->name,
>> @@ -3939,8 +3939,8 @@ nv50_disp_atomic_commit_tail(struct drm_atomic_state *state)
>> }
>>
>> /* Disable plane(s). */
>> - for_each_plane_in_state(state, plane, plane_state, i) {
>> - struct nv50_wndw_atom *asyw = nv50_wndw_atom(plane->state);
>> + for_each_new_plane_in_state(state, plane, new_plane_state, i) {
>> + struct nv50_wndw_atom *asyw = nv50_wndw_atom(new_plane_state);
>> struct nv50_wndw *wndw = nv50_wndw(plane);
>>
>> NV_ATOMIC(drm, "%s: clr %02x (set %02x)\n", plane->name,
>> @@ -4005,8 +4005,8 @@ nv50_disp_atomic_commit_tail(struct drm_atomic_state *state)
>> }
>>
>> /* Update head(s). */
>> - for_each_crtc_in_state(state, crtc, crtc_state, i) {
>> - struct nv50_head_atom *asyh = nv50_head_atom(crtc->state);
>> + for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) {
>> + struct nv50_head_atom *asyh = nv50_head_atom(new_crtc_state);
>> struct nv50_head *head = nv50_head(crtc);
>>
>> NV_ATOMIC(drm, "%s: set %04x (clr %04x)\n", crtc->name,
>> @@ -4018,14 +4018,14 @@ nv50_disp_atomic_commit_tail(struct drm_atomic_state *state)
>> }
>> }
>>
>> - for_each_crtc_in_state(state, crtc, crtc_state, i) {
>> - if (crtc->state->event)
>> + for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) {
>> + if (new_crtc_state->event)
>> drm_crtc_vblank_get(crtc);
>> }
>>
>> /* Update plane(s). */
>> - for_each_plane_in_state(state, plane, plane_state, i) {
>> - struct nv50_wndw_atom *asyw = nv50_wndw_atom(plane->state);
>> + for_each_new_plane_in_state(state, plane, new_plane_state, i) {
>> + struct nv50_wndw_atom *asyw = nv50_wndw_atom(new_plane_state);
>> struct nv50_wndw *wndw = nv50_wndw(plane);
>>
>> NV_ATOMIC(drm, "%s: set %02x (clr %02x)\n", plane->name,
>> @@ -4055,23 +4055,23 @@ nv50_disp_atomic_commit_tail(struct drm_atomic_state *state)
>> mutex_unlock(&disp->mutex);
>>
>> /* Wait for HW to signal completion. */
>> - for_each_plane_in_state(state, plane, plane_state, i) {
>> - struct nv50_wndw_atom *asyw = nv50_wndw_atom(plane->state);
>> + for_each_new_plane_in_state(state, plane, new_plane_state, i) {
>> + struct nv50_wndw_atom *asyw = nv50_wndw_atom(new_plane_state);
>> struct nv50_wndw *wndw = nv50_wndw(plane);
>> int ret = nv50_wndw_wait_armed(wndw, asyw);
>> if (ret)
>> NV_ERROR(drm, "%s: timeout\n", plane->name);
>> }
>>
>> - for_each_crtc_in_state(state, crtc, crtc_state, i) {
>> - if (crtc->state->event) {
>> + for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) {
>> + if (new_crtc_state->event) {
>> unsigned long flags;
>> /* Get correct count/ts if racing with vblank irq */
>> drm_crtc_accurate_vblank_count(crtc);
>> spin_lock_irqsave(&crtc->dev->event_lock, flags);
>> - drm_crtc_send_vblank_event(crtc, crtc->state->event);
>> + drm_crtc_send_vblank_event(crtc, new_crtc_state->event);
>> spin_unlock_irqrestore(&crtc->dev->event_lock, flags);
>> - crtc->state->event = NULL;
>> + new_crtc_state->event = NULL;
>> drm_crtc_vblank_put(crtc);
>> }
>> }
>> @@ -4096,7 +4096,7 @@ nv50_disp_atomic_commit(struct drm_device *dev,
>> {
>> struct nouveau_drm *drm = nouveau_drm(dev);
>> struct nv50_disp *disp = nv50_disp(dev);
>> - struct drm_plane_state *plane_state;
>> + struct drm_plane_state *old_plane_state;
>> struct drm_plane *plane;
>> struct drm_crtc *crtc;
>> bool active = false;
>> @@ -4122,8 +4122,8 @@ nv50_disp_atomic_commit(struct drm_device *dev,
>> goto done;
>> }
>>
>> - for_each_plane_in_state(state, plane, plane_state, i) {
>> - struct nv50_wndw_atom *asyw = nv50_wndw_atom(plane_state);
>> + for_each_old_plane_in_state(state, plane, old_plane_state, i) {
>> + struct nv50_wndw_atom *asyw = nv50_wndw_atom(old_plane_state);
>> struct nv50_wndw *wndw = nv50_wndw(plane);
>> if (asyw->set.image) {
>> asyw->ntfy.handle = wndw->dmac->sync.handle;
>> @@ -4185,18 +4185,19 @@ nv50_disp_outp_atomic_add(struct nv50_atom *atom, struct drm_encoder *encoder)
>>
>> static int
>> nv50_disp_outp_atomic_check_clr(struct nv50_atom *atom,
>> - struct drm_connector *connector)
>> + struct drm_connector_state *old_connector_state)
>> {
>> - struct drm_encoder *encoder = connector->state->best_encoder;
>> - struct drm_crtc_state *crtc_state;
>> + struct drm_encoder *encoder = old_connector_state->best_encoder;
>> + struct drm_crtc_state *old_crtc_state, *new_crtc_state;
>> struct drm_crtc *crtc;
>> struct nv50_outp_atom *outp;
>>
>> - if (!(crtc = connector->state->crtc))
>> + if (!(crtc = old_connector_state->crtc))
>> return 0;
>>
>> - crtc_state = drm_atomic_get_existing_crtc_state(&atom->state, crtc);
>> - if (crtc->state->active && drm_atomic_crtc_needs_modeset(crtc_state)) {
>> + old_crtc_state = drm_atomic_get_new_crtc_state(&atom->state, crtc);
>> + new_crtc_state = drm_atomic_get_new_crtc_state(&atom->state, crtc);
> I think you have a mixup here of the crtc states for old and new crtc,
> both are get_new_crtc_state.
Ah indeed, thanks for catching. :)
> Otherwise lgtm.
> -Daniel
>
>> + if (old_crtc_state->active && drm_atomic_crtc_needs_modeset(new_crtc_state)) {
>> outp = nv50_disp_outp_atomic_add(atom, encoder);
>> if (IS_ERR(outp))
>> return PTR_ERR(outp);
>> @@ -4217,15 +4218,15 @@ nv50_disp_outp_atomic_check_set(struct nv50_atom *atom,
>> struct drm_connector_state *connector_state)
>> {
>> struct drm_encoder *encoder = connector_state->best_encoder;
>> - struct drm_crtc_state *crtc_state;
>> + struct drm_crtc_state *new_crtc_state;
>> struct drm_crtc *crtc;
>> struct nv50_outp_atom *outp;
>>
>> if (!(crtc = connector_state->crtc))
>> return 0;
>>
>> - crtc_state = drm_atomic_get_existing_crtc_state(&atom->state, crtc);
>> - if (crtc_state->active && drm_atomic_crtc_needs_modeset(crtc_state)) {
>> + new_crtc_state = drm_atomic_get_new_crtc_state(&atom->state, crtc);
>> + if (new_crtc_state->active && drm_atomic_crtc_needs_modeset(new_crtc_state)) {
>> outp = nv50_disp_outp_atomic_add(atom, encoder);
>> if (IS_ERR(outp))
>> return PTR_ERR(outp);
>> @@ -4241,7 +4242,7 @@ static int
>> nv50_disp_atomic_check(struct drm_device *dev, struct drm_atomic_state *state)
>> {
>> struct nv50_atom *atom = nv50_atom(state);
>> - struct drm_connector_state *connector_state;
>> + struct drm_connector_state *old_connector_state, *new_connector_state;
>> struct drm_connector *connector;
>> int ret, i;
>>
>> @@ -4249,12 +4250,12 @@ nv50_disp_atomic_check(struct drm_device *dev, struct drm_atomic_state *state)
>> if (ret)
>> return ret;
>>
>> - for_each_connector_in_state(state, connector, connector_state, i) {
>> - ret = nv50_disp_outp_atomic_check_clr(atom, connector);
>> + for_each_oldnew_connector_in_state(state, connector, old_connector_state, new_connector_state, i) {
>> + ret = nv50_disp_outp_atomic_check_clr(atom, old_connector_state);
>> if (ret)
>> return ret;
>>
>> - ret = nv50_disp_outp_atomic_check_set(atom, connector_state);
>> + ret = nv50_disp_outp_atomic_check_set(atom, new_connector_state);
>> if (ret)
>> return ret;
>> }
>> --
>> 2.11.0
>>
>> _______________________________________________
>> Intel-gfx mailing list
>> Intel-gfx@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2017-07-13 13:51 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-12 8:13 [PATCH 00/16] drm/atomic: Remove deprecated atomic iterator macros Maarten Lankhorst
2017-07-12 8:13 ` [PATCH 01/16] drm/simple-kms-helper: Fix the check for the mismatch between plane and CRTC enabled Maarten Lankhorst
2017-07-12 9:01 ` Daniel Vetter
2017-07-12 8:13 ` [PATCH 02/16] drm/atomic: Use the correct iterator macro in atomic_remove_fb Maarten Lankhorst
2017-07-12 9:01 ` Daniel Vetter
2017-07-12 8:13 ` [PATCH 03/16] drm/atomic: Use the new helpers in drm_atomic_helper_disable_all() Maarten Lankhorst
2017-07-12 9:03 ` Daniel Vetter
2017-07-12 8:13 ` [PATCH 04/16] drm/atomic: Use new iterator macros in drm_atomic_helper_wait_for_flip_done Maarten Lankhorst
2017-07-12 9:07 ` [Intel-gfx] " Daniel Vetter
2017-07-12 8:13 ` [PATCH 05/16] drm/vmwgfx: Make check_modeset() use the new atomic iterator macros Maarten Lankhorst
2017-07-12 8:33 ` Sinclair Yeh
2017-07-12 9:09 ` [Intel-gfx] " Daniel Vetter
2017-07-12 9:11 ` Sinclair Yeh
2017-07-12 8:13 ` [PATCH 06/16] drm/i915: Use correct iterator macro Maarten Lankhorst
2017-07-12 9:10 ` Daniel Vetter
2017-07-12 8:13 ` [PATCH 07/16] drm/rcar-du: Use new iterator macros Maarten Lankhorst
2017-07-12 9:15 ` Daniel Vetter
2017-07-12 10:43 ` [PATCH v2 07/16] drm/rcar-du: Use new iterator macros, v2 Maarten Lankhorst
2017-07-12 8:13 ` [PATCH 08/16] drm/atmel-hlcdec: Use for_each_new_connector_in_state Maarten Lankhorst
2017-07-12 9:17 ` Daniel Vetter
2017-07-12 9:22 ` Boris Brezillon
2017-07-12 8:13 ` [PATCH 09/16] drm/rockchip: Use for_each_oldnew_plane_in_state in vop_crtc_atomic_flush Maarten Lankhorst
2017-07-12 9:21 ` Daniel Vetter
2017-07-12 9:41 ` Mark yao
2017-07-12 8:13 ` [PATCH 10/16] drm/omapdrm: Fix omap_atomic_wait_for_completion Maarten Lankhorst
2017-07-12 9:23 ` Daniel Vetter
2017-07-12 8:13 ` [PATCH 11/16] drm/mali: Use new atomic iterator macros Maarten Lankhorst
2017-07-12 9:25 ` [Intel-gfx] " Daniel Vetter
2017-07-12 9:44 ` Liviu Dudau
2017-07-12 10:00 ` Maarten Lankhorst
2017-07-12 10:06 ` Liviu Dudau
2017-07-12 8:13 ` [PATCH 12/16] drm/imx: Use " Maarten Lankhorst
2017-07-12 9:26 ` Daniel Vetter
2017-07-12 10:00 ` Philipp Zabel
2017-07-12 8:13 ` [PATCH 13/16] drm/mediatek: Convert to new " Maarten Lankhorst
2017-07-12 9:45 ` Daniel Vetter
2017-07-13 16:00 ` Maarten Lankhorst
2017-07-12 10:01 ` Philipp Zabel
[not found] ` <20170712081344.25495-1-maarten.lankhorst-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2017-07-12 8:13 ` [PATCH 14/16] drm/msm: Convert to use " Maarten Lankhorst
2017-07-12 9:48 ` [Intel-gfx] " Daniel Vetter
[not found] ` <20170712094823.2akjrev3v7ckxb7b-dv86pmgwkMBes7Z6vYuT8azUEOm+Xw19@public.gmane.org>
2017-07-12 10:45 ` [PATCH 14/16] drm/msm: Convert to use new iterator macros, v2 Maarten Lankhorst
[not found] ` <de5e7892-71a0-d160-6619-e8267d793897-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2017-07-19 9:25 ` Archit Taneja
2017-07-12 8:13 ` [PATCH 15/16] drm/nouveau: Convert nouveau to use new iterator macros Maarten Lankhorst
2017-07-13 12:33 ` [Intel-gfx] " Daniel Vetter
2017-07-13 13:51 ` Maarten Lankhorst [this message]
2017-07-12 8:13 ` [PATCH 16/16] drm/atomic: Remove deprecated accessor macros Maarten Lankhorst
2017-07-12 9:50 ` Daniel Vetter
2017-07-12 11:48 ` Maarten Lankhorst
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=9c7ed6b0-f964-3269-239b-fa9e5cbc88e9@linux.intel.com \
--to=maarten.lankhorst@linux.intel.com \
--cc=bskeggs@redhat.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=nouveau@lists.freedesktop.org \
/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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox