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

Chia-I Wu olvaffe at gmail.com
Wed Aug 17 20:24:00 PDT 2011


On Thu, Aug 18, 2011 at 2:03 AM, Chad Versace <chad at chad-versace.us> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> 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.

>>
>> +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?

>> +
>> +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
>
> - --
> Chad Versace
> chad at chad-versace.us
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.11 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iQIcBAEBAgAGBQJOTAJ4AAoJEAIvNt057x8ilcAP/0wvxg/hUFAE/96bCsSDFjsB
> 5pl7KdyGpV7UyS71gpTSa/+P79zXRFqLb7+eXNTkApIyVn4G6XhDmhzaU0oLVlGT
> Y/HFN3rX61ouzdoUQ9vJ2DhagL/fD3sLNEtb4Ly760i+Ek/sownADABIj2fI1qSr
> H26XluLv5zRfTgxjJHo+MBsRvYbyme+Y34/ePVDjDkyUhBMiIP0IInBDLrUGWdEy
> 0O7FDJ8ANRW6inZhboYY4uh/SPU/QwTRmFtUdNz3gvX7ZqL1QC1wZAGmAE33HUDC
> xy3hRyCA5rWQ1OPfPalwwvfwijZ4z9F2/WM5TU/Pm3gUEmiBFFDNq/BnFqzG1ccn
> eGbjtmdlo7MLvK8ol5ImAcv5C4GMRUysmz8AOKsKgpYegrnmCWZwxXuG5OOcQUoC
> Szeiy8T34ZcMcNO778YrKGTKE7pBlVAb1BxCL5J5Czsxn1IYLXMKYOJIzRloUMPA
> xVMwHAhORcJ6cvqbirL812PIVKUkBqYRovtrAB7HUiGFipMTb7h6pCsUzODNspbq
> DWq2+Rp9WE5lYzbOrZ3EeB8fWu8DW9cF0SBuffahtOoPQGb9xhGOka1Zp9rigMVu
> PZsISoOR/A2qbQnnbqTcHBL1SBtSXABBWhyPrR923pGpZGyEMCBJ9RXymBIUgHyB
> o6hWE3k/EiSVkfI5i7nr
> =qXo/
> -----END PGP SIGNATURE-----
>



-- 
olv at LunarG.com


More information about the mesa-dev mailing list