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

RFC: Use mesa gl with sgx #116

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions conf/distro/include/egl.inc
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,29 @@ SGX_USERLAND_LIBARIES ?= "ti-sgx-ddk-um"
# and it is safe to use with user space applications linked against Mesa.

def get_egl_handler(d, target):
""" Overloading the default EGL/GLES implementation."""
""" Overloading the default EGL/GLES/MESA implementation."""
features = d.getVar('MACHINE_FEATURES', True).split()

mali_libs = d.getVar('MALI_USERLAND_LIBARIES', True);
sgx_libs = d.getVar('SGX_USERLAND_LIBARIES', True);

if 'mali450' in features:
provider = mali_libs.split()[0]
if target == 'mesa' or target == 'libgl':
provider = "mesa"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what does this specific case correspond to? when would we use mesa if mali450 is in features?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mali450 driver is only binaries (libMali.so and the lib[gbm|EGL|GLES].so symlinks pointing to the former). So the process is essentially building mesa, and replacing the corresponding mesa binaries with the mali450's ones. So that the include and the pkgconfig files comes from mesa in the mali450 case.

The SGX driver comes with the relevant include and the *.pc files, and mesa-gl is the best fit there.

else:
provider = mali_libs.split()[0]
elif 'sgx' in features:
provider = sgx_libs.split()[0]
if target == 'mesa' or target == 'libgl':
provider = "mesa-gl"
else:
provider = sgx_libs.split()[0]
else:
provider = "mesa"

return provider;

PREFERRED_PROVIDER_virtual/libgl = "${@get_egl_handler(d, 'libgl')}"
PREFERRED_PROVIDER_virtual/egl = "${@get_egl_handler(d, 'egl')}"
PREFERRED_PROVIDER_virtual/libgles1 = "${@get_egl_handler(d, 'libgles1')}"
PREFERRED_PROVIDER_virtual/libgles2 = "${@get_egl_handler(d, 'libgles2')}"
PREFERRED_PROVIDER_virtual/mesa = "${@get_egl_handler(d, 'mesa')}"
1 change: 1 addition & 0 deletions recipes-graphics/mesa/mesa-gl_%.bbappend
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PACKAGES_remove = "${@bb.utils.contains("MACHINE_FEATURES", "sgx", "libgbm libgbm-dev", "", d)}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we should fix mesa recipe instead of this hack?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So producing empty libgbm and libgbm-dev instead of not building them at all is a bug in mesa - not the other's inability to handle empty packages. Then yes, fixing mesa is the most correct approach. Will try this. Thanks!