grate-driver / xf86-video-opentegra

X.Org video driver for NVIDIA Tegra
Other
12 stars 9 forks source link

Composite improvements and bug fixes #51

Closed digetx closed 5 years ago

digetx commented 5 years ago

Here is a quite big update for the compositing using 3d: a big performance improvement (more to come) and various bug-fixes. The performance is greatly improved by using specifically-optimized shaders for the most common compositing operations and a bit smarter optimizations in the composite-preparation phase (texture reduction and coords wrapping checks), thus transparency and fading effects in plasma 5 are smooth now in comparison to a slideshow that it was before. Unpleasant bugs popped out due to the code changes, they are fixed now. It also turned out that the attributes-buffer set-up code was buggy and I was blaming HW before, that is fixed now and seems we can enable 3d compositing by default (I'll do more testing to be sure).

digetx commented 5 years ago

BTW, I'll probably add couple more patches to this PR soon'ish.

digetx commented 5 years ago

@kusma, I'm not going to add any new features to this PR. Will be nice if you could skim through the changes and tell if anything is ridiculous. In overall this work gives quite huge improvement to performance and fixes several serious bugs.

Decatf commented 5 years ago

The commit exa: composite-3d: support transformations breaks rendering on Galaxy Tab 10.1 (tegra 2). It happens when Option "AccelCompositing" "true". When this is false there is no rendering bug. This bug does not happen on Ouya.

Option "AccelCompositing" "false": https://i.imgur.com/5LJK2vC.png

Option "AccelCompositing" "true": https://i.imgur.com/11frFG3.png Xorg.0.log: https://paste.ubuntu.com/p/5rm4BzMpMm/

xorg conf:

Section "Device"
    Identifier "Tegra Graphics"
    Option "device" "/dev/dri/card0"
    Option "SWcursor" "false"
    Option "AccelCompositing" "true"
    Option "NoAccel" "false"
    Option "DisablePoolAllocator" "false"
    Option "DisablePixmapRefrigerator" "false"
    Option "DisableCompressionLZ4" "false"
    Option "DisableCompressionJPEG" "true"
    Option "JPEGCompressionQuality" "75"
    Option "DisableCompressionPNG" "false"
EndSection
digetx commented 5 years ago

@Decatf are you using the same kernel configuration on both devices?

Decatf commented 5 years ago

are you using the same kernel configuration on both devices?

Not exactly the same. They are similar aside from configs for peripheral drivers. GPU related configs should be the same though.

For Galaxy Tab 10.1. It is this kernel branch and defconfig https://github.com/Decatf/linux/tree/5.0-p4wifi_pmos https://gitlab.com/postmarketOS/pmaports/blob/d079a3d0/device/linux-samsung-p4wifi/config-samsung-p4wifi.armv7

For Ouya. It is this kernel branch and defconfig https://github.com/Decatf/linux/tree/5.0-next-20190305-ouya-V2 https://gitlab.com/ryang2678/pmaports/blob/66fc2a5340604f75d12f0de6b7708c2fccde3927/device/linux-ouya-ouya-mainline/config-ouya-ouya-mainline.armv7

The Galaxy Tab 10.1 kernel is based on upstream linux v5.0. The Ouya kernel is based on grate-driver/linux. For Ouya, I've reverted the commits related to the new host1x implementation.

XXX: drm/tegra: plane: Add custom CSC BLOB property 
WIP: drm/tegra: Introduce new Host1x driver and new v2 UAPI
drm/tegra: Remove staging UAPI and Host1x driver 
digetx commented 5 years ago

@Decatf could you please try this change:

diff --git a/src/shaders/vertex_common.asm b/src/shaders/vertex_common.asm
index de3e169..71606ba 100644
--- a/src/shaders/vertex_common.asm
+++ b/src/shaders/vertex_common.asm
@@ -53,6 +53,6 @@ EXEC
        RCPs r0.***w, c[4].wwww
 ;

-EXEC(export[1]=vector)
+EXEC_END(export[1]=vector)
        MULv r63.xyzw, r3.xyzw, r0.xyzw
 ;
Decatf commented 5 years ago

could you please try this change:

This change fixes the rendering bug.

digetx commented 5 years ago

@Decatf awesome, thank you!

digetx commented 5 years ago

Everything works fine, it all got enough testing and Erik is too busy for review. Hence merging!