From f140467b5b43bc30046aa57247897e68ae13707a Mon Sep 17 00:00:00 2001 From: Robert Foss Date: Tue, 22 Oct 2019 19:31:52 +0200 Subject: [PATCH] android: Add panfrost support to build scripts 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 Reviewed-By: Rohan Garg Reviewed-by: Alyssa Rosenzweig --- Android.mk | 5 +- src/gallium/Android.mk | 1 + src/gallium/drivers/panfrost/Android.mk | 59 ++++++++++++++++++ src/gallium/drivers/panfrost/Makefile.sources | 38 ++++++++++++ src/gallium/targets/dri/Android.mk | 6 +- src/panfrost/Android.bifrost.mk | 50 +++++++++++++++ src/panfrost/Android.encoder.mk | 42 +++++++++++++ src/panfrost/Android.midgard.mk | 61 +++++++++++++++++++ src/panfrost/Android.mk | 4 ++ src/panfrost/Android.pandecode.mk | 44 +++++++++++++ src/panfrost/Android.shared.mk | 2 +- src/panfrost/Makefile.sources | 56 +++++++++++++++++ 12 files changed, 364 insertions(+), 4 deletions(-) create mode 100644 src/gallium/drivers/panfrost/Android.mk create mode 100644 src/gallium/drivers/panfrost/Makefile.sources create mode 100644 src/panfrost/Android.bifrost.mk create mode 100644 src/panfrost/Android.encoder.mk create mode 100644 src/panfrost/Android.midgard.mk create mode 100644 src/panfrost/Android.pandecode.mk diff --git a/Android.mk b/Android.mk index 16e385e162b..19d9e1e0a74 100644 --- a/Android.mk +++ b/Android.mk @@ -24,7 +24,7 @@ # 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. @@ -61,7 +61,8 @@ gallium_drivers := \ 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))) diff --git a/src/gallium/Android.mk b/src/gallium/Android.mk index 37e923c225d..59ee0e0f68b 100644 --- a/src/gallium/Android.mk +++ b/src/gallium/Android.mk @@ -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 += winsys/panfrost/drm drivers/panfrost # 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 index 00000000000..c4b5bfd6d44 --- /dev/null +++ b/src/gallium/drivers/panfrost/Android.mk @@ -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 index 00000000000..5c1fc1f0a17 --- /dev/null +++ b/src/gallium/drivers/panfrost/Makefile.sources @@ -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 diff --git a/src/gallium/targets/dri/Android.mk b/src/gallium/targets/dri/Android.mk index 3059e839c00..fa69b708c13 100644 --- a/src/gallium/targets/dri/Android.mk +++ b/src/gallium/targets/dri/Android.mk @@ -57,7 +57,11 @@ endif 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 diff --git a/src/panfrost/Android.bifrost.mk b/src/panfrost/Android.bifrost.mk new file mode 100644 index 00000000000..d30ddfadf40 --- /dev/null +++ b/src/panfrost/Android.bifrost.mk @@ -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 index 00000000000..d913f45b177 --- /dev/null +++ b/src/panfrost/Android.encoder.mk @@ -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 index 00000000000..6c9cd4c18e9 --- /dev/null +++ b/src/panfrost/Android.midgard.mk @@ -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 diff --git a/src/panfrost/Android.mk b/src/panfrost/Android.mk index 9ab5ddf9fdf..e48f81071e6 100644 --- a/src/panfrost/Android.mk +++ b/src/panfrost/Android.mk @@ -25,4 +25,8 @@ 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.pandecode.mk diff --git a/src/panfrost/Android.pandecode.mk b/src/panfrost/Android.pandecode.mk new file mode 100644 index 00000000000..76c5ce9a763 --- /dev/null +++ b/src/panfrost/Android.pandecode.mk @@ -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 diff --git a/src/panfrost/Android.shared.mk b/src/panfrost/Android.shared.mk index 6b921756ecb..81024607eeb 100644 --- a/src/panfrost/Android.shared.mk +++ b/src/panfrost/Android.shared.mk @@ -33,7 +33,7 @@ LOCAL_SRC_FILES := \ LOCAL_C_INCLUDES := \ $(MESA_TOP)/src/gallium/auxiliary/ \ - $(MESA_TOP)/src/gallium/include/ \ + $(MESA_TOP)/src/gallium/include/ LOCAL_STATIC_LIBRARIES := \ diff --git a/src/panfrost/Makefile.sources b/src/panfrost/Makefile.sources index 3ab90f27913..5b2535bc42a 100644 --- a/src/panfrost/Makefile.sources +++ b/src/panfrost/Makefile.sources @@ -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 + +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 -- 2.30.2