[Mesa-dev] [PATCH 09/18] android: build libGLES_mesa

Chad Versace chad at chad-versace.us
Thu Aug 18 07:14:07 PDT 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 08/17/2011 08:24 PM, Chia-I Wu wrote:
> On Thu, Aug 18, 2011 at 2:03 AM, Chad Versace <chad at chad-versace.us> wrote:
> I've commented below on TOP/Android.mk and TOP/Android.common.mk.
> The Gallium makefiles are outside of my domain, so I have no comments on those.
> 
> On 08/16/2011 11:28 PM, Chia-I Wu wrote:
>>>> This is the first step to integrate Mesa into Android(-x86) build
>>>> system.  You can git clone mesa under the external/ directory of Android
>>>> source tree and build Android with
>>>>
>>>>  $ make BOARD_GPU_DRIVERS=swrast
>>>>
>>>> It will build libGLES_mesa that will be loaded by Android runtime.
>>>>
>>>> libGLES_mesa is still a stub in this commit.
>>>> ---
>>>>  Android.common.mk                         |   48 ++++++++++++++++++
>>>>  Android.mk                                |   76 +++++++++++++++++++++++++++++
>>>>  src/gallium/Android.mk                    |   36 ++++++++++++++
>>>>  src/gallium/Android.template.mk           |   33 ++++++++++++
>>>>  src/gallium/targets/egl-static/Android.mk |   39 +++++++++++++++
>>>>  5 files changed, 232 insertions(+), 0 deletions(-)
>>>>  create mode 100644 Android.common.mk
>>>>  create mode 100644 Android.mk
>>>>  create mode 100644 src/gallium/Android.mk
>>>>  create mode 100644 src/gallium/Android.template.mk
>>>>  create mode 100644 src/gallium/targets/egl-static/Android.mk
>>>>
>>>> diff --git a/Android.common.mk b/Android.common.mk
>>>> new file mode 100644
>>>> index 0000000..c1e4cce
>>>> --- /dev/null
>>>> +++ b/Android.common.mk
>>>> @@ -0,0 +1,48 @@
>>>> +# Mesa 3-D graphics library
>>>> +# Version:  7.12
> 
> "Version 7.12" is misleading and should be removed from all the
> copyright headers in the series.
>> I will remove the version tag from all new files.
>>>> +#
>>>> +# Copyright (C) 2010-2011 Chia-I Wu <olvaffe at gmail.com>
>>>> +# Copyright (C) 2010-2011 LunarG Inc.
>>>> +#
>>>> +# Permission is hereby granted, free of charge, to any person obtaining a
>>>> +# copy of this software and associated documentation files (the "Software"),
>>>> +# to deal in the Software without restriction, including without limitation
>>>> +# the rights to use, copy, modify, merge, publish, distribute, sublicense,
>>>> +# and/or sell copies of the Software, and to permit persons to whom the
>>>> +# Software is furnished to do so, subject to the following conditions:
>>>> +#
>>>> +# The above copyright notice and this permission notice shall be included
>>>> +# in all copies or substantial portions of the Software.
>>>> +#
>>>> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
>>>> +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
>>>> +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
>>>> +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
>>>> +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
>>>> +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
>>>> +# DEALINGS IN THE SOFTWARE.
>>>> +
>>>> +LOCAL_C_INCLUDES += \
>>>> +     $(MESA_TOP)/include
>>>> +
>>>> +LOCAL_CFLAGS += \
>>>> +     -DPTHREADS \
>>>> +     -fvisibility=hidden \
>>>> +     -Wno-sign-compare
>>>> +
>>>> +ifeq ($(strip $(MESA_ENABLE_ASM)),true)
>>>> +ifeq ($(TARGET_ARCH),x86)
>>>> +LOCAL_CFLAGS += \
>>>> +     -DUSE_X86_ASM
>>>> +endif
>>>> +endif
>>>> +
>>>> +LOCAL_CPPFLAGS += \
>>>> +     -Wno-error=non-virtual-dtor \
>>>> +     -Wno-non-virtual-dtor
>>>> +
>>>> +#LOCAL_STRIP_MODULE := false
> 
> Did you intend to comment out this line? If you intend for it to
> remain commented-out in the file, then there should be a comment
> explaining why.
>> I will add a comment.  Uncomment it will leave the libraries
>> unstripped, easier for debugging.

Ah! That's good to know.

>>>>
>>>> +ifeq ($(strip $(LOCAL_MODULE_TAGS)),)
>>>> +LOCAL_MODULE_TAGS := optional
>>>> +endif
>>>> diff --git a/Android.mk b/Android.mk
>>>> new file mode 100644
>>>> index 0000000..8da5120
>>>> --- /dev/null
>>>> +++ b/Android.mk
>>>> @@ -0,0 +1,76 @@
>>>> +# Mesa 3-D graphics library
>>>> +# Version:  7.12
>>>> +#
>>>> +# Copyright (C) 2010-2011 Chia-I Wu <olvaffe at gmail.com>
>>>> +# Copyright (C) 2010-2011 LunarG Inc.
>>>> +#
>>>> +# Permission is hereby granted, free of charge, to any person obtaining a
>>>> +# copy of this software and associated documentation files (the "Software"),
>>>> +# to deal in the Software without restriction, including without limitation
>>>> +# the rights to use, copy, modify, merge, publish, distribute, sublicense,
>>>> +# and/or sell copies of the Software, and to permit persons to whom the
>>>> +# Software is furnished to do so, subject to the following conditions:
>>>> +#
>>>> +# The above copyright notice and this permission notice shall be included
>>>> +# in all copies or substantial portions of the Software.
>>>> +#
>>>> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
>>>> +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
>>>> +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
>>>> +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
>>>> +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
>>>> +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
>>>> +# DEALINGS IN THE SOFTWARE.
>>>> +
>>>> +# BOARD_GPU_DRIVERS should be defined.  The valid values are
>>>> +#
>>>> +#   classic drivers:
>>>> +#   gallium drivers: swrast
>>>> +#
>>>> +# The main target is libGLES_mesa.  There is no classic drivers yet.
>>>> +#
> 
> ---
>>>> +# The rules can be found in src/gallium/targets/Android.mk.
> ---
> This comment line is misleading. It implies that the build system is intended only for Gallium.
> Very soon the build system will also build non-Gallium drivers.

>> That is where libGLES_mesa is built even there is no Gallium driver.
>> When Gallium drivers are enabled, a set of static libraries will be
>> added to libGLES_mesa.  When non-Gallium drivers are enabled, another
>> set of static libraries will be added to.
> 
>> The most reasonable place for it would be src/egl/Android.mk.  But its
>> contents will be mostly about Gallium (winsys, pipe drivers, state
>> trackers, and etc.).  That is why it is in
>> gallium/targets/egl-static/.  Do you prefer to move it or is it
>> suffice if I add more comments to the top-level Android.mk?

Let's not make the Intel drivers second-class citizens in the build system ;)

The Intel drivers, their contents will *not* "be mostly about Gallium (winsys,
pipe drivers, state trackers, and etc)". Having libGLES be built in a
Gallium subdir, even when no Gallium drivers are being built, is *very* confusing.
Building it in src/egl is also confusing, because src/egl should build libEGL,
not libGLES.

libGLES should be built in same directory as it is currently being built by the
autoconf/Scons build, or it should be built at the toplevel. Also, the Gallium-
specific directories (winsys, pipe drivers, state trackers, etc) should only be
built when a Gallium driver is built.

>>>> +
>>>> +LOCAL_PATH := $(call my-dir)
>>>> +
>>>> +MESA_PYTHON2 := python
>>>> +
>>>> +MESA_TOP := $(LOCAL_PATH)
>>>> +DRM_TOP := external/drm
>>>> +DRM_GRALLOC_TOP := hardware/drm_gralloc
>>>> +
>>>> +MESA_COMMON_MK := $(MESA_TOP)/Android.common.mk
>>>> +
>>>> +SUBDIRS := \
>>>> +     $(LOCAL_PATH)/src/gallium/Android.mk
> 
> The gallium subdir should only be added if MESA_BUILD_GALLIUM is true.
>> The rules for libGLES_mesa is in gallium/targets/egl-static/.  See above.
>>>> +
>>>> +MESA_GPU_DRIVERS := $(BOARD_GPU_DRIVERS)
>>>> +
>>>> +classic_drivers :=
>>>> +gallium_drivers := swrast
>>>> +
>>>> +# warn about invalid drivers
>>>> +invalid_drivers := $(filter-out \
>>>> +     $(classic_drivers) $(gallium_drivers), $(MESA_GPU_DRIVERS))
>>>> +ifneq ($(invalid_drivers),)
>>>> +$(warning invalid GPU drivers: $(invalid_drivers))
>>>> +# tidy up
>>>> +MESA_GPU_DRIVERS := $(filter-out $(invalid_drivers), $(MESA_GPU_DRIVERS))
>>>> +endif
>>>> +
>>>> +# host and target must be the same arch to generate matypes.h
>>>> +ifeq ($(TARGET_ARCH),$(HOST_ARCH))
>>>> +MESA_ENABLE_ASM := true
>>>> +else
>>>> +MESA_ENABLE_ASM := false
>>>> +endif
>>>> +
>>>> +ifneq ($(filter $(gallium_drivers), $(MESA_GPU_DRIVERS)),)
>>>> +MESA_BUILD_GALLIUM := true
>>>> +else
>>>> +MESA_BUILD_GALLIUM := false
>>>> +endif
>>>> +
>>>> +ifneq ($(strip $(MESA_GPU_DRIVERS)),)
>>>> +include $(SUBDIRS)
>>>> +endif

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJOTR4vAAoJEAIvNt057x8i7tkQAInCCum5dcHhjiAjZHv561Nu
MLinqQM8gklQ4vazD6pOIcZxyc/sw8arSAzblrm62mjxK18HrXzbzbDv5NjirDWD
p2F3qQ803r0i5Oamh8LEC0Ab+qkB1eKF64asyeeT/2SVwvOlBm5XYQvKVgetMxcB
ea7iSHNcbejlanbBaVJ7lSQ2NF+NBGKMwp4BXXz3ZyMaYk7Knlw4XJn9JN4F/Pl/
MVxYZk43jsOGOxXX7EriBd8O+A3BzfOu9MLfdFuH0XCl+MKnhDYFohWyrMzkERrR
F43ZeWYpq0GjyvDCpXecysuoLmsRqNqhQOi4KRvCSP4QG6JkktH5Zuo/GfEA+k8t
pYL0ZjhGQOUCzVlYTR3hh9HzCoxpQx6sECNsShIttCcPfLW4e9D2r7ElT0SL+yzY
uTAqNj2Y+D49erFga8rncs3d8lREcPQSS308Rs3QHKEGa8i1bQZGseM1NPxv+OGI
PNP9oPBTg+fNYk1csNXmNYLaHT1gGv3qNAW8X4alQrFs36u8Vsdk63FqYpI4/NM7
ebT30Y82rpe3kTv8zj62c0PNtKWl6m6unqQIIAJBQdSh/XuaPv0Ji9YIo8eRQhGk
ZonDYkJ04ASKKxyVBzftgCbBSEhPNNvmtBXptrYrODXH+EIdKhM9pVLCHhJ+q4B6
os6w48xDd+bdxYYf/Fub
=yTAO
-----END PGP SIGNATURE-----


More information about the mesa-dev mailing list