freedreno: pipe loader for either kgsl or msm
authorRob Clark <robclark@freedesktop.org>
Thu, 29 Aug 2013 21:26:16 +0000 (17:26 -0400)
committerRob Clark <robclark@freedesktop.org>
Thu, 29 Aug 2013 21:35:05 +0000 (17:35 -0400)
The downstream android kernel driver is "kgsl", the upstream drm/kms
driver is called "msm".  Since libdrm_freedreno handles the differences
between the two, we need to load the same thing for either device.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
src/gallium/targets/dri-freedreno/Makefile.am
src/gallium/targets/dri-freedreno/target-kgsl.c [new file with mode: 0644]
src/gallium/targets/dri-freedreno/target-msm.c [new file with mode: 0644]
src/gallium/targets/dri-freedreno/target.c [deleted file]
src/gallium/targets/egl-static/egl_pipe.c

index cfa1f37fd373fcbb0b6987ae72163de43ce0d9d0..615ae6f2de843b3747034b5b6ca36392909677b7 100644 (file)
@@ -37,18 +37,16 @@ AM_CPPFLAGS = \
        -DGALLIUM_NOOP
 
 dridir = $(DRI_DRIVER_INSTALL_DIR)
-dri_LTLIBRARIES = kgsl_dri.la
+dri_LTLIBRARIES = kgsl_dri.la msm_dri.la
 
-nodist_EXTRA_kgsl_dri_la_SOURCES = dummy.cpp
-kgsl_dri_la_SOURCES = \
-       target.c \
+COMMON_SOURCES = \
        $(top_srcdir)/src/mesa/drivers/dri/common/utils.c \
        $(top_srcdir)/src/mesa/drivers/dri/common/dri_util.c \
        $(top_srcdir)/src/mesa/drivers/dri/common/xmlconfig.c
 
-kgsl_dri_la_LDFLAGS = -module -avoid-version -shared -no-undefined
+COMMON_LDFLAGS = -module -avoid-version -shared -no-undefined
 
-kgsl_dri_la_LIBADD = \
+COMMON_LIBADD = \
        $(top_builddir)/src/mesa/libmesagallium.la \
        $(top_builddir)/src/gallium/auxiliary/libgallium.la \
        $(top_builddir)/src/gallium/state_trackers/dri/drm/libdridrm.la \
@@ -62,12 +60,23 @@ kgsl_dri_la_LIBADD = \
        $(FREEDRENO_LIBS)
 
 if HAVE_MESA_LLVM
-kgsl_dri_la_LDFLAGS += $(LLVM_LDFLAGS)
-kgsl_dri_la_LIBADD += $(LLVM_LIBS)
+COMMON_LDFLAGS += $(LLVM_LDFLAGS)
+COMMON_LIBADD += $(LLVM_LIBS)
 endif
 
+nodist_EXTRA_kgsl_dri_la_SOURCES = dummy.cpp
+kgsl_dri_la_SOURCES = target-kgsl.c $(COMMON_SOURCES)
+kgsl_dri_la_LDFLAGS = $(COMMON_LDFLAGS)
+kgsl_dri_la_LIBADD  = $(COMMON_LIBADD)
+
+nodist_EXTRA_msm_dri_la_SOURCES = dummy.cpp
+msm_dri_la_SOURCES  = target-msm.c $(COMMON_SOURCES)
+msm_dri_la_LDFLAGS  = $(COMMON_LDFLAGS)
+msm_dri_la_LIBADD   = $(COMMON_LIBADD)
+
 # Provide compatibility with scripts for the old Mesa build system for
 # a while by putting a link to the driver into /lib of the build tree.
-all-local: kgsl_dri.la
+all-local: kgsl_dri.la msm_dri.la
        $(MKDIR_P) $(top_builddir)/$(LIB_DIR)/gallium
        ln -f .libs/kgsl_dri.so $(top_builddir)/$(LIB_DIR)/gallium/kgsl_dri.so
+       ln -f .libs/msm_dri.so $(top_builddir)/$(LIB_DIR)/gallium/msm_dri.so
diff --git a/src/gallium/targets/dri-freedreno/target-kgsl.c b/src/gallium/targets/dri-freedreno/target-kgsl.c
new file mode 100644 (file)
index 0000000..dcaf299
--- /dev/null
@@ -0,0 +1,20 @@
+
+#include "target-helpers/inline_debug_helper.h"
+#include "state_tracker/drm_driver.h"
+#include "freedreno/drm/freedreno_drm_public.h"
+
+static struct pipe_screen *
+create_screen(int fd)
+{
+   struct pipe_screen *screen;
+
+   screen = fd_drm_screen_create(fd);
+   if (!screen)
+      return NULL;
+
+   screen = debug_screen_wrap(screen);
+
+   return screen;
+}
+
+DRM_DRIVER_DESCRIPTOR("freedreno", "kgsl", create_screen, NULL)
diff --git a/src/gallium/targets/dri-freedreno/target-msm.c b/src/gallium/targets/dri-freedreno/target-msm.c
new file mode 100644 (file)
index 0000000..4a6299b
--- /dev/null
@@ -0,0 +1,20 @@
+
+#include "target-helpers/inline_debug_helper.h"
+#include "state_tracker/drm_driver.h"
+#include "freedreno/drm/freedreno_drm_public.h"
+
+static struct pipe_screen *
+create_screen(int fd)
+{
+   struct pipe_screen *screen;
+
+   screen = fd_drm_screen_create(fd);
+   if (!screen)
+      return NULL;
+
+   screen = debug_screen_wrap(screen);
+
+   return screen;
+}
+
+DRM_DRIVER_DESCRIPTOR("freedreno", "msm", create_screen, NULL)
diff --git a/src/gallium/targets/dri-freedreno/target.c b/src/gallium/targets/dri-freedreno/target.c
deleted file mode 100644 (file)
index dcaf299..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-
-#include "target-helpers/inline_debug_helper.h"
-#include "state_tracker/drm_driver.h"
-#include "freedreno/drm/freedreno_drm_public.h"
-
-static struct pipe_screen *
-create_screen(int fd)
-{
-   struct pipe_screen *screen;
-
-   screen = fd_drm_screen_create(fd);
-   if (!screen)
-      return NULL;
-
-   screen = debug_screen_wrap(screen);
-
-   return screen;
-}
-
-DRM_DRIVER_DESCRIPTOR("freedreno", "kgsl", create_screen, NULL)
index 57a3233530fe2a11fa547a1d299e5aff3e620f0c..e5100c173e6e15250fe3b74507821223bf807ee4 100644 (file)
@@ -241,7 +241,7 @@ egl_pipe_create_drm_screen(const char *name, int fd)
       return pipe_radeonsi_create_screen(fd);
    else if (strcmp(name, "vmwgfx") == 0)
       return pipe_vmwgfx_create_screen(fd);
-   else if (strcmp(name, "kgsl") == 0)
+   else if ((strcmp(name, "kgsl") == 0) || (strcmp(name, "msm") == 0))
       return pipe_freedreno_create_screen(fd);
    else
       return NULL;