From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mario Kleiner Subject: Re: [PATCH 14/19] drm: Don't update vblank timestamp when the counter didn't change Date: Sat, 13 Sep 2014 18:25:54 +0200 Message-ID: <54147012.40609@gmail.com> References: <1407325803-6944-1-git-send-email-ville.syrjala@linux.intel.com> <1407325803-6944-15-git-send-email-ville.syrjala@linux.intel.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------040107060707060004050905" Return-path: In-Reply-To: <1407325803-6944-15-git-send-email-ville.syrjala@linux.intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: ville.syrjala@linux.intel.com, dri-devel@lists.freedesktop.org Cc: Daniel Vetter , intel-gfx@lists.freedesktop.org, Dave Airlie List-Id: dri-devel@lists.freedesktop.org This is a multi-part message in MIME format. --------------040107060707060004050905 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable The current drm-next misses Ville's original Patch 14/19, the one i=20 first objected, then objected to my objection. It is needed to avoid=20 actual regressions. Attached a trivially rebased (v2) of Ville's patch=20 to go on top of drm-next, also as tgz in case my e-mail client mangles=20 the patch again, because it's one of those "email hates me" weeks. -mario On 08/06/2014 01:49 PM, ville.syrjala@linux.intel.com wrote: > From: Ville Syrj=C3=A4l=C3=A4 > > If we already have a timestamp for the current vblank counter, don't > update it with a new timestmap. Small errors can creep in between two > timestamp queries for the same vblank count, which could be confusing t= o > userspace when it queries the timestamp for the same vblank sequence > number twice. > > This problem gets exposed when the vblank disable timer is not used > (or is set to expire quickly) and thus we can get multiple vblank > disable<->enable transition during the same frame which would all > attempt to update the timestamp with the latest estimate. > > Testcase: igt/kms_flip/flip-vs-expired-vblank > Signed-off-by: Ville Syrj=C3=A4l=C3=A4 > --- > drivers/gpu/drm/drm_irq.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c > index af33df1..0523f5b 100644 > --- a/drivers/gpu/drm/drm_irq.c > +++ b/drivers/gpu/drm/drm_irq.c > @@ -106,6 +106,9 @@ static void drm_update_vblank_count(struct drm_devi= ce *dev, int crtc) > DRM_DEBUG("enabling vblank interrupts on crtc %d, missed %d\n", > crtc, diff); > =20 > + if (diff =3D=3D 0) > + return; > + > /* Reinitialize corresponding vblank timestamp if high-precision que= ry > * available. Skip this step if query unsupported or failed. Will > * reinitialize delayed at next vblank interrupt in that case. --------------040107060707060004050905 Content-Type: text/x-patch; name="0001-drm-Don-t-update-vblank-timestamp-when-the-counter-d.patch" Content-Disposition: attachment; filename*0="0001-drm-Don-t-update-vblank-timestamp-when-the-counter-d.pa"; filename*1="tch" Content-Transfer-Encoding: quoted-printable >>From c0a5228a7fc43d4c3615a471c340b68bcb2caa16 Mon Sep 17 00:00:00 2001 From: =3D?UTF-8?q?Ville=3D20Syrj=3DC3=3DA4l=3DC3=3DA4?=3D Date: Wed, 6 Aug 2014 14:49:57 +0300 Subject: [PATCH] drm: Don't update vblank timestamp when the counter didn= 't change (v2) MIME-Version: 1.0 Content-Type: text/plain; charset=3DUTF-8 Content-Transfer-Encoding: 8bit If we already have a timestamp for the current vblank counter, don't update it with a new timestmap. Small errors can creep in between two timestamp queries for the same vblank count, which could be confusing to userspace when it queries the timestamp for the same vblank sequence number twice. This problem gets exposed when the vblank disable timer is not used (or is set to expire quickly) and thus we can get multiple vblank disable<->enable transition during the same frame which would all attempt to update the timestamp with the latest estimate. Testcase: igt/kms_flip/flip-vs-expired-vblank Signed-off-by: Ville Syrj=C3=A4l=C3=A4 Reviewed-by: Mario Kleiner v2:Mario: Trivial rebase on top of current drm-next (13-Sep-2014) Signed-off-by: Mario Kleiner --- drivers/gpu/drm/drm_irq.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c index 80ff94a..e73cbda 100644 --- a/drivers/gpu/drm/drm_irq.c +++ b/drivers/gpu/drm/drm_irq.c @@ -126,6 +126,9 @@ static void drm_update_vblank_count(struct drm_device= *dev, int crtc) DRM_DEBUG("updating vblank count on crtc %d, missed %d\n", crtc, diff); =20 + if (diff =3D=3D 0) + return; + /* Reinitialize corresponding vblank timestamp if high-precision query * available. Skip this step if query unsupported or failed. Will * reinitialize delayed at next vblank interrupt in that case. --=20 1.9.1 --------------040107060707060004050905 Content-Type: application/gzip; name="0001-drm-Don-t-update-vblank-timestamp-when-the-counter-d.patch.tar.gz" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename*0="0001-drm-Don-t-update-vblank-timestamp-when-the-counter-d.pa"; filename*1="tch.tar.gz" H4sIANNvFFQAA+1V3W7bNhTubfgUBwWK2XEoS7ZsJ07cJE3SrRgCDEnaXmyDQZGUzUaiFJKy 42GP0zfpi+1QchJ3Q9puuxgGhLBFSTz8eH6+7ygMw4gKk9PTQlNHq1IwJ+kiyZi+pk7l0jqW l3Q5l7g8l5QXlXbSUBGUzPH5s28ZYRgOhzHgHI0G4eZcj/4gHEDUi8NBOBz1oxGEvWE4GDyD 8JvQ/+WoMECDrlxnUmlp8sfsvrbexAL38/9kvDZFDjxkg15vl41SHvdFzPvDaMDiUcT7cZgM dxOe9Dhj0RDOCw2XsgRfpHBc/6CH5SQeZgyTw7dXr+nu4c3hO5VlctILL1fmw+SkPzmOs2Y6 nMDBwi8GFpdYxo4ypavbQCGrsoAX+Utyigwcw3spdmAIx9UMT4hiiOJxvDcejKAT9sOQXFbJ B8ndGH7+6fjq5IdfATk8BiTxdw4aEkNDYrgnMXgSA5IY1iQGoQTaE+BzpmcSWotem5y/OT+j 76SxqtBjiIKQnBRorB29WpXol5O3rltmTOl9v89Y6SZ11A92hmmbokbONC+E0rMx7CbKEfIm haUElhnJxArmbIEPG+6lhWm8q4xBnDv/187ugPDBkXVwysFSuTkCaLlcg+SsDOAyZ1kG0pjC WOBMAzcSK6Y0JNItpc/AsiAPp95U0ihp70+3LJefHb2DeVN87h8ygSB4o9PKYlzgClJZTFXJ uGyyi27dAXqwvwa3CW8l2mouia7yBMvhlorLgJCrubJQmiLJZA4z6SzI27KwUjxUcI0glGVo VZ9jAHfpAsuPlqRV1M9YHfTS71dGomuKX2erNjAtEKayvh4+R3gI5FXmVJndYZM19gF9KXVz iK+rcsgLEJWp478LKDX+2uRpWecJi0CYczIvawfWVfs8J3UB/asM16wD/Kscb30K8J4zi3xT M9e9zu00zVTZ9Re6sLSJR6z7NLlUM41PRZrSZDWGWnzgpffpY/bp41cFdyEXSi4RwG8+Z0YV 8GPT7eAg94/BuvkFQh7NcqbW+8iiN67Nx3Bl1EKxDIxM0GvAFLmihCK9J7P/xGiUDrSiPsUW Qr2o23/2/G8cTikliKoWyL/urKy6eIL/T5W5CTj8Dn3odDoEIkgVZqOROLaUPkoBOevLaFud NsE6pylQOkPqsu7jgMnja0RpIW9hN0zTvZgFgRz1eSIYRPjdi2Pv6ZeQCbr5RfSjI6BRb7gz hI6f9gBfIIGc4rAolPCpnTb8mjZ8mNa6bVlnKl5nfiqwwijRbZx3MH6HTcHxNoGt04vz6enZ q7fft57XEJ7Vm+L3lfS28AJTlyvrRfhC/KKf7+DmLajXsDNhCtv7BEhnS6XQqjM6mUDYxhdb RrrK6H2CtdjqbsMFFhNFxDL1m28lyA5bFlpsHPwgEASbq9mclkZy5Rty3VxWCATbwBbIBS9M 7HnXqkQheb07WW+r7aDStirLwjj0GvtBihukCOA9yqHBMJvOCJmxFVoyBzVT1+54oRhToY6V 7z246oUZYFmBRMFeEBHyX3/En8bTeBpP4x+MPwAI+n+CAA4AAA== --------------040107060707060004050905 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx --------------040107060707060004050905--