android: Add panfrost support to build scripts
authorRobert Foss <robert.foss@collabora.com>
Tue, 22 Oct 2019 17:31:52 +0000 (19:31 +0200)
committerRobert Foss <robert.foss@collabora.com>
Thu, 31 Oct 2019 09:03:54 +0000 (10:03 +0100)
Currently the Android build system doesn't expose the panfrost
driver.

This patch enables the panfrost driver to be build on for the
Android platform.

Signed-off-by: Robert Foss <robert.foss@collabora.com>
Reviewed-By: Rohan Garg <rohan.garg@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
12 files changed:
Android.mk
src/gallium/Android.mk
src/gallium/drivers/panfrost/Android.mk [new file with mode: 0644]
src/gallium/drivers/panfrost/Makefile.sources [new file with mode: 0644]
src/gallium/targets/dri/Android.mk
src/panfrost/Android.bifrost.mk [new file with mode: 0644]
src/panfrost/Android.encoder.mk [new file with mode: 0644]
src/panfrost/Android.midgard.mk [new file with mode: 0644]
src/panfrost/Android.mk
src/panfrost/Android.pandecode.mk [new file with mode: 0644]
src/panfrost/Android.shared.mk
src/panfrost/Makefile.sources

index 16e385e162b73cf60f03c4d2707012cdd676f50a..19d9e1e0a748459113451b6ffdbf0651fbcc6769 100644 (file)
@@ -24,7 +24,7 @@
 # BOARD_GPU_DRIVERS should be defined.  The valid values are
 #
 #   classic drivers: i915 i965
 # BOARD_GPU_DRIVERS should be defined.  The valid values are
 #
 #   classic drivers: i915 i965
-#   gallium drivers: swrast freedreno i915g nouveau kmsro r300g r600g radeonsi vc4 virgl vmwgfx etnaviv iris lima
+#   gallium drivers: swrast freedreno i915g nouveau kmsro r300g r600g radeonsi vc4 virgl vmwgfx etnaviv iris lima panfrost
 #
 # The main target is libGLES_mesa.  For each classic driver enabled, a DRI
 # module will also be built.  DRI modules will be loaded by libGLES_mesa.
 #
 # The main target is libGLES_mesa.  For each classic driver enabled, a DRI
 # module will also be built.  DRI modules will be loaded by libGLES_mesa.
@@ -61,7 +61,8 @@ gallium_drivers := \
        virgl.HAVE_GALLIUM_VIRGL \
        etnaviv.HAVE_GALLIUM_ETNAVIV \
        iris.HAVE_GALLIUM_IRIS \
        virgl.HAVE_GALLIUM_VIRGL \
        etnaviv.HAVE_GALLIUM_ETNAVIV \
        iris.HAVE_GALLIUM_IRIS \
-       lima.HAVE_GALLIUM_LIMA
+       lima.HAVE_GALLIUM_LIMA \
+       panfrost.HAVE_GALLIUM_PANFROST
 
 ifeq ($(BOARD_GPU_DRIVERS),all)
 MESA_BUILD_CLASSIC := $(filter HAVE_%, $(subst ., , $(classic_drivers)))
 
 ifeq ($(BOARD_GPU_DRIVERS),all)
 MESA_BUILD_CLASSIC := $(filter HAVE_%, $(subst ., , $(classic_drivers)))
index 37e923c225d2035a9ad54070c13f652c0ec2d50b..59ee0e0f68b6e479cadbd5d52310d36c9c70a611 100644 (file)
@@ -49,6 +49,7 @@ SUBDIRS += winsys/etnaviv/drm drivers/etnaviv drivers/renderonly
 SUBDIRS += state_trackers/dri
 SUBDIRS += winsys/iris/drm drivers/iris
 SUBDIRS += winsys/lima/drm drivers/lima
 SUBDIRS += state_trackers/dri
 SUBDIRS += winsys/iris/drm drivers/iris
 SUBDIRS += winsys/lima/drm drivers/lima
+SUBDIRS += winsys/panfrost/drm drivers/panfrost
 
 # sort to eliminate any duplicates
 INC_DIRS := $(call all-named-subdir-makefiles,$(sort $(SUBDIRS)))
 
 # sort to eliminate any duplicates
 INC_DIRS := $(call all-named-subdir-makefiles,$(sort $(SUBDIRS)))
diff --git a/src/gallium/drivers/panfrost/Android.mk b/src/gallium/drivers/panfrost/Android.mk
new file mode 100644 (file)
index 0000000..c4b5bfd
--- /dev/null
@@ -0,0 +1,59 @@
+# Copyright © 2019 Collabora Ltd.
+#
+# 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_PATH := $(call my-dir)
+
+# get C_SOURCES
+include $(LOCAL_PATH)/Makefile.sources
+
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := \
+       $(C_SOURCES)
+
+LOCAL_C_INCLUDES := \
+       $(MESA_TOP)/src/gallium/auxiliary/ \
+       $(MESA_TOP)/src/gallium/include/ \
+       $(MESA_TOP)/src/panfrost/include/ \
+       $(MESA_TOP)/src/panfrost/
+
+LOCAL_MODULE := libmesa_pipe_panfrost
+
+LOCAL_SHARED_LIBRARIES := libdrm
+
+LOCAL_STATIC_LIBRARIES := \
+       libmesa_nir \
+    libmesa_winsys_panfrost \
+       libpanfrost_bifrost \
+       libpanfrost_decode \
+       libpanfrost_encoder \
+       libpanfrost_midgard \
+       libpanfrost_shared
+
+LOCAL_MODULE_CLASS := STATIC_LIBRARIES
+
+include $(GALLIUM_COMMON_MK)
+include $(BUILD_STATIC_LIBRARY)
+
+ifneq ($(HAVE_GALLIUM_PANFROST),)
+GALLIUM_TARGET_DRIVERS += panfrost
+$(eval GALLIUM_LIBS += $(LOCAL_MODULE) libmesa_winsys_panfrost)
+$(eval GALLIUM_SHARED_LIBS += $(LOCAL_SHARED_LIBRARIES))
+endif
diff --git a/src/gallium/drivers/panfrost/Makefile.sources b/src/gallium/drivers/panfrost/Makefile.sources
new file mode 100644 (file)
index 0000000..5c1fc1f
--- /dev/null
@@ -0,0 +1,38 @@
+C_SOURCES := \
+       nir/nir_lower_blend.c \
+       nir/nir_lower_blend.h \
+       nir/nir_lower_framebuffer.c \
+       nir/nir_undef_to_zero.c \
+    \
+       pan_afbc.c \
+       pan_allocate.c \
+       pan_allocate.h \
+       pan_assemble.c \
+       pan_blend_cso.c \
+       pan_blend.h \
+       pan_blending.c \
+       pan_blending.h \
+       pan_blend_shaders.c \
+       pan_blend_shaders.h \
+       pan_blit.c \
+       pan_bo.c \
+       pan_bo.h \
+       pan_compute.c \
+       pan_context.c \
+       pan_context.h \
+       pan_format.c \
+       pan_format.h \
+       pan_fragment.c \
+       pan_instancing.c \
+       pan_job.c \
+       pan_job.h \
+       pan_mfbd.c \
+       pan_public.h \
+       pan_resource.c \
+       pan_resource.h \
+       pan_scoreboard.c \
+       pan_screen.c \
+       pan_screen.h \
+       pan_sfbd.c \
+       pan_util.h \
+       pan_varyings.c
index 3059e839c007154ece8d5ca73b1f5a2610785bd6..fa69b708c13385aa1481a37b1b79664f7adbcb30 100644 (file)
@@ -57,7 +57,11 @@ endif
 LOCAL_STATIC_LIBRARIES += \
        libfreedreno_drm \
        libfreedreno_ir3 \
 LOCAL_STATIC_LIBRARIES += \
        libfreedreno_drm \
        libfreedreno_ir3 \
-       libpanfrost_shared \
+       libpanfrost_bifrost \
+       libpanfrost_decode \
+       libpanfrost_encoder \
+       libpanfrost_midgard \
+       libpanfrost_shared
 
 ifeq ($(USE_LIBBACKTRACE),true)
        LOCAL_SHARED_LIBRARIES += libbacktrace
 
 ifeq ($(USE_LIBBACKTRACE),true)
        LOCAL_SHARED_LIBRARIES += libbacktrace
diff --git a/src/panfrost/Android.bifrost.mk b/src/panfrost/Android.bifrost.mk
new file mode 100644 (file)
index 0000000..d30ddfa
--- /dev/null
@@ -0,0 +1,50 @@
+# Copyright © 2019 Collabora Ltd.
+#
+# 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.
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libpanfrost_bifrost
+
+LOCAL_SRC_FILES := \
+       $(bifrost_FILES)
+
+LOCAL_C_INCLUDES := \
+       $(MESA_TOP)/include \
+       $(MESA_TOP)/src/compiler/nir/ \
+       $(MESA_TOP)/src/gallium/auxiliary/ \
+       $(MESA_TOP)/src/gallium/include/ \
+       $(MESA_TOP)/src/mapi/ \
+       $(MESA_TOP)/src/mesa/ \
+       $(MESA_TOP)/src/panfrost/bifrost/ \
+       $(MESA_TOP)/src/panfrost/include/
+
+LOCAL_STATIC_LIBRARIES := \
+       libmesa_glsl \
+       libmesa_nir \
+       libmesa_st_mesa
+
+LOCAL_GENERATED_SOURCES := \
+       $(MESA_GEN_GLSL_H)
+
+LOCAL_EXPORT_C_INCLUDE_DIRS := \
+       $(MESA_TOP)/src/panfrost/bifrost/ \
+
+include $(MESA_COMMON_MK)
+include $(BUILD_STATIC_LIBRARY)
\ No newline at end of file
diff --git a/src/panfrost/Android.encoder.mk b/src/panfrost/Android.encoder.mk
new file mode 100644 (file)
index 0000000..d913f45
--- /dev/null
@@ -0,0 +1,42 @@
+# Copyright © 2019 Collabora Ltd.
+#
+# 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.
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libpanfrost_encoder
+
+LOCAL_SRC_FILES := \
+       $(encoder_FILES)
+
+LOCAL_C_INCLUDES := \
+       $(MESA_TOP)/src/gallium/auxiliary/ \
+       $(MESA_TOP)/src/gallium/include/ \
+       $(MESA_TOP)/src/panfrost/encoder/ \
+       $(MESA_TOP)/src/panfrost/include/
+
+LOCAL_STATIC_LIBRARIES := \
+
+LOCAL_GENERATED_SOURCES := \
+
+LOCAL_EXPORT_C_INCLUDE_DIRS := \
+       $(MESA_TOP)/src/panfrost/encoder/ \
+
+include $(MESA_COMMON_MK)
+include $(BUILD_STATIC_LIBRARY)
\ No newline at end of file
diff --git a/src/panfrost/Android.midgard.mk b/src/panfrost/Android.midgard.mk
new file mode 100644 (file)
index 0000000..6c9cd4c
--- /dev/null
@@ -0,0 +1,61 @@
+# Copyright © 2019 Collabora Ltd.
+#
+# 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.
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libpanfrost_midgard
+LOCAL_MODULE_CLASS := STATIC_LIBRARIES
+intermediates := $(call local-generated-sources-dir)
+
+LOCAL_SRC_FILES := \
+       $(midgard_FILES)
+
+LOCAL_GENERATED_SOURCES := \
+       $(MESA_GEN_GLSL_H) \
+       $(intermediates)/midgard_nir_algebraic.c
+
+LOCAL_C_INCLUDES := \
+       $(MESA_TOP)/include \
+       $(MESA_TOP)/src/compiler/nir/ \
+       $(MESA_TOP)/src/gallium/auxiliary/ \
+       $(MESA_TOP)/src/gallium/include/ \
+       $(MESA_TOP)/src/mapi/ \
+       $(MESA_TOP)/src/mesa/ \
+       $(MESA_TOP)/src/panfrost/include/ \
+       $(MESA_TOP)/src/panfrost/midgard/
+
+LOCAL_STATIC_LIBRARIES := \
+       libmesa_glsl \
+       libmesa_nir \
+       libmesa_st_mesa
+
+midgard_nir_algebraic_gen := $(LOCAL_PATH)/midgard/midgard_nir_algebraic.py
+midgard_nir_algebraic_deps := \
+       $(MESA_TOP)/src/compiler/nir/
+
+$(intermediates)/midgard_nir_algebraic.c: $(midgard_nir_algebraic_deps)
+       @mkdir -p $(dir $@)
+       $(hide) $(MESA_PYTHON2) $(midgard_nir_algebraic_gen) -p $< > $@
+
+LOCAL_EXPORT_C_INCLUDE_DIRS := \
+       $(MESA_TOP)/src/panfrost/midgard/ \
+
+include $(MESA_COMMON_MK)
+include $(BUILD_STATIC_LIBRARY)
\ No newline at end of file
index 9ab5ddf9fdf4fce60b9811537a15914ecb232bee..e48f81071e6929eaca2542285930fd46561b7f95 100644 (file)
@@ -25,4 +25,8 @@
 LOCAL_PATH := $(call my-dir)
 
 include $(LOCAL_PATH)/Makefile.sources
 LOCAL_PATH := $(call my-dir)
 
 include $(LOCAL_PATH)/Makefile.sources
+include $(LOCAL_PATH)/Android.bifrost.mk
+include $(LOCAL_PATH)/Android.encoder.mk
+include $(LOCAL_PATH)/Android.midgard.mk
 include $(LOCAL_PATH)/Android.shared.mk
 include $(LOCAL_PATH)/Android.shared.mk
+include $(LOCAL_PATH)/Android.pandecode.mk
diff --git a/src/panfrost/Android.pandecode.mk b/src/panfrost/Android.pandecode.mk
new file mode 100644 (file)
index 0000000..76c5ce9
--- /dev/null
@@ -0,0 +1,44 @@
+# Copyright © 2019 Collabora Ltd.
+#
+# 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.
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libpanfrost_decode
+
+LOCAL_SRC_FILES := \
+       $(pandecode_FILES)
+
+LOCAL_C_INCLUDES := \
+       $(MESA_TOP)/src/gallium/auxiliary/ \
+       $(MESA_TOP)/src/gallium/include/ \
+       $(MESA_TOP)/src/panfrost/include/ \
+       $(MESA_TOP)/src/panfrost/encoder/ \
+       $(MESA_TOP)/src/panfrost/pandecode/
+
+LOCAL_STATIC_LIBRARIES := \
+       libpanfrost_encoder
+
+LOCAL_GENERATED_SOURCES := \
+
+LOCAL_EXPORT_C_INCLUDE_DIRS := \
+       $(MESA_TOP)/src/panfrost/pandecode/ \
+
+include $(MESA_COMMON_MK)
+include $(BUILD_STATIC_LIBRARY)
\ No newline at end of file
index 6b921756ecb874386300d20962b636d65db8ac60..81024607eebc6c2125c00a90274d70019f79137d 100644 (file)
@@ -33,7 +33,7 @@ LOCAL_SRC_FILES := \
 
 LOCAL_C_INCLUDES := \
        $(MESA_TOP)/src/gallium/auxiliary/ \
 
 LOCAL_C_INCLUDES := \
        $(MESA_TOP)/src/gallium/auxiliary/ \
-       $(MESA_TOP)/src/gallium/include/ \
+       $(MESA_TOP)/src/gallium/include/
 
 LOCAL_STATIC_LIBRARIES := \
 
 
 LOCAL_STATIC_LIBRARIES := \
 
index 3ab90f27913458baacf6e2bf1a74ee2e70d3d02b..5b2535bc42aba019cfddadd4c8e210fbeb0a5f40 100644 (file)
@@ -1,3 +1,59 @@
+bifrost_FILES := \
+        bifrost/bifrost_compile.c \
+        bifrost/bifrost_compile.h \
+        bifrost/bifrost.h \
+        bifrost/bifrost_ops.h \
+        bifrost/bifrost_opts.c \
+        bifrost/bifrost_opts.h \
+        bifrost/bifrost_print.c \
+        bifrost/bifrost_print.h \
+        bifrost/bifrost_sched.c \
+        bifrost/bifrost_sched.h \
+        bifrost/cmdline.c \
+        bifrost/compiler_defines.h \
+        bifrost/disassemble.c \
+        bifrost/disassemble.h
+
+encoder_FILES := \
+        encoder/pan_encoder.h \
+        encoder/pan_invocation.c \
+        encoder/pan_tiler.c
+
+midgard_FILES := \
+        midgard/compiler.h \
+        midgard/disassemble.c \
+        midgard/disassemble.h \
+        midgard/helpers.h \
+        midgard/midgard_compile.c \
+        midgard/midgard_compile.h \
+        midgard/midgard_derivatives.c \
+        midgard/midgard_emit.c \
+        midgard/midgard.h \
+        midgard/midgard_liveness.c \
+        midgard/midgard_nir.h \
+        midgard/midgard_ops.c \
+        midgard/midgard_ops.h \
+        midgard/midgard_opt_copy_prop.c \
+        midgard/midgard_opt_dce.c \
+        midgard/midgard_opt_float.c \
+        midgard/midgard_opt_invert.c \
+        midgard/midgard_opt_perspective.c \
+        midgard/midgard-parse.h \
+        midgard/midgard_print.c \
+        midgard/midgard_ra.c \
+        midgard/midgard_ra_pipeline.c \
+        midgard/midgard_schedule.c \
+        midgard/mir.c \
+        midgard/mir_promote_uniforms.c
+
 shared_FILES := \
         shared/pan_tiling.c \
         shared/pan_tiling.h
 shared_FILES := \
         shared/pan_tiling.c \
         shared/pan_tiling.h
+
+pandecode_FILES := \
+        pandecode/common.c \
+        pandecode/decode.c \
+        pandecode/decode.h \
+        pandecode/pan_pretty_print.c \
+        pandecode/pan_pretty_print.h \
+        pandecode/public.h
\ No newline at end of file