Skip to contentSkip to conversation

various exynos cleanups

PATCH Superseded Daniel Kurtz 2 participants 12 messages Mar 5, 2014 – Apr 5, 2014 Arm Samsung Exynos

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover various exynos cleanups

Just some clean up patches, mostly for libdrm_exynos.

Daniel Kurtz (8):
eyxnos: install exynos tests if HAVE_INSTALL_TESTS
exynos: fix two warnings
exynos_fimg2d: fix cast from pointer to integer of different size
exynos: remove unusable "run" target
exynos_fimg2d_test: fix drmModeRmFB
drmOpenByName: remove redundant drmAvailable check
exynos: prime: use drmPrime*() helpers
exynos: removed unused fd field

 exynos/exynos_drm.c               | 52 +++++++++------------------------------
 exynos/exynos_drmif.h             |  2 --
 exynos/exynos_fimg2d.c            |  4 +--
 tests/exynos/Makefile.am          |  7 ++++--
 tests/exynos/exynos_fimg2d_test.c |  2 +-
 xf86drm.c                         | 13 ----------
 6 files changed, 20 insertions(+), 60 deletions(-)
Signature · 1 line
1.9.0.rc1.175.g0b1dcb5
#1 lore raw

PATCH 1/8 eyxnos: install exynos tests if HAVE_INSTALL_TESTS

This exynos test was added just before HAVE_INSTALL_TESTS, and so didn't get this annotation.

---
 tests/exynos/Makefile.am | 5 +++++
 1 file changed, 5 insertions(+)
tests/exynos/Makefile.am +5 -0
index bf9ad82..6703dcf 100644
@@ -4,8 +4,13 @@ AM_CFLAGS = \
 	-I $(top_srcdir)/exynos \
 	-I $(top_srcdir)
 
+if HAVE_INSTALL_TESTS
+bin_PROGRAMS = \
+	exynos_fimg2d_test
+else
 noinst_PROGRAMS = \
 	exynos_fimg2d_test
+endif
 
 exynos_fimg2d_test_LDADD = \
 	$(top_builddir)/libdrm.la \
Signature · 1 line
1.9.0.rc1.175.g0b1dcb5
#2 lore raw

PATCH 2/8 exynos: fix two warnings

In reply to Daniel Kurtz

warning: assignment makes pointer from integer without a cast [enabled by default]
warning: initialization makes integer from pointer without a cast [enabled by default]

---
 exynos/exynos_drm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
exynos/exynos_drm.c +2 -2
index 4db755e..b7acdf5 100644
@@ -294,7 +294,7 @@ void *exynos_bo_map(struct exynos_bo *bo)
 			return NULL;
 		}
 
-		bo->vaddr = req.mapped;
+		bo->vaddr = (void *)(uintptr_t)req.mapped;
 	}
 
 	return bo->vaddr;
@@ -381,7 +381,7 @@ int exynos_vidi_connection(struct exynos_device *dev, uint32_t connect,
 	struct drm_exynos_vidi_connection req = {
 		.connection	= connect,
 		.extensions	= ext,
-		.edid		= edid,
+		.edid		= (uint64_t)(uintptr_t)edid,
 	};
 	int ret;
 
Signature · 1 line
1.9.0.rc1.175.g0b1dcb5
#3 lore raw

PATCH 3/8 exynos_fimg2d: fix cast from pointer to integer of different size

In reply to Daniel Kurtz

Fixes two gcc [-Wpointer-to-int-cast] warnings.

---
 exynos/exynos_fimg2d.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
exynos/exynos_fimg2d.c +2 -2
index cf712a8..0b14618 100644
@@ -158,8 +158,8 @@ static int g2d_flush(struct g2d_context *ctx)
 
 	memset(&cmdlist, 0, sizeof(struct drm_exynos_g2d_set_cmdlist));
 
-	cmdlist.cmd = (unsigned int)&ctx->cmd[0];
-	cmdlist.cmd_buf = (unsigned int)&ctx->cmd_buf[0];
+	cmdlist.cmd = (uint64_t)(uintptr_t)&ctx->cmd[0];
+	cmdlist.cmd_buf = (uint64_t)(uintptr_t)&ctx->cmd_buf[0];
 	cmdlist.cmd_nr = ctx->cmd_nr;
 	cmdlist.cmd_buf_nr = ctx->cmd_buf_nr;
 	cmdlist.event_type = G2D_EVENT_NOT;
Signature · 1 line
1.9.0.rc1.175.g0b1dcb5
#4 lore raw

PATCH 4/8 exynos: remove unusable "run" target

In reply to Daniel Kurtz

This looks like it was copied from kmstest, but isn't needed, and doesn't actually work since exynos_fimg2d_test requires parameters.

---
 tests/exynos/Makefile.am | 2 --
 1 file changed, 2 deletions(-)
tests/exynos/Makefile.am +0 -2
index 6703dcf..518f00b 100644
@@ -20,5 +20,3 @@ exynos_fimg2d_test_LDADD = \
 exynos_fimg2d_test_SOURCES = \
 	exynos_fimg2d_test.c
 
-run: exynos_fimg2d_test
-	./exynos_fimg2d_test
Signature · 1 line
1.9.0.rc1.175.g0b1dcb5
#5 lore raw

PATCH 5/8 exynos_fimg2d_test: fix drmModeRmFB

In reply to Daniel Kurtz

The first parameter should be the drm fd, second param is the fb id.

---
 tests/exynos/exynos_fimg2d_test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/exynos/exynos_fimg2d_test.c +1 -1
index e80455a..c6bd558 100644
@@ -682,7 +682,7 @@ err_free_src:
 		exynos_destroy_buffer(src);
 
 err_rm_fb:
-	drmModeRmFB(fb_id, bo->handle);
+	drmModeRmFB(dev->fd, fb_id);
 
 err_destroy_buffer:
 	exynos_destroy_buffer(bo);
Signature · 1 line
1.9.0.rc1.175.g0b1dcb5
#6 lore raw

PATCH 6/8 drmOpenByName: remove redundant drmAvailable check

In reply to Daniel Kurtz

drmOpenByName() is a static function that is only called by drmOpen(). drmOpen() already checks drmAvailable(), so the checki in drmOpenByName() is redundant.

---
 xf86drm.c | 13 -------------
 1 file changed, 13 deletions(-)
xf86drm.c +0 -13
index 720952f..118022c 100644
@@ -537,19 +537,6 @@ static int drmOpenByName(const char *name)
     int           fd;
     drmVersionPtr version;
     char *        id;
-    
-    if (!drmAvailable()) {
-	if (!drm_server_info) {
-	    return -1;
-	}
-	else {
-	    /* try to load the kernel module now */
-	    if (!drm_server_info->load_module(name)) {
-		drmMsg("[drm] failed to load kernel module \"%s\"\n", name);
-		return -1;
-	    }
-	}
-    }
 
     /*
      * Open the first minor number that matches the driver name and isn't
Signature · 1 line
1.9.0.rc1.175.g0b1dcb5
#7 lore raw

PATCH 7/8 exynos: prime: use drmPrime*() helpers

In reply to Daniel Kurtz

Reuse the common drmPrime() helper functions rather than reinventing them.

---
 exynos/exynos_drm.c | 48 ++++++++++--------------------------------------
 1 file changed, 10 insertions(+), 38 deletions(-)
exynos/exynos_drm.c +10 -38
index b7acdf5..5fff259 100644
@@ -303,59 +303,31 @@ void *exynos_bo_map(struct exynos_bo *bo)
 /*
  * Export gem object to dmabuf as file descriptor.
  *
- * @dev: a exynos device object.
- * @handle: gem handle to be exported into dmabuf as file descriptor.
- * @fd: file descriptor to dmabuf exported from gem handle and
- *	returned by kernel side.
+ * @dev: exynos device object
+ * @handle: gem handle to export as file descriptor of dmabuf
+ * @fd: file descriptor returned from kernel
  *
- * if true, return 0 else negative.
+ * @return: 0 on success, -1 on error, and errno will be set
  */
 int exynos_prime_handle_to_fd(struct exynos_device *dev, uint32_t handle,
 					int *fd)
 {
-	int ret;
-	struct drm_prime_handle req = {
-		.handle	= handle,
-	};
-
-	ret = drmIoctl(dev->fd, DRM_IOCTL_PRIME_HANDLE_TO_FD, &req);
-	if (ret) {
-		fprintf(stderr, "failed to mmap[%s].\n",
-			strerror(errno));
-		return ret;
-	}
-
-	*fd = req.fd;
-	return 0;
+	return drmPrimeHandleToFD(dev->fd, handle, 0, fd);
 }
 
 /*
  * Import file descriptor into gem handle.
  *
- * @dev: a exynos device object.
- * @fd: file descriptor exported into dmabuf.
- * @handle: gem handle to gem object imported from file descriptor
- *	and returned by kernel side.
+ * @dev: exynos device object
+ * @fd: file descriptor of dmabuf to import
+ * @handle: gem handle returned from kernel
  *
- * if true, return 0 else negative.
+ * @return: 0 on success, -1 on error, and errno will be set
  */
 int exynos_prime_fd_to_handle(struct exynos_device *dev, int fd,
 					uint32_t *handle)
 {
-	int ret;
-	struct drm_prime_handle req = {
-		.fd	= fd,
-	};
-
-	ret = drmIoctl(dev->fd, DRM_IOCTL_PRIME_FD_TO_HANDLE, &req);
-	if (ret) {
-		fprintf(stderr, "failed to mmap[%s].\n",
-			strerror(errno));
-		return ret;
-	}
-
-	*handle = req.handle;
-	return 0;
+	return drmPrimeFDToHandle(dev->fd, fd, handle);
 }
 
 
Signature · 1 line
1.9.0.rc1.175.g0b1dcb5
#8 lore raw

PATCH 8/8 exynos: removed unused fd field

In reply to Daniel Kurtz

The documentation says fd holds the fd from prime import/export. However, it isn't actually used, nor is it necessary, so let's just remove it.

---
 exynos/exynos_drmif.h | 2 --
 1 file changed, 2 deletions(-)
exynos/exynos_drmif.h +0 -2
index 92f613e..c7c1d44 100644
@@ -41,7 +41,6 @@ struct exynos_device {
  * @dev: exynos device object allocated.
  * @handle: a gem handle to gem object created.
  * @flags: indicate memory allocation and cache attribute types.
- * @fd: file descriptor exported into dmabuf.
  * @size: size to the buffer created.
  * @vaddr: user space address to a gem buffer mmaped.
  * @name: a gem global handle from flink request.
@@ -50,7 +49,6 @@ struct exynos_bo {
 	struct exynos_device	*dev;
 	uint32_t		handle;
 	uint32_t		flags;
-	int			fd;
 	size_t			size;
 	void			*vaddr;
 	uint32_t		name;
Signature · 1 line
1.9.0.rc1.175.g0b1dcb5
Acked-by on the v1 series
#9 lore raw
In reply to Daniel Kurtz

Hi,

Thanks you for cleanups.

2014-03-05 14:01 GMT+09:00 Daniel Kurtz <[email protected]>:

Quoted 12 lines

Just some clean up patches, mostly for libdrm_exynos.

Daniel Kurtz (8):
eyxnos: install exynos tests if HAVE_INSTALL_TESTS
exynos: fix two warnings
exynos_fimg2d: fix cast from pointer to integer of different size
exynos: remove unusable "run" target
exynos_fimg2d_test: fix drmModeRmFB
drmOpenByName: remove redundant drmAvailable check
exynos: prime: use drmPrime*() helpers
exynos: removed unused fd field

1 through 5, and 7 through 8,

Thanks,
Inki Dae

Quoted 15 lines
 exynos/exynos_drm.c               | 52 +++++++++------------------------------
 exynos/exynos_drmif.h             |  2 --
 exynos/exynos_fimg2d.c            |  4 +--
 tests/exynos/Makefile.am          |  7 ++++--
 tests/exynos/exynos_fimg2d_test.c |  2 +-
 xf86drm.c                         | 13 ----------
 6 files changed, 20 insertions(+), 60 deletions(-)

--
1.9.0.rc1.175.g0b1dcb5

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

#10 lore raw
Quoted 18 lines · Inki Dae

Hi,

Thanks you for cleanups.

2014-03-05 14:01 GMT+09:00 Daniel Kurtz <[email protected]>:

Quoted 12 lines

Just some clean up patches, mostly for libdrm_exynos.

Daniel Kurtz (8):
eyxnos: install exynos tests if HAVE_INSTALL_TESTS
exynos: fix two warnings
exynos_fimg2d: fix cast from pointer to integer of different size
exynos: remove unusable "run" target
exynos_fimg2d_test: fix drmModeRmFB
drmOpenByName: remove redundant drmAvailable check
exynos: prime: use drmPrime*() helpers
exynos: removed unused fd field

Quoted 3 lines

1 through 5, and 7 through 8,

Inki,
Thanks for the reviews.

Can someone with commit access push the 7 ACK'ed patches. Also, can someone please review patch number 6?

Quoted 20 lines

Thanks,
Inki Dae

Quoted 15 lines
 exynos/exynos_drm.c               | 52 +++++++++------------------------------
 exynos/exynos_drmif.h             |  2 --
 exynos/exynos_fimg2d.c            |  4 +--
 tests/exynos/Makefile.am          |  7 ++++--
 tests/exynos/exynos_fimg2d_test.c |  2 +-
 xf86drm.c                         | 13 ----------
 6 files changed, 20 insertions(+), 60 deletions(-)

--
1.9.0.rc1.175.g0b1dcb5

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

#11 lore raw
Quoted 21 lines · Daniel Kurtz
Quoted 20 lines · Inki Dae

Hi,

Thanks you for cleanups.

2014-03-05 14:01 GMT+09:00 Daniel Kurtz <[email protected]>:

Quoted 12 lines

Just some clean up patches, mostly for libdrm_exynos.

Daniel Kurtz (8):
eyxnos: install exynos tests if HAVE_INSTALL_TESTS
exynos: fix two warnings
exynos_fimg2d: fix cast from pointer to integer of different size
exynos: remove unusable "run" target
exynos_fimg2d_test: fix drmModeRmFB
drmOpenByName: remove redundant drmAvailable check
exynos: prime: use drmPrime*() helpers
exynos: removed unused fd field

1 through 5, and 7 through 8,

Quoted 7 lines
Quoted 1 line

Inki,
Thanks for the reviews.

Can someone with commit access push the 7 ACK'ed patches. Also, can someone please review patch number 6?

Gentle ping...
Can someone with commit access push the 7 ACK'ed patches. Also, can someone please review patch number 6?

Quoted 21 lines
Quoted 21 lines

Thanks,
Inki Dae

Quoted 15 lines
 exynos/exynos_drm.c               | 52 +++++++++------------------------------
 exynos/exynos_drmif.h             |  2 --
 exynos/exynos_fimg2d.c            |  4 +--
 tests/exynos/Makefile.am          |  7 ++++--
 tests/exynos/exynos_fimg2d_test.c |  2 +-
 xf86drm.c                         | 13 ----------
 6 files changed, 20 insertions(+), 60 deletions(-)

--
1.9.0.rc1.175.g0b1dcb5

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