Issue title: X performance regression in `20170608-beta-5` and `20170824-beta-2`
 Issue body: We are in the process of releasing updated images for our RK3399-Q7 module, but we have noticed slower X performance compared to the `20170504-beta-3` image.

You can feel that moving windows is much slower in the `20170824-beta-2` image, but to get hard numbers I have used `gtkperf`:
```
20170308-beta-3:  45 seconds
20170504-beta-3:  48 seconds
20170608-beta-5:  81 seconds
20170824-beta-2: 117 seconds
```

So what has changed? Xorg was updated in `20170608-beta-5`,
and libmali was updated in `20170824-beta-2` (see below).

It looks like both changes have had a negative impact on X performance. Have you noticed this as well?

libmali versions
----------------
```
root@rk3399-q7:/emmc# sha256sum */usr/lib/arm-linux-gnueabihf/libmali-midgard-4th-r13p0.so
829f013bb06b2ec5511d998e54fd5aa5f43e22953d4368ae36af9a6eab96d6d1  20170308-beta-3/usr/lib/arm-linux-gnueabihf/libmali-midgard-4th-r13p0.so
829f013bb06b2ec5511d998e54fd5aa5f43e22953d4368ae36af9a6eab96d6d1  20170504-beta-3/usr/lib/arm-linux-gnueabihf/libmali-midgard-4th-r13p0.so
829f013bb06b2ec5511d998e54fd5aa5f43e22953d4368ae36af9a6eab96d6d1  20170608-beta-5/usr/lib/arm-linux-gnueabihf/libmali-midgard-4th-r13p0.so
01dd686e00f34292e9e8d6dcd1c35b5454e5416e5cf0ec898194b9eac23b6409  20170824-beta-2/usr/lib/arm-linux-gnueabihf/libmali-midgard-4th-r13p0.so
```

xorg versions
--------------
```
root@rk3399-q7:/emmc# sha256sum 20170308-beta-3/usr/bin/Xorg 20170504-beta-3/usr/bin/Xorg */usr/lib/xorg/Xorg
69cd0b055322454c7771bcf617273b824065be522ff93cd2ca2d3e7b1aac1421  20170308-beta-3/usr/bin/Xorg
69cd0b055322454c7771bcf617273b824065be522ff93cd2ca2d3e7b1aac1421  20170504-beta-3/usr/bin/Xorg
e78047ec4f502baf4659d12d9ae3862812622f9502a992b6b64f33e74b1f550d  20170608-beta-5/usr/lib/xorg/Xorg
e78047ec4f502baf4659d12d9ae3862812622f9502a992b6b64f33e74b1f550d  20170824-beta-2/usr/lib/xorg/Xorg
 Comments: 
 Comment 0: It shouldn't be slow.
Could show me the log after issuing  `cat /var/log/Xorg.0.log | grep glamor `?
 Comment 1: I have archived the complete logs (see below). This line appears in all of them, glamor seems to be active:
```
(II) modeset(0): glamor initialized
```


20170308-beta-3: https://gist.github.com/jakob-tsd/2714a5373c1c4bd7fd8b7a10a511068c
20170504-beta-3: https://gist.github.com/jakob-tsd/69bc7a41de716f7a38d9edfb53a723db
20170608-beta-5: https://gist.github.com/jakob-tsd/7a45dbedd7396ea6108e21a5febcd90b
20170824-beta-2: https://gist.github.com/jakob-tsd/921fc0c20aa7de327a506060d8e4a29c
 Comment 2: Oh, it might be due to that i have replace glFlush with glFinish in xserver, because if we don't use glFinish to clean cache, xserver will random crash...  Since stability is more important than performance, so i update this chage.


 Comment 3: For a better performance, you should use qt eglfs/wayland.  
There are so many problems in xserver.
 Comment 4: but i don't know why result in `20170824-beta-2` is worse than `20170608-beta-5`.
maybe this changes?
https://github.com/rockchip-linux/rk-rootfs-build/commit/022af8508c89ccdc3c4c0906fa06354c90d3e4ff#diff-226678754f222aa73b690b3a08f2c4ce

 Comment 5: Ok, thanks for the reply. I will see if we can move over to Wayland for the desktop environment.
 Comment 6: If you are looking for backend for desktop environment, then i would say that X11 is still the best choice for the desktop environment, because of its compatibility, although the performance is not good......

You can see that i have push some commits about wayland desktop experiment, but I can't make it work. There are also many problems need be sloved. ; )
https://github.com/rockchip-linux/rk-rootfs-build/commit/139ceb8af8fcd72d02e276317ff0b9d8dae163f5


 Comment 7: Wow, gtkperf result with glamor enabled is worse than glamor disabled.
```
GtkEntry - time:  0.27                                                                         
GtkComboBox - time:  1.25                                                                      
GtkComboBoxEntry - time:  1.07                                                                 
GtkSpinButton - time:  0.29                                                                    
GtkProgressBar - time:  0.21                                                                   
GtkToggleButton - time:  0.47                                                                  
GtkCheckButton - time:  0.23                                                                   
GtkRadioButton - time:  0.38                                                                   
GtkTextView - Add text - time:  1.16                                                           
GtkTextView - Scroll - time:  0.81                                                             
GtkDrawingArea - Lines - time:  3.43                                                           
GtkDrawingArea - Circles - time: 56.57                                                         
GtkDrawingArea - Text - time:  4.93                                                            
GtkDrawingArea - Pixbufs - time:  0.59                                                         
 ---                                                                                           
Total time: 71.65 

```

```
GtkEntry - time:  0.03                                                                         
GtkComboBox - time:  0.70                                                                      
GtkComboBoxEntry - time:  0.58                                                                 
GtkSpinButton - time:  0.05                                                                    
GtkProgressBar - time:  0.03                                                                   
GtkToggleButton - time:  0.08                                                                  
GtkCheckButton - time:  0.06                                                                   
GtkRadioButton - time:  0.11                                                                   
GtkTextView - Add text - time:  0.46                                                           
GtkTextView - Scroll - time:  0.16                                                             
GtkDrawingArea - Lines - time:  0.46                                                           
GtkDrawingArea - Circles - time:  1.26                                                         
GtkDrawingArea - Text - time:  0.65                                                            
GtkDrawingArea - Pixbufs - time:  0.11                                                         
 ---                                                                                           
Total time:  4.74    
```
 Comment 8: Let me explain rockchip graphic current status, hope it could help people who need those infomations.

At the begining, we want to use 2d accel unit in xserver, just like other platforms, but  our 2d accel unit don't have a mmu, which means it's not suitable for EXA, so we switch to glamor.
The problem about glamor is that libmali is not mesa, they behave different in many places, which make it so buggy. The results show it can only accel big operations(drag window) and even make small operations(gtk) much slower.
Optimizate xserver is beylond our ability and we have been told that ARM won't support X11 in the future, so we won't have dev plan for it.
We have plan to switch to wayland(gnome, kde etc) for people who want a desktop enviroment.  It's not in high priority.

At present, the recommended choices for `single window` is :
1. qt with eglfs plugin
2. qt qml or EGL app + x11
3. qt with wayland plugin
4. wayland
5. x11

The recommended choices for `multi window` is :
1. wayland
2. x11

The recommended choices for `desktop` is :
1. x11

The recommended choices for `4K playback` + `single window`  is :
1. qt with eglfs plugin
2. x11

The recommended choices for `4K playback` + `multi window`  is :
1. x11
 Comment 9: Thank you, yes, very helpful information.

I have bootstrapped a Debian Buster system as well now. Without libmali, Gnome works very slow but otherwise OK. "pstree" shows that gdm-wayland-session is running.

With libmali installed as you did in https://github.com/rockchip-linux/rk-rootfs-build/blob/183e56ccd729ec13fc20000014b777d4d959bee1/mk-rootfs-buster.sh#L62 , gdm seems to fall back to X11 automatically. But I forced it to wayland using

```
mv /usr/lib/gdm3/gdm-x-session /usr/lib/gdm3/gdm-x-session.DISABLED
```

I then get the error `The DDK is not compatible` in "journalctl -f" (and gdm is stuck in a restart loop. Full error below).

This message seems to be emitted by libmali:
```
strings libmali-midgard-t86x-r13p0-wayland.so | grep ERROR
ERROR: The DDK is not compatible with any of the Mali GPUs on the system.
```
However, `glmark2-es2-drm` works fine. I'm confused what libmali is complaining about.


Full error:
```
org.gnome.Shell.desktop[13701]: ERROR: The DDK is not compatible with any of the Mali GPUs on the system.
org.gnome.Shell.desktop[13701]: The DDK was built for 0x860 r2p0 status range [0..15], but none of the GPUs matched:
org.gnome.Shell.desktop[13701]: ERROR: The DDK is not compatible with any of the Mali GPUs on the system.
org.gnome.Shell.desktop[13701]: The DDK was built for 0x860 r2p0 status range [0..15], but none of the GPUs matched:
org.gnome.Shell.desktop[13701]: ERROR: The DDK is not compatible with any of the Mali GPUs on the system.
org.gnome.Shell.desktop[13701]: The DDK was built for 0x860 r2p0 status range [0..15], but none of the GPUs matched:
gnome-shell[13701]: Unable to initialize Clutter: Unable to initialize the Clutter backend: no available drivers found.
gnome-shell[13701]: Unable to initialize Clutter.
gnome-session[13694]: gnome-session-binary[13694]: WARNING: App 'org.gnome.Shell.desktop' exited with code 1
gnome-session-binary[13694]: WARNING: App 'org.gnome.Shell.desktop' exited with code 1
gnome-session-binary[13694]: Unrecoverable failure in required component org.gnome.Shell.desktop
```


 Comment 10: Hi @wzyy2 
Thanks for your helpful state of the graphics library landscape on rockchip ! 

But i'd  just to like to ask you a slight precision please. 
We bought a tinkerboard in the hope that we could execute  a simple opengl code (with an application named pure-data (https://puredata.info/) [1]) that we would like to display on *4k* screen

Does the tinkerboard support opengl (ES) on x11 please (i.e with 3d hardware acceleated graphics) ? 
If that's the case:
  * are you aware of any documentation on how to enable it or any distribution that provide it out of the box please ?
  * And does that opengl on x11 option would be able to display on a 4k screen please ? 

If there's no hope of an opengl drivers for x11, what would be our best option between those you listed above please ?

Thanks
Regards,

[1] Mentioning the program we wish to run (aka pure-data) is not that important here but i just mentioned it because it might be relevant as i don't know if it can run under another server than X11

 Comment 11: We support opengl ES on X11, I think it's already enabled out of the box, you could ask tinkerboard guys how to use it.....

EGL programs have a same performance on X11/ [QT EGLFS](http://doc.qt.io/qt-5/embedded-linux.html)/wayland , just note that opengl ES on x11 is low efficient when it be displayed as a window.
If you like to deal with low level API, you can study how to use  (DRM + GBM + EGL), so x11/qt/wayland depend can be removed.


 Comment 12: Flame graph when dragging window in X11:
![](https://rawgit.com/wzyy2/wzyy2.github.io/master/images/better.svg)

Wonder if we can improve it......
 Comment 13: It seems mali-r14 have fix crash issues, which means"glfinish" can be revert.

 Comment 14: I noticed that you have commited and build the change https://github.com/rockchip-linux/xserver/commit/543d0338c68f39bc59c0aa945a6241043b457e51 so I have tested on our RK3399-Q7 module:

* Moving windows feels snappy again
* gtkperf: 50.40 seconds

Looks great!

Exact tested versions:
* [rootfs-debian-20171218(video package update).tar.gz](https://drive.google.com/drive/folders/0BwAJtUrQohwXdGRVYTAwdlJDOUU) plus [xserver-common / xorg-core_1.19.3-2_armhf.deb](https://github.com/rockchip-linux/rk-rootfs-build/tree/master/packages/armhf/xserver)
* on latest 4.4 kernel https://github.com/rockchip-linux/kernel/commit/2801809213b2ebda0ab877ede0354d48fe95cde1 
 Comment 15: Yeah, but we need soem time to test to ensure there is no crash again.
 Comment 16: Does the resolution affect the gtkperf result? If it does what resolution you guys are using?
 Comment 17: I use 1920x1080
 Comment 18: Hi. I can not get performance like you guys talking above.Don't know what's going wrong...
Here comes my environment:
rootfs: https://github.com/rockchip-linux/rk-rootfs-build/commit/34e0150f9768fa7140fda45d7f4f64280a4c0506
linux-kernel: https://github.com/rockchip-linux/kernel/commit/77c621e5319e4b78cb04cc00699f1877627ccc05
display device: 1920x1080 HDMI
glmark2-es2 score: 51
gtkperf's log:
[gtkperf.log](https://github.com/rockchip-linux/rk-rootfs-build/files/1638156/gtkperf.log)
Any hints ?





 Comment 19: As per your log, you get `Total time: 115.62`. This matches what I got in my first post: `20170824-beta-2: 117 seconds`. To get ~50 seconds you need `xorg-core_1.19.3-2_armhf.deb`, but this package [has been deleted](https://github.com/rockchip-linux/rk-rootfs-build/commit/4a67d359406dbf4da51450aca31a0ef54b7703bb) again. I don't know all the details, but I guess it was causing other trouble.
 Comment 20: `xorg-core_1.19.3-2_armhf.deb` still casue crash, so i revert it and keep glfinish.

glmark2-es2: Use "off-screen" option.
If you care about graphic performance, then i don't suggest to use X11.


 Comment 21: https://github.com/rockchip-linux/xserver/issues/6#issuecomment-358348217
 Comment 22: out-dated
{'source': 'GithubIssues', 'repo_name_with_owner': 'rockchip-linux/rk-rootfs-build', 'issue_id': 264914088, 'repo_stars': 113.0}