Similar configuration to the iMX platform, but interfaces with the armada-drm driver.
Signed-off-by: Kyle Russell <bkyleruss...@gmail.com> --- configure.ac | 12 +++++++++- meson.build | 6 ++++- meson_options.txt | 2 +- src/gallium/Makefile.am | 4 ++++ .../auxiliary/pipe-loader/pipe_loader_drm.c | 5 ++++ .../auxiliary/target-helpers/drm_helper.h | 23 ++++++++++++++++++ .../target-helpers/drm_helper_public.h | 3 +++ src/gallium/drivers/armada/Automake.inc | 9 +++++++ src/gallium/drivers/armada/Makefile.am | 8 +++++++ src/gallium/meson.build | 5 ++++ src/gallium/targets/dri/Makefile.am | 1 + src/gallium/targets/dri/meson.build | 3 ++- src/gallium/targets/dri/target.c | 1 + src/gallium/winsys/armada/drm/Makefile.am | 11 +++++++++ .../winsys/armada/drm/Makefile.sources | 3 +++ .../winsys/armada/drm/armada_drm_public.h | 8 +++++++ .../winsys/armada/drm/armada_drm_winsys.c | 24 +++++++++++++++++++ src/gallium/winsys/armada/drm/meson.build | 14 +++++++++++ 18 files changed, 138 insertions(+), 4 deletions(-) create mode 100644 src/gallium/drivers/armada/Automake.inc create mode 100644 src/gallium/drivers/armada/Makefile.am create mode 100644 src/gallium/winsys/armada/drm/Makefile.am create mode 100644 src/gallium/winsys/armada/drm/Makefile.sources create mode 100644 src/gallium/winsys/armada/drm/armada_drm_public.h create mode 100644 src/gallium/winsys/armada/drm/armada_drm_winsys.c create mode 100644 src/gallium/winsys/armada/drm/meson.build diff --git a/configure.ac b/configure.ac index c7473d77eff..a6c3fa19852 100644 --- a/configure.ac +++ b/configure.ac @@ -1408,7 +1408,7 @@ GALLIUM_DRIVERS_DEFAULT="r300,r600,svga,swrast" AC_ARG_WITH([gallium-drivers], [AS_HELP_STRING([--with-gallium-drivers@<:@=DIRS...@:>@], [comma delimited Gallium drivers list, e.g. - "i915,nouveau,r300,r600,radeonsi,freedreno,pl111,svga,swrast,swr,tegra,v3d,vc4,virgl,etnaviv,imx" + "i915,nouveau,r300,r600,radeonsi,freedreno,pl111,svga,swrast,swr,tegra,v3d,vc4,virgl,etnaviv,imx,armada" @<:@default=r300,r600,svga,swrast@:>@])], [with_gallium_drivers="$withval"], [with_gallium_drivers="$GALLIUM_DRIVERS_DEFAULT"]) @@ -2747,6 +2747,9 @@ if test -n "$with_gallium_drivers"; then HAVE_GALLIUM_TEGRA=yes require_libdrm "tegra" ;; + xarmada) + HAVE_GALLIUM_ARMADA=yes + ;; xswrast) HAVE_GALLIUM_SOFTPIPE=yes if test "x$enable_llvm" = xyes; then @@ -2867,6 +2870,10 @@ if test "x$HAVE_GALLIUM_ETNAVIV" != xyes -a "x$HAVE_GALLIUM_IMX" = xyes ; then AC_MSG_ERROR([Building with imx requires etnaviv]) fi +if test "x$HAVE_GALLIUM_ETNAVIV" != xyes -a "x$HAVE_GALLIUM_ARMADA" = xyes ; then + AC_MSG_ERROR([Building with armada requires etnaviv]) +fi + if test "x$HAVE_GALLIUM_VC4" != xyes -a "x$HAVE_GALLIUM_PL111" = xyes ; then AC_MSG_ERROR([Building with pl111 requires vc4]) fi @@ -2973,6 +2980,7 @@ AM_CONDITIONAL(HAVE_GALLIUM_NOUVEAU, test "x$HAVE_GALLIUM_NOUVEAU" = xyes) AM_CONDITIONAL(HAVE_GALLIUM_FREEDRENO, test "x$HAVE_GALLIUM_FREEDRENO" = xyes) AM_CONDITIONAL(HAVE_GALLIUM_ETNAVIV, test "x$HAVE_GALLIUM_ETNAVIV" = xyes) AM_CONDITIONAL(HAVE_GALLIUM_IMX, test "x$HAVE_GALLIUM_IMX" = xyes) +AM_CONDITIONAL(HAVE_GALLIUM_ARMADA, test "x$HAVE_GALLIUM_ARMADA" = xyes) AM_CONDITIONAL(HAVE_GALLIUM_TEGRA, test "x$HAVE_GALLIUM_TEGRA" = xyes) AM_CONDITIONAL(HAVE_GALLIUM_SOFTPIPE, test "x$HAVE_GALLIUM_SOFTPIPE" = xyes) AM_CONDITIONAL(HAVE_GALLIUM_LLVMPIPE, test "x$HAVE_GALLIUM_LLVMPIPE" = xyes) @@ -3124,6 +3132,7 @@ AC_CONFIG_FILES([Makefile src/gallium/drivers/swr/Makefile src/gallium/drivers/tegra/Makefile src/gallium/drivers/etnaviv/Makefile + src/gallium/drivers/armada/Makefile src/gallium/drivers/imx/Makefile src/gallium/drivers/v3d/Makefile src/gallium/drivers/vc4/Makefile @@ -3159,6 +3168,7 @@ AC_CONFIG_FILES([Makefile src/gallium/tests/trivial/Makefile src/gallium/tests/unit/Makefile src/gallium/winsys/etnaviv/drm/Makefile + src/gallium/winsys/armada/drm/Makefile src/gallium/winsys/imx/drm/Makefile src/gallium/winsys/freedreno/drm/Makefile src/gallium/winsys/i915/drm/Makefile diff --git a/meson.build b/meson.build index c5bc94720d6..6536a38e790 100644 --- a/meson.build +++ b/meson.build @@ -132,7 +132,7 @@ if _drivers.contains('auto') elif ['arm', 'aarch64'].contains(host_machine.cpu_family()) _drivers = [ 'pl111', 'v3d', 'vc4', 'freedreno', 'etnaviv', 'imx', 'nouveau', - 'tegra', 'virgl', 'swrast', + 'armada', 'tegra', 'virgl', 'swrast', ] else error('Unknown architecture @0@. Please pass -Dgallium-drivers to set driver options. Patches gladly accepted to fix this.'.format( @@ -156,6 +156,7 @@ with_gallium_vc4 = _drivers.contains('vc4') with_gallium_v3d = _drivers.contains('v3d') with_gallium_etnaviv = _drivers.contains('etnaviv') with_gallium_imx = _drivers.contains('imx') +with_gallium_armada = _drivers.contains('armada') with_gallium_tegra = _drivers.contains('tegra') with_gallium_i915 = _drivers.contains('i915') with_gallium_svga = _drivers.contains('svga') @@ -205,6 +206,9 @@ endif if with_gallium_imx and not with_gallium_etnaviv error('IMX driver requires etnaviv driver') endif +if with_gallium_armada and not with_gallium_etnaviv + error('Armada driver requires etnaviv driver') +endif if with_gallium_pl111 and not with_gallium_vc4 error('pl111 driver requires vc4 driver') endif diff --git a/meson_options.txt b/meson_options.txt index bfb06c4dd42..690cde4a05a 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -60,7 +60,7 @@ option( choices : [ '', 'auto', 'pl111', 'radeonsi', 'r300', 'r600', 'nouveau', 'freedreno', 'swrast', 'v3d', 'vc4', 'etnaviv', 'imx', 'tegra', 'i915', 'svga', 'virgl', - 'swr', + 'swr', 'armada', ], description : 'List of gallium drivers to build. If this is set to auto all drivers applicable to the target OS/architecture will be built' ) diff --git a/src/gallium/Makefile.am b/src/gallium/Makefile.am index e75c1866832..1db9f40bf9f 100644 --- a/src/gallium/Makefile.am +++ b/src/gallium/Makefile.am @@ -56,6 +56,10 @@ if HAVE_GALLIUM_ETNAVIV SUBDIRS += drivers/etnaviv winsys/etnaviv/drm endif +if HAVE_GALLIUM_ARMADA +SUBDIRS += drivers/armada winsys/armada/drm +endif + if HAVE_GALLIUM_IMX SUBDIRS += drivers/imx winsys/imx/drm endif diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c b/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c index 5a88a2ac2f0..338b49af48c 100644 --- a/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c +++ b/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c @@ -141,6 +141,11 @@ static const struct drm_driver_descriptor driver_descriptors[] = { .create_screen = pipe_tegra_create_screen, .configuration = pipe_default_configuration_query, }, + { + .driver_name = "armada-drm", + .create_screen = pipe_armada_create_screen, + .configuration = pipe_default_configuration_query, + } }; #endif diff --git a/src/gallium/auxiliary/target-helpers/drm_helper.h b/src/gallium/auxiliary/target-helpers/drm_helper.h index 7eefa6e42ec..4a0ca9ddf4c 100644 --- a/src/gallium/auxiliary/target-helpers/drm_helper.h +++ b/src/gallium/auxiliary/target-helpers/drm_helper.h @@ -403,4 +403,27 @@ pipe_tegra_create_screen(int fd, const struct pipe_screen_config *config) #endif +#ifdef GALLIUM_ARMADA +#include "armada/drm/armada_drm_public.h" + +struct pipe_screen * +pipe_armada_create_screen(int fd, const struct pipe_screen_config *config) +{ + struct pipe_screen *screen; + + screen = armada_drm_screen_create(fd); + return screen ? debug_screen_wrap(screen) : NULL; +} + +#else + +struct pipe_screen * +pipe_armada_create_screen(int fd, const struct pipe_screen_config *config) +{ + fprintf(stderr, "armada-drm: driver missing\n"); + return NULL; +} + +#endif + #endif /* DRM_HELPER_H */ diff --git a/src/gallium/auxiliary/target-helpers/drm_helper_public.h b/src/gallium/auxiliary/target-helpers/drm_helper_public.h index 155c525762c..cc6e42eb648 100644 --- a/src/gallium/auxiliary/target-helpers/drm_helper_public.h +++ b/src/gallium/auxiliary/target-helpers/drm_helper_public.h @@ -54,6 +54,9 @@ pipe_imx_drm_create_screen(int fd, const struct pipe_screen_config *config); struct pipe_screen * pipe_tegra_create_screen(int fd, const struct pipe_screen_config *config); +struct pipe_screen * +pipe_armada_create_screen(int fd, const struct pipe_screen_config *config); + const struct drm_conf_ret * pipe_default_configuration_query(enum drm_conf conf); diff --git a/src/gallium/drivers/armada/Automake.inc b/src/gallium/drivers/armada/Automake.inc new file mode 100644 index 00000000000..f4718d68855 --- /dev/null +++ b/src/gallium/drivers/armada/Automake.inc @@ -0,0 +1,9 @@ +if HAVE_GALLIUM_ARMADA + +TARGET_DRIVERS += armada-drm +TARGET_CPPFLAGS += -DGALLIUM_ARMADA +TARGET_LIB_DEPS += \ + $(top_builddir)/src/gallium/winsys/armada/drm/libarmadadrm.la \ + $(LIBDRM_LIBS) + +endif diff --git a/src/gallium/drivers/armada/Makefile.am b/src/gallium/drivers/armada/Makefile.am new file mode 100644 index 00000000000..788b08ef350 --- /dev/null +++ b/src/gallium/drivers/armada/Makefile.am @@ -0,0 +1,8 @@ +include $(top_srcdir)/src/gallium/Automake.inc + +AM_CPPFLAGS = \ + $(GALLIUM_CFLAGS) + +noinst_LTLIBRARIES = libarmada.la + +libarmada_la_SOURCES = diff --git a/src/gallium/meson.build b/src/gallium/meson.build index 561af9d339c..3de028c3f45 100644 --- a/src/gallium/meson.build +++ b/src/gallium/meson.build @@ -111,6 +111,11 @@ if with_gallium_imx else driver_imx = declare_dependency() endif +if with_gallium_armada + subdir('winsys/armada/drm') +else + driver_armada = declare_dependency() +endif if with_gallium_tegra subdir('winsys/tegra/drm') subdir('drivers/tegra') diff --git a/src/gallium/targets/dri/Makefile.am b/src/gallium/targets/dri/Makefile.am index a857b5129fd..ae5b1c0bd07 100644 --- a/src/gallium/targets/dri/Makefile.am +++ b/src/gallium/targets/dri/Makefile.am @@ -83,6 +83,7 @@ include $(top_srcdir)/src/gallium/drivers/pl111/Automake.inc include $(top_srcdir)/src/gallium/drivers/virgl/Automake.inc include $(top_srcdir)/src/gallium/drivers/etnaviv/Automake.inc +include $(top_srcdir)/src/gallium/drivers/armada/Automake.inc include $(top_srcdir)/src/gallium/drivers/imx/Automake.inc include $(top_srcdir)/src/gallium/drivers/softpipe/Automake.inc diff --git a/src/gallium/targets/dri/meson.build b/src/gallium/targets/dri/meson.build index 51940a2f350..60356f2192b 100644 --- a/src/gallium/targets/dri/meson.build +++ b/src/gallium/targets/dri/meson.build @@ -58,7 +58,7 @@ libgallium_dri = shared_library( driver_swrast, driver_r300, driver_r600, driver_radeonsi, driver_nouveau, driver_pl111, driver_v3d, driver_vc4, driver_freedreno, driver_etnaviv, driver_imx, driver_tegra, driver_i915, driver_svga, driver_virgl, - driver_swr, + driver_swr, driver_armada ], ) @@ -72,6 +72,7 @@ foreach d : [[with_gallium_pl111, 'pl111_dri.so'], [with_gallium_vc4, 'vc4_dri.so'], [with_gallium_etnaviv, 'etnaviv_dri.so'], [with_gallium_imx, 'imx-drm_dri.so'], + [with_gallium_armada, 'armada-drm_dri.so'], [with_gallium_tegra, 'tegra_dri.so'], [with_gallium_i915, 'i915_dri.so'], [with_gallium_r300, 'r300_dri.so'], diff --git a/src/gallium/targets/dri/target.c b/src/gallium/targets/dri/target.c index 835d125f21e..5d5a41dba80 100644 --- a/src/gallium/targets/dri/target.c +++ b/src/gallium/targets/dri/target.c @@ -83,6 +83,7 @@ DEFINE_LOADER_DRM_ENTRYPOINT(pl111) #endif #if defined(GALLIUM_ETNAVIV) +DEFINE_LOADER_DRM_ENTRYPOINT(armada_drm) DEFINE_LOADER_DRM_ENTRYPOINT(imx_drm) DEFINE_LOADER_DRM_ENTRYPOINT(etnaviv) #endif diff --git a/src/gallium/winsys/armada/drm/Makefile.am b/src/gallium/winsys/armada/drm/Makefile.am new file mode 100644 index 00000000000..f0773976e0c --- /dev/null +++ b/src/gallium/winsys/armada/drm/Makefile.am @@ -0,0 +1,11 @@ +include Makefile.sources +include $(top_srcdir)/src/gallium/Automake.inc + +AM_CFLAGS = \ + -I$(top_srcdir)/src/gallium/drivers \ + -I$(top_srcdir)/src/gallium/winsys \ + $(GALLIUM_WINSYS_CFLAGS) + +noinst_LTLIBRARIES = libarmadadrm.la + +libarmadadrm_la_SOURCES = $(C_SOURCES) diff --git a/src/gallium/winsys/armada/drm/Makefile.sources b/src/gallium/winsys/armada/drm/Makefile.sources new file mode 100644 index 00000000000..00d8de33bb9 --- /dev/null +++ b/src/gallium/winsys/armada/drm/Makefile.sources @@ -0,0 +1,3 @@ +C_SOURCES := \ + armada_drm_public.h \ + armada_drm_winsys.c diff --git a/src/gallium/winsys/armada/drm/armada_drm_public.h b/src/gallium/winsys/armada/drm/armada_drm_public.h new file mode 100644 index 00000000000..c3628ae5a07 --- /dev/null +++ b/src/gallium/winsys/armada/drm/armada_drm_public.h @@ -0,0 +1,8 @@ +#ifndef __ARMADA_DRM_PUBLIC_H__ +#define __ARMADA_DRM_PUBLIC_H__ + +struct pipe_screen; + +struct pipe_screen *armada_drm_screen_create(int fd); + +#endif diff --git a/src/gallium/winsys/armada/drm/armada_drm_winsys.c b/src/gallium/winsys/armada/drm/armada_drm_winsys.c new file mode 100644 index 00000000000..c9dbf1997b7 --- /dev/null +++ b/src/gallium/winsys/armada/drm/armada_drm_winsys.c @@ -0,0 +1,24 @@ +#include "armada_drm_public.h" +#include "etnaviv/drm/etnaviv_drm_public.h" +#include "renderonly/renderonly.h" + +#include <fcntl.h> +#include <unistd.h> + +struct pipe_screen *armada_drm_screen_create(int fd) +{ + struct renderonly ro = { + .create_for_resource = renderonly_create_kms_dumb_buffer_for_resource, + .kms_fd = fd, + .gpu_fd = open("/dev/dri/renderD128", O_RDWR | O_CLOEXEC) + }; + + if (ro.gpu_fd < 0) + return NULL; + + struct pipe_screen *screen = etna_drm_screen_create_renderonly(&ro); + if (!screen) + close(ro.gpu_fd); + + return screen; +} diff --git a/src/gallium/winsys/armada/drm/meson.build b/src/gallium/winsys/armada/drm/meson.build new file mode 100644 index 00000000000..af4d55fb634 --- /dev/null +++ b/src/gallium/winsys/armada/drm/meson.build @@ -0,0 +1,14 @@ +libarmadadrm = static_library( + 'armadadrm', + 'armada_drm_winsys.c', + include_directories : [ + inc_include, inc_src, inc_gallium, inc_gallium_aux, + include_directories('../..'), + ], +) + +driver_armada = declare_dependency( + compile_args : '-DGALLIUM_ARMADA', + link_with : libarmadadrm, +) + -- 2.20.1 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev