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

Add support for loading GL symbols using dlsym() instead of libretro API #150

Merged
merged 2 commits into from
Apr 10, 2020

Conversation

hhromic
Copy link
Contributor

@hhromic hhromic commented Feb 19, 2020

  • Required for platforms with EGL version < 1.5
  • To enable, use new compile-time define: -DGL_USE_DLSYM

Currently only enabled for Raspberry Pi platforms that use the legacy Broadcom driver.

@hhromic
Copy link
Contributor Author

hhromic commented Feb 19, 2020

Btw, is there a function to cleanly exit on error from gliden? Right now if the lib is not found it logs the error but the plugin will still crash afterwards. I assume exit() is no bueno here?

@hhromic hhromic changed the title Add support for loading GL symbols using dlsym/dlopen instead of libretro API Add support for loading GL symbols using dlsym() instead of libretro API Feb 19, 2020
@hhromic
Copy link
Contributor Author

hhromic commented Feb 19, 2020

New version of the PR now. I found out that dlsym() can be called with RTLD_DEFAULT as the handle parameter and will search symbols in all the linked libraries, including the GL lib. We don't need to supply a hard-coded path nor use dlopen()/dlclose() anymore thus greatly simplifying the fix.

RTLD_DEFAULT
Find the first occurrence of the desired symbol using the default shared object search order. The search will include global symbols in the executable and its dependencies, as well as symbols in shared objects that were dynamically loaded with the RTLD_GLOBAL flag.

@m4xw
Copy link
Collaborator

m4xw commented Apr 10, 2020

@hhromic Can you please target the 2.0.5-RC1 branch, then I can merge it (will need some changes for thr branch anyway)
Also please amend and remove the @ next to my name.

* Required for platforms with EGL version < 1.5
* To enable, use new compile-time define: `-DGL_USE_DLSYM`

Currently only enabled for Raspberry Pi platforms that use the legacy Broadcom driver.
@hhromic hhromic changed the base branch from develop to v2.0.5-RC1 April 10, 2020 13:37
@hhromic
Copy link
Contributor Author

hhromic commented Apr 10, 2020

@m4xw rebased and commit msg amended. Test pending.
I'm going to test this change and the v2.0.5-RC1 later tonight on my RPI3B with legacy drivers to confirm all is fine to merge. Thanks!

Ps: I never liked the YOLO_DLSYM name for the define, I think this core deserves seriousness in its variable names :) Therefore I renamed it to GL_USE_DLSYM. I hope you don't mind.

@m4xw
Copy link
Collaborator

m4xw commented Apr 10, 2020

Whatever works, just give me the go when you are ready.

@hhromic
Copy link
Contributor Author

hhromic commented Apr 10, 2020

Finished testing it now. All is working on RPI3B + Legacy Drivers 👍

I tested the rebased version (v2.0.5-RC1 branch) and the core is working pretty much as usual for this setup.

@m4xw m4xw merged commit 0ea1a6d into libretro:v2.0.5-RC1 Apr 10, 2020
@m4xw
Copy link
Collaborator

m4xw commented Apr 10, 2020

Ty

@hhromic hhromic deleted the dlsym-support branch April 10, 2020 20:33
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

Successfully merging this pull request may close these issues.

2 participants