Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenGL: move away from fixed function pipeline #12841

Merged
merged 25 commits into from Oct 5, 2017

Conversation

@FernetMenta
Copy link
Member

commented Sep 27, 2017

This is first iteration of upgrading OpenGL to >= 3.2. I moved all shaders used by OpenGL to a separate folder with GLSL version. This allows keeping backwards compatibility on systems that don't support GLSL 1.5 that comes with OpenGL 3.2

OSX: define environment variable KODI_GL_PROFILE_3_2 to get OpenGL core profile 3.2

@FernetMenta FernetMenta changed the title OpenGL: move away from fixed funcion pipeline OpenGL: move away from fixed function pipeline Sep 27, 2017
@notspiff

This comment has been minimized.

Copy link
Contributor

commented Sep 28, 2017

i tested this, it seems to work fine on linux/nvidia legacy drivers. i'm surprised that it doesn't seem to break add-ons using fixed pipeline functionality. i thought they were exclusive starting in gl3.2 ?

@FernetMenta

This comment has been minimized.

Copy link
Member Author

commented Sep 28, 2017

GL 3.2 dropped fixed pipeline completely. If you request profile 3.2 (on Intel) by setting MESA_GL_VERSION_OVERRIDE to 3.2, you get a black sceen even with this PR. GL 3.0 is last version that supports fixed. I don't know how nvidia drivers manage compatibility.

@MilhouseVH

This comment has been minimized.

Copy link
Contributor

commented Sep 28, 2017

i tested this, it seems to work fine on linux/nvidia legacy drivers

ION2 is now using only software decode (vc-1, h264 etc.) with this PR - presumably this is expected?

@FernetMenta

This comment has been minimized.

Copy link
Member Author

commented Sep 29, 2017

vdpau should work again with added commit

@MilhouseVH

This comment has been minimized.

Copy link
Contributor

commented Sep 29, 2017

Thanks, hardware acceleration is working again with ION2.

float x,y,z;
};
Svertex vertices[24];
Svertex vertex;

This comment has been minimized.

Copy link
@Rechi

Rechi Sep 30, 2017

Member

unused variable

@FernetMenta

This comment has been minimized.

Copy link
Member Author

commented Oct 1, 2017

next step done. on OSX I can play video with OpenGL core profile 3.2 by defining environment variable 3.2.

@Rechi

This comment has been minimized.

Copy link
Member

commented Oct 1, 2017

Not sure if this the following is expected in the current state.
I only have a green background with enabled hardware decoding instead of seeing the video on OSX.
After disabled hardware decoding the video is displayed correctly.

@FernetMenta

This comment has been minimized.

Copy link
Member Author

commented Oct 2, 2017

right, I haven't looked into hw accels so far. works with latest update

@Memphiz

This comment has been minimized.

Copy link
Member

commented Oct 3, 2017

What is the reason for not enabling gl3.2 on OS X in general? I guess there is no guarantee that everything running OS X 10.8 (our current deployment target) supports it?

@FernetMenta

This comment has been minimized.

Copy link
Member Author

commented Oct 3, 2017

Addons (visualizations) need to adapt to 3.2 too. If you are using a viz that still uses fixed function pipeline, you can run Kodi in legacy OpenGL.

@FernetMenta

This comment has been minimized.

Copy link
Member Author

commented Oct 3, 2017

jenkins build this please

@MilhouseVH

This comment has been minimized.

Copy link
Contributor

commented Oct 3, 2017

Latest version of this PR crashes on ION2:

http://sprunge.us/BScR
http://sprunge.us/PWPj

Let me know if you need a debug-enabled crashlog.

@FernetMenta

This comment has been minimized.

Copy link
Member Author

commented Oct 3, 2017

@MilhouseVH updated, could you please try again

@MilhouseVH

This comment has been minimized.

Copy link
Contributor

commented Oct 3, 2017

Thanks, that's working fine again.

@@ -326,10 +326,7 @@ void CMatrixGL::PrintMatrix(void)

void CMatrixGLStack::Load()
{
#ifdef HAS_GL
glMatrixMode(m_type);

This comment has been minimized.

Copy link
@Rechi

Rechi Oct 3, 2017

Member

m_type is now unused at least on osx

This comment has been minimized.

Copy link
@FernetMenta

FernetMenta Oct 4, 2017

Author Member

This entire file is a hack: MatrixGLES and used by OpenGL. Load() is empty now and can be removed but this would reslts in more changes in GLES only code. I think it is best to do this in a separate PR.

@MilhouseVH

This comment has been minimized.

Copy link
Contributor

commented Oct 3, 2017

On both a NUC (Skylake i5) and ION2, with this PR there's some sort of alpha/blending issue in Estuary:

WIthout this PR:
s1

With this PR:
s2

@FernetMenta FernetMenta force-pushed the FernetMenta:opengl branch from 59e5935 to 79fd5dc Oct 4, 2017
@FernetMenta

This comment has been minimized.

Copy link
Member Author

commented Oct 4, 2017

@MilhouseVH should be fixed now

@FernetMenta

This comment has been minimized.

Copy link
Member Author

commented Oct 4, 2017

jenkins build this please

@MilhouseVH

This comment has been minimized.

Copy link
Contributor

commented Oct 4, 2017

Thanks, that looks good now on both the NUC and ION2.

@MilhouseVH

This comment has been minimized.

Copy link
Contributor

commented Oct 5, 2017

Addons (visualizations) need to adapt to 3.2 too. If you are using a viz that still uses fixed function pipeline, you can run Kodi in legacy OpenGL.

Perhaps this is the reason why the "Dim" screensaver is crashing kodi on the ION2 (NUC is OK)? Or maybe it's something else...

Crashlog: https://pastebin.com/raw/8cttCMaq

@Rechi

This comment has been minimized.

Copy link
Member

commented Oct 5, 2017

jenkins build this please

@FernetMenta

This comment has been minimized.

Copy link
Member Author

commented Oct 5, 2017

stupid jenkins builds outdated sources all the time

@popcornmix

This comment has been minimized.

Copy link
Member

commented Oct 6, 2017

@stefansaraev

This comment has been minimized.

Copy link
Contributor

commented Oct 6, 2017

for me, it is black screen (using confluence) - home window not rendered at all. but some widgets are visible:

poor man's bisect revealed fb00118 is the first bad commit

@FernetMenta

This comment has been minimized.

Copy link
Member Author

commented Oct 6, 2017

weird, there is nothing on the GLES path but this single line of code:
https://github.com/FernetMenta/xbmc/blob/c578f71f0c63f74a44a067da12524a3589626dd7/xbmc/guilib/GUIFontTTFGL.cpp#L108

can you try to comment this line and try again?

@popcornmix

This comment has been minimized.

Copy link
Member

commented Oct 6, 2017

Commenting out glActiveTexture(GL_TEXTURE0); didn't help.

garbear added a commit to garbear/xbmc that referenced this pull request Oct 6, 2017
This reverts commit 9c76db5, reversing
changes made to 3488545.
@FernetMenta

This comment has been minimized.

Copy link
Member Author

commented on xbmc/guilib/GUIFontTTFGL.cpp in fb00118 Oct 7, 2017

@stefansaraev @popcornmix those lines belong to gles and I accidentally changed them.

This comment has been minimized.

Copy link
Contributor

replied Oct 7, 2017

yep fixed. thanks!

@FernetMenta

This comment has been minimized.

Copy link
Member Author

commented Oct 7, 2017

this should fix it: #12890

@Guilouz

This comment has been minimized.

Copy link
Contributor

commented Oct 9, 2017

@FernetMenta
With this PR I have issue on my Intel NUC NUC5i5RYH, tested with Stock Estuary and my Estuary MOD

See my post here : https://forum.kodi.tv/showthread.php?tid=298462&pid=2653307#pid2653307

if (!getenv("KODI_GL_PROFILE_3_2"))
pixFmt = [[NSOpenGLPixelFormat alloc] initWithAttributes:fsattrs];

pixFmt = [[NSOpenGLPixelFormat alloc] initWithAttributes:fsattrs];

This comment has been minimized.

Copy link
@hauihau

hauihau Oct 9, 2017

compared to the changes according to wattrs, the last line looks like it sets pixFmt to fsattrs even when KODI_GL_PROFILE_3_2 is set.

This comment has been minimized.

Copy link
@FernetMenta

FernetMenta Oct 9, 2017

Author Member

good catch, thanks a lot!
fixed here: 325ab1c

@MilhouseVH

This comment has been minimized.

Copy link
Contributor

commented Oct 9, 2017

As reported by @Guilouz there continues to be some sort of alpha/transparency issue.

Build #1004 on Skylake NUC (does not include this PR):

s1

Build #1005 on Skylake NUC (does include this PR):

s2

In addition to the transparency difference, as can be seen in the screenshots above the GUI appears to be darker with this PR suggesting maybe a difference in the way limited colour range is being handled?

xrandr --verbose from #1004 (limited colour range enabled in Kodi, corresponding to first screenshot): http://sprunge.us/VeeF
xrandr --verbose from #1005 (limited colour range enabled in Kodi, corresponding to second screenshot): http://sprunge.us/EfiS

Display settings from #1005:
s3

@FernetMenta

This comment has been minimized.

Copy link
Member Author

commented Oct 9, 2017

@MilhouseVH could you please attach screenshots taken with stock kodi. I would like to reproduce.

@FernetMenta

This comment has been minimized.

Copy link
Member Author

commented Oct 9, 2017

@MilhouseVH do oyu observe the alpha issue only with limited colour or also with full range?

@MilhouseVH

This comment has been minimized.

Copy link
Contributor

commented Oct 9, 2017

@MilhouseVH do oyu observe the alpha issue only with limited colour or also with full range?

Yes, transparency only seems to be an issue when "Use limited colour range (16-235)" is ENABLED.

With limited colour range DISABLED there is no transparency issue - the dialogue is opaque.

I'm currently building Ubuntu in an effort to find a simple way to reproduce.

@FernetMenta

This comment has been minimized.

Copy link
Member Author

commented Oct 9, 2017

I think I see the error

@MilhouseVH

This comment has been minimized.

Copy link
Contributor

commented Oct 9, 2017

Yes, I can reproduce on Ubuntu with Estuary Mod skin but only when enabling limited colour range.

@stefansaraev

This comment has been minimized.

Copy link
Contributor

commented Oct 9, 2017

@FernetMenta do you remember my issue with the renderloop deadlocks after starting playback and switching to fullscreen too fast, that I reported to you maybe year and half ago? it was magicaly fixed by an unrelated rework (I dont remember the exact PR) done by you, but it's now back! :)

here's what I used as a workaround in confluence to keep the renderloop busy: http://sprunge.us/JGDI

EDIT: I'll do a debug build and open a trac ticket later with gdb info if you want me to.

@FernetMenta

This comment has been minimized.

Copy link
Member Author

commented Oct 9, 2017

@stefansaraev yes, I remember it. It was triggered by calling swapBuffers without having rendered anything.
Are you saying this PR brought it back?

@stefansaraev

This comment has been minimized.

Copy link
Contributor

commented Oct 9, 2017

Are you saying this PR brought it back?

yep. 100% reproducible on amlogic s905 (wetek play 2). I can't test on other gles platform.

EDIT: well. I think it's this PR, didn't try reverting it yet. bisecting is not a trivial task with my buildsystem unfortunately. but the issue started very recently after this PR was merged.

@FernetMenta

This comment has been minimized.

Copy link
Member Author

commented Oct 9, 2017

the problem does only show when playing videos, right? is hq scaling involved?

@stefansaraev

This comment has been minimized.

Copy link
Contributor

commented Oct 9, 2017

the problem is only visible here when playing live tv (there is a noticeable delay in playback start so I can switch to fullscreen before actual playback) with amlogic hw decoders enabled. I can't reproduce with any video from my library.

I also can't reproduce with software decoding (playback starts faster when hw decoder is disabled).

changing videoplayer.hqscalers value to 0% does not make a difference.

@FernetMenta

This comment has been minimized.

Copy link
Member Author

commented Oct 9, 2017

This PR was not supposed to change anything on the GLES path. It changed FBO which is used by GLES too. This is why I asked if hq scaling makes a difference (but aml renderer won'tuse this anyway, right?)
I don't see any GLES related changes here. Would be graet if you could manage it to bisect.

@stefansaraev

This comment has been minimized.

Copy link
Contributor

commented Oct 9, 2017

will do, but not today, I'll open a trac ticket tomorrow :)

@stefansaraev

This comment has been minimized.

Copy link
Contributor

commented Oct 10, 2017

@FernetMenta I was wrong. it is not this PR.

tried to bisect but gave up after few hours rebuilding and testing. seems the bug was re-introduced somewhere here: 16b9b7c...6f90513

I was stuck with some pvr api / binary addons nonsense, other bugs came into play and am not going to continue bisecting. I'd keep a workaround in confluence instead. sorry for the noise :)

EDIT: here is a crashlog (generated with kill -SEGV) after deadlocking if it can help somehow: http://sprunge.us/

@garbear garbear referenced this pull request Oct 10, 2017
1 of 4 tasks complete
@FernetMenta

This comment has been minimized.

Copy link
Member Author

commented Oct 10, 2017

@stefansaraev

This comment has been minimized.

Copy link
Contributor

commented Oct 10, 2017

yes. that helps. now I have black screen instead of video (audio is playing fine), but the deadlock is gone. I can get out of fullscreen (to confluence home screen by pressing "back" on the remote) and then picture appears immediately.

EDIT: can't we just render black the moment playback is started? that would solve the issue.

EDIT: I dont feel good spamming 100+ people on github. this is bug that probably affects only amlogic + confluence users. I could not reproduce it with stock eastuary last time I tried. and I haven't seen anyone else ever complaining. so consider this as minor issue - we can move this discussion to forums. or trac. whatever you think is best ;)

@FernetMenta

This comment has been minimized.

Copy link
Member Author

commented Oct 10, 2017

slack?

@stefansaraev

This comment has been minimized.

Copy link
Contributor

commented Oct 10, 2017

I dont have access to kodi slack. only LibreELEC's but I dont see you there.

@da-anda

This comment has been minimized.

Copy link
Member

commented Oct 10, 2017

@stefansaraev the Kodi IRC channels (#kodi, #kodi-dev, ...) are bridged to Slack if that helps, so even if IRC doesn't show certain members online, they might still read your messages on Slack). We can also add you as a guest account on Slack if it helps you tracking down bugs or in any other way

@bhaal2

This comment has been minimized.

Copy link

commented on dfcd6a2 Oct 23, 2017

Hi there, not sure if this is when it happened, but I hadn't updated my nightly ubuntu ppa build for a while, and when I did a full ubuntu apt-get update/upgrade, it installed 20171021 nightly build and suddenly Kodi starts and gives me no interface. I get the below errors when it starts (which is why I am posting this here):

23:56:54.171 T:140398959011904 NOTICE: Using visual 0x21
23:56:54.319 T:140398959011904 ERROR: GL: Error validating shader
23:56:54.319 T:140398959011904 ERROR: 8^D

Hope this is helpful. Thanks.

This comment has been minimized.

Copy link
Member

replied Oct 23, 2017

Please don't cut logfiles - we have no idea what hardware / driver you are running: trac.kodi.tv is the way to go

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.