From: Paul Menzel Subject: Re: Flickering with page-flipping on Acer Iconia W500 (AMD C-50 APU) Date: Wed, 22 Feb 2012 00:34:18 +0100 Message-ID: <1329867258.22542.23.camel@mattotaupa> References: <4F29C00E.4020300@amd.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1299004463==" Return-path: Received: from mail.gw90.de (mail.gw90.de [188.40.100.199]) by gabe.freedesktop.org (Postfix) with ESMTP id 6369CA0976 for ; Tue, 21 Feb 2012 15:34:24 -0800 (PST) In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org Errors-To: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org To: Alex Deucher Cc: "Deucher, Alexander" , Felix Kuehling , "Daenzer, Michel" , mario.kleiner@tuebingen.mpg.de, dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org --===============1299004463== Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="=-zQdNUpEEsPYME4Ij5NOe" --=-zQdNUpEEsPYME4Ij5NOe Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Felix! Am Dienstag, den 21.02.2012, 15:07 -0500 schrieb Alex Deucher: > On Wed, Feb 1, 2012 at 5:43 PM, Felix Kuehling w= rote: > > Following up on my message from Jan 19, now with a lot more hard data a= nd a > > less intrusive modification. Still a prototype though. CC-ing DRI-devel= and > > Mario Kleiner for a larger audience. > > > > To recap, I was seeing consistent flickering with Mesa/KMS on Android o= n my > > Iconia Tab W500 tablet with an AMD C-50 APU. I was also noticing occasi= onal > > flickering under Ubuntu on the same system when maximizing/restoring wi= ndows > > and releasing windows after moving them. > > > > I believe that flickering is related to page flipping and the associate= d > > notifications to user space. A small modification to the page flipping = code > > in the Radeon driver made the problem disappear on both Ubuntu and Andr= oid. > > As I understand it, the page flip notification logic works as follows: > > > > Hardware issues vsync IRQ > > IRQ handler calls radeon_crtc_handle_flip > > radeon_crtc_handle_flip calls radeon_page_flip, which programs MMIO to = flip > > pages and returns status whether the flip has been completed > > if flip has not been completed, radeon_crtc_handle_flip uses current sc= anout > > position to predict whether flip will complete in the current frame or = not > > if flip is predicted to complete, signal user space, otherwise defer un= til > > next vsync IRQ > > > > The condition in step 4 needed a slight modification on my hardware. If= the > > current scanout position is negative (inside vblank interval), the page= flip > > will not complete until the next vsync on my hardware. > > > > I'm attaching two patches. radeon_flip_diag.diff adds some debug output= to > > the kernel log that helped me understand the timing of VSync IRQs used = for > > handling page-flips relative to the screen refresh in progress. It also > > measures the time it takes to program the page flip in MMIO in pixels > > scanned out (typically about 300 pixels, so relatively insignificant > > compared to the vertical refresh). > > > > On my system it turned out that the scanout position at the time > > radeon_crtc_handle_flip was called was somewhere between 798-800 and -2= -0 > > (the LVDS screen having 800 visible rows). I used an awk script (also > > attached) to compute some statistics. With the original condition almos= t no > > page flips were detected as deferred to the next vsync IRQ. With the > > modified condition about 50% page flips were completed immediately acco= rding > > to radeon_page_flip and of the remaining ones about 50% were correctly > > predicted to complete based on the scanout position. In total about 25%= were > > deferred until the next vsync. These 25% must have been causing flicker= ing > > with the original condition. > > > > radeon_flip_fix.diff shows the minor modification to the condition used= to > > decide whether a page-flip has been completed or will complete in the > > current screen refresh. > > > > My conclusion is that on this particular hardware the condition that > > predicts page flip completion must be modified in order to avoid notify= ing > > user space of completed page flips prematurely. >=20 > The fix looks ok to me. Mario any thoughts? >=20 > Reviewed-by: Alex Deucher A Signed-off-by line is required, is not it? Should it also got to stable? Additionally should the diagnose also be committed? Felix: git config user.name "Felix K=C3=BChling" git config user.email "felix.kuehling@amd.com" git clone git://people.freedesktop.org/~airlied/linux git checkout -b flicker-fix drm-next # I hope that is the correct o= ne. # apply your fix git commit -a -s # add your commit message with Alex=E2=80=99s Reviewed-by line git format-patch -1 # use git send-email or paste it to your message editor to send the= patch to the list Thanks, Paul --=-zQdNUpEEsPYME4Ij5NOe Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iEYEABECAAYFAk9EKfsACgkQPX1aK2wOHVhKWgCdEVTzoJ2J2gDLesCKKyc6yo7u 7F8AoIKj0pDSNF5TE1uLi/jID5eVVfGm =Lpg2 -----END PGP SIGNATURE----- --=-zQdNUpEEsPYME4Ij5NOe-- --===============1299004463== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel --===============1299004463==--