Bug 27192

Summary: bad double buffering or vertical sync
Product: xorg Reporter: Bryce Harrington <bryce>
Component: Driver/RadeonAssignee: xf86-video-ati maintainers <xorg-driver-ati>
Status: RESOLVED INVALID QA Contact: Xorg Project Team <xorg-team>
Severity: normal    
Priority: medium CC: christopher.m.penalver, pumba88, sfandino
Version: 7.4 (2008.09)Keywords: regression
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
Xorg.0.log
none
dmesg
none
simulation
none
xvinfo for ubuntu 9.04 none

Description Bryce Harrington 2010-03-19 02:40:37 UTC
Forwarding this bug from Ubuntu reporter salva:
http://bugs.launchpad.net/ubuntu/+source/xserver-xorg-video-ati/+bug/514245

[Problem]
Video playback is not smooth.  

[Original Description]
Reproducing video with totem or mplayer does not go smoothly, consecutive frames are mixed. It looks as if that double buffering was not being use or the buffer swapping was not synchronized with video vertical sync.

It happens both in full screen and in window mode.

I didn't have this problem with Ubuntu 9.10.

This is in dmesg:
[    1.762832] [drm] radeon: 1 quad pipes, 1 z pipes initialized.
[    1.893527] Failed to wait MC idle while programming pipes. Bad things might happen.

Architecture: amd64
Date: Fri Jan 29 12:17:36 2010
DistroRelease: Ubuntu 10.04
DkmsStatus:
 virtualbox-ose, 3.1.2, 2.6.32-12-generic, x86_64: installed 
 virtualbox-ose, 3.1.2, 2.6.32-11-generic, x86_64: installed 
 virtualbox-ose, 3.1.2, 2.6.32-10-generic, x86_64: installed
InstallationMedia: Ubuntu 10.04 "Lucid Lynx" - Alpha amd64 (20091209)
MachineType: Hewlett-Packard HP dx5150 SFF
Package: xserver-xorg-video-radeon 1:6.12.99+git20100126.e5933fd7-0ubuntu1
ProcCmdLine: BOOT_IMAGE=/boot/vmlinuz-2.6.32-12-generic root=UUID=564eb7dd-0d11-4482-b882-f3794a37eb34 ro quiet splash
ProcEnviron:
 LANG=en_US.utf8ProcVersionSignature: Ubuntu 2.6.32-12.16-generic
RelatedPackageVersions:
 xserver-xorg 1:7.5+1ubuntu2
 libgl1-mesa-glx 7.7-0ubuntu8
 libdrm2 2.4.17-0ubuntu2
 xserver-xorg-video-intel 2:2.9.1-1ubuntu3
SourcePackage: xserver-xorg-video-ati
Uname: Linux 2.6.32-12-generic x86_64
dmi.bios.date: 02/24/2006
dmi.bios.vendor: Phoenix Technologies, LTD
dmi.bios.version: 1.13
dmi.board.name: 09AC
dmi.board.vendor: MSI
dmi.chassis.asset.tag: CZC62933NH
dmi.chassis.type: 3
dmi.chassis.vendor: Hewlett-Packard
dmi.modalias: dmi:bvnPhoenixTechnologies,LTD:bvr1.13:bd02/24/2006:svnHewlett-Packard:pnHPdx5150SFF:pvr:rvnMSI:rn09AC:rvr:cvnHewlett-Packard:ct3:cvr:
dmi.product.name: HP dx5150 SFF
dmi.sys.vendor: Hewlett-Packard
glxinfo: Error: [Errno 2] No such file or directory
system: architecture:       x86_64kernel:             2.6.32-12-generic
Comment 1 Bryce Harrington 2010-03-19 02:41:22 UTC
Created attachment 34231 [details]
Xorg.0.log
Comment 2 Bryce Harrington 2010-03-19 02:41:54 UTC
Created attachment 34232 [details]
dmesg
Comment 3 Bryce Harrington 2010-03-19 02:43:18 UTC
We've had him test 6.12.191 and the 2.6.32-16 kernel (which includes the 2.6.33 drm)
Comment 4 Michel Dänzer 2010-03-19 02:51:32 UTC
If he's using a compositing manager, he should either:

* Use fullscreen and make sure the compositing manager unredirects fullscreen windows.

or

* Make sure the compositing manager uses OpenGL.

Otherwise it's not really practical to avoid tearing with KMS.
Comment 5 Salvador Fandiño García 2010-03-19 03:36:52 UTC
Hi, I am the original reporter.

In Gnome I have "Special effects" set to "none", I guess that means I am not using a composite manager.

Changing that to "Normal" or "Extra" does not solve the problem, though the artifacts are different: instead of mixed frames, I get full frames but at a low rate or the timing is wrong (or both) and video does not play smoothly.

Comment 6 Alex Deucher 2010-03-19 07:36:44 UTC
Is there anyway you can get a picture or a screenshot of the problem?
Comment 7 Salvador Fandiño García 2010-03-19 11:06:24 UTC
Created attachment 34248 [details]
simulation

An screenchot does not reproduce the problem I am seeing because it mixes a lot of video frames (and not just two) in the resulting image.

I have made up a picture showing the effect. The border between the frames is not static but changes randomly and is usually placed at the top, between the 10% and 30% of the screen.

BTW, playing the same films I have tried using another computer with an Intel card attached to the same monitor (same resolution) run smoothly.
Comment 8 Alex Deucher 2010-03-19 12:00:05 UTC
(In reply to comment #7)
> Created an attachment (id=34248) [details]
> simulation
> 
> An screenchot does not reproduce the problem I am seeing because it mixes a lot
> of video frames (and not just two) in the resulting image.
> 
> I have made up a picture showing the effect. The border between the frames is
> not static but changes randomly and is usually placed at the top, between the
> 10% and 30% of the screen.

Looks like tearing.  Make sure the Xv attribute XV_VSYNC is set to 1 (check with xvinfo or xvattr) and your video app is using Xv.  You might also try disabling XV_BICUBIC (use xvattr).
Comment 9 Salvador Fandiño García 2010-03-19 12:30:55 UTC
When XV_BICUBIC is set to 0, video plays smoothly.
Comment 10 Alex Deucher 2010-03-19 12:37:15 UTC
(In reply to comment #9)
> When XV_BICUBIC is set to 0, video plays smoothly.
> 

bicubic filtering may be a bit much for the IGP depending on the video.
Comment 11 Salvador Fandiño García 2010-03-20 05:29:00 UTC
Created attachment 34253 [details]
xvinfo for ubuntu 9.04

I was able to see video without any issue on the same machine before moving to Ubuntu Lucid.

Actually, I have just tried booting from an Ubuntu 9.04 CD and video plays fine there and xvinfo reports that bicubic interpolation is being used (xvinfo for Ubuntu 9.04 attached).

That should discard the non-powerful-enough-IGP hypothesis.
Comment 12 Michel Dänzer 2010-03-23 11:50:58 UTC
(In reply to comment #11)
> I was able to see video without any issue on the same machine before moving to
> Ubuntu Lucid.

That was probably using the video overlay, which isn't available with KMS.

> Actually, I have just tried booting from an Ubuntu 9.04 CD and video plays fine
> there and xvinfo reports that bicubic interpolation is being used (xvinfo for
> Ubuntu 9.04 attached).

Bicubic filtering is only supported by the textured video adaptor.
Comment 13 Salvador Fandiño García 2010-03-23 14:57:52 UTC
yes, under 9.04 the video player uses video overlay
Comment 14 Lollerke 2010-04-14 02:47:42 UTC
Setting XV_BICUBIC to 0 doesn't solve tearing for me (UMS is the only solution). I have a Radeon Xpress 200M.
Comment 15 Alex Deucher 2010-04-14 10:43:56 UTC
(In reply to comment #14)
> Setting XV_BICUBIC to 0 doesn't solve tearing for me (UMS is the only
> solution). I have a Radeon Xpress 200M.

You will still get Xv tearing if you are using a composite manager like compiz or metacity unless you configure the compositor to use gl vsync options.
Comment 16 Lollerke 2010-04-15 01:36:45 UTC
What should I do exactly to get rid of tearing under KMS? I use GNOME and desktop effects are turned off.
Comment 17 Lollerke 2010-04-15 12:56:41 UTC
So I have to enable compiz and tick sync to vblank? I can only check it out sunday.
Comment 18 Lollerke 2010-04-18 09:45:25 UTC
It works.

(In reply to comment #17)
> So I have to enable compiz and tick sync to vblank? I can only check it out
> sunday.
Comment 19 Lollerke 2010-04-18 13:48:40 UTC
Three hours later it doesn't work (the computer was in idle during this time). When I switch a movie into full screen it's starts to stutter.

(In reply to comment #18)
> It works.
> 
> (In reply to comment #17)
> > So I have to enable compiz and tick sync to vblank? I can only check it out
> > sunday.
Comment 20 Lollerke 2010-04-18 13:57:58 UTC
If I use UMS I have system freezes randomly when playing videos in full screen ,so the only way it will be working is KMS + Overlay.

(In reply to comment #19)
> Three hours later it doesn't work (the computer was in idle during this time).
> When I switch a movie into full screen it's starts to stutter.
> 
> (In reply to comment #18)
> > It works.
> > 
> > (In reply to comment #17)
> > > So I have to enable compiz and tick sync to vblank? I can only check it out
> > > sunday.
Comment 21 Lollerke 2010-04-19 01:21:03 UTC
Is there any other solution?
Comment 22 Alex Deucher 2010-10-19 19:24:38 UTC
Is this still an issue with a newer driver?
Comment 23 Lollerke 2010-10-20 11:26:13 UTC
(In reply to comment #22)
> Is this still an issue with a newer driver?

It's much better, but I still see tearing in the upper half of the screen. DVD videos are fine (I saw one tearing in 30 minutes). With 1800kbps h264 and 6000kbps h264 the video tears badly when there's a high speed camera move. Other than that the tearing is not noticable, so movies are watchable.

Ubuntu 10.10, linux-image-2.6.35-22.35 (2.6.35.4), xserver 1.9.0-0ubuntu7, xserver-xorg-video-ati 6.13.1-1ubuntu5
Comment 24 Lollerke 2011-02-14 08:10:47 UTC
It's still an issue with 2.6.38-rc4, xserver 1.9 and xserver-xorg-video-ati 6.14.0.

xvinfo:

"X-Video Extension version 2.2
screen #0
  Adaptor #0: "Radeon Textured Video"
    number of ports: 16
    port base: 63
    operations supported: PutImage 
    supported visuals:
      depth 24, visualID 0x21
    number of attributes: 9
      "XV_BICUBIC" (range 0 to 2)
              client settable attribute
              client gettable attribute (current value is 0)
      "XV_VSYNC" (range 0 to 1)
              client settable attribute
              client gettable attribute (current value is 1)"

Xorg.0.log:

"[    16.486] (--) RADEON(0): Chipset: "ATI Radeon XPRESS 200M 5A62 (PCIE)" (ChipID = 0x5a62)
[    16.487] (II) RADEON(0): KMS Color Tiling: enabled
[    16.487] (II) RADEON(0): KMS Pageflipping: enabled
[    16.487] (II) RADEON(0): SwapBuffers wait for vsync: enabled"
Comment 25 Lollerke 2011-02-14 08:17:21 UTC
dmesg:

"[    7.936293] [drm] radeon defaulting to kernel modesetting.
[    7.936299] [drm] radeon kernel modesetting enabled.
[    7.936458] radeon 0000:01:05.0: PCI INT A -> GSI 17 (level, low) -> IRQ 17
[    7.939726] [drm] initializing kernel modesetting (RS400 0x1002:0x5A62).
[    7.939790] [drm] register mmio base: 0xC0000000
[    7.939793] [drm] register mmio size: 65536
[    7.940143] [drm] Generation 2 PCI interface, using max accessible memory
[    7.940154] radeon 0000:01:05.0: VRAM: 128M 0x0000000058000000 - 0x000000005FFFFFFF (128M used)
[    7.940159] radeon 0000:01:05.0: GTT: 512M 0x0000000060000000 - 0x000000007FFFFFFF
[    7.940177] [drm] Supports vblank timestamp caching Rev 1 (10.10.2010).
[    7.940180] [drm] Driver supports precise vblank timestamp query.
[    7.940255] [drm] radeon: irq initialized.
[    7.942623] [drm] Detected VRAM RAM=128M, BAR=256M
[    7.942629] [drm] RAM width 128bits DDR
[    7.942763] [TTM] Zone  kernel: Available graphics memory: 440494 kiB.
[    7.942766] [TTM] Zone highmem: Available graphics memory: 705970 kiB.
[    7.942769] [TTM] Initializing pool allocator.
[    7.942805] [drm] radeon: 128M of VRAM memory ready
[    7.942808] [drm] radeon: 512M of GTT memory ready.
[    7.942841] [drm] GART: num cpu pages 131072, num gpu pages 131072
[    7.969009] [drm] radeon: 1 quad pipes, 1 z pipes initialized."

I get perfect video playback only with UMS and Overlay Video Output.
Comment 26 Lollerke 2011-03-16 02:36:36 UTC
No tearing with 2.6.38 final and VLC Player. Videos are still tearing with MPlayer so its not a vsync fault.
Comment 27 Christopher M. Penalver 2016-02-25 02:16:55 UTC
Salvador Fandiño García, Ubuntu 10.04 Desktop reached EOL on May 9, 2013. For more on this, please see https://wiki.ubuntu.com/Releases .

If this is reproducible in a supported release, it will help immensely if you filed a new report with Ubuntu by ensuring you have the package xdiagnose installed, and that you click the Yes button for attaching additional debugging information running the following from a terminal:
ubuntu-bug xorg

Also, please feel free to subscribe me to it.

For more on why this is helpful, please see https://wiki.ubuntu.com/ReportingBugs.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.