Skip to contentSkip to conversation

freedreno: add freedreno DRM

PATCH In review Rob Clark 2 participants 2 messages Feb 17, 2013 – Feb 19, 2013 Kbuild

lore
Share & tools
lore

Rob Clark

author
#0 lore raw

PATCH 1/1 freedreno: add freedreno DRM

From: Rob Clark <[email protected]>

The libdrm_freedreno helper layer for use by xf86-video-freedreno, fdre (freedreno r/e library and tests for driving gpu), and eventual gallium driver for the Adreno GPU. This uses the msm gpu driver from QCOM's android kernel tree.

Note that current msm kernel driver is a bit strange. It provides a DRM interface for GEM, which is basically sufficient to have DRI2 working. But it does not provide KMS. And interface to 2d and 3d cores is via different other devices (/dev/kgsl-*). This is not quite how I'd write a DRM driver, but at this stage it is useful for xf86-video-freedreno and fdre (and eventual gallium driver) to be able to work on existing kernel driver from QCOM, to allow to capture cmdstream dumps from the binary blob drivers without having to reboot. So libdrm_freedreno attempts to hide most of the crazy. The intention is that when there is a proper kernel driver, it will be mostly just changes in libdrm_freedreno to adapt the gallium driver and xf86-video-freedreno (ignoring the fbdev->KMS changes).

So don't look at freedreno as an example of how to write a libdrm module or a DRM driver.. it is just an attempt to paper over a non- standard kernel driver architecture.

v1: original
v2: hold ref's to pending bo's (because qcom's kernel driver doesn't),
various bug fixes, add ringbuffer markers so we can emit IB's to portion of ringbuffer (so that gallium driver can use a single ringbuffer for both tile cmds and draw cmds.

---
 .gitignore                       |   1 +
 Makefile.am                      |   6 +-
 configure.ac                     |  15 +-
 freedreno/Makefile.am            |  19 ++
 freedreno/README                 |  16 ++
 freedreno/freedreno_bo.c         | 274 +++++++++++++++++++++
 freedreno/freedreno_device.c     |  45 ++++
 freedreno/freedreno_drmif.h      |  99 ++++++++
 freedreno/freedreno_pipe.c       | 227 +++++++++++++++++
 freedreno/freedreno_priv.h       | 117 +++++++++
 freedreno/freedreno_ringbuffer.c | 249 +++++++++++++++++++
 freedreno/freedreno_ringbuffer.h |  87 +++++++
 freedreno/kgsl_drm.h             | 192 +++++++++++++++
 freedreno/libdrm_freedreno.pc.in |  11 +
 freedreno/list.h                 | 137 +++++++++++
 freedreno/msm_kgsl.h             | 519 +++++++++++++++++++++++++++++++++++++++
 16 files changed, 2012 insertions(+), 2 deletions(-)
 create mode 100644 freedreno/Makefile.am
 create mode 100644 freedreno/README
 create mode 100644 freedreno/freedreno_bo.c
 create mode 100644 freedreno/freedreno_device.c
 create mode 100644 freedreno/freedreno_drmif.h
 create mode 100644 freedreno/freedreno_pipe.c
 create mode 100644 freedreno/freedreno_priv.h
 create mode 100644 freedreno/freedreno_ringbuffer.c
 create mode 100644 freedreno/freedreno_ringbuffer.h
 create mode 100644 freedreno/kgsl_drm.h
 create mode 100644 freedreno/libdrm_freedreno.pc.in
 create mode 100644 freedreno/list.h
 create mode 100644 freedreno/msm_kgsl.h
.gitignore +1 -0
index 225fd80..9f8eabb 100644
@@ -48,6 +48,7 @@ libdrm_nouveau.pc
 libdrm_radeon.pc
 libdrm_omap.pc
 libdrm_exynos.pc
+libdrm_freedreno.pc
 libkms.pc
 libtool
 ltmain.sh
Makefile.am +5 -1
index 94572d0..f726036 100644
@@ -47,7 +47,11 @@ if HAVE_EXYNOS
 EXYNOS_SUBDIR = exynos
 endif
 
-SUBDIRS = . $(LIBKMS_SUBDIR) $(INTEL_SUBDIR) $(NOUVEAU_SUBDIR) $(RADEON_SUBDIR) $(OMAP_SUBDIR) $(EXYNOS_SUBDIR) tests include man
+if HAVE_FREEDRENO
+FREEDRENO_SUBDIR = freedreno
+endif
+
+SUBDIRS = . $(LIBKMS_SUBDIR) $(INTEL_SUBDIR) $(NOUVEAU_SUBDIR) $(RADEON_SUBDIR) $(OMAP_SUBDIR) $(EXYNOS_SUBDIR) $(FREEDRENO_SUBDIR) tests include man
 
 libdrm_la_LTLIBRARIES = libdrm.la
 libdrm_ladir = $(libdir)
configure.ac +14 -1
index e2e3466..83ffe1b 100644
@@ -93,6 +93,11 @@ AC_ARG_ENABLE(exynos-experimental-api,
 	      [Enable support for EXYNOS's experimental API (default: disabled)]),
 	      [EXYNOS=$enableval], [EXYNOS=no])
 
+AC_ARG_ENABLE(freedreno-experimental-api,
+	      AS_HELP_STRING([--enable-freedreno-experimental-api],
+	      [Enable support for freedreno's experimental API (default: disabled)]),
+	      [FREEDRENO=$enableval], [FREEDRENO=no])
+
 dnl ===========================================================================
 dnl check compiler flags
 AC_DEFUN([LIBDRM_CC_TRY_FLAG], [
@@ -201,6 +206,11 @@ if test "x$EXYNOS" = xyes; then
 	AC_DEFINE(HAVE_EXYNOS, 1, [Have EXYNOS support])
 fi
 
+AM_CONDITIONAL(HAVE_FREEDRENO, [test "x$FREEDRENO" = xyes])
+if test "x$FREEDRENO" = xyes; then
+	AC_DEFINE(HAVE_FREEDRENO, 1, [Have freedreno support])
+fi
+
 AC_ARG_ENABLE([cairo-tests],
               [AS_HELP_STRING([--enable-cairo-tests],
                               [Enable support for Cairo rendering in tests (default: auto)])],
@@ -247,7 +257,7 @@ else
 fi
 AM_CONDITIONAL([HAVE_MANPAGES_STYLESHEET], [test "x$HAVE_MANPAGES_STYLESHEET" = "xyes"])
 
-if test "x$INTEL" != "xno" -o "x$RADEON" != "xno" -o "x$NOUVEAU" != "xno" -o "x$OMAP" != "xno"; then
+if test "x$INTEL" != "xno" -o "x$RADEON" != "xno" -o "x$NOUVEAU" != "xno" -o "x$OMAP" != "xno" -o "x$FREEDRENO" != "xno"; then
     # Check for atomic intrinsics
     AC_CACHE_CHECK([for native atomic primitives], drm_cv_atomic_primitives,
     [
@@ -358,6 +368,8 @@ AC_CONFIG_FILES([
 	omap/libdrm_omap.pc
 	exynos/Makefile
 	exynos/libdrm_exynos.pc
+	freedreno/Makefile
+	freedreno/libdrm_freedreno.pc
 	tests/Makefile
 	tests/modeprint/Makefile
 	tests/modetest/Makefile
@@ -380,4 +392,5 @@ echo "  Radeon API     $RADEON"
 echo "  Nouveau API    $NOUVEAU"
 echo "  OMAP API       $OMAP"
 echo "  EXYNOS API     $EXYNOS"
+echo "  Freedreno API  $FREEDRENO"
 echo ""
freedreno/Makefile.am new file +19 -0
new file mode 100644
index 0000000..f46a780
@@ -0,0 +1,19 @@
+AM_CFLAGS = \
+	$(WARN_CFLAGS) \
+	-I$(top_srcdir) \
+	-I$(top_srcdir)/freedreno \
+	$(PTHREADSTUBS_CFLAGS) \
+	-I$(top_srcdir)/include/drm
+
+libdrm_freedreno_la_LTLIBRARIES = libdrm_freedreno.la
+libdrm_freedreno_ladir = $(libdir)
+libdrm_freedreno_la_LDFLAGS = -version-number 1:0:0 -no-undefined
+libdrm_freedreno_la_LIBADD = ../libdrm.la @PTHREADSTUBS_LIBS@
+
+libdrm_freedreno_la_SOURCES = freedreno_device.c freedreno_pipe.c freedreno_ringbuffer.c freedreno_bo.c
+
+libdrm_freedrenocommonincludedir = ${includedir}/freedreno
+libdrm_freedrenocommoninclude_HEADERS = freedreno_drmif.h freedreno_ringbuffer.h
+
+pkgconfigdir = @pkgconfigdir@
+pkgconfig_DATA = libdrm_freedreno.pc
freedreno/README new file +16 -0
new file mode 100644
index 0000000..ae22e01
@@ -0,0 +1,16 @@
+Note that current msm kernel driver is a bit strange.  It provides a
+DRM interface for GEM, which is basically sufficient to have DRI2
+working.  But it does not provide KMS.  And interface to 2d and 3d
+cores is via different other devices (/dev/kgsl-*).  This is not
+quite how I'd write a DRM driver, but at this stage it is useful for
+xf86-video-freedreno and fdre (and eventual gallium driver) to be
+able to work on existing kernel driver from QCOM, to allow to
+capture cmdstream dumps from the binary blob drivers without having
+to reboot.  So libdrm_freedreno attempts to hide most of the crazy.
+The intention is that when there is a proper kernel driver, it will
+be mostly just changes in libdrm_freedreno to adapt the gallium
+driver and xf86-video-freedreno (ignoring the fbdev->KMS changes).
+
+So don't look at freedreno as an example of how to write a libdrm
+module or a DRM driver.. it is just an attempt to paper over a non-
+standard kernel driver architecture.
freedreno/freedreno_bo.c new file +274 -0

274 lines not on this page · raw message

freedreno/freedreno_device.c new file +45 -0

45 lines not on this page · raw message

freedreno/freedreno_drmif.h new file +99 -0

99 lines not on this page · raw message

freedreno/freedreno_pipe.c new file +227 -0

227 lines not on this page · raw message

freedreno/freedreno_priv.h new file +117 -0

117 lines not on this page · raw message

freedreno/freedreno_ringbuffer.c new file +249 -0

249 lines not on this page · raw message

freedreno/freedreno_ringbuffer.h new file +87 -0

87 lines not on this page · raw message

freedreno/kgsl_drm.h new file +192 -0

192 lines not on this page · raw message

freedreno/libdrm_freedreno.pc.in new file +11 -0
new file mode 100644
index 0000000..b736b65
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: libdrm_freedreno
+Description: Userspace interface to freedreno kernel DRM services
+Version: @PACKAGE_VERSION@
+Libs: -L${libdir} -ldrm_freedreno
+Cflags: -I${includedir} -I${includedir}/libdrm -I${includedir}/freedreno
+Requires.private: libdrm
freedreno/list.h new file +137 -0

137 lines not on this page · raw message

freedreno/msm_kgsl.h new file +519 -0

519 lines not on this page · raw message

Signature · 1 line
1.8.1
Acked-by on v1 1/1
#1 lore raw
Quoted 20 lines · Rob Clark

From: Rob Clark <[email protected]>

The libdrm_freedreno helper layer for use by xf86-video-freedreno, fdre (freedreno r/e library and tests for driving gpu), and eventual gallium driver for the Adreno GPU. This uses the msm gpu driver from QCOM's android kernel tree.

Note that current msm kernel driver is a bit strange. It provides a DRM interface for GEM, which is basically sufficient to have DRI2 working. But it does not provide KMS. And interface to 2d and 3d cores is via different other devices (/dev/kgsl-*). This is not quite how I'd write a DRM driver, but at this stage it is useful for xf86-video-freedreno and fdre (and eventual gallium driver) to be able to work on existing kernel driver from QCOM, to allow to capture cmdstream dumps from the binary blob drivers without having to reboot. So libdrm_freedreno attempts to hide most of the crazy. The intention is that when there is a proper kernel driver, it will be mostly just changes in libdrm_freedreno to adapt the gallium driver and xf86-video-freedreno (ignoring the fbdev->KMS changes).

Quoted 3 lines

So don't look at freedreno as an example of how to write a libdrm module or a DRM driver.. it is just an attempt to paper over a non- standard kernel driver architecture.

Yeah, at this stage I expect things to be kinda held together with duct tape and baling wire, and it's still worth having the code in git.

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel