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) Bios renders only a black screen #315

Closed
orbea opened this issue Mar 9, 2018 · 20 comments
Closed

(OpenGL) Bios renders only a black screen #315

orbea opened this issue Mar 9, 2018 · 20 comments

Comments

@orbea
Copy link
Contributor

orbea commented Mar 9, 2018

Description

With OpenGL the bios now renders as only black. Software is unaffected and I am not able to testing vulkan. Sound still works.

Expected behavior

The bios should render.

Actual behavior

The bios renders as a black screen with sound.

Steps to reproduce the bug

  1. Build beetle-psx-libtetro with opengl
  2. Start beetle-psx-librtetro with opengl and the bios skip hack off.
  3. Observe a black screen instead of the bios.

Bisect Results

Previously unaffected beetle-psx-libretro commits either do not work at all anymore or also show this issue. Older RetroArch releases also seem affected. I will try checking other programs next like mesa.

Version/Commit

  • RetroArch: 1.7.1
  • beetle-psx-libretro: 063eec6

Environment information

  • OS: Slackware64-current
  • Compiler: gcc-7.3.0
@ghost
Copy link

ghost commented Mar 9, 2018

Does the content render normally after the BIOS? What about if you take a screenshot during the BIOS boot (try with both GPU screenshot on and off)? Do you see any video in the screenshot then?

@orbea
Copy link
Contributor Author

orbea commented Mar 9, 2018

Content did seem to render before making this issue, but I must of been testing something wrong since it doesn't render now either. Taking screenshots with GPU screenshot on or off just shows a black screen.

@orbea
Copy link
Contributor Author

orbea commented Mar 9, 2018

No improvement with the llvmpipe or with a fresh config, but apitrace reveals lots of issues...

http://ks392457.kimsufi.com/orbea/stuff/trace/retroarch_beetle_psx_blackscreen.trace.xz
apitrace log - https://pastebin.com/fsU7jejG

@orbea
Copy link
Contributor Author

orbea commented Mar 9, 2018

Its getting worse for no known reason...now it just crashes.

Log - https://pastebin.com/fucUctse
When loading content with -L the backtrace changes - https://pastebin.com/VDM5WMuk

@orbea
Copy link
Contributor Author

orbea commented Mar 9, 2018

Clearing the mesa shader cache files resolved the crash and now its back to a black screen....

@ghost
Copy link

ghost commented Mar 12, 2018

tried with GL_DEBUG and/or ASAN?

@orbea
Copy link
Contributor Author

orbea commented Mar 12, 2018

Not yet, its a change in mesa that caused this. I will bisect sometime today.

@orbea
Copy link
Contributor Author

orbea commented Mar 12, 2018

First bad commit.

a0c8b49284efe736849c0a45920ad0a1bbd8d93d is the first bad commit
commit a0c8b49284efe736849c0a45920ad0a1bbd8d93d
Author: Marek Olšák <[email protected]>
Date:   Wed Feb 14 20:13:40 2018 +0100

    mesa: enable OpenGL 3.1 with ARB_compatibility
    
    Tested-by: Dieter Nützel <[email protected]>
    Reviewed-by: Brian Paul <[email protected]>

:040000 040000 e77355f4d5979f42b5e8f55dd6c6ea62cba32ff3 24f0fe1b3e5f9d1daa801a706299f0115f9d8f2d M	docs
:040000 040000 89d6cc6fe13b05f4625fb48abbb94050f0cb5c96 3b91e5c0091caf1426b09568846f8f2b3bc64803 M	src

https://github.com/mesa3d/mesa/commit/a0c8b49284efe736849c0a45920ad0a1bbd8d93d

@orbea
Copy link
Contributor Author

orbea commented Mar 12, 2018

My understanding is that there might be something in beetle-psx or maybe libretro making assumptions about GL versions which are no longer correct after that commit.

@orbea
Copy link
Contributor Author

orbea commented Mar 12, 2018

This can be worked around by exporting MESA_GL_VERSION_OVERRIDE to at least 3.2 where 3.1 will display garbage and 3.0 doesn't boot the core.

For example.

export MESA_GL_VERSION_OVERRIDE=3.2

or

export MESA_GL_VERSION_OVERRIDE=4.5

@orbea
Copy link
Contributor Author

orbea commented Mar 12, 2018

This also fixes it.

diff --git a/libretro-common/glsm/glsm.c b/libretro-common/glsm/glsm.c
index ab8c562..0f01a27 100644
--- a/libretro-common/glsm/glsm.c
+++ b/libretro-common/glsm/glsm.c
@@ -2207,7 +2207,7 @@ static bool glsm_state_ctx_init(void *data)
 #ifdef CORE
    hw_render.context_type       = RETRO_HW_CONTEXT_OPENGL_CORE;
    hw_render.version_major      = 3;
-   hw_render.version_minor      = 1;
+   hw_render.version_minor      = 3;
 #else
    hw_render.context_type       = RETRO_HW_CONTEXT_OPENGL;
 #endif

I think libretro-common probably shouldn't request a 3.1 core context?

An excerpt from #nouveau which was kind enough to help debug this.

11:57 <imirkin_> ok. so ACTUALLY ... i think this is a mesa bug.
11:58 <imirkin_> we probably see GLX_CONTEXT_PROFILE_MASK_ARB + GLX_CONTEXT_CORE_PROFILE_BIT_ARB and happily return the 3.1 compat context.
11:58 <imirkin_> we should not do that.
11:58 <karolherbst> imirkin_: you mean they request core + 3.1?
11:58 <karolherbst> and then we screw up?
11:58 <imirkin_> it's also a psx core bug, in that it should not be asking for a 3.1 core context, since that's not a thing.
11:58 <imirkin_> yes
11:59 <imirkin_> i haven't looked at the code
11:59 <imirkin_> but this seems plausible.
11:59 <karolherbst> well it makes sense

@orbea
Copy link
Contributor Author

orbea commented Mar 12, 2018

This seems to be really a mesa + libretro-common bug.

As far as libretro-common goes, it probably should not be hardcoded to 3.1 and should use the highest available core context.

retroarch --verbose

[INFO] [GLX]: Using Xinerama on screen #0.
[INFO] [GLX]: X = 0, Y = 0, W = 1680, H = 1050.
[INFO] [GLX]: Using windowed fullscreen.
[INFO] [GLX]: Found swap function: glXSwapIntervalMESA.
[INFO] [GLX]: glXSwapInterval(1)
[INFO] [GL]: Vendor: nouveau, Renderer: NVF1.
[INFO] [GL]: Version: 3.1 Mesa 18.1.0-devel (git-163a29099a).
$ glxinfo | grep Core
OpenGL core profile version string: 4.5 (Core Profile) Mesa 18.1.0-devel (git-163a29099a)

@ghost
Copy link

ghost commented Mar 12, 2018

How would you know what the highest available is?

@orbea
Copy link
Contributor Author

orbea commented Mar 12, 2018

I'm not sure yet, maybe I am misunderstanding the logs and its reporting the minimum available version and not the given context?

@orbea
Copy link
Contributor Author

orbea commented Mar 12, 2018

I know dolphin-emu reports that I have OpenGL 4.5 exposed correctly, maybe their code could offer clues?

@rz5
Copy link
Contributor

rz5 commented Mar 13, 2018

@Themaister - Mind taking a quick peek? Noveau devs suggest that requesting a core context in addition to specifying a 3.1 version number is an error.

@simias
Copy link
Collaborator

simias commented Mar 13, 2018

In the original rust code I request a CORE 3.3 context, I'm not sure why or when the requirement got lowered in beetle.

@orbea
Copy link
Contributor Author

orbea commented Mar 13, 2018

@rz5 I missed you on irc so I will reply here.

My understanding is that there are two issues here.

  1. beetle-psx is requesting a 3.1 context, getting one and then not liking it.
  2. mesa is going along with this even when it should have good reasons to not.

This is a result of there being a lot of confusion with 3.1 contexts and any application that wants a real core profile should request at least 3.2.

This is also a general mesa issue and not just nouveau. I confirmed already that it already occurs with the llvmpipe too, it would be helpful if anyone that has either mesa and amd or intel could also test this with the mesa git master.

@rz5
Copy link
Contributor

rz5 commented Mar 14, 2018

@twinaphex - Based on @simias's observation about the Rustation GL renderer being 3.3, then I propose we bump glsm.c's request up to at least match it since it's what beetle-psx's GL renderer is based on. This should be done at least after more info on this bug is found.

orbea pushed a commit to orbea/beetle-psx-libretro that referenced this issue Mar 19, 2018
There isn't a 3.1 core profile context and requesting one is wrong.
Recent mesa commits have revealed this as wrong and causes problems
for beetle-psx. A 3.3 OpenGL context is what beetle-psx originally
requested, but at some point this was lowered.

Fixes libretro#315
@orbea
Copy link
Contributor Author

orbea commented Mar 19, 2018

I've created a PR to raise it to 3.3 again. I'm not there is much more to discuss as far as beetle-psx is concerned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants