[Mesa-dev] [PATCH 04/11] imx: add freedreno
Jonathan Marek
jonathan at marek.ca
Mon Sep 17 18:22:13 UTC 2018
Signed-off-by: Jonathan Marek <jonathan at marek.ca>
---
configure.ac | 4 ++--
src/gallium/targets/dri/target.c | 5 +++-
src/gallium/winsys/imx/drm/Makefile.am | 9 +++++++
src/gallium/winsys/imx/drm/imx_drm_winsys.c | 26 ++++++++++++++++-----
4 files changed, 35 insertions(+), 9 deletions(-)
diff --git a/configure.ac b/configure.ac
index f8bb131cb6..85cd3c1eeb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2835,8 +2835,8 @@ AM_CONDITIONAL(HAVE_SWR_BUILTIN, test "x$HAVE_SWR_BUILTIN" = xyes)
dnl We need to validate some needed dependencies for renderonly drivers.
-if test "x$HAVE_GALLIUM_ETNAVIV" != xyes -a "x$HAVE_GALLIUM_IMX" = xyes ; then
- AC_MSG_ERROR([Building with imx requires etnaviv])
+if test "x$HAVE_GALLIUM_ETNAVIV" != xyes -a "x$HAVE_GALLIUM_FREEDRENO" != xyes -a "x$HAVE_GALLIUM_IMX" = xyes ; then
+ AC_MSG_ERROR([Building with imx requires etnaviv or freedreno])
fi
if test "x$HAVE_GALLIUM_VC4" != xyes -a "x$HAVE_GALLIUM_PL111" = xyes ; then
diff --git a/src/gallium/targets/dri/target.c b/src/gallium/targets/dri/target.c
index 835d125f21..ddaca8501a 100644
--- a/src/gallium/targets/dri/target.c
+++ b/src/gallium/targets/dri/target.c
@@ -83,10 +83,13 @@ DEFINE_LOADER_DRM_ENTRYPOINT(pl111)
#endif
#if defined(GALLIUM_ETNAVIV)
-DEFINE_LOADER_DRM_ENTRYPOINT(imx_drm)
DEFINE_LOADER_DRM_ENTRYPOINT(etnaviv)
#endif
+#if defined(GALLIUM_IMX)
+DEFINE_LOADER_DRM_ENTRYPOINT(imx_drm)
+#endif
+
#if defined(GALLIUM_TEGRA)
DEFINE_LOADER_DRM_ENTRYPOINT(tegra);
#endif
diff --git a/src/gallium/winsys/imx/drm/Makefile.am b/src/gallium/winsys/imx/drm/Makefile.am
index f15b531f81..17068cb300 100644
--- a/src/gallium/winsys/imx/drm/Makefile.am
+++ b/src/gallium/winsys/imx/drm/Makefile.am
@@ -28,8 +28,17 @@ AM_CFLAGS = \
-I$(top_srcdir)/src/gallium/winsys \
$(GALLIUM_WINSYS_CFLAGS)
+if HAVE_GALLIUM_ETNAVIV
+AM_CFLAGS += -DGALLIUM_ETNAVIV
+endif
+
+if HAVE_GALLIUM_FREEDRENO
+AM_CFLAGS += -DGALLIUM_FREEDRENO
+endif
+
noinst_LTLIBRARIES = libimxdrm.la
libimxdrm_la_SOURCES = $(C_SOURCES)
EXTRA_DIST = meson.build
+
diff --git a/src/gallium/winsys/imx/drm/imx_drm_winsys.c b/src/gallium/winsys/imx/drm/imx_drm_winsys.c
index 4bd2125031..f8c4abffde 100644
--- a/src/gallium/winsys/imx/drm/imx_drm_winsys.c
+++ b/src/gallium/winsys/imx/drm/imx_drm_winsys.c
@@ -26,6 +26,7 @@
#include "imx_drm_public.h"
#include "etnaviv/drm/etnaviv_drm_public.h"
+#include "freedreno/drm/freedreno_drm_public.h"
#include "loader/loader.h"
#include "renderonly/renderonly.h"
@@ -37,15 +38,28 @@ struct pipe_screen *imx_drm_screen_create(int fd)
struct renderonly ro = {
.create_for_resource = renderonly_create_kms_dumb_buffer_for_resource,
.kms_fd = fd,
- .gpu_fd = loader_open_render_node("etnaviv")
};
+ struct pipe_screen *screen;
- if (ro.gpu_fd < 0)
- return NULL;
+#if defined(GALLIUM_ETNAVIV)
+ ro.gpu_fd = loader_open_render_node("etnaviv");
+ if (ro.gpu_fd >= 0) {
+ screen = etna_drm_screen_create_renderonly(&ro);
+ if (screen)
+ return screen;
+ close(ro.gpu_fd);
+ }
+#endif
- struct pipe_screen *screen = etna_drm_screen_create_renderonly(&ro);
- if (!screen)
+#if defined(GALLIUM_FREEDRENO)
+ ro.gpu_fd = loader_open_render_node("msm");
+ if (ro.gpu_fd >= 0) {
+ screen = fd_drm_screen_create_renderonly(&ro);
+ if (screen)
+ return screen;
close(ro.gpu_fd);
+ }
+#endif
- return screen;
+ return NULL;
}
--
2.17.1
More information about the mesa-dev
mailing list