Skip to contentSkip to conversation

Ion unit test with VGEM

RFC PATCH Superseded Laura Abbott 4 participants 10 messages Feb 16, 2018 – Feb 27, 2018 Kselftest

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Ion unit test with VGEM

Hi,

Ion hasn't had much in the way of unit tests and fixing that is something that needs to happen before it can move out of staging. The difficult part of testing parts of Ion is that it relies on having a kernel driver to actually make some of the dma_buf calls. The vgem DRM driver exists mostly for testing and works great for this case. I went back and forth about trying to put this in the existing graphics test suite but I think having something in the self-tests directory is easier.

I'm mostly interested in feedback about the use of the DRM APIs but I appreciate any and all comments.

Thanks,
Laura

Laura Abbott (2):
selftests: ion: Remove some prints
selftests: ion: Add simple test with the vgem driver

 tools/testing/selftests/android/ion/Makefile      |   3 +-
 tools/testing/selftests/android/ion/config        |   1 +
 tools/testing/selftests/android/ion/ionmap_test.c | 136 ++++++++++++++++++++++
 tools/testing/selftests/android/ion/ionutils.c    |   6 -
 4 files changed, 139 insertions(+), 7 deletions(-)
 create mode 100644 tools/testing/selftests/android/ion/ionmap_test.c
Signature · 1 line
2.14.3
#1 lore raw

PATCH 1/2 selftests: ion: Remove some prints

There's no need to print messages each time we alloc and free. Remove them.

---
 tools/testing/selftests/android/ion/ionutils.c | 6 ------
 1 file changed, 6 deletions(-)
tools/testing/selftests/android/ion/ionutils.c +0 -6
index ce69c14f51fa..7d1d37c4ef6a 100644
@@ -80,11 +80,6 @@ int ion_export_buffer_fd(struct ion_buffer_info *ion_info)
 	heap_id = MAX_HEAP_COUNT + 1;
 	for (i = 0; i < query.cnt; i++) {
 		if (heap_data[i].type == ion_info->heap_type) {
-			printf("--------------------------------------\n");
-			printf("heap type: %d\n", heap_data[i].type);
-			printf("  heap id: %d\n", heap_data[i].heap_id);
-			printf("heap name: %s\n", heap_data[i].name);
-			printf("--------------------------------------\n");
 			heap_id = heap_data[i].heap_id;
 			break;
 		}
@@ -204,7 +199,6 @@ void ion_close_buffer_fd(struct ion_buffer_info *ion_info)
 		/* Finally, close the client fd */
 		if (ion_info->ionfd > 0)
 			close(ion_info->ionfd);
-		printf("<%s>: buffer release successfully....\n", __func__);
 	}
 }
 
Signature · 1 line
2.14.3
maintainer
#2 lore raw

Re: [PATCH 1/2] selftests: ion: Remove some prints

Quoted 25 lines · Laura Abbott

There's no need to print messages each time we alloc and free. Remove them.

---
 tools/testing/selftests/android/ion/ionutils.c | 6 ------
 1 file changed, 6 deletions(-)
tools/testing/selftests/android/ion/ionutils.c +0 -5
index ce69c14f51fa..7d1d37c4ef6a 100644
@@ -80,11 +80,6 @@ int ion_export_buffer_fd(struct ion_buffer_info *ion_info)
 	heap_id = MAX_HEAP_COUNT + 1;
 	for (i = 0; i < query.cnt; i++) {
 		if (heap_data[i].type == ion_info->heap_type) {
-			printf("--------------------------------------\n");
-			printf("heap type: %d\n", heap_data[i].type);
-			printf("  heap id: %d\n", heap_data[i].heap_id);
-			printf("heap name: %s\n", heap_data[i].name);
-			printf("--------------------------------------\n");
 			heap_id = heap_data[i].heap_id;
 			break;
 		}

tools/testing/selftests/android/ion/ionutils.c void ion_close_buffer_fd(struct ion_buffer_info *ion_info) · line 204

Quoted 7 lines
tools/testing/selftests/android/ion/ionutils.c +0 -1
@@ -204,7 +199,6 @@ void ion_close_buffer_fd(struct ion_buffer_info *ion_info)
 		/* Finally, close the client fd */
 		if (ion_info->ionfd > 0)
 			close(ion_info->ionfd);
-		printf("<%s>: buffer release successfully....\n", __func__);
 	}
 }
 

Thanks Laura. I will queue this up for 4.17-rc1.

thanks,
-- Shuah

#3 lore raw

PATCH 2/2 selftests: ion: Add simple test with the vgem driver

In reply to Laura Abbott

Ion is designed to be a framework used by other clients who perform operations on the buffer. Use the DRM vgem client as a simple consumer. In conjunction with the dma-buf sync ioctls, this tests the full attach/map path for the system heap.

---
 tools/testing/selftests/android/ion/Makefile      |   3 +-
 tools/testing/selftests/android/ion/config        |   1 +
 tools/testing/selftests/android/ion/ionmap_test.c | 136 ++++++++++++++++++++++
 3 files changed, 139 insertions(+), 1 deletion(-)
 create mode 100644 tools/testing/selftests/android/ion/ionmap_test.c
tools/testing/selftests/android/ion/Makefile +2 -1
index 96e0c448b39d..d23b6d537d8b 100644
@@ -2,7 +2,7 @@
 INCLUDEDIR := -I. -I../../../../../drivers/staging/android/uapi/
 CFLAGS := $(CFLAGS) $(INCLUDEDIR) -Wall -O2 -g
 
-TEST_GEN_FILES := ionapp_export ionapp_import
+TEST_GEN_FILES := ionapp_export ionapp_import ionmap_test
 
 all: $(TEST_GEN_FILES)
 
@@ -14,3 +14,4 @@ include ../../lib.mk
 
 $(OUTPUT)/ionapp_export: ionapp_export.c ipcsocket.c ionutils.c
 $(OUTPUT)/ionapp_import: ionapp_import.c ipcsocket.c ionutils.c
+$(OUTPUT)/ionmap_test: ionmap_test.c ionutils.c
tools/testing/selftests/android/ion/config +1 -0
index 19db6ca9aa2b..b4ad748a9dd9 100644
@@ -2,3 +2,4 @@ CONFIG_ANDROID=y
 CONFIG_STAGING=y
 CONFIG_ION=y
 CONFIG_ION_SYSTEM_HEAP=y
+CONFIG_DRM_VGEM=y
tools/testing/selftests/android/ion/ionmap_test.c new file +136 -0

136 lines not on this page · raw message

Signature · 1 line
2.14.3
Reviewed-by on v1 2/2
#4 lore raw

Re: [PATCH 2/2] selftests: ion: Add simple test with the vgem driver

Quoted 161 lines · Laura Abbott

Ion is designed to be a framework used by other clients who perform operations on the buffer. Use the DRM vgem client as a simple consumer. In conjunction with the dma-buf sync ioctls, this tests the full attach/map path for the system heap.

Signed-off-by Laura Abbott <labbott at redhat.com>
---
 tools/testing/selftests/android/ion/Makefile      |   3 +-
 tools/testing/selftests/android/ion/config        |   1 +
 tools/testing/selftests/android/ion/ionmap_test.c | 136 ++++++++++++++++++++++
 3 files changed, 139 insertions(+), 1 deletion(-)
 create mode 100644 tools/testing/selftests/android/ion/ionmap_test.c
tools/testing/selftests/android/ion/Makefile +2 -1
index 96e0c448b39d..d23b6d537d8b 100644
@@ -2,7 +2,7 @@
 INCLUDEDIR := -I. -I../../../../../drivers/staging/android/uapi/
 CFLAGS := $(CFLAGS) $(INCLUDEDIR) -Wall -O2 -g
 
-TEST_GEN_FILES := ionapp_export ionapp_import
+TEST_GEN_FILES := ionapp_export ionapp_import ionmap_test
 
 all: $(TEST_GEN_FILES)
 
@@ -14,3 +14,4 @@ include ../../lib.mk
 
 $(OUTPUT)/ionapp_export: ionapp_export.c ipcsocket.c ionutils.c
 $(OUTPUT)/ionapp_import: ionapp_import.c ipcsocket.c ionutils.c
+$(OUTPUT)/ionmap_test: ionmap_test.c ionutils.c
tools/testing/selftests/android/ion/config +1 -0
index 19db6ca9aa2b..b4ad748a9dd9 100644
@@ -2,3 +2,4 @@ CONFIG_ANDROID=y
 CONFIG_STAGING=y
 CONFIG_ION=y
 CONFIG_ION_SYSTEM_HEAP=y
+CONFIG_DRM_VGEM=y
tools/testing/selftests/android/ion/ionmap_test.c new file +115 -0
new file mode 100644
index 000000000000..dab36b06b37d
@@ -0,0 +1,136 @@
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdint.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <sys/ioctl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include <linux/dma-buf.h>
+
+#include <drm/drm.h>
+
+#include "ion.h"
+#include "ionutils.h"
+
+int check_vgem(int fd)
+{
+	drm_version_t version = { 0 };
+	char name[5];
+	int ret;
+
+	version.name_len = 4;
+	version.name = name;
+
+	ret = ioctl(fd, DRM_IOCTL_VERSION, &version);
+	if (ret)
+		return 1;
+
+	return strcmp(name, "vgem");
+}
+
+int open_vgem(void)
+{
+	int i, fd;
+	const char *drmstr = "/dev/dri/card";
+
+	fd = -1;
+	for (i = 0; i < 16; i++) {
+		char name[80];
+
+		sprintf(name, "%s%u", drmstr, i);
+
+		fd = open(name, O_RDWR);
+		if (fd < 0)
+			continue;
+
+		if (check_vgem(fd)) {
+			close(fd);
+			continue;
+		} else {
+			break;
+		}
+
+	}
+	return fd;
+}
+
+int import_vgem_fd(int vgem_fd, int dma_buf_fd, uint32_t *handle)
+{
+	struct drm_prime_handle import_handle = { 0 };
+	int ret;
+
+	import_handle.fd = dma_buf_fd;
+	import_handle.flags = 0;
+	import_handle.handle = 0;
+
+	ret = ioctl(vgem_fd, DRM_IOCTL_PRIME_FD_TO_HANDLE, &import_handle);
+	if (ret == 0)
+		*handle = import_handle.handle;
+	return ret;
+}
+
+void close_handle(int vgem_fd, uint32_t handle)
+{
+	struct drm_gem_close close = { 0 };
+
+	close.handle = handle;
+	ioctl(vgem_fd, DRM_IOCTL_GEM_CLOSE, &close);
+}
+
+int main()
+{
+	int ret, vgem_fd;
+	struct ion_buffer_info info;
+	uint32_t handle = 0;
+	struct dma_buf_sync sync = { 0 };
+
+	info.heap_type = ION_HEAP_TYPE_SYSTEM;
+	info.heap_size = 4096;
+	info.flag_type = ION_FLAG_CACHED;
+
+	ret = ion_export_buffer_fd(&info);
+	if (ret < 0) {
+		printf("ion buffer alloc failed\n");
+		return -1;
+	}
+
+	vgem_fd = open_vgem();
+	if (vgem_fd < 0) {
+		ret = vgem_fd;
+		printf("Failed to open vgem\n");
+		goto out_ion;
+	}
+
+	ret = import_vgem_fd(vgem_fd, info.buffd, &handle);
+
+	if (ret < 0) {
+		printf("Failed to import buffer\n");
+		goto out_vgem;
+	}
+
+	sync.flags = DMA_BUF_SYNC_START | DMA_BUF_SYNC_RW;

tools/testing/selftests/android/ion/ionmap_test.c line 125

Quoted 10 lines
tools/testing/selftests/android/ion/ionmap_test.c new file +10 -0
+	ret = ioctl(info.buffd, DMA_BUF_IOCTL_SYNC, &sync);
+	if (ret)
+		printf("sync start failed %d\n", errno);
+
+	memset(info.buffer, 0xff, 4096);
+
+	sync.flags = DMA_BUF_SYNC_END | DMA_BUF_SYNC_RW;
+	ret = ioctl(info.buffd, DMA_BUF_IOCTL_SYNC, &sync);
+	if (ret)
+		printf("sync end failed %d\n", errno);

At least in drm we require that userspace auto-restarts all ioctls when they get interrupt. See

https://cgit.freedesktop.org/drm/libdrm/tree/xf86drm.c#n186

not really an issue with vgem (which can't wait for hw or anything else). But good to make sure we don't spread bad copypastas.

Actual use of the ioctls looks all good. With the drmIoctl wrapper added and used this is:

Reviewed-by Daniel Vetter <daniel.vetter at ffwll.ch>
Quoted 18 lines
tools/testing/selftests/android/ion/ionmap_test.c new file +11 -0
+
+	close_handle(vgem_fd, handle);
+	ret = 0;
+
+out_vgem:
+	close(vgem_fd);
+out_ion:
+	ion_close_buffer_fd(&info);
+	printf("done.\n");
+	return ret;
+}
Signature · 6 lines
2.14.3

_______________________________________________
dri-devel mailing list
dri-devel at lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
--
To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#5 lore raw

Re: [PATCH 2/2] selftests: ion: Add simple test with the vgem driver

Quoted 178 lines · Daniel Vetter
Quoted 161 lines · Laura Abbott

Ion is designed to be a framework used by other clients who perform operations on the buffer. Use the DRM vgem client as a simple consumer. In conjunction with the dma-buf sync ioctls, this tests the full attach/map path for the system heap.

Signed-off-by Laura Abbott <labbott at redhat.com>
---
  tools/testing/selftests/android/ion/Makefile      |   3 +-
  tools/testing/selftests/android/ion/config        |   1 +
  tools/testing/selftests/android/ion/ionmap_test.c | 136 ++++++++++++++++++++++
  3 files changed, 139 insertions(+), 1 deletion(-)

create mode 100644 tools/testing/selftests/android/ion/ionmap_test.c

tools/testing/selftests/android/ion/Makefile +2 -1
index 96e0c448b39d..d23b6d537d8b 100644
@@ -2,7 +2,7 @@
  INCLUDEDIR := -I. -I../../../../../drivers/staging/android/uapi/
  CFLAGS := $(CFLAGS) $(INCLUDEDIR) -Wall -O2 -g
 
-TEST_GEN_FILES := ionapp_export ionapp_import
+TEST_GEN_FILES := ionapp_export ionapp_import ionmap_test
 
  all: $(TEST_GEN_FILES)
 
@@ -14,3 +14,4 @@ include ../../lib.mk
 
  $(OUTPUT)/ionapp_export: ionapp_export.c ipcsocket.c ionutils.c
  $(OUTPUT)/ionapp_import: ionapp_import.c ipcsocket.c ionutils.c
+$(OUTPUT)/ionmap_test: ionmap_test.c ionutils.c
tools/testing/selftests/android/ion/config +1 -0
index 19db6ca9aa2b..b4ad748a9dd9 100644
@@ -2,3 +2,4 @@ CONFIG_ANDROID=y
  CONFIG_STAGING=y
  CONFIG_ION=y
  CONFIG_ION_SYSTEM_HEAP=y
+CONFIG_DRM_VGEM=y
tools/testing/selftests/android/ion/ionmap_test.c new file +115 -0
new file mode 100644
index 000000000000..dab36b06b37d
@@ -0,0 +1,136 @@
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdint.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <sys/ioctl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include <linux/dma-buf.h>
+
+#include <drm/drm.h>
+
+#include "ion.h"
+#include "ionutils.h"
+
+int check_vgem(int fd)
+{
+	drm_version_t version = { 0 };
+	char name[5];
+	int ret;
+
+	version.name_len = 4;
+	version.name = name;
+
+	ret = ioctl(fd, DRM_IOCTL_VERSION, &version);
+	if (ret)
+		return 1;
+
+	return strcmp(name, "vgem");
+}
+
+int open_vgem(void)
+{
+	int i, fd;
+	const char *drmstr = "/dev/dri/card";
+
+	fd = -1;
+	for (i = 0; i < 16; i++) {
+		char name[80];
+
+		sprintf(name, "%s%u", drmstr, i);
+
+		fd = open(name, O_RDWR);
+		if (fd < 0)
+			continue;
+
+		if (check_vgem(fd)) {
+			close(fd);
+			continue;
+		} else {
+			break;
+		}
+
+	}
+	return fd;
+}
+
+int import_vgem_fd(int vgem_fd, int dma_buf_fd, uint32_t *handle)
+{
+	struct drm_prime_handle import_handle = { 0 };
+	int ret;
+
+	import_handle.fd = dma_buf_fd;
+	import_handle.flags = 0;
+	import_handle.handle = 0;
+
+	ret = ioctl(vgem_fd, DRM_IOCTL_PRIME_FD_TO_HANDLE, &import_handle);
+	if (ret == 0)
+		*handle = import_handle.handle;
+	return ret;
+}
+
+void close_handle(int vgem_fd, uint32_t handle)
+{
+	struct drm_gem_close close = { 0 };
+
+	close.handle = handle;
+	ioctl(vgem_fd, DRM_IOCTL_GEM_CLOSE, &close);
+}
+
+int main()
+{
+	int ret, vgem_fd;
+	struct ion_buffer_info info;
+	uint32_t handle = 0;
+	struct dma_buf_sync sync = { 0 };
+
+	info.heap_type = ION_HEAP_TYPE_SYSTEM;
+	info.heap_size = 4096;
+	info.flag_type = ION_FLAG_CACHED;
+
+	ret = ion_export_buffer_fd(&info);
+	if (ret < 0) {
+		printf("ion buffer alloc failed\n");
+		return -1;
+	}
+
+	vgem_fd = open_vgem();
+	if (vgem_fd < 0) {
+		ret = vgem_fd;
+		printf("Failed to open vgem\n");
+		goto out_ion;
+	}
+
+	ret = import_vgem_fd(vgem_fd, info.buffd, &handle);
+
+	if (ret < 0) {
+		printf("Failed to import buffer\n");
+		goto out_vgem;
+	}
+
+	sync.flags = DMA_BUF_SYNC_START | DMA_BUF_SYNC_RW;

tools/testing/selftests/android/ion/ionmap_test.c line 125

Quoted 10 lines
tools/testing/selftests/android/ion/ionmap_test.c new file +10 -0
+	ret = ioctl(info.buffd, DMA_BUF_IOCTL_SYNC, &sync);
+	if (ret)
+		printf("sync start failed %d\n", errno);
+
+	memset(info.buffer, 0xff, 4096);
+
+	sync.flags = DMA_BUF_SYNC_END | DMA_BUF_SYNC_RW;
+	ret = ioctl(info.buffd, DMA_BUF_IOCTL_SYNC, &sync);
+	if (ret)
+		printf("sync end failed %d\n", errno);

At least in drm we require that userspace auto-restarts all ioctls when they get interrupt. See

https://cgit.freedesktop.org/drm/libdrm/tree/xf86drm.c#n186

Quoted 7 lines

not really an issue with vgem (which can't wait for hw or anything else). But good to make sure we don't spread bad copypastas.

Actual use of the ioctls looks all good. With the drmIoctl wrapper added and used this is:

Reviewed-by Daniel Vetter <daniel.vetter at ffwll.ch>

Thanks for the review. The reason I didn't use the standard drmIoctl was because I didn't want to introduce a dependency on libdrm. I don't see an example of another selftest having a dependency on an external library.

Is adding a dependencies on fairly standard but still external userspace libraries okay for kernel self tests?

Thanks,
Laura
--
To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

#6 lore raw

Re: [PATCH 2/2] selftests: ion: Add simple test with the vgem driver

Quoted 183 lines · Laura Abbott
Quoted 174 lines · Daniel Vetter
Quoted 157 lines · Laura Abbott

Ion is designed to be a framework used by other clients who perform operations on the buffer. Use the DRM vgem client as a simple consumer. In conjunction with the dma-buf sync ioctls, this tests the full attach/map path for the system heap.

---
  tools/testing/selftests/android/ion/Makefile      |   3 +-
  tools/testing/selftests/android/ion/config        |   1 +
  tools/testing/selftests/android/ion/ionmap_test.c | 136 ++++++++++++++++++++++
  3 files changed, 139 insertions(+), 1 deletion(-)

create mode 100644 tools/testing/selftests/android/ion/ionmap_test.c

tools/testing/selftests/android/ion/Makefile +2 -1
index 96e0c448b39d..d23b6d537d8b 100644
@@ -2,7 +2,7 @@
  INCLUDEDIR := -I. -I../../../../../drivers/staging/android/uapi/
  CFLAGS := $(CFLAGS) $(INCLUDEDIR) -Wall -O2 -g
-TEST_GEN_FILES := ionapp_export ionapp_import
+TEST_GEN_FILES := ionapp_export ionapp_import ionmap_test
  all: $(TEST_GEN_FILES)
@@ -14,3 +14,4 @@ include ../../lib.mk
  $(OUTPUT)/ionapp_export: ionapp_export.c ipcsocket.c ionutils.c
  $(OUTPUT)/ionapp_import: ionapp_import.c ipcsocket.c ionutils.c
+$(OUTPUT)/ionmap_test: ionmap_test.c ionutils.c
tools/testing/selftests/android/ion/config +1 -0
index 19db6ca9aa2b..b4ad748a9dd9 100644
@@ -2,3 +2,4 @@ CONFIG_ANDROID=y
  CONFIG_STAGING=y
  CONFIG_ION=y
  CONFIG_ION_SYSTEM_HEAP=y
+CONFIG_DRM_VGEM=y
tools/testing/selftests/android/ion/ionmap_test.c new file +115 -0
new file mode 100644
index 000000000000..dab36b06b37d
@@ -0,0 +1,136 @@
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdint.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <sys/ioctl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include <linux/dma-buf.h>
+
+#include <drm/drm.h>
+
+#include "ion.h"
+#include "ionutils.h"
+
+int check_vgem(int fd)
+{
+	drm_version_t version = { 0 };
+	char name[5];
+	int ret;
+
+	version.name_len = 4;
+	version.name = name;
+
+	ret = ioctl(fd, DRM_IOCTL_VERSION, &version);
+	if (ret)
+		return 1;
+
+	return strcmp(name, "vgem");
+}
+
+int open_vgem(void)
+{
+	int i, fd;
+	const char *drmstr = "/dev/dri/card";
+
+	fd = -1;
+	for (i = 0; i < 16; i++) {
+		char name[80];
+
+		sprintf(name, "%s%u", drmstr, i);
+
+		fd = open(name, O_RDWR);
+		if (fd < 0)
+			continue;
+
+		if (check_vgem(fd)) {
+			close(fd);
+			continue;
+		} else {
+			break;
+		}
+
+	}
+	return fd;
+}
+
+int import_vgem_fd(int vgem_fd, int dma_buf_fd, uint32_t *handle)
+{
+	struct drm_prime_handle import_handle = { 0 };
+	int ret;
+
+	import_handle.fd = dma_buf_fd;
+	import_handle.flags = 0;
+	import_handle.handle = 0;
+
+	ret = ioctl(vgem_fd, DRM_IOCTL_PRIME_FD_TO_HANDLE, &import_handle);
+	if (ret == 0)
+		*handle = import_handle.handle;
+	return ret;
+}
+
+void close_handle(int vgem_fd, uint32_t handle)
+{
+	struct drm_gem_close close = { 0 };
+
+	close.handle = handle;
+	ioctl(vgem_fd, DRM_IOCTL_GEM_CLOSE, &close);
+}
+
+int main()
+{
+	int ret, vgem_fd;
+	struct ion_buffer_info info;
+	uint32_t handle = 0;
+	struct dma_buf_sync sync = { 0 };
+
+	info.heap_type = ION_HEAP_TYPE_SYSTEM;
+	info.heap_size = 4096;
+	info.flag_type = ION_FLAG_CACHED;
+
+	ret = ion_export_buffer_fd(&info);
+	if (ret < 0) {
+		printf("ion buffer alloc failed\n");
+		return -1;
+	}
+
+	vgem_fd = open_vgem();
+	if (vgem_fd < 0) {
+		ret = vgem_fd;
+		printf("Failed to open vgem\n");
+		goto out_ion;
+	}
+
+	ret = import_vgem_fd(vgem_fd, info.buffd, &handle);
+
+	if (ret < 0) {
+		printf("Failed to import buffer\n");
+		goto out_vgem;
+	}
+
+	sync.flags = DMA_BUF_SYNC_START | DMA_BUF_SYNC_RW;

tools/testing/selftests/android/ion/ionmap_test.c line 125

Quoted 10 lines
tools/testing/selftests/android/ion/ionmap_test.c new file +10 -0
+	ret = ioctl(info.buffd, DMA_BUF_IOCTL_SYNC, &sync);
+	if (ret)
+		printf("sync start failed %d\n", errno);
+
+	memset(info.buffer, 0xff, 4096);
+
+	sync.flags = DMA_BUF_SYNC_END | DMA_BUF_SYNC_RW;
+	ret = ioctl(info.buffd, DMA_BUF_IOCTL_SYNC, &sync);
+	if (ret)
+		printf("sync end failed %d\n", errno);

At least in drm we require that userspace auto-restarts all ioctls when they get interrupt. See

https://cgit.freedesktop.org/drm/libdrm/tree/xf86drm.c#n186

Quoted 7 lines

not really an issue with vgem (which can't wait for hw or anything else). But good to make sure we don't spread bad copypastas.

Actual use of the ioctls looks all good. With the drmIoctl wrapper added and used this is:

Quoted 7 lines

Thanks for the review. The reason I didn't use the standard drmIoctl was because I didn't want to introduce a dependency on libdrm. I don't see an example of another selftest having a dependency on an external library.

Is adding a dependencies on fairly standard but still external userspace libraries okay for kernel self tests?

Yeah adding a dependency isn't good, I'd just copypaste a local static version into the test file. That's good enough, the point isn't to use the libdrm one, but a wrapper that automatically restarts (every other userspace for gfx has their own copy of it since it's so trivial). -Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
maintainer
#7 lore raw

Re: [PATCH 2/2] selftests: ion: Add simple test with the vgem driver

Quoted 184 lines · Daniel Vetter
Quoted 183 lines · Laura Abbott
Quoted 181 lines · Daniel Vetter
Quoted 157 lines · Laura Abbott

Ion is designed to be a framework used by other clients who perform operations on the buffer. Use the DRM vgem client as a simple consumer. In conjunction with the dma-buf sync ioctls, this tests the full attach/map path for the system heap.

Signed-off-by Laura Abbott <labbott at redhat.com>
---
  tools/testing/selftests/android/ion/Makefile      |   3 +-
  tools/testing/selftests/android/ion/config        |   1 +
  tools/testing/selftests/android/ion/ionmap_test.c | 136 ++++++++++++++++++++++
  3 files changed, 139 insertions(+), 1 deletion(-)

create mode 100644 tools/testing/selftests/android/ion/ionmap_test.c

tools/testing/selftests/android/ion/Makefile +2 -1
index 96e0c448b39d..d23b6d537d8b 100644
@@ -2,7 +2,7 @@
  INCLUDEDIR := -I. -I../../../../../drivers/staging/android/uapi/
  CFLAGS := $(CFLAGS) $(INCLUDEDIR) -Wall -O2 -g
-TEST_GEN_FILES := ionapp_export ionapp_import
+TEST_GEN_FILES := ionapp_export ionapp_import ionmap_test
  all: $(TEST_GEN_FILES)
@@ -14,3 +14,4 @@ include ../../lib.mk
  $(OUTPUT)/ionapp_export: ionapp_export.c ipcsocket.c ionutils.c
  $(OUTPUT)/ionapp_import: ionapp_import.c ipcsocket.c ionutils.c
+$(OUTPUT)/ionmap_test: ionmap_test.c ionutils.c
tools/testing/selftests/android/ion/config +1 -0
index 19db6ca9aa2b..b4ad748a9dd9 100644
@@ -2,3 +2,4 @@ CONFIG_ANDROID=y
  CONFIG_STAGING=y
  CONFIG_ION=y
  CONFIG_ION_SYSTEM_HEAP=y
+CONFIG_DRM_VGEM=y
tools/testing/selftests/android/ion/ionmap_test.c new file +115 -0
new file mode 100644
index 000000000000..dab36b06b37d
@@ -0,0 +1,136 @@
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdint.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <sys/ioctl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include <linux/dma-buf.h>
+
+#include <drm/drm.h>
+
+#include "ion.h"
+#include "ionutils.h"
+
+int check_vgem(int fd)
+{
+	drm_version_t version = { 0 };
+	char name[5];
+	int ret;
+
+	version.name_len = 4;
+	version.name = name;
+
+	ret = ioctl(fd, DRM_IOCTL_VERSION, &version);
+	if (ret)
+		return 1;
+
+	return strcmp(name, "vgem");
+}
+
+int open_vgem(void)
+{
+	int i, fd;
+	const char *drmstr = "/dev/dri/card";
+
+	fd = -1;
+	for (i = 0; i < 16; i++) {
+		char name[80];
+
+		sprintf(name, "%s%u", drmstr, i);
+
+		fd = open(name, O_RDWR);
+		if (fd < 0)
+			continue;
+
+		if (check_vgem(fd)) {
+			close(fd);
+			continue;
+		} else {
+			break;
+		}
+
+	}
+	return fd;
+}
+
+int import_vgem_fd(int vgem_fd, int dma_buf_fd, uint32_t *handle)
+{
+	struct drm_prime_handle import_handle = { 0 };
+	int ret;
+
+	import_handle.fd = dma_buf_fd;
+	import_handle.flags = 0;
+	import_handle.handle = 0;
+
+	ret = ioctl(vgem_fd, DRM_IOCTL_PRIME_FD_TO_HANDLE, &import_handle);
+	if (ret == 0)
+		*handle = import_handle.handle;
+	return ret;
+}
+
+void close_handle(int vgem_fd, uint32_t handle)
+{
+	struct drm_gem_close close = { 0 };
+
+	close.handle = handle;
+	ioctl(vgem_fd, DRM_IOCTL_GEM_CLOSE, &close);
+}
+
+int main()
+{
+	int ret, vgem_fd;
+	struct ion_buffer_info info;
+	uint32_t handle = 0;
+	struct dma_buf_sync sync = { 0 };
+
+	info.heap_type = ION_HEAP_TYPE_SYSTEM;
+	info.heap_size = 4096;
+	info.flag_type = ION_FLAG_CACHED;
+
+	ret = ion_export_buffer_fd(&info);
+	if (ret < 0) {
+		printf("ion buffer alloc failed\n");
+		return -1;
+	}
+
+	vgem_fd = open_vgem();
+	if (vgem_fd < 0) {
+		ret = vgem_fd;
+		printf("Failed to open vgem\n");
+		goto out_ion;
+	}
+
+	ret = import_vgem_fd(vgem_fd, info.buffd, &handle);
+
+	if (ret < 0) {
+		printf("Failed to import buffer\n");
+		goto out_vgem;
+	}
+
+	sync.flags = DMA_BUF_SYNC_START | DMA_BUF_SYNC_RW;

tools/testing/selftests/android/ion/ionmap_test.c line 125

Quoted 10 lines
tools/testing/selftests/android/ion/ionmap_test.c new file +10 -0
+	ret = ioctl(info.buffd, DMA_BUF_IOCTL_SYNC, &sync);
+	if (ret)
+		printf("sync start failed %d\n", errno);
+
+	memset(info.buffer, 0xff, 4096);
+
+	sync.flags = DMA_BUF_SYNC_END | DMA_BUF_SYNC_RW;
+	ret = ioctl(info.buffd, DMA_BUF_IOCTL_SYNC, &sync);
+	if (ret)
+		printf("sync end failed %d\n", errno);

At least in drm we require that userspace auto-restarts all ioctls when they get interrupt. See

https://cgit.freedesktop.org/drm/libdrm/tree/xf86drm.c#n186

not really an issue with vgem (which can't wait for hw or anything else). But good to make sure we don't spread bad copypastas.

Actual use of the ioctls looks all good. With the drmIoctl wrapper added and used this is:

Reviewed-by Daniel Vetter <daniel.vetter at ffwll.ch>
Quoted 7 lines
Quoted 7 lines

Thanks for the review. The reason I didn't use the standard drmIoctl was because I didn't want to introduce a dependency on libdrm. I don't see an example of another selftest having a dependency on an external library.

Is adding a dependencies on fairly standard but still external userspace libraries okay for kernel self tests?

We have cases where external libraries are used. fuse test probably is one example.

Quoted 5 lines

Yeah adding a dependency isn't good, I'd just copypaste a local static version into the test file. That's good enough, the point isn't to use the libdrm one, but a wrapper that automatically restarts (every other userspace for gfx has their own copy of it since it's so trivial).

Let's go ahead and use libdrm - It is important to keep them in sync. Maybe we can check dependency in the ion Makefile and not compile the test. As long as the rest of the tests run even when libdrm dependency isn't met, we should be good.

thanks,
-- Shuah

--
To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

#8 lore raw

Re: [PATCH 2/2] selftests: ion: Add simple test with the vgem driver

Quoted 202 lines · Shuah Khan
Quoted 184 lines · Daniel Vetter
Quoted 183 lines · Laura Abbott
Quoted 181 lines · Daniel Vetter
Quoted 157 lines · Laura Abbott

Ion is designed to be a framework used by other clients who perform operations on the buffer. Use the DRM vgem client as a simple consumer. In conjunction with the dma-buf sync ioctls, this tests the full attach/map path for the system heap.

Signed-off-by Laura Abbott <labbott at redhat.com>
---
   tools/testing/selftests/android/ion/Makefile      |   3 +-
   tools/testing/selftests/android/ion/config        |   1 +
   tools/testing/selftests/android/ion/ionmap_test.c | 136 ++++++++++++++++++++++
   3 files changed, 139 insertions(+), 1 deletion(-)

create mode 100644 tools/testing/selftests/android/ion/ionmap_test.c

tools/testing/selftests/android/ion/Makefile +2 -1
index 96e0c448b39d..d23b6d537d8b 100644
@@ -2,7 +2,7 @@
   INCLUDEDIR := -I. -I../../../../../drivers/staging/android/uapi/
   CFLAGS := $(CFLAGS) $(INCLUDEDIR) -Wall -O2 -g
-TEST_GEN_FILES := ionapp_export ionapp_import
+TEST_GEN_FILES := ionapp_export ionapp_import ionmap_test
   all: $(TEST_GEN_FILES)
@@ -14,3 +14,4 @@ include ../../lib.mk
   $(OUTPUT)/ionapp_export: ionapp_export.c ipcsocket.c ionutils.c
   $(OUTPUT)/ionapp_import: ionapp_import.c ipcsocket.c ionutils.c
+$(OUTPUT)/ionmap_test: ionmap_test.c ionutils.c
tools/testing/selftests/android/ion/config +1 -0
index 19db6ca9aa2b..b4ad748a9dd9 100644
@@ -2,3 +2,4 @@ CONFIG_ANDROID=y
   CONFIG_STAGING=y
   CONFIG_ION=y
   CONFIG_ION_SYSTEM_HEAP=y
+CONFIG_DRM_VGEM=y
tools/testing/selftests/android/ion/ionmap_test.c new file +115 -0
new file mode 100644
index 000000000000..dab36b06b37d
@@ -0,0 +1,136 @@
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdint.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <sys/ioctl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include <linux/dma-buf.h>
+
+#include <drm/drm.h>
+
+#include "ion.h"
+#include "ionutils.h"
+
+int check_vgem(int fd)
+{
+	drm_version_t version = { 0 };
+	char name[5];
+	int ret;
+
+	version.name_len = 4;
+	version.name = name;
+
+	ret = ioctl(fd, DRM_IOCTL_VERSION, &version);
+	if (ret)
+		return 1;
+
+	return strcmp(name, "vgem");
+}
+
+int open_vgem(void)
+{
+	int i, fd;
+	const char *drmstr = "/dev/dri/card";
+
+	fd = -1;
+	for (i = 0; i < 16; i++) {
+		char name[80];
+
+		sprintf(name, "%s%u", drmstr, i);
+
+		fd = open(name, O_RDWR);
+		if (fd < 0)
+			continue;
+
+		if (check_vgem(fd)) {
+			close(fd);
+			continue;
+		} else {
+			break;
+		}
+
+	}
+	return fd;
+}
+
+int import_vgem_fd(int vgem_fd, int dma_buf_fd, uint32_t *handle)
+{
+	struct drm_prime_handle import_handle = { 0 };
+	int ret;
+
+	import_handle.fd = dma_buf_fd;
+	import_handle.flags = 0;
+	import_handle.handle = 0;
+
+	ret = ioctl(vgem_fd, DRM_IOCTL_PRIME_FD_TO_HANDLE, &import_handle);
+	if (ret == 0)
+		*handle = import_handle.handle;
+	return ret;
+}
+
+void close_handle(int vgem_fd, uint32_t handle)
+{
+	struct drm_gem_close close = { 0 };
+
+	close.handle = handle;
+	ioctl(vgem_fd, DRM_IOCTL_GEM_CLOSE, &close);
+}
+
+int main()
+{
+	int ret, vgem_fd;
+	struct ion_buffer_info info;
+	uint32_t handle = 0;
+	struct dma_buf_sync sync = { 0 };
+
+	info.heap_type = ION_HEAP_TYPE_SYSTEM;
+	info.heap_size = 4096;
+	info.flag_type = ION_FLAG_CACHED;
+
+	ret = ion_export_buffer_fd(&info);
+	if (ret < 0) {
+		printf("ion buffer alloc failed\n");
+		return -1;
+	}
+
+	vgem_fd = open_vgem();
+	if (vgem_fd < 0) {
+		ret = vgem_fd;
+		printf("Failed to open vgem\n");
+		goto out_ion;
+	}
+
+	ret = import_vgem_fd(vgem_fd, info.buffd, &handle);
+
+	if (ret < 0) {
+		printf("Failed to import buffer\n");
+		goto out_vgem;
+	}
+
+	sync.flags = DMA_BUF_SYNC_START | DMA_BUF_SYNC_RW;

tools/testing/selftests/android/ion/ionmap_test.c line 125

Quoted 10 lines
tools/testing/selftests/android/ion/ionmap_test.c new file +10 -0
+	ret = ioctl(info.buffd, DMA_BUF_IOCTL_SYNC, &sync);
+	if (ret)
+		printf("sync start failed %d\n", errno);
+
+	memset(info.buffer, 0xff, 4096);
+
+	sync.flags = DMA_BUF_SYNC_END | DMA_BUF_SYNC_RW;
+	ret = ioctl(info.buffd, DMA_BUF_IOCTL_SYNC, &sync);
+	if (ret)
+		printf("sync end failed %d\n", errno);

At least in drm we require that userspace auto-restarts all ioctls when they get interrupt. See

https://cgit.freedesktop.org/drm/libdrm/tree/xf86drm.c#n186

not really an issue with vgem (which can't wait for hw or anything else). But good to make sure we don't spread bad copypastas.

Actual use of the ioctls looks all good. With the drmIoctl wrapper added and used this is:

Reviewed-by Daniel Vetter <daniel.vetter at ffwll.ch>
Quoted 7 lines
Quoted 7 lines

Thanks for the review. The reason I didn't use the standard drmIoctl was because I didn't want to introduce a dependency on libdrm. I don't see an example of another selftest having a dependency on an external library.

Is adding a dependencies on fairly standard but still external userspace libraries okay for kernel self tests?

We have cases where external libraries are used. fuse test probably is one example.

Quoted 5 lines

Yeah adding a dependency isn't good, I'd just copypaste a local static version into the test file. That's good enough, the point isn't to use the libdrm one, but a wrapper that automatically restarts (every other userspace for gfx has their own copy of it since it's so trivial).

Quoted 9 lines

Let's go ahead and use libdrm - It is important to keep them in sync. Maybe we can check dependency in the ion Makefile and not compile the test. As long as the rest of the tests run even when libdrm dependency isn't met, we should be good.

thanks,
-- Shuah

The example you gave with fuse doesn't compile if you don't have the fuse library installed. I don't think adding a dependency on libdrm is worth it for a simple wrapper ioctl, especially since Daniel mention it gets copied around anyway.

Thanks,
Laura
--
To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

#9 lore raw

Re: [PATCH 2/2] selftests: ion: Add simple test with the vgem driver

Quoted 213 lines · Laura Abbott
Quoted 202 lines · Shuah Khan
Quoted 184 lines · Daniel Vetter
Quoted 183 lines · Laura Abbott
Quoted 181 lines · Daniel Vetter
Quoted 157 lines · Laura Abbott

Ion is designed to be a framework used by other clients who perform operations on the buffer. Use the DRM vgem client as a simple consumer. In conjunction with the dma-buf sync ioctls, this tests the full attach/map path for the system heap.

---
   tools/testing/selftests/android/ion/Makefile      |   3 +- tools/testing/selftests/android/ion/config        |   1 + tools/testing/selftests/android/ion/ionmap_test.c | 136 ++++++++++++++++++++++

   3 files changed, 139 insertions(+), 1 deletion(-)

   create mode 100644 tools/testing/selftests/android/ion/ionmap_test.c

tools/testing/selftests/android/ion/Makefile +0 -0
index 96e0c448b39d..d23b6d537d8b 100644
@@ -2,7 +2,7 @@

   INCLUDEDIR := -I. -I../../../../../drivers/staging/android/uapi/ CFLAGS := $(CFLAGS) $(INCLUDEDIR) -Wall -O2 -g

tools/testing/selftests/android/ion/Makefile +1 -1
-TEST_GEN_FILES := ionapp_export ionapp_import
+TEST_GEN_FILES := ionapp_export ionapp_import ionmap_test

   all: $(TEST_GEN_FILES)

tools/testing/selftests/android/ion/Makefile +0 -0
@@ -14,3 +14,4 @@ include ../../lib.mk

   $(OUTPUT)/ionapp_export: ionapp_export.c ipcsocket.c ionutils.c $(OUTPUT)/ionapp_import: ionapp_import.c ipcsocket.c ionutils.c +$(OUTPUT)/ionmap_test: ionmap_test.c ionutils.c

tools/testing/selftests/android/ion/config +0 -0
index 19db6ca9aa2b..b4ad748a9dd9 100644
@@ -2,3 +2,4 @@ CONFIG_ANDROID=y

   CONFIG_STAGING=y
   CONFIG_ION=y
   CONFIG_ION_SYSTEM_HEAP=y

tools/testing/selftests/android/ion/config +1 -0
+CONFIG_DRM_VGEM=y
tools/testing/selftests/android/ion/ionmap_test.c new file +115 -0
new file mode 100644
index 000000000000..dab36b06b37d
@@ -0,0 +1,136 @@
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdint.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <sys/ioctl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include <linux/dma-buf.h>
+
+#include <drm/drm.h>
+
+#include "ion.h"
+#include "ionutils.h"
+
+int check_vgem(int fd)
+{
+    drm_version_t version = { 0 };
+    char name[5];
+    int ret;
+
+    version.name_len = 4;
+    version.name = name;
+
+    ret = ioctl(fd, DRM_IOCTL_VERSION, &version);
+    if (ret)
+        return 1;
+
+    return strcmp(name, "vgem");
+}
+
+int open_vgem(void)
+{
+    int i, fd;
+    const char *drmstr = "/dev/dri/card";
+
+    fd = -1;
+    for (i = 0; i < 16; i++) {
+        char name[80];
+
+        sprintf(name, "%s%u", drmstr, i);
+
+        fd = open(name, O_RDWR);
+        if (fd < 0)
+            continue;
+
+        if (check_vgem(fd)) {
+            close(fd);
+            continue;
+        } else {
+            break;
+        }
+
+    }
+    return fd;
+}
+
+int import_vgem_fd(int vgem_fd, int dma_buf_fd, uint32_t *handle)
+{
+    struct drm_prime_handle import_handle = { 0 };
+    int ret;
+
+    import_handle.fd = dma_buf_fd;
+    import_handle.flags = 0;
+    import_handle.handle = 0;
+
+    ret = ioctl(vgem_fd, DRM_IOCTL_PRIME_FD_TO_HANDLE, &import_handle);
+    if (ret == 0)
+        *handle = import_handle.handle;
+    return ret;
+}
+
+void close_handle(int vgem_fd, uint32_t handle)
+{
+    struct drm_gem_close close = { 0 };
+
+    close.handle = handle;
+    ioctl(vgem_fd, DRM_IOCTL_GEM_CLOSE, &close);
+}
+
+int main()
+{
+    int ret, vgem_fd;
+    struct ion_buffer_info info;
+    uint32_t handle = 0;
+    struct dma_buf_sync sync = { 0 };
+
+    info.heap_type = ION_HEAP_TYPE_SYSTEM;
+    info.heap_size = 4096;
+    info.flag_type = ION_FLAG_CACHED;
+
+    ret = ion_export_buffer_fd(&info);
+    if (ret < 0) {
+        printf("ion buffer alloc failed\n");
+        return -1;
+    }
+
+    vgem_fd = open_vgem();
+    if (vgem_fd < 0) {
+        ret = vgem_fd;
+        printf("Failed to open vgem\n");
+        goto out_ion;
+    }
+
+    ret = import_vgem_fd(vgem_fd, info.buffd, &handle);
+
+    if (ret < 0) {
+        printf("Failed to import buffer\n");
+        goto out_vgem;
+    }
+
+    sync.flags = DMA_BUF_SYNC_START | DMA_BUF_SYNC_RW;

tools/testing/selftests/android/ion/ionmap_test.c line 125

Quoted 10 lines
tools/testing/selftests/android/ion/ionmap_test.c new file +10 -0
+    ret = ioctl(info.buffd, DMA_BUF_IOCTL_SYNC, &sync);
+    if (ret)
+        printf("sync start failed %d\n", errno);
+
+    memset(info.buffer, 0xff, 4096);
+
+    sync.flags = DMA_BUF_SYNC_END | DMA_BUF_SYNC_RW;
+    ret = ioctl(info.buffd, DMA_BUF_IOCTL_SYNC, &sync);
+    if (ret)
+        printf("sync end failed %d\n", errno);

At least in drm we require that userspace auto-restarts all ioctls when they get interrupt. See

https://cgit.freedesktop.org/drm/libdrm/tree/xf86drm.c#n186

not really an issue with vgem (which can't wait for hw or anything else). But good to make sure we don't spread bad copypastas.

Actual use of the ioctls looks all good. With the drmIoctl wrapper added and used this is:

Quoted 7 lines
Quoted 7 lines

Thanks for the review. The reason I didn't use the standard drmIoctl was because I didn't want to introduce a dependency on libdrm. I don't see an example of another selftest having a dependency on an external library.

Is adding a dependencies on fairly standard but still external userspace libraries okay for kernel self tests?

We have cases where external libraries are used. fuse test probably is one example.

Quoted 5 lines

Yeah adding a dependency isn't good, I'd just copypaste a local static version into the test file. That's good enough, the point isn't to use the libdrm one, but a wrapper that automatically restarts (every other userspace for gfx has their own copy of it since it's so trivial).

Quoted 9 lines

Let's go ahead and use libdrm - It is important to keep them in sync. Maybe we can check dependency in the ion Makefile and not compile the test. As long as the rest of the tests run even when libdrm dependency isn't met, we should be good.

thanks,
-- Shuah

Quoted 7 lines

The example you gave with fuse doesn't compile if you don't have the fuse library installed. I don't think adding a dependency on libdrm is worth it for a simple wrapper ioctl, especially since Daniel mention it gets copied around anyway.

Thanks,
Laura

Right. It won't compile without the library. The upside is there is no duplicate code. That said, I have no problems taking the patch for now. If I start seeing more and more drm code, I might reconsider and opt to add the dependency.

I will queue this up for 4.17-rc1

thanks,
-- Shuah
_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel