Skip to contentSkip to conversation

tests: Add -lm to LDADD for dristat

PATCH In review Michel Dänzer 3 participants 4 messages Sep 7, 2015 – Sep 9, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests: Add -lm to LDADD for dristat

From: Michel Dänzer <[email protected]>

Fixes build failure due to unresolved log2.

---
 tests/Makefile.am | 2 ++
 1 file changed, 2 insertions(+)
tests/Makefile.am +2 -0
index 9a2d932..a511d28 100644
@@ -33,6 +33,8 @@ check_PROGRAMS = \
 	dristat \
 	drmstat
 
+dristat_LDADD = -lm
+
 if HAVE_NOUVEAU
 SUBDIRS += nouveau
 endif
Signature · 6 lines
2.5.0

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Michel Dänzer

From: Michel Dänzer <[email protected]>

Fixes build failure due to unresolved log2.

Quoted 20 lines
---
 tests/Makefile.am | 2 ++
 1 file changed, 2 insertions(+)
tests/Makefile.am +2 -1
index 9a2d932..a511d28 100644
@@ -33,6 +33,8 @@ check_PROGRAMS = \
        dristat \
        drmstat
 
+dristat_LDADD = -lm
+
 if HAVE_NOUVEAU
 SUBDIRS += nouveau
 endif
--

2.5.0

Quoted 4 lines

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

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

#2 lore raw
In reply to Michel Dänzer
Quoted 4 lines · Michel Dänzer

From: Michel Dänzer <[email protected]>

Fixes build failure due to unresolved log2.

Sigh I've completely forgot that we still have the #include "xf86drm.c" hack around.

I'll resent the patch that nukes it shortly but until that gets reviewed this fix will be living in master.

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

#3 lore raw

PATCH 1/1 tests/dristat: don't include C files

Remove the hack of including xf86drm.c (and friends), by reworking the only requirement drmOpenMinor() to an open(buf...).

After all we do know the exact name of the device we're going to open, so might as well use it. Replace hard-coded 16 with DRM_MAX_MINOR while we're here.

Note that this does drop the explicit creation of the device node (create == 1). Modern users should not need this as they either 1) use udev which manages the device node(s) or 2) you're in BSD land where you either have udev equivalent, or explicitly manage things yourself.

This also removes the -lm link, which is no longer needed.

---
 tests/Makefile.am |  2 --
 tests/dristat.c   | 11 ++++++-----
 2 files changed, 6 insertions(+), 7 deletions(-)
tests/Makefile.am +0 -2
index a511d28..9a2d932 100644
@@ -33,8 +33,6 @@ check_PROGRAMS = \
 	dristat \
 	drmstat
 
-dristat_LDADD = -lm
-
 if HAVE_NOUVEAU
 SUBDIRS += nouveau
 endif
tests/dristat.c +6 -5
index cca4b03..cc23e16 100644
@@ -31,13 +31,14 @@
 # include <config.h>
 #endif
 
+#include <ctype.h>
+#include <fcntl.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
 #include <unistd.h>
 #include "xf86drm.h"
-#include "xf86drmRandom.c"
-#include "xf86drmHash.c"
-#include "xf86drm.c"
 
 #define DRM_VERSION 0x00000001
 #define DRM_MEMORY  0x00000002
@@ -267,9 +268,9 @@ int main(int argc, char **argv)
 	    return 1;
 	}
 
-    for (i = 0; i < 16; i++) if (!minor || i == minor) {
+    for (i = 0; i < DRM_MAX_MINOR; i++) if (!minor || i == minor) {
 	sprintf(buf, DRM_DEV_NAME, DRM_DIR_NAME, i);
-	fd = drmOpenMinor(i, 1, DRM_NODE_PRIMARY);
+	fd = open(buf, O_RDWR, 0);
 	if (fd >= 0) {
 	    printf("%s\n", buf);
 	    if (mask & DRM_BUSID)   getbusid(fd);
Signature · 6 lines
2.5.0

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