Bug 36029 - Refresh rate of Compiz is limited to 30FPS
Summary: Refresh rate of Compiz is limited to 30FPS
Status: RESOLVED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: Driver/intel (show other bugs)
Version: unspecified
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Chris Wilson
QA Contact: Xorg Project Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-06 08:25 UTC by Achim Frase
Modified: 2011-09-03 04:40 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
systeminformation (21.68 KB, text/plain)
2011-04-06 08:25 UTC, Achim Frase
no flags Details
updated systeminformation (22.50 KB, text/x-log)
2011-06-04 05:18 UTC, Achim Frase
no flags Details
Revenge Of The Titans xtrace (7.51 KB, text/plain)
2011-06-05 11:26 UTC, Achim Frase
no flags Details

Description Achim Frase 2011-04-06 08:25:48 UTC
Created attachment 45347 [details]
systeminformation

I have talked to smspillaz on IRC (#compiz-dev) about the problem and he thought it is a good idea to ask on #intel-gfx. As I haven't got an answer I thought it would be good to describe my problem in an bug-report.

As you can see from the screenshot the refresh rate is limited to 30FPS also the actual app (xbmc) is drawing at 60FPS
http://img23.imageshack.us/i/compiz.jpg/

The result is, that not all frames make it to the screen and animations are not as smooth as they should be.

"Sync to Vblank" is enabled in compiz. If I disable the option "Sync to Vblank" fullscreen updates do work much better, but if I move a window with "Sync to Vblank" disabled, the movement is very sluggish.

This problem occurs every time a fullscreen update happens.
Not only xbmc is affected, also other apps, even compiz itself is affected by the problem.

For more information about my system please take a look at the attached gfx_info.log.

If you need more information or if you think this is not a driver bug, please let me know.
Comment 1 Chris Wilson 2011-04-06 08:32:27 UTC
A redirected app running at 60fps when vsynced under compiz will never hit 60fps...
Comment 2 Achim Frase 2011-04-06 08:46:14 UTC
2011/4/6 <bugzilla-daemon@freedesktop.org>

> https://bugs.freedesktop.org/show_bug.cgi?id=36029
>
> --- Comment #1 from Chris Wilson <chris@chris-wilson.co.uk> 2011-04-06
> 08:32:27 PDT ---
> A redirected app running at 60fps when vsynced under compiz will never hit
> 60fps...
>
>
Okay, I never thought that I would only get 1/2 FPS with Sync to Vblank.

Interesting is that partial screen updates are not affected by this problem.

So the conclusion is that the compiz people need to fix there fullscreen
behavior, like Martin described in his blog?
http://blog.martin-graesslin.com/blog/2011/04/turning-compositing-off-in-the-right-way/
Comment 3 Chris Wilson 2011-04-06 11:51:58 UTC
30fps sounds about right if the app is presenting frames every 16ms, but it takes a finite amount of time for it to be swapped i.e. every other frame will miss the vblank and so you will halve the framerate.

Jesse can explain it much better if you want, since this is one of his favourite topics.

In order for the app to hit 60fps it has to include the finite amount of time for the buffer to reach the hardware, that is it should be calling swapbuffers roughly half-way between vblanks. Kristian's favourite topic.
Comment 4 Achim Frase 2011-04-27 08:30:11 UTC
What I do not understand is, that if I reduce the resolution, I would expect to hit 60FPS at one point. The lowest resolution that I tried was 720x480@60Hz and I am still stuck at 30FPS.

1920x1080@60Hz
http://img806.imageshack.us/i/compizsync2vblank.png/

1280x800@60Hz
http://img821.imageshack.us/i/20110427164111.jpg/

Is it because compiz doesn't support intel_swap_event or maybe XSync Fence Objects?
Comment 5 Achim Frase 2011-05-03 04:31:25 UTC
Today I had to kill compiz from tty1. After switching back to my Desktop I noticed everything was very smooth.

Fullscreen updates where suddenly running with 60FPS.
There was also no tearing, so it seems some component of the graphics stack is still taking care of that.

But in my Xorg.log I saw this:
[  7382.770] (II) AIGLX: Suspending AIGLX clients for VT switch
[  7414.595] (II) Open ACPI successful (/var/run/acpid.socket)
[  7414.595] (II) AIGLX: Resuming AIGLX clients after VT switch
[  7414.910] (II) intel(0): EDID vendor "NEC", prod id 26489
[  7414.910] (II) intel(0): Using hsync ranges from config file
[  7414.910] (II) intel(0): Using vrefresh ranges from config file
[  7414.910] (II) intel(0): Printing DDC gathered Modelines:
[  7414.910] (II) intel(0): Modeline "1920x1080"x0.0  148.50  1920 2008 2052 2200  1080 1084 1089 1125 +hsync +vsync (67.5 kHz)
[  7414.910] (II) intel(0): Modeline "1280x720"x0.0   74.25  1280 1390 1430 1650  720 725 730 750 +hsync +vsync (45.0 kHz)
[  7414.910] (II) intel(0): Modeline "720x480"x0.0   27.00  720 736 798 858  480 489 495 525 -hsync -vsync (31.5 kHz)
[  7414.910] (II) intel(0): Modeline "720x576"x0.0   27.00  720 732 796 864  576 581 586 625 -hsync -vsync (31.2 kHz)
[  7414.910] (II) intel(0): Modeline "1280x720"x0.0   74.25  1280 1720 1760 1980  720 725 730 750 +hsync +vsync (37.5 kHz)
[  7414.910] (II) intel(0): Modeline "1920x1080"x0.0  148.50  1920 2448 2492 2640  1080 1084 1089 1125 +hsync +vsync (56.2 kHz)
[  7414.910] (II) intel(0): Modeline "1920x1080i"x0.0   74.25  1920 2008 2052 2200  1080 1084 1094 1125 interlace +hsync +vsync (33.8 kHz)
[  7414.910] (II) intel(0): Modeline "800x600"x0.0   40.00  800 840 968 1056  600 601 605 628 +hsync +vsync (37.9 kHz)
[  7414.910] (II) intel(0): Modeline "800x600"x0.0   36.00  800 824 896 1024  600 601 603 625 +hsync +vsync (35.2 kHz)
[  7414.910] (II) intel(0): Modeline "640x480"x0.0   31.50  640 656 720 840  480 481 484 500 -hsync -vsync (37.5 kHz)
[  7414.911] (II) intel(0): Modeline "640x480"x0.0   31.50  640 664 704 832  480 489 492 520 -hsync -vsync (37.9 kHz)
[  7414.911] (II) intel(0): Modeline "640x480"x0.0   30.24  640 704 768 864  480 483 486 525 -hsync -vsync (35.0 kHz)
[  7414.911] (II) intel(0): Modeline "640x480"x0.0   25.18  640 656 752 800  480 490 492 525 -hsync -vsync (31.5 kHz)
[  7414.911] (II) intel(0): Modeline "720x400"x0.0   28.32  720 738 846 900  400 412 414 449 -hsync +vsync (31.5 kHz)
[  7414.911] (II) intel(0): Modeline "1280x1024"x0.0  135.00  1280 1296 1440 1688  1024 1025 1028 1066 +hsync +vsync (80.0 kHz)
[  7414.911] (II) intel(0): Modeline "1024x768"x0.0   78.75  1024 1040 1136 1312  768 769 772 800 +hsync +vsync (60.0 kHz)
[  7414.911] (II) intel(0): Modeline "1024x768"x0.0   75.00  1024 1048 1184 1328  768 771 777 806 -hsync -vsync (56.5 kHz)
[  7414.911] (II) intel(0): Modeline "1024x768"x0.0   65.00  1024 1048 1184 1344  768 771 777 806 -hsync -vsync (48.4 kHz)
[  7414.911] (II) intel(0): Modeline "832x624"x0.0   57.28  832 864 928 1152  624 625 628 667 -hsync -vsync (49.7 kHz)
[  7414.911] (II) intel(0): Modeline "800x600"x0.0   49.50  800 816 896 1056  600 601 604 625 +hsync +vsync (46.9 kHz)
[  7414.911] (II) intel(0): Modeline "800x600"x0.0   50.00  800 856 976 1040  600 637 643 666 +hsync +vsync (48.1 kHz)
[  7414.911] (II) intel(0): Modeline "1152x864"x0.0  108.00  1152 1216 1344 1600  864 865 868 900 +hsync +vsync (67.5 kHz)
[  7414.911] (II) intel(0): Modeline "1280x800"x0.0   71.00  1280 1328 1360 1440  800 803 809 823 +hsync -vsync (49.3 kHz)
[  7414.911] (II) intel(0): Modeline "1280x960"x0.0  108.00  1280 1376 1488 1800  960 961 964 1000 +hsync +vsync (60.0 kHz)
[  7414.911] (II) intel(0): Modeline "1280x1024"x0.0  108.00  1280 1328 1440 1688  1024 1025 1028 1066 +hsync +vsync (64.0 kHz)
[  7414.911] (II) intel(0): Modeline "1280x720"x60.0   74.48  1280 1336 1472 1664  720 721 724 746 -hsync +vsync (44.8 kHz)
[  7414.911] (II) intel(0): Modeline "1440x900"x0.0   88.75  1440 1488 1520 1600  900 903 909 926 +hsync -vsync (55.5 kHz)
[  7414.911] (II) intel(0): Modeline "1400x1050"x0.0  101.00  1400 1448 1480 1560  1050 1053 1057 1080 +hsync -vsync (64.7 kHz)
[  7414.911] (II) intel(0): Modeline "1680x1050"x0.0  119.00  1680 1728 1760 1840  1050 1053 1059 1080 +hsync -vsync (64.7 kHz)
[  7414.911] (II) intel(0): Modeline "1600x900"x60.0  119.00  1600 1696 1864 2128  900 901 904 932 -hsync +vsync (55.9 kHz)
[  7415.374] (WW) intel(0): I830DRI2GetMSC:1144 get vblank counter failed: Invalid argument
[  7415.608] (WW) intel(0): I830DRI2GetMSC:1144 get vblank counter failed: Invalid argument
[  7415.609] (WW) intel(0): I830DRI2GetMSC:1144 get vblank counter failed: Invalid argument
[  7415.610] (WW) intel(0): I830DRI2GetMSC:1144 get vblank counter failed: Invalid argument
[  7417.351] (WW) intel(0): I830DRI2GetMSC:1144 get vblank counter failed: Invalid argument
[  7423.238] (WW) intel(0): I830DRI2ScheduleWaitMSC:1204 get vblank counter failed: Invalid argument
[  7423.238] (WW) intel(0): first get vblank counter failed: Invalid argument
[  7423.261] (WW) intel(0): I830DRI2ScheduleWaitMSC:1204 get vblank counter failed: Invalid argument
[  7423.261] (WW) intel(0): first get vblank counter failed: Invalid argument
[  7423.267] (WW) intel(0): I830DRI2ScheduleWaitMSC:1204 get vblank counter failed: Invalid argument
[  7423.301] (WW) intel(0): I830DRI2ScheduleWaitMSC:1204 get vblank counter failed: Invalid argument
[  7423.308] (WW) intel(0): I830DRI2ScheduleWaitMSC:1204 get vblank counter failed: Invalid argument
[  7425.768] (WW) intel(0): first get vblank counter failed: Invalid argument
[  7427.810] (WW) intel(0): first get vblank counter failed: Invalid argument
[  7430.870] (WW) intel(0): first get vblank counter failed: Invalid argument
[  7430.875] (WW) intel(0): first get vblank counter failed: Invalid argument
Comment 6 Achim Frase 2011-06-04 05:17:35 UTC
I have updated to xorg-edgers ppa to see if it makes any difference.
So far nothing has changed.

I also did some tests with different options in compiz and the intel driver.
The test are all about fullscreen updates. As earlier stated partial screen updates work like expected.

This are my results:
xorg.conf: Option	"SwapbuffersWait" "1"
Compiz: Sync to vblank "enabled"
No tearing but stuck at 30 FPS.

xorg.conf: Option	"SwapbuffersWait" "1"
Compiz: Sync to vblank "disabled"
No tearing and 60 FPS

xorg.conf: Option	"SwapbuffersWait" "0"
Compiz: Sync to vblank "enabled"
Tearing and min 83 FPS, max 170 FPS.

xorg.conf: Option	"SwapbuffersWait" "0"
Compiz: Sync to vblank "disabled"
Tearing and min 83 FPS, max 170 FPS.

The first two cases give the impression, that something is to often syncing to vblank.

Other people in irc (#compiz) toled me that they don't have that issue with AMD or Nvidia. I can't test it, because I don't have any other system except the intel one.

To my mind the last two cases show, that my graphcis chip should be able to run 60 FPS with sync to vblank without any problems.

If you need more information, please let me know.
Comment 7 Achim Frase 2011-06-04 05:18:05 UTC
Created attachment 47517 [details]
updated systeminformation
Comment 8 Chris Wilson 2011-06-04 05:52:11 UTC
That does suggest that you are seeing two synchronous updates. Break out xtrace and see the commands being sent, look for DRI2*.
Comment 9 Achim Frase 2011-06-04 07:14:18 UTC
(In reply to comment #8)
> That does suggest that you are seeing two synchronous updates. Break out xtrace
> and see the commands being sent, look for DRI2*.

Can you give me some advice how to use xtrace?
This is what I get:

$ xtrace
No display name to create specified, trying :9

That's it nothing else happens.
Is there something that I need to do before xtrace can work?
Comment 10 Achim Frase 2011-06-05 11:24:45 UTC
(In reply to comment #8)
> That does suggest that you are seeing two synchronous updates. Break out xtrace
> and see the commands being sent, look for DRI2*.

After some "googeling", I found a bit more information on how to use xtrace.
I was not able to run compiz under xtrace.
So I have done two tests with "Revenge Of The Titans" under xtrace.

One test was with sync to vblank in compiz enabled and one with sync to vblank in compiz disabled.

My internet connection is very slow, so I am going to attach only a view lines
with the keyword "DRI2".

I hope this information is helpful.
Comment 11 Achim Frase 2011-06-05 11:26:55 UTC
Created attachment 47569 [details]
Revenge Of The Titans xtrace
Comment 12 Chris Wilson 2011-06-11 01:31:23 UTC
I noticed that in the typical condition of queuing a page-flip on the next vblank, we incurred an unnecessary rtt through the kernel to first queue a vblank wakeup and then pageflip.

I've attempted a fix for this under sna, and I would be grateful if you can checkout xf86-video-intel.git and compile with --enable-sna and see if this improves performance on your system.

If not, we'll enable the debug in that file and see what compiz is requesting.
Comment 13 Achim Frase 2011-06-11 07:39:57 UTC
(In reply to comment #12)
> I noticed that in the typical condition of queuing a page-flip on the next
> vblank, we incurred an unnecessary rtt through the kernel to first queue a
> vblank wakeup and then pageflip.
> 
> I've attempted a fix for this under sna, and I would be grateful if you can
> checkout xf86-video-intel.git and compile with --enable-sna and see if this
> improves performance on your system.
> 
> If not, we'll enable the debug in that file and see what compiz is requesting.

Today I tried to get this up and running, but it didn't work.
dri2proto version of xorg-edgers is to old.

It is 2.3, while the new intel driver requests 2.6.

Then I tried to install everything from git with the help of this wiki page:
http://www.x.org/wiki/CompileXserverManually
Xserver doesn't want to build, so I grabbed it from your tree:
git://anongit.freedesktop.org/~ickle/xserver
and it build.

But then as I tried to start the server I got this error:
[ 23767.808] (EE) Error compiling keymap (server-0)
[ 23767.808] (EE) XKB: Couldn't compile keymap
[ 23767.808] (EE) XKB: Failed to load keymap. Loading default keymap instead.
[ 23767.811] (EE) Error compiling keymap (server-0)
[ 23767.811] (EE) XKB: Couldn't compile keymap
[ 23767.811] XKB: Failed to compile keymap
[ 23767.811] Keyboard initialization failed. This could be a missing or incorrect setup of xkeyboard-config.
[ 23767.811] 
Fatal server error:

Latest dri2proto was installed from git but at that time I hadn't build mesa.
I guess that is also needed.

Is there a chance that someone from the xorg-edgers people is going to pull the intel driver with sna-support?

I am sorry that I am not very helpful at the moment.
Comment 14 Chris Wilson 2011-07-10 05:45:11 UTC
Good news, xorg-edgers has enabled sna! (Hopefully you don't get caught by too many of the kernel/X bugs it has so far revealed.)

But you can be first victim to test tripple-buffer vsync support... So please do install xserver-xorg-video-intel from ppa:xorg-edgers and see what happens.
Comment 15 Achim Frase 2011-07-10 08:02:18 UTC
(In reply to comment #14)
> Good news, xorg-edgers has enabled sna! (Hopefully you don't get caught by too
> many of the kernel/X bugs it has so far revealed.)
> 
> But you can be first victim to test tripple-buffer vsync support... So please
> do install xserver-xorg-video-intel from ppa:xorg-edgers and see what happens.

Now I am very impressed. Compiz is running very smooth with 60FPS and vsync. Thank you very much.
Comment 16 Chris Wilson 2011-09-03 04:40:20 UTC
Triple buffering landed for UXA in 2.16. *fingers crossed*


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.