RPI: update vendor library names & add Mesa VC4 build support

Vendor library has new names to avoid conflicts with Mesa. Update
raspberrypi argument to use new libraries and support Mesa VC4 driver.

* raspberrypi=1 will build against the (newly named) vendor libraries
* raspberrypi=mesa will target building against the VC4 driver.

Both will select GLES by default, but you can target GL for the VC4 driver
via "raspberrypi=mesa opengles=0"
This commit is contained in:
Conn O'Griofa 2017-10-17 00:00:17 +01:00
parent 171e87a1e7
commit 166b1ecd4d
3 changed files with 56 additions and 11 deletions

View file

@ -2806,6 +2806,7 @@ class DXXCommon(LazyObjectConstructor):
# Paths for the Videocore libs/includes on the Raspberry Pi
RPI_DEFAULT_VC_PATH='/opt/vc'
default_OGLES_LIB = 'GLES_CM'
default_EGL_LIB = 'EGL'
_default_prefix = '/usr/local'
__stdout_is_not_a_tty = None
__has_git_dir = None
@ -2853,7 +2854,7 @@ class DXXCommon(LazyObjectConstructor):
return self.debug
# automatic setup for raspberrypi
def default_opengles(self):
if self.raspberrypi:
if self.raspberrypi in ('yes', 'mesa'):
return True
return False
@classmethod
@ -2869,11 +2870,17 @@ class DXXCommon(LazyObjectConstructor):
cls.__stdout_is_not_a_tty = r = False if isatty is None else not isatty()
return r
def default_words_need_alignment(self):
return self.raspberrypi
if self.raspberrypi in ('yes', 'mesa'):
return True
return False
def selected_OGLES_LIB(self):
if self.raspberrypi:
return 'GLESv2'
if self.raspberrypi == 'yes':
return 'brcmGLESv2'
return self.default_OGLES_LIB
def selected_EGL_LIB(self):
if self.raspberrypi == 'yes':
return 'brcmEGL'
return self.default_EGL_LIB
def __default_DATA_DIR(self):
return '%s/share/games/%s' % (self.prefix, self._program.target)
def _generic_variable(key,help,default):
@ -2928,11 +2935,16 @@ class DXXCommon(LazyObjectConstructor):
) for t in tests
],
},
{
'variable': EnumVariable,
'arguments': (
('raspberrypi', None, 'build for Raspberry Pi (automatically selects opengles)', {'ignorecase': 1, 'map': {'1':'yes', 'true':'yes', '0':'no', 'false':'no'}, 'allowed_values': ('yes', 'no', 'mesa')}),
),
},
{
'variable': BoolVariable,
'arguments': (
('record_sconf_results', False, 'write sconf results to dxxsconf.h'),
('raspberrypi', False, 'build for Raspberry Pi (automatically sets opengles and opengles_lib)'),
('git_describe_version', self.__get_has_git_dir(), 'include git --describe in extra_version'),
('git_status', True, 'include git status'),
('versid_depend_all', False, 'rebuild vers_id.cpp if any object file changes'),
@ -2943,6 +2955,7 @@ class DXXCommon(LazyObjectConstructor):
'arguments': (
('rpi_vc_path', self.RPI_DEFAULT_VC_PATH, 'directory for RPi VideoCore libraries'),
('opengles_lib', self.selected_OGLES_LIB, 'name of the OpenGL ES library to link against'),
('egl_lib', self.selected_EGL_LIB, 'name of the OpenGL ES Graphics Library to link against'),
('prefix', self._default_prefix, 'installation prefix directory (Linux only)'),
('sharepath', self.__default_DATA_DIR, 'directory for shared game data (Linux only)'),
),
@ -3170,7 +3183,7 @@ class DXXCommon(LazyObjectConstructor):
@property
def ogllibs(self):
user_settings = self.user_settings
return (user_settings.opengles_lib, 'EGL') if user_settings.opengles else ('GL', 'GLU')
return (user_settings.opengles_lib, user_settings.egl_lib) if user_settings.opengles else ('GL', 'GLU')
@staticmethod
def get_platform_objects(_empty=()):
return _empty
@ -3490,7 +3503,7 @@ class DXXCommon(LazyObjectConstructor):
env.Prepend(CXXFLAGS = ['-g', '-O2'])
# Raspberry Pi?
if user_settings.raspberrypi:
if user_settings.raspberrypi == 'yes':
rpi_vc_path = user_settings.rpi_vc_path
message(self, "Raspberry Pi: using VideoCore libs in %r" % rpi_vc_path)
env.Append(

View file

@ -9,13 +9,29 @@ packages, debain/raspbian do so for sure. Using a distribution with hardfp ABI
is recommended for optimal performance. I developed/tested this on a raspbian
wheezy.
To build directly on the device, just run:
Multiple build configurations are possible for the Pi, depending on whether you
wish to use the legacy vendor graphics driver or experimental Mesa VC4 driver.
scons raspberrypi=1 [... other options (see scons -h)...]
To build against the legacy vendor graphics driver (recommended for most users):
scons raspberrypi=1
If you're using a firmware release older than 1.20160921-1, it's highly
recommended that you upgrade, but if that's not an option, you must manually
specify the original GLES/EGL library names:
scons raspberrypi=1 egl_lib=EGL opengles_lib=GLESv2
This assumes that the development files (libs/headers) for the VideoCore APIs
are located in /opt/vc. You can use rpi_vc_path to specify another location.
If you wish to build against the experimental Mesa VC4 driver, use:
scons raspberrypi=mesa
This will select the GLES interface by default, but you can select OpenGL by
adding opengles=0. For all other options, check "scons -h".
Currently, there is no direct support for crosscompiling.
RUNNING:

View file

@ -9,13 +9,29 @@ packages, debain/raspbian do so for sure. Using a distribution with hardfp ABI
is recommended for optimal performance. I developed/tested this on a raspbian
wheezy.
To build directly on the device, just run:
Multiple build configurations are possible for the Pi, depending on whether you
wish to use the legacy vendor graphics driver or experimental Mesa VC4 driver.
scons raspberrypi=1 [... other options (see scons -h)...]
To build against the legacy vendor graphics driver (recommended for most users):
scons raspberrypi=1
If you're using a firmware release older than 1.20160921-1, it's highly
recommended that you upgrade, but if that's not an option, you must manually
specify the original GLES/EGL library names:
scons raspberrypi=1 egl_lib=EGL opengles_lib=GLESv2
This assumes that the development files (libs/headers) for the VideoCore APIs
are located in /opt/vc. You can use rpi_vc_path to specify another location.
If you wish to build against the experimental Mesa VC4 driver, use:
scons raspberrypi=mesa
This will select the GLES interface by default, but you can select OpenGL by
adding opengles=0. For all other options, check "scons -h".
Currently, there is no direct support for crosscompiling.
RUNNING: