Final batch of Android related fixes
Subsystems (2)
cover Final batch of Android related fixes
Hello list,
Here is the final batch that I've been planning to get upstreamed. Everything else that remains are some custom downstream "hacks" that will get upstreamed by their original authors in due time :)
Highlights:
- Drop a few unneeded Makefiles.
- Android support for libkms & modetest. Inspired by Benjamin
Gaignard's work.
- Private mmap/munmap wrappers to hide all the love that bionic has for
us :)
The series is available in branch 'android-final-fixes' at
https://github.com/evelikov/libdrm
Any comments, reviews, it builds or it works are appreciated.
-Emil
PATCH 1/18 automake: remove obsolete makefiles
Rather than having two extra makefiles in order to ship ~10 headers just fold its 5 lines of code into the top one makefile.
--- Android.mk | 8 +++----- Makefile.am | 10 +++++++++- Makefile.sources | 19 +++++++++++++++++++ configure.ac | 2 -- include/Makefile.am | 1 - include/drm/Makefile.am | 32 -------------------------------- include/drm/Makefile.sources | 18 ------------------ 7 files changed, 31 insertions(+), 59 deletions(-) delete mode 100644 include/Makefile.am delete mode 100644 include/drm/Makefile.am delete mode 100644 include/drm/Makefile.sources
Android.mk +3 -5
@@ -26,10 +26,8 @@ include $(CLEAR_VARS) LIBDRM_TOP := $(LOCAL_PATH) -# Import variables LIBDRM_FILES, LIBDRM_H_FILES +# Import variables LIBDRM_{,H_,INCLUDE_H_,INCLUDE_VMWGFX_H_}FILES include $(LOCAL_PATH)/Makefile.sources -# Import variables LIBDRM_INCLUDE_H_FILES, LIBDRM_INCLUDE_VMWGFX_H_FILES -include $(LOCAL_PATH)/include/drm/Makefile.sources LOCAL_MODULE := libdrm LOCAL_MODULE_TAGS := optional
@@ -47,8 +45,8 @@ LOCAL_CFLAGS := \ LOCAL_COPY_HEADERS := \ $(LIBDRM_H_FILES) \ - $(addprefix include/drm/,$(LIBDRM_INCLUDE_H_FILES)) \ - $(addprefix include/drm/,$(LIBDRM_INCLUDE_VMWGFX_H_FILES)) + $(LIBDRM_INCLUDE_H_FILES) \ + $(LIBDRM_INCLUDE_VMWGFX_H_FILES) LOCAL_COPY_HEADERS_TO := libdrm include $(BUILD_SHARED_LIBRARY)
Makefile.am +9 -1
@@ -53,7 +53,7 @@ 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 +SUBDIRS = . $(LIBKMS_SUBDIR) $(INTEL_SUBDIR) $(NOUVEAU_SUBDIR) $(RADEON_SUBDIR) $(OMAP_SUBDIR) $(EXYNOS_SUBDIR) $(FREEDRENO_SUBDIR) tests man libdrm_la_LTLIBRARIES = libdrm.la libdrm_ladir = $(libdir)
@@ -71,6 +71,14 @@ libdrminclude_HEADERS = $(LIBDRM_H_FILES) EXTRA_DIST = libdrm.pc.in include/drm/* +klibdrmincludedir = ${includedir}/libdrm +klibdrminclude_HEADERS = $(LIBDRM_INCLUDE_H_FILES) + +if HAVE_VMWGFX +klibdrminclude_HEADERS += $(LIBDRM_INCLUDE_VMWGFX_H_FILES) +endif + + copy-headers : cp -r $(kernel_source)/usr/include/drm $(top_srcdir)/include
Makefile.sources +19 -0
@@ -11,3 +11,22 @@ LIBDRM_FILES := \ LIBDRM_H_FILES := \ xf86drm.h \ xf86drmMode.h + +LIBDRM_INCLUDE_H_FILES := \ + include/drm/drm.h \ + include/drm/drm_fourcc.h \ + include/drm/drm_mode.h \ + include/drm/drm_sarea.h \ + include/drm/i915_drm.h \ + include/drm/mach64_drm.h \ + include/drm/mga_drm.h \ + include/drm/nouveau_drm.h \ + include/drm/qxl_drm.h \ + include/drm/r128_drm.h \ + include/drm/radeon_drm.h \ + include/drm/savage_drm.h \ + include/drm/sis_drm.h \ + include/drm/via_drm.h + +LIBDRM_INCLUDE_VMWGFX_H_FILES := \ + include/drm/vmwgfx_drm.h
configure.ac +0 -2
@@ -410,8 +410,6 @@ AC_CONFIG_FILES([ tests/radeon/Makefile tests/vbltest/Makefile tests/exynos/Makefile - include/Makefile - include/drm/Makefile man/Makefile libdrm.pc]) AC_OUTPUT
include/Makefile.am deleted +0 -1
@@ -1 +0,0 @@ -SUBDIRS = drm
include/drm/Makefile.am deleted +0 -32
@@ -1,32 +0,0 @@ -# Copyright 2005 Adam Jackson. -# -# 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 -# on the rights to use, copy, modify, merge, publish, distribute, sub -# license, 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 NON-INFRINGEMENT. IN NO EVENT SHALL -# ADAM JACKSON 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. - -# XXX airlied says, nothing besides *_drm.h and drm*.h should be necessary. -# however, r300 and via need their reg headers installed in order to build. -# better solutions are welcome. - -include Makefile.sources - -klibdrmincludedir = ${includedir}/libdrm -klibdrminclude_HEADERS = $(LIBDRM_INCLUDE_H_FILES) - -if HAVE_VMWGFX -klibdrminclude_HEADERS += $(LIBDRM_INCLUDE_VMWGFX_H_FILES) -endif
include/drm/Makefile.sources deleted +0 -18
@@ -1,18 +0,0 @@ -LIBDRM_INCLUDE_H_FILES := \ - drm.h \ - drm_mode.h \ - drm_fourcc.h \ - drm_sarea.h \ - i915_drm.h \ - mga_drm.h \ - nouveau_drm.h \ - r128_drm.h \ - radeon_drm.h \ - savage_drm.h \ - sis_drm.h \ - via_drm.h \ - mach64_drm.h \ - qxl_drm.h - -LIBDRM_INCLUDE_VMWGFX_H_FILES := \ - vmwgfx_drm.h
Signature · 1 line
2.0.2
PATCH 2/18 Remove i810_drm.h and i830_drm.h from the distribution tarball
In reply to Emil VelikovBoth of these headers are not installed since they were imported. They are not even used internally. The latter does not exist in the kernel...
Note the * symbol in EXTRA_DIST causes 'make distcheck' fail. When was the last time we ran it ?
--- Makefile.am | 2 +- include/drm/i810_drm.h | 281 ---------------------------------------- include/drm/i830_drm.h | 342 ------------------------------------------------- 3 files changed, 1 insertion(+), 624 deletions(-) delete mode 100644 include/drm/i810_drm.h delete mode 100644 include/drm/i830_drm.h
Makefile.am +1 -1
@@ -69,7 +69,7 @@ libdrm_la_SOURCES = $(LIBDRM_FILES) libdrmincludedir = ${includedir} libdrminclude_HEADERS = $(LIBDRM_H_FILES) -EXTRA_DIST = libdrm.pc.in include/drm/* +EXTRA_DIST = libdrm.pc.in klibdrmincludedir = ${includedir}/libdrm klibdrminclude_HEADERS = $(LIBDRM_INCLUDE_H_FILES)
include/drm/i810_drm.h deleted +0 -281
281 lines not on this page · raw message
include/drm/i830_drm.h deleted +0 -342
342 lines not on this page · raw message
Signature · 6 lines
2.0.2 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 3/18 automake: fix 'make commit-headers'
In reply to Emil VelikovNot too long ago the in-kernel drm public headers were moved. Since then we could no longer fetch/update the ones in libdrm using the command.
--- Makefile.am | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Makefile.am +2 -2
@@ -80,8 +80,8 @@ endif copy-headers : - cp -r $(kernel_source)/usr/include/drm $(top_srcdir)/include + cp -r $(kernel_source)/include/uapi/drm/*.h $(top_srcdir)/include/drm/ commit-headers : copy-headers - git add include + git add include/drm/*.h git commit -am "Copy headers from kernel $$(GIT_DIR=$(kernel_source)/.git git describe)"
Signature · 1 line
2.0.2
PATCH 4/18 configure: unconditionally check for atomic ops/primitives
In reply to Emil VelikovJust have the check once, and let new drivers opt-in if they want to use them. Move the block further up the script, to tie nicely with the actual usage of $HW defines.
Move the final $HW users to be alongside their brethren.
--- configure.ac | 167 +++++++++++++++++++++++++++++------------------------------ 1 file changed, 82 insertions(+), 85 deletions(-)
configure.ac +82 -85
@@ -177,6 +177,81 @@ AC_CACHE_CHECK([for supported warning flags], libdrm_cv_warn_cflags, [ AC_MSG_CHECKING([which warning flags were supported])]) WARN_CFLAGS="$libdrm_cv_warn_cflags" +# Check for atomic intrinsics +AC_CACHE_CHECK([for native atomic primitives], drm_cv_atomic_primitives, [ + drm_cv_atomic_primitives="none" + + AC_LINK_IFELSE([AC_LANG_PROGRAM([[ + int atomic_add(int i) { return __sync_fetch_and_add (&i, 1); } + int atomic_cmpxchg(int i, int j, int k) { return __sync_val_compare_and_swap (&i, j, k); } + ]],[[]])], [drm_cv_atomic_primitives="Intel"],[]) + + if test "x$drm_cv_atomic_primitives" = "xnone"; then + AC_CHECK_HEADER([atomic_ops.h], drm_cv_atomic_primitives="libatomic-ops") + fi + + # atomic functions defined in <atomic.h> & libc on Solaris + if test "x$drm_cv_atomic_primitives" = "xnone"; then + AC_CHECK_FUNC([atomic_cas_uint], drm_cv_atomic_primitives="Solaris") + fi +]) + +if test "x$drm_cv_atomic_primitives" = xIntel; then + AC_DEFINE(HAVE_LIBDRM_ATOMIC_PRIMITIVES, 1, + [Enable if your compiler supports the Intel __sync_* atomic primitives]) +fi +if test "x$drm_cv_atomic_primitives" = "xlibatomic-ops"; then + AC_DEFINE(HAVE_LIB_ATOMIC_OPS, 1, [Enable if you have libatomic-ops-dev installed]) +fi + +if test "x$INTEL" != "xno" -o "x$RADEON" != "xno" -o "x$NOUVEAU" != "xno"; then + if test "x$drm_cv_atomic_primitives" = "xnone"; then + if test "x$INTEL" != "xauto"; then + if test "x$INTEL" != "xno"; then + AC_MSG_ERROR([libdrm_intel depends upon atomic operations, which were not found for your compiler/cpu. Try compiling with -march=native, or install the libatomics-op-dev package, or, failing both of those, disable support for Intel GPUs by passing --disable-intel to ./configure]) + fi + else + AC_MSG_WARN([Disabling libdrm_intel. It depends on atomic operations, which were not found for your compiler/cpu. Try compiling with -march=native, or install the libatomics-op-dev package.]) + INTEL=no + fi + if test "x$RADEON" != "xauto"; then + if test "x$RADEON" != "xno"; then + AC_MSG_ERROR([libdrm_radeon depends upon atomic operations, which were not found for your compiler/cpu. Try compiling with -march=native, or install the libatomics-op-dev package, or, failing both of those, disable support for Radeon GPUs by passing --disable-radeon to ./configure]) + fi + else + AC_MSG_WARN([Disabling libdrm_radeon. It depends on atomic operations, which were not found for your compiler/cpu. Try compiling with -march=native, or install the libatomics-op-dev package.]) + RADEON=no + fi + if test "x$NOUVEAU" != "xauto"; then + if test "x$NOUVEAU" != "xno"; then + AC_MSG_ERROR([libdrm_nouveau depends upon atomic operations, which were not found for your compiler/cpu. Try compiling with -march=native, or install the libatomics-op-dev package, or, failing both of those, disable support for NVIDIA GPUs by passing --disable-nouveau to ./configure]) + fi + else + AC_MSG_WARN([Disabling libdrm_nouveau. It depends on atomic operations, which were not found for your compiler/cpu. Try compiling with -march=native, or install the libatomics-op-dev package.]) + NOUVEAU=no + fi + else + if test "x$INTEL" != "xno"; then + case $host_cpu in + i?86|x86_64) INTEL=yes ;; + *) INTEL=no ;; + esac + fi + if test "x$RADEON" != "xno"; then + RADEON=yes + fi + if test "x$NOUVEAU" != "xno"; then + NOUVEAU=yes + fi + fi +fi + +if test "x$INTEL" != "xno"; then + PKG_CHECK_MODULES(PCIACCESS, [pciaccess >= 0.10]) +fi +AC_SUBST(PCIACCESS_CFLAGS) +AC_SUBST(PCIACCESS_LIBS) + if test "x$UDEV" = xyes; then AC_DEFINE(UDEV, 1, [Have UDEV support]) fi
@@ -194,6 +269,8 @@ fi AM_CONDITIONAL(HAVE_LIBKMS, [test "x$LIBKMS" = xyes]) +AM_CONDITIONAL(HAVE_INTEL, [test "x$INTEL" = xyes]) + AM_CONDITIONAL(HAVE_VMWGFX, [test "x$VMWGFX" = xyes]) if test "x$VMWGFX" = xyes; then AC_DEFINE(HAVE_VMWGFX, 1, [Have vmwgfx kernel headers])
@@ -219,6 +296,11 @@ if test "x$FREEDRENO" = xyes; then AC_DEFINE(HAVE_FREEDRENO, 1, [Have freedreno support]) fi +AM_CONDITIONAL(HAVE_RADEON, [test "x$RADEON" = xyes]) +if test "x$RADEON" = xyes; then + AC_DEFINE(HAVE_RADEON, 1, [Have radeon 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])
@@ -270,96 +352,11 @@ 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" -o "x$FREEDRENO" != "xno"; then - # Check for atomic intrinsics - AC_CACHE_CHECK([for native atomic primitives], drm_cv_atomic_primitives, - [ - drm_cv_atomic_primitives="none" - - AC_LINK_IFELSE([AC_LANG_PROGRAM([[ - int atomic_add(int i) { return __sync_fetch_and_add (&i, 1); } - int atomic_cmpxchg(int i, int j, int k) { return __sync_val_compare_and_swap (&i, j, k); } - ]],[[]])], - [drm_cv_atomic_primitives="Intel"],[]) - - if test "x$drm_cv_atomic_primitives" = "xnone"; then - AC_CHECK_HEADER([atomic_ops.h], drm_cv_atomic_primitives="libatomic-ops") - fi - - # atomic functions defined in <atomic.h> & libc on Solaris - if test "x$drm_cv_atomic_primitives" = "xnone"; then - AC_CHECK_FUNC([atomic_cas_uint], - drm_cv_atomic_primitives="Solaris") - fi - - ]) - if test "x$drm_cv_atomic_primitives" = xIntel; then - AC_DEFINE(HAVE_LIBDRM_ATOMIC_PRIMITIVES, 1, - [Enable if your compiler supports the Intel __sync_* atomic primitives]) - fi - if test "x$drm_cv_atomic_primitives" = "xlibatomic-ops"; then - AC_DEFINE(HAVE_LIB_ATOMIC_OPS, 1, [Enable if you have libatomic-ops-dev installed]) - fi - - if test "x$drm_cv_atomic_primitives" = "xnone"; then - if test "x$INTEL" != "xauto"; then - if test "x$INTEL" != "xno"; then - AC_MSG_ERROR([libdrm_intel depends upon atomic operations, which were not found for your compiler/cpu. Try compiling with -march=native, or install the libatomics-op-dev package, or, failing both of those, disable support for Intel GPUs by passing --disable-intel to ./configure]) - fi - else - AC_MSG_WARN([Disabling libdrm_intel. It depends on atomic operations, which were not found for your compiler/cpu. Try compiling with -march=native, or install the libatomics-op-dev package.]) - INTEL=no - fi - if test "x$RADEON" != "xauto"; then - if test "x$RADEON" != "xno"; then - AC_MSG_ERROR([libdrm_radeon depends upon atomic operations, which were not found for your compiler/cpu. Try compiling with -march=native, or install the libatomics-op-dev package, or, failing both of those, disable support for Radeon support by passing --disable-radeon to ./configure]) - fi - else - AC_MSG_WARN([Disabling libdrm_radeon. It depends on atomic operations, which were not found for your compiler/cpu. Try compiling with -march=native, or install the libatomics-op-dev package.]) - RADEON=no - fi - if test "x$NOUVEAU" != "xauto"; then - if test "x$NOUVEAU" != "xno"; then - AC_MSG_ERROR([libdrm_nouveau depends upon atomic operations, which were not found for your compiler/cpu. Try compiling with -march=native, or install the libatomics-op-dev package, or, failing both of those, disable support for NVIDIA GPUs by passing --disable-nouveau to ./configure]) - fi - else - AC_MSG_WARN([Disabling libdrm_nouveau. It depends on atomic operations, which were not found for your compiler/cpu. Try compiling with -march=native, or install the libatomics-op-dev package.]) - NOUVEAU=no - fi - else - if test "x$INTEL" != "xno"; then - case $host_cpu in - i?86|x86_64) INTEL=yes ;; - *) INTEL=no ;; - esac - fi - if test "x$RADEON" != "xno"; then - RADEON=yes - fi - if test "x$NOUVEAU" != "xno"; then - NOUVEAU=yes - fi - fi -fi - -if test "x$INTEL" != "xno"; then - PKG_CHECK_MODULES(PCIACCESS, [pciaccess >= 0.10]) -fi -AC_SUBST(PCIACCESS_CFLAGS) -AC_SUBST(PCIACCESS_LIBS) - PKG_CHECK_MODULES(VALGRIND, [valgrind], [have_valgrind=yes], [have_valgrind=no]) if test "x$have_valgrind" = "xyes"; then AC_DEFINE([HAVE_VALGRIND], 1, [Use valgrind intrinsics to suppress false warnings]) fi -AM_CONDITIONAL(HAVE_INTEL, [test "x$INTEL" != "xno"]) -AM_CONDITIONAL(HAVE_RADEON, [test "x$RADEON" != "xno"]) -AM_CONDITIONAL(HAVE_NOUVEAU, [test "x$NOUVEAU" != "xno"]) -if test "x$RADEON" = xyes; then - AC_DEFINE(HAVE_RADEON, 1, [Have radeon support]) -fi - AC_ARG_WITH([kernel-source], [AS_HELP_STRING([--with-kernel-source], [specify path to linux kernel source])],
Signature · 1 line
2.0.2
PATCH 5/18 libkms: build the intel backend only when needed
In reply to Emil Velikov--- configure.ac | 3 +++ libkms/Makefile.am | 5 ++++- libkms/linux.c | 16 +++++++++++----- 3 files changed, 18 insertions(+), 6 deletions(-)
configure.ac +3 -0
@@ -270,6 +270,9 @@ fi AM_CONDITIONAL(HAVE_LIBKMS, [test "x$LIBKMS" = xyes]) AM_CONDITIONAL(HAVE_INTEL, [test "x$INTEL" = xyes]) +if test "x$INTEL" = xyes; then + AC_DEFINE(HAVE_INTEL, 1, [Have intel support]) +fi AM_CONDITIONAL(HAVE_VMWGFX, [test "x$VMWGFX" = xyes]) if test "x$VMWGFX" = xyes; then
libkms/Makefile.am +4 -1
@@ -15,7 +15,6 @@ libkms_la_LIBADD = ../libdrm.la libkms_la_SOURCES = \ internal.h \ linux.c \ - intel.c \ dumb.c \ api.c
@@ -23,6 +22,10 @@ if HAVE_VMWGFX libkms_la_SOURCES += vmwgfx.c endif +if HAVE_INTEL +libkms_la_SOURCES += intel.c +endif + if HAVE_NOUVEAU libkms_la_SOURCES += nouveau.c endif
libkms/linux.c +11 -5
@@ -103,25 +103,31 @@ linux_from_sysfs(int fd, struct kms_driver **out)if (ret)return ret; +#ifdef HAVE_INTEL if (!strcmp (name,"intel" )) ret =intel_create (fd, out); + else +#endif #ifdef HAVE_VMWGFX - else if (!strcmp(name, "vmwgfx")) +if (!strcmp (name,"vmwgfx" )) ret =vmwgfx_create (fd, out); + else#endif #ifdef HAVE_NOUVEAU - else if (!strcmp(name, "nouveau")) +if (!strcmp (name,"nouveau" )) ret =nouveau_create (fd, out); + else#endif #ifdef HAVE_RADEON - else if (!strcmp(name, "radeon")) +if (!strcmp (name,"radeon" )) ret =radeon_create (fd, out); + else#endif #ifdef HAVE_EXYNOS - else if (!strcmp(name, "exynos")) +if (!strcmp (name,"exynos" )) ret =exynos_create (fd, out); -#endif else +#endif ret = -ENOSYS ;free (name);
Signature · 1 line
2.0.2
Re: [PATCH 05/18] libkms: build the intel backend only when needed
Quoted 6 lines · Emil Velikov
Signed-off-by Emil Velikov <[email protected]>--- configure.ac | 3 +++ libkms/Makefile.am | 5 ++++- libkms/linux.c | 16 +++++++++++----- 3 files changed, 18 insertions(+), 6 deletions(-)
Cheers, Jakob.
Quoted 86 lines
configure.ac +3
-0@@ -270,6 +270,9 @@ fi AM_CONDITIONAL(HAVE_LIBKMS, [test "x$LIBKMS" = xyes]) AM_CONDITIONAL(HAVE_INTEL, [test "x$INTEL" = xyes]) +if test "x$INTEL" = xyes; then + AC_DEFINE(HAVE_INTEL, 1, [Have intel support]) +fi AM_CONDITIONAL(HAVE_VMWGFX, [test "x$VMWGFX" = xyes]) if test "x$VMWGFX" = xyes; thenlibkms/Makefile.am +4
-1@@ -15,7 +15,6 @@ libkms_la_LIBADD = ../libdrm.la libkms_la_SOURCES = \ internal.h \ linux.c \ - intel.c \ dumb.c \ api.c@@ -23,6 +22,10 @@ if HAVE_VMWGFX libkms_la_SOURCES += vmwgfx.c endif +if HAVE_INTEL +libkms_la_SOURCES += intel.c +endif + if HAVE_NOUVEAU libkms_la_SOURCES += nouveau.c endiflibkms/linux.c +11
-6@@ -103,25 +103,31 @@ linux_from_sysfs(int fd, struct kms_driver **out)if (ret)return ret; +#ifdef HAVE_INTEL if (!strcmp (name,"intel" )) ret =intel_create (fd, out); + else +#endif #ifdef HAVE_VMWGFX - else if (!strcmp(name, "vmwgfx")) +if (!strcmp (name,"vmwgfx" )) ret =vmwgfx_create (fd, out); + else#endif #ifdef HAVE_NOUVEAU - else if (!strcmp(name, "nouveau")) +if (!strcmp (name,"nouveau" )) ret =nouveau_create (fd, out); + else#endif #ifdef HAVE_RADEON - else if (!strcmp(name, "radeon")) +if (!strcmp (name,"radeon" )) ret =radeon_create (fd, out); + else#endif #ifdef HAVE_EXYNOS - else if (!strcmp(name, "exynos")) +if (!strcmp (name,"exynos" )) ret =exynos_create (fd, out); -#endif else +#endif ret = -ENOSYS ;free (name); --2.0.2
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 6/18 libkms: move sources lists to makefile.sources
In reply to Emil Velikov--- libkms/Makefile.am | 20 +++++++++----------- libkms/Makefile.sources | 23 +++++++++++++++++++++++ 2 files changed, 32 insertions(+), 11 deletions(-) create mode 100644 libkms/Makefile.sources
libkms/Makefile.am +9 -11
@@ -1,3 +1,5 @@ +include Makefile.sources + AM_CFLAGS = \ $(WARN_CFLAGS) \ -I$(top_srcdir)/include/drm \
@@ -12,35 +14,31 @@ libkms_la_LIBADD = ../libdrm.la #libkms_la_LIBADD += $(LIBUDEV_LIBS) #endif -libkms_la_SOURCES = \ - internal.h \ - linux.c \ - dumb.c \ - api.c +libkms_la_SOURCES = $(LIBKMS_FILES) if HAVE_VMWGFX -libkms_la_SOURCES += vmwgfx.c +libkms_la_SOURCES += $(LIBKMS_VMWGFX_FILES) endif if HAVE_INTEL -libkms_la_SOURCES += intel.c +libkms_la_SOURCES += $(LIBKMS_INTEL_FILES) endif if HAVE_NOUVEAU -libkms_la_SOURCES += nouveau.c +libkms_la_SOURCES += $(LIBKMS_NOUVEAU_FILES) endif if HAVE_RADEON -libkms_la_SOURCES += radeon.c +libkms_la_SOURCES += $(LIBKMS_RADEON_FILES) endif if HAVE_EXYNOS -libkms_la_SOURCES += exynos.c +libkms_la_SOURCES += $(LIBKMS_EXYNOS_FILES) AM_CFLAGS += -I$(top_srcdir)/exynos endif libkmsincludedir = ${includedir}/libkms -libkmsinclude_HEADERS = libkms.h +libkmsinclude_HEADERS = $(LIBKMS_H_FILES) pkgconfigdir = @pkgconfigdir@ pkgconfig_DATA = libkms.pc
libkms/Makefile.sources new file +23 -0
@@ -0,0 +1,23 @@ +LIBKMS_FILES := \ + internal.h \ + linux.c \ + dumb.c \ + api.c + +LIBKMS_VMWGFX_FILES := \ + vmwgfx.c + +LIBKMS_INTEL_FILES := \ + intel.c + +LIBKMS_NOUVEAU_FILES := \ + nouveau.c + +LIBKMS_RADEON_FILES := \ + radeon.c + +LIBKMS_EXYNOS_FILES := \ + exynos.c + +LIBKMS_H_FILES := \ + libkms.h
Signature · 1 line
2.0.2
PATCH 7/18 libkms: add Android build
In reply to Emil Velikov--- Android.mk | 3 ++- libkms/Android.mk | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 libkms/Android.mk
Android.mk +2 -1
@@ -55,7 +55,8 @@ SUBDIRS := \ freedreno \ intel \ nouveau \ - radeon + radeon \ + libkms mkfiles := $(patsubst %,$(LIBDRM_TOP)/%/Android.mk,$(SUBDIRS)) include $(mkfiles)
libkms/Android.mk new file +53 -0
53 lines not on this page · raw message
Signature · 1 line
2.0.2
Re: [PATCH 07/18] libkms: add Android build
Quoted 7 lines · Emil Velikov
Cc Benjamin Gaignard <[email protected]>Signed-off-by Emil Velikov <[email protected]>--- Android.mk | 3 ++- libkms/Android.mk | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 libkms/Android.mk
Not super familiar with Android build system but it looks good to me:
Cheers, Jakob.
Quoted 81 lines
Android.mk +2
-1@@ -55,7 +55,8 @@ SUBDIRS := \ freedreno \ intel \ nouveau \ - radeon + radeon \ + libkms mkfiles := $(patsubst %,$(LIBDRM_TOP)/%/Android.mk,$(SUBDIRS)) include $(mkfiles)libkms/Android.mk new file +53
-1@@ -0,0 +1,53 @@ +DRM_GPU_DRIVERS := $(strip $(filter-out swrast, $(BOARD_GPU_DRIVERS))) + +intel_drivers := i915 i965 i915g ilo +radeon_drivers := r300g r600g radeonsi +nouveau_drivers := nouveau +vmwgfx_drivers := vmwgfx + +valid_drivers := \ + $(intel_drivers) \ + $(radeon_drivers) \ + $(nouveau_drivers) \ + $(vmwgfx_drivers) + +# warn about invalid drivers +invalid_drivers := $(filter-out $(valid_drivers), $(DRM_GPU_DRIVERS)) +ifneq ($(invalid_drivers),) +$(warning invalid GPU drivers: $(invalid_drivers)) +# tidy up +DRM_GPU_DRIVERS := $(filter-out $(invalid_drivers), $(DRM_GPU_DRIVERS)) +endif + +LOCAL_PATH := $(call my-dir) + +include $(CLEAR_VARS) +include $(LOCAL_PATH)/Makefile.sources + +LOCAL_SRC_FILES := $(LIBKMS_FILES) + +ifneq ($(filter $(vmwgfx_drivers), $(DRM_GPU_DRIVERS)),) +LOCAL_SRC_FILES += $(LIBKMS_VMWGFX_FILES) +endif + +ifneq ($(filter $(intel_drivers), $(DRM_GPU_DRIVERS)),) +LOCAL_SRC_FILES += $(LIBKMS_INTEL_FILES) +endif + +ifneq ($(filter $(nouveau_drivers), $(DRM_GPU_DRIVERS)),) +LOCAL_SRC_FILES += $(LIBKMS_NOUVEAU_FILES) +endif + +ifneq ($(filter $(radeon_drivers), $(DRM_GPU_DRIVERS)),) +LOCAL_SRC_FILES += $(LIBKMS_RADEON_FILES) +endif + +LOCAL_MODULE := libkms +LOCAL_SHARED_LIBRARIES := libdrm + +LOCAL_C_INCLUDES += $(TARGET_OUT_HEADERS)/libdrm + +LOCAL_COPY_HEADERS_TO := libdrm +LOCAL_COPY_HEADERS := $(LIBKMS_H_FILES) + +include $(BUILD_SHARED_LIBRARY) --2.0.2
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 8/18 modetest: move sources lists to makefiles.sources
In reply to Emil Velikov--- tests/modetest/Makefile.am | 7 +++---- tests/modetest/Makefile.sources | 6 ++++++ 2 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 tests/modetest/Makefile.sources
tests/modetest/Makefile.am +3 -4
@@ -1,3 +1,5 @@ +include Makefile.sources + AM_CFLAGS = $(filter-out -Wpointer-arith, $(WARN_CFLAGS)) AM_CFLAGS += \
@@ -13,10 +15,7 @@ noinst_PROGRAMS = \ modetest endif -modetest_SOURCES = \ - buffers.c buffers.h \ - cursor.c cursor.h \ - modetest.c +modetest_SOURCES = $(MODETEST_FILES) modetest_LDADD = \ $(top_builddir)/libdrm.la \
tests/modetest/Makefile.sources new file +6 -0
@@ -0,0 +1,6 @@ +MODETEST_FILES := \ + buffers.c \ + buffers.h \ + cursor.c \ + cursor.h \ + modetest.c
Signature · 1 line
2.0.2
PATCH 9/18 modetest: add Android build
In reply to Emil Velikov--- Android.mk | 3 ++- tests/modetest/Android.mk | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 tests/modetest/Android.mk
Android.mk +2 -1
@@ -56,7 +56,8 @@ SUBDIRS := \ intel \ nouveau \ radeon \ - libkms + libkms \ + tests/modeset mkfiles := $(patsubst %,$(LIBDRM_TOP)/%/Android.mk,$(SUBDIRS)) include $(mkfiles)
tests/modetest/Android.mk new file +14 -0
@@ -0,0 +1,14 @@ +LOCAL_PATH := $(call my-dir) + +include $(CLEAR_VARS) +include $(LOCAL_PATH)/Makefile.sources + +LOCAL_SRC_FILES := $(MODETEST_FILES) + +LOCAL_MODULE := modetest + +LOCAL_C_INCLUDES += $(TARGET_OUT_HEADERS)/libdrm + +LOCAL_SHARED_LIBRARIES := libdrm libkms + +include $(BUILD_EXECUTABLE)
Signature · 1 line
2.0.2
PATCH v2 9/18 modetest: add Android build
v2: include modetest rather than modeset.
Spotted by Mauro Rossi and Paulo Sergio.
--- Android.mk | 3 ++- tests/modetest/Android.mk | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 tests/modetest/Android.mk
Android.mk +2 -1
@@ -56,7 +56,8 @@ SUBDIRS := \ intel \ nouveau \ radeon \ - libkms + libkms \ + tests/modetest mkfiles := $(patsubst %,$(LIBDRM_TOP)/%/Android.mk,$(SUBDIRS)) include $(mkfiles)
tests/modetest/Android.mk new file +14 -0
@@ -0,0 +1,14 @@ +LOCAL_PATH := $(call my-dir) + +include $(CLEAR_VARS) +include $(LOCAL_PATH)/Makefile.sources + +LOCAL_SRC_FILES := $(MODETEST_FILES) + +LOCAL_MODULE := modetest + +LOCAL_C_INCLUDES += $(TARGET_OUT_HEADERS)/libdrm + +LOCAL_SHARED_LIBRARIES := libdrm libkms + +include $(BUILD_EXECUTABLE)
Signature · 1 line
2.1.0
PATCH 10/18 modetest: Add support of STI driver
In reply to Emil VelikovFrom: Benjamin Gaignard <[email protected]>
--- tests/modetest/modetest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tests/modetest/modetest.c +1 -1
@@ -1437,7 +1437,7 @@ int main(int argc, char **argv)int drop_master =0 ;int test_vsync =0 ;int test_cursor =0 ; -const char *modules[] = {"i915" ,"radeon" ,"nouveau" ,"vmwgfx" ,"omapdrm" ,"exynos" ,"tilcdc" ,"msm" }; +const char *modules[] = {"i915" ,"radeon" ,"nouveau" ,"vmwgfx" ,"omapdrm" ,"exynos" ,"tilcdc" ,"msm" ,"sti" };char *device =NULL ;char *module =NULL ;unsigned int i;
Signature · 1 line
2.0.2
PATCH 11/18 automake: pick up all files for distribution.
In reply to Emil VelikovAutotools is already smart enough to pick the *.pc.in files but it needs some help with the Android.mk ones.
--- Makefile.am | 2 +- freedreno/Makefile.am | 2 ++ intel/Makefile.am | 3 ++- libkms/Makefile.am | 2 +- nouveau/Makefile.am | 2 ++ radeon/Makefile.am | 2 +- tests/modetest/Makefile.am | 2 ++ 7 files changed, 11 insertions(+), 4 deletions(-)
Makefile.am +1 -1
@@ -69,7 +69,7 @@ libdrm_la_SOURCES = $(LIBDRM_FILES) libdrmincludedir = ${includedir} libdrminclude_HEADERS = $(LIBDRM_H_FILES) -EXTRA_DIST = libdrm.pc.in +EXTRA_DIST = Android.mk klibdrmincludedir = ${includedir}/libdrm klibdrminclude_HEADERS = $(LIBDRM_INCLUDE_H_FILES)
freedreno/Makefile.am +2 -0
@@ -21,3 +21,5 @@ libdrm_freedrenocommoninclude_HEADERS = $(LIBDRM_FREEDRENO_H_FILES) pkgconfigdir = @pkgconfigdir@ pkgconfig_DATA = libdrm_freedreno.pc + +EXTRA_DIST = Android.mk
intel/Makefile.am +2 -1
@@ -68,7 +68,8 @@ EXTRA_DIST = \ $(BATCHES:.batch=.batch.sh) \ $(BATCHES:.batch=.batch-ref.txt) \ $(BATCHES:.batch=.batch-ref.txt) \ - tests/test-batch.sh + tests/test-batch.sh \ + Android.mk test_decode_LDADD = libdrm_intel.la ../libdrm.la
libkms/Makefile.am +1 -1
@@ -43,4 +43,4 @@ libkmsinclude_HEADERS = $(LIBKMS_H_FILES) pkgconfigdir = @pkgconfigdir@ pkgconfig_DATA = libkms.pc -EXTRA_DIST = libkms.pc.in +EXTRA_DIST = Android.mk
nouveau/Makefile.am +2 -0
@@ -21,3 +21,5 @@ libdrm_nouveauinclude_HEADERS = $(LIBDRM_NOUVEAU_H_FILES) pkgconfigdir = @pkgconfigdir@ pkgconfig_DATA = libdrm_nouveau.pc + +EXTRA_DIST = Android.mk
radeon/Makefile.am +1 -1
@@ -45,4 +45,4 @@ libdrm_radeoninclude_HEADERS = $(LIBDRM_RADEON_H_FILES) pkgconfigdir = @pkgconfigdir@ pkgconfig_DATA = libdrm_radeon.pc -EXTRA_DIST = libdrm_radeon.pc.in +EXTRA_DIST = Android.mk
tests/modetest/Makefile.am +2 -0
@@ -25,3 +25,5 @@ if HAVE_CAIRO AM_CFLAGS += $(CAIRO_CFLAGS) modetest_LDADD += $(CAIRO_LIBS) endif + +EXTRA_DIST = Android.mk
Signature · 1 line
2.0.2
PATCH 12/18 Add private mmap/munmap wrappers
In reply to Emil VelikovUnlike Linux, Android (bionic) has separate functions - mmap & mmap64. Add a local wrapper (inspired by gallium) that will be used throughout libdrm to combat this bionic feature.
--- libdrm.h | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+)
libdrm.h +45 -0
@@ -31,4 +31,49 @@# define drm_public#endif + +/** +* Static (compile-time) assertion. +* Basically, use COND to dimension an array. If COND is false/zero the +* array size will be -1 and we'll get a compilation error. +*/ +#define STATIC_ASSERT (COND ) \ + do { \ + (void) sizeof(char [1 - 2*!(COND)]); \ + } while (0) + + +#include <sys/mman.h> + +#if defined(ANDROID ) +#include <errno.h> /* for EINVAL */ + +extern void *__mmap2 (void *,size_t ,int ,int ,int ,size_t ); + +static inline void *drm_mmap (void *addr,size_t length,int prot,int flags,int fd,loff_t offset) +{ +/* offset must be aligned to 4096 (not necessarily the page size) */ +if (unlikely (offset &4095 )) { + errno =EINVAL ; +return MAP_FAILED ; + } + +return __mmap2 (addr, length, prot, flags, fd, (size_t ) (offset >>12 )); +} + +#else +/* assume large file support exists */ +# define drm_mmap (addr, length, prot, flags, fd, offset) mmap(addr, length, prot, flags, fd, offset) +#endif + +static inline int drm_munmap (void *addr,size_t length) +{ +/* Copied from configure code generated by AC_SYS_LARGEFILE */ +#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) +STATIC_ASSERT (LARGE_OFF_T %2147483629 ==721 &&LARGE_OFF_T %2147483647 ==1 ); +#undef LARGE_OFF_T + +return munmap (addr, length); +} +#endif
Signature · 1 line
2.0.2
PATCH v2 12/18 Add private mmap/munmap wrappers
Unlike Linux, Android (bionic) has separate functions - mmap & mmap64. Add a local wrapper (inspired by gallium) that will be used throughout libdrm to combat this bionic feature.
v2:
- Drop the undefined unlikely macro.
- Use macro for munmap under Android.
- Wrap long lines.
--- libdrm.h | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+)
libdrm.h +55 -0
@@ -31,4 +31,59 @@# define drm_public#endif + +/** +* Static (compile-time) assertion. +* Basically, use COND to dimension an array. If COND is false/zero the +* array size will be -1 and we'll get a compilation error. +*/ +#define STATIC_ASSERT (COND ) \ + do { \ + (void) sizeof(char [1 - 2*!(COND)]); \ + } while (0) + + +#include <sys/mman.h> + +#if defined(ANDROID ) +#include <errno.h> /* for EINVAL */ + +extern void *__mmap2 (void *,size_t ,int ,int ,int ,size_t ); + +static inline void *drm_mmap (void *addr,size_t length,int prot,int flags, +int fd,loff_t offset) +{ +/* offset must be aligned to 4096 (not necessarily the page size) */ +if (offset &4095 ) { + errno =EINVAL ; +return MAP_FAILED ; + } + +return __mmap2 (addr, length, prot, flags, fd, (size_t ) (offset >>12 )); +} + +# define drm_munmap (addr, length) \ + munmap(addr, length) + + +#else + +/* assume large file support exists */ +# define drm_mmap (addr, length, prot, flags, fd, offset) \ + mmap(addr, length, prot, flags, fd, offset) + + +static inline int drm_munmap (void *addr,size_t length) +{ +/* Copied from configure code generated by AC_SYS_LARGEFILE */ +#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + \ + (((off_t) 1 << 31) << 31)) +STATIC_ASSERT (LARGE_OFF_T %2147483629 ==721 && +LARGE_OFF_T %2147483647 ==1 ); +#undef LARGE_OFF_T + +return munmap (addr, length); +} +#endif +#endif
Signature · 1 line
2.1.0
PATCH 13/18 drm: use drm_mmap/drm_munmap wrappers
In reply to Emil Velikov--- xf86drm.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
xf86drm.c +4 -4
@@ -48,7 +48,6 @@#include <sys/stat.h> #define stat_t struct stat#include <sys/ioctl.h> -#include <sys/mman.h> #include <sys/time.h> #include <stdarg.h>
@@ -58,6 +57,7 @@#endif #include "xf86drm.h" +#include "libdrm.h" #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)#define DRM_MAJOR 145
@@ -1137,7 +1137,7 @@ int drmMap(int fd, drm_handle_t handle, drmSize size, drmAddressPtr address) size = (size + pagesize_mask) & ~pagesize_mask; - *address =mmap (0 , size,PROT_READ |PROT_WRITE ,MAP_SHARED , fd, handle); + *address =drm_mmap (0 , size,PROT_READ |PROT_WRITE ,MAP_SHARED , fd, handle);if (*address ==MAP_FAILED )return -errno;return 0 ;
@@ -1157,7 +1157,7 @@ int drmMap(int fd, drm_handle_t handle, drmSize size, drmAddressPtr address)*/ int drmUnmap (drmAddress address,drmSize size) { -return munmap (address, size); +return drm_munmap (address, size); }drmBufInfoPtr drmGetBufInfo (int fd)
@@ -1264,7 +1264,7 @@ int drmUnmapBufs(drmBufMapPtr bufs)int i;for (i =0 ; i < bufs->count; i++) { -munmap (bufs->list[i].address, bufs->list[i].total); +drm_munmap (bufs->list[i].address, bufs->list[i].total); }drmFree (bufs->list);
Signature · 1 line
2.0.2
PATCH 14/18 libkms: use drm_mmap/drm_munmap wrappers
In reply to Emil Velikov... for all by exynos.
--- libkms/dumb.c | 8 +++----- libkms/intel.c | 6 +++--- libkms/nouveau.c | 6 +++--- libkms/radeon.c | 8 ++++---- libkms/vmwgfx.c | 6 +++--- 5 files changed, 16 insertions(+), 18 deletions(-)
libkms/dumb.c +3 -5
@@ -36,11 +36,9 @@#include <string.h> #include "internal.h" -#include <sys/mman.h> #include <sys/ioctl.h> #include "xf86drm.h" - -#include "i915_drm.h" +#include "libdrm.h" struct dumb_bo {
@@ -149,7 +147,7 @@ dumb_bo_map(struct kms_bo *_bo, void **out)if (ret)return ret; - map =mmap (0 , bo->base.size,PROT_READ |PROT_WRITE ,MAP_SHARED , bo->base.kms->fd, arg.offset); + map =drm_mmap (0 , bo->base.size,PROT_READ |PROT_WRITE ,MAP_SHARED , bo->base.kms->fd, arg.offset);if (map ==MAP_FAILED )return -errno;
@@ -177,7 +175,7 @@ dumb_bo_destroy(struct kms_bo *_bo)if (bo->base.ptr) {/* XXX Sanity check map_count */ -munmap (bo->base.ptr, bo->base.size); +drm_munmap (bo->base.ptr, bo->base.size); bo->base.ptr =NULL ; }
libkms/intel.c +3 -3
@@ -36,9 +36,9 @@#include <string.h> #include "internal.h" -#include <sys/mman.h> #include <sys/ioctl.h> #include "xf86drm.h" +#include "libdrm.h" #include "i915_drm.h"
@@ -173,7 +173,7 @@ intel_bo_map(struct kms_bo *_bo, void **out)if (ret)return ret; - map =mmap (0 , bo->base.size,PROT_READ |PROT_WRITE ,MAP_SHARED , bo->base.kms->fd, arg.offset); + map =drm_mmap (0 , bo->base.size,PROT_READ |PROT_WRITE ,MAP_SHARED , bo->base.kms->fd, arg.offset);if (map ==MAP_FAILED )return -errno;
@@ -201,7 +201,7 @@ intel_bo_destroy(struct kms_bo *_bo)if (bo->base.ptr) {/* XXX Sanity check map_count */ -munmap (bo->base.ptr, bo->base.size); +drm_munmap (bo->base.ptr, bo->base.size); bo->base.ptr =NULL ; }
libkms/nouveau.c +3 -3
@@ -36,9 +36,9 @@#include <string.h> #include "internal.h" -#include <sys/mman.h> #include <sys/ioctl.h> #include "xf86drm.h" +#include "libdrm.h" #include "nouveau_drm.h"
@@ -155,7 +155,7 @@ nouveau_bo_map(struct kms_bo *_bo, void **out)return 0 ; } - map =mmap (0 , bo->base.size,PROT_READ |PROT_WRITE ,MAP_SHARED , bo->base.kms->fd, bo->map_handle); + map =drm_mmap (0 , bo->base.size,PROT_READ |PROT_WRITE ,MAP_SHARED , bo->base.kms->fd, bo->map_handle);if (map ==MAP_FAILED )return -errno;
@@ -183,7 +183,7 @@ nouveau_bo_destroy(struct kms_bo *_bo)if (bo->base.ptr) {/* XXX Sanity check map_count */ -munmap (bo->base.ptr, bo->base.size); +drm_munmap (bo->base.ptr, bo->base.size); bo->base.ptr =NULL ; }
libkms/radeon.c +4 -4
@@ -36,9 +36,9 @@#include <string.h> #include "internal.h" -#include <sys/mman.h> #include <sys/ioctl.h> #include "xf86drm.h" +#include "libdrm.h" #include "radeon_drm.h"
@@ -172,7 +172,7 @@ radeon_bo_map(struct kms_bo *_bo, void **out)if (ret)return -errno; - map =mmap (0 , arg.size,PROT_READ |PROT_WRITE ,MAP_SHARED , + map =drm_mmap (0 , arg.size,PROT_READ |PROT_WRITE ,MAP_SHARED , bo->base.kms->fd, arg.addr_ptr);if (map ==MAP_FAILED )return -errno;
@@ -189,7 +189,7 @@ radeon_bo_unmap(struct kms_bo *_bo) {struct radeon_bo *bo = (struct radeon_bo *)_bo;if (--bo->map_count ==0 ) { -munmap (bo->base.ptr, bo->base.size); +drm_munmap (bo->base.ptr, bo->base.size); bo->base.ptr =NULL ; }return 0 ;
@@ -204,7 +204,7 @@ radeon_bo_destroy(struct kms_bo *_bo)if (bo->base.ptr) {/* XXX Sanity check map_count */ -munmap (bo->base.ptr, bo->base.size); +drm_munmap (bo->base.ptr, bo->base.size); bo->base.ptr =NULL ; }
libkms/vmwgfx.c +3 -3
@@ -35,8 +35,8 @@#include <string.h> #include "internal.h" -#include <sys/mman.h> #include "xf86drm.h" +#include "libdrm.h" #include "vmwgfx_drm.h" struct vmwgfx_bo
@@ -146,7 +146,7 @@ vmwgfx_bo_map(struct kms_bo *_bo, void **out)return 0 ; } - map =mmap (NULL , bo->base.size,PROT_READ |PROT_WRITE ,MAP_SHARED , bo->base.kms->fd, bo->map_handle); + map =drm_mmap (NULL , bo->base.size,PROT_READ |PROT_WRITE ,MAP_SHARED , bo->base.kms->fd, bo->map_handle);if (map ==MAP_FAILED )return -errno;
@@ -173,7 +173,7 @@ vmwgfx_bo_destroy(struct kms_bo *_bo)if (bo->base.ptr) {/* XXX Sanity check map_count */ -munmap (bo->base.ptr, bo->base.size); +drm_munmap (bo->base.ptr, bo->base.size); bo->base.ptr =NULL ; }
Signature · 1 line
2.0.2
PATCH 15/18 nouveau: use drm_mmap/drm_munmap wrappers
In reply to Emil Velikov--- nouveau/nouveau.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
nouveau/nouveau.c +3 -3
@@ -33,11 +33,11 @@#include <stdbool.h> #include <assert.h> #include <errno.h> -#include <sys/mman.h> #include <fcntl.h> #include <xf86drm.h> #include <xf86atomic.h> +#include "libdrm.h" #include "libdrm_lists.h" #include "nouveau_drm.h"
@@ -381,7 +381,7 @@ nouveau_bo_del(struct nouveau_bo *bo)drmIoctl (bo->device->fd,DRM_IOCTL_GEM_CLOSE , &req); }if (bo->map) -munmap (bo->map, bo->size); +drm_munmap (bo->map, bo->size);free (nvbo); }
@@ -607,7 +607,7 @@ nouveau_bo_map(struct nouveau_bo *bo, uint32_t access, {struct nouveau_bo_priv *nvbo =nouveau_bo (bo);if (bo->map ==NULL ) { - bo->map =mmap (0 , bo->size,PROT_READ |PROT_WRITE , + bo->map =drm_mmap (0 , bo->size,PROT_READ |PROT_WRITE ,MAP_SHARED , bo->device->fd, nvbo->map_handle);if (bo->map ==MAP_FAILED ) { bo->map =NULL ;
Signature · 1 line
2.0.2
PATCH 16/18 radeon: use drm_mmap/drm_munmap wrappers
In reply to Emil Velikov--- radeon/radeon_bo_gem.c | 7 +++---- radeon/radeon_cs_gem.c | 1 - radeon/radeon_surface.c | 1 - 3 files changed, 3 insertions(+), 6 deletions(-)
radeon/radeon_bo_gem.c +3 -4
@@ -36,7 +36,6 @@#include <stdint.h> #include <stdlib.h> #include <string.h> -#include <sys/mman.h> #include <errno.h> #include "libdrm.h" #include "xf86drm.h"
@@ -135,7 +134,7 @@ static struct radeon_bo *bo_unref(struct radeon_bo_int *boi)return (struct radeon_bo *)boi; }if (bo_gem->priv_ptr) { -munmap (bo_gem->priv_ptr, boi->size); +drm_munmap (bo_gem->priv_ptr, boi->size); }/* Zero out args to make valgrind happy */
@@ -179,7 +178,7 @@ static int bo_map(struct radeon_bo_int *boi, int write) boi, boi->handle, r);return r; } - ptr =mmap (0 , args.size,PROT_READ |PROT_WRITE ,MAP_SHARED , boi->bom->fd, args.addr_ptr); + ptr =drm_mmap (0 , args.size,PROT_READ |PROT_WRITE ,MAP_SHARED , boi->bom->fd, args.addr_ptr);if (ptr ==MAP_FAILED )return -errno; bo_gem->priv_ptr = ptr;
@@ -198,7 +197,7 @@ static int bo_unmap(struct radeon_bo_int *boi)if (--bo_gem->map_count >0 ) {return 0 ; } -//munmap(bo->ptr, bo->size); +//drm_munmap(bo->ptr, bo->size); boi->ptr =NULL ;return 0 ; }
radeon/radeon_cs_gem.c +0 -1
@@ -37,7 +37,6 @@#include <stdlib.h> #include <string.h> #include <pthread.h> -#include <sys/mman.h> #include <sys/ioctl.h> #include "radeon_cs.h" #include "radeon_cs_int.h"
radeon/radeon_surface.c +0 -1
@@ -35,7 +35,6 @@#include <stdio.h> #include <stdlib.h> #include <string.h> -#include <sys/mman.h> #include <sys/ioctl.h> #include "drm.h" #include "libdrm.h"
Signature · 1 line
2.0.2
PATCH 17/18 freedreno: use drm_mmap/drm_munmap wrappers
In reply to Emil Velikov--- freedreno/freedreno_bo.c | 4 ++-- freedreno/freedreno_priv.h | 1 - freedreno/kgsl/kgsl_bo.c | 2 +- freedreno/kgsl/kgsl_ringbuffer.c | 4 ++-- 4 files changed, 5 insertions(+), 6 deletions(-)
freedreno/freedreno_bo.c +2 -2
@@ -288,7 +288,7 @@ out:static void bo_del (struct fd_bo *bo) {if (bo->map) -munmap (bo->map, bo->size); +drm_munmap (bo->map, bo->size);/* TODO probably bo's in bucket list get removed from * handle table??
@@ -351,7 +351,7 @@ drm_public void * fd_bo_map(struct fd_bo *bo)return NULL ; } - bo->map =mmap (0 , bo->size,PROT_READ |PROT_WRITE ,MAP_SHARED , + bo->map =drm_mmap (0 , bo->size,PROT_READ |PROT_WRITE ,MAP_SHARED , bo->dev->fd, offset);if (bo->map ==MAP_FAILED ) {ERROR_MSG ("mmap failed: %s" ,strerror (errno));
freedreno/freedreno_priv.h +0 -1
@@ -40,7 +40,6 @@#include <errno.h> #include <fcntl.h> #include <sys/ioctl.h> -#include <sys/mman.h> #include <pthread.h> #include <stdio.h> #include <assert.h>
freedreno/kgsl/kgsl_bo.c +1 -1
@@ -186,7 +186,7 @@ fd_bo_from_fbdev(struct fd_pipe *pipe, int fbfd, uint32_t size)* thinks the buffer hasn't be allocate and fails */ if (bo) { -void *fbmem =mmap (NULL , size,PROT_READ |PROT_WRITE , +void *fbmem =drm_mmap (NULL , size,PROT_READ |PROT_WRITE ,MAP_SHARED , fbfd,0 );struct kgsl_map_user_mem req = { .memtype =KGSL_USER_MEM_TYPE_ADDR ,
freedreno/kgsl/kgsl_ringbuffer.c +2 -2
@@ -60,7 +60,7 @@ static void kgsl_rb_bo_del(struct kgsl_rb_bo *bo) };int ret; -munmap (bo->hostptr, bo->size); +drm_munmap (bo->hostptr, bo->size); ret =ioctl (bo->pipe->fd,IOCTL_KGSL_SHAREDMEM_FREE , &req);if (ret) {
@@ -93,7 +93,7 @@ static struct kgsl_rb_bo * kgsl_rb_bo_new(struct kgsl_pipe *pipe, uint32_t size) bo->pipe = pipe; bo->gpuaddr = req.gpuaddr; bo->size = size; - bo->hostptr =mmap (NULL , size,PROT_WRITE |PROT_READ , + bo->hostptr =drm_mmap (NULL , size,PROT_WRITE |PROT_READ ,MAP_SHARED , pipe->fd, req.gpuaddr);return bo;
Signature · 1 line
2.0.2
PATCH 18/18 intel: use drm_mmap/drm_munmap wrappers
In reply to Emil Velikov--- intel/intel_bufmgr_gem.c | 15 +++++++-------- intel/test_decode.c | 4 ++-- 2 files changed, 9 insertions(+), 10 deletions(-)
intel/intel_bufmgr_gem.c +7 -8
@@ -48,7 +48,6 @@#include <assert.h> #include <pthread.h> #include <sys/ioctl.h> -#include <sys/mman.h> #include <sys/stat.h> #include <sys/types.h> #include <stdbool.h>
@@ -955,11 +954,11 @@ drm_intel_gem_bo_free(drm_intel_bo *bo)DRMLISTDEL (&bo_gem->vma_list);if (bo_gem->mem_virtual) {VG (VALGRIND_FREELIKE_BLOCK (bo_gem->mem_virtual,0 )); -munmap (bo_gem->mem_virtual, bo_gem->bo.size); +drm_munmap (bo_gem->mem_virtual, bo_gem->bo.size); bufmgr_gem->vma_count--; }if (bo_gem->gtt_virtual) { -munmap (bo_gem->gtt_virtual, bo_gem->bo.size); +drm_munmap (bo_gem->gtt_virtual, bo_gem->bo.size); bufmgr_gem->vma_count--; }
@@ -1044,12 +1043,12 @@ static void drm_intel_gem_bo_purge_vma_cache(drm_intel_bufmgr_gem *bufmgr_gem)DRMLISTDELINIT (&bo_gem->vma_list);if (bo_gem->mem_virtual) { -munmap (bo_gem->mem_virtual, bo_gem->bo.size); +drm_munmap (bo_gem->mem_virtual, bo_gem->bo.size); bo_gem->mem_virtual =NULL ; bufmgr_gem->vma_count--; }if (bo_gem->gtt_virtual) { -munmap (bo_gem->gtt_virtual, bo_gem->bo.size); +drm_munmap (bo_gem->gtt_virtual, bo_gem->bo.size); bo_gem->gtt_virtual =NULL ; bufmgr_gem->vma_count--; }
@@ -1271,9 +1270,9 @@ map_gtt(drm_intel_bo *bo) }/* and mmap it */ - bo_gem->gtt_virtual =mmap (0 , bo->size,PROT_READ |PROT_WRITE , -MAP_SHARED , bufmgr_gem->fd, - mmap_arg.offset); + bo_gem->gtt_virtual =drm_mmap (0 , bo->size,PROT_READ |PROT_WRITE , +MAP_SHARED , bufmgr_gem->fd, + mmap_arg.offset);if (bo_gem->gtt_virtual ==MAP_FAILED ) { bo_gem->gtt_virtual =NULL ; ret = -errno;
intel/test_decode.c +2 -2
@@ -32,9 +32,9 @@#include <fcntl.h> #include <sys/types.h> #include <sys/stat.h> -#include <sys/mman.h> #include <err.h> +#include "libdrm.h" #include "intel_bufmgr.h" #include "intel_chipset.h"
@@ -64,7 +64,7 @@ read_file(const char *filename, void **ptr, size_t *size)errx (1 ,"couldn't stat `%s'" , filename); *size = st.st_size; - *ptr =mmap (NULL , st.st_size,PROT_READ ,MAP_SHARED , fd,0 ); + *ptr =drm_mmap (NULL , st.st_size,PROT_READ ,MAP_SHARED , fd,0 );if (*ptr ==MAP_FAILED )errx (1 ,"couldn't map `%s'" , filename);
Signature · 1 line
2.0.2
Quoted 15 lines · Emil Velikov
Hello list,
Here is the final batch that I've been planning to get upstreamed. Everything else that remains are some custom downstream "hacks" that will get upstreamed by their original authors in due time :)
Highlights:
- Drop a few unneeded Makefiles.
- Android support for libkms & modetest. Inspired by Benjamin
Gaignard's work.
- Private mmap/munmap wrappers to hide all the love that bionic has for
us :)
Quoted 5 lines
The series is available in branch 'android-final-fixes' at
https://github.com/evelikov/libdrmAny comments, reviews, it builds or it works are appreciated.
While I'm not that familiar with the Android build system patches 01, 02 and 03 - 18 are
You will have to ask the intel people about 810 and 830 headers removal.
Cheers, Jakob.
Quoted 20 lines · Jakob Bornecrantz
Quoted 19 lines · Emil Velikov
Hello list,
Here is the final batch that I've been planning to get upstreamed. Everything else that remains are some custom downstream "hacks" that will get upstreamed by their original authors in due time :)
Highlights:
- Drop a few unneeded Makefiles.
- Android support for libkms & modetest. Inspired by Benjamin
Gaignard's work.
- Private mmap/munmap wrappers to hide all the love that bionic has for
us :)The series is available in branch 'android-final-fixes' at
https://github.com/evelikov/libdrm
Quoted 8 lines
Quoted 1 line
Any comments, reviews, it builds or it works are appreciated.
While I'm not that familiar with the Android build system patches 01, 02 and 03 - 18 are
Reviewed-by Jakob Bornecrantz <[email protected]>You will have to ask the intel people about 810 and 830 headers removal.
I've thought libdrm provides the canonical sources for drm headers, but grepping current mesa and intel ddx didn't show any hits. I have no idea whether we still need them and whether they've ever been part of the libdrm api. In case of doubt I'd keep them.
-Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
Quoted 15 lines · Emil Velikov
Hello list,
Here is the final batch that I've been planning to get upstreamed. Everything else that remains are some custom downstream "hacks" that will get upstreamed by their original authors in due time :)
Highlights:
- Drop a few unneeded Makefiles.
- Android support for libkms & modetest. Inspired by Benjamin
Gaignard's work.
- Private mmap/munmap wrappers to hide all the love that bionic has for
us :)
Quoted 3 lines
The series is available in branch 'android-final-fixes' at
https://github.com/evelikov/libdrm
Just sent out a couple of updates for patches 09 and 12. The updated series can be found at android-final-fixes-v2.
My plan is to push this over the weekend. So if you have any comments, suggestions or concerns please let me know :)
Cheers,
Emil
Quoted 5 lines
Any comments, reviews, it builds or it works are appreciated.
-Emil