From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Shayenne Moura <shayenneluzmoura@gmail.com>,
Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>,
Haneen Mohammed <hamohammed.sa@gmail.com>,
David Airlie <airlied@linux.ie>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drm/vkms: Solve bug on kms_crc_cursor tests
Date: Thu, 28 Feb 2019 16:03:41 +0200 [thread overview]
Message-ID: <20190228140341.GG20097@intel.com> (raw)
In-Reply-To: <20190228101107.GL2665@phenom.ffwll.local>
On Thu, Feb 28, 2019 at 11:11:07AM +0100, Daniel Vetter wrote:
> On Mon, Feb 25, 2019 at 11:26:06AM -0300, Shayenne Moura wrote:
> > vkms_crc_work_handle needs the value of the actual frame to
> > schedule the workqueue that calls periodically the vblank
> > handler and the destroy state functions. However, the frame
> > value returned from vkms_vblank_simulate is updated and
> > diminished in vblank_get_timestamp because it is not in a
> > vblank interrupt, and return an inaccurate value.
> >
> > Solve this getting the actual vblank frame directly from the
> > vblank->count inside the `struct drm_crtc`, instead of using
> > the `drm_accurate_vblank_count` function.
> >
> > Signed-off-by: Shayenne Moura <shayenneluzmoura@gmail.com>
>
> Sorry for the delay, I'm a bit swamped right now :-/
>
> Debug work you're doing here is really impressive! But I have no idea
> what's going on. It doesn't look like it's just papering over a bug (like
> the in_vblank_irq check we've discussed on irc), but I also have no idea
> why it works.
>
> I'll pull in Ville, he understands this better than me.
It's not entirely clear what we're trying to fix. From what I can see
the crc work seems to be in no way synchronized with page flips, so
I'm not sure how all this is really supposed to work.
> -Daniel
>
> > ---
> > drivers/gpu/drm/vkms/vkms_crc.c | 4 +++-
> > drivers/gpu/drm/vkms/vkms_crtc.c | 4 +++-
> > 2 files changed, 6 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/vkms/vkms_crc.c b/drivers/gpu/drm/vkms/vkms_crc.c
> > index d7b409a3c0f8..09a8b00ef1f1 100644
> > --- a/drivers/gpu/drm/vkms/vkms_crc.c
> > +++ b/drivers/gpu/drm/vkms/vkms_crc.c
> > @@ -161,6 +161,8 @@ void vkms_crc_work_handle(struct work_struct *work)
> > struct vkms_output *out = drm_crtc_to_vkms_output(crtc);
> > struct vkms_device *vdev = container_of(out, struct vkms_device,
> > output);
> > + unsigned int pipe = drm_crtc_index(crtc);
> > + struct drm_vblank_crtc *vblank = &crtc->dev->vblank[pipe];
> > struct vkms_crc_data *primary_crc = NULL;
> > struct vkms_crc_data *cursor_crc = NULL;
> > struct drm_plane *plane;
> > @@ -196,7 +198,7 @@ void vkms_crc_work_handle(struct work_struct *work)
> > if (primary_crc)
> > crc32 = _vkms_get_crc(primary_crc, cursor_crc);
> >
> > - frame_end = drm_crtc_accurate_vblank_count(crtc);
> > + frame_end = vblank->count;
> >
> > /* queue_work can fail to schedule crc_work; add crc for
> > * missing frames
> > diff --git a/drivers/gpu/drm/vkms/vkms_crtc.c b/drivers/gpu/drm/vkms/vkms_crtc.c
> > index 8a9aeb0a9ea8..9bf3268e2e92 100644
> > --- a/drivers/gpu/drm/vkms/vkms_crtc.c
> > +++ b/drivers/gpu/drm/vkms/vkms_crtc.c
> > @@ -10,6 +10,8 @@ static enum hrtimer_restart vkms_vblank_simulate(struct hrtimer *timer)
> > vblank_hrtimer);
> > struct drm_crtc *crtc = &output->crtc;
> > struct vkms_crtc_state *state = to_vkms_crtc_state(crtc->state);
> > + unsigned int pipe = drm_crtc_index(crtc);
> > + struct drm_vblank_crtc *vblank = &crtc->dev->vblank[pipe];
> > u64 ret_overrun;
> > bool ret;
> >
> > @@ -20,7 +22,7 @@ static enum hrtimer_restart vkms_vblank_simulate(struct hrtimer *timer)
> > DRM_ERROR("vkms failure on handling vblank");
> >
> > if (state && output->crc_enabled) {
> > - u64 frame = drm_crtc_accurate_vblank_count(crtc);
> > + u64 frame = vblank->count;
> >
> > /* update frame_start only if a queued vkms_crc_work_handle()
> > * has read the data
> > --
> > 2.17.1
> >
>
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
--
Ville Syrjälä
Intel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2019-02-28 14:03 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-25 14:26 [PATCH] drm/vkms: Solve bug on kms_crc_cursor tests Shayenne Moura
2019-02-25 21:48 ` Rodrigo Siqueira
2019-02-28 10:11 ` Daniel Vetter
2019-02-28 10:14 ` Daniel Vetter
2019-02-28 14:03 ` Ville Syrjälä [this message]
2019-03-01 14:55 ` Shayenne Moura
2019-03-01 15:25 ` Ville Syrjälä
2019-03-01 18:35 ` Shayenne Moura
2019-03-01 18:41 ` Ville Syrjälä
2019-03-10 20:35 ` Rodrigo Siqueira
2019-03-11 14:27 ` Ville Syrjälä
2019-03-15 11:51 ` Rodrigo Siqueira
2019-03-15 13:48 ` Ville Syrjälä
2019-03-18 19:36 ` Rodrigo Siqueira
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=20190228140341.GG20097@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=airlied@linux.ie \
--cc=dri-devel@lists.freedesktop.org \
--cc=hamohammed.sa@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rodrigosiqueiramelo@gmail.com \
--cc=shayenneluzmoura@gmail.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: 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;
as well as URLs for NNTP newsgroup(s).