Skip to contentSkip to conversation

NVIDIA Tegra support

RFC New Arto Merilainen 1 participant 3 messages Apr 12, 2013 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v2 cover NVIDIA Tegra support

This patch series adds application level support for host1x hardware on Tegra SoCs. This set of patches can be used in combination with host1x kernel patches. The most recent version of the kernel patch series is available at [0].

An example of using 2d hardware acceleration with this library is available at [1].

Changes in version 2:
- Instead of using assertations, the library now returns error codes
- Added a minimal set of tests to test common use cases
- The size of a stream buffer pool can be set runtime
- The library keeps track of syncpoint increments
- Added reference counting to buffer management
- Removed 2d related patches from the series
- Rebased to latest libdrm
- Updated ioctl interface
- Fixed stylish issues

[0]: http://gitorious.org/linux-host1x/linux-host1x
[1]: http://gitorious.org/linux-host1x/libdrm-host1x/commits/2d

Arto Merilainen (2):
tegra: Add stream library
tests: tegra: Add stream library test

 Makefile.am                            |    6 +-
 configure.ac                           |   14 +
 tegra/Makefile.am                      |   25 +
 tegra/class_ids.h                      |   36 ++
 tegra/host1x01_hardware.h              |  125 ++++
 tegra/hw_host1x01_uclass.h             |  155 +++++
 tegra/libdrm_tegra.pc.in               |   10 +
 tegra/tegra_drm.c                      |  998 ++++++++++++++++++++++++++++++++
 tegra/tegra_drm.h                      |  136 +++++
 tegra/tegra_drmif.h                    |  110 ++++
 tests/tegra/host1x/Makefile.am         |   12 +
 tests/tegra/host1x/tegra_host1x_test.c |  893 ++++++++++++++++++++++++++++
 12 files changed, 2519 insertions(+), 1 deletion(-)
 create mode 100644 tegra/Makefile.am
 create mode 100644 tegra/class_ids.h
 create mode 100644 tegra/host1x01_hardware.h
 create mode 100644 tegra/hw_host1x01_uclass.h
 create mode 100644 tegra/libdrm_tegra.pc.in
 create mode 100644 tegra/tegra_drm.c
 create mode 100644 tegra/tegra_drm.h
 create mode 100644 tegra/tegra_drmif.h
 create mode 100644 tests/tegra/host1x/Makefile.am
 create mode 100644 tests/tegra/host1x/tegra_host1x_test.c
Signature · 1 line
1.7.9.5

A message that is not in the archive (sent off-list or not yet received): 1365763320-31360-1-git-send-email-amerilainen-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org

#2 lore raw

RFC v2 1/2 tegra: Add stream library

This patch introduces tegra stream library. The library is used for buffer management, command stream construction and work synchronization.

---
 Makefile.am                |    6 +-
 configure.ac               |   13 +
 tegra/Makefile.am          |   25 ++
 tegra/class_ids.h          |   36 ++
 tegra/host1x01_hardware.h  |  125 ++++++
 tegra/hw_host1x01_uclass.h |  155 +++++++
 tegra/libdrm_tegra.pc.in   |   10 +
 tegra/tegra_drm.c          |  998 ++++++++++++++++++++++++++++++++++++++++++++
 tegra/tegra_drm.h          |  136 ++++++
 tegra/tegra_drmif.h        |  110 +++++
 10 files changed, 1613 insertions(+), 1 deletion(-)
 create mode 100644 tegra/Makefile.am
 create mode 100644 tegra/class_ids.h
 create mode 100644 tegra/host1x01_hardware.h
 create mode 100644 tegra/hw_host1x01_uclass.h
 create mode 100644 tegra/libdrm_tegra.pc.in
 create mode 100644 tegra/tegra_drm.c
 create mode 100644 tegra/tegra_drm.h
 create mode 100644 tegra/tegra_drmif.h
Makefile.am +5 -1
index f726036..bd942e7 100644
@@ -51,7 +51,11 @@ 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
+if HAVE_TEGRA
+TEGRA_SUBDIR = tegra
+endif
+
+SUBDIRS = . $(LIBKMS_SUBDIR) $(INTEL_SUBDIR) $(NOUVEAU_SUBDIR) $(RADEON_SUBDIR) $(OMAP_SUBDIR) $(EXYNOS_SUBDIR) $(FREEDRENO_SUBDIR) $(TEGRA_SUBDIR) tests include man
 
 libdrm_la_LTLIBRARIES = libdrm.la
 libdrm_ladir = $(libdir)
configure.ac +13 -0
index 2786c87..e55e9c1 100644
@@ -103,6 +103,11 @@ AC_ARG_ENABLE(install-test-programs,
 		  [Install test programs (default: no)]),
 		  [INSTALL_TESTS=$enableval], [INSTALL_TESTS=no])
 
+AC_ARG_ENABLE(tegra,
+	      AS_HELP_STRING([--enable-tegra],
+	      [Enable support for tegra's API (default: disabled)]),
+	      [TEGRA=$enableval], [TEGRA=no])
+
 dnl ===========================================================================
 dnl check compiler flags
 AC_DEFUN([LIBDRM_CC_TRY_FLAG], [
@@ -216,6 +221,11 @@ if test "x$FREEDRENO" = xyes; then
 	AC_DEFINE(HAVE_FREEDRENO, 1, [Have freedreno support])
 fi
 
+AM_CONDITIONAL(HAVE_TEGRA, [test "x$TEGRA" = xyes])
+if test "x$TEGRA" = xyes; then
+	AC_DEFINE(HAVE_TEGRA, 1, [Have TEGRA support])
+fi
+
 AM_CONDITIONAL(HAVE_INSTALL_TESTS, [test "x$INSTALL_TESTS" = xyes])
 if test "x$INSTALL_TESTS" = xyes; then
 	AC_DEFINE(HAVE_INSTALL_TESTS, 1, [Install test programs])
@@ -380,6 +390,8 @@ AC_CONFIG_FILES([
 	exynos/libdrm_exynos.pc
 	freedreno/Makefile
 	freedreno/libdrm_freedreno.pc
+	tegra/Makefile
+	tegra/libdrm_tegra.pc
 	tests/Makefile
 	tests/modeprint/Makefile
 	tests/modetest/Makefile
@@ -404,4 +416,5 @@ echo "  Nouveau API    $NOUVEAU"
 echo "  OMAP API       $OMAP"
 echo "  EXYNOS API     $EXYNOS"
 echo "  Freedreno API  $FREEDRENO"
+echo "  TEGRA API      $TEGRA"
 echo ""
tegra/Makefile.am new file +25 -0
new file mode 100644
index 0000000..72675e5
@@ -0,0 +1,25 @@
+AM_CFLAGS = \
+	$(WARN_CFLAGS) \
+	-I$(top_srcdir) \
+	-I$(top_srcdir)/tegra \
+	$(PTHREADSTUBS_CFLAGS) \
+	-I$(top_srcdir)/include/drm
+
+libdrm_tegra_la_LTLIBRARIES = libdrm_tegra.la
+libdrm_tegra_ladir = $(libdir)
+libdrm_tegra_la_LDFLAGS = -version-number 1:0:0 -no-undefined
+libdrm_tegra_la_LIBADD = ../libdrm.la @PTHREADSTUBS_LIBS@
+
+libdrm_tegra_la_SOURCES = \
+	tegra_drm.c
+
+libdrm_tegracommonincludedir = ${includedir}/tegra
+libdrm_tegracommoninclude_HEADERS = \
+	tegra_drm.h
+
+libdrm_tegraincludedir = ${includedir}/libdrm
+libdrm_tegrainclude_HEADERS = \
+	tegra_drmif.h
+
+pkgconfigdir = @pkgconfigdir@
+pkgconfig_DATA = libdrm_tegra.pc
tegra/class_ids.h new file +36 -0
new file mode 100644
index 0000000..b512306
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2012-2013 NVIDIA Corporation.
+ *
+ * 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 (including the next
+ * paragraph) 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.
+ *
+ * Authors:
+ *	Arto Merilainen <[email protected]>
+ */
+
+#ifndef CLASS_IDS_H_
+#define CLASS_IDS_H_
+
+enum host1x_class {
+	HOST1X_CLASS_HOST1X	= 0x1,
+	HOST1X_CLASS_GR2D	= 0x51,
+	HOST1X_CLASS_GR2D_SB	= 0x52
+};
+
+#endif
tegra/host1x01_hardware.h new file +125 -0

125 lines not on this page · raw message

tegra/hw_host1x01_uclass.h new file +155 -0

155 lines not on this page · raw message

tegra/libdrm_tegra.pc.in new file +10 -0
new file mode 100644
index 0000000..3ad8c6f
@@ -0,0 +1,10 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: libdrm_tegra
+Description: Userspace interface to tegra kernel DRM services
+Version: @PACKAGE_VERSION@
+Libs: -L${libdir} -ldrm_tegra
+Cflags: -I${includedir} -I${includedir}/libdrm -I${includedir}/tegra
tegra/tegra_drm.c new file +998 -0

998 lines not on this page · raw message

tegra/tegra_drm.h new file +136 -0

136 lines not on this page · raw message

tegra/tegra_drmif.h new file +110 -0

110 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#3 lore raw

RFC v2 2/2 tests: tegra: Add stream library test

In reply to a message not in the archive

This patch adds a minimal test set for the stream library and host1x kernel interface.

The test verifies that the driver (or library) is able to:
- Increment, read and wait for syncpoint values
- Use a host1x channel to do host1x operations
- Handle submit timeout correctly
- Do relocations to buffer
- Allocate and release memory
- Use stream pools correctly

---
 configure.ac                           |    1 +
 tests/tegra/host1x/Makefile.am         |   12 +
 tests/tegra/host1x/tegra_host1x_test.c |  893 ++++++++++++++++++++++++++++++++
 3 files changed, 906 insertions(+)
 create mode 100644 tests/tegra/host1x/Makefile.am
 create mode 100644 tests/tegra/host1x/tegra_host1x_test.c
configure.ac +1 -0
index e55e9c1..a678bcd 100644
@@ -399,6 +399,7 @@ AC_CONFIG_FILES([
 	tests/radeon/Makefile
 	tests/vbltest/Makefile
 	tests/exynos/Makefile
+	tests/tegra/host1x/Makefile
 	include/Makefile
 	include/drm/Makefile
 	man/Makefile
tests/tegra/host1x/Makefile.am new file +12 -0
new file mode 100644
index 0000000..700f764
@@ -0,0 +1,12 @@
+AM_CFLAGS = \
+	-I $(top_srcdir)/include/drm \
+	-I $(top_srcdir)
+
+LDADD = \
+	$(top_builddir)/libdrm.la
+
+noinst_PROGRAMS = \
+	tegra_host1x_test
+
+tegra_host1x_test_SOURCES = \
+	tegra_host1x_test.c
tests/tegra/host1x/tegra_host1x_test.c new file +893 -0

893 lines not on this page · raw message

Signature · 1 line
1.7.9.5