drm: Branch 'master' - 8 commits

[email protected] (Emil Velikov)
Newsgroups gmane.comp.video.dri.patches
Message-ID <[email protected]>
 Android.common.mk                 |    4 ++-
 Android.mk                        |    2 +
 amdgpu/amdgpu-symbol-check        |    1 
 exynos/exynos_drm.c               |    2 -
 exynos/exynos_fimg2d.c            |   14 ------------
 tests/exynos/exynos_fimg2d_test.c |   43 +++++++++++++++++++++-----------------
 tests/util/Android.mk             |    2 +
 xf86drm.c                         |   18 ++++++++++-----
 8 files changed, 45 insertions(+), 41 deletions(-)

New commits:
commit 51a514c43f607c7f3c1231d1fcac15d450f98e5c
Author: Rob Herring <[email protected]>
Date:   Wed Mar 22 14:05:25 2017 -0500

    Android: disable pointer-arith and enum-conversion
    
    Disable some more warnings from clang. These don't appear to be warnings
    worth fixing.
    
    Signed-off-by: Rob Herring <[email protected]>
    Reviewed-by: Emil Velikov <[email protected]>

diff --git a/Android.common.mk b/Android.common.mk
index f57b8d37..35c0f02c 100644
--- a/Android.common.mk
+++ b/Android.common.mk
@@ -5,7 +5,9 @@ LOCAL_CFLAGS += \
 
 LOCAL_CFLAGS += \
 	-Wno-unused-parameter \
-	-Wno-missing-field-initializers
+	-Wno-missing-field-initializers \
+	-Wno-pointer-arith \
+	-Wno-enum-conversion
 
 # Quiet down the build system and remove any .h files from the sources
 LOCAL_SRC_FILES := $(patsubst %.h, , $(LOCAL_SRC_FILES))
commit c4d673acdcf1add753aa53d359f29bb44bc057db
Author: Rob Herring <[email protected]>
Date:   Wed Mar 22 14:05:24 2017 -0500

    Android: fix building of modetest and proptest
    
    These tests depend on tests/util/ headers, but expect the include path
    to be tests/.
    
    Signed-off-by: Rob Herring <[email protected]>
    Reviewed-by: Emil Velikov <[email protected]>

diff --git a/Android.mk b/Android.mk
index 5209059e..292be236 100644
--- a/Android.mk
+++ b/Android.mk
@@ -24,6 +24,8 @@
 LIBDRM_COMMON_MK := $(call my-dir)/Android.common.mk
 
 LOCAL_PATH := $(call my-dir)
+LIBDRM_TOP := $(LOCAL_PATH)
+
 include $(CLEAR_VARS)
 
 # Import variables LIBDRM_{,H_,INCLUDE_H_,INCLUDE_VMWGFX_H_}FILES
diff --git a/tests/util/Android.mk b/tests/util/Android.mk
index 7656c4c2..12eccb42 100644
--- a/tests/util/Android.mk
+++ b/tests/util/Android.mk
@@ -32,5 +32,7 @@ LOCAL_SHARED_LIBRARIES := libdrm
 
 LOCAL_SRC_FILES := $(UTIL_FILES)
 
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(LIBDRM_TOP)/tests
+
 include $(LIBDRM_COMMON_MK)
 include $(BUILD_STATIC_LIBRARY)
commit 7b806e87890182ac1b6181a848e03cd5c7db97ec
Author: Seung-Woo Kim <[email protected]>
Date:   Mon Mar 27 11:09:29 2017 +0900

    xf86drm: remove memory leaks in drmGetBusid/drmGetReservedContextList
    
    In error path of drmGetBusid() and drmGetReservedContextList(),
    there are memory leaks for error path. So this removes them.
    
    Signed-off-by: Seung-Woo Kim <[email protected]>
    Reviewed-by: Nicolai Hähnle <[email protected]>
    Reviewed-by: Emil Velikov <[email protected]>

diff --git a/xf86drm.c b/xf86drm.c
index 88f86ed5..685cf69d 100644
--- a/xf86drm.c
+++ b/xf86drm.c
@@ -994,8 +994,10 @@ char *drmGetBusid(int fd)
     if (drmIoctl(fd, DRM_IOCTL_GET_UNIQUE, &u))
         return NULL;
     u.unique = drmMalloc(u.unique_len + 1);
-    if (drmIoctl(fd, DRM_IOCTL_GET_UNIQUE, &u))
+    if (drmIoctl(fd, DRM_IOCTL_GET_UNIQUE, &u)) {
+        drmFree(u.unique);
         return NULL;
+    }
     u.unique[u.unique_len] = '\0';
 
     return u.unique;
@@ -1523,14 +1525,12 @@ drm_context_t *drmGetReservedContextList(int fd, int *count)
 
     if (!(list   = drmMalloc(res.count * sizeof(*list))))
         return NULL;
-    if (!(retval = drmMalloc(res.count * sizeof(*retval)))) {
-        drmFree(list);
-        return NULL;
-    }
+    if (!(retval = drmMalloc(res.count * sizeof(*retval))))
+        goto err_free_list;
 
     res.contexts = list;
     if (drmIoctl(fd, DRM_IOCTL_RES_CTX, &res))
-        return NULL;
+        goto err_free_context;
 
     for (i = 0; i < res.count; i++)
         retval[i] = list[i].handle;
@@ -1538,6 +1538,12 @@ drm_context_t *drmGetReservedContextList(int fd, int *count)
 
     *count = res.count;
     return retval;
+
+err_free_list:
+    drmFree(list);
+err_free_context:
+    drmFree(retval);
+    return NULL;
 }
 
 void drmFreeReservedContextList(drm_context_t *pt)
commit 2dc30dd5279fea1838f181724fb699a3689f582b
Author: Seung-Woo Kim <[email protected]>
Date:   Mon Mar 20 09:52:49 2017 +0900

    tests/exynos: fix invalid code of error path in g2d test
    
    This patch fixes invalid code of error path including NULL
    deference and leak in g2d test.
    
    Signed-off-by: Seung-Woo Kim <[email protected]>
    Reviewed-by: Emil Velikov <[email protected]>

diff --git a/tests/exynos/exynos_fimg2d_test.c b/tests/exynos/exynos_fimg2d_test.c
index 3495c626..ab1028e8 100644
--- a/tests/exynos/exynos_fimg2d_test.c
+++ b/tests/exynos/exynos_fimg2d_test.c
@@ -59,7 +59,6 @@ static void connector_find_mode(int fd, struct connector *c,
 		if (!connector) {
 			fprintf(stderr, "could not get connector %i: %s\n",
 				resources->connectors[i], strerror(errno));
-			drmModeFreeConnector(connector);
 			continue;
 		}
 
@@ -98,7 +97,6 @@ static void connector_find_mode(int fd, struct connector *c,
 		if (!c->encoder) {
 			fprintf(stderr, "could not get encoder %i: %s\n",
 				resources->encoders[i], strerror(errno));
-			drmModeFreeEncoder(c->encoder);
 			continue;
 		}
 
@@ -264,7 +262,8 @@ static int g2d_copy_test(struct exynos_device *dev, struct exynos_bo *src,
 		userptr = (unsigned long)malloc(size);
 		if (!userptr) {
 			fprintf(stderr, "failed to allocate userptr.\n");
-			return -EFAULT;
+			ret = -EFAULT;
+			goto fail;
 		}
 
 		src_img.user_ptr[0].userptr = userptr;
@@ -469,7 +468,8 @@ static int g2d_copy_with_scale_test(struct exynos_device *dev,
 		userptr = (unsigned long)malloc(size);
 		if (!userptr) {
 			fprintf(stderr, "failed to allocate userptr.\n");
-			return -EFAULT;
+			ret = -EFAULT;
+			goto fail;
 		}
 
 		src_img.user_ptr[0].userptr = userptr;
@@ -520,7 +520,7 @@ err_free_userptr:
 fail:
 	g2d_fini(ctx);
 
-	return 0;
+	return ret;;
 }
 
 #if EXYNOS_G2D_USERPTR_TEST
@@ -558,7 +558,8 @@ static int g2d_blend_test(struct exynos_device *dev,
 		userptr = (unsigned long)malloc(size);
 		if (!userptr) {
 			fprintf(stderr, "failed to allocate userptr.\n");
-			return -EFAULT;
+			ret = -EFAULT;
+			goto fail;
 		}
 
 		src_img.user_ptr[0].userptr = userptr;
@@ -620,7 +621,7 @@ err_free_userptr:
 fail:
 	g2d_fini(ctx);
 
-	return 0;
+	return ret;
 }
 #endif
 
@@ -647,8 +648,8 @@ static int g2d_checkerboard_test(struct exynos_device *dev,
 	dst_y = 0;
 
 	checkerboard = create_checkerboard_pattern(screen_width / 32, screen_height / 32, 32);
-	if (checkerboard == NULL) {
-		ret = -1;
+	if (!checkerboard) {
+		ret = -EFAULT;
 		goto fail;
 	}
 
@@ -757,8 +758,8 @@ int main(int argc, char **argv)
 
 	dev = exynos_device_create(fd);
 	if (!dev) {
-		drmClose(dev->fd);
-		return -EFAULT;
+		ret = -EFAULT;
+		goto err_drm_close;
 	}
 
 	resources = drmModeGetResources(dev->fd);
@@ -766,7 +767,7 @@ int main(int argc, char **argv)
 		fprintf(stderr, "drmModeGetResources failed: %s\n",
 				strerror(errno));
 		ret = -EFAULT;
-		goto err_drm_close;
+		goto err_dev_destory;
 	}
 
 	connector_find_mode(dev->fd, &con, resources);
@@ -775,7 +776,7 @@ int main(int argc, char **argv)
 	if (!con.mode) {
 		fprintf(stderr, "failed to find usable connector\n");
 		ret = -EFAULT;
-		goto err_drm_close;
+		goto err_dev_destory;
 	}
 
 	screen_width = con.mode->hdisplay;
@@ -784,7 +785,7 @@ int main(int argc, char **argv)
 	if (screen_width == 0 || screen_height == 0) {
 		fprintf(stderr, "failed to find sane resolution on connector\n");
 		ret = -EFAULT;
-		goto err_drm_close;
+		goto err_dev_destory;
 	}
 
 	printf("screen width = %d, screen height = %d\n", screen_width,
@@ -793,7 +794,7 @@ int main(int argc, char **argv)
 	bo = exynos_create_buffer(dev, screen_width * screen_height * 4, 0);
 	if (!bo) {
 		ret = -EFAULT;
-		goto err_drm_close;
+		goto err_dev_destory;
 	}
 
 	handles[0] = bo->handle;
@@ -884,9 +885,11 @@ err_rm_fb:
 err_destroy_buffer:
 	exynos_destroy_buffer(bo);
 
-err_drm_close:
-	drmClose(dev->fd);
+err_dev_destory:
 	exynos_device_destroy(dev);
 
-	return 0;
+err_drm_close:
+	drmClose(fd);
+
+	return ret;
 }
commit a398adba7c845fe248ab1e5c338789ca2882644b
Author: Seung-Woo Kim <[email protected]>
Date:   Fri Mar 31 12:30:57 2017 +0900

    tests/exynos: remove unused-function build warning
    
    The function g2d_blend_test() is blocked to call because of
    feature unsafety. This patch blocks with proper feature name
    and also blocks the function itself to remove build warning.
    
    Signed-off-by: Seung-Woo Kim <[email protected]>
    Reviewed-by: Emil Velikov <[email protected]>

diff --git a/tests/exynos/exynos_fimg2d_test.c b/tests/exynos/exynos_fimg2d_test.c
index 797fb6eb..3495c626 100644
--- a/tests/exynos/exynos_fimg2d_test.c
+++ b/tests/exynos/exynos_fimg2d_test.c
@@ -523,6 +523,7 @@ fail:
 	return 0;
 }
 
+#if EXYNOS_G2D_USERPTR_TEST
 static int g2d_blend_test(struct exynos_device *dev,
 					struct exynos_bo *src,
 					struct exynos_bo *dst,
@@ -621,6 +622,7 @@ fail:
 
 	return 0;
 }
+#endif
 
 static int g2d_checkerboard_test(struct exynos_device *dev,
 					struct exynos_bo *src,
@@ -864,7 +866,7 @@ int main(int argc, char **argv)
 	 *
 	 * Disable the test for now, until the kernel code has been sanitized.
 	 */
-#if 0
+#if EXYNOS_G2D_USERPTR_TEST
 	ret  = g2d_blend_test(dev, src, bo, G2D_IMGBUF_USERPTR);
 	if (ret < 0)
 		fprintf(stderr, "failed to test blend operation.\n");
commit 762be6c2102de0ec99659838a1423c4a131432ff
Author: Seung-Woo Kim <[email protected]>
Date:   Fri Mar 31 12:30:56 2017 +0900

    exynos/fimg2d: remove unused-function build warning
    
    The function g2d_reset() is not anymore used after the commit
    e3c97d1a2473 ("exynos/fimg2d: add g2d_validate_xyz() functions"),
    so it should be removed.
    
    Signed-off-by: Seung-Woo Kim <[email protected]>
    Reviewed-by: Tobias Jakobi <[email protected]>
    Reviewed-by: Emil Velikov <[email protected]>

diff --git a/exynos/exynos_fimg2d.c b/exynos/exynos_fimg2d.c
index 7f1d105a..61340c36 100644
--- a/exynos/exynos_fimg2d.c
+++ b/exynos/exynos_fimg2d.c
@@ -293,20 +293,6 @@ static void g2d_set_direction(struct g2d_context *ctx,
 }
 
 /*
- * g2d_reset - reset fimg2d hardware.
- *
- * @ctx: a pointer to g2d_context structure.
- *
- */
-static void g2d_reset(struct g2d_context *ctx)
-{
-	ctx->cmd_nr = 0;
-	ctx->cmd_buf_nr = 0;
-
-	g2d_add_cmd(ctx, SOFT_RESET_REG, 0x01);
-}
-
-/*
  * g2d_flush - submit all commands and values in user side command buffer
  *		to command queue aware of fimg2d dma.
  *
commit c9ef5c4a1c691ebcdfa4261b406b8b81f7b5a18f
Author: Seung-Woo Kim <[email protected]>
Date:   Fri Mar 31 12:30:55 2017 +0900

    exynos: fix type-punned pointer build warning
    
    As like the commit ecc2a097294d ("xf86drm: Fix type-punned pointer
    build warning"), this fixes following build warning.
    
       exynos_drm.c: In function 'exynos_handle_event':
       exynos_drm.c:420:15: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
          e = (struct drm_event *) &buffer[i];
                      ^
    
    Signed-off-by: Seung-Woo Kim <[email protected]>
    Reviewed-by: Tobias Jakobi <[email protected]>
    Reviewed-by: Emil Velikov <[email protected]>

diff --git a/exynos/exynos_drm.c b/exynos/exynos_drm.c
index b961e520..f6204f1c 100644
--- a/exynos/exynos_drm.c
+++ b/exynos/exynos_drm.c
@@ -417,7 +417,7 @@ exynos_handle_event(struct exynos_device *dev, struct exynos_event_context *ctx)
 
 	i = 0;
 	while (i < len) {
-		e = (struct drm_event *) &buffer[i];
+		e = (struct drm_event *)(buffer + i);
 		switch (e->type) {
 		case DRM_EVENT_VBLANK:
 			if (evctx->version < 1 ||
commit f5995751b0722bdd3789b1afb48b86d8f075b1e7
Author: Emil Velikov <[email protected]>
Date:   Mon Apr 3 17:40:59 2017 +0100

    amdgpu: add amdgpu_bo_va_op_raw to the symbol check
    
    Otherwise the make check will rightfully fail.
    
    Fixes: 4e369f25a94 ("amdgpu: add amdgpu_bo_va_op_raw")
    Signed-off-by: Emil Velikov <[email protected]>

diff --git a/amdgpu/amdgpu-symbol-check b/amdgpu/amdgpu-symbol-check
index 87f4fd2c..8e06474d 100755
--- a/amdgpu/amdgpu-symbol-check
+++ b/amdgpu/amdgpu-symbol-check
@@ -22,6 +22,7 @@ amdgpu_bo_list_update
 amdgpu_bo_query_info
 amdgpu_bo_set_metadata
 amdgpu_bo_va_op
+amdgpu_bo_va_op_raw
 amdgpu_bo_wait_for_idle
 amdgpu_create_bo_from_user_mem
 amdgpu_cs_create_semaphore

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

--
_______________________________________________
Dri-patches mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dri-patches
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.