Skip to contentSkip to conversation

Misc build fixes

PATCH In review Emil Velikov 2 participants 12 messages Jan 29, 2015 – Feb 6, 2015

lore
Share & tools
lore
#0 lore raw

cover Misc build fixes

Hello all,

It's time for another Android fueled round of fixes. Mostly trivial and self explanatory patches enough to get things building (rather quietly) on Android 5, x86_64

The series can be found at in branch for-android at
https://github.com/evelikov/libdrm/

Cheers,
Emil

 freedreno/Android.mk       |  3 ---
 intel/Android.mk           |  1 -
 libdrm.h                   |  2 +-
 nouveau/Android.mk         |  3 ---
 radeon/Android.mk          |  3 ---
 tests/modetest/Makefile.am |  6 +++---
 tests/util/Makefile.am     | 13 +++++++------
 xf86drm.c                  |  4 ++--
 8 files changed, 13 insertions(+), 22 deletions(-)

Chih-Wei Huang (1):
android: remove duplicate libdrm in LOCAL_SHARED_LIBRARIES

Emil Velikov (5):
util: add WARN_CFLAGS, rename the c*flags vars
modetest: move includes into AM_CPPFLAGS
libdrm: fix the Android 64bit build
drmOpenDevice: silence compiler warning
drmGetStats: silence compiler warning

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

#1 lore raw

PATCH 1/6 util: add WARN_CFLAGS, rename the c*flags vars

---
 tests/util/Makefile.am | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
tests/util/Makefile.am +7 -6
index f8e0b17..aaaf932 100644
@@ -1,13 +1,14 @@
 include Makefile.sources
 
-noinst_LTLIBRARIES = \
-	libutil.la
-
-libutil_la_CPPFLAGS = \
+AM_CPPFLAGS = \
 	-I$(top_srcdir)/include/drm \
 	-I$(top_srcdir)
 
-libutil_la_CFLAGS = \
-	$(CAIRO_CFLAGS)
+AM_CFLAGS = \
+	$(CAIRO_CFLAGS) \
+	$(WARN_CFLAGS)
+
+noinst_LTLIBRARIES = \
+	libutil.la
 
 libutil_la_SOURCES = $(UTIL_FILES)
Signature · 6 lines
2.1.3

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

PATCH 2/6 modetest: move includes into AM_CPPFLAGS

In reply to Emil Velikov
---
 tests/modetest/Makefile.am | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
tests/modetest/Makefile.am +3 -3
index 40dad3e..a8b9a3a 100644
@@ -1,12 +1,12 @@
 include Makefile.sources
 
-AM_CFLAGS = $(filter-out -Wpointer-arith, $(WARN_CFLAGS))
-
-AM_CFLAGS += \
+AM_CPPFLAGS = \
 	-I$(top_srcdir)/include/drm \
 	-I$(top_srcdir)/tests \
 	-I$(top_srcdir)
 
+AM_CFLAGS = $(filter-out -Wpointer-arith, $(WARN_CFLAGS))
+
 if HAVE_INSTALL_TESTS
 bin_PROGRAMS = \
 	modetest
Signature · 6 lines
2.1.3

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

PATCH 3/6 libdrm: fix the Android 64bit build

In reply to Emil Velikov

With 64bit bionic mmap now handles 64bit offset, thus we no longer need the __mmap2 trick.

Fix from Chih-Wei Huang, over at the google forums.

Cc Chih-Wei Huang <[email protected]>
---
 libdrm.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
libdrm.h +1 -1
index acfada5..6c3cd59 100644
@@ -45,7 +45,7 @@
 
 #include <sys/mman.h>
 
-#if defined(ANDROID)
+#if defined(ANDROID) && !defined(__LP64__)
 #include <errno.h> /* for EINVAL */
 
 extern void *__mmap2(void *, size_t, int, int, int, size_t);
Signature · 6 lines
2.1.3

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

Re: [PATCH 3/6] libdrm: fix the Android 64bit build

Quoted 16 lines · Emil Velikov

With 64bit bionic mmap now handles 64bit offset, thus we no longer need the __mmap2 trick.

Fix from Chih-Wei Huang, over at the google forums.

Cc Chih-Wei Huang <[email protected]>
---
 libdrm.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
libdrm.h +0 -0
index acfada5..6c3cd59 100644

libdrm.h line 51

Quoted 8 lines
libdrm.h +1 -1
@@ -45,7 +45,7 @@
 
 #include <sys/mman.h>
 
-#if defined(ANDROID)
+#if defined(ANDROID) && !defined(__LP64__)
 #include <errno.h> /* for EINVAL */
 
 extern void *__mmap2(void *, size_t, int, int, int, size_t);

It seems like you're be better off just using mmap64 instead of __mpap2?

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

#5 lore raw

Re: [PATCH 3/6] libdrm: fix the Android 64bit build

Quoted 20 lines · Stéphane Marchesin
Quoted 19 lines · Emil Velikov

With 64bit bionic mmap now handles 64bit offset, thus we no longer need the __mmap2 trick.

Fix from Chih-Wei Huang, over at the google forums.

Cc Chih-Wei Huang <[email protected]>
---
 libdrm.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
libdrm.h +0 -0
index acfada5..6c3cd59 100644
@@ -45,7 +45,7 @@
 
 #include <sys/mman.h>
 
Quoted 8 lines

libdrm.h line 51

Quoted 5 lines
libdrm.h +1 -1
-#if defined(ANDROID)
+#if defined(ANDROID) && !defined(__LP64__)
 #include <errno.h> /* for EINVAL */
 
 extern void *__mmap2(void *, size_t, int, int, int, size_t);

It seems like you're be better off just using mmap64 instead of __mpap2?

I was thinking about that but decided against it due to:

- For 64bit platforms - mmap64 maps directly to mmap [1].

- For other platforms (kitkat at least) mmap64 does a costly (according
to the man page) syscall (don't recall the name).

- Some systems may be lacking mmap64.

Quite a noobie on the topic so I might be completely wrong :)

Thanks
Emil

[1]
https://android.googlesource.com/platform/bionic.git/+/38fcbbb35a40c46e96b4df10d670d1c132910854%5E2%5E!/

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

#6 lore raw

PATCH 4/6 drmOpenDevice: silence compiler warning

In reply to Emil Velikov

Under 64bit Android the compiler throws a -Wsign-compare warning. Typecast the variable dev to silence the build.

---
 xf86drm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xf86drm.c +1 -1
index 345325a..b41c1d8 100644
@@ -394,7 +394,7 @@ wait_for_udev:
     /* Check if the device node is not what we expect it to be, and recreate it
      * and try again if so.
      */
-    if (st.st_rdev != dev) {
+    if (st.st_rdev != (dev_t)dev) {
 	if (!isroot)
 	    return DRM_ERR_NOT_ROOT;
 	remove(buf);
Signature · 6 lines
2.1.3

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

PATCH 5/6 drmGetStats: silence compiler warning

In reply to Emil Velikov

drm_stats_t::count is of type unsigned long, while i is an int. Make the latter an unsigned int.
Spotted as -Wsign-compare warning while building under Android 5.

---
 xf86drm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xf86drm.c +1 -1
index b41c1d8..cc79ab6 100644
@@ -2213,7 +2213,7 @@ int drmGetClient(int fd, int idx, int *auth, int *pid, int *uid,
 int drmGetStats(int fd, drmStatsT *stats)
 {
     drm_stats_t s;
-    int         i;
+    unsigned int i;
 
     if (drmIoctl(fd, DRM_IOCTL_GET_STATS, &s))
 	return -errno;
Signature · 6 lines
2.1.3

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

PATCH 6/6 android: remove duplicate libdrm in LOCAL_SHARED_LIBRARIES

In reply to Emil Velikov

From: Chih-Wei Huang <[email protected]>

---
 freedreno/Android.mk | 3 ---
 intel/Android.mk     | 1 -
 nouveau/Android.mk   | 3 ---
 radeon/Android.mk    | 3 ---
 4 files changed, 10 deletions(-)
freedreno/Android.mk +0 -3
index 243a1e2..22520fb 100644
@@ -24,7 +24,4 @@ LOCAL_CFLAGS := \
 LOCAL_COPY_HEADERS := $(LIBDRM_FREEDRENO_H_FILES)
 LOCAL_COPY_HEADERS_TO := freedreno
 
-LOCAL_SHARED_LIBRARIES := \
-	libdrm
-
 include $(BUILD_SHARED_LIBRARY)
intel/Android.mk +0 -1
index f2f21b9..bf6e822 100644
@@ -49,7 +49,6 @@ LOCAL_COPY_HEADERS := $(LIBDRM_INTEL_H_FILES)
 LOCAL_COPY_HEADERS_TO := libdrm
 
 LOCAL_SHARED_LIBRARIES := \
-	libdrm \
 	libpciaccess
 
 include $(BUILD_SHARED_LIBRARY)
nouveau/Android.mk +0 -3
index 734fc21..93c9ec2 100644
@@ -24,7 +24,4 @@ LOCAL_CFLAGS := \
 LOCAL_COPY_HEADERS := $(LIBDRM_NOUVEAU_H_FILES)
 LOCAL_COPY_HEADERS_TO := libdrm
 
-LOCAL_SHARED_LIBRARIES := \
-	libdrm
-
 include $(BUILD_SHARED_LIBRARY)
radeon/Android.mk +0 -3
index 9cba546..71c58bd 100644
@@ -24,7 +24,4 @@ LOCAL_CFLAGS := \
 LOCAL_COPY_HEADERS := $(LIBDRM_RADEON_H_FILES)
 LOCAL_COPY_HEADERS_TO := libdrm
 
-LOCAL_SHARED_LIBRARIES := \
-	libdrm
-
 include $(BUILD_SHARED_LIBRARY)
Signature · 6 lines
2.1.3

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

PATCH 1/2 util: add missing include <string.h>

In reply to Emil Velikov

Required by strcmp, otherwise we'll error out of the build with the following commit.

---
 tests/util/format.c | 1 +
 1 file changed, 1 insertion(+)
tests/util/format.c +1 -0
index c365ceb..52b3f97 100644
@@ -29,6 +29,7 @@
 
 #include <stdint.h>
 #include <stdlib.h>
+#include <string.h>
 
 #include <drm_fourcc.h>
 
Signature · 6 lines
2.1.3

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

PATCH 2/2 util: silence pointer arithmetic warnings

---
 tests/util/Makefile.am | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tests/util/Makefile.am +2 -1
index aaaf932..1d71c40 100644
@@ -6,7 +6,8 @@ AM_CPPFLAGS = \
 
 AM_CFLAGS = \
 	$(CAIRO_CFLAGS) \
-	$(WARN_CFLAGS)
+	$(filter-out -Wpointer-arith, $(WARN_CFLAGS))
+
 
 noinst_LTLIBRARIES = \
 	libutil.la
Signature · 6 lines
2.1.3

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

Re: [PATCH 1/2] util: add missing include <string.h>

In reply to Emil Velikov

Grr... git send-email did not keep the fix of the patches :\

This one should be "PATCH 0.1/6" while "util: silence pointer arithmetic warnings" - "PATCH 1.1/6".

Cheers,
Emil

Quoted 14 lines · Emil Velikov

Required by strcmp, otherwise we'll error out of the build with the following commit.

---
 tests/util/format.c | 1 +
 1 file changed, 1 insertion(+)
tests/util/format.c +0 -0
index c365ceb..52b3f97 100644

tests/util/format.c line 35

Quoted 7 lines
tests/util/format.c +1 -0
@@ -29,6 +29,7 @@
 
 #include <stdint.h>
 #include <stdlib.h>
+#include <string.h>
 
 #include <drm_fourcc.h>
 

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