[Mesa-dev] [PATCH 1/4] gbm: Add Android build support

Emil Velikov emil.l.velikov at gmail.com
Fri Apr 22 22:57:37 UTC 2016


Hi Rob,

On 22 April 2016 at 16:50, Rob Herring <robh at kernel.org> wrote:

> --- /dev/null
> +++ b/src/gbm/Android.mk

> +LOCAL_EXPORT_C_INCLUDE_DIRS := \
> +       $(LOCAL_PATH)/main
> +
You don't need this.

> +LOCAL_C_INCLUDES := \
> +       $(LOCAL_PATH)/main
> +
> +ifeq ($(MESA_LOLLIPOP_BUILD),true)
> +LOCAL_CFLAGS_32 := -DDEFAULT_DRIVER_DIR=\"/system/lib/$(MESA_DRI_MODULE_REL_PATH)\"
> +LOCAL_CFLAGS_64 := -DDEFAULT_DRIVER_DIR=\"/system/lib64/$(MESA_DRI_MODULE_REL_PATH)\"
> +else
> +LOCAL_CFLAGS += -DDEFAULT_DRIVER_DIR=\"/system/lib/$(MESA_DRI_MODULE_REL_PATH)\"
> +endif
> +
Can you factor out the existing copy from src/egl/Android.mk to
$(top)/Android.mk.
The following should work ... I think.

define set-default-driver-dir
   ifeq ($(MESA_LOLLIPOP_BUILD),true)
   LOCAL_CFLAGS_32 :=
-DDEFAULT_DRIVER_DIR=\"/system/lib/$(MESA_DRI_MODULE_REL_PATH)\"
   LOCAL_CFLAGS_64 :=
-DDEFAULT_DRIVER_DIR=\"/system/lib64/$(MESA_DRI_MODULE_REL_PATH)\"
   else
   LOCAL_CFLAGS +=
-DDEFAULT_DRIVER_DIR=\"/system/lib/$(MESA_DRI_MODULE_REL_PATH)\"
  endif

To use it
$(call set-default-driver-dir)

> +LOCAL_SHARED_LIBRARIES := libdrm
> +LOCAL_STATIC_LIBRARIES := libmesa_loader
> +LOCAL_MODULE := libgbm
> +
Nit: Please move these three after LOCAL_SRC_FILES.

> +LOCAL_SRC_FILES := \
> +       $(gbm_core_FILES) \
> +       $(gbm_dri_FILES)
> +
> +include $(MESA_COMMON_MK)
> +include $(BUILD_SHARED_LIBRARY)
> diff --git a/src/gbm/Makefile.am b/src/gbm/Makefile.am
> index 9a584ca..68dc8f2 100644
> --- a/src/gbm/Makefile.am
> +++ b/src/gbm/Makefile.am
> @@ -15,12 +15,7 @@ lib_LTLIBRARIES = libgbm.la

Add following line just after the license. Also please split out
autoconf changes (move the sources list to Makefile.sources) to a
separate patch.

include Makefile.sources


> --- /dev/null
> +++ b/src/gbm/Makefile.sources
> @@ -0,0 +1,12 @@
> +
Nit: Kill off this empty line.


> --- a/src/gbm/backends/dri/gbm_dri.c
> +++ b/src/gbm/backends/dri/gbm_dri.c
> @@ -341,6 +341,15 @@ dri_open_driver(struct gbm_dri_device *dri)
>        /* not need continue to loop all paths once the driver is found */
>        if (dri->driver != NULL)
>           break;
> +
> +#ifdef ANDROID
> +      snprintf(path, sizeof path, "%.*s/gallium_dri.so", len, p);
> +      dri->driver = dlopen(path, RTLD_NOW | RTLD_GLOBAL);
> +      if (dri->driver == NULL)
> +         sprintf("failed to open %s: %s\n", path, dlerror());
> +      else
> +         break;
> +#endif

And this should be separate commit. Unless you insist on re-factoring
these dri functions to a common place.

Thanks
Emil


More information about the mesa-dev mailing list